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 7C5C8239 for ; Thu, 5 Oct 2017 14:45:07 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2017 05:45:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,481,1500966000"; d="scan'208";a="1202557028" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga001.fm.intel.com with ESMTP; 05 Oct 2017 05:45:05 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.49]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0319.002; Thu, 5 Oct 2017 13:45:05 +0100 From: "Ananyev, Konstantin" To: "Hunt, David" , "dev@dpdk.org" CC: "Wu, Jingjing" , "santosh.shukla@caviumnetworks.com" , "Sexton, Rory" , "Marjanovic, Nemanja" Thread-Topic: [PATCH v6 1/9] net/i40e: add API to convert VF MAC to VF id Thread-Index: AQHTPdVfh4TlTnxM40mj/OK8FNnAg6LVM14g Date: Thu, 5 Oct 2017 12:45:04 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772585FAA4A73@IRSMSX103.ger.corp.intel.com> References: <1507130720-48891-1-git-send-email-david.hunt@intel.com> <1507206350-215367-1-git-send-email-david.hunt@intel.com> <1507206350-215367-2-git-send-email-david.hunt@intel.com> In-Reply-To: <1507206350-215367-2-git-send-email-david.hunt@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWQzYjZmYTUtNGJiMy00NjM1LWIxZTctYzQ2OWUwYjU3NzlkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjdqTXBoVEEyMUtvekJsZ2hhRmpXNHdXbGpTcGt5XC9BUk1LT25WTWRKcDE0PSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 1/9] net/i40e: add API to convert VF MAC to VF id 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: Thu, 05 Oct 2017 12:45:08 -0000 Hi Dave, > -----Original Message----- > From: Hunt, David > Sent: Thursday, October 5, 2017 1:26 PM > To: dev@dpdk.org > Cc: Ananyev, Konstantin ; Wu, Jingjing ; santosh.shukla@caviumnetworks.com; > Sexton, Rory ; Marjanovic, Nemanja ; Hunt, David > Subject: [PATCH v6 1/9] net/i40e: add API to convert VF MAC to VF id >=20 > From: "Sexton, Rory" >=20 > Need a way to convert a vf id to a pf id on the host so as to query the p= f > for relevant statistics which are used for the frequency changes in the > vm_power_manager app. Used when profiles are passed down from the guest > to the host, allowing the host to map the vfs to pfs. >=20 > Signed-off-by: Nemanja Marjanovic > Signed-off-by: Rory Sexton > Signed-off-by: David Hunt > --- > drivers/net/i40e/rte_pmd_i40e.c | 30 +++++++++++++++++++++++++= +++++ > drivers/net/i40e/rte_pmd_i40e.h | 15 +++++++++++++++ > drivers/net/i40e/rte_pmd_i40e_version.map | 7 +++++++ > 3 files changed, 52 insertions(+) >=20 > diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i= 40e.c > index f12b7f4..541d575 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -2115,3 +2115,33 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t por= t, >=20 > return 0; > } > + > +int64_t > +rte_pmd_i40e_query_vfid_by_mac(uint8_t port, const struct ether_addr *vf= _mac) I don't think you need int64_t as a return value here. Just 'int' seems good enough. Anyway vf_id is just an 'int'. Konstantin > +{ > + struct rte_eth_dev *dev; > + struct ether_addr *mac; > + struct i40e_pf *pf; > + int vf_id; > + struct i40e_pf_vf *vf; > + uint16_t vf_num; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > + vf_num =3D pf->vf_num; > + > + for (vf_id =3D 0; vf_id < vf_num; vf_id++) { > + vf =3D &pf->vfs[vf_id]; > + mac =3D &vf->mac_addr; > + > + if (is_same_ether_addr(mac, vf_mac)) > + return vf_id; > + } > + > + return -EINVAL; > +} > diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i= 40e.h > index 356fa89..2952ab0 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -637,4 +637,19 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, > uint8_t mask, > uint32_t pkt_type); >=20 > +/** > + * On the PF, find VF index based on VF MAC address > + * > + * @param port > + * pointer to port identifier of the device > + * @param vf_mac > + * the mac address of the vf to determine index of > + * @return > + * The index of vfid If successful. > + * -EINVAL: vf mac address does not exist for this port > + * -ENOTSUP: i40e not supported for this port. > + */ > +int64_t rte_pmd_i40e_query_vfid_by_mac(uint8_t port, > + const struct ether_addr *vf_mac); > + > #endif /* _PMD_I40E_H_ */ > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e= /rte_pmd_i40e_version.map > index 20cc980..d8b74bd 100644 > --- a/drivers/net/i40e/rte_pmd_i40e_version.map > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map > @@ -45,3 +45,10 @@ DPDK_17.08 { > rte_pmd_i40e_get_ddp_info; >=20 > } DPDK_17.05; > + > +DPDK_17.11 { > + global: > + > + rte_pmd_i40e_query_vfid_by_mac; > + > +} DPDK_17.08; > -- > 2.7.4