i40e: fix statistics
authorXutao Sun <xutao.sun@intel.com>
Wed, 4 Nov 2015 09:20:48 +0000 (17:20 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 4 Nov 2015 12:11:56 +0000 (13:11 +0100)
The old statistics on i40e only counted the packets on ports.
So the discarding packets on VSI were not counted.
This patch is to make statistics for packets both on ports and VSI.
Also update release notes.

Signed-off-by: Xutao Sun <xutao.sun@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
doc/guides/rel_notes/release_2_2.rst
drivers/net/i40e/i40e_ethdev.c

index ca8471b..b7ab27a 100644 (file)
@@ -134,6 +134,10 @@ Drivers
   as long as the total number of queues used in PF, VFs, VMDq and FD does not
   exceeds the hardware maximum.
 
+* **i40e: Fixed statistics of packets.**
+
+  Added discarding packets on VSI to the stats and rectify the old statistics.
+
 * **vhost: Fixed Qemu shutdown.**
 
   Fixed issue with libvirt ``virsh destroy`` not killing the VM.
index 34acc8c..df9db04 100644 (file)
@@ -1858,21 +1858,26 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        /* call read registers - updates values, now write them to struct */
        i40e_read_stats_registers(pf, hw);
 
-       stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast +
-                                               ns->eth.rx_broadcast;
-       stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast +
-                                               ns->eth.tx_broadcast;
-       stats->ibytes   = ns->eth.rx_bytes;
-       stats->obytes   = ns->eth.tx_bytes;
-       stats->oerrors  = ns->eth.tx_errors;
-       stats->imcasts  = ns->eth.rx_multicast;
+       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 = pf->main_vsi->eth_stats.tx_unicast +
+                       pf->main_vsi->eth_stats.tx_multicast +
+                       pf->main_vsi->eth_stats.tx_broadcast;
+       stats->ibytes   = pf->main_vsi->eth_stats.rx_bytes;
+       stats->obytes   = pf->main_vsi->eth_stats.tx_bytes;
+       stats->oerrors  = ns->eth.tx_errors +
+                       pf->main_vsi->eth_stats.tx_errors;
+       stats->imcasts  = pf->main_vsi->eth_stats.rx_multicast;
        stats->fdirmatch = ns->fd_sb_match;
 
        /* Rx Errors */
        stats->ibadcrc  = ns->crc_errors;
        stats->ibadlen  = ns->rx_length_errors + ns->rx_undersize +
                        ns->rx_oversize + ns->rx_fragments + ns->rx_jabber;
-       stats->imissed  = ns->eth.rx_discards;
+       stats->imissed  = ns->eth.rx_discards +
+                       pf->main_vsi->eth_stats.rx_discards;
        stats->ierrors  = stats->ibadcrc + stats->ibadlen + stats->imissed;
 
        PMD_DRV_LOG(DEBUG, "***************** PF stats start *******************");