netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] cfg80211:  Add framework to support ethtool stats.
@ 2012-03-16 19:59 greearb
  2012-03-16 19:59 ` [PATCH v2 2/4] mac80211: Support getting sta_info stats via ethtool greearb
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: greearb @ 2012-03-16 19:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, Ben Greear

From: Ben Greear <greearb@candelatech.com>

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

v2:  Fix formatting issues, add kdoc comments

:100644 100644 9ed8021... f5c8e02... M	include/net/cfg80211.h
:100644 100644 9bde4d1... 7eecdf4... M	net/wireless/ethtool.c
 include/net/cfg80211.h |   14 ++++++++++++++
 net/wireless/ethtool.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9ed8021..f5c8e02 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1491,6 +1491,13 @@ struct cfg80211_gtk_rekey_data {
  *	later passes to cfg80211_probe_status().
  *
  * @set_noack_map: Set the NoAck Map for the TIDs.
+ *
+ * @get_et_sset_count:  Ethtool API to get string-set count.
+ *
+ * @get_et_stats:  Ethtool API to get a set of u64 stats.
+ *
+ * @get_et_strings:  Ethtool API to get a set of strings to describe stats
+ *	and perhaps other supported types of ethtool data-sets.
  */
 struct cfg80211_ops {
 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1689,6 +1696,13 @@ struct cfg80211_ops {
 				  u16 noack_map);
 
 	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
+
+	int	(*get_et_sset_count)(struct wiphy *wiphy,
+				     struct net_device *dev, int sset);
+	void	(*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
+				struct ethtool_stats *stats, u64 *data);
+	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
+				  u32 sset, u8 *data);
 };
 
 /*
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index 9bde4d1..7eecdf4 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -68,6 +68,32 @@ static int cfg80211_set_ringparam(struct net_device *dev,
 	return -ENOTSUPP;
 }
 
+static int cfg80211_get_sset_count(struct net_device *dev, int sset)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+	if (rdev->ops->get_et_sset_count)
+		return rdev->ops->get_et_sset_count(wdev->wiphy, dev, sset);
+	return -EOPNOTSUPP;
+}
+
+static void cfg80211_get_stats(struct net_device *dev,
+			       struct ethtool_stats *stats, u64 *data)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+	if (rdev->ops->get_et_stats)
+		rdev->ops->get_et_stats(wdev->wiphy, dev, stats, data);
+}
+
+static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
+	if (rdev->ops->get_et_strings)
+		rdev->ops->get_et_strings(wdev->wiphy, dev, sset, data);
+}
+
 const struct ethtool_ops cfg80211_ethtool_ops = {
 	.get_drvinfo = cfg80211_get_drvinfo,
 	.get_regs_len = cfg80211_get_regs_len,
@@ -75,4 +101,7 @@ const struct ethtool_ops cfg80211_ethtool_ops = {
 	.get_link = ethtool_op_get_link,
 	.get_ringparam = cfg80211_get_ringparam,
 	.set_ringparam = cfg80211_set_ringparam,
+	.get_strings = cfg80211_get_strings,
+	.get_ethtool_stats = cfg80211_get_stats,
+	.get_sset_count = cfg80211_get_sset_count,
 };
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] mac80211:  Support getting sta_info stats via ethtool.
  2012-03-16 19:59 [PATCH v2 1/4] cfg80211: Add framework to support ethtool stats greearb
@ 2012-03-16 19:59 ` greearb
       [not found]   ` <1331927952-8706-2-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
  2012-03-17  9:07   ` Johannes Berg
  2012-03-16 19:59 ` [PATCH v2 4/4] ath9k: Support ethtool getstats api greearb
       [not found] ` <1331927952-8706-1-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
  2 siblings, 2 replies; 11+ messages in thread
From: greearb @ 2012-03-16 19:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, Ben Greear

From: Ben Greear <greearb@candelatech.com>

This lets ethtool print out stats related to station
interfaces.  Does not yet get stats from the underlying
driver.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2:  Minor changes to make next patch that adds calls
     into the driver smaller/cleaner.

:100644 100644 cf5b08a... bb834d7... M	net/mac80211/cfg.c
 net/mac80211/cfg.c |   71 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index cf5b08a..bb834d7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -112,6 +112,74 @@ static int ieee80211_set_noack_map(struct wiphy *wiphy,
 	return 0;
 }
 
+static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
+	"rx_packets", "rx_bytes", "wep_weak_iv_count",
+	"rx_duplicates", "rx_fragments", "rx_dropped",
+	"tx_packets", "tx_bytes", "tx_fragments",
+	"tx_filtered", "tx_retry_failed", "tx_retries",
+	"beacon_loss"
+};
+#define STA_STATS_LEN	ARRAY_SIZE(ieee80211_gstrings_sta_stats)
+
+static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
+				       struct net_device *dev,
+				       int sset)
+{
+	if (sset == ETH_SS_STATS)
+		return STA_STATS_LEN;
+
+	return -EOPNOTSUPP;
+}
+
+static void ieee80211_get_et_stats(struct wiphy *wiphy,
+				   struct net_device *dev,
+				   struct ethtool_stats *stats,
+				   u64 *data)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct sta_info *sta;
+	struct ieee80211_local *local = sdata->local;
+
+	memset(data, 0, sizeof(u64) * STA_STATS_LEN);
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(sta, &local->sta_list, list) {
+		int i = 0;
+
+		/* Make sure this station belongs to the proper dev */
+		if (sta->sdata->dev != dev)
+			continue;
+
+		data[i++] += sta->rx_packets;
+		data[i++] += sta->rx_bytes;
+		data[i++] += sta->wep_weak_iv_count;
+		data[i++] += sta->num_duplicates;
+		data[i++] += sta->rx_fragments;
+		data[i++] += sta->rx_dropped;
+
+		data[i++] += sta->tx_packets;
+		data[i++] += sta->tx_bytes;
+		data[i++] += sta->tx_fragments;
+		data[i++] += sta->tx_filtered_count;
+		data[i++] += sta->tx_retry_failed;
+		data[i++] += sta->tx_retry_count;
+		data[i++] += sta->beacon_loss_count;
+		BUG_ON(i != STA_STATS_LEN);
+	}
+	rcu_read_unlock();
+}
+
+static void ieee80211_get_et_strings(struct wiphy *wiphy,
+				     struct net_device *dev,
+				     u32 sset, u8 *data)
+{
+	if (sset == ETH_SS_STATS) {
+		int sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
+		memcpy(data, *ieee80211_gstrings_sta_stats, sz_sta_stats);
+	}
+}
+
+
 static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
 			     u8 key_idx, bool pairwise, const u8 *mac_addr,
 			     struct key_params *params)
@@ -2768,4 +2836,7 @@ struct cfg80211_ops mac80211_config_ops = {
 	.probe_client = ieee80211_probe_client,
 	.get_channel = ieee80211_wiphy_get_channel,
 	.set_noack_map = ieee80211_set_noack_map,
+	.get_et_sset_count = ieee80211_get_et_sset_count,
+	.get_et_stats = ieee80211_get_et_stats,
+	.get_et_strings = ieee80211_get_et_strings,
 };
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] mac80211:  Framework to get wifi-driver stats via ethtool.
       [not found] ` <1331927952-8706-1-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
@ 2012-03-16 19:59   ` greearb-my8/4N5VtI7c+919tysfdA
  2012-03-16 20:50   ` [PATCH v2 1/4] cfg80211: Add framework to support ethtool stats Ben Hutchings
  1 sibling, 0 replies; 11+ messages in thread
From: greearb-my8/4N5VtI7c+919tysfdA @ 2012-03-16 19:59 UTC (permalink / raw)
  To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Ben Greear

From: Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>

This adds hooks to call into the driver to get additional
stats for the ethtool API.

Signed-off-by: Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
---
v2:  Add kdoc comments, trace support.
     Patch differs based on chaging of 2/4 patch as well.

:100644 100644 d49928b... a90cc8e... M	include/net/mac80211.h
:100644 100644 bb834d7... f82b285... M	net/mac80211/cfg.c
:100644 100644 b6ef8e7... c2d1661... M	net/mac80211/driver-ops.h
:100644 100644 6e9df8f... f05fc9c... M	net/mac80211/driver-trace.h
 include/net/mac80211.h      |   17 +++++++++++++++++
 net/mac80211/cfg.c          |   19 ++++++++++++++++---
 net/mac80211/driver-ops.h   |   37 +++++++++++++++++++++++++++++++++++++
 net/mac80211/driver-trace.h |   15 +++++++++++++++
 4 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d49928b..a90cc8e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2108,6 +2108,14 @@ enum ieee80211_frame_release_type {
  *	The @tids parameter is a bitmap and tells the driver which TIDs the
  *	frames will be on; it will at most have two bits set.
  *	This callback must be atomic.
+ *
+ * @get_et_sset_count:  Ethtool API to get string-set count.
+ *
+ * @get_et_stats:  Ethtool API to get a set of u64 stats.
+ *
+ * @get_et_strings:  Ethtool API to get a set of strings to describe stats
+ *	and perhaps other supported types of ethtool data-sets.
+ *
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -2236,6 +2244,15 @@ struct ieee80211_ops {
 					u16 tids, int num_frames,
 					enum ieee80211_frame_release_type reason,
 					bool more_data);
+
+	int	(*get_et_sset_count)(struct ieee80211_hw *hw,
+				     struct ieee80211_vif *vif, int sset);
+	void	(*get_et_stats)(struct ieee80211_hw *hw,
+				struct ieee80211_vif *vif,
+				struct ethtool_stats *stats, u64 *data);
+	void	(*get_et_strings)(struct ieee80211_hw *hw,
+				  struct ieee80211_vif *vif,
+				  u32 sset, u8 *data);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bb834d7..f82b285 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -125,10 +125,17 @@ static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
 				       struct net_device *dev,
 				       int sset)
 {
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	int rv = 0;
+
 	if (sset == ETH_SS_STATS)
-		return STA_STATS_LEN;
+		rv += STA_STATS_LEN;
 
-	return -EOPNOTSUPP;
+	rv += drv_get_et_sset_count(sdata, sset);
+
+	if (rv == 0)
+		return -EOPNOTSUPP;
+	return rv;
 }
 
 static void ieee80211_get_et_stats(struct wiphy *wiphy,
@@ -167,16 +174,22 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 		BUG_ON(i != STA_STATS_LEN);
 	}
 	rcu_read_unlock();
+
+	drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
 }
 
 static void ieee80211_get_et_strings(struct wiphy *wiphy,
 				     struct net_device *dev,
 				     u32 sset, u8 *data)
 {
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	int sz_sta_stats = 0;
+
 	if (sset == ETH_SS_STATS) {
-		int sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
+		sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
 		memcpy(data, *ieee80211_gstrings_sta_stats, sz_sta_stats);
 	}
+	drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
 }
 
 
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index b6ef8e7..c2d1661 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -35,6 +35,43 @@ static inline void drv_tx_frags(struct ieee80211_local *local,
 	local->ops->tx_frags(&local->hw, vif, sta, skbs);
 }
 
+static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
+				      u32 sset, u8 *data)
+{
+	struct ieee80211_local *local = sdata->local;
+	if (local->ops->get_et_strings) {
+		trace_drv_get_et_strings(local, sset);
+		local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
+		trace_drv_return_void(local);
+	}
+}
+
+static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
+				    struct ethtool_stats *stats,
+				    u64 *data)
+{
+	struct ieee80211_local *local = sdata->local;
+	if (local->ops->get_et_stats) {
+		trace_drv_get_et_stats(local);
+		local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
+		trace_drv_return_void(local);
+	}
+}
+
+static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
+					int sset)
+{
+	struct ieee80211_local *local = sdata->local;
+	int rv = 0;
+	if (local->ops->get_et_sset_count) {
+		trace_drv_get_et_sset_count(local, sset);
+		rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
+						   sset);
+		trace_drv_return_int(local, rv);
+	}
+	return rv;
+}
+
 static inline int drv_start(struct ieee80211_local *local)
 {
 	int ret;
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 6e9df8f..f05fc9c 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -161,6 +161,21 @@ DEFINE_EVENT(local_only_evt, drv_start,
 	TP_ARGS(local)
 );
 
+DEFINE_EVENT(local_u32_evt, drv_get_et_strings,
+	     TP_PROTO(struct ieee80211_local *local, u32 sset),
+	     TP_ARGS(local, sset)
+);
+
+DEFINE_EVENT(local_u32_evt, drv_get_et_sset_count,
+	     TP_PROTO(struct ieee80211_local *local, u32 sset),
+	     TP_ARGS(local, sset)
+);
+
+DEFINE_EVENT(local_only_evt, drv_get_et_stats,
+	     TP_PROTO(struct ieee80211_local *local),
+	     TP_ARGS(local)
+);
+
 DEFINE_EVENT(local_only_evt, drv_suspend,
 	TP_PROTO(struct ieee80211_local *local),
 	TP_ARGS(local)
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] ath9k:  Support ethtool getstats api.
  2012-03-16 19:59 [PATCH v2 1/4] cfg80211: Add framework to support ethtool stats greearb
  2012-03-16 19:59 ` [PATCH v2 2/4] mac80211: Support getting sta_info stats via ethtool greearb
@ 2012-03-16 19:59 ` greearb
  2012-03-16 20:53   ` Ben Hutchings
       [not found] ` <1331927952-8706-1-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
  2 siblings, 1 reply; 11+ messages in thread
From: greearb @ 2012-03-16 19:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, Ben Greear

From: Ben Greear <greearb@candelatech.com>

This returns many of the values that formerly could
only be obtained from debugfs.  This should be an
improvement when trying to access these counters
programatically.  Currently this support is only
enabled when DEBUGFS is enabled because otherwise
these stats are not accumulated.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

v2:  Remove phy-err counters that are currently never
     set.  Remove a few other stats that appeared
     useless.

:100644 100644 4a00806... 7261f88... M	drivers/net/wireless/ath/ath9k/main.c
 drivers/net/wireless/ath/ath9k/main.c |  134 +++++++++++++++++++++++++++++++++
 1 files changed, 134 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 4a00806..7261f88 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2430,6 +2430,134 @@ static int ath9k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
 	return 0;
 }
 
+#ifdef CONFIG_ATH9K_DEBUGFS
+
+/* 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_retries),
+	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)
+
+static 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));
+}
+
+static 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 PR_QNUM(_n) (sc->tx.txq_map[_n]->axq_qnum)
+#define AWDATA(elem)							\
+	do {								\
+		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].elem; \
+		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].elem; \
+		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].elem; \
+		data[i++] = sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].elem; \
+	} while (0)
+
+#define AWDATA_RX(elem)						\
+	do {							\
+		data[i++] = sc->debug.stats.rxstats.elem;	\
+	} while (0)
+
+static 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(WME_AC_BE)].tx_pkts_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].tx_pkts_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].tx_pkts_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_AC_VO)].tx_pkts_all);
+	data[i++] = (sc->debug.stats.txstats[PR_QNUM(WME_AC_BE)].tx_bytes_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_AC_BK)].tx_bytes_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_AC_VI)].tx_bytes_all +
+		     sc->debug.stats.txstats[PR_QNUM(WME_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]);
+
+	BUG_ON(i != ATH9K_SSTATS_LEN);
+}
+
+/* End of ethtool get-stats functions */
+
+#endif
+
+
 struct ieee80211_ops ath9k_ops = {
 	.tx 		    = ath9k_tx,
 	.start 		    = ath9k_start,
@@ -2458,4 +2586,10 @@ struct ieee80211_ops ath9k_ops = {
 	.get_stats	    = ath9k_get_stats,
 	.set_antenna	    = ath9k_set_antenna,
 	.get_antenna	    = ath9k_get_antenna,
+
+#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,
+#endif
 };
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4] cfg80211:  Add framework to support ethtool stats.
       [not found] ` <1331927952-8706-1-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
  2012-03-16 19:59   ` [PATCH v2 3/4] mac80211: Framework to get wifi-driver stats via ethtool greearb-my8/4N5VtI7c+919tysfdA
@ 2012-03-16 20:50   ` Ben Hutchings
  1 sibling, 0 replies; 11+ messages in thread
From: Ben Hutchings @ 2012-03-16 20:50 UTC (permalink / raw)
  To: greearb-my8/4N5VtI7c+919tysfdA
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

On Fri, 2012-03-16 at 12:59 -0700, greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org wrote:
> From: Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
> 
> Signed-off-by: Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
> ---
> 
> v2:  Fix formatting issues, add kdoc comments
> 
> :100644 100644 9ed8021... f5c8e02... M	include/net/cfg80211.h
> :100644 100644 9bde4d1... 7eecdf4... M	net/wireless/ethtool.c
>  include/net/cfg80211.h |   14 ++++++++++++++
>  net/wireless/ethtool.c |   29 +++++++++++++++++++++++++++++
>  2 files changed, 43 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index 9ed8021..f5c8e02 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1491,6 +1491,13 @@ struct cfg80211_gtk_rekey_data {
>   *	later passes to cfg80211_probe_status().
>   *
>   * @set_noack_map: Set the NoAck Map for the TIDs.
> + *
> + * @get_et_sset_count:  Ethtool API to get string-set count.
> + *
> + * @get_et_stats:  Ethtool API to get a set of u64 stats.
> + *
> + * @get_et_strings:  Ethtool API to get a set of strings to describe stats
> + *	and perhaps other supported types of ethtool data-sets.
[...]

Please add an explicit reference to struct ethtool_ops, where the
semantics of these operations should be described in more detail.
(There isn't currently as much detail as there should be, but any extra
information is going to be added there and not here.)

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] ath9k:  Support ethtool getstats api.
  2012-03-16 19:59 ` [PATCH v2 4/4] ath9k: Support ethtool getstats api greearb
@ 2012-03-16 20:53   ` Ben Hutchings
  2012-03-16 20:57     ` Ben Hutchings
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Hutchings @ 2012-03-16 20:53 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, netdev

On Fri, 2012-03-16 at 12:59 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> This returns many of the values that formerly could
> only be obtained from debugfs.  This should be an
> improvement when trying to access these counters
> programatically.  Currently this support is only
> enabled when DEBUGFS is enabled because otherwise
> these stats are not accumulated.
[...]

Given that ethtool (unlike debugfs) is itself an unconditional feature,
why not make this unconditional?  Is it expensive to accumulate the
stats?

Please at least fix the name.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4] mac80211:  Support getting sta_info stats via ethtool.
       [not found]   ` <1331927952-8706-2-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
@ 2012-03-16 20:56     ` Ben Hutchings
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Hutchings @ 2012-03-16 20:56 UTC (permalink / raw)
  To: greearb-my8/4N5VtI7c+919tysfdA
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

On Fri, 2012-03-16 at 12:59 -0700, greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org wrote:
> From: Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
> 
> This lets ethtool print out stats related to station
> interfaces.  Does not yet get stats from the underlying
> driver.
[...]

Nice.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] ath9k:  Support ethtool getstats api.
  2012-03-16 20:53   ` Ben Hutchings
@ 2012-03-16 20:57     ` Ben Hutchings
       [not found]       ` <1331931427.2504.12.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Hutchings @ 2012-03-16 20:57 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, netdev

On Fri, 2012-03-16 at 20:53 +0000, Ben Hutchings wrote:
> On Fri, 2012-03-16 at 12:59 -0700, greearb@candelatech.com wrote:
> > From: Ben Greear <greearb@candelatech.com>
> > 
> > This returns many of the values that formerly could
> > only be obtained from debugfs.  This should be an
> > improvement when trying to access these counters
> > programatically.  Currently this support is only
> > enabled when DEBUGFS is enabled because otherwise
> > these stats are not accumulated.
> [...]
> 
> Given that ethtool (unlike debugfs) is itself an unconditional feature,
> why not make this unconditional?  Is it expensive to accumulate the
> stats?
> 
> Please at least fix the name.
                         ^ config option

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] ath9k:  Support ethtool getstats api.
       [not found]       ` <1331931427.2504.12.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
@ 2012-03-16 21:26         ` Ben Greear
  2012-03-16 21:38           ` Christian Lamparter
  0 siblings, 1 reply; 11+ messages in thread
From: Ben Greear @ 2012-03-16 21:26 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

On 03/16/2012 01:57 PM, Ben Hutchings wrote:
> On Fri, 2012-03-16 at 20:53 +0000, Ben Hutchings wrote:
>> On Fri, 2012-03-16 at 12:59 -0700, greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org wrote:
>>> From: Ben Greear<greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
>>>
>>> This returns many of the values that formerly could
>>> only be obtained from debugfs.  This should be an
>>> improvement when trying to access these counters
>>> programatically.  Currently this support is only
>>> enabled when DEBUGFS is enabled because otherwise
>>> these stats are not accumulated.
>> [...]
>>
>> Given that ethtool (unlike debugfs) is itself an unconditional feature,
>> why not make this unconditional?  Is it expensive to accumulate the
>> stats?
>>
>> Please at least fix the name.
>                           ^ config option
>

The ath9k stats are currently only gathered when debugfs is enabled.

I could do some patches in the future to allow stats to always
be gathered regardless of debugfs being enabled, but since
ath9k is used on small form factor systems, there may be some
resistance to enabling that all the time.

Thanks,
Ben

-- 
Ben Greear <greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
Candela Technologies Inc  http://www.candelatech.com
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 4/4] ath9k:  Support ethtool getstats api.
  2012-03-16 21:26         ` Ben Greear
@ 2012-03-16 21:38           ` Christian Lamparter
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Lamparter @ 2012-03-16 21:38 UTC (permalink / raw)
  To: Ben Greear; +Cc: Ben Hutchings, linux-wireless, netdev

On Friday 16 March 2012 22:26:34 Ben Greear wrote:
> On 03/16/2012 01:57 PM, Ben Hutchings wrote:
> > On Fri, 2012-03-16 at 20:53 +0000, Ben Hutchings wrote:
> >> On Fri, 2012-03-16 at 12:59 -0700, greearb@candelatech.com wrote:
> >>> From: Ben Greear<greearb@candelatech.com>
> >>>
> >>> This returns many of the values that formerly could
> >>> only be obtained from debugfs.  This should be an
> >>> improvement when trying to access these counters
> >>> programatically.  Currently this support is only
> >>> enabled when DEBUGFS is enabled because otherwise
> >>> these stats are not accumulated.
> >> [...]
> >>
> >> Given that ethtool (unlike debugfs) is itself an unconditional feature,
> >> why not make this unconditional?  Is it expensive to accumulate the
> >> stats?
> >>
> >> Please at least fix the name.
> >                           ^ config option
> >
> 
> The ath9k stats are currently only gathered when debugfs is enabled.
> 
> I could do some patches in the future to allow stats to always
> be gathered regardless of debugfs being enabled, but since
> ath9k is used on small form factor systems, there may be some
> resistance to enabling that all the time.
When we are talking about small form factor.
Did you know that OpenWRT has enabled ath9k's debugfs feature by default?
Even the image for my TL-WR841ND [just a 4MiB flash] has it enabled! 
So I don't that's much of a problem. Even more the debugfs bits are
probably smaller than all those initvals [you know, those for the whole
AR5008/AR91XX/AR92XX/AR93XX/AR94XX gang] they have to carry around.
[Yeah, if you use the same rev-chips on your stuff, you could get
away with just one initval... Think of the savings!]

Regards,
	Chr

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4] mac80211:  Support getting sta_info stats via ethtool.
  2012-03-16 19:59 ` [PATCH v2 2/4] mac80211: Support getting sta_info stats via ethtool greearb
       [not found]   ` <1331927952-8706-2-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
@ 2012-03-17  9:07   ` Johannes Berg
  1 sibling, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2012-03-17  9:07 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless, netdev

On Fri, 2012-03-16 at 12:59 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> This lets ethtool print out stats related to station
> interfaces.

That's kinda misleading -- it makes it print out "stats related to
stations connected to the interface" :-)

johannes

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-03-17  9:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 19:59 [PATCH v2 1/4] cfg80211: Add framework to support ethtool stats greearb
2012-03-16 19:59 ` [PATCH v2 2/4] mac80211: Support getting sta_info stats via ethtool greearb
     [not found]   ` <1331927952-8706-2-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
2012-03-16 20:56     ` Ben Hutchings
2012-03-17  9:07   ` Johannes Berg
2012-03-16 19:59 ` [PATCH v2 4/4] ath9k: Support ethtool getstats api greearb
2012-03-16 20:53   ` Ben Hutchings
2012-03-16 20:57     ` Ben Hutchings
     [not found]       ` <1331931427.2504.12.camel-/LGg1Z1CJKReKY3V0RtoKmatzQS1i7+A3tAM5lWOD0I@public.gmane.org>
2012-03-16 21:26         ` Ben Greear
2012-03-16 21:38           ` Christian Lamparter
     [not found] ` <1331927952-8706-1-git-send-email-greearb-my8/4N5VtI7c+919tysfdA@public.gmane.org>
2012-03-16 19:59   ` [PATCH v2 3/4] mac80211: Framework to get wifi-driver stats via ethtool greearb-my8/4N5VtI7c+919tysfdA
2012-03-16 20:50   ` [PATCH v2 1/4] cfg80211: Add framework to support ethtool stats Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).