aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/netdev.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-02-06 22:56:38 +0000
committerJakub Kicinski <[email protected]>2025-02-08 01:21:03 +0000
commit285b3f78eabd951e59e98f01f86abaaa6c76cd44 (patch)
tree173c9371158b93ff7588f9bc2000299abda2a83d /drivers/net/netdevsim/netdev.c
parentnet: page_pool: avoid false positive warning if NAPI was never added (diff)
downloadkernel-285b3f78eabd951e59e98f01f86abaaa6c76cd44.tar.gz
kernel-285b3f78eabd951e59e98f01f86abaaa6c76cd44.zip
netdevsim: allow normal queue reset while down
Resetting queues while the device is down should be legal. Allow it, test it. Ideally we'd test this with a real device supporting devmem but I don't have access to such devices. Reviewed-by: Mina Almasry <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r--drivers/net/netdevsim/netdev.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 42f247cbdcee..9b394ddc5206 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -645,8 +645,11 @@ nsim_queue_mem_alloc(struct net_device *dev, void *per_queue_mem, int idx)
if (ns->rq_reset_mode > 3)
return -EINVAL;
- if (ns->rq_reset_mode == 1)
+ if (ns->rq_reset_mode == 1) {
+ if (!netif_running(ns->netdev))
+ return -ENETDOWN;
return nsim_create_page_pool(&qmem->pp, &ns->rq[idx]->napi);
+ }
qmem->rq = nsim_queue_alloc();
if (!qmem->rq)
@@ -754,11 +757,6 @@ nsim_qreset_write(struct file *file, const char __user *data,
return -EINVAL;
rtnl_lock();
- if (!netif_running(ns->netdev)) {
- ret = -ENETDOWN;
- goto exit_unlock;
- }
-
if (queue >= ns->netdev->real_num_rx_queues) {
ret = -EINVAL;
goto exit_unlock;