Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wireless: implement basic ethtool support for cfg80211 devices

Signed-off-by: John W. Linville <linville@tuxdriver.com>

+36 -1
+1 -1
net/wireless/Makefile
··· 10 10 obj-$(CONFIG_WEXT_PRIV) += wext-priv.o 11 11 12 12 cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o 13 - cfg80211-y += mlme.o ibss.o sme.o chan.o 13 + cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o 14 14 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o 15 15 cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o 16 16
+3
net/wireless/core.c
··· 21 21 #include "sysfs.h" 22 22 #include "debugfs.h" 23 23 #include "wext-compat.h" 24 + #include "ethtool.h" 24 25 25 26 /* name for sysfs, %d is appended */ 26 27 #define PHY_NAME "phy" ··· 691 690 wdev->wext.ps = false; 692 691 } 693 692 #endif 693 + if (!dev->ethtool_ops) 694 + dev->ethtool_ops = &cfg80211_ethtool_ops; 694 695 break; 695 696 case NETDEV_GOING_DOWN: 696 697 switch (wdev->iftype) {
+24
net/wireless/ethtool.c
··· 1 + #include <linux/utsname.h> 2 + #include <net/cfg80211.h> 3 + #include "ethtool.h" 4 + 5 + static void cfg80211_get_drvinfo(struct net_device *dev, 6 + struct ethtool_drvinfo *info) 7 + { 8 + struct wireless_dev *wdev = dev->ieee80211_ptr; 9 + 10 + strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name, 11 + sizeof(info->driver)); 12 + 13 + strlcpy(info->version, init_utsname()->release, sizeof(info->version)); 14 + 15 + strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); 16 + 17 + strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), 18 + sizeof(info->bus_info)); 19 + } 20 + 21 + const struct ethtool_ops cfg80211_ethtool_ops = { 22 + .get_drvinfo = cfg80211_get_drvinfo, 23 + .get_link = ethtool_op_get_link, 24 + };
+8
net/wireless/ethtool.h
··· 1 + #ifndef __CFG80211_ETHTOOL__ 2 + #define __CFG80211_ETHTOOL__ 3 + 4 + #include <linux/ethtool.h> 5 + 6 + extern const struct ethtool_ops cfg80211_ethtool_ops; 7 + 8 + #endif /* __CFG80211_ETHTOOL__ */