[PATCH net-next v13 2/5] net: stmmac: remove software VLAN tag stripping

Lorenzo Bianconi lorenzo.bianconi at oss.qualcomm.com
Fri Nov 27 01:54:53 PST 2026


> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 1 · Low: 2
> 
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
> 
> - [Medium] In __stmmac_dvr_probe()
>   (drivers/net/ethernet/stmicro/stmmac/stmmac_main.c),…
> - [Low] The patch carries 'Fixes: 534df0c1724b', which marks it for
>   stable backporting.
> - [Low] On DWXGMAC (stmmac_rx_8021ad_offload() true),
>   __stmmac_dvr_probe() now adds NETIF_F_HW_VLAN_STAG_RX to…
> 
> --
> 
> net: stmmac: remove software VLAN tag stripping
> 
> This removes the software VLAN stripping in stmmac_rx_vlan() and changes
> stmmac_has_ip_ethertype() so that it still recognises IPv4/IPv6 behind a
> single in-payload C-tag on RX. NETIF_F_HW_VLAN_CTAG_RX and
> NETIF_F_HW_VLAN_STAG_RX are now advertised only when the VLAN ops and the
> descriptor ops provide real RX VLAN offload.
> 
> > The DWXLGMAC mis-advertisement was introduced when the RX VLAN offload
> > gate was widened to all xmac cores, so tag the fix accordingly.
> >
> > With NETIF_F_VLAN_FEATURES possibly empty, EEE RX clock stop may be
> > enabled on some platforms; the preceding selftests patch blocks RX
> > clock stop while the ethtool selftests run.
> >
> > This depends on the preceding selftests fix.
> >
> > Fixes: 534df0c1724b ("net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping")
> 
> [Severity: Low]
> Is the Fixes: tag in proportion to the change? On DWXLGMAC,
> dwxlgmac2_vlan_ops has no .rx_hw_vlan:
> 
> const struct stmmac_vlan_ops dwxlgmac2_vlan_ops = {
> 	.update_vlan_hash = dwxgmac2_update_vlan_hash,
> 	.enable_vlan = vlan_enable,
> 	.set_hw_vlan_mode = dwxlgmac2_set_hw_vlan_mode,
> };
> 
> With the old hw_vlan_en = true, stmmac_rx_hw_vlan() did nothing, and
> dwxlgmac2_set_hw_vlan_mode() only sets EDVLP. The tag stayed in the
> payload and the VLAN core removed it in software. The only visible effect
> seems to have been the wrong CTAG_RX/STAG_RX advertisement.
> 
> The same Fixes-tagged patch also does the following:
> 
> - removes the software stripping path;
> - drops CTAG_RX on every dwmac100/dwmac1000;
> - changes the RX checksum trust rules in stmmac_has_ip_ethertype();
> - makes STAG_RX user-visible in hw_features;
> - depends on the preceding selftests patch.
> 
> Through the NETIF_F_VLAN_FEATURES check in stmmac_phylink_setup(), it also
> enables EEE RX clock stop on every such platform that does not set
> STMMAC_FLAG_RX_CLK_RUNS_IN_LPI, not only on "some platforms".
> 
> Could the minimal DWXLGMAC advertisement fix be split out for net, with
> the cleanup and its EEE side effects going to net-next?
> 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index ca4c7fb11b73f..7896364c43e95 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> 
> [ ... ]
> 
> > @@ -8275,15 +8248,17 @@ static int __stmmac_dvr_probe(struct device *device,
> >  	ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA;
> >  	ndev->watchdog_timeo = msecs_to_jiffies(watchdog);
> >  #ifdef STMMAC_VLAN_TAG_USED
> > -	/* Both mac100 and gmac support receive VLAN tag detection */
> > -	ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
> > -	if (priv->plat->core_type == DWMAC_CORE_XGMAC)
> > -		ndev->features |= NETIF_F_HW_VLAN_STAG_RX;
> > -
> > -	if (dwmac_is_xmac(priv->plat->core_type)) {
> > +	if (stmmac_rx_8021q_offload(priv)) {
> > +		ndev->features |= NETIF_F_HW_VLAN_CTAG_RX;
> >  		ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
> >  		priv->hw->hw_vlan_en = true;
> >  	}
> 
> [Severity: Medium]
> Does this make RX clock stop reachable from set_rx_mode again?
> 
> dwmac1000 has no .vlan ops, and neither does DWXLGMAC without
> vlhash/vlins. With CONFIG_VLAN_8021Q enabled, these cores now end up with
> no NETIF_F_VLAN_FEATURES. stmmac_phylink_setup() then does:
> 
> 	if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI) &&
> 	    !(priv->dev->features & NETIF_F_VLAN_FEATURES))
> 		config->eee_rx_clk_stop_enable = true;
> 
> As a result the PHY may stop RXC while the link is in LPI.
> 
> stmmac_set_rx_mode() runs with BH disabled under netif_addr_lock_bh(). It
> cannot use phylink_rx_clk_stop_block(), which needs RTNL and a sleeping
> MDIO access:
> 
>  *  FIXME: This may need RXC to be running, but it may be called with BH
>  *  disabled, which means we can't call phylink_rx_clk_stop*().
>  */
> static void stmmac_set_rx_mode(struct net_device *dev)
> {
> 	struct stmmac_priv *priv = netdev_priv(dev);
> 
> 	stmmac_set_filter(priv, priv->hw, dev);
> 
> Commit c171e679ee66 notes that the hardware needs RXC when MAC address
> configuration registers are written. On these platforms, could a
> multicast join/leave, a promisc/allmulti change or a secondary unicast
> address update reach stmmac_set_filter() while RXC is stopped? That would
> leave the address or hash filter unprogrammed.
> 
> The selftests patch covers the ethtool selftests, but the commit message
> does not mention this path. dwmac100 should not be affected because it
> has no EEE.
> 
> These platforms did run with RX clock stop before c171e679ee66, and they
> still do with CONFIG_VLAN_8021Q=n. Whether dwmac1000 filter writes
> actually fail without RXC is therefore a hardware question.

I think this is a real problem, but the fix we have in place is quite frigile
and error prone (we already have the same problem with CONFIG_VLAN_8021Q=n).
I think this problem should be properly addressed with a specific patch not
included in this series.

> 
> > +
> > +	if (stmmac_rx_8021ad_offload(priv)) {
> > +		ndev->features |= NETIF_F_HW_VLAN_STAG_RX;
> > +		ndev->hw_features |= NETIF_F_HW_VLAN_STAG_RX;
> > +	}
> 
> [Severity: Low]
> Should STAG_RX be added to hw_features here? On DWXGMAC this tells
> userspace the bit can be toggled on its own, but stmmac_fix_features()
> ties it to CTAG_RX:
> 
> 	if (stmmac_rx_8021ad_offload(priv)) {
> 		if (features & NETIF_F_HW_VLAN_CTAG_RX)
> 			features |= NETIF_F_HW_VLAN_STAG_RX;
> 		else
> 			features &= ~NETIF_F_HW_VLAN_STAG_RX;
> 	}
> 
> stmmac_set_features() also has only one combined hw_vlan_en state.
> 
> So "ethtool -K <dev> rx-vlan-stag-hw-parse off" with rxvlan on, or "on"
> with rxvlan off, is always undone. ethtool then reports [requested off]
> or [requested on].
> 
> Before this patch STAG_RX was only in features and showed as [fixed],
> which matched the coupling. The coupling in stmmac_fix_features() already
> adds STAG_RX back when CTAG_RX is re-enabled.

I guess this is managed by stmmac_fix_features() disabling
NETIF_F_HW_VLAN_STAG_RX if NETIF_F_HW_VLAN_CTAG_RX is not enabled.

Regards,
Lorenzo

> 
> > +
> >  	if (priv->dma_cap.vlhash) {
> >  		ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
> >  		if (priv->plat->core_type == DWMAC_CORE_XGMAC)
> 
> [ ... ]
> 
> -- 
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125-stmmac-rx-mb-v13-0-0f6bac53e8d5%40oss.qualcomm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261127/da583b94/attachment.sig>


More information about the linux-arm-kernel mailing list