summaryrefslogtreecommitdiff
path: root/drivers/net/netdevsim/fib.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-10-03 12:49:27 +0300
committerDavid S. Miller <davem@davemloft.net>2019-10-04 21:10:55 +0300
commit7c550daffe22a97282effa75fe7c1f6b83563ecb (patch)
tree1ae072e80d39ed7d698622e471e077891efa4e90 /drivers/net/netdevsim/fib.c
parenta5facc4cac4dc504397428c936ef1492ce4edd19 (diff)
downloadlinux-7c550daffe22a97282effa75fe7c1f6b83563ecb.tar.xz
net: fib_notifier: make FIB notifier per-netns
Currently all users of FIB notifier only cares about events in init_net. Later in this patchset, users get interested in other namespaces too. However, for every registered block user is interested only about one namespace. Make the FIB notifier registration per-netns and avoid unnecessary calls of notifier block for other namespaces. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/fib.c')
-rw-r--r--drivers/net/netdevsim/fib.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
index 7de17e42d77a..01ee9cc54605 100644
--- a/drivers/net/netdevsim/fib.c
+++ b/drivers/net/netdevsim/fib.c
@@ -182,9 +182,6 @@ static int nsim_fib_event_nb(struct notifier_block *nb, unsigned long event,
struct fib_notifier_info *info = ptr;
int err = 0;
- if (!net_eq(info->net, &init_net))
- return NOTIFY_DONE;
-
switch (event) {
case FIB_EVENT_RULE_ADD: /* fall through */
case FIB_EVENT_RULE_DEL:
@@ -258,7 +255,8 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink)
data->ipv6.rules.max = (u64)-1;
data->fib_nb.notifier_call = nsim_fib_event_nb;
- err = register_fib_notifier(&data->fib_nb, nsim_fib_dump_inconsistent);
+ err = register_fib_notifier(&init_net, &data->fib_nb,
+ nsim_fib_dump_inconsistent);
if (err) {
pr_err("Failed to register fib notifier\n");
goto err_out;
@@ -297,6 +295,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(&data->fib_nb);
+ unregister_fib_notifier(&init_net, &data->fib_nb);
kfree(data);
}