Subject: Re: [RFC] vlan: GRO rx statistics

From: Eric Dumazet <[email-masked]>
Date: Fri, 13 Nov 2009 17:41:21 +0100

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...