From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0041.outbound.protection.outlook.com [104.47.0.41]) by dpdk.org (Postfix) with ESMTP id C1FBB1B659 for ; Tue, 3 Apr 2018 08:27:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6w7VjNaAcvxKfmZ8UwZ/iabq/HEDGmvdr8byTJWlGwQ=; b=tlnFyiScWyMrTvMtA7N/MB5VO+LdZ+Fg2amADN1S6nfP3yGuvZp0T01rXsfL5fkNCtlFKlWgLSYbzsBkV2J9SApbWYlWVM9b5eQUIusgxb6n+5rwYXeVkDs4NgQb903gaIS79jknW2jeWNMT5qjAe1OblTDxVvUpEaOT+PR8iLU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from [10.232.133.65] (14.142.187.166) by DB3PR04MB0762.eurprd04.prod.outlook.com (2a01:111:e400:9440::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Tue, 3 Apr 2018 06:27:52 +0000 To: Thomas Monjalon , Hemant Agrawal Cc: dev@dpdk.org, bruce.richardson@intel.com, anatoly.burakov@intel.comm, xiao.w.wang@intel.com, junjie.j.chen@intel.com References: <1521014434-3399-1-git-send-email-hemant.agrawal@nxp.com> <1882630.IHjtNmfOsM@xps> From: Hemant Agrawal Message-ID: <61905017-5c93-87f7-032d-e0b1907f56c0@nxp.com> Date: Tue, 3 Apr 2018 11:57:40 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1882630.IHjtNmfOsM@xps> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::27) To DB3PR04MB0762.eurprd04.prod.outlook.com (2a01:111:e400:9440::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 745c5648-aacf-43ce-f827-08d5992c0881 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR04MB0762; X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0762; 3:CIqKwieZpWYvJi3emxdoSZzKbF/11GA1gruOybJ5i0mD/ajGK02Gd5eyr/eanq26gLPy4D37XxE3jOpqPHXEra/6qMB+WWe6FLLEZ3NLsEimrRghMcM5LxWCsRdI5aiEtsLjcGirxMeJzeUJX7HD+KjsHDQ7Vw2YxTlLcqFeaDEdOoNNKxUjS6FqkDWxmohV/Lwc0VtAbAZkxJzOAhiROm7t0uSEdPY9tdoIFUnpwkwboBpU9fcTuz2loGEz4u+s; 25:+16fRSRtP6RkRdP5baWRbHJbpPk/bUe4j/eRoAkxOAJK696pSQs7W86EFfLS1QJICZNYu+GM4GO25FpkfdhKfkrOWKp8D4A/c88IPMlYPKqZn7tgToFsDPbPZv2zXkWlXMH0wjp3w3gCnHMwQHo62EKg00pPEO493cRq/+tPg1yF7X/Y4A5l448Hy7d8TrkpjhPRYC+GSiflmksdmIGcBnpf1dXciafVEik7jWy/g0Mxg+6d6b7v773Es3nrckq8CeD1vKN/ycEEknPRuXnoxofJsOkUopP/qVfXrjvs4WAkOuGjTcQ72h9rScOa3cv5/sYn2C3z0KAvzzUCGLAVVg==; 31:AujruWUC4sjV2r+kxzJxXWCARdIMR6dQg5NFCr2qEDEiYF3kZWv+ZlGqpuCY9m7xPeG3qLAz87Hr5vN0XvpuiXC+LLuNa3h0jW8WBHh/V7+6ePii1lGRhIYSA2BINWYriFiprmzwecGa7ISm7xQhEIv264rTAa+lsOcvQ9X7861l72F6SbWhHuGIdl/HwiWkcJy1whUEIR/ztx/d4tar9C7+NiIUsQaGYp92LwPczP0= X-MS-TrafficTypeDiagnostic: DB3PR04MB0762: X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0762; 20:BSYhcSa8b7NuY+eGEmSguaRjNdgG9Zl48AaJzm/sjs0343LBpk4MnIW3tVa5REQTqzmO5IHoF8TFaE1/3AEugfkIIShVq9vjJ/IhFENfCkfBYWWP+FI5M1IwTQgDcWUYnfDQHyTCDCyHUBw/tQ4aPIJaHzFjkisAMKiOkZd5RyI+AVlhPqwfEXivLa6lpz2vX4eGGBu84A5ZjgtkidynAR8Y7xYRiXtirgDymokl98MWQ6vY/wRvmDXj8ZFXB41GIqm5al1H48gypeZeZO5VGT6p9g2AxsXUKNxoMZJ9lKkOl7+U22jCc1goRF/DTWbRJEgBB7ho02kfqRQ9aP9Kuu0caxlDYdL8k1ehZmZu/tZkG/5BZyquPBNOndVb3I1jgXtRqHHew4Uoyxtu8oJvJT/4f0PR0yvULKlN1jt14IyPfOMx7QitL2yz2Zy102c/h6R8wuwVXy29JBX3oDBXIh+pNCLSd/KjUP51EAxCwV5Tzy4J5rW9fWuVoZinMG2p; 4:Yyks2bp/+H7qtB7ud5nEyh2cPTVm+IxHLMSU6rPKHg0Zyf5JbwgkKAbXNHsu2T7U+ZSOcH+744LGCfPgbaV06KGWj14SOtWGwmHMuv6eas2hVajfp0zHrpnn84p1RH8rIUYOisO26pLUjWc4sqXyp/64UEooygSyZarXidFhjnmo/8iH0bUELif0pB21D7+a8htZPLr8b7SEZgwizsJJvylPxZR9PvZ9QukWzp3vuwUqfuDDHKtRPFYz3UL2KUirowJnaItMt1Hc/R/arwOacV4MZaa0yHIuIe00tdAVTszdZvAw9lMz8sMRPDygtTfG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB3PR04MB0762; BCL:0; PCL:0; RULEID:; SRVR:DB3PR04MB0762; X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(376002)(366004)(39860400002)(396003)(346002)(39380400002)(189003)(199004)(68736007)(6486002)(11346002)(52116002)(47776003)(106356001)(66066001)(8676002)(65806001)(53546011)(386003)(64126003)(52146003)(77096007)(8936002)(446003)(16526019)(3846002)(16576012)(65956001)(55236004)(5009440100003)(316002)(478600001)(305945005)(2906002)(65826007)(2616005)(4326008)(6116002)(36756003)(58126008)(50466002)(2486003)(5660300001)(23676004)(110136005)(186003)(956004)(2870700001)(67846002)(31696002)(81166006)(25786009)(53936002)(229853002)(486005)(6666003)(76176011)(26005)(86362001)(105586002)(31686004)(486005)(7736002)(476003)(81156014)(97736004)(6246003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR04MB0762; H:[10.232.133.65]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjNQUjA0TUIwNzYyOzIzOi9OMUUwUTZLSGNCNHM2cWtXK1lxTUlxSVV2?= =?utf-8?B?MVE5RTljRTU0ZXQyZ0hlYWpqV2hPcGRHRmZDSklldDhNUEZKT3YxWGhvci85?= =?utf-8?B?aHhjTytMTDZQcjNlZmJEa3JiNDMzQi9ob2pKZFNwOFV3Q1NrQmMxRkFHay9B?= =?utf-8?B?VEI1MzN2dUk4bWFPRW9abEpZdkp6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vTslAz+Rlq+kpcac5QNVkxmybJX6jtOCiM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0762; 7:OEk9/hPxpgFGUKq4mfTmOZt6b7z+2U6tWlKZ5geDEHAgXvIFeLewKjYwYMInSALNoLIHgHQ2JS9v8AeQW1k8s0p6sxc8aPrVtBVf8j7oyx6ELQ60J4LVfwLJkqHssd7j8xc+6C7FhuBJLahBmZa2RYttzSxeBO5qDb6vn+Zogs9fn1NSukwTkOkgEuzEJHzGJc/9+d7PvzbCtOEDihHdGdZACcAr0VhHZLOo5UeztFzIiyGpg21VOMTDv5HlfABi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 06:27:52.7670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 745c5648-aacf-43ce-f827-08d5992c0881 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0762 Subject: Re: [dpdk-dev] [PATCH] eal/vfio: export internal vfio functions 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, 03 Apr 2018 06:27:56 -0000 Hi Thomas, On 3/27/2018 9:23 PM, Thomas Monjalon wrote: > 14/03/2018 09:00, Hemant Agrawal: >> This patch moves some of the internal vfio functions from >> eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix. >> >> This patch also change the FSLMC bus usages from the internal >> VFIO functions to external ones with "rte_" prefix >> >> Signed-off-by: Hemant Agrawal >> --- >> --- a/lib/librte_eal/common/include/rte_vfio.h >> +++ b/lib/librte_eal/common/include/rte_vfio.h >> @@ -28,6 +28,12 @@ >> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) >> +#define RTE_VFIO_NOIOMMU 8 >> +#else >> +#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU >> +#endif > I know this is just a move of an existing code, > but do you know why this check is against a version number (4.5.0), > instead of #ifdef VFIO_NOIOMMU_IOMMU which would be backport-safe? Agreed. please check it in v3. >> +/** >> + * Parse IOMMU group number for a device >> + * >> + * This function is only relevant to linux and will return >> + * an error on BSD. >> + * >> + * @return >> + * 1 on success >> + * 0 for non-existent group >> + * <0 for errors >> + */ >> +int __rte_experimental >> +rte_vfio_get_group_no(const char *sysfs_base, >> + const char *dev_addr, int *iommu_group_no); >> + >> +/** >> + * Open VFIO container fd or get an existing one >> + * >> + * This function is only relevant to linux and will return >> + * an error on BSD. >> + * >> + * @return >> + * > 0 container fd >> + * < 0 for errors >> + */ >> +int __rte_experimental >> +rte_vfio_get_container_fd(void); >> + >> +/** >> + * Open VFIO group fd or get an existing one >> + * >> + * This function is only relevant to linux and will return >> + * an error on BSD. >> + * >> + * @return >> + * > 0 group fd >> + * < 0 for errors >> + */ >> +int __rte_experimental >> +rte_vfio_get_group_fd(int iommu_group_no); > All these new functions should have some @param documentation. added the @param > This file is not included in doxygen, probably because @file is missing. most of these functions are internal functions. do you think we should add it in doxygen as well? > > About the naming, are you sure about "group_no" instead of "group_num"? Agree, but this is already in many places.  I feel this change will be unnecessary. > >> --- a/lib/librte_eal/rte_eal_version.map >> +++ b/lib/librte_eal/rte_eal_version.map >> @@ -254,5 +254,8 @@ EXPERIMENTAL { >> rte_service_set_runstate_mapped_check; >> rte_service_set_stats_enable; >> rte_service_start_with_defaults; >> + rte_vfio_get_group_no; >> + rte_vfio_get_container_fd; >> + rte_vfio_get_group_fd; > Please indent with tabs. > > done in v3