Re: [PATCH net-next v5 07/10] forcedeth: implementndo_get_stats64() API

From: Stephen Hemminger
Date: Wed Nov 16 2011 - 11:55:37 EST


On Tue, 15 Nov 2011 21:15:55 -0800
David Decotigny <david.decotigny@xxxxxxxxxx> wrote:

> This commit implements the ndo_get_stats64() API for forcedeth. Since
> these stats are being updated from different contexts (process and
> timer), this commit adds protection (locking + atomic variables).
>
> Tested:
> - 16-way SMP x86_64 ->
> RX bytes:7244556582 (7.2 GB) TX bytes:181904254 (181.9 MB)
> - pktgen + loopback: identical rx_bytes/tx_bytes and rx_packets/tx_packets

Rather than adding additional locking why not use a percpu structure
to hold statistics. See loopback, macvlan, veth, xen-netfront.

Or realize that the Tx side is single threaded by dev->xmit_lock already
and the Rx side is single threaded by NAPI.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/