Lines Matching refs:q
70 struct inet_frag_queue q; member
111 static unsigned int ip4_hashfn(const struct inet_frag_queue *q) in ip4_hashfn() argument
115 ipq = container_of(q, struct ipq, q); in ip4_hashfn()
119 static bool ip4_frag_match(const struct inet_frag_queue *q, const void *a) in ip4_frag_match() argument
124 qp = container_of(q, struct ipq, q); in ip4_frag_match()
132 static void ip4_frag_init(struct inet_frag_queue *q, const void *a) in ip4_frag_init() argument
134 struct ipq *qp = container_of(q, struct ipq, q); in ip4_frag_init()
135 struct netns_ipv4 *ipv4 = container_of(q->net, struct netns_ipv4, in ip4_frag_init()
151 static void ip4_frag_free(struct inet_frag_queue *q) in ip4_frag_free() argument
155 qp = container_of(q, struct ipq, q); in ip4_frag_free()
165 inet_frag_put(&ipq->q, &ip4_frags); in ipq_put()
173 inet_frag_kill(&ipq->q, &ip4_frags); in ipq_kill()
184 qp = container_of((struct inet_frag_queue *) arg, struct ipq, q); in ip_expire()
185 net = container_of(qp->q.net, struct net, ipv4.frags); in ip_expire()
187 spin_lock(&qp->q.lock); in ip_expire()
189 if (qp->q.flags & INET_FRAG_COMPLETE) in ip_expire()
195 if (!(qp->q.flags & INET_FRAG_EVICTED)) { in ip_expire()
196 struct sk_buff *head = qp->q.fragments; in ip_expire()
202 if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments) in ip_expire()
232 spin_unlock(&qp->q.lock); in ip_expire()
241 struct inet_frag_queue *q; in ip_find() local
250 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); in ip_find()
251 if (IS_ERR_OR_NULL(q)) { in ip_find()
252 inet_frag_maybe_warn_overflow(q, pr_fmt()); in ip_find()
255 return container_of(q, struct ipq, q); in ip_find()
274 rc = qp->q.fragments && (end - start) > max; in ip_frag_too_far()
279 net = container_of(qp->q.net, struct net, ipv4.frags); in ip_frag_too_far()
291 if (!mod_timer(&qp->q.timer, jiffies + qp->q.net->timeout)) { in ip_frag_reinit()
292 atomic_inc(&qp->q.refcnt); in ip_frag_reinit()
296 fp = qp->q.fragments; in ip_frag_reinit()
304 sub_frag_mem_limit(&qp->q, sum_truesize); in ip_frag_reinit()
306 qp->q.flags = 0; in ip_frag_reinit()
307 qp->q.len = 0; in ip_frag_reinit()
308 qp->q.meat = 0; in ip_frag_reinit()
309 qp->q.fragments = NULL; in ip_frag_reinit()
310 qp->q.fragments_tail = NULL; in ip_frag_reinit()
327 if (qp->q.flags & INET_FRAG_COMPLETE) in ip_frag_queue()
353 if (end < qp->q.len || in ip_frag_queue()
354 ((qp->q.flags & INET_FRAG_LAST_IN) && end != qp->q.len)) in ip_frag_queue()
356 qp->q.flags |= INET_FRAG_LAST_IN; in ip_frag_queue()
357 qp->q.len = end; in ip_frag_queue()
364 if (end > qp->q.len) { in ip_frag_queue()
366 if (qp->q.flags & INET_FRAG_LAST_IN) in ip_frag_queue()
368 qp->q.len = end; in ip_frag_queue()
386 prev = qp->q.fragments_tail; in ip_frag_queue()
392 for (next = qp->q.fragments; next != NULL; next = next->next) { in ip_frag_queue()
431 qp->q.meat -= i; in ip_frag_queue()
446 qp->q.fragments = next; in ip_frag_queue()
448 qp->q.meat -= free_it->len; in ip_frag_queue()
449 sub_frag_mem_limit(&qp->q, free_it->truesize); in ip_frag_queue()
459 qp->q.fragments_tail = skb; in ip_frag_queue()
463 qp->q.fragments = skb; in ip_frag_queue()
470 qp->q.stamp = skb->tstamp; in ip_frag_queue()
471 qp->q.meat += skb->len; in ip_frag_queue()
473 add_frag_mem_limit(&qp->q, skb->truesize); in ip_frag_queue()
475 qp->q.flags |= INET_FRAG_FIRST_IN; in ip_frag_queue()
478 skb->len + ihl > qp->q.max_size) in ip_frag_queue()
479 qp->q.max_size = skb->len + ihl; in ip_frag_queue()
481 if (qp->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && in ip_frag_queue()
482 qp->q.meat == qp->q.len) { in ip_frag_queue()
505 struct net *net = container_of(qp->q.net, struct net, ipv4.frags); in ip_frag_reasm()
507 struct sk_buff *fp, *head = qp->q.fragments; in ip_frag_reasm()
530 qp->q.fragments_tail = fp; in ip_frag_reasm()
533 skb_morph(head, qp->q.fragments); in ip_frag_reasm()
534 head->next = qp->q.fragments->next; in ip_frag_reasm()
536 consume_skb(qp->q.fragments); in ip_frag_reasm()
537 qp->q.fragments = head; in ip_frag_reasm()
545 len = ihlen + qp->q.len; in ip_frag_reasm()
576 add_frag_mem_limit(&qp->q, clone->truesize); in ip_frag_reasm()
604 sub_frag_mem_limit(&qp->q, sum_truesize); in ip_frag_reasm()
608 head->tstamp = qp->q.stamp; in ip_frag_reasm()
609 IPCB(head)->frag_max_size = qp->q.max_size; in ip_frag_reasm()
613 iph->frag_off = qp->q.max_size ? htons(IP_DF) : 0; in ip_frag_reasm()
620 qp->q.fragments = NULL; in ip_frag_reasm()
621 qp->q.fragments_tail = NULL; in ip_frag_reasm()
649 spin_lock(&qp->q.lock); in ip_defrag()
653 spin_unlock(&qp->q.lock); in ip_defrag()