[1/2] net/netvsc: set id in xstats_get

Message ID 20190620220924.32079-2-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/netvsc: xstat fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues

Commit Message

Stephen Hemminger June 20, 2019, 10:09 p.m. UTC
  From: Mohsin Mazhar Shaikh <mohsinmazhar_shaikh@trendmicro.com>

The xstats_get was not setting id correctly for each entry.

Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Signed-off-by: Mohsin Mazhar Shaikh <mohsinmazhar_shaikh@trendmicro.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/netvsc/hn_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 9e7cf2df5472..d37db7c6a232 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -577,9 +577,11 @@  hn_dev_xstats_get(struct rte_eth_dev *dev,
 			continue;
 
 		stats = (const char *)&txq->stats;
-		for (t = 0; t < RTE_DIM(hn_stat_strings); t++)
-			xstats[count++].value = *(const uint64_t *)
+		for (t = 0; t < RTE_DIM(hn_stat_strings); t++, count++) {
+			xstats[count].id = count;
+			xstats[count].value = *(const uint64_t *)
 				(stats + hn_stat_strings[t].offset);
+		}
 	}
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -589,9 +591,11 @@  hn_dev_xstats_get(struct rte_eth_dev *dev,
 			continue;
 
 		stats = (const char *)&rxq->stats;
-		for (t = 0; t < RTE_DIM(hn_stat_strings); t++)
-			xstats[count++].value = *(const uint64_t *)
+		for (t = 0; t < RTE_DIM(hn_stat_strings); t++, count++) {
+			xstats[count].id = count;
+			xstats[count].value = *(const uint64_t *)
 				(stats + hn_stat_strings[t].offset);
+		}
 	}
 
 	ret = hn_vf_xstats_get(dev, xstats + count, n - count);