Skip to contentSkip to conversation

ath9k: Gather and report bus-timeout errors.

PATCH New greearb at candelatech.com 2 participants 3 messages Apr 3, 2012 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Gather and report bus-timeout errors.

From: Ben Greear <[email protected]>

Seems like a useful stat to report (when debugfs
is enabled).

---
:100644 100644 7b6417b... ec4fc16... M drivers/net/wireless/ath/ath9k/ar9002_mac.c
:100644 100644 09b8c9d... 4948f54... M drivers/net/wireless/ath/ath9k/ar9003_mac.c
:100644 100644 43d84db... 016476e... M drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 a2eb043... 664ec90... M drivers/net/wireless/ath/ath9k/debug.h

 drivers/net/wireless/ath/ath9k/ar9002_mac.c |    3 ++
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |    6 +++-
 drivers/net/wireless/ath/ath9k/debug.c      |   50 ++++++++++++++------------
 drivers/net/wireless/ath/ath9k/debug.h      |    9 +++++
 4 files changed, 44 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath9k/ar9002_mac.c +3 -0
index 7b6417b..ec4fc16 100644
@@ -16,6 +16,8 @@
 
 #include "hw.h"
 #include <linux/export.h>
+#include "debug.h"
+#include "ath9k.h"
 
 #define AR_BufLen           0x00000fff
 
@@ -162,6 +164,7 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
 		if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) {
 			ath_dbg(common, INTERRUPT,
 				"AR_INTR_SYNC_LOCAL_TIMEOUT\n");
+			ATH_INCR_IRQ_STAT_COMMON(common, sync_local_timeout);
 		}
 
 		REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
drivers/net/wireless/ath/ath9k/ar9003_mac.c +5 -1
index 09b8c9d..4948f54 100644
@@ -16,6 +16,8 @@
 #include <linux/export.h>
 #include "hw.h"
 #include "ar9003_mac.h"
+#include "debug.h"
+#include "ath9k.h"
 
 static void ar9003_hw_rx_enable(struct ath_hw *hw)
 {
@@ -332,9 +334,11 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
 			*masked |= ATH9K_INT_FATAL;
 		}
 
-		if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT)
+		if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) {
 			ath_dbg(common, INTERRUPT,
 				"AR_INTR_SYNC_LOCAL_TIMEOUT\n");
+			ATH_INCR_IRQ_STAT_COMMON(common, sync_local_timeout);
+		}
 
 		REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
 		(void) REG_READ(ah, AR_INTR_SYNC_CAUSE_CLR);
drivers/net/wireless/ath/ath9k/debug.c +27 -23

84 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/debug.h +9 -0
index a2eb043..664ec90 100644
@@ -60,6 +60,7 @@ struct ath_buf;
  * @tsfoor: TSF out of range, indicates that the corrected TSF received
  * from a beacon differs from the PCU's internal TSF by more than a
  * (programmable) threshold
+ * @sync_local_timeout: Internal bus timeout.
  */
 struct ath_interrupt_stats {
 	u32 total;
@@ -85,8 +86,15 @@ struct ath_interrupt_stats {
 	u32 dtim;
 	u32 bb_watchdog;
 	u32 tsfoor;
+	u32 sync_local_timeout;
 };
 
+#define ATH_INCR_IRQ_STAT_COMMON(c, s)					\
+	do {								\
+		struct ath_softc *sc = (struct ath_softc *) (c)->priv;	\
+		sc->debug.stats.istats.s++;				\
+	} while (0);
+
 /**
  * struct ath_tx_stats - Statistics about TX
  * @tx_pkts_all:  No. of total frames transmitted, including ones that
@@ -272,6 +280,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
 #else
 
 #define RX_STAT_INC(c) /* NOP */
+#define ATH_INCR_IRQ_STAT_COMMON(c, s) /* NOP */
 
 static inline int ath9k_init_debug(struct ath_hw *ah)
 {
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 ath9k: Gather and report bus-timeout errors.

Quoted 4 lines · greearb at candelatech.com

From: Ben Greear <[email protected]>

Seems like a useful stat to report (when debugfs
is enabled).

[]

drivers/net/wireless/ath/ath9k/debug.c

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.c +0 -0

[]

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 388

Quoted 6 lines
drivers/net/wireless/ath/ath9k/debug.c +1 -1
@@ -385,57 +385,61 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
 				   size_t count, loff_t *ppos)
 {
 	struct ath_softc *sc = file->private_data;
-	char buf[512];
+	char buf[800];

800 seems excessive.
Maybe it's better to kmalloc this.

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 393

Quoted 6 lines
drivers/net/wireless/ath/ath9k/debug.c +1 -1
 	unsigned int len = 0;
 
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
 		len += snprintf(buf + len, sizeof(buf) - len,
-			"%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
+			"%11s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

why change the size from 8 to 11?

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 398

Quoted 7 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -2
 		len += snprintf(buf + len, sizeof(buf) - len,
-			"%8s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp);
+			"%11s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp);
 		len += snprintf(buf + len, sizeof(buf) - len,
-			"%8s: %10u\n", "WATCHDOG",
+			"%11s: %10u\n", "WATCHDOG",
 			sc->debug.stats.istats.bb_watchdog);

[]

drivers/net/wireless/ath/ath9k/debug.h

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.h +0 -0

[]

drivers/net/wireless/ath/ath9k/debug.h struct ath_interrupt_stats { · line 94

Quoted 10 lines
drivers/net/wireless/ath/ath9k/debug.h +4 -0
@@ -85,8 +86,15 @@ struct ath_interrupt_stats {
 	u32 dtim;
 	u32 bb_watchdog;
 	u32 tsfoor;
+	u32 sync_local_timeout;
 };
 
+#define ATH_INCR_IRQ_STAT_COMMON(c, s)					\
+	do {								\
+		struct ath_softc *sc = (struct ath_softc *) (c)->priv;	\

Isn't priv void *?
I think you don't need the cast.

drivers/net/wireless/ath/ath9k/debug.h struct ath_interrupt_stats { · line 96

Quoted 2 lines
drivers/net/wireless/ath/ath9k/debug.h +2 -0
+		sc->debug.stats.istats.s++;				\
+	} while (0);

sb: "while (0)" without the ;

author
#2 lore raw

PATCH 1/1 ath9k: Gather and report bus-timeout errors.

Quoted 8 lines · Joe Perches
Quoted 4 lines · greearb at candelatech.com

From: Ben Greear<[email protected]>

Seems like a useful stat to report (when debugfs
is enabled).

[]

drivers/net/wireless/ath/ath9k/debug.c

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.c +0 -0

[]

Quoted 9 lines

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 388

Quoted 6 lines
drivers/net/wireless/ath/ath9k/debug.c +1 -1
@@ -385,57 +385,61 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
  				   size_t count, loff_t *ppos)
  {
  	struct ath_softc *sc = file->private_data;
-	char buf[512];
+	char buf[800];

800 seems excessive.
Maybe it's better to kmalloc this.

Ok.

Quoted 8 lines

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 393

Quoted 6 lines
drivers/net/wireless/ath/ath9k/debug.c +1 -1
  	unsigned int len = 0;
 
  	if (sc->sc_ah->caps.hw_caps&  ATH9K_HW_CAP_EDMA) {
  		len += snprintf(buf + len, sizeof(buf) - len,
-			"%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
+			"%11s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

why change the size from 8 to 11?

To make the columns line up properly.

Quoted 6 lines

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 396

Quoted 3 lines
drivers/net/wireless/ath/ath9k/debug.c +3 -0
+#define ATH_INCR_IRQ_STAT_COMMON(c, s)					\
+	do {								\
+		struct ath_softc *sc = (struct ath_softc *) (c)->priv;	\

Isn't priv void *?
I think you don't need the cast.

Dunno..just copied existing code. I'll see if it compiles w/out the explicit cast.

Quoted 5 lines

drivers/net/wireless/ath/ath9k/debug.c static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, · line 398

Quoted 3 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -0
+		sc->debug.stats.istats.s++;				\
+	} while (0);

sb: "while (0)" without the ;

Ok.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com