On Wed, Nov 25, 2026 at 1:08 AM Tianyi Gao <[email protected]> wrote: > > 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.
Realistically speaking there is an easy solution to this in the program itself. It would be to look at using something like the REDIRECT action instead of just stripping the tunnels and passing it back to the original interface. It would then take the frame and stop processing the remaining descriptor data. As it stands that would be the more correct solution as you could then just redirect it to the tunnel interface I assume you have stacked on top of it and have it receive the frame instead of having received it at the interface that just head the header stripped. It would also match up better with how the stack would actually expect this to work if you didn't have the XDP program in place.
