Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'wireless-2023-01-12' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless

Johannes Berg says:

====================
Some fixes, stack only for now:
* iTXQ conversion fixes, various bugs reported
* properly reset multiple BSSID settings
* fix for a link_sta crash
* fix for AP VLAN checks
* fix for MLO address translation

* tag 'wireless-2023-01-12' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
wifi: mac80211: fix MLO + AP_VLAN check
mac80211: Fix MLO address translation for multiple bss case
wifi: mac80211: reset multiple BSSID options in stop_ap()
wifi: mac80211: Fix iTXQ AMPDU fragmentation handling
wifi: mac80211: sdata can be NULL during AMPDU start
wifi: mac80211: Proper mark iTXQs for resumption
wifi: mac80211: fix initialization of rx->link and rx->link_sta
====================

Link: https://lore.kernel.org/r/20230112111941.82408-1-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+176 -191
-4
include/net/mac80211.h
··· 1832 1832 * @drv_priv: data area for driver use, will always be aligned to 1833 1833 * sizeof(void \*). 1834 1834 * @txq: the multicast data TX queue 1835 - * @txqs_stopped: per AC flag to indicate that intermediate TXQs are stopped, 1836 - * protected by fq->lock. 1837 1835 * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see 1838 1836 * &enum ieee80211_offload_flags. 1839 1837 * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled. ··· 1860 1862 1861 1863 bool probe_req_reg; 1862 1864 bool rx_mcast_action_reg; 1863 - 1864 - bool txqs_stopped[IEEE80211_NUM_ACS]; 1865 1865 1866 1866 struct ieee80211_vif *mbssid_tx_vif; 1867 1867
+5 -3
net/mac80211/agg-tx.c
··· 491 491 { 492 492 struct tid_ampdu_tx *tid_tx; 493 493 struct ieee80211_local *local = sta->local; 494 - struct ieee80211_sub_if_data *sdata = sta->sdata; 494 + struct ieee80211_sub_if_data *sdata; 495 495 struct ieee80211_ampdu_params params = { 496 496 .sta = &sta->sta, 497 497 .action = IEEE80211_AMPDU_TX_START, ··· 511 511 */ 512 512 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); 513 513 514 - ieee80211_agg_stop_txq(sta, tid); 515 - 516 514 /* 517 515 * Make sure no packets are being processed. This ensures that 518 516 * we have a valid starting sequence number and that in-flight ··· 519 521 */ 520 522 synchronize_net(); 521 523 524 + sdata = sta->sdata; 522 525 params.ssn = sta->tid_seq[tid] >> 4; 523 526 ret = drv_ampdu_action(local, sdata, &params); 524 527 tid_tx->ssn = params.ssn; ··· 533 534 */ 534 535 set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state); 535 536 } else if (ret) { 537 + if (!sdata) 538 + return; 539 + 536 540 ht_dbg(sdata, 537 541 "BA request denied - HW unavailable for %pM tid %d\n", 538 542 sta->sta.addr, tid);
+7
net/mac80211/cfg.c
··· 147 147 link_conf->bssid_index = 0; 148 148 link_conf->nontransmitted = false; 149 149 link_conf->ema_ap = false; 150 + link_conf->bssid_indicator = 0; 150 151 151 152 if (sdata->vif.type != NL80211_IFTYPE_AP || !params.tx_wdev) 152 153 return -EINVAL; ··· 1511 1510 1512 1511 kfree(link_conf->ftmr_params); 1513 1512 link_conf->ftmr_params = NULL; 1513 + 1514 + sdata->vif.mbssid_tx_vif = NULL; 1515 + link_conf->bssid_index = 0; 1516 + link_conf->nontransmitted = false; 1517 + link_conf->ema_ap = false; 1518 + link_conf->bssid_indicator = 0; 1514 1519 1515 1520 __sta_info_flush(sdata, true); 1516 1521 ieee80211_free_keys(sdata, true);
+3 -2
net/mac80211/debugfs_sta.c
··· 167 167 continue; 168 168 txqi = to_txq_info(sta->sta.txq[i]); 169 169 p += scnprintf(p, bufsz + buf - p, 170 - "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s)\n", 170 + "%d %d %u %u %u %u %u %u %u %u %u 0x%lx(%s%s%s%s)\n", 171 171 txqi->txq.tid, 172 172 txqi->txq.ac, 173 173 txqi->tin.backlog_bytes, ··· 182 182 txqi->flags, 183 183 test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ? "STOP" : "RUN", 184 184 test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags) ? " AMPDU" : "", 185 - test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : ""); 185 + test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags) ? " NO-AMSDU" : "", 186 + test_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) ? " DIRTY" : ""); 186 187 } 187 188 188 189 rcu_read_unlock();
+3
net/mac80211/driver-ops.c
··· 392 392 393 393 might_sleep(); 394 394 395 + if (!sdata) 396 + return -EIO; 397 + 395 398 sdata = get_bss_sdata(sdata); 396 399 if (!check_sdata_in_driver(sdata)) 397 400 return -EIO;
+1 -1
net/mac80211/driver-ops.h
··· 1199 1199 1200 1200 /* In reconfig don't transmit now, but mark for waking later */ 1201 1201 if (local->in_reconfig) { 1202 - set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags); 1202 + set_bit(IEEE80211_TXQ_DIRTY, &txq->flags); 1203 1203 return; 1204 1204 } 1205 1205
+31
net/mac80211/ht.c
··· 391 391 392 392 tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; 393 393 if (!blocked && tid_tx) { 394 + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); 395 + struct ieee80211_sub_if_data *sdata = 396 + vif_to_sdata(txqi->txq.vif); 397 + struct fq *fq = &sdata->local->fq; 398 + 399 + spin_lock_bh(&fq->lock); 400 + 401 + /* Allow only frags to be dequeued */ 402 + set_bit(IEEE80211_TXQ_STOP, &txqi->flags); 403 + 404 + if (!skb_queue_empty(&txqi->frags)) { 405 + /* Fragmented Tx is ongoing, wait for it to 406 + * finish. Reschedule worker to retry later. 407 + */ 408 + 409 + spin_unlock_bh(&fq->lock); 410 + spin_unlock_bh(&sta->lock); 411 + 412 + /* Give the task working on the txq a chance 413 + * to send out the queued frags 414 + */ 415 + synchronize_net(); 416 + 417 + mutex_unlock(&sta->ampdu_mlme.mtx); 418 + 419 + ieee80211_queue_work(&sdata->local->hw, work); 420 + return; 421 + } 422 + 423 + spin_unlock_bh(&fq->lock); 424 + 394 425 /* 395 426 * Assign it over to the normal tid_tx array 396 427 * where it "goes live".
+1 -1
net/mac80211/ieee80211_i.h
··· 838 838 IEEE80211_TXQ_STOP, 839 839 IEEE80211_TXQ_AMPDU, 840 840 IEEE80211_TXQ_NO_AMSDU, 841 - IEEE80211_TXQ_STOP_NETIF_TX, 841 + IEEE80211_TXQ_DIRTY, 842 842 }; 843 843 844 844 /**
+3 -1
net/mac80211/iface.c
··· 364 364 365 365 /* No support for VLAN with MLO yet */ 366 366 if (iftype == NL80211_IFTYPE_AP_VLAN && 367 - nsdata->wdev.use_4addr) 367 + sdata->wdev.use_4addr && 368 + nsdata->vif.type == NL80211_IFTYPE_AP && 369 + nsdata->vif.valid_links) 368 370 return -EOPNOTSUPP; 369 371 370 372 /*
+102 -123
net/mac80211/rx.c
··· 4049 4049 #undef CALL_RXH 4050 4050 } 4051 4051 4052 + static bool 4053 + ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id) 4054 + { 4055 + if (!sta->mlo) 4056 + return false; 4057 + 4058 + return !!(sta->valid_links & BIT(link_id)); 4059 + } 4060 + 4061 + static bool ieee80211_rx_data_set_link(struct ieee80211_rx_data *rx, 4062 + u8 link_id) 4063 + { 4064 + rx->link_id = link_id; 4065 + rx->link = rcu_dereference(rx->sdata->link[link_id]); 4066 + 4067 + if (!rx->sta) 4068 + return rx->link; 4069 + 4070 + if (!ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta, link_id)) 4071 + return false; 4072 + 4073 + rx->link_sta = rcu_dereference(rx->sta->link[link_id]); 4074 + 4075 + return rx->link && rx->link_sta; 4076 + } 4077 + 4078 + static bool ieee80211_rx_data_set_sta(struct ieee80211_rx_data *rx, 4079 + struct ieee80211_sta *pubsta, 4080 + int link_id) 4081 + { 4082 + struct sta_info *sta; 4083 + 4084 + sta = container_of(pubsta, struct sta_info, sta); 4085 + 4086 + rx->link_id = link_id; 4087 + rx->sta = sta; 4088 + 4089 + if (sta) { 4090 + rx->local = sta->sdata->local; 4091 + if (!rx->sdata) 4092 + rx->sdata = sta->sdata; 4093 + rx->link_sta = &sta->deflink; 4094 + } 4095 + 4096 + if (link_id < 0) 4097 + rx->link = &rx->sdata->deflink; 4098 + else if (!ieee80211_rx_data_set_link(rx, link_id)) 4099 + return false; 4100 + 4101 + return true; 4102 + } 4103 + 4052 4104 /* 4053 4105 * This function makes calls into the RX path, therefore 4054 4106 * it has to be invoked under RCU read lock. ··· 4109 4057 { 4110 4058 struct sk_buff_head frames; 4111 4059 struct ieee80211_rx_data rx = { 4112 - .sta = sta, 4113 - .sdata = sta->sdata, 4114 - .local = sta->local, 4115 4060 /* This is OK -- must be QoS data frame */ 4116 4061 .security_idx = tid, 4117 4062 .seqno_idx = tid, 4118 - .link_id = -1, 4119 4063 }; 4120 4064 struct tid_ampdu_rx *tid_agg_rx; 4121 - u8 link_id; 4065 + int link_id = -1; 4066 + 4067 + /* FIXME: statistics won't be right with this */ 4068 + if (sta->sta.valid_links) 4069 + link_id = ffs(sta->sta.valid_links) - 1; 4070 + 4071 + if (!ieee80211_rx_data_set_sta(&rx, &sta->sta, link_id)) 4072 + return; 4122 4073 4123 4074 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); 4124 4075 if (!tid_agg_rx) ··· 4141 4086 }; 4142 4087 drv_event_callback(rx.local, rx.sdata, &event); 4143 4088 } 4144 - /* FIXME: statistics won't be right with this */ 4145 - link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0; 4146 - rx.link = rcu_dereference(sta->sdata->link[link_id]); 4147 - rx.link_sta = rcu_dereference(sta->link[link_id]); 4148 4089 4149 4090 ieee80211_rx_handlers(&rx, &frames); 4150 4091 } ··· 4156 4105 /* This is OK -- must be QoS data frame */ 4157 4106 .security_idx = tid, 4158 4107 .seqno_idx = tid, 4159 - .link_id = -1, 4160 4108 }; 4161 4109 int i, diff; 4162 4110 ··· 4166 4116 4167 4117 sta = container_of(pubsta, struct sta_info, sta); 4168 4118 4169 - rx.sta = sta; 4170 - rx.sdata = sta->sdata; 4171 - rx.link = &rx.sdata->deflink; 4172 - rx.local = sta->local; 4119 + if (!ieee80211_rx_data_set_sta(&rx, pubsta, -1)) 4120 + return; 4173 4121 4174 4122 rcu_read_lock(); 4175 4123 tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); ··· 4554 4506 mutex_unlock(&local->sta_mtx); 4555 4507 } 4556 4508 4557 - static bool 4558 - ieee80211_rx_is_valid_sta_link_id(struct ieee80211_sta *sta, u8 link_id) 4559 - { 4560 - if (!sta->mlo) 4561 - return false; 4562 - 4563 - return !!(sta->valid_links & BIT(link_id)); 4564 - } 4565 - 4566 4509 static void ieee80211_rx_8023(struct ieee80211_rx_data *rx, 4567 4510 struct ieee80211_fast_rx *fast_rx, 4568 4511 int orig_len) ··· 4664 4625 struct sk_buff *skb = rx->skb; 4665 4626 struct ieee80211_hdr *hdr = (void *)skb->data; 4666 4627 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4667 - struct sta_info *sta = rx->sta; 4668 4628 int orig_len = skb->len; 4669 4629 int hdrlen = ieee80211_hdrlen(hdr->frame_control); 4670 4630 int snap_offs = hdrlen; ··· 4675 4637 u8 da[ETH_ALEN]; 4676 4638 u8 sa[ETH_ALEN]; 4677 4639 } addrs __aligned(2); 4678 - struct link_sta_info *link_sta; 4679 4640 struct ieee80211_sta_rx_stats *stats; 4680 4641 4681 4642 /* for parallel-rx, we need to have DUP_VALIDATED, otherwise we write ··· 4777 4740 drop: 4778 4741 dev_kfree_skb(skb); 4779 4742 4780 - if (rx->link_id >= 0) { 4781 - link_sta = rcu_dereference(sta->link[rx->link_id]); 4782 - if (!link_sta) 4783 - return true; 4784 - } else { 4785 - link_sta = &sta->deflink; 4786 - } 4787 - 4788 4743 if (fast_rx->uses_rss) 4789 - stats = this_cpu_ptr(link_sta->pcpu_rx_stats); 4744 + stats = this_cpu_ptr(rx->link_sta->pcpu_rx_stats); 4790 4745 else 4791 - stats = &link_sta->rx_stats; 4746 + stats = &rx->link_sta->rx_stats; 4792 4747 4793 4748 stats->dropped++; 4794 4749 return true; ··· 4798 4769 struct ieee80211_local *local = rx->local; 4799 4770 struct ieee80211_sub_if_data *sdata = rx->sdata; 4800 4771 struct ieee80211_hdr *hdr = (void *)skb->data; 4801 - struct link_sta_info *link_sta = NULL; 4802 - struct ieee80211_link_data *link; 4772 + struct link_sta_info *link_sta = rx->link_sta; 4773 + struct ieee80211_link_data *link = rx->link; 4803 4774 4804 4775 rx->skb = skb; 4805 4776 ··· 4821 4792 if (!ieee80211_accept_frame(rx)) 4822 4793 return false; 4823 4794 4824 - if (rx->link_id >= 0) { 4825 - link = rcu_dereference(rx->sdata->link[rx->link_id]); 4826 - 4827 - /* we might race link removal */ 4828 - if (!link) 4829 - return true; 4830 - rx->link = link; 4831 - 4832 - if (rx->sta) { 4833 - rx->link_sta = 4834 - rcu_dereference(rx->sta->link[rx->link_id]); 4835 - if (!rx->link_sta) 4836 - return true; 4837 - } 4838 - } else { 4839 - if (rx->sta) 4840 - rx->link_sta = &rx->sta->deflink; 4841 - 4842 - rx->link = &sdata->deflink; 4843 - } 4844 - 4845 - if (unlikely(!is_multicast_ether_addr(hdr->addr1) && 4846 - rx->link_id >= 0 && rx->sta && rx->sta->sta.mlo)) { 4847 - link_sta = rcu_dereference(rx->sta->link[rx->link_id]); 4848 - 4849 - if (WARN_ON_ONCE(!link_sta)) 4850 - return true; 4851 - } 4852 - 4853 4795 if (!consume) { 4854 4796 struct skb_shared_hwtstamps *shwt; 4855 4797 ··· 4838 4838 */ 4839 4839 shwt = skb_hwtstamps(rx->skb); 4840 4840 shwt->hwtstamp = skb_hwtstamps(skb)->hwtstamp; 4841 + 4842 + /* Update the hdr pointer to the new skb for translation below */ 4843 + hdr = (struct ieee80211_hdr *)rx->skb->data; 4841 4844 } 4842 4845 4843 - if (unlikely(link_sta)) { 4846 + if (unlikely(rx->sta && rx->sta->sta.mlo)) { 4844 4847 /* translate to MLD addresses */ 4845 4848 if (ether_addr_equal(link->conf->addr, hdr->addr1)) 4846 4849 ether_addr_copy(hdr->addr1, rx->sdata->vif.addr); ··· 4873 4870 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4874 4871 struct ieee80211_fast_rx *fast_rx; 4875 4872 struct ieee80211_rx_data rx; 4873 + int link_id = -1; 4876 4874 4877 4875 memset(&rx, 0, sizeof(rx)); 4878 4876 rx.skb = skb; ··· 4890 4886 if (!pubsta) 4891 4887 goto drop; 4892 4888 4893 - rx.sta = container_of(pubsta, struct sta_info, sta); 4894 - rx.sdata = rx.sta->sdata; 4895 - 4896 - if (status->link_valid && 4897 - !ieee80211_rx_is_valid_sta_link_id(pubsta, status->link_id)) 4898 - goto drop; 4889 + if (status->link_valid) 4890 + link_id = status->link_id; 4899 4891 4900 4892 /* 4901 4893 * TODO: Should the frame be dropped if the right link_id is not ··· 4900 4900 * link_id is used only for stats purpose and updating the stats on 4901 4901 * the deflink is fine? 4902 4902 */ 4903 - if (status->link_valid) 4904 - rx.link_id = status->link_id; 4905 - 4906 - if (rx.link_id >= 0) { 4907 - struct ieee80211_link_data *link; 4908 - 4909 - link = rcu_dereference(rx.sdata->link[rx.link_id]); 4910 - if (!link) 4911 - goto drop; 4912 - rx.link = link; 4913 - } else { 4914 - rx.link = &rx.sdata->deflink; 4915 - } 4903 + if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id)) 4904 + goto drop; 4916 4905 4917 4906 fast_rx = rcu_dereference(rx.sta->fast_rx); 4918 4907 if (!fast_rx) ··· 4919 4930 { 4920 4931 struct link_sta_info *link_sta; 4921 4932 struct ieee80211_hdr *hdr = (void *)skb->data; 4933 + struct sta_info *sta; 4934 + int link_id = -1; 4922 4935 4923 4936 /* 4924 4937 * Look up link station first, in case there's a ··· 4930 4939 */ 4931 4940 link_sta = link_sta_info_get_bss(rx->sdata, hdr->addr2); 4932 4941 if (link_sta) { 4933 - rx->sta = link_sta->sta; 4934 - rx->link_id = link_sta->link_id; 4942 + sta = link_sta->sta; 4943 + link_id = link_sta->link_id; 4935 4944 } else { 4936 4945 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 4937 4946 4938 - rx->sta = sta_info_get_bss(rx->sdata, hdr->addr2); 4939 - if (rx->sta) { 4940 - if (status->link_valid && 4941 - !ieee80211_rx_is_valid_sta_link_id(&rx->sta->sta, 4942 - status->link_id)) 4943 - return false; 4944 - 4945 - rx->link_id = status->link_valid ? status->link_id : -1; 4946 - } else { 4947 - rx->link_id = -1; 4948 - } 4947 + sta = sta_info_get_bss(rx->sdata, hdr->addr2); 4948 + if (status->link_valid) 4949 + link_id = status->link_id; 4949 4950 } 4951 + 4952 + if (!ieee80211_rx_data_set_sta(rx, &sta->sta, link_id)) 4953 + return false; 4950 4954 4951 4955 return ieee80211_prepare_and_rx_handle(rx, skb, consume); 4952 4956 } ··· 5001 5015 5002 5016 if (ieee80211_is_data(fc)) { 5003 5017 struct sta_info *sta, *prev_sta; 5004 - u8 link_id = status->link_id; 5018 + int link_id = -1; 5019 + 5020 + if (status->link_valid) 5021 + link_id = status->link_id; 5005 5022 5006 5023 if (pubsta) { 5007 - rx.sta = container_of(pubsta, struct sta_info, sta); 5008 - rx.sdata = rx.sta->sdata; 5009 - 5010 - if (status->link_valid && 5011 - !ieee80211_rx_is_valid_sta_link_id(pubsta, link_id)) 5024 + if (!ieee80211_rx_data_set_sta(&rx, pubsta, link_id)) 5012 5025 goto out; 5013 - 5014 - if (status->link_valid) 5015 - rx.link_id = status->link_id; 5016 5026 5017 5027 /* 5018 5028 * In MLO connection, fetch the link_id using addr2 ··· 5027 5045 if (!link_sta) 5028 5046 goto out; 5029 5047 5030 - rx.link_id = link_sta->link_id; 5048 + ieee80211_rx_data_set_link(&rx, link_sta->link_id); 5031 5049 } 5032 5050 5033 5051 if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) ··· 5043 5061 continue; 5044 5062 } 5045 5063 5046 - if ((status->link_valid && 5047 - !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, 5048 - link_id)) || 5049 - (!status->link_valid && prev_sta->sta.mlo)) 5064 + rx.sdata = prev_sta->sdata; 5065 + if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta, 5066 + link_id)) 5067 + goto out; 5068 + 5069 + if (!status->link_valid && prev_sta->sta.mlo) 5050 5070 continue; 5051 5071 5052 - rx.link_id = status->link_valid ? link_id : -1; 5053 - rx.sta = prev_sta; 5054 - rx.sdata = prev_sta->sdata; 5055 5072 ieee80211_prepare_and_rx_handle(&rx, skb, false); 5056 5073 5057 5074 prev_sta = sta; 5058 5075 } 5059 5076 5060 5077 if (prev_sta) { 5061 - if ((status->link_valid && 5062 - !ieee80211_rx_is_valid_sta_link_id(&prev_sta->sta, 5063 - link_id)) || 5064 - (!status->link_valid && prev_sta->sta.mlo)) 5078 + rx.sdata = prev_sta->sdata; 5079 + if (!ieee80211_rx_data_set_sta(&rx, &prev_sta->sta, 5080 + link_id)) 5065 5081 goto out; 5066 5082 5067 - rx.link_id = status->link_valid ? link_id : -1; 5068 - rx.sta = prev_sta; 5069 - rx.sdata = prev_sta->sdata; 5083 + if (!status->link_valid && prev_sta->sta.mlo) 5084 + goto out; 5070 5085 5071 5086 if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) 5072 5087 return;
+17 -17
net/mac80211/tx.c
··· 1129 1129 struct sk_buff *purge_skb = NULL; 1130 1130 1131 1131 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { 1132 - info->flags |= IEEE80211_TX_CTL_AMPDU; 1133 1132 reset_agg_timer = true; 1134 1133 } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { 1135 1134 /* ··· 1160 1161 if (!tid_tx) { 1161 1162 /* do nothing, let packet pass through */ 1162 1163 } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { 1163 - info->flags |= IEEE80211_TX_CTL_AMPDU; 1164 1164 reset_agg_timer = true; 1165 1165 } else { 1166 1166 queued = true; ··· 3675 3677 info->band = fast_tx->band; 3676 3678 info->control.vif = &sdata->vif; 3677 3679 info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | 3678 - IEEE80211_TX_CTL_DONTFRAG | 3679 - (ampdu ? IEEE80211_TX_CTL_AMPDU : 0); 3680 + IEEE80211_TX_CTL_DONTFRAG; 3680 3681 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT | 3681 3682 u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, 3682 3683 IEEE80211_TX_CTRL_MLO_LINK); ··· 3780 3783 struct ieee80211_tx_data tx; 3781 3784 ieee80211_tx_result r; 3782 3785 struct ieee80211_vif *vif = txq->vif; 3786 + int q = vif->hw_queue[txq->ac]; 3787 + bool q_stopped; 3783 3788 3784 3789 WARN_ON_ONCE(softirq_count() == 0); 3785 3790 ··· 3789 3790 return NULL; 3790 3791 3791 3792 begin: 3792 - spin_lock_bh(&fq->lock); 3793 + spin_lock(&local->queue_stop_reason_lock); 3794 + q_stopped = local->queue_stop_reasons[q]; 3795 + spin_unlock(&local->queue_stop_reason_lock); 3793 3796 3794 - if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || 3795 - test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) 3796 - goto out; 3797 - 3798 - if (vif->txqs_stopped[txq->ac]) { 3799 - set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); 3800 - goto out; 3797 + if (unlikely(q_stopped)) { 3798 + /* mark for waking later */ 3799 + set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags); 3800 + return NULL; 3801 3801 } 3802 + 3803 + spin_lock_bh(&fq->lock); 3802 3804 3803 3805 /* Make sure fragments stay together. */ 3804 3806 skb = __skb_dequeue(&txqi->frags); ··· 3810 3810 IEEE80211_SKB_CB(skb)->control.flags &= 3811 3811 ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING; 3812 3812 } else { 3813 + if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags))) 3814 + goto out; 3815 + 3813 3816 skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); 3814 3817 } 3815 3818 ··· 3863 3860 } 3864 3861 3865 3862 if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags)) 3866 - info->flags |= IEEE80211_TX_CTL_AMPDU; 3867 - else 3868 - info->flags &= ~IEEE80211_TX_CTL_AMPDU; 3863 + info->flags |= (IEEE80211_TX_CTL_AMPDU | 3864 + IEEE80211_TX_CTL_DONTFRAG); 3869 3865 3870 3866 if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { 3871 3867 if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { ··· 4598 4596 4599 4597 info = IEEE80211_SKB_CB(skb); 4600 4598 memset(info, 0, sizeof(*info)); 4601 - if (tid_tx) 4602 - info->flags |= IEEE80211_TX_CTL_AMPDU; 4603 4599 4604 4600 info->hw_queue = sdata->vif.hw_queue[queue]; 4605 4601
+3 -39
net/mac80211/util.c
··· 292 292 struct ieee80211_sub_if_data *sdata, 293 293 struct ieee80211_txq *queue) 294 294 { 295 - int q = sdata->vif.hw_queue[queue->ac]; 296 295 struct ieee80211_tx_control control = { 297 296 .sta = queue->sta, 298 297 }; 299 298 struct sk_buff *skb; 300 - unsigned long flags; 301 - bool q_stopped; 302 299 303 300 while (1) { 304 - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 305 - q_stopped = local->queue_stop_reasons[q]; 306 - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 307 - 308 - if (q_stopped) 309 - break; 310 - 311 301 skb = ieee80211_tx_dequeue(&local->hw, queue); 312 302 if (!skb) 313 303 break; ··· 337 347 local_bh_disable(); 338 348 spin_lock(&fq->lock); 339 349 340 - sdata->vif.txqs_stopped[ac] = false; 341 - 342 350 if (!test_bit(SDATA_STATE_RUNNING, &sdata->state)) 343 351 goto out; 344 352 ··· 358 370 if (ac != txq->ac) 359 371 continue; 360 372 361 - if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, 373 + if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, 362 374 &txqi->flags)) 363 375 continue; 364 376 ··· 373 385 374 386 txqi = to_txq_info(vif->txq); 375 387 376 - if (!test_and_clear_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags) || 388 + if (!test_and_clear_bit(IEEE80211_TXQ_DIRTY, &txqi->flags) || 377 389 (ps && atomic_read(&ps->num_sta_ps)) || ac != vif->txq->ac) 378 390 goto out; 379 391 ··· 505 517 bool refcounted) 506 518 { 507 519 struct ieee80211_local *local = hw_to_local(hw); 508 - struct ieee80211_sub_if_data *sdata; 509 - int n_acs = IEEE80211_NUM_ACS; 510 520 511 521 trace_stop_queue(local, queue, reason); 512 522 ··· 516 530 else 517 531 local->q_stop_reasons[queue][reason]++; 518 532 519 - if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue])) 520 - return; 521 - 522 - if (local->hw.queues < IEEE80211_NUM_ACS) 523 - n_acs = 1; 524 - 525 - rcu_read_lock(); 526 - list_for_each_entry_rcu(sdata, &local->interfaces, list) { 527 - int ac; 528 - 529 - if (!sdata->dev) 530 - continue; 531 - 532 - for (ac = 0; ac < n_acs; ac++) { 533 - if (sdata->vif.hw_queue[ac] == queue || 534 - sdata->vif.cab_queue == queue) { 535 - spin_lock(&local->fq.lock); 536 - sdata->vif.txqs_stopped[ac] = true; 537 - spin_unlock(&local->fq.lock); 538 - } 539 - } 540 - } 541 - rcu_read_unlock(); 533 + set_bit(reason, &local->queue_stop_reasons[queue]); 542 534 } 543 535 544 536 void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,