]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: stmmac: Improve double VLAN handling
authorOvidiu Panait <ovidiu.panait.rb@renesas.com>
Tue, 3 Mar 2026 14:58:26 +0000 (14:58 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2026 02:48:49 +0000 (18:48 -0800)
commite38200e361cbe331806dc454c76c11c7cd95e1b9
treeb25781d691a1763ac3a05fe116d910cb24f829f0
parent35dfedce442c4060cfe5b98368bc9643fb995716
net: stmmac: Improve double VLAN handling

The double VLAN bits (EDVLP, ESVL, DOVLTC) are handled inconsistently
between the two vlan_update_hash() implementations:

- dwxgmac2_update_vlan_hash() explicitly clears the double VLAN bits when
is_double is false, meaning that adding a 802.1Q VLAN will disable
double VLAN mode:

  $ ip link add link eth0 name eth0.200 type vlan id 200 protocol 802.1ad
  $ ip link add link eth0 name eth0.100 type vlan id 100
  # Double VLAN bits no longer set

- vlan_update_hash() sets these bits and only clears them when the last
VLAN has been removed, so double VLAN mode remains enabled even after all
802.1AD VLANs are removed.

Address both issues by tracking the number of active 802.1AD VLANs in
priv->num_double_vlans. Pass this count to stmmac_vlan_update() so both
implementations correctly set the double VLAN bits when any 802.1AD
VLAN is active, and clear them only when none remain.

Also update vlan_update_hash() to explicitly clear the double VLAN bits
when is_double is false, matching the dwxgmac2 behavior.

Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Link: https://patch.msgid.link/20260303145828.7845-3-ovidiu.panait.rb@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c