[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pmmouqmt.fsf@toke.dk>
Date: Mon, 14 Mar 2022 23:16:10 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Felix Fietkau <nbd@....name>,
"Jesper D. Brouer" <netdev@...uer.com>, netdev@...r.kernel.org,
bpf <bpf@...r.kernel.org>
Cc: brouer@...hat.com, John Fastabend <john.fastabend@...il.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH] net: xdp: allow user space to request a smaller packet
headroom requirement
Felix Fietkau <nbd@....name> writes:
> On 14.03.22 21:39, Jesper D. Brouer wrote:
>> (Cc. BPF list and other XDP maintainers)
>>
>> On 14/03/2022 11.22, Felix Fietkau wrote:
>>> Most ethernet drivers allocate a packet headroom of NET_SKB_PAD. Since it is
>>> rounded up to L1 cache size, it ends up being at least 64 bytes on the most
>>> common platforms.
>>> On most ethernet drivers, having a guaranteed headroom of 256 bytes for XDP
>>> adds an extra forced pskb_expand_head call when enabling SKB XDP, which can
>>> be quite expensive.
>>> Many XDP programs need only very little headroom, so it can be beneficial
>>> to have a way to opt-out of the 256 bytes headroom requirement.
>>
>> IMHO 64 bytes is too small.
>> We are using this area for struct xdp_frame and also for metadata
>> (XDP-hints). This will limit us from growing this structures for
>> the sake of generic-XDP.
>>
>> I'm fine with reducting this to 192 bytes, as most Intel drivers
>> have this headroom, and have defacto established that this is
>> a valid XDP headroom, even for native-XDP.
>>
>> We could go a small as two cachelines 128 bytes, as if xdp_frame
>> and metadata grows above a cache-line (64 bytes) each, then we have
>> done something wrong (performance wise).
> Here's some background on why I chose 64 bytes: I'm currently
> implementing a userspace + xdp program to act as generic fastpath to
> speed network bridging.
Any reason this can't run in the TC ingress hook instead? Generic XDP is
a bit of an odd duck, and I'm not a huge fan of special-casing it this
way...
-Toke
Powered by blists - more mailing lists