From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>
Cc: bpf@vger.kernel.org, "Alexei Starovoitov" <ast@kernel.org>,
"Arthur Fabre" <arthur@arthurfabre.com>,
"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>,
netdev@vger.kernel.org, kernel-team@cloudflare.com,
"Stanislav Fomichev" <sdf@fomichev.me>
Subject: Re: [PATCH bpf-next 03/13] bpf: Add new variant of skb dynptr for the metadata area
Date: Mon, 30 Jun 2025 09:27:34 -0700 [thread overview]
Message-ID: <aGK69qJ9tLVvarqh@mini-arch> (raw)
In-Reply-To: <20250630-skb-metadata-thru-dynptr-v1-3-f17da13625d8@cloudflare.com>
On 06/30, Jakub Sitnicki wrote:
> Add a new flag for the bpf_dynptr_from_skb helper to let users to create
> dynptrs to skb metadata area. Access paths are stubbed out. Implemented by
> the following changes.
>
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
> ---
> include/uapi/linux/bpf.h | 9 ++++++++
> net/core/filter.c | 60 +++++++++++++++++++++++++++++++++++++++++-------
> 2 files changed, 61 insertions(+), 8 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 719ba230032f..ab5730d2fb29 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -7591,4 +7591,13 @@ enum bpf_kfunc_flags {
> BPF_F_PAD_ZEROS = (1ULL << 0),
> };
>
> +/**
> + * enum bpf_dynptr_from_skb_flags - Flags for bpf_dynptr_from_skb()
> + *
> + * @BPF_DYNPTR_F_SKB_METADATA: Create dynptr to the SKB metadata area
> + */
> +enum bpf_dynptr_from_skb_flags {
> + BPF_DYNPTR_F_SKB_METADATA = (1ULL << 0),
> +};
> +
> #endif /* _UAPI__LINUX_BPF_H__ */
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 1fee51b72220..3c2948517838 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -11967,12 +11967,27 @@ bpf_sk_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> return func;
> }
>
> +enum skb_dynptr_offset {
> + SKB_DYNPTR_METADATA = -1,
nit: any reason not do make it 1? The offset is u32, so that -1 reads a bit
intentional and I don't get the intention :-)
next prev parent reply other threads:[~2025-06-30 16:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 14:55 [PATCH bpf-next 00/13] Extend skb dynptr for metadata access from TC Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 01/13] bpf: Ignore dynptr offset in skb data access Jakub Sitnicki
2025-07-01 20:55 ` Andrii Nakryiko
2025-07-02 8:20 ` Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 02/13] bpf: Helpers for skb dynptr read/write/slice Jakub Sitnicki
2025-07-01 2:03 ` kernel test robot
2025-07-01 11:13 ` Jakub Sitnicki
2025-07-01 3:06 ` kernel test robot
2025-06-30 14:55 ` [PATCH bpf-next 03/13] bpf: Add new variant of skb dynptr for the metadata area Jakub Sitnicki
2025-06-30 16:27 ` Stanislav Fomichev [this message]
2025-06-30 20:34 ` Jakub Sitnicki
2025-07-01 20:59 ` Andrii Nakryiko
2025-07-02 8:22 ` Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 04/13] bpf: Enable read access to skb metadata with bpf_dynptr_read Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 05/13] bpf: Enable write access to skb metadata with bpf_dynptr_write Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 06/13] bpf: Enable read-write access to skb metadata with dynptr slice Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 07/13] net: Clear skb metadata on handover from device to protocol Jakub Sitnicki
2025-06-30 16:25 ` Stanislav Fomichev
2025-06-30 20:30 ` Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 08/13] selftests/bpf: Pass just bpf_map to xdp_context_test helper Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 09/13] selftests/bpf: Parametrize test_xdp_context_tuntap Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 10/13] selftests/bpf: Cover read access to skb metadata via dynptr Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 11/13] selftests/bpf: Cover write " Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 12/13] selftests/bpf: Cover lack of access to skb metadata at ip layer Jakub Sitnicki
2025-06-30 14:55 ` [PATCH bpf-next 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=aGK69qJ9tLVvarqh@mini-arch \
--to=stfomichev@gmail.com \
--cc=arthur@arthurfabre.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--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