All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tianyi Gao <tianyi@cloudflare.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.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>,
	Simon Horman <horms@kernel.org>,
	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>,
	Paul Greenwalt <paul.greenwalt@intel.com>,
	Alice Michael <alice.michael@intel.com>,
	Eric Joyner <eric.joyner@intel.com>,
	Jesse Brandeburg <jbrandeb@kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	bpf@vger.kernel.org, kernel-team@cloudflare.com,
	tianyi.gao@linux.dev,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: Re: [PATCH net] ice: do not report CHECKSUM_COMPLETE when an XDP program is attached
Date: Wed, 25 Nov 2026 09:07:32 +0000	[thread overview]
Message-ID: <20261125090732.69233-1-tianyi@cloudflare.com> (raw)
In-Reply-To: <CAKgT0UeNyyXKARjKR4nVVxNe3UB16WuXqxSz0cf4ZvCdb9A4_Q@mail.gmail.com>

On Mon, 2026-11-23 at 16:17 -0800, Alexander Duyck wrote:
> 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.

Thank you for your valuable comments.

Clearing the flag in ndo_bpf alone is not enough, because
ice_vsi_alloc_rings() sets it again on a VSI rebuild, for example after
"ethtool -L" or a PF reset, while the program stays attached.

In v2 I will set ICE_RX_FLAGS_RING_GCS in ice_vsi_cfg_rxq(), which runs
every time a ring comes up, similar to what mlx5 does when it opens the
RQ.

v2 also logs an info message when a program is attached on a port
with GCS. I tested it on E830 with attach, detach and "ethtool -L",
and I will send it soon.

> 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.

100% agree. We should be able to tell whether a frame was modified,
keep CHECKSUM_COMPLETE for the frames that were not, and give XDP
programs kfuncs to read and set the checksum status.

Unfortunately, today there is a big gap before we start that:

- [1] lets a program read the checksum status, including the
  CHECKSUM_COMPLETE value.
- [2] lets a program set CHECKSUM_NONE or CHECKSUM_UNNECESSARY with
  csum_level on the skb.
- Nothing lets a program pass a corrected CHECKSUM_COMPLETE value to
  the skb. [3] lists this as future work.

> 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.

From roughly looking at the code path, ICMP does use it.
icmp_rcv() trusts CHECKSUM_UNNECESSARY, so after decap the inner ICMP
checksum is not checked. TCP and UDP are the same. This is the decap
case left open in [3]. E810 and mlx5 with XDP behave the same today,
and this patch does not change it.

[1] https://lore.kernel.org/all/20260715-bpf-xdp-meta-rxcksum-v5-0-623d5c0d0ab7@kernel.org/
[2] https://lore.kernel.org/all/cover.1794281983.git.tianyi@cloudflare.com/
[3] https://lore.kernel.org/all/20260721183256.6f49d6e1@kernel.org/

Thanks,
Tianyi

  reply	other threads:[~2026-11-25  9:07 UTC|newest]

Thread overview: 17+ 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  9:07               ` Tianyi Gao [this message]
2026-11-25 16:32                 ` Alexander Duyck
2026-11-25 18:31                   ` Tianyi Gao
2026-11-25 22:02                     ` Alexander Duyck
2026-11-25 22:44                       ` Tianyi Gao
2026-11-25  1:38 ` netdev-bot+sashiko
2026-11-25  9:00   ` Tianyi Gao

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=20261125090732.69233-1-tianyi@cloudflare.com \
    --to=tianyi@cloudflare.com \
    --cc=alexander.duyck@gmail.com \
    --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=maciej.fijalkowski@intel.com \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.