From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id DEC097CE2; Mon, 21 Aug 2017 14:43:01 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2017 05:43:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,409,1498546800"; d="scan'208";a="302632165" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.57]) ([10.237.220.57]) by fmsmga004.fm.intel.com with ESMTP; 21 Aug 2017 05:42:59 -0700 To: Qi Zhang , jingjing.wu@intel.com Cc: dev@dpdk.org, stable@dpdk.org References: <20170820200535.25987-1-qi.z.zhang@intel.com> From: Ferruh Yigit Message-ID: <5a9052eb-a49e-bc14-1f1a-70a468b148fb@intel.com> Date: Mon, 21 Aug 2017 13:42:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170820200535.25987-1-qi.z.zhang@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net/i40e: fix packet count for PF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2017 12:43:02 -0000 On 8/20/2017 9:05 PM, Qi Zhang wrote: > Previously, for PF statistics we use VSI register for packet count > but use port's register for packet bytes, that cause inconsistent > situation of PF statistics when some VF is active, since it will > cover VF's packet bytes but not packet count. > The patch will take port register for PF packet count back, but still > exclude main vsi's discard packet count. > Just like pervious fix, its still not perfect,(since RX packet number > is over counted when there is VF discard packet) but seems it make the > overall better). What does Linux do for stats calculation? I believe it is good to be consistent with it. > > Fixes: 9aace75fc82e ("i40e: fix statistics") > Cc: stable@dpdk.org > > Signed-off-by: Qi Zhang > --- > drivers/net/i40e/i40e_ethdev.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 5f26e24..63acbb8 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -2664,13 +2664,14 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > /* call read registers - updates values, now write them to struct */ > i40e_read_stats_registers(pf, hw); > > - stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + > - pf->main_vsi->eth_stats.rx_multicast + > - pf->main_vsi->eth_stats.rx_broadcast - > + stats->ipackets = ns->eth.rx_unicast + > + ns->eth.rx_multicast + > + ns->eth.rx_broadcast - > + ns->eth.rx_discards - > pf->main_vsi->eth_stats.rx_discards; Both port rx_discards and PF rx_discards excluded, is this intentional? Won't this cause double exclusion of some rx_discards packets? > - stats->opackets = pf->main_vsi->eth_stats.tx_unicast + > - pf->main_vsi->eth_stats.tx_multicast + > - pf->main_vsi->eth_stats.tx_broadcast; > + stats->opackets = ns->eth.tx_unicast + > + ns->eth.tx_multicast + > + ns->eth.tx_broadcast; > stats->ibytes = ns->eth.rx_bytes; > stats->obytes = ns->eth.tx_bytes; > stats->oerrors = ns->eth.tx_errors + >