All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf.kernel@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	Donald Hunter <donald.hunter@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	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>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Vladimir Vdovin <deliran@verdict.gg>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org,
	linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH bpf-next v5 8/8] selftests: net: add test for XDP_PASS skb checksum invalidation
Date: Tue, 21 Jul 2026 18:32:56 -0700	[thread overview]
Message-ID: <20260721183256.6f49d6e1@kernel.org> (raw)
In-Reply-To: <al_4VWS_EyyZLe8z@devvm7509.cco0.facebook.com>

On Tue, 21 Jul 2026 16:03:37 -0700 Stanislav Fomichev wrote:
> > > 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?

What about decap? If we decap the header that device validated 
as UNNECESSARY there's no possibility of maintaining the checksum
(by which IIUC you mean correcting it in along the payload changes).

I think we'd need some API to "decrement the csum level" ?
Or some heuristic in the drivers to decrement if the head moved
by at least len(IP+UDP) into the packet ?

> 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

Yes, that sounds fair.

>   - the hw test needs to make sure that the csum is either
>     NONE or UNNECESSARY, and will error out on COMPLETE

Driver can report COMPLETE to XDP, just not to the stack.
I think we can use a tracepoint (bpftrace) or attach in TCP
to check the skb state?

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

WARNING: multiple messages have this Message-ID (diff)
From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf.kernel@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	Donald Hunter <donald.hunter@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	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>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Vladimir Vdovin <deliran@verdict.gg>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org,
	linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH bpf-next v5 8/8] selftests: net: add test for XDP_PASS skb checksum invalidation
Date: Tue, 21 Jul 2026 18:32:56 -0700	[thread overview]
Message-ID: <20260721183256.6f49d6e1@kernel.org> (raw)
In-Reply-To: <al_4VWS_EyyZLe8z@devvm7509.cco0.facebook.com>

On Tue, 21 Jul 2026 16:03:37 -0700 Stanislav Fomichev wrote:
> > > 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?

What about decap? If we decap the header that device validated 
as UNNECESSARY there's no possibility of maintaining the checksum
(by which IIUC you mean correcting it in along the payload changes).

I think we'd need some API to "decrement the csum level" ?
Or some heuristic in the drivers to decrement if the head moved
by at least len(IP+UDP) into the packet ?

> 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

Yes, that sounds fair.

>   - the hw test needs to make sure that the csum is either
>     NONE or UNNECESSARY, and will error out on COMPLETE

Driver can report COMPLETE to XDP, just not to the stack.
I think we can use a tracepoint (bpftrace) or attach in TCP
to check the skb state?

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

  reply	other threads:[~2026-07-22  1:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 21:39 [PATCH bpf-next v5 0/8] Add the the capability to load HW RX checksum in eBPF programs Lorenzo Bianconi
2026-07-15 21:39 ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:39 ` [PATCH bpf-next v5 1/8] netlink: specs: add XDP RX checksum capability to XDP metadata specs Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 22:24   ` bot+bpf-ci
2026-07-15 22:24     ` [Intel-wired-lan] " bot+bpf-ci
2026-07-21 15:21   ` Jakub Kicinski
2026-07-21 15:21     ` [Intel-wired-lan] " Jakub Kicinski
2026-07-15 21:39 ` [PATCH bpf-next v5 2/8] net: veth: add xmo_rx_checksum callback to veth driver Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 22:08   ` sashiko-bot
2026-07-15 21:39 ` [PATCH bpf-next v5 3/8] net: ice: add xmo_rx_checksum callback Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:48   ` sashiko-bot
2026-07-15 21:39 ` [PATCH bpf-next v5 4/8] selftests/bpf: add selftest support for bpf_xdp_metadata_rx_checksum Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:39 ` [PATCH bpf-next v5 5/8] selftests/bpf: add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:39 ` [PATCH bpf-next v5 6/8] net: add bpf_skb_rx_checksum kfunc to read skb checksum metadata Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:39 ` [PATCH bpf-next v5 7/8] selftests/bpf: Add test for bpf_skb_rx_checksum kfunc Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 22:08   ` sashiko-bot
2026-07-15 21:39 ` [PATCH bpf-next v5 8/8] selftests: net: add test for XDP_PASS skb checksum invalidation Lorenzo Bianconi
2026-07-15 21:39   ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-15 21:58   ` sashiko-bot
2026-07-16 12:30   ` [Intel-wired-lan] " Stanislav Fomichev
2026-07-16 12:30     ` Stanislav Fomichev
2026-07-16 16:06     ` Lorenzo Bianconi
2026-07-16 16:06       ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-20 19:32       ` Stanislav Fomichev
2026-07-20 19:32         ` Stanislav Fomichev
2026-07-20 22:08         ` Lorenzo Bianconi
2026-07-20 22:08           ` [Intel-wired-lan] " Lorenzo Bianconi
2026-07-21 15:27         ` Jakub Kicinski
2026-07-21 15:27           ` [Intel-wired-lan] " Jakub Kicinski
2026-07-21 23:03           ` Stanislav Fomichev
2026-07-21 23:03             ` [Intel-wired-lan] " Stanislav Fomichev
2026-07-22  1:32             ` Jakub Kicinski [this message]
2026-07-22  1:32               ` Jakub Kicinski

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=20260721183256.6f49d6e1@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=deliran@verdict.gg \
    --cc=donald.hunter@gmail.com \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=emil@etsalapatis.com \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sdf.kernel@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@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.