Lines Matching refs:tif

117 	struct tcq_if	*tif;
119 tif = (how == M_WAITOK) ? zalloc(tcq_zone) : zalloc_noblock(tcq_zone);
120 if (tif == NULL)
123 bzero(tif, tcq_size);
124 tif->tif_maxpri = -1;
125 tif->tif_ifq = &ifp->if_snd;
127 tif->tif_flags |= TCQIFF_ALTQ;
131 if_name(ifp), tcq_style(tif));
134 return (tif);
138 tcq_destroy(struct tcq_if *tif)
140 struct ifclassq *ifq = tif->tif_ifq;
144 err = tcq_destroy_locked(tif);
151 tcq_destroy_locked(struct tcq_if *tif)
153 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
155 (void) tcq_clear_interface(tif);
159 if_name(TCQIF_IFP(tif)), tcq_style(tif));
162 zfree(tcq_zone, tif);
172 tcq_clear_interface(struct tcq_if *tif)
177 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
180 for (pri = 0; pri <= tif->tif_maxpri; pri++)
181 if ((cl = tif->tif_classes[pri]) != NULL)
182 tcq_class_destroy(tif, cl);
189 tcq_purge(struct tcq_if *tif)
194 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
196 for (pri = 0; pri <= tif->tif_maxpri; pri++) {
197 if ((cl = tif->tif_classes[pri]) != NULL && !qempty(&cl->cl_q))
198 tcq_purgeq(tif, cl, 0, NULL, NULL);
207 VERIFY(IFCQ_LEN(tif->tif_ifq) == 0);
212 tcq_purge_sc(struct tcq_if *tif, cqrq_purge_sc_t *pr)
214 struct ifclassq *ifq = tif->tif_ifq;
226 tcq_purgeq(tif, ifq->ifcq_disc_slots[i].cl,
235 tcq_purgeq(tif, ifq->ifcq_disc_slots[i].cl,
244 tcq_event(struct tcq_if *tif, cqev_t ev)
249 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
251 for (pri = 0; pri <= tif->tif_maxpri; pri++)
252 if ((cl = tif->tif_classes[pri]) != NULL)
253 tcq_updateq(tif, cl, ev);
257 tcq_add_queue(struct tcq_if *tif, int priority, u_int32_t qlimit,
262 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
267 if (tif->tif_classes[priority] != NULL)
269 if (tcq_clh_to_clp(tif, qid) != NULL)
272 cl = tcq_class_create(tif, priority, qlimit, flags, qid);
283 tcq_class_create(struct tcq_if *tif, int pri, u_int32_t qlimit,
290 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
293 if (tif->tif_flags & TCQIFF_ALTQ)
299 if_name(TCQIF_IFP(tif)), tcq_style(tif));
307 if_name(TCQIF_IFP(tif)), tcq_style(tif));
315 if_name(TCQIF_IFP(tif)), tcq_style(tif));
327 if_name(TCQIF_IFP(tif)), tcq_style(tif));
331 ifq = tif->tif_ifq;
332 ifp = TCQIF_IFP(tif);
334 if ((cl = tif->tif_classes[pri]) != NULL) {
337 tcq_purgeq(tif, cl, 0, NULL, NULL);
363 tif->tif_classes[pri] = cl;
365 tif->tif_default = cl;
374 if (pri > tif->tif_maxpri)
375 tif->tif_maxpri = pri;
376 cl->cl_tif = tif;
453 "flags=%b\n", if_name(ifp), tcq_style(tif),
461 tcq_remove_queue(struct tcq_if *tif, u_int32_t qid)
465 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
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)
476 struct ifclassq *ifq = tif->tif_ifq;
482 tcq_purgeq(tif, cl, 0, NULL, NULL);
484 tif->tif_classes[cl->cl_pri] = NULL;
485 if (tif->tif_maxpri == cl->cl_pri) {
487 if (tif->tif_classes[pri] != NULL) {
488 tif->tif_maxpri = pri;
492 tif->tif_maxpri = -1;
495 if (tif->tif_default == cl)
496 tif->tif_default = NULL;
520 if_name(TCQIF_IFP(tif)), tcq_style(tif),
529 tcq_enqueue(struct tcq_if *tif, struct tcq_class *cl, struct mbuf *m,
532 struct ifclassq *ifq = tif->tif_ifq;
536 VERIFY(cl == NULL || cl->cl_tif == tif);
539 cl = tcq_clh_to_clp(tif, t->pftag_qid);
541 cl = tif->tif_default;
588 tcq_dequeue_tc(struct tcq_if *tif, mbuf_svc_class_t sc, cqdq_op_t op)
590 return (tcq_dequeue_cl(tif, NULL, sc, op));
594 tcq_dequeue_cl(struct tcq_if *tif, struct tcq_class *cl,
597 struct ifclassq *ifq = tif->tif_ifq;
603 cl = tcq_clh_to_clp(tif, MBUF_SCIDX(sc));
630 struct tcq_if *tif = cl->cl_tif;
631 struct ifclassq *ifq = tif->tif_ifq;
652 struct ifnet *ifp = TCQIF_IFP(tif);
669 tcq_style(tif), cl->cl_handle,
671 } else if (tif->tif_throttle != IFNET_THROTTLE_OFF) {
673 cqrq_throttle_t tr = { 1, tif->tif_throttle };
674 int err = tcq_throttle(tif, &tr);
680 (void) tcq_throttle(tif, &tr);
735 tcq_purgeq(struct tcq_if *tif, struct tcq_class *cl, u_int32_t flow,
738 struct ifclassq *ifq = tif->tif_ifq;
781 if_name(TCQIF_IFP(tif)), tcq_style(tif),
794 tcq_updateq(struct tcq_if *tif, struct tcq_class *cl, cqev_t ev)
796 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
800 if_name(TCQIF_IFP(tif)), tcq_style(tif),
821 tcq_get_class_stats(struct tcq_if *tif, u_int32_t qid,
826 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
828 if ((cl = tcq_clh_to_clp(tif, qid)) == NULL)
861 tcq_clh_to_clp(struct tcq_if *tif, u_int32_t chandle)
866 IFCQ_LOCK_ASSERT_HELD(tif->tif_ifq);
868 for (idx = tif->tif_maxpri; idx >= 0; idx--)
869 if ((cl = tif->tif_classes[idx]) != NULL &&
877 tcq_style(struct tcq_if *tif)
879 return ((tif->tif_flags & TCQIFF_ALTQ) ? "ALTQ_TCQ" : "TCQ");
933 struct tcq_if *tif = (struct tcq_if *)ifq->ifcq_disc;
940 tcq_purge(tif);
944 tcq_purge_sc(tif, (cqrq_purge_sc_t *)arg);
948 tcq_event(tif, (cqev_t)arg);
952 err = tcq_throttle(tif, (cqrq_throttle_t *)arg);
963 struct tcq_if *tif;
984 tif = tcq_alloc(ifp, M_WAITOK, FALSE);
985 if (tif == NULL)
991 if ((err = tcq_add_queue(tif, 0, maxlen,
995 if ((err = tcq_add_queue(tif, 1, maxlen,
999 if ((err = tcq_add_queue(tif, 2, maxlen,
1003 if ((err = tcq_add_queue(tif, 3, maxlen,
1007 err = ifclassq_attach(ifq, PKTSCHEDT_TCQ, tif,
1050 (void) tcq_destroy_locked(tif);
1058 struct tcq_if *tif = ifq->ifcq_disc;
1062 VERIFY(tif != NULL && ifq->ifcq_type == PKTSCHEDT_TCQ);
1064 (void) tcq_destroy_locked(tif);
1079 struct tcq_if *tif = ifq->ifcq_disc;
1087 return (tcq_get_class_stats(tif, ifq->ifcq_disc_slots[slot].qid,
1092 tcq_throttle(struct tcq_if *tif, cqrq_throttle_t *tr)
1094 struct ifclassq *ifq = tif->tif_ifq;
1099 VERIFY(!(tif->tif_flags & TCQIFF_ALTQ));
1102 tr->level = tif->tif_throttle;
1106 if (tr->level == tif->tif_throttle)
1114 err = tcq_resumeq(tif, cl);
1118 err = tcq_suspendq(tif, cl);
1129 if_name(TCQIF_IFP(tif)), tcq_style(tif),
1130 (err == 0) ? "" : "lazy ", tif->tif_throttle,
1133 tif->tif_throttle = tr->level;
1137 tcq_purgeq(tif, cl, 0, NULL, NULL);
1140 "%d->%d [error=%d]\n", if_name(TCQIF_IFP(tif)),
1141 tcq_style(tif), tif->tif_throttle, tr->level, err);
1148 tcq_resumeq(struct tcq_if *tif, struct tcq_class *cl)
1150 struct ifclassq *ifq = tif->tif_ifq;
1180 tcq_suspendq(struct tcq_if *tif, struct tcq_class *cl)
1182 struct ifclassq *ifq = tif->tif_ifq;