Lines Matching defs:hif

358 hfsc_grow_class_tbl(struct hfsc_if *hif, u_int howmany)
361 size_t oldlen = sizeof(void *) * hif->hif_allocated;
365 old = hif->hif_class_tbl;
368 hif->hif_class_tbl = newtbl;
369 hif->hif_allocated = howmany;
386 struct hfsc_if *hif;
390 hif = malloc(sizeof(*hif), M_DEVBUF, M_WAITOK | M_ZERO);
391 TAILQ_INIT(&hif->hif_eligible);
392 hif->hif_class_tbl = mallocarray(HFSC_DEFAULT_CLASSES, sizeof(void *),
394 hif->hif_allocated = HFSC_DEFAULT_CLASSES;
396 timeout_set(&hif->hif_defer, hfsc_deferred, ifp);
398 return (hif);
404 struct hfsc_if *hif = arg;
409 KASSERT(hif != NULL);
417 if (q->parent_qid == 0 && hif->hif_rootclass == NULL) {
418 np = hfsc_class_create(hif, NULL, NULL, NULL, NULL,
423 } else if ((parent = hfsc_clh2cph(hif, q->parent_qid)) == NULL)
426 if (hfsc_clh2cph(hif, q->qid) != NULL) {
427 hfsc_class_destroy(hif, np);
441 if ((cl = hfsc_class_create(hif, &rtsc, &lssc, &ulsc,
443 hfsc_class_destroy(hif, np);
457 hfsc_class_destroy(hif, cl);
458 hfsc_class_destroy(hif, np);
465 hfsc_class_destroy(hif, cl);
466 hfsc_class_destroy(hif, np);
481 struct hfsc_if *hif;
492 hif = ifq_q_enter(&ifp->if_snd, ifq_hfsc_ops);
493 if (hif == NULL)
496 if ((cl = hfsc_clh2cph(hif, q->qid)) == NULL) {
497 ifq_q_leave(&ifp->if_snd, hif);
502 ifq_q_leave(&ifp->if_snd, hif);
576 struct hfsc_if *hif = q;
579 KASSERT(hif != NULL);
580 return (hif);
586 struct hfsc_if *hif = q;
593 timeout_del(&hif->hif_defer);
597 for (i = 0; i < hif->hif_allocated; i++) {
598 cl = hif->hif_class_tbl[i];
599 if (hfsc_class_destroy(hif, cl) == EBUSY)
604 free(hif->hif_class_tbl, M_DEVBUF, hif->hif_allocated * sizeof(void *));
605 free(hif, M_DEVBUF, sizeof(*hif));
611 struct hfsc_if *hif = ifq->ifq_q;
614 for (cl = hif->hif_rootclass; cl != NULL; cl = hfsc_nextclass(cl))
615 hfsc_cl_purge(hif, cl, ml);
619 hfsc_class_create(struct hfsc_if *hif, struct hfsc_sc *rsc,
629 if (hif->hif_classes >= hif->hif_allocated) {
630 u_int newslots = hfsc_more_slots(hif->hif_allocated);
632 if (newslots == hif->hif_allocated)
634 hfsc_grow_class_tbl(hif, newslots);
661 cl->cl_id = hif->hif_classid++;
666 hif->hif_classes++;
673 i = qid % hif->hif_allocated;
674 if (hif->hif_class_tbl[i] == NULL)
675 hif->hif_class_tbl[i] = cl;
677 for (i = 0; i < hif->hif_allocated; i++)
678 if (hif->hif_class_tbl[i] == NULL) {
679 hif->hif_class_tbl[i] = cl;
682 if (i == hif->hif_allocated) {
689 hif->hif_defaultclass = cl;
692 hif->hif_rootclass = cl;
719 hfsc_class_destroy(struct hfsc_if *hif, struct hfsc_class *cl)
745 for (i = 0; i < hif->hif_allocated; i++)
746 if (hif->hif_class_tbl[i] == cl) {
747 hif->hif_class_tbl[i] = NULL;
751 hif->hif_classes--;
756 if (cl == hif->hif_rootclass)
757 hif->hif_rootclass = NULL;
758 if (cl == hif->hif_defaultclass)
759 hif->hif_defaultclass = NULL;
779 * for (cl = hif->hif_rootclass; cl != NULL; cl = hfsc_nextclass(cl))
803 struct hfsc_if *hif = ifq->ifq_q;
807 if ((cl = hfsc_clh2cph(hif, m->m_pkthdr.pf.qid)) == NULL ||
809 cl = hif->hif_defaultclass;
818 hfsc_set_active(hif, cl, m->m_pkthdr.len);
819 if (!timeout_pending(&hif->hif_defer))
820 timeout_add(&hif->hif_defer, 1);
834 struct hfsc_if *hif = ifq->ifq_q;
846 cl = hfsc_ellist_get_mindl(hif, cur_time);
853 tcl = hif->hif_rootclass;
877 hfsc_update_sc(hif, cl, 0);
881 hif->hif_microtime = cur_time;
889 struct hfsc_if *hif = ifq->ifq_q;
893 hfsc_update_sc(hif, cl, m->m_pkthdr.len);
899 hfsc_update_sc(struct hfsc_if *hif, struct hfsc_class *cl, int len)
902 u_int64_t cur_time = hif->hif_microtime;
927 hfsc_update_ed(hif, cl, next_len);
933 hfsc_set_passive(hif, cl);
942 struct hfsc_if *hif;
950 hif = ifq_q_enter(&ifp->if_snd, ifq_hfsc_ops);
951 if (hif == NULL)
954 timeout_add(&hif->hif_defer, 1);
955 ifq_q_leave(&ifp->if_snd, hif);
959 hfsc_cl_purge(struct hfsc_if *hif, struct hfsc_class *cl, struct mbuf_list *ml)
970 hfsc_set_passive(hif, cl);
974 hfsc_set_active(struct hfsc_if *hif, struct hfsc_class *cl, int len)
977 hfsc_init_ed(hif, cl, len);
985 hfsc_set_passive(struct hfsc_if *hif, struct hfsc_class *cl)
988 hfsc_ellist_remove(hif, cl);
997 hfsc_init_ed(struct hfsc_if *hif, struct hfsc_class *cl, int next_len)
1021 hfsc_ellist_insert(hif, cl);
1025 hfsc_update_ed(struct hfsc_if *hif, struct hfsc_class *cl, int next_len)
1030 hfsc_ellist_update(hif, cl);
1243 hfsc_ellist_insert(struct hfsc_if *hif, struct hfsc_class *cl)
1248 if ((p = TAILQ_LAST(&hif->hif_eligible, hfsc_eligible)) == NULL ||
1250 TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist);
1254 TAILQ_FOREACH(p, &hif->hif_eligible, cl_ellist) {
1263 hfsc_ellist_remove(struct hfsc_if *hif, struct hfsc_class *cl)
1265 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1269 hfsc_ellist_update(struct hfsc_if *hif, struct hfsc_class *cl)
1282 last = TAILQ_LAST(&hif->hif_eligible, hfsc_eligible);
1284 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1285 TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist);
1295 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1304 hfsc_ellist_get_mindl(struct hfsc_if *hif, u_int64_t cur_time)
1308 TAILQ_FOREACH(p, &hif->hif_eligible, cl_ellist) {
1709 hfsc_clh2cph(struct hfsc_if *hif, u_int32_t chandle)
1720 i = chandle % hif->hif_allocated;
1721 if ((cl = hif->hif_class_tbl[i]) != NULL && cl->cl_handle == chandle)
1723 for (i = 0; i < hif->hif_allocated; i++)
1724 if ((cl = hif->hif_class_tbl[i]) != NULL &&