Re: [Intel-wired-lan] [PATCH bpf-next v5 8/8] selftests: net: add test for XDP_PASS skb checksum invalidation

Stanislav Fomichev <[email protected]> Tue, 21 Jul 2026 16:03:37 -0700
Newsgroups org.osuosl.intel-wired-lan,org.kernel.vger.bpf,org.kernel.vger.linux-doc,org.kernel.vger.linux-kselftest,org.kernel.vger.netdev
Message-ID <[email protected]>
On 07/21, Jakub Kicinski wrote:
> On Mon, 20 Jul 2026 12:32:55 -0700 Stanislav Fomichev wrote:
> > > > (although for gve I might be wrong, there is also gve_rx_skb_csum that only
> > > > does UNNECESSARY).
> > > > 
> > > > I'd wait for Jakub to chime in, but it feels like we should just document
> > > > what we currently do as a recommended approach: for the drivers
> > > > that support COMPLETE, do not report it when the bpf program is attached.
> > > > Both NONE and UNNECESSARY are ok.  
> > > 
> > > I am not completely sure the UNNECESSARY case is different from the COMPLETE
> > > one. What are we supposed to do if the driver reports UNNECESSARY and the ebpf
> > > program modifies some fields covered by the rx-checksum?  
> > 
> > For unnecessary, I think the safe expectation is that the bpf program
> > will update the value of the checksum in the packet if it touches the data?
> 
> Documenting as expected behavior which no driver currently follows 
> is a bit silly. I thought the ask was to sketch out the plan of
> explicitly updating/invalidating the checksum even if we don't
> implement it today?

This is about current drivers that only report UNNECESSARY with xdp: the xdp
prog has to maintain in-packet checksum if it changes the payload. I think
it's a fair assumption?

In terms of documentation, here is what I have on my side, lmk if that makes
sense, roughly:

- TODAY
  - some drivers (correctly) disable reporting COMPLETE when XDP is attached
    - the xdp program has to modify the packet checksum value if it
      changes the payload
  - some drivers (incorrectly?) report COMPLETE for xdp-to-skb path -> unsafe,
    needs to be fixed
    - updating the payload doesn't update skb->csum, so the safest
      option right now is to only do UNNECESSARY with xdp for all drivers
  - the hw test needs to make sure that the csum is either
    NONE or UNNECESSARY, and will error out on COMPLETE

- TOMORROW
  - if we want to properly support COMPLETE, we need a new set of kfuncs
    to update skb->csum value in the skb

Does that make sense?