DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xutao Sun <xutao.sun@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v6] i40e: Fix the statistics issue of i40e
Date: Wed,  4 Nov 2015 17:20:48 +0800	[thread overview]
Message-ID: <1446628848-31835-1-git-send-email-xutao.sun@intel.com> (raw)
In-Reply-To: <1446193240-2223-1-git-send-email-xutao.sun@intel.com>

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
v6:
 - rebase on Harry's patches

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

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index ca8471b..e012ccf 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -134,6 +134,11 @@ 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.**
+
+  Fixed the issue in i40e of statistics. 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.
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 34acc8c..df9db04 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -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 *******************");
-- 
1.9.3

  parent reply	other threads:[~2015-11-04  9:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29  3:26 [dpdk-dev] [PATCH v1] " Xutao Sun
2015-10-29  5:36 ` [dpdk-dev] [PATCH v2] " Xutao Sun
2015-10-29  8:02   ` [dpdk-dev] [PATCH v3 0/2] " Xutao Sun
2015-10-29  8:02     ` [dpdk-dev] [PATCH v3 1/2] " Xutao Sun
2015-10-29  8:02     ` [dpdk-dev] [PATCH v3 2/2] doc: update release notes Xutao Sun
2015-10-29  8:19     ` [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e Thomas Monjalon
2015-10-29  8:32       ` Sun, Xutao
2015-10-29  9:52     ` Van Haaren, Harry
2015-10-30  6:09     ` [dpdk-dev] [PATCH v4] " Xutao Sun
2015-10-30  8:20       ` [dpdk-dev] [PATCH v5] " Xutao Sun
2015-10-30  8:26         ` Zhang, Helin
2015-11-02 23:34         ` Thomas Monjalon
2015-11-04  4:23           ` Sun, Xutao
2015-11-04  9:21             ` Thomas Monjalon
2015-11-04  9:20         ` Xutao Sun [this message]
2015-11-04 10:06           ` [dpdk-dev] [PATCH v6] " Van Haaren, Harry
2015-11-04 12:12             ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446628848-31835-1-git-send-email-xutao.sun@intel.com \
    --to=xutao.sun@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).