From: Ben Hutchings <bhutchings@solarflare.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Vladislav Zolotarov <vladz@broadcom.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Eilon Greenstein <eilong@broadcom.com>
Subject: Re: [PATCH v5] net: bnx2x: convert to hw_features
Date: Thu, 21 Apr 2011 23:52:22 +0100 [thread overview]
Message-ID: <1303426342.3464.184.camel@localhost> (raw)
In-Reply-To: <20110421221548.GA7888@rere.qmqm.pl>
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!
Ben.
--
Ben Hutchings, Senior Software 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.
next prev parent reply other threads:[~2011-04-21 22:52 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-10 14:47 [PATCH] net: bnx2x: convert to hw_features Michał Mirosław
2011-04-10 15:10 ` Vladislav Zolotarov
2011-04-10 15:23 ` Michał Mirosław
2011-04-10 15:35 ` [PATCH v2] " Michał Mirosław
2011-04-11 14:10 ` Vladislav Zolotarov
2011-04-11 19:54 ` [PATCH v3] " Michał Mirosław
2011-04-11 20:26 ` [PATCH v4] " Michał Mirosław
2011-04-12 12:10 ` Vladislav Zolotarov
2011-04-12 14:07 ` Michał Mirosław
2011-04-12 14:36 ` Vladislav Zolotarov
2011-04-12 14:49 ` Michał Mirosław
2011-04-13 9:36 ` Vladislav Zolotarov
2011-04-12 19:38 ` [PATCH v5] " Michał Mirosław
2011-04-12 21:52 ` David Miller
2011-04-21 14:52 ` Eric Dumazet
2011-04-21 18:49 ` Vladislav Zolotarov
2011-04-21 19:19 ` Ben Hutchings
2011-04-21 22:15 ` Michał Mirosław
2011-04-21 22:52 ` Ben Hutchings [this message]
2011-04-21 23:14 ` Michał Mirosław
2011-04-21 23:44 ` Michał Mirosław
2011-04-21 23:12 ` [PATCH] net: fix hw_features ethtool_ops->set_flags compatibility Michał Mirosław
2011-04-21 23:19 ` [PATCH v2] " Michał Mirosław
2011-04-21 23:21 ` [PATCH v3] " Michał Mirosław
2011-04-21 23:59 ` [PATCH v4] " Michał Mirosław
2011-04-22 0:21 ` David Miller
2011-04-22 5:16 ` Eric Dumazet
2011-04-22 5:27 ` Eric Dumazet
2011-04-21 22:41 ` [PATCH v5] net: bnx2x: convert to hw_features Michał Mirosław
2011-04-22 4:51 ` Eric Dumazet
2011-04-21 22:42 ` [PATCH] net: make WARN_ON in dev_disable_lro() useful Michał Mirosław
2011-04-22 5:11 ` Eric Dumazet
2011-04-25 18:56 ` David Miller
2011-04-11 20:12 ` [PATCH v2] net: bnx2x: convert to hw_features Michał Mirosław
2011-04-12 7:26 ` Vladislav Zolotarov
2011-04-12 7:46 ` Vladislav Zolotarov
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=1303426342.3464.184.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=eilong@broadcom.com \
--cc=eric.dumazet@gmail.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
--cc=vladz@broadcom.com \
/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).