Skip to contentSkip to conversation

Revert "ath9k_hw: Fix false tx hung detection in AR9003 chips"

PATCH In review Felix Fietkau 3 participants 9 messages Feb 27, 2012 – Mar 5, 2012 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Revert "ath9k_hw: Fix false tx hung detection in AR9003 chips"

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |    8 ++------
 drivers/net/wireless/ath/ath9k/beacon.c     |    6 ------
 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_mac.c +2 -6
index 09b8c9d..73d44bc 100644
@@ -346,7 +346,6 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
 static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
 				 struct ath_tx_status *ts)
 {
-	struct ar9003_txc *txc = (struct ar9003_txc *) ds;
 	struct ar9003_txs *ads;
 	u32 status;
 
@@ -356,11 +355,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
 	if ((status & AR_TxDone) == 0)
 		return -EINPROGRESS;
 
-	ts->qid = MS(ads->ds_info, AR_TxQcuNum);
-	if (!txc || (MS(txc->info, AR_TxQcuNum) == ts->qid))
-		ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
-	else
-		return -ENOENT;
+	ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
 
 	if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) ||
 	    (MS(ads->ds_info, AR_TxRxDesc) != 1)) {
@@ -374,6 +369,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
 	ts->ts_seqnum = MS(status, AR_SeqNum);
 	ts->tid = MS(status, AR_TxTid);
 
+	ts->qid = MS(ads->ds_info, AR_TxQcuNum);
 	ts->desc_id = MS(ads->status1, AR_TxDescId);
 	ts->ts_tstamp = ads->status4;
 	ts->ts_status = 0;
drivers/net/wireless/ath/ath9k/beacon.c +0 -6
index b8967e4..6d1e465 100644
@@ -355,7 +355,6 @@ void ath_beacon_tasklet(unsigned long data)
 	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath_buf *bf = NULL;
 	struct ieee80211_vif *vif;
-	struct ath_tx_status ts;
 	bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
 	int slot;
 	u32 bfaddr, bc = 0;
@@ -462,11 +461,6 @@ void ath_beacon_tasklet(unsigned long data)
 			ath9k_hw_txstart(ah, sc->beacon.beaconq);
 
 		sc->beacon.ast_be_xmit += bc;     /* XXX per-vif? */
-		if (edma) {
-			spin_lock_bh(&sc->sc_pcu_lock);
-			ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
-			spin_unlock_bh(&sc->sc_pcu_lock);
-		}
 	}
 }
 
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 2/4 ath9k: do not call ath9k_hw_txprocdesc on AR9003 outside of the tx tasklet

Since AR9003 uses a global tx status queue, processing tx status outside of the regular tx tasklet is dangerous and messes up hardware/software synchronization of tx status events.

---
 drivers/net/wireless/ath/ath9k/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +2 -1
index 4a00806..8cbbc17 100644
@@ -2332,6 +2332,7 @@ static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
 	struct ath_vif *avp;
 	struct ath_buf *bf;
 	struct ath_tx_status ts;
+	bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
 	int status;
 
 	vif = sc->beacon.bslot[0];
@@ -2342,7 +2343,7 @@ static int ath9k_tx_last_beacon(struct ieee80211_hw *hw)
 	if (!avp->is_bslot_active)
 		return 0;
 
-	if (!sc->beacon.tx_processed) {
+	if (!sc->beacon.tx_processed && !edma) {
 		tasklet_disable(&sc->bcon_tasklet);
 
 		bf = avp->av_bcbuf;
Signature · 1 line
1.7.3.2
#2 lore raw

PATCH 3/4 ath9k_hw: enable interrupts for beacon tx completion events

Not doing so could cause the tx status queue to overflow during longer periods of time without non-beacon tx. These events are also required for proper drv_tx_last_beacon handling.

---
 drivers/net/wireless/ath/ath9k/mac.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/mac.c +5 -1
index e196aba..5f4ae6c 100644
@@ -745,7 +745,11 @@ int ath9k_hw_beaconq_setup(struct ath_hw *ah)
 	qi.tqi_aifs = 1;
 	qi.tqi_cwmin = 0;
 	qi.tqi_cwmax = 0;
-	/* NB: don't enable any interrupts */
+
+	if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
+		qi.tqi_qflags = TXQ_FLAG_TXOKINT_ENABLE |
+				TXQ_FLAG_TXERRINT_ENABLE;
+
 	return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
 }
 EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
Signature · 1 line
1.7.3.2
#3 lore raw

PATCH 4/4 ath9k: fix drv_tx_last_beacon on AR9003 by processing beacon tx status

---
 drivers/net/wireless/ath/ath9k/beacon.c |    2 +-
 drivers/net/wireless/ath/ath9k/xmit.c   |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +1 -1
index 6d1e465..43882f9 100644
@@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
 	info.txpower = MAX_RATE_POWER;
 	info.keyix = ATH9K_TXKEYIX_INVALID;
 	info.keytype = ATH9K_KEY_TYPE_CLEAR;
-	info.flags = ATH9K_TXDESC_NOACK;
+	info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
 
 	info.buf_addr[0] = bf->bf_buf_addr;
 	info.buf_len[0] = roundup(skb->len, 4);
drivers/net/wireless/ath/ath9k/xmit.c +5 -2
index 3182408..cf5a267 100644
@@ -2297,9 +2297,12 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
 			break;
 		}
 
-		/* Skip beacon completions */
-		if (ts.qid == sc->beacon.beaconq)
+		/* Process beacon completions separately */
+		if (ts.qid == sc->beacon.beaconq) {
+			sc->beacon.tx_processed = true;
+			sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
 			continue;
+		}
 
 		txq = &sc->tx.txq[ts.qid];
 
Signature · 1 line
1.7.3.2
#4 lore raw
In reply to Felix Fietkau
Quoted 5 lines · Felix Fietkau

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

How flawed is the current approach? That commit looks like it has been around for months already. Does it really _need_ to be fixed in 3.3?

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.
#5 lore raw
Quoted 9 lines · John W. Linville
Quoted 5 lines · Felix Fietkau

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

How flawed is the current approach? That commit looks like it has been around for months already. Does it really _need_ to be fixed in 3.3?

It only slightly reduces the severity of the issue it tried to address, while adding some ugly race conditions. It is not possible to properly fix the issue without a revert of that commit, so I really would like to see this patch series in 3.3.

- Felix

#6 lore raw
Quoted 6 lines · Felix Fietkau
Quoted 5 lines · John W. Linville
Quoted 4 lines · Felix Fietkau

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

How flawed is the current approach? That commit looks like it has been around for months already. Does it really _need_ to be fixed in 3.3?

It only slightly reduces the severity of the issue it tried to address, while adding some ugly race conditions. It is not possible to properly fix the issue without a revert of that commit, so I really would like to see this patch series in 3.3.

I am happy to take this series for 3.4, but it seems quite late for 3.3. We have been living with it for a while already.

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.
#7 lore raw
Quoted 11 lines · Felix Fietkau
Quoted 10 lines · John W. Linville
Quoted 9 lines · Felix Fietkau
Quoted 5 lines

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

How flawed is the current approach? That commit looks like it has been around for months already. Does it really _need_ to be fixed in 3.3?

Quoted 7 lines
Quoted 4 lines

It only slightly reduces the severity of the issue it tried to address, while adding some ugly race conditions. It is not possible to properly fix the issue without a revert of that commit, so I really would like to see this patch series in 3.3.

I am happy to take this series for 3.4, but it seems quite late for 3.3. We have been living with it for a while already.

As said, it is not a regression. The latest patch fix it in proper manner. So it fine to have it from 3.4 onwards.

-Rajkumar

#8 lore raw
In reply to John W. Linville
Quoted 11 lines · John W. Linville
Quoted 10 lines · Felix Fietkau
Quoted 9 lines · John W. Linville
Quoted 5 lines · Felix Fietkau

The approach of this change is flawed, as it triggers tx status processing from more callsites, yet the chips only have one global tx status queue. Subsequent patches will properly fix the issue that this one tried to address.

How flawed is the current approach? That commit looks like it has been around for months already. Does it really _need_ to be fixed in 3.3?

Quoted 7 lines
Quoted 4 lines

It only slightly reduces the severity of the issue it tried to address, while adding some ugly race conditions. It is not possible to properly fix the issue without a revert of that commit, so I really would like to see this patch series in 3.3.

I am happy to take this series for 3.4, but it seems quite late for 3.3. We have been living with it for a while already.

OK, no problem. I'm using bleeding edge anyway ;)

- Felix