Re: [PATCH v5] net: bnx2x: convert to hw_features

Michał Mirosław
2011-04-21T22:15:50Z

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.

Best Regards,
Michał Mirosław