John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 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 | |
Kalle Valo | dfce95f | 2009-09-24 11:02:42 -0700 | [diff] [blame] | 15 | if (wdev->wiphy->fw_version[0]) |
| 16 | strncpy(info->fw_version, wdev->wiphy->fw_version, |
| 17 | sizeof(info->fw_version)); |
| 18 | else |
| 19 | strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 20 | |
| 21 | strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), |
| 22 | sizeof(info->bus_info)); |
| 23 | } |
| 24 | |
Kalle Valo | dfce95f | 2009-09-24 11:02:42 -0700 | [diff] [blame] | 25 | static int cfg80211_get_regs_len(struct net_device *dev) |
| 26 | { |
| 27 | /* For now, return 0... */ |
| 28 | return 0; |
| 29 | } |
| 30 | |
| 31 | static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
| 32 | void *data) |
| 33 | { |
| 34 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 35 | |
| 36 | regs->version = wdev->wiphy->hw_version; |
| 37 | regs->len = 0; |
| 38 | } |
| 39 | |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 40 | const struct ethtool_ops cfg80211_ethtool_ops = { |
| 41 | .get_drvinfo = cfg80211_get_drvinfo, |
Kalle Valo | dfce95f | 2009-09-24 11:02:42 -0700 | [diff] [blame] | 42 | .get_regs_len = cfg80211_get_regs_len, |
| 43 | .get_regs = cfg80211_get_regs, |
John W. Linville | 4890e3b | 2009-09-30 14:50:17 -0400 | [diff] [blame] | 44 | .get_link = ethtool_op_get_link, |
| 45 | }; |