2009-02-09 15:56:54 +08:00
|
|
|
/*
|
2011-05-17 16:06:18 +08:00
|
|
|
* Copyright (c) 2008-2011 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"
|
2011-12-15 12:16:34 +08:00
|
|
|
#include "dfs_debug.h"
|
2009-09-07 19:52:26 +08:00
|
|
|
|
2009-07-27 14:38:16 +08:00
|
|
|
struct ath_txq;
|
|
|
|
struct ath_buf;
|
2013-01-08 21:48:58 +08:00
|
|
|
struct fft_sample_tlv;
|
2009-07-27 14:38:16 +08:00
|
|
|
|
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++
|
2014-01-13 09:59:30 +08:00
|
|
|
#define RX_STAT_INC(c) (sc->debug.stats.rxstats.c++)
|
2011-10-07 08:28:13 +08:00
|
|
|
#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++
|
2013-08-01 14:23:17 +08:00
|
|
|
#define ANT_STAT_INC(i, c) sc->debug.stats.ant_stats[i].c++
|
2013-08-01 23:27:06 +08:00
|
|
|
#define ANT_LNA_INC(i, c) sc->debug.stats.ant_stats[i].lna_recv_cnt[c]++;
|
2009-07-27 14:38:16 +08:00
|
|
|
#else
|
|
|
|
#define TX_STAT_INC(q, c) do { } while (0)
|
2014-01-13 09:59:30 +08:00
|
|
|
#define RX_STAT_INC(c)
|
2011-10-07 08:28:13 +08:00
|
|
|
#define RESET_STAT_INC(sc, type) do { } while (0)
|
2013-08-01 14:23:17 +08:00
|
|
|
#define ANT_STAT_INC(i, c) do { } while (0)
|
|
|
|
#define ANT_LNA_INC(i, c) do { } while (0)
|
2009-07-27 14:38:16 +08:00
|
|
|
#endif
|
|
|
|
|
2012-07-17 19:46:42 +08:00
|
|
|
enum ath_reset_type {
|
|
|
|
RESET_TYPE_BB_HANG,
|
|
|
|
RESET_TYPE_BB_WATCHDOG,
|
|
|
|
RESET_TYPE_FATAL_INT,
|
|
|
|
RESET_TYPE_TX_ERROR,
|
2014-01-13 16:25:11 +08:00
|
|
|
RESET_TYPE_TX_GTT,
|
2012-07-17 19:46:42 +08:00
|
|
|
RESET_TYPE_TX_HANG,
|
|
|
|
RESET_TYPE_PLL_HANG,
|
|
|
|
RESET_TYPE_MAC_HANG,
|
|
|
|
RESET_TYPE_BEACON_STUCK,
|
2012-11-20 21:00:00 +08:00
|
|
|
RESET_TYPE_MCI,
|
2014-10-25 23:19:30 +08:00
|
|
|
RESET_TYPE_CALIBRATION,
|
2015-07-02 19:40:29 +08:00
|
|
|
RESET_TX_DMA_ERROR,
|
|
|
|
RESET_RX_DMA_ERROR,
|
2012-07-17 19:46:42 +08:00
|
|
|
__RESET_TYPE_MAX
|
|
|
|
};
|
|
|
|
|
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
|
2010-05-14 01:33:44 +08:00
|
|
|
* @bb_watchdog: Baseband watchdog
|
2011-04-22 19:57:01 +08:00
|
|
|
* @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
|
2012-04-13 01:04:00 +08:00
|
|
|
* @local_timeout: Internal bus timeout.
|
2012-09-07 18:24:13 +08:00
|
|
|
* @mci: MCI interrupt, specific to MCI based BTCOEX chipsets
|
|
|
|
* @gen_timer: Generic hardware timer interrupt
|
2009-02-09 15:56:54 +08:00
|
|
|
*/
|
|
|
|
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;
|
2010-05-14 01:33:44 +08:00
|
|
|
u32 bb_watchdog;
|
2011-04-22 19:57:01 +08:00
|
|
|
u32 tsfoor;
|
2012-06-04 18:57:41 +08:00
|
|
|
u32 mci;
|
2012-09-07 18:24:13 +08:00
|
|
|
u32 gen_timer;
|
2012-04-13 01:04:00 +08:00
|
|
|
|
|
|
|
/* 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;
|
2009-02-09 15:56:54 +08:00
|
|
|
};
|
|
|
|
|
2012-04-13 01:04:00 +08:00
|
|
|
|
2009-07-27 14:38:16 +08:00
|
|
|
/**
|
|
|
|
* struct ath_tx_stats - Statistics about TX
|
2010-10-02 03:26:30 +08:00
|
|
|
* @tx_pkts_all: No. of total frames transmitted, including ones that
|
|
|
|
may have had errors.
|
|
|
|
* @tx_bytes_all: No. of total bytes transmitted, including ones that
|
|
|
|
may have had errors.
|
2009-07-27 14:38:16 +08:00
|
|
|
* @queued: Total MPDUs (non-aggr) queued
|
|
|
|
* @completed: Total MPDUs (non-aggr) completed
|
|
|
|
* @a_aggr: Total no. of aggregates queued
|
2011-01-10 15:11:48 +08:00
|
|
|
* @a_queued_hw: Total AMPDUs queued to hardware
|
2009-07-27 14:38:16 +08:00
|
|
|
* @a_completed: Total AMPDUs completed
|
|
|
|
* @a_retries: No. of AMPDUs retried (SW)
|
|
|
|
* @a_xretries: No. of AMPDUs dropped due to xretries
|
2013-03-05 07:31:16 +08:00
|
|
|
* @txerr_filtered: No. of frames with TXERR_FILT flag set.
|
2009-07-27 14:38:16 +08:00
|
|
|
* @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
|
2011-01-10 15:11:45 +08:00
|
|
|
* @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
|
2012-04-04 00:16:55 +08:00
|
|
|
* @txfailed: Out-of-memory or other errors in xmit path.
|
2009-07-27 14:38:16 +08:00
|
|
|
*/
|
|
|
|
struct ath_tx_stats {
|
2010-10-02 03:26:30 +08:00
|
|
|
u32 tx_pkts_all;
|
|
|
|
u32 tx_bytes_all;
|
2009-07-27 14:38:16 +08:00
|
|
|
u32 queued;
|
|
|
|
u32 completed;
|
2011-06-01 03:21:41 +08:00
|
|
|
u32 xretries;
|
2009-07-27 14:38:16 +08:00
|
|
|
u32 a_aggr;
|
2011-01-10 15:11:48 +08:00
|
|
|
u32 a_queued_hw;
|
2009-07-27 14:38:16 +08:00
|
|
|
u32 a_completed;
|
|
|
|
u32 a_retries;
|
|
|
|
u32 a_xretries;
|
2013-03-05 07:31:16 +08:00
|
|
|
u32 txerr_filtered;
|
2009-07-27 14:38:16 +08:00
|
|
|
u32 fifo_underrun;
|
|
|
|
u32 xtxop;
|
|
|
|
u32 timer_exp;
|
|
|
|
u32 desc_cfg_err;
|
|
|
|
u32 data_underrun;
|
|
|
|
u32 delim_underrun;
|
2011-01-10 15:11:45 +08:00
|
|
|
u32 puttxbuf;
|
|
|
|
u32 txstart;
|
|
|
|
u32 txprocdesc;
|
2012-04-04 00:16:55 +08:00
|
|
|
u32 txfailed;
|
2009-07-27 14:38:16 +08:00
|
|
|
};
|
|
|
|
|
2012-11-21 20:43:11 +08:00
|
|
|
/*
|
|
|
|
* Various utility macros to print TX/Queue counters.
|
|
|
|
*/
|
|
|
|
#define PR_QNUM(_n) sc->tx.txq_map[_n]->axq_qnum
|
|
|
|
#define TXSTATS sc->debug.stats.txstats
|
|
|
|
#define PR(str, elem) \
|
|
|
|
do { \
|
2014-11-09 18:31:59 +08:00
|
|
|
seq_printf(file, "%s%13u%11u%10u%10u\n", str, \
|
|
|
|
TXSTATS[PR_QNUM(IEEE80211_AC_BE)].elem,\
|
|
|
|
TXSTATS[PR_QNUM(IEEE80211_AC_BK)].elem,\
|
|
|
|
TXSTATS[PR_QNUM(IEEE80211_AC_VI)].elem,\
|
|
|
|
TXSTATS[PR_QNUM(IEEE80211_AC_VO)].elem); \
|
2012-11-21 20:43:11 +08:00
|
|
|
} while(0)
|
|
|
|
|
2014-01-13 09:59:30 +08:00
|
|
|
struct ath_rx_rate_stats {
|
|
|
|
struct {
|
|
|
|
u32 ht20_cnt;
|
|
|
|
u32 ht40_cnt;
|
|
|
|
u32 sgi_cnt;
|
|
|
|
u32 lgi_cnt;
|
|
|
|
} ht_stats[24];
|
|
|
|
|
|
|
|
struct {
|
|
|
|
u32 ofdm_cnt;
|
|
|
|
} ofdm_stats[8];
|
|
|
|
|
|
|
|
struct {
|
|
|
|
u32 cck_lp_cnt;
|
|
|
|
u32 cck_sp_cnt;
|
|
|
|
} cck_stats[4];
|
|
|
|
};
|
2012-04-04 00:18:59 +08:00
|
|
|
|
2013-08-01 14:23:17 +08:00
|
|
|
#define ANT_MAIN 0
|
|
|
|
#define ANT_ALT 1
|
|
|
|
|
|
|
|
struct ath_antenna_stats {
|
|
|
|
u32 recv_cnt;
|
2013-08-01 23:27:06 +08:00
|
|
|
u32 rssi_avg;
|
|
|
|
u32 lna_recv_cnt[4];
|
|
|
|
u32 lna_attempt_cnt[4];
|
2013-08-01 14:23:17 +08:00
|
|
|
};
|
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
struct ath_stats {
|
|
|
|
struct ath_interrupt_stats istats;
|
2012-12-07 22:55:30 +08:00
|
|
|
struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
|
2010-01-08 13:06:11 +08:00
|
|
|
struct ath_rx_stats rxstats;
|
2011-12-15 12:16:34 +08:00
|
|
|
struct ath_dfs_stats dfs_stats;
|
2013-08-01 14:23:17 +08:00
|
|
|
struct ath_antenna_stats ant_stats[2];
|
2011-10-07 08:28:13 +08:00
|
|
|
u32 reset[__RESET_TYPE_MAX];
|
2009-02-09 15:56:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ath9k_debug {
|
|
|
|
struct dentry *debugfs_phy;
|
2010-05-11 23:23:02 +08:00
|
|
|
u32 regidx;
|
2009-02-09 15:56:54 +08:00
|
|
|
struct ath_stats stats;
|
|
|
|
};
|
|
|
|
|
2009-09-07 19:52:26 +08:00
|
|
|
int ath9k_init_debug(struct ath_hw *ah);
|
2013-05-10 21:11:06 +08:00
|
|
|
void ath9k_deinit_debug(struct ath_softc *sc);
|
2009-09-07 19:52:26 +08:00
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
|
2010-11-07 21:59:39 +08:00
|
|
|
void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
|
2011-09-15 03:24:16 +08:00
|
|
|
struct ath_tx_status *ts, struct ath_txq *txq,
|
|
|
|
unsigned int flags);
|
2010-03-30 11:09:27 +08:00
|
|
|
void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs);
|
2012-11-28 17:38:52 +08:00
|
|
|
int ath9k_get_et_sset_count(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif, int sset);
|
|
|
|
void ath9k_get_et_stats(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ethtool_stats *stats, u64 *data);
|
|
|
|
void ath9k_get_et_strings(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
u32 sset, u8 *data);
|
2012-11-28 17:38:54 +08:00
|
|
|
void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
|
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
struct ieee80211_sta *sta,
|
|
|
|
struct dentry *dir);
|
2013-08-01 23:27:06 +08:00
|
|
|
void ath9k_debug_stat_ant(struct ath_softc *sc,
|
|
|
|
struct ath_hw_antcomb_conf *div_ant_conf,
|
|
|
|
int main_rssi_avg, int alt_rssi_avg);
|
2013-12-20 01:01:48 +08:00
|
|
|
void ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause);
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-05-10 21:11:06 +08:00
|
|
|
static inline void ath9k_deinit_debug(struct ath_softc *sc)
|
|
|
|
{
|
|
|
|
}
|
2009-02-09 15:56:54 +08:00
|
|
|
static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
|
|
|
|
enum ath9k_int status)
|
|
|
|
{
|
|
|
|
}
|
2009-07-27 14:38:16 +08:00
|
|
|
static inline void ath_debug_stat_tx(struct ath_softc *sc,
|
2010-04-01 06:41:36 +08:00
|
|
|
struct ath_buf *bf,
|
2011-01-29 00:52:49 +08:00
|
|
|
struct ath_tx_status *ts,
|
2011-09-15 03:24:16 +08:00
|
|
|
struct ath_txq *txq,
|
|
|
|
unsigned int flags)
|
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
|
|
|
{
|
2013-08-01 23:27:06 +08:00
|
|
|
}
|
|
|
|
static inline void ath9k_debug_stat_ant(struct ath_softc *sc,
|
|
|
|
struct ath_hw_antcomb_conf *div_ant_conf,
|
|
|
|
int main_rssi_avg, int alt_rssi_avg)
|
|
|
|
{
|
|
|
|
|
2010-01-08 13:06:11 +08:00
|
|
|
}
|
|
|
|
|
2013-12-20 01:01:48 +08:00
|
|
|
static inline void
|
|
|
|
ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-24 05:33:27 +08:00
|
|
|
#endif /* CONFIG_ATH9K_DEBUGFS */
|
2009-02-09 15:56:54 +08:00
|
|
|
|
2014-01-13 09:59:30 +08:00
|
|
|
#ifdef CONFIG_ATH9K_STATION_STATISTICS
|
|
|
|
void ath_debug_rate_stats(struct ath_softc *sc,
|
|
|
|
struct ath_rx_status *rs,
|
|
|
|
struct sk_buff *skb);
|
|
|
|
#else
|
|
|
|
static inline void ath_debug_rate_stats(struct ath_softc *sc,
|
|
|
|
struct ath_rx_status *rs,
|
|
|
|
struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ATH9K_STATION_STATISTICS */
|
|
|
|
|
2009-02-09 15:56:54 +08:00
|
|
|
#endif /* DEBUG_H */
|