Commit 99c472a3 authored by Catherine Sullivan's avatar Catherine Sullivan Committed by Jeff Kirsher

i40e: Tweak for-loop in i40e_ethtool.c

Tweak a for-loop to make it easier to add conditional stats in the future.
Signed-off-by: default avatarCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 7c122007
...@@ -649,7 +649,7 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, ...@@ -649,7 +649,7 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
sizeof(u64)) ? *(u64 *)p : *(u32 *)p; sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
} }
rcu_read_lock(); rcu_read_lock();
for (j = 0; j < vsi->num_queue_pairs; j++, i += 4) { for (j = 0; j < vsi->num_queue_pairs; j++) {
struct i40e_ring *tx_ring = ACCESS_ONCE(vsi->tx_rings[j]); struct i40e_ring *tx_ring = ACCESS_ONCE(vsi->tx_rings[j]);
struct i40e_ring *rx_ring; struct i40e_ring *rx_ring;
...@@ -662,14 +662,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev, ...@@ -662,14 +662,16 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
data[i] = tx_ring->stats.packets; data[i] = tx_ring->stats.packets;
data[i + 1] = tx_ring->stats.bytes; data[i + 1] = tx_ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&tx_ring->syncp, start)); } while (u64_stats_fetch_retry_irq(&tx_ring->syncp, start));
i += 2;
/* Rx ring is the 2nd half of the queue pair */ /* Rx ring is the 2nd half of the queue pair */
rx_ring = &tx_ring[1]; rx_ring = &tx_ring[1];
do { do {
start = u64_stats_fetch_begin_irq(&rx_ring->syncp); start = u64_stats_fetch_begin_irq(&rx_ring->syncp);
data[i + 2] = rx_ring->stats.packets; data[i] = rx_ring->stats.packets;
data[i + 3] = rx_ring->stats.bytes; data[i + 1] = rx_ring->stats.bytes;
} while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start)); } while (u64_stats_fetch_retry_irq(&rx_ring->syncp, start));
i += 2;
} }
rcu_read_unlock(); rcu_read_unlock();
if (vsi == pf->vsi[pf->lan_vsi]) { if (vsi == pf->vsi[pf->lan_vsi]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment