Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/pfctl/pfctl_altq.c
Show First 20 Lines • Show All 423 Lines • ▼ Show 20 Lines | if (parent == NULL) { | ||||
pa->parent, pa->qname); | pa->parent, pa->qname); | ||||
return (1); | return (1); | ||||
} | } | ||||
pa->parent_qid = parent->pa.qid; | pa->parent_qid = parent->pa.qid; | ||||
} | } | ||||
if (pa->qlimit == 0) | if (pa->qlimit == 0) | ||||
pa->qlimit = DEFAULT_QLIMIT; | pa->qlimit = DEFAULT_QLIMIT; | ||||
if (eval_queue_opts(pa, opts, | |||||
parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth)) | |||||
return (1); | |||||
if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC || | if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC || | ||||
pa->scheduler == ALTQT_FAIRQ) { | pa->scheduler == ALTQT_FAIRQ) { | ||||
pa->bandwidth = eval_bwspec(bw, | pa->bandwidth = eval_bwspec(bw, | ||||
parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth); | parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth); | ||||
/* | |||||
* For HFSC, if the linkshare service curve m2 parameter is | |||||
* set, it overrides the provided queue bandwidth parameter, | |||||
* so adjust the queue bandwidth parameter accordingly here | |||||
* to avoid false positives in the total child bandwidth | |||||
* check below. | |||||
*/ | |||||
if ((pa->scheduler == ALTQT_HFSC) && | |||||
(pa->pq_u.hfsc_opts.lssc_m2 != 0)) { | |||||
pa->bandwidth = pa->pq_u.hfsc_opts.lssc_m2; | |||||
} | |||||
if (pa->bandwidth > pa->ifbandwidth) { | if (pa->bandwidth > pa->ifbandwidth) { | ||||
fprintf(stderr, "bandwidth for %s higher than " | fprintf(stderr, "bandwidth for %s higher than " | ||||
"interface\n", pa->qname); | "interface\n", pa->qname); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* check the sum of the child bandwidth is under parent's */ | /* | ||||
if (parent != NULL) { | * If not HFSC, then check that the sum of the child | ||||
* bandwidths is less than the parent's bandwidth. For | |||||
* HFSC, the equivalent concept is to check that the sum of | |||||
* the child linkshare service curves are under the parent's | |||||
* linkshare service curve, and that check is performed by | |||||
* eval_pfqueue_hfsc(). | |||||
*/ | |||||
if ((parent != NULL) && (pa->scheduler != ALTQT_HFSC)) { | |||||
if (pa->bandwidth > parent->pa.bandwidth) { | if (pa->bandwidth > parent->pa.bandwidth) { | ||||
warnx("bandwidth for %s higher than parent", | warnx("bandwidth for %s higher than parent", | ||||
pa->qname); | pa->qname); | ||||
return (1); | return (1); | ||||
} | } | ||||
parent->meta.bwsum += pa->bandwidth; | parent->meta.bwsum += pa->bandwidth; | ||||
if (parent->meta.bwsum > parent->pa.bandwidth) { | if (parent->meta.bwsum > parent->pa.bandwidth) { | ||||
warnx("the sum of the child bandwidth (%" PRIu64 | warnx("the sum of the child bandwidth (%" PRIu64 | ||||
") higher than parent \"%s\" (%" PRIu64 ")", | ") higher than parent \"%s\" (%" PRIu64 ")", | ||||
parent->meta.bwsum, parent->pa.qname, | parent->meta.bwsum, parent->pa.qname, | ||||
parent->pa.bandwidth); | parent->pa.bandwidth); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (eval_queue_opts(pa, opts, | |||||
parent == NULL ? pa->ifbandwidth : parent->pa.bandwidth)) | |||||
return (1); | |||||
if (parent != NULL) | if (parent != NULL) | ||||
parent->meta.children++; | parent->meta.children++; | ||||
switch (pa->scheduler) { | switch (pa->scheduler) { | ||||
case ALTQT_CBQ: | case ALTQT_CBQ: | ||||
error = eval_pfqueue_cbq(pf, pa, if_ppa); | error = eval_pfqueue_cbq(pf, pa, if_ppa); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |