diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2006-08-23 20:22:24 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:55:51 -0400 |
commit | 7fc33165a74301b2c5c90b2f2a1f6907cbd5c6f1 (patch) | |
tree | 377c2299e95fcaae378a3498ccda7b09517722cc | |
parent | fefc2a6c201aeafc1d0329a140de502d49f69d04 (diff) |
[IPV6] ROUTE: Put SUBTREE() as FIB6_SUBTREE() into ip6_fib.h for future use.
Based on MIPL2 kernel patch.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Ville Nuorvala <vnuorval@tcs.hut.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip6_fib.h | 5 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 20 |
2 files changed, 14 insertions, 11 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 9610b887ffb5..6a3f26a04509 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -60,6 +60,11 @@ struct fib6_node | |||
60 | __u32 fn_sernum; | 60 | __u32 fn_sernum; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #ifndef CONFIG_IPV6_SUBTREES | ||
64 | #define FIB6_SUBTREE(fn) NULL | ||
65 | #else | ||
66 | #define FIB6_SUBTREE(fn) ((fn)->subtree) | ||
67 | #endif | ||
63 | 68 | ||
64 | /* | 69 | /* |
65 | * routing information | 70 | * routing information |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index b706424e70b8..6536e33d8353 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -73,10 +73,8 @@ static DEFINE_RWLOCK(fib6_walker_lock); | |||
73 | 73 | ||
74 | #ifdef CONFIG_IPV6_SUBTREES | 74 | #ifdef CONFIG_IPV6_SUBTREES |
75 | #define FWS_INIT FWS_S | 75 | #define FWS_INIT FWS_S |
76 | #define SUBTREE(fn) ((fn)->subtree) | ||
77 | #else | 76 | #else |
78 | #define FWS_INIT FWS_L | 77 | #define FWS_INIT FWS_L |
79 | #define SUBTREE(fn) NULL | ||
80 | #endif | 78 | #endif |
81 | 79 | ||
82 | static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt); | 80 | static void fib6_prune_clones(struct fib6_node *fn, struct rt6_info *rt); |
@@ -854,7 +852,7 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root, | |||
854 | } | 852 | } |
855 | 853 | ||
856 | while(fn) { | 854 | while(fn) { |
857 | if (SUBTREE(fn) || fn->fn_flags & RTN_RTINFO) { | 855 | if (FIB6_SUBTREE(fn) || fn->fn_flags & RTN_RTINFO) { |
858 | struct rt6key *key; | 856 | struct rt6key *key; |
859 | 857 | ||
860 | key = (struct rt6key *) ((u8 *) fn->leaf + | 858 | key = (struct rt6key *) ((u8 *) fn->leaf + |
@@ -985,7 +983,7 @@ static struct rt6_info * fib6_find_prefix(struct fib6_node *fn) | |||
985 | if(fn->right) | 983 | if(fn->right) |
986 | return fn->right->leaf; | 984 | return fn->right->leaf; |
987 | 985 | ||
988 | fn = SUBTREE(fn); | 986 | fn = FIB6_SUBTREE(fn); |
989 | } | 987 | } |
990 | return NULL; | 988 | return NULL; |
991 | } | 989 | } |
@@ -1016,7 +1014,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) | |||
1016 | if (fn->right) child = fn->right, children |= 1; | 1014 | if (fn->right) child = fn->right, children |= 1; |
1017 | if (fn->left) child = fn->left, children |= 2; | 1015 | if (fn->left) child = fn->left, children |= 2; |
1018 | 1016 | ||
1019 | if (children == 3 || SUBTREE(fn) | 1017 | if (children == 3 || FIB6_SUBTREE(fn) |
1020 | #ifdef CONFIG_IPV6_SUBTREES | 1018 | #ifdef CONFIG_IPV6_SUBTREES |
1021 | /* Subtree root (i.e. fn) may have one child */ | 1019 | /* Subtree root (i.e. fn) may have one child */ |
1022 | || (children && fn->fn_flags&RTN_ROOT) | 1020 | || (children && fn->fn_flags&RTN_ROOT) |
@@ -1035,9 +1033,9 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) | |||
1035 | 1033 | ||
1036 | pn = fn->parent; | 1034 | pn = fn->parent; |
1037 | #ifdef CONFIG_IPV6_SUBTREES | 1035 | #ifdef CONFIG_IPV6_SUBTREES |
1038 | if (SUBTREE(pn) == fn) { | 1036 | if (FIB6_SUBTREE(pn) == fn) { |
1039 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1037 | BUG_TRAP(fn->fn_flags&RTN_ROOT); |
1040 | SUBTREE(pn) = NULL; | 1038 | FIB6_SUBTREE(pn) = NULL; |
1041 | nstate = FWS_L; | 1039 | nstate = FWS_L; |
1042 | } else { | 1040 | } else { |
1043 | BUG_TRAP(!(fn->fn_flags&RTN_ROOT)); | 1041 | BUG_TRAP(!(fn->fn_flags&RTN_ROOT)); |
@@ -1085,7 +1083,7 @@ static struct fib6_node * fib6_repair_tree(struct fib6_node *fn) | |||
1085 | read_unlock(&fib6_walker_lock); | 1083 | read_unlock(&fib6_walker_lock); |
1086 | 1084 | ||
1087 | node_free(fn); | 1085 | node_free(fn); |
1088 | if (pn->fn_flags&RTN_RTINFO || SUBTREE(pn)) | 1086 | if (pn->fn_flags&RTN_RTINFO || FIB6_SUBTREE(pn)) |
1089 | return pn; | 1087 | return pn; |
1090 | 1088 | ||
1091 | rt6_release(pn->leaf); | 1089 | rt6_release(pn->leaf); |
@@ -1228,8 +1226,8 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1228 | switch (w->state) { | 1226 | switch (w->state) { |
1229 | #ifdef CONFIG_IPV6_SUBTREES | 1227 | #ifdef CONFIG_IPV6_SUBTREES |
1230 | case FWS_S: | 1228 | case FWS_S: |
1231 | if (SUBTREE(fn)) { | 1229 | if (FIB6_SUBTREE(fn)) { |
1232 | w->node = SUBTREE(fn); | 1230 | w->node = FIB6_SUBTREE(fn); |
1233 | continue; | 1231 | continue; |
1234 | } | 1232 | } |
1235 | w->state = FWS_L; | 1233 | w->state = FWS_L; |
@@ -1263,7 +1261,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1263 | pn = fn->parent; | 1261 | pn = fn->parent; |
1264 | w->node = pn; | 1262 | w->node = pn; |
1265 | #ifdef CONFIG_IPV6_SUBTREES | 1263 | #ifdef CONFIG_IPV6_SUBTREES |
1266 | if (SUBTREE(pn) == fn) { | 1264 | if (FIB6_SUBTREE(pn) == fn) { |
1267 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1265 | BUG_TRAP(fn->fn_flags&RTN_ROOT); |
1268 | w->state = FWS_L; | 1266 | w->state = FWS_L; |
1269 | continue; | 1267 | continue; |