[dpdk-dev,v5] i40e: Fix the statistics issue of i40e

Message ID 1446193240-2223-1-git-send-email-xutao.sun@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Xutao Sun Oct. 30, 2015, 8:20 a.m. UTC
  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>
---
v2:
 - reword comments
v3:
 - update release notes
v4:
 - fix the wrong release notes and move the doc as part of this patch
v5:
 - fix the patch_apply issue

 doc/guides/rel_notes/release_2_2.rst |  4 ++++
 drivers/net/i40e/i40e_ethdev.c       | 23 ++++++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)
  

Comments

Zhang, Helin Oct. 30, 2015, 8:26 a.m. UTC | #1
> -----Original Message-----
> From: Sun, Xutao
> Sent: Friday, October 30, 2015 4:21 PM
> To: dev@dpdk.org
> Cc: Zhang, Helin; Van Haaren, Harry; Sun, Xutao
> Subject: [PATCH v5] i40e: Fix the statistics issue of i40e
> 
> 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: Helin Zhang <helin.zhang@intel.com>
  
Thomas Monjalon Nov. 2, 2015, 11:34 p.m. UTC | #2
2015-10-30 16:20, Xutao Sun:
> 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.

Please, could you rebase on top of Harry's patches for extended stats?
Thanks
  
Xutao Sun Nov. 4, 2015, 4:23 a.m. UTC | #3
Hi, Thomas

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, November 03, 2015 7:35 AM
> To: Sun, Xutao
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
> 
> 2015-10-30 16:20, Xutao Sun:
> > 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.
> 
> Please, could you rebase on top of Harry's patches for extended stats?
> Thanks

My patch is different from Harry's patches for extended stats actually.
My modification for stats has no intersection with Harry's.
So maybe I don't  need to rebase on Harry's patches.

Regards,
Xutao
  
Thomas Monjalon Nov. 4, 2015, 9:21 a.m. UTC | #4
> > 2015-10-30 16:20, Xutao Sun:
> > > 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.
> > 
> > Please, could you rebase on top of Harry's patches for extended stats?
> > Thanks
> 
> My patch is different from Harry's patches for extended stats actually.
> My modification for stats has no intersection with Harry's.
> So maybe I don't  need to rebase on Harry's patches.

When I can manage the merge myself safely, I don't ask.
Please rebase on current master.
  

Patch

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 89e4d58..8991209 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -67,6 +67,10 @@  Drivers
   Fixed i40e issue that occurred when a DPDK application didn't initialize
   ports if memory wasn't available on socket 0.
 
+* **i40e: Fix statistics of packets.**
+
+  Add 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.
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2dd9fdc..5365192 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1511,21 +1511,26 @@  i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	if (pf->main_vsi)
 		i40e_update_vsi_stats(pf->main_vsi);
 
-	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 *******************");