Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Jisheng Zhang
Thu, 22 Oct 2026 11:33
Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
Author: Jisheng Zhang
Date: Thu, 22 Oct 2026 11:33
Date: Thu, 22 Oct 2026 11:33
36 lines
9379 bytes
9379 bytes
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. Thanks
Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
Author: Andrew Lunn
Date: Thu, 22 Oct 2026 13:54
Date: Thu, 22 Oct 2026 13:54
48 lines
10364 bytes
10364 bytes
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
Re: [PATCH] net: stmmac: Disable checksum insertion for XDP frame TX
Author: Jisheng Zhang
Date: Mon, 09 Nov 2026 04:27
Date: Mon, 09 Nov 2026 04:27
64 lines
10739 bytes
10739 bytes
On Thu, Oct 22, 2026 at 03:54:54PM +0200, Andrew Lunn wrote: > 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? I checked ixgbe and i40e. AIUI, their ordinary XDP tx paths don't request checksum insertion: ixgbe_xmit_xdp_ring() leaves the checksum offload bits clear, and i40e_xmit_xdp_ring() supplies no checksum command or header offsets. So this patch likewise changes the descriptor for each XDP frame. NOTE, it doesn't disable checksum for normal skb transmissions. Also disabling insertion doesn't introduce an automatic software checksum calculation. An unchanged forwarded pkt already has its checksum. If an XDP prog modifies checksum-covered fields, it's responsible for updating the checksum. > > 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? This needs XDP common code path changes, I think, it needs a separate discussion.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads