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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04.04.2014 15:39, Antoni S. Puimedon wrote:
> 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@xxxxxxxxxx>
> ---
>   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);
>   
> 

The patch is missing virnetdevbandwidthtest adjustment (could be caught by running 'make check'). This needs to be squashed in:

diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 3f68194..384991e 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 ip handle 1 fw flowid 1\n"));
+                 TC " filter add dev eth0 parent 1:0 protocol all handle 1 fw flowid 1\n"));
 
     DO_TEST_SET(("<bandwidth>"
                  "  <outbound average='1024'/>"
@@ -147,7 +147,7 @@ mymain(void)
                 (TC " qdisc del dev eth0 root\n"
                  TC " qdisc del dev eth0 ingress\n"
                  TC " qdisc add dev eth0 ingress\n"
-                 TC " filter add dev eth0 parent ffff: protocol ip u32 match ip src 0.0.0.0/0 "
+                 TC " filter add dev eth0 parent ffff: protocol all u32 match u32 0 0 "
                  "police rate 1024kbps burst 1024kb mtu 64kb drop flowid :1\n"));
 
     DO_TEST_SET(("<bandwidth>"
@@ -159,9 +159,9 @@ 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 ip handle 1 fw flowid 1\n"
+                 TC " filter add dev eth0 parent 1:0 protocol all handle 1 fw flowid 1\n"
                  TC " qdisc add dev eth0 ingress\n"
-                 TC " filter add dev eth0 parent ffff: protocol ip u32 match ip src 0.0.0.0/0 "
+                 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"));
 
     return ret;

Squashed in, ACKed and pushed. Congratulations on your first libvirt contribution!

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]