From patchwork Wed Apr 4 07:48:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132797 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4742399ljb; Wed, 4 Apr 2018 00:50:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx48SB2sFQbrdWFogeYd9lCFEDuqLB9e2nWAjTqQxD4KPusXTT7HX3/BUL/iKYPqCOiLWUCMe X-Received: by 10.28.7.141 with SMTP id 135mr6845165wmh.157.1522828250864; Wed, 04 Apr 2018 00:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522828250; cv=none; d=google.com; s=arc-20160816; b=g9QuV74CY1O/qm+mvCnAu3P3I9sU5CCis1D0fV3nobCD/jn3MfSEOueOkGt6GJceZ/ 7YILxcbFxnjOqLkrBEnrrBrN2i5Wu6R8nMeDK9JXzmYOux+iqIqFm+w3OD/TuzumhTR3 m8Cm9mh80ttzRwJIFQePmuN8Ma25TfbNoJlHiwbvAurFaS6e/Qh1ggWcHfgoDMr56OrT 2EVNKVNzMqn5UTNyebaTL7NhlEc+ZDCfmYc74OAcvuI+nBEpfkCxBDr9Ml1wf6IYbGMd c2eSr1Bu6BeI+i7J9pnn1MyVqeBkj9KU9X96tkfqt2rh8NAvz40Xbz14gQGiEboz9biw StRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=HHLp2NWaSTPbgUuGzgi8l5sbVGgOXvx/k+dh4KOK0Ek=; b=SM1YBxOX1bIPjJhJnnlG5TazvpdNUIwlMbNgqzKKq2I97T2UADm6qVkbQ+4O5pcwhv uhklMt3/2i42ol45/eaj2J/edq4yWzR4+4GEkc2niIjQV4Ya6iN6+EWvK/mS/GZQIAE/ LRQHN5YsQ02Cjvg2vfKs+3wiFB5SyWy+p0ephWBCYaLAX6f8wrD9uHElO0Y/A1RGMnb4 UkCejc1zreLiEAwyCd9gAdafch3glc+2vUQlY2WyTr2NtIG6yJ2t5NzWYCaGTN4hQPng m3QCvIcO1JrqDFL9kbXJlCD3tj/vV7PVh4C1QUOxChGeXLoo1d6CtE4jnY0hO92SKeNU Hasg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=h6PuciDj; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id h13si3240676wrc.19.2018.04.04.00.50.50; Wed, 04 Apr 2018 00:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=h6PuciDj; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AACCC1BC5E; Wed, 4 Apr 2018 09:50:49 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50077.outbound.protection.outlook.com [40.107.5.77]) by dpdk.org (Postfix) with ESMTP id 7CD241BC5B for ; Wed, 4 Apr 2018 09:50:48 +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=HHLp2NWaSTPbgUuGzgi8l5sbVGgOXvx/k+dh4KOK0Ek=; b=h6PuciDjnlHYQG+87znuZEyvZcuwbUXNL3065WZhsAlNFVjMPZwstLCwG/60mo9ShtyMTsJaW/mrq4pi/ugbLxkkrAzDGiiAmUCNtkRqF40vIxbSZCuetLGr+PHeA6ZMWiKmslksX0m82qlrC0csrASyfZIuOuRrXurokA8SmPo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by DB3PR04MB0761.eurprd04.prod.outlook.com (2a01:111:e400:9440::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Wed, 4 Apr 2018 07:50:36 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Wed, 4 Apr 2018 13:18:39 +0530 Message-Id: <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com> References: <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR01CA0087.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::27) To DB3PR04MB0761.eurprd04.prod.outlook.com (2a01:111:e400:9440::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2dd26a2e-9e4f-4082-6b63-08d59a00c16f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR04MB0761; X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0761; 3:DDi4jAncrdFLG8Ozo7UaErID7C2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KcBQ2kjW+Gqc+evQDAaU0CjtJuBhMFNW0y6UOdzGjcwxcSrFUcS2ziTnO4Ha1mlnBmNLOSz7fdgPx5dPV+llecrQJyz9ausmagiRmeJXx3HkT4U5ke8Bavg4VrSwVKaKotWHpesuNGyH20YKz9dMidt9cAdZ8jdBp9wBVye1WzGna2Y2+NbruAZZ8vbYZMp24DnFh9t4mql35+u+LvPkI8hD9V+Ov7nclC9h8Nn8hcbpkjzpdZsjToEpflObgsY+UouikRczyAA5sPBsuhUh0cyAT506p8YqX6QJD4ahvL6tdRu9KPC; 4:6ix8YulSWuv51YOqhey0S/EvrqrzAdbdX9cZ0a+P4OqXWZKR7YkSCH9dMnYMFLdiAYwqsGeKCkcl8+9VDwcWSHqUrcVB6+8uNQC1zkWs7ALNcqa7he5OqOMb5paPYkOhKNlUrRDa5pGZoMAu83SkTkbVopEuBx0XBOPfDdthyCKUD0dXRha2i9THnvWoGak79i1gW3tfw5XQ+CJtq11M1+SnqJUQtsTpIz0rJiC1jeT23QYqxdHdBpJ7de/uM1OBP62FXYPuUkR8Ltw9X7hdG8xLjtdWZVz7Gr/VvYIIysmxlkaS2h6b45xjSiulQWWZ 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)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB3PR04MB0761; BCL:0; PCL:0; RULEID:; SRVR:DB3PR04MB0761; X-Forefront-PRVS: 0632519F33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(39380400002)(189003)(199004)(8676002)(105586002)(6512007)(6486002)(2351001)(5660300001)(2361001)(6916009)(53936002)(16526019)(956004)(59450400001)(50466002)(4326008)(81156014)(2616005)(186003)(48376002)(7736002)(6506007)(106356001)(25786009)(86362001)(36756003)(50226002)(81166006)(47776003)(26005)(316002)(446003)(5009440100003)(2906002)(476003)(55236004)(66066001)(478600001)(52116002)(11346002)(386003)(305945005)(6116002)(76176011)(68736007)(51416003)(16586007)(3846002)(97736004)(8936002)(486006)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR04MB0761; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR04MB0761; 23:UXPRbJ+WywZMWXdNxf7+GhBsEsSlr2zY/Iy9J/KOQ?= wDQgkBfey6cIbGeC5GjV1+a1vnaRgp+R1UIo5TTC93bvsoRcFHx2fqlANLESJilehDDUrteg4TNaHD6fQQ5k/S+vWn3Ii7h0njj3MTavHb1I0Gj6YtYJkvrZNKb4Ta9H6BnF42ea6lFXje3YuOBi4KpC9/D8g83fL3A0yIUAvqNH0TjCUuA76KHODD1IEcNF2R1AExeZ0qaehChJLF7/EeTLvFoYYADzWTz3TsnQQnJ9QmAp5Z3pS3XPVqLgH8RFcaSr5ExE8YSrqN9nufgfKXZcWjHoecudq5f2yBWzlnqtwlKCgk0yiFwHzSPctu7z0WlRNzZu4on+MIvUt9csUSLAKoW4HznFKa97oq6F4AJiR7htUGSlToBI1RVA/ZCFzVj2OmRZ+aHocC9z0qFKqnZkOxGx6mOr8x4OgRw0iVt7smPPZEzqKlAQ2XZIW5AwulTNqd5OJQasWPSlVCGr2JoX25fm7ooQeQDHaCHQiMuiOxrUx9gDrpUg1TXPgKoWNWX/Y59x7xH3lT9f2pR8RPV+w/ymYJCLq/oAX3+F6BPGmHiCZC7BCf/MKlV2pEu+P1p2tAQy6MceOwExZXbFfVe+K0naI3jBhEqNO1r4L93jny4DEhAAWgwU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jny9UXkhZjc9SHq/WcB1vBskFPBJ1/huihH7osex/n+6nl45wC8zt4OIOCHyKTx4gqKOMpR+jWs8hqvbYN97omDUMD/sszwZomU2LW+I7BVP+1fe0WCIbczxpbS1MCVb7CBE8Qslflt6AgAoIdN3GkDWex8leNGC2+bAtkRtVDdeYw38kuGm4ciLIFI9vPHOC9SXLKhlpfF2oz9AU7Y0bEvHGpsRq9Tm63U17STse8e00J7xwW/KlNbzBLBlSF9im4n5DRH94cAFZ2xXvxD3A==; 5:TEyn7OoLgEIuGLkNQGSlEd6eOAoIOS0SMbNUZKD0Fy4TczPvxxqr1TS6GybFZBV0Ns0El/byzrgeiZRCwVvUwJqaC634S6adM0WYgsF7UW+oeVUH235inI54Nif6Fz/u3BL2ByY8ZklSH309mxBeAzkzOfAOdgPFlT7rtl2gJIE=; 24:bbVKp5SGGgs1uNxlVskEVrkL9SeBaYlnL43/CjIqO+pzIiXNNM3eYbiU59qEZQkZPpEB27lw30eVQSpUOYs05unz+sNIxi0BQuauw5NBlIo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0761; 7:Od5b6bculp9BxKZJp0o0KerZ+7aH6Y35XzVWDOJOvp58oGh80snNvFq9B0GlnmYdvVphNdmFzyPh6VtTxN5TnhAFiAXlqFn1nU6ytZqb5G3Aw7o5ll8OurpLEBmrSpP8T3GmC305X3CUjK/UIUVAERNTcYyaA1UcY6kIRouDD1gjckCEI8Br8RVuAGn9quoaxyyg3+QRsU5l1f68oGGVBJ3qBd5ZyeN0Q4Cy6ZJNmAaeTuq1VAnGEoCeGMiIN3a0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2018 07:50:36.8931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2dd26a2e-9e4f-4082-6b63-08d59a00c16f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0761 Subject: [dpdk-dev] [PATCH v5 1/2] doc: add vfio api support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Hemant Agrawal --- doc/api/doxy-api-index.md | 3 ++- doc/api/doxy-api.conf | 1 + lib/librte_eal/common/include/rte_vfio.h | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index d77f205..d21f2d9 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -52,7 +52,8 @@ The public API headers are grouped by topics: [bitrate] (@ref rte_bitrate.h), [latency] (@ref rte_latencystats.h), [devargs] (@ref rte_devargs.h), - [PCI] (@ref rte_pci.h) + [PCI] (@ref rte_pci.h), + [vfio] (@ref rte_vfio.h) - **device specific**: [softnic] (@ref rte_eth_softnic.h), diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index cda52fd..ad8bdcf 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -82,6 +82,7 @@ INPUT = doc/api/doxy-api-index.md \ FILE_PATTERNS = rte_*.h \ cmdline.h PREDEFINED = __DOXYGEN__ \ + VFIO_PRESENT \ __attribute__(x)= OPTIMIZE_OUTPUT_FOR_C = YES diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h index 249095e..9b7b983 100644 --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -5,6 +5,11 @@ #ifndef _RTE_VFIO_H_ #define _RTE_VFIO_H_ +/** + * @file + * RTE VFIO. This library provides various VFIO related utility functions. + */ + /* * determine if VFIO is present on the system */ From patchwork Wed Apr 4 07:48:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132798 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp4742488ljb; Wed, 4 Apr 2018 00:50:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/By+IvTFpl13JuadNbH2KFoXKqJQskrLnZaVHf+D9i7NeyZA9i5YHmtyQV/dLY3Ma4jo+m X-Received: by 10.223.210.73 with SMTP id o9mr13425841wri.248.1522828257486; Wed, 04 Apr 2018 00:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522828257; cv=none; d=google.com; s=arc-20160816; b=tgJEBaz2dhZ71NhgBp3SBt8fNLn6mw/S+d6eEOI5x2xh3GFzEBo6Er98Pf0+ZOPN/3 tyIfTiqHRgBpMFcluk1UFm+exxVczz/5nenq9F60bJEehBPyd87GScICxLvrxVqg+Tc/ 4wapjDFG9+6DeVwkOQtOzcSNzV4IeqM8cFSBL0gwZlOgKdP2vNhRpLKpwmzbmcvRgws3 ndnpqXoDvPSmZfzAGYa4TPdN6djcbG4GDF9wFWodIjBYlllrspjYjvnpBvG8Y0NBYVXt rsz1Fp8L8UpKnFiDNVNUAbe2uhKLegpOk7RZT+OefaQ+iISb06WIA8YR6YN1LAIdLaTg h8Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=V0DbaJzYjxByd6MeDt/br67lSSOgO776BmVggTGwK9w=; b=WUW/hRDmm/DM9tTGN5IGCCMkuTHr8sHvQutH1dC9Y33SqW9BLGizI4SuPU+uAAd6jR JLnbk2hk61tuJMgZQuNdMS9riLqUDtEXCnaXyx7EwoLzQ4AyY9YXxgZVWXVmJxN7JKuY KsFyBTMWq9oBtfXoR1nbswXJc8VPAqOQZod3/YKYRqQY39zEqSZbZ9pGI2UQxQOfiQu4 FtttxCyQDiwlQbHK8G/eJw9GA+VaueE7sn6wLws2enIjtKIwe2OJpKS/NPwSK4/auM3I 6RuVqIL5xZ9DFLXjdYNpa9qa9dkaL9niOqejsxYu70Wt5l7j2Xms22m5e529aZlpWc/7 owqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=Ek5X751+; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id b14si3226685wri.178.2018.04.04.00.50.57; Wed, 04 Apr 2018 00:50:57 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=Ek5X751+; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 335401BC6D; Wed, 4 Apr 2018 09:50:53 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50079.outbound.protection.outlook.com [40.107.5.79]) by dpdk.org (Postfix) with ESMTP id E3D461BC69 for ; Wed, 4 Apr 2018 09:50:49 +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=V0DbaJzYjxByd6MeDt/br67lSSOgO776BmVggTGwK9w=; b=Ek5X751+udqKYAlkBy+duac2Ub5uONMVSd5nE2AqRvKOt+BNEpxndu8Qfrv8Wjv/Zt6WG2yDGZ+2P/5Rb3+W1MYctEmCqkNNqvzeHFcKz6VIRYP/q9lz2M5JCzY1dqmKhvabJCkp/dypDjd2bWz7hd3vI9fx1RvuS14tA4uOvL0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by DB3PR04MB0761.eurprd04.prod.outlook.com (2a01:111:e400:9440::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Wed, 4 Apr 2018 07:50:38 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Wed, 4 Apr 2018 13:18:40 +0530 Message-Id: <1522828120-16100-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> References: <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com> <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR01CA0087.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::27) To DB3PR04MB0761.eurprd04.prod.outlook.com (2a01:111:e400:9440::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5a063110-d332-4467-75c7-08d59a00c25b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR04MB0761; X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0761; 3: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4/4bRwsw2oVGG5Ybx3h7tVGt5IyZRmrwSpmzhYHHPd7x2WuRgrF0DWBaaRHJP48YvCWTyUKgTe+3uXJKmi9rRp/Q4cBLao+zkvZ7BUYfd9BSR28GjFhRv0M+BeBJFaP0U3xwhNfGRzwB3JJU8eym+GcPz2ZgtBdiR78myK4slfwKPiJLlhPpHYrAsazLTfLx5eKlIYvHq4hUHIqiI+iDm0R9mmzVQuU+xFeqwM0qznXZ6cS+9XB+iv8aCT7z6kvWNXfGqMPA3mhx8rFdTu7JR4TORif8gzQDIgpSvqWei3f8p6dYxlLqPmZ0SnxmYXXUomHFTt4GLEUKxIHlZkJhXO; 4:g7wRf+kl+k9IhiC8XSNmyu2+q+YAgHlYYEBqlf4vNZRwp1y804YU5E0stE9ccZobQrHDZr4eJgx+N27AI4aTqsYuC1aMoFkzjBhcw/ozh23uv1YM/F+mOhfcbP0hnV8rmOOyxmGdQ49uE7ZGS7WD5IpHrHsGS4+nQZS8bEjRdTsQxssRQc1LLKbTl1gxdhq0VvY2xwswaL06cCQj/h41FVnl/kveUP4GEd2885QwwhufiaIRrZf/OpQXaSECRn+YOhtdB/9tX6S+GjoJGfY11lZUpgx4mmbqquzXkwsI667RWmGFZQw/xm3MZp0j1qHgdEgDY2kRsZOmpO40l6hZlYOSEVSeyoXzt3iUYyV286cn3BaOJjqb6Yx1bhC8bxcX X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB3PR04MB0761; BCL:0; PCL:0; RULEID:; SRVR:DB3PR04MB0761; X-Forefront-PRVS: 0632519F33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(39380400002)(189003)(199004)(8676002)(105586002)(6512007)(6486002)(2351001)(5660300001)(2361001)(6916009)(53936002)(16526019)(956004)(59450400001)(50466002)(4326008)(81156014)(2616005)(186003)(48376002)(7736002)(6506007)(106356001)(25786009)(6666003)(86362001)(36756003)(50226002)(81166006)(47776003)(26005)(316002)(446003)(5009440100003)(2906002)(476003)(55236004)(66066001)(478600001)(52116002)(11346002)(386003)(305945005)(6116002)(76176011)(68736007)(51416003)(16586007)(3846002)(97736004)(8936002)(486006)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR04MB0761; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR04MB0761; 23:48FvE9q8c3an5P6poFug37OJPSOvv2AI5FOd2LttW?= U0cTev6ZMBX4Bluvrm0EDUglD+9arzgoX8nS3fTjCGDSh/MRNOw/sGGLuKh4qu31yBB48MWolJLHBaoAze4BKv5GaMI0eXmW6X4/o3PTBMGdCXuGUW4eQivYQUqPjQ3sodt4Q6v9Bw/ougKWjGq7UqnyvMSDVvzXWnmgzFjlhtyt/FkVU3ik9cgkrF/KwGEUsnK6tRhWuZfFr+DF8IbYTQhX868trO7R6Wy96+4qfoGjI8oOi1lmjgoea8mUaoe2mJs4BhNPWMyOZXQE5mI0xtzOkt31OuNdilHYcwi/6mg5HZcNPoEb0uagyQaPD2Cu7BEWDUrj/23zYk8JX2TrskB8e0H7nSKKp7m4X+Qqmi8jKl1LtzJ54WpjaEz4YNN3CIxtkbHA7uGeywjF9wQHYrqQ1IFbusBEpiVVpB9okNjLhHfbrkNyUcTMfxCKyYub6a0wFLneoV73syELo4x4ti3exnvX+tmssO+uwymGNOtfl5yZST4RUAb+qi/hGcN/MjHs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ivbYKD5Kpc6fI0y8zAupC4Js1Y6tGn2wqLHC4Mmj3A8/YUZ5G2kXKS4Dp5d4X/tdFrDV+H33vuuDAzEzQJos9yWA00me3gkkwRooUI4oxrF1bdBwJghibe9aAwUjqQaw+IQ1mfkcSsfyV7flYFzejhVDJkAyd8Dtz4gZbo9iA+yasmZ0XDs/7yyP8eDEkPojk7IX+IruL8G69Vh4fkMXjsul5fcQooKEJSSoYc5ZReRE2t8iD8Ydxz5UQQaDSltLsZ8dpiENs+HAoAUZMNPtNsxKnlxGtMB6TwCy4VildB27Z8/xzv6/exd5wznodKkriXBBxOcT650HMP6U7OmviAVJazqtishuFrk7pySdobJprRX6moyKvW1j6NS3RIlwImb+pvxoaAwqp3mSei0F1Q==; 5:kBou+xukK/HV6ZLfJxmVrKVt6WNUTX0EyDDG/SQcnfqDHDTxb5HLrZebrs0g9AKnvlhUhUTnqWK8N3Lvw91CLU7wCeNgP+l4bjjtbUy9ouCUu1iEfQTC/RiSEpbIjXcGvLS7dzNv1l5ILP8uG+I0RwgsnShlizaixm9JnS8QIc8=; 24:sknH7NCW5qdn2ykK9QFzAfib7ePCU4hN4kjAnXxx7x4sDNan2iAjuvCPWhxk5GJk+Xyz2vgNd4HkUJkD+qIjDSL+pJroADZ9rHTmp9HGZ8A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0761; 7:aRd++ydJFGTPoJzzPaBlYb/tQePDz26WwRbpO+U2sggbHaDLE8aaxdva0/m+1ZrGJyKnvcPZxGQ8OD5h2Ibm4kvALXfiH1UejyCHAdgFH/vIvznMdRrjTWAHguKgAjWU8slq8jmsGeXYrOiAWkA7mYG2ui0iyAE7i+LKdw6nGp/iCiOmomkzk2o3Yulz3KmhKCmj97Wnx5BVOJcnZqIvNiD1qeFxfl3XjNUzRlOt0GAPt7KY35SRyXo8RPvj4nOX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2018 07:50:38.4713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a063110-d332-4467-75c7-08d59a00c25b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0761 Subject: [dpdk-dev] [PATCH v5 2/2] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Anatoly Burakov --- v5: fix the bsd compilation drivers/bus/fslmc/Makefile | 1 - drivers/bus/fslmc/fslmc_vfio.c | 7 +-- drivers/bus/fslmc/fslmc_vfio.h | 2 - drivers/bus/fslmc/meson.build | 1 - lib/librte_eal/bsdapp/eal/eal.c | 24 +++++++++ lib/librte_eal/common/include/rte_vfio.h | 75 +++++++++++++++++++++++++- lib/librte_eal/linuxapp/eal/eal_vfio.c | 39 +++++++------- lib/librte_eal/linuxapp/eal/eal_vfio.h | 21 -------- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 4 +- lib/librte_eal/rte_eal_version.map | 3 ++ 10 files changed, 127 insertions(+), 50 deletions(-) -- 2.7.4 diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 93870ba..3aa34e2 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -16,7 +16,6 @@ CFLAGS += $(WERROR_FLAGS) CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include -CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 62499de..f3b2960 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -91,7 +91,8 @@ fslmc_get_container_group(int *groupid) } /* get group number */ - ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, groupid); + ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES, + g_container, groupid); if (ret <= 0) { DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container); return -1; @@ -124,7 +125,7 @@ vfio_connect_container(void) } /* Opens main vfio file descriptor which represents the "container" */ - fd = vfio_get_container_fd(); + fd = rte_vfio_get_container_fd(); if (fd < 0) { DPAA2_BUS_ERR("Failed to open VFIO container"); return -errno; @@ -620,7 +621,7 @@ fslmc_vfio_setup_group(void) } /* Get the actual group fd */ - ret = vfio_get_group_fd(groupid); + ret = rte_vfio_get_group_fd(groupid); if (ret < 0) return ret; vfio_group.fd = ret; diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h index e8fb344..9e2c4fe 100644 --- a/drivers/bus/fslmc/fslmc_vfio.h +++ b/drivers/bus/fslmc/fslmc_vfio.h @@ -10,8 +10,6 @@ #include -#include "eal_vfio.h" - #define DPAA2_MC_DPNI_DEVID 7 #define DPAA2_MC_DPSECI_DEVID 3 #define DPAA2_MC_DPCON_DEVID 5 diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build index e94340e..78f9d92 100644 --- a/drivers/bus/fslmc/meson.build +++ b/drivers/bus/fslmc/meson.build @@ -22,6 +22,5 @@ sources = files('fslmc_bus.c', allow_experimental_apis = true -includes += include_directories('../../../lib/librte_eal/linuxapp/eal') includes += include_directories('mc', 'qbman/include', 'portal') cflags += ['-D_GNU_SOURCE'] diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 4eafcb5..e2f2df1 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -746,6 +746,10 @@ int rte_vfio_enable(const char *modname); int rte_vfio_is_enabled(const char *modname); int rte_vfio_noiommu_is_enabled(void); int rte_vfio_clear_group(int vfio_group_fd); +int rte_vfio_get_group_num(const char *sysfs_base, const char *dev_addr, + int *iommu_group_num); +int rte_vfio_get_container_fd(void); +int rte_vfio_get_group_fd(int iommu_group_num); int rte_vfio_setup_device(__rte_unused const char *sysfs_base, __rte_unused const char *dev_addr, @@ -781,3 +785,23 @@ int rte_vfio_clear_group(__rte_unused int vfio_group_fd) { return 0; } + +int __rte_experimental +rte_vfio_get_group_num(__rte_unused const char *sysfs_base, + __rte_unused const char *dev_addr, + __rte_unused int *iommu_group_num) +{ + return -1; +} + +int __rte_experimental +rte_vfio_get_container_fd(void) +{ + return -1; +} + +int __rte_experimental +rte_vfio_get_group_fd(__rte_unused int iommu_group_num) +{ + return -1; +} diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h index 9b7b983..9369b42 100644 --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -37,6 +37,13 @@ extern "C" { #endif +/* NOIOMMU is defined from kernel version 4.5 onwards */ +#ifdef VFIO_NOIOMMU_IOMMU +#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU +#else +#define RTE_VFIO_NOIOMMU 8 +#endif + /** * Setup vfio_cfg for the device identified by its address. * It discovers the configured I/O MMU groups or sets a new one for the device. @@ -128,10 +135,76 @@ int rte_vfio_is_enabled(const char *modname); */ int rte_vfio_noiommu_is_enabled(void); -/* remove group fd from internal VFIO group fd array */ +/** + * Remove group fd from internal VFIO group fd array/ + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @param vfio_group_fd + * VFIO Grouup FD. + * + * @return + * 0 on success. + * <0 on failure. + */ int rte_vfio_clear_group(int vfio_group_fd); +/** + * Parse IOMMU group number for a device + * + * This function is only relevant to linux and will return + * an error on BSD. + * + * @param sysfs_base + * sysfs path prefix. + * + * @param dev_addr + * device location. + * + * @param iommu_group_num + * iommu group number + * + * @return + * >0 on success + * 0 for non-existent group or VFIO + * <0 for errors + */ +int __rte_experimental +rte_vfio_get_group_num(const char *sysfs_base, + const char *dev_addr, + int *iommu_group_num); + +/** + * 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. + * + * @param iommu_group_num + * iommu group number + * + * @return + * > 0 group fd + * < 0 for errors + */ +int __rte_experimental +rte_vfio_get_group_fd(int iommu_group_num); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index e44ae4d..6021872 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -36,7 +36,7 @@ static const struct vfio_iommu_type iommu_types[] = { }; int -vfio_get_group_fd(int iommu_group_no) +rte_vfio_get_group_fd(int iommu_group_num) { int i; int vfio_group_fd; @@ -45,7 +45,7 @@ vfio_get_group_fd(int iommu_group_no) /* check if we already have the group descriptor open */ for (i = 0; i < VFIO_MAX_GROUPS; i++) - if (vfio_cfg.vfio_groups[i].group_no == iommu_group_no) + if (vfio_cfg.vfio_groups[i].group_no == iommu_group_num) return vfio_cfg.vfio_groups[i].fd; /* Lets see first if there is room for a new group */ @@ -70,7 +70,7 @@ vfio_get_group_fd(int iommu_group_no) if (internal_config.process_type == RTE_PROC_PRIMARY) { /* try regular group format */ snprintf(filename, sizeof(filename), - VFIO_GROUP_FMT, iommu_group_no); + VFIO_GROUP_FMT, iommu_group_num); vfio_group_fd = open(filename, O_RDWR); if (vfio_group_fd < 0) { /* if file not found, it's not an error */ @@ -82,7 +82,8 @@ vfio_get_group_fd(int iommu_group_no) /* special case: try no-IOMMU path as well */ snprintf(filename, sizeof(filename), - VFIO_NOIOMMU_GROUP_FMT, iommu_group_no); + VFIO_NOIOMMU_GROUP_FMT, + iommu_group_num); vfio_group_fd = open(filename, O_RDWR); if (vfio_group_fd < 0) { if (errno != ENOENT) { @@ -95,7 +96,7 @@ vfio_get_group_fd(int iommu_group_no) /* noiommu group found */ } - cur_grp->group_no = iommu_group_no; + cur_grp->group_no = iommu_group_num; cur_grp->fd = vfio_group_fd; vfio_cfg.vfio_active_groups++; return vfio_group_fd; @@ -117,7 +118,7 @@ vfio_get_group_fd(int iommu_group_no) close(socket_fd); return -1; } - if (vfio_mp_sync_send_request(socket_fd, iommu_group_no) < 0) { + if (vfio_mp_sync_send_request(socket_fd, iommu_group_num) < 0) { RTE_LOG(ERR, EAL, " cannot send group number!\n"); close(socket_fd); return -1; @@ -132,7 +133,7 @@ vfio_get_group_fd(int iommu_group_no) /* if we got the fd, store it and return it */ if (vfio_group_fd > 0) { close(socket_fd); - cur_grp->group_no = iommu_group_no; + cur_grp->group_no = iommu_group_num; cur_grp->fd = vfio_group_fd; vfio_cfg.vfio_active_groups++; return vfio_group_fd; @@ -262,11 +263,11 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, .argsz = sizeof(group_status) }; int vfio_group_fd; - int iommu_group_no; + int iommu_group_num; int ret; /* get group number */ - ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); + ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_num); if (ret == 0) { RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n", dev_addr); @@ -278,7 +279,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, return -1; /* get the actual group fd */ - vfio_group_fd = vfio_get_group_fd(iommu_group_no); + vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num); if (vfio_group_fd < 0) return -1; @@ -394,11 +395,11 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, .argsz = sizeof(group_status) }; int vfio_group_fd; - int iommu_group_no; + int iommu_group_num; int ret; /* get group number */ - ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no); + ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_num); if (ret <= 0) { RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver\n", dev_addr); @@ -407,9 +408,9 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, } /* get the actual group fd */ - vfio_group_fd = vfio_get_group_fd(iommu_group_no); + vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num); if (vfio_group_fd <= 0) { - RTE_LOG(INFO, EAL, "vfio_get_group_fd failed for %s\n", + RTE_LOG(INFO, EAL, "rte_vfio_get_group_fd failed for %s\n", dev_addr); return -1; } @@ -480,7 +481,7 @@ rte_vfio_enable(const char *modname) return 0; } - vfio_cfg.vfio_container_fd = vfio_get_container_fd(); + vfio_cfg.vfio_container_fd = rte_vfio_get_container_fd(); /* check if we have VFIO driver enabled */ if (vfio_cfg.vfio_container_fd != -1) { @@ -558,7 +559,7 @@ vfio_has_supported_extensions(int vfio_container_fd) } int -vfio_get_container_fd(void) +rte_vfio_get_container_fd(void) { int ret, vfio_container_fd; @@ -622,8 +623,8 @@ vfio_get_container_fd(void) } int -vfio_get_group_no(const char *sysfs_base, - const char *dev_addr, int *iommu_group_no) +rte_vfio_get_group_num(const char *sysfs_base, + const char *dev_addr, int *iommu_group_num) { char linkname[PATH_MAX]; char filename[PATH_MAX]; @@ -655,7 +656,7 @@ vfio_get_group_no(const char *sysfs_base, errno = 0; group_tok = tok[ret - 1]; end = group_tok; - *iommu_group_no = strtol(group_tok, &end, 10); + *iommu_group_num = strtol(group_tok, &end, 10); if ((end != group_tok && *end != '\0') || errno != 0) { RTE_LOG(ERR, EAL, " %s error parsing IOMMU number!\n", dev_addr); return -1; diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 8059577..c72b76c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -79,12 +79,6 @@ struct vfio_iommu_spapr_tce_info { #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) -#define RTE_VFIO_NOIOMMU 8 -#else -#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU -#endif - #define VFIO_MAX_GROUPS RTE_MAX_VFIO_GROUPS /* @@ -133,21 +127,6 @@ vfio_set_iommu_type(int vfio_container_fd); int vfio_has_supported_extensions(int vfio_container_fd); -/* open container fd or get an existing one */ -int -vfio_get_container_fd(void); - -/* parse IOMMU group number for a device - * returns 1 on success, -1 for errors, 0 for non-existent group - */ -int -vfio_get_group_no(const char *sysfs_base, - const char *dev_addr, int *iommu_group_no); - -/* open group fd or get an existing one */ -int -vfio_get_group_fd(int iommu_group_no); - int vfio_mp_sync_setup(void); #define SOCKET_REQ_CONTAINER 0x100 diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c index 7cc3c15..e19b571 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c @@ -267,7 +267,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) switch (ret) { case SOCKET_REQ_CONTAINER: - fd = vfio_get_container_fd(); + fd = rte_vfio_get_container_fd(); if (fd < 0) vfio_mp_sync_send_request(conn_sock, SOCKET_ERR); else @@ -283,7 +283,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) continue; } - fd = vfio_get_group_fd(vfio_data); + fd = rte_vfio_get_group_fd(vfio_data); if (fd < 0) vfio_mp_sync_send_request(conn_sock, SOCKET_ERR); diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index f331f54..60871cc 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -255,5 +255,8 @@ EXPERIMENTAL { rte_service_set_runstate_mapped_check; rte_service_set_stats_enable; rte_service_start_with_defaults; + rte_vfio_get_container_fd; + rte_vfio_get_group_fd; + rte_vfio_get_group_num; } DPDK_18.02;