Lines Matching refs:cl

221 static void qfq_purge_queue(struct qfq_class *cl)
223 unsigned int len = cl->qdisc->q.qlen;
225 qdisc_reset(cl->qdisc);
226 qdisc_tree_decrease_qlen(cl->qdisc, len);
324 struct qfq_class *cl)
326 cl->agg = agg;
329 if (cl->qdisc->q.qlen > 0) { /* adding an active class */
330 list_add_tail(&cl->alist, &agg->active);
332 cl && q->in_serv_agg != agg) /* agg was inactive */
349 static void qfq_deactivate_class(struct qfq_sched *q, struct qfq_class *cl)
351 struct qfq_aggregate *agg = cl->agg;
354 list_del(&cl->alist); /* remove from RR queue of the aggregate */
360 static void qfq_rm_from_agg(struct qfq_sched *q, struct qfq_class *cl)
362 struct qfq_aggregate *agg = cl->agg;
364 cl->agg = NULL;
373 static void qfq_deact_rm_from_agg(struct qfq_sched *q, struct qfq_class *cl)
375 if (cl->qdisc->q.qlen > 0) /* class is active */
376 qfq_deactivate_class(q, cl);
378 qfq_rm_from_agg(q, cl);
382 static int qfq_change_agg(struct Qdisc *sch, struct qfq_class *cl, u32 weight,
394 qfq_deact_rm_from_agg(q, cl);
395 qfq_add_to_agg(q, new_agg, cl);
404 struct qfq_class *cl = (struct qfq_class *)*arg;
442 if (cl != NULL &&
443 lmax == cl->agg->lmax &&
444 weight == cl->agg->class_weight)
447 delta_w = weight - (cl ? cl->agg->class_weight : 0);
455 if (cl != NULL) { /* modify existing class */
457 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
468 cl = kzalloc(sizeof(struct qfq_class), GFP_KERNEL);
469 if (cl == NULL)
472 cl->refcnt = 1;
473 cl->common.classid = classid;
474 cl->deficit = lmax;
476 cl->qdisc = qdisc_create_dflt(sch->dev_queue,
478 if (cl->qdisc == NULL)
479 cl->qdisc = &noop_qdisc;
482 err = gen_new_estimator(&cl->bstats, &cl->rate_est,
490 qdisc_class_hash_insert(&q->clhash, &cl->common);
503 gen_kill_estimator(&cl->bstats, &cl->rate_est);
510 qfq_deact_rm_from_agg(q, cl);
511 qfq_add_to_agg(q, new_agg, cl);
514 *arg = (unsigned long)cl;
518 qdisc_destroy(cl->qdisc);
519 kfree(cl);
523 static void qfq_destroy_class(struct Qdisc *sch, struct qfq_class *cl)
527 qfq_rm_from_agg(q, cl);
528 gen_kill_estimator(&cl->bstats, &cl->rate_est);
529 qdisc_destroy(cl->qdisc);
530 kfree(cl);
536 struct qfq_class *cl = (struct qfq_class *)arg;
538 if (cl->filter_cnt > 0)
543 qfq_purge_queue(cl);
544 qdisc_class_hash_remove(&q->clhash, &cl->common);
546 BUG_ON(--cl->refcnt == 0);
558 struct qfq_class *cl = qfq_find_class(sch, classid);
560 if (cl != NULL)
561 cl->refcnt++;
563 return (unsigned long)cl;
568 struct qfq_class *cl = (struct qfq_class *)arg;
570 if (--cl->refcnt == 0)
571 qfq_destroy_class(sch, cl);
574 static struct tcf_proto **qfq_tcf_chain(struct Qdisc *sch, unsigned long cl)
578 if (cl)
587 struct qfq_class *cl = qfq_find_class(sch, classid);
589 if (cl != NULL)
590 cl->filter_cnt++;
592 return (unsigned long)cl;
597 struct qfq_class *cl = (struct qfq_class *)arg;
599 cl->filter_cnt--;
605 struct qfq_class *cl = (struct qfq_class *)arg;
609 &pfifo_qdisc_ops, cl->common.classid);
615 qfq_purge_queue(cl);
616 *old = cl->qdisc;
617 cl->qdisc = new;
624 struct qfq_class *cl = (struct qfq_class *)arg;
626 return cl->qdisc;
632 struct qfq_class *cl = (struct qfq_class *)arg;
636 tcm->tcm_handle = cl->common.classid;
637 tcm->tcm_info = cl->qdisc->handle;
642 if (nla_put_u32(skb, TCA_QFQ_WEIGHT, cl->agg->class_weight) ||
643 nla_put_u32(skb, TCA_QFQ_LMAX, cl->agg->lmax))
655 struct qfq_class *cl = (struct qfq_class *)arg;
659 cl->qdisc->qstats.qlen = cl->qdisc->q.qlen;
661 xstats.weight = cl->agg->class_weight;
662 xstats.lmax = cl->agg->lmax;
664 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
665 gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 ||
666 gnet_stats_copy_queue(d, &cl->qdisc->qstats) < 0)
675 struct qfq_class *cl;
682 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
687 if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
700 struct qfq_class *cl;
706 cl = qfq_find_class(sch, skb->priority);
707 if (cl != NULL)
708 return cl;
723 cl = (struct qfq_class *)res.class;
724 if (cl == NULL)
725 cl = qfq_find_class(sch, res.classid);
726 return cl;
962 struct qfq_class *cl, unsigned int len)
964 qdisc_dequeue_peeked(cl->qdisc);
966 cl->deficit -= (int) len;
968 if (cl->qdisc->q.qlen == 0) /* no more packets, remove from list */
969 list_del(&cl->alist);
970 else if (cl->deficit < qdisc_pkt_len(cl->qdisc->ops->peek(cl->qdisc))) {
971 cl->deficit += agg->lmax;
972 list_move_tail(&cl->alist, &agg->active);
977 struct qfq_class **cl,
982 *cl = list_first_entry(&agg->active, struct qfq_class, alist);
983 skb = (*cl)->qdisc->ops->peek((*cl)->qdisc);
1016 struct qfq_class *cl;
1025 skb = qfq_peek_skb(in_serv_agg, &cl, &len);
1062 skb = qfq_peek_skb(in_serv_agg, &cl, &len);
1070 agg_dequeue(in_serv_agg, cl, len);
1194 struct qfq_class *cl;
1198 cl = qfq_classify(skb, sch, &err);
1199 if (cl == NULL) {
1205 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);
1207 if (unlikely(cl->agg->lmax < qdisc_pkt_len(skb))) {
1209 cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid);
1210 err = qfq_change_agg(sch, cl, cl->agg->class_weight,
1216 err = qdisc_enqueue(skb, cl->qdisc);
1220 cl->qstats.drops++;
1226 bstats_update(&cl->bstats, skb);
1229 agg = cl->agg;
1231 if (cl->qdisc->q.qlen != 1) {
1232 if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) &&
1234 == cl && cl->deficit < qdisc_pkt_len(skb))
1235 list_move_tail(&cl->alist, &agg->active);
1241 cl->deficit = agg->lmax;
1242 list_add_tail(&cl->alist, &agg->active);
1244 if (list_first_entry(&agg->active, struct qfq_class, alist) != cl ||
1391 struct qfq_class *cl = (struct qfq_class *)arg;
1393 if (cl->qdisc->q.qlen == 0)
1394 qfq_deactivate_class(q, cl);
1401 struct qfq_class *cl;
1405 list_for_each_entry(cl, &agg->active, alist) {
1407 if (!cl->qdisc->ops->drop)
1410 len = cl->qdisc->ops->drop(cl->qdisc);
1412 if (cl->qdisc->q.qlen == 0)
1413 qfq_deactivate_class(q, cl);
1482 struct qfq_class *cl;
1486 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
1487 if (cl->qdisc->q.qlen > 0)
1488 qfq_deactivate_class(q, cl);
1490 qdisc_reset(cl->qdisc);
1499 struct qfq_class *cl;
1506 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
1508 qfq_destroy_class(sch, cl);