Skip to contentSkip to conversation

ath9k: prevent aggregation session deadlocks

PATCH In review Felix Fietkau 2 participants 2 messages May 18, 2013 – May 20, 2013 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: prevent aggregation session deadlocks

Waiting for all subframes of an existing aggregation session to drain before allowing mac80211 to start a new one is fragile and deadlocks caused by this behavior have been observed.

Since mac80211 has proper synchronization for aggregation session start/stop handling, a better approach to session handling is to simply allow mac80211 to start a new session at any time. This requires changing the code to discard any packets outside of the BlockAck window in the A-MPDU software retry code.

This patch implements the above and also simplifies the code.

---
 drivers/net/wireless/ath/ath9k/ath9k.h |  14 +---
 drivers/net/wireless/ath/ath9k/main.c  |   3 +-
 drivers/net/wireless/ath/ath9k/rc.c    |   5 +-
 drivers/net/wireless/ath/ath9k/xmit.c  | 138 ++++++++++-----------------------
 4 files changed, 46 insertions(+), 114 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +4 -10
index 366002f..42b03dc 100644
@@ -251,10 +251,9 @@ struct ath_atx_tid {
 	int tidno;
 	int baw_head;   /* first un-acked tx buffer */
 	int baw_tail;   /* next unused tx buffer slot */
-	int sched;
-	int paused;
-	u8 state;
-	bool stop_cb;
+	bool sched;
+	bool paused;
+	bool active;
 };
 
 struct ath_node {
@@ -275,10 +274,6 @@ struct ath_node {
 #endif
 };
 
-#define AGGR_CLEANUP         BIT(1)
-#define AGGR_ADDBA_COMPLETE  BIT(2)
-#define AGGR_ADDBA_PROGRESS  BIT(3)
-
 struct ath_tx_control {
 	struct ath_txq *txq;
 	struct ath_node *an;
@@ -352,8 +347,7 @@ void ath_tx_tasklet(struct ath_softc *sc);
 void ath_tx_edma_tasklet(struct ath_softc *sc);
 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 		      u16 tid, u16 *ssn);
-bool ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid,
-		      bool flush);
+void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
 void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
 
 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
drivers/net/wireless/ath/ath9k/main.c +2 -1
index 2382d12..5092eca 100644
@@ -1709,7 +1709,8 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
 		flush = true;
 	case IEEE80211_AMPDU_TX_STOP_CONT:
 		ath9k_ps_wakeup(sc);
-		if (ath_tx_aggr_stop(sc, sta, tid, flush))
+		ath_tx_aggr_stop(sc, sta, tid);
+		if (!flush)
 			ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
 		ath9k_ps_restore(sc);
 		break;
drivers/net/wireless/ath/ath9k/rc.c +1 -4
index aa4d368..7eb1f4b 100644
@@ -1227,10 +1227,7 @@ static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta,
 		return false;
 
 	txtid = ATH_AN_2_TID(an, tidno);
-
-	if (!(txtid->state & (AGGR_ADDBA_COMPLETE | AGGR_ADDBA_PROGRESS)))
-			return true;
-	return false;
+	return !txtid->active;
 }
 
 
drivers/net/wireless/ath/ath9k/xmit.c +39 -99

242 lines not on this page · raw message

Signature · 1 line
1.8.0.2
#1 lore raw
Quoted 11 lines · Felix Fietkau

Waiting for all subframes of an existing aggregation session to drain before allowing mac80211 to start a new one is fragile and deadlocks caused by this behavior have been observed.

Since mac80211 has proper synchronization for aggregation session start/stop handling, a better approach to session handling is to simply allow mac80211 to start a new session at any time. This requires changing the code to discard any packets outside of the BlockAck window in the A-MPDU software retry code.

This patch implements the above and also simplifies the code.

John,

Can you please drop my patch, "ath9k: Fix TID locking" since it is not necessary after this one ?

The rest of the pending patches have been rebased and are here:
http://msujith.org/patches/wl/May-20-2013/

Yell at me if you want them to be resent.

Sujith