Lines Matching defs:tx

43 static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
49 struct ieee80211_local *local = tx->local;
55 if (tx->rate.flags & (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
59 if (WARN_ON_ONCE(tx->rate.idx < 0))
66 txrate = &sband->bitrates[tx->rate.idx];
137 if (tx->sdata->vif.bss_conf.basic_rates & BIT(i))
143 if (tx->sdata->deflink.operating_11g_mode)
176 tx->sdata->vif.bss_conf.use_short_preamble);
185 tx->sdata->vif.bss_conf.use_short_preamble);
191 /* tx handlers */
193 ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
195 struct ieee80211_local *local = tx->local;
197 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
223 if (tx->sdata->vif.type != NL80211_IFTYPE_STATION)
229 ifmgd = &tx->sdata->u.mgd;
246 skb_get_queue_mapping(tx->skb) == IEEE80211_AC_VO)
270 ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
273 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
274 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
280 if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) &&
281 test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) &&
294 if (tx->sdata->vif.type == NL80211_IFTYPE_OCB)
297 if (tx->flags & IEEE80211_TX_PS_BUFFERED)
300 if (tx->sta)
301 assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
303 if (likely(tx->flags & IEEE80211_TX_UNICAST)) {
307 sdata_info(tx->sdata,
311 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
315 ieee80211_vif_get_num_mcast_if(tx->sdata) == 0)) {
378 ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
380 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
381 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
393 if (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
394 tx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
395 if (!tx->sdata->bss)
398 ps = &tx->sdata->bss->ps;
399 } else if (ieee80211_vif_is_mesh(&tx->sdata->vif)) {
400 ps = &tx->sdata->u.mesh.ps;
413 if (ieee80211_hw_check(&tx->local->hw, QUEUE_CONTROL))
414 info->hw_queue = tx->sdata->vif.cab_queue;
423 if (!ieee80211_hw_check(&tx->local->hw, HOST_BROADCAST_PS_BUFFERING))
427 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
428 purge_old_ps_buffers(tx->local);
431 ps_dbg(tx->sdata,
433 ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
435 tx->local->total_ps_buffered++;
437 skb_queue_tail(&ps->bc_buf, tx->skb);
458 ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
460 struct sta_info *sta = tx->sta;
461 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
462 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
463 struct ieee80211_local *local = tx->local;
472 int ac = skb_get_queue_mapping(tx->skb);
475 !ieee80211_is_bufferable_mmpdu(tx->skb)) {
482 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
483 purge_old_ps_buffers(tx->local);
501 ps_dbg(tx->sdata,
506 tx->local->total_ps_buffered++;
509 info->control.vif = &tx->sdata->vif;
512 skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb);
528 ps_dbg(tx->sdata,
537 ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
539 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
542 if (tx->flags & IEEE80211_TX_UNICAST)
543 return ieee80211_tx_h_unicast_ps_buf(tx);
545 return ieee80211_tx_h_multicast_ps_buf(tx);
549 ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
551 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
553 if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol)) {
554 if (tx->sdata->control_port_no_encrypt)
564 ieee80211_select_link_key(struct ieee80211_tx_data *tx)
566 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
567 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
573 link = &tx->sdata->deflink;
575 link = rcu_dereference(tx->sdata->link[link_id]);
580 if (ieee80211_is_group_privacy_action(tx->skb))
584 ieee80211_is_robust_mgmt_frame(tx->skb))
593 ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
596 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
597 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
600 tx->key = NULL;
604 if (tx->sta &&
605 (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
606 tx->key = key;
607 else if ((key = ieee80211_select_link_key(tx)))
608 tx->key = key;
610 (key = rcu_dereference(tx->sdata->default_unicast_key)))
611 tx->key = key;
613 tx->key = NULL;
616 if (tx->key && tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
617 info->control.hw_key = &tx->key->conf;
621 if (tx->key) {
626 switch (tx->key->conf.cipher) {
631 tx->key = NULL;
638 !ieee80211_use_mfp(hdr->frame_control, tx->sta,
639 tx->skb) &&
640 !ieee80211_is_group_privacy_action(tx->skb) &&
642 tx->sta))
643 tx->key = NULL;
645 skip_hw = (tx->key->conf.flags &
654 tx->key = NULL;
658 if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED &&
660 tx->skb->protocol != tx->sdata->control_port_protocol)
663 if (!skip_hw && tx->key &&
664 tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
665 info->control.hw_key = &tx->key->conf;
666 } else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta &&
667 test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
675 ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
677 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
678 struct ieee80211_hdr *hdr = (void *)tx->skb->data;
689 sband = tx->local->hw.wiphy->bands[info->band];
693 len = min_t(u32, tx->skb->len + FCS_LEN,
694 tx->local->hw.wiphy->frag_threshold);
696 /* set up the tx rate control struct we give the RC algo */
697 txrc.hw = &tx->local->hw;
699 txrc.bss_conf = &tx->sdata->vif.bss_conf;
700 txrc.skb = tx->skb;
706 txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band];
708 if (tx->sdata->rc_has_mcs_mask[info->band])
710 tx->sdata->rc_rateidx_mcs_mask[info->band];
713 txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
714 tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
715 tx->sdata->vif.type == NL80211_IFTYPE_ADHOC ||
716 tx->sdata->vif.type == NL80211_IFTYPE_OCB);
719 if (len > tx->local->hw.wiphy->rts_threshold) {
724 info->control.use_cts_prot = tx->sdata->vif.bss_conf.use_cts_prot;
732 if (tx->sdata->vif.bss_conf.use_short_preamble &&
733 (ieee80211_is_tx_data(tx->skb) ||
734 (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
743 if (tx->sta)
744 assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
750 if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc &&
751 !rate_usable_index_exists(sband, &tx->sta->sta),
755 tx->sdata->name,
764 rate_control_get_rate(tx->sdata, tx->sta, &txrc);
766 if (tx->sta && !info->control.skip_table)
767 ratetbl = rcu_dereference(tx->sta->sta.rates);
780 tx->rate = rate;
785 tx->rate = info->control.rates[0];
789 txrc.reported_rate = tx->rate;
790 if (tx->sta && ieee80211_is_tx_data(tx->skb))
791 tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
792 } else if (tx->sta)
793 tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
820 ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
822 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
823 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
851 tx->sdata->mld_mcast_seq += 0x10;
852 hdr->seq_ctrl = cpu_to_le16(tx->sdata->mld_mcast_seq);
867 hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number);
868 tx->sdata->sequence_number += 0x10;
869 if (tx->sta)
870 tx->sta->deflink.tx_stats.msdu[IEEE80211_NUM_TIDS]++;
879 if (!tx->sta)
884 tx->sta->deflink.tx_stats.msdu[tid]++;
886 hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
891 static int ieee80211_fragment(struct ieee80211_tx_data *tx,
895 struct ieee80211_local *local = tx->local;
920 __skb_queue_tail(&tx->skbs, tmp);
952 ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
954 struct sk_buff *skb = tx->skb;
957 int frag_threshold = tx->local->hw.wiphy->frag_threshold;
961 /* no matter what happens, tx->skb moves to tx->skbs */
962 __skb_queue_tail(&tx->skbs, skb);
963 tx->skb = NULL;
968 if (ieee80211_hw_check(&tx->local->hw, SUPPORTS_TX_FRAG))
993 if (ieee80211_fragment(tx, skb, hdrlen, frag_threshold))
999 skb_queue_walk(&tx->skbs, skb) {
1005 if (!skb_queue_is_last(&tx->skbs, skb)) {
1027 ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
1032 if (!tx->sta)
1035 skb_queue_walk(&tx->skbs, skb) {
1037 tx->sta->deflink.tx_stats.bytes[ac] += skb->len;
1040 tx->sta->deflink.tx_stats.packets[ac]++;
1046 ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
1048 if (!tx->key)
1051 switch (tx->key->conf.cipher) {
1054 return ieee80211_crypto_wep_encrypt(tx);
1056 return ieee80211_crypto_tkip_encrypt(tx);
1059 tx, IEEE80211_CCMP_MIC_LEN);
1062 tx, IEEE80211_CCMP_256_MIC_LEN);
1065 tx, IEEE80211_CMAC_128_MIC_LEN);
1068 tx, IEEE80211_CMAC_256_MIC_LEN);
1071 return ieee80211_crypto_aes_gmac_encrypt(tx);
1074 return ieee80211_crypto_gcmp_encrypt(tx);
1081 ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
1088 skb_queue_walk(&tx->skbs, skb) {
1092 if (!skb_queue_is_last(&tx->skbs, skb)) {
1093 struct sk_buff *next = skb_queue_next(&tx->skbs, skb);
1100 ieee80211_duration(tx, skb, group_addr, next_len);
1108 static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1125 } else if (!tx->sta->sta.txq[tid]) {
1126 spin_lock(&tx->sta->lock);
1145 tid_tx = rcu_dereference_protected_tid_tx(tx->sta, tid);
1154 clear_sta_flag(tx->sta, WLAN_STA_SP);
1155 ps_dbg(tx->sta->sdata,
1157 tx->sta->sta.addr, tx->sta->sta.aid);
1159 info->control.vif = &tx->sdata->vif;
1166 spin_unlock(&tx->sta->lock);
1169 ieee80211_free_txskb(&tx->local->hw, purge_skb);
1203 * initialises @tx
1209 struct ieee80211_tx_data *tx,
1218 memset(tx, 0, sizeof(*tx));
1219 tx->skb = skb;
1220 tx->local = local;
1221 tx->sdata = sdata;
1222 __skb_queue_head_init(&tx->skbs);
1235 tx->sta = sta;
1238 tx->sta = rcu_dereference(sdata->u.vlan.sta);
1239 if (!tx->sta && sdata->wdev.use_4addr)
1241 } else if (tx->sdata->control_port_protocol == tx->skb->protocol) {
1242 tx->sta = sta_info_get_bss(sdata, hdr->addr1);
1244 if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) {
1245 tx->sta = sta_info_get(sdata, hdr->addr1);
1250 if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
1257 tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1259 ieee80211_aggr_check(sdata, tx->sta, skb);
1260 tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1266 queued = ieee80211_tx_prep_agg(tx, skb, info,
1275 tx->flags &= ~IEEE80211_TX_UNICAST;
1278 tx->flags |= IEEE80211_TX_UNICAST;
1281 if (!(tx->flags & IEEE80211_TX_UNICAST) ||
1287 if (!tx->sta)
1289 else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
1291 ieee80211_check_fast_xmit(tx->sta);
1725 * later transmission from the tx-pending
1816 static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
1822 res = txh(tx); \
1835 tx->sdata->tx_handlers_drop++;
1836 if (tx->skb)
1837 ieee80211_free_txskb(&tx->local->hw, tx->skb);
1839 ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1842 I802_DEBUG_INC(tx->local->tx_handlers_queued);
1853 static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx)
1855 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
1858 if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1862 __skb_queue_tail(&tx->skbs, tx->skb);
1863 tx->skb = NULL;
1870 /* handlers after fragment must be aware of tx info fragmentation! */
1873 if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1879 tx->sdata->tx_handlers_drop++;
1880 if (tx->skb)
1881 ieee80211_free_txskb(&tx->local->hw, tx->skb);
1883 ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1886 I802_DEBUG_INC(tx->local->tx_handlers_queued);
1893 static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
1895 int r = invoke_tx_handlers_early(tx);
1899 return invoke_tx_handlers_late(tx);
1908 struct ieee80211_tx_data tx;
1911 if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP) {
1920 if (invoke_tx_handlers(&tx))
1924 if (tx.sta)
1925 *sta = &tx.sta->sta;
1931 skb2 = __skb_dequeue(&tx.skbs);
1932 if (WARN_ON(skb2 != skb || !skb_queue_empty(&tx.skbs))) {
1934 ieee80211_purge_tx_queue(hw, &tx.skbs);
1950 struct ieee80211_tx_data tx;
1960 /* initialises tx */
1961 res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
1965 tx.sdata->tx_handlers_drop++;
1977 if (invoke_tx_handlers_early(&tx))
1980 if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
1983 if (!invoke_tx_handlers_late(&tx))
1984 result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
3091 * key and the fast-tx assignment are done atomically, so the CPU that
3594 struct ieee80211_tx_data *tx)
3596 struct sk_buff *skb = tx->skb;
3601 if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL) &&
3602 ieee80211_tx_h_rate_ctrl(tx) != TX_CONTINUE)
3718 struct ieee80211_tx_data tx;
3767 __skb_queue_head_init(&tx.skbs);
3769 tx.flags = IEEE80211_TX_UNICAST;
3770 tx.local = local;
3771 tx.sdata = sdata;
3772 tx.sta = sta;
3773 tx.key = fast_tx->key;
3778 tx.skb = skb;
3780 fast_tx->key, &tx);
3781 tx.skb = NULL;
3783 tx.sdata->tx_handlers_drop++;
3791 __skb_queue_tail(&tx.skbs, skb);
3792 ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false);
3860 struct ieee80211_tx_data tx;
3908 memset(&tx, 0, sizeof(tx));
3909 __skb_queue_head_init(&tx.skbs);
3910 tx.local = local;
3911 tx.skb = skb;
3912 tx.sdata = vif_to_sdata(info->control.vif);
3915 tx.sta = container_of(txq->sta, struct sta_info, sta);
3922 !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
3923 tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
3925 !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
3928 !ieee80211_is_our_addr(tx.sdata, hdr->addr2,
3941 r = ieee80211_tx_h_select_key(&tx);
3953 r = ieee80211_tx_h_rate_ctrl(&tx);
3967 if (tx.key &&
3968 (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
3972 tx.key, &tx);
3978 if (invoke_tx_handlers_late(&tx))
3981 skb = __skb_dequeue(&tx.skbs);
3984 if (!skb_queue_empty(&tx.skbs)) {
3986 skb_queue_splice_tail(&tx.skbs, &txqi->frags);
3999 switch (tx.sdata->vif.type) {
4001 if ((tx.sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) ||
4003 vif = &tx.sdata->vif;
4006 tx.sdata = rcu_dereference(local->monitor_sdata);
4007 if (tx.sdata &&
4009 vif = &tx.sdata->vif;
4021 tx.sdata = container_of(tx.sdata->bss,
4025 vif = &tx.sdata->vif;
4032 if (tx.sta &&
4041 ieee80211_sta_update_pending_airtime(local, tx.sta,
4786 struct ieee80211_tx_data tx = {
4806 tx.sta = sta_info_get(sdata, hdr->addr1);
4807 tx.skb = skb;
4809 if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) {
5326 struct ieee80211_tx_data tx;
5329 memset(&tx, 0, sizeof(tx));
5330 tx.key = rcu_dereference(link->default_beacon_key);
5331 if (!tx.key)
5334 if (unlikely(tx.key->flags & KEY_FLAG_TAINTED)) {
5335 tx.key = NULL;
5339 if (!(tx.key->conf.flags & IEEE80211_KEY_FLAG_SW_MGMT_TX) &&
5340 tx.key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
5341 IEEE80211_SKB_CB(skb)->control.hw_key = &tx.key->conf;
5343 tx.local = local;
5344 tx.sdata = sdata;
5345 __skb_queue_head_init(&tx.skbs);
5346 __skb_queue_tail(&tx.skbs, skb);
5347 res = ieee80211_tx_h_encrypt(&tx);
5348 check_skb = __skb_dequeue(&tx.skbs);
5362 struct ieee80211_tx_data tx;
5368 memset(&tx, 0, sizeof(tx));
5369 tx.key = container_of(info->control.hw_key, struct ieee80211_key, conf);
5372 __skb_queue_head_init(&tx.skbs);
5373 __skb_queue_tail(&tx.skbs, skb);
5376 tx.sdata = sdata;
5377 tx.local = sdata->local;
5378 res = ieee80211_tx_h_encrypt(&tx);
5379 check_skb = __skb_dequeue(&tx.skbs);
6159 struct ieee80211_tx_data tx;
6208 if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
6215 tx.flags |= IEEE80211_TX_PS_BUFFERED;
6218 if (invoke_tx_handlers(&tx))
6367 * requirements are that we do not come into tx with bhs on.