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: <26b6d2d9-0626-4638-abcd-967a7b437165@intel.com>
Date: Tue, 19 Nov 2024 13:03:33 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Toke Høiland-Jørgensen <toke@...hat.com>, "Alexei
 Starovoitov" <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, "John
 Fastabend" <john.fastabend@...il.com>, Andrii Nakryiko <andrii@...nel.org>,
	Maciej Fijalkowski <maciej.fijalkowski@...el.com>, Stanislav Fomichev
	<sdf@...ichev.me>, Magnus Karlsson <magnus.karlsson@...el.com>,
	<nex.sw.ncis.osdt.itp.upstreaming@...el.com>, <bpf@...r.kernel.org>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v5 11/19] xdp: add generic xdp_buff_add_frag()

From: Jakub Kicinski <kuba@...nel.org>
Date: Fri, 15 Nov 2024 18:40:59 -0800

> On Wed, 13 Nov 2024 16:24:34 +0100 Alexander Lobakin wrote:
>> +static inline bool __xdp_buff_add_frag(struct xdp_buff *xdp, struct page *page,
>> +				       u32 offset, u32 size, u32 truesize,
>> +				       bool try_coalesce)
>> +{
>> +	struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
>> +	skb_frag_t *prev;
>> +	u32 nr_frags;
>> +
>> +	if (!xdp_buff_has_frags(xdp)) {
>> +		xdp_buff_set_frags_flag(xdp);
>> +
>> +		nr_frags = 0;
>> +		sinfo->xdp_frags_size = 0;
>> +		sinfo->xdp_frags_truesize = 0;
>> +
>> +		goto fill;
>> +	}
>> +
>> +	nr_frags = sinfo->nr_frags;
>> +	if (unlikely(nr_frags == MAX_SKB_FRAGS))
>> +		return false;
>> +
>> +	prev = &sinfo->frags[nr_frags - 1];
>> +	if (try_coalesce && page == skb_frag_page(prev) &&
>> +	    offset == skb_frag_off(prev) + skb_frag_size(prev))
>> +		skb_frag_size_add(prev, size);
> 
> don't we have to release the reference if we coalesced?

Correct. I realized that when replying to Ido =\

> 
>> +	else
>> +fill:
>> +		__skb_fill_page_desc_noacc(sinfo, nr_frags++, page,
>> +					   offset, size);
>> +
>> +	sinfo->nr_frags = nr_frags;
>> +	sinfo->xdp_frags_size += size;
>> +	sinfo->xdp_frags_truesize += truesize;
>> +
>> +	return true;
>> +}

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ