diff options
author | Alexander Duyck <alexander.h.duyck@redhat.com> | 2015-01-22 15:51:39 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-25 14:47:16 -0800 |
commit | 02525368f48c197bce6e4251ff7bde92fa6f026e (patch) | |
tree | a8ba43c54974cb7fa3fdd8a6f2fb2d0412325a52 /net/ipv4/fib_trie.c | |
parent | 30cfe7c9c88d73440560d7e381bab12f5463a6cd (diff) |
fib_trie: Move fib_find_alias to file where it is used
The function fib_find_alias is only accessed by functions in fib_trie.c as
such it makes sense to relocate it and cast it as static so that the
compiler can take advantage of optimizations it can do to it as a local
function.
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 90654bb64e21..7f342265968e 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -998,6 +998,26 @@ static struct tnode *fib_find_node(struct trie *t, u32 key) return n; } +/* Return the first fib alias matching TOS with + * priority less than or equal to PRIO. + */ +static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) +{ + struct fib_alias *fa; + + if (!fah) + return NULL; + + list_for_each_entry(fa, fah, fa_list) { + if (fa->fa_tos > tos) + continue; + if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) + return fa; + } + + return NULL; +} + static void trie_rebalance(struct trie *t, struct tnode *tn) { struct tnode *tp; |