[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 zhe.tao at intel.com
Thu Jul 9 08:09:00 CEST 2015


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);
 }
 
 static int
-- 
1.9.3



More information about the dev mailing list