Re: [PATCH bpf-next 2/4] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 5, 2025 at 6:24 AM Paul Chaignon <paul.chaignon@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxx> 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?
>

I choose to use ctx_in because it doesn't change the interface and
feels natural. kattr->test.ctx_in is already copied from users and
shows users' expectation about the input ctx. I think we should honor
that (as long as the value makes sense). WDYT?

Thanks for working on this. It would be great if there is some
consistency between test_run_skb and test_run_xdp.

> >
> > > Cheers,
> > > Daniel
> >





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux