1 From: Alexander Duyck <alexander.h.duyck@redhat.com>
2 Date: Thu, 22 Jan 2015 15:51:39 -0800
3 Subject: [PATCH] fib_trie: Move fib_find_alias to file where it is used
5 The function fib_find_alias is only accessed by functions in fib_trie.c as
6 such it makes sense to relocate it and cast it as static so that the
7 compiler can take advantage of optimizations it can do to it as a local
10 Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
14 --- a/net/ipv4/fib_lookup.h
15 +++ b/net/ipv4/fib_lookup.h
16 @@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u
18 void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len,
19 u32 tb_id, const struct nl_info *info, unsigned int nlm_flags);
20 -struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio);
22 static inline void fib_result_assign(struct fib_result *res,
24 --- a/net/ipv4/fib_semantics.c
25 +++ b/net/ipv4/fib_semantics.c
26 @@ -410,24 +410,6 @@ errout:
27 rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
30 -/* Return the first fib alias matching TOS with
31 - * priority less than or equal to PRIO.
33 -struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio)
36 - struct fib_alias *fa;
37 - list_for_each_entry(fa, fah, fa_list) {
38 - if (fa->fa_tos > tos)
40 - if (fa->fa_info->fib_priority >= prio ||
48 static int fib_detect_death(struct fib_info *fi, int order,
49 struct fib_info **last_resort, int *last_idx,
51 --- a/net/ipv4/fib_trie.c
52 +++ b/net/ipv4/fib_trie.c
53 @@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struc
57 +/* Return the first fib alias matching TOS with
58 + * priority less than or equal to PRIO.
60 +static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio)
62 + struct fib_alias *fa;
67 + list_for_each_entry(fa, fah, fa_list) {
68 + if (fa->fa_tos > tos)
70 + if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos)
77 static void trie_rebalance(struct trie *t, struct tnode *tn)