All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] vlan: GRO rx statistics
@ 2009-11-10 16:52 Eric Dumazet
  2009-11-13 16:41 ` Eric Dumazet
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2009-11-10 16:52 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, Linux Netdev List

It seems vlan interfaces with hardware-assisted VLAN reception 
dont have rx statistics.

Following patch cures the problem for me but I have no idea
if it is correct ?

Another problem about all rx stats is about multi rx queues devices.
Several cpus can access these counters in parallel ?


diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 8d5ca2a..e13b007 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -89,6 +89,11 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
 	if (!skb->dev)
 		goto drop;
 
+	skb->dev->stats.rx_packets++;
+	skb->dev->stats.rx_bytes += skb->len;
+	if (skb->pkt_type == PACKET_MULTICAST)
+		skb->dev->stats.multicast++;
+
 	for (p = napi->gro_list; p; p = p->next) {
 		NAPI_GRO_CB(p)->same_flow =
 			p->dev == skb->dev && !compare_ether_header(

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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-10 16:52 [RFC] vlan: GRO rx statistics Eric Dumazet
@ 2009-11-13 16:41 ` Eric Dumazet
  2009-11-13 16:44   ` Eric Dumazet
  2009-11-14  1:27   ` Herbert Xu
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Dumazet @ 2009-11-13 16:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, Linux Netdev List

Eric Dumazet a écrit :
> It seems vlan interfaces with hardware-assisted VLAN reception 
> dont have rx statistics.
> 
> Following patch cures the problem for me but I have no idea
> if it is correct ?
> 
> Another problem about all rx stats is about multi rx queues devices.
> Several cpus can access these counters in parallel ?
> 
> 
> diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
> index 8d5ca2a..e13b007 100644
> --- a/net/8021q/vlan_core.c
> +++ b/net/8021q/vlan_core.c
> @@ -89,6 +89,11 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
>  	if (!skb->dev)
>  		goto drop;
>  
> +	skb->dev->stats.rx_packets++;
> +	skb->dev->stats.rx_bytes += skb->len;
> +	if (skb->pkt_type == PACKET_MULTICAST)
> +		skb->dev->stats.multicast++;
> +
>  	for (p = napi->gro_list; p; p = p->next) {
>  		NAPI_GRO_CB(p)->same_flow =
>  			p->dev == skb->dev && !compare_ether_header(
> 

Replying to myself, I found root of the problem and posted a fix.

Still the race while updating dev->stats.tx_{bytes|packets} should be addressed eventually...


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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-13 16:41 ` Eric Dumazet
@ 2009-11-13 16:44   ` Eric Dumazet
  2009-11-14  1:27   ` Herbert Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2009-11-13 16:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, Linux Netdev List

Eric Dumazet a écrit :

> Still the race while updating dev->stats.tx_{bytes|packets} should be addressed eventually...

Sorry, I meant dev->stats.rx_{bytes|packets}, since tx side is protected by txq spinlock.


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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-13 16:41 ` Eric Dumazet
  2009-11-13 16:44   ` Eric Dumazet
@ 2009-11-14  1:27   ` Herbert Xu
  2009-11-14  7:27     ` Eric Dumazet
  2009-11-15 19:35     ` Eric Dumazet
  1 sibling, 2 replies; 7+ messages in thread
From: Herbert Xu @ 2009-11-14  1:27 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List

On Fri, Nov 13, 2009 at 05:41:21PM +0100, Eric Dumazet wrote:
>
> Replying to myself, I found root of the problem and posted a fix.

Just curious, do you have a link to that fix?

> Still the race while updating dev->stats.tx_{bytes|packets} should be addressed eventually...

Well making it per-napi_struct should do the trick.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-14  1:27   ` Herbert Xu
@ 2009-11-14  7:27     ` Eric Dumazet
  2009-11-15 19:35     ` Eric Dumazet
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2009-11-14  7:27 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, Linux Netdev List

Herbert Xu a écrit :
> On Fri, Nov 13, 2009 at 05:41:21PM +0100, Eric Dumazet wrote:
>> Replying to myself, I found root of the problem and posted a fix.
> 
> Just curious, do you have a link to that fix?
> 

Sure, I thought you were a netdev subscriber, sorry :)

[PATCH net-next-2.6] vlan: Use __vlan_hwaccel_put_tag() in rx

http://patchwork.ozlabs.org/patch/38377/


>> Still the race while updating dev->stats.tx_{bytes|packets} should be addressed eventually...
> 
> Well making it per-napi_struct should do the trick.
> 
> Cheers,


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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-14  1:27   ` Herbert Xu
  2009-11-14  7:27     ` Eric Dumazet
@ 2009-11-15 19:35     ` Eric Dumazet
  2009-11-16  5:21       ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2009-11-15 19:35 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, Linux Netdev List

Herbert Xu a écrit :
> On Fri, Nov 13, 2009 at 05:41:21PM +0100, Eric Dumazet wrote:
>> Still the race while updating dev->stats.tx_{bytes|packets} should be addressed eventually...
> 
> Well making it per-napi_struct should do the trick.

For normal devices, probably (but many of them use hardware counters anyway)
but not vlan :)

vlan_hwaccel_do_receive() has no napi context.


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

* Re: [RFC] vlan: GRO rx statistics
  2009-11-15 19:35     ` Eric Dumazet
@ 2009-11-16  5:21       ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2009-11-16  5:21 UTC (permalink / raw)
  To: eric.dumazet; +Cc: herbert, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 15 Nov 2009 20:35:56 +0100

> vlan_hwaccel_do_receive() has no napi context.

But this is a choice :-)  And being able to split up the RX
counters would be another reason to potentially change that
choice.

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

end of thread, other threads:[~2009-11-16  5:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-10 16:52 [RFC] vlan: GRO rx statistics Eric Dumazet
2009-11-13 16:41 ` Eric Dumazet
2009-11-13 16:44   ` Eric Dumazet
2009-11-14  1:27   ` Herbert Xu
2009-11-14  7:27     ` Eric Dumazet
2009-11-15 19:35     ` Eric Dumazet
2009-11-16  5:21       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.