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.
Showing the changes to include/linux (1 of 15 files). Show all
Unified · Split
| @@ -47,7 +47,6 @@ struct vif_entry_notifier_info { · 46 unmodified lines | |||
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | static inline int mr_call_vif_notifier(struct notifier_block *nb, | 49 | static inline int mr_call_vif_notifier(struct notifier_block *nb, |
| 50 | struct net *net, | ||
| 51 | unsigned short family, | 50 | unsigned short family, |
| 52 | enum fib_event_type event_type, | 51 | enum fib_event_type event_type, |
| 53 | struct vif_device *vif, | 52 | struct vif_device *vif, |
| @@ -56,7 +55,6 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 2 unmodified lines | |||
| 56 | struct vif_entry_notifier_info info = { | 55 | struct vif_entry_notifier_info info = { |
| 57 | .info = { | 56 | .info = { |
| 58 | .family = family, | 57 | .family = family, |
| 59 | .net = net, | ||
| 60 | }, | 58 | }, |
| 61 | .dev = vif->dev, | 59 | .dev = vif->dev, |
| 62 | .vif_index = vif_index, | 60 | .vif_index = vif_index, |
| @@ -64,7 +62,7 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 1 unmodified line | |||
| 64 | .tb_id = tb_id, | 62 | .tb_id = tb_id, |
| 65 | }; | 63 | }; |
| 66 | 64 | ||
| 67 | return call_fib_notifier(nb, net, event_type, &info.info); | 65 | return call_fib_notifier(nb, event_type, &info.info); |
| 68 | } | 66 | } |
| 69 | 67 | ||
| 70 | static inline int mr_call_vif_notifiers(struct net *net, | 68 | static inline int mr_call_vif_notifiers(struct net *net, |
| @@ -77,7 +75,6 @@ static inline int mr_call_vif_notifiers(struct net *net, · 6 unmodified lines | |||
| 77 | struct vif_entry_notifier_info info = { | 75 | struct vif_entry_notifier_info info = { |
| 78 | .info = { | 76 | .info = { |
| 79 | .family = family, | 77 | .family = family, |
| 80 | .net = net, | ||
| 81 | }, | 78 | }, |
| 82 | .dev = vif->dev, | 79 | .dev = vif->dev, |
| 83 | .vif_index = vif_index, | 80 | .vif_index = vif_index, |
| @@ -173,7 +170,6 @@ struct mfc_entry_notifier_info { · 89 unmodified lines | |||
| 173 | }; | 170 | }; |
| 174 | 171 | ||
| 175 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, | 172 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, |
| 176 | struct net *net, | ||
| 177 | unsigned short family, | 173 | unsigned short family, |
| 178 | enum fib_event_type event_type, | 174 | enum fib_event_type event_type, |
| 179 | struct mr_mfc *mfc, u32 tb_id) | 175 | struct mr_mfc *mfc, u32 tb_id) |
| @@ -181,13 +177,12 @@ static inline int mr_call_mfc_notifier(struct notifier_block *nb, · 1 unmodified line | |||
| 181 | struct mfc_entry_notifier_info info = { | 177 | struct mfc_entry_notifier_info info = { |
| 182 | .info = { | 178 | .info = { |
| 183 | .family = family, | 179 | .family = family, |
| 184 | .net = net, | ||
| 185 | }, | 180 | }, |
| 186 | .mfc = mfc, | 181 | .mfc = mfc, |
| 187 | .tb_id = tb_id | 182 | .tb_id = tb_id |
| 188 | }; | 183 | }; |
| 189 | 184 | ||
| 190 | return call_fib_notifier(nb, net, event_type, &info.info); | 185 | return call_fib_notifier(nb, event_type, &info.info); |
| 191 | } | 186 | } |
| 192 | 187 | ||
| 193 | static inline int mr_call_mfc_notifiers(struct net *net, | 188 | static inline int mr_call_mfc_notifiers(struct net *net, |
| @@ -199,7 +194,6 @@ static inline int mr_call_mfc_notifiers(struct net *net, · 5 unmodified lines | |||
| 199 | struct mfc_entry_notifier_info info = { | 194 | struct mfc_entry_notifier_info info = { |
| 200 | .info = { | 195 | .info = { |
| 201 | .family = family, | 196 | .family = family, |
| 202 | .net = net, | ||
| 203 | }, | 197 | }, |
| 204 | .mfc = mfc, | 198 | .mfc = mfc, |
| 205 | .tb_id = tb_id | 199 | .tb_id = tb_id |