net/ice: fix Rx statistics
authorSimei Su <simei.su@intel.com>
Wed, 24 Apr 2019 07:06:10 +0000 (15:06 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 3 May 2019 16:45:23 +0000 (18:45 +0200)
The RX stats will increase even no packets sent, this patch fix this issue
by modifying ipackets and ibytes statistics based on vsi instead of port
to avoid statistics error.

Fixes: a37bde56314d ("net/ice: support statistics")
Cc: stable@dpdk.org
Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index 429c2b6..cae7a9d 100644 (file)
@@ -3326,15 +3326,14 @@ ice_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        /* call read registers - updates values, now write them to struct */
        ice_read_stats_registers(pf, hw);
 
-       stats->ipackets = ns->eth.rx_unicast +
-                         ns->eth.rx_multicast +
-                         ns->eth.rx_broadcast -
-                         ns->eth.rx_discards -
+       stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
+                         pf->main_vsi->eth_stats.rx_multicast +
+                         pf->main_vsi->eth_stats.rx_broadcast -
                          pf->main_vsi->eth_stats.rx_discards;
        stats->opackets = ns->eth.tx_unicast +
                          ns->eth.tx_multicast +
                          ns->eth.tx_broadcast;
-       stats->ibytes   = ns->eth.rx_bytes;
+       stats->ibytes   = pf->main_vsi->eth_stats.rx_bytes;
        stats->obytes   = ns->eth.tx_bytes;
        stats->oerrors  = ns->eth.tx_errors +
                          pf->main_vsi->eth_stats.tx_errors;