From patchwork Tue Apr 3 11:10:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132739 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3668075ljb; Tue, 3 Apr 2018 04:12:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/pQQ1W1tK14Mq9CKBM+fMFvb18/BADRboVkt0/zp09YhZvYTGF4aoLKtb9MdE/nAq19mjA X-Received: by 10.28.184.86 with SMTP id i83mr3482682wmf.30.1522753931901; Tue, 03 Apr 2018 04:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522753931; cv=none; d=google.com; s=arc-20160816; b=olQhgOoXKrtiYyw2xG7tN3RBz4IKZiKclI6ZqiI840R46JSzX1QILzJV28QHcs2efc xz1U2wR8jQaKRb+OBjcZ77pAgMhT2zl9SvYKGMMidXg+2xNmGfrxkbrmSog2mo4RoBS2 6Rn6bTlvJ04+3+qYbhJO9/8Nr02+CkVRLgx9IRNUrpA5YdbM4Ok6l+1W4kHX4gH4DQ8D 2i0cGpuDQfndJ4knmxRobjgclGHdAM5Z+UlT/UnP5C6d6IyHDHu6vWdJo5DlLCOVadUT Z+vj70cpIcBTfNwpkmWfszk+mCHiVNxsrnE7YPY+2FjaeSdKkR3HGIGOersBDjv/0UYA ay8w== 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=yMPfpo1pnx9mnnmGIHl1Ehpv146QVxShIOpzEvo1RRrypogdd51V3y5lWOYhE4ZRku 62KRVcn9DWGyWBokLWLMCH5rkKQ3IneJnkGwgSAYaYEwxaY/HdcgBdnOY8LT4Ef8ZSha Ln+QJKOytRnWQWXuszCv9MXhf5uTI4UHf6BrR4d/kaKBtYhyFPxoTuDPbzTazbd/n/zw DZR9iTBp6jAvK6u7xOoOhEpfVFP9XPs8bxEIJoCKMLAvjJGeXWq6Ip2xLfMBaiaFlAaW XVn/Do/s0P6AdcY9qqniEweR64PU3h/FkjfsfZKQzzmecrVAxx5vCnd9gUfaOVZjqoOI skQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=jTy6R9N2; 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 v18si243837wrb.47.2018.04.03.04.12.11; Tue, 03 Apr 2018 04:12:11 -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=jTy6R9N2; 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 3DF4F1B718; Tue, 3 Apr 2018 13:12:11 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0075.outbound.protection.outlook.com [104.47.2.75]) by dpdk.org (Postfix) with ESMTP id 0DAA91B716 for ; Tue, 3 Apr 2018 13:12: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=HHLp2NWaSTPbgUuGzgi8l5sbVGgOXvx/k+dh4KOK0Ek=; b=jTy6R9N27cuyndIcuy8wzCQb5W58QIjfZYqgWMoIpJ3W1U4yDMnjDZyiIWwUR58szGK71j9ZWAokooS2I1BPqrUcmCVS3jVD5jcjFr8nb3ubK9kVZiyvwmORLjERePmwer+krErClkfuAozuqRzgWYaZegV4U3vcYau6vhp2Qe4= 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 DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) 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 11:12:06 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Tue, 3 Apr 2018 16:40:14 +0530 Message-Id: <1522753815-28718-1-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: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0014.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::24) To DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c318a19d-9882-4b16-12e4-08d59953bd44 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0765; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 3:HpCpZFMfY2LeNyEtsyZm569Xtg9igMjO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DOeFBQk0B9UqV8A5/TAoPIvB/qSp8w1uFhmmYzDmI4IxqRuzHiHX8bYadBZb5llww6CJxBesu94aLNtlDX0YmDdF66mxRNDVeSU5E9saiit4kq9OIP3E+UCzl/UFVtHX2nCm+OMuIx3ZaI9nsDBj9+yzbir7fawa3Fhb06SYkYbb+phm5GcJzlhPw1SpZ2ucyvE5Pyhk4uT2agf5mkBv30XI8+hFVJw46o7nk05O51EeQ7lfHTQV9dQ8n1tSpcfGq6XIYT9ywH1erEXxmAgCPRktrt2WKczX2/iF1zHUAKBGEn35UfKWbPqbbinbal; 4:3oMxyazGhEKKsq4Ls7yBox48bMU2Ni4T+5lHhBX6tTIyCeTSjoC9bW6C8CRwLWNs5IBQm06PQakl1qhA1aropNShGjIrWaNHpSPVw/le4yj/2K4tQEyeolMT5QeArju5YqjrpCqfhrSLAR0a+5E82aVi6u3vUMnIz1yaJk4/FlTNrZJh1zN6QQHFov/tuGL97R/8xuio1Qbli2BbR5Pc/04HZcob7GZbaYlNVFhSDF9AnGHRhx3m8E1XC40eGABdgzf7RLTKIZ6xVwk7cqYc24mN1B1jfFZ2wjbIHdeIGckarMEZpnso8htNxxiIreeG 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)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB4PR04MB0765; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0765; X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(346002)(366004)(39860400002)(396003)(189003)(199004)(186003)(11346002)(6666003)(956004)(446003)(105586002)(50226002)(55236004)(16526019)(6506007)(6486002)(68736007)(26005)(386003)(5660300001)(59450400001)(6916009)(478600001)(2351001)(476003)(486005)(486005)(48376002)(2616005)(66066001)(6512007)(2361001)(53936002)(76176011)(52116002)(51416003)(97736004)(8936002)(36756003)(25786009)(305945005)(3846002)(81156014)(5009440100003)(86362001)(316002)(50466002)(16586007)(6116002)(81166006)(7736002)(8676002)(2906002)(106356001)(47776003)(4326008)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0765; H:bf-netperf1.ap.freescale.net; 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: =?us-ascii?Q?1; DB4PR04MB0765; 23:enNkQERiH3Ci6GQc9IBW1j391WiMmnV5HdUsxZ14Q?= T1XiyjwF4SsVt+oMxJTThS6jMzbFX17JH0wSc9QgVhAXHE1Y3Nj7iZhgAdfw8vC5vNFuBCCjRlqo0qcny+QLGJtI1bnw853/di3uYOxIX/FA2H+dj8m5xa35Yx2ZPm9Tlf+9KZVLXh719csLUNuPF9Iszk1UJAEMVSayQTr0wgwdIOmjhvHRUh1lqd0R/OS3AiTBTbhHFX3w+i5cLUsAgEF6JU7WaWPP/5yIeY1lX3imrEp1xRMZ9iqA1Mr8Ca3qyfSDSkVkq2r0WisyEazJj/GETTdthgedr8WJiSU/6vsBHbKGg/azxmk9NgPSjjpNrLfZPtuzFaBDHwJU4aL92VKg5NdlJv2KHvujjAed8Hun7yal2KiwYV/I8L99p1Vf/35S+kAtPmHyZk+fHAep+T9wHO/k9qnFIwNWQG1U7KDmX8ftWGzJ37q3C6MzdV9bbv0mKfoocCBQbveJEmm/Bmd2HxAXuZ/7TKeYQ+GVQxQOkRhTkNKvWhwDWU8qe9kkv5Ru1vRRw8LMhBAVNKl5lyOJctzez6eOV6Sj6M9lEYyBC4I2lEQ/R26KrP8nq/ctEdy1LBxqPQlrbZ6Xj4KjgKJ0FiWWq6A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lQijbW7VOAjferUtitGuSKHYAUSqqtJH2uHOmzxKUxrXB1j8z7XxFLB4R0XVhkzVCAbbitmPgRhjuhUSEJVq3Niwfr4nutXfojDl5CVUdI0ADWmLtVPuSamaLP1+NbDFrC1H/clhRy+gcr//mf1wm8g0NPWJWqKjHspV0k9jTMK+greiLJkBoBddTgAyBwpW5mIM/j0qWemKLW5zSEc8tCrx5Ou765vI80Ydi+ZbLj9dFqil/aWV3HC7m18fwqWmRgC5Lvf0/I3bV1GUsmKy3kKs0VDy0ZJju3LBmyZFAMFSoTCE8DlIcKB9QJC7SkQIAEV9Ho42//hNF+g==; 5:mBd1mnjMVZA9GUoaibZEY7TXEJtfzwPTlcHNxItBVPuggxik5UvHvpnCdhwzVYG5oY+8c2h7AgykSMqGddQKd/5SRtlc0hQ71C3CyxPrNOGkiuYGR7+JMAIt0oGCuxVPwkXUMPMYZxjfZbHkLfHMbw6pNdXfbgGAL+327l5zVgw=; 24:vLBZ9h0lGiMl3+1SdcAMP9zz6B/AY9prEiQmcRlMubLgYoJ5lyoritz9ill0ecbPTH8RAG6p5gw+BNy93vutHXPRejJqe0RrfA9lULT/00A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 7:XkvLwdJcgtpqPfZkhVR2fWN9HYM+rtjSFNPqMidBamn7umwEzf+zUL2IWrl2ERXVZXdHK7hM98hx+G+xCpgvwwLubQpNQhmEsuVwHZ87mODfhwRLmXl8UAL+WWei69AvXMZtreIgdQTzfnREtwTvE19yauew5Yx9EY3j9ELI/bbAREsuxAEbCImSRIEAcGRYhlSiLEqEQzug8MlBqFfhqBCfVBv3mnPTyDdO9yR3OINZ5F5PRVl+LpOGW8Db6ol0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 11:12:06.9952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c318a19d-9882-4b16-12e4-08d59953bd44 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0765 Subject: [dpdk-dev] [PATCH v4 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 Tue Apr 3 11:10:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 132740 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3668266ljb; Tue, 3 Apr 2018 04:12:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/M/jXRDHHTnYC6fTbz/tvJ9AMd7lqRk6bNV0VO/3K+loUtHhjJ/XRnhybayxtz2Ezv84sk X-Received: by 10.28.106.17 with SMTP id f17mr4165083wmc.92.1522753942796; Tue, 03 Apr 2018 04:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522753942; cv=none; d=google.com; s=arc-20160816; b=wK66v5QFQQZsGd+RhVb3In/KeSZHGD0dEbiOW7cOl+zKVx9RAx+mvxVVZLFG2WNkMK H/LwmN8kv/VNAPJwL2LsIb7B5zdl6srFdostpyzyPdKPDP/MsbGu74zI3sX7a7tQTjDb KZZmHKn5a4B+r0qDbfQaSvXRFWzI0T1IzjCXu1D3xI1dgoxv7XCHdTWPWzrUulR0Ueag eNdWsRkaj7RQ+v/mo6WwhnB72EZehe45QBYZx7AQPwWiG9nEAdNfE/50+tH8gBn1g31K 5Y6SrxC2Yj7ngqUSf5ofxye4Uu5dWcrVoynGsgIsnpi5lwBPSmPnTbDTo/QBa4163ewr wLuA== 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=c8m6KE63DVkAzqzaoI3EeJ3nnCrWXj5qvLRwHAzWY1JR3aA6f1IsUBVPiA6WEodLLM ZXwSxs9BQeTdj/UlvlQASwwx27n9z3t2V2smZw5TTpqJEwdstQp6eT715l8pydwP9o02 vROFU9OaoftsKvFERPIy/8+xgEeCXYAqlMY9AQCgsMtiDzTIwihTf8TvCTtlN4DwpaIx rVvSGhyUzLF9fxALUy6h6dNJNfcB3Gl3yfQ9xm5ey8Q086iW2DO1x1na0mmgffaPjCpT dQzTdI/B1UpdPcAAFlU1C0EWMd6hCXKXMRaGky38rBB0AElQSBR6WoPcpeZeW74wQmJL w7pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=ie6BgPA5; 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 c129si199293wmh.277.2018.04.03.04.12.22; Tue, 03 Apr 2018 04:12:22 -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=ie6BgPA5; 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 2F2141B725; Tue, 3 Apr 2018 13:12:13 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0086.outbound.protection.outlook.com [104.47.2.86]) by dpdk.org (Postfix) with ESMTP id 57A411B71A for ; Tue, 3 Apr 2018 13:12:11 +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=ie6BgPA51nmORxv2Nx/2GSUXH8831bKIE2uKpjXV8KEBPcNIqiGMrzbHT6xJsHzD3ytjwXBbbujCs3Fv1LISrqFjNLBHSf8WRk0RZLXZBYiZZ0l998AXO7u0BD6qhEhuauk8AEJRHbW1UPIu4rtsgzvbt/kB+ALa/Mb0lxwcPQY= 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 DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) 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 11:12:08 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Tue, 3 Apr 2018 16:40:15 +0530 Message-Id: <1522753815-28718-2-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: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com> <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0014.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:d::24) To DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 25350509-8e15-4db4-a7e7-08d59953be1a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0765; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 3:5qTBcte8m7tMHDspMrMlfH4lH1Csf1xyHTvaaSNXxBZ9O4YqK+R0Atd3w1BzPMI49IyDRRY5ESjAeForoUY1z/MqxwOBMFcL0zNFP5nL0Kolh5KauvsnL9ol/Gy1isnghZBY7ONdYTzKMZlohjXlTN1t4njxVOBOWHP/1Rt0o+B/AZdyJvJRLTwSzpFTMdfaznWHUvyfh0421yHL93vvKs47DnD9VYiEBQOAN7wlfYp8MfkgIUWp766E9gA5aLMh; 25:qKCR+pIlBSd2IWoeBWtxRSzbvusTGgdiSNi/cvnlrET5O0c6gJVJXSX6i4nDipwrG3S+zj8cml/C6R3vCDDtHB92/qz4LZLjo5xyLu3IAJwT01jvRRXYzI0pvt13FSl57R66GNmBvy0nzSKWKI5skVuIzRDwK07KY93WSjLeqP6tIqgl1YJA/460i5im+JcY7HOS7v7bm5SKu9bRUacLgtJk563J4bFnAjeBpp+wU+25N+UggFGbacgiFpf4J+YaI1OpCrAxovMKgCqvn6vGHMLdG4iFzXsFbmzWyRIHXVs05fuBVCgrXAKL2Q4SAJwNY1hRR3o5uaOd+i6eRpcf8Q==; 31:bgxWTF+OKTDVh2W6TlztViFGQxfbZ+acfSxGDHcRgzkBQIjDaZwl6NM38WX1DRKiBZVH4KqmPbsLsRgCwqwqLZ5baidKdv68V/0EPg6aL4jPGIlSpmqvY6yJ127jvZJOSFwfPK/X8bbjfX7j3bMeEaad0TsKe/y89xay7tU2J+/6zILFa4Whv4O6NODYjK9+aFmMG3wgdgPHttPQza3g/zfai0xcExQifd/xq8o0iSQ= X-MS-TrafficTypeDiagnostic: DB4PR04MB0765: X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 20:MMnSER25fQgPPBiTXl1CCvNRRwLgNEAeYOy3IbGthHwVvNS0Ry0MuOtnfFL1TFXynqeYMDrIyx6UDLCeWdnVDOJGY54W6eL0blubG1gQhHXDlVeo7L5pyT2Ci4eM9Y2IlpWGcORVFbspTsZk8klEAbgtcV+1vSFeKkS65IP4ghqg09ZMj5utZ6udsH5QQXpV5citZN8BsXJb+RSzxXHrENLysarPP13NE7BG40TGZ8BccaT6GvSmQUgK6I1SR/s1TgNP7sU8/lay/+JixOqDg4ixcqlOS6OHtLyjHIgYZ1P0X4I30jwfLQjelJIXny+9zBu1cUE8argMJ8TeJ4FIliJXx1jlx7bfF5UNkYZ3hlUZIG4RdMsaycIqZv1fCZktZdsugjWDsFBE+P6usW8PIBDuUK5HlvDwQXfs7Z01pJo8RI5dsRCIAR8rOK2gTA3Rw0QiK3GHHWKpM/OvVcJcDeosvs+GaEMu/VlFsv1PU4IP915vIjR1nT56CAbAN1ov; 4:6S7NT7U47Utaut4++Kdfa3Oi4O/kMzHcS/ghbc6+Xr6Hq0C5OJyqP/JY7/Ju0MBgdUmLcul/qBCBWG64DlRsftCIVl7YpIYNvips0DEmAcQShADyHtAUY6DAbGI2aCQsvnxq8q0tlo5Z9hxtyr5S658NSYg2fodGvdbNHgZeKyJuBmev1ZJxBOhYO0mwcpZQEey72SqIN291jQt6QnOPJkdO3NfNpP6cQjXuXkOZcbxMdzgrLW7jx8qKlV+AiXRZHqwwctRlADT9gMjqxLA9BlG8cwDcY4eCO2v4oI6RXYpG2pVSARcI2L8wCtjeeW5LMAa4HHwsUrwmyTH5qRDUK9UWc/JnmHQ5U8QjN4p4gT3tqLM2wUwxuJPC+WQXhhlt 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)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB4PR04MB0765; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0765; X-Forefront-PRVS: 0631F0BC3D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(346002)(366004)(39860400002)(396003)(189003)(199004)(186003)(11346002)(6666003)(956004)(446003)(105586002)(50226002)(55236004)(16526019)(6506007)(6486002)(68736007)(26005)(386003)(5660300001)(59450400001)(6916009)(478600001)(2351001)(476003)(486005)(486005)(48376002)(2616005)(66066001)(6512007)(2361001)(53936002)(76176011)(52116002)(51416003)(97736004)(8936002)(36756003)(25786009)(305945005)(3846002)(81156014)(5009440100003)(86362001)(316002)(50466002)(16586007)(6116002)(81166006)(7736002)(8676002)(2906002)(106356001)(47776003)(4326008)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0765; H:bf-netperf1.ap.freescale.net; 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: =?us-ascii?Q?1; DB4PR04MB0765; 23:6mEp/KsVX2ACmexhiRwRIWIREBXn307VvBJdxNGiX?= jPyavfSDt5p/BI1QxuY5zccpFriYvA8FfEd+6B1Qodr3CMvZ3s4crVpXdBMBNqjTrI6w/LHzIkxt7oDEI6Rts4P901E+b+QcoJEXz8xqTb/dI47WQU7aT27a6Un6ym7jstrMB95rm6bmEaSVRhpL82drUpDFocSm09Iq1iembvQq9GmrllQNO494qp6ZJgM0aRtoTlCQVlKo+vJOLtWDrq9JvkF/e+iFhv/iKud8iLfNJM79Cf4lLsEA3o/Dt+rCfoaFcMqeL7afZkoh1d2tpnHDdRbjQCiecTRrg7OaEds6WK4G7PrLulqlIwnXymp8U7zZKa8xVt/s6mjqe0WuxgAofNp/xF07ohmjFjh8KdytqaaUU2nHiY6rAFuc129KApoMFPJuA19cA2N7gHXBDhLdHzRk1SGF8cuKfR0F3ycYbWIFFzkL7hmK0TH1gN3voPucOmhaazDddfJHETg3L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8h4+/xUYartMHLL8/kqZlpJXcF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2018 11:12:08.3858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25350509-8e15-4db4-a7e7-08d59953be1a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0765 Subject: [dpdk-dev] [PATCH v4 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;