All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Chaignon <paul.chaignon@gmail.com>
To: Amery Hung <ameryhung@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>
Subject: Re: [PATCH bpf-next 2/4] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN
Date: Fri, 5 Sep 2025 15:23:59 +0200	[thread overview]
Message-ID: <aLrkb-6ZFMLfMd-o@mail.gmail.com> (raw)
In-Reply-To: <a3a927f6-7cad-46c7-9b20-89c9978acad7@gmail.com>

On Thu, Sep 04, 2025 at 09:27:58AM -0700, Amery Hung wrote:
> 
> 
> On 9/4/25 9:02 AM, Daniel Borkmann wrote:
> > On 9/4/25 5:56 PM, Alexei Starovoitov wrote:
> > > On Thu, Sep 4, 2025 at 5:11 AM Paul Chaignon
> > > <paul.chaignon@gmail.com> wrote:
> > > > 
> > > > This patch adds support for crafting non-linear skbs in BPF test runs
> > > > for tc programs, via a new flag BPF_F_TEST_SKB_NON_LINEAR. When this
> > > > flag is set, only the L2 header is pulled in the linear area.
> > > 
> > > ...
> > > 
> > > > +               /* eth_type_trans expects the Ethernet header in
> > > > the linear area. */
> > > > +               __pskb_pull_tail(skb, ETH_HLEN);
> > > 
> > > Looks useful, but only L2 ? Is it realistic ?
> > > I don't recall any driver that would do L2 only.
> > > Is L2 only enough to cover all corner cases in your progs ?
> > > Should the linear size be a configurable parameter for prog_run() ?

I think it's enough for Cilium. It's a bit of a worst case for us AFAIU.
In any case, I'm definitely not against making it configurable.

> > 
> > Yeah perhaps we could make this configurable. The ETH_HLEN is a common
> > case
> > we've seen and also what virtual drivers pull in at min, but with NICs
> > doing
> > header/data split its probably better to let the user define this as part
> > of the testing. Then we're more flexible.
> > 
> 
> How about letting users specify the linear size through ctx->data_end? I am
> working on a set that introduces a kfunc, bpf_xdp_pull_data(). A part of is
> to support non-linear xdp_buff in test_run_xdp, and I am doing it through
> ctx->data_end. Is it something reasonable for test_run_skb?

Oh, nice! That was next on my list :)

Why use data_end though? I guess it'd work for skb, but can't we just
add a new field to the anonymous struct for BPF_PROG_TEST_RUN?

> 
> > Cheers,
> > Daniel
> 

  reply	other threads:[~2025-09-05 13:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 12:07 [PATCH bpf-next 0/4] bpf: Support non-linear skbs for BPF_PROG_TEST_RUN Paul Chaignon
2025-09-04 12:09 ` [PATCH bpf-next 1/4] bpf: Refactor cleanup of bpf_prog_test_run_skb Paul Chaignon
2025-09-05 12:57   ` kernel test robot
2025-09-04 12:11 ` [PATCH bpf-next 2/4] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN Paul Chaignon
2025-09-04 15:56   ` Alexei Starovoitov
2025-09-04 16:02     ` Daniel Borkmann
2025-09-04 16:27       ` Amery Hung
2025-09-05 13:23         ` Paul Chaignon [this message]
2025-09-05 16:34           ` Amery Hung
2025-09-08 17:41             ` Paul Chaignon
2025-09-08 19:09               ` Martin KaFai Lau
2025-09-08 19:10               ` Amery Hung
2025-09-08 19:16                 ` Paul Chaignon
2025-09-04 12:13 ` [PATCH bpf-next 3/4] selftests/bpf: Support non-linear flag in test loader Paul Chaignon
2025-09-04 12:13 ` [PATCH bpf-next 4/4] selftests/bpf: Test direct packet access on non-linear skbs Paul Chaignon
2025-09-04 18:08 ` [syzbot ci] Re: bpf: Support non-linear skbs for BPF_PROG_TEST_RUN syzbot ci

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=aLrkb-6ZFMLfMd-o@mail.gmail.com \
    --to=paul.chaignon@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.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 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.