Skip to content

Commit d619921

Browse files
greearblinvjw
authored andcommitted
cfg80211: Add framework to support ethtool stats.
Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 35e7ada commit d619921

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎include/net/cfg80211.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,16 @@ struct cfg80211_gtk_rekey_data {
15141514
* later passes to cfg80211_probe_status().
15151515
*
15161516
* @set_noack_map: Set the NoAck Map for the TIDs.
1517+
*
1518+
* @get_et_sset_count: Ethtool API to get string-set count.
1519+
* See @ethtool_ops.get_sset_count
1520+
*
1521+
* @get_et_stats: Ethtool API to get a set of u64 stats.
1522+
* See @ethtool_ops.get_ethtool_stats
1523+
*
1524+
* @get_et_strings: Ethtool API to get a set of strings to describe stats
1525+
* and perhaps other supported types of ethtool data-sets.
1526+
* See @ethtool_ops.get_strings
15171527
*/
15181528
struct cfg80211_ops {
15191529
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1712,6 +1722,13 @@ struct cfg80211_ops {
17121722

17131723
struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy,
17141724
enum nl80211_channel_type *type);
1725+
1726+
int (*get_et_sset_count)(struct wiphy *wiphy,
1727+
struct net_device *dev, int sset);
1728+
void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1729+
struct ethtool_stats *stats, u64 *data);
1730+
void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1731+
u32 sset, u8 *data);
17151732
};
17161733

17171734
/*

‎net/wireless/ethtool.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,40 @@ static int cfg80211_set_ringparam(struct net_device *dev,
6868
return -ENOTSUPP;
6969
}
7070

71+
static int cfg80211_get_sset_count(struct net_device *dev, int sset)
72+
{
73+
struct wireless_dev *wdev = dev->ieee80211_ptr;
74+
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
75+
if (rdev->ops->get_et_sset_count)
76+
return rdev->ops->get_et_sset_count(wdev->wiphy, dev, sset);
77+
return -EOPNOTSUPP;
78+
}
79+
80+
static void cfg80211_get_stats(struct net_device *dev,
81+
struct ethtool_stats *stats, u64 *data)
82+
{
83+
struct wireless_dev *wdev = dev->ieee80211_ptr;
84+
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
85+
if (rdev->ops->get_et_stats)
86+
rdev->ops->get_et_stats(wdev->wiphy, dev, stats, data);
87+
}
88+
89+
static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
90+
{
91+
struct wireless_dev *wdev = dev->ieee80211_ptr;
92+
struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
93+
if (rdev->ops->get_et_strings)
94+
rdev->ops->get_et_strings(wdev->wiphy, dev, sset, data);
95+
}
96+
7197
const struct ethtool_ops cfg80211_ethtool_ops = {
7298
.get_drvinfo = cfg80211_get_drvinfo,
7399
.get_regs_len = cfg80211_get_regs_len,
74100
.get_regs = cfg80211_get_regs,
75101
.get_link = ethtool_op_get_link,
76102
.get_ringparam = cfg80211_get_ringparam,
77103
.set_ringparam = cfg80211_set_ringparam,
104+
.get_strings = cfg80211_get_strings,
105+
.get_ethtool_stats = cfg80211_get_stats,
106+
.get_sset_count = cfg80211_get_sset_count,
78107
};

0 commit comments

Comments
 (0)