Re: [PATCH net] net: stmmac: fix the invalid VID programmed by VLAN perfect filtering

From: Linkui Xiao

Date: Fri Sep 18 2026 - 03:12:42 EST


Hi Maxime,

On 2026/9/17 23:57, Maxime Chevallier wrote:
Hi,

+Ovidiu

On 9/17/26 14:22, Linkui Xiao wrote:
From: Linkui Xiao <xiaolinkui@xxxxxxxxxx>

for_each_set_bit() leaves its iterator equal to the bitmap size once the
loop terminates, so the 'vid' read after the loop in stmmac_vlan_update()
is always VLAN_N_VID (4096) and never the last VLAN ID that was found.

Cores that do not support VLAN hash filtering (dma_cap.vlhash == 0) fall
back to the single VID perfect match filter and hand that value straight
to the MAC. vlan_update_hash() therefore programs MAC_VLAN_Tag with
VID 4096, a value that can never match an incoming 802.1Q tag, so the
perfect filter ends up discarding all VLAN tagged traffic. Both
stmmac_test_vlanfilt_perfect() and stmmac_test_dvlanfilt_perfect() walk
this path and fail as a result.

Remember the VID while iterating so that the last active VLAN ID is the
one passed to the perfect match filter. When hash filtering is available
'hash' is non-zero as soon as at least one VID is active, so
vlan_update_hash() keeps ignoring 'pmatch' and nothing changes there.

Fixes: c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Linkui Xiao <xiaolinkui@xxxxxxxxxx>

Thank you for proposing this fix, however this code is currently being removed :

https://lore.kernel.org/r/20260908164309.59282-1-ovidiu.panait.rb@xxxxxxxxxxx

So no need for this patch :)

Thanks for the heads-up. I'll drop this patch then.

Ovidiu, I'll keep an eye on your series. If the fallback path
still needs a valid VID after the removal, feel free to ping me.

Thanks,
Linkui

Maxime