From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5A3AB7CE2; Fri, 2 Jun 2017 02:23:17 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP; 01 Jun 2017 17:23:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,281,1493708400"; d="scan'208";a="1137116089" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 01 Jun 2017 17:23:16 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 1 Jun 2017 17:23:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Fri, 2 Jun 2017 08:23:13 +0800 From: "Zhang, Qi Z" To: "Xing, Beilei" , "Wu, Jingjing" , "Zhang, Helin" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count Thread-Index: AQHS2pxZ/8EfpCXTJUKneOJdBZJsjaIPMyqAgAGEVDA= Date: Fri, 2 Jun 2017 00:23:13 +0000 Message-ID: <039ED4275CED7440929022BC67E70611530A7156@SHSMSX103.ccr.corp.intel.com> References: <1496271207-36688-1-git-send-email-qi.z.zhang@intel.com> <94479800C636CB44BD422CB454846E0131FBF93D@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <94479800C636CB44BD422CB454846E0131FBF93D@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte count 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: Fri, 02 Jun 2017 00:23:19 -0000 > -----Original Message----- > From: Xing, Beilei > Sent: Thursday, June 1, 2017 5:13 PM > To: Zhang, Qi Z ; Wu, Jingjing > ; Zhang, Helin > Cc: dev@dpdk.org; Zhang, Qi Z ; stable@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte > count >=20 > Hi Qi, >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qi Zhang > > Sent: Thursday, June 1, 2017 6:53 AM > > To: Wu, Jingjing ; Zhang, Helin > > > > Cc: dev@dpdk.org; Zhang, Qi Z ; stable@dpdk.org > > Subject: [dpdk-dev] [PATCH] net/i40e: exclude internal packet's byte > > count > > > > Tx/Rx byte counts of internal managed packet should be exluded from > > the total rx/tx bytes. > > > > Fixes: 9aace75fc82e ("i40e: fix statistics") > > Cc: stable@dpdk.org > > > > Signed-off-by: Qi Zhang > > --- > > drivers/net/i40e/i40e_ethdev.c | 13 +++++++++++-- > > drivers/net/i40e/i40e_ethdev.h | 5 +++++ > > 2 files changed, 16 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 4c49673..c8802f2 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -2379,6 +2379,15 @@ i40e_read_stats_registers(struct i40e_pf *pf, > > struct i40e_hw *hw) > > struct i40e_hw_port_stats *ns =3D &pf->stats; /* new stats */ > > struct i40e_hw_port_stats *os =3D &pf->stats_offset; /* old stats */ > > > > + /* Get rx/tx bytes of internal transfer packets */ > > + i40e_stat_update_48(hw, I40E_GLV_GORCH(hw->port), > > I40E_GLV_GORCL(hw->port), > > + pf->offset_loaded, &pf->internal_rx_bytes_offset, > > + &pf->internal_rx_bytes); > > + > > + i40e_stat_update_48(hw, I40E_GLV_GOTCH(hw->port), > > I40E_GLV_GOTCL(hw->port), > > + pf->offset_loaded, &pf->internal_tx_bytes_offset, > > + &pf->internal_tx_bytes); > > + > > /* Get statistics of struct i40e_eth_stats */ > > i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port), > > I40E_GLPRT_GORCL(hw->port), > > @@ -2400,7 +2409,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, > > struct i40e_hw *hw) > > * so subtract ETHER_CRC_LEN from the byte counter for each rx > > packet. > > */ > > ns->eth.rx_bytes -=3D (ns->eth.rx_unicast + ns->eth.rx_multicast + > > - ns->eth.rx_broadcast) * ETHER_CRC_LEN; > > + ns->eth.rx_broadcast) * ETHER_CRC_LEN + pf- > > >internal_rx_bytes; > > > > i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port), > > pf->offset_loaded, &os->eth.rx_discards, @@ - > > 2428,7 +2437,7 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct > > i40e_hw *hw) > > pf->offset_loaded, &os->eth.tx_broadcast, > > &ns->eth.tx_broadcast); > > ns->eth.tx_bytes -=3D (ns->eth.tx_unicast + ns->eth.tx_multicast + > > - ns->eth.tx_broadcast) * ETHER_CRC_LEN; > > + ns->eth.tx_broadcast) * ETHER_CRC_LEN + pf- > > >internal_tx_bytes; > > /* GLPRT_TEPC not supported */ > > > > /* additional port specific stats */ diff --git > > a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h > > index 2ff8282..b0d963c 100644 > > --- a/drivers/net/i40e/i40e_ethdev.h > > +++ b/drivers/net/i40e/i40e_ethdev.h > > @@ -639,6 +639,11 @@ struct i40e_pf { > > > > struct i40e_hw_port_stats stats_offset; > > struct i40e_hw_port_stats stats; > > + /* internal packet byte count, it should be excluded from the total *= / > > + uint64_t internal_rx_bytes; > > + uint64_t internal_tx_bytes; > > + uint64_t internal_rx_bytes_offset; > > + uint64_t internal_tx_bytes_offset; > > bool offset_loaded; > > > > struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ > > -- > > 2.7.4 >=20 > Do we need to clear the two new stats counters in i40e_pf_setup function? > Just like clear pf->stats and pf->stats_offset. Yes, it should be reset as other stats Thanks for capture this. Qi