netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macvtap: Do not double-count received packets
@ 2013-11-26 17:37 Vlad Yasevich
  2013-11-26 21:09 ` Michael S. Tsirkin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vlad Yasevich @ 2013-11-26 17:37 UTC (permalink / raw)
  To: netdev; +Cc: mst, 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 <vyasevic@redhat.com>
---
 drivers/net/macvtap.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index dc76670..50f8dce 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -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;
 }
 
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] macvtap: Do not double-count received packets
  2013-11-26 17:37 [PATCH] macvtap: Do not double-count received packets Vlad Yasevich
@ 2013-11-26 21:09 ` Michael S. Tsirkin
  2013-11-27  2:12 ` Jason Wang
  2013-11-29 21:07 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2013-11-26 21:09 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: netdev

On Tue, Nov 26, 2013 at 12:37:12PM -0500, Vlad Yasevich wrote:
> 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 <vyasevic@redhat.com>


Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/macvtap.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index dc76670..50f8dce 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -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;
>  }
>  
> -- 
> 1.8.4.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] macvtap: Do not double-count received packets
  2013-11-26 17:37 [PATCH] macvtap: Do not double-count received packets Vlad Yasevich
  2013-11-26 21:09 ` Michael S. Tsirkin
@ 2013-11-27  2:12 ` Jason Wang
  2013-11-29 21:07 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2013-11-27  2:12 UTC (permalink / raw)
  To: Vlad Yasevich, netdev; +Cc: mst

On 11/27/2013 01:37 AM, Vlad Yasevich wrote:
> 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 <vyasevic@redhat.com>
> ---
>  drivers/net/macvtap.c | 10 ----------
>  1 file changed, 10 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index dc76670..50f8dce 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -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;
>  }
>  

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] macvtap: Do not double-count received packets
  2013-11-26 17:37 [PATCH] macvtap: Do not double-count received packets Vlad Yasevich
  2013-11-26 21:09 ` Michael S. Tsirkin
  2013-11-27  2:12 ` Jason Wang
@ 2013-11-29 21:07 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-11-29 21:07 UTC (permalink / raw)
  To: vyasevic; +Cc: netdev, mst

From: Vlad Yasevich <vyasevic@redhat.com>
Date: Tue, 26 Nov 2013 12:37:12 -0500

> 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

> packets.
> 
> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>

Applied, with the above typo fixed, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-29 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-26 17:37 [PATCH] macvtap: Do not double-count received packets Vlad Yasevich
2013-11-26 21:09 ` Michael S. Tsirkin
2013-11-27  2:12 ` Jason Wang
2013-11-29 21:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).