Lines Matching refs:q
71 struct inet_frag_queue q; member
115 static unsigned int ip4_hashfn(const struct inet_frag_queue *q) in ip4_hashfn() argument
119 ipq = container_of(q, struct ipq, q); in ip4_hashfn()
123 static bool ip4_frag_match(const struct inet_frag_queue *q, const void *a) in ip4_frag_match() argument
128 qp = container_of(q, struct ipq, q); in ip4_frag_match()
137 static void ip4_frag_init(struct inet_frag_queue *q, const void *a) in ip4_frag_init() argument
139 struct ipq *qp = container_of(q, struct ipq, q); in ip4_frag_init()
140 struct netns_ipv4 *ipv4 = container_of(q->net, struct netns_ipv4, in ip4_frag_init()
158 static void ip4_frag_free(struct inet_frag_queue *q) in ip4_frag_free() argument
162 qp = container_of(q, struct ipq, q); in ip4_frag_free()
172 inet_frag_put(&ipq->q, &ip4_frags); in ipq_put()
180 inet_frag_kill(&ipq->q, &ip4_frags); in ipq_kill()
200 qp = container_of((struct inet_frag_queue *) arg, struct ipq, q); in ip_expire()
201 net = container_of(qp->q.net, struct net, ipv4.frags); in ip_expire()
203 spin_lock(&qp->q.lock); in ip_expire()
205 if (qp->q.flags & INET_FRAG_COMPLETE) in ip_expire()
211 if (!inet_frag_evicting(&qp->q)) { in ip_expire()
212 struct sk_buff *head = qp->q.fragments; in ip_expire()
218 if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments) in ip_expire()
246 spin_unlock(&qp->q.lock); in ip_expire()
256 struct inet_frag_queue *q; in ip_find() local
266 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); in ip_find()
267 if (IS_ERR_OR_NULL(q)) { in ip_find()
268 inet_frag_maybe_warn_overflow(q, pr_fmt()); in ip_find()
271 return container_of(q, struct ipq, q); in ip_find()
290 rc = qp->q.fragments && (end - start) > max; in ip_frag_too_far()
295 net = container_of(qp->q.net, struct net, ipv4.frags); in ip_frag_too_far()
307 if (!mod_timer(&qp->q.timer, jiffies + qp->q.net->timeout)) { in ip_frag_reinit()
308 atomic_inc(&qp->q.refcnt); in ip_frag_reinit()
312 fp = qp->q.fragments; in ip_frag_reinit()
320 sub_frag_mem_limit(qp->q.net, sum_truesize); in ip_frag_reinit()
322 qp->q.flags = 0; in ip_frag_reinit()
323 qp->q.len = 0; in ip_frag_reinit()
324 qp->q.meat = 0; in ip_frag_reinit()
325 qp->q.fragments = NULL; in ip_frag_reinit()
326 qp->q.fragments_tail = NULL; in ip_frag_reinit()
344 if (qp->q.flags & INET_FRAG_COMPLETE) in ip_frag_queue()
370 if (end < qp->q.len || in ip_frag_queue()
371 ((qp->q.flags & INET_FRAG_LAST_IN) && end != qp->q.len)) in ip_frag_queue()
373 qp->q.flags |= INET_FRAG_LAST_IN; in ip_frag_queue()
374 qp->q.len = end; in ip_frag_queue()
381 if (end > qp->q.len) { in ip_frag_queue()
383 if (qp->q.flags & INET_FRAG_LAST_IN) in ip_frag_queue()
385 qp->q.len = end; in ip_frag_queue()
403 prev = qp->q.fragments_tail; in ip_frag_queue()
409 for (next = qp->q.fragments; next != NULL; next = next->next) { in ip_frag_queue()
448 qp->q.meat -= i; in ip_frag_queue()
463 qp->q.fragments = next; in ip_frag_queue()
465 qp->q.meat -= free_it->len; in ip_frag_queue()
466 sub_frag_mem_limit(qp->q.net, free_it->truesize); in ip_frag_queue()
476 qp->q.fragments_tail = skb; in ip_frag_queue()
480 qp->q.fragments = skb; in ip_frag_queue()
487 qp->q.stamp = skb->tstamp; in ip_frag_queue()
488 qp->q.meat += skb->len; in ip_frag_queue()
490 add_frag_mem_limit(qp->q.net, skb->truesize); in ip_frag_queue()
492 qp->q.flags |= INET_FRAG_FIRST_IN; in ip_frag_queue()
496 if (fragsize > qp->q.max_size) in ip_frag_queue()
497 qp->q.max_size = fragsize; in ip_frag_queue()
503 if (qp->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && in ip_frag_queue()
504 qp->q.meat == qp->q.len) { in ip_frag_queue()
527 struct net *net = container_of(qp->q.net, struct net, ipv4.frags); in ip_frag_reasm()
529 struct sk_buff *fp, *head = qp->q.fragments; in ip_frag_reasm()
551 qp->q.fragments_tail = fp; in ip_frag_reasm()
554 skb_morph(head, qp->q.fragments); in ip_frag_reasm()
555 head->next = qp->q.fragments->next; in ip_frag_reasm()
557 consume_skb(qp->q.fragments); in ip_frag_reasm()
558 qp->q.fragments = head; in ip_frag_reasm()
566 len = ihlen + qp->q.len; in ip_frag_reasm()
597 add_frag_mem_limit(qp->q.net, clone->truesize); in ip_frag_reasm()
612 sub_frag_mem_limit(qp->q.net, head->truesize); in ip_frag_reasm()
616 head->tstamp = qp->q.stamp; in ip_frag_reasm()
617 IPCB(head)->frag_max_size = max(qp->max_df_size, qp->q.max_size); in ip_frag_reasm()
631 if (qp->max_df_size == qp->q.max_size) { in ip_frag_reasm()
641 qp->q.fragments = NULL; in ip_frag_reasm()
642 qp->q.fragments_tail = NULL; in ip_frag_reasm()
671 spin_lock(&qp->q.lock); in ip_defrag()
675 spin_unlock(&qp->q.lock); in ip_defrag()