2009-02-09 15:56:54 +08:00
|
|
|
/*
|
2009-03-13 11:37:23 +08:00
|
|
|
* Copyright (c) 2008-2009 Atheros Communications Inc.
|
2009-02-09 15:56:54 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DEBUG_H
|
|
|
|
#define DEBUG_H
|
|
|
|
|
2009-09-07 19:52:26 +08:00
|
|
|
#include "hw.h"
|
2009-11-24 05:21:01 +08:00
|
|
|
#include "rc.h"
|
2009-09-07 19:52:26 +08:00
|
|
|
|
2009-07-27 14:38:16 +08:00
|
|
|
struct ath_txq;
|
|
|
|
struct ath_buf;
|
|
|
|
|
2009-11-24 05:33:27 +08:00
|
|
|
#ifdef CONFIG_ATH9K_DEBUGFS
|
2009-07-27 14:38:16 +08:00
|
|
|
#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++
|
|
|
|
#else
|
|
|
|
#define TX_STAT_INC(q, c) do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
2009-11-24 05:33:27 +08:00
|
|
|
#ifdef CONFIG_ATH9K_DEBUGFS
|
2009-02-09 15:56:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct ath_interrupt_stats - Contains statistics about interrupts
|
|
|
|
* @total: Total no. of interrupts generated so far
|
|
|
|
* @rxok: RX with no errors
|
2010-04-16 05:39:30 +08:00
|
|
|
* @rxlp: RX with low priority RX
|
|
|
|
* @rxhp: RX with high priority, uapsd only
|
2009-02-09 15:56:54 +08:00
|
|
|
* @rxeol: RX with no more RXDESC available
|
|
|
|
* @rxorn: RX FIFO overrun
|
|
|
|
* @txok: TX completed at the requested rate
|
|
|
|
* @txurn: TX FIFO underrun
|
|
|
|
* @mib: MIB regs reaching its threshold
|
|
|
|
* @rxphyerr: RX with phy errors
|
|
|
|
* @rx_keycache_miss: RX with key cache misses
|
|
|
|
* @swba: Software Beacon Alert
|
|
|
|
* @bmiss: Beacon Miss
|
|
|
|
* @bnr: Beacon Not Ready
|
|
|
|
* @cst: Carrier Sense TImeout
|
|
|
|
* @gtt: Global TX Timeout
|
|
|
|
* @tim: RX beacon TIM occurrence
|
|
|
|
* @cabend: RX End of CAB traffic
|
|
|
|
* @dtimsync: DTIM sync lossage
|
|
|
|
* @dtim: RX Beacon with DTIM
|
|
|
|
*/
|
|
|
|
struct ath_interrupt_stats {
|
|
|
|
u32 total;
|
|
|
|
u32 rxok;
|
2010-04-16 05:39:30 +08:00
|
|
|
u32 rxlp;
|
|
|
|
u32 rxhp;
|
2009-02-09 15:56:54 +08:00
|
|
|
u32 rxeol;
|
|
|
|
u32 rxorn;
|
|
|
|
u32 txok;
|
|
|
|
u32 txeol;
|
|
|
|
u32 txurn;
|
|
|
|
u32 mib;
|
|
|
|
u32 rxphyerr;
|
|
|
|
u32 rx_keycache_miss;
|
|
|
|
u32 swba;
|
|
|
|
u32 bmiss;
|
|
|
|
u32 bnr;
|
|
|
|
u32 cst;
|
|
|
|
u32 gtt;
|
|
|
|
u32 tim;
|
|
|
|
u32 cabend;
|
|
|
|
u32 dtimsync;
|
|
|
|
u32 dtim;
|
|
|
|
};
|
|
|
|
|
2009-05-27 20:48:28 +08:00
|
|
|
struct ath_rc_stats {
|
2009-02-09 15:56:54 +08:00
|
|
|
u32 success;
|
|
|
|
u32 retries;
|
|
|
|
u32 xretries;
|
2009-02-20 17:43:20 +08:00
|
|
|
u8 per;
|
2009-02-09 15:56:54 +08:00
|
|
|
};
|
|
|
|
|
2009-07-27 14:38:16 +08:00
|
|
|
/**
|
|
|
|
* struct ath_tx_stats - Statistics about TX
|
|
|
|
* @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_completed: Total AMPDUs completed
|
|
|
|
* @a_retries: No. of AMPDUs retried (SW)
|
|
|
|
* @a_xretries: No. of AMPDUs dropped due to xretries
|
|
|
|
* @fifo_underrun: FIFO underrun occurrences
|
|
|
|
Valid only for:
|
|
|
|
- non-aggregate condition.
|
|
|
|
- first packet of aggregate.
|
|
|
|
* @xtxop: No. of frames filtered because of TXOP limit
|
|
|
|
* @timer_exp: Transmit timer expiry
|
|
|
|
* @desc_cfg_err: Descriptor configuration errors
|
|
|
|
* @data_urn: TX data underrun errors
|
|
|
|
* @delim_urn: TX delimiter underrun errors
|
|
|
|
*/
|
|
|
|
struct ath_tx_stats {
|
|
|
|
u32 queued;
|
|
|
|
u32 completed;
|
|
|
|
u32 a_aggr;
|
|
|
|
u32 a_queued;
|
|
|
|
u32 a_completed;
|
|
|
|
u32 a_retries;
|
|
|
|
u32 a_xretries;
|
|
|
|
u32 fifo_underrun;
|
|
|
|
u32 xtxop;
|
|
|
|
u32 timer_exp;
|
|
|
|
u32 desc_cfg_err;
|
|
|
|
u32 data_underrun;
|
|
|
|
u32 delim_underrun;
|
|
|
|
};
|
|
|
|
|
2010-01-08 13:06:11 +08:00
|
|
|
/**
|
|
|
|
* struct ath_rx_stats - RX Statistics
|
|
|
|
* @crc_err: No. of frames with incorrect CRC value
|
|
|
|
* @decrypt_crc_err: No. of frames whose CRC check failed after
|
|
|
|
decryption process completed
|
|
|
|
* @phy_err: No. of frames whose reception failed because the PHY
|
|
|
|
encountered an error
|
|
|
|
* @mic_err: No. of frames with incorrect TKIP MIC verification failure
|
|
|
|
* @pre_delim_crc_err: Pre-Frame delimiter CRC error detections
|
|
|
|
* @post_delim_crc_err: Post-Frame delimiter CRC error detections
|
|
|
|
* @decrypt_busy_err: Decryption interruptions counter
|
|
|
|
* @phy_err_stats: Individual PHY error statistics
|
|
|
|
*/
|
|
|
|
struct ath_rx_stats {
|
|
|
|
u32 crc_err;
|
|
|
|
u32 decrypt_crc_err;
|
|
|
|
u32 phy_err;
|
|
|
|
u32 mic_err;
|
|
|
|
u32 pre_delim_crc_err;
|
|
|
|
u32 post_delim_crc_err;
|
|
|
|
u32 decrypt_busy_err;
|
|
|
|
u32 phy_err_stats[ATH9K_PHYERR_MAX];
|
|
|
|
};
|
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
struct ath_stats {
|
|
|
|
struct ath_interrupt_stats istats;
|
2009-05-27 20:48:28 +08:00
|
|
|
struct ath_rc_stats rcstats[RATE_TABLE_SIZE];
|
2009-07-27 14:38:16 +08:00
|
|
|
struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
|
2010-01-08 13:06:11 +08:00
|
|
|
struct ath_rx_stats rxstats;
|
2009-02-09 15:56:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_debug {
|
|
|
|
struct dentry *debugfs_phy;
|
|
|
|
struct ath_stats stats;
|
|
|
|
};
|
|
|
|
|
2009-09-07 19:52:26 +08:00
|
|
|
int ath9k_init_debug(struct ath_hw *ah);
|
|
|
|
void ath9k_exit_debug(struct ath_hw *ah);
|
|
|
|
|
2009-03-05 23:55:18 +08:00
|
|
|
int ath9k_debug_create_root(void);
|
|
|
|
void ath9k_debug_remove_root(void);
|
2009-02-09 15:56:54 +08:00
|
|
|
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
|
2009-11-24 05:21:01 +08:00
|
|
|
void ath_debug_stat_rc(struct ath_softc *sc, int final_rate);
|
2009-07-27 14:38:16 +08:00
|
|
|
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq,
|
2010-03-30 11:07:11 +08:00
|
|
|
struct ath_buf *bf, struct ath_tx_status *ts);
|
2010-03-30 11:09:27 +08:00
|
|
|
void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
|
2009-02-09 15:56:54 +08:00
|
|
|
void ath_debug_stat_retries(struct ath_softc *sc, int rix,
|
2009-02-20 17:43:20 +08:00
|
|
|
int xretries, int retries, u8 per);
|
2009-02-09 15:56:54 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2009-09-07 19:52:26 +08:00
|
|
|
static inline int ath9k_init_debug(struct ath_hw *ah)
|
2009-02-09 15:56:54 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-09-07 19:52:26 +08:00
|
|
|
static inline void ath9k_exit_debug(struct ath_hw *ah)
|
2009-02-09 15:56:54 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-03-05 23:55:18 +08:00
|
|
|
static inline int ath9k_debug_create_root(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ath9k_debug_remove_root(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
|
|
|
|
enum ath9k_int status)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ath_debug_stat_rc(struct ath_softc *sc,
|
2009-11-24 05:21:01 +08:00
|
|
|
int final_rate)
|
2009-02-09 15:56:54 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-07-27 14:38:16 +08:00
|
|
|
static inline void ath_debug_stat_tx(struct ath_softc *sc,
|
|
|
|
struct ath_txq *txq,
|
2010-04-01 06:41:36 +08:00
|
|
|
struct ath_buf *bf,
|
|
|
|
struct ath_tx_status *ts)
|
2009-07-27 14:38:16 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-01-08 13:06:11 +08:00
|
|
|
static inline void ath_debug_stat_rx(struct ath_softc *sc,
|
2010-04-01 06:41:36 +08:00
|
|
|
struct ath_rx_status *rs)
|
2010-01-08 13:06:11 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
static inline void ath_debug_stat_retries(struct ath_softc *sc, int rix,
|
2009-02-20 17:43:20 +08:00
|
|
|
int xretries, int retries, u8 per)
|
2009-02-09 15:56:54 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-24 05:33:27 +08:00
|
|
|
#endif /* CONFIG_ATH9K_DEBUGFS */
|
2009-02-09 15:56:54 +08:00
|
|
|
|
|
|
|
#endif /* DEBUG_H */
|