Skip to content

Commit c3d64ad

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: fix ethtool stats gather retry
The while loop fetching 64 bit ethtool statistics may have to retry multiple times, it shouldn't modify the outside state. Fixes: 4c35236 ("net: add driver for Netronome NFP4000/NFP6000 NIC VFs") Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3668bb8 commit c3d64ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,22 +464,24 @@ static u64 *nfp_vnic_get_sw_stats(struct net_device *netdev, u64 *data)
464464

465465
do {
466466
start = u64_stats_fetch_begin(&nn->r_vecs[i].rx_sync);
467-
*data++ = nn->r_vecs[i].rx_pkts;
467+
data[0] = nn->r_vecs[i].rx_pkts;
468468
tmp[0] = nn->r_vecs[i].hw_csum_rx_ok;
469469
tmp[1] = nn->r_vecs[i].hw_csum_rx_inner_ok;
470470
tmp[2] = nn->r_vecs[i].hw_csum_rx_error;
471471
} while (u64_stats_fetch_retry(&nn->r_vecs[i].rx_sync, start));
472472

473473
do {
474474
start = u64_stats_fetch_begin(&nn->r_vecs[i].tx_sync);
475-
*data++ = nn->r_vecs[i].tx_pkts;
476-
*data++ = nn->r_vecs[i].tx_busy;
475+
data[1] = nn->r_vecs[i].tx_pkts;
476+
data[2] = nn->r_vecs[i].tx_busy;
477477
tmp[3] = nn->r_vecs[i].hw_csum_tx;
478478
tmp[4] = nn->r_vecs[i].hw_csum_tx_inner;
479479
tmp[5] = nn->r_vecs[i].tx_gather;
480480
tmp[6] = nn->r_vecs[i].tx_lso;
481481
} while (u64_stats_fetch_retry(&nn->r_vecs[i].tx_sync, start));
482482

483+
data += 3;
484+
483485
for (j = 0; j < NN_ET_RVEC_GATHER_STATS; j++)
484486
gathered_stats[j] += tmp[j];
485487
}

0 commit comments

Comments
 (0)