Skip to contentSkip to conversation

ath9k: Initialize ah->hw

PATCH New greearb at candelatech.com 1 participant 5 messages Jan 6, 2011 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 ath9k: Initialize ah->hw

From: Ben Greear <[email protected]>

Previous code left it NULL.

---
:100644 100644 b0e5e716.. 9ca87de... M drivers/net/wireless/ath/ath9k/init.c

 drivers/net/wireless/ath/ath9k/init.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +1 -0
index b0e5e716..9ca87de 100644
@@ -536,6 +536,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
 	if (!ah)
 		return -ENOMEM;
 
+	ah->hw = sc->hw;
 	ah->hw_version.devid = devid;
 	ah->hw_version.subsysid = subsysid;
 	sc->sc_ah = ah;
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 2/5 ath9k: Add more information to debugfs xmit file.

From: Ben Greear <[email protected]>

Should help debug strange tx lockup type issues.

---
:100644 100644 5075faa... 577bc5a... M drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 1e5078b... cd2db3f... M drivers/net/wireless/ath/ath9k/debug.h
:100644 100644 e3d2ebf... 1fcc1a5... M drivers/net/wireless/ath/ath9k/mac.c
:100644 100644 332d1fe... c769037... M drivers/net/wireless/ath/ath9k/xmit.c

 drivers/net/wireless/ath/ath9k/debug.c |   29 +++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath9k/debug.h |    6 ++++++
 drivers/net/wireless/ath/ath9k/mac.c   |    8 ++++++++
 drivers/net/wireless/ath/ath9k/xmit.c  |    1 +
 4 files changed, 42 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +27 -2
index 5075faa..577bc5a 100644
@@ -599,13 +599,25 @@ do {									\
 			(unsigned int)(sc->tx.txq[WME_AC_VO].elem));	\
 } while(0)
 
+#define PRQLE(str, elem)						\
+do {									\
+	len += snprintf(buf + len, size - len,				\
+			"%s%13i%11i%10i%10i\n", str,			\
+			list_empty(&sc->tx.txq[WME_AC_BE].elem),	\
+			list_empty(&sc->tx.txq[WME_AC_BK].elem),	\
+			list_empty(&sc->tx.txq[WME_AC_VI].elem),	\
+			list_empty(&sc->tx.txq[WME_AC_VO].elem));	\
+} while (0)
+
 static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
 			      size_t count, loff_t *ppos)
 {
 	struct ath_softc *sc = file->private_data;
 	char *buf;
-	unsigned int len = 0, size = 2048;
+	unsigned int len = 0, size = 4000;
+	int i;
 	ssize_t retval = 0;
+	char tmp[32];
 
 	buf = kzalloc(size, GFP_KERNEL);
 	if (buf == NULL)
@@ -628,13 +640,26 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
 	PR("DELIM Underrun:  ", delim_underrun);
 	PR("TX-Pkts-All:     ", tx_pkts_all);
 	PR("TX-Bytes-All:    ", tx_bytes_all);
+	PR("hw-put-tx-buf:   ", puttxbuf);
+	PR("hw-tx-start:     ", txstart);
+	PR("hw-tx-proc-desc: ", txprocdesc);
 
 	PRX("axq-qnum:        ", axq_qnum);
 	PRX("axq-depth:       ", axq_depth);
+	PRX("axq-ampdu_depth: ", axq_ampdu_depth);
 	PRX("axq-stopped      ", stopped);
 	PRX("tx-in-progress   ", axq_tx_inprogress);
 	PRX("pending-frames   ", pending_frames);
-
+	PRX("txq_headidx:     ", txq_headidx);
+	PRX("txq_tailidx:     ", txq_headidx);
+
+	PRQLE("axq_q empty:       ", axq_q);
+	PRQLE("axq_acq empty:     ", axq_acq);
+	PRQLE("txq_fifo_pending:  ", txq_fifo_pending);
+	for (i = 0; i < ATH_TXFIFO_DEPTH; i++) {
+		snprintf(tmp, sizeof(tmp) - 1, "txq_fifo[%i] empty: ", i);
+		PRQLE(tmp, txq_fifo[i]);
+	}
 	if (len > size)
 		len = size;
 
drivers/net/wireless/ath/ath9k/debug.h +6 -0
index 1e5078b..cd2db3f 100644
@@ -102,6 +102,9 @@ struct ath_interrupt_stats {
  * @desc_cfg_err: Descriptor configuration errors
  * @data_urn: TX data underrun errors
  * @delim_urn: TX delimiter underrun errors
+ * @puttxbuf: Number of times hardware was given txbuf to write.
+ * @txstart:  Number of times hardware was told to start tx.
+ * @txprocdesc:  Number of times tx descriptor was processed
  */
 struct ath_tx_stats {
 	u32 tx_pkts_all;
@@ -119,6 +122,9 @@ struct ath_tx_stats {
 	u32 desc_cfg_err;
 	u32 data_underrun;
 	u32 delim_underrun;
+	u32 puttxbuf;
+	u32 txstart;
+	u32 txprocdesc;
 };
 
 /**
drivers/net/wireless/ath/ath9k/mac.c +8 -0
index e3d2ebf..1fcc1a5 100644
@@ -16,6 +16,8 @@
 
 #include "hw.h"
 #include "hw-ops.h"
+#include "debug.h"
+#include "ath9k.h"
 
 static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
 					struct ath9k_tx_queue_info *qi)
@@ -50,12 +52,18 @@ EXPORT_SYMBOL(ath9k_hw_gettxbuf);
 
 void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp)
 {
+	struct ath_wiphy *aphy = ah->hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	TX_STAT_INC(q, puttxbuf);
 	REG_WRITE(ah, AR_QTXDP(q), txdp);
 }
 EXPORT_SYMBOL(ath9k_hw_puttxbuf);
 
 void ath9k_hw_txstart(struct ath_hw *ah, u32 q)
 {
+	struct ath_wiphy *aphy = ah->hw->priv;
+	struct ath_softc *sc = aphy->sc;
+	TX_STAT_INC(q, txstart);
 	ath_dbg(ath9k_hw_common(ah), ATH_DBG_QUEUE,
 		"Enable TXE on queue: %u\n", q);
 	REG_WRITE(ah, AR_Q_TXE, 1 << q);
drivers/net/wireless/ath/ath9k/xmit.c +1 -0
index 332d1fe..c769037 100644
@@ -2033,6 +2033,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 			spin_unlock_bh(&txq->axq_lock);
 			break;
 		}
+		TX_STAT_INC(txq->axq_qnum, txprocdesc);
 
 		/*
 		 * Remove ath_buf's of the same transmit unit from txq,
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 3/5 ath9k: Remove un-used member from ath_node.

In reply to greearb at candelatech.com

From: Ben Greear <[email protected]>

---
:100644 100644 2c31f51... 8855539... M drivers/net/wireless/ath/ath9k/ath9k.h

 drivers/net/wireless/ath/ath9k/ath9k.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
index 2c31f51..8855539 100644
@@ -342,7 +342,6 @@ struct ath_vif {
 	__le64 tsf_adjust; /* TSF adjustment for staggered beacons */
 	enum nl80211_iftype av_opmode;
 	struct ath_buf *av_bcbuf;
-	struct ath_tx_control av_btxctl;
 	u8 bssid[ETH_ALEN]; /* current BSSID from config_interface */
 };
 
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 4/5 ath9k: Ensure xmit makes progress.

In reply to greearb at candelatech.com

From: Ben Greear <[email protected]>

If the txq->axq_q is empty, the code was breaking out of the tx_processq logic without checking to see if it should transmit other queued AMPDU frames (txq->axq_acq).

This patches ensures ath_txq_schedule is called.

This needs review.

---
:100644 100644 c769037... 2248e47... M drivers/net/wireless/ath/ath9k/xmit.c

 drivers/net/wireless/ath/ath9k/xmit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/xmit.c +2 -0
index c769037..2248e47 100644
@@ -1999,6 +1999,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)
+				ath_txq_schedule(sc, txq);
 			spin_unlock_bh(&txq->axq_lock);
 			break;
 		}
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 5/5 ath9k: Add counters to distinquish AMPDU enqueues.

In reply to greearb at candelatech.com

From: Ben Greear <[email protected]>

Show counters for pkts sent directly to hardware and those queued in software.

---
:100644 100644 577bc5a... faf84e4... M drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 cd2db3f... 980c9fa... M drivers/net/wireless/ath/ath9k/debug.h
:100644 100644 2248e47... 3aae523... M drivers/net/wireless/ath/ath9k/xmit.c

 drivers/net/wireless/ath/ath9k/debug.c |    3 ++-
 drivers/net/wireless/ath/ath9k/debug.h |    6 ++++--
 drivers/net/wireless/ath/ath9k/xmit.c  |    3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +2 -1
index 577bc5a..faf84e4 100644
@@ -628,7 +628,8 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
 	PR("MPDUs Queued:    ", queued);
 	PR("MPDUs Completed: ", completed);
 	PR("Aggregates:      ", a_aggr);
-	PR("AMPDUs Queued:   ", a_queued);
+	PR("AMPDUs Queued HW:", a_queued_hw);
+	PR("AMPDUs Queued SW:", a_queued_sw);
 	PR("AMPDUs Completed:", a_completed);
 	PR("AMPDUs Retried:  ", a_retries);
 	PR("AMPDUs XRetried: ", a_xretries);
drivers/net/wireless/ath/ath9k/debug.h +4 -2
index cd2db3f..980c9fa 100644
@@ -89,7 +89,8 @@ struct ath_interrupt_stats {
  * @queued: Total MPDUs (non-aggr) queued
  * @completed: Total MPDUs (non-aggr) completed
  * @a_aggr: Total no. of aggregates queued
- * @a_queued: Total AMPDUs queued
+ * @a_queued_hw: Total AMPDUs queued to hardware
+ * @a_queued_sw: Total AMPDUs queued to software queues
  * @a_completed: Total AMPDUs completed
  * @a_retries: No. of AMPDUs retried (SW)
  * @a_xretries: No. of AMPDUs dropped due to xretries
@@ -112,7 +113,8 @@ struct ath_tx_stats {
 	u32 queued;
 	u32 completed;
 	u32 a_aggr;
-	u32 a_queued;
+	u32 a_queued_hw;
+	u32 a_queued_sw;
 	u32 a_completed;
 	u32 a_retries;
 	u32 a_xretries;
drivers/net/wireless/ath/ath9k/xmit.c +2 -1
index 2248e47..3aae523 100644
@@ -1335,7 +1335,6 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
 	struct list_head bf_head;
 
 	bf->bf_state.bf_type |= BUF_AMPDU;
-	TX_STAT_INC(txctl->txq->axq_qnum, a_queued);
 
 	/*
 	 * Do not queue to h/w when any of the following conditions is true:
@@ -1351,6 +1350,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
 		 * Add this frame to software queue for scheduling later
 		 * for aggregation.
 		 */
+		TX_STAT_INC(txctl->txq->axq_qnum, a_queued_sw);
 		list_add_tail(&bf->list, &tid->buf_q);
 		ath_tx_queue_tid(txctl->txq, tid);
 		return;
@@ -1364,6 +1364,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
 		ath_tx_addto_baw(sc, tid, fi->seqno);
 
 	/* Queue to h/w without aggregation */
+	TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw);
 	bf->bf_lastbf = bf;
 	ath_buf_set_rate(sc, bf, fi->framelen);
 	ath_tx_txqaddbuf(sc, txctl->txq, &bf_head);
Signature · 1 line
1.7.2.3