netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Jakub Sitnicki <jakub@cloudflare.com>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Arthur Fabre" <arthur@arthurfabre.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"Jesse Brandeburg" <jbrandeburg@cloudflare.com>,
	"Joanne Koong" <joannelkoong@gmail.com>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Toke Høiland-Jørgensen" <thoiland@redhat.com>,
	"Yan Zhai" <yan@cloudflare.com>,
	kernel-team@cloudflare.com, netdev@vger.kernel.org,
	"Stanislav Fomichev" <sdf@fomichev.me>,
	bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 01/13] bpf: Add dynptr type for skb metadata
Date: Thu, 17 Jul 2025 17:06:21 -0700	[thread overview]
Message-ID: <9aa1f2b0-0f63-45e8-b787-e14d53cac75a@linux.dev> (raw)
In-Reply-To: <20250716-skb-metadata-thru-dynptr-v2-1-5f580447e1df@cloudflare.com>

On 7/16/25 9:16 AM, Jakub Sitnicki wrote:
> +__bpf_kfunc int bpf_dynptr_from_skb_meta(struct __sk_buff *skb, u64 flags,
> +					 struct bpf_dynptr *ptr__uninit)
> +{
> +	return dynptr_from_skb_meta(skb, flags, ptr__uninit, false);
> +}
> +
>   __bpf_kfunc int bpf_dynptr_from_xdp(struct xdp_md *x, u64 flags,
>   				    struct bpf_dynptr *ptr__uninit)
>   {
> @@ -12165,8 +12190,15 @@ int bpf_dynptr_from_skb_rdonly(struct __sk_buff *skb, u64 flags,
>   	return 0;
>   }
>   
> +int bpf_dynptr_from_skb_meta_rdonly(struct __sk_buff *skb, u64 flags,
> +				    struct bpf_dynptr *ptr__uninit)
> +{
> +	return dynptr_from_skb_meta(skb, flags, ptr__uninit, true);
> +}
> +
>   BTF_KFUNCS_START(bpf_kfunc_check_set_skb)
>   BTF_ID_FLAGS(func, bpf_dynptr_from_skb, KF_TRUSTED_ARGS)
> +BTF_ID_FLAGS(func, bpf_dynptr_from_skb_meta, KF_TRUSTED_ARGS)

I looked at the high level of the set. I have a quick question.

Have you considered to create another bpf_kfunc_check_set_xxx that is only for 
the tc and tracing prog type? No need to expose this kfunc to other prog types 
if the skb_meta is not available now at those hooks.

It seems patch 5 is to ensure other prog types has meta_len 0 and some of the 
tests are to ensure that the other prog types cannot do useful things with the 
new skb_meta kfunc. The tests will also be different eventually when the 
skb_meta can be preserved beyond tc.


  reply	other threads:[~2025-07-18  0:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 16:16 [PATCH bpf-next v2 00/13] Add a dynptr type for skb metadata Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 01/13] bpf: Add " Jakub Sitnicki
2025-07-18  0:06   ` Martin KaFai Lau [this message]
2025-07-18 10:01     ` Jakub Sitnicki
2025-07-18 19:19       ` Martin KaFai Lau
2025-07-18 19:27         ` Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 02/13] bpf: Enable read access to skb metadata with bpf_dynptr_read Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 03/13] bpf: Enable write access to skb metadata with bpf_dynptr_write Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 04/13] bpf: Enable read-write access to skb metadata with dynptr slice Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 05/13] net: Clear skb metadata on handover from device to protocol Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 06/13] selftests/bpf: Cover verifier checks for skb_meta dynptr type Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 07/13] selftests/bpf: Pass just bpf_map to xdp_context_test helper Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 08/13] selftests/bpf: Parametrize test_xdp_context_tuntap Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 09/13] selftests/bpf: Cover read access to skb metadata via dynptr Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 10/13] selftests/bpf: Cover write " Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 11/13] selftests/bpf: Cover read/write to skb metadata at an offset Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 12/13] selftests/bpf: Cover lack of access to skb metadata at ip layer Jakub Sitnicki
2025-07-16 16:16 ` [PATCH bpf-next v2 13/13] selftests/bpf: Count successful bpf program runs Jakub Sitnicki

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=9aa1f2b0-0f63-45e8-b787-e14d53cac75a@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=arthur@arthurfabre.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=jakub@cloudflare.com \
    --cc=jbrandeburg@cloudflare.com \
    --cc=joannelkoong@gmail.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=thoiland@redhat.com \
    --cc=yan@cloudflare.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).