* Re: [PATCH net-next] net: stmmac: Advertise TX checksum offload only when supported
2026-11-19 18:50 [PATCH net-next] net: stmmac: Advertise TX checksum offload only when supported Prabhakar
@ 2026-11-23 20:06 ` netdev-bot+sashiko
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-11-23 20:06 UTC (permalink / raw)
To: prabhakar.csengg
Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni,
mcoquelin.stm32, alexandre.torgue, netdev, linux-stm32,
linux-arm-kernel, linux-renesas-soc, prabhakar.csengg+renesas,
biju.das.jz, fabrizio.castro.jz, prabhakar.mahadev-lad.rj
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] The new advertisement gate in __stmmac_dvr_probe() trusts
plat->tx_coe.
- [Low] The commit message presents this as a bug fix ('This can cause
DSA user ports to inherit checksum offload through vlan_features…
--
net: stmmac: Advertise TX checksum offload only when supported
With this patch, __stmmac_dvr_probe() adds NETIF_F_IP_CSUM and
NETIF_F_IPV6_CSUM to hw_features only when plat->tx_coe is set.
Previously they were always advertised. The goal is to stop DSA user
ports from inheriting TX checksum offload through vlan_features when the
conduit can't do it, for example in threshold DMA mode.
> The driver unconditionally advertises TX checksum offload, even when
> the hardware capability check disables it, such as when threshold DMA
> mode is selected. This can cause DSA user ports to inherit checksum
> offload through vlan_features despite the conduit not supporting it.
[Severity: Low]
This reads as a bug fix, but there's no Fixes: tag, and the message
doesn't say what actually breaks. Is this meant for net or net-next?
Before this patch the conduit's own dev->features was already correct.
stmmac_fix_features() removes the TX checksum bits:
stmmac_fix_features() {
...
if (!priv->plat->tx_coe)
features &= ~NETIF_F_CSUM_MASK;
...
}
So only hw_features and vlan_features were wrong.
For header-tagged DSA traffic, validate_xmit_skb()->skb_csum_hwoffload_help()
on the conduit already falls back to software checksums. Also,
stmmac_features_check() drops CSUM for non-IP ethertypes. In that case
the only effect looks like wrong feature reporting.
Wrong L4 checksums on the wire would come from trailer taggers that rely
on the conduit (tag_trailer, tag_xrs700x). Is that the case this patch
fixes, and could the message say so?
There is also a change users can see in ethtool when tx_coe is false.
tx-checksumming on the stmmac netdev now shows "off [fixed]" instead of
"off [requested on]". Should the message mention that as well?
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index f256244ce0d11..8cb1e3b4030e2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -8224,8 +8224,9 @@ static int __stmmac_dvr_probe(struct device *device,
> ndev->xdp_metadata_ops = &stmmac_xdp_metadata_ops;
> ndev->xsk_tx_metadata_ops = &stmmac_xsk_tx_metadata_ops;
>
> - ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
> - NETIF_F_RXCSUM;
> + ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM;
> + if (priv->plat->tx_coe)
> + ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
[Severity: Medium]
On cores without the DMA HW feature register, does plat->tx_coe reflect
threshold DMA mode by the time this check runs?
The threshold-mode override is applied only inside the hw_cap_support
branch of stmmac_hw_init():
stmmac_hw_init() {
...
if (priv->hw_cap_support) {
...
/* TXCOE doesn't work in thresh DMA mode */
if (priv->plat->force_thresh_dma_mode)
priv->plat->tx_coe = false;
else
priv->plat->tx_coe = priv->dma_cap.tx_coe;
...
} else {
dev_info(priv->device, "No HW DMA feature register supported\n");
}
...
}
Older GMACs such as 3.40a don't have this register. There,
dwmac1000_get_hw_feature() reads 0 and returns -EOPNOTSUPP, so the else
branch runs and tx_coe keeps the value the platform set.
For "snps,dwmac-3.40a", stmmac_probe_config_dt() sets that value
statically:
if (of_device_is_compatible(np, "snps,dwmac-3.40a")) {
...
plat->tx_coe = true;
It reads "snps,force_thresh_dma_mode" for any compatible. Nothing makes
the two settings agree.
If both are set, stmmac_dma_operation_mode() checks force_thresh_dma_mode
first:
if (priv->plat->force_thresh_dma_mode) {
rxmode = tc;
} else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
The TX channels are then programmed in threshold mode with tx_threshold[],
while tx_coe stays true.
In that setup the new check still adds NETIF_F_IP_CSUM and
NETIF_F_IPV6_CSUM to hw_features, features and vlan_features. That is the
DSA case the commit message describes. stmmac_fix_features() keeps the
bits because it also checks only tx_coe. stmmac_xmit() then requests HW
checksum insertion for CHECKSUM_PARTIAL skbs.
The driver comment says TX COE doesn't work in threshold mode. If the
hardware really skips it, won't those frames go out with only the
pseudo-header partial checksum?
No in-tree DT seems to combine dwmac-3.40a with
snps,force_thresh_dma_mode (spear3xx.dtsi uses 3.40a without it). This
may not be reachable with current in-tree users.
Would it fix this to move the force_thresh_dma_mode check that clears
tx_coe out of the hw_cap_support branch?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119185016.1789843-1-prabhakar.mahadev-lad.rj%40bp.renesas.com
^ permalink raw reply [flat|nested] 2+ messages in thread