Lines Matching refs:cl

220 static void qfq_purge_queue(struct qfq_class *cl)  in qfq_purge_queue()  argument
222 unsigned int len = cl->qdisc->q.qlen; in qfq_purge_queue()
223 unsigned int backlog = cl->qdisc->qstats.backlog; in qfq_purge_queue()
225 qdisc_reset(cl->qdisc); in qfq_purge_queue()
226 qdisc_tree_reduce_backlog(cl->qdisc, len, backlog); in qfq_purge_queue()
325 struct qfq_class *cl) in qfq_add_to_agg() argument
327 cl->agg = agg; in qfq_add_to_agg()
330 if (cl->qdisc->q.qlen > 0) { /* adding an active class */ in qfq_add_to_agg()
331 list_add_tail(&cl->alist, &agg->active); in qfq_add_to_agg()
333 cl && q->in_serv_agg != agg) /* agg was inactive */ in qfq_add_to_agg()
353 static void qfq_deactivate_class(struct qfq_sched *q, struct qfq_class *cl) in qfq_deactivate_class() argument
355 struct qfq_aggregate *agg = cl->agg; in qfq_deactivate_class()
358 list_del(&cl->alist); /* remove from RR queue of the aggregate */ in qfq_deactivate_class()
364 static void qfq_rm_from_agg(struct qfq_sched *q, struct qfq_class *cl) in qfq_rm_from_agg() argument
366 struct qfq_aggregate *agg = cl->agg; in qfq_rm_from_agg()
368 cl->agg = NULL; in qfq_rm_from_agg()
377 static void qfq_deact_rm_from_agg(struct qfq_sched *q, struct qfq_class *cl) in qfq_deact_rm_from_agg() argument
379 if (cl->qdisc->q.qlen > 0) /* class is active */ in qfq_deact_rm_from_agg()
380 qfq_deactivate_class(q, cl); in qfq_deact_rm_from_agg()
382 qfq_rm_from_agg(q, cl); in qfq_deact_rm_from_agg()
386 static int qfq_change_agg(struct Qdisc *sch, struct qfq_class *cl, u32 weight, in qfq_change_agg() argument
398 qfq_deact_rm_from_agg(q, cl); in qfq_change_agg()
399 qfq_add_to_agg(q, new_agg, cl); in qfq_change_agg()
408 struct qfq_class *cl = (struct qfq_class *)*arg; in qfq_change_class() local
446 if (cl != NULL && in qfq_change_class()
447 lmax == cl->agg->lmax && in qfq_change_class()
448 weight == cl->agg->class_weight) in qfq_change_class()
451 delta_w = weight - (cl ? cl->agg->class_weight : 0); in qfq_change_class()
459 if (cl != NULL) { /* modify existing class */ in qfq_change_class()
461 err = gen_replace_estimator(&cl->bstats, NULL, in qfq_change_class()
462 &cl->rate_est, in qfq_change_class()
473 cl = kzalloc(sizeof(struct qfq_class), GFP_KERNEL); in qfq_change_class()
474 if (cl == NULL) in qfq_change_class()
477 cl->refcnt = 1; in qfq_change_class()
478 cl->common.classid = classid; in qfq_change_class()
479 cl->deficit = lmax; in qfq_change_class()
481 cl->qdisc = qdisc_create_dflt(sch->dev_queue, in qfq_change_class()
483 if (cl->qdisc == NULL) in qfq_change_class()
484 cl->qdisc = &noop_qdisc; in qfq_change_class()
487 err = gen_new_estimator(&cl->bstats, NULL, in qfq_change_class()
488 &cl->rate_est, in qfq_change_class()
496 qdisc_class_hash_insert(&q->clhash, &cl->common); in qfq_change_class()
509 gen_kill_estimator(&cl->bstats, &cl->rate_est); in qfq_change_class()
516 qfq_deact_rm_from_agg(q, cl); in qfq_change_class()
517 qfq_add_to_agg(q, new_agg, cl); in qfq_change_class()
520 *arg = (unsigned long)cl; in qfq_change_class()
524 qdisc_destroy(cl->qdisc); in qfq_change_class()
525 kfree(cl); in qfq_change_class()
529 static void qfq_destroy_class(struct Qdisc *sch, struct qfq_class *cl) in qfq_destroy_class() argument
533 qfq_rm_from_agg(q, cl); in qfq_destroy_class()
534 gen_kill_estimator(&cl->bstats, &cl->rate_est); in qfq_destroy_class()
535 qdisc_destroy(cl->qdisc); in qfq_destroy_class()
536 kfree(cl); in qfq_destroy_class()
542 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_delete_class() local
544 if (cl->filter_cnt > 0) in qfq_delete_class()
549 qfq_purge_queue(cl); in qfq_delete_class()
550 qdisc_class_hash_remove(&q->clhash, &cl->common); in qfq_delete_class()
552 BUG_ON(--cl->refcnt == 0); in qfq_delete_class()
564 struct qfq_class *cl = qfq_find_class(sch, classid); in qfq_get_class() local
566 if (cl != NULL) in qfq_get_class()
567 cl->refcnt++; in qfq_get_class()
569 return (unsigned long)cl; in qfq_get_class()
574 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_put_class() local
576 if (--cl->refcnt == 0) in qfq_put_class()
577 qfq_destroy_class(sch, cl); in qfq_put_class()
581 unsigned long cl) in qfq_tcf_chain() argument
585 if (cl) in qfq_tcf_chain()
594 struct qfq_class *cl = qfq_find_class(sch, classid); in qfq_bind_tcf() local
596 if (cl != NULL) in qfq_bind_tcf()
597 cl->filter_cnt++; in qfq_bind_tcf()
599 return (unsigned long)cl; in qfq_bind_tcf()
604 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_unbind_tcf() local
606 cl->filter_cnt--; in qfq_unbind_tcf()
612 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_graft_class() local
616 &pfifo_qdisc_ops, cl->common.classid); in qfq_graft_class()
621 *old = qdisc_replace(sch, new, &cl->qdisc); in qfq_graft_class()
627 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_class_leaf() local
629 return cl->qdisc; in qfq_class_leaf()
635 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_dump_class() local
639 tcm->tcm_handle = cl->common.classid; in qfq_dump_class()
640 tcm->tcm_info = cl->qdisc->handle; in qfq_dump_class()
645 if (nla_put_u32(skb, TCA_QFQ_WEIGHT, cl->agg->class_weight) || in qfq_dump_class()
646 nla_put_u32(skb, TCA_QFQ_LMAX, cl->agg->lmax)) in qfq_dump_class()
658 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_dump_class_stats() local
663 xstats.weight = cl->agg->class_weight; in qfq_dump_class_stats()
664 xstats.lmax = cl->agg->lmax; in qfq_dump_class_stats()
666 if (gnet_stats_copy_basic(d, NULL, &cl->bstats) < 0 || in qfq_dump_class_stats()
667 gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || in qfq_dump_class_stats()
669 &cl->qdisc->qstats, cl->qdisc->q.qlen) < 0) in qfq_dump_class_stats()
678 struct qfq_class *cl; in qfq_walk() local
685 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) { in qfq_walk()
690 if (arg->fn(sch, (unsigned long)cl, arg) < 0) { in qfq_walk()
703 struct qfq_class *cl; in qfq_classify() local
710 cl = qfq_find_class(sch, skb->priority); in qfq_classify()
711 if (cl != NULL) in qfq_classify()
712 return cl; in qfq_classify()
728 cl = (struct qfq_class *)res.class; in qfq_classify()
729 if (cl == NULL) in qfq_classify()
730 cl = qfq_find_class(sch, res.classid); in qfq_classify()
731 return cl; in qfq_classify()
996 struct qfq_class *cl, unsigned int len) in agg_dequeue() argument
998 qdisc_dequeue_peeked(cl->qdisc); in agg_dequeue()
1000 cl->deficit -= (int) len; in agg_dequeue()
1002 if (cl->qdisc->q.qlen == 0) /* no more packets, remove from list */ in agg_dequeue()
1003 list_del(&cl->alist); in agg_dequeue()
1004 else if (cl->deficit < qdisc_pkt_len(cl->qdisc->ops->peek(cl->qdisc))) { in agg_dequeue()
1005 cl->deficit += agg->lmax; in agg_dequeue()
1006 list_move_tail(&cl->alist, &agg->active); in agg_dequeue()
1011 struct qfq_class **cl, in qfq_peek_skb() argument
1016 *cl = list_first_entry(&agg->active, struct qfq_class, alist); in qfq_peek_skb()
1017 skb = (*cl)->qdisc->ops->peek((*cl)->qdisc); in qfq_peek_skb()
1102 struct qfq_class *cl; in qfq_dequeue() local
1111 skb = qfq_peek_skb(in_serv_agg, &cl, &len); in qfq_dequeue()
1148 skb = qfq_peek_skb(in_serv_agg, &cl, &len); in qfq_dequeue()
1156 agg_dequeue(in_serv_agg, cl, len); in qfq_dequeue()
1220 struct qfq_class *cl; in qfq_enqueue() local
1224 cl = qfq_classify(skb, sch, &err); in qfq_enqueue()
1225 if (cl == NULL) { in qfq_enqueue()
1231 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid); in qfq_enqueue()
1233 if (unlikely(cl->agg->lmax < qdisc_pkt_len(skb))) { in qfq_enqueue()
1235 cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid); in qfq_enqueue()
1236 err = qfq_change_agg(sch, cl, cl->agg->class_weight, in qfq_enqueue()
1242 err = qdisc_enqueue(skb, cl->qdisc); in qfq_enqueue()
1246 cl->qstats.drops++; in qfq_enqueue()
1252 bstats_update(&cl->bstats, skb); in qfq_enqueue()
1255 agg = cl->agg; in qfq_enqueue()
1257 if (cl->qdisc->q.qlen != 1) { in qfq_enqueue()
1258 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) && in qfq_enqueue()
1260 == cl && cl->deficit < qdisc_pkt_len(skb)) in qfq_enqueue()
1261 list_move_tail(&cl->alist, &agg->active); in qfq_enqueue()
1267 cl->deficit = agg->lmax; in qfq_enqueue()
1268 list_add_tail(&cl->alist, &agg->active); in qfq_enqueue()
1270 if (list_first_entry(&agg->active, struct qfq_class, alist) != cl || in qfq_enqueue()
1417 struct qfq_class *cl = (struct qfq_class *)arg; in qfq_qlen_notify() local
1419 if (cl->qdisc->q.qlen == 0) in qfq_qlen_notify()
1420 qfq_deactivate_class(q, cl); in qfq_qlen_notify()
1427 struct qfq_class *cl; in qfq_drop_from_slot() local
1431 list_for_each_entry(cl, &agg->active, alist) { in qfq_drop_from_slot()
1433 if (!cl->qdisc->ops->drop) in qfq_drop_from_slot()
1436 len = cl->qdisc->ops->drop(cl->qdisc); in qfq_drop_from_slot()
1438 if (cl->qdisc->q.qlen == 0) in qfq_drop_from_slot()
1439 qfq_deactivate_class(q, cl); in qfq_drop_from_slot()
1508 struct qfq_class *cl; in qfq_reset_qdisc() local
1512 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) { in qfq_reset_qdisc()
1513 if (cl->qdisc->q.qlen > 0) in qfq_reset_qdisc()
1514 qfq_deactivate_class(q, cl); in qfq_reset_qdisc()
1516 qdisc_reset(cl->qdisc); in qfq_reset_qdisc()
1525 struct qfq_class *cl; in qfq_destroy_qdisc() local
1532 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i], in qfq_destroy_qdisc()
1534 qfq_destroy_class(sch, cl); in qfq_destroy_qdisc()