]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: stmmac: Defer VLAN HW configuration when interface is down
authorOvidiu Panait <ovidiu.panait.rb@renesas.com>
Tue, 3 Mar 2026 14:58:28 +0000 (14:58 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Mar 2026 02:48:49 +0000 (18:48 -0800)
commit2cd70e3968f505996d5fefdf7ca684f0f4575734
tree08b9998a86c87bda39d94ed8f731ef32e9a9d8ed
parentbd7ad51253a76fb35886d01cfe9a37f0e4ed6709
net: stmmac: Defer VLAN HW configuration when interface is down

VLAN register accesses on the MAC side require the PHY RX clock to be
active. When the network interface is down, the PHY is suspended and
the RX clock is unavailable, causing VLAN operations to fail with
timeouts.

The VLAN core automatically removes VID 0 after the interface goes down
and re-adds it when it comes back up, so these timeouts happen during
normal interface down/up:

    # ip link set end1 down
    renesas-gbeth 15c40000.ethernet end1: Timeout accessing MAC_VLAN_Tag_Filter
    renesas-gbeth 15c40000.ethernet end1: failed to kill vid 0081/0

Adding VLANs while the interface is down also fails:

    # ip link add link end1 name end1.10 type vlan id 10
    renesas-gbeth 15c40000.ethernet end1: Timeout accessing MAC_VLAN_Tag_Filter
    RTNETLINK answers: Device or resource busy

To fix this, check if the interface is up before accessing VLAN registers.
The software state is always kept up to date regardless of interface state.

When the interface is brought up, stmmac_vlan_restore() is called
to write the VLAN state to hardware.

Fixes: ed64639bc1e0 ("net: stmmac: Add support for VLAN Rx filtering")
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Link: https://patch.msgid.link/20260303145828.7845-5-ovidiu.panait.rb@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c