From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0043.outbound.protection.outlook.com [104.47.33.43]) by dpdk.org (Postfix) with ESMTP id 08F531B692 for ; Wed, 4 Oct 2017 17:26:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CpmbTZt857KgM3saiCmNZbku6obqTeuLipbWsQqYFko=; b=Fc9dCgszebWyxApO2a3e6yaoa0DmKBClzzTdk1BQrhJwB0sSJ1/NyT306mVS/JE0Z8NkVwAIOu60xBxKK761x4fjiA+U+kzk4VkxjzC9FqBDEJbbsCrjrsDzLsDWa6s/qJvM6adRvRyaUWtVh8dUrGR5DQFid2BNCIAy5g6MSpI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from [192.168.0.105] (103.76.56.167) by MWHPR07MB3101.namprd07.prod.outlook.com (10.172.95.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 4 Oct 2017 15:26:24 +0000 To: David Hunt , dev@dpdk.org References: <1506342429-199695-1-git-send-email-david.hunt@intel.com> <1507108515-186477-1-git-send-email-david.hunt@intel.com> <1507108515-186477-2-git-send-email-david.hunt@intel.com> Cc: konstantin.ananyev@intel.com, jingjing.wu@intel.com, "Sexton, Rory" , Nemanja Marjanovic From: santosh Message-ID: <00f48d01-2c73-bda4-58c0-06293acf46ef@caviumnetworks.com> Date: Wed, 4 Oct 2017 20:56:07 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1507108515-186477-2-git-send-email-david.hunt@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Originating-IP: [103.76.56.167] X-ClientProxiedBy: SG2PR04CA0141.apcprd04.prod.outlook.com (10.170.139.25) To MWHPR07MB3101.namprd07.prod.outlook.com (10.172.95.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd0be33f-db70-41cc-818f-08d50b3c4782 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:MWHPR07MB3101; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3101; 3:n6FmpPm4uFeUvF333Bhvz9LPdeLLrP2Uy1jc13AfqPItVTxbQmtXX8LxVjx0NDq4V6yoGUOdqeX9e8ghVN1BV/hRD2Eqvxwtg7vp+8iiTMXmBwMzYn1ITe/j4lwqWC/LMV30fYH/1mgk0wSs68UadgQaCRPYm0OHlEB+Ldy83vwjJEoqqmMlckWd23YSVYvermjLq8ztCEqK46o4OaTg07Ri/6rbVc9QW6uNLQNLJAmMhMHHFF//536EGfgEpKJh; 25:5AIMPm8y2gmnil/S4ZhBvHyXRjoyrcyzoP6++VFFOoKbZ+q885KdB8WyN8bApsIvJYWTyUFexT27JaOlFErBHoMdmRVr5l650L6tKw8589syYB4ucc1ydHJif/M5th5UILoTRVaQ0+HCd+AvU9AxpiCOtv4Z2PBObB3h6SsfCTRTP+BbKhjfktr3aRZuhjsfO/iPOhk8xprsHjLn98n4p65mhku4fGpQ8gKbVdjD98GF6on6zfWAifAzwb3sGeSQ8FDQU49f63+eWzrMbAs5kM0Iz4xOc0+p5VEvMa94Z/CX1hijm0N2anKNMQ6bQhbtcnml6tqer3t1p1LZoYo7ew==; 31:hvEgjZfmzWjWEvQCAlrhXynq3dC4b9EYNqG/t4JSEYHI4wY31O9NG+iUZ9F1W4Xe4YpaKL5WcXPJajhrk3Z0r/+rtUTRAgJf23EvJvIJ3c8NkQ/QFeJA3lEMp2SXeH+V0bCOKufgcs5wAISuVOVgLndTK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notOXB2ocuYuark= X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3101; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3101; X-Forefront-PRVS: 0450A714CB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(376002)(346002)(24454002)(377454003)(189002)(199003)(54906003)(66066001)(86152003)(105586002)(23746002)(106356001)(316002)(6486002)(77096006)(230700001)(117156002)(229853002)(5660300001)(189998001)(575784001)(33646002)(65956001)(65806001)(50466002)(6116002)(53936002)(7736002)(90366009)(64126003)(478600001)(3846002)(305945005)(16576012)(83506001)(16526018)(31696002)(97736004)(6246003)(72206003)(58126008)(101416001)(81156014)(42882006)(81166006)(65826007)(31686004)(54356999)(25786009)(2906002)(6666003)(76176999)(50986999)(8676002)(47776003)(36756003)(4326008)(8936002)(2950100002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3101; H:[192.168.0.105]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; MWHPR07MB3101; 23:7iOlWHPNBJO4N0e72IstAhguiCYE1OKo1KsUS?= =?Windows-1252?Q?MCQ2YEFoSOFqgBhVoyg84p0TZhAcPWGg2qKuq/ul9ZYttEHqpMCPK1mx?= =?Windows-1252?Q?Z6qeX70M4V1q0cElQp7KwxCSEZX4AgwwarMfBYwfHv16x8rbV46SlqFa?= =?Windows-1252?Q?Fb2trsVULWaSGN27gly05mracv4H1dhg23mu3b6ja4N9lhHbjG5/7yjh?= =?Windows-1252?Q?C7oLVYRzebbxwPiU3UqTcoG4n5EXUHuM5psVBeT1zEYbPuR93qijv811?= =?Windows-1252?Q?rVZEtAtarbbpXe3Xr7mkr6oO6AEHXVhahE3MBXbnp5dRMWNvRq2qgo6h?= =?Windows-1252?Q?fHcJ/o9CXa35HQoxfjDY8Mz9YxQvL2X1aRgkqD+X9F0dEjVNFTaJ2N2F?= =?Windows-1252?Q?qwVrdPiIjsl/VZUg8jWn3m60ZyNQ8WVw2+nV2XT8CXFtapjYHlkeKBuM?= =?Windows-1252?Q?EEgTQNb7VgwO1aIScrJPZxPc475lJZQ4GPwzxYWyFkJ3WcZOOw+DUkIY?= =?Windows-1252?Q?aUKDpu30AymEsceIdG3Tqj9NU7N8vz9Ofl+sVdiH44disWFSylgJuDAC?= =?Windows-1252?Q?WLr/liiQ1a3GJpzh+zXMM0hc0wiWJCb3vK3gSUi/GmiOvbJY4dL3M+HQ?= =?Windows-1252?Q?Pij5w4ssguQCZIddy2PXbXg8ynRKX9c2UWoidugT7n/MJ3TR6kyKlOdV?= =?Windows-1252?Q?4XRwFAOeGwzgbcJk7GVqoTr/k61LgNax2rb4M/N4ksTavziWwuTtxxLh?= =?Windows-1252?Q?Js4JfxKvYIf69UiQuMPT3uZFaTXvn7G8rmQY3lyVhu5JBTDbGLuGura6?= =?Windows-1252?Q?cVxHJt4ERJZ1NhFwHKOn/y57S62VLv91XLtRiJkAblk9N1SC2YsGsbim?= =?Windows-1252?Q?kp9yBB838jx4TIZc7xBGttM8nZMi8X+cAz8jxGsjDE6IuJcPLq3nsYMa?= =?Windows-1252?Q?nmnpyO5cmE3c3y1NIzIYvoXuyBpz0RdXYEHrGeP2XS2WLCNtXV/xdlP1?= =?Windows-1252?Q?4eviNG/HI090ofV+vottTYt4G+L410UcWrL7FjUKFqBvnUAnwMXoV/H9?= =?Windows-1252?Q?lHYyu2jt1OLoATfKiwwxXAa2cP1dRsVKl3HnAT3wYzMnBObvCDRG7o6x?= =?Windows-1252?Q?cEC+259Kv30oCdTjesiUVzP3tyLj/ZyLkl11AC0ouF8IVXNUS07tenJJ?= =?Windows-1252?Q?I93gXaFFUF4nWB5y/3Fm2JkqcPUKbNgMwhEOIGlfZbqPMbeVXj4Amr8u?= =?Windows-1252?Q?VebYfBhrviUc83KNTOwo0wiSuuFloo7N9uBhSKk9eCAo7vtREy8xfz/n?= =?Windows-1252?Q?cXN465yJ+jlXgNHha11fbwwIIsk996LRzapnSzZFnQ52gc9LR8qdhLcW?= =?Windows-1252?Q?7TEh0Nx8nZAkTE/4AfIHOXHZywBDgsPlvxNVouGX2aBwXjLsUOJTdYZH?= =?Windows-1252?Q?dWsbybqxcoGion/0jTcXldO5FKW/bAIaeUB/vOFigI5aP31dZ4HFJamk?= =?Windows-1252?Q?TNJQ84Gc+/irs3YOZDokdCD7cdowj0xU8wc8l9cb8rW7kPhCw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3101; 6:YE15sv31CC5l9jP+h5eCOKAFRp8DWjSoFEH893kVj5n91uiMKVMzs9ZhndzKFeGMGY47yX9cIHukZCiPcX1YV0/nx4FEjSLB4gBCoGJ/0DzJ8wdizhcCWb8rNA/QcQeerb0Ha1TomvzbT9khiOnZC5L4Ufh44omGs9mBUbvDS9133a6B8E8+DT5VKc8x0szVX+8ttSYQtMvUWbMt3yFIOD0v2e6KK+pJSPvA6MpkZ1gdrZ5nHpwGNhbPsZyEvsuAamW0HjA2oUUbdbMXaBY95q6o8K4IuKAXlyAmco6e9kDL9OokaUsY1Etr0kUMYpO9Nxl+DkEn4nj7gysIYxGPHA==; 5:P3qebF70cInjSMK9WWzEy6mbqLe/QE1+ZgfJ2iwLaTBleRjPeZ0dgJv7YSjBzks7kqwAKwkoQpx5juE3056nix9oKDIyW/rCbb76g40K3gcYHdGJerwYSak5ucqrlwoBg0fLPLMs77yzVTkpW1JcQw==; 24:yrLtvllDQ/WiyhKcPfMAWcbKNDKewxgIAIGy4bsa1vKvei4EheMrql7PYwbYRHmDOmUF3Mak45dQWGFyxTkYtWtkJKw/6p/m9FdGA7rvxCw=; 7:OKK7U/Ujr5jLeXnS0+b+NaDiUdiH0F0vRO46hrvALbq39oAGrR/8gKlle/ZYKxwhw8UKoX7rkJ/qWbg9BchHIlX00AwOFnLgEXBt7bEX4Sfp1be2Jhk6GBKgQZyXJpR8DD9ZeRkRrfkWhOrghOuORWmq9Vbc0G+bP3CkZgtV8m7OQAxYyBpT5lh29zoXlHy9G52wTZ03+pZyurTOT1On2KZLwgEWeUV/BVeYVGjA6TU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2017 15:26:24.6440 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3101 Subject: Re: [dpdk-dev] [PATCH v4 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: Wed, 04 Oct 2017 15:26:29 -0000 On Wednesday 04 October 2017 02:45 PM, David Hunt wrote: > From: "Sexton, Rory" > > Need a way to convert a vf id to a pf id on the host so as to query the pf > 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. > > Signed-off-by: Nemanja Marjanovic > Signed-off-by: Rory Sexton > Signed-off-by: David Hunt > --- > drivers/net/i40e/rte_pmd_i40e.c | 31 +++++++++++++++++++++++++++++++ > drivers/net/i40e/rte_pmd_i40e.h | 13 +++++++++++++ > drivers/net/i40e/rte_pmd_i40e_version.map | 7 +++++++ > 3 files changed, 51 insertions(+) > > diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c > index f12b7f4..21efb2f 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -2115,3 +2115,34 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, > > return 0; > } > + > +uint64_t > +rte_pmd_i40e_query_vfid_by_mac(uint8_t port, uint64_t vf_mac) > +{ > + struct rte_eth_dev *dev; > + struct ether_addr *vf_mac_addr = (struct ether_addr *)&vf_mac; > + 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 = &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > + vf_num = pf->vf_num; > + > + for (vf_id = 0; vf_id < vf_num; vf_id++) { > + vf = &pf->vfs[vf_id]; > + mac = &vf->mac_addr; > + > + if (is_same_ether_addr(mac, vf_mac_addr)) > + return vf_id; > + } > + > + return -EINVAL; > +} > diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h > index 356fa89..a7ae0f0 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -637,4 +637,17 @@ int rte_pmd_i40e_ptype_mapping_replace(uint8_t port, > uint8_t mask, > uint32_t pkt_type); > > +/** > + * 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 > + * -(-22 EINVAL) the vf mac does not exist on this port > + * -(!-22) the index of vfid in pf->vfs > + */ > +uint64_t rte_pmd_i40e_query_vfid_by_mac(uint8_t port, uint64_t vf_mac); > + On @return: - The index of vfid If successful. - -EINVAL: vf mac address does not exits for this port - -ENOTSUP: i40e not supported for this port. and return type should s/uint64_t/int since error case -ve value. Thanks.