1 #include <linux/utsname.h>
2 #include <net/cfg80211.h>
6 static void cfg80211_get_drvinfo(struct net_device *dev,
7 struct ethtool_drvinfo *info)
9 struct wireless_dev *wdev = dev->ieee80211_ptr;
11 strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
12 sizeof(info->driver));
14 strlcpy(info->version, init_utsname()->release, sizeof(info->version));
16 if (wdev->wiphy->fw_version[0])
17 strncpy(info->fw_version, wdev->wiphy->fw_version,
18 sizeof(info->fw_version));
20 strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
22 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
23 sizeof(info->bus_info));
26 static int cfg80211_get_regs_len(struct net_device *dev)
28 /* For now, return 0... */
32 static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
35 struct wireless_dev *wdev = dev->ieee80211_ptr;
37 regs->version = wdev->wiphy->hw_version;
41 static void cfg80211_get_ringparam(struct net_device *dev,
42 struct ethtool_ringparam *rp)
44 struct wireless_dev *wdev = dev->ieee80211_ptr;
45 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
47 memset(rp, 0, sizeof(*rp));
49 if (rdev->ops->get_ringparam)
50 rdev->ops->get_ringparam(wdev->wiphy,
51 &rp->tx_pending, &rp->tx_max_pending,
52 &rp->rx_pending, &rp->rx_max_pending);
55 static int cfg80211_set_ringparam(struct net_device *dev,
56 struct ethtool_ringparam *rp)
58 struct wireless_dev *wdev = dev->ieee80211_ptr;
59 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
61 if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
64 if (rdev->ops->set_ringparam)
65 return rdev->ops->set_ringparam(wdev->wiphy,
66 rp->tx_pending, rp->rx_pending);
71 const struct ethtool_ops cfg80211_ethtool_ops = {
72 .get_drvinfo = cfg80211_get_drvinfo,
73 .get_regs_len = cfg80211_get_regs_len,
74 .get_regs = cfg80211_get_regs,
75 .get_link = ethtool_op_get_link,
76 .get_ringparam = cfg80211_get_ringparam,
77 .set_ringparam = cfg80211_set_ringparam,