Lines Matching refs:hinfo

269 	struct hookinfo *const hinfo = NG_HOOK_PRIVATE(hook);
277 if (hinfo->q_first != hinfo->q_last) {
278 ng_car_enqueue(hinfo, item);
305 ++hinfo->stats.dropped_pkts; \
311 if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
319 if ((hinfo->conf.opt & NG_CAR_COLOR_AWARE) && (colp != NULL))
325 if (hinfo->tc - len >= 0 && col <= QOS_COLOR_GREEN) {
327 ++hinfo->stats.green_pkts;
328 hinfo->tc -= len;
330 hinfo->conf.green_action,
334 ng_car_refillhook(hinfo);
337 if (hinfo->tc - len >= 0 && col <= QOS_COLOR_GREEN) {
339 ++hinfo->stats.green_pkts;
340 hinfo->tc -= len;
342 hinfo->conf.green_action,
346 } else if (hinfo->conf.mode == NG_CAR_SHAPE) {
347 ng_car_enqueue(hinfo, item);
351 } else if (hinfo->conf.mode == NG_CAR_RED) {
353 if (len - (hinfo->tc - len) > hinfo->conf.ebs ||
356 ++hinfo->stats.red_pkts;
357 hinfo->te = 0;
359 hinfo->conf.red_action,
364 } else if (hinfo->te + (len - hinfo->tc) < hinfo->conf.ebs &&
367 ++hinfo->stats.yellow_pkts;
368 hinfo->te += len - hinfo->tc;
370 hinfo->tc -= len;
372 hinfo->conf.yellow_action,
376 ++hinfo->stats.red_pkts;
377 hinfo->te = 0;
379 hinfo->conf.red_action,
385 if (hinfo->te - len >= 0 && col <= QOS_COLOR_YELLOW) {
387 ++hinfo->stats.yellow_pkts;
388 hinfo->te -= len;
390 hinfo->conf.yellow_action,
394 ++hinfo->stats.red_pkts;
396 hinfo->conf.red_action,
404 NG_FWD_ITEM_HOOK(error, item, hinfo->dest);
406 ++hinfo->stats.errors;
407 ++hinfo->stats.passed_pkts;
592 struct hookinfo *const hinfo = NG_HOOK_PRIVATE(hook);
596 if (hinfo) {
598 while (hinfo->q_first != hinfo->q_last) {
599 NG_FREE_M(hinfo->q[hinfo->q_first]);
600 hinfo->q_first++;
601 if (hinfo->q_first >= NG_CAR_QUEUE_SIZE)
602 hinfo->q_first = 0;
605 if (hinfo->hook == priv->upper.hook)
609 hinfo->hook = NULL;
688 ng_car_schedule(struct hookinfo *hinfo)
692 delay = (-(hinfo->tc)) * hz * 8 / hinfo->conf.cir + 1;
694 ng_callout(&hinfo->q_callout, NG_HOOK_NODE(hinfo->hook), hinfo->hook,
704 struct hookinfo *hinfo = NG_HOOK_PRIVATE(hook);
709 ng_car_refillhook(hinfo);
712 while (hinfo->tc >= 0) {
714 m = hinfo->q[hinfo->q_first];
715 NG_SEND_DATA_ONLY(error, hinfo->dest, m);
717 ++hinfo->stats.errors;
718 ++hinfo->stats.passed_pkts;
721 hinfo->q_first++;
722 if (hinfo->q_first >= NG_CAR_QUEUE_SIZE)
723 hinfo->q_first = 0;
726 if (hinfo->q_first == hinfo->q_last)
730 m = hinfo->q[hinfo->q_first];
731 if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
732 hinfo->tc -= 128;
734 hinfo->tc -= m->m_pkthdr.len;
739 if (hinfo->q_first != hinfo->q_last)
741 ng_car_schedule(hinfo);
748 ng_car_enqueue(struct hookinfo *hinfo, item_p item)
760 if ((hinfo->conf.opt & NG_CAR_COLOR_AWARE) && (colp != NULL))
766 mtx_lock(&hinfo->q_mtx);
769 len = hinfo->q_last - hinfo->q_first;
775 (hinfo->te + len >= NG_CAR_QUEUE_SIZE) ||
778 ++hinfo->stats.red_pkts;
779 ++hinfo->stats.dropped_pkts;
782 hinfo->te = 0;
785 ++hinfo->stats.yellow_pkts;
788 hinfo->q[hinfo->q_last] = m;
789 hinfo->q_last++;
790 if (hinfo->q_last >= NG_CAR_QUEUE_SIZE)
791 hinfo->q_last = 0;
795 hinfo->te += len - NG_CAR_QUEUE_MIN_TH;
799 if (hinfo->conf.opt & NG_CAR_COUNT_PACKETS) {
800 hinfo->tc -= 128;
802 hinfo->tc -= m->m_pkthdr.len;
806 ng_car_schedule(hinfo);
811 mtx_unlock(&hinfo->q_mtx);