Skip to contentSkip to conversation

RFC: mac80211: add ethtool support

PATCH Patrick McHardy 3 participants 7 messages Nov 25, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

If people find this useful, I'll go through the other wireless drivers and add the drvname field.

commit 7ac460f6b6deb95955f008eb94a7a81ee4d9d2d9

Author: Patrick McHardy <[email protected]>
Date:   Wed Nov 25 17:16:56 2009 +0100

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

drivers/net/wireless/ath/ath5k/base.c +1 -0
index a4c086f..94f8a2c 100644
@@ -256,6 +256,7 @@ static void ath5k_sw_scan_start(struct ieee80211_hw *hw);
 static void ath5k_sw_scan_complete(struct ieee80211_hw *hw);
 
 static const struct ieee80211_ops ath5k_hw_ops = {
+	.drvname	= "ath5k",
 	.tx 		= ath5k_tx,
 	.start 		= ath5k_start,
 	.stop 		= ath5k_stop,
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -0
index 0db9b79..a0df4ee 100644
@@ -3855,6 +3855,7 @@ static struct attribute_group iwl3945_attribute_group = {
 };
 
 static struct ieee80211_ops iwl3945_hw_ops = {
+	.drvname = "iwl3945",
 	.tx = iwl3945_mac_tx,
 	.start = iwl3945_mac_start,
 	.stop = iwl3945_mac_stop,
include/net/mac80211.h +1 -0
index 3754ea4..971db98 100644
@@ -1530,6 +1530,7 @@ struct ieee80211_ops {
 #ifdef CONFIG_NL80211_TESTMODE
 	int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
 #endif
+	const char *drvname;
 };
 
 /**
net/mac80211/iface.c +17 -0
index 1bf12a2..7c1ceee 100644
@@ -664,10 +664,27 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
 	.ndo_set_mac_address 	= eth_mac_addr,
 };
 
+static void ieee80211_get_drvinfo(struct net_device *dev,
+				  struct ethtool_drvinfo *drvinfo)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+
+	if (local->ops->drvname != NULL)
+		snprintf(drvinfo->driver, sizeof(drvinfo->driver),
+			 local->ops->drvname);
+}
+
+static const struct ethtool_ops ieee80211_ethtool_ops = {
+	.get_link		= ethtool_op_get_link,
+	.get_drvinfo		= ieee80211_get_drvinfo,
+};
+
 static void ieee80211_if_setup(struct net_device *dev)
 {
 	ether_setup(dev);
 	dev->netdev_ops = &ieee80211_dataif_ops;
+	dev->ethtool_ops = &ieee80211_ethtool_ops;
 	dev->destructor = free_netdev;
 }
 
maintainer
#1 lore raw
Quoted 7 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

I thought we _had_ ethtool support via cfg80211?!

johannes

#2 lore raw
Quoted 9 lines · Johannes Berg
Quoted 6 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

I thought we _had_ ethtool support via cfg80211?!

Mhh good point :) For some reason it didn't show any information, but that might have been a mistake on my part. I'll give it another shot :)

maintainer
#3 lore raw
Quoted 9 lines · Patrick McHardy
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

Quoted 4 lines
Quoted 1 line

I thought we _had_ ethtool support via cfg80211?!

Mhh good point :) For some reason it didn't show any information, but that might have been a mistake on my part. I'll give it another shot :)

It probably won't show the driver name because we haven't pushed that through in any way?

johannes

#4 lore raw
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Patrick McHardy
Quoted 7 lines · Johannes Berg
Quoted 6 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I thought we _had_ ethtool support via cfg80211?!

Mhh good point :) For some reason it didn't show any information, but that might have been a mistake on my part. I'll give it another shot :)

It probably won't show the driver name because we haven't pushed that through in any way?

Its actually showing:

# ethtool -i wlan0
Cannot get driver information: Operation not supported

which shouldn't happen, since the callback is defined. I'll have a closer look at this.

#5 lore raw
Quoted 17 lines · Patrick McHardy
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Patrick McHardy
Quoted 7 lines · Johannes Berg
Quoted 6 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I thought we _had_ ethtool support via cfg80211?!

Mhh good point :) For some reason it didn't show any information, but that might have been a mistake on my part. I'll give it another shot :)

It probably won't show the driver name because we haven't pushed that through in any way?

Quoted 7 lines

Its actually showing:

# ethtool -i wlan0
Cannot get driver information: Operation not supported

which shouldn't happen, since the callback is defined. I'll have a closer look at this.

What kernel are you using?

[linville-t400.local]:> ethtool -i wlan0
driver: iwlagn
version: 2.6.32-rc8-wl
firmware-version: 8.24.2.12
bus-info: 0000:03:00.0

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#6 lore raw
Quoted 18 lines · John W. Linville
Quoted 17 lines · Patrick McHardy
Quoted 9 lines · Johannes Berg
Quoted 8 lines · Patrick McHardy
Quoted 7 lines · Johannes Berg
Quoted 6 lines · Patrick McHardy

mac80211: add ethtool support

Add ethtool support and add a drvname field to struct ieee80211_ops, which is used for ethtool driver information. This is useful with multiple different wireless cards to find out which device is using which driver.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I thought we _had_ ethtool support via cfg80211?!

Mhh good point :) For some reason it didn't show any information, but that might have been a mistake on my part. I'll give it another shot :)

It probably won't show the driver name because we haven't pushed that through in any way?

Its actually showing:

Quoted 7 lines
Quoted 5 lines
# ethtool -i wlan0
Cannot get driver information: Operation not supported

which shouldn't happen, since the callback is defined. I'll have a closer look at this.

What kernel are you using?

OK, that was a mistake on my part, I added the patch on net-next, but the above test was done on net-2.6. Everything is working fine, sorry for the confusion :)