Re: [PATCH bpf-next v2 3/7] bpf: Support pulling non-linear xdp data

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

 



On Wed, Sep 10, 2025 at 2:04 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Wed, 10 Sep 2025 11:17:52 -0400 Amery Hung wrote:
> > > Larger note: I wonder if we should support "shifting the buffer down"
> > > if there's insufficient tailroom. XDP has rather copious headroom,
> > > but tailroom may be pretty tight, and it may depend on the length of
> > > the headers. So if there's not enough tailroom but there's enough
> > > headroom -- should we try to memmove the existing headers?
> >
> > I think it should. If users want to reserve space for metadata, they
> > can check the headroom before pulling data.
> >
> > If the kfunc does not do memmove(), users are still able to do so in
> > XDP programs through bpf_xdp_adjust_head() and memmove(), but it feels
> > less easy to use IMO.
>
> Actually, I don't think adjust_head() would even work. The program can
> adjust head and memmove() the header, but there's no way to "punch out"
> the end of the head buffer. We can only grow and shrink start of packet
> and end of packet. After adjust_head + memmove in the prog buffer would
> look something like:

Ahh. You are right.

>
>   _ _ _ _ __________ _____ _ _ _ _      ________
>    hroom |  headers | old | troom      |  frag0 |
>   - - - - ---------- ----- - - - -      --------
>
> and the program has no way to "free" the "old" to let pull grab data
> from frag0 in its place...
>
> skb pull helper can allocate a completely fresh buffer, but IDK if
> drivers are ready to have the head buffer swapped under their feet.
> So I think that best we can do is have the pull() helper aromatically
> memmove the headers.

Agree. Will make the kfunc memmove headers if more spaces are needed.





[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