Commit 9d9a67c7 authored by David Ward's avatar David Ward Committed by Stephen Hemminger

tc: red, gred: Rename overloaded variable wlog

It is used when parsing three different parameters, only one of
which is Wlog. Change the name to make the code less confusing.
Signed-off-by: default avatarDavid Ward <david.ward@ll.mit.edu>
parent 699589f6
...@@ -123,7 +123,7 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n ...@@ -123,7 +123,7 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
unsigned avpkt = 0; unsigned avpkt = 0;
double probability = 0.02; double probability = 0.02;
unsigned rate = 0; unsigned rate = 0;
int wlog; int parm;
__u8 sbuf[256]; __u8 sbuf[256];
struct rtattr *tail; struct rtattr *tail;
__u32 max_P; __u32 max_P;
...@@ -227,27 +227,26 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n ...@@ -227,27 +227,26 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt); burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt);
fprintf(stderr, "GRED: set burst to %u\n", burst); fprintf(stderr, "GRED: set burst to %u\n", burst);
} }
if ((parm = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
if ((wlog = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
fprintf(stderr, "GRED: failed to calculate EWMA constant.\n"); fprintf(stderr, "GRED: failed to calculate EWMA constant.\n");
return -1; return -1;
} }
if (wlog >= 10) if (parm >= 10)
fprintf(stderr, "GRED: WARNING. Burst %d seems to be too " fprintf(stderr, "GRED: WARNING. Burst %d seems to be too "
"large.\n", burst); "large.\n", burst);
opt.Wlog = wlog; opt.Wlog = parm;
if ((wlog = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) { if ((parm = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) {
fprintf(stderr, "GRED: failed to calculate probability.\n"); fprintf(stderr, "GRED: failed to calculate probability.\n");
return -1; return -1;
} }
opt.Plog = wlog; opt.Plog = parm;
if ((wlog = tc_red_eval_idle_damping(opt.Wlog, avpkt, rate, sbuf)) < 0) if ((parm = tc_red_eval_idle_damping(opt.Wlog, avpkt, rate, sbuf)) < 0)
{ {
fprintf(stderr, "GRED: failed to calculate idle damping " fprintf(stderr, "GRED: failed to calculate idle damping "
"table.\n"); "table.\n");
return -1; return -1;
} }
opt.Scell_log = wlog; opt.Scell_log = parm;
tail = NLMSG_TAIL(n); tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
......
...@@ -40,7 +40,7 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl ...@@ -40,7 +40,7 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
unsigned avpkt = 0; unsigned avpkt = 0;
double probability = 0.02; double probability = 0.02;
unsigned rate = 0; unsigned rate = 0;
int wlog; int parm;
__u8 sbuf[256]; __u8 sbuf[256];
__u32 max_P; __u32 max_P;
struct rtattr *tail; struct rtattr *tail;
...@@ -126,23 +126,23 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl ...@@ -126,23 +126,23 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
opt.qth_min = opt.qth_max / 3; opt.qth_min = opt.qth_max / 3;
if (!burst) if (!burst)
burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt); burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt);
if ((wlog = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) { if ((parm = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
fprintf(stderr, "RED: failed to calculate EWMA constant.\n"); fprintf(stderr, "RED: failed to calculate EWMA constant.\n");
return -1; return -1;
} }
if (wlog >= 10) if (parm >= 10)
fprintf(stderr, "RED: WARNING. Burst %d seems to be too large.\n", burst); fprintf(stderr, "RED: WARNING. Burst %d seems to be too large.\n", burst);
opt.Wlog = wlog; opt.Wlog = parm;
if ((wlog = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) { if ((parm = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) {
fprintf(stderr, "RED: failed to calculate probability.\n"); fprintf(stderr, "RED: failed to calculate probability.\n");
return -1; return -1;
} }
opt.Plog = wlog; opt.Plog = parm;
if ((wlog = tc_red_eval_idle_damping(opt.Wlog, avpkt, rate, sbuf)) < 0) { if ((parm = tc_red_eval_idle_damping(opt.Wlog, avpkt, rate, sbuf)) < 0) {
fprintf(stderr, "RED: failed to calculate idle damping table.\n"); fprintf(stderr, "RED: failed to calculate idle damping table.\n");
return -1; return -1;
} }
opt.Scell_log = wlog; opt.Scell_log = parm;
tail = NLMSG_TAIL(n); tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
......
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