From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id BEE07DE6 for ; Thu, 5 Nov 2015 13:56:33 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 05 Nov 2015 04:56:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,247,1444719600"; d="scan'208";a="843240245" Received: from sie-lab-212-222.ir.intel.com (HELO silpixa00366884.ir.intel.com) ([10.237.212.222]) by orsmga002.jf.intel.com with ESMTP; 05 Nov 2015 04:56:31 -0800 From: Harry van Haaren To: dev@dpdk.org Date: Thu, 5 Nov 2015 12:56:29 +0000 Message-Id: <1446728189-24418-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446727941-17018-1-git-send-email-harry.van.haaren@intel.com> References: <1446727941-17018-1-git-send-email-harry.van.haaren@intel.com> Cc: Harry van Haaren Subject: [dpdk-dev] [PATCH v2] i40e: fix resetting of 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, 05 Nov 2015 12:56:34 -0000 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 --- 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