🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21774

[PATCH net-next 11/15] net: Add netif_rxq_has_xdp_only_mp()

#21774
From: Björn Töpel
Date: Tue, 24 Nov 2026 12:56
69 lines
11344 bytes
A driver lays out an RX queue before it creates the page pools of that
queue, so it cannot ask a pool whether a memory provider backs it, and
a layout that depends on the provider has nothing to read.

Tell the driver from the queue. Return whether the provider of an RX
queue is XDP-only, which the next patch uses to keep an mlx5 queue
from waiting for buffers that its socket has not lent yet.

Page pools of a queue are created under the instance lock, which the
caller holds as well, so the answer agrees with the pools of that
queue. A queue index past the device's RX queues has no provider.

Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
 include/net/netdev_queues.h |  1 +
 net/core/netdev_rx_queue.c  | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
index c5335e935b7d..813388778797 100644
--- a/include/net/netdev_queues.h
+++ b/include/net/netdev_queues.h
@@ -235,6 +235,7 @@ void netdev_queue_config(struct net_device *dev, int rxq,
 			 struct netdev_queue_config *qcfg);
 
 bool netif_rxq_has_unreadable_mp(struct net_device *dev, unsigned int rxq_idx);
+bool netif_rxq_has_xdp_only_mp(struct net_device *dev, unsigned int rxq_idx);
 
 /**
  * DOC: Lockless queue stopping / waking helpers.
diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
index 2e10201fc0c0..212f1b9415b3 100644
--- a/net/core/netdev_rx_queue.c
+++ b/net/core/netdev_rx_queue.c
@@ -94,6 +94,31 @@ bool netif_rxq_has_unreadable_mp(struct net_device *dev, unsigned int rxq_idx)
 }
 EXPORT_SYMBOL(netif_rxq_has_unreadable_mp);
 
+/**
+ * netif_rxq_has_xdp_only_mp() - whether an XDP-only provider backs an RX queue
+ * @dev: device of the queue
+ * @rxq_idx: RX queue of @dev itself, not of a lease
+ *
+ * The page pools of the queue that allow it take the provider, see
+ * %PP_FLAG_ALLOW_XDP_ONLY_NETMEM. They are created under the instance lock,
+ * which the caller holds, so they agree with the answer.
+ *
+ * Return: true if the queue has a provider with %MP_XDP_ONLY.
+ */
+bool netif_rxq_has_xdp_only_mp(struct net_device *dev, unsigned int rxq_idx)
+{
+	const struct memory_provider_ops *ops;
+
+	netdev_assert_locked(dev);
+
+	if (rxq_idx >= dev->real_num_rx_queues)
+		return false;
+
+	ops = __netif_get_rx_queue(dev, rxq_idx)->mp_params.mp_ops;
+	return ops && ops->flags & MP_XDP_ONLY;
+}
+EXPORT_SYMBOL(netif_rxq_has_xdp_only_mp);
+
 bool netif_rxq_has_mp(struct net_device *dev, unsigned int rxq_idx)
 {
 	if (rxq_idx < dev->real_num_rx_queues)
-- 
2.56.1
Technical Details
Message-ID: <20261124125654.183091-11-bjorn@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370357-linux-kernel-netdev=dewy.ru
References: <20261124112707.118678-1-bjorn@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370357-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 11/15] net: Add netif_rxq_has_xdp_only_mp()
Date: Tue, 24 Nov 2026 13:56:46 +0100
Organization: Usenet Network
Message-ID: <20261124125654.183091-11-bjorn@kernel.org>
References: <20261124112707.118678-1-bjorn@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4138478"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:U1J3RmsJ3TR3FARV/KswL5Y5YDw= sha256:/KWhOXn2Yxwpbczbp2RxouGNML4vut6nWuDvQnuKSuc=
	sha1:X9Drbs+8/GrEXPov+WYzZ+2BQ/k= sha256:fmZ/hvIK+9Vaw2w9nvTlhirmj/p6ozOtgqFxdrMPe8A=
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 0574D125E15; Tue, 24 Nov 2026 15:59:52 +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 uGyxt7TxhD5e;
	Tue, 24 Nov 2026 15:59:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370357-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 BDE80125E13; Tue, 24 Nov 2026 15:59:39 +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 30E523A097; Tue, 24 Nov 2026 12:59:28 +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=1795525167;
	b=AOSSrgCpEFGFKp9ZWkansy1ROqaKnhh2gdxjUjWrGsfE2BO31p/725qwrNqg6EwAOrAv
	 VUzcXwodoNt1Vb2U/L4+CrPQGPuJZkOzFZVFO2IHO7UhtFjJLFlfEp0UcH333KjzlkaJl
	 M/1dtcaifE1sxXy0hyPRv64MvFQRIb6F98pyOCXr0/S+wSYiOi6gF4oOorkJ5YZ/Nddjx
	 x4SXBOi4lbRyeVikWoPpeOUyRtz8dKTA9UHn5lfnjUxdYass597Hl2ZlPbCiw4hnSca82
	 QVOBfHlguWqlL/HpIdUBxt+W2Jp+sG54TsCiu+zmGoMyIb6n1YZKfuLqWurpLoxDArg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795525167;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=LA1pnI8aeeYlz5Y+3GA+5FCYedjmJ9wlZv/anfHcgGI=;
	b=4RLogCcs/toAJdBxm0w/qdLKdqrb4vjLhIap/xbmPq2aXGej2mx6R1BxSeVkQIJstjLv
	 LHN3JdolodsarCjpQWZLPo+ga02ZvizraZqBbc0p9uLsM5ZgJ6Ch3qZ0Xjf0LPfDXG4Bh
	 z0SjU5fpCvmsA53Z+TPA91ZTdPex6fRDbHligE3j4SPPKZqj/ZnW0TUCqzmPWIjeXmuUH
	 BA0Fx4UkBTHJS5cQ6HwdKvgAOlQFHBsCY/5vZJD/UxL1snfayXuIAu+FqJgIUUWwH/UEe
	 f430Jr71BAJU0aWlkKNQPDs6ePMZwYKBqKrLaag4LaSovXgzRdVpDsVz0MI8XM1vg9Q==
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=h03Sjxum;
	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 32014606A32D;
	Tue, 24 Nov 2026 12:59:27 +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=h03Sjxum
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=1795525156;
	b=ZXc+taxytxiibw0VSyI2rAFKX+GNXaB6sQ19FL0ZaZ9MYZHctoWGMvt7vM9ubSfGsGIn
	 wUZIpwrjDEPND+PiCqxUeJst+5ntFKuplaINy33uO8jL79Ye7L6JgoX8nL08ZWXeXfl59
	 5/zqxUDCoDkccWPcf5UziltARioSSRDo3kkrObLOwg+uTPJ94m+fjTJzy2s2DP0j+atWf
	 qr0lWTDdfIExlFoXYIgaYgxXH0KaTRlCKtGisH2PNVXoZyLUHuC6sy8u/8nJzhzEK6rP/
	 Y/bsnOHOslodbL28wkSW5cmH5pGymmU+JkymyQFzU8Hb1H/4XVbqn2ugeO5eXIj3EFg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795525156;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=LA1pnI8aeeYlz5Y+3GA+5FCYedjmJ9wlZv/anfHcgGI=;
	b=2bhNGE6532ZTQwDWvBLDMi10dV5rdj9/pDarRe74HXhcUz8Pj6ocO5l8snSFLN6V+B5E
	 u1elXNMNj/zOttpcC3vkUZriJeceufem2EkLjEspGxDKsYCezuQYRJOf6/DiXkGcFUqiy
	 mVeRuHDwBwjQibtz8iZpVrza3YFxtId/vHqPHs5NB+Qd+EUK4OJ+DfW2DEqc/sGk6lR0c
	 U/XjkhMOD3Mro/4ke2QiudxwENvhStAennPG6FiRPI2LlDVfMA0ifsK/bwm/ebjnUllZH
	 QbwVdLyrRy+kiqW5HuVSdLb6MwwzXvevgCfxqQE+zWbV0NFo+uzdqNp4TrpG32G3zgQ==
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=h03Sjxum;
	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 49889606A31E;
	Tue, 24 Nov 2026 12:59:16 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F431F000C0;
	Tue, 24 Nov 2026 12:59:04 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795525155;
	bh=LA1pnI8aeeYlz5Y+3GA+5FCYedjmJ9wlZv/anfHcgGI=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=h03SjxumTxIqMg65F7MX2PyEtjRQ2rVLMzNU5UrAP2yer4y6cqZf5xBPTB/mpq+zo
	 Smp5n7RXcH57JyZkf8jusqDiw3xxgNKUW/YJl+cWgBAVE4IcYLkhwXL+qj+NQQe36U
	 YuSz5dkdHiSt6302VxO2u2O0X47CFEQJnYeFRTOdX99p6em5xIdz56eH8jKZdYAGY2
	 S1C1ulZpOEAKbl0ZHij578yzJU+B16ZWz98UaHD3tIdVfmjEm8ytHDXyGm8R2+8qoQ
	 CmAgPtC4q/AalqgOAoF7hOetzJ3+Q9rMSW/AQzpjmJR0gSZLiy1zEf8r5dnGjSvtDg
	 gdzmDHYkVX+vg==
X-Cc: Stuart Clark <stuclar@meta.com>,
	Björn Töpel <bjorn@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Simon Horman <horms@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Mina Almasry <almasrymina@google.com>,
	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>,
	Randy Dunlap <rdunlap@infradead.org>,
	kernel-team@meta.com,
	Dimitri Daskalakis <dimitri.daskalakis1@gmail.com>,
	Bobby Eshleman <bobbyeshleman@meta.com>,
	Mohsin Bashir <mohsin.bashr@gmail.com>,
	Kees Cook <kees@kernel.org>,
	Breno Leitao <leitao@debian.org>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Tao Cui <cuitao@kylinos.cn>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	"Mike Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Jiayuan Chen <jiayuan.chen@linux.dev>,
	Martin Karsten <mkarsten@uwaterloo.ca>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	David Wei <dw@davidwei.uk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	linux-rdma@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261124112707.118678-1-bjorn@kernel.org>
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