[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

Zhang, Helin helin.zhang at intel.com
Mon Aug 3 19:35:15 CEST 2015



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Zhe Tao
> Sent: Wednesday, July 8, 2015 11:09 PM
> To: dev at 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 at 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



More information about the dev mailing list