aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 17:07:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 17:07:15 -0400
commitd2aa4550379f92e929af7ed1dd4f55e6a1e331f8 (patch)
tree5ef0fc69a507f0d701fd157b6652427eabd5efdd /net/ipv4/fib_trie.c
parent9e3e4b1d2d13bead8d52703c82a02b55f108b491 (diff)
parentcb2107be43d2fc5eadec58b92b54bf32c00bfff3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (55 commits) netxen: fix tx ring accounting netxen: fix detection of cut-thru firmware mode forcedeth: fix dma api mismatches atm: sk_wmem_alloc initial value is one net: correct off-by-one write allocations reports via-velocity : fix no link detection on boot Net / e100: Fix suspend of devices that cannot be power managed TI DaVinci EMAC : Fix rmmod error net: group address list and its count ipv4: Fix fib_trie rebalancing, part 2 pkt_sched: Update drops stats in act_police sky2: version 1.23 sky2: add GRO support sky2: skb recycling sky2: reduce default transmit ring sky2: receive counter update sky2: fix shutdown synchronization sky2: PCI irq issues sky2: more receive shutdown sky2: turn off pause during shutdown ... Manually fix trivial conflict in net/core/skbuff.c due to kmemcheck
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index d1a39b1277d6..012cf5a68581 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -391,13 +391,8 @@ static inline void tnode_free(struct tnode *tn)
391static void tnode_free_safe(struct tnode *tn) 391static void tnode_free_safe(struct tnode *tn)
392{ 392{
393 BUG_ON(IS_LEAF(tn)); 393 BUG_ON(IS_LEAF(tn));
394 394 tn->tnode_free = tnode_free_head;
395 if (node_parent((struct node *) tn)) { 395 tnode_free_head = tn;
396 tn->tnode_free = tnode_free_head;
397 tnode_free_head = tn;
398 } else {
399 tnode_free(tn);
400 }
401} 396}
402 397
403static void tnode_free_flush(void) 398static void tnode_free_flush(void)
@@ -1009,7 +1004,7 @@ fib_find_node(struct trie *t, u32 key)
1009 return NULL; 1004 return NULL;
1010} 1005}
1011 1006
1012static struct node *trie_rebalance(struct trie *t, struct tnode *tn) 1007static void trie_rebalance(struct trie *t, struct tnode *tn)
1013{ 1008{
1014 int wasfull; 1009 int wasfull;
1015 t_key cindex, key; 1010 t_key cindex, key;
@@ -1033,12 +1028,13 @@ static struct node *trie_rebalance(struct trie *t, struct tnode *tn)
1033 } 1028 }
1034 1029
1035 /* Handle last (top) tnode */ 1030 /* Handle last (top) tnode */
1036 if (IS_TNODE(tn)) { 1031 if (IS_TNODE(tn))
1037 tn = (struct tnode *)resize(t, (struct tnode *)tn); 1032 tn = (struct tnode *)resize(t, (struct tnode *)tn);
1038 tnode_free_flush();
1039 }
1040 1033
1041 return (struct node *)tn; 1034 rcu_assign_pointer(t->trie, (struct node *)tn);
1035 tnode_free_flush();
1036
1037 return;
1042} 1038}
1043 1039
1044/* only used from updater-side */ 1040/* only used from updater-side */
@@ -1186,7 +1182,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
1186 1182
1187 /* Rebalance the trie */ 1183 /* Rebalance the trie */
1188 1184
1189 rcu_assign_pointer(t->trie, trie_rebalance(t, tp)); 1185 trie_rebalance(t, tp);
1190done: 1186done:
1191 return fa_head; 1187 return fa_head;
1192} 1188}
@@ -1605,7 +1601,7 @@ static void trie_leaf_remove(struct trie *t, struct leaf *l)
1605 if (tp) { 1601 if (tp) {
1606 t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits); 1602 t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits);
1607 put_child(t, (struct tnode *)tp, cindex, NULL); 1603 put_child(t, (struct tnode *)tp, cindex, NULL);
1608 rcu_assign_pointer(t->trie, trie_rebalance(t, tp)); 1604 trie_rebalance(t, tp);
1609 } else 1605 } else
1610 rcu_assign_pointer(t->trie, NULL); 1606 rcu_assign_pointer(t->trie, NULL);
1611 1607