Skip to contentSkip to conversation

ath9k: Gather and report IRQ sync_cause errors.

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

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ath9k: Gather and report IRQ sync_cause errors.

From: Ben Greear <[email protected]>

Report all defined sync_cause errors in debugfs
to aid with debugging.

---

v2: Lots of changes. Report all sync-cause errors instead of just one.
Use method to gather them instead of individual macros. Increase width of the interrupts debugfs columns to 21 chars to fit labels.

I do not know what all of these really mean, so didn't add comments to the ath_interrupt_stats kdoc header. Someone with docs might be able to fill that in.

:100644 100644 7b6417b... 87ee5b1... M drivers/net/wireless/ath/ath9k/ar9002_mac.c
:100644 100644 09b8c9d... 666de70... M drivers/net/wireless/ath/ath9k/ar9003_mac.c
:100644 100644 43d84db... 83f0201... M drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 a2eb043... 301266f... M drivers/net/wireless/ath/ath9k/debug.h
:100644 100644 87db1ee... d116c56... M drivers/net/wireless/ath/ath9k/hw.c
:100644 100644 c8261d4... d1e8ad97.. M drivers/net/wireless/ath/ath9k/hw.h

 drivers/net/wireless/ath/ath9k/ar9002_mac.c |    1 +
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |    2 +
 drivers/net/wireless/ath/ath9k/debug.c      |  169 +++++++++++++++++++--------
 drivers/net/wireless/ath/ath9k/debug.h      |   23 ++++
 drivers/net/wireless/ath/ath9k/hw.c         |   49 ++++++++
 drivers/net/wireless/ath/ath9k/hw.h         |    6 +
 6 files changed, 199 insertions(+), 51 deletions(-)
drivers/net/wireless/ath/ath9k/ar9002_mac.c +1 -0
index 7b6417b..87ee5b1 100644
@@ -136,6 +136,7 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
 	}
 
 	if (sync_cause) {
+		ath9k_debug_sync_cause(common, sync_cause);
 		fatal_int =
 			(sync_cause &
 			 (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR))
drivers/net/wireless/ath/ath9k/ar9003_mac.c +2 -0
index 09b8c9d..666de70 100644
@@ -326,6 +326,8 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
 	}
 
 	if (sync_cause) {
+		ath9k_debug_sync_cause(common, sync_cause);
+
 		if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) {
 			REG_WRITE(ah, AR_RC, AR_RC_HOSTIF);
 			REG_WRITE(ah, AR_RC, 0);
drivers/net/wireless/ath/ath9k/debug.c +118 -51

181 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/debug.h +23 -0
index a2eb043..301266f 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
+ * @local_timeout: Internal bus timeout.
  */
 struct ath_interrupt_stats {
 	u32 total;
@@ -85,8 +86,30 @@ struct ath_interrupt_stats {
 	u32 dtim;
 	u32 bb_watchdog;
 	u32 tsfoor;
+
+	/* Sync-cause stats */
+	u32 sync_cause_all;
+	u32 sync_rtc_irq;
+	u32 sync_mac_irq;
+	u32 eeprom_illegal_access;
+	u32 apb_timeout;
+	u32 pci_mode_conflict;
+	u32 host1_fatal;
+	u32 host1_perr;
+	u32 trcv_fifo_perr;
+	u32 radm_cpl_ep;
+	u32 radm_cpl_dllp_abort;
+	u32 radm_cpl_tlp_abort;
+	u32 radm_cpl_ecrc_err;
+	u32 radm_cpl_timeout;
+	u32 local_timeout;
+	u32 pm_access;
+	u32 mac_awake;
+	u32 mac_asleep;
+	u32 mac_sleep_access;
 };
 
+
 /**
  * struct ath_tx_stats - Statistics about TX
  * @tx_pkts_all:  No. of total frames transmitted, including ones that
drivers/net/wireless/ath/ath9k/hw.c +49 -0

61 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/hw.h +6 -0
index c8261d4..d1e8ad97 100644
@@ -1129,6 +1129,12 @@ bool ath9k_hw_check_alive(struct ath_hw *ah);
 
 bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
 
+#ifdef CONFIG_ATH9K_DEBUGFS
+void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
+#else
+static void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause) {}
+#endif
+
 /* Generic hw timer primitives */
 struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
 					  void (*trigger)(void *),
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH v2 1/1 ath9k: Gather and report IRQ sync_cause errors.

Quoted 4 lines · greearb at candelatech.com

From: Ben Greear <[email protected]>

Report all defined sync_cause errors in debugfs
to aid with debugging.

just trivia:

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 387

Quoted 4 lines
drivers/net/wireless/ath/ath9k/debug.c +0 -0
@@ -385,63 +385,130 @@ 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;

[]

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

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.c +0 -0
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {

[]

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

Quoted 2 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -0
+		len += snprintf(buf + len, mxlen - len,
+			"%21s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

Alignment is overrated.

I wouldn't change any of the original block
though perhaps changing the sc pointer to an
istats pointer so these dereferences become
similar to istats->rxlp;

[]

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

Quoted 2 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -0
+	len += snprintf(buf + len, mxlen - len,
+			"SYNC_CAUSE stats:\n");

But _might_ add the %21s here for the new entries.

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

Quoted 3 lines
drivers/net/wireless/ath/ath9k/debug.c +3 -0
+	len += snprintf(buf + len, mxlen - len,
+			"%21s: %10u\n", "Sync-All",
+			sc->debug.stats.istats.sync_cause_all);

[]

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

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

[]

drivers/net/wireless/ath/ath9k/hw.c static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah) · line 95

Quoted 13 lines
drivers/net/wireless/ath/ath9k/hw.c +9 -0
@@ -82,6 +84,53 @@ static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
 /* Helper Functions */
 /********************/
 
+#ifdef CONFIG_ATH9K_DEBUGFS
+
+void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
+{
+	struct ath_softc *sc = common->priv;
+	if (sync_cause)
+		sc->debug.stats.istats.sync_cause_all++;
+	if (sync_cause & AR_INTR_SYNC_RTC_IRQ)
+		sc->debug.stats.istats.sync_rtc_irq++;

And nicer here to use a pointer to istats too.

		istats->sync_rtc_irq++;

drivers/net/wireless/ath/ath9k/hw.c static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah) · line 97

Quoted 2 lines
drivers/net/wireless/ath/ath9k/hw.c +2 -0
+	if (sync_cause & AR_INTR_SYNC_MAC_IRQ)
+		sc->debug.stats.istats.sync_mac_irq++;
		istats->sync_mac_irq++;

etc.

author
#2 lore raw

PATCH v2 1/1 ath9k: Gather and report IRQ sync_cause errors.

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

From: Ben Greear<[email protected]>

Report all defined sync_cause errors in debugfs
to aid with debugging.

just trivia:

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 387

Quoted 4 lines
drivers/net/wireless/ath/ath9k/debug.c +0 -0
@@ -385,63 +385,130 @@ 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;

[]

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

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.c +0 -0
  	if (sc->sc_ah->caps.hw_caps&  ATH9K_HW_CAP_EDMA) {

[]

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

Quoted 2 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -0
+		len += snprintf(buf + len, mxlen - len,
+			"%21s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

Alignment is overrated.

Quoted 4 lines

I wouldn't change any of the original block
though perhaps changing the sc pointer to an
istats pointer so these dereferences become
similar to istats->rxlp;

Other files in this driver are aligned, so it seems nice to continue the tradition. debugfs files are for human consumption, so making them readable is a virtue.

If someone wants more efficient access to this data, then we can use ethtool stats (I'll add ethtool stats support for these counters if/when my first ethtool patches make it in...)

Quoted 9 lines

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

Quoted 7 lines
drivers/net/wireless/ath/ath9k/debug.c +7 -0
+void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
+{
+	struct ath_softc *sc = common->priv;
+	if (sync_cause)
+		sc->debug.stats.istats.sync_cause_all++;
+	if (sync_cause&  AR_INTR_SYNC_RTC_IRQ)
+		sc->debug.stats.istats.sync_rtc_irq++;

And nicer here to use a pointer to istats too.

Hopefully the compiler is smart enough that this doesn't really matter.

If the maintainers care, I'll respin the patch, but otherwise I'm not sure it's worth the effort.

Thanks,
Ben

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

PATCH v2 1/1 ath9k: Gather and report IRQ sync_cause errors.

(added Luis R and the current ath9k-devel list to cc's)

Quoted 28 lines · Ben Greear
Quoted 22 lines · Joe Perches
Quoted 4 lines · greearb at candelatech.com

From: Ben Greear<[email protected]>

Report all defined sync_cause errors in debugfs
to aid with debugging.

just trivia:

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 387

Quoted 4 lines
drivers/net/wireless/ath/ath9k/debug.c +0 -0
@@ -385,63 +385,130 @@ 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;

[]

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

Quoted 1 line
drivers/net/wireless/ath/ath9k/debug.c +0 -0
  	if (sc->sc_ah->caps.hw_caps&  ATH9K_HW_CAP_EDMA) {

[]

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

Quoted 2 lines
drivers/net/wireless/ath/ath9k/debug.c +2 -0
+		len += snprintf(buf + len, mxlen - len,
+			"%21s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);

Alignment is overrated.

Quoted 4 lines

I wouldn't change any of the original block
though perhaps changing the sc pointer to an
istats pointer so these dereferences become
similar to istats->rxlp;

Quoted 4 lines

Other files in this driver are aligned, so it seems nice to continue the tradition. debugfs files are for human consumption, so making them readable is a virtue.

It'd still be readable, it would just be a different block separated by a new header line.

Quoted 4 lines

If someone wants more efficient access to this data, then we can use ethtool stats (I'll add ethtool stats support for these counters if/when my first ethtool patches make it in...)

That'd be a good idea.

Quoted 10 lines
Quoted 9 lines

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

Quoted 7 lines
drivers/net/wireless/ath/ath9k/debug.c +7 -0
+void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
+{
+	struct ath_softc *sc = common->priv;
+	if (sync_cause)
+		sc->debug.stats.istats.sync_cause_all++;
+	if (sync_cause&  AR_INTR_SYNC_RTC_IRQ)
+		sc->debug.stats.istats.sync_rtc_irq++;

And nicer here to use a pointer to istats too.

Quoted 2 lines

Hopefully the compiler is smart enough that this doesn't really matter.

It is, but it's really for reader clarity not
compiler output.

Quoted 2 lines

If the maintainers care, I'll respin the patch, but otherwise I'm not sure it's worth the effort.

The patch doesn't apply cleanly against next anyway. There's a trivial #include mismatch.

cheers, Joe