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 | 49 | static inline int mr_call_vif_notifier(struct notifier_block *nb, |
| 50 | − struct net *net, | |
| 51 | 50 | unsigned short family, |
| 52 | 51 | enum fib_event_type event_type, |
| 53 | 52 | struct vif_device *vif, |
| @@ -56,7 +55,6 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 2 unmodified lines | ||
| 56 | 55 | struct vif_entry_notifier_info info = { |
| 57 | 56 | .info = { |
| 58 | 57 | .family = family, |
| 59 | − .net = net, | |
| 60 | 58 | }, |
| 61 | 59 | .dev = vif->dev, |
| 62 | 60 | .vif_index = vif_index, |
| @@ -64,7 +62,7 @@ static inline int mr_call_vif_notifier(struct notifier_block *nb, · 1 unmodified line | ||
| 64 | 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 | 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 | 75 | struct vif_entry_notifier_info info = { |
| 78 | 76 | .info = { |
| 79 | 77 | .family = family, |
| 80 | − .net = net, | |
| 81 | 78 | }, |
| 82 | 79 | .dev = vif->dev, |
| 83 | 80 | .vif_index = vif_index, |
| @@ -173,7 +170,6 @@ struct mfc_entry_notifier_info { · 89 unmodified lines | ||
| 173 | 170 | }; |
| 174 | 171 | |
| 175 | 172 | static inline int mr_call_mfc_notifier(struct notifier_block *nb, |
| 176 | − struct net *net, | |
| 177 | 173 | unsigned short family, |
| 178 | 174 | enum fib_event_type event_type, |
| 179 | 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 | 177 | struct mfc_entry_notifier_info info = { |
| 182 | 178 | .info = { |
| 183 | 179 | .family = family, |
| 184 | − .net = net, | |
| 185 | 180 | }, |
| 186 | 181 | .mfc = mfc, |
| 187 | 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 | 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 | 194 | struct mfc_entry_notifier_info info = { |
| 200 | 195 | .info = { |
| 201 | 196 | .family = family, |
| 202 | − .net = net, | |
| 203 | 197 | }, |
| 204 | 198 | .mfc = mfc, |
| 205 | 199 | .tb_id = tb_id |