Message ID | 1381203411-12047-1-git-send-email-baker.kernel@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: baker.kernel@gmail.com Date: Tue, 8 Oct 2013 11:36:51 +0800 > From: "baker.zhang" <baker.kernel@gmail.com> > > 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 <baker.kernel@gmail.com> The compiler is probably doing this transformation all by itself, but applied anyways, thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 {