lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2EB0DFB0-E12D-4FFC-89CF-CF286A9CF8E2@nutanix.com>
Date: Wed, 30 Apr 2025 18:45:18 +0000
From: Jon Kohler <jon@...anix.com>
To: Daniel Borkmann <daniel@...earbox.net>
CC: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
        Jason Wang
	<jasowang@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
        "David S. Miller"
	<davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Alexei Starovoitov
	<ast@...nel.org>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        John Fastabend
	<john.fastabend@...il.com>,
        Simon Horman <horms@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: Re: [PATCH net-next] xdp: add xdp_skb_reserve_put helper



> On Apr 30, 2025, at 2:40 PM, Daniel Borkmann <daniel@...earbox.net> wrote:
> 
> !-------------------------------------------------------------------|
> CAUTION: External Email
> 
> |-------------------------------------------------------------------!
> 
> On 4/30/25 8:25 PM, Willem de Bruijn wrote:
>> Jon Kohler wrote:
>>> Add helper for calling skb_{put|reserve} to reduce repetitive pattern
>>> across various drivers.
>>> 
>>> Plumb into tap and tun to start.
>>> 
>>> No functional change intended.
>>> 
>>> Signed-off-by: Jon Kohler <jon@...anix.com>
>>> ---
>>>  drivers/net/tap.c | 3 +--
>>>  drivers/net/tun.c | 3 +--
>>>  include/net/xdp.h | 8 ++++++++
>>>  net/core/xdp.c    | 3 +--
>>>  4 files changed, 11 insertions(+), 6 deletions(-)
>> Subjective, but I prefer the existing code. I understand what
>> skb_reserve and skb_put do. While xdp_skb_reserve_put adds a layer of
>> indirection that I'd have to follow.
>> Sometimes deduplication makes sense, sometimes the indirection adds
>> more mental load than it's worth. In this case the code savings are
>> small. As said, subjective. Happy to hear other opinions.
> 
> +1, agree with Willem

That’s a fair point. I was also toying with the idea of something like
this instead:

e.g.
xdp_headroom(xdp) == xdp->data - xdp->data_hard_start
… similar to skb_headroom

xdp_length_base(xdp) == xdp->data_end - xdp->data
… similar to xdp_get_buff_len, but doesn’t look at frags

then we could do:
skb_reserve(skb, xdp_headroom(xdp));
skb_put(skb, xdp_length_base(xdp));

Names TBD of course, but thoughts?

That way we keep skb_reserve/put just the same, but have
a nice helper like we do for skb_headroom() already

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ