From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 9A000569A for ; Thu, 9 Jul 2015 08:09:10 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 08 Jul 2015 23:09:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,437,1432623600"; d="scan'208";a="725517668" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 08 Jul 2015 23:09:08 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t69696MO024883; Thu, 9 Jul 2015 14:09:06 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t69692jR029058; Thu, 9 Jul 2015 14:09:05 +0800 Received: (from zhetao@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t69692EI029054; Thu, 9 Jul 2015 14:09:02 +0800 From: Zhe Tao To: dev@dpdk.org Date: Thu, 9 Jul 2015 14:09:00 +0800 Message-Id: <1436422141-29024-1-git-send-email-zhe.tao@intel.com> X-Mailer: git-send-email 1.7.4.1 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 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2015 06:09:11 -0000 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 --- 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