QoS: make tc filters match all traffic

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@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Antoni S. Puimedon 2014-04-04 15:39:33 +02:00 committed by Michal Privoznik
parent 4463e438e2
commit d9de144385
2 changed files with 8 additions and 7 deletions

View File

@ -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);

View File

@ -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;