On Wed, Nov 25, 2026 at 10:31 AM Tianyi Gao <[email protected]> wrote:
>
> On Wed, 2026-11-25 at 08:32 -0800, Alexander Duyck wrote:
> > 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.
>
> That is exactly what we are trying to do. Our traffic will be
> redirected anyway, to a cpumap for load balancing. We tried to keep the
> RX metadata across the redirect autonomously in [2], but this has been
> strongly opposed so far [5][6].
>
> [2] https://lore.kernel.org/all/[email protected]/
> [5] https://lore.kernel.org/all/[email protected]/
> [6] https://lore.kernel.org/all/[email protected]/

The thing is once you start making modifications to the frame all that
metadata should probably be thrown out anyway since none of it is
really valid. I would probably treat it like we would a namespace
leak. I get that you want things like the RSS hash to provide some
entropy but it is basically just snooping into fields that you
wouldn't want getting passed on anyway like details about the outer
headers. Same thing for CHECKSUM_UNNECESSARY. It was making
assumptions about the frame that you likely changed, as a result you
can't really trust the flag when it is provided.

If anything, the path you are taking now with disabling
CHECKSUM_COMPLETE is the opposite direction of how I would probably go
about this. If you are wanting something that is more universal
focusing more on CHECKSUM_COMPLETE would more than likely be the way
to go as it doesn't care about what the outer or inner protocols are
and the math is pretty lightweight as you only have to fold in the
header checksums as you modify them and don't have to mess with the
entire frame. Your modified frame could return whatever the value is
that you want to pass out to indicate that it is modified, and you
would then be able to just pass the checksum modification out as part
of the metadata in some expected format that the drivers could then
process.

By disabling it you are basically forcing yourself into a
vendor/protocol lock in as you can only get checksum info on the
packet types the hardware supports. The issue is that
CHECKSUM_UNNECESSARY doesn't convert well to anything once you strip
the header. That is why back in the day we had strongly encouraged
people to use non-zero UDP checksum on their tunnels and had added the
ability to convert the CHECKSUM_UNNECESSARY to CHECKSUM_COMPLETE when
decapsulating generic UDP tunnels. With that we could support most
NICs instead of the 2 or 3 that supported all the new tunnel types
that were coming out that then had to parse all the way to the inner
headers.

Reply via email to