DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40e: fix resetting of stats
@ 2015-11-05 12:52 Harry van Haaren
  2015-11-05 12:56 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
  0 siblings, 1 reply; 6+ messages in thread
From: Harry van Haaren @ 2015-11-05 12:52 UTC (permalink / raw)
  To: dev; +Cc: Harry van Haaren

This patch fixes a bug where only some of the statistics were being reset
when calling rte_eth_stats_reset() or rte_eth_xstats_reset().

This patch marks the VSI to update its offset, causing the stats be look
like they are reset.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Harry van Haaren <harry.van.haaren@gmail.com>
---
 drivers/net/i40e/i40e_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..70c1674 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2129,14 +2129,15 @@ i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_hw_port_stats *hw_stats = &pf->stats;
+	/*struct i40e_hw_port_stats *hw_stats = &pf->stats;*/
 
-	/* The hw registers are cleared on read */
+	/* Mark PF and VSI stats to update the offset, aka "reset" */
 	pf->offset_loaded = false;
-	i40e_read_stats_registers(pf, hw);
+	if (pf->main_vsi)
+		pf->main_vsi->offset_loaded = false;
 
-	/* reset software counters */
-	memset(hw_stats, 0, sizeof(*hw_stats));
+	/* read the stats, reading current register values into offset */
+	i40e_read_stats_registers(pf, hw);
 }
 
 static int
-- 
1.9.1

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

* [dpdk-dev] [PATCH v2] i40e: fix resetting of stats
  2015-11-05 12:52 [dpdk-dev] [PATCH] i40e: fix resetting of stats Harry van Haaren
@ 2015-11-05 12:56 ` Harry van Haaren
  2015-11-08  7:40   ` Tahhan, Maryam
  2015-11-09 10:13   ` [dpdk-dev] [PATCH v3] " Harry van Haaren
  0 siblings, 2 replies; 6+ messages in thread
From: Harry van Haaren @ 2015-11-05 12:56 UTC (permalink / raw)
  To: dev; +Cc: Harry van Haaren

This patch fixes a bug where only some of the statistics were being reset
when calling rte_eth_stats_reset() or rte_eth_xstats_reset().

This patch marks the VSI to update its offset, causing the stats be look
like they are reset.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Harry van Haaren <harry.van.haaren@gmail.com>
---

v2: Remove commented code

 drivers/net/i40e/i40e_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..7e18ba7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2129,14 +2129,14 @@ i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_hw_port_stats *hw_stats = &pf->stats;
 
-	/* The hw registers are cleared on read */
+	/* Mark PF and VSI stats to update the offset, aka "reset" */
 	pf->offset_loaded = false;
-	i40e_read_stats_registers(pf, hw);
+	if (pf->main_vsi)
+		pf->main_vsi->offset_loaded = false;
 
-	/* reset software counters */
-	memset(hw_stats, 0, sizeof(*hw_stats));
+	/* read the stats, reading current register values into offset */
+	i40e_read_stats_registers(pf, hw);
 }
 
 static int
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v2] i40e: fix resetting of stats
  2015-11-05 12:56 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
@ 2015-11-08  7:40   ` Tahhan, Maryam
  2015-11-09 10:13   ` [dpdk-dev] [PATCH v3] " Harry van Haaren
  1 sibling, 0 replies; 6+ messages in thread
From: Tahhan, Maryam @ 2015-11-08  7:40 UTC (permalink / raw)
  To: Van Haaren, Harry, dev; +Cc: Harry van Haaren

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Harry van Haaren
> Sent: Thursday, November 5, 2015 12:56 PM
> To: dev@dpdk.org
> Cc: Harry van Haaren <harry.van.haaren@gmail.com>
> Subject: [dpdk-dev] [PATCH v2] i40e: fix resetting of stats
> 
> This patch fixes a bug where only some of the statistics were being reset when
> calling rte_eth_stats_reset() or rte_eth_xstats_reset().
> 
> This patch marks the VSI to update its offset, causing the stats be look like they
> are reset.
> 
> Fixes: 9aace75fc82e ("i40e: fix statistics")
> 
> Signed-off-by: Harry van Haaren <harry.van.haaren@gmail.com>
> ---

Acked-by: Maryam Tahhan <maryam.tahhan@intel.com>

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

* [dpdk-dev] [PATCH v3] i40e: fix resetting of stats
  2015-11-05 12:56 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
  2015-11-08  7:40   ` Tahhan, Maryam
@ 2015-11-09 10:13   ` Harry van Haaren
  2015-11-09 10:22     ` Harry van Haaren
  1 sibling, 1 reply; 6+ messages in thread
From: Harry van Haaren @ 2015-11-09 10:13 UTC (permalink / raw)
  To: dev; +Cc: Harry van Haaren

This patch fixes a bug where only some of the statistics were being
reset when calling rte_eth_stats_reset() or rte_eth_xstats_reset().
As both the stats reset and xstats reset do the same, refactor away
the duplicated function.

This patch marks the VSI to update its offset, causing the stats be
look like they are reset.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Harry van Haaren <harry.van.haaren@gmail.com>
---

v3: Refactor away function, fixing stats and xstats reset
v2: Remove commented code


 drivers/net/i40e/i40e_ethdev.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..e7f1fc7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -426,7 +426,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_get                    = i40e_dev_stats_get,
 	.xstats_get                   = i40e_dev_xstats_get,
 	.stats_reset                  = i40e_dev_stats_reset,
-	.xstats_reset                 = i40e_dev_xstats_reset,
+	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
 	.dev_infos_get                = i40e_dev_info_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2124,19 +2124,20 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	PMD_DRV_LOG(DEBUG, "***************** PF stats end ********************");
 }
 
+/* Reset the statistics */
 static void
-i40e_dev_xstats_reset(struct rte_eth_dev *dev)
+i40e_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_hw_port_stats *hw_stats = &pf->stats;
 
-	/* The hw registers are cleared on read */
+	/* Mark PF and VSI stats to update the offset, aka "reset" */
 	pf->offset_loaded = false;
-	i40e_read_stats_registers(pf, hw);
+	if (pf->main_vsi)
+		pf->main_vsi->offset_loaded = false;
 
-	/* reset software counters */
-	memset(hw_stats, 0, sizeof(*hw_stats));
+	/* read the stats, reading current register values into offset */
+	i40e_read_stats_registers(pf, hw);
 }
 
 static int
@@ -2216,16 +2217,6 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
 	return I40E_NB_XSTATS;
 }
 
-/* Reset the statistics */
-static void
-i40e_dev_stats_reset(struct rte_eth_dev *dev)
-{
-	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-
-	/* It results in reloading the start point of each counter */
-	pf->offset_loaded = false;
-}
-
 static int
 i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 				 __rte_unused uint16_t queue_id,
-- 
1.9.1

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

* [dpdk-dev] [PATCH v3] i40e: fix resetting of stats
  2015-11-09 10:13   ` [dpdk-dev] [PATCH v3] " Harry van Haaren
@ 2015-11-09 10:22     ` Harry van Haaren
  2015-11-10 16:45       ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Harry van Haaren @ 2015-11-09 10:22 UTC (permalink / raw)
  To: dev

This patch fixes a bug where only some of the statistics were being
reset when calling rte_eth_stats_reset() or rte_eth_xstats_reset().
As both the stats reset and xstats reset do the same, refactor away
the duplicated function.

This patch marks the VSI to update its offset, causing the stats be
look like they are reset.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Maryam Tahhan <maryam.tahhan@intel.com>
---

v4: Add previous ack, remove uneccessary function prototype
v3: Refactor away function, fixing stats and xstats reset
v2: Remove commented code

 drivers/net/i40e/i40e_ethdev.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..5e707d1 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -288,7 +288,6 @@ static void i40e_dev_stats_get(struct rte_eth_dev *dev,
 static int i40e_dev_xstats_get(struct rte_eth_dev *dev,
 			       struct rte_eth_xstats *xstats, unsigned n);
 static void i40e_dev_stats_reset(struct rte_eth_dev *dev);
-static void i40e_dev_xstats_reset(struct rte_eth_dev *dev);
 static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
 					    uint16_t queue_id,
 					    uint8_t stat_idx,
@@ -426,7 +425,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
 	.stats_get                    = i40e_dev_stats_get,
 	.xstats_get                   = i40e_dev_xstats_get,
 	.stats_reset                  = i40e_dev_stats_reset,
-	.xstats_reset                 = i40e_dev_xstats_reset,
+	.xstats_reset                 = i40e_dev_stats_reset,
 	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
 	.dev_infos_get                = i40e_dev_info_get,
 	.vlan_filter_set              = i40e_vlan_filter_set,
@@ -2124,19 +2123,20 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	PMD_DRV_LOG(DEBUG, "***************** PF stats end ********************");
 }
 
+/* Reset the statistics */
 static void
-i40e_dev_xstats_reset(struct rte_eth_dev *dev)
+i40e_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_hw_port_stats *hw_stats = &pf->stats;
 
-	/* The hw registers are cleared on read */
+	/* Mark PF and VSI stats to update the offset, aka "reset" */
 	pf->offset_loaded = false;
-	i40e_read_stats_registers(pf, hw);
+	if (pf->main_vsi)
+		pf->main_vsi->offset_loaded = false;
 
-	/* reset software counters */
-	memset(hw_stats, 0, sizeof(*hw_stats));
+	/* read the stats, reading current register values into offset */
+	i40e_read_stats_registers(pf, hw);
 }
 
 static int
@@ -2216,16 +2216,6 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,
 	return I40E_NB_XSTATS;
 }
 
-/* Reset the statistics */
-static void
-i40e_dev_stats_reset(struct rte_eth_dev *dev)
-{
-	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-
-	/* It results in reloading the start point of each counter */
-	pf->offset_loaded = false;
-}
-
 static int
 i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
 				 __rte_unused uint16_t queue_id,
-- 
1.9.1

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

* Re: [dpdk-dev] [PATCH v3] i40e: fix resetting of stats
  2015-11-09 10:22     ` Harry van Haaren
@ 2015-11-10 16:45       ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-11-10 16:45 UTC (permalink / raw)
  To: Harry van Haaren; +Cc: dev

2015-11-09 10:22, Harry van Haaren:
> This patch fixes a bug where only some of the statistics were being
> reset when calling rte_eth_stats_reset() or rte_eth_xstats_reset().
> As both the stats reset and xstats reset do the same, refactor away
> the duplicated function.
> 
> This patch marks the VSI to update its offset, causing the stats be
> look like they are reset.
> 
> Fixes: 9aace75fc82e ("i40e: fix statistics")
> 
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> Acked-by: Maryam Tahhan <maryam.tahhan@intel.com>

Applied, thanks

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

end of thread, other threads:[~2015-11-10 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 12:52 [dpdk-dev] [PATCH] i40e: fix resetting of stats Harry van Haaren
2015-11-05 12:56 ` [dpdk-dev] [PATCH v2] " Harry van Haaren
2015-11-08  7:40   ` Tahhan, Maryam
2015-11-09 10:13   ` [dpdk-dev] [PATCH v3] " Harry van Haaren
2015-11-09 10:22     ` Harry van Haaren
2015-11-10 16:45       ` 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).