[patch net-next 1/7] netdevsim: don't re-create dummy region during devlink reload

Jiri Pirko
2022-08-25T10:34:10Z

Follow the pattern of other drivers and do not create/destroy region for
registered devlink instance.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
drivers/net/netdevsim/dev.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
index e88f783c297e..cd3debc9921a 100644
--- a/drivers/net/netdevsim/dev.c
+++ b/drivers/net/netdevsim/dev.c
@@ -1460,13 +1460,9 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev,

nsim_devlink_param_load_driverinit_values(devlink);

- err = nsim_dev_dummy_region_init(nsim_dev, devlink);
- if (err)
- return err;
-
err = nsim_dev_traps_init(devlink);
if (err)
- goto err_dummy_region_exit;
+ return err;

nsim_dev->fib_data = nsim_fib_create(devlink, extack);
if (IS_ERR(nsim_dev->fib_data)) {
@@ -1507,8 +1503,6 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev,
nsim_fib_destroy(devlink, nsim_dev->fib_data);
err_traps_exit:
nsim_dev_traps_exit(devlink);
-err_dummy_region_exit:
- nsim_dev_dummy_region_exit(nsim_dev);
return err;
}

@@ -1648,7 +1642,6 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev)
nsim_dev_health_exit(nsim_dev);
nsim_fib_destroy(devlink, nsim_dev->fib_data);
nsim_dev_traps_exit(devlink);
- nsim_dev_dummy_region_exit(nsim_dev);
}

void nsim_drv_remove(struct nsim_bus_dev *nsim_bus_dev)
@@ -1662,6 +1655,7 @@ void nsim_drv_remove(struct nsim_bus_dev *nsim_bus_dev)

nsim_bpf_dev_exit(nsim_dev);
nsim_dev_debugfs_exit(nsim_dev);
+ nsim_dev_dummy_region_exit(nsim_dev);
devlink_params_unregister(devlink, nsim_devlink_params,
ARRAY_SIZE(nsim_devlink_params));
devl_resources_unregister(devlink);
--
2.37.1