netdevsim: take devlink net instead of init_net

Follow-up patch is going to allow to reload devlink instance into
different network namespace, so use devlink_net() helper instead
of init_net.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2019-10-03 11:49:38 +02:00 committed by David S. Miller
parent 90d299138d
commit 4f174bbcc9
1 changed files with 2 additions and 2 deletions

View File

@ -260,7 +260,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
nsim_fib_set_max_all(data, devlink);
data->fib_nb.notifier_call = nsim_fib_event_nb;
err = register_fib_notifier(&init_net, &data->fib_nb,
err = register_fib_notifier(devlink_net(devlink), &data->fib_nb,
nsim_fib_dump_inconsistent, extack);
if (err) {
pr_err("Failed to register fib notifier\n");
@ -300,6 +300,6 @@ void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data)
NSIM_RESOURCE_IPV4_FIB_RULES);
devlink_resource_occ_get_unregister(devlink,
NSIM_RESOURCE_IPV4_FIB);
unregister_fib_notifier(&init_net, &data->fib_nb);
unregister_fib_notifier(devlink_net(devlink), &data->fib_nb);
kfree(data);
}