[Devel] [PATCH RHEL7 COMMIT] ve/net: fix tap ve shaping
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Nov 10 05:40:04 PST 2015
The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.7
------>
commit 40642464b573eabc8d9f5c9f1e491c1f040afcc5
Author: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
Date: Tue Nov 10 17:40:04 2015 +0400
ve/net: fix tap ve shaping
There was a mistake in b59e089eb2d : "ve/net: introduce TAP accounting"
venet_acct_classify_add_outgoing (which is setting skb->mark)
was called _after_ netif_rx_ni(skb), so out of the vm all the packets
has mark=0.
This patch fixes it.
Related to https://jira.sw.ru/browse/PSBM-40888
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
P.S.: As I understand, PSBM-40888 is not fixed.
This patch just fix my part of work.
For me everything is working with tc:
1. start a vm
2. set ve id for vnet0 to 10 (TUNSETACCTID ioctl from my previous patch)
3. set class for one ip to 2 (VZCTL_TC_SET_CLASS_TABLE ioctl)
4. venet_acct_classify_add_outgoing generates mark = 322
5. tc filter:
tc qdisc add dev eno1 root handle 1: cbq avpkt 1000 bandwidth 10mbit
tc class add dev eno1 parent 1: classid 1:1 cbq rate 512kbit allot 1500 prio 5 bounded isolated
tc filter add dev eno1 parent 1: protocol ip prio 16 handle 322 fw flowid 1:1
6. finish. traffic for this ip is shaped successfully
drivers/net/tun.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
drivers/net/tun.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 4f7eee9..779d73c 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1242,18 +1242,18 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
skb_reset_network_header(skb);
skb_probe_transport_header(skb, 0);
- rxhash = skb_get_hash(skb);
- netif_rx_ni(skb);
-
- tun->dev->stats.rx_packets++;
- tun->dev->stats.rx_bytes += len;
-
#ifdef CONFIG_VE_TUNTAP_ACCOUNTING
if (tun->vestat) {
venet_acct_classify_add_outgoing(tun->vestat, skb);
}
#endif /* CONFIG_VE_TUNTAP_ACCOUNTING */
+ rxhash = skb_get_hash(skb);
+ netif_rx_ni(skb);
+
+ tun->dev->stats.rx_packets++;
+ tun->dev->stats.rx_bytes += len;
+
tun_flow_update(tun, rxhash, tfile);
return total_len;
}
More information about the Devel
mailing list