Lines Matching refs:cl
202 struct priq_class *cl;
209 if ((cl = pif->pif_classes[pri]) != NULL)
210 priq_class_destroy(pif, cl);
219 struct priq_class *cl;
225 if ((cl = pif->pif_classes[pri]) != NULL && !qempty(&cl->cl_q))
226 priq_purgeq(pif, cl, 0, NULL, NULL);
254 priq_purgeq(pif, ifq->ifcq_disc_slots[i].cl,
263 priq_purgeq(pif, ifq->ifcq_disc_slots[i].cl,
274 struct priq_class *cl;
280 if ((cl = pif->pif_classes[pri]) != NULL)
281 priq_updateq(pif, cl, ev);
288 struct priq_class *cl;
300 cl = priq_class_create(pif, priority, qlimit, flags, qid);
301 if (cl == NULL)
305 *clp = cl;
316 struct priq_class *cl;
362 if ((cl = pif->pif_classes[pri]) != NULL) {
364 if (!qempty(&cl->cl_q))
365 priq_purgeq(pif, cl, 0, NULL, NULL);
367 if (q_is_rio(&cl->cl_q))
368 rio_destroy(cl->cl_rio);
371 if (q_is_red(&cl->cl_q))
372 red_destroy(cl->cl_red);
375 if (q_is_blue(&cl->cl_q))
376 blue_destroy(cl->cl_blue);
378 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
379 sfb_destroy(cl->cl_sfb);
380 cl->cl_qalg.ptr = NULL;
381 qtype(&cl->cl_q) = Q_DROPTAIL;
382 qstate(&cl->cl_q) = QS_RUNNING;
384 cl = zalloc(priq_cl_zone);
385 if (cl == NULL)
388 bzero(cl, priq_cl_size);
391 pif->pif_classes[pri] = cl;
393 pif->pif_default = cl;
399 _qinit(&cl->cl_q, Q_DROPTAIL, qlimit);
400 cl->cl_flags = flags;
401 cl->cl_pri = pri;
404 cl->cl_pif = pif;
405 cl->cl_handle = qid;
413 cl->cl_qflags = 0;
416 cl->cl_qflags |= BLUEF_ECN;
418 cl->cl_qflags |= SFBF_ECN;
420 cl->cl_qflags |= REDF_ECN;
422 cl->cl_qflags |= RIOF_ECN;
426 cl->cl_qflags |= SFBF_FLOWCTL;
430 cl->cl_qflags |= RIOF_CLEARDSCP;
446 cl->cl_red = red_alloc(ifp, 0, 0,
447 qlimit(&cl->cl_q) * 10/100,
448 qlimit(&cl->cl_q) * 30/100,
449 cl->cl_qflags, pkttime);
450 if (cl->cl_red != NULL)
451 qtype(&cl->cl_q) = Q_RED;
456 cl->cl_rio =
457 rio_alloc(ifp, 0, NULL, cl->cl_qflags, pkttime);
458 if (cl->cl_rio != NULL)
459 qtype(&cl->cl_q) = Q_RIO;
465 cl->cl_blue = blue_alloc(ifp, 0, 0, cl->cl_qflags);
466 if (cl->cl_blue != NULL)
467 qtype(&cl->cl_q) = Q_BLUE;
471 if (!(cl->cl_flags & PRCF_LAZY))
472 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
473 qlimit(&cl->cl_q), cl->cl_qflags);
474 if (cl->cl_sfb != NULL || (cl->cl_flags & PRCF_LAZY))
475 qtype(&cl->cl_q) = Q_SFB;
482 cl->cl_handle, cl->cl_pri, qlimit, flags, PRCF_BITS);
485 return (cl);
491 struct priq_class *cl;
495 if ((cl = priq_clh_to_clp(pif, qid)) == NULL)
498 return (priq_class_destroy(pif, cl));
502 priq_class_destroy(struct priq_if *pif, struct priq_class *cl)
509 if (!qempty(&cl->cl_q))
510 priq_purgeq(pif, cl, 0, NULL, NULL);
512 VERIFY(cl->cl_pri < PRIQ_MAXPRI);
513 VERIFY(!pktsched_bit_tst(cl->cl_pri, &pif->pif_bitmap));
515 pif->pif_classes[cl->cl_pri] = NULL;
516 if (pif->pif_maxpri == cl->cl_pri) {
517 for (pri = cl->cl_pri; pri >= 0; pri--)
526 if (pif->pif_default == cl)
529 if (cl->cl_qalg.ptr != NULL) {
531 if (q_is_rio(&cl->cl_q))
532 rio_destroy(cl->cl_rio);
535 if (q_is_red(&cl->cl_q))
536 red_destroy(cl->cl_red);
539 if (q_is_blue(&cl->cl_q))
540 blue_destroy(cl->cl_blue);
542 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
543 sfb_destroy(cl->cl_sfb);
544 cl->cl_qalg.ptr = NULL;
545 qtype(&cl->cl_q) = Q_DROPTAIL;
546 qstate(&cl->cl_q) = QS_RUNNING;
552 cl->cl_handle, cl->cl_pri);
555 zfree(priq_cl_zone, cl);
561 priq_enqueue(struct priq_if *pif, struct priq_class *cl, struct mbuf *m,
569 VERIFY(cl == NULL || cl->cl_pif == pif);
571 if (cl == NULL) {
572 cl = priq_clh_to_clp(pif, t->pftag_qid);
573 if (cl == NULL) {
574 cl = pif->pif_default;
575 if (cl == NULL) {
582 pri = cl->cl_pri;
587 ret = priq_addq(cl, m, t);
597 PKTCNTR_ADD(&cl->cl_dropcnt, 1, len);
630 struct priq_class *cl;
644 cl = pif->pif_classes[pri];
645 VERIFY(cl != NULL && !qempty(&cl->cl_q));
648 return (priq_pollq(cl));
650 m = priq_getq(cl);
655 if (qempty(&cl->cl_q)) {
656 cl->cl_period++;
660 PKTCNTR_ADD(&cl->cl_xmitcnt, 1, len);
667 priq_addq(struct priq_class *cl, struct mbuf *m, struct pf_mtag *t)
669 struct priq_if *pif = cl->cl_pif;
675 if (q_is_rio(&cl->cl_q))
676 return (rio_addq(cl->cl_rio, &cl->cl_q, m, t));
680 if (q_is_red(&cl->cl_q))
681 return (red_addq(cl->cl_red, &cl->cl_q, m, t));
685 if (q_is_blue(&cl->cl_q))
686 return (blue_addq(cl->cl_blue, &cl->cl_q, m, t));
689 if (q_is_sfb(&cl->cl_q)) {
690 if (cl->cl_sfb == NULL) {
693 VERIFY(cl->cl_flags & PRCF_LAZY);
694 cl->cl_flags &= ~PRCF_LAZY;
697 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
698 qlimit(&cl->cl_q), cl->cl_qflags);
699 if (cl->cl_sfb == NULL) {
701 qtype(&cl->cl_q) = Q_DROPTAIL;
702 cl->cl_flags &= ~PRCF_SFB;
703 cl->cl_qflags &= ~(SFBF_ECN | SFBF_FLOWCTL);
708 priq_style(pif), cl->cl_handle,
709 cl->cl_pri);
723 if (cl->cl_sfb != NULL)
724 return (sfb_addq(cl->cl_sfb, &cl->cl_q, m, t));
725 } else if (qlen(&cl->cl_q) >= qlimit(&cl->cl_q)) {
731 if (cl->cl_flags & PRCF_CLEARDSCP)
734 _addq(&cl->cl_q, m);
740 priq_getq(struct priq_class *cl)
742 IFCQ_LOCK_ASSERT_HELD(cl->cl_pif->pif_ifq);
745 if (q_is_rio(&cl->cl_q))
746 return (rio_getq(cl->cl_rio, &cl->cl_q));
750 if (q_is_red(&cl->cl_q))
751 return (red_getq(cl->cl_red, &cl->cl_q));
755 if (q_is_blue(&cl->cl_q))
756 return (blue_getq(cl->cl_blue, &cl->cl_q));
759 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
760 return (sfb_getq(cl->cl_sfb, &cl->cl_q));
762 return (_getq(&cl->cl_q));
766 priq_pollq(struct priq_class *cl)
768 IFCQ_LOCK_ASSERT_HELD(cl->cl_pif->pif_ifq);
770 return (qhead(&cl->cl_q));
774 priq_purgeq(struct priq_if *pif, struct priq_class *cl, u_int32_t flow,
782 if ((qlen = qlen(&cl->cl_q)) == 0) {
783 VERIFY(!pktsched_bit_tst(cl->cl_pri, &pif->pif_bitmap));
791 if (q_is_rio(&cl->cl_q))
792 rio_purgeq(cl->cl_rio, &cl->cl_q, flow, &cnt, &len);
796 if (q_is_red(&cl->cl_q))
797 red_purgeq(cl->cl_red, &cl->cl_q, flow, &cnt, &len);
801 if (q_is_blue(&cl->cl_q))
802 blue_purgeq(cl->cl_blue, &cl->cl_q, flow, &cnt, &len);
805 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
806 sfb_purgeq(cl->cl_sfb, &cl->cl_q, flow, &cnt, &len);
808 _flushq_flow(&cl->cl_q, flow, &cnt, &len);
811 VERIFY(qlen(&cl->cl_q) == (qlen - cnt));
813 PKTCNTR_ADD(&cl->cl_dropcnt, cnt, len);
819 if (qempty(&cl->cl_q))
820 pktsched_bit_clr(cl->cl_pri, &pif->pif_bitmap);
826 cl->cl_handle, cl->cl_pri, qlen, qlen(&cl->cl_q),
838 priq_updateq(struct priq_if *pif, struct priq_class *cl, cqev_t ev)
845 cl->cl_handle, cl->cl_pri, ifclassq_ev2str(ev));
849 if (q_is_rio(&cl->cl_q))
850 return (rio_updateq(cl->cl_rio, ev));
853 if (q_is_red(&cl->cl_q))
854 return (red_updateq(cl->cl_red, ev));
857 if (q_is_blue(&cl->cl_q))
858 return (blue_updateq(cl->cl_blue, ev));
860 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
861 return (sfb_updateq(cl->cl_sfb, ev));
868 struct priq_class *cl;
872 if ((cl = priq_clh_to_clp(pif, qid)) == NULL)
875 sp->class_handle = cl->cl_handle;
876 sp->priority = cl->cl_pri;
877 sp->qlength = qlen(&cl->cl_q);
878 sp->qlimit = qlimit(&cl->cl_q);
879 sp->period = cl->cl_period;
880 sp->xmitcnt = cl->cl_xmitcnt;
881 sp->dropcnt = cl->cl_dropcnt;
883 sp->qtype = qtype(&cl->cl_q);
884 sp->qstate = qstate(&cl->cl_q);
886 if (q_is_red(&cl->cl_q))
887 red_getstats(cl->cl_red, &sp->red[0]);
890 if (q_is_rio(&cl->cl_q))
891 rio_getstats(cl->cl_rio, &sp->red[0]);
894 if (q_is_blue(&cl->cl_q))
895 blue_getstats(cl->cl_blue, &sp->blue);
897 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
898 sfb_getstats(cl->cl_sfb, &sp->sfb);
907 struct priq_class *cl;
913 if ((cl = pif->pif_classes[idx]) != NULL &&
914 cl->cl_handle == chandle)
915 return (cl);
950 ifq->ifcq_disc_slots[i].cl, m, m_pftag(m)));
1077 ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl = cl0;
1080 ifq->ifcq_disc_slots[SCIDX_BK].cl = cl1;
1083 ifq->ifcq_disc_slots[SCIDX_BE].cl = cl2;
1086 ifq->ifcq_disc_slots[SCIDX_RD].cl = cl3;
1089 ifq->ifcq_disc_slots[SCIDX_OAM].cl = cl4;
1092 ifq->ifcq_disc_slots[SCIDX_AV].cl = cl5;
1095 ifq->ifcq_disc_slots[SCIDX_RV].cl = cl6;
1098 ifq->ifcq_disc_slots[SCIDX_VI].cl = cl7;
1101 ifq->ifcq_disc_slots[SCIDX_VO].cl = cl8;
1104 ifq->ifcq_disc_slots[SCIDX_CTL].cl = cl9;
1128 ifq->ifcq_disc_slots[i].cl = NULL;
1154 struct priq_class *cl;
1169 cl = ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl;
1173 err = priq_resumeq(pif, cl);
1177 err = priq_suspendq(pif, cl);
1196 priq_purgeq(pif, cl, 0, NULL, NULL);
1207 priq_resumeq(struct priq_if *pif, struct priq_class *cl)
1215 if (q_is_rio(&cl->cl_q))
1216 err = rio_suspendq(cl->cl_rio, &cl->cl_q, FALSE);
1220 if (q_is_red(&cl->cl_q))
1221 err = red_suspendq(cl->cl_red, &cl->cl_q, FALSE);
1225 if (q_is_blue(&cl->cl_q))
1226 err = blue_suspendq(cl->cl_blue, &cl->cl_q, FALSE);
1229 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1230 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, FALSE);
1233 qstate(&cl->cl_q) = QS_RUNNING;
1239 priq_suspendq(struct priq_if *pif, struct priq_class *cl)
1247 if (q_is_rio(&cl->cl_q))
1248 err = rio_suspendq(cl->cl_rio, &cl->cl_q, TRUE);
1252 if (q_is_red(&cl->cl_q))
1253 err = red_suspendq(cl->cl_red, &cl->cl_q, TRUE);
1257 if (q_is_blue(&cl->cl_q))
1258 err = blue_suspendq(cl->cl_blue, &cl->cl_q, TRUE);
1261 if (q_is_sfb(&cl->cl_q)) {
1262 if (cl->cl_sfb != NULL) {
1263 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, TRUE);
1265 VERIFY(cl->cl_flags & PRCF_LAZY);
1271 qstate(&cl->cl_q) = QS_SUSPENDED;