提交 d9de1443 编写于 作者: A Antoni S. Puimedon 提交者: Michal Privoznik

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/1084444Signed-off-by: NAntoni S. Puimedon <asegurap@redhat.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 4463e438
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册