diff options
author | Jakub Kicinski <kuba@kernel.org> | 2025-02-06 14:56:36 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-02-07 17:21:02 -0800 |
commit | 3e7efc3f4f03bca0ea630c302e7c79cf807476bb (patch) | |
tree | 2edc81d1789e4d721d4caedfc09e09c748747b52 /net/core/netdev_rx_queue.c | |
parent | 1eb824d69f8d88405e4e80c568e8f07080309fb0 (diff) | |
download | linux-3e7efc3f4f03bca0ea630c302e7c79cf807476bb.tar.gz linux-3e7efc3f4f03bca0ea630c302e7c79cf807476bb.tar.bz2 linux-3e7efc3f4f03bca0ea630c302e7c79cf807476bb.zip |
net: devmem: don't call queue stop / start when the interface is down
We seem to be missing a netif_running() check from the devmem
installation path. Starting a queue on a stopped device makes
no sense. We still want to be able to allocate the memory, just
to test that the device is indeed setting up the page pools
in a memory provider compatible way.
This is not a bug fix, because existing drivers check if
the interface is down as part of the ops. But new drivers
shouldn't have to do this, as long as they can correctly
alloc/free while down.
Reviewed-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/20250206225638.1387810-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core/netdev_rx_queue.c')
-rw-r--r-- | net/core/netdev_rx_queue.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c index d421abe06c03..ddd54e1e7289 100644 --- a/net/core/netdev_rx_queue.c +++ b/net/core/netdev_rx_queue.c @@ -38,13 +38,17 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) if (err) goto err_free_new_queue_mem; - err = qops->ndo_queue_stop(dev, old_mem, rxq_idx); - if (err) - goto err_free_new_queue_mem; - - err = qops->ndo_queue_start(dev, new_mem, rxq_idx); - if (err) - goto err_start_queue; + if (netif_running(dev)) { + err = qops->ndo_queue_stop(dev, old_mem, rxq_idx); + if (err) + goto err_free_new_queue_mem; + + err = qops->ndo_queue_start(dev, new_mem, rxq_idx); + if (err) + goto err_start_queue; + } else { + swap(new_mem, old_mem); + } qops->ndo_queue_mem_free(dev, old_mem); |