mac80211 aggregation improvements
Subsystems (2)
Johannes Berg
maintainercover mac80211 aggregation improvements
Hi,
Here's my patch set for improving aggregation, it contains
* mac80211: rewrite fragmentation
* mac80211: fix A-MPDU queue assignment
* mac80211: rework the pending packets code
* mac80211: clean up __ieee80211_tx args
* mac80211: unify and fix TX aggregation start
* mac80211: add skb length sanity checking
* mac80211: fix aggregation to not require queue stop
* mac80211/iwlwifi: move virtual A-MDPU queue bookkeeping to iwlwifi
The skb length sanity checking isn't strictly part of this series, but it would help debug things like the zd1211 problem Jouni fixed recently, and I wanted to do it after the third patch due to the amount of code changes in that.
The rest of the code changes fix/rework some things related to pending frames and fragmentation (to be able to work with that code for pending aggregation frames), clean up some aggregation code and finally remove a lot of the code that was necessary for trying to handle hardware aggregation queues in mac80211 -- the code for handling it in the driver is much simpler (because it can be less generic) too.
Despite adding new features, long comments and reworking things the diffstat thus looks fairly good with not many new code lines in total:
drivers/net/wireless/ath9k/main.c | 2 drivers/net/wireless/iwlwifi/iwl-3945.c | 2 drivers/net/wireless/iwlwifi/iwl-4965.c | 7 drivers/net/wireless/iwlwifi/iwl-5000.c | 7 drivers/net/wireless/iwlwifi/iwl-core.c | 3 drivers/net/wireless/iwlwifi/iwl-dev.h | 6 drivers/net/wireless/iwlwifi/iwl-helpers.h | 52 ++ drivers/net/wireless/iwlwifi/iwl-tx.c | 8 drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 drivers/net/wireless/mac80211_hwsim.c | 1 include/net/mac80211.h | 22 net/mac80211/agg-tx.c | 243 ++++----- net/mac80211/ieee80211_i.h | 31 - net/mac80211/main.c | 13 net/mac80211/sta_info.c | 17 net/mac80211/sta_info.h | 4 net/mac80211/tx.c | 704 +++++++++++++++------------- net/mac80211/util.c | 97 +-- net/mac80211/wep.c | 21 net/mac80211/wpa.c | 28 - 20 files changed, 656 insertions(+), 614 deletions(-)
I've tested this with various Intel hardware, Sujith has also tested with ath9k hardware (thanks!)
johannes
Johannes Berg
maintainerPATCH 1/8 mac80211: rewrite fragmentation
Fragmentation currently uses an allocated array to store the fragment skbs, and then keeps track of which have been sent and which are still pending etc. This is rather complicated; make it simpler by just chaining the fragments into skb->next and removing from that list when sent. Also simplifies all code that needs to touch fragments, since it now only needs to walk the skb->next list.
This is a prerequisite for fixing the stored packet code, which I need to do for proper aggregation packet storing.
--- net/mac80211/ieee80211_i.h | 7 net/mac80211/tx.c | 328 +++++++++++++++++++++------------------------ net/mac80211/util.c | 17 -- net/mac80211/wep.c | 21 -- net/mac80211/wpa.c | 28 +-- 5 files changed, 175 insertions(+), 226 deletions(-)
net/mac80211/ieee80211_i.h +0 -7
@@ -149,11 +149,6 @@ struct ieee80211_tx_data {struct ieee80211_channel *channel; -/* Extra fragments (in addition to the first fragment -* in skb) */ -struct sk_buff **extra_frag; -int num_extra_frag; -u16 ethertype;unsigned int flags; };
@@ -191,8 +186,6 @@ struct ieee80211_rx_data {struct ieee80211_tx_stored_packet {struct sk_buff *skb; -struct sk_buff **extra_frag; -int num_extra_frag; };struct beacon_data {
net/mac80211/tx.c +154 -174
459 lines not on this page · raw message
net/mac80211/wep.c +7 -14
@@ -329,24 +329,17 @@ static int wep_encrypt_skb(struct ieee80ieee80211_tx_result ieee80211_crypto_wep_encrypt (struct ieee80211_tx_data *tx) { -int i; +struct sk_buff *skb;ieee80211_tx_set_protected (tx); -if (wep_encrypt_skb (tx, tx->skb) <0 ) { -I802_DEBUG_INC (tx->local->tx_handlers_drop_wep); -return TX_DROP ; - } - -if (tx->extra_frag) { -for (i =0 ; i < tx->num_extra_frag; i++) { -if (wep_encrypt_skb (tx, tx->extra_frag[i])) { -I802_DEBUG_INC (tx->local-> - tx_handlers_drop_wep); -return TX_DROP ; - } + skb = tx->skb; +do { +if (wep_encrypt_skb (tx, skb) <0 ) { +I802_DEBUG_INC (tx->local->tx_handlers_drop_wep); +return TX_DROP ; } - } + }while ((skb = skb->next));return TX_CONTINUE ; }
net/mac80211/wpa.c +8 -20
@@ -196,19 +196,13 @@ ieee80211_tx_result ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) {struct sk_buff *skb = tx->skb; -int i;ieee80211_tx_set_protected (tx); -if (tkip_encrypt_skb (tx, skb) <0 ) -return TX_DROP ; - -if (tx->extra_frag) { -for (i =0 ; i < tx->num_extra_frag; i++) { -if (tkip_encrypt_skb (tx, tx->extra_frag[i])) -return TX_DROP ; - } - } +do { +if (tkip_encrypt_skb (tx, skb) <0 ) +return TX_DROP ; + }while ((skb = skb->next));return TX_CONTINUE ; }
@@ -428,19 +422,13 @@ ieee80211_tx_result ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) {struct sk_buff *skb = tx->skb; -int i;ieee80211_tx_set_protected (tx); -if (ccmp_encrypt_skb (tx, skb) <0 ) -return TX_DROP ; - -if (tx->extra_frag) { -for (i =0 ; i < tx->num_extra_frag; i++) { -if (ccmp_encrypt_skb (tx, tx->extra_frag[i])) -return TX_DROP ; - } - } +do { +if (ccmp_encrypt_skb (tx, skb) <0 ) +return TX_DROP ; + }while ((skb = skb->next));return TX_CONTINUE ; }
net/mac80211/util.c +6 -11
@@ -166,18 +166,13 @@ int ieee80211_get_mesh_hdrlen(struct ieevoid ieee80211_tx_set_protected (struct ieee80211_tx_data *tx) { -struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; +struct sk_buff *skb = tx->skb; +struct ieee80211_hdr *hdr; - hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PROTECTED ); -if (tx->extra_frag) { -struct ieee80211_hdr *fhdr; -int i; -for (i =0 ; i < tx->num_extra_frag; i++) { - fhdr = (struct ieee80211_hdr *) - tx->extra_frag[i]->data; - fhdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PROTECTED ); - } - } +do { + hdr = (struct ieee80211_hdr *) skb->data; + hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PROTECTED ); + }while ((skb = skb->next)); } int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
Johannes Berg
maintainerPATCH 2/8 mac80211: fix A-MPDU queue assignment
In reply to Johannes BergInternally, mac80211 requires the skb's queue mapping to be set to the AC queue, not the virtual A-MPDU queue. This is not done correctly currently, this patch moves the code down to directly before the driver is invoked and adds a comment that it will be moved into the driver later.
Since this requires __ieee80211_tx() to have the sta pointer, make sure to provide it in ieee80211_tx_pending().
--- net/mac80211/tx.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)
net/mac80211/tx.c +27 -8
@@ -1024,13 +1024,8 @@ __ieee80211_tx_prepare(struct ieee80211_spin_lock_irqsave (&tx->sta->lock, flags); state = &tx->sta->ampdu_mlme.tid_state_tx[tid]; -if (*state ==HT_AGG_STATE_OPERATIONAL ) { +if (*state ==HT_AGG_STATE_OPERATIONAL ) info->flags |=IEEE80211_TX_CTL_AMPDU ; -if (local->hw.ampdu_queues) -skb_set_queue_mapping ( - skb, tx->local->hw.queues + - tx->sta->tid_to_tx_q[tid]); - }spin_unlock_irqrestore (&tx->sta->lock, flags); }
@@ -1103,10 +1098,29 @@ static int __ieee80211_tx(struct ieee802 skb_get_queue_mapping(skb)))return IEEE80211_TX_PENDING ; -if (fragm) { - info =IEEE80211_SKB_CB (skb); + info =IEEE80211_SKB_CB (skb); + +if (fragm) info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |IEEE80211_TX_CTL_FIRST_FRAGMENT ); + +/* +* Internally, we need to have the queue mapping point to +* the real AC queue, not the virtual A-MPDU queue. This +* now finally sets the queue to what the driver wants. +* We will later move this down into the only driver that +* needs it, iwlwifi. +*/ +if (tx->sta && local->hw.ampdu_queues && + info->flags &IEEE80211_TX_CTL_AMPDU ) { +unsigned long flags; +u8 *qc =ieee80211_get_qos_ctl ((void *) skb->data); +int tid = *qc &IEEE80211_QOS_CTL_TID_MASK ; + +spin_lock_irqsave (&tx->sta->lock, flags); +skb_set_queue_mapping (skb, local->hw.queues + + tx->sta->tid_to_tx_q[tid]); +spin_unlock_irqrestore (&tx->sta->lock, flags); } next = skb->next;
@@ -1817,9 +1831,11 @@ void ieee80211_tx_pending(unsigned longstruct ieee80211_local *local = (struct ieee80211_local *)data;struct net_device *dev = local->mdev;struct ieee80211_tx_stored_packet *store; +struct ieee80211_hdr *hdr;struct ieee80211_tx_data tx;int i, ret; +rcu_read_lock ();netif_tx_lock_bh (dev);for (i =0 ; i < local->hw.queues; i++) {/* Check that this queue is ok */
@@ -1839,6 +1855,8 @@ void ieee80211_tx_pending(unsigned long store = &local->pending_packet[i]; tx.flags =0 ; tx.skb = store->skb; + hdr = (struct ieee80211_hdr *)tx.skb->data; + tx.sta =sta_info_get (local, hdr->addr1); ret =__ieee80211_tx (local, &tx); store->skb = tx.skb;if (!ret) {
@@ -1847,6 +1865,7 @@ void ieee80211_tx_pending(unsigned long } }netif_tx_unlock_bh (dev); +rcu_read_unlock (); }/* functions for drivers to get certain frames */
Johannes Berg
maintainerPATCH 3/8 mac80211: rework the pending packets code
In reply to Johannes BergThe pending packets code is quite incomprehensible, uses memory barriers nobody really understands, etc. This patch reworks it entirely, using the queue spinlock, proper stop bits and the skb queues themselves to indicate whether packets are pending or not (rather than a separate variable like before).
---
Tested with the later aggregation patches, I see packets going onto the pending queue and being sent out from there.
net/mac80211/ieee80211_i.h | 9 -- net/mac80211/main.c | 2 net/mac80211/tx.c | 142 +++++++++++++++++++++++++-------------------- net/mac80211/util.c | 22 ++++-- 4 files changed, 97 insertions(+), 78 deletions(-)
net/mac80211/ieee80211_i.h +2 -7
@@ -184,10 +184,6 @@ struct ieee80211_rx_data {u16 tkip_iv16; }; -struct ieee80211_tx_stored_packet { -struct sk_buff *skb; -}; -struct beacon_data {u8 *head, *tail;int head_len, tail_len;
@@ -581,6 +577,7 @@ enum queue_stop_reason {IEEE80211_QUEUE_STOP_REASON_CSA ,IEEE80211_QUEUE_STOP_REASON_AGGREGATION ,IEEE80211_QUEUE_STOP_REASON_SUSPEND , + IEEE80211_QUEUE_STOP_REASON_PENDING, }; struct ieee80211_master_priv {
@@ -637,9 +634,7 @@ struct ieee80211_local {struct sta_info *sta_hash[STA_HASH_SIZE ];struct timer_list sta_cleanup; -unsigned long queues_pending[BITS_TO_LONGS (IEEE80211_MAX_QUEUES )]; -unsigned long queues_pending_run[BITS_TO_LONGS (IEEE80211_MAX_QUEUES )]; -struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES ]; +struct sk_buff_head pending[IEEE80211_MAX_QUEUES ];struct tasklet_struct tx_pending_tasklet;/* number of interfaces with corresponding IFF_ flags */
net/mac80211/main.c +2 -0
@@ -781,6 +781,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(sta_info_init (local); +for (i =0 ; i <IEEE80211_MAX_QUEUES ; i++) +skb_queue_head_init (&local->pending[i]);tasklet_init (&local->tx_pending_tasklet, ieee80211_tx_pending, (unsigned long )local);tasklet_disable (&local->tx_pending_tasklet);
net/mac80211/tx.c +79 -63
202 lines not on this page · raw message
net/mac80211/util.c +14 -8
@@ -365,16 +365,16 @@ static void __ieee80211_wake_queue(struc__clear_bit (reason, &local->queue_stop_reasons[queue]); +if (!skb_queue_empty (&local->pending[queue]) && + local->queue_stop_reasons[queue] == +BIT (IEEE80211_QUEUE_STOP_REASON_PENDING )) +tasklet_schedule (&local->tx_pending_tasklet); +if (local->queue_stop_reasons[queue] !=0 )/* someone still has this queue stopped */ return ; -if (test_bit (queue, local->queues_pending)) { -set_bit (queue, local->queues_pending_run); -tasklet_schedule (&local->tx_pending_tasklet); - }else { -netif_wake_subqueue (local->mdev, queue); - } +netif_wake_subqueue (local->mdev, queue); } void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
@@ -420,9 +420,15 @@ static void __ieee80211_stop_queue(struc reason =IEEE80211_QUEUE_STOP_REASON_AGGREGATION ; } -__set_bit (reason, &local->queue_stop_reasons[queue]); +/* +* Only stop if it was previously running, this is necessary +* for correct pending packets handling because there we may +* start (but not wake) the queue and rely on that. +*/ +if (!local->queue_stop_reasons[queue]) +netif_stop_subqueue (local->mdev, queue); -netif_stop_subqueue (local->mdev, queue); +__set_bit (reason, &local->queue_stop_reasons[queue]); } void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
Johannes Berg
maintainerPATCH 4/8 mac80211: clean up __ieee80211_tx args
In reply to Johannes Berg__ieee80211_tx takes a struct ieee80211_tx_data argument, but only uses a few of its members, namely 'skb' and 'sta'. Make that explicit, so that less internal knowledge is required in ieee80211_tx_pending and the possibility of introducing errors here is removed.
--- net/mac80211/tx.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
net/mac80211/tx.c +16 -15
@@ -1084,9 +1084,10 @@ static int ieee80211_tx_prepare(struct i }static int __ieee80211_tx (struct ieee80211_local *local, -struct ieee80211_tx_data *tx) +struct sk_buff **skbp, +struct sta_info *sta) { -struct sk_buff *skb = tx->skb, *next; +struct sk_buff *skb = *skbp, *next;struct ieee80211_tx_info *info;int ret;bool fragm = false;
@@ -1111,23 +1112,23 @@ static int __ieee80211_tx(struct ieee802* We will later move this down into the only driver that * needs it, iwlwifi. */ -if (tx->sta && local->hw.ampdu_queues && +if (sta && local->hw.ampdu_queues && info->flags &IEEE80211_TX_CTL_AMPDU ) {unsigned long flags;u8 *qc =ieee80211_get_qos_ctl ((void *) skb->data);int tid = *qc &IEEE80211_QOS_CTL_TID_MASK ; -spin_lock_irqsave (&tx->sta->lock, flags); +spin_lock_irqsave (&sta->lock, flags);skb_set_queue_mapping (skb, local->hw.queues + - tx->sta->tid_to_tx_q[tid]); -spin_unlock_irqrestore (&tx->sta->lock, flags); + sta->tid_to_tx_q[tid]); +spin_unlock_irqrestore (&sta->lock, flags); } next = skb->next; ret = local->ops->tx (local_to_hw (local), skb);if (ret !=NETDEV_TX_OK )return IEEE80211_TX_AGAIN ; - tx->skb = skb = next; + *skbp = skb = next;ieee80211_led_tx (local,1 ); fragm = true; }
@@ -1223,7 +1224,7 @@ static int ieee80211_tx(struct net_devic retries =0 ; retry: - ret =__ieee80211_tx (local, &tx); + ret =__ieee80211_tx (local, &tx.skb, tx.sta);switch (ret) {case IEEE80211_TX_OK :break ;
@@ -1831,7 +1832,6 @@ void ieee80211_tx_pending(unsigned longstruct net_device *dev = local->mdev;struct ieee80211_hdr *hdr;unsigned long flags; -struct ieee80211_tx_data tx;int i, ret;bool next;
@@ -1862,14 +1862,15 @@ void ieee80211_tx_pending(unsigned longnetif_start_subqueue (local->mdev, i);while (!skb_queue_empty (&local->pending[i])) { - tx.flags =0 ; - tx.skb =skb_dequeue (&local->pending[i]); - hdr = (struct ieee80211_hdr *)tx.skb->data; - tx.sta =sta_info_get (local, hdr->addr1); +struct sk_buff *skb =skb_dequeue (&local->pending[i]); +struct sta_info *sta; + + hdr = (struct ieee80211_hdr *)skb->data; + sta =sta_info_get (local, hdr->addr1); - ret =__ieee80211_tx (local, &tx); + ret =__ieee80211_tx (local, &skb, sta);if (ret !=IEEE80211_TX_OK ) { -skb_queue_head (&local->pending[i], tx.skb); +skb_queue_head (&local->pending[i], skb);break ; } }
Johannes Berg
maintainerPATCH 5/8 mac80211: unify and fix TX aggregation start
In reply to Johannes BergWhen TX aggregation becomes operational, we do a number of steps:
1) print a debug message
2) wake the virtual queue
3) notify the driver
Unfortunately, 1) and 3) are only done if the driver is first to reply to the aggregation request, it is, however, possible that the remote station replies before the driver! Thus, unify the code for this and call the new function ieee80211_agg_tx_operational in both places where TX aggregation can become operational.
Additionally, rename the driver notification from IEEE80211_AMPDU_TX_RESUME to IEEE80211_AMPDU_TX_OPERATIONAL.
--- drivers/net/wireless/ath9k/main.c | 2 - include/net/mac80211.h | 4 +- net/mac80211/agg-tx.c | 63 ++++++++++++++++---------------------- 3 files changed, 30 insertions(+), 39 deletions(-)
net/mac80211/agg-tx.c +27 -36
@@ -404,6 +404,27 @@ int ieee80211_start_tx_ba_session(struct }EXPORT_SYMBOL (ieee80211_start_tx_ba_session); +static void ieee80211_agg_tx_operational (struct ieee80211_local *local, +struct sta_info *sta,u16 tid) +{ +#ifdef CONFIG_MAC80211_HT_DEBUG +printk (KERN_DEBUG "Aggregation is on for tid %d \n" , tid); +#endif + +if (local->hw.ampdu_queues) { +/* +* Wake up the A-MPDU queue, we stopped it earlier, +* this will in turn wake the entire AC. +*/ +ieee80211_wake_queue_by_reason (&local->hw, + local->hw.queues + sta->tid_to_tx_q[tid], +IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); + } + + local->ops->ampdu_action (&local->hw,IEEE80211_AMPDU_TX_OPERATIONAL , + &sta->sta, tid,NULL ); +} +void ieee80211_start_tx_ba_cb (struct ieee80211_hw *hw,u8 *ra,u16 tid) {struct ieee80211_local *local =hw_to_local (hw);
@@ -446,20 +467,8 @@ void ieee80211_start_tx_ba_cb(struct iee *state |=HT_ADDBA_DRV_READY_MSK ; -if (*state ==HT_AGG_STATE_OPERATIONAL ) { -#ifdef CONFIG_MAC80211_HT_DEBUG -printk (KERN_DEBUG "Aggregation is on for tid %d \n" , tid); -#endif -if (hw->ampdu_queues) { -/* -* Wake up this queue, we stopped it earlier, -* this will in turn wake the entire AC. -*/ -ieee80211_wake_queue_by_reason (hw, - hw->queues + sta->tid_to_tx_q[tid], -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); - } - } +if (*state ==HT_AGG_STATE_OPERATIONAL ) +ieee80211_agg_tx_operational (local, sta, tid); out:spin_unlock_bh (&sta->lock);
@@ -646,9 +655,7 @@ void ieee80211_process_addba_resp(struct struct ieee80211_mgmt *mgmt, size_t len) { -struct ieee80211_hw *hw = &local->hw; -u16 capab; -u16 tid, start_seq_num; +u16 capab, tid;u8 *state; capab =le16_to_cpu (mgmt->u.action.u.addba_resp.capab);
@@ -682,26 +689,10 @@ void ieee80211_process_addba_resp(struct *state |=HT_ADDBA_RECEIVED_MSK ; -if (hw->ampdu_queues && *state != curstate && - *state ==HT_AGG_STATE_OPERATIONAL ) { -/* -* Wake up this queue, we stopped it earlier, -* this will in turn wake the entire AC. -*/ -ieee80211_wake_queue_by_reason (hw, - hw->queues + sta->tid_to_tx_q[tid], -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); - } - sta->ampdu_mlme.addba_req_num[tid] =0 ; +if (*state != curstate && *state ==HT_AGG_STATE_OPERATIONAL ) +ieee80211_agg_tx_operational (local, sta, tid); -if (local->ops->ampdu_action) { - (void )local->ops->ampdu_action (hw, -IEEE80211_AMPDU_TX_RESUME , - &sta->sta, tid, &start_seq_num); - } -#ifdef CONFIG_MAC80211_HT_DEBUG -printk (KERN_DEBUG "Resuming TX aggregation for tid %d\n" , tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ + sta->ampdu_mlme.addba_req_num[tid] =0 ; }else { sta->ampdu_mlme.addba_req_num[tid]++;___ieee80211_stop_tx_ba_session (sta, tid,WLAN_BACK_INITIATOR );
include/net/mac80211.h +2 -2
@@ -1213,14 +1213,14 @@ enum ieee80211_filter_flags {* @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation * @IEEE80211_AMPDU_TX_START: start Tx aggregation * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation -* @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation +* @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational */ enum ieee80211_ampdu_mlme_action {IEEE80211_AMPDU_RX_START ,IEEE80211_AMPDU_RX_STOP ,IEEE80211_AMPDU_TX_START ,IEEE80211_AMPDU_TX_STOP , -IEEE80211_AMPDU_TX_RESUME , +IEEE80211_AMPDU_TX_OPERATIONAL , };/**
drivers/net/wireless/ath9k/main.c +1 -1
@@ -2730,7 +2730,7 @@ static int ath9k_ampdu_action(struct ieeieee80211_stop_tx_ba_cb_irqsafe (hw, sta->addr, tid);break ; -case IEEE80211_AMPDU_TX_RESUME : +case IEEE80211_AMPDU_TX_OPERATIONAL :ath_tx_aggr_resume (sc, sta, tid);break ;default :
Johannes Berg
maintainerPATCH 6/8 mac80211: add skb length sanity checking
In reply to Johannes BergWe just found a bug in zd1211rw where it would reject packets in the ->tx() method but leave them modified, which would cause retransmit attempts with completely bogus skbs, eventually leading to a panic due to not having enough headroom in those.
This patch adds a sanity check to mac80211 to catch such driver mistakes; in this case we warn and drop the skb.
--- net/mac80211/tx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/mac80211/tx.c +6 -1
@@ -1089,7 +1089,7 @@ static int __ieee80211_tx(struct ieee802 {struct sk_buff *skb = *skbp, *next;struct ieee80211_tx_info *info; -int ret; +int ret, len;bool fragm = false; local->mdev->trans_start = jiffies;
@@ -1125,7 +1125,12 @@ static int __ieee80211_tx(struct ieee802 } next = skb->next; + len = skb->len; ret = local->ops->tx (local_to_hw (local), skb); +if (WARN_ON (ret !=NETDEV_TX_OK && skb->len != len)) { +dev_kfree_skb (skb); + ret =NETDEV_TX_OK ; + }if (ret !=NETDEV_TX_OK )return IEEE80211_TX_AGAIN ; *skbp = skb = next;
Johannes Berg
maintainerPATCH 7/8 mac80211: fix aggregation to not require queue stop
In reply to Johannes BergInstead of stopping the entire AC queue when enabling aggregation (which was only done for hardware with aggregation queues) buffer the packets for each station, and release them to the pending skb queue once aggregation is turned on successfully.
We get a little more code, but it becomes conceptually simpler and we can remove the entire virtual queue mechanism from mac80211 in a follow-up patch.
This changes how mac80211 behaves towards drivers that support aggregation but have no hardware queues -- those drivers will now not be handed packets while the aggregation session is being established, but only after it has been fully established.
--- include/net/mac80211.h | 4 + net/mac80211/agg-tx.c | 136 ++++++++++++++++++++++++++----------------- net/mac80211/ieee80211_i.h | 8 ++ net/mac80211/main.c | 2 net/mac80211/sta_info.c | 5 + net/mac80211/sta_info.h | 2 net/mac80211/tx.c | 142 ++++++++++++++++++++++++++++++++++++--------- 7 files changed, 221 insertions(+), 78 deletions(-)
net/mac80211/sta_info.h +2 -0
@@ -73,11 +73,13 @@ enum ieee80211_sta_info_flags {* struct tid_ampdu_tx - TID aggregation information (Tx). * * @addba_resp_timer: timer for peer's response to addba request +* @pending: pending frames queue -- use sta's spinlock to protect * @ssn: Starting Sequence Number expected to be aggregated. * @dialog_token: dialog token for aggregation session */ struct tid_ampdu_tx {struct timer_list addba_resp_timer; +struct sk_buff_head pending;u16 ssn;u8 dialog_token; };
include/net/mac80211.h +4 -0
@@ -248,6 +248,9 @@ struct ieee80211_bss_conf {* @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or * set this flag in the driver; indicates that the rate control * algorithm was used and should be notified of TX status +* @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, +* used to indicate that a pending frame requires TX processing before +* it can be sent out. */ enum mac80211_tx_control_flags {IEEE80211_TX_CTL_REQ_TX_STATUS =BIT (0 ),
@@ -264,6 +267,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_STAT_AMPDU_NO_BACK =BIT (11 ),IEEE80211_TX_CTL_RATE_CTRL_PROBE =BIT (12 ),IEEE80211_TX_INTFL_RCALGO =BIT (13 ), + IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), };/**
net/mac80211/agg-tx.c +84 -52
216 lines not on this page · raw message
net/mac80211/tx.c +116 -26
267 lines not on this page · raw message
net/mac80211/sta_info.c +5 -0
@@ -239,6 +239,11 @@ void sta_info_destroy(struct sta_info *s tid_tx = sta->ampdu_mlme.tid_tx[i];if (tid_tx) {del_timer_sync (&tid_tx->addba_resp_timer); +/* +* STA removed while aggregation session being +* started? Bit odd, but purge frames anyway. +*/ +skb_queue_purge (&tid_tx->pending);kfree (tid_tx); } }
net/mac80211/ieee80211_i.h +8 -0
@@ -637,6 +637,14 @@ struct ieee80211_local {struct sk_buff_head pending[IEEE80211_MAX_QUEUES ];struct tasklet_struct tx_pending_tasklet; +/* +* This lock is used to prevent concurrent A-MPDU +* session start/stop processing, this thus also +* synchronises the ->ampdu_action() callback to +* drivers and limits it to one at a time. +*/ +spinlock_t ampdu_lock; +/* number of interfaces with corresponding IFF_ flags */ atomic_t iff_allmultis, iff_promiscs;
net/mac80211/main.c +2 -0
@@ -795,6 +795,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(skb_queue_head_init (&local->skb_queue);skb_queue_head_init (&local->skb_queue_unreliable); +spin_lock_init (&local->ampdu_lock); +return local_to_hw (local); }EXPORT_SYMBOL (ieee80211_alloc_hw);
Johannes Berg
maintainerPATCH 8/8 mac80211/iwlwifi: move virtual A-MDPU queue bookkeeping to iwlwifi
In reply to Johannes BergThis patch removes all the virtual A-MPDU-queue bookkeeping from mac80211. Curiously, iwlwifi already does its own bookkeeping, so it doesn't require much changes except where it needs to handle starting and stopping the queues in mac80211.
To handle the queue stop/wake properly, we rewrite the software queue number for aggregation frames and internally to iwlwifi keep track of the queues that map into the same AC queue, and only talk to mac80211 about the AC queue. The implementation requires calling two new functions, iwl_stop_queue and iwl_wake_queue instead of the mac80211 counterparts.
--- drivers/net/wireless/iwlwifi/iwl-3945.c | 2 drivers/net/wireless/iwlwifi/iwl-4965.c | 7 +-- drivers/net/wireless/iwlwifi/iwl-5000.c | 7 +-- drivers/net/wireless/iwlwifi/iwl-core.c | 3 - drivers/net/wireless/iwlwifi/iwl-dev.h | 6 ++ drivers/net/wireless/iwlwifi/iwl-helpers.h | 52 +++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-tx.c | 8 ++- drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 drivers/net/wireless/mac80211_hwsim.c | 1 include/net/mac80211.h | 14 ------ net/mac80211/agg-tx.c | 44 +-------------------- net/mac80211/ieee80211_i.h | 7 --- net/mac80211/main.c | 9 ---- net/mac80211/sta_info.c | 12 ----- net/mac80211/sta_info.h | 2 net/mac80211/tx.c | 19 --------- net/mac80211/util.c | 58 +++------------------------- 17 files changed, 84 insertions(+), 169 deletions(-)
net/mac80211/ieee80211_i.h +1 -6
@@ -592,12 +592,7 @@ struct ieee80211_local {const struct ieee80211_ops *ops; -/* AC queue corresponding to each AMPDU queue */ -s8 ampdu_ac_queue[IEEE80211_MAX_AMPDU_QUEUES ]; -unsigned int amdpu_ac_stop_refcnt[IEEE80211_MAX_AMPDU_QUEUES ]; - -unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES + -IEEE80211_MAX_AMPDU_QUEUES ]; +unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES ];/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ spinlock_t queue_stop_reason_lock;
net/mac80211/util.c +7 -51
83 lines not on this page · raw message
net/mac80211/agg-tx.c +3 -41
80 lines not on this page · raw message
net/mac80211/main.c +0 -9
@@ -774,11 +774,6 @@ struct ieee80211_hw *ieee80211_alloc_hw(setup_timer (&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, (unsigned long ) local); -for (i =0 ; i <IEEE80211_MAX_AMPDU_QUEUES ; i++) - local->ampdu_ac_queue[i] =-1 ; -/* using an s8 won't work with more than that */ -BUILD_BUG_ON (IEEE80211_MAX_AMPDU_QUEUES >127 ); -sta_info_init (local);for (i =0 ; i <IEEE80211_MAX_QUEUES ; i++)
@@ -874,10 +869,6 @@ int ieee80211_register_hw(struct ieee802*/ if (hw->queues >IEEE80211_MAX_QUEUES ) hw->queues =IEEE80211_MAX_QUEUES ; -if (hw->ampdu_queues >IEEE80211_MAX_AMPDU_QUEUES ) - hw->ampdu_queues =IEEE80211_MAX_AMPDU_QUEUES ; -if (hw->queues <4 ) - hw->ampdu_queues =0 ; mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv), "wmaster%d", ieee80211_master_setup,
include/net/mac80211.h +2 -12
@@ -93,12 +93,9 @@ struct ieee80211_ht_bss_info {* enum ieee80211_max_queues - maximum number of queues * * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. -* @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable -* for A-MPDU operation. */ enum ieee80211_max_queues {IEEE80211_MAX_QUEUES =4 , -IEEE80211_MAX_AMPDU_QUEUES =16 , };/**
@@ -947,12 +944,6 @@ enum ieee80211_hw_flags {* data packets. WMM/QoS requires at least four, these * queues need to have configurable access parameters. * -* @ampdu_queues: number of available hardware transmit queues -* for A-MPDU packets, these have no access parameters -* because they're used only for A-MPDU frames. Note that -* mac80211 will not currently use any of the regular queues -* for aggregation. -* * @rate_control_algorithm: rate control algorithm for this hardware. * If unset (NULL), the default algorithm will be used. Must be * set before calling ieee80211_register_hw().
@@ -977,7 +968,6 @@ struct ieee80211_hw {int vif_data_size;int sta_data_size;u16 queues; -u16 ampdu_queues;u16 max_listen_interval;s8 max_signal;u8 max_rates;
@@ -1347,8 +1337,8 @@ enum ieee80211_ampdu_mlme_action {* @get_tx_stats: Get statistics of the current TX queue status. This is used * to get number of currently queued packets (queue length), maximum queue * size (limit), and total number of packets sent using each TX queue -* (count). The 'stats' pointer points to an array that has hw->queues + -* hw->ampdu_queues items. +* (count). The 'stats' pointer points to an array that has hw->queues +* items. * * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, * this is only used for IBSS mode BSSID merging and debugging. Is not a
net/mac80211/sta_info.c +0 -12
@@ -203,17 +203,6 @@ void sta_info_destroy(struct sta_info *sif (tid_rx) tid_rx->shutdown = true; -/* -* The stop callback cannot find this station any more, but -* it didn't complete its work -- start the queue if necessary -*/ -if (sta->ampdu_mlme.tid_state_tx[i] &HT_AGG_STATE_INITIATOR_MSK && - sta->ampdu_mlme.tid_state_tx[i] &HT_AGG_STATE_REQ_STOP_BA_MSK && - local->hw.ampdu_queues) -ieee80211_wake_queue_by_reason (&local->hw, - local->hw.queues + sta->tid_to_tx_q[i], -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); -spin_unlock_bh (&sta->lock);/*
@@ -292,7 +281,6 @@ struct sta_info *sta_info_alloc(struct i* enable session_timer's data differentiation. refer to * sta_rx_agg_session_timer_expired for useage */ sta->timer_to_tid[i] = i; - sta->tid_to_tx_q[i] =-1 ;/* rx */ sta->ampdu_mlme.tid_state_rx[i] =HT_AGG_STATE_IDLE ; sta->ampdu_mlme.tid_rx[i] =NULL ;
net/mac80211/sta_info.h +0 -2
@@ -206,7 +206,6 @@ struct sta_ampdu_mlme {* @tid_seq: per-TID sequence numbers for sending to this STA * @ampdu_mlme: A-MPDU state machine state * @timer_to_tid: identity mapping to ID timers -* @tid_to_tx_q: map tid to tx queue (invalid == negative values) * @llid: Local link ID * @plid: Peer link ID * @reason: Cancel reason on PLINK_HOLDING state
@@ -281,7 +280,6 @@ struct sta_info {*/ struct sta_ampdu_mlme ampdu_mlme;u8 timer_to_tid[STA_TID_NUM ]; -s8 tid_to_tx_q[STA_TID_NUM ];#ifdef CONFIG_MAC80211_MESH /*
net/mac80211/tx.c +0 -19
@@ -1145,25 +1145,6 @@ static int __ieee80211_tx(struct ieee802 info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |IEEE80211_TX_CTL_FIRST_FRAGMENT ); -/* -* Internally, we need to have the queue mapping point to -* the real AC queue, not the virtual A-MPDU queue. This -* now finally sets the queue to what the driver wants. -* We will later move this down into the only driver that -* needs it, iwlwifi. -*/ -if (sta && local->hw.ampdu_queues && - info->flags &IEEE80211_TX_CTL_AMPDU ) { -unsigned long flags; -u8 *qc =ieee80211_get_qos_ctl ((void *) skb->data); -int tid = *qc &IEEE80211_QOS_CTL_TID_MASK ; - -spin_lock_irqsave (&sta->lock, flags); -skb_set_queue_mapping (skb, local->hw.queues + - sta->tid_to_tx_q[tid]); -spin_unlock_irqrestore (&sta->lock, flags); - } - next = skb->next; len = skb->len; ret = local->ops->tx (local_to_hw (local), skb);
drivers/net/wireless/iwlwifi/iwl-core.c +0 -3
@@ -1309,9 +1309,6 @@ int iwl_setup_mac(struct iwl_priv *priv)/* Default value; 4 EDCA QOS priorities */ hw->queues =4 ; -/* queues to support 11n aggregation */ -if (priv->cfg->sku &IWL_SKU_N ) - hw->ampdu_queues = priv->cfg->mod_params->num_of_ampdu_queues; hw->conf.beacon_int =100 ; hw->max_listen_interval =IWL_CONN_MAX_LISTEN_INTERVAL ;
drivers/net/wireless/mac80211_hwsim.c +0 -1
@@ -927,7 +927,6 @@ static int __init init_mac80211_hwsim(voBIT (NL80211_IFTYPE_STATION ) |BIT (NL80211_IFTYPE_AP ) |BIT (NL80211_IFTYPE_MESH_POINT ); - hw->ampdu_queues =1 ; hw->flags =IEEE80211_HW_MFP_CAPABLE ;
drivers/net/wireless/iwlwifi/iwl-3945.c +1 -1
@@ -293,7 +293,7 @@ static void iwl3945_tx_queue_reclaim(strif (iwl_queue_space (q) > q->low_mark && (txq_id >=0 ) && (txq_id !=IWL_CMD_QUEUE_NUM ) && priv->mac80211_registered) -ieee80211_wake_queue (priv->hw, txq_id); +iwl_wake_queue (priv, txq_id); }/**
drivers/net/wireless/iwlwifi/iwl-4965.c +3 -4
@@ -2178,10 +2178,9 @@ static void iwl4965_rx_reply_tx(struct i (iwl_queue_space(&txq->q) > txq->q.low_mark) && (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) {if (agg->state ==IWL_AGG_OFF ) -ieee80211_wake_queue (priv->hw, txq_id); +iwl_wake_queue (priv, txq_id);else -ieee80211_wake_queue (priv->hw, - txq->swq_id); +iwl_wake_queue (priv, txq->swq_id); } } }else {
@@ -2205,7 +2204,7 @@ static void iwl4965_rx_reply_tx(struct iif (priv->mac80211_registered && (iwl_queue_space (&txq->q) > txq->q.low_mark)) -ieee80211_wake_queue (priv->hw, txq_id); +iwl_wake_queue (priv, txq_id); }if (qc &&likely (sta_id !=IWL_INVALID_STATION ))
drivers/net/wireless/iwlwifi/iwl-5000.c +3 -4
@@ -1295,10 +1295,9 @@ static void iwl5000_rx_reply_tx(struct i (iwl_queue_space(&txq->q) > txq->q.low_mark) && (agg->state != IWL_EMPTYING_HW_QUEUE_DELBA)) {if (agg->state ==IWL_AGG_OFF ) -ieee80211_wake_queue (priv->hw, txq_id); +iwl_wake_queue (priv, txq_id);else -ieee80211_wake_queue (priv->hw, - txq->swq_id); +iwl_wake_queue (priv, txq->swq_id); } } }else {
@@ -1324,7 +1323,7 @@ static void iwl5000_rx_reply_tx(struct iif (priv->mac80211_registered && (iwl_queue_space (&txq->q) > txq->q.low_mark)) -ieee80211_wake_queue (priv->hw, txq_id); +iwl_wake_queue (priv, txq_id); }if (ieee80211_is_data_qos (tx_resp->frame_ctrl))
drivers/net/wireless/iwlwifi/iwl-dev.h +6 -0
@@ -996,6 +996,12 @@ struct iwl_priv {u8 key_mapping_key;unsigned long ucode_key_table; +/* queue refcounts */ +#define IWL_MAX_HW_QUEUES 32 +unsigned long queue_stopped[BITS_TO_LONGS (IWL_MAX_HW_QUEUES )]; +/* for each AC */ +atomic_t queue_stop_count[4 ]; +/* Indication if ieee80211_ops->open has been called */ u8 is_open;
drivers/net/wireless/iwlwifi/iwl-helpers.h +52 -0
56 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-tx.c +5 -3
@@ -763,8 +763,10 @@ int iwl_tx_skb(struct iwl_priv *priv, st hdr->seq_ctrl |=cpu_to_le16 (seq_number); seq_number +=0x10 ;/* aggregation is on for this <sta,tid> */ -if (info->flags &IEEE80211_TX_CTL_AMPDU ) +if (info->flags &IEEE80211_TX_CTL_AMPDU ) { txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; + swq_id =iwl_virtual_agg_queue_num (swq_id, txq_id); + } priv->stations[sta_id].tid[tid].tfds_in_queue++; }
@@ -895,7 +897,7 @@ int iwl_tx_skb(struct iwl_priv *priv, stiwl_txq_update_write_ptr (priv, txq);spin_unlock_irqrestore (&priv->lock, flags); }else { -ieee80211_stop_queue (priv->hw, txq->swq_id); +iwl_stop_queue (priv, txq->swq_id); } }
@@ -1433,7 +1435,7 @@ void iwl_rx_reply_compressed_ba(struct iif ((iwl_queue_space (&txq->q) > txq->q.low_mark) && priv->mac80211_registered && (agg->state !=IWL_EMPTYING_HW_QUEUE_DELBA )) -ieee80211_wake_queue (priv->hw, txq->swq_id); +iwl_wake_queue (priv, txq->swq_id);iwl_txq_check_empty (priv, sta_id, tid, scd_flow); }
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -1
@@ -1168,7 +1168,7 @@ static int iwl3945_tx_skb(struct iwl_prispin_unlock_irqrestore (&priv->lock, flags); } -ieee80211_stop_queue (priv->hw,skb_get_queue_mapping (skb)); +iwl_stop_queue (priv,skb_get_queue_mapping (skb)); }return 0 ;
Johannes Berg
maintainerQuoted 1 line · Johannes Berg
Here's my patch set for improving aggregation
John, can I convince you to put this on track for .30 despite being posted just hours before the merge window officially opened? The reason I'm asking is that otherwise I'll have to support two code bases with rather different ways to have aggregation working for iwlwifi again, with different sets of bugs and different ways to fix it. This patch set has also been tested fairly extensively already [1] inside Intel for iwlwifi hardware and by Sujith for ath9k (and myself for both).
The decision isn't mine to make, obviously, and I'll put up with whatever you decide is best, even if that means supporting both code bases.
johannes
[1] unlike that patch to remove the superfluous code, sorry about that
Quoted 11 lines · Johannes Berg
Quoted 1 line · Johannes Berg
Here's my patch set for improving aggregation
John, can I convince you to put this on track for .30 despite being posted just hours before the merge window officially opened? The reason I'm asking is that otherwise I'll have to support two code bases with rather different ways to have aggregation working for iwlwifi again, with different sets of bugs and different ways to fix it. This patch set has also been tested fairly extensively already [1] inside Intel for iwlwifi hardware and by Sujith for ath9k (and myself for both).
It is not accurate to say Sujith has extensively tested this for ath9k, he probably just ran it a few times. So I cannot say we are as comfortable with the patches as you or Intel seem to be already.
Luis
Quoted 14 lines · Luis R. Rodriguez
Quoted 11 lines · Johannes Berg
Quoted 1 line · Johannes Berg
Here's my patch set for improving aggregation
John, can I convince you to put this on track for .30 despite being posted just hours before the merge window officially opened? The reason I'm asking is that otherwise I'll have to support two code bases with rather different ways to have aggregation working for iwlwifi again, with different sets of bugs and different ways to fix it. This patch set has also been tested fairly extensively already [1] inside Intel for iwlwifi hardware and by Sujith for ath9k (and myself for both).
Quoted 3 lines
It is not accurate to say Sujith has extensively tested this for ath9k, he probably just ran it a few times. So I cannot say we are as comfortable with the patches as you or Intel seem to be already.
Johannes,
Given Luis's objection I'm inclined to delay. I have asked him to try to "get comfortable" with this patch series over the next few days. If that happens, then I'll try to get this merged during the window.
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Johannes Berg
maintainerQuoted 3 lines · John W. Linville
Quoted 3 lines
It is not accurate to say Sujith has extensively tested this for ath9k, he probably just ran it a few times. So I cannot say we are as comfortable with the patches as you or Intel seem to be already.
Indeed, both Sujith and I just gave it a few test runs. Given that ath9k enables aggregation on the first packet always though, the code was definitely exercised.
Quoted 4 lines
Given Luis's objection I'm inclined to delay. I have asked him to try to "get comfortable" with this patch series over the next few days. If that happens, then I'll try to get this merged during the window.
Fair enough.
johannes
Re: [PATCH 1/8] mac80211: rewrite fragmentation
In reply to Johannes BergT24gTW9uLCBNYXIgMjMsIDIwMDkgYXQgOToyOCBBTSwgSm9oYW5uZXMgQmVyZwo8am9oYW5uZXNA c2lwc29sdXRpb25zLm5ldD4gd3JvdGU6Cj4gRnJhZ21lbnRhdGlvbiBjdXJyZW50bHkgdXNlcyBh biBhbGxvY2F0ZWQgYXJyYXkgdG8gc3RvcmUgdGhlCj4gZnJhZ21lbnQgc2ticywgYW5kIHRoZW4g a2VlcHMgdHJhY2sgb2Ygd2hpY2ggaGF2ZSBiZWVuIHNlbnQKPiBhbmQgd2hpY2ggYXJlIHN0aWxs IHBlbmRpbmcgZXRjLiBUaGlzIGlzIHJhdGhlciBjb21wbGljYXRlZDsKPiBtYWtlIGl0IHNpbXBs ZXIgYnkganVzdCBjaGFpbmluZyB0aGUgZnJhZ21lbnRzIGludG8gc2tiLT5uZXh0Cj4gYW5kIHJl bW92aW5nIGZyb20gdGhhdCBsaXN0IHdoZW4gc2VudC4gQWxzbyBzaW1wbGlmaWVzIGFsbAo+IGNv ZGUgdGhhdCBuZWVkcyB0byB0b3VjaCBmcmFnbWVudHMsIHNpbmNlIGl0IG5vdyBvbmx5IG5lZWRz Cj4gdG8gd2FsayB0aGUgc2tiLT5uZXh0IGxpc3QuCj4KPiBUaGlzIGlzIGEgcHJlcmVxdWlzaXRl IGZvciBmaXhpbmcgdGhlIHN0b3JlZCBwYWNrZXQgY29kZSwKPiB3aGljaCBJIG5lZ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ro ZXIgY2FzZSB3aGVyZSB0aGlzIGNvdWxkIGJlIGFmZmVjdGVkCndlIG1pZ2h0IGFzIHdlbGwgcmVt b3ZlIHRoYXQgZmlyc3QgdXBkYXRlIGFzIGF0IGxlYXN0IGZvciBtYWM4MDIxMSBpdHMKY29tcGxl dGVseSB1bnRvdWNoZWQuCgpPdGhlciB0aGFuIHRoYXQ6CgpSZXZpZXdlZC1ieTogTHVpcyBSLiBS b2RyaWd1ZXogPGxyb2RyaWd1ZXpAYXRoZXJvcy5jb20+CgogIEx1aXMK
W T F..............?
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
Re: [PATCH 1/8] mac80211: rewrite fragmentation
2009/3/25 Julian Calaby <[email protected]>:
Quoted 5 lines
2009/3/26 Luis R. Rodriguez <[email protected]>:
Quoted 2 lines
1bnRvdWNoZWQuCgpPdGhlciB0aGFuIHRoYXQ6CgpSZXZpZXdlZC1ieTogTHVpcyBSLiBS b2RyaWd1ZXogPGxyb2RyaWd1ZXpAYXRoZXJvcy5jb20+CgogIEx1aXMK
W T F..............?
WTF^pi.. I don't know I used fscking gmail with firefox... hmmm. Let try again..
Luis
Re: [PATCH 1/8] mac80211: rewrite fragmentation
In reply to Luis R. RodriguezQuoted 10 lines · Luis R. Rodriguez
I see only one possible regression with this patch and that is that it seems you forgot to update the
mdev->trans_startin the new loop on each fragment.As far as I can tell this would only introduce a regression with if someone is using a netdev watchdog on the mdev, if we don't care about that and I'm not missing any other case where this could be affected we might as well remove that first update as at least for mac80211 its completely untouched.
Quoted 3 lines
Other than that:
Reviewed-by Luis R. Rodriguez <[email protected]>
Above is my actual reply, seems gmail stored it properly... hmm.......
Luis
Re: [PATCH 2/8] mac80211: fix A-MPDU queue assignment
In reply to Johannes BergQuoted 10 lines · Johannes Berg
Internally, mac80211 requires the skb's queue mapping to be set to the AC queue, not the virtual A-MPDU queue. This is not done correctly currently, this patch moves the code down to directly before the driver is invoked and adds a comment that it will be moved into the driver later.
Since this requires
__ieee80211_tx()to have the sta pointer, make sure to provide it inieee80211_tx_pending().Signed-off-by Johannes Berg <[email protected]>
Luis
Johannes Berg
maintainerRe: [PATCH 1/8] mac80211: rewrite fragmentation
In reply to Luis R. RodriguezQuoted 18 lines · Luis R. Rodriguez
Quoted 18 lines
net/mac80211/tx.c +7
-3-static int __ieee80211_tx (struct ieee80211_local *local,struct sk_buff *skb, +static int __ieee80211_tx (struct ieee80211_local *local,struct ieee80211_tx_data *tx) { +struct sk_buff *skb = tx->skb, *next;struct ieee80211_tx_info *info; -int ret, i; +int ret; +bool fragm = false; -if (skb) { + local->mdev->trans_start = jiffies; + +while (skb) {if (ieee80211_queue_stopped (&local->hw,skb_get_queue_mapping (skb)))return IEEE80211_TX_PENDING ;
Quoted 10 lines
net/mac80211/tx.c static int ieee80211_tx_prepare(struct i · line 1118
Quoted 6 lines
net/mac80211/tx.c +0
-6- ret = local->ops->tx (local_to_hw (local), skb); -if (ret) -return IEEE80211_TX_AGAIN ; - local->mdev->trans_start = jiffies; -ieee80211_led_tx (local,1 ); - }I see only one possible regression with this patch and that is that it seems you forgot to update the
mdev->trans_startin the new loop on each fragment.
Well, that was actually intentional. Since none of the code here can block the time between the various assignments of trans_start would be _very_ small, and as such the multiple assignments can't really be necessary.
Quoted 5 lines
As far as I can tell this would only introduce a regression with if someone is using a netdev watchdog on the mdev, if we don't care about that and I'm not missing any other case where this could be affected we might as well remove that first update as at least for mac80211 its completely untouched.
netdev watchdog is always running for all netdevs :)
Quoted 3 lines
Other than that:
Reviewed-by Luis R. Rodriguez <[email protected]>
Thanks for looking!
johannes
Re: [PATCH 3/8] mac80211: rework the pending packets code
In reply to Johannes BergQuoted 7 lines · Johannes Berg
The pending packets code is quite incomprehensible, uses memory barriers nobody really understands, etc. This patch reworks it entirely, using the queue spinlock, proper stop bits and the skb queues themselves to indicate whether packets are pending or not (rather than a separate variable like before).
Signed-off-by Johannes Berg <[email protected]>
<-- snip -->
Quoted 59 lines
/*
net/mac80211/tx.c +22
-20@@ -1830,40 +1829,57 @@ void ieee80211_tx_pending(unsigned long {struct ieee80211_local *local = (struct ieee80211_local *)data;struct net_device *dev = local->mdev; -struct ieee80211_tx_stored_packet *store;struct ieee80211_hdr *hdr; +unsigned long flags;struct ieee80211_tx_data tx;int i, ret; +bool next;rcu_read_lock ();netif_tx_lock_bh (dev); +for (i =0 ; i < local->hw.queues; i++) { -/* Check that this queue is ok */ -if (__netif_subqueue_stopped (local->mdev, i) && - !test_bit (i, local->queues_pending_run)) -continue ; +/* +* If queue is stopped by something other than due to pending +* frames, or we have no pending frames, proceed to next queue. +*/ +spin_lock_irqsave (&local->queue_stop_reason_lock, flags); + next = false; +if (local->queue_stop_reasons[i] != +BIT (IEEE80211_QUEUE_STOP_REASON_PENDING ) || +skb_queue_empty (&local->pending[i])) + next = true; +spin_unlock_irqrestore (&local->queue_stop_reason_lock, flags); -if (!test_bit (i, local->queues_pending)) { -clear_bit (i, local->queues_pending_run); -ieee80211_wake_queue (&local->hw, i); +if (next)continue ; - } -clear_bit (i, local->queues_pending_run); +/* +* start the queue now to allow processing our packets, +* we're under the tx lock here anyway so nothing will +* happen as a result of this +*/ netif_start_subqueue (local->mdev, i); - store = &local->pending_packet[i]; - tx.flags =0 ; - tx.skb = store->skb; - hdr = (struct ieee80211_hdr *)tx.skb->data; - tx.sta =sta_info_get (local, hdr->addr1); - ret =__ieee80211_tx (local, &tx); - store->skb = tx.skb; -if (!ret) { -clear_bit (i, local->queues_pending); -ieee80211_wake_queue (&local->hw, i); +while (!skb_queue_empty (&local->pending[i])) { + tx.flags =0 ;
net/mac80211/tx.c void ieee80211_tx_pending(unsigned long · line 1875
Quoted 10 lines
net/mac80211/tx.c +9
-0+ tx.skb =skb_dequeue (&local->pending[i]); + hdr = (struct ieee80211_hdr *)tx.skb->data; + tx.sta =sta_info_get (local, hdr->addr1); + + ret =__ieee80211_tx (local, &tx); +if (ret !=IEEE80211_TX_OK ) { +skb_queue_head (&local->pending[i], tx.skb); +break ; + } }
So this is good functional change, might be worth mentioning in the commit log, that is, we now requeue onto the pending queue the skb when the driver's tx() didn't return NETDEV_TX_OK or when __ieee80211_tx() returns IEEE80211_TX_PENDING (which happens when the queue is stopped). Maybe even better as a seperate patch. Before this we were just dropping the skbs in the pending queue under those same conditions.
Other than that:
Luis
Re: [PATCH 4/8] mac80211: clean up __ieee80211_tx args
In reply to Johannes BergQuoted 6 lines · Johannes Berg
__ieee80211_txtakes a structieee80211_tx_dataargument, but only uses a few of its members, namely 'skb' and 'sta'. Make that explicit, so that less internal knowledge is required inieee80211_tx_pendingand the possibility of introducing errors here is removed.Signed-off-by Johannes Berg <[email protected]>
Luis
Johannes Berg
maintainerRe: [PATCH 3/8] mac80211: rework the pending packets code
In reply to Luis R. RodriguezQuoted 6 lines · Luis R. Rodriguez
So this is good functional change, might be worth mentioning in the commit log, that is, we now requeue onto the pending queue the skb when the driver's
tx()didn't returnNETDEV_TX_OKor when__ieee80211_tx()returnsIEEE80211_TX_PENDING(which happens when the queue is stopped). Maybe even better as a seperate patch. Before this we were just dropping the skbs in the pending queue under those same conditions.
Hmm? We always did that. Well, we didn't put it on there directly, we kept it in extra_tx or whatever it was called and then later pushed it over to the pending_frames thing.
johannes
Re: [PATCH 5/8] mac80211: unify and fix TX aggregation start
In reply to Johannes BergQuoted 11 lines · Johannes Berg
When TX aggregation becomes operational, we do a number of steps:
1) print a debug message
2) wake the virtual queue
3) notify the driverUnfortunately, 1) and 3) are only done if the driver is first to reply to the aggregation request, it is, however, possible that the remote station replies before the driver! Thus, unify the code for this and call the new function
ieee80211_agg_tx_operationalin both places where TX aggregation can become operational.
Quoted 4 lines
Additionally, rename the driver notification from
IEEE80211_AMPDU_TX_RESUMEtoIEEE80211_AMPDU_TX_OPERATIONAL.Signed-off-by Johannes Berg <[email protected]>
Nice catch man!
Luis
Re: [PATCH 6/8] mac80211: add skb length sanity checking
In reply to Johannes BergQuoted 11 lines · Johannes Berg
We just found a bug in zd1211rw where it would reject packets in the ->tx() method but leave them modified, which would cause retransmit attempts with completely bogus skbs, eventually leading to a panic due to not having enough headroom in those.
This patch adds a sanity check to mac80211 to catch such driver mistakes; in this case we warn and drop the skb.
Signed-off-by Johannes Berg <[email protected]>
Heh well this is obviously even a stable candidate and it got merged already :D.
Luis
Re: [PATCH 6/8] mac80211: add skb length sanity checking
Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Johannes Berg
We just found a bug in zd1211rw where it would reject packets in the ->tx() method but leave them modified, which would cause retransmit attempts with completely bogus skbs, eventually leading to a panic due to not having enough headroom in those.
Quoted 8 lines
Quoted 5 lines
This patch adds a sanity check to mac80211 to catch such driver mistakes; in this case we warn and drop the skb.
Signed-off-by Johannes Berg <[email protected]>Heh well this is obviously even a stable candidate and it got merged already :D.
Nevermind, I was looking at .30, heh. So if zd1211rw also manged the skb len in older kernels it seems this is stable candidate. Too lazy to check right now though.
Luis
Re: [PATCH 5/8] mac80211: unify and fix TX aggregation start
In reply to Luis R. RodriguezQuoted 12 lines · Luis R. Rodriguez
Quoted 11 lines · Johannes Berg
When TX aggregation becomes operational, we do a number of steps:
=C2=A01) print a debug message
=C2=A02) wake the virtual queue
=C2=A03) notify the driverUnfortunately, 1) and 3) are only done if the driver is first to reply to the aggregation request, it is, however, possible that the remote station replies before the driver! Thus, unify the code for this and call the new function
ieee80211_agg_tx_operationalin both places where TX aggregation can become operational.
Quoted 8 lines
Quoted 4 lines
Additionally, rename the driver notification from
IEEE80211_AMPDU_TX_RESUMEtoIEEE80211_AMPDU_TX_OPERATIONAL.Signed-off-by Johannes Berg <[email protected]>Nice catch man!
Reviewed-by Luis R. Rodriguez <[email protected]>
Hm, maybe also a backported version could go to stable? Perhaps we can trigger a panic on a UP box?
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
In reply to Johannes BergQuoted 4 lines · Johannes Berg
Instead of stopping the entire AC queue when enabling aggregation (which was only done for hardware with aggregation queues) buffer the packets for each station, and release them to the pending skb queue once aggregation is turned on successfully.
Thank you for the nice compromised solution.
Quoted 8 lines
We get a little more code, but it becomes conceptually simpler and we can remove the entire virtual queue mechanism from mac80211 in a follow-up patch.
This changes how mac80211 behaves towards drivers that support aggregation but have no hardware queues -- those drivers will now not be handed packets while the aggregation session is being established, but only after it has been fully established.
That's fine from a logical point of view as compromise here as our ampdu start should be relatively quick. Now while I can say this from a logical point of view this patch obviously needed more testing but lets see how it holds up and I'm glad you're the one who wrote it. I'm confident there won't be any issues but that is something I cannot gaurantee just based on the review. We now need to go out and tests this. All other patches previous to this make 100% perfect sense.
I'm particularly interested in seeing results with AP support. Did you get to test that with ath9k by any chance?
Hauke -- just a heads up since you're quick with this now :) :skb_queue_splice_tail_init() needs some backporting to 2.6.27. I'd do it but I'm beat and calling it a day now.
More comments below. I've tried to remove all the hunks I didn't have comments on.
Quoted 20 lines
net/mac80211/agg-tx.c +1
-13@@ -308,21 +296,19 @@ int ieee80211_start_tx_ba_session(struct ret = -ENOSPC ; goto err_unlock_sta; } - -/* -* If we successfully allocate the session, we can't have -* anything going on on the queue this TID maps into, so -* stop it for now. This is a "virtual" stop using the same -* mechanism that drivers will use. -* -* XXX: queue up frames for this session in the sta_info -* struct instead to avoid hitting all other STAs. -*/ -ieee80211_stop_queue_by_reason ( - &local->hw, hw->queues + qn, -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); } +/*
net/mac80211/agg-tx.c int ieee80211_start_tx_ba_session(struct · line 311
Quoted 10 lines
net/mac80211/agg-tx.c +10
-0+* While we're asking the driver about the aggregation, +* stop the AC queue so that we don't have to worry +* about frames that came in while we were doing that, +* which would require us to put them to the AC pending +* afterwards which just makes the code more complex. +*/ +ieee80211_stop_queue_by_reason ( + &local->hw,ieee80211_ac_from_tid (tid), +IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); +
ath9k's ampdu start is pretty quick anyway, so this won't be for long.
Quoted 8 lines
net/mac80211/agg-tx.c +4
-0@@ -404,6 +399,45 @@ int ieee80211_start_tx_ba_session(struct }EXPORT_SYMBOL (ieee80211_start_tx_ba_session); +/* +* splice packets from the STA's pending to the local pending, +* requires a call to ieee80211_agg_splice_finish and holding +* local->ampdu_lock across both calls.
net/mac80211/agg-tx.c int ieee80211_start_tx_ba_session(struct · line 415
Quoted 10 lines
net/mac80211/agg-tx.c +10
-0+*/ +static void ieee80211_agg_splice_packets (struct ieee80211_local *local, +struct sta_info *sta,u16 tid) +{ +unsigned long flags; +u16 queue =ieee80211_ac_from_tid (tid); + +ieee80211_stop_queue_by_reason ( + &local->hw, queue, +IEEE80211_QUEUE_STOP_REASON_AGGREGATION );
No point in stopping the queue if the STA's tid queue is empty.
Quoted 7 lines
net/mac80211/agg-tx.c +1
-1@@ -602,22 +637,19 @@ void ieee80211_stop_tx_ba_cb(struct ieee WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);spin_lock_bh (&sta->lock); +spin_lock (&local->ampdu_lock); - if (*state & HT_AGG_STATE_INITIATOR_MSK &&
net/mac80211/agg-tx.c void ieee80211_stop_tx_ba_cb(struct ieee · line 642
Quoted 10 lines
net/mac80211/agg-tx.c +1
-9- hw->ampdu_queues) { -/* -* Wake up this queue, we stopped it earlier, -* this will in turn wake the entire AC. -*/ -ieee80211_wake_queue_by_reason (hw, - hw->queues + sta->tid_to_tx_q[tid], -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); - } +ieee80211_agg_splice_packets (local, sta, tid);
Is it possible for ieee80211_stop_tx_ba_cb() to be called while state of the tid is not yet operational? from what I can tell that's the only case when we would have added skbs to the STA's tid pending queue.
net/mac80211/agg-tx.c void ieee80211_stop_tx_ba_cb(struct ieee · line 645
Quoted 3 lines
net/mac80211/agg-tx.c +1
-0*state =HT_AGG_STATE_IDLE ; +/* from now on packets are no longer put onto sta->pending */
I think it would help to refer to the pendign queue consitantly instead as something like "STA's TID pending queue" as that is what it is. We also now have the local->pending queue. STA's pending queue seems to imply its also used for non-aggregation sessions.
See -- if the state is not operation nothing would have gone been put into the STA's tid pending queue. Might also be worth mentioning that in the comment.
Quoted 8 lines
net/mac80211/tx.c +4
-0@@ -1013,20 +1013,53 @@ __ieee80211_tx_prepare(struct ieee80211_*/ } +/* +* If this flag is set to true anywhere, and we get here, +* we are doing the needed processing, so remove the flag +* now.
net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1028
Quoted 10 lines
net/mac80211/tx.c +5
-1+*/ + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING ; + hdr = (struct ieee80211_hdr *) skb->data; tx->sta =sta_info_get (local, hdr->addr1); -if (tx->sta &&ieee80211_is_data_qos (hdr->frame_control)) { +if (tx->sta &&ieee80211_is_data_qos (hdr->frame_control) && + (local->hw.flags &IEEE80211_HW_AMPDU_AGGREGATION )) {
Hm, why were we not crashing here before? I figure we would have with something like this:
state = &tx->sta->ampdu_mlme.tid_state_tx[tid];
That it itself should be separate patch, but too late now. Anyway the new added check for IEEE80211_HW_AMPDU_AGGREGATION should go to stable.
Quoted 15 lines
net/mac80211/tx.c +10
-0unsigned long flags; +struct tid_ampdu_tx *tid_tx; + qc =ieee80211_get_qos_ctl (hdr); tid = *qc &IEEE80211_QOS_CTL_TID_MASK ;spin_lock_irqsave (&tx->sta->lock, flags); +/* +* XXX: This spinlock could be fairly expensive, but see the +* comment in agg-tx.c:ieee80211_agg_tx_operational(). +* One way to solve this would be to do something RCU-like +* for managing the tid_tx struct and using atomic bitops +* for the actual state -- by introducing an actual +* 'operational' bit that would be possible. It would +* require changing ieee80211_agg_tx_operational() to
net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1052
Quoted 10 lines
net/mac80211/tx.c +7
-1+* set that bit, and changing the way tid_tx is managed +* everywhere, including races between that bit and +* tid_tx going away (tid_tx being added can be easily +* committed to memory before the 'operational' bit). +*/ + tid_tx = tx->sta->ampdu_mlme.tid_tx[tid]; state = &tx->sta->ampdu_mlme.tid_state_tx[tid]; -if (*state ==HT_AGG_STATE_OPERATIONAL ) +if (*state ==HT_AGG_STATE_OPERATIONAL ) { info->flags |=IEEE80211_TX_CTL_AMPDU ;
See, when its operational we don't add stuff to the STA's TID pending queue.
This piece:
net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1058
Quoted 6 lines
net/mac80211/tx.c +6
-0+ }else if (*state !=HT_AGG_STATE_IDLE ) { +/* in progress */ + queued = true; + info->flags |=IEEE80211_TX_INTFL_NEED_TXPROCESSING ; +__skb_queue_tail (&tid_tx->pending, skb); + }
Can probably be ported to stable too, to just TX_DROP.
net/mac80211/tx.c static int ieee80211_tx(struct net_devic · line 1303
Quoted 11 lines
net/mac80211/tx.c +6
-1@@ -1251,7 +1295,12 @@ static int ieee80211_tx(struct net_devic do { next = skb->next; skb->next = NULL; - skb_queue_tail(&local->pending[queue], skb); + if (unlikely(txpending)) + skb_queue_head(&local->pending[queue], + skb); + else + skb_queue_tail(&local->pending[queue], + skb);
For someone who hasn't read all the pending queue code stuff the above would be a little brain twister. It might be good to leave a comment explaining why txpendign would be set and why we add it to the head (i.e. because the "skb" sent at a previous time was put into a pending queue). Maybe even rename txpending to something like skb_was_pending.
net/mac80211/tx.c int ieee80211_master_start_xmit(struct s · line 1410
Quoted 6 lines
net/mac80211/tx.c +1
-1@@ -1360,7 +1407,7 @@ int ieee80211_master_start_xmit(struct s "originating device\n", dev->name);#endif dev_kfree_skb (skb); -return 0 ; +return NETDEV_TX_OK ;
All these NETDEV_TX_OK could've gone into a separate patch.
Luis
Re: [PATCH 8/8] mac80211/iwlwifi: move virtual A-MDPU queue bookkeeping to iwlwifi
In reply to Johannes BergQuoted 12 lines · Johannes Berg
This patch removes all the virtual A-MPDU-queue bookkeeping from mac80211. Curiously, iwlwifi already does its own bookkeeping, so it doesn't require much changes except where it needs to handle starting and stopping the queues in mac80211.
To handle the queue stop/wake properly, we rewrite the software queue number for aggregation frames and internally to iwlwifi keep track of the queues that map into the same AC queue, and only talk to mac80211 about the AC queue. The implementation requires calling two new functions,
iwl_stop_queueandiwl_wake_queueinstead of the mac80211 counterparts.
Quoted 2 lines
Signed-off-by Johannes Berg <[email protected]>Cc Reinette Chattre <[email protected]>
This one I enjoyed the most. Fucking awesome.
Luis
Johannes Berg
maintainerRe: [PATCH 5/8] mac80211: unify and fix TX aggregation start
In reply to Luis R. RodriguezQuoted 9 lines · Luis R. Rodriguez
Quoted 9 lines
Quoted 9 lines
Unfortunately, 1) and 3) are only done if the driver is first to reply to the aggregation request, it is, however, possible that the remote station replies before the driver! Thus, unify the code for this and call the new function
ieee80211_agg_tx_operationalin both places where TX aggregation can become operational.Additionally, rename the driver notification from
IEEE80211_AMPDU_TX_RESUMEtoIEEE80211_AMPDU_TX_OPERATIONAL.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Johannes Berg <[email protected]>Nice catch man!
Reviewed-by Luis R. Rodriguez <[email protected]>Hm, maybe also a backported version could go to stable? Perhaps we can trigger a panic on a UP box?
No need -- ath9k always replies _instantly_, and iwlwifi doesn't support aggregation in stable.
johannes
Johannes Berg
maintainerRe: [PATCH 6/8] mac80211: add skb length sanity checking
In reply to Luis R. RodriguezQuoted 4 lines · Luis R. Rodriguez
Quoted 4 lines
Quoted 4 lines
This patch adds a sanity check to mac80211 to catch such driver mistakes; in this case we warn and drop the skb.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Johannes Berg <[email protected]>Heh well this is obviously even a stable candidate and it got merged already :D.
Nevermind, I was looking at .30, heh. So if zd1211rw also manged the skb len in older kernels it seems this is stable candidate. Too lazy to check right now though.
The fixes should go to stable, but this won't apply without serious backporting.
johannes
Johannes Berg
maintainerRe: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
In reply to Luis R. RodriguezQuoted 5 lines · Luis R. Rodriguez
Quoted 4 lines
This changes how mac80211 behaves towards drivers that support aggregation but have no hardware queues -- those drivers will now not be handed packets while the aggregation session is being established, but only after it has been fully established.
Quoted 8 lines
That's fine from a logical point of view as compromise here as our ampdu start should be relatively quick. Now while I can say this from a logical point of view this patch obviously needed more testing but lets see how it holds up and I'm glad you're the one who wrote it. I'm confident there won't be any issues but that is something I cannot gaurantee just based on the review. We now need to go out and tests this. All other patches previous to this make 100% perfect sense.
:)
I think it also makes more _sense_ to not ask the driver to handle these frames, because we won't set the AMPDU flag correctly if the session start is declined.
Quoted 6 lines
Quoted 6 lines
net/mac80211/agg-tx.c +6
-0+/* +* While we're asking the driver about the aggregation, +* stop the AC queue so that we don't have to worry +* about frames that came in while we were doing that, +* which would require us to put them to the AC pending +* afterwards which just makes the code more complex.
Quoted 8 lines
net/mac80211/agg-tx.c int ieee80211_start_tx_ba_session(struct · line 311
Quoted 5 lines
net/mac80211/agg-tx.c +5
-0+*/ +ieee80211_stop_queue_by_reason ( + &local->hw,ieee80211_ac_from_tid (tid), +IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); +ath9k's ampdu start is pretty quick anyway, so this won't be for long.
Yup.
Quoted 8 lines
Quoted 8 lines
net/mac80211/agg-tx.c +8
-0+/* +* splice packets from the STA's pending to the local pending, +* requires a call to ieee80211_agg_splice_finish and holding +* local->ampdu_lock across both calls. +*/ +static void ieee80211_agg_splice_packets (struct ieee80211_local *local, +struct sta_info *sta,u16 tid) +{
Quoted 8 lines
net/mac80211/agg-tx.c int ieee80211_start_tx_ba_session(struct · line 415
Quoted 6 lines
net/mac80211/agg-tx.c +6
-0+unsigned long flags; +u16 queue =ieee80211_ac_from_tid (tid); + +ieee80211_stop_queue_by_reason ( + &local->hw, queue, +IEEE80211_QUEUE_STOP_REASON_AGGREGATION );No point in stopping the queue if the STA's tid queue is empty.
Hmm, true I guess.
Quoted 6 lines
Quoted 6 lines
net/mac80211/agg-tx.c +1
-0@@ -602,22 +637,19 @@ void ieee80211_stop_tx_ba_cb(struct ieee WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);spin_lock_bh (&sta->lock); +spin_lock (&local->ampdu_lock);
Quoted 16 lines
net/mac80211/agg-tx.c void ieee80211_stop_tx_ba_cb(struct ieee · line 642
Quoted 11 lines
net/mac80211/agg-tx.c +1
-10-if (*state &HT_AGG_STATE_INITIATOR_MSK && - hw->ampdu_queues) { -/* -* Wake up this queue, we stopped it earlier, -* this will in turn wake the entire AC. -*/ -ieee80211_wake_queue_by_reason (hw, - hw->queues + sta->tid_to_tx_q[tid], -IEEE80211_QUEUE_STOP_REASON_AGGREGATION ); - } +ieee80211_agg_splice_packets (local, sta, tid);Is it possible for
ieee80211_stop_tx_ba_cb()to be called while state of the tid is not yet operational? from what I can tell that's the only case when we would have added skbs to the STA's tid pending queue.
This happens when the session is denied by the peer.
Quoted 11 lines
net/mac80211/agg-tx.c void ieee80211_stop_tx_ba_cb(struct ieee · line 645
Quoted 2 lines
net/mac80211/agg-tx.c +1
-0*state =HT_AGG_STATE_IDLE ; +/* from now on packets are no longer put onto sta->pending */ I think it would help to refer to the pendign queue consitantly instead as something like "STA's TID pending queue" as that is what it is. We also now have the
local->pendingqueue. STA's pending queue seems to imply its also used for non-aggregation sessions.See -- if the state is not operation nothing would have gone been put into the STA's tid pending queue. Might also be worth mentioning that in the comment.
Hmm, yeah, might rewrite the comments a bit. Mind if I do a separate patch later?
Quoted 22 lines
Quoted 8 lines
net/mac80211/tx.c +4
-0@@ -1013,20 +1013,53 @@ __ieee80211_tx_prepare(struct ieee80211_*/ } +/* +* If this flag is set to true anywhere, and we get here, +* we are doing the needed processing, so remove the flag +* now. net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1028
Quoted 10 lines
net/mac80211/tx.c +5
-1+*/ + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING ; + hdr = (struct ieee80211_hdr *) skb->data; tx->sta =sta_info_get (local, hdr->addr1); -if (tx->sta &&ieee80211_is_data_qos (hdr->frame_control)) { +if (tx->sta &&ieee80211_is_data_qos (hdr->frame_control) && + (local->hw.flags &IEEE80211_HW_AMPDU_AGGREGATION )) {Hm, why were we not crashing here before? I figure we would have with something like this:
Quoted 5 lines
state = &tx->sta->ampdu_mlme.tid_state_tx[tid];
That it itself should be separate patch, but too late now. Anyway the new added check for
IEEE80211_HW_AMPDU_AGGREGATIONshould go to stable.
Nah, state_tx always exists (and will be IDLE) but this was just an added check to make us not need the spinlock for non-ampdu hw.
Quoted 31 lines
Quoted 15 lines
net/mac80211/tx.c +10
-0unsigned long flags; +struct tid_ampdu_tx *tid_tx; + qc =ieee80211_get_qos_ctl (hdr); tid = *qc &IEEE80211_QOS_CTL_TID_MASK ;spin_lock_irqsave (&tx->sta->lock, flags); +/* +* XXX: This spinlock could be fairly expensive, but see the +* comment in agg-tx.c:ieee80211_agg_tx_operational(). +* One way to solve this would be to do something RCU-like +* for managing the tid_tx struct and using atomic bitops +* for the actual state -- by introducing an actual +* 'operational' bit that would be possible. It would +* require changing ieee80211_agg_tx_operational() to net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1052
Quoted 10 lines
net/mac80211/tx.c +7
-1+* set that bit, and changing the way tid_tx is managed +* everywhere, including races between that bit and +* tid_tx going away (tid_tx being added can be easily +* committed to memory before the 'operational' bit). +*/ + tid_tx = tx->sta->ampdu_mlme.tid_tx[tid]; state = &tx->sta->ampdu_mlme.tid_state_tx[tid]; -if (*state ==HT_AGG_STATE_OPERATIONAL ) +if (*state ==HT_AGG_STATE_OPERATIONAL ) { info->flags |=IEEE80211_TX_CTL_AMPDU ;See, when its operational we don't add stuff to the STA's TID pending queue.
This piece:
Quoted 8 lines
net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1058
Quoted 6 lines
net/mac80211/tx.c +6
-0+ }else if (*state !=HT_AGG_STATE_IDLE ) { +/* in progress */ + queued = true; + info->flags |=IEEE80211_TX_INTFL_NEED_TXPROCESSING ; +__skb_queue_tail (&tid_tx->pending, skb); + }Can probably be ported to stable too, to just
TX_DROP.
No, why? We're handing the frames to the driver. It wants to handle those frames before agg session is started correctly. That's what I was referring to before with this making more sense now.
Quoted 9 lines
Quoted 9 lines
net/mac80211/tx.c +4
-1@@ -1251,7 +1295,12 @@ static int ieee80211_tx(struct net_devic do { next = skb->next; skb->next = NULL; - skb_queue_tail(&local->pending[queue], skb); + if (unlikely(txpending)) + skb_queue_head(&local->pending[queue], + skb); + else
Quoted 8 lines
net/mac80211/tx.c static int ieee80211_tx(struct net_devic · line 1303
Quoted 2 lines
net/mac80211/tx.c +2
-0+skb_queue_tail (&local->pending[queue], + skb);For someone who hasn't read all the pending queue code stuff the above would be a little brain twister. It might be good to leave a comment explaining why txpendign would be set and why we add it to the head (i.e. because the "skb" sent at a previous time was put into a pending queue). Maybe even rename txpending to something like
skb_was_pending.
Ok that might make some sense, though as a parameter you can easily see where it's coming from, I think :) I agree that the entire code is a little brain twister...
Quoted 8 lines
net/mac80211/tx.c int ieee80211_master_start_xmit(struct s · line 1410
Quoted 6 lines
net/mac80211/tx.c +1
-1@@ -1360,7 +1407,7 @@ int ieee80211_master_start_xmit(struct s "originating device\n", dev->name);#endif dev_kfree_skb (skb); -return 0 ; +return NETDEV_TX_OK ;All these
NETDEV_TX_OKcould've gone into a separate patch.
I guess, they're also not strictly necessary since 0 == TX_OK :)
johannes
Re: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 17 lines · Johannes Berg
Quoted 5 lines · Luis R. Rodriguez
Quoted 4 lines
This changes how mac80211 behaves towards drivers that support aggregation but have no hardware queues -- those drivers will now not be handed packets while the aggregation session is being established, but only after it has been fully established.
Quoted 8 lines
That's fine from a logical point of view as compromise here as our ampdu start should be relatively quick. Now while I can say this from a logical point of view this patch obviously needed more testing but lets see how it holds up and I'm glad you're the one who wrote it. I'm confident there won't be any issues but that is something I cannot gaurantee just based on the review. We now need to go out and tests this. All other patches previous to this make 100% perfect sense.
Quoted 2 lines
:)
I think it also makes more _sense_ to not ask the driver to handle th=
ese
Quoted 2 lines
frames, because we won't set the AMPDU flag correctly if the session start is declined.
Hm, wouldn't we send them as normal frames if its declined here eventua= lly?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0
-0@@ -602,22 +637,19 @@ void ieee80211_stop_tx_ba_cb(struct ieee=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
=C2=A0 =C2=A0
spin_lock_bh(&sta->lock);
+ =C2=A0spin_lock(&local->ampdu_lock);- =C2=A0 if (*state &
HT_AGG_STATE_INITIATOR_MSK&&
- =C2=A0 =C2=A0 =C2=A0hw->ampdu_queues) {
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Wake up this queue, w=
e stopped it earlier,
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* this will in turn wak=
e the entire AC.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ieee80211_wake_queue_by_reaso=
n(hw,
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 h=
w->queues + sta->tid_to_tx_q[tid],
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 I=
EEE80211_QUEUE_STOP_REASON_AGGREGATION);
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
- =C2=A0 }
+ =C2=A0ieee80211_agg_splice_packets(local, sta, tid);Is it possible for
ieee80211_stop_tx_ba_cb()to be called while state of the tid is not yet operational? from what I can tell that's the only case when we would have added skbs to the STA's tid pending queue.This happens when the session is denied by the peer.
Ah, got it, thanks.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
=C2=A0 =C2=A0 *state =3D
HT_AGG_STATE_IDLE;
+ =C2=A0 /* from now on packets are no longer put onto sta->pendin=
g */
Quoted 2 lines
Quoted 2 lines
I think it would help to refer to the pendign queue consitantly inst=
ead
Quoted 1 line
Quoted 1 line
as something like "STA's TID pending queue" as that is what it is. W=
e also
Quoted 1 line
Quoted 1 line
now have the
local->pendingqueue. STA's pending queue seems to impl=
y
Quoted 8 lines
Quoted 5 lines
its also used for non-aggregation sessions.
See -- if the state is not operation nothing would have gone been put into the STA's tid pending queue. Might also be worth mentioning that in the comment.
Hmm, yeah, might rewrite the comments a bit. Mind if I do a separate patch later?
Nope.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0
-0@@ -1013,20 +1013,53 @@ __ieee80211_tx_prepare(struct ieee80211_=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/ =C2=A0 =C2=A0 }
+ =C2=A0 /*
+ =C2=A0 =C2=A0* If this flag is set to true anywhere, and we get =
here,
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0* we are doing the needed processing, so remove the=
flag
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
+ =C2=A0 =C2=A0* now.
+ =C2=A0 =C2=A0*/
+ =C2=A0info->flags&=3D ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; +
=C2=A0 =C2=A0 hdr =3D (structieee80211_hdr*)skb->data;=C2=A0 =C2=A0
tx->sta=3Dsta_info_get(local, hdr->addr1);- =C2=A0 if (
tx->sta&& ieee80211_is_data_qos(hdr->frame_control))=
{
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 if (
tx->sta&&ieee80211_is_data_qos(hdr->frame_control)=
&&
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 (
local->hw.flags& IEEE80211_HW_AMPDU_AGGRE=
GATION)) {
Quoted 4 lines
Quoted 4 lines
Hm, why were we not crashing here before? I figure we would have with something like this:
Quoted 8 lines
Quoted 5 lines
state =3D &tx->sta->ampdu_mlme.tid_state_tx[tid];
That it itself should be separate patch, but too late now. Anyway the new added check for
IEEE80211_HW_AMPDU_AGGREGATIONshould go to stable.Nah,
state_txalways exists (and will be IDLE) but this was just an added check to make us not need the spinlock for non-ampdu hw.
Ah yes, its the ampdu_mlme.tid_tx that gets kmalloc'd only on aggr session start.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long flags;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 structtid_ampdu_tx*tid_tx; +
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 qc =3D ieee80211_get_qos=
_ctl(hdr);
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tid =3D *qc & IEEE80211_=
QOS_CTL_TID_MASK;
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 spin_lock_irqsave(&tx->s=
ta->lock, flags);
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* XXX: This spinlock co=
uld be fairly expensive, but see the
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0c=
omment in agg-tx.c:ieee80211_agg_tx_operational().
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0O=
ne way to solve this would be to do something RCU-like
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0f=
or managing the tid_tx struct and using atomic bitops
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0f=
or the actual state -- by introducing an actual
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0'=
operational' bit that would be possible. It would
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0r=
equire changing ieee80211_agg_tx_operational() to
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0s=
et that bit, and changing the way tid_tx is managed
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0e=
verywhere, including races between that bit and
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0t=
id_tx going away (tid_tx being added can be easily
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* =C2=A0 =C2=A0 =C2=A0c=
ommitted to memory before the 'operational' bit).
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tid_tx=3D tx->sta->ampdu_mlm=
e.tid_tx[tid];
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 state =3D &tx->sta->ampd=
u_mlme.tid_state_tx[tid];
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (*state =3D=3D HT_AGG_STAT=
E_OPERATIONAL)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (*state =3D=3D HT_AGG_STAT=
E_OPERATIONAL) {
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 info->flags |=3D IEEE80211_TX_CTL_AMPDU;
Quoted 2 lines
Quoted 2 lines
See, when its operational we don't add stuff to the STA's TID pendin=
g
Quoted 5 lines
Quoted 5 lines
queue.
This piece:
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (*state !=3D HT_AGG=
_STATE_IDLE) {
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /=
* in progress */
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 q=
ueued =3D true;
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i=
nfo->flags |=3D IEEE80211_TX_INTFL_NEED_TXPROCESSING;
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _=
_skb_queue_tail(&tid_tx->pending, skb);
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
Can probably be ported to stable too, to just
TX_DROP.No, why? We're handing the frames to the driver. It wants to handle those frames before agg session is started correctly. That's what I w=
as
Quoted 1 line
referring to before with this making more sense now.
OK I see that but I am not sure of what's done to the skb in the old case if the session is note complete yet, nor now if the session gets declined. I can check later, right now I'm feeling lazy.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0
-0@@ -1251,7 +1295,12 @@ static int ieee80211_tx(struct net_devic=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 do {
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 next =3D skb->next;
Quoted 1 line
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 skb->next =3D NULL;
Quoted 1 line
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 skb_queue_tail(&local->pending[queue], skb);
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 if (unlikely(txpending))
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 skb_queue_head(&lo= cal->pending[queue],
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0skb);
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 else
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 skb_queue_tail(&lo= cal->pending[queue],
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0skb);
Quoted 2 lines
Quoted 2 lines
For someone who hasn't read all the pending queue code stuff the abo=
ve would be
Quoted 1 line
Quoted 1 line
a little brain twister. It might be good to leave a comment explaini=
ng why
Quoted 1 line
Quoted 1 line
txpendign would be set and why we add it to the head (i.e. because t=
he "skb" sent
Quoted 1 line
Quoted 1 line
at a previous time was put into a pending queue). Maybe even rename =
txpending to
Quoted 3 lines
Quoted 1 line
something like
skb_was_pending.Ok that might make some sense, though as a parameter you can easily s=
ee
Quoted 2 lines
where it's coming from, I think :) I agree that the entire code is a little brain twister...
Yeah.. I had to re-read aggregation code again to get the hang of it. Anything we can do to make
it easier for people to pick would be nice. I think I'll go patch up the aggr-tx kdoc too now, unless we
plan on nuking some stuff soon again. I suspect the next big change will be to move software based
aggregation queue handling and mapping to ACs within mac80211 for that type of hardware which
we'll need for ar9170, ralink stuff, broadcom (if that ever happens) and our next generation 11n USB
driver.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0
-0@@ -1360,7 +1407,7 @@ int ieee80211_master_start_xmit(struct s=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0"originating device\n", dev->name);
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
=C2=A0#endif
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dev_kfree_skb(skb);
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 returnNETDEV_TX_OK;All these
NETDEV_TX_OKcould've gone into a separate patch.I guess, they're also not strictly necessary since 0 =3D=3D
TX_OK:)
Sure, what I'm trying to say is these patches are pretty hard to review because of the topic,
it just helps to trim them down as much as possible -- but I realize even that is painful.
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 9 lines · Luis R. Rodriguez
Quoted 9 lines
Quoted 8 lines
That's fine from a logical point of view as compromise here as our ampdu start should be relatively quick. Now while I can say this from a logical point of view this patch obviously needed more testing but lets see how it holds up and I'm glad you're the one who wrote it. I'm confident there won't be any issues but that is something I cannot gaurantee just based on the review. We now need to go out and tests this. All other patches previous to this make 100% perfect sense.
Quoted 6 lines
Quoted 4 lines
:)
I think it also makes more _sense_ to not ask the driver to handle these frames, because we won't set the AMPDU flag correctly if the session start is declined.Hm, wouldn't we send them as normal frames if its declined here eventually?
Yes, we take them off the sta->pending, put them through TX processing and send them as normal frames.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
This piece:
net/mac80211/tx.c __ieee80211_tx_prepare(struct ieee80211_ · line 1058
Quoted 6 lines
net/mac80211/tx.c +6
-0+ }else if (*state !=HT_AGG_STATE_IDLE ) { +/* in progress */ + queued = true; + info->flags |=IEEE80211_TX_INTFL_NEED_TXPROCESSING ; +__skb_queue_tail (&tid_tx->pending, skb); + }Can probably be ported to stable too, to just
TX_DROP.
Quoted 7 lines
Quoted 3 lines
No, why? We're handing the frames to the driver. It wants to handle those frames before agg session is started correctly. That's what I was referring to before with this making more sense now.
OK I see that but I am not sure of what's done to the skb in the old case if the session is note complete yet, nor now if the session gets declined. I can check later, right now I'm feeling lazy.
Before my patch the skb is still passed to the driver, which would need to be able to handle it (it == session being stopped). I'm not entirely sure ath9k handles it properly but I suspect it does.
Quoted 4 lines
Quoted 3 lines
Ok that might make some sense, though as a parameter you can easily see where it's coming from, I think :) I agree that the entire code is a little brain twister...
Quoted 11 lines
Yeah.. I had to re-read aggregation code again to get the hang of it. Anything we can do to make
it easier for people to pick would be nice. I think I'll go patch up the aggr-tx kdoc too now, unless we
plan on nuking some stuff soon again. I suspect the next big change will be to move software based
aggregation queue handling and mapping to ACs within mac80211 for that type of hardware which
we'll need for ar9170, ralink stuff, broadcom (if that ever happens) and our next generation 11n USB
driver.
Right -- but I don't expect to be working on it any time soon myself.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
net/mac80211/tx.c int ieee80211_master_start_xmit(struct s · line 1410
Quoted 6 lines
net/mac80211/tx.c +1
-1@@ -1360,7 +1407,7 @@ int ieee80211_master_start_xmit(struct s "originating device\n", dev->name);#endif dev_kfree_skb (skb); -return 0 ; +return NETDEV_TX_OK ;All these
NETDEV_TX_OKcould've gone into a separate patch.
Quoted 6 lines
Quoted 1 line
I guess, they're also not strictly necessary since 0 ==
TX_OK:)Sure, what I'm trying to say is these patches are pretty hard to review because of the topic,
it just helps to trim them down as much as possible -- but I realize even that is painful.
:)
Thanks man, I really appreciate you giving them a close look!
johannes
Re: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 3 lines · Johannes Berg
Quoted 1 line · Luis R. Rodriguez
Quoted 1 line
Quoted 1 line
That's fine from a logical point of view as compromise here as ou=
r
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
ampdu start should be relatively quick. Now while I can say this from a logical point of view this patch obviously needed more testing but lets see how it holds up and I'm glad you're the one who wrote it. I'm confident there won't be any issues but that is something I cannot gaurantee just based on the review. We now need to go out and tests this. All other patches previous to this make 100% perfect sense.
:)
I think it also makes more _sense_ to not ask the driver to handle=
these
Quoted 1 line
Quoted 1 line
Quoted 1 line
frames, because we won't set the AMPDU flag correctly if the sessi=
on
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
start is declined.
Hm, wouldn't we send them as normal frames if its declined here even=
tually?
Quoted 2 lines
Yes, we take them off the
sta->pending, put them through TX processin=
g
Quoted 1 line
and send them as normal frames.
OK so you're not suggesting we change this more, just stating that this makes sense.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This piece:
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (*state !=3D HT_=
AGG_STATE_IDLE) {
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
/* in progress */
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
queued =3D true;
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
info->flags |=3D IEEE80211_TX_INTFL_NEED_TXPROCESSING;
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
__skb_queue_tail(&tid_tx->pending, skb);
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
Can probably be ported to stable too, to just
TX_DROP.No, why? We're handing the frames to the driver. It wants to handl=
e
Quoted 1 line
Quoted 1 line
Quoted 1 line
those frames before agg session is started correctly. That's what =
I was
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
referring to before with this making more sense now.
OK I see that but I am not sure of what's done to the skb in the old case if the session is note complete yet, nor now if the session get=
s
Quoted 3 lines
Quoted 1 line
declined. I can check later, right now I'm feeling lazy.
Before my patch the skb is still passed to the driver, which would ne=
ed
Quoted 1 line
to be able to handle it (it =3D=3D session being stopped). I'm not en=
tirely
Quoted 1 line
sure ath9k handles it properly but I suspect it does.
Not sure, this begs the question when you were seeing the received addba response come up first. SInce both iwlagn and ath9k use the irq safe aggregation cb I was suspecting this would happen in general on UP boxen and probably even less likely to happen on ath9k as we don't have to talk to the firmware during the ampdu start action.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Ok that might make some sense, though as a parameter you can easil=
y see
Quoted 1 line
Quoted 1 line
Quoted 1 line
where it's coming from, I think :) I agree that the entire code is=
a
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
little brain twister...
Yeah.. I had to re-read aggregation code again to get the hang of it=
=2E
Quoted 6 lines
Quoted 6 lines
Anything we can do to make
it easier for people to pick would be nice. I think I'll go patch up the aggr-tx kdoc too now, unless we
plan on nuking some stuff soon again. I suspect the next big change will be to move software based
aggregation queue handling and mapping to ACs within mac80211 for th=
at
Quoted 6 lines
Quoted 4 lines
type of hardware which
we'll need for ar9170, ralink stuff, broadcom (if that ever happens) and our next generation 11n USB
driver.Right -- but I don't expect to be working on it any time soon myself.
I didn't expect you to. We may have the need first unless chr gets to ar9170 stuff first.
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Johannes Berg
maintainerRe: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 11 lines · Luis R. Rodriguez
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I think it also makes more _sense_ to not ask the driver to handle these frames, because we won't set the AMPDU flag correctly if the session start is declined.
Hm, wouldn't we send them as normal frames if its declined here eventually?
Yes, we take them off the
sta->pending, put them through TX processing and send them as normal frames.OK so you're not suggesting we change this more, just stating that this makes sense.
Yes; I don't see why we should change it. Otherwise the driver needs to ignore the TXCTL_AMPDU flag and do its own processing, would would seem odd. By the way ath9k does it, it probably does it automatically though, but I don't see why we should require it.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
OK I see that but I am not sure of what's done to the skb in the old case if the session is note complete yet, nor now if the session gets declined. I can check later, right now I'm feeling lazy.
Before my patch the skb is still passed to the driver, which would need to be able to handle it (it == session being stopped). I'm not entirely sure ath9k handles it properly but I suspect it does.
Quoted 5 lines
Not sure, this begs the question when you were seeing the received addba response come up first. SInce both iwlagn and ath9k use the irq safe aggregation cb I was suspecting this would happen in general on UP boxen and probably even less likely to happen on ath9k as we don't have to talk to the firmware during the ampdu start action.
No, it can only happen when the remote station is faster to reply than the driver.
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 3 lines
Ok that might make some sense, though as a parameter you can easily see where it's coming from, I think :) I agree that the entire code is a little brain twister...
Yeah.. I had to re-read aggregation code again to get the hang of it. Anything we can do to make
it easier for people to pick would be nice. I think I'll go patch up the aggr-tx kdoc too now, unless we
plan on nuking some stuff soon again. I suspect the next big change will be to move software based
aggregation queue handling and mapping to ACs within mac80211 for that type of hardware which
we'll need for ar9170, ralink stuff, broadcom (if that ever happens) and our next generation 11n USB
driver.
Quoted 4 lines
Quoted 1 line
Right -- but I don't expect to be working on it any time soon myself.
I didn't expect you to. We may have the need first unless chr gets to ar9170 stuff first.
Ok, makes sense.
johannes
Re: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 10 lines · Johannes Berg
Quoted 8 lines · Luis R. Rodriguez
Quoted 7 lines
Quoted 3 lines
OK I see that but I am not sure of what's done to the skb in the old case if the session is note complete yet, nor now if the session gets declined. I can check later, right now I'm feeling lazy.
Before my patch the skb is still passed to the driver, which would need to be able to handle it (it == session being stopped). I'm not entirely sure ath9k handles it properly but I suspect it does.
Quoted 8 lines
Quoted 5 lines
Not sure, this begs the question when you were seeing the received addba response come up first. SInce both iwlagn and ath9k use the irq safe aggregation cb I was suspecting this would happen in general on UP boxen and probably even less likely to happen on ath9k as we don't have to talk to the firmware during the ampdu start action.
No, it can only happen when the remote station is faster to reply than the driver.
My point was that if you have the tasklet handled by a separate CPU the DRV flag would most likely be set by the time the addba response comes back. On a UP box though you have no option but to wait for wait for it to be done after we send off the addba request so then it is a race between the scheduler to schedule the tasklet and the remote station's speed + the IRQ processing of the received response.
If we would somehow be able to ensure pending BHs complete before we process the addba response this wouldn't be needed in both places.
Anyway I'm also stating that its likely that the ampdu start action is slower with iwlagn as interaction with the firmware is required so I would suspect one can see this behavior more likely on UP iwlagn boxen.
Where did you see it?
Luis
Johannes Berg
maintainerRe: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 6 lines · Luis R. Rodriguez
My point was that if you have the tasklet handled by a separate CPU the DRV flag would most likely be set by the time the addba response comes back. On a UP box though you have no option but to wait for wait for it to be done after we send off the addba request so then it is a race between the scheduler to schedule the tasklet and the remote station's speed + the IRQ processing of the received response.
Ah, I see what you mean. But this goes off the same tasklet :) so ath9k doesn't have a problem in any case.
Quoted 2 lines
If we would somehow be able to ensure pending BHs complete before we process the addba response this wouldn't be needed in both places.
No, we can't ensure that -- the driver might very well take longer and we don't have a way to only process the received frame later.
Quoted 6 lines
Anyway I'm also stating that its likely that the ampdu start action is slower with iwlagn as interaction with the firmware is required so I would suspect one can see this behavior more likely on UP iwlagn boxen.
Where did you see it?
I didn't actually see it :) But iwlagn can possibly flush the queue before calling back to the cb.
johannes
Re: [PATCH 7/8] mac80211: fix aggregation to not require queue stop
Quoted 11 lines · Johannes Berg
Quoted 6 lines · Luis R. Rodriguez
My point was that if you have the tasklet handled by a separate CPU the DRV flag would most likely be set by the time the addba response comes back. On a UP box though you have no option but to wait for wait for it to be done after we send off the addba request so then it is a race between the scheduler to schedule the tasklet and the remote station's speed + the IRQ processing of the received response.
Ah, I see what you mean. But this goes off the same tasklet :) so ath9k doesn't have a problem in any case.
:D
Quoted 5 lines
Quoted 2 lines
If we would somehow be able to ensure pending BHs complete before we process the addba response this wouldn't be needed in both places.
No, we can't ensure that -- the driver might very well take longer and we don't have a way to only process the received frame later.
Well as you pointed out we already do since its on the same tasklet -- the delay will happen within the ampdu start action in the driver, not the irqsafe callback itself.
Quoted 9 lines
Quoted 6 lines
Anyway I'm also stating that its likely that the ampdu start action is slower with iwlagn as interaction with the firmware is required so I would suspect one can see this behavior more likely on UP iwlagn boxen.
Where did you see it?
I didn't actually see it :) But iwlagn can possibly flush the queue before calling back to the cb.
Heh, flush what queue? A virtual ampdu queue thing? Or something else, I'm trying to understand exactly where this would happen, I don't think I get the picture yet.
Luis