]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
red: make burst optional
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 1 Dec 2011 14:25:59 +0000 (15:25 +0100)
committerStephen Hemminger <shemminger@vyatta.com>
Thu, 1 Dec 2011 17:23:49 +0000 (09:23 -0800)
Documentation advises to set burst to (min+min+max)/(3*avpkt)

Let tc do this automatically if user doesnt provide burst himself.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
tc/q_choke.c
tc/q_gred.c
tc/q_red.c

index 04a864f3bcfc1140c2f75d38a4020132138905a8..7816f62f9dfdda5cf6f8a5fe92089c6e88e4a24a 100644 (file)
@@ -133,7 +133,7 @@ static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv,
                return -1;
        }
        if (wlog >= 10)
-               fprintf(stderr, "CHOKE: WARNING. Burst %d seems to be to large.\n", burst);
+               fprintf(stderr, "CHOKE: WARNING. Burst %d seems to be too large.\n", burst);
        opt.Wlog = wlog;
 
        wlog = tc_red_eval_P(opt.qth_min*avpkt, opt.qth_max*avpkt, probability);
index 59651d362bb4800b620ea67b879534ba4656a569..5fa0cc761a36c8ee0703305fd9378b1dd633d540 100644 (file)
@@ -215,19 +215,23 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
        if (rate == 0)
                get_rate(&rate, "10Mbit");
 
-       if (!opt.qth_min || !opt.qth_max || !burst || !opt.limit || !avpkt ||
+       if (!opt.qth_min || !opt.qth_max || !opt.limit || !avpkt ||
            (opt.DP<0)) {
-               fprintf(stderr, "Required parameter (min, max, burst, limit, "
+               fprintf(stderr, "Required parameter (min, max, limit, "
                    "avpkt, DP) is missing\n");
                return -1;
        }
+       if (!burst) {
+               burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt);
+               fprintf(stderr, "GRED: set burst to %u\n", burst);
+       }
 
        if ((wlog = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
                fprintf(stderr, "GRED: failed to calculate EWMA constant.\n");
                return -1;
        }
        if (wlog >= 10)
-               fprintf(stderr, "GRED: WARNING. Burst %d seems to be to "
+               fprintf(stderr, "GRED: WARNING. Burst %d seems to be too "
                    "large.\n", burst);
        opt.Wlog = wlog;
        if ((wlog = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) {
index 4b1b889365bdb931d38384e6812e340b641a6025..6e58d7a788e32845652357b4cf89d5d9d1ae4be6 100644 (file)
@@ -104,17 +104,20 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
        if (rate == 0)
                get_rate(&rate, "10Mbit");
 
-       if (!opt.qth_min || !opt.qth_max || !burst || !opt.limit || !avpkt) {
-               fprintf(stderr, "Required parameter (min, max, burst, limit, avpkt) is missing\n");
+       if (!opt.qth_min || !opt.qth_max || !opt.limit || !avpkt) {
+               fprintf(stderr, "RED: Required parameter (min, max, limit, avpkt) is missing\n");
                return -1;
        }
-
+       if (!burst) {
+               burst = (2 * opt.qth_min + opt.qth_max) / (3 * avpkt);
+               fprintf(stderr, "RED: set burst to %u\n", burst);
+       }
        if ((wlog = tc_red_eval_ewma(opt.qth_min, burst, avpkt)) < 0) {
                fprintf(stderr, "RED: failed to calculate EWMA constant.\n");
                return -1;
        }
        if (wlog >= 10)
-               fprintf(stderr, "RED: WARNING. Burst %d seems to be to large.\n", burst);
+               fprintf(stderr, "RED: WARNING. Burst %d seems to be too large.\n", burst);
        opt.Wlog = wlog;
        if ((wlog = tc_red_eval_P(opt.qth_min, opt.qth_max, probability)) < 0) {
                fprintf(stderr, "RED: failed to calculate probability.\n");