ath9k_htc: Add ethtool stats support.
PATCH v2 1/1 ath9k_htc: Add ethtool stats support.
From: Ben Greear <[email protected]>
This provides some of the same info found in
the ath9k_htc debugfs through the standard ethtool stats API.
This logic is only supported when ath9k_htc debugfs kernel feature is enabled, since that is the only time stats are actually gathered.
Signed-off-by Ben Greear <[email protected]>
---
v2: Fix compile when ath9k-htc-debugfs is not enabled.
:100644 100644 f5dda84... 9e582e1... M drivers/net/wireless/ath/ath9k/hif_usb.c
:100644 100644 8e95930... a964a60... M drivers/net/wireless/ath/ath9k/htc.h
:100644 100644 632d13d... 7416d58... M drivers/net/wireless/ath/ath9k/htc_drv_debug.c
:100644 100644 2060ba8... fb87109... M drivers/net/wireless/ath/ath9k/htc_drv_main.c
drivers/net/wireless/ath/ath9k/hif_usb.c | 8 ++- drivers/net/wireless/ath/ath9k/htc.h | 14 ++++ drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 81 ++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/htc_drv_main.c | 6 ++ 4 files changed, 108 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +7 -1
@@ -234,10 +234,15 @@ static inline void ath9k_skb_queue_complete(struct hif_device_usb *hif_dev,struct sk_buff *skb;while ((skb =__skb_dequeue (queue)) !=NULL ) { +#ifdef CONFIG_ATH9K_HTC_DEBUGFS +int ln = skb->len; +#endif ath9k_htc_txcompletion_cb (hif_dev->htc_handle, skb, txok); -if (txok) +if (txok) {TX_STAT_INC (skb_success); +TX_STAT_ADD (skb_success_bytes, ln); + }else TX_STAT_INC (skb_failed); }
@@ -620,6 +625,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, err:for (i =0 ; i < pool_index; i++) { +RX_STAT_ADD (skb_completed_bytes, skb_pool[i]->len);ath9k_htc_rx_msg (hif_dev->htc_handle, skb_pool[i], skb_pool[i]->len,USB_WLAN_RX_PIPE );RX_STAT_INC (skb_completed);
drivers/net/wireless/ath/ath9k/htc.h +14 -0
@@ -317,7 +317,9 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)#ifdef CONFIG_ATH9K_HTC_DEBUGFS #define TX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) +#define TX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c += a)#define RX_STAT_INC (c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) +#define RX_STAT_ADD (c, a) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c += a)#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++#define TX_QSTAT_INC (q) (priv->debug.tx_stats.queue_stats[q]++)
@@ -330,6 +332,7 @@ struct ath_tx_stats {u32 buf_completed;u32 skb_queued;u32 skb_success; +u32 skb_success_bytes;u32 skb_failed;u32 cab_queued;u32 queue_stats[IEEE80211_NUM_ACS ];
@@ -338,6 +341,7 @@ struct ath_tx_stats {struct ath_rx_stats {u32 skb_allocated;u32 skb_completed; +u32 skb_completed_bytes;u32 skb_dropped;u32 err_crc;u32 err_decrypt_crc;
@@ -355,10 +359,20 @@ struct ath9k_debug { struct ath_rx_stats rx_stats; }; +void ath9k_htc_get_et_strings (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +u32 sset,u8 *data); +int ath9k_htc_get_et_sset_count (struct ieee80211_hw *hw, +struct ieee80211_vif *vif,int sset); +void ath9k_htc_get_et_stats (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ethtool_stats *stats,u64 *data);#else #define TX_STAT_INC (c) do { } while (0) +#define TX_STAT_ADD (c, a) do { } while (0)#define RX_STAT_INC (c) do { } while (0) +#define RX_STAT_ADD (c, a) do { } while (0)#define CAB_STAT_INC do { } while (0)#define TX_QSTAT_INC (c) do { } while (0)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +81 -0
87 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/htc_drv_main.c +6 -0
@@ -1822,4 +1822,10 @@ struct ieee80211_ops ath9k_htc_ops = { .set_bitrate_mask = ath9k_htc_set_bitrate_mask, .get_stats = ath9k_htc_get_stats, .get_antenna = ath9k_htc_get_antenna, + +#ifdef CONFIG_ATH9K_HTC_DEBUGFS + .get_et_sset_count = ath9k_htc_get_et_sset_count, + .get_et_stats = ath9k_htc_get_et_stats, + .get_et_strings = ath9k_htc_get_et_strings, +#endif };
Signature · 1 line
1.7.3.4