linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/2] cfg80211:  Add framework to support ethtool stats.
@ 2012-03-15 17:39 greearb
  2012-03-15 17:39 ` [RFC 2/2] mac80211: Support getting sta_info stats via ethtool greearb
  2012-03-15 18:50 ` [RFC 1/2] cfg80211: Add framework to support ethtool stats Johannes Berg
  0 siblings, 2 replies; 15+ messages in thread
From: greearb @ 2012-03-15 17:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 9ed8021... d97c9da... M	include/net/cfg80211.h
:100644 100644 bfed851... bc75a32... M	net/mac80211/sta_info.h
:100644 100644 9bde4d1... 7eecdf4... M	net/wireless/ethtool.c
 include/net/cfg80211.h  |    7 +++++++
 net/mac80211/sta_info.h |    2 ++
 net/wireless/ethtool.c  |   29 +++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9ed8021..d97c9da 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1689,6 +1689,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/mac80211/sta_info.h b/net/mac80211/sta_info.h
index bfed851..bc75a32 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -379,6 +379,8 @@ struct sta_info {
 	struct ieee80211_sta sta;
 };
 
+#define NUM_STA_INFO_STATS 12
+
 static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta)
 {
 #ifdef CONFIG_MAC80211_MESH
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] 15+ messages in thread

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

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 17:39 [RFC 1/2] cfg80211: Add framework to support ethtool stats greearb
2012-03-15 17:39 ` [RFC 2/2] mac80211: Support getting sta_info stats via ethtool greearb
2012-03-15 18:52   ` Johannes Berg
2012-03-15 18:56     ` Ben Greear
2012-03-16 13:49       ` John W. Linville
2012-03-16 14:18         ` Florian Fainelli
2012-03-16 14:54           ` Ben Greear
2012-03-16 14:59             ` Florian Fainelli
2012-03-16 16:39               ` Ben Greear
2012-03-16 17:14               ` Rick Jones
2012-03-15 18:55   ` Johannes Berg
2012-03-15 19:03     ` Ben Greear
2012-03-15 19:05       ` Johannes Berg
2012-03-15 18:50 ` [RFC 1/2] cfg80211: Add framework to support ethtool stats Johannes Berg
2012-03-15 18:52   ` Ben Greear

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).