macvtap: Do not double-count received packets
Subsystems (2)
PATCH 1/1 macvtap: Do not double-count received packets
Currently macvlan will count received packets after calling each
vlans receive handler. Macvtap attempts to count the packet
yet again when the user reads the packet from the tap socket. This code doesn't do this consistently either. Remove the counting from macvap and let only macvlan count received packets.
--- drivers/net/macvtap.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/net/macvtap.c +0 -10
@@ -767,7 +767,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,const struct sk_buff *skb, const struct iovec *iv, int len) { - struct macvlan_dev *vlan; int ret;int vnet_hdr_len =0 ;int vlan_offset =0 ;
@@ -821,15 +820,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, copied += len; done: -rcu_read_lock (); - vlan =rcu_dereference (q->vlan); -if (vlan) { -preempt_disable (); -macvlan_count_rx (vlan, copied - vnet_hdr_len, ret ==0 ,0 ); -preempt_enable (); - } -rcu_read_unlock (); -return ret ? ret : copied; }
Signature · 1 line
1.8.4.2
Quoted 8 lines · Vlad Yasevich
Currently macvlan will count received packets after calling each
vlans receive handler. Macvtap attempts to count the packet
yet again when the user reads the packet from the tap socket. This code doesn't do this consistently either. Remove the counting from macvap and let only macvlan count received packets.Signed-off-by Vlad Yasevich <[email protected]>
Quoted 34 lines
--- drivers/net/macvtap.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/net/macvtap.c +0
-10@@ -767,7 +767,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,const struct sk_buff *skb, const struct iovec *iv, int len) { - struct macvlan_dev *vlan; int ret;int vnet_hdr_len =0 ;int vlan_offset =0 ;@@ -821,15 +820,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, copied += len; done: -rcu_read_lock (); - vlan =rcu_dereference (q->vlan); -if (vlan) { -preempt_disable (); -macvlan_count_rx (vlan, copied - vnet_hdr_len, ret ==0 ,0 ); -preempt_enable (); - } -rcu_read_unlock (); -return ret ? ret : copied; }Signature · 1 line
1.8.4.2
Quoted 30 lines · Vlad Yasevich
Currently macvlan will count received packets after calling each
vlans receive handler. Macvtap attempts to count the packet
yet again when the user reads the packet from the tap socket. This code doesn't do this consistently either. Remove the counting from macvap and let only macvlan count received packets.Signed-off-by Vlad Yasevich <[email protected]>--- drivers/net/macvtap.c | 10 ---------- 1 file changed, 10 deletions(-)drivers/net/macvtap.c +0
-3@@ -767,7 +767,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,const struct sk_buff *skb, const struct iovec *iv, int len) { - struct macvlan_dev *vlan; int ret;int vnet_hdr_len =0 ;int vlan_offset =0 ;@@ -821,15 +820,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, copied += len; done: -rcu_read_lock (); - vlan =rcu_dereference (q->vlan);
drivers/net/macvtap.c static ssize_t macvtap_put_user(struct macvtap_queue *q, · line 825
Quoted 10 lines
drivers/net/macvtap.c +0
-7-if (vlan) { -preempt_disable (); -macvlan_count_rx (vlan, copied - vnet_hdr_len, ret ==0 ,0 ); -preempt_enable (); - } -rcu_read_unlock (); -return ret ? ret : copied; }
From: Vlad Yasevich <[email protected]>
Date: Tue, 26 Nov 2013 12:37:12 -0500
Quoted 5 lines
Currently macvlan will count received packets after calling each
vlans receive handler. Macvtap attempts to count the packet
yet again when the user reads the packet from the tap socket. This code doesn't do this consistently either. Remove the counting from macvap and let only macvlan count received
^^^^^^
--> macvtap
Quoted 3 lines
packets.
Signed-off-by Vlad Yasevich <[email protected]>
Applied, with the above typo fixed, thanks.