Netdev List
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Ong Boon Leong <boon.leong.ong@intel.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: stmmac: disable TX checksum offload for jumbo frames on bugged cores
Date: Tue, 20 Oct 2026 11:08:54 +0800	[thread overview]
Message-ID: <atbbRqSJIJ_glwuf@xhacker> (raw)
In-Reply-To: <ata8k2EVDCDTmeE6@xhacker>

On Tue, Oct 20, 2026 at 08:57:55AM +0800, Jisheng Zhang wrote:
> On Fri, Oct 16, 2026 at 04:18:06PM +0200, Maxime Chevallier wrote:
> > Hi Lorenzo,
> > 
> > On 10/12/26 17:24, Lorenzo Bianconi wrote:
> > > stmmac_xdp_xmit_xdpf() decides TX checksum insertion from the queue COE
> > > capability only:
> > > 
> > > 	csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
> > > 
> > > and lets the enhanced descriptor set TX_CIC_FULL accordingly. On the
> > > bugged_jumbo cores (snps,dwmac-3.40a, snps,dwmac-3.610 and
> > > snps,dwmac-3.710) hardware checksum insertion is broken for jumbo
> > > frames; the skb path works around it by clearing NETIF_F_CSUM_MASK in
> > > stmmac_fix_features() when the MTU exceeds ETH_DATA_LEN, so skbs are
> > > never marked CHECKSUM_PARTIAL and no checksum is inserted. The XDP TX
> > > path bypasses that workaround, so once XDP is allowed at MTU >
> > > ETH_DATA_LEN, jumbo frames sent via XDP_TX or redirected into the
> > > device would leave the interface with a full checksum insertion enabled
> > > on those cores - exactly what the workaround is meant to avoid.
> > > 
> > > Disable checksum insertion for oversized frames on bugged_jumbo cores in
> > > the XDP TX path too.
> 
> Here I want to query a generic rule from netdev maintainers:
> can XDP frame enable HW checksum on dwmac IP? Per my understanding, the
> dwmac can only do HW checksum for normal particular packets layouts, such as
> TCP, UDP. What about if XDP transmits a non-IP frame?

or a generic XDP guide from netdev maintainers:
Since XDP can tranmist arbitrary Eth frames, so how does the eth driver cope
with HW checksum if the HW checksum is intended for supported IP packet
layouts rather than arbitrary layer2 frames?

choices:
c1. Simply disabled HW checksum by default. Then XDP prog must provide
checksums themselves, lost the HW offload cap for IP packets.

c2. detect the frame in eth driver's xdp code path, then enable/disable
HW checksum accordingly. Then how? Any example in exisiting eth drivers
is appreciated.

Thanks in advance

> 
> Correct me if I misunderstood something.
> 
> Thanks
> > > 
> > > Fixes: be8b38a722e6 ("net: stmmac: Add support for XDP_TX action")
> > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > 
> > Looks cleaner to me than the alternative patch from Jisheng :
> > 
> > https://lore.kernel.org/netdev/20260929121025.20821-1-jszhang@kernel.org/
> > 
> > It sure seems there're a lot of people interested in getting XDP/XSK
> > working properly on stmmac :)
> > 
> > Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> > 
> > Maxime
> > 
> > > ---
> > >  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > index ca61ab449e32..0e29c5d04714 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > > @@ -5276,6 +5276,14 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
> > >  		return STMMAC_XDP_CONSUMED;
> > >  	}
> > >  
> > > +	/* Disable TX checksum offload for jumbo frames on cores where
> > > +	 * checksum insertion is broken for oversized frames, matching the
> > > +	 * stmmac_fix_features() workaround used by the skb path.
> > > +	 */
> > > +	if (priv->plat->bugged_jumbo &&
> > > +	    xdp_get_frame_len(xdpf) > ETH_FRAME_LEN)
> > > +		csum = false;
> > > +
> > >  	while (true) {
> > >  		skb_frag_t *frag = i ? &sinfo->frags[i - 1] : NULL;
> > >  		int len = frag ? skb_frag_size(frag) : xdpf->len;
> > > 
> > 

  reply	other threads:[~2026-10-20  3:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 15:24 [PATCH net-next 0/2] stmmac: some XDP fixes in XDP_TX path Lorenzo Bianconi
2026-10-12 15:24 ` [PATCH net-next 1/2] net: stmmac: fix XDP TX DMA address for compound RX pages Lorenzo Bianconi
2026-10-12 19:43   ` Daniel Machon
2026-10-12 20:47     ` Lorenzo Bianconi
2026-10-13  7:54       ` Daniel Machon
2026-10-13 15:27   ` netdev-bot+sashiko
2026-10-13 15:40     ` Lorenzo Bianconi
2026-10-16 14:13   ` Maxime Chevallier
2026-10-12 15:24 ` [PATCH net-next 2/2] net: stmmac: disable TX checksum offload for jumbo frames on bugged cores Lorenzo Bianconi
2026-10-13 15:27   ` netdev-bot+sashiko
2026-10-13 15:33     ` Lorenzo Bianconi
2026-10-19 13:40       ` Paolo Abeni
2026-10-20 13:17         ` Lorenzo Bianconi
2026-10-16 14:18   ` Maxime Chevallier
2026-10-20  0:57     ` Jisheng Zhang
2026-10-20  3:08       ` Jisheng Zhang [this message]
2026-10-20 12:28         ` Andrew Lunn
2026-10-12 15:30 ` [PATCH net-next 0/2] stmmac: some XDP fixes in XDP_TX path netdev-bot+sinfo
2026-10-12 15:52   ` Lorenzo Bianconi
2026-10-19 13:50 ` patchwork-bot+netdevbpf

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=atbbRqSJIJ_glwuf@xhacker \
    --to=jszhang@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=boon.leong.ong@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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