From patchwork Tue Apr 3 08:28:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132703 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3519757ljb; Tue, 3 Apr 2018 01:30:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/8m+GNX6/PVddhefMU072sFBda0fJQ64tqx5312/58RfJAE4nFCdZZKcED2M9qKrDJLjfb X-Received: by 10.223.151.1 with SMTP id r1mr8888349wrb.126.1522744212941; Tue, 03 Apr 2018 01:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522744212; cv=none; d=google.com; s=arc-20160816; b=b/0r//hum/1YEcvMEjfNq8r4GMCZT70kd3VmiAuuB3kXD0mbSOd8MwrkNKmFjKrisa OuLWcafzKz8yYL1cuFxrsxycqewVGoaI0ZiAzcuNI7CG8Hk/0DElnbudhU3F7idAHw6w s9TCBZPIrhr4qo/BCdDSM4yg4oRAy7aEcKKZzfScbBSCS8Fl9Co+wYhfUrLZ0mhzcNHu jPRnE8AsyPjipraMFEF/kVzx5kv3gR8H2Rnj4HmCPV5l1gsGO/HZ6zcpTdSe7DVugTvb sPyuW8IuBMp/sm12t8zmUuNhawlmRPXj11yV63UVR/sV7FMp01e6DxCeYIlLh2EiZn3P 3gKw== 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=FkDXhhZpH2vFy4yOalqoDA18YyhTSfsSav7xc4/BUNw=; b=Dt6U3N4Hf+44FjI6fid5CKah1OeIxpcp3dKB6pEWqFaWQhbPsVUOx8QiUwEW3zuHRN MsN8lxBuhqx+sRFjOA1o2G4tyk7twNlDsBgdWeGH5s2N4CX+aRLiH2Hv+295UaGhwxuf Q5P5CAhfj18L1T+0kfLrmWa4FkOrHsUEVjiCynfJ96VbGSNnLr0PhPlVaehovZiBfXem 5Ct5iUEULWf5IqJGD9oapY90xzM3QUtL6BQJ/vFRawLrG1qRc6+qRAzy+nLHWcIrH/X5 EqCOAmhCGtVNaUDdsdzg52wbeID6t+s8vaqBoZPUX1R6xc3twQhoc1shvxrAiFLK2c6r 9W2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=PRzwaKCj; 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 l9si10882wmh.4.2018.04.03.01.30.12; Tue, 03 Apr 2018 01:30:12 -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=PRzwaKCj; 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 7B9DB1B659; Tue, 3 Apr 2018 10:30:11 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0047.outbound.protection.outlook.com [104.47.2.47]) by dpdk.org (Postfix) with ESMTP id 4A9BCAAEC for ; Tue, 3 Apr 2018 10:30:10 +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=FkDXhhZpH2vFy4yOalqoDA18YyhTSfsSav7xc4/BUNw=; b=PRzwaKCjuOZ1B2DVqsLoxc04Lavgxhp3uA/MXhweV8Hqr+Z5T2TaGhl1Pmc5dHODmLH5HnrSSAcq63dX80TREbQqHtbS7ATLvjj0hAAiyk9nmNhbWSumIzd8xSBFUjWxGJD229XSDPUxzinDemZdplDRfZnhvLRkkoA6mitWbNA= 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 AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Tue, 3 Apr 2018 08:30:04 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Tue, 3 Apr 2018 13:58:05 +0530 Message-Id: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522658173-13955-1-git-send-email-hemant.agrawal@nxp.com> References: <1522658173-13955-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::27) To AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8e9d5be4-2888-49d5-2535-08d5993d1a6b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0753; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 3:MNO/6vL918RISe4q54HK/GMVgZ6F8ByNcDb9Bl3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tDxJFeTT0Go633fXhr+kSIRaFqkuZTC2y+Yehb4tATraR1wF8R77ArT0SYHMq0+CURLx+ePujw3KMxfz5+rOyUtpzlykKrPhLmcFvoNShhRZ1jlgPeONB/g2rsfMt66m1yAlJDmIU1dOHIFdZ/L16/oXFC2rV1nv0JF1Cx0axjIiOuEgPHgq4ZikduoYh16xhTDW09O169AasVSkw5kJAVBxGgdwrnvUNCQ5ttzgawdenK6hfHB6Ap2JG+nnewXXXfEiSY/Q8rRsOLdn458wUW3fx67y79gDaO8SrBEdHw/1rEw0jZ1nPHggxOSx8dYb; 4:w8NhJ0aC5N6fwydv4RhdG1unHzY0ZbaSqytKX18ywOrUAUBHj5ym/GecT7F9N3XyOO9kOwxzMURqmzOTvrMdofyI7oJVAI3/EJ4l8+brfXC+ijNlEdD0t27fLE+pAQS9QTmUwfFvR2tPQ5ZZuLDs1ywtzUxY/3sG4wbDyyWFgKBtQwbEJXJmyyFXwNCcaHVX7rvsDh+Us9F9HpbxHlLrJRQYEtCqxOXNenyrpwvVyTfnkCMrtQRU8t1EKMth/A8Xk4x+CJBdH2hcImxMozhiTMugH6zk+PDiX7YTL42WMK2bg1dJB13ens9UAJrsKIy4 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)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:AM2PR04MB0753; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0753; X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39380400002)(396003)(39860400002)(189003)(199004)(66066001)(47776003)(26005)(6506007)(106356001)(76176011)(68736007)(50466002)(16526019)(486005)(2616005)(3846002)(6116002)(59450400001)(55236004)(11346002)(48376002)(5009440100003)(305945005)(316002)(476003)(446003)(105586002)(7736002)(956004)(2351001)(6512007)(16586007)(186003)(486005)(6916009)(386003)(53936002)(5660300001)(478600001)(4326008)(2361001)(86362001)(2906002)(36756003)(8676002)(50226002)(81156014)(81166006)(8936002)(51416003)(6486002)(97736004)(25786009)(52116002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0753; 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; AM2PR04MB0753; 23:PX8QjzY6OiKuwcupseYMpd8TkgLiaDNZh0xDnxKpR?= 7EzfraOC4pvsH20nKdpJ+cytkywhTmI7KqmA7ene/9UgD6uEY1/nupniuQssdzV0mrNEUjNcK/RLkl+wF1n3650noAKP0dvdGz1chgpyBwzxmLYeSaOBuZD/byliIG1GgZX6rLsU9Ph7hDkE8sTS9GV41K1sdcqugdP91ioOY8SAsIz9syywpU2FhRuKBFrLE/+dE4ingP1asXVNySwqYqjXlfLUPKg1AQ3oikGk2v95YLaSplG5I+uB0Sl4fykIr8QTmumRhBQh2CooPiwPYWdWOitpkdYKuaTb9baN3LG7zljwsWFfCsdYpg+hai9XTXvcW/pBAWEaUwlHtaFMJb3am7Fe6HfP9bqpgbGsEdrnln+pRt0Tc2OvRG0HpmGwuq1fVkcHfOroROLDqrsXbWVu4TDtMY9L68GWxj+HC/t+P4OK/fFtYuuubXyZqYO3Uxhhr9Y85LF8fjye2H+ayI1PhTeXmIa/7AfTglhMvSz6XvUyMAvzBzJLnzPeqOwNAoIOp//5b7q7CDHLVEy1IptD+LJPJmbVrc1VSL3ZvXDdf3fgAfig0CxqYq4UXUNFEWg3RUpzCLfFzsuh+s15jPHE8oAjBZSDUnKXCPv41YXGH+6EMq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9Swd++yU62oRUC//7w7IMSllVw/hAIErddxu55flq2TbcGFo0J6ZemqQ5R4ki9Iv9qaNnVVmEpHPi9dJI/4rqIGICsAtXKi/rnTkWcfTdw/X4bcvMXKlw9XVwGPuzEsdyiyEwc4z0wyHTFpWAj8msKghobPWIga+UXw3x65zDjCJyhl8IQJNKIFAMzHv0o5paAfNL13zsJX85+mFGDW58aLyusXB9DEH5esg57k8dKpMGbY5VTdWjX0Ukba8F6syIdqitbR7Pi1Tx0l3pzQf8cs3iEDm03JVAnw==; 5:OBr0ZW67Iz8cDgWmF98A/c9B0dGcb6lve/yZeC3aJov+srQQZ2EMXxn5NO/a0FYzGtoV41EYCxgr/SMYwIhq0043P6lLfS1W+6kDLXWqH+pIhbgyo9TPjJiMGedNMgcL+ddcMUHQWeSHi+femhxYw5VWEoE/OAt8IxbgC+kcQpg=; 24:drowt5FG+xPSO1mcp+IXvN1tzTn5SjZmICeQ9t7FMv5AbzcClqdjFSOEIY24Z5+6VyiQ29p5YkiM6MayP9q3Hz/HNy5tM+sDC7Fbgzq6bKs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 7:BzWzqObV9ZH7oAUGHv17XZ2fHB5yGUFVTuzr4UiyQKLxfYPazTYIOSYo1j957w+wR3bOGONUdFXKrWrH0oMaPADL2GbNAP6jsVpiZbu9iSMYzHewaB4wy914o2HvyZ8iC136ybdDJ6/yeTv3GZKSo0wnRTV5cKEEHgtrbn4UqxYJfNpJYgk68Rms7vppVjaelf/V3v6iJaYKxeQe4OZ6/abx8W7x7neBICVheAKmHfi+tVl0uOwEmbMlXqru/fKX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 08:30:04.9430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e9d5be4-2888-49d5-2535-08d5993d1a6b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0753 Subject: [dpdk-dev] [PATCH v3 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..12c1ebe 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -179,4 +179,5 @@ The public API headers are grouped by topics: [EAL config] (@ref rte_eal.h), [common] (@ref rte_common.h), [ABI compat] (@ref rte_compat.h), - [version] (@ref rte_version.h) + [version] (@ref rte_version.h), + [vfio] (@ref rte_vfio.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index cda52fd..166612f 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 Tue Apr 3 08:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132704 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3519875ljb; Tue, 3 Apr 2018 01:30:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx49aSuBCyt3rbq4nvqho1D2i2llkwRU4tVL/id8y/JTmnQqOVYUwytLA60cPp29aoGYD02yj X-Received: by 10.28.32.210 with SMTP id g201mr3601201wmg.9.1522744220344; Tue, 03 Apr 2018 01:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522744220; cv=none; d=google.com; s=arc-20160816; b=1IPI6VYJNTpru/5fbf5O6xr8FZySbHjGkFn7bGH4L4TIcxF+wF3qmF1RBgp/t6pDoh HWn5IrzhGUKQL0ZEA/+fm//Eq4tcGp6nipcfTHr5I+lmkOPhR1mbaKisbSj/Zy7uqBoJ atLJMxUNB66iba4BkXb3uQO3GcsS15vnCYIqCna4KCJNIpht3HECjtzof1MtBNfFCCYQ /aajJAbOUUH2GQzZksZSjqezqtgQ4Q58BSgbCbFBlArskKNJmC1hUt6a9uwrMealTVaa L/JlMi1Zfh6CqmHSuEE7zkK18gbmwMVOo8iqTrYwzxtkE2ViTizZBdj1CIlOuirNTmnJ tPNQ== 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=GTLDvX8zrwUl7ddHfFL4W199oP1n3xcz3adguk9ZbJk=; b=xICX7MEscWEOcvPosRxdQdxYeaZ/qwAqWykWxxJh4sSg1rSQwN6up9FPpd1xJQNBx4 9KLvmF+qYJ4v7nT9kbhGDmFWr17XYNiOYcRzjOgznzauc91/HenYF04NbzU5A4/9iYQ4 WOjTSX81fiY/uigZ0GTywgvLOVJByMZzP903qOUc4RgKqYzt4Bf5/lr1WBXhmKwxN518 CJwwHvgVGbZt4GshCBlNNGhhq/cMuVXEd1lGpxa+gcZMYOUUehYZO34ukXLV3Wn+COKR oTQjgERA5M1RZ2T/kZTAksbZ9bFdr+MgCuIaU5W81AQ7YvT+2yC1RGCyxY3XYJKZ9JoN aRqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=bmSxiiSb; 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 i198si1842364wmd.229.2018.04.03.01.30.20; Tue, 03 Apr 2018 01:30:20 -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=bmSxiiSb; 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 D77E71B686; Tue, 3 Apr 2018 10:30:13 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0073.outbound.protection.outlook.com [104.47.2.73]) by dpdk.org (Postfix) with ESMTP id D27AEAAEC for ; Tue, 3 Apr 2018 10:30:10 +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=GTLDvX8zrwUl7ddHfFL4W199oP1n3xcz3adguk9ZbJk=; b=bmSxiiSbAZEZ9799xItJU3x4MuqUzc4xvkeOwbNGyK/UTmpgrrI5+mj8vnfFKYvG2CQWs1G/UzSCL7zbCoyDAaQZLtve+FwrOZ8rx3R/KD8QroEPQa9i7BOOscy72hsjUFAMKcmemgvru7zWjnVDcsgYzeXzoDnV7dg57pi/EB4= 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 AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.10; Tue, 3 Apr 2018 08:30:06 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Tue, 3 Apr 2018 13:58:06 +0530 Message-Id: <1522744086-31507-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com> References: <1522658173-13955-1-git-send-email-hemant.agrawal@nxp.com> <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::27) To AM2PR04MB0753.eurprd04.prod.outlook.com (2a01:111:e400:8411::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0db974c1-9e3c-4215-81ed-08d5993d1b3c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0753; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 3:M0dLdAkCCJjmTqCE0auZ/DSI6dX9OUN2dwV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5nO34D+haocMJji/uES6Cp8jUTZDU+L9lMwgdJ13hsD2lch/rDfJEsEh0L7n7zffSFRxNmuIHoexfsoHE6jeZprugU8h7MnjR0VQtdwRWfUbXCjDTMueYJdC+wF2OITV+bR3JlcdY2nN7B5WN6KRBdLsSkV2qhhQgdqwaOIvlaVJH7HsIYEVuqfTWqAWQOX2SZslt2S+GGOobKWNBqDHel6GsV2OcWLXmYJiWwdhUPtzs6nz0HZri2ecIQ28kF1IjecVd4MTxrfnPGLv/ncV9QoUF3S66edd54Oke5d9yzG7LU85sxv; 4:J7KwPVpZljw37kj+0K9nVvhw0bYiLsc6jdXSXhfJ/Q+hM2N+TDWf6IWifz2keWjd9enOlspr/rjChzXnMFTC9xpnguAcQ4266Nq7qBIdOSTj8nYx4BK3LCed6ADRLqdPqnu9ttI0WHDn4n+1ovhSJeNrmhgjpJNSd8VgYnPdwJJLgtHxmUHZBFR4hYVpCgcC7/O/vEQWc2lWYqLrR5NSQVTspYpEgpVx4pcgNvABpPaT25Dc8IxL+a2E8HRtX2qfB4peuzRQH6DmrRB9hbN7auIQC+wTO56J3FX+hfOc+rCigBB5S0Ekx4czPjpV6nmS5gnG5cUeRnFhM4OMF0+Y3qKCsrZ5mcBLn8Wr9rRXQPQZcNZa9qePkhT0CuP/Z+Fr 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)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:AM2PR04MB0753; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0753; X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39380400002)(396003)(39860400002)(189003)(199004)(66066001)(47776003)(26005)(6506007)(106356001)(76176011)(68736007)(50466002)(16526019)(486005)(2616005)(3846002)(6116002)(59450400001)(55236004)(11346002)(48376002)(5009440100003)(305945005)(316002)(476003)(446003)(105586002)(7736002)(956004)(2351001)(6512007)(16586007)(186003)(486005)(6916009)(386003)(53936002)(5660300001)(478600001)(4326008)(2361001)(86362001)(2906002)(36756003)(8676002)(50226002)(81156014)(81166006)(8936002)(51416003)(6486002)(97736004)(25786009)(52116002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0753; 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; AM2PR04MB0753; 23:6z8GPwPlEVNRIDRUA0J6fFjg6fKuLcDbD9+lwZZ2d?= 89Kjk2n43Bmg7nCY8RCZz+8urkUcCGSuyKrPY4TK6/RyXesIPipecV01u1xbplb61MZ+PlNcuTXSaUT+xHvWGjYtdV8Dh589qP4MeJN2p0omG/Lvr0BN1zeVljWmW5hW4x/vd2KN/EFO+sIwRMld4ZAVZCVtuUU/G/oDEtER9IO9QIASnbB09woW0Xn0HTTS/ok7UgCoiresaZjJryMOl6L7QVR9zVu6mYSNnAWlvRnLXxfqbHqZ8+Y2/ONncpCwpUUWjf0TisKs92TtFY02r8mLI8JYQiZSCpbu8cqQCt90M2tSP0FOOJPHP1WDzGVpQEbSiZVzTLFFuSKSJzuDMR8ymBlNzGjiFsTbiyOnU+5ajkfuo8O8jYP5lkNOuPVZgmY+DjXO4Knhx+Ib6uYDLMSFqDYpCxwviUefoqiW5Ab99eEIOvRfMEp5pNQK0/v1PToKuWuYfK0l87Hfh4qwpfaCox69HGH6sEjOPJkzHKxT1M939++glMMDnIdtd4dOg04BIPYSEcx++nrWjacMV+l8hvKOlYoFdubynj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23J2XIrRl6nq8Cj+J38thQV0CYhy8zNeY4FP+/28zchrHYsYlzkDHbJqMTevdF5/t7XNbPgKdtHlx9Ygjy40zgeebqc486DrAjlewZzkTJW/jSbTGt4yyZf1F/mJiUseKvMgCOdNqYpDiIeHh8zAXszV/CI88q7LUMwUJQacs4Toby11aXCjckO4Uj11fbiNROAsoC8Pb6NcF0dZoH94NzS8mpmKiyXEnsHXVrl2Qe0ceCnPhDqnDt51uAAKPxD578w6QY0CKt7AmKXl/UxLYqiT6tBEbzMGUmRI3uBqXWTsNZoOg6Khd5Z9V6mN+EPSbzAiKHKn+pYLixwyCPN79W3zjRX7wA9op5OL7A3Z3IYytnx7eTaA==; 5:JMecFISxKdL3U5HCVN91NDLqUPGTdKibfRXsHqihlDLWYvEgtGvtQjMizqb3wzhUW05hzvHMgn7/B/XX5TuwqL6b32nHcKB+lkY6G/z0dBhWIvKdl81dRa3OIaUkahFhfFUgbdHrRz2Ws7SNy0n5BM3a+2ZNWQy5SIS9AQG9O54=; 24:4tyGBW1/axl13GLg78EgEug5ZiW4jQtwmFzEJRuVOZuQmJ599JrgnK+qeoYGZk+80TYvl7U37KXAI8bcktfwyvVVF0tgEEyNUmWmpxMi4sE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0753; 7:mCgWusbPtbX9JZqeJZci1TUgWMyiYgkBGKbEmpVlhF464Mp/ZzVv8KapgYB9ybb0+GiNiGh2cD94bd5xJgYoKGXleI6wYn7lAT4L84SZxSABG8EEp9HwSR1MJjk6pKLF1WMJ1VtrhAUY0peRUtQKYFTBHcsYuCVoAuUEOixwd96Wd9BXY8bGJoNrA9F/eh73qlz+6UdwnkX+rJlV3PkvDzaTBzgEp0p80g2c47HKBTUUNu/gAv9E/NLcFHGEuPoJ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 08:30:06.2831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0db974c1-9e3c-4215-81ed-08d5993d1b3c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0753 Subject: [dpdk-dev] [PATCH v3 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 --- 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 | 20 +++++++ lib/librte_eal/common/include/rte_vfio.h | 75 +++++++++++++++++++++++++- lib/librte_eal/linuxapp/eal/eal_vfio.c | 38 ++++++------- 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, 122 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..ac23db5 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -781,3 +781,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..9f75417 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,7 @@ 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 +95,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 +117,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 +132,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 +262,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 +278,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 +394,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 +407,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 +480,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 +558,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 +622,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 +655,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..f663b8b 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_group_num; + rte_vfio_get_container_fd; + rte_vfio_get_group_fd; } DPDK_18.02;