ath9k: Move ethtool functions to debug.c
PATCH 1/4 ath9k: Move ethtool functions to debug.c
From: Sujith Manoharan <[email protected]>
The ethtool statistics are available only when CONFIG_ATH9K_DEBUGFS is enabled, move these functions to debug.c
Signed-off-by Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/debug.c | 119 ++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/debug.h | 8 +++ drivers/net/wireless/ath/ath9k/main.c | 127 --------------------------------- 3 files changed, 127 insertions(+), 127 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +119 -0
@@ -1509,6 +1509,125 @@ static const struct file_operations fops_btcoex = { };#endif +/* Ethtool support for get-stats */ + +#define AMKSTR (nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" +static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN ] = { +"tx_pkts_nic" , +"tx_bytes_nic" , +"rx_pkts_nic" , +"rx_bytes_nic" , +AMKSTR (d_tx_pkts), +AMKSTR (d_tx_bytes), +AMKSTR (d_tx_mpdus_queued), +AMKSTR (d_tx_mpdus_completed), +AMKSTR (d_tx_mpdu_xretries), +AMKSTR (d_tx_aggregates), +AMKSTR (d_tx_ampdus_queued_hw), +AMKSTR (d_tx_ampdus_queued_sw), +AMKSTR (d_tx_ampdus_completed), +AMKSTR (d_tx_ampdu_retries), +AMKSTR (d_tx_ampdu_xretries), +AMKSTR (d_tx_fifo_underrun), +AMKSTR (d_tx_op_exceeded), +AMKSTR (d_tx_timer_expiry), +AMKSTR (d_tx_desc_cfg_err), +AMKSTR (d_tx_data_underrun), +AMKSTR (d_tx_delim_underrun), +"d_rx_decrypt_crc_err" , +"d_rx_phy_err" , +"d_rx_mic_err" , +"d_rx_pre_delim_crc_err" , +"d_rx_post_delim_crc_err" , +"d_rx_decrypt_busy_err" , + +"d_rx_phyerr_radar" , +"d_rx_phyerr_ofdm_timing" , +"d_rx_phyerr_cck_timing" , + +}; +#define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) + +void ath9k_get_et_strings (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +u32 sset,u8 *data) +{ +if (sset ==ETH_SS_STATS ) +memcpy (data, *ath9k_gstrings_stats, +sizeof (ath9k_gstrings_stats)); +} + +int ath9k_get_et_sset_count (struct ieee80211_hw *hw, +struct ieee80211_vif *vif,int sset) +{ +if (sset ==ETH_SS_STATS ) +return ATH9K_SSTATS_LEN ; +return 0 ; +} + +#define AWDATA (elem) \ + do { \ + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ + data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ + } while (0) + +#define AWDATA_RX (elem) \ + do { \ + data[i++] = sc->debug.stats.rxstats.elem; \ + } while (0) + +void ath9k_get_et_stats (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ethtool_stats *stats,u64 *data) +{ +struct ath_softc *sc = hw->priv; +int i =0 ; + + data[i++] = (sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_BE )].tx_pkts_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_BK )].tx_pkts_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_VI )].tx_pkts_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_VO )].tx_pkts_all); + data[i++] = (sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_BE )].tx_bytes_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_BK )].tx_bytes_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_VI )].tx_bytes_all + + sc->debug.stats.txstats[PR_QNUM (IEEE80211_AC_VO )].tx_bytes_all); +AWDATA_RX (rx_pkts_all); +AWDATA_RX (rx_bytes_all); + +AWDATA (tx_pkts_all); +AWDATA (tx_bytes_all); +AWDATA (queued); +AWDATA (completed); +AWDATA (xretries); +AWDATA (a_aggr); +AWDATA (a_queued_hw); +AWDATA (a_queued_sw); +AWDATA (a_completed); +AWDATA (a_retries); +AWDATA (a_xretries); +AWDATA (fifo_underrun); +AWDATA (xtxop); +AWDATA (timer_exp); +AWDATA (desc_cfg_err); +AWDATA (data_underrun); +AWDATA (delim_underrun); + +AWDATA_RX (decrypt_crc_err); +AWDATA_RX (phy_err); +AWDATA_RX (mic_err); +AWDATA_RX (pre_delim_crc_err); +AWDATA_RX (post_delim_crc_err); +AWDATA_RX (decrypt_busy_err); + +AWDATA_RX (phy_err_stats[ATH9K_PHYERR_RADAR ]); +AWDATA_RX (phy_err_stats[ATH9K_PHYERR_OFDM_TIMING ]); +AWDATA_RX (phy_err_stats[ATH9K_PHYERR_CCK_TIMING ]); + +WARN_ON (i !=ATH9K_SSTATS_LEN ); +} +int ath9k_init_debug (struct ath_hw *ah) {struct ath_common *common =ath9k_hw_common (ah);
drivers/net/wireless/ath/ath9k/debug.h +8 -0
@@ -307,6 +307,14 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, struct ath_tx_status *ts, struct ath_txq *txq, unsigned int flags);void ath_debug_stat_rx (struct ath_softc *sc,struct ath_rx_status *rs); +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);#else
drivers/net/wireless/ath/ath9k/main.c +0 -127
133 lines not on this page · raw message
Signature · 1 line
1.8.0.1
PATCH 2/4 ath9k: Replace WME_NUM_TID with IEEE80211_NUM_TIDS
From: Sujith Manoharan <[email protected]>
Signed-off-by Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 +- drivers/net/wireless/ath/ath9k/common.h | 1 - drivers/net/wireless/ath/ath9k/xmit.c | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
@@ -261,7 +261,7 @@ struct ath_atx_tid {struct ath_node {struct ieee80211_sta *sta;/* station struct we're part of */ struct ieee80211_vif *vif;/* interface with which we're associated */ -struct ath_atx_tid tid[WME_NUM_TID ]; +struct ath_atx_tid tid[IEEE80211_NUM_TIDS ];struct ath_atx_ac ac[IEEE80211_NUM_ACS ];int ps_key;
drivers/net/wireless/ath/ath9k/common.h +0 -1
@@ -23,7 +23,6 @@/* Common header for Atheros 802.11n base driver cores */ -#define WME_NUM_TID 16#define WME_BA_BMP_SIZE 64#define WME_MAX_BA WME_BA_BMP_SIZE#define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
drivers/net/wireless/ath/ath9k/xmit.c +4 -4
@@ -1263,7 +1263,7 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,int tidno;for (tidno =0 , tid = &an->tid[tidno]; - tidno <WME_NUM_TID ; tidno++, tid++) { + tidno <IEEE80211_NUM_TIDS ; tidno++, tid++) {if (!tid->sched)continue ;
@@ -1297,7 +1297,7 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)int tidno;for (tidno =0 , tid = &an->tid[tidno]; - tidno <WME_NUM_TID ; tidno++, tid++) { + tidno <IEEE80211_NUM_TIDS ; tidno++, tid++) { ac = tid->ac; txq = ac->txq;
@@ -2448,7 +2448,7 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)int tidno, acno;for (tidno =0 , tid = &an->tid[tidno]; - tidno <WME_NUM_TID ; + tidno <IEEE80211_NUM_TIDS ; tidno++, tid++) { tid->an = an; tid->tidno = tidno;
@@ -2481,7 +2481,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)int tidno;for (tidno =0 , tid = &an->tid[tidno]; - tidno <WME_NUM_TID ; tidno++, tid++) { + tidno <IEEE80211_NUM_TIDS ; tidno++, tid++) { ac = tid->ac; txq = ac->txq;
Signature · 1 line
1.8.0.1
PATCH 3/4 ath9k: Implement sta_add_debugfs/sta_remove_debugfs
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Signed-off-by Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/ath9k.h | 5 ++ drivers/net/wireless/ath/ath9k/debug.c | 90 ++++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/debug.h | 9 +++- drivers/net/wireless/ath/ath9k/main.c | 10 +++- 4 files changed, 111 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +5 -0
@@ -259,6 +259,7 @@ struct ath_atx_tid { };struct ath_node { +struct ath_softc *sc;struct ieee80211_sta *sta;/* station struct we're part of */ struct ieee80211_vif *vif;/* interface with which we're associated */ struct ath_atx_tid tid[IEEE80211_NUM_TIDS ];
@@ -269,6 +270,10 @@ struct ath_node {u8 mpdudensity;bool sleeping; + +#if defined(CONFIG_MAC80211_DEBUGFS ) && defined(CONFIG_ATH9K_DEBUGFS ) +struct dentry *node_stat; +#endif };#define AGGR_CLEANUP BIT(1)
drivers/net/wireless/ath/ath9k/debug.c +90 -0
96 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/debug.h +8 -1
@@ -315,7 +315,14 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,void ath9k_get_et_strings (struct ieee80211_hw *hw,struct ieee80211_vif *vif,u32 sset,u8 *data); - +void ath9k_sta_add_debugfs (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct dentry *dir); +void ath9k_sta_remove_debugfs (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct dentry *dir);#else #define RX_STAT_INC (c)/* NOP */
drivers/net/wireless/ath/ath9k/main.c +8 -2
@@ -331,6 +331,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta,u8 density; an = (struct ath_node *)sta->drv_priv; + an->sc = sc; an->sta = sta; an->vif = vif;
@@ -2275,7 +2276,12 @@ struct ieee80211_ops ath9k_ops = {#ifdef CONFIG_ATH9K_DEBUGFS .get_et_sset_count = ath9k_get_et_sset_count, - .get_et_stats = ath9k_get_et_stats, - .get_et_strings = ath9k_get_et_strings, + .get_et_stats = ath9k_get_et_stats, + .get_et_strings = ath9k_get_et_strings, +#endif + +#if defined(CONFIG_MAC80211_DEBUGFS ) && defined(CONFIG_ATH9K_DEBUGFS ) + .sta_add_debugfs = ath9k_sta_add_debugfs, + .sta_remove_debugfs = ath9k_sta_remove_debugfs,#endif };
Signature · 1 line
1.8.0.1
PATCH 4/4 ath9k: Remove redundant NULL assignment
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
'bf_next' is cleared using ATH_TXBUF_RESET() in both the callsites of ath_tx_get_buffer().
Signed-off-by Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/xmit.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath9k/xmit.c +0 -1
@@ -312,7 +312,6 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) } bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); - bf->bf_next =NULL ;list_del (&bf->list);spin_unlock_bh (&sc->tx.txbuflock);
Signature · 1 line
1.8.0.1