From: Patrick McHardy <kaber@trash.net>
To: linux-wireless@vger.kernel.org
Subject: RFC: mac80211: add ethtool support
Date: Wed, 25 Nov 2009 17:18:50 +0100 [thread overview]
Message-ID: <4B0D58EA.8060304@trash.net> (raw)
[-- 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;
}
next reply other threads:[~2009-11-25 16:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 16:18 Patrick McHardy [this message]
2009-11-25 16:31 ` RFC: mac80211: add ethtool support 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B0D58EA.8060304@trash.net \
--to=kaber@trash.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).