🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15426

Re: [PATCH net-next v1 07/11] xsk: Deliver provider chunks without copying

#15426
From: Björn Töpel
Date: Thu, 12 Nov 2026 19:57
82 lines
12575 bytes
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:

> On Tue, Nov 10, 2026 at 11:20:28AM +0100, Björn Töpel wrote:
>> A provider socket still receives through the copy path, which takes
>> FILL entries without the provider's ownership checks: a chunk that a
>> page pool holds could be handed out twice. No driver opts in yet.
>> 
>> Put packets whose buffers all belong to the socket's provider on the
>> RX ring as they are, and copy others into chunks the provider claims.
>> Only the queue NAPI may produce to such a socket, so generic XDP and
>> CPUMAP redirects to it are dropped.
>> 
>> A device may place payload at chunk offset 0, as fbnic does, so only
>> the first buffer of a packet keeps the UMEM headroom. Such buffers may
>> be sent back as they are, so only descriptors with XDP_TX_METADATA
>> need room for TX metadata in front.
>> 
>> Signed-off-by: Björn Töpel <bjorn@kernel.org>
>> ---
>>  Documentation/networking/af_xdp.rst          |   6 +-
>>  Documentation/networking/xsk-tx-metadata.rst |   3 +-
>>  include/net/page_pool/memory_provider.h      |   2 +
>>  net/core/page_pool.c                         |  34 +++-
>>  net/xdp/xsk.c                                |  82 ++++++++-
>>  net/xdp/xsk.h                                |   5 +
>>  net/xdp/xsk_pp.c                             | 165 +++++++++++++++++++
>>  net/xdp/xsk_queue.h                          |  18 +-
>>  8 files changed, 304 insertions(+), 11 deletions(-)
>> 
>
> (...)
>
>> +
>>  static int xsk_pp_nl_fill(void *mp_priv, struct sk_buff *rsp,
>>  			  struct netdev_rx_queue *rxq)
>>  {
>> diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h
>> index 1bc42c8902f4..b9464b917a88 100644
>> --- a/net/xdp/xsk_queue.h
>> +++ b/net/xdp/xsk_queue.h
>> @@ -156,17 +156,24 @@ static inline bool xp_unused_options_set(u32 options)
>>  	return options & ~(XDP_PKT_CONTD | XDP_TX_METADATA);
>>  }
>>  
>> +static inline u32 xp_desc_meta_len(struct xsk_buff_pool *pool,
>> +				   struct xdp_desc *desc)
>> +{
>> +	return desc->options & XDP_TX_METADATA ? pool->tx_metadata_len : 0;
>
> How is it related to this patch? I know I trimmed, but I didn't see any
> references above to tx_metadata_len, only some documentation bump.

Provider frags start at chunk offset 0, and an application may send them
back as they are. TX validation wants tx_metadata_len in front of every
descriptor once the UMEM has it, so such a descriptor fails, though only
XDP_TX_METADATA descriptors use that room. Driver ZC never puts RX data
below offset 256, so it never came up. It stands on its own; I'll make
it a separate patch.

> Besides, the amount of branches introduced to existing hot path is
> worrying. On next revision, could you provide numbers from xdpsock before
> and after this set run on existing zc driver?

(FWIW, I've left a all my performance patches out, to keep the size of
set down.)

Will do, but the only one I got is mlx5. Would be awesome if you or
Magnus could take it for a spin on Intel NICs.

Single-buffer RX on driver ZC gets no new per-packet branch: xsk_rcv()
leaves through xsk_rcv_zc() first. The rest is one test per flush, one
XDP_TX_METADATA test per TX descriptor, and a flag test in the
multi-buffer and XDP_PASS/redirect helpers. v2 also moves pool->pp next
to fq, which the flush reads anyway, and drops the frag walk in
xdp_buff_needs_copy(), as agreed with Stan.

Anything specific, or just in general?


Björn
Technical Details
Message-ID: <875wy1rff5.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362180-linux-kernel-netdev=dewy.ru
References: <20261110102039.1002605-1-bjorn@kernel.org> <20261110102039.1002605-8-bjorn@kernel.org> <avWua/xvHrUa5wUI@boxer>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362180-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v1 07/11] xsk: Deliver provider chunks without
 copying
Date: Thu, 12 Nov 2026 20:57:34 +0100
Organization: Usenet Network
Message-ID: <875wy1rff5.fsf@all.your.base.are.belong.to.us>
References: <20261110102039.1002605-1-bjorn@kernel.org>
 <20261110102039.1002605-8-bjorn@kernel.org> <avWua/xvHrUa5wUI@boxer>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1195892"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BoG5T2B4UNyTugNkx/S3fyN6Feo= sha256:dvtXFNJPlArJga9X9H10G3IFGqexTXNjJWEM9RUZX3k=
	sha1:f1dHmE+Ro/+Ppze5MWPJ6w6gCwM= sha256:PrWkgw9w2xb0XvWZ2QoqSRQF+s8IVSn3iZLh4Mp1xYI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 41B661143B4; Fri, 13 Nov 2026 01:37:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EnEljrvczzHA;
	Fri, 13 Nov 2026 01:37:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-362180-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 20C381143B7; Fri, 13 Nov 2026 01:36:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B907910E125; Thu, 12 Nov 2026 19:58:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794513459;
	b=hilKukvHxKPZV8cX989io+g7dxfuQ+vLE4QGyg5tEoZG9VdYYGj32zCqsa6Z5LphcsRD
	 n4l5XkkqfC91r2kxg1L77QKYgu+qtmHCpMiPOoJezkTypfMYG7UYhtdCAoGP9+2WBM3Bi
	 svUxd3QlzQZ4DBT3T/l/OlmKjeO3DY0Ze2bmiMUZZG/JenhagoMe4/2kGQT4zjp09jh3m
	 Puqa9TgSYuRtmcMaLTlQHSE99+GWr7EcSIq4jwEK5aMLmNhwGCJZ4vwK7c4ngAZB5JKoq
	 gxp2tZJt1IPanKPyjSp9lqRDOpLHLmLgb8YBetlJVqsU+KUMKbB/sNdzPQHUNLqiMgg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794513459;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=7guJMRRaIyBXSu5q1TNtm5fdzWXrkWkE2iKaLV14h3U=;
	b=rOLEk5oQ57DzqLteesAabovPhEWeWn30ApMTtYTHGGgKvmzrqiQDkcp4ikXsfQljOMPf
	 cOCqFM14vSW7R34fccTbYCxu8GA4x7gso056YhJoMyKuMPDyXetmqriJAdk4Bc15192Ca
	 Z6H07kOOER2NAGWuh1Hbwah+ku+poJ7y8U0f8KA0ziFom0yl/iLUWcKGTdcG2aWzh+tWp
	 MxODuip+aXHWY8933QvLgIHfknoennGGySq8do0PHsEuJSKTcIfw8kWIteG63TutCEg56
	 LU7obEt4ZGZmltdk8i3mSvLuU5MZ3Y8gCTCZuH8cmFU2yvaH6ja/F/MMTPn4sTJ+Pug==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WwR0zLi9;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A5E8D606A8AE;
	Thu, 12 Nov 2026 19:57:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WwR0zLi9
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794513458;
	b=1anX/uCg2hwk/P/8eMTdM61jHBrAPfemEo697vniGIg4i9436W2+FzYM5+CARlRVjRpL
	 N3fkzXNkZLskJjsSCmx71PwEAwG+IDOTGfxRvc3ycICXcIZJJv63CNOPOHqJfm+GzaWYC
	 U8DrAT4ZgDM4aUhidB8/zrUQ5InK7sIEQCMn9yKSFveMpvEjt1oBaMCTMh61Cirqkm40G
	 6VCJwWmKWNjhTSFAZwtKUM6N5OIvUE7WbT4v8WUaM2db37ecuQBNirV0kHtaJsNnLiYM3
	 H+tthZzGXzTmsUW7oW6lD9eIywuYRq7ZURvzWLgvKOneNzzzOS5ksx2uhK/+SnjiRdg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794513458;
	h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References:
	 Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=7guJMRRaIyBXSu5q1TNtm5fdzWXrkWkE2iKaLV14h3U=;
	b=kvJJnBIpXnEqbemn+vE3lTmWItKPdXdrUOdApZUt/qlOGSO3cRJ6ECavnAfNrmhbjNSA
	 74VGnb/jq3zhXW7f3mRbSiX9pZSoJUFqdB+RywRvkwTt4MZjis1pBCTk3TjM/t3fCVVZ5
	 8MH1ZInPpc2nzSmI9QjmQKmu1jybeROeS+1gxtVeuMWSo6xwdskIIs7IUrxOQj8Q16upu
	 j8upr/x2L8YhAOU1e8DhbTeqncDi6e2RPjP9vmODWLtjmKoylbjDpXcH3oNr7C/322LSl
	 W8lbYEdPNQQqy46n+l77h6hD/R8tevzwIM6/k3WwCXVe0Xr71MDMMxUDW1+FClL+lSA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WwR0zLi9;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCBFE606A88F;
	Thu, 12 Nov 2026 19:57:38 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDE151F000C5;
	Thu, 12 Nov 2026 19:57:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794513458;
	bh=7guJMRRaIyBXSu5q1TNtm5fdzWXrkWkE2iKaLV14h3U=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=WwR0zLi94YNDct3dcB3nW3opR+n+eZhSHuebehNpSFyoYQJYcRB/uTok6f0VIEsn8
	 VhNnmCYLnslIOCeD3XHMyPbA/szoNfexl/h4UkRdQdnkKQS+t4viFQd0RF5sIrS+7w
	 94NnR1EI7kWlcUYSg5DeygJD9WLbjg6lApMtl06hUAl/P2fwWHzg6oLoFiO4b46RcW
	 EtTonZU6mxNjqp2zNmo0stc9wJcpwtqAxzNRKlZulu64/zsMZDedhlHfcdt4xWq8eU
	 vUh5tJKBKk+fh7k+Z924uIN9JJy6j+hnV411pXsULtaOC6Ei5AfRW5f5NXXqASN3YD
	 y+XV789RFCh3g==
X-Cc: Magnus Karlsson <magnus.karlsson@intel.com>, Stanislav Fomichev
 <sdf@fomichev.me>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet
 <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni
 <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Jonathan Corbet
 <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, Randy Dunlap
 <rdunlap@infradead.org>, Alexander Duyck <alexanderduyck@fb.com>,
 kernel-team@meta.com, Andrew Lunn <andrew+netdev@lunn.ch>, Jesper Dangaard
 Brouer <hawk@kernel.org>, Ilias Apalodimas <ilias.apalodimas@linaro.org>,
 Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann
 <daniel@iogearbox.net>, John Fastabend <john.fastabend@gmail.com>, Pavel
 Begunkov <asml.silence@gmail.com>, Jens Axboe <axboe@kernel.dk>, Andrii
 Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Kumar
 Kartikeya
 Dwivedi <memxor@gmail.com>, Martin KaFai Lau <martin.lau@linux.dev>, Song
 Liu <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, Jiri Olsa
 <jolsa@kernel.org>, Emil Tsalapatis <emil@etsalapatis.com>, Ihor Solodrai
 <ihor.solodrai@linux.dev>, netdev@vger.kernel.org, bpf@vger.kernel.org,
 io-uring@vger.kernel.org, Mina Almasry <almasrymina@google.com>, "Mike
 Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>, Weiming Shi
 <bestswngs@gmail.com>, Nikolay Aleksandrov <razor@blackwall.org>, David
 Wei <dw@davidwei.uk>, Alexander Lobakin <aleksander.lobakin@intel.com>,
 linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Stuart Clark
 <stuclar@meta.com>
X-In-Reply-To: <avWua/xvHrUa5wUI@boxer>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list