• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/xnu-2782.1.97/bsd/net/pktsched/

Lines Matching +defs:cl +defs:next

302 	struct qfq_class *cl;
309 if ((cl = qif->qif_class_tbl[i]) != NULL)
310 qfq_class_destroy(qif, cl);
319 struct qfq_class *cl;
325 if ((cl = qif->qif_class_tbl[i]) != NULL)
326 qfq_purgeq(qif, cl, 0, NULL, NULL);
354 qfq_purgeq(qif, ifq->ifcq_disc_slots[i].cl,
363 qfq_purgeq(qif, ifq->ifcq_disc_slots[i].cl,
374 struct qfq_class *cl;
380 if ((cl = qif->qif_class_tbl[i]) != NULL)
381 qfq_updateq(qif, cl, ev);
388 struct qfq_class *cl;
407 cl = qfq_class_create(qif, weight, qlimit, flags, maxsz, qid);
408 if (cl == NULL)
412 *clp = cl;
424 struct qfq_class *cl;
479 cl = zalloc(qfq_cl_zone);
480 if (cl == NULL)
483 bzero(cl, qfq_cl_size);
490 _qinit(&cl->cl_q, Q_DROPTAIL, qlimit);
491 cl->cl_qif = qif;
492 cl->cl_flags = flags;
493 cl->cl_handle = qid;
502 qif->qif_class_tbl[i] = cl;
506 qif->qif_class_tbl[i] = cl;
511 zfree(qfq_cl_zone, cl);
518 cl->cl_lmax = maxsz;
519 cl->cl_inv_w = (QFQ_ONE_FP / w);
520 w = (QFQ_ONE_FP / cl->cl_inv_w);
523 i = qfq_calc_index(cl, cl->cl_inv_w, cl->cl_lmax);
542 cl->cl_handle);
548 zfree(qfq_cl_zone, cl);
554 cl->cl_grp = grp;
556 /* XXX cl->cl_S = qif->qif_V; ? */
562 qif->qif_default = cl;
570 cl->cl_qflags = 0;
573 cl->cl_qflags |= BLUEF_ECN;
575 cl->cl_qflags |= SFBF_ECN;
577 cl->cl_qflags |= REDF_ECN;
579 cl->cl_qflags |= RIOF_ECN;
583 cl->cl_qflags |= SFBF_FLOWCTL;
587 cl->cl_qflags |= SFBF_DELAYBASED;
591 cl->cl_qflags |= RIOF_CLEARDSCP;
607 cl->cl_red = red_alloc(ifp, 0, 0,
608 qlimit(&cl->cl_q) * 10/100,
609 qlimit(&cl->cl_q) * 30/100,
610 cl->cl_qflags, pkttime);
611 if (cl->cl_red != NULL)
612 qtype(&cl->cl_q) = Q_RED;
617 cl->cl_rio =
618 rio_alloc(ifp, 0, NULL, cl->cl_qflags, pkttime);
619 if (cl->cl_rio != NULL)
620 qtype(&cl->cl_q) = Q_RIO;
626 cl->cl_blue = blue_alloc(ifp, 0, 0, cl->cl_qflags);
627 if (cl->cl_blue != NULL)
628 qtype(&cl->cl_q) = Q_BLUE;
632 if (!(cl->cl_flags & QFCF_LAZY))
633 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
634 qlimit(&cl->cl_q), cl->cl_qflags);
635 if (cl->cl_sfb != NULL || (cl->cl_flags & QFCF_LAZY))
636 qtype(&cl->cl_q) = Q_SFB;
643 cl->cl_handle, cl->cl_grp->qfg_index, weight, qlimit,
647 return (cl);
653 struct qfq_class *cl;
657 if ((cl = qfq_clh_to_clp(qif, qid)) == NULL)
660 return (qfq_class_destroy(qif, cl));
664 qfq_class_destroy(struct qfq_if *qif, struct qfq_class *cl)
671 qfq_purgeq(qif, cl, 0, NULL, NULL);
673 if (cl->cl_inv_w != 0) {
674 qif->qif_wsum -= (QFQ_ONE_FP / cl->cl_inv_w);
675 cl->cl_inv_w = 0; /* reset weight to avoid run twice */
679 if (qif->qif_class_tbl[i] == cl) {
686 if (cl->cl_qalg.ptr != NULL) {
688 if (q_is_rio(&cl->cl_q))
689 rio_destroy(cl->cl_rio);
692 if (q_is_red(&cl->cl_q))
693 red_destroy(cl->cl_red);
696 if (q_is_blue(&cl->cl_q))
697 blue_destroy(cl->cl_blue);
699 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
700 sfb_destroy(cl->cl_sfb);
701 cl->cl_qalg.ptr = NULL;
702 qtype(&cl->cl_q) = Q_DROPTAIL;
703 qstate(&cl->cl_q) = QS_RUNNING;
706 if (qif->qif_default == cl)
711 if_name(QFQIF_IFP(qif)), qfq_style(qif), cl->cl_handle);
714 zfree(qfq_cl_zone, cl);
740 struct qfq_group *next;
743 next = qfq_ffs(qif, mask);
744 if (qfq_gt(grp->qfg_F, next->qfg_F))
768 struct qfq_group *next;
771 next = qfq_ffs(qif, mask);
772 if (!qfq_gt(next->qfg_F, old_finish))
808 * roundedS is always cl->qfg_S rounded on grp->qfg_slot_shift bits.
812 struct qfq_class *cl, u_int64_t roundedS)
817 cl->cl_next = grp->qfg_slots[i];
818 grp->qfg_slots[i] = cl;
904 struct qfq_class *cl)
907 cl->cl_S = cl->cl_F;
908 if (qempty(&cl->cl_q)) {
914 len = m_pktlen(qhead(&cl->cl_q));
915 cl->cl_F = cl->cl_S + (u_int64_t)len * cl->cl_inv_w;
916 roundedS = qfq_round_down(cl->cl_S, grp->qfg_slot_shift);
921 qfq_slot_insert(qif, grp, cl, roundedS);
927 * note: CLASSQDQ_POLL returns the next packet without removing the packet
938 struct qfq_class *cl;
965 cl = grp->qfg_slots[grp->qfg_front];
966 VERIFY(cl != NULL && !qempty(&cl->cl_q));
969 return (qfq_pollq(cl));
971 m = qfq_getq(cl);
980 if (qempty(&cl->cl_q))
981 cl->cl_period++;
982 PKTCNTR_ADD(&cl->cl_xmitcnt, 1, len);
991 cl->cl_handle, (uint64_t)VM_KERNEL_ADDRPERM(m), cl->cl_F,
995 if (qfq_update_class(qif, grp, cl)) {
998 cl = qfq_slot_scan(qif, grp);
999 if (!cl) { /* group gone, remove from ER */
1004 qfq_round_down(cl->cl_S, grp->qfg_slot_shift);
1046 qfq_update_start(struct qfq_if *qif, struct qfq_class *cl)
1050 int slot_shift = cl->cl_grp->qfg_slot_shift;
1052 roundedF = qfq_round_down(cl->cl_F, slot_shift);
1055 if (!qfq_gt(cl->cl_F, qif->qif_V) || qfq_gt(roundedF, limit)) {
1057 mask = mask_from(qif->qif_bitmaps[ER], cl->cl_grp->qfg_index);
1059 struct qfq_group *next = qfq_ffs(qif, mask);
1060 if (qfq_gt(roundedF, next->qfg_F)) {
1061 cl->cl_S = next->qfg_F;
1065 cl->cl_S = qif->qif_V;
1067 cl->cl_S = cl->cl_F;
1072 qfq_enqueue(struct qfq_if *qif, struct qfq_class *cl, struct mbuf *m,
1081 VERIFY(cl == NULL || cl->cl_qif == qif);
1083 if (cl == NULL) {
1085 cl = qfq_clh_to_clp(qif, t->pftag_qid);
1087 cl = qfq_clh_to_clp(qif, 0);
1089 if (cl == NULL) {
1090 cl = qif->qif_default;
1091 if (cl == NULL) {
1101 ret = qfq_addq(cl, m, t);
1111 PKTCNTR_ADD(&cl->cl_dropcnt, 1, len);
1131 if (qlen(&cl->cl_q) > 1)
1135 grp = cl->cl_grp;
1136 qfq_update_start(qif, cl); /* adjust start time */
1139 cl->cl_F = cl->cl_S + (u_int64_t)len * cl->cl_inv_w;
1140 roundedS = qfq_round_down(cl->cl_S, grp->qfg_slot_shift);
1143 * Insert cl in the correct bucket.
1145 * If cl->cl_S >= grp->qfg_S we don't need to adjust the bucket list
1152 if (!qfq_gt(grp->qfg_S, cl->cl_S))
1155 /* create a slot for this cl->cl_S */
1174 qfq_style(qif), cl->cl_handle,
1176 qif->qif_bitmaps[s], cl->cl_S, cl->cl_F, qif->qif_V);
1180 qfq_slot_insert(qif, grp, cl, roundedS);
1189 struct qfq_class *cl)
1196 roundedS = qfq_round_down(cl->cl_S, grp->qfg_slot_shift);
1201 while (*pprev && *pprev != cl)
1204 *pprev = cl->cl_next;
1218 qfq_deactivate_class(struct qfq_if *qif, struct qfq_class *cl)
1220 struct qfq_group *grp = cl->cl_grp;
1229 if_name(QFQIF_IFP(cl->cl_qif)), qfq_style(cl->cl_qif),
1230 cl->cl_handle, grp->qfg_index, grp->qfg_full_slots,
1239 cl->cl_F = cl->cl_S; /* not needed if the class goes away */
1240 qfq_slot_remove(qif, grp, cl);
1265 cl = qfq_slot_scan(qif, grp);
1266 roundedS = qfq_round_down(cl->cl_S, grp->qfg_slot_shift);
1312 qfq_addq(struct qfq_class *cl, struct mbuf *m, struct pf_mtag *t)
1314 struct qfq_if *qif = cl->cl_qif;
1320 if (q_is_rio(&cl->cl_q))
1321 return (rio_addq(cl->cl_rio, &cl->cl_q, m, t));
1325 if (q_is_red(&cl->cl_q))
1326 return (red_addq(cl->cl_red, &cl->cl_q, m, t));
1330 if (q_is_blue(&cl->cl_q))
1331 return (blue_addq(cl->cl_blue, &cl->cl_q, m, t));
1334 if (q_is_sfb(&cl->cl_q)) {
1335 if (cl->cl_sfb == NULL) {
1338 VERIFY(cl->cl_flags & QFCF_LAZY);
1339 cl->cl_flags &= ~QFCF_LAZY;
1342 cl->cl_sfb = sfb_alloc(ifp, cl->cl_handle,
1343 qlimit(&cl->cl_q), cl->cl_qflags);
1344 if (cl->cl_sfb == NULL) {
1346 qtype(&cl->cl_q) = Q_DROPTAIL;
1347 cl->cl_flags &= ~QFCF_SFB;
1348 cl->cl_qflags &= ~(SFBF_ECN | SFBF_FLOWCTL);
1353 qfq_style(qif), cl->cl_handle,
1354 cl->cl_grp->qfg_index);
1368 if (cl->cl_sfb != NULL)
1369 return (sfb_addq(cl->cl_sfb, &cl->cl_q, m, t));
1370 } else if (qlen(&cl->cl_q) >= qlimit(&cl->cl_q)) {
1377 if (cl->cl_flags & QFCF_CLEARDSCP)
1381 _addq(&cl->cl_q, m);
1387 qfq_getq(struct qfq_class *cl)
1389 IFCQ_LOCK_ASSERT_HELD(cl->cl_qif->qif_ifq);
1392 if (q_is_rio(&cl->cl_q))
1393 return (rio_getq(cl->cl_rio, &cl->cl_q));
1397 if (q_is_red(&cl->cl_q))
1398 return (red_getq(cl->cl_red, &cl->cl_q));
1402 if (q_is_blue(&cl->cl_q))
1403 return (blue_getq(cl->cl_blue, &cl->cl_q));
1406 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1407 return (sfb_getq(cl->cl_sfb, &cl->cl_q));
1409 return (_getq(&cl->cl_q));
1413 qfq_pollq(struct qfq_class *cl)
1415 IFCQ_LOCK_ASSERT_HELD(cl->cl_qif->qif_ifq);
1417 return (qhead(&cl->cl_q));
1421 qfq_purgeq(struct qfq_if *qif, struct qfq_class *cl, u_int32_t flow,
1429 if ((qlen = qlen(&cl->cl_q)) == 0)
1436 if (q_is_rio(&cl->cl_q))
1437 rio_purgeq(cl->cl_rio, &cl->cl_q, flow, &cnt, &len);
1441 if (q_is_red(&cl->cl_q))
1442 red_purgeq(cl->cl_red, &cl->cl_q, flow, &cnt, &len);
1446 if (q_is_blue(&cl->cl_q))
1447 blue_purgeq(cl->cl_blue, &cl->cl_q, flow, &cnt, &len);
1450 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1451 sfb_purgeq(cl->cl_sfb, &cl->cl_q, flow, &cnt, &len);
1453 _flushq_flow(&cl->cl_q, flow, &cnt, &len);
1456 VERIFY(qlen(&cl->cl_q) == (qlen - cnt));
1462 PKTCNTR_ADD(&cl->cl_dropcnt, cnt, len);
1468 if (qempty(&cl->cl_q))
1469 qfq_deactivate_class(qif, cl);
1475 qfq_style(qif), cl->cl_handle,
1476 (u_int32_t)(QFQ_ONE_FP / cl->cl_inv_w), qlen,
1477 qlen(&cl->cl_q), cnt, len, flow);
1488 qfq_updateq(struct qfq_if *qif, struct qfq_class *cl, cqev_t ev)
1495 cl->cl_handle, (u_int32_t)(QFQ_ONE_FP / cl->cl_inv_w),
1500 if (q_is_rio(&cl->cl_q))
1501 return (rio_updateq(cl->cl_rio, ev));
1504 if (q_is_red(&cl->cl_q))
1505 return (red_updateq(cl->cl_red, ev));
1508 if (q_is_blue(&cl->cl_q))
1509 return (blue_updateq(cl->cl_blue, ev));
1511 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1512 return (sfb_updateq(cl->cl_sfb, ev));
1519 struct qfq_class *cl;
1523 if ((cl = qfq_clh_to_clp(qif, qid)) == NULL)
1526 sp->class_handle = cl->cl_handle;
1527 sp->index = cl->cl_grp->qfg_index;
1528 sp->weight = (QFQ_ONE_FP / cl->cl_inv_w);
1529 sp->lmax = cl->cl_lmax;
1530 sp->qlength = qlen(&cl->cl_q);
1531 sp->qlimit = qlimit(&cl->cl_q);
1532 sp->period = cl->cl_period;
1533 sp->xmitcnt = cl->cl_xmitcnt;
1534 sp->dropcnt = cl->cl_dropcnt;
1536 sp->qtype = qtype(&cl->cl_q);
1537 sp->qstate = qstate(&cl->cl_q);
1539 if (q_is_red(&cl->cl_q))
1540 red_getstats(cl->cl_red, &sp->red[0]);
1543 if (q_is_rio(&cl->cl_q))
1544 rio_getstats(cl->cl_rio, &sp->red[0]);
1547 if (q_is_blue(&cl->cl_q))
1548 blue_getstats(cl->cl_blue, &sp->blue);
1550 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
1551 sfb_getstats(cl->cl_sfb, &sp->sfb);
1560 struct qfq_class *cl;
1570 cl = ifq->ifcq_disc_slots[i].cl;
1571 sr->packets = qlen(&cl->cl_q);
1572 sr->bytes = qsize(&cl->cl_q);
1581 struct qfq_class *cl;
1591 if ((cl = qif->qif_class_tbl[i]) != NULL && cl->cl_handle == chandle)
1592 return (cl);
1594 if ((cl = qif->qif_class_tbl[i]) != NULL &&
1595 cl->cl_handle == chandle)
1596 return (cl);
1643 qfq_calc_index(struct qfq_class *cl, u_int32_t inv_w, u_int32_t maxlen)
1661 if_name(QFQIF_IFP(cl->cl_qif)), qfq_style(cl->cl_qif),
1662 cl->cl_handle, index, (u_int32_t)(QFQ_ONE_FP/inv_w),
1746 ifq->ifcq_disc_slots[i].cl, m, m_pftag(m)));
1753 * note: CLASSQDQ_POLL returns the next packet without removing the packet
1878 ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl = cl0;
1881 ifq->ifcq_disc_slots[SCIDX_BK].cl = cl1;
1884 ifq->ifcq_disc_slots[SCIDX_BE].cl = cl2;
1887 ifq->ifcq_disc_slots[SCIDX_RD].cl = cl3;
1890 ifq->ifcq_disc_slots[SCIDX_OAM].cl = cl4;
1893 ifq->ifcq_disc_slots[SCIDX_AV].cl = cl5;
1896 ifq->ifcq_disc_slots[SCIDX_RV].cl = cl6;
1899 ifq->ifcq_disc_slots[SCIDX_VI].cl = cl7;
1902 ifq->ifcq_disc_slots[SCIDX_VO].cl = cl8;
1905 ifq->ifcq_disc_slots[SCIDX_CTL].cl = cl9;
1929 ifq->ifcq_disc_slots[i].cl = NULL;
1955 struct qfq_class *cl;
1970 cl = ifq->ifcq_disc_slots[SCIDX_BK_SYS].cl;
1974 err = qfq_resumeq(qif, cl);
1978 err = qfq_suspendq(qif, cl);
1997 qfq_purgeq(qif, cl, 0, NULL, NULL);
2008 qfq_resumeq(struct qfq_if *qif, struct qfq_class *cl)
2016 if (q_is_rio(&cl->cl_q))
2017 err = rio_suspendq(cl->cl_rio, &cl->cl_q, FALSE);
2021 if (q_is_red(&cl->cl_q))
2022 err = red_suspendq(cl->cl_red, &cl->cl_q, FALSE);
2026 if (q_is_blue(&cl->cl_q))
2027 err = blue_suspendq(cl->cl_blue, &cl->cl_q, FALSE);
2030 if (q_is_sfb(&cl->cl_q) && cl->cl_sfb != NULL)
2031 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, FALSE);
2034 qstate(&cl->cl_q) = QS_RUNNING;
2040 qfq_suspendq(struct qfq_if *qif, struct qfq_class *cl)
2048 if (q_is_rio(&cl->cl_q))
2049 err = rio_suspendq(cl->cl_rio, &cl->cl_q, TRUE);
2053 if (q_is_red(&cl->cl_q))
2054 err = red_suspendq(cl->cl_red, &cl->cl_q, TRUE);
2058 if (q_is_blue(&cl->cl_q))
2059 err = blue_suspendq(cl->cl_blue, &cl->cl_q, TRUE);
2062 if (q_is_sfb(&cl->cl_q)) {
2063 if (cl->cl_sfb != NULL) {
2064 err = sfb_suspendq(cl->cl_sfb, &cl->cl_q, TRUE);
2066 VERIFY(cl->cl_flags & QFCF_LAZY);
2072 qstate(&cl->cl_q) = QS_SUSPENDED;