lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1367345978.2941.7.camel@bwh-desktop.uk.solarflarecom.com>
Date:	Tue, 30 Apr 2013 19:19:38 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	"Tantilov, Emil S" <emil.s.tantilov@...el.com>
CC:	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"gospo@...hat.com" <gospo@...hat.com>,
	"sassmann@...hat.com" <sassmann@...hat.com>
Subject: RE: [ethtool] ethtool: check mac type from ethtool_regs.version

On Tue, 2013-04-30 at 18:12 +0000, Tantilov, Emil S wrote:
[...]
> >It seems like this would work with both old and new drivers:
> >
> >diff --git a/ixgbe.c b/ixgbe.c
> >index dae11d4..9b005f2 100644
> >--- a/ixgbe.c
> >+++ b/ixgbe.c
> >@@ -133,10 +133,13 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct
> >ethtool_regs *regs)
> > 	u8 i;
> > 	enum ixgbe_mac_type mac_type;
> >
> >-	if (version != 1)
> >+	if (version == 0)
> > 		return -1;
> >
> >-	mac_type = ixgbe_get_mac_type(hw_device_id);
> >+	/* The current driver reports the MAC type, but older versions
> >+	 * only report the device ID so we have to infer the MAC type.
> >+	 */
> >+	mac_type = version > 1 ? version : ixgbe_get_mac_type(hw_device_id);
> >
> > 	reg = regs_buff[1065];
> > 	fprintf(stdout,
> 
> Yeah, this seems like a better way to go.
> 
> Thanks a lot,
> Emil

OK, so I've applied this:

---
From: Ben Hutchings <bhutchings@...arflare.com>
Subject: ixgbe: check mac type from ethtool_regs.version

This patch cleans up the mac type checks by using ethtool_regs.version
provided by the driver. This change eliminates the need to add device IDs
every time they are added to the driver.

Note that when using ethtool with this patch with a version of ixgbe that
does not provide the mac_type in ethtool_regs.version the register dump
may be incomplete. However this issue would've existed previously for
device IDs that were not added to ethtool.

Original patch and description by Emil Tantilov <emil.s.tantilov@...el.com>.

Signed-off-by: Ben Hutchings <bhutchings@...arflare.com>
---
 ixgbe.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ixgbe.c b/ixgbe.c
index dae11d4..9b005f2 100644
--- a/ixgbe.c
+++ b/ixgbe.c
@@ -133,10 +133,13 @@ ixgbe_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
 	u8 i;
 	enum ixgbe_mac_type mac_type;
 
-	if (version != 1)
+	if (version == 0)
 		return -1;
 
-	mac_type = ixgbe_get_mac_type(hw_device_id);
+	/* The current driver reports the MAC type, but older versions
+	 * only report the device ID so we have to infer the MAC type.
+	 */
+	mac_type = version > 1 ? version : ixgbe_get_mac_type(hw_device_id);
 
 	reg = regs_buff[1065];
 	fprintf(stdout,


-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ