Hi Ovidiu

On Tue, Aug 25, 2026 at 04:45:19PM +0000, Ovidiu Panait wrote:
> The double VLAN bits (EDVLP, ESVL, DOVLTC) are currently handled inside
> update_vlan_hash(). This ties the double VLAN state to the hash filter
> update, even though the two features are independent: hash filtering is
> controlled by dma_cap.vlhash and double vlan by dma_cap.dvlan.
> 
> In preparation for removing double vlan support from dwmac4, move the
> double vlan logic into a separate update_dvlan_state() VLAN operation.

The S-VLAN implementation in STMMAC is a complete mess. It seems like
the original code author didn't fully understand what he was doing.

Double VLAN feature of DW *MACs has nothing to do with S-Tag VLANs.
It merely provides a way to insert/extract/filter an additional level
of VLAN header - inner. That's it. Seeing the networking subsystem
provides only the outer VLAN header for HW-accelerations, having the
DW MACs somehow working with the inner one is not only redundant but
had been harmful up until a recent kernel. The Tx path has been fixed
there.  What you see here is a leftover of the incomplete fix.

Anyway if you feel like cleaning up a mess here then the only correct
solution would be to almost completely drop any double vlan stuff from
the VLAN implementation of the driver. That is:
1. Drop EDVLP flag toggle. But preserve the flag being always set
otherwise COE won't work for packets with an inner VLAN header.
2. Rename "double" word to "svlan".

You must not touch the ESVL and DOVLTC flags, since they are responsible
for the S-VLAN tags handling, have nothing to do with the Double VLAN
feature, and must be set so VLAN hash-based filter would perceive
VLAN S-tagged packets.

If you need to make DW GMAC4 not stripping VLAN S-Tags on Rx packets,
then you have to find a way to prevent the networking core from
enabling HW-accelerated S-Tags handling.

-Joseph

> 
> Signed-off-by: Ovidiu Panait <[email protected]>
> Reviewed-by: Maxime Chevallier <[email protected]>
> ---
> v3 changes:
> - Rebased after dropping the dma_cap.dvlan patch.
> - Added "Reviewed-by" tag from Maxime.
> 


Reply via email to