netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: vlan: sync VLAN features with lower device
@ 2025-10-21  9:56 Hangbin Liu
  2025-10-23 13:39 ` Paolo Abeni
  0 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2025-10-21  9:56 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Stanislav Fomichev, Dr. David Alan Gilbert,
	Dong Chenchen, Oscar Maes, Hangbin Liu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1172 bytes --]

After registering a VLAN device and setting its feature flags, we need to
synchronize the VLAN features with the lower device. For example, the VLAN
device does not have the NETIF_F_LRO flag, it should be synchronized with
the lower device based on the NETIF_F_UPPER_DISABLES definition.

As the dev->vlan_features has changed, we need to call
netdev_change_features(). The caller must run after netdev_upper_dev_link()
links the lower devices, so this patch adds the netdev_change_features()
call in register_vlan_dev().

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---

I’m not sure what the proper Fixes tag should be, so I’ve left it blank for
now. If anyone has a clue, please let me know.

---
 net/8021q/vlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index fda3a80e9340..4857fb0ee11d 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -193,6 +193,8 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
 	vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
 	grp->nr_vlan_devs++;
 
+	netdev_change_features(dev);
+
 	return 0;
 
 out_unregister_netdev:
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: vlan: sync VLAN features with lower device
  2025-10-21  9:56 [PATCH net] net: vlan: sync VLAN features with lower device Hangbin Liu
@ 2025-10-23 13:39 ` Paolo Abeni
  2025-10-23 13:55   ` Jakub Kicinski
  2025-10-23 14:17   ` Hangbin Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Paolo Abeni @ 2025-10-23 13:39 UTC (permalink / raw)
  To: Hangbin Liu, netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Simon Horman,
	Stanislav Fomichev, Dr. David Alan Gilbert, Dong Chenchen,
	Oscar Maes

On 10/21/25 11:56 AM, Hangbin Liu wrote:
> After registering a VLAN device and setting its feature flags, we need to
> synchronize the VLAN features with the lower device. For example, the VLAN
> device does not have the NETIF_F_LRO flag, it should be synchronized with
> the lower device based on the NETIF_F_UPPER_DISABLES definition.
> 
> As the dev->vlan_features has changed, we need to call
> netdev_change_features(). The caller must run after netdev_upper_dev_link()
> links the lower devices, so this patch adds the netdev_change_features()
> call in register_vlan_dev().


> 
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> 
> I’m not sure what the proper Fixes tag should be, so I’ve left it blank for
> now. If anyone has a clue, please let me know.

Apparently the issue is there since fd867d51f889aec11cca235ebb008578780d052d

> 
> ---
>  net/8021q/vlan.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index fda3a80e9340..4857fb0ee11d 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -193,6 +193,8 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
>  	vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
>  	grp->nr_vlan_devs++;
>  
> +	netdev_change_features(dev);

Is this just for NETIF_F_LRO? it feels a bit overkill for single flag.
Also, why netdev_change_features() (vs netdev_update_features())?> +
>  	return 0;
>  
>  out_unregister_netdev:


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: vlan: sync VLAN features with lower device
  2025-10-23 13:39 ` Paolo Abeni
@ 2025-10-23 13:55   ` Jakub Kicinski
  2025-10-23 14:57     ` Hangbin Liu
  2025-10-23 14:17   ` Hangbin Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-10-23 13:55 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: Hangbin Liu, netdev, David S. Miller, Eric Dumazet, Simon Horman,
	Stanislav Fomichev, Dr. David Alan Gilbert, Dong Chenchen,
	Oscar Maes

On Thu, 23 Oct 2025 15:39:07 +0200 Paolo Abeni wrote:
> > @@ -193,6 +193,8 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
> >  	vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
> >  	grp->nr_vlan_devs++;
> >  
> > +	netdev_change_features(dev);  
> 
> Is this just for NETIF_F_LRO? it feels a bit overkill for single flag.
> Also, why netdev_change_features() (vs netdev_update_features())?

Another thought -- isn't this a problem for more uppers?
Isn't this what all callers of netdev_upper_dev_link() effectively
need, and therefore perhaps we should stick it somewhere in the core
(netdev_upper_dev_link() itself or when device is registered) ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: vlan: sync VLAN features with lower device
  2025-10-23 13:39 ` Paolo Abeni
  2025-10-23 13:55   ` Jakub Kicinski
@ 2025-10-23 14:17   ` Hangbin Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2025-10-23 14:17 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Simon Horman, Stanislav Fomichev, Dr. David Alan Gilbert,
	Dong Chenchen, Oscar Maes

On Thu, Oct 23, 2025 at 03:39:07PM +0200, Paolo Abeni wrote:
> On 10/21/25 11:56 AM, Hangbin Liu wrote:
> > After registering a VLAN device and setting its feature flags, we need to
> > synchronize the VLAN features with the lower device. For example, the VLAN
> > device does not have the NETIF_F_LRO flag, it should be synchronized with
> > the lower device based on the NETIF_F_UPPER_DISABLES definition.
> > 
> > As the dev->vlan_features has changed, we need to call
> > netdev_change_features(). The caller must run after netdev_upper_dev_link()
> > links the lower devices, so this patch adds the netdev_change_features()
> > call in register_vlan_dev().
> 
> 
> > 
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> > ---
> > 
> > I’m not sure what the proper Fixes tag should be, so I’ve left it blank for
> > now. If anyone has a clue, please let me know.
> 
> Apparently the issue is there since fd867d51f889aec11cca235ebb008578780d052d

Thanks, I thought it's a VLAN issue. Didn't expect it's from here.

> 
> > 
> > ---
> >  net/8021q/vlan.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> > index fda3a80e9340..4857fb0ee11d 100644
> > --- a/net/8021q/vlan.c
> > +++ b/net/8021q/vlan.c
> > @@ -193,6 +193,8 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
> >  	vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
> >  	grp->nr_vlan_devs++;
> >  
> > +	netdev_change_features(dev);
> 
> Is this just for NETIF_F_LRO? it feels a bit overkill for single flag.

Not only LRO, the vlan set all the dev features in vlan_dev_init() but doesn't
call the netdev_change_features(). I think it need to compute the dev features
once.

> Also, why netdev_change_features() (vs netdev_update_features())?> +

Hmm, I might made a mistake. I thought any_dev->vlan_features changes need
to call netdev_change_features(). But actually only the lower_dev->vlan_features
changes need to call netdev_change_features(). I will fix it.

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: vlan: sync VLAN features with lower device
  2025-10-23 13:55   ` Jakub Kicinski
@ 2025-10-23 14:57     ` Hangbin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2025-10-23 14:57 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Paolo Abeni, netdev, David S. Miller, Eric Dumazet, Simon Horman,
	Stanislav Fomichev, Dr. David Alan Gilbert, Dong Chenchen,
	Oscar Maes

On Thu, Oct 23, 2025 at 06:55:17AM -0700, Jakub Kicinski wrote:
> On Thu, 23 Oct 2025 15:39:07 +0200 Paolo Abeni wrote:
> > > @@ -193,6 +193,8 @@ int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
> > >  	vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev);
> > >  	grp->nr_vlan_devs++;
> > >  
> > > +	netdev_change_features(dev);  
> > 
> > Is this just for NETIF_F_LRO? it feels a bit overkill for single flag.
> > Also, why netdev_change_features() (vs netdev_update_features())?
> 
> Another thought -- isn't this a problem for more uppers?
> Isn't this what all callers of netdev_upper_dev_link() effectively
> need, and therefore perhaps we should stick it somewhere in the core
> (netdev_upper_dev_link() itself or when device is registered) ?

I saw bond/team/bridge/hsr disabled lro via dev_disable_lro() when add new
ports. But net_failover/ipvlan/macvlan and some others did not.

Maybe as you said, we can do it in netdev_upper_dev_link(), as some
devices may register first but not set upper dev link yet.

Thanks
Hangbin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-23 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  9:56 [PATCH net] net: vlan: sync VLAN features with lower device Hangbin Liu
2025-10-23 13:39 ` Paolo Abeni
2025-10-23 13:55   ` Jakub Kicinski
2025-10-23 14:57     ` Hangbin Liu
2025-10-23 14:17   ` Hangbin Liu

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