All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org, Kalle Valo <kalle.valo@nokia.com>,
	Kalle Valo <kalle.valo@iki.fi>,
	"Luis R. Rodriguez" <mcgrof@gmail.com>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 2/3] cfg80211: add firmware and hardware version to wiphy
Date: Wed, 30 Sep 2009 21:19:01 -0400	[thread overview]
Message-ID: <1254359942-3483-2-git-send-email-linville@tuxdriver.com> (raw)
In-Reply-To: <1254359942-3483-1-git-send-email-linville@tuxdriver.com>

From: Kalle Valo <kalle.valo@nokia.com>

It's useful to provide firmware and hardware version to user space and have a
generic interface to retrieve them. Users can provide the version information
in bug reports etc.

Add fields for firmware and hardware version to struct wiphy.

(Dropped nl80211 bits for now and modified remaining bits in favor of
ethtool. -- JWL)

Cc: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 include/net/cfg80211.h |    3 +++
 net/wireless/ethtool.c |   23 ++++++++++++++++++++++-
 net/wireless/ethtool.h |    3 +++
 3 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 241ea14..6f4862b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1142,6 +1142,9 @@ struct wiphy {
 	u32 frag_threshold;
 	u32 rts_threshold;
 
+	char fw_version[ETHTOOL_BUSINFO_LEN];
+	u32 hw_version;
+
 	/* If multiple wiphys are registered and you're handed e.g.
 	 * a regular netdev with assigned ieee80211_ptr, you won't
 	 * know whether it points to a wiphy your driver has registered
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index 94ca377..3c59549 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -4,6 +4,8 @@
 
 const struct ethtool_ops cfg80211_ethtool_ops = {
 	.get_drvinfo = cfg80211_get_drvinfo,
+	.get_regs_len = cfg80211_get_regs_len,
+	.get_regs = cfg80211_get_regs,
 	.get_link = ethtool_op_get_link,
 };
 
@@ -18,10 +20,29 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 	strncpy(info->version, UTS_RELEASE, sizeof(info->version));
 	info->version[sizeof(info->version) - 1] = '\0';
 
-	strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
+	if (wdev->wiphy->fw_version[0])
+		strncpy(info->fw_version, wdev->wiphy->fw_version,
+			sizeof(info->fw_version));
+	else
+		strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
 	info->fw_version[sizeof(info->fw_version) - 1] = '\0';
 
 	strncpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
 		sizeof(info->bus_info));
 	info->bus_info[sizeof(info->bus_info) - 1] = '\0';
 }
+
+int cfg80211_get_regs_len(struct net_device *dev)
+{
+	/* For now, return 0... */
+	return 0;
+}
+
+void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+			void *data)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+	regs->version = wdev->wiphy->hw_version;
+	regs->len = 0;
+}
diff --git a/net/wireless/ethtool.h b/net/wireless/ethtool.h
index a51b470..2d4602a 100644
--- a/net/wireless/ethtool.h
+++ b/net/wireless/ethtool.h
@@ -4,6 +4,9 @@
 #include <linux/ethtool.h>
 
 extern void cfg80211_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
+extern int cfg80211_get_regs_len(struct net_device *);
+extern void cfg80211_get_regs(struct net_device *, struct ethtool_regs *,
+				void *);
 
 extern const struct ethtool_ops cfg80211_ethtool_ops;
 
-- 
1.6.2.5


  reply	other threads:[~2009-10-01  1:20 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 18:02 [PATCH 0/2] cfg80211: firmware and hardware version Kalle Valo
2009-09-24 18:02 ` [PATCH 1/2] cfg80211: add firmware and hardware version to wiphy Kalle Valo
2009-09-24 18:32   ` Luis R. Rodriguez
2009-09-24 19:14     ` Kalle Valo
2009-09-24 20:08       ` Luis R. Rodriguez
2009-09-24 18:02 ` [PATCH 2/2] at76c50x-usb: set firmware and hardware version in wiphy Kalle Valo
2009-09-24 18:35   ` Luis R. Rodriguez
2009-09-24 19:10     ` Kalle Valo
2009-09-24 20:11       ` Luis R. Rodriguez
2009-09-25 19:11         ` Kalle Valo
2009-09-25 19:27           ` Luis R. Rodriguez
2009-09-26 12:07           ` Johannes Berg
2009-09-26 13:59             ` Kalle Valo
2009-09-24 21:13   ` Joerg Albert
2009-09-25 19:06     ` Kalle Valo
2009-09-24 18:09 ` [PATCH 1/2] iw: update nl80211.h from wireless-testing Kalle Valo
2009-09-24 18:09 ` [PATCH 2/2] iw: print firmware and hardware version Kalle Valo
2009-09-24 20:20 ` [PATCH 0/2] cfg80211: " Luis R. Rodriguez
2009-09-25  4:42   ` John W. Linville
2009-09-25 16:47     ` Kalle Valo
2009-09-25 16:53       ` Luis R. Rodriguez
2009-10-01  1:13         ` John W. Linville
2009-10-01  1:19           ` [PATCH 1/3] wireless: implement basic ethtool support for cfg80211 devices John W. Linville
2009-10-01  1:19             ` John W. Linville
2009-10-01  1:19             ` John W. Linville [this message]
2009-10-01  1:19               ` [PATCH 3/3] at76c50x-usb: set firmware and hardware version in wiphy John W. Linville
2009-10-01  1:19                 ` John W. Linville
2009-10-01  1:32                 ` Ben Hutchings
2009-10-01 14:27                   ` Kalle Valo
2009-10-01  1:30             ` [PATCH 1/3] wireless: implement basic ethtool support for cfg80211 devices Ben Hutchings
2009-10-01  8:51             ` Johannes Berg
2009-10-01  8:51               ` Johannes Berg
2009-10-01 14:18           ` [PATCH 0/2] cfg80211: firmware and hardware version Kalle Valo
2009-10-01 15:18             ` John W. Linville
2009-10-01 15:33               ` Ben Hutchings
2009-10-01 16:56                 ` John W. Linville
2009-10-01 16:56                   ` John W. Linville
2009-10-01 16:20               ` Kalle Valo
2009-10-01 17:07                 ` John W. Linville
2009-10-01 19:56                   ` Luis R. Rodriguez
2009-10-01 19:56                     ` Luis R. Rodriguez
2009-10-01 20:12                     ` Inaky Perez-Gonzalez

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=1254359942-3483-2-git-send-email-linville@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=kalle.valo@iki.fi \
    --cc=kalle.valo@nokia.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@gmail.com \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.