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

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

Commit Message

Xutao Sun Oct. 29, 2015, 5:36 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.

Signed-off-by: Xutao Sun <xutao.sun@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
  

Comments

Xutao Sun Oct. 29, 2015, 8:02 a.m. UTC | #1
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.

v2 changes:
Reword comments.

v3 changes:
Update documentation.

Xutao Sun (2):
  i40e: Fix the statistics issue of i40e
  doc: update release notes

 doc/guides/rel_notes/release_2_1.rst |  5 +++++
 drivers/net/i40e/i40e_ethdev.c       | 23 ++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
  
Thomas Monjalon Oct. 29, 2015, 8:19 a.m. UTC | #2
Hi,

> Xutao Sun (2):
>   i40e: Fix the statistics issue of i40e
>   doc: update release notes

It is not needed to have a separate commit for the documentation in this case.
Thanks for considering it next time :)
  
Xutao Sun Oct. 29, 2015, 8:32 a.m. UTC | #3
Hi, Thomas

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, October 29, 2015 4:19 PM
> To: Sun, Xutao
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
> 
> Hi,
> 
> > Xutao Sun (2):
> >   i40e: Fix the statistics issue of i40e
> >   doc: update release notes
> 
> It is not needed to have a separate commit for the documentation in this
> case.
> Thanks for considering it next time :)

OK. Thank you for your advice.

Thanks,
Xutao
  
Van Haaren, Harry Oct. 29, 2015, 9:52 a.m. UTC | #4
Hi Xutao,

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xutao Sun
> Sent: Thursday, October 29, 2015 8:02 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 0/2] 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.

Indeed there is an issue in i40e stats, and adding the VSI stats to the port stats seems the right fix.

> Xutao Sun (2):
>   i40e: Fix the statistics issue of i40e
>   doc: update release notes
> 
>  doc/guides/rel_notes/release_2_1.rst |  5 +++++
>  drivers/net/i40e/i40e_ethdev.c       | 23 ++++++++++++++---------
>  2 files changed, 19 insertions(+), 9 deletions(-)

It is preferred to update docs in the same patch as a bugfix: one patch should suffice for a bug-fix and adding a note that it has been fixed.

Perhaps you edited the wrong release file? The next release changes are described in release_2_2.rst

Would you send a v4 with release_2_2 updated, and then I'll test and ack?
Cheers, -Harry
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..5e20fa7 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 *******************");