๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24027

Re: [PATCH net v5 3/6] igb: keep the stack's Rx queues that still have an XSK pool

#24027
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 00:37
99 lines
11684 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] igb_set_real_num_queues()
  (drivers/net/ethernet/intel/igb/igb_main.c) keepsโ€ฆ

--

igb: keep the stack's Rx queues that still have an XSK pool

When igb lowers its own queue counts (an MSI fallback on resume, or a VF
enable), this patch keeps netdev->real_num_rx_queues up to the highest
queue that still has an XSK pool. That way the pool can still be found
and disabled. The count is lowered again at the next open.

Closes: https://lore.kernel.org/netdev/xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f/

> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 6b299a1429a8e..47a92447aab27 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -4125,6 +4125,26 @@ static int igb_sw_init(struct igb_adapter *adapter)
>  	return 0;
>  }
>  
> +/* ethtool refuses to remove a queue that still has an XSK pool. igb can't
> + * refuse when it lowers its queue counts by itself, so keep the stack's Rx
> + * queue instead, or the pool couldn't be disabled anymore: lower the count
> + * once it's gone, at the next open.
> + */
> +static int igb_set_real_num_queues(struct igb_adapter *adapter)
> +{
> +	struct net_device *netdev = adapter->netdev;
> +	unsigned int rxq = adapter->num_rx_queues;
> +	unsigned int i;
> +
> +	for (i = netdev->real_num_rx_queues; i > rxq; i--)
> +		if (xsk_get_pool_from_qid(netdev, i - 1)) {
> +			rxq = i;
> +			break;
> +		}

[Severity: Low]
Should this loop only keep queues whose pool is in zero-copy mode?

As written, any registered pool keeps the count up, including copy-mode
(XDP_COPY) pools. The comment above gives one reason for keeping the
queue: otherwise the pool couldn't be disabled. That reason only seems to
apply to zero-copy pools:

net/xdp/xsk_buff_pool.c:xp_disable_drv_zc() {
    ...
	if (pool->umem->zc) {
		bpf.command = XDP_SETUP_XSK_POOL;
    ...
}

A copy-mode pool on a removed queue is cleared by
__xsk_clear_pool_at_qid(). That function walks dev->_rx[] and dev->_tx[]
up to the allocated num_rx_queues and num_tx_queues, so the extra queues
were not needed for that case before this patch.

This case also looks easy to reach. igb only sets the real queue counts
through this helper, so before the first open real_num_rx_queues is still
16 from alloc_etherdev_mq(..., IGB_MAX_TX_QUEUES) in igb_probe(). While
the device is down, xsk_reg_pool_at_qid() accepts any qid below 16.

igb_xsk_pool_enable() rejects a zero-copy bind on such a queue:

	if (qid >= adapter->num_rx_queues)
		return -EINVAL;

If neither XDP_ZEROCOPY nor XDP_COPY is requested, xp_assign_dev() falls
back to copy mode and leaves the pool registered at that qid. An explicit
XDP_COPY bind skips the driver entirely.

On the next __igb_open(), or after a VF enable or MSI fallback with only a
copy-mode socket on a removed queue, this loop finds that pool and calls
netif_set_real_num_queues(netdev, num_tx_queues, qid + 1). The stack would
then report RX queues that have no hardware ring (rx-N sysfs entries and
netdev-genl queue dumps) until the socket is closed and the device is
reopened.

Would checking pool->umem->zc here limit the behavior to the case
described in the commit message and the comment?

> +
> +	return netif_set_real_num_queues(netdev, adapter->num_tx_queues, rxq);
> +}
> +

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124235723.1135808-1-antonio%40mandelbit.com
Technical Details
Message-ID: <179591262735.3135.13991879696193077438@kernel.org>
Path: mbox-mo1.pugleaf.net!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-373322-linux-kernel-netdev=dewy.ru
References: <20261124235723.1135808-4-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!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-373322-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 3/6] igb: keep the stack's Rx queues that still
 have an XSK pool
Date: Sun, 29 Nov 2026 00:37:07 +0000
Organization: Usenet Network
Message-ID: <179591262735.3135.13991879696193077438@kernel.org>
References: <20261124235723.1135808-4-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1069366"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:D7m3IZdZeiRGFsLDZ0RSZ3TB0oU= sha256:BHurgCVUJktg8jL9TCuRT1TJM95j0NLDlRO++JQuCA4=
	sha1:uFc3/UQGuBmWa8TTWuSVREjvSLw= sha256:WvE6Hkzk/jpwtx8XCxu6pEbswZxCCu8pj+/wPBee2n8=
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 1CC15125F8E; Sun, 29 Nov 2026 03:37:35 +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 cKFoGJsivJ6v;
	Sun, 29 Nov 2026 03:37:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373322-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 538F8125F88; Sun, 29 Nov 2026 03:37:23 +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 E3C2F28F64; Sun, 29 Nov 2026 00:37:09 +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=1795912629;
	b=vzG9JNsdWj5k2rm7TCo82cp1FOwNujyP8dNWJVaK5xH9Rfs8cnqv6pvu43fQpp73vwl5
	 OYebbG9SaCSsqq5O4mpe9/9YrdNf/ea9aoDXTus0waTLzfQSgXBY3Z33e0Ey3TcU+qmXm
	 8h0pXR2rE8HWyG37svEX1JMBMQ2e+WQLDMPPmTi2KjKgphnGgL80in8s1cN94WV1HMQ2l
	 /uJTLV0/6wtj/f/jXMX4J3Gj6rNQMAOAhu+fzQp+DRpoQfOpHjB4tkzbQGnNETYrOVOdZ
	 d4aQb25Q8NsSMV/p5EKwdY8xwYuT/jP4hgJig3Qlpc7S95cWtO7XCK3w9AI5pUtCw4g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795912629;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=kpHARFiZg1sm53i4FkJm3ttTLca6QFWU8cP1YHTrW64=;
	b=i/rCrs/I1PtwwmDfahQV6zD/Mxqdo8eUBygqg8gzKvVRaCpbSvTRjd/ynrIYmlupZwit
	 qkUxpgtZuZS+zoa31Qr4pRnxN5pHaRnDZM5oQ17IqqWeGnQLbapMFotz2gncFLXnpY39H
	 dtmDEyBYTgaRtfuOhFSYL8yZF1SFdYMrLro9K9X8a6ET+TWHl9y6/hK3RAwxpb5m/Glwq
	 8XjpWYAbm7VUVkoUL3Tpr7HEfQdFsYC51WuR4YsNk85vBGb3yGRmLF9UZBDZhZLR7bB1E
	 wwZNLbi8wlmHmktFFSdR0VAlzib7JTodDWeupJHqmc0aUVrZKK4Mh7bStAp3rPuRw4w==
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=fWeLkb7v;
	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 9762D606A337;
	Sun, 29 Nov 2026 00:37:09 +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=fWeLkb7v
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=1795912628;
	b=sqbrm7HPwZGiUHXvH5/gS+y/NsAF/LLRedx1m5LeHpUffBotcvoBWcXvozIyALOuOx4T
	 WfZ8t3CLS5cH3/ZUGp3rxXPXi865k+Y49HzWUKuZXJKXUF8BFRIzPWZYxQ0GmMMGry87+
	 Q3pbzrGShSMv+VNFJZoql5xIh+HR3lTuJEpOnrCopgH+iF21jSyle3U8h+2zG/OFbiaGp
	 mg3RzQqwpaR9whnzQxx5SKWut9zCYyPi168yMaQH2q/072FgJTYF9s5TFUmec7n32lbvw
	 UvH5p4CVPyHfAfwuJN/pBZxNYe1m5A+sCXt3DS+2YXwm/TNJObfpEeDuEP4Dxl/tnKQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795912628;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=kpHARFiZg1sm53i4FkJm3ttTLca6QFWU8cP1YHTrW64=;
	b=4lUEA/J9stOTiq40YlIRmPONpgYXAjvhl5ZLNp3dSXhgYteLhcD7ia7HK+qkTk4YnztN
	 vb2cYBKmjhxxXq+KxGi5n+tXp+vjRJaWZvawyLMMAbK9M7nq5+Z1h6/zj5QkKkhWW+6Vl
	 TynbdN3kY+ER0UzgMUZ/5JfRYj4jFDdP5ecgmp3hC88oCDMivFfPbzbpVE+ZQivMO0WZh
	 X3Dz+yKW+/gPVsGvl6rqOnbZfDiZptofdKRTFBQUShEWsahgqMohABtUOypWSK085KGGS
	 6gU5YzXor5Do+P+pjDrVMk+B2+sLvAH0eIrYuhLycj2jDrOEpH2DBswb+lGSrvL1ZjQ==
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=fWeLkb7v;
	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 BA66A606A32A;
	Sun, 29 Nov 2026 00:37:08 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C48791F00898;
	Sun, 29 Nov 2026 00:37:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795912628;
	bh=kpHARFiZg1sm53i4FkJm3ttTLca6QFWU8cP1YHTrW64=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=fWeLkb7vjj3DKqwGdPXFhesczekJfvSbQtaGkGv8Kqo3RqaHTm8v/lcx5QdjBDkEe
	 RSFhW4l8WinG8/LFR/FU2gCuhY+kev+ZI6TILA6Pek0MfL0FSQJ/Dt2t/ShfCLWnTG
	 X5ewqVhgK8rp5JGqho6ZKFkMGEeYbF3GRjP1W5nHtWuL9NN9l/0k8zHU5VkywrYnnC
	 lNnsidichhDe01Tq2NLfRTz2x4rAonQtPbZ0gdWaP+FYhRWhtbuYa2xvWtVVccA7Cf
	 jqt0a8FUo/ULnmNRgsHmk53qW23P+fnBuTQY+1w3zMhv8UYsxLf7hwH4yShhtBI9AA
	 vePoEOExIe6Jw==
X-Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
 przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 janislacis06@gmail.com, kurt@linutronix.de, joe@dama.to,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-In-Reply-To: <20261124235723.1135808-4-antonio@mandelbit.com>
X-sashiko-severity: Low
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