Commit b4c3eac4 authored by Vlad Yasevich's avatar Vlad Yasevich Committed by Greg Kroah-Hartman

macvtap: Do not double-count received packets

[ Upstream commit 006da7b0 ]

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 macvtap and let only macvlan count received
packets.
Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 468c82ca
...@@ -797,7 +797,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, ...@@ -797,7 +797,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
const struct sk_buff *skb, const struct sk_buff *skb,
const struct iovec *iv, int len) const struct iovec *iv, int len)
{ {
struct macvlan_dev *vlan;
int ret; int ret;
int vnet_hdr_len = 0; int vnet_hdr_len = 0;
int vlan_offset = 0; int vlan_offset = 0;
...@@ -851,12 +850,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, ...@@ -851,12 +850,6 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
copied += len; copied += len;
done: done:
rcu_read_lock_bh();
vlan = rcu_dereference_bh(q->vlan);
if (vlan)
macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
rcu_read_unlock_bh();
return ret ? ret : copied; return ret ? ret : copied;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment