Search Linux Wireless

[PATCH 3/4] mac80211: Framework to get wifi-driver stats via ethtool.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

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

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
:100644 100644 d49928b... e89a742... M	include/net/mac80211.h
:100644 100644 0aef0d2... 872e06e... M	net/mac80211/cfg.c
 include/net/mac80211.h |    9 +++++++++
 net/mac80211/cfg.c     |   23 +++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d49928b..e89a742 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2236,6 +2236,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 0aef0d2..872e06e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -125,8 +125,17 @@ 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;
+	struct ieee80211_sub_if_data *sdata;
+	struct ieee80211_local *local;
+	if (sset == ETH_SS_STATS) {
+		int rv = STA_STATS_LEN;
+		sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+		local = sdata->local;
+		if (local->ops->get_et_sset_count)
+			rv += local->ops->get_et_sset_count(&local->hw,
+							    &sdata->vif, sset);
+		return rv;
+	}
 	
 	return -EOPNOTSUPP;
 }
@@ -167,15 +176,25 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
 		BUG_ON(i != STA_STATS_LEN);
 	}
 	rcu_read_unlock();
+
+	if (local->ops->get_et_stats)
+		local->ops->get_et_stats(&local->hw, &sdata->vif,
+					 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);
+	struct ieee80211_local *local = sdata->local;
 	if (sset == ETH_SS_STATS) {
 		int sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
 		memcpy(data, *ieee80211_gstrings_sta_stats, sz_sta_stats);
+
+		if (local->ops->get_et_strings)
+			local->ops->get_et_strings(&local->hw, &sdata->vif,
+						   sset, &(data[sz_sta_stats]));
 	}
 }
 
-- 
1.7.3.4

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


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux