/* 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
}
/* 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;
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");
}
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? */
/* Creation primitives. */
-static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
+static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in,
+ unsigned int hash)
{
struct frag_queue *fq;
- unsigned int hash;
#ifdef CONFIG_SMP
struct hlist_node *n;
#endif
write_lock(&ip6_frags.lock);
- hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr);
#ifdef CONFIG_SMP
hlist_for_each_entry(fq, n, &ip6_frags.hash[hash], q.list) {
if (fq->id == fq_in->id &&
static struct frag_queue *
ip6_frag_create(__be32 id, struct in6_addr *src, struct in6_addr *dst,
- struct inet6_dev *idev)
+ struct inet6_dev *idev, unsigned int hash)
{
struct frag_queue *fq;
spin_lock_init(&fq->q.lock);
atomic_set(&fq->q.refcnt, 1);
- return ip6_frag_intern(fq);
+ return ip6_frag_intern(fq, hash);
oom:
IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS);
}
read_unlock(&ip6_frags.lock);
- return ip6_frag_create(id, src, dst, idev);
+ return ip6_frag_create(id, src, dst, idev, hash);
}