Lines Matching refs:q
57 static void fragrun_append_to_last(struct inet_frag_queue *q, in fragrun_append_to_last() argument
62 FRAG_CB(q->last_run_head)->frag_run_len += skb->len; in fragrun_append_to_last()
63 FRAG_CB(q->fragments_tail)->next_frag = skb; in fragrun_append_to_last()
64 q->fragments_tail = skb; in fragrun_append_to_last()
68 static void fragrun_create(struct inet_frag_queue *q, struct sk_buff *skb) in fragrun_create() argument
73 if (q->last_run_head) in fragrun_create()
74 rb_link_node(&skb->rbnode, &q->last_run_head->rbnode, in fragrun_create()
75 &q->last_run_head->rbnode.rb_right); in fragrun_create()
77 rb_link_node(&skb->rbnode, NULL, &q->rb_fragments.rb_node); in fragrun_create()
78 rb_insert_color(&skb->rbnode, &q->rb_fragments); in fragrun_create()
80 q->fragments_tail = skb; in fragrun_create()
81 q->last_run_head = skb; in fragrun_create()
258 struct inet_frag_queue *q = container_of(head, struct inet_frag_queue, in inet_frag_destroy_rcu() local
260 struct inet_frags *f = q->fqdir->f; in inet_frag_destroy_rcu()
263 f->destructor(q); in inet_frag_destroy_rcu()
264 kmem_cache_free(f->frags_cachep, q); in inet_frag_destroy_rcu()
290 void inet_frag_destroy(struct inet_frag_queue *q) in inet_frag_destroy() argument
297 WARN_ON(!(q->flags & INET_FRAG_COMPLETE)); in inet_frag_destroy()
298 reason = (q->flags & INET_FRAG_DROP) ? in inet_frag_destroy()
301 WARN_ON(del_timer(&q->timer) != 0); in inet_frag_destroy()
304 fqdir = q->fqdir; in inet_frag_destroy()
306 sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments, reason); in inet_frag_destroy()
309 call_rcu(&q->rcu, inet_frag_destroy_rcu); in inet_frag_destroy()
319 struct inet_frag_queue *q; in inet_frag_alloc() local
321 q = kmem_cache_zalloc(f->frags_cachep, GFP_ATOMIC); in inet_frag_alloc()
322 if (!q) in inet_frag_alloc()
325 q->fqdir = fqdir; in inet_frag_alloc()
326 f->constructor(q, arg); in inet_frag_alloc()
329 timer_setup(&q->timer, f->frag_expire, 0); in inet_frag_alloc()
330 spin_lock_init(&q->lock); in inet_frag_alloc()
331 refcount_set(&q->refcnt, 3); in inet_frag_alloc()
333 return q; in inet_frag_alloc()
341 struct inet_frag_queue *q; in inet_frag_create() local
343 q = inet_frag_alloc(fqdir, f, arg); in inet_frag_create()
344 if (!q) { in inet_frag_create()
348 mod_timer(&q->timer, jiffies + fqdir->timeout); in inet_frag_create()
350 *prev = rhashtable_lookup_get_insert_key(&fqdir->rhashtable, &q->key, in inet_frag_create()
351 &q->node, f->rhash_params); in inet_frag_create()
353 q->flags |= INET_FRAG_COMPLETE; in inet_frag_create()
354 inet_frag_kill(q); in inet_frag_create()
355 inet_frag_destroy(q); in inet_frag_create()
358 return q; in inet_frag_create()
386 int inet_frag_queue_insert(struct inet_frag_queue *q, struct sk_buff *skb, in inet_frag_queue_insert() argument
389 struct sk_buff *last = q->fragments_tail; in inet_frag_queue_insert()
401 fragrun_create(q, skb); /* First fragment. */ in inet_frag_queue_insert()
408 fragrun_append_to_last(q, skb); in inet_frag_queue_insert()
410 fragrun_create(q, skb); in inet_frag_queue_insert()
417 rbn = &q->rb_fragments.rb_node; in inet_frag_queue_insert()
441 rb_insert_color(&skb->rbnode, &q->rb_fragments); in inet_frag_queue_insert()
450 void *inet_frag_reasm_prepare(struct inet_frag_queue *q, struct sk_buff *skb, in inet_frag_reasm_prepare() argument
453 struct sk_buff *fp, *head = skb_rb_first(&q->rb_fragments); in inet_frag_reasm_prepare()
481 &q->rb_fragments); in inet_frag_reasm_prepare()
482 if (q->fragments_tail == skb) in inet_frag_reasm_prepare()
483 q->fragments_tail = fp; in inet_frag_reasm_prepare()
493 &q->rb_fragments); in inet_frag_reasm_prepare()
507 add_frag_mem_limit(q->fqdir, delta); in inet_frag_reasm_prepare()
529 add_frag_mem_limit(q->fqdir, clone->truesize); in inet_frag_reasm_prepare()
555 void inet_frag_reasm_finish(struct inet_frag_queue *q, struct sk_buff *head, in inet_frag_reasm_finish() argument
570 rb_erase(&head->rbnode, &q->rb_fragments); in inet_frag_reasm_finish()
612 rb_erase(rbn, &q->rb_fragments); in inet_frag_reasm_finish()
616 sub_frag_mem_limit(q->fqdir, sum_truesize); in inet_frag_reasm_finish()
621 head->tstamp = q->stamp; in inet_frag_reasm_finish()
622 head->mono_delivery_time = q->mono_delivery_time; in inet_frag_reasm_finish()
629 struct sk_buff *inet_frag_pull_head(struct inet_frag_queue *q) in inet_frag_pull_head() argument
633 head = skb_rb_first(&q->rb_fragments); in inet_frag_pull_head()
639 &q->rb_fragments); in inet_frag_pull_head()
641 rb_erase(&head->rbnode, &q->rb_fragments); in inet_frag_pull_head()
645 if (head == q->fragments_tail) in inet_frag_pull_head()
646 q->fragments_tail = NULL; in inet_frag_pull_head()
648 sub_frag_mem_limit(q->fqdir, head->truesize); in inet_frag_pull_head()