🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27026

[PATCH net-next v2 10/15] net/mlx5e: Handle restarts with XDP-only providers

#27026
From: Björn Töpel
Date: Fri, 04 Dec 2026 16:27
120 lines
12464 bytes
An XDP-only provider backs an RQ with UMEM chunks that come back only
through that queue. Currently, mlx5 assumes that an RQ can always get
more pages, which does not hold across a channel restart.

While a queue has such a provider:
- skip its RQ, as the XSK RQ already is, in the wait for posted WQEs
  on activation. FILL may stay empty, so the wait would time out and
  the health reporter could turn off the ICOSQ;
- close the old channels of a switch before the new ones run, as the
  old RQs hold the buffers that the new ones need, and their last puts
  must not overlap the new NAPIs.

A channel switch, as for an MTU change, then stops traffic on every
channel while it runs, as without tis_tir_td_order.

Nothing installs such a provider on mlx5 before the next patch.

Signed-off-by: Björn Töpel <bjorn@kernel.org>
---

Notes (v2changes):
    Changes in v2:
    - Split out of v1 patch 12, which skipped the wait for the minimum of
      posted WQEs.
    - Close the old channels of a switch before the new ones run
      (Sashiko).
    - The message says that every channel stops while a switch runs, and
      that closing the old channels first also keeps the last puts of the
      old buffers off the NAPIs of the new ones.

 .../net/ethernet/mellanox/mlx5/core/en_main.c | 36 ++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 54f4f5a097c8..a76ba297c9a9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3102,6 +3102,14 @@ static int mlx5e_wait_channels_min_rx_wqes(struct mlx5e_channels *chs)
 		if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
 			continue;
 
+		/* An RQ that an XDP-only provider backs fills from the FILL
+		 * ring of its socket, which stays empty until the socket
+		 * gets its chunks back, so a queue that restarts under a
+		 * slow reader would never meet the bound.
+		 */
+		if (netif_rxq_has_xdp_only_mp(c->netdev, c->ix))
+			continue;
+
 		err |= mlx5e_wait_for_min_rx_wqes(&c->rq, timeout);
 
 		/* Don't wait on the XSK RQ, because the newer xdpsock sample
@@ -3528,11 +3536,29 @@ static void mlx5e_close_channels_xsk(struct mlx5e_channels *chs)
 	}
 }
 
+static bool mlx5e_has_xdp_only_mp(struct mlx5e_priv *priv, unsigned int n)
+{
+	unsigned int i;
+
+	for (i = 0; i < n; i++)
+		if (netif_rxq_has_xdp_only_mp(priv->netdev, i))
+			return true;
+	return false;
+}
+
+static bool mlx5e_close_old_first(struct mlx5e_priv *priv,
+				  struct mlx5e_channels *chs)
+{
+	if (mlx5e_has_xdp_only_mp(priv, priv->netdev->real_num_rx_queues))
+		return true;
+	return !MLX5_CAP_GEN(priv->mdev, tis_tir_td_order);
+}
+
 static int mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
 				      struct mlx5e_channels *old_chs,
 				      struct mlx5e_channels *new_chs,
 				      mlx5e_fp_preactivate preactivate,
-				      void *context)
+				      void *context, bool old_first)
 {
 	struct net_device *netdev = priv->netdev;
 	int carrier_ok;
@@ -3557,7 +3583,7 @@ static int mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
 	}
 
 	mlx5e_set_xdp_feature(priv);
-	if (!MLX5_CAP_GEN(priv->mdev, tis_tir_td_order))
+	if (old_first)
 		mlx5e_close_channels(old_chs);
 	else
 		mlx5e_close_channels_xsk(old_chs);
@@ -3580,6 +3606,7 @@ int mlx5e_safe_switch_params(struct mlx5e_priv *priv,
 			     void *context, bool reset)
 {
 	struct mlx5e_channels *old_chs, *new_chs;
+	bool old_first;
 	int err;
 
 	reset &= test_bit(MLX5E_STATE_OPENED, &priv->state);
@@ -3602,13 +3629,14 @@ int mlx5e_safe_switch_params(struct mlx5e_priv *priv,
 		goto err_cancel_selq;
 
 	*old_chs = priv->channels;
+	old_first = mlx5e_close_old_first(priv, old_chs);
 
 	err = mlx5e_switch_priv_channels(priv, old_chs, new_chs,
-					 preactivate, context);
+					 preactivate, context, old_first);
 	if (err)
 		goto err_close;
 
-	if (MLX5_CAP_GEN(priv->mdev, tis_tir_td_order))
+	if (!old_first)
 		mlx5e_close_channels(old_chs);
 
 	kfree(new_chs);
-- 
2.56.1
Technical Details
Message-ID: <20261204162723.755897-11-bjorn@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377492-linux-kernel-netdev=dewy.ru
References: <20261204162723.755897-1-bjorn@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377492-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 10/15] net/mlx5e: Handle restarts with XDP-only providers
Date: Fri,  4 Dec 2026 17:27:15 +0100
Organization: Usenet Network
Message-ID: <20261204162723.755897-11-bjorn@kernel.org>
References: <20261204162723.755897-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="2806484"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:c2HvQLO9nBdgxxQFYECrqpYC7EI= sha256:vJsaUHRCOxwbz3l2lUjqqjIU9Xv3Qg4FDUaSdiIuBtg=
	sha1:LL3VDEprLCy4fa5dpt12TNuv5U0= sha256:qxUMGTlOPKuV7OQethY5GhHpRtIRVG5z+AdmpRF8+Kw=
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 7878B117C6A; Fri,  4 Dec 2026 19:29:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.542
X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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 WmlhghI_W8gQ;
	Fri,  4 Dec 2026 19:29:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377492-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id BE2BA117C67; Fri,  4 Dec 2026 19:29:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id EB4F526388; Fri,  4 Dec 2026 16:29:16 +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=1796401755;
	b=oP00QuGPg09NLWJcboMj/kZs4vC9vHd2FGytHnwUZlwJAPgijsiY82A0ennEckmTeiBS
	 UnPY97jJEL54pYrGrE7QHhSS54BZ98KOVWreAKgzD+WadcNQ0Tc8rwvp2/HIsQdvjZQ6Z
	 AGnoHbIt3oiBlQvHpW8taFupEfJlkOp1M9UqqxnNnGnpFyR7J9/u9uil9Ood3QaE+sKH/
	 H0P7RIhbcXuzoo1Ng80b2dreZzsu5l5yLB4APZZ44JoaoC8myw3WfpHft6AlCdAp/p4gL
	 HBtUXI0RqdSALGpbMPmnt7PC8taxRwMOOoy2FwKunxqshMBOqzpx7iUHPdhX8SutRHQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796401755;
	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=XS8M+AfSXX2bS8ZPVLkO5NfxtVkV5VkHxAZyGRjRIV8=;
	b=3ZbsmFu4PFT1BFKf8qJstsgSTwAF6YGkW79chSjIyPS6NDLVaFS8vXMC4Vn9eIAPS4XS
	 kE5nnbjvyBhNBknz7mmbkxyzOg9yoMN2bUcm1s13gYJpMF6WdeDH4Wb8gBrIpWvt0Bc4O
	 rxaI5j0vy/O/sGrMQG85J1Vp+fvi73L+3IpPL1FgZWeSFIzT0xKNIIGiJuqBuajvFoFIn
	 143vrTcbZYjLiJBTHUBWSPBwskBVIrdxrmyB7CG/hlSzWZ1nSiDymDRab/K+SH29Rn7n+
	 H7hXmO3zq/M665xkjkX60tCMmwI/w9kJiQVKUdauIjiBNoGv6+9Ui80qQ9OIgm9hfOw==
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=TfnsTzQM;
	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 78872606A33C;
	Fri,  4 Dec 2026 16:29:15 +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=TfnsTzQM
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=1796401749;
	b=4Rqkd0+TA6XIXzqhRSOkhT7dZwxTaVWLNvw8hT4b6pZoycBFNlYbcP+OWKcBqk4eZywo
	 x/GvppDtm57xKnSrrurqQadJhSZWHFYzrKmeeGY9ZwShgT8V/SixCg/8CltK3/mPioDIo
	 tvEPUQI7JkOhSL7J29qU7IxnE0Umd15rXZgFzkv6HD1EsP/PdZ7DUSDE8Ovo/wnSotn7F
	 GjCpV/CcxuvMOu6T4iFwgaLiUL3FOs7v4nTEI1taoupOoleUjArc28d1IhbsrNJXyS1Zc
	 iIslALhZQQG4TWHh4awYfvF4Y19lc21tnJkLZSNFf+eKr4JV+1AvHs9qiQnOIiEWSYw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796401749;
	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=XS8M+AfSXX2bS8ZPVLkO5NfxtVkV5VkHxAZyGRjRIV8=;
	b=lk0swXqegxIa7DQrLMjGl0NUaSgYnspSxPiev+uy3bsv74NXI1jD1PMeovjKYO3++6O6
	 voa5OUA5mPS2sayTyXjM8DMU7wmQBDCUMzg7sXjsLVDi6jp4/UXhKholhhAmyYA0UJNc6
	 c6E//xq0Fq7u5RegF0IHmIF0W8ZXP53Ncp3ZjyL3QEKDO6caSHZ700AkxCcvCNps4Sj8C
	 6iBwFzzq52X1iCHmYrURgH/8IsewfhlrKchpQm7GvDI23U9u4AapKAVuKFjOiATMaReZ7
	 6bHynLIADgafV7SaYJiBV735lBSHNBVDsE38Z5zG6STg0w+lt8M3KcFbeC2I8YqnQzA==
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=TfnsTzQM;
	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 950FE606A322;
	Fri,  4 Dec 2026 16:29:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAE6A1F000C2;
	Fri,  4 Dec 2026 16:29:00 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796401749;
	bh=XS8M+AfSXX2bS8ZPVLkO5NfxtVkV5VkHxAZyGRjRIV8=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=TfnsTzQMMAkn17bGVR3FYn96txLfp2ikBW7gzyaK1vj7lYPKD8FgsHud4Ipt1tT15
	 Oe2HBfBTmprG6uRkr+SxLDj11rmfaAQLUcw5YWgsxhJ1a0MVli+qKHmw9Frw/PsnHw
	 36MYuwBg+zgwQ9l5Wof+0IxOMB78SxulHjPpfKxdskWiW5oBpKgPxtamwzTOo1VHhv
	 ZHwkuzxrf2gF3DBuZnIiBhc9m06ME63yxZR1iURtKUph3u8pxAFU+wQbGt4S7azn1b
	 EQ6vgDVFdy6RRTcwvBlGIpqnFCtWoQ4hLCpBcwcwX/tj9hPX0axQP5T7UerQFeKG8n
	 uN29CvBh6gkZQ==
X-Cc: Björn Töpel <bjorn@kernel.org>,
	Simon Horman <horms@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	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>,
	David Wei <dw@davidwei.uk>,
	Tao Cui <cuitao@kylinos.cn>,
	linux-kernel@vger.kernel.org,
	kernel-team@meta.com,
	"Mike Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>,
	linux-rdma@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261204162723.755897-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