linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: mac80211: add ethtool support
@ 2009-11-25 16:18 Patrick McHardy
  2009-11-25 16:31 ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2009-11-25 16:18 UTC (permalink / raw)
  To: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 99 bytes --]

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


[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 2724 bytes --]

commit 7ac460f6b6deb95955f008eb94a7a81ee4d9d2d9
Author: Patrick McHardy <kaber@trash.net>
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.
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index a4c086f..94f8a2c 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -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,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 0db9b79..a0df4ee 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -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,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3754ea4..971db98 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -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;
 };
 
 /**
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 1bf12a2..7c1ceee 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -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;
 }
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:18 RFC: mac80211: add ethtool support Patrick McHardy
@ 2009-11-25 16:31 ` Johannes Berg
  2009-11-25 16:34   ` Patrick McHardy
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2009-11-25 16:31 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
> 
>     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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:31 ` Johannes Berg
@ 2009-11-25 16:34   ` Patrick McHardy
  2009-11-25 16:36     ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2009-11-25 16:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Johannes Berg wrote:
> On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
>>     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 :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:34   ` Patrick McHardy
@ 2009-11-25 16:36     ` Johannes Berg
  2009-11-25 16:42       ` Patrick McHardy
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2009-11-25 16:36 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

On Wed, 2009-11-25 at 17:34 +0100, Patrick McHardy wrote:
> Johannes Berg wrote:
> > On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
> >>     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 :)

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

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:36     ` Johannes Berg
@ 2009-11-25 16:42       ` Patrick McHardy
  2009-11-25 16:43         ` John W. Linville
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2009-11-25 16:42 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Johannes Berg wrote:
> On Wed, 2009-11-25 at 17:34 +0100, Patrick McHardy wrote:
>> Johannes Berg wrote:
>>> On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
>>>>     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 :)
> 
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:42       ` Patrick McHardy
@ 2009-11-25 16:43         ` John W. Linville
  2009-11-25 16:47           ` Patrick McHardy
  0 siblings, 1 reply; 7+ messages in thread
From: John W. Linville @ 2009-11-25 16:43 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Johannes Berg, linux-wireless

On Wed, Nov 25, 2009 at 05:42:53PM +0100, Patrick McHardy wrote:
> Johannes Berg wrote:
> > On Wed, 2009-11-25 at 17:34 +0100, Patrick McHardy wrote:
> >> Johannes Berg wrote:
> >>> On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
> >>>>     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 :)
> > 
> > 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.

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

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: mac80211: add ethtool support
  2009-11-25 16:43         ` John W. Linville
@ 2009-11-25 16:47           ` Patrick McHardy
  0 siblings, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2009-11-25 16:47 UTC (permalink / raw)
  To: John W. Linville; +Cc: Johannes Berg, linux-wireless

John W. Linville wrote:
> On Wed, Nov 25, 2009 at 05:42:53PM +0100, Patrick McHardy wrote:
>> Johannes Berg wrote:
>>> On Wed, 2009-11-25 at 17:34 +0100, Patrick McHardy wrote:
>>>> Johannes Berg wrote:
>>>>> On Wed, 2009-11-25 at 17:18 +0100, Patrick McHardy wrote:
>>>>>>     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 :)
>>> 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.
> 
> 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 :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-25 16:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 16:18 RFC: mac80211: add ethtool support Patrick McHardy
2009-11-25 16:31 ` Johannes Berg
2009-11-25 16:34   ` Patrick McHardy
2009-11-25 16:36     ` Johannes Berg
2009-11-25 16:42       ` Patrick McHardy
2009-11-25 16:43         ` John W. Linville
2009-11-25 16:47           ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).