aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/Makefile2
-rw-r--r--net/wireless/core.c3
-rw-r--r--net/wireless/ethtool.c24
-rw-r--r--net/wireless/ethtool.h8
4 files changed, 36 insertions, 1 deletions
diff --git a/net/wireless/Makefile b/net/wireless/Makefile
index c8141505a83a..f07c8dc7aab2 100644
--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_WEXT_SPY) += wext-spy.o
10obj-$(CONFIG_WEXT_PRIV) += wext-priv.o 10obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
11 11
12cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o 12cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
13cfg80211-y += mlme.o ibss.o sme.o chan.o 13cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o
14cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o 14cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
15cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o 15cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
16 16
diff --git a/net/wireless/core.c b/net/wireless/core.c
index eb0bb24b99c3..07252967be9c 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -21,6 +21,7 @@
21#include "sysfs.h" 21#include "sysfs.h"
22#include "debugfs.h" 22#include "debugfs.h"
23#include "wext-compat.h" 23#include "wext-compat.h"
24#include "ethtool.h"
24 25
25/* name for sysfs, %d is appended */ 26/* name for sysfs, %d is appended */
26#define PHY_NAME "phy" 27#define PHY_NAME "phy"
@@ -690,6 +691,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
690 wdev->wext.ps = false; 691 wdev->wext.ps = false;
691 } 692 }
692#endif 693#endif
694 if (!dev->ethtool_ops)
695 dev->ethtool_ops = &cfg80211_ethtool_ops;
693 break; 696 break;
694 case NETDEV_GOING_DOWN: 697 case NETDEV_GOING_DOWN:
695 switch (wdev->iftype) { 698 switch (wdev->iftype) {
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
new file mode 100644
index 000000000000..80d6d0d31f12
--- /dev/null
+++ b/net/wireless/ethtool.c
@@ -0,0 +1,24 @@
1#include <linux/utsname.h>
2#include <net/cfg80211.h>
3#include "ethtool.h"
4
5static 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
21const struct ethtool_ops cfg80211_ethtool_ops = {
22 .get_drvinfo = cfg80211_get_drvinfo,
23 .get_link = ethtool_op_get_link,
24};
diff --git a/net/wireless/ethtool.h b/net/wireless/ethtool.h
new file mode 100644
index 000000000000..70cbee1bc62e
--- /dev/null
+++ b/net/wireless/ethtool.h
@@ -0,0 +1,8 @@
1#ifndef __CFG80211_ETHTOOL__
2#define __CFG80211_ETHTOOL__
3
4#include <linux/ethtool.h>
5
6extern const struct ethtool_ops cfg80211_ethtool_ops;
7
8#endif /* __CFG80211_ETHTOOL__ */