DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats
@ 2015-07-09  6:09 Zhe Tao
  2015-08-03 16:48 ` Thomas Monjalon
  2015-08-03 17:35 ` Zhang, Helin
  0 siblings, 2 replies; 3+ messages in thread
From: Zhe Tao @ 2015-07-09  6:09 UTC (permalink / raw)
  To: dev

Issue: When calling the reset API to reset all the stats for i40e,
all the stats will be untracked before the next time calling get stats API.
Once calling the get stats API it will show all the stats equal zero.

Changes: Calling the get stats API in the reset API will force the stats_offset update immediately  

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5fb6b4c..c9cc317 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1517,9 +1517,17 @@ static void
 i40e_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct rte_eth_stats stat = {0};
 
 	/* It results in reloading the start point of each counter */
 	pf->offset_loaded = false;
+
+	/*
+	* need to read the status one time right after reset the offset_loaded field
+	* prevent the stats data loss between the i40e_dev_stats_reset and i40e_dev_stats_get
+	*/
+
+	i40e_dev_stats_get(dev, &stat);
 }
 
 static int
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats
  2015-07-09  6:09 [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats Zhe Tao
@ 2015-08-03 16:48 ` Thomas Monjalon
  2015-08-03 17:35 ` Zhang, Helin
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-08-03 16:48 UTC (permalink / raw)
  To: helin.zhang; +Cc: dev

Helin, your review is needed.
Please check how to write a simple title.

2015-07-09 14:09, Zhe Tao:
> Issue: When calling the reset API to reset all the stats for i40e,
> all the stats will be untracked before the next time calling get stats API.
> Once calling the get stats API it will show all the stats equal zero.
> 
> Changes: Calling the get stats API in the reset API will force the stats_offset update immediately  
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
[...]
> +
> +	/*
> +	* need to read the status one time right after reset the offset_loaded field
> +	* prevent the stats data loss between the i40e_dev_stats_reset and i40e_dev_stats_get
> +	*/

This comment seems complicated to understand.

> +
> +	i40e_dev_stats_get(dev, &stat);

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

* Re: [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats
  2015-07-09  6:09 [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats Zhe Tao
  2015-08-03 16:48 ` Thomas Monjalon
@ 2015-08-03 17:35 ` Zhang, Helin
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Helin @ 2015-08-03 17:35 UTC (permalink / raw)
  To: Tao, Zhe, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhe Tao
> Sent: Wednesday, July 8, 2015 11:09 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e,
> the stats information will be lost before next time getting the stats
Please refer to other for a brief title! Basically the title should be brief enough.

> 
> Issue: When calling the reset API to reset all the stats for i40e, all the stats will be
> untracked before the next time calling get stats API.
> Once calling the get stats API it will show all the stats equal zero.
> 
> Changes: Calling the get stats API in the reset API will force the stats_offset
> update immediately
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 5fb6b4c..c9cc317 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -1517,9 +1517,17 @@ static void
>  i40e_dev_stats_reset(struct rte_eth_dev *dev)  {
>  	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> +	struct rte_eth_stats stat = {0};
> 
>  	/* It results in reloading the start point of each counter */
>  	pf->offset_loaded = false;
> +
> +	/*
> +	* need to read the status one time right after reset the offset_loaded field
> +	* prevent the stats data loss between the i40e_dev_stats_reset and
> i40e_dev_stats_get
> +	*/
> +
> +	i40e_dev_stats_get(dev, &stat);
I'd prefer to call "memset(hw_stats, 0, sizeof(*hw_stats));" as igb/ixgbe does.
Please also think of implement the similar reset function for i40evf.

Thank you!
Helin


>  }
> 
>  static int
> --
> 1.9.3

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

end of thread, other threads:[~2015-08-03 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09  6:09 [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats Zhe Tao
2015-08-03 16:48 ` Thomas Monjalon
2015-08-03 17:35 ` Zhang, Helin

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