Lines Matching refs:cl
174 struct tcq_class *cl;
181 if ((cl = tif->tif_classes[pri]) != NULL)
182 tcq_class_destroy(tif, cl);
191 struct tcq_class *cl;
197 if ((cl = tif->tif_classes[pri]) != NULL && !qempty(&cl->cl_q))
198 tcq_purgeq(tif, cl, 0, NULL, NULL);
226 tcq_purgeq(tif, ifq->ifcq_disc_slots[i].cl,
235 tcq_purgeq(tif, ifq->ifcq_disc_slots[i].cl,
246 struct tcq_class *cl;
252 if ((cl = tif->tif_classes[pri]) != NULL)
253 tcq_updateq(tif, cl, ev);
260 struct tcq_class *cl;
272 cl = tcq_class_create(tif, priority, qlimit, flags, qid);
273 if (cl == NULL)
277 *clp = cl;
288 struct tcq_class *cl;
334 if ((cl = tif->tif_classes[pri]) != NULL) {
336 if (!qempty(&cl->cl_q))
337 tcq_purgeq(tif, cl, 0, NULL, NULL);
339 if (q_is_rio(&cl->cl_q))
340 rio_destroy(cl->cl_rio);
343 if (q_is_red(&cl->cl_q))
344 red_destroy(cl->cl_red);
347 if (q_is_blue(&cl->cl_q))
348 blue_destroy(cl->cl_blue);
350 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
351 sfb_destroy(cl->cl_sfb);
352 cl->cl_qalg.ptr = NULL;
353 qtype(&cl->cl_q) = Q_DROPTAIL;
354 qstate(&cl->cl_q) = QS_RUNNING;
356 cl = zalloc(tcq_cl_zone);
357 if (cl == NULL)
360 bzero(cl, tcq_cl_size);
363 tif->tif_classes[pri] = cl;
365 tif->tif_default = cl;
371 _qinit(&cl->cl_q, Q_DROPTAIL, qlimit);
372 cl->cl_flags = flags;
373 cl->cl_pri = pri;
376 cl->cl_tif = tif;
377 cl->cl_handle = qid;
385 cl->cl_qflags = 0;
388 cl->cl_qflags |= BLUEF_ECN;
390 cl->cl_qflags |= SFBF_ECN;
392 cl->cl_qflags |= REDF_ECN;
394 cl->cl_qflags |= RIOF_ECN;
398 cl->cl_qflags |= SFBF_FLOWCTL;
402 cl->cl_qflags |= RIOF_CLEARDSCP;
418 cl->cl_red = red_alloc(ifp, 0, 0,
419 qlimit(&cl->cl_q) * 10/100,
420 qlimit(&cl->cl_q) * 30/100,
421 cl->cl_qflags, pkttime);
422 if (cl->cl_red != NULL)
423 qtype(&cl->cl_q) = Q_RED;
428 cl->cl_rio =
429 rio_alloc(ifp, 0, NULL, cl->cl_qflags, pkttime);
430 if (cl->cl_rio != NULL)
431 qtype(&cl->cl_q) = Q_RIO;
437 cl->cl_blue = blue_alloc(ifp, 0, 0, cl->cl_qflags);
438 if (cl->cl_blue != NULL)
439 qtype(&cl->cl_q) = Q_BLUE;
443 if (!(cl->cl_flags & TQCF_LAZY))
444 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
445 qlimit(&cl->cl_q), cl->cl_qflags);
446 if (cl->cl_sfb != NULL || (cl->cl_flags & TQCF_LAZY))
447 qtype(&cl->cl_q) = Q_SFB;
454 cl->cl_handle, cl->cl_pri, qlimit, flags, TQCF_BITS);
457 return (cl);
463 struct tcq_class *cl;
467 if ((cl = tcq_clh_to_clp(tif, qid)) == NULL)
470 return (tcq_class_destroy(tif, cl));
474 tcq_class_destroy(struct tcq_if *tif, struct tcq_class *cl)
481 if (!qempty(&cl->cl_q))
482 tcq_purgeq(tif, cl, 0, NULL, NULL);
484 tif->tif_classes[cl->cl_pri] = NULL;
485 if (tif->tif_maxpri == cl->cl_pri) {
486 for (pri = cl->cl_pri; pri >= 0; pri--)
495 if (tif->tif_default == cl)
498 if (cl->cl_qalg.ptr != NULL) {
500 if (q_is_rio(&cl->cl_q))
501 rio_destroy(cl->cl_rio);
504 if (q_is_red(&cl->cl_q))
505 red_destroy(cl->cl_red);
508 if (q_is_blue(&cl->cl_q))
509 blue_destroy(cl->cl_blue);
511 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
512 sfb_destroy(cl->cl_sfb);
513 cl->cl_qalg.ptr = NULL;
514 qtype(&cl->cl_q) = Q_DROPTAIL;
515 qstate(&cl->cl_q) = QS_RUNNING;
521 cl->cl_handle, cl->cl_pri);
524 zfree(tcq_cl_zone, cl);
529 tcq_enqueue(struct tcq_if *tif, struct tcq_class *cl, struct mbuf *m,
536 VERIFY(cl == NULL || cl->cl_tif == tif);
538 if (cl == NULL) {
539 cl = tcq_clh_to_clp(tif, t->pftag_qid);
540 if (cl == NULL) {
541 cl = tif->tif_default;
542 if (cl == NULL) {
552 ret = tcq_addq(cl, m, t);
562 PKTCNTR_ADD(&cl->cl_dropcnt, 1, len);
594 tcq_dequeue_cl(struct tcq_if *tif, struct tcq_class *cl,
602 if (cl == NULL) {
603 cl = tcq_clh_to_clp(tif, MBUF_SCIDX(sc));
604 if (cl == NULL)
608 if (qempty(&cl->cl_q))
614 return (tcq_pollq(cl));
616 m = tcq_getq(cl);
619 if (qempty(&cl->cl_q))
620 cl->cl_period++;
621 PKTCNTR_ADD(&cl->cl_xmitcnt, 1, m_pktlen(m));
628 tcq_addq(struct tcq_class *cl, struct mbuf *m, struct pf_mtag *t)
630 struct tcq_if *tif = cl->cl_tif;
636 if (q_is_rio(&cl->cl_q))
637 return (rio_addq(cl->cl_rio, &cl->cl_q, m, t));
641 if (q_is_red(&cl->cl_q))
642 return (red_addq(cl->cl_red, &cl->cl_q, m, t));
646 if (q_is_blue(&cl->cl_q))
647 return (blue_addq(cl->cl_blue, &cl->cl_q, m, t));
650 if (q_is_sfb(&cl->cl_q)) {
651 if (cl->cl_sfb == NULL) {
654 VERIFY(cl->cl_flags & TQCF_LAZY);
655 cl->cl_flags &= ~TQCF_LAZY;
658 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
659 qlimit(&cl->cl_q), cl->cl_qflags);
660 if (cl->cl_sfb == NULL) {
662 qtype(&cl->cl_q) = Q_DROPTAIL;
663 cl->cl_flags &= ~TQCF_SFB;
664 cl->cl_qflags &= ~(SFBF_ECN | SFBF_FLOWCTL);
669 tcq_style(tif), cl->cl_handle,
670 cl->cl_pri);
684 if (cl->cl_sfb != NULL)
685 return (sfb_addq(cl->cl_sfb, &cl->cl_q, m, t));
686 } else if (qlen(&cl->cl_q) >= qlimit(&cl->cl_q)) {
692 if (cl->cl_flags & TQCF_CLEARDSCP)
695 _addq(&cl->cl_q, m);
701 tcq_getq(struct tcq_class *cl)
703 IFCQ_LOCK_ASSERT_HELD(cl->cl_tif->tif_ifq);
706 if (q_is_rio(&cl->cl_q))
707 return (rio_getq(cl->cl_rio, &cl->cl_q));
711 if (q_is_red(&cl->cl_q))
712 return (red_getq(cl->cl_red, &cl->cl_q));
716 if (q_is_blue(&cl->cl_q))
717 return (blue_getq(cl->cl_blue, &cl->cl_q));
720 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
721 return (sfb_getq(cl->cl_sfb, &cl->cl_q));
723 return (_getq(&cl->cl_q));
727 tcq_pollq(struct tcq_class *cl)
729 IFCQ_LOCK_ASSERT_HELD(cl->cl_tif->tif_ifq);
731 return (qhead(&cl->cl_q));
735 tcq_purgeq(struct tcq_if *tif, struct tcq_class *cl, u_int32_t flow,
743 if ((qlen = qlen(&cl->cl_q)) == 0)
750 if (q_is_rio(&cl->cl_q))
751 rio_purgeq(cl->cl_rio, &cl->cl_q, flow, &cnt, &len);
755 if (q_is_red(&cl->cl_q))
756 red_purgeq(cl->cl_red, &cl->cl_q, flow, &cnt, &len);
760 if (q_is_blue(&cl->cl_q))
761 blue_purgeq(cl->cl_blue, &cl->cl_q, flow, &cnt, &len);
764 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
765 sfb_purgeq(cl->cl_sfb, &cl->cl_q, flow, &cnt, &len);
767 _flushq_flow(&cl->cl_q, flow, &cnt, &len);
770 VERIFY(qlen(&cl->cl_q) == (qlen - cnt));
772 PKTCNTR_ADD(&cl->cl_dropcnt, cnt, len);
782 cl->cl_handle, cl->cl_pri, qlen, qlen(&cl->cl_q),
794 tcq_updateq(struct tcq_if *tif, struct tcq_class *cl, cqev_t ev)
801 cl->cl_handle, cl->cl_pri, ifclassq_ev2str(ev));
805 if (q_is_rio(&cl->cl_q))
806 return (rio_updateq(cl->cl_rio, ev));
809 if (q_is_red(&cl->cl_q))
810 return (red_updateq(cl->cl_red, ev));
813 if (q_is_blue(&cl->cl_q))
814 return (blue_updateq(cl->cl_blue, ev));
816 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
817 return (sfb_updateq(cl->cl_sfb, ev));
824 struct tcq_class *cl;
828 if ((cl = tcq_clh_to_clp(tif, qid)) == NULL)
831 sp->class_handle = cl->cl_handle;
832 sp->priority = cl->cl_pri;
833 sp->qlength = qlen(&cl->cl_q);
834 sp->qlimit = qlimit(&cl->cl_q);
835 sp->period = cl->cl_period;
836 sp->xmitcnt = cl->cl_xmitcnt;
837 sp->dropcnt = cl->cl_dropcnt;
839 sp->qtype = qtype(&cl->cl_q);
840 sp->qstate = qstate(&cl->cl_q);
842 if (q_is_red(&cl->cl_q))
843 red_getstats(cl->cl_red, &sp->red[0]);
846 if (q_is_rio(&cl->cl_q))
847 rio_getstats(cl->cl_rio, &sp->red[0]);
850 if (q_is_blue(&cl->cl_q))
851 blue_getstats(cl->cl_blue, &sp->blue);
853 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
854 sfb_getstats(cl->cl_sfb, &sp->sfb);
863 struct tcq_class *cl;
869 if ((cl = tif->tif_classes[idx]) != NULL &&
870 cl->cl_handle == chandle)
871 return (cl);
906 ifq->ifcq_disc_slots[i].cl, m, m_pftag(m)));
927 ifq->ifcq_disc_slots[i].cl, sc, op));
1015 ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl = cl0;
1018 ifq->ifcq_disc_slots[SCIDX_BK].cl = cl0;
1022 ifq->ifcq_disc_slots[SCIDX_BE].cl = cl1;
1025 ifq->ifcq_disc_slots[SCIDX_RD].cl = cl1;
1028 ifq->ifcq_disc_slots[SCIDX_OAM].cl = cl1;
1032 ifq->ifcq_disc_slots[SCIDX_AV].cl = cl2;
1035 ifq->ifcq_disc_slots[SCIDX_RV].cl = cl2;
1038 ifq->ifcq_disc_slots[SCIDX_VI].cl = cl2;
1042 ifq->ifcq_disc_slots[SCIDX_VO].cl = cl3;
1045 ifq->ifcq_disc_slots[SCIDX_CTL].cl = cl3;
1069 ifq->ifcq_disc_slots[i].cl = NULL;
1095 struct tcq_class *cl;
1110 cl = ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl;
1114 err = tcq_resumeq(tif, cl);
1118 err = tcq_suspendq(tif, cl);
1137 tcq_purgeq(tif, cl, 0, NULL, NULL);
1148 tcq_resumeq(struct tcq_if *tif, struct tcq_class *cl)
1156 if (q_is_rio(&cl->cl_q))
1157 err = rio_suspendq(cl->cl_rio, &cl->cl_q, FALSE);
1161 if (q_is_red(&cl->cl_q))
1162 err = red_suspendq(cl->cl_red, &cl->cl_q, FALSE);
1166 if (q_is_blue(&cl->cl_q))
1167 err = blue_suspendq(cl->cl_blue, &cl->cl_q, FALSE);
1170 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1171 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, FALSE);
1174 qstate(&cl->cl_q) = QS_RUNNING;
1180 tcq_suspendq(struct tcq_if *tif, struct tcq_class *cl)
1188 if (q_is_rio(&cl->cl_q))
1189 err = rio_suspendq(cl->cl_rio, &cl->cl_q, TRUE);
1193 if (q_is_red(&cl->cl_q))
1194 err = red_suspendq(cl->cl_red, &cl->cl_q, TRUE);
1198 if (q_is_blue(&cl->cl_q))
1199 err = blue_suspendq(cl->cl_blue, &cl->cl_q, TRUE);
1202 if (q_is_sfb(&cl->cl_q)) {
1203 if (cl->cl_sfb != NULL) {
1204 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, TRUE);
1206 VERIFY(cl->cl_flags & TQCF_LAZY);
1212 qstate(&cl->cl_q) = QS_SUSPENDED;