Lines Matching refs:f

174 static void fq_flow_set_detached(struct fq_flow *f)  in fq_flow_set_detached()  argument
176 f->age = jiffies | 1UL; in fq_flow_set_detached()
179 static bool fq_flow_is_detached(const struct fq_flow *f) in fq_flow_is_detached() argument
181 return !!(f->age & 1UL); in fq_flow_is_detached()
187 static bool fq_flow_is_throttled(const struct fq_flow *f) in fq_flow_is_throttled() argument
189 return f->next == &throttled; in fq_flow_is_throttled()
213 static void fq_flow_unset_throttled(struct fq_sched_data *q, struct fq_flow *f) in fq_flow_unset_throttled() argument
215 rb_erase(&f->rate_node, &q->delayed); in fq_flow_unset_throttled()
217 fq_flow_add_tail(q, f, OLD_FLOW); in fq_flow_unset_throttled()
220 static void fq_flow_set_throttled(struct fq_sched_data *q, struct fq_flow *f) in fq_flow_set_throttled() argument
229 if (f->time_next_packet >= aux->time_next_packet) in fq_flow_set_throttled()
234 rb_link_node(&f->rate_node, parent, p); in fq_flow_set_throttled()
235 rb_insert_color(&f->rate_node, &q->delayed); in fq_flow_set_throttled()
239 f->next = &throttled; in fq_flow_set_throttled()
240 if (q->time_next_delayed_flow > f->time_next_packet) in fq_flow_set_throttled()
241 q->time_next_delayed_flow = f->time_next_packet; in fq_flow_set_throttled()
252 static bool fq_gc_candidate(const struct fq_flow *f) in fq_gc_candidate() argument
254 return fq_flow_is_detached(f) && in fq_gc_candidate()
255 time_after(jiffies, f->age + FQ_GC_AGE); in fq_gc_candidate()
264 struct fq_flow *f; in fq_gc() local
272 f = rb_entry(parent, struct fq_flow, fq_node); in fq_gc()
273 if (f->sk == sk) in fq_gc()
276 if (fq_gc_candidate(f)) { in fq_gc()
277 tofree[fcnt++] = f; in fq_gc()
282 if (f->sk > sk) in fq_gc()
292 f = tofree[--i]; in fq_gc()
293 rb_erase(&f->fq_node, root); in fq_gc()
361 struct fq_flow *f; in fq_classify() local
412 f = rb_entry(parent, struct fq_flow, fq_node); in fq_classify()
413 if (f->sk == sk) { in fq_classify()
420 f->socket_hash != sk->sk_hash)) { in fq_classify()
421 f->credit = q->initial_quantum; in fq_classify()
422 f->socket_hash = sk->sk_hash; in fq_classify()
426 if (fq_flow_is_throttled(f)) in fq_classify()
427 fq_flow_unset_throttled(q, f); in fq_classify()
428 f->time_next_packet = 0ULL; in fq_classify()
430 return f; in fq_classify()
432 if (f->sk > sk) in fq_classify()
438 f = kmem_cache_zalloc(fq_flow_cachep, GFP_ATOMIC | __GFP_NOWARN); in fq_classify()
439 if (unlikely(!f)) { in fq_classify()
445 fq_flow_set_detached(f); in fq_classify()
446 f->sk = sk; in fq_classify()
448 f->socket_hash = sk->sk_hash; in fq_classify()
453 f->credit = q->initial_quantum; in fq_classify()
455 rb_link_node(&f->fq_node, parent, p); in fq_classify()
456 rb_insert_color(&f->fq_node, root); in fq_classify()
460 return f; in fq_classify()
546 struct fq_flow *f; in fq_enqueue() local
574 f = fq_classify(sch, skb, now); in fq_enqueue()
576 if (f != &q->internal) { in fq_enqueue()
577 if (unlikely(f->qlen >= q->flow_plimit)) { in fq_enqueue()
583 if (fq_flow_is_detached(f)) { in fq_enqueue()
584 fq_flow_add_tail(q, f, NEW_FLOW); in fq_enqueue()
585 if (time_after(jiffies, f->age + q->flow_refill_delay)) in fq_enqueue()
586 f->credit = max_t(u32, f->credit, q->quantum); in fq_enqueue()
589 f->band = band; in fq_enqueue()
592 if (f->qlen == 0) in fq_enqueue()
596 f->qlen++; in fq_enqueue()
598 flow_queue_add(f, skb); in fq_enqueue()
627 struct fq_flow *f = rb_entry(p, struct fq_flow, rate_node); in fq_check_throttled() local
629 if (f->time_next_packet > now) { in fq_check_throttled()
630 q->time_next_delayed_flow = f->time_next_packet; in fq_check_throttled()
633 fq_flow_unset_throttled(q, f); in fq_check_throttled()
654 struct fq_flow *f; in fq_dequeue() local
693 f = head->first; in fq_dequeue()
695 if (f->credit <= 0) { in fq_dequeue()
696 f->credit += q->quantum; in fq_dequeue()
697 head->first = f->next; in fq_dequeue()
698 fq_flow_add_tail(q, f, OLD_FLOW); in fq_dequeue()
702 skb = fq_peek(f); in fq_dequeue()
705 f->time_next_packet); in fq_dequeue()
708 head->first = f->next; in fq_dequeue()
709 f->time_next_packet = time_next_packet; in fq_dequeue()
710 fq_flow_set_throttled(q, f); in fq_dequeue()
718 if (--f->qlen == 0) in fq_dequeue()
721 fq_dequeue_skb(sch, f, skb); in fq_dequeue()
723 head->first = f->next; in fq_dequeue()
726 fq_flow_add_tail(q, f, OLD_FLOW); in fq_dequeue()
728 fq_flow_set_detached(f); in fq_dequeue()
733 f->credit -= plen; in fq_dequeue()
750 f->credit = 0; in fq_dequeue()
753 if (f->credit > 0) in fq_dequeue()
774 if (f->time_next_packet) in fq_dequeue()
775 len -= min(len/2, now - f->time_next_packet); in fq_dequeue()
776 f->time_next_packet = now + len; in fq_dequeue()
804 struct fq_flow *f; in fq_reset() local
818 f = rb_entry(p, struct fq_flow, fq_node); in fq_reset()
821 fq_flow_purge(f); in fq_reset()
823 kmem_cache_free(fq_flow_cachep, f); in fq_reset()