From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E5C0D2B91 for ; Fri, 6 Jan 2017 02:25:10 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 05 Jan 2017 17:25:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,323,1477983600"; d="scan'208";a="26787366" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 05 Jan 2017 17:25:09 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 17:25:09 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 5 Jan 2017 17:25:09 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Fri, 6 Jan 2017 09:25:07 +0800 From: "Wu, Jingjing" To: "Lu, Wenzhuo" , "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: AQHSZY9EnjbN9J+yS0GUx3XcZQIwUqEqq8DA Date: Fri, 6 Jan 2017 01:25:06 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810CC3E3A@SHSMSX103.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> In-Reply-To: <1483426488-117332-26-git-send-email-wenzhuo.lu@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 01:25:11 -0000 > -----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 >=20 > From: Qi Zhang >=20 > 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. >=20 > 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(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.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, >=20 > 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; It looks ret is not changed in this func at all. > +} > + > +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.