Subject: Re: [RFC] gianfar: Fix stats support

From: Eric Dumazet <[email-masked]>
Date: Thu, 10 Dec 2009 07:13:07 +0100

Le 10/12/2009 06:42, Sandeep Gopalpet a écrit :
> This patch updates the per rx/tx queue stats.
> To update the per rx queue stats a new structure has been
> introduced rx_q_stats.
> The per tx queue stats are updated via the netdev_queue
> structure itself.
> 
> Note that we update only the tx_packtes, tx_bytes, rx_packets,
> rx_bytes and rx_dropped stats on a per queue basis.
> 
> Signed-off-by: Sandeep Gopalpet <[email-masked]>

> +
> +	for (i = 0; i < priv->num_tx_queues; i++) {
> +		txq = netdev_get_tx_queue(dev, i);
> +		tx_bytes += txq->tx_bytes;
> +		tx_packets += txq->tx_packets;
> +	}
> +
> +	dev->stats.tx_bytes = tx_bytes;
> +	dev->stats.tx_packets = tx_packets;
> +
> +	return &dev->stats;

Fine by me, but if this patch is for linux-2.6.33, you can use dev_txq_stats_fold()
helper in your gfar_get_stats()

dev_txq_stats_fold(dev, &dev->stats);
return &dev->stats;