Re: [PATCH net v4 1/4] igb: don't touch rings that don't exist when disabling an XSK pool

From: Antonio Quartulli

Date: Mon Nov 23 2026 - 15:29:15 EST




On 21/11/2026 00:17, Janis Edvarts Lacis wrote:
On 20 Nov 22:01, Antonio Quartulli wrote:
xsk_get_pool_from_qid() checks the queue id against the stack's real
queue counts, which can be higher than the number of rings the device
has: on 82576, enabling VFs leaves a single Tx queue while keeping two
Rx queues, and igb can fall back from MSI-X to MSI with a single queue
on resume. Disabling the pool of such a queue, e.g. one bound to queue 1
before enabling VFs, then passes a NULL Tx ring to
igb_txrx_ring_disable().

Only disable and re-enable the rings the device has: skip the queue if
it has no Rx ring, and only the Tx part if it has no Tx ring, so that
an Rx ring using the pool still stops using it.


What happens if a pool is bound to, say, queue 1 and the socket stays open across a runtime resume that falls back from MSI-X to MSI (queue 1 becomes invalid)?

If the socket is closed after igb_rtnl_resume_task() has reduced both
real queue counts to one, xsk_get_pool_from_qid() will return NULL for
queue 1. As I read it, igb_xsk_pool_disable() then returns -EINVAL
before doing the cleanup and resources get leaked.

I may be mistaken here, if so, please let me know :)

Hi Janis,

actually you're not mistaken, thanks for spotting it.
Once the real Rx queue count is lowered below a queue with a bound XSK pool, xsk_get_pool_from_qid() no longer finds the pool, the disable fails ("Failed to disable zero-copy!") and the pool's DMA mappings are never unmapped.

igb already does this today (it lowers the counts on runtime resume, just without RTNL), and so does any shrink done by the driver itself (e.g. SR-IOV reinit), so it's worth fixing here.

In v5 igb I will follow what ethtool does for channel changes: when the
driver lowers its queue counts, it keeps the real Rx count up to the
highest queue that still has an XSK pool, so the pool can still be
disabled and unmapped (the rings are skipped as they don't exist). The
Tx count follows the device, and the Rx count is lowered at the next
open.

This said, I will first wait for Sashiko to report any other potential issue and then I'll work on v5.

Best regards,

--
Antonio Quartulli

CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com