From: baker.zhang Date: Tue, 8 Oct 2013 03:36:51 +0000 (+0800) Subject: fib_trie: only calc for the un-first node X-Git-Tag: v3.13-rc1~105^2~199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c60f1d67fae632743df9324301e3cb2682f54d4;p=kernel%2Fkernel-generic.git fib_trie: only calc for the un-first node This is a enhancement. for the first node in fib_trie, newpos is 0, bit is 1. Only for the leaf or node with unmatched key need calc pos. Signed-off-by: baker.zhang Signed-off-by: David S. Miller --- diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 45c74ba..ec9a9ef 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1117,12 +1117,8 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen) * first tnode need some special handling */ - if (tp) - pos = tp->pos+tp->bits; - else - pos = 0; - if (n) { + pos = tp ? tp->pos+tp->bits : 0; newpos = tkey_mismatch(key, pos, n->key); tn = tnode_new(n->key, newpos, 1); } else {