Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 macvtap and let only macvlan count received
packets.

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vlad Yasevich and committed by
David S. Miller
006da7b0 dff345c5

-10
-10
drivers/net/macvtap.c
··· 767 767 const struct sk_buff *skb, 768 768 const struct iovec *iv, int len) 769 769 { 770 - struct macvlan_dev *vlan; 771 770 int ret; 772 771 int vnet_hdr_len = 0; 773 772 int vlan_offset = 0; ··· 820 821 copied += len; 821 822 822 823 done: 823 - rcu_read_lock(); 824 - vlan = rcu_dereference(q->vlan); 825 - if (vlan) { 826 - preempt_disable(); 827 - macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); 828 - preempt_enable(); 829 - } 830 - rcu_read_unlock(); 831 - 832 824 return ret ? ret : copied; 833 825 } 834 826