[libvirt] [PATCH 4/7] virNetDevBandwidthSet: Add priority to filter

Michal Privoznik mprivozn at redhat.com
Tue Apr 14 16:59:34 UTC 2015


Currently, when constructing traffic shaping rules, the ingress
filter is created without any priority specified on the command
line. This makes kernel to make up one. While this works, it
simplifies things a big if we provide the filter priority. In
this case, since it's the root filter lets have it the highest
priority of number 1.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virnetdevbandwidth.c  | 4 ++--
 tests/virnetdevbandwidthtest.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index d1c0f12..943178b 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -209,8 +209,8 @@ virNetDevBandwidthSet(const char *ifname,
         virCommandFree(cmd);
         cmd = virCommandNew(TC);
         virCommandAddArgList(cmd, "filter", "add", "dev", ifname, "parent",
-                             "1:0", "protocol", "all", "handle", "1", "fw",
-                             "flowid", "1", NULL);
+                             "1:0", "protocol", "all", "prio", "1", "handle",
+                             "1", "fw", "flowid", "1", NULL);
 
         if (virCommandRun(cmd, NULL) < 0)
             goto cleanup;
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 3b46455..5a3f02c 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -139,7 +139,7 @@ mymain(void)
                  TC " qdisc add dev eth0 root handle 1: htb default 1\n"
                  TC " class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps\n"
                  TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
-                 TC " filter add dev eth0 parent 1:0 protocol all handle 1 fw flowid 1\n"));
+                 TC " filter add dev eth0 parent 1:0 protocol all prio 1 handle 1 fw flowid 1\n"));
 
     DO_TEST_SET(("<bandwidth>"
                  "  <outbound average='1024'/>"
@@ -159,7 +159,7 @@ mymain(void)
                  TC " qdisc add dev eth0 root handle 1: htb default 1\n"
                  TC " class add dev eth0 parent 1: classid 1:1 htb rate 1kbps ceil 2kbps burst 4kb\n"
                  TC " qdisc add dev eth0 parent 1:1 handle 2: sfq perturb 10\n"
-                 TC " filter add dev eth0 parent 1:0 protocol all handle 1 fw flowid 1\n"
+                 TC " filter add dev eth0 parent 1:0 protocol all prio 1 handle 1 fw flowid 1\n"
                  TC " qdisc add dev eth0 ingress\n"
                  TC " filter add dev eth0 parent ffff: protocol all u32 match u32 0 0 "
                  "police rate 5kbps burst 7kb mtu 64kb drop flowid :1\n"));
-- 
2.0.5




More information about the libvir-list mailing list