Lines Matching refs:hif

201 	struct hfsc_if *hif;
203 hif = (how == M_WAITOK) ? zalloc(hfsc_zone) : zalloc_noblock(hfsc_zone);
204 if (hif == NULL)
207 bzero(hif, hfsc_size);
208 TAILQ_INIT(&hif->hif_eligible);
209 hif->hif_ifq = &ifp->if_snd;
211 hif->hif_maxclasses = HFSC_MAX_CLASSES;
212 hif->hif_flags |= HFSCIFF_ALTQ;
214 hif->hif_maxclasses = IFCQ_SC_MAX + 1; /* incl. root class */
217 if ((hif->hif_class_tbl = _MALLOC(sizeof (struct hfsc_class *) *
218 hif->hif_maxclasses, M_DEVBUF, M_WAITOK|M_ZERO)) == NULL) {
220 if_name(ifp), hfsc_style(hif));
226 if_name(ifp), hfsc_style(hif));
229 return (hif);
232 if (hif->hif_class_tbl != NULL) {
233 _FREE(hif->hif_class_tbl, M_DEVBUF);
234 hif->hif_class_tbl = NULL;
236 zfree(hfsc_zone, hif);
242 hfsc_destroy(struct hfsc_if *hif)
244 struct ifclassq *ifq = hif->hif_ifq;
248 err = hfsc_destroy_locked(hif);
255 hfsc_destroy_locked(struct hfsc_if *hif)
257 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
259 (void) hfsc_clear_interface(hif);
260 (void) hfsc_class_destroy(hif, hif->hif_rootclass);
262 VERIFY(hif->hif_class_tbl != NULL);
263 _FREE(hif->hif_class_tbl, M_DEVBUF);
264 hif->hif_class_tbl = NULL;
268 if_name(HFSCIF_IFP(hif)), hfsc_style(hif));
271 zfree(hfsc_zone, hif);
281 hfsc_clear_interface(struct hfsc_if *hif)
285 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
288 while (hif->hif_rootclass != NULL &&
289 (cl = hif->hif_rootclass->cl_children) != NULL) {
296 (void) hfsc_class_destroy(hif, cl);
307 hfsc_purge(struct hfsc_if *hif)
311 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
313 for (cl = hif->hif_rootclass; cl != NULL; cl = hfsc_nextclass(cl)) {
315 hfsc_purgeq(hif, cl, 0, NULL, NULL);
324 VERIFY(IFCQ_LEN(hif->hif_ifq) == 0);
329 hfsc_event(struct hfsc_if *hif, cqev_t ev)
333 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
335 for (cl = hif->hif_rootclass; cl != NULL; cl = hfsc_nextclass(cl))
336 hfsc_updateq(hif, cl, ev);
340 hfsc_add_queue(struct hfsc_if *hif, struct service_curve *rtsc,
347 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
349 if (parent_qid == HFSC_NULLCLASS_HANDLE && hif->hif_rootclass == NULL)
351 else if ((parent = hfsc_clh_to_clp(hif, parent_qid)) == NULL)
354 if (hfsc_clh_to_clp(hif, qid) != NULL)
357 cl = hfsc_class_create(hif, rtsc, lssc, ulsc, parent,
369 hfsc_class_create(struct hfsc_if *hif, struct service_curve *rsc,
379 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
382 if (hif->hif_flags & HFSCIFF_ALTQ)
385 if (hif->hif_classes >= hif->hif_maxclasses) {
387 if_name(HFSCIF_IFP(hif)), hfsc_style(hif),
388 hif->hif_maxclasses);
395 if_name(HFSCIF_IFP(hif)), hfsc_style(hif));
403 if_name(HFSCIF_IFP(hif)), hfsc_style(hif));
411 if_name(HFSCIF_IFP(hif)), hfsc_style(hif));
423 if_name(HFSCIF_IFP(hif)), hfsc_style(hif));
433 ifq = hif->hif_ifq;
434 ifp = HFSCIF_IFP(hif);
524 cl->cl_id = hif->hif_classid++;
526 cl->cl_hif = hif;
529 eff_rate = ifnet_output_linkrate(HFSCIF_IFP(hif));
530 hif->hif_eff_rate = eff_rate;
566 i = qid % hif->hif_maxclasses;
567 if (hif->hif_class_tbl[i] == NULL) {
568 hif->hif_class_tbl[i] = cl;
570 for (i = 0; i < hif->hif_maxclasses; i++)
571 if (hif->hif_class_tbl[i] == NULL) {
572 hif->hif_class_tbl[i] = cl;
575 if (i == hif->hif_maxclasses) {
579 hif->hif_classes++;
582 hif->hif_defaultclass = cl;
586 hif->hif_rootclass = cl;
600 "flags=%b\n", if_name(ifp), hfsc_style(hif), cl->cl_handle,
604 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
608 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
612 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
644 hfsc_remove_queue(struct hfsc_if *hif, u_int32_t qid)
648 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
650 if ((cl = hfsc_clh_to_clp(hif, qid)) == NULL)
653 return (hfsc_class_destroy(hif, cl));
657 hfsc_class_destroy(struct hfsc_if *hif, struct hfsc_class *cl)
667 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
670 hfsc_purgeq(hif, cl, 0, NULL, NULL);
688 for (i = 0; i < hif->hif_maxclasses; i++)
689 if (hif->hif_class_tbl[i] == cl) {
690 hif->hif_class_tbl[i] = NULL;
694 hif->hif_classes--;
716 if (cl == hif->hif_rootclass)
717 hif->hif_rootclass = NULL;
718 if (cl == hif->hif_defaultclass)
719 hif->hif_defaultclass = NULL;
723 if_name(HFSCIF_IFP(hif)), hfsc_style(hif),
735 * for (cl = hif->hif_rootclass; cl != NULL; cl = hfsc_nextclass(cl))
759 hfsc_enqueue(struct hfsc_if *hif, struct hfsc_class *cl, struct mbuf *m,
762 struct ifclassq *ifq = hif->hif_ifq;
767 VERIFY(cl == NULL || cl->cl_hif == hif);
770 cl = hfsc_clh_to_clp(hif, t->pftag_qid);
772 cl = hif->hif_defaultclass;
823 hfsc_dequeue(struct hfsc_if *hif, cqdq_op_t op)
825 struct ifclassq *ifq = hif->hif_ifq;
834 if (hif->hif_packets == 0)
840 if (op == CLASSQDQ_REMOVE && hif->hif_pollcache != NULL) {
842 cl = hif->hif_pollcache;
843 hif->hif_pollcache = NULL;
853 if ((cl = ellist_get_mindl(&hif->hif_eligible, cur_time))
862 cl = hif->hif_rootclass;
870 if_name(HFSCIF_IFP(hif)),
871 hfsc_style(hif), fits);
885 hif->hif_pollcache = cl;
1017 hfsc_purgeq(struct hfsc_if *hif, struct hfsc_class *cl, u_int32_t flow,
1020 struct ifclassq *ifq = hif->hif_ifq;
1026 VERIFY(hif->hif_packets == 0);
1059 VERIFY(hif->hif_packets >= cnt);
1060 hif->hif_packets -= cnt;
1073 if_name(HFSCIF_IFP(hif)), hfsc_style(hif),
1086 hfsc_print_sc(struct hfsc_if *hif, u_int32_t qid, u_int64_t eff_rate,
1089 struct ifnet *ifp = HFSCIF_IFP(hif);
1093 if_name(ifp), hfsc_style(hif), qid,
1101 hfsc_updateq_linkrate(struct hfsc_if *hif, struct hfsc_class *cl)
1103 u_int64_t eff_rate = ifnet_output_linkrate(HFSCIF_IFP(hif));
1108 if (eff_rate == hif->hif_eff_rate)
1117 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
1126 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
1135 hfsc_print_sc(hif, cl->cl_handle, eff_rate,
1142 hfsc_updateq(struct hfsc_if *hif, struct hfsc_class *cl, cqev_t ev)
1144 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
1148 if_name(HFSCIF_IFP(hif)), hfsc_style(hif),
1153 hfsc_updateq_linkrate(hif, cl);
1454 struct hfsc_if *hif = cl->cl_hif;
1458 if ((p = TAILQ_LAST(&hif->hif_eligible, _eligible)) == NULL ||
1460 TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist);
1464 TAILQ_FOREACH(p, &hif->hif_eligible, cl_ellist) {
1476 struct hfsc_if *hif = cl->cl_hif;
1478 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1484 struct hfsc_if *hif = cl->cl_hif;
1496 last = TAILQ_LAST(&hif->hif_eligible, _eligible);
1499 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1500 TAILQ_INSERT_TAIL(&hif->hif_eligible, cl, cl_ellist);
1510 TAILQ_REMOVE(&hif->hif_eligible, cl, cl_ellist);
1729 struct hfsc_if *hif = cl->cl_hif;
1744 "using temporary rate %llu bps\n", if_name(HFSCIF_IFP(hif)),
1745 hfsc_style(hif), cl->cl_handle, cl->cl_id, eff_rate);
1896 hfsc_get_class_stats(struct hfsc_if *hif, u_int32_t qid,
1901 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
1903 if ((cl = hfsc_clh_to_clp(hif, qid)) == NULL)
1988 hfsc_clh_to_clp(struct hfsc_if *hif, u_int32_t chandle)
1993 IFCQ_LOCK_ASSERT_HELD(hif->hif_ifq);
1999 i = chandle % hif->hif_maxclasses;
2000 if ((cl = hif->hif_class_tbl[i]) != NULL && cl->cl_handle == chandle)
2002 for (i = 0; i < hif->hif_maxclasses; i++)
2003 if ((cl = hif->hif_class_tbl[i]) != NULL &&
2010 hfsc_style(struct hfsc_if *hif)
2012 return ((hif->hif_flags & HFSCIFF_ALTQ) ? "ALTQ_HFSC" : "HFSC");
2025 struct hfsc_if *hif = ifq->ifcq_disc;
2029 VERIFY(hif != NULL && ifq->ifcq_type == PKTSCHEDT_HFSC);
2031 (void) hfsc_destroy_locked(hif);
2046 struct hfsc_if *hif = ifq->ifcq_disc;
2054 return (hfsc_get_class_stats(hif, ifq->ifcq_disc_slots[slot].qid,