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 C9B5E3257 for ; Tue, 19 Sep 2017 04:59:01 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2017 19:59:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,415,1500966000"; d="scan'208";a="1196551186" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 18 Sep 2017 19:59:00 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 19:59:00 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 18 Sep 2017 19:59:00 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Tue, 19 Sep 2017 10:58:36 +0800 From: "Wu, Jingjing" To: "Zhao1, Wei" , "dev@dpdk.org" CC: "Zhao1, Wei" Thread-Topic: [dpdk-dev] [PATCH v3 1/3] net/i40e: fix clear xstats bug in vf port Thread-Index: AQHTMEeApFypHX3lt0igaWR81U/LuqK7fNIg Date: Tue, 19 Sep 2017 02:58:36 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810E76F10@SHSMSX103.ccr.corp.intel.com> References: <20170829022806.68101-1-wei.zhao1@intel.com> <1505715504-8797-1-git-send-email-wei.zhao1@intel.com> In-Reply-To: <1505715504-8797-1-git-send-email-wei.zhao1@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 v3 1/3] net/i40e: fix clear xstats bug in vf port 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: Tue, 19 Sep 2017 02:59:02 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao > Sent: Monday, September 18, 2017 2:18 PM > To: dev@dpdk.org > Cc: Zhao1, Wei > Subject: [dpdk-dev] [PATCH v3 1/3] net/i40e: fix clear xstats bug in vf p= ort >=20 > There is a bug in vf clear xstats command, it do not record the statics d= ata in > offset struct member.So, vf need to keep record of xstats data from pf an= d > update the statics according to offset. >=20 > Fixes: da61cd0849766 ("i40evf: add extended stats") >=20 > Signed-off-by: Wei Zhao >=20 > --- >=20 > Changes in v2: >=20 > fix patch log check warning. >=20 > --- >=20 > changes in v3: >=20 > remove nic_stats_display protect to a new patch > --- > drivers/net/i40e/i40e_ethdev_vf.c | 64 > ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 63 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c > b/drivers/net/i40e/i40e_ethdev_vf.c > index 38c3adc..806ff9e 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -888,16 +888,74 @@ i40evf_update_stats(struct rte_eth_dev *dev, struct > i40e_eth_stats **pstats) > return 0; > } >=20 > +static void > +i40evf_stat_update_48(uint64_t *offset, > + uint64_t *stat) > +{ > + if (*stat >=3D *offset) > + *stat =3D *stat - *offset; > + else > + *stat =3D (uint64_t)((*stat + > + ((uint64_t)1 << I40E_48_BIT_WIDTH)) - *offset); > + > + *stat &=3D I40E_48_BIT_MASK; > +} > + > +static void > +i40evf_stat_update_32(uint64_t *offset, > + uint64_t *stat) > +{ > + if (*stat >=3D *offset) > + *stat =3D (uint64_t)(*stat - *offset); > + else > + *stat =3D (uint64_t)((*stat + > + ((uint64_t)1 << I40E_32_BIT_WIDTH)) - *offset); } The type of count is 64 bits. Is that correct to use 1 << I40E_32_BIT_WIDTH= ? > + > +static void > +i40evf_update_vsi_stats(struct i40e_vsi *vsi, > + struct i40e_eth_stats *nes) > +{ > + struct i40e_eth_stats *oes =3D &vsi->eth_stats_offset; > + > + i40evf_stat_update_48(&oes->rx_bytes, > + &nes->rx_bytes); > + i40evf_stat_update_48(&oes->rx_unicast, > + &nes->rx_unicast); > + i40evf_stat_update_48(&oes->rx_multicast, > + &nes->rx_multicast); > + i40evf_stat_update_48(&oes->rx_broadcast, > + &nes->rx_broadcast); > + i40evf_stat_update_32(&oes->rx_discards, > + &nes->rx_discards); > + i40evf_stat_update_32(&oes->rx_unknown_protocol, > + &nes->rx_unknown_protocol); > + i40evf_stat_update_48(&oes->tx_bytes, > + &nes->tx_bytes); > + i40evf_stat_update_48(&oes->tx_unicast, > + &nes->tx_unicast); > + i40evf_stat_update_48(&oes->tx_multicast, > + &nes->tx_multicast); > + i40evf_stat_update_48(&oes->tx_broadcast, > + &nes->tx_broadcast); > + i40evf_stat_update_32(&oes->tx_errors, &nes->tx_errors); > + i40evf_stat_update_32(&oes->tx_discards, &nes->tx_discards); } > + > static int > i40evf_get_statistics(struct rte_eth_dev *dev, struct rte_eth_stats *sta= ts) { > int ret; > struct i40e_eth_stats *pstats =3D NULL; > + struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > >dev_private); > + struct i40e_vsi *vsi =3D &vf->vsi; >=20 > ret =3D i40evf_update_stats(dev, &pstats); > if (ret !=3D 0) > return 0; >=20 > + i40evf_update_vsi_stats(vsi, pstats); > + It looks like, with this change, the static gotten by user the incensement = from the last query? If so, I don't think it is our expected. The names of functions are similar. Could you help to refine the code? For example, merge i40evf_dev_stats_get and i40evf_get_statistics to be on= e function. Rename i40evf_update_stats like i40evf_query_stats, and chang i40evf_update= _vsi_stats To be i40evf_update_stats? I think it would be clearer, what do you think? Thanks Jingjing