From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796163641; b=h8ssrH+MHLWi9khk6yRHg95+6+ClczFTGptplA7VRETIrWAxE5EVQKLsFgvMKSjnd1Bb E+sBpjVdofMn+NtsjuE2YSRklHNAm4r3U+utYU0rrcfC3OPDnUE+anN5Zw9fF7GxnYoFZ 4/GaJ/Te5LQpAPuTelxhZyjk6shMnSwwpHxZ8AzGB5uZEYjDvHJoYEzoh2pYRW4yHHYje i2dX2547Vw8bAST1ziL1Gc6ZjMTdH60G2KKdJ+Fk2gzg9oRIt9eMh6WBflcx7+lEMFCbT sikbeT0cpJengYGTpKMr7JzFEv2MtY0H/+7JUo7nhqC558Srxkq7OCNFd19H5meWjCQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796163641; 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=sLeTCPjOyXsWO7vn05owofvP6H0LXf/5E0iu3y4Ws4w=; b=PDAMgexrxzIiJxu58CnzdeAUVtmWHWO7qxHcsQF0u/TYCh7kSg/R18ebi3CAC12Zy0YC oaB9K8t77ELoOQAvqcJf1PoHQxFcyhmxW3vu6UtE4wnd5PsO9YmMx65BUxCKzTvLAz91g DnGwsNhm0JNwBaZC6hDa5LJbmveP1ISN6CxYkPnmn/4L/O+soijf+sRbTJMSUHlwFwbQr HgzEi3feRX0N2Y76SXUftyY0GUXWyOo9g2Pzdm1mtiszu0/f9mS1QHFQZxbaqP5w+XmJQ YO8x7kBqejVh3Bx7PKyQneiT5sw1qXYPiyKW2b8Ty/4dBwMNOYoyWdO3KynCj15Hudg== 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=Lgyf0DCR; arc=none smtp.remote-ip=100.103.45.18 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 56011606A684; Tue, 1 Dec 2026 22:20:41 +0000 (UTC) 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=Lgyf0DCR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C5CA1F00893; Tue, 1 Dec 2026 22:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796163640; bh=sLeTCPjOyXsWO7vn05owofvP6H0LXf/5E0iu3y4Ws4w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Lgyf0DCRluPxNZsgwC5LrYf9mN8MrSafYzcNJIjLai5XG5YQOTWk+b+mYJNK62HFU h1OpyLVy8b1X6HFJCmHuUZcOB8qeB/dNdqm/fqX8Nn3/qYXOwyfTA6PHem2nmk/lNY DrjkqZbDCR+f4+PTqb1sYXdgALcL4rpbXE/+oGPGYg9o1P694sE/CMShXDMuI2cYi/ VYRRjVdKOiw5e7MouQQDkGROjdYETMgIoWQtXObwBuqaXZwvNySBnMy4dUTiKw3NL/ lO5pwWO7AQvCUt9S4Fv5oSW1cjAZT1seeto55cQkzYCQWdGq63H0bX4UjsApFRqf7U L6Dl/FLiINsEg== Subject: Re: [PATCH net v6 4/7] igb: keep the stack's Rx queues that still have an XSK pool From: netdev-bot+sashiko@kernel.org To: antonio@mandelbit.com 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, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, sriram.yagnaraman@ericsson.com, kurt@linutronix.de, maciej.fijalkowski@intel.com, hkallweit1@gmail.com, joe@dama.to, rafael@kernel.org, sven.auhagen@voleatech.de, netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, stable@vger.kernel.org Date: Tue, 01 Dec 2026 22:20:39 +0000 Message-ID: <179616363905.3146.10706452251262063361@kernel.org> In-Reply-To: <20261130213740.3323814-5-antonio@mandelbit.com> References: <20261130213740.3323814-5-antonio@mandelbit.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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] After this patch, the stack's Rx queue count and igb's ring count can disagree until the next open. -- igb: keep the stack's Rx queues that still have an XSK pool This patch adds igb_set_real_num_queues(). When igb lowers its own queue counts after a VF enable or an MSI-X to MSI fallback on resume, the helper keeps the stack's real Rx queue count up to the highest queue that still has a zero-copy XSK pool. That way the pool can still be found and disabled, and the count is lowered 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 5774a4d3c9810..9752350ffc68b 100644 > --- a/drivers/net/ethernet/intel/igb/igb_main.c > +++ b/drivers/net/ethernet/intel/igb/igb_main.c > @@ -4128,6 +4128,29 @@ 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 a zero-copy 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; > + struct xsk_buff_pool *pool; > + unsigned int i; > + > + for (i = netdev->real_num_rx_queues; i > rxq; i--) { > + pool = xsk_get_pool_from_qid(netdev, i - 1); > + if (pool && pool->umem->zc) { > + rxq = i; > + break; > + } > + } > + > + return netif_set_real_num_queues(netdev, adapter->num_tx_queues, rxq); [Severity: Low] Until the next open, can this leave the stack advertising Rx queues that have no ring behind them? For example, say a zero-copy pool is bound to queue 2. A VF enable or an MSI-X to MSI fallback then lowers adapter->num_rx_queues to 1, but real_num_rx_queues stays at 3. Queue 1 has no ring, yet the stack still counts it as real. In that window, a new AF_XDP bind to queue 1 passes the check in xsk_reg_pool_at_qid(): net/xdp/xsk.c:xsk_reg_pool_at_qid() { ... if (queue_id >= max(dev->real_num_rx_queues, dev->real_num_tx_queues)) return -EINVAL; ... } With XDP_COPY, xp_assign_dev() returns 0 straight away. With default flags, ndo_bpf(XDP_SETUP_XSK_POOL) reaches igb_xsk_pool_enable(), which rejects the queue: drivers/net/ethernet/intel/igb/igb_xsk.c:igb_xsk_pool_enable() { ... if (qid >= adapter->num_rx_queues) return -EINVAL; ... } xp_assign_dev() then falls back to copy mode and returns 0. So the bind succeeds, but the socket never gets any Rx traffic, because no ring has queue_index 1. On Tx, real_num_tx_queues follows the device, so __xsk_generic_xmit() skips the socket and returns no error: net/xdp/xsk.c:__xsk_generic_xmit() { ... if (xs->queue_id >= xs->dev->real_num_tx_queues) goto out; ... } Before this patch, igb would have lowered real_num_rx_queues to 1 and the same bind would have failed with -EINVAL. Is this window intended? Or should binds to queues at or above adapter->num_rx_queues still be refused while the count is held up? > +} > + [ ... ] -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130213740.3323814-1-antonio%40mandelbit.com