OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 |
||
4 | |||
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 |
||
8 | function. |
||
9 | |||
10 | Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> |
||
11 | Signed-off-by: David S. Miller <davem@davemloft.net> |
||
12 | --- |
||
13 | |||
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 |
||
17 | unsigned int); |
||
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); |
||
21 | |||
22 | static inline void fib_result_assign(struct fib_result *res, |
||
23 | struct fib_info *fi) |
||
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); |
||
28 | } |
||
29 | |||
30 | -/* Return the first fib alias matching TOS with |
||
31 | - * priority less than or equal to PRIO. |
||
32 | - */ |
||
33 | -struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) |
||
34 | -{ |
||
35 | - if (fah) { |
||
36 | - struct fib_alias *fa; |
||
37 | - list_for_each_entry(fa, fah, fa_list) { |
||
38 | - if (fa->fa_tos > tos) |
||
39 | - continue; |
||
40 | - if (fa->fa_info->fib_priority >= prio || |
||
41 | - fa->fa_tos < tos) |
||
42 | - return fa; |
||
43 | - } |
||
44 | - } |
||
45 | - return NULL; |
||
46 | -} |
||
47 | - |
||
48 | static int fib_detect_death(struct fib_info *fi, int order, |
||
49 | struct fib_info **last_resort, int *last_idx, |
||
50 | int dflt) |
||
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 |
||
54 | return n; |
||
55 | } |
||
56 | |||
57 | +/* Return the first fib alias matching TOS with |
||
58 | + * priority less than or equal to PRIO. |
||
59 | + */ |
||
60 | +static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) |
||
61 | +{ |
||
62 | + struct fib_alias *fa; |
||
63 | + |
||
64 | + if (!fah) |
||
65 | + return NULL; |
||
66 | + |
||
67 | + list_for_each_entry(fa, fah, fa_list) { |
||
68 | + if (fa->fa_tos > tos) |
||
69 | + continue; |
||
70 | + if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) |
||
71 | + return fa; |
||
72 | + } |
||
73 | + |
||
74 | + return NULL; |
||
75 | +} |
||
76 | + |
||
77 | static void trie_rebalance(struct trie *t, struct tnode *tn) |
||
78 | { |
||
79 | struct tnode *tp; |