ath9k: fix aggregation session lockup
PATCH 1/1 ath9k: fix aggregation session lockup
If an aggregation session fails, frames still end up in the driver queue with IEEE80211_TX_CTL_AMPDU set.
This causes tx for the affected station/tid to stall, since ath_tx_get_tid_subframe returning packets to send.
Fix this by clearing IEEE80211_TX_CTL_AMPDU as long as no aggregation session is running.
--- drivers/net/wireless/ath/ath9k/xmit.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/xmit.c +9 -0
@@ -897,6 +897,15 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, tx_info =IEEE80211_SKB_CB (skb); tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT ; + +/* +* No aggregation session is running, but there may be frames +* from a previous session or a failed attempt in the queue. +* Send them out as normal data frames +*/ +if (!tid->active) + tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU ; +if (!(tx_info->flags &IEEE80211_TX_CTL_AMPDU )) { bf->bf_state.bf_type =0 ;return bf;
Signature · 1 line
1.8.5.2 (Apple Git-48)
Quoted 7 lines · Felix Fietkau
If an aggregation session fails, frames still end up in the driver queue with
IEEE80211_TX_CTL_AMPDUset.
This causes tx for the affected station/tid to stall, sinceath_tx_get_tid_subframereturning packets to send.Fix this by clearing
IEEE80211_TX_CTL_AMPDUas long as no aggregation session is running.
Did this and your previous patch about 'pending tx frames accounting' fix the issues reported?
They at least do not fix the problems I see where tx appears to hang, but my setup is pretty 'special'....
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 11 lines · Ben Greear
Quoted 7 lines · Felix Fietkau
If an aggregation session fails, frames still end up in the driver queue with
IEEE80211_TX_CTL_AMPDUset.
This causes tx for the affected station/tid to stall, sinceath_tx_get_tid_subframereturning packets to send.Fix this by clearing
IEEE80211_TX_CTL_AMPDUas long as no aggregation session is running.Did this and your previous patch about 'pending tx frames accounting' fix the issues reported?
Yes.
Quoted 2 lines
They at least do not fix the problems I see where tx appears to hang, but my setup is pretty 'special'....
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
- Felix
Quoted 12 lines · Felix Fietkau
Quoted 11 lines · Ben Greear
Quoted 7 lines · Felix Fietkau
If an aggregation session fails, frames still end up in the driver queue with
IEEE80211_TX_CTL_AMPDUset.
This causes tx for the affected station/tid to stall, sinceath_tx_get_tid_subframereturning packets to send.Fix this by clearing
IEEE80211_TX_CTL_AMPDUas long as no aggregation session is running.Did this and your previous patch about 'pending tx frames accounting' fix the issues reported?
Quoted 8 lines
Yes.
Quoted 2 lines
They at least do not fix the problems I see where tx appears to hang, but my setup is pretty 'special'....
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
Let me first try to reproduce with a recent, un-hacked-upon kernel...
I would welcome the debug patch in the meantime.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 12 lines · Felix Fietkau
Quoted 11 lines · Ben Greear
Quoted 7 lines · Felix Fietkau
If an aggregation session fails, frames still end up in the driver queue with
IEEE80211_TX_CTL_AMPDUset.
This causes tx for the affected station/tid to stall, sinceath_tx_get_tid_subframereturning packets to send.Fix this by clearing
IEEE80211_TX_CTL_AMPDUas long as no aggregation session is running.Did this and your previous patch about 'pending tx frames accounting' fix the issues reported?
Quoted 8 lines
Yes.
Quoted 2 lines
They at least do not fix the problems I see where tx appears to hang, but my setup is pretty 'special'....
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
What is the easiest upstream tree for you to debug?
Thanks,
Ben
Quoted 7 lines
- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 7 lines · Ben Greear
Quoted 4 lines · Felix Fietkau
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
What is the easiest upstream tree for you to debug?
Sorry for the late reply but I was pretty "disconnected" in the last days.
Is the debugging patch still required? If so, I can dig in my buildroot and retrieve it.
Cheers,
Signature · 1 line
Antonio Quartulli
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 4 lines · Antonio Quartulli
Quoted 1 line · Ben Greear
On 07/28/2014 02:11 PM, Felix Fietkau wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
What is the easiest upstream tree for you to debug?
Sorry for the late reply but I was pretty "disconnected" in the last days.
Is the debugging patch still required? If so, I can dig in my buildroot and retrieve it.
I would appreciate it if you could post the patch. I'd like to see if I can get the bug fixed once and for all.....
Thanks,
Ben
Quoted 5 lines
Cheers,
- --
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJT3+m0AAoJELbHqkYeJT4OniwH/1mLfg10xq5CPR5eNKCiM2vY Ww38H/fC5N2K0Uyw84uWTHmJTjqvl4IbW2Xhve4i6yqiQa+NSva/ge5ogK6bLiMH 13AxHysUMnPgu3f9so4wziRuc3izkcs4qgArnXOW03UnVOpAoUbRUVkNPojDzQpM zkxmQTYTd61XAW6cvOUlvLJsaY6Eapa9ClbIRtj8SuyoIvrvKzKlww96ibnJ7jFR AXDBSt6n0bPy07DpHuvIs5UypbV2rO6JjQ4WFD85tqScP3+ZEs0KcYk3lv06FXnq o1SbMSIY24AiLMMhIdIREPadETgft65DGd7wgMarvF8nnqsB7Gnnq0f/YJS32uc= =daKD
-----END PGP SIGNATURE-----
Quoted 12 lines · Ben Greear
Quoted 8 lines · Antonio Quartulli
Quoted 5 lines · Ben Greear
Quoted 2 lines · Felix Fietkau
Interesting. Maybe you should ask Antonio for an updated version of the patch that he used to debug this issue. If you give me the output of it while it's locked up, I might be able to figure out what's going on in your setup.
What is the easiest upstream tree for you to debug?
Sorry for the late reply but I was pretty "disconnected" in the last days.
Quoted 7 lines
Quoted 1 line
Is the debugging patch still required? If so, I can dig in my buildroot and retrieve it.
I would appreciate it if you could post the patch. I'd like to see if I can get the bug fixed once and for all.....
Thanks,
Ben
Ben,
attached you have the patches we have been using during our debug.
They create a new debugfs file that you can read when the wifi is stuck in order to gather some information about the queues/tids status. The file is located in the ath9k debugfs folder and its name is "nodes".
I hope it can help.
Cheers,
Signature · 1 line
Antonio Quartulli
drivers/net/wireless/ath/ath9k/ath9k.h +7 -0
@@ -22,6 +22,7 @@#include <linux/interrupt.h> #include <linux/leds.h> #include <linux/completion.h> +#include <linux/types.h> #include <net/mac80211.h> #include "common.h"
@@ -281,6 +282,7 @@u8 key_idx[4 ];atomic_t decrypt_errors; +struct hlist_node list; };struct ath_tx_control {
@@ -862,4 +864,9 @@static inline void ath_ahb_exit (void ) {};#endif + +extern struct hlist_head an_list; +extern spinlock_t an_list_lock; +struct ath_frame_info *get_frame_info (struct sk_buff *skb); +#endif /* ATH9K_H */
drivers/net/wireless/ath/ath9k/debug.c +141 -0
171 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/main.c +15 -0
@@ -16,10 +16,14 @@#include <linux/nl80211.h> #include <linux/delay.h> +#include <linux/rculist.h> #include <net/mac80211.h> #include "ath9k.h" #include "btcoex.h" +struct hlist_head an_list; +spinlock_t an_list_lock; +static void ath9k_set_assoc_state (struct ath_softc *sc,struct ieee80211_vif *vif);
@@ -429,12 +433,20 @@memset (&an->key_idx,0 ,sizeof (an->key_idx));ath_tx_node_init (sc, an); + +spin_lock_bh (&an_list_lock); +hlist_add_head_rcu (&an->list, &an_list); +spin_unlock_bh (&an_list_lock); }static void ath_node_detach (struct ath_softc *sc,struct ieee80211_sta *sta) {struct ath_node *an = (struct ath_node *)sta->drv_priv;ath_tx_node_cleanup (sc, an); + +spin_lock_bh (&an_list_lock); +hlist_del_rcu (&an->list); +spin_unlock_bh (&an_list_lock); }void ath9k_tasklet (unsigned long data)
@@ -726,6 +738,9 @@struct ath9k_channel *init_channel;int r; +INIT_HLIST_HEAD (&an_list); +spin_lock_init (&an_list_lock); +ath_dbg (common,CONFIG ,"Starting driver with initial channel: %d MHz\n" , curchan->center_freq);
drivers/net/wireless/ath/ath9k/xmit.c +1 -1
@@ -120,7 +120,7 @@list_add_tail (&ac->list, &txq->axq_acq); } -static struct ath_frame_info *get_frame_info (struct sk_buff *skb) +struct ath_frame_info *get_frame_info (struct sk_buff *skb) {struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); BUILD_BUG_ON(sizeof(struct ath_frame_info) >
From 3d06af34b48677146f9f0bdf4a3db29f3c195b39 Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <[email protected]>
Date: Tue, 22 Jul 2014 12:23:00 +0200
Subject: [PATCH] ath9k: queue debug
--- drivers/net/wireless/ath/ath9k/xmit.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/xmit.c +9 -1
@@ -1813,8 +1813,14 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)bool sent = false;if (test_bit (ATH_OP_HW_RESET , &common->op_flags) || -list_empty (&txq->axq_acq)) +list_empty (&txq->axq_acq)) { +ath_dbg (common,QUEUE ,"%s %d queue qnum: %d is empty, not processing\n" , + __func__, __LINE__, txq->axq_qnum);return ; + } + +ath_dbg (common,QUEUE ,"%s %d queue qnum: %d, txq depth: %d\n" , + __func__, __LINE__, txq->axq_qnum, txq->axq_depth);rcu_read_lock ();
@@ -1826,6 +1832,8 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);list_del (&ac->list); ac->sched = false; +ath_dbg (common,QUEUE ,"%s %d processing ac %p, list_empty(&ac->tid_q): %d\n" , + __func__, __LINE__, ac,list_empty (&ac->tid_q));while (!list_empty (&ac->tid_q)) {
Signature · 1 line
1.9.1
From 818253338aec9ce33c83b4d2e839520ae406d5ce Mon Sep 17 00:00:00 2001
From: Simon Wunderlich <[email protected]>
Date: Tue, 22 Jul 2014 18:48:59 +0200
Subject: [PATCH] ath9k: more debug output
--- drivers/net/wireless/ath/ath9k/xmit.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/xmit.c +20 -3
@@ -1327,7 +1327,7 @@ ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq, }static bool ath_tx_sched_aggr (struct ath_softc *sc,struct ath_txq *txq, -struct ath_atx_tid *tid,bool *stop) +struct ath_atx_tid *tid,bool *stop,int *step) {struct ath_buf *bf;struct ieee80211_tx_info *tx_info;
@@ -1336,15 +1336,18 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,int aggr_len =0 ;bool aggr, last = true; + *step =0 ;if (!ath_tid_has_buffered (tid))return false;INIT_LIST_HEAD (&bf_q); + *step =1 ; bf =ath_tx_get_tid_subframe (sc, txq, tid, &tid_q);if (!bf)return false; + *step =2 ; tx_info =IEEE80211_SKB_CB (bf->bf_mpdu); aggr = !!(tx_info->flags &IEEE80211_TX_CTL_AMPDU ); if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
@@ -1353,6 +1356,7 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,return false; } + *step =3 ;ath_set_rates (tid->an->vif, tid->an->sta, bf);if (aggr) last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
@@ -1360,13 +1364,16 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,else ath_tx_form_burst (sc, txq, tid, &bf_q, bf, tid_q); + *step =4 ;if (list_empty (&bf_q))return false; + *step =5 ;if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) { tid->ac->clear_ps_filter = false; tx_info->flags |=IEEE80211_TX_CTL_CLEAR_PS_FILT ; } + *step =6 ;ath_tx_fill_desc (sc, bf, txq, aggr_len);ath_tx_txqaddbuf (sc, txq, &bf_q, false);
@@ -1836,22 +1843,32 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) __func__, __LINE__, ac, list_empty(&ac->tid_q));while (!list_empty (&ac->tid_q)) { +int ret, step; tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);list_del (&tid->list); tid->sched = false; -if (ath_tx_sched_aggr (sc, txq, tid, &stop)) + ret =ath_tx_sched_aggr (sc, txq, tid, &stop, &step); +if (ret) sent = true; +ath_dbg (common,QUEUE ,"%s %d tid %d of ac %p: ath_tx_sched_aggr returned %d, stop = %d, last_tid = %d, step = %d\n" , + __func__, __LINE__, tid->tidno, ac, ret, stop, last_tid->tidno, step);/* * add tid to round-robin queue if more frames * are pending for the tid */ -if (ath_tid_has_buffered (tid)) + ret =ath_tid_has_buffered (tid); +if (ret)ath_tx_queue_tid (txq, tid); +ath_dbg (common,QUEUE ,"%s %d tid %d of ac %p: ath_tid_has_buffered returned %d\n" , + __func__, __LINE__, tid->tidno, ac, ret); + + +if (stop || tid == last_tid)break ; }
Signature · 1 line
1.9.1
drivers/net/wireless/ath/ath9k/debug.c +7 -1
@@ -715,14 +715,20 @@static void ath9k_debug_print_skb (struct sk_buff_head *skb_head) { +struct ieee80211_tx_info *tx_info;struct ath_frame_info *fi;struct ath_buf *bf;struct sk_buff *skb; skb_queue_walk(skb_head, skb) { + tx_info =IEEE80211_SKB_CB (skb); + nodes_len +=snprintf (nodes_buf + nodes_len, + nodes_size - nodes_len, +"skb tx_info->flags = %#.8x\n" , + tx_info->flags); + fi =get_frame_info (skb); bf = fi->bf; -if (!bf) { nodes_len +=snprintf (nodes_buf + nodes_len, nodes_size - nodes_len,"no bf\n" );continue ;