From patchwork Thu Apr 12 06:23:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 133186 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1364376ljb; Wed, 11 Apr 2018 23:25:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ujgbCzNeeA9ZG5NwAuWV4bw48uAX7Bws4Xg95XD1tCodva497n5ppFSsP2YAE0QcGWSrF X-Received: by 10.223.220.70 with SMTP id m6mr5191848wrj.244.1523514340743; Wed, 11 Apr 2018 23:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523514340; cv=none; d=google.com; s=arc-20160816; b=guHKhtZt2c4JxOFQKs7YbIf7ZM8APKMDUDdji/4obmUWhtGnZS//iXxafkoPIYhBL+ rXZC0cMNnz/rgFDH0GiZIEQAJwa28OIeAEMv28OEmvmS3QUkNXGIN3y7dOEZ9+iMu94v 3iiVL/IrjnwbCzWxVdzjbW4e6jNoVXLooHlREqD4NjTUpuiIlyzuakKrV0BSd2YQpUGP 18MNIE1Ly3wb34filwxHzQsAkFBi/u+n39v0QtKaAfl9xZQu11UYTJHYm15RAnqbO2Nt 7U1+SBIo8t6t8fRPO+WDeCRl80QeV2Caa3IbaPllB5pvDXy5+6nmRfFuXWYDekoLsGQq VRLg== 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=V5adyxC0A9BffJpWgmNvdomntD2OzBjSjTZy1SV6a6k=; b=yX3TJfiv7j60qtfqp5yMLA2Tq+vcS/ZLNw+1U6YyE6vZPVGZCKLfANq4JA1xgN57kB QwIhpq5SpzGWM1biwn/KJz/++sdcXBbCXlKlEwWkTzyw+tpFGOoFualTC0IVgWioN+Wo F8+Ddt9K4YIe7RH0P2BpBUsY+/IeetM8szsrzHfrHtsvzuH7fBZj4dBoqDCGaTachbNt +gaPgsrWo0B3jGjfQr2sryHtreUzzs8Z3C2Gk/FXZfkJCqeAZk9qwbn6qR3KtyQqtVt0 yHw4w3nNjPq/tgfn8cbicBntLLRrEP/an2kdPTwfnyUquSaCiCC1rNQLU39PznlIsrKg zjog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=inMueu0v; 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 r126si2110575wmd.116.2018.04.11.23.25.40; Wed, 11 Apr 2018 23:25:40 -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=inMueu0v; 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 7E3FC1BA86; Thu, 12 Apr 2018 08:25:39 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50074.outbound.protection.outlook.com [40.107.5.74]) by dpdk.org (Postfix) with ESMTP id DAFF91BA5A for ; Thu, 12 Apr 2018 08:25:37 +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=V5adyxC0A9BffJpWgmNvdomntD2OzBjSjTZy1SV6a6k=; b=inMueu0v+/v8xX6+UVguL2ikke16XvGy43JEJqg8HmXTJs0j6mLM1D05MGBl0loZduU4fVCUq7Um50CHdTDxXWJ7VzgoqJfw8FPsls/5k7f62iXjSJXnjHXrox82pNWg+xKBbKAC0KXDCAGKLsqL4COq5lhD+m1UGdl0U4PWv64= 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 DB3PR04MB0764.eurprd04.prod.outlook.com (2a01:111:e400:9440::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.10; Thu, 12 Apr 2018 06:25:35 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Thu, 12 Apr 2018 11:53:36 +0530 Message-Id: <1523514217-12580-1-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: <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0045.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::31) To DB3PR04MB0764.eurprd04.prod.outlook.com (2a01:111:e400:9440::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB3PR04MB0764; X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0764; 3:Psb5BkEvHoD0KJqyssz69UX25iPCYL1QVWbQSO7zFk3bcGTn+qKRb+wO6JNLqygEqhYJ4jJicWDkT0Q4wb/+2Y1g/D2qaBuSGvK2L7i4E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hSgy157Xth/APJyOnZ3h09/weZWWiudMZWPwfQntNynVzfH9c+mz8RW0Xzh45fQx+B9xWGDsAgnuhnKMkANK+zYvBi/iUN3RzdDe4PPhSHNaYY6VqmQP9vyvqi0tAR3XVUdh1/YbqgDs4fGXk+k5Y5DHAMRZmDqQFNBmyc0fmh1lSdTIzoAcfRLSH7Jyjsx4WkYmiT7LoRle9c9XDfTgFUYivliyE0bIVsIJfsumRAhBao; 4:oNSczku9lMKnsm+jSSY0eQsFSfoIOklKcRufoGrjekjTJS6R9CbpQZFXDW8IqQuKXCA6vyvi/h2zfS/OaGqY83EoZiYLnUQqj+dEKDrHz/ZlmgErVdjJDtosesFamsisXiAcbsYrlxHHjT3w8JFVRPm7prgZfBY+uo4y/DheUEKmTcXh30+wW5tPiHhEPvC4vn6zroYWG9L2w54Ns/hriYuHkZBpX7gofNp1/g6eqfblqW2Qhc1T+y3mlK7qT+9QrT/fiQS/Sh3RWQ1NGPzXWrZtI5eCcXcTx24lJLG/WNZ/NIZL7PR053rWJ/9fpMJm 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)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DB3PR04MB0764; BCL:0; PCL:0; RULEID:; SRVR:DB3PR04MB0764; X-Forefront-PRVS: 06400060E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(396003)(376002)(346002)(39380400002)(189003)(199004)(106356001)(5009440100003)(2361001)(2351001)(16586007)(316002)(8676002)(5660300001)(81156014)(81166006)(50226002)(305945005)(8936002)(105586002)(7736002)(53936002)(478600001)(36756003)(6512007)(4326008)(2906002)(25786009)(48376002)(6916009)(3846002)(68736007)(6486002)(6116002)(26005)(50466002)(186003)(97736004)(51416003)(6506007)(55236004)(52116002)(386003)(11346002)(47776003)(446003)(16526019)(956004)(59450400001)(76176011)(66066001)(2616005)(486006)(476003)(86362001)(44832011)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR04MB0764; 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; DB3PR04MB0764; 23:PAUL5eP1RxK+4OMCo0GLjythjsq2Ja2GlPkAFC1IK?= Ej2H4M6JhxImS8xPk7azFmo4/hLzlN++G1sR30F5pHsZ/wF0wUbYzYsG2D7pB7fmqAwJ4+I/j/d8FxKd+PUNQ3vQ1Z2QpC6zoeRRHeKVCpgUs0k1uthNyqsYWXQheiWcJG2at7Jj6rQkmG0ZzHcf9oVkeYdVL+PF4nNe6sH2WEdeR3ocdSVNEZaqH0GlaJKXgZqel0IkzIN/g+3yNypW+iKB1+K07ZL//5yMXpgKidP4k/+fBCazo1Z13LdM4/h2XDUiy2MPZCZ6G51Wi7ExJI3HzuW4mUyQQILlHDTxJUiuR0gbuotnhb5idHvTULbbVCRayM/Zy1SZP3fINYw8QaDv0C9ow6jC8y4gOYVsZiFoUA3klhY2UeFRkXI4OUgth/X0lHpEydk9PypuiCt1imge5+CVlHwdl9fCrnJxuSuYJmdnWPUzxhI9e7Yk4aJYd4bqHzev935cUjqFdEhwNspXa3QH+2BTZmChjcF3pU8g+/shOYT7QFKU490saUuEdZDpu5y1APQvCczhiipAXzQqAmSjA1BoWtp7Cw75F3kX1IW6GlNYT3qRv0XVXNuBfALCLX0itIpXoXghFkxFArbzVGVspt9fF46b4Qw1yeilKP/l3dcU1SbyR+KQKWIlP44pnW60DWu/74SpL+R6UpB1jEO73JxJPPsR+1heDLPaHe6Ojbih0mthwwVlTHNLt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C3oarjyF6hCpAcjHkoSiUPB1C2SOOm4q8CwuNVSu7uxUpvexZkWmO8WNBwU9Eq0WPPeON5DZlHe/WkDoUAOexfM8sxu7z5xzcE14I+PXsWgW53mqYkUrdWKkBYM/5comcdIX2s059Rq809+q82TL9+uaRvFZnvcVas+BcRt0/9FjkkkSm5rPo39Ct9kHJsAp4aer1mc6Acsvi9rg==; 5:5iSo/5YdviT97rsT8c/i2d1d2irK+IqaaZ9OGewfYTCcK3Nh7MN3fAT2E5nLZE9ckF1y/F3YV4z0kZvtP++0Sg9WzdUe5XTp8ryVHlzbZtI+CHoq6A46e7Z3xiQG1Npna2aswYjz9Z/uGw/somP7H2iFeBc3cEKnJpsNcMUshAk=; 24:Lgwmbzb7HY/F2DyUpsj28VEtYUXiFg9aE7KfBvqE4cVwN3IbZAWkAKf2mUKUFI1AdC2d8f9WGRl1WKPbms89BlzKHmPD5Q2KeD+FXXACLUI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0764; 7:X7ZfSFM92MZJ36kymVxpngOBBObQldtZpM7Dd0p+HD4wLkEhyHvHySY3LLLwmAuqVSEtuxYHadDw/k9xOxjBD01qgLYlS+QiFnjRw7Crjcu2U/nRmq40MKIKZZEwEzOhUkcnUrwJQHwoCsk2tsQcGCCyZxb3Zah97RlvXq0zrHiGJwfkM0prwdlAIhL3no9cn9Xr3lob8mhE+8GhTTjUmokUFNIl/n5IV+OpAvaSqsg6Zddj0QK5tM4miW28N+iP X-MS-Office365-Filtering-Correlation-Id: d75c95ba-693f-4402-2b50-08d5a03e3406 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2018 06:25:35.4811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d75c95ba-693f-4402-2b50-08d5a03e3406 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0764 Subject: [dpdk-dev] [PATCH v6 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 2f04619..d5ccbe8 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 d26ab01..f363cac 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 Thu Apr 12 06:23:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 133187 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1364442ljb; Wed, 11 Apr 2018 23:25:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48FJxFlWDsAsa7DqDuNZUhd45wMMV6kB9jJiJGU83KCrTbEGxH957vMj0rtlD0sVEha7oKm X-Received: by 10.28.74.88 with SMTP id x85mr4875048wma.85.1523514347574; Wed, 11 Apr 2018 23:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523514347; cv=none; d=google.com; s=arc-20160816; b=jgBYjx98j9GCqxivkZ6BgIdaF1LZqshEB/LV2X8lMgAOjRvejrV5l+RIfnFlYt6Khm uGcjlsXYUde15aFpbGXV/gVTLmugujHPpgFgIB71tjO73xtrJkfjMH6AV+iFUdOqkFOI UWQkeBkfzulq2P9Nh/tUmCVpUJ20atzzU/ZSwSufaQYB7SNch44oebTBOWgwDpCc3N0B e9JTJA1cf6Ky42Ve0/qTDzieZmEI/QE7AfQY7WdQtnw3aAh9tYKf1KVEvBg+Bgn8Smkq Hrd6kX7aZonNI4FawbGcisQ+JZHvuJIxXSM06QGyqS9nymdSizthgr3SU5JAsddz1jHC h9tw== 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=GIPz86zQ/YIG8tT9PaNzKshkeuOxsqQLOzYS8T/sefo=; b=aZOfhAgYUOJDlkZ0KGdZAhoqqX8/sxVwJSYmVC6HGGws8aLCAKZC28Z5eEC/4JV5G8 gFL8ilmyXP7Bt+NPZ2GYBVKQxvTga5RG7p2+6k0PXEOi4PoU5t+9ND5snq7K4EI9PJs+ KSjLDieyqfeXAVjSFHNUcaZAmvL1mBpx4UnIrZAmcfa7JeIXaYFGpsGRAG/v1OvKCJLS QA3ltJe4sNicMj82AUOt2oIbWI2rKqxWIAWE/Wg9AaD4iLKrPRa4X+10Ox5sM7d/3i3a HAqzdcbE2Ba8hLgS10VkRgvszLHvoBNjDC0ypQ5tzXzvqFoPdMPUa0Z1UX8/cyL7EC0V lOnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=ckgwSxHa; 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 x1si2057239wre.466.2018.04.11.23.25.47; Wed, 11 Apr 2018 23:25:47 -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=ckgwSxHa; 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 54EC01BACA; Thu, 12 Apr 2018 08:25:44 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50067.outbound.protection.outlook.com [40.107.5.67]) by dpdk.org (Postfix) with ESMTP id 484271BA98 for ; Thu, 12 Apr 2018 08:25:40 +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=GIPz86zQ/YIG8tT9PaNzKshkeuOxsqQLOzYS8T/sefo=; b=ckgwSxHaA4nfM1cdewAApcNQWiuaKwqK4qpKQYxVEBNiN5wDEVWoSOEWKMjngi0ZMDXJ0LhLhmAOVb6reBjUPeW8nJOpy6ZwLtAjkNbrTlgKHDO/wlU66qCg0HqRzhRdw84+G2MEjJXCoZB/STvMru832AWxYCFXMALaE4DU6iw= 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 DB3PR04MB0764.eurprd04.prod.outlook.com (2a01:111:e400:9440::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.10; Thu, 12 Apr 2018 06:25:36 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: anatoly.burakov@intel.com, thomas@monjalon.net Date: Thu, 12 Apr 2018 11:53:37 +0530 Message-Id: <1523514217-12580-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523514217-12580-1-git-send-email-hemant.agrawal@nxp.com> References: <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> <1523514217-12580-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BMXPR01CA0045.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::31) To DB3PR04MB0764.eurprd04.prod.outlook.com (2a01:111:e400:9440::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB3PR04MB0764; X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0764; 3:5mol57qcndgGbY7gTQ+MpXHq05JG9H8l4I372Cp/LNx7cMZe3gy+F1ivU+5i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zIfCZoEBqJLOjYME09M21x+bphXvaaOCxKejEPDna8Sqezz3tuTKPJphmMhIFDJ9N01Nh9SEE7j+Ha/ZBV/2bDHSBuq5ewhK58aKSqN1qCayvGrwP+KUI+6/CSbGzqNz+1j1TX/6OLC35+/aMB9U54FdwcZuS/V+O8F1dFoyflbSCXOk4VDcJQm70g0LlvqtJ9LNE4h01oAgKCeMCerNGRxnCOKc4gfrm9O4BDzAZopXLuO6i3/mU1qYElHKDXfWMer4PAsFusfYChxFenp6hatUyL84LwaV; 4:M9qHs84ABSzl/bb5g2j9cHKNn7+4Vkg2C9C3bsZm26CHYtTBGESrmHGObMxG8ylOtKQWfaF99L3yNWSmtW1BdG44NIZQT7sritNBVdko6hYLJIh5daN48oW1FoS3IORh7utxv32gtAiE6Ig6sd4NxuDwvvfm/RvFTwH8JGp6hEnXiHV8wEW8fl0s471h8D5rRp0njvZYC4oNYndhMFNv8ENM3pMXBHf+YXk9l5zCPujmd5LKOxaDgRDf5ZtclYWdfXpFEqg8DlJokZtuCn1UN4u7pdcihJunc/9JxKoXqYPSDq9lA4f8hSHOq76tM2BxkCwEXUDw9HATF7qTnIB57mQ9J9lQFnrpEL3tBm4fb1vz2BNcMoESnsESV+jSiAKj 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)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DB3PR04MB0764; BCL:0; PCL:0; RULEID:; SRVR:DB3PR04MB0764; X-Forefront-PRVS: 06400060E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(396003)(376002)(346002)(39380400002)(189003)(199004)(106356001)(5009440100003)(2361001)(2351001)(16586007)(316002)(8676002)(5660300001)(81156014)(81166006)(50226002)(305945005)(8936002)(105586002)(7736002)(53936002)(478600001)(36756003)(6512007)(4326008)(2906002)(25786009)(48376002)(6916009)(3846002)(68736007)(6486002)(6116002)(26005)(50466002)(186003)(97736004)(51416003)(6506007)(55236004)(52116002)(386003)(11346002)(47776003)(446003)(16526019)(956004)(59450400001)(76176011)(66066001)(2616005)(486006)(476003)(86362001)(575784001)(44832011)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR04MB0764; 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; DB3PR04MB0764; 23:x+aAXYi22c4eXWoROJguqrZfshJm5zW7LlCfhC2GL?= BqBsPwDu2XdTTkqXI0E0GFI6d2JSdqJY0ljmRs4jq0ETVexMoV7txrA+xASEAiivBkrAr3SihtdZnCJ61j5ToSpeXU32PG49oIYIlvVRlGAhfzCgrOf1VP+H5/xRVOUO5eXg+HpV3e94jLI4vV3rmHb0kXRF2jZZFO6NwyjZ0KV0J8EsfxlG3sCQUOSpC+EYWcLPie9hE3nVtS2cIYy3v7QLqPOCG1q0jflhJdRrAlDo2KGArf5XxZf0nn37Mul/18/lnlcp8yUYMK9BssO+jJiIq1/o+KupufOM0B1e9Sk3tmIWlH8bOFq655e013GHYZMJYFEay3Loxki8hKxvXh5dYgbr34RZo3BXpZFuNLLBYIRWwvjrdrRmPe4wKybMYIOnkCEmm2VePYZhjGrVpsUqBeHyKf6rJajz89vWWJTbHnqheU9deoVcB6apPGWq/DaCdW9gZ5lWTpoY41AG/LF8zHizXfAwu8F0Si9cVgXPUPvF9NT4WYJ+MPMeJmzpCfUB/fahscFREtYdfK7PnGdjmebfMJ2/O8PfGTSn9PYstRqvgqrZ34rrGOABOWwhZF7WzBNi8RcL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gKNUINDbjVMIX5v2Uw6ilyhCDUPX/1vvBJ9ibm3VHk7aCVPQJqPW4XGhZ1zltByUyCJKEyZbdVuR74x8RlcbXY/aRajy6gqg8q6qY5KaK9l7St9h9zMyo9+d283BR9ggDIRM3hICJK/vjEqGfcKb5M23sJRvLxV7NV0bN9gg/XD3Qh3N2FlYepvV4Ku9RCIBExgKgL/pvaUlbkpK6/dyqqG/Ko1RNSD45DBo0zEO8BIpjg43UA+MQKu6OSiBpqDh+JYw0Tnpn9H319XzhfBcsufeFdIOcrM0AL7fG8TZLg2rrqiF6F9hGAlFvmS/Kh8hR0rUE8SNYfk0z3KcPKgu5xlK/w9/k7D+YB5+glm9zsIK2E6MGrH8zwQ==; 5:KmAJF0MiVLdBl1sWTU/OGOtF57ioEGlIgiE3lnSkuwX6ONU67oqpxBSLZl5VtUIy1rjZOuRtcaq6bLms75mN5vo1fkzrce1rt88NDxHwaWkq4/AOuxOsXcIg0QQwbA4Ql+/r2bzNlpaP4Oq6XpzpmvtRFi83nr3pirebb4sDBQc=; 24:i1c/nla2OiqfLj4E8l7CLdKSteEwG/X21e0ChiDl8dlXLNN3tSiFHP216jVBnzEyZHOJKQyADIMsYDfQUTcJcX0h6n0OFVwLEMaYiR37wo4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR04MB0764; 7:AN+LS6aitAGWvPXucUGdJlggmmOn29JcRLhAGr06Rn8CDxe0Slj+C9mu3FL3HRJJPozSpg5/SWHtnJbl/YBv3gnJ43TglNPlM/j0EUufgKQ9J7z661TrN3DODpijJCszxIu1jJRlsAVxO/NphM/uZqrDZbN4b7vghGGNeXqaaU4XayTrTI6UotQlhg/WxbFiTUxPLFpAvZeNP/0qjMfreMoeicYA1AEq0FzEZY4ctSh4fxFvzRReAd/3Bc0qq4mC X-MS-Office365-Filtering-Correlation-Id: 42525939-613b-4b6f-e3f7-08d5a03e34c4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2018 06:25:36.7310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42525939-613b-4b6f-e3f7-08d5a03e34c4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR04MB0764 Subject: [dpdk-dev] [PATCH v6 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 --- v6: rebase on latest master 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 | 74 +++++++++++++++++++++++++- lib/librte_eal/linuxapp/eal/eal_vfio.c | 45 ++++++++-------- lib/librte_eal/linuxapp/eal/eal_vfio.h | 23 +------- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 4 +- lib/librte_eal/rte_eal_version.map | 3 ++ 10 files changed, 126 insertions(+), 54 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 625fa7c..4036e82 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; @@ -726,7 +727,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 727adc5..bfbec0d 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -818,3 +818,23 @@ rte_vfio_dma_unmap(uint64_t __rte_unused vaddr, uint64_t __rte_unused iova, { return -1; } + +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 f363cac..c4a2e60 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,7 +135,19 @@ 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); @@ -170,8 +189,61 @@ rte_vfio_dma_map(uint64_t vaddr, uint64_t iova, uint64_t len); * 0 if success. * -1 on error. */ + int __rte_experimental rte_vfio_dma_unmap(uint64_t vaddr, uint64_t iova, uint64_t len); +/** + * 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 } diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 589d7d4..984b1a1 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -284,7 +284,7 @@ compact_user_maps(void) } int -vfio_get_group_fd(int iommu_group_no) +rte_vfio_get_group_fd(int iommu_group_num) { int i; int vfio_group_fd; @@ -293,7 +293,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_num == iommu_group_num) return vfio_cfg.vfio_groups[i].fd; /* Lets see first if there is room for a new group */ @@ -304,7 +304,7 @@ vfio_get_group_fd(int iommu_group_no) /* Now lets get an index for the new group */ for (i = 0; i < VFIO_MAX_GROUPS; i++) - if (vfio_cfg.vfio_groups[i].group_no == -1) { + if (vfio_cfg.vfio_groups[i].group_num == -1) { cur_grp = &vfio_cfg.vfio_groups[i]; break; } @@ -318,7 +318,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 */ @@ -330,7 +330,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) { @@ -343,7 +344,7 @@ vfio_get_group_fd(int iommu_group_no) /* noiommu group found */ } - cur_grp->group_no = iommu_group_no; + cur_grp->group_num = iommu_group_num; cur_grp->fd = vfio_group_fd; vfio_cfg.vfio_active_groups++; return vfio_group_fd; @@ -365,7 +366,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; @@ -380,7 +381,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_num = iommu_group_num; cur_grp->fd = vfio_group_fd; vfio_cfg.vfio_active_groups++; return vfio_group_fd; @@ -487,7 +488,7 @@ rte_vfio_clear_group(int vfio_group_fd) i = get_vfio_group_idx(vfio_group_fd); if (i < 0) return -1; - vfio_cfg.vfio_groups[i].group_no = -1; + vfio_cfg.vfio_groups[i].group_num = -1; vfio_cfg.vfio_groups[i].fd = -1; vfio_cfg.vfio_groups[i].devices = 0; vfio_cfg.vfio_active_groups--; @@ -544,11 +545,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 i, 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); @@ -560,7 +561,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; @@ -733,7 +734,7 @@ 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; /* we don't want any DMA mapping messages to come while we're detaching @@ -743,7 +744,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, rte_rwlock_read_lock(mem_lock); /* 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); @@ -753,9 +754,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); ret = -1; goto out; @@ -818,7 +819,7 @@ rte_vfio_enable(const char *modname) for (i = 0; i < VFIO_MAX_GROUPS; i++) { vfio_cfg.vfio_groups[i].fd = -1; - vfio_cfg.vfio_groups[i].group_no = -1; + vfio_cfg.vfio_groups[i].group_num = -1; vfio_cfg.vfio_groups[i].devices = 0; } @@ -841,7 +842,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) { @@ -919,7 +920,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; @@ -983,8 +984,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]; @@ -1016,7 +1017,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 549f442..c788bba 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -81,12 +81,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 /* @@ -103,7 +97,7 @@ int vfio_mp_sync_connect_to_primary(void); * the group fd via an ioctl() call. */ struct vfio_group { - int group_no; + int group_num; int fd; int devices; }; @@ -145,21 +139,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 2b5b1dc..603c744 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -286,5 +286,8 @@ EXPERIMENTAL { rte_socket_id_by_idx; rte_vfio_dma_map; rte_vfio_dma_unmap; + rte_vfio_get_container_fd; + rte_vfio_get_group_fd; + rte_vfio_get_group_num; } DPDK_18.02;