net/mlx4_en: Fill all counters under one call of stats lock
authorEran Ben Elisha <eranbe@mellanox.com>
Wed, 13 Dec 2017 16:12:11 +0000 (18:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Dec 2017 21:38:37 +0000 (16:38 -0500)
commit5a1647c391ba543a77a400dddf89053ec5c2b7a4
treee81bc4358cdff998de373296af7ffee5320cb7cf
parent0bb9fc4f5429ac970181c073aa32e521e20f7b73
net/mlx4_en: Fill all counters under one call of stats lock

Before this patch, the stats_lock was acquired twice. In between the
locks Driver sent command to gather some more statistics (per priority
and counter statistics). If the stats lock was acquired by get
statistics NDO in between we would have report out of sync counters.

Fix this by collecting all stats from Firmware in advance and then
fill the Software structs under one lock.

Fixes: 0b131561a7d6 ("net/mlx4_en: Add Flow control statistics display via ethtool")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_port.c