diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-17 19:43:37 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-17 19:43:37 -0700 |
commit | fd9e63544cac30a34c951f0ec958038f0529e244 (patch) | |
tree | ab50911ec813780ee1e472089f4b02a3be6a69e6 /net/ipv4 | |
parent | be07664599fa94d0b85c3e0f525aee2432d15fbf (diff) | |
download | linux-fd9e63544cac30a34c951f0ec958038f0529e244.tar.bz2 |
[INET]: Omit double hash calculations in xxx_frag_intern
Since the hash value is already calculated in xxx_find, we can
simply use it later. This is already done in netfilter code,
so make the same in ipv4 and ipv6.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ip_fragment.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 443b3f89192f..d12a18b8f568 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -212,17 +212,14 @@ out: /* Creation primitives. */ -static struct ipq *ip_frag_intern(struct ipq *qp_in) +static struct ipq *ip_frag_intern(struct ipq *qp_in, unsigned int hash) { struct ipq *qp; #ifdef CONFIG_SMP struct hlist_node *n; #endif - unsigned int hash; write_lock(&ip4_frags.lock); - hash = ipqhashfn(qp_in->id, qp_in->saddr, qp_in->daddr, - qp_in->protocol); #ifdef CONFIG_SMP /* With SMP race we have to recheck hash table, because * such entry could be created on other cpu, while we @@ -257,7 +254,7 @@ static struct ipq *ip_frag_intern(struct ipq *qp_in) } /* Add an entry to the 'ipq' queue for a newly received IP datagram. */ -static struct ipq *ip_frag_create(struct iphdr *iph, u32 user) +static struct ipq *ip_frag_create(struct iphdr *iph, u32 user, unsigned int h) { struct ipq *qp; @@ -278,7 +275,7 @@ static struct ipq *ip_frag_create(struct iphdr *iph, u32 user) spin_lock_init(&qp->q.lock); atomic_set(&qp->q.refcnt, 1); - return ip_frag_intern(qp); + return ip_frag_intern(qp, h); out_nomem: LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); @@ -313,7 +310,7 @@ static inline struct ipq *ip_find(struct iphdr *iph, u32 user) } read_unlock(&ip4_frags.lock); - return ip_frag_create(iph, user); + return ip_frag_create(iph, user, hash); } /* Is the fragment too far ahead to be part of ipq? */ |