]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/q_fq.c
tc: B.W limits can now be specified in %.
[mirror_iproute2.git] / tc / q_fq.c
index 49ebeefa0b78035ab30b34d9d257244ffd46f821..51b5bc367cab4d7a3a0cb558609498bc50f10721 100644 (file)
--- a/tc/q_fq.c
+++ b/tc/q_fq.c
@@ -71,7 +71,7 @@ static unsigned int ilog2(unsigned int val)
 }
 
 static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
-                       struct nlmsghdr *n)
+                       struct nlmsghdr *n, const char *dev)
 {
        unsigned int plimit;
        unsigned int flow_plimit;
@@ -118,7 +118,12 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
                        }
                } else if (strcmp(*argv, "maxrate") == 0) {
                        NEXT_ARG();
-                       if (get_rate(&maxrate, *argv)) {
+                       if (strchr(*argv, '%')) {
+                               if (get_percent_rate(&maxrate, *argv, dev)) {
+                                       fprintf(stderr, "Illegal \"maxrate\"\n");
+                                       return -1;
+                               }
+                       } else if (get_rate(&maxrate, *argv)) {
                                fprintf(stderr, "Illegal \"maxrate\"\n");
                                return -1;
                        }
@@ -132,7 +137,12 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
                        set_low_rate_threshold = true;
                } else if (strcmp(*argv, "defrate") == 0) {
                        NEXT_ARG();
-                       if (get_rate(&defrate, *argv)) {
+                       if (strchr(*argv, '%')) {
+                               if (get_percent_rate(&defrate, *argv, dev)) {
+                                       fprintf(stderr, "Illegal \"defrate\"\n");
+                                       return -1;
+                               }
+                       } else if (get_rate(&defrate, *argv)) {
                                fprintf(stderr, "Illegal \"defrate\"\n");
                                return -1;
                        }