Re: [PATCH net-next v3 5/9] forcedeth: implement ndo_get_stats64() API
From: David Decotigny
Date: Tue Nov 15 2011 - 14:31:10 EST
Hi Stephen,
On Mon, Nov 14, 2011 at 5:10 PM, Stephen Hemminger
<shemminger@xxxxxxxxxx> wrote:
> Please existing u64_stats_sync rather than inventing your own
> method. The u64_stats_sync is faster and does require locking.
Thanks for your review.
This should be fixed in the v4 series I just sent:
http://patchwork.ozlabs.org/patch/125861/
Regards,
--
David Decotigny
On Mon, Nov 14, 2011 at 5:10 PM, Stephen Hemminger
<shemminger@xxxxxxxxxx> wrote:
> On Mon, 14 Nov 2011 16:11:15 -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
>>
>>
>>
>> Signed-off-by: David Decotigny <david.decotigny@xxxxxxxxxx>
>> ---
>> drivers/net/ethernet/nvidia/forcedeth.c | 182 ++++++++++++++++++++++++-------
>> 1 files changed, 141 insertions(+), 41 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
>> index ee8cce5..a67c1f4 100644
>> --- a/drivers/net/ethernet/nvidia/forcedeth.c
>> +++ b/drivers/net/ethernet/nvidia/forcedeth.c
>> @@ -692,6 +692,21 @@ struct nv_ethtool_stats {
>> #define NV_DEV_STATISTICS_V2_COUNT (NV_DEV_STATISTICS_V3_COUNT - 3)
>> #define NV_DEV_STATISTICS_V1_COUNT (NV_DEV_STATISTICS_V2_COUNT - 6)
>>
>> +/* driver statistics */
>> +struct nv_driver_stat {
>> + atomic_t delta; /* increase since last nv_update_stats() */
>> + u64 total; /* cumulative, requires netdev_priv(dev)->stats_lock */
>> +};
>
> Please existing u64_stats_sync rather than inventing your own
> method. The u64_stats_sync is faster and does require locking.
>
--
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/