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/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/

Thanks,
Tianyi

Reply via email to