Skip to contentSkip to conversation

ath9k: Implement op_flush()

PATCH In review Vasanthakumar Thiagarajan 2 participants 7 messages Feb 19, 2011 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Implement op_flush()

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

---
 drivers/net/wireless/ath/ath9k/ath9k.h |    1 +
 drivers/net/wireless/ath/ath9k/main.c  |   71 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/xmit.c  |   27 +++++++-----
 3 files changed, 88 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
index a224c56..f9f0389 100644
@@ -189,6 +189,7 @@ struct ath_txq {
 	u32 axq_ampdu_depth;
 	bool stopped;
 	bool axq_tx_inprogress;
+	bool txq_flush_inprogress;
 	struct list_head axq_acq;
 	struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
 	struct list_head txq_fifo_pending;
drivers/net/wireless/ath/ath9k/main.c +71 -0

93 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/xmit.c +16 -11
index bc614ac..e16136d 100644
@@ -2014,7 +2014,8 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 		spin_lock_bh(&txq->axq_lock);
 		if (list_empty(&txq->axq_q)) {
 			txq->axq_link = NULL;
-			if (sc->sc_flags & SC_OP_TXAGGR)
+			if (sc->sc_flags & SC_OP_TXAGGR &&
+			    !txq->txq_flush_inprogress)
 				ath_txq_schedule(sc, txq);
 			spin_unlock_bh(&txq->axq_lock);
 			break;
@@ -2071,6 +2072,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 
 		if (bf_is_ampdu_not_probing(bf))
 			txq->axq_ampdu_depth--;
+
 		spin_unlock_bh(&txq->axq_lock);
 
 		if (bf_held)
@@ -2094,7 +2096,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 
 		spin_lock_bh(&txq->axq_lock);
 
-		if (sc->sc_flags & SC_OP_TXAGGR)
+		if (sc->sc_flags & SC_OP_TXAGGR && !txq->txq_flush_inprogress)
 			ath_txq_schedule(sc, txq);
 		spin_unlock_bh(&txq->axq_lock);
 	}
@@ -2265,15 +2267,18 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
 
 		spin_lock_bh(&txq->axq_lock);
 
-		if (!list_empty(&txq->txq_fifo_pending)) {
-			INIT_LIST_HEAD(&bf_head);
-			bf = list_first_entry(&txq->txq_fifo_pending,
-				struct ath_buf, list);
-			list_cut_position(&bf_head, &txq->txq_fifo_pending,
-				&bf->bf_lastbf->list);
-			ath_tx_txqaddbuf(sc, txq, &bf_head);
-		} else if (sc->sc_flags & SC_OP_TXAGGR)
-			ath_txq_schedule(sc, txq);
+		if (!txq->txq_flush_inprogress) {
+			if (!list_empty(&txq->txq_fifo_pending)) {
+				INIT_LIST_HEAD(&bf_head);
+				bf = list_first_entry(&txq->txq_fifo_pending,
+						      struct ath_buf, list);
+				list_cut_position(&bf_head,
+						  &txq->txq_fifo_pending,
+						  &bf->bf_lastbf->list);
+				ath_tx_txqaddbuf(sc, txq, &bf_head);
+			} else if (sc->sc_flags & SC_OP_TXAGGR)
+				ath_txq_schedule(sc, txq);
+		}
 		spin_unlock_bh(&txq->axq_lock);
 	}
 }
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

johannes

#2 lore raw
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

It is not that we wait for 100ms always, we return as soon as possible if there are no pending frames in sw/hw queues. I never hit this timeout though. In the worst case there can be 128 (4 aggr) frames pending in sw queue and 2 in hw queue. If we assume each one of these aggregates has 4ms duration, we at least need 24ms air time at the lowest rate. If they are not part of AMPDU, it would take a little bit more I think. So, probably we can give ~40ms timeout, is that reasonable?. If i'm reading the code correctly, iwlwifi seems to use 2000ms.

vasanth

#3 lore raw
Quoted 11 lines · Vasanthakumar Thiagarajan
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

Quoted 9 lines

It is not that we wait for 100ms always, we return as soon as possible if there are no pending frames in sw/hw queues. I never hit this timeout though. In the worst case there can be 128 (4 aggr) frames pending in sw queue and 2 in hw queue. If we assume each one of these aggregates has 4ms duration, we at least need 24ms air time at the lowest rate. If they are not part of AMPDU, it would take a little bit more I think. So, probably we can give ~40ms timeout, is that reasonable?. If i'm reading the code correctly, iwlwifi seems to use 2000ms.

Ok. I wasn't concerned about it being too high, I was thinking 100ms might not be enough, but since you say it will be I guess it's fine.

johannes

#4 lore raw
Quoted 22 lines · Johannes Berg
Quoted 11 lines · Vasanthakumar Thiagarajan
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

Quoted 9 lines

It is not that we wait for 100ms always, we return as soon as possible if there are no pending frames in sw/hw queues. I never hit this timeout though. In the worst case there can be 128 (4 aggr) frames pending in sw queue and 2 in hw queue. If we assume each one of these aggregates has 4ms duration, we at least need 24ms air time at the lowest rate. If they are not part of AMPDU, it would take a little bit more I think. So, probably we can give ~40ms timeout, is that reasonable?. If i'm reading the code correctly, iwlwifi seems to use 2000ms.

Quoted 2 lines

Ok. I wasn't concerned about it being too high, I was thinking 100ms might not be enough, but since you say it will be I guess it's fine.

Yeah, I misread it. This 100ms timeout is on every ac queue and is pretty much good enough from my testing.

Vasanth

#5 lore raw
In reply to Johannes Berg
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Vasanthakumar Thiagarajan
Quoted 9 lines · Johannes Berg
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

Would not having a long timeout for flush affect bg scanning by applications (scan time out)?.

Vasanth

#6 lore raw
Quoted 9 lines · Vasanthakumar Thiagarajan
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Vasanthakumar Thiagarajan
Quoted 6 lines · Johannes Berg
Quoted 4 lines · Vasanthakumar Thiagarajan

When op_flush() is called with no drop (drop=false), the driver tries to tx as many frames as possible in about 100ms on every hw queue. During this time period frames from sw queue are also scheduled on to respective hw queue.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Given how long HW queues currently are, I wouldn't set the timeout to 100ms -- mac80211 has no expectation how long this will take, although 100ms seems pretty long I'm not sure it'll always be sufficient?

Would not having a long timeout for flush affect bg scanning by applications (scan time out)?.

In theory, yes. In practise, if the timeout is so low, your application is not going to work right anyway :)

johannes