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 558942B91 for ; Fri, 6 Jan 2017 09:01:25 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP; 06 Jan 2017 00:01:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,323,1477983600"; d="scan'208";a="50153484" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 06 Jan 2017 00:01:24 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Jan 2017 00:01:24 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 Jan 2017 00:01:23 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Fri, 6 Jan 2017 16:01:21 +0800 From: "Lu, Wenzhuo" To: "Wu, Jingjing" , "dev@dpdk.org" CC: "Zhang, Qi Z" Thread-Topic: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from PF Thread-Index: AQHSZY9CqLNiLvulqkCaNbVX2JUr6qEqJjEAgADxdRA= Date: Fri, 6 Jan 2017 08:01:20 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B556673@shsmsx102.ccr.corp.intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1483426488-117332-1-git-send-email-wenzhuo.lu@intel.com> <1483426488-117332-26-git-send-email-wenzhuo.lu@intel.com> <9BB6961774997848B5B42BEC655768F810CC3E3A@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810CC3E3A@SHSMSX103.ccr.corp.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 v7 25/27] net/i40e: set/clear VF stats from 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: Fri, 06 Jan 2017 08:01:25 -0000 Hi Jingjing, Qi, > -----Original Message----- > From: Wu, Jingjing > Sent: Friday, January 6, 2017 9:25 AM > To: Lu, Wenzhuo; dev@dpdk.org > Cc: Zhang, Qi Z > Subject: RE: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats fro= m PF >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu > > Sent: Tuesday, January 3, 2017 2:55 PM > > To: dev@dpdk.org > > Cc: Zhang, Qi Z > > Subject: [dpdk-dev] [PATCH v7 25/27] net/i40e: set/clear VF stats from > > PF > > > > From: Qi Zhang > > > > This patch add support to get/clear VF statistics from PF side. > > Two APIs are added: > > rte_pmd_i40e_get_vf_stats. > > rte_pmd_i40e_reset_vf_stats. > > > > Signed-off-by: Qi Zhang > > --- > > drivers/net/i40e/i40e_ethdev.c | 81 > > +++++++++++++++++++++++++++++++ > > drivers/net/i40e/rte_pmd_i40e.h | 41 ++++++++++++++++ > > drivers/net/i40e/rte_pmd_i40e_version.map | 2 + > > 3 files changed, 124 insertions(+) > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > b/drivers/net/i40e/i40e_ethdev.c index 47e03d6..be45cfa 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -10480,3 +10480,84 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t > > port, uint16_t vlan_id, > > > > return ret; > > } > > + > > +int > > +rte_pmd_i40e_get_vf_stats(uint8_t port, > > + uint16_t vf_id, > > + struct rte_eth_stats *stats) > > +{ > > + struct rte_eth_dev *dev; > > + struct rte_eth_dev_info dev_info; > > + struct i40e_pf *pf; > > + struct i40e_vsi *vsi; > > + int ret =3D 0; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > > + > > + dev =3D &rte_eth_devices[port]; > > + rte_eth_dev_info_get(port, &dev_info); > > + > > + if (vf_id >=3D dev_info.max_vfs) > > + return -EINVAL; > > + > > + pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > > + > > + if (vf_id > pf->vf_num - 1 || !pf->vfs) { > > + PMD_DRV_LOG(ERR, "Invalid argument."); > > + return -EINVAL; > > + } > > + > > + vsi =3D pf->vfs[vf_id].vsi; > > + if (!vsi) > > + return -EINVAL; > > + > > + i40e_update_vsi_stats(vsi); > > + > > + stats->ipackets =3D vsi->eth_stats.rx_unicast + > > + vsi->eth_stats.rx_multicast + > > + vsi->eth_stats.rx_broadcast; > > + stats->opackets =3D vsi->eth_stats.tx_unicast + > > + vsi->eth_stats.tx_multicast + > > + vsi->eth_stats.tx_broadcast; > > + stats->ibytes =3D vsi->eth_stats.rx_bytes; > > + stats->obytes =3D vsi->eth_stats.tx_bytes; > > + stats->ierrors =3D vsi->eth_stats.rx_discards; > > + stats->oerrors =3D vsi->eth_stats.tx_errors + > > +vsi->eth_stats.tx_discards; > > + > > + return ret; >=20 > It looks ret is not changed in this func at all. >=20 > > +} > > + > > +int > > +rte_pmd_i40e_reset_vf_stats(uint8_t port, > > + uint16_t vf_id) > > +{ > > + struct rte_eth_dev *dev; > > + struct rte_eth_dev_info dev_info; > > + struct i40e_pf *pf; > > + struct i40e_vsi *vsi; > > + int ret =3D 0; > > + > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > > + > > + dev =3D &rte_eth_devices[port]; > > + rte_eth_dev_info_get(port, &dev_info); > > + > > + if (vf_id >=3D dev_info.max_vfs) > > + return -EINVAL; > > + > > + pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > > + > > + if (vf_id > pf->vf_num - 1 || !pf->vfs) { > > + PMD_DRV_LOG(ERR, "Invalid argument."); > > + return -EINVAL; > > + } > > + > > + vsi =3D pf->vfs[vf_id].vsi; > > + if (!vsi) > > + return -EINVAL; > > + > > + vsi->offset_loaded =3D false; > > + i40e_update_vsi_stats(vsi); > > + > > + return ret; > Same comment as above. I'll change it to 'return 0'. The same as above.