* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-21 1:24 [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached Tianyi Gao
@ 2026-11-23 18:29 ` Maciej Fijalkowski
2026-11-23 20:50 ` Tianyi Gao
2026-11-23 18:49 ` Alexander H Duyck
2026-11-25 1:38 ` netdev-bot+sashiko
2 siblings, 1 reply; 11+ messages in thread
From: Maciej Fijalkowski @ 2026-11-23 18:29 UTC (permalink / raw)
To: Tianyi Gao
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Sat, Nov 21, 2026 at 01:24:02AM +0000, Tianyi Gao wrote:
> On E830, ice reports CHECKSUM_COMPLETE with the generic checksum (GCS)
> that the hardware computes over the received frame. If an XDP program
> changes the packet and returns XDP_PASS, that checksum no longer
> matches. The stack then checks the packet again in software and calls
> netdev_rx_csum_fault().
>
> On Cloudflare servers, an XDP load balancer removes the encapsulation
> of the packets that it accepts locally. Our production traffic hits
> netdev_rx_csum_fault() all the time.
>
> Do not use GCS when the ring has an XDP program, as mlx5 has done since
> commit 5d0bb3bac4b9 ("net/mlx5e: XDP, Avoid checksum complete when XDP
> prog is loaded").
>
> E830 also sets the L3L4P and checksum error bits, so the packet gets
> CHECKSUM_UNNECESSARY or CHECKSUM_NONE, as on E810. For example, a zero
> UDP checksum over IPv6 is marked as bad and gets CHECKSUM_NONE. A zero
> UDP checksum over IPv4 gets CHECKSUM_UNNECESSARY.
>
> Two pending series [1][2] give XDP access to the checksum status.
> Neither of them supports CHECKSUM_COMPLETE.
>
> ice_rx_csum() reads rx_ring->xdp_prog again after the poll loop ran XDP.
> While ICE_VSI_REBUILD_PENDING is set, ice_xdp_setup_prog() can replace
> the program without stopping NAPI, so the two reads can differ. At
> worst, a packet in that poll gets CHECKSUM_COMPLETE as before this
> patch. The pointer is only compared with NULL, so this cannot crash.
>
> Link: https://lore.kernel.org/all/20260715-bpf-xdp-meta-rxcksum-v5-0-623d5c0d0ab7@kernel.org/ [1]
> Link: https://lore.kernel.org/all/cover.1794281983.git.tianyi@cloudflare.com/ [2]
> Fixes: 905d1a220e8d ("ice: Add E830 checksum offload support")
> Suggested-by: Jesse Brandeburg <jbrandeb@kernel.org>
> Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> Tested on an E830 (8086:12d2, board N31483-007, fw.mgmt 7.9.5, DDP ICE
> COMMS 1.3.63.0) with an XDP program that removes a UDP encapsulation
> header with bpf_xdp_adjust_head() and returns XDP_PASS. The kernel was
> based on 6.18.64, where ice_rx_csum() is the same as in net:
>
> - Before: 63322069 netdev_rx_csum_fault() calls in 30 s.
> - After: 0.
> - Without an XDP program, the port still reports CHECKSUM_COMPLETE.
>
> On an E810, which has no GCS, drivers/net/xdp.py, ping.py and
> hw/csum.py give the same results with and without this patch.
>
> Request for comment: I also prepared a drv-net selftest for net-next.
> It removes 16 bytes from the UDP payload with bpf_xdp_adjust_head()
> and fails if the packet reaches the stack with CHECKSUM_COMPLETE. I am
> not sure we want to enforce this for all NICs, so asking here.
Anyone else besides mlx5 behaving this way?
>
> drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> index e695a664e53d..ad22d855436e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> @@ -123,6 +123,7 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
> rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
>
> if ((ring->flags & ICE_RX_FLAGS_RING_GCS) &&
> + !READ_ONCE(ring->xdp_prog) &&
> rx_desc->wb.rxdid == ICE_RXDID_FLEX_NIC &&
> (decoded.inner_prot == LIBETH_RX_PT_INNER_TCP ||
> decoded.inner_prot == LIBETH_RX_PT_INNER_UDP ||
>
> base-commit: 92e97d7cffc7ec6adfa4699203c18b1ab0c8b314
> --
> 2.56.0
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 18:29 ` Maciej Fijalkowski
@ 2026-11-23 20:50 ` Tianyi Gao
0 siblings, 0 replies; 11+ messages in thread
From: Tianyi Gao @ 2026-11-23 20:50 UTC (permalink / raw)
To: Maciej Fijalkowski
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, Nov 23, 2026 at 07:29:08PM +0100, Maciej Fijalkowski wrote:
> Anyone else besides mlx5 behaving this way?
Thanks for the ack, Maciej.
From roughly analyzing the code, no. At least fbnic, gve, idpf, enetc,
ionic, mlx4 and nfp report CHECKSUM_COMPLETE with an XDP program
attached too, and I am not sure this list is exhaustive. So I am
wondering whether we should enforce it for all drivers, with the
drv-net selftest I mentioned.
The existing tests in xdp.py (test_xdp_native_adjst_head_* and
test_xdp_native_adjst_tail_*) already change the frame and return
XDP_PASS, but they only check the payload. A stale CHECKSUM_COMPLETE is
only reported silently as "hw csum failure" in dmesg, so they still
pass. Could you check the dmesg of the ice-E830-XXV2 NIPA runner?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-21 1:24 [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached Tianyi Gao
2026-11-23 18:29 ` Maciej Fijalkowski
@ 2026-11-23 18:49 ` Alexander H Duyck
2026-11-23 20:35 ` Tianyi Gao
2026-11-25 1:38 ` netdev-bot+sashiko
2 siblings, 1 reply; 11+ messages in thread
From: Alexander H Duyck @ 2026-11-23 18:49 UTC (permalink / raw)
To: Tianyi Gao, netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Sat, 2026-11-21 at 01:24 +0000, Tianyi Gao wrote:
> On E830, ice reports CHECKSUM_COMPLETE with the generic checksum (GCS)
> that the hardware computes over the received frame. If an XDP program
> changes the packet and returns XDP_PASS, that checksum no longer
> matches. The stack then checks the packet again in software and calls
> netdev_rx_csum_fault().
>
> On Cloudflare servers, an XDP load balancer removes the encapsulation
> of the packets that it accepts locally. Our production traffic hits
> netdev_rx_csum_fault() all the time.
>
> Do not use GCS when the ring has an XDP program, as mlx5 has done since
> commit 5d0bb3bac4b9 ("net/mlx5e: XDP, Avoid checksum complete when XDP
> prog is loaded").
>
> E830 also sets the L3L4P and checksum error bits, so the packet gets
> CHECKSUM_UNNECESSARY or CHECKSUM_NONE, as on E810. For example, a zero
> UDP checksum over IPv6 is marked as bad and gets CHECKSUM_NONE. A zero
> UDP checksum over IPv4 gets CHECKSUM_UNNECESSARY.
>
> Two pending series [1][2] give XDP access to the checksum status.
> Neither of them supports CHECKSUM_COMPLETE.
>
> ice_rx_csum() reads rx_ring->xdp_prog again after the poll loop ran XDP.
> While ICE_VSI_REBUILD_PENDING is set, ice_xdp_setup_prog() can replace
> the program without stopping NAPI, so the two reads can differ. At
> worst, a packet in that poll gets CHECKSUM_COMPLETE as before this
> patch. The pointer is only compared with NULL, so this cannot crash.
>
> Link: https://lore.kernel.org/all/20260715-bpf-xdp-meta-rxcksum-v5-0-623d5c0d0ab7@kernel.org/ [1]
> Link: https://lore.kernel.org/all/cover.1794281983.git.tianyi@cloudflare.com/ [2]
> Fixes: 905d1a220e8d ("ice: Add E830 checksum offload support")
> Suggested-by: Jesse Brandeburg <jbrandeb@kernel.org>
> Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
> ---
> Tested on an E830 (8086:12d2, board N31483-007, fw.mgmt 7.9.5, DDP ICE
> COMMS 1.3.63.0) with an XDP program that removes a UDP encapsulation
> header with bpf_xdp_adjust_head() and returns XDP_PASS. The kernel was
> based on 6.18.64, where ice_rx_csum() is the same as in net:
>
> - Before: 63322069 netdev_rx_csum_fault() calls in 30 s.
> - After: 0.
> - Without an XDP program, the port still reports CHECKSUM_COMPLETE.
>
> On an E810, which has no GCS, drivers/net/xdp.py, ping.py and
> hw/csum.py give the same results with and without this patch.
>
> Request for comment: I also prepared a drv-net selftest for net-next.
> It removes 16 bytes from the UDP payload with bpf_xdp_adjust_head()
> and fails if the packet reaches the stack with CHECKSUM_COMPLETE. I am
> not sure we want to enforce this for all NICs, so asking here.
>
> drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> index e695a664e53d..ad22d855436e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> @@ -123,6 +123,7 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
> rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
>
> if ((ring->flags & ICE_RX_FLAGS_RING_GCS) &&
> + !READ_ONCE(ring->xdp_prog) &&
> rx_desc->wb.rxdid == ICE_RXDID_FLEX_NIC &&
> (decoded.inner_prot == LIBETH_RX_PT_INNER_TCP ||
> decoded.inner_prot == LIBETH_RX_PT_INNER_UDP ||
>
> base-commit: 92e97d7cffc7ec6adfa4699203c18b1ab0c8b314
I'm not sure this is the best fix for this. If we are needing all NICs
that support CHECKSUM_COMPLETE *and* XDP to report CHECKSUM_NONE in the
event of a frame being modified by XDP it really feels like we should
probably look at moving this further up the stack.
Otherwise the proper fix for this is probably going to need to be
spread out to far more drivers as I suspect the intersection of the two
is likely not that uncommon.
Also even if we go the multiple driver fix route I wonder if we
shouldn't look at adding a new XDP return type to indicate that we are
passing a modified frame so that we don't have every XDP program out
there forcing NICs into a state where they have to start turning off
various offloads across the board when they don't need to.
What we are going to end up with this current path is one group of XDP
programs dragging down the performance of others since they will take
the penalty for the ones that are making the dirty modifications.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 18:49 ` Alexander H Duyck
@ 2026-11-23 20:35 ` Tianyi Gao
2026-11-23 21:09 ` Alexander Duyck
0 siblings, 1 reply; 11+ messages in thread
From: Tianyi Gao @ 2026-11-23 20:35 UTC (permalink / raw)
To: Alexander H Duyck
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, 2026-11-23 at 10:49 -0800, Alexander H Duyck wrote:
> I'm not sure this is the best fix for this. If we are needing all NICs
> that support CHECKSUM_COMPLETE *and* XDP to report CHECKSUM_NONE in the
> event of a frame being modified by XDP it really feels like we should
> probably look at moving this further up the stack.
Thanks for the review, Alex.
IMHO we should first make sure XDP programs do not cause "hw csum
failure" in current kernels. Whatever an XDP program does, it should
not be able to trigger a hw csum failure. It's not an uncommon use
case, e.g., Katran from Meta [3] and Cloudflare's load balancer. And
existing selftests already do it (test_xdp_native_adjst_head_* and
test_xdp_native_adjst_tail_* in
tools/testing/selftests/drivers/net/xdp.py).
> Also even if we go the multiple driver fix route I wonder if we
> shouldn't look at adding a new XDP return type to indicate that we are
> passing a modified frame
IMHO that is for net-next. There we can add optimizations, such as a
way to keep CHECKSUM_COMPLETE for programs that do not change the
frame, potentially after [1] or [2] is accepted.
[3] https://github.com/facebookincubator/katran/blob/13a0d69221e43b4941b81303e6726ddc61a12169/katran/lib/bpf/pckt_encap.h#L137
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 20:35 ` Tianyi Gao
@ 2026-11-23 21:09 ` Alexander Duyck
2026-11-23 22:01 ` Tianyi Gao
0 siblings, 1 reply; 11+ messages in thread
From: Alexander Duyck @ 2026-11-23 21:09 UTC (permalink / raw)
To: Tianyi Gao
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, Nov 23, 2026 at 12:35 PM Tianyi Gao <tianyi@cloudflare.com> wrote:
>
> On Mon, 2026-11-23 at 10:49 -0800, Alexander H Duyck wrote:
> > I'm not sure this is the best fix for this. If we are needing all NICs
> > that support CHECKSUM_COMPLETE *and* XDP to report CHECKSUM_NONE in the
> > event of a frame being modified by XDP it really feels like we should
> > probably look at moving this further up the stack.
>
> Thanks for the review, Alex.
>
> IMHO we should first make sure XDP programs do not cause "hw csum
> failure" in current kernels. Whatever an XDP program does, it should
> not be able to trigger a hw csum failure. It's not an uncommon use
> case, e.g., Katran from Meta [3] and Cloudflare's load balancer. And
> existing selftests already do it (test_xdp_native_adjst_head_* and
> test_xdp_native_adjst_tail_* in
> tools/testing/selftests/drivers/net/xdp.py).
That is exactly my point though. What we have is a divergence between
a number of the existing drivers in how they handle these things. As a
result the behavior is currently different depending on which NIC is
in use.
For example, one recent one I saw was an issue on the Tx side where an
outgoing XDP program was modifying the frame and actually not updating
the pseudoheader checksum. As a result it was breaking Tx checksum
offloads for NICs that were using the HW_CSUM that used that checksum
header. We could have fixed it by forcing all the drivers to
recalculate the pseudo-header checksum, but instead we pushed back on
the program that was making that change.
> > Also even if we go the multiple driver fix route I wonder if we
> > shouldn't look at adding a new XDP return type to indicate that we are
> > passing a modified frame
>
> IMHO that is for net-next. There we can add optimizations, such as a
> way to keep CHECKSUM_COMPLETE for programs that do not change the
> frame, potentially after [1] or [2] is accepted.
The point is you are fixing things for your use case, but anybody who
is using the CHECKSUM_COMPLETE to compute the checksum on the frames
and using XDP without changing the frames will see this as a
significant performance regression.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 21:09 ` Alexander Duyck
@ 2026-11-23 22:01 ` Tianyi Gao
2026-11-23 22:42 ` Alexander Duyck
0 siblings, 1 reply; 11+ messages in thread
From: Tianyi Gao @ 2026-11-23 22:01 UTC (permalink / raw)
To: Alexander Duyck
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, 2026-11-23, Alexander H Duyck wrote:
> For example, one recent one I saw was an issue on the Tx side where
> an outgoing XDP program was modifying the frame and actually not
> updating the pseudoheader checksum. As a result it was breaking Tx
> checksum offloads for NICs that were using the HW_CSUM that used
> that checksum header. We could have fixed it by forcing all the
> drivers to recalculate the pseudo-header checksum, but instead we
> pushed back on the program that was making that change.
Thank you for the explanation, Alex.
On Tx the checksum is in the frame, so the program can fix it. On Rx
the program can't touch skb->csum at all, so there is nothing to push
back on.
> The point is you are fixing things for your use case, but anybody
> who is using the CHECKSUM_COMPLETE to compute the checksum on the
> frames and using XDP without changing the frames will see this as a
> significant performance regression.
Without GCS, TCP and UDP still get CHECKSUM_UNNECESSARY, same as
E810. GCS only came in v6.15, so this just puts E830 with XDP back
to where it was.
The cases I can think of that are truly impacted are IPv6 with
extension headers, and UDP tunnels that the NIC does not parse and
that have a zero outer checksum. These fall back to software
checksum.
And programs that do change the frame are worse off today. Every
packet gets summed again in software, plus the "hw csum failure".
I don't see a fix that meets all of these:
1. It is small enough and can be backported to stable.
2. It fixes the problem fully. We could drop CHECKSUM_COMPLETE only
when the program moved data or data_end, but some in-place
writes, e.g. NAT or the IPv6 hop limit, would still trigger
"hw csum failure". IMO that brings more problems.
3. It keeps CHECKSUM_COMPLETE for programs that do not change the
frame. But that looks like a bigger change, which doesn't fit
net.
If you have one, I am happy to take it. Otherwise, as I understand
it, the choice is between:
1. A performance regression for some programs, but no "hw csum
failure".
2. No regression for those programs, but "hw csum failure" stays
for programs that change the frame.
I would like to know how the community normally decides between
these.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 22:01 ` Tianyi Gao
@ 2026-11-23 22:42 ` Alexander Duyck
2026-11-23 23:26 ` Tianyi Gao
0 siblings, 1 reply; 11+ messages in thread
From: Alexander Duyck @ 2026-11-23 22:42 UTC (permalink / raw)
To: Tianyi Gao
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, Nov 23, 2026 at 2:01 PM Tianyi Gao <tianyi@cloudflare.com> wrote:
>
> On Mon, 2026-11-23, Alexander H Duyck wrote:
> > For example, one recent one I saw was an issue on the Tx side where
> > an outgoing XDP program was modifying the frame and actually not
> > updating the pseudoheader checksum. As a result it was breaking Tx
> > checksum offloads for NICs that were using the HW_CSUM that used
> > that checksum header. We could have fixed it by forcing all the
> > drivers to recalculate the pseudo-header checksum, but instead we
> > pushed back on the program that was making that change.
>
> Thank you for the explanation, Alex.
>
> On Tx the checksum is in the frame, so the program can fix it. On Rx
> the program can't touch skb->csum at all, so there is nothing to push
> back on.
>
> > The point is you are fixing things for your use case, but anybody
> > who is using the CHECKSUM_COMPLETE to compute the checksum on the
> > frames and using XDP without changing the frames will see this as a
> > significant performance regression.
>
> Without GCS, TCP and UDP still get CHECKSUM_UNNECESSARY, same as
> E810. GCS only came in v6.15, so this just puts E830 with XDP back
> to where it was.
>
> The cases I can think of that are truly impacted are IPv6 with
> extension headers, and UDP tunnels that the NIC does not parse and
> that have a zero outer checksum. These fall back to software
> checksum.
>
> And programs that do change the frame are worse off today. Every
> packet gets summed again in software, plus the "hw csum failure".
>
> I don't see a fix that meets all of these:
>
> 1. It is small enough and can be backported to stable.
> 2. It fixes the problem fully. We could drop CHECKSUM_COMPLETE only
> when the program moved data or data_end, but some in-place
> writes, e.g. NAT or the IPv6 hop limit, would still trigger
> "hw csum failure". IMO that brings more problems.
> 3. It keeps CHECKSUM_COMPLETE for programs that do not change the
> frame. But that looks like a bigger change, which doesn't fit
> net.
>
> If you have one, I am happy to take it. Otherwise, as I understand
> it, the choice is between:
>
> 1. A performance regression for some programs, but no "hw csum
> failure".
> 2. No regression for those programs, but "hw csum failure" stays
> for programs that change the frame.
>
> I would like to know how the community normally decides between
> these.
The thing is your fix isn't really complete. As I said it is primarily
just addressing your use case and sweeping follow-on issues under the
rug. In the mlx5e case they were disabling the feature via the private
control flag if it was enabled. In the case of your change you are
just disabling it without exposing that it is disabled.
From what I can tell you are just bypassing the checksum complete
logic, but you don't exit out of the function as a result. What
effects is that having on frames that would have been normally
checksum complete? Specifically, is it being treated as though the
frame is unrecognized, or is it falling through into the
CHECKSUM_UNNECESSARY path with all the indications that a tunnel was
still there even though you stripped the header?
The issue is that the driver is making a number of assumptions about
what is there based on what the hardware parsed for headers and such.
With the headers being stripped and/or replaced those aren't correct
anymore. That is why we should probably be looking at dropping more of
the existing logic or forcing a rescan of the packet once the headers
are replaced to update the descriptor data for the skb configuration.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 22:42 ` Alexander Duyck
@ 2026-11-23 23:26 ` Tianyi Gao
2026-11-24 0:17 ` Alexander Duyck
0 siblings, 1 reply; 11+ messages in thread
From: Tianyi Gao @ 2026-11-23 23:26 UTC (permalink / raw)
To: Alexander Duyck
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
Hi Alex,
Thank you for being so responsive, and I really appreciate it.
On Mon, 2026-11-23 at 14:42 -0800, Alexander Duyck wrote:
> In the mlx5e case they were disabling the feature via the private
> control flag if it was enabled. In the case of your change you are
> just disabling it without exposing that it is disabled.
mlx5 does not change the private flag when a program is attached. It
sets MLX5E_RQ_STATE_NO_CSUM_COMPLETE on the RQ, and
rx_no_csum_complete keeps its value ("off" by default).
> is it falling through into the CHECKSUM_UNNECESSARY path with all
> the indications that a tunnel was still there even though you
> stripped the header?
Yes, the same path as E810, and mlx5 does the same with a program
attached.
> The issue is that the driver is making a number of assumptions about
> what is there based on what the hardware parsed for headers and such.
This was discussed in the thread of [1], including the decap problem
with csum_level. The summary there was that reporting
CHECKSUM_COMPLETE on the XDP-to-skb path is unsafe, and that the
safest option for now is CHECKSUM_UNNECESSARY only [3]. The decap
case with CHECKSUM_UNNECESSARY was left open as a known problem.
I am also working on the long-term design in [2], though there is
still a long way to go. Please take a look if you are interested.
For this patch, my aim is simple: stop the "hw csum failure", and
make E830 with XDP report RX checksums the same way as E810, i.e. as
before GCS was added.
[3] https://lore.kernel.org/all/20260721183256.6f49d6e1@kernel.org/
Thanks,
Tianyi
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-23 23:26 ` Tianyi Gao
@ 2026-11-24 0:17 ` Alexander Duyck
0 siblings, 0 replies; 11+ messages in thread
From: Alexander Duyck @ 2026-11-24 0:17 UTC (permalink / raw)
To: Tianyi Gao
Cc: netdev, intel-wired-lan, Tony Nguyen, Przemek Kitszel,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Paul Greenwalt, Alice Michael, Eric Joyner, Jesse Brandeburg,
Lorenzo Bianconi, bpf, kernel-team, tianyi.gao
On Mon, Nov 23, 2026 at 3:26 PM Tianyi Gao <tianyi@cloudflare.com> wrote:
>
> Hi Alex,
>
> Thank you for being so responsive, and I really appreciate it.
>
> On Mon, 2026-11-23 at 14:42 -0800, Alexander Duyck wrote:
> > In the mlx5e case they were disabling the feature via the private
> > control flag if it was enabled. In the case of your change you are
> > just disabling it without exposing that it is disabled.
>
> mlx5 does not change the private flag when a program is attached. It
> sets MLX5E_RQ_STATE_NO_CSUM_COMPLETE on the RQ, and
> rx_no_csum_complete keeps its value ("off" by default).
>
> > is it falling through into the CHECKSUM_UNNECESSARY path with all
> > the indications that a tunnel was still there even though you
> > stripped the header?
>
> Yes, the same path as E810, and mlx5 does the same with a program
> attached.
>
> > The issue is that the driver is making a number of assumptions about
> > what is there based on what the hardware parsed for headers and such.
>
> This was discussed in the thread of [1], including the decap problem
> with csum_level. The summary there was that reporting
> CHECKSUM_COMPLETE on the XDP-to-skb path is unsafe, and that the
> safest option for now is CHECKSUM_UNNECESSARY only [3]. The decap
> case with CHECKSUM_UNNECESSARY was left open as a known problem.
>
> I am also working on the long-term design in [2], though there is
> still a long way to go. Please take a look if you are interested.
>
> For this patch, my aim is simple: stop the "hw csum failure", and
> make E830 with XDP report RX checksums the same way as E810, i.e. as
> before GCS was added.
>
> [3] https://lore.kernel.org/all/20260721183256.6f49d6e1@kernel.org/
>
> Thanks,
> Tianyi
Any reason why you couldn't just strip the GCS enable flags from the
rings when you add the XDP program in ndo_bpf instead of having to add
a check for every packet if the XDP program is present? That would be
closer to what they did for the Mellanox NIC and wouldn't be adding
code to the hot path. Then it is just a matter of also adding an info
message that you are disabling this in the log so if somebody does
have to figure out a regression it should be more obvious.
Thinking in terms of what the final fix for this might look like,
currently the drivers are already starting to carry stuff for frags to
determine if they support jumbo frames via frags or not. I suspect we
will likely need to do something similar when the time comes
indicating if the program can avoid corrupting a checksum or not when
it is stripping headers.
I am not super thrilled with the idea of this becoming standardized.
In theory this would be much better if there was some way to pass the
data out that the frame was mangled and what the checksum adjustment
is to the total frame. As it stands we are probably going to be
getting CHECKSUM_UNNECESSARY on everything even if we don't expect it.
For example I don't know what will happen with an ICMP frame sent over
this tunnel. I assume it is likely just discaring the
CHECKSUM_UNECESSARY since it isn't used.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
2026-11-21 1:24 [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached Tianyi Gao
2026-11-23 18:29 ` Maciej Fijalkowski
2026-11-23 18:49 ` Alexander H Duyck
@ 2026-11-25 1:38 ` netdev-bot+sashiko
2 siblings, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-11-25 1:38 UTC (permalink / raw)
To: tianyi
Cc: netdev, intel-wired-lan, anthony.l.nguyen, przemyslaw.kitszel,
andrew+netdev, davem, edumazet, kuba, pabeni, horms, ast, daniel,
hawk, john.fastabend, sdf, paul.greenwalt, alice.michael,
eric.joyner, jbrandeb, lorenzo, bpf, kernel-team, tianyi.gao
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] On E830 with an XDP program attached, ice_rx_csum()
(drivers/net/ethernet/intel/ice/ice_txrx_lib.c) now skips ice_rx_gcs()…
- [Low] ice_rx_csum() decides whether to use GCS/CHECKSUM_COMPLETE by
reading ring->xdp_prog again with `!READ_ONCE(ring->xdp_prog)`…
--
ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
This patch stops ice_rx_csum() from using the E830 generic checksum (GCS)
to report CHECKSUM_COMPLETE when the rx ring has an XDP program attached,
because an XDP_PASS program may have modified the frame. Such packets now
take the L3L4P/XSUM_* descriptor status path, as on E810.
Link: https://lore.kernel.org/all/20260715-bpf-xdp-meta-rxcksum-v5-0-623d5c0d0ab7@kernel.org/ [1]
Link: https://lore.kernel.org/all/cover.1794281983.git.tianyi@cloudflare.com/ [2]
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> index e695a664e53d1..ad22d855436eb 100644
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> @@ -123,6 +123,7 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
> rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
>
> if ((ring->flags & ICE_RX_FLAGS_RING_GCS) &&
> + !READ_ONCE(ring->xdp_prog) &&
[Severity: Medium]
With an XDP program attached, E830 packets now go to the L3L4P/XSUM_*
status path further down in ice_rx_csum(). Can that path mark a modified
packet CHECKSUM_UNNECESSARY based on how the hardware parsed the original
frame?
ice_rx_csum() runs after XDP has already run:
ice_clean_rx_irq()
ice_run_xdp() /* returns XDP_PASS */
ice_process_skb_fields()
ice_rx_csum()
The same thing happens in ice_clean_rx_irq_zc() via ice_run_xdp_zc().
Take the load balancer case from the commit message. The program strips
a UDP encapsulation with bpf_xdp_adjust_head() and returns XDP_PASS.
If the outer UDP port is not a configured VXLAN/GENEVE port, the parser
does not treat the frame as a tunnel. The L4 status bits then describe
only the outer UDP checksum. A zero outer UDP checksum over IPv4 ends up
here:
if (decoded.tunnel_type >= LIBETH_RX_PT_TUNNEL_IP_GRENAT)
skb->csum_level = 1;
skb->ip_summed = CHECKSUM_UNNECESSARY;
After decapsulation, the outermost L4 header is the inner TCP/UDP header.
The stack skips that checksum, and nothing has verified it. If the parser
did recognise the tunnel, csum_level = 1 is applied to a packet that is
no longer tunnelled.
Before this patch, the stale CHECKSUM_COMPLETE value made the stack
recompute the checksum in software. Good packets passed with a
netdev_rx_csum_fault() warning, and corrupted ones were dropped.
The commit message says:
E830 also sets the L3L4P and checksum error bits, so the packet gets
CHECKSUM_UNNECESSARY or CHECKSUM_NONE, as on E810.
E810 already behaves this way, and so does mlx5, where
MLX5E_RQ_STATE_NO_CSUM_COMPLETE leads to csum_unnecessary. On E830,
though, corrupted packets on these rings used to be caught in software.
Would CHECKSUM_NONE be a safer fallback here until the pending XDP
checksum hint series land? If not, could the commit message describe
this trade-off?
[Severity: Low]
Should this use the per-poll snapshot instead of reading ring->xdp_prog
a second time? The program that actually ran comes from:
ice_clean_rx_irq():
xdp_prog = READ_ONCE(rx_ring->xdp_prog);
...
xdp_verdict = ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_desc);
ice_clean_rx_irq_zc() takes the same kind of snapshot for
ice_run_xdp_zc(). Neither function passes the snapshot to
ice_process_skb_fields().
The commit message already mentions the window this opens.
ice_prepare_for_reset() sets ICE_VSI_REBUILD_PENDING before calling
ice_pf_dis_all_vsi(). ice_dis_vsi() then has to take rtnl_lock before
ice_vsi_close() can stop NAPI. An XDP detach that holds rtnl during that
window gets here:
ice_xdp_setup_prog():
if (ice_is_xdp_ena_vsi(vsi) == !!prog ||
test_bit(ICE_VSI_REBUILD_PENDING, vsi->state)) {
ice_vsi_assign_bpf_prog(vsi, prog);
return 0;
}
ice_vsi_assign_bpf_prog() writes NULL to rx_ring->xdp_prog while NAPI
is still running. Suppose a poll runs the old program on a packet and
gets XDP_PASS. ice_rx_csum() then reads NULL here and reports the stale
GCS value as CHECKSUM_COMPLETE.
Both callers of ice_process_skb_fields() already know whether a program
ran. Would passing that down close this window and also save a
per-packet load?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121012402.84848-1-tianyi%40cloudflare.com
^ permalink raw reply [flat|nested] 11+ messages in thread