]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/commitdiff
sfq: add divisor support
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 23 Jan 2011 00:09:06 +0000 (00:09 +0000)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Fri, 25 Feb 2011 20:59:53 +0000 (12:59 -0800)
In 2.6.39, we can build SFQ queues with a given hash table size,

tc/q_sfq.c

index 71a3c9ac16694a67195d9366c15c3f57e0fd5c5b..98ec530d14f358e41d77218f7137655b406355ea 100644 (file)
@@ -26,6 +26,7 @@
 static void explain(void)
 {
        fprintf(stderr, "Usage: ... sfq [ limit NUMBER ] [ perturb SECS ] [ quantum BYTES ]\n");
+       fprintf(stderr, "               [ divisor NUMBER ]\n");
 }
 
 static int sfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
@@ -61,6 +62,13 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
                                return -1;
                        }
                        ok++;
+               } else if (strcmp(*argv, "divisor") == 0) {
+                       NEXT_ARG();
+                       if (get_u32(&opt.divisor, *argv, 0)) {
+                               fprintf(stderr, "Illegal \"divisor\"\n");
+                               return -1;
+                       }
+                       ok++;
                } else if (strcmp(*argv, "help") == 0) {
                        explain();
                        return -1;
@@ -93,6 +101,7 @@ static int sfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
        if (show_details) {
                fprintf(f, "flows %u/%u ", qopt->flows, qopt->divisor);
        }
+       fprintf(f, "divisor %u ", qopt->divisor);
        if (qopt->perturb_period)
                fprintf(f, "perturb %dsec ", qopt->perturb_period);
        return 0;