diff options
author | David Ahern <dsahern@gmail.com> | 2017-10-18 14:39:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-20 08:29:26 -0400 |
commit | 6eba87c781aaa02f6bf1b64df2f8b12833eee521 (patch) | |
tree | 1cb2a33f0183083aba0e54d1f618ed75bf1e8492 | |
parent | 1fba70e5b6bed53496ba1f1f16127f5be01b5fb6 (diff) |
net: ipv4: Change fib notifiers to take a fib_alias
All of the notifier data (fib_info, tos, type and table id) are
contained in the fib_alias. Pass it to the notifier instead of
each data separately shortening the argument list by 3.
Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/fib_trie.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index c636650a6a70..aaa1ba09afaa 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -87,32 +87,30 @@ | |||
87 | 87 | ||
88 | static int call_fib_entry_notifier(struct notifier_block *nb, struct net *net, | 88 | static int call_fib_entry_notifier(struct notifier_block *nb, struct net *net, |
89 | enum fib_event_type event_type, u32 dst, | 89 | enum fib_event_type event_type, u32 dst, |
90 | int dst_len, struct fib_info *fi, | 90 | int dst_len, struct fib_alias *fa) |
91 | u8 tos, u8 type, u32 tb_id) | ||
92 | { | 91 | { |
93 | struct fib_entry_notifier_info info = { | 92 | struct fib_entry_notifier_info info = { |
94 | .dst = dst, | 93 | .dst = dst, |
95 | .dst_len = dst_len, | 94 | .dst_len = dst_len, |
96 | .fi = fi, | 95 | .fi = fa->fa_info, |
97 | .tos = tos, | 96 | .tos = fa->fa_tos, |
98 | .type = type, | 97 | .type = fa->fa_type, |
99 | .tb_id = tb_id, | 98 | .tb_id = fa->tb_id, |
100 | }; | 99 | }; |
101 | return call_fib4_notifier(nb, net, event_type, &info.info); | 100 | return call_fib4_notifier(nb, net, event_type, &info.info); |
102 | } | 101 | } |
103 | 102 | ||
104 | static int call_fib_entry_notifiers(struct net *net, | 103 | static int call_fib_entry_notifiers(struct net *net, |
105 | enum fib_event_type event_type, u32 dst, | 104 | enum fib_event_type event_type, u32 dst, |
106 | int dst_len, struct fib_info *fi, | 105 | int dst_len, struct fib_alias *fa) |
107 | u8 tos, u8 type, u32 tb_id) | ||
108 | { | 106 | { |
109 | struct fib_entry_notifier_info info = { | 107 | struct fib_entry_notifier_info info = { |
110 | .dst = dst, | 108 | .dst = dst, |
111 | .dst_len = dst_len, | 109 | .dst_len = dst_len, |
112 | .fi = fi, | 110 | .fi = fa->fa_info, |
113 | .tos = tos, | 111 | .tos = fa->fa_tos, |
114 | .type = type, | 112 | .type = fa->fa_type, |
115 | .tb_id = tb_id, | 113 | .tb_id = fa->tb_id, |
116 | }; | 114 | }; |
117 | return call_fib4_notifiers(net, event_type, &info.info); | 115 | return call_fib4_notifiers(net, event_type, &info.info); |
118 | } | 116 | } |
@@ -1216,9 +1214,7 @@ int fib_table_insert(struct net *net, struct fib_table *tb, | |||
1216 | new_fa->fa_default = -1; | 1214 | new_fa->fa_default = -1; |
1217 | 1215 | ||
1218 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, | 1216 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, |
1219 | key, plen, fi, | 1217 | key, plen, new_fa); |
1220 | new_fa->fa_tos, cfg->fc_type, | ||
1221 | tb->tb_id); | ||
1222 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, | 1218 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, |
1223 | tb->tb_id, &cfg->fc_nlinfo, nlflags); | 1219 | tb->tb_id, &cfg->fc_nlinfo, nlflags); |
1224 | 1220 | ||
@@ -1273,8 +1269,7 @@ int fib_table_insert(struct net *net, struct fib_table *tb, | |||
1273 | tb->tb_num_default++; | 1269 | tb->tb_num_default++; |
1274 | 1270 | ||
1275 | rt_cache_flush(cfg->fc_nlinfo.nl_net); | 1271 | rt_cache_flush(cfg->fc_nlinfo.nl_net); |
1276 | call_fib_entry_notifiers(net, event, key, plen, fi, tos, cfg->fc_type, | 1272 | call_fib_entry_notifiers(net, event, key, plen, new_fa); |
1277 | tb->tb_id); | ||
1278 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id, | 1273 | rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id, |
1279 | &cfg->fc_nlinfo, nlflags); | 1274 | &cfg->fc_nlinfo, nlflags); |
1280 | succeeded: | 1275 | succeeded: |
@@ -1574,8 +1569,7 @@ int fib_table_delete(struct net *net, struct fib_table *tb, | |||
1574 | return -ESRCH; | 1569 | return -ESRCH; |
1575 | 1570 | ||
1576 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, key, plen, | 1571 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, key, plen, |
1577 | fa_to_delete->fa_info, tos, | 1572 | fa_to_delete); |
1578 | fa_to_delete->fa_type, tb->tb_id); | ||
1579 | rtmsg_fib(RTM_DELROUTE, htonl(key), fa_to_delete, plen, tb->tb_id, | 1573 | rtmsg_fib(RTM_DELROUTE, htonl(key), fa_to_delete, plen, tb->tb_id, |
1580 | &cfg->fc_nlinfo, 0); | 1574 | &cfg->fc_nlinfo, 0); |
1581 | 1575 | ||
@@ -1892,9 +1886,7 @@ int fib_table_flush(struct net *net, struct fib_table *tb) | |||
1892 | 1886 | ||
1893 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, | 1887 | call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, |
1894 | n->key, | 1888 | n->key, |
1895 | KEYLENGTH - fa->fa_slen, | 1889 | KEYLENGTH - fa->fa_slen, fa); |
1896 | fi, fa->fa_tos, fa->fa_type, | ||
1897 | tb->tb_id); | ||
1898 | hlist_del_rcu(&fa->fa_list); | 1890 | hlist_del_rcu(&fa->fa_list); |
1899 | fib_release_info(fa->fa_info); | 1891 | fib_release_info(fa->fa_info); |
1900 | alias_free_mem_rcu(fa); | 1892 | alias_free_mem_rcu(fa); |
@@ -1932,8 +1924,7 @@ static void fib_leaf_notify(struct net *net, struct key_vector *l, | |||
1932 | continue; | 1924 | continue; |
1933 | 1925 | ||
1934 | call_fib_entry_notifier(nb, net, FIB_EVENT_ENTRY_ADD, l->key, | 1926 | call_fib_entry_notifier(nb, net, FIB_EVENT_ENTRY_ADD, l->key, |
1935 | KEYLENGTH - fa->fa_slen, fi, fa->fa_tos, | 1927 | KEYLENGTH - fa->fa_slen, fa); |
1936 | fa->fa_type, fa->tb_id); | ||
1937 | } | 1928 | } |
1938 | } | 1929 | } |
1939 | 1930 | ||