Re: [PATCH v3 net-next] net: introduce dev_set_forwarding()

Ben Hutchings
2013-11-02T15:46:24Z

On Sat, 2013-11-02 at 07:01 -0700, Eric Dumazet wrote:
[...]
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[...]
> -void dev_disable_lro(struct net_device *dev)
> +void dev_set_forwarding(struct net_device *dev, int inc)
> {
> /*
> - * If we're trying to disable lro on a vlan device
> + * If we're trying to enable forwarding from a vlan device
> * use the underlying physical device instead
> */
> if (is_vlan_dev(dev))
> dev = vlan_dev_real_dev(dev);
>
> - dev->wanted_features &= ~NETIF_F_LRO;
> + dev->forwarding_count += inc;
> + if (dev->forwarding_count)
> + dev->wanted_features &= ~NETIF_F_LRO;
> + else
> + dev->wanted_features |= NETIF_F_LRO;
> netdev_update_features(dev);
[...]

We should not change dev->wanted_features any more. It should only be
set as requested by userland.

Instead, netdev_update_features() should mask out NETIF_F_LRO based on
dev->forwarding_count.

Ben.

--
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.