Skip to contentSkip to conversation

net: vlan: sync VLAN features with lower device

PATCH Superseded Hangbin Liu 3 participants 5 messages Oct 21, 2025 – Oct 23, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: vlan: sync VLAN features with lower device

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

---

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(+)
net/8021q/vlan.c +2 -0
index fda3a80e9340..4857fb0ee11d 100644
@@ -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:
Signature · 1 line
2.50.1
maintainer
#1 lore raw
Quoted 12 lines · Hangbin Liu

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

Quoted 5 lines

---

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

Quoted 10 lines
---
 net/8021q/vlan.c | 2 ++
 1 file changed, 2 insertions(+)
net/8021q/vlan.c +0 -0
index fda3a80e9340..4857fb0ee11d 100644

net/8021q/vlan.c int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack) · line 196

Quoted 4 lines
net/8021q/vlan.c +1 -0
@@ -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())?> +

Quoted 3 lines
net/8021q/vlan.c +0 -0
 	return 0;
 
 out_unregister_netdev:
maintainer
#2 lore raw
Quoted 8 lines · On Thu, 23 Oct 2025 15:39:07 +0200 Paolo Abeni wrote:

net/8021q/vlan.c int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack) · line 196

Quoted 5 lines
net/8021q/vlan.c +1 -0
@@ -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) ?

#3 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 23 Oct 2025 15:39:07 +0200 Paolo Abeni wrote:

net/8021q/vlan.c int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack) · line 196

Quoted 5 lines
net/8021q/vlan.c +1 -0
@@ -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())?

Quoted 4 lines

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

#4 lore raw
In reply to Paolo Abeni
Quoted 13 lines · Paolo Abeni
Quoted 12 lines · Hangbin Liu

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

Quoted 7 lines
Quoted 5 lines

---

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.

Quoted 14 lines
Quoted 14 lines

---
 net/8021q/vlan.c | 2 ++
 1 file changed, 2 insertions(+)
net/8021q/vlan.c +0 -0
index fda3a80e9340..4857fb0ee11d 100644
@@ -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++;
 
Quoted 3 lines

net/8021q/vlan.c int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack) · line 196

Quoted 1 line
net/8021q/vlan.c +1 -0
+	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.

Quoted 1 line

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