Commit f57ab5b7 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

netdevsim: dev: Initialize FIB module after debugfs

Initialize the dummy FIB offload module after debugfs, so that the FIB
module could create its own directory there.
Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 484a4dfb
...@@ -1012,23 +1012,25 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, ...@@ -1012,23 +1012,25 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev,
nsim_dev->fw_update_status = true; nsim_dev->fw_update_status = true;
nsim_dev->fw_update_overwrite_mask = 0; nsim_dev->fw_update_overwrite_mask = 0;
nsim_dev->fib_data = nsim_fib_create(devlink, extack);
if (IS_ERR(nsim_dev->fib_data))
return PTR_ERR(nsim_dev->fib_data);
nsim_devlink_param_load_driverinit_values(devlink); nsim_devlink_param_load_driverinit_values(devlink);
err = nsim_dev_dummy_region_init(nsim_dev, devlink); err = nsim_dev_dummy_region_init(nsim_dev, devlink);
if (err) if (err)
goto err_fib_destroy; return err;
err = nsim_dev_traps_init(devlink); err = nsim_dev_traps_init(devlink);
if (err) if (err)
goto err_dummy_region_exit; goto err_dummy_region_exit;
nsim_dev->fib_data = nsim_fib_create(devlink, extack);
if (IS_ERR(nsim_dev->fib_data)) {
err = PTR_ERR(nsim_dev->fib_data);
goto err_traps_exit;
}
err = nsim_dev_health_init(nsim_dev, devlink); err = nsim_dev_health_init(nsim_dev, devlink);
if (err) if (err)
goto err_traps_exit; goto err_fib_destroy;
err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count); err = nsim_dev_port_add_all(nsim_dev, nsim_bus_dev->port_count);
if (err) if (err)
...@@ -1043,12 +1045,12 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev, ...@@ -1043,12 +1045,12 @@ static int nsim_dev_reload_create(struct nsim_dev *nsim_dev,
err_health_exit: err_health_exit:
nsim_dev_health_exit(nsim_dev); nsim_dev_health_exit(nsim_dev);
err_fib_destroy:
nsim_fib_destroy(devlink, nsim_dev->fib_data);
err_traps_exit: err_traps_exit:
nsim_dev_traps_exit(devlink); nsim_dev_traps_exit(devlink);
err_dummy_region_exit: err_dummy_region_exit:
nsim_dev_dummy_region_exit(nsim_dev); nsim_dev_dummy_region_exit(nsim_dev);
err_fib_destroy:
nsim_fib_destroy(devlink, nsim_dev->fib_data);
return err; return err;
} }
...@@ -1080,15 +1082,9 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) ...@@ -1080,15 +1082,9 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)
if (err) if (err)
goto err_devlink_free; goto err_devlink_free;
nsim_dev->fib_data = nsim_fib_create(devlink, NULL);
if (IS_ERR(nsim_dev->fib_data)) {
err = PTR_ERR(nsim_dev->fib_data);
goto err_resources_unregister;
}
err = devlink_register(devlink, &nsim_bus_dev->dev); err = devlink_register(devlink, &nsim_bus_dev->dev);
if (err) if (err)
goto err_fib_destroy; goto err_resources_unregister;
err = devlink_params_register(devlink, nsim_devlink_params, err = devlink_params_register(devlink, nsim_devlink_params,
ARRAY_SIZE(nsim_devlink_params)); ARRAY_SIZE(nsim_devlink_params));
...@@ -1108,9 +1104,15 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) ...@@ -1108,9 +1104,15 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)
if (err) if (err)
goto err_traps_exit; goto err_traps_exit;
nsim_dev->fib_data = nsim_fib_create(devlink, NULL);
if (IS_ERR(nsim_dev->fib_data)) {
err = PTR_ERR(nsim_dev->fib_data);
goto err_debugfs_exit;
}
err = nsim_dev_health_init(nsim_dev, devlink); err = nsim_dev_health_init(nsim_dev, devlink);
if (err) if (err)
goto err_debugfs_exit; goto err_fib_destroy;
err = nsim_bpf_dev_init(nsim_dev); err = nsim_bpf_dev_init(nsim_dev);
if (err) if (err)
...@@ -1128,6 +1130,8 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) ...@@ -1128,6 +1130,8 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)
nsim_bpf_dev_exit(nsim_dev); nsim_bpf_dev_exit(nsim_dev);
err_health_exit: err_health_exit:
nsim_dev_health_exit(nsim_dev); nsim_dev_health_exit(nsim_dev);
err_fib_destroy:
nsim_fib_destroy(devlink, nsim_dev->fib_data);
err_debugfs_exit: err_debugfs_exit:
nsim_dev_debugfs_exit(nsim_dev); nsim_dev_debugfs_exit(nsim_dev);
err_traps_exit: err_traps_exit:
...@@ -1139,8 +1143,6 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev) ...@@ -1139,8 +1143,6 @@ int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev)
ARRAY_SIZE(nsim_devlink_params)); ARRAY_SIZE(nsim_devlink_params));
err_dl_unregister: err_dl_unregister:
devlink_unregister(devlink); devlink_unregister(devlink);
err_fib_destroy:
nsim_fib_destroy(devlink, nsim_dev->fib_data);
err_resources_unregister: err_resources_unregister:
devlink_resources_unregister(devlink, NULL); devlink_resources_unregister(devlink, NULL);
err_devlink_free: err_devlink_free:
...@@ -1157,10 +1159,10 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev) ...@@ -1157,10 +1159,10 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev)
debugfs_remove(nsim_dev->take_snapshot); debugfs_remove(nsim_dev->take_snapshot);
nsim_dev_port_del_all(nsim_dev); nsim_dev_port_del_all(nsim_dev);
nsim_dev_health_exit(nsim_dev); nsim_dev_health_exit(nsim_dev);
nsim_fib_destroy(devlink, nsim_dev->fib_data);
nsim_dev_traps_exit(devlink); nsim_dev_traps_exit(devlink);
nsim_dev_dummy_region_exit(nsim_dev); nsim_dev_dummy_region_exit(nsim_dev);
mutex_destroy(&nsim_dev->port_list_lock); mutex_destroy(&nsim_dev->port_list_lock);
nsim_fib_destroy(devlink, nsim_dev->fib_data);
} }
void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev) void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment