DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] i40e: Fix the statistics issue of i40e
@ 2015-10-29  3:26 Xutao Sun
  2015-10-29  5:36 ` [dpdk-dev] [PATCH v2] " Xutao Sun
  0 siblings, 1 reply; 17+ messages in thread
From: Xutao Sun @ 2015-10-29  3:26 UTC (permalink / raw)
  To: dev

The old statistics on i40e only count the packets on ports.
This patch is to make statistics for packets both on ports and VSI.
But there're still some issues about statistics for 'bytes'.

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

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..a8d7116 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->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   = ns->eth.rx_bytes;
 	stats->obytes   = ns->eth.tx_bytes;
-	stats->oerrors  = ns->eth.tx_errors;
-	stats->imcasts  = ns->eth.rx_multicast;
+	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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v2] i40e: Fix the statistics issue of i40e
  2015-10-29  3:26 [dpdk-dev] [PATCH v1] i40e: Fix the statistics issue of i40e Xutao Sun
@ 2015-10-29  5:36 ` Xutao Sun
  2015-10-29  8:02   ` [dpdk-dev] [PATCH v3 0/2] " Xutao Sun
  0 siblings, 1 reply; 17+ messages in thread
From: Xutao Sun @ 2015-10-29  5:36 UTC (permalink / raw)
  To: dev

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(-)

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 *******************");
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
  2015-10-29  5:36 ` [dpdk-dev] [PATCH v2] " Xutao Sun
@ 2015-10-29  8:02   ` Xutao Sun
  2015-10-29  8:02     ` [dpdk-dev] [PATCH v3 1/2] " Xutao Sun
                       ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Xutao Sun @ 2015-10-29  8:02 UTC (permalink / raw)
  To: dev

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(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v3 1/2] i40e: Fix the statistics issue of i40e
  2015-10-29  8:02   ` [dpdk-dev] [PATCH v3 0/2] " Xutao Sun
@ 2015-10-29  8:02     ` Xutao Sun
  2015-10-29  8:02     ` [dpdk-dev] [PATCH v3 2/2] doc: update release notes Xutao Sun
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Xutao Sun @ 2015-10-29  8:02 UTC (permalink / raw)
  To: dev

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>
---
v2:
 - reword comments

 drivers/net/i40e/i40e_ethdev.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

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 *******************");
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v3 2/2] doc: update release notes
  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     ` Xutao Sun
  2015-10-29  8:19     ` [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e Thomas Monjalon
                       ` (2 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Xutao Sun @ 2015-10-29  8:02 UTC (permalink / raw)
  To: dev

Update release notes with the newly resolved issues about statistics on i40e.

Signed-off-by: Xutao Sun <xutao.sun@intel.com>
---
 doc/guides/rel_notes/release_2_1.rst | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/guides/rel_notes/release_2_1.rst b/doc/guides/rel_notes/release_2_1.rst
index 103a5ee..897f939 100644
--- a/doc/guides/rel_notes/release_2_1.rst
+++ b/doc/guides/rel_notes/release_2_1.rst
@@ -676,6 +676,11 @@ Resolved Issues
 * **i40e: Fix registers access from big endian CPU.**
 
 
+* **i40e: Fix statistics of packets.**
+
+  Add discarding packets on VSI to the stats and rectify the old statistics.
+
+
 * **i40evf: Clear command when error occurs.**
 
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
  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     ` 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
  4 siblings, 1 reply; 17+ messages in thread
From: Thomas Monjalon @ 2015-10-29  8:19 UTC (permalink / raw)
  To: Xutao Sun; +Cc: dev

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 :)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
  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
  0 siblings, 0 replies; 17+ messages in thread
From: Sun, Xutao @ 2015-10-29  8:32 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e
  2015-10-29  8:02   ` [dpdk-dev] [PATCH v3 0/2] " Xutao Sun
                       ` (2 preceding siblings ...)
  2015-10-29  8:19     ` [dpdk-dev] [PATCH v3 0/2] i40e: Fix the statistics issue of i40e Thomas Monjalon
@ 2015-10-29  9:52     ` Van Haaren, Harry
  2015-10-30  6:09     ` [dpdk-dev] [PATCH v4] " Xutao Sun
  4 siblings, 0 replies; 17+ messages in thread
From: Van Haaren, Harry @ 2015-10-29  9:52 UTC (permalink / raw)
  To: Sun, Xutao, dev

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v4] i40e: Fix the statistics issue of i40e
  2015-10-29  8:02   ` [dpdk-dev] [PATCH v3 0/2] " Xutao Sun
                       ` (3 preceding siblings ...)
  2015-10-29  9:52     ` Van Haaren, Harry
@ 2015-10-30  6:09     ` Xutao Sun
  2015-10-30  8:20       ` [dpdk-dev] [PATCH v5] " Xutao Sun
  4 siblings, 1 reply; 17+ messages in thread
From: Xutao Sun @ 2015-10-30  6:09 UTC (permalink / raw)
  To: dev

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

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

diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index 682f468..e80c20d 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -8,6 +8,10 @@ New Features
 Resolved Issues
 ---------------
 
+* **i40e: Fix statistics of packets.**
+
+  Add discarding packets on VSI to the stats and rectify the old statistics.
+
 
 Known Issues
 ------------
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 *******************");
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
  2015-10-30  6:09     ` [dpdk-dev] [PATCH v4] " Xutao Sun
@ 2015-10-30  8:20       ` Xutao Sun
  2015-10-30  8:26         ` Zhang, Helin
                           ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Xutao Sun @ 2015-10-30  8:20 UTC (permalink / raw)
  To: dev

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(-)

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 *******************");
-- 
1.9.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
  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  9:20         ` [dpdk-dev] [PATCH v6] " Xutao Sun
  2 siblings, 0 replies; 17+ messages in thread
From: Zhang, Helin @ 2015-10-30  8:26 UTC (permalink / raw)
  To: Sun, Xutao, dev



> -----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>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
  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:20         ` [dpdk-dev] [PATCH v6] " Xutao Sun
  2 siblings, 1 reply; 17+ messages in thread
From: Thomas Monjalon @ 2015-11-02 23:34 UTC (permalink / raw)
  To: Xutao Sun; +Cc: dev

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
  2015-11-02 23:34         ` Thomas Monjalon
@ 2015-11-04  4:23           ` Sun, Xutao
  2015-11-04  9:21             ` Thomas Monjalon
  0 siblings, 1 reply; 17+ messages in thread
From: Sun, Xutao @ 2015-11-04  4:23 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH v6] i40e: Fix the statistics issue of i40e
  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  9:20         ` Xutao Sun
  2015-11-04 10:06           ` Van Haaren, Harry
  2 siblings, 1 reply; 17+ messages in thread
From: Xutao Sun @ 2015-11-04  9:20 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v5] i40e: Fix the statistics issue of i40e
  2015-11-04  4:23           ` Sun, Xutao
@ 2015-11-04  9:21             ` Thomas Monjalon
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2015-11-04  9:21 UTC (permalink / raw)
  To: Sun, Xutao; +Cc: dev

> > 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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v6] i40e: Fix the statistics issue of i40e
  2015-11-04  9:20         ` [dpdk-dev] [PATCH v6] " Xutao Sun
@ 2015-11-04 10:06           ` Van Haaren, Harry
  2015-11-04 12:12             ` Thomas Monjalon
  0 siblings, 1 reply; 17+ messages in thread
From: Van Haaren, Harry @ 2015-11-04 10:06 UTC (permalink / raw)
  To: Sun, Xutao, dev

> From: Sun, Xutao
> Sent: Wednesday, November 4, 2015 9:21 AM
> To: dev@dpdk.org
> Cc: Zhang, Helin; Van Haaren, Harry; Sun, Xutao
> Subject: [PATCH v6] 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: Harry van Haaren <harry.van.haaren@intel.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH v6] i40e: Fix the statistics issue of i40e
  2015-11-04 10:06           ` Van Haaren, Harry
@ 2015-11-04 12:12             ` Thomas Monjalon
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2015-11-04 12:12 UTC (permalink / raw)
  To: Sun, Xutao; +Cc: dev

> > 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>

Applied, thanks

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-11-04 12:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29  3:26 [dpdk-dev] [PATCH v1] i40e: Fix the statistics issue of i40e 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         ` [dpdk-dev] [PATCH v6] " Xutao Sun
2015-11-04 10:06           ` Van Haaren, Harry
2015-11-04 12:12             ` Thomas Monjalon

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).