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 301016880 for ; Fri, 21 Nov 2014 08:57:16 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 21 Nov 2014 00:07:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,429,1413270000"; d="scan'208";a="635761351" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 21 Nov 2014 00:07:17 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id sAL87F9w008239; Fri, 21 Nov 2014 16:07:15 +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 sAL87DrS002767; Fri, 21 Nov 2014 16:07:15 +0800 Received: (from zzang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id sAL87Dw7002763; Fri, 21 Nov 2014 16:07:13 +0800 From: zhida zang To: dev@dpdk.org Date: Fri, 21 Nov 2014 16:07:11 +0800 Message-Id: <1416557231-2732-1-git-send-email-zhida.zang@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH v3] i40e: fixed tx packets stats bug 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: Fri, 21 Nov 2014 07:57:18 -0000 v3 changes: -updated commit log -fixed the bug that stats data can't be cleared Signed-off-by: Zhida Zang --- lib/librte_pmd_i40e/i40e_ethdev.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 4b7a827..c1ea37e 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -1102,6 +1102,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */ struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */ + struct i40e_eth_stats *ves = &pf->main_vsi->eth_stats; /* vsi stats */ /* Get statistics of struct i40e_eth_stats */ i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), @@ -1277,15 +1278,18 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* GLPRT_MSPDC not supported */ /* GLPRT_XEC not supported */ - pf->offset_loaded = true; - if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); stats->ipackets = ns->eth.rx_unicast + ns->eth.rx_multicast + ns->eth.rx_broadcast; - stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + + if (pf->offset_loaded) + stats->opackets = ves->tx_unicast + ves->tx_multicast + + ves->tx_broadcast; + else + stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + ns->eth.tx_broadcast; + pf->offset_loaded = true; stats->ibytes = ns->eth.rx_bytes; stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors; -- 1.9.3