Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
From: Andrew Lunn
Date: Thu Oct 22 2026 - 10:02:28 EST
On Thu, Oct 22, 2026 at 07:33:44PM +0800, Jisheng Zhang wrote:
> On Tue, Sep 29, 2026 at 10:29:14PM +0200, Andrew Lunn wrote:
> > On Tue, Sep 29, 2026 at 08:10:25PM +0800, Jisheng Zhang wrote:
> > > stmmac enables TX checksum insertion for XDP frames whenever the queue
> > > supports it. XDP frames carry no TX checksum offload request, so this
> > > can overwrite a checksum already present in the packet.
> > >
> > > Pass false to stmmac_prepare_tx_desc() when transmitting an XDP frame
> > > so that the packet is sent with its checksum fields unchanged.
> >
> > This seems odd to me.
> >
> > If the frame contains a checksum, it is either correct, and the
> > hardware calculated one will come out the same, not an issue. Or the
> > checksum in the frame is actually wrong, because the frame has got
> > mangled by eBPF before sending it out, and you want the hardware to
> > calculate the correct value.
> >
> > What an i missing?
> >
> Hi Andrew and all,
>
> some discussions happened in below thread
> https://lore.kernel.org/netdev/athAoWfW-xesPhFP@xhacker/
>
> Since it has been merged. Let's move the discussion back to my patch.
>
> AIUI, dwmac can only do HW checksum for normal particular packets
> layouts, such as TCP, UDP etc. The stmmac_has_ip_ethertype() has
> well demostrated this limitation.
> Different with normal tx where the common stack supplies the skb->ip_summed
> metadata, XDP path doesn't have the necessary metadata. So to make
> the XDP always work properly when transmiting tranmist arbitrary Eth
> frames, dwmac HW csum needs to be disabled by default currently.
I don't know the XDP code. But...
Zoom out, look at the big picture:
What do other MAC drivers does? Do they also disable hardware checksum
when XDP is enabled on a queue?
Should XDP actually have the needed meta data? Can it be added in a
low overhead way? Does the overhead of having it cost less than
forcing software check sums?
Andrew