Article View: linux.kernel.netdev
Article #24797[PATCH net v6 4/7] igb: keep the stack's Rx queues that still have an XSK pool
From: Antonio Quartulli
Date: Mon, 30 Nov 2026 21:37
Date: Mon, 30 Nov 2026 21:37
90 lines
13466 bytes
13466 bytes
When igb lowers its queue counts by itself, after a fallback from MSI-X
to MSI on resume or when enabling VFs, xsk_get_pool_from_qid() doesn't
find the pool of a socket bound to a removed queue anymore. Disabling
it then fails ("Failed to disable zero-copy!") and the pool's DMA
mappings are never unmapped.
ethtool refuses to remove a queue that still has an XSK pool, but igb
can't refuse a VF enable or a resume fallback. Keep the real Rx queue
count up to the highest queue that still has a zero-copy XSK pool
instead, so that the pool can still be disabled, and lower it at the
next open. Copy mode pools don't need the driver to be disabled. The
Tx count follows the device: an XSK pool is always bound to both an Rx
and a Tx queue, and the lookup finds it through the Rx one.
Tested with the 82576 emulated by QEMU and a zero-copy AF_XDP socket,
bound to queue 2 when enabling a VF, and to queue 1 across a runtime
resume forced to use MSI with a single queue (with a test hook): closing
it warned and leaked before, not anymore.
Fixes: 80f6ccf9f116 ("igb: Introduce XSK data structures and helpers")
Cc: stable@vger.kernel.org # 6.14+
Reported-by: Janis Edvarts Lacis <janislacis06@gmail.com>
Closes: https://lore.kernel.org/netdev/xupy6jbpnziq2qji54zjbvm7neggrwkxg3sfrhlolmrd6ysifl@zptk6ynkbu5f/
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
v6: only zero-copy pools keep a queue: copy mode pools don't need the
driver to be disabled (Sashiko); dropped Janis's Reviewed-by
v5: new patch (Janis)
drivers/net/ethernet/intel/igb/igb_main.c | 30 +++++++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index bf24768..8b8e8c3 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4129,6 +4129,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);
+}
+
/* Some settings need RTNL, which isn't held when resuming from runtime
* suspend: apply them from here instead, if the device is still up.
* Resuming the device first waits for a resume or suspend in progress.
@@ -4142,9 +4165,7 @@ static void igb_rtnl_resume_task(struct work_struct *work)
pm_runtime_get_sync(&adapter->pdev->dev);
if (!test_bit(__IGB_DOWN, &adapter->state) &&
netif_running(adapter->netdev)) {
- if (netif_set_real_num_queues(adapter->netdev,
- adapter->num_tx_queues,
- adapter->num_rx_queues))
+ if (igb_set_real_num_queues(adapter))
netdev_err(adapter->netdev,
"error setting real queue count\n");
}
@@ -4214,8 +4235,7 @@ static int __igb_open(struct net_device *netdev, bool resuming,
* runtime resume igb_rtnl_resume_task() does it.
*/
if (rtnl_held) {
- err = netif_set_real_num_queues(netdev, adapter->num_tx_queues,
- adapter->num_rx_queues);
+ err = igb_set_real_num_queues(adapter);
if (err)
goto err_set_queues;
}
--
2.56.1
Technical Details
Message-ID:
<20261130213740.3323814-5-antonio@mandelbit.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374474-linux-kernel-netdev=dewy.ruReferences:
<20261130213740.3323814-1-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!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374474-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: [PATCH net v6 4/7] igb: keep the stack's Rx queues that still have an XSK pool Date: Mon, 30 Nov 2026 22:37:34 +0100 Organization: Usenet Network Message-ID: <20261130213740.3323814-5-antonio@mandelbit.com> References: <20261130213740.3323814-1-antonio@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1544240"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:LGqPFP16LIX42IkXqdkzCkvo37M= sha256:MsoKYlZ58Li7mUiGM5MPdISklf4RcMTTLn4HD9Ni9mg= sha1:Mnltk2diNeVMYsxV811XN3eiw1M= sha256:gHcihg7jxOmu1YJGcCOQ78iollZuO68uPfEWtilz5lw= 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 E245612600C; Tue, 1 Dec 2026 00:38:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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=mandelbit.com 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 E7LXoeetctgm; Tue, 1 Dec 2026 00:38:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374474-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5B9B2126007; Tue, 1 Dec 2026 00:38:45 +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 B4A002FEE2; Mon, 30 Nov 2026 21:38:15 +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=1796074686; b=m3LAKcxgvUDydDv2i+ieX3hG9j3kWeumSlEGDut/Ulz1ekAIGNPE7k1t5gqpOtjjmTvc 26SDWx9DHOCutRL8TILk34U/XAW44AFE/bortb6YBEma6FIoMsCbe8BcCjYUZihZ5G42O l7IuILIVvpp4tuOggAu5mLOexz7ywfRd+P6zwBkpRzs95zt028ojMJGBOQTF7gWi5f6os OOzKing7Vc3HmufuLYMpQb7+OhxPTJ+HxDfuGop8mz+1uwGHRRH3EiuAE08dI96+lMVkP Y0NStRanNhIeUTFVtwHLmiNzmL9XE8I/rJV3/z2ux0DhsgrZbLCZyAh5doHnVb9uF1g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074686; h=X-Original-To:Received:DMARC-Filter: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-Transfer-Encoding:X-Rspamd-Queue-Id; bh=XEYI+GiavhdEaBlenPNtD0YeUYaaVRemvBXNbdB6Qbw=; b=HQaSTbnCeuClBWPbtjOzPVb+6syQT/ybLQNqYFmTRMFyc8p1rJihbWrWKc7iUWqBNThu mOP6ifYPBBbRZ8WPTrTWBFMhCokz0/dRlzCAL1zr6ua8rlBS9QfiTOWtsSfd0HCaFLpIR BuP/5x8vXeZwNCzTPvwDkAhFNkkY0Nb2J3i8L2csRh4xbGttSG7yQIPJrIA8X1GVxKipA at5Qbpt4lSfha/XS6PS6RGITEB+8zaELDlQZ5GVNdX1F3v59DHEKwabJbnKHZbTJmIyCw rRlBU3v/B8NOITf2Ae1xZFD2PcXH8N58lGPcwlEKw8ucurWGbRtExVwEhOekHHH0O3Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=tPGt9tvs; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; 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 0798560A261C; Mon, 30 Nov 2026 21:38:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=tPGt9tvs X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796074685; b=kY5OgL+8WiycRafa8prh47RXxGPYn/HykzB+g2NEIsxnfiFUmSSE39KEgaZ1Vza8a77q wz2Vszg+RTEdMNQoFvUSZmZ0eWXSkVhpKuAH8OYVuz4qT0138vPwFw9Lu59ykDGZ7iU+j mzWa8r/ULyOiiOzAUpG0WgbCZ8qcKtbIhPOtQ4JitpUhcgwWEjUmsQlyEXiQosEmUxDDq qS/A4VKRES3PCVFZ1rdfhxnrVDifPkWSvXe3Sp+u0ezWY9yHqvy3UXp41Tb5PuKMZkavW 4MNW86WVh6meThOOKybGW3mcklFj3SaYU/5fyJzMZ/IpilYvN7Ejn7qk9lMEqFBBSQw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074685; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=XEYI+GiavhdEaBlenPNtD0YeUYaaVRemvBXNbdB6Qbw=; b=1v7O1I05qSAJlBJWBJt9pOuGRaxRble6kj/obJNbvgIbOoiG4aty6iForwzUgd2ZdNeA cG5rw2E48iYIRGdiu3jeBxEXdkyXaVEm4LDHw/I/cKxcaUffnxV7wy2LS6NGwG1BwIP9S LBjLuCf1tkaGHcyqpV9F8YoJypTrw3ofNbkPWV7llgLCdY8lVBy92ehIkbDyQXD3/P8L9 IQ8gL7C5eFud3/uvpT4eEAKiYiP/qFDPGrQHBC5dWE0DO/JCtZIFRW7YmK1lOo5OD3RSu uxqkUiHz1HGlgthKCL4+HGP1XoEPdwhHAIHER3u21iSFrxwg+0WpZPTqTD4r/HPmiaA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=tPGt9tvs; arc=none smtp.remote-ip=195.10.208.42 X-Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DD02606A337; Mon, 30 Nov 2026 21:38:04 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7DD02606A337 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jdcnZ4C1Wz5wV5; Mon, 30 Nov 2026 22:37:54 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796074674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XEYI+GiavhdEaBlenPNtD0YeUYaaVRemvBXNbdB6Qbw=; b=tPGt9tvskHLqCdNITSJEzNpT1ciU0uksGeC/nXT7TzuG8ixc3pYLOpf0riFCPveImHt/OP HH/3Q1n9HkQIa/47KkyLhDpnbqgCuyFreEmswnwAoVhcUsZcSehp9l4qnOZtte7GLBBMO9 gTI0oFOsZr24lFdtHavuvqiTlCSwIGrsnbQEyRvmT6tWiZJVaVud0DcdkmXT6hm536y0+W Vz8mqELaP1M4td99DC/Yfyo8OEVJv6vva3UanRGJ4y72bF33ffO1W4QwyVEMe59aC/PoN7 vwF+xjDv36bbE13IRngWneWFHsvHf+m9VhVogLLxzfyWmWjOc/5orS0VKxlShA== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=antonio@mandelbit.com X-Cc: Antonio Quartulli <antonio@mandelbit.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Janis Edvarts Lacis <janislacis06@gmail.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>, Kurt Kanzenbach <kurt@linutronix.de>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Heiner Kallweit <hkallweit1@gmail.com>, Joe Damato <joe@dama.to>, "Rafael J. Wysocki" <rafael@kernel.org>, Sven Auhagen <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 X-Mailer: git-send-email 2.56.1 X-In-Reply-To: <20261130213740.3323814-1-antonio@mandelbit.com> 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 X-Rspamd-Queue-Id: 4jdcnZ4C1Wz5wV5 X-Received-Bytes: 13207