Commit 08fd0184 authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by Stephen Hemminger

CBQ, implement overhead parameter parsing.

For CBQ, implement overhead parameter parsing.

The change is ABI (Application Binary Interface) backward compatible
with older kernels, but will first have effect from kernel 2.6.24.
Signed-off-by: default avatarJesper Dangaard Brouer <hawk@comx.dk>
Signed-off-by: default avatarStephen Hemminger <stephen.hemminger@vyatta.com>
parent 1db5e2ec
...@@ -53,6 +53,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl ...@@ -53,6 +53,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
struct tc_cbq_lssopt lss; struct tc_cbq_lssopt lss;
__u32 rtab[256]; __u32 rtab[256];
unsigned mpu=0, avpkt=0, allot=0; unsigned mpu=0, avpkt=0, allot=0;
unsigned short overhead=0;
int cell_log=-1; int cell_log=-1;
int ewma_log=-1; int ewma_log=-1;
struct rtattr *tail; struct rtattr *tail;
...@@ -113,6 +114,11 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl ...@@ -113,6 +114,11 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
explain1("allot"); explain1("allot");
return -1; return -1;
} }
} else if (matches(*argv, "overhead") == 0) {
NEXT_ARG();
if (get_u16(&overhead, *argv, 10)) {
explain1("overhead"); return -1;
}
} else if (matches(*argv, "help") == 0) { } else if (matches(*argv, "help") == 0) {
explain(); explain();
return -1; return -1;
...@@ -138,6 +144,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl ...@@ -138,6 +144,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
allot = (avpkt*3)/2; allot = (avpkt*3)/2;
r.mpu = mpu; r.mpu = mpu;
r.overhead = overhead;
if (tc_calc_rtable(&r, rtab, cell_log, allot) < 0) { if (tc_calc_rtable(&r, rtab, cell_log, allot) < 0) {
fprintf(stderr, "CBQ: failed to calculate rate table.\n"); fprintf(stderr, "CBQ: failed to calculate rate table.\n");
return -1; return -1;
...@@ -179,6 +186,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str ...@@ -179,6 +186,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
int ewma_log=-1; int ewma_log=-1;
unsigned bndw = 0; unsigned bndw = 0;
unsigned minburst=0, maxburst=0; unsigned minburst=0, maxburst=0;
unsigned short overhead=0;
struct rtattr *tail; struct rtattr *tail;
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
...@@ -317,6 +325,11 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str ...@@ -317,6 +325,11 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
if (err == 1) if (err == 1)
fopt.defchange = ~0; fopt.defchange = ~0;
fopt_ok++; fopt_ok++;
} else if (matches(*argv, "overhead") == 0) {
NEXT_ARG();
if (get_u16(&overhead, *argv, 10)) {
explain1("overhead"); return -1;
}
} else if (matches(*argv, "help") == 0) { } else if (matches(*argv, "help") == 0) {
explain_class(); explain_class();
return -1; return -1;
...@@ -336,6 +349,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str ...@@ -336,6 +349,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
if (wrr.allot < (lss.avpkt*3)/2) if (wrr.allot < (lss.avpkt*3)/2)
wrr.allot = (lss.avpkt*3)/2; wrr.allot = (lss.avpkt*3)/2;
r.mpu = mpu; r.mpu = mpu;
r.overhead = overhead;
if (tc_calc_rtable(&r, rtab, cell_log, pktsize) < 0) { if (tc_calc_rtable(&r, rtab, cell_log, pktsize) < 0) {
fprintf(stderr, "CBQ: failed to calculate rate table.\n"); fprintf(stderr, "CBQ: failed to calculate rate table.\n");
return -1; return -1;
...@@ -464,6 +478,8 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -464,6 +478,8 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
fprintf(f, "cell %ub ", 1<<r->cell_log); fprintf(f, "cell %ub ", 1<<r->cell_log);
if (r->mpu) if (r->mpu)
fprintf(f, "mpu %ub ", r->mpu); fprintf(f, "mpu %ub ", r->mpu);
if (r->overhead)
fprintf(f, "overhead %ub ", r->overhead);
} }
} }
if (lss && lss->flags) { if (lss && lss->flags) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment