diff options
author | Alexander Duyck <alexander.h.duyck@redhat.com> | 2015-01-22 18:51:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-25 17:47:16 -0500 |
commit | 02525368f48c197bce6e4251ff7bde92fa6f026e (patch) | |
tree | a8ba43c54974cb7fa3fdd8a6f2fb2d0412325a52 /net/ipv4 | |
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')
-rw-r--r-- | net/ipv4/fib_lookup.h | 1 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 18 | ||||
-rw-r--r-- | net/ipv4/fib_trie.c | 20 |
3 files changed, 20 insertions, 19 deletions
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index 1e4f6600b31d..825981b1049a 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -32,7 +32,6 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, u32 tb_id, | |||
32 | unsigned int); | 32 | unsigned int); |
33 | void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, | 33 | void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, int dst_len, |
34 | u32 tb_id, const struct nl_info *info, unsigned int nlm_flags); | 34 | u32 tb_id, const struct nl_info *info, unsigned int nlm_flags); |
35 | struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio); | ||
36 | 35 | ||
37 | static inline void fib_result_assign(struct fib_result *res, | 36 | static inline void fib_result_assign(struct fib_result *res, |
38 | struct fib_info *fi) | 37 | struct fib_info *fi) |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 265cb72b7c1b..1e2090ea663e 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -411,24 +411,6 @@ errout: | |||
411 | rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); | 411 | rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err); |
412 | } | 412 | } |
413 | 413 | ||
414 | /* Return the first fib alias matching TOS with | ||
415 | * priority less than or equal to PRIO. | ||
416 | */ | ||
417 | struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) | ||
418 | { | ||
419 | if (fah) { | ||
420 | struct fib_alias *fa; | ||
421 | list_for_each_entry(fa, fah, fa_list) { | ||
422 | if (fa->fa_tos > tos) | ||
423 | continue; | ||
424 | if (fa->fa_info->fib_priority >= prio || | ||
425 | fa->fa_tos < tos) | ||
426 | return fa; | ||
427 | } | ||
428 | } | ||
429 | return NULL; | ||
430 | } | ||
431 | |||
432 | static int fib_detect_death(struct fib_info *fi, int order, | 414 | static int fib_detect_death(struct fib_info *fi, int order, |
433 | struct fib_info **last_resort, int *last_idx, | 415 | struct fib_info **last_resort, int *last_idx, |
434 | int dflt) | 416 | int dflt) |
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) | |||
998 | return n; | 998 | return n; |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | /* Return the first fib alias matching TOS with | ||
1002 | * priority less than or equal to PRIO. | ||
1003 | */ | ||
1004 | static struct fib_alias *fib_find_alias(struct list_head *fah, u8 tos, u32 prio) | ||
1005 | { | ||
1006 | struct fib_alias *fa; | ||
1007 | |||
1008 | if (!fah) | ||
1009 | return NULL; | ||
1010 | |||
1011 | list_for_each_entry(fa, fah, fa_list) { | ||
1012 | if (fa->fa_tos > tos) | ||
1013 | continue; | ||
1014 | if (fa->fa_info->fib_priority >= prio || fa->fa_tos < tos) | ||
1015 | return fa; | ||
1016 | } | ||
1017 | |||
1018 | return NULL; | ||
1019 | } | ||
1020 | |||
1001 | static void trie_rebalance(struct trie *t, struct tnode *tn) | 1021 | static void trie_rebalance(struct trie *t, struct tnode *tn) |
1002 | { | 1022 | { |
1003 | struct tnode *tp; | 1023 | struct tnode *tp; |