Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tianyi@cloudflare.com
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	john.fastabend@gmail.com, sdf@fomichev.me,
	paul.greenwalt@intel.com, alice.michael@intel.com,
	eric.joyner@intel.com, jbrandeb@kernel.org, lorenzo@kernel.org,
	bpf@vger.kernel.org, kernel-team@cloudflare.com,
	tianyi.gao@linux.dev
Subject: Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
Date: Wed, 25 Nov 2026 01:38:08 +0000	[thread overview]
Message-ID: <179557068810.3135.17964087549504688357@kernel.org> (raw)
In-Reply-To: <20261121012402.84848-1-tianyi@cloudflare.com>

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

      parent reply	other threads:[~2026-11-25  1:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-23 20:35   ` Tianyi Gao
2026-11-23 21:09     ` Alexander Duyck
2026-11-23 22:01       ` Tianyi Gao
2026-11-23 22:42         ` Alexander Duyck
2026-11-23 23:26           ` Tianyi Gao
2026-11-24  0:17             ` Alexander Duyck
2026-11-25  1:38 ` netdev-bot+sashiko [this message]

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=179557068810.3135.17964087549504688357@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alice.michael@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eric.joyner@intel.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jbrandeb@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul.greenwalt@intel.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sdf@fomichev.me \
    --cc=tianyi.gao@linux.dev \
    --cc=tianyi@cloudflare.com \
    /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