[libvirt] [PATCH] QoS: make tc filters match all traffic

Antoni S. Puimedon asegurap at redhat.com
Fri Apr 4 13:39:33 UTC 2014


Up until now the traffic control filters for the vNIC QoS were
matching only ip traffic. For egress traffic that was unnoticed
because the unmatched traffic would just go to the default htb class
and be shaped anyway. For ingress, though, since the policing of the
rate is done by the filter itself.

The problem is solved by changing protocol to all and making anything
match the filter.

Bug-Url: https://bugzilla.redhat.com/1084444
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
 src/util/virnetdevbandwidth.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index b06ed4c..1e00116 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -193,7 +193,7 @@ virNetDevBandwidthSet(const char *ifname,
         virCommandFree(cmd);
         cmd = virCommandNew(TC);
         virCommandAddArgList(cmd, "filter", "add", "dev", ifname, "parent",
-                             "1:0", "protocol", "ip", "handle", "1", "fw",
+                             "1:0", "protocol", "all", "handle", "1", "fw",
                              "flowid", "1", NULL);
 
         if (virCommandRun(cmd, NULL) < 0)
@@ -221,9 +221,10 @@ virNetDevBandwidthSet(const char *ifname,
 
         virCommandFree(cmd);
         cmd = virCommandNew(TC);
+        /* Set filter to match all ingress traffic */
         virCommandAddArgList(cmd, "filter", "add", "dev", ifname, "parent",
-                             "ffff:", "protocol", "ip", "u32", "match", "ip",
-                             "src", "0.0.0.0/0", "police", "rate", average,
+                             "ffff:", "protocol", "all", "u32", "match", "u32",
+                             "0", "0", "police", "rate", average,
                              "burst", burst, "mtu", "64kb", "drop", "flowid",
                              ":1", NULL);
 
-- 
1.9.0




More information about the libvir-list mailing list