From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: netdev-bot+sashiko@kernel.org
Cc: andrew+netdev@lunn.ch, kuba@kernel.org, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
linux@armlinux.org.uk, lorenzo.bianconi@oss.qualcomm.com,
nb@tipi-net.de, ovidiu.panait.rb@renesas.com, recv.jo@gmail.com,
muhammad.nazim.amirul.nazle.asmade@altera.com,
thomas.petazzoni@bootlin.com, alexis.lothore@bootlin.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next] net: stmmac: xgmac: Report the VLAN tag type from the descriptor
Date: Fri, 20 Nov 2026 11:22:55 +0100 [thread overview]
Message-ID: <4f7183c4-5a59-4c4d-8f33-a307fad4d7e3@bootlin.com> (raw)
In-Reply-To: <179510815456.3136.11469597684415088@kernel.org>
On 11/19/26 18:09, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 1
>
> 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] This patch is a bug fix but carries no Fixes: tag, and the
> subject reads like a new feature ("Report the VLAN tag type from the…
> - [Low] The ET/LT macro names in dwxgmac2.h disagree with how the new
> dwxgmac2_wrback_get_rx_vlan_proto() reads them.
>
> --
>
> net: stmmac: xgmac: Report the VLAN tag type from the descriptor
>
> This adds a get_rx_vlan_proto() desc op for XGMAC. The op decodes the
> RDES3 ET_LT field and reports either ETH_P_8021AD or ETH_P_8021Q as the
> stripped outer tag type. vlan_rx_hw() now uses that op when it exists and
> keeps ETH_P_8021Q as the fallback.
>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
>> index 6719ac6e395bc..71ce2bc9b5e11 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
>> @@ -76,6 +76,18 @@ static bool dwxgmac2_wrback_get_rx_vlan_valid(struct dma_desc *p)
>> et_lt <= XGMAC_ET_LT_DVLAN_STAG_CTAG;
>> }
>>
>> +static u16 dwxgmac2_wrback_get_rx_vlan_proto(struct dma_desc *p)
>> +{
>> + switch (FIELD_GET(XGMAC_RDES3_ET_LT, le32_to_cpu(p->des3))) {
>> + case XGMAC_ET_LT_VLAN_STAG:
>> + case XGMAC_ET_LT_DVLAN_STAG_STAG:
>> + case XGMAC_ET_LT_DVLAN_CTAG_STAG:
>> + return ETH_P_8021AD;
>> + default:
>> + return ETH_P_8021Q;
>> + }
>> +}
>
> [Severity: Low]
> This isn't a bug, but the macro names in dwxgmac2.h don't match how they
> are used here. The only comment on them is:
>
> drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h:
> /* Error Type or L2 Type(ET/LT) Field Number */
> #define XGMAC_ET_LT_VLAN_STAG 8
> #define XGMAC_ET_LT_VLAN_CTAG 9
> #define XGMAC_ET_LT_DVLAN_CTAG_CTAG 10
> #define XGMAC_ET_LT_DVLAN_STAG_STAG 11
> #define XGMAC_ET_LT_DVLAN_CTAG_STAG 12
> #define XGMAC_ET_LT_DVLAN_STAG_CTAG 13
>
> Read outer-first, XGMAC_ET_LT_DVLAN_CTAG_STAG means an outer C-tag, yet
> dwxgmac2_wrback_get_rx_vlan_proto() returns ETH_P_8021AD for it. Likewise
> XGMAC_ET_LT_DVLAN_STAG_CTAG falls through to ETH_P_8021Q.
>
> The commit message says "note inner/outer is reversed in the macro
> names", but nothing in the tree records that. Could the macros be renamed
> (for example XGMAC_ET_LT_DVLAN_OUTER_STAG_INNER_CTAG), or could a comment
> in dwxgmac2.h give the tag order? Otherwise a future user of these
> constants could easily invert the mapping.
>
> If the names do follow the databook's outer-first order, the mapping for
> values 12 and 13 would be inverted. That can't be checked without the
> databook, so it would help to confirm which reading is correct.
I don't have the databooks. The AgileX5 doc is pretty clear about which
value is what though, we could rename the macros but that's not very
urgent IMO.
>
> [ ... ]
>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
>> index fb9aad748cb34..bf23d82e9f383 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
>> @@ -209,8 +209,12 @@ static void vlan_rx_hw(struct mac_device_info *hw,
>> {
>> if (hw->desc->get_rx_vlan_valid(rx_desc)) {
>> u16 vid = hw->desc->get_rx_vlan_tci(rx_desc);
>> + u16 proto = ETH_P_8021Q;
>>
>> - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
>> + if (hw->desc->get_rx_vlan_proto)
>> + proto = hw->desc->get_rx_vlan_proto(rx_desc);
>> +
>> + __vlan_hwaccel_put_tag(skb, htons(proto), vid);
>
> [Severity: Medium]
> Should this patch carry a Fixes: tag? It looks like it fixes a
> user-visible regression on XGMAC.
>
> On XGMAC, __stmmac_dvr_probe() advertises NETIF_F_HW_VLAN_STAG_RX and
> enables MAC-level stripping by default:
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:__stmmac_dvr_probe() {
> ...
> if (priv->plat->core_type == DWMAC_CORE_XGMAC)
> ndev->features |= NETIF_F_HW_VLAN_STAG_RX;
>
> if (dwmac_is_xmac(priv->plat->core_type)) {
> ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
> priv->hw->hw_vlan_en = true;
> }
> ...
> }
>
> stmmac_fix_features() also keeps STAG_RX tied to CTAG_RX on XGMAC.
> Because of this, every frame with a stripped 802.1ad outer tag went
> through the old vlan_rx_hw() and reached the stack labelled as
> ETH_P_8021Q. 802.1ad VLAN uppers received no traffic and QinQ between
> hosts failed.
>
> The sibling commit da17990421d7 ("net: stmmac: Disable S-Tag processing
> on dwmac4") describes this exact failure and carries a Fixes: tag. Its
> message says the dwxgmac2 side can be fixed using the RDES3 ET_LT field,
> which is what this patch does.
>
> Without a Fixes: tag, stable trees that pick up the dwmac4 half would
> still mislabel S-tags on XGMAC. Would this be a suitable tag?
>
> Fixes: 534df0c1724b ("net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping")
That's not strictly speaking a regression, I'm ok sending this to
net but I'm not sure this is worth.
Maxime
prev parent reply other threads:[~2026-11-20 10:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 16:21 [PATCH net-next] net: stmmac: xgmac: Report the VLAN tag type from the descriptor Maxime Chevallier
2026-11-18 20:09 ` Nicolai Buchwitz
2026-11-19 7:36 ` Maxime Chevallier
2026-11-20 17:13 ` Muhammad Nazim Amirul Nazle Asmade
2026-11-19 17:09 ` netdev-bot+sashiko
2026-11-20 10:22 ` Maxime Chevallier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f7183c4-5a59-4c4d-8f33-a307fad4d7e3@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo.bianconi@oss.qualcomm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
--cc=nb@tipi-net.de \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ovidiu.panait.rb@renesas.com \
--cc=pabeni@redhat.com \
--cc=recv.jo@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox