Skip to content

Commit 6eba87c

Browse files
dsaherndavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1fba70e commit 6eba87c

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

net/ipv4/fib_trie.c

+15-24
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,30 @@
8787

8888
static int call_fib_entry_notifier(struct notifier_block *nb, struct net *net,
8989
enum fib_event_type event_type, u32 dst,
90-
int dst_len, struct fib_info *fi,
91-
u8 tos, u8 type, u32 tb_id)
90+
int dst_len, struct fib_alias *fa)
9291
{
9392
struct fib_entry_notifier_info info = {
9493
.dst = dst,
9594
.dst_len = dst_len,
96-
.fi = fi,
97-
.tos = tos,
98-
.type = type,
99-
.tb_id = tb_id,
95+
.fi = fa->fa_info,
96+
.tos = fa->fa_tos,
97+
.type = fa->fa_type,
98+
.tb_id = fa->tb_id,
10099
};
101100
return call_fib4_notifier(nb, net, event_type, &info.info);
102101
}
103102

104103
static int call_fib_entry_notifiers(struct net *net,
105104
enum fib_event_type event_type, u32 dst,
106-
int dst_len, struct fib_info *fi,
107-
u8 tos, u8 type, u32 tb_id)
105+
int dst_len, struct fib_alias *fa)
108106
{
109107
struct fib_entry_notifier_info info = {
110108
.dst = dst,
111109
.dst_len = dst_len,
112-
.fi = fi,
113-
.tos = tos,
114-
.type = type,
115-
.tb_id = tb_id,
110+
.fi = fa->fa_info,
111+
.tos = fa->fa_tos,
112+
.type = fa->fa_type,
113+
.tb_id = fa->tb_id,
116114
};
117115
return call_fib4_notifiers(net, event_type, &info.info);
118116
}
@@ -1216,9 +1214,7 @@ int fib_table_insert(struct net *net, struct fib_table *tb,
12161214
new_fa->fa_default = -1;
12171215

12181216
call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE,
1219-
key, plen, fi,
1220-
new_fa->fa_tos, cfg->fc_type,
1221-
tb->tb_id);
1217+
key, plen, new_fa);
12221218
rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen,
12231219
tb->tb_id, &cfg->fc_nlinfo, nlflags);
12241220

@@ -1273,8 +1269,7 @@ int fib_table_insert(struct net *net, struct fib_table *tb,
12731269
tb->tb_num_default++;
12741270

12751271
rt_cache_flush(cfg->fc_nlinfo.nl_net);
1276-
call_fib_entry_notifiers(net, event, key, plen, fi, tos, cfg->fc_type,
1277-
tb->tb_id);
1272+
call_fib_entry_notifiers(net, event, key, plen, new_fa);
12781273
rtmsg_fib(RTM_NEWROUTE, htonl(key), new_fa, plen, new_fa->tb_id,
12791274
&cfg->fc_nlinfo, nlflags);
12801275
succeeded:
@@ -1574,8 +1569,7 @@ int fib_table_delete(struct net *net, struct fib_table *tb,
15741569
return -ESRCH;
15751570

15761571
call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, key, plen,
1577-
fa_to_delete->fa_info, tos,
1578-
fa_to_delete->fa_type, tb->tb_id);
1572+
fa_to_delete);
15791573
rtmsg_fib(RTM_DELROUTE, htonl(key), fa_to_delete, plen, tb->tb_id,
15801574
&cfg->fc_nlinfo, 0);
15811575

@@ -1892,9 +1886,7 @@ int fib_table_flush(struct net *net, struct fib_table *tb)
18921886

18931887
call_fib_entry_notifiers(net, FIB_EVENT_ENTRY_DEL,
18941888
n->key,
1895-
KEYLENGTH - fa->fa_slen,
1896-
fi, fa->fa_tos, fa->fa_type,
1897-
tb->tb_id);
1889+
KEYLENGTH - fa->fa_slen, fa);
18981890
hlist_del_rcu(&fa->fa_list);
18991891
fib_release_info(fa->fa_info);
19001892
alias_free_mem_rcu(fa);
@@ -1932,8 +1924,7 @@ static void fib_leaf_notify(struct net *net, struct key_vector *l,
19321924
continue;
19331925

19341926
call_fib_entry_notifier(nb, net, FIB_EVENT_ENTRY_ADD, l->key,
1935-
KEYLENGTH - fa->fa_slen, fi, fa->fa_tos,
1936-
fa->fa_type, fa->tb_id);
1927+
KEYLENGTH - fa->fa_slen, fa);
19371928
}
19381929
}
19391930

0 commit comments

Comments
 (0)