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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 22 Apr 2011 01:44:13 +0200
From:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	Vladislav Zolotarov <vladz@...adcom.com>,
	Eric Dumazet <eric.dumazet@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Eilon Greenstein <eilong@...adcom.com>
Subject: Re: [PATCH v5] net: bnx2x: convert to hw_features

On Thu, Apr 21, 2011 at 11:52:22PM +0100, Ben Hutchings wrote:
> On Fri, 2011-04-22 at 00:15 +0200, Michał Mirosław wrote:
> > On Thu, Apr 21, 2011 at 08:19:19PM +0100, Ben Hutchings wrote:
> > > 	/* Transfer changeable features to wanted_features and enable
> > > 	 * software offloads (GSO and GRO).
> > > 	 */
> > > 	dev->hw_features |= NETIF_F_SOFT_FEATURES;
> > > 	dev->features |= NETIF_F_SOFT_FEATURES;
> > > 	dev->wanted_features = dev->features & dev->hw_features;
> > > 
> > > This doesn't work correctly for features that are always enabled, like
> > > NETIF_F_HW_VLAN_RX in bnx2x, which are set in dev->features but not in
> > > dev->hw_features.
> > 
> > > The name 'hw_features' really wasn't a good choice - the obvious meaning
> > > and the meaning assumed by this code is 'hardware-supported features'
> > > and not 'hardware-supported features that can be toggled'.  And since we
> > > add NETIF_F_SOFT_FEATURES, it really only means 'features that can be
> > > toggled'.
> > 
> > I won't argue about hw_features name - I just couldn't find a better one.
> > Comment in include/linux/netdevice.h clearly explains the purpose of this
> > field.
> > 
> > wanted_features is supposed to be limited by hw_features (so that it's always
> > true that (hw_features & wanted_features) == wanted_features). If you have
> > an idea how to make that more clear, I'd be happy to update descriptions.
> 
> Then the computation of 'changed' in __ethtool_set_flags() is wrong:
> 
> 	/* allow changing only bits set in hw_features */
> 	changed = (data ^ dev->wanted_features) & flags_dup_features;
> 	if (changed & ~dev->hw_features)
> 		return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
> 
> You need to add something like:
> 
> 	/* Features that are requested to be on, are already on, and cannot
> 	 * be changed, have not changed.
> 	 */
> 	changes &= ~(data & dev->features & ~dev->hw_features);
> 
> It seems like there ought to be a way to simplify that, though!

I tried couple of variations, but your seems to be the best one. I'll send
it as a last try before I fall asleep.

Best Regards,
Michał Mirosław
--
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