From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0073.outbound.protection.outlook.com [104.47.36.73]) by dpdk.org (Postfix) with ESMTP id 4F4072BF3 for ; Mon, 15 Jan 2018 06:12:37 +0100 (CET) Received: from BLUPR0301CA0028.namprd03.prod.outlook.com (10.162.113.166) by CY4PR03MB2694.namprd03.prod.outlook.com (10.173.43.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 05:12:35 +0000 Received: from BN1BFFO11OLC004.protection.gbl (2a01:111:f400:7c10::1:156) by BLUPR0301CA0028.outlook.office365.com (2a01:111:e400:5259::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 05:12:35 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11OLC004.mail.protection.outlook.com (10.58.145.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 05:12:35 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0F5CWCj013440; Sun, 14 Jan 2018 22:12:33 -0700 From: Hemant Agrawal To: CC: , Date: Mon, 15 Jan 2018 10:41:25 +0530 Message-ID: <1515993086-22134-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512642493-14609-1-git-send-email-hemant.agrawal@nxp.com> References: <1512642493-14609-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604667553826395; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(346002)(39860400002)(2980300002)(1109001)(1110001)(3190300001)(339900001)(199004)(189003)(50466002)(5660300001)(54906003)(59450400001)(316002)(16586007)(51416003)(76176011)(305945005)(106466001)(48376002)(47776003)(356003)(2351001)(77096006)(498600001)(97736004)(85426001)(68736007)(104016004)(2906002)(86362001)(4326008)(53936002)(575784001)(6916009)(105606002)(81156014)(81166006)(8676002)(8936002)(50226002)(2950100002)(6666003)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2694; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC004; 1:ICaqCq0nsMWjXY4aRu25X3j6i3XyVcj1sTZkNjN/YvsXa88RP0zjzMyw3rLgjikaAegeTC11D0hFPzLtT5z9DWNUPR32DFZ/+od9DkDJv20jEd/qUd9Luw5GX/3JP7LL MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 099be65b-3c9d-48b5-465b-08d55bd696cb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 3:3b586011ElCOC2Bxx8QSIlPZ1vbquet/NPIoG19Db8cQzNUOrEuHEE3931cLEQm4DufDRRssfch+40JM8+d+t9HZLVPtTM6DcWaifC8+O5n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ytmp/+rQec4VsmYFsXAr4iYNkG1sgrmHsLaXdYUASFEcXKLi4+swjYoniUY8KCLkyNdHWuNRSnJUOPFg2jlZ0Ub6z/mv5GMqG4JgJW7mbFZFETVlCegyWXVltiJG9dc8cuPwC1Bc5uNeA9rK6CE0JrCV8tFJ8os6GXBl9WNEd1KciOqEPbp3gQyJhywyy6FPgwzeyiAcEZMQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(3231023)(944501161)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(20161123556025)(20161123559100)(20161123565025)(201708071742011); SRVR:CY4PR03MB2694; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY4PR03MB2694; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2694; 23:HUPBOa6iCauqB8bc+TI33Bt9+McgWQhVm5qe1WzRP?= =?us-ascii?Q?dLNStUeq9nRhGxUOYuwGGQzs6XADvf98Ysqsq0YjnzH6ceMHQm3oxF55xH7P?= =?us-ascii?Q?bL9w1cAUSSBHtfN5+YpOjZwDBUMRS8caGTIZsUB5FcM/KV1o19E5sB2+A+RT?= =?us-ascii?Q?fkkw8bK/wG//utVxjqqQxFk7QvZ9IE4eOUgvePM/a2N/4AKfB+ZDdFUmlfnb?= =?us-ascii?Q?Asnad42/Bj7V6bYxfR1CRWAcxBdMjN04aAMdc6DpkR8QrRh201uYU4/S28aT?= =?us-ascii?Q?1mqN9hrwVEjjB/BTvkxmi9Tl+wCS7jRewJlh59RXlMrXhkp5SDPscJnm3bWP?= =?us-ascii?Q?XsllO9PHiB0Oz6SH8HNmJum3zO44icWYxXrFtDPVK///mewGVLpkjdV2nQP7?= =?us-ascii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yYD+gRq3mmbsKgcBks8KaSfkEpzx1GGF0RrVlRj+6D/qJ8A+W/Q/U27PDzPw/tBqEgM8V0nCxlXoO1J0zt+dh0QgXn0ZtZxp4SRKwhoS9dU8V+xI8koH80V3DSvSZmHEOr39VXRCYcClUjgzdORtfgWP6SBx0QPbh2XTcvuAeQqCp84UEQdwQiPz6CYtnolCAqnEIgvXAa//hPDlJ1Mz1FGnW7QKQTWymje0lasEdXxK0geQwkL0=; 5:lAmzslwp8LQpR1C7uQVwZKdpdGzx3bmC/AEoPRCOmmQoSuOPD5iypyEsQnHH7wrm+D5WUL7fAQkNVKsxcU4aUbEpschGICNsu7lHu+c9TwzLF0TmojrID/h2kEYXcny3Ci6JqHlQId96uKEfxE1SetnMJLGmANivHOn1xY1PFE0=; 24:MJ32Dd46fxtk9tqDq1heiwZBXXwN+p+YNTs7rTjE5nuanD0euYjufLqNNZMrswV4xD1liqmMfcVfo4LZsuP8U1HbuiSvoUuxgbGrJUUmkUE=; 7:ypJfaygSFUIKfAwGhVkrs18s+dI+um3c/IiPcdZ8xlW+qNe9uxFY3iCZ6Wa7DF+j6d1loPz8K9X9bnQAAA79uXM72vdQGOma2bsNO+PDpF+BUr1epItKNlOGjOSgni9SjsMmrGtd9YL47fN8SS3EUY2tuWHiM7w0j2sEM7vOXAeESbujGJG/Y5HCCej7CEyTWH/pEttNZxrKDlXNC06O5sX+sEbsXS58YCYW8lmGOhhMQYD5zOo6+SevQi3IVZSX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 05:12:35.2110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 099be65b-3c9d-48b5-465b-08d55bd696cb X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2694 Subject: [dpdk-dev] [PATCH v2 1/2] vfio: expose clear group function for internal usages X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 05:12:37 -0000 other vfio based module e.g. fslmc will also need to use the clear_group call. So, exposing it and renaming it to *rte_vfio_clear_group* Signed-off-by: Hemant Agrawal Acked-by: Anatoly Burakov --- lib/librte_eal/bsdapp/eal/eal.c | 5 +++++ lib/librte_eal/common/include/rte_vfio.h | 4 ++++ lib/librte_eal/linuxapp/eal/eal_vfio.c | 18 +++++++++--------- lib/librte_eal/linuxapp/eal/eal_vfio.h | 4 ---- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 2 +- lib/librte_eal/rte_eal_version.map | 1 + 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 369a682..7239243 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -778,3 +778,8 @@ int rte_vfio_noiommu_is_enabled(void) { return 0; } + +int rte_vfio_clear_group(int vfio_group_fd) +{ + return 0; +} diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h index a69c4ff..daa0dbd 100644 --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -148,6 +148,10 @@ int rte_vfio_is_enabled(const char *modname); */ int rte_vfio_noiommu_is_enabled(void); +/* remove group fd from internal VFIO group fd array */ +int +rte_vfio_clear_group(int vfio_group_fd); + #endif /* VFIO_PRESENT */ #endif /* _RTE_VFIO_H_ */ diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 681eab5..5371ec2 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -197,7 +197,7 @@ vfio_group_device_count(int vfio_group_fd) } int -clear_group(int vfio_group_fd) +rte_vfio_clear_group(int vfio_group_fd) { int i; int socket_fd, ret; @@ -300,12 +300,12 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, RTE_LOG(ERR, EAL, " %s cannot get group status, " "error %i (%s)\n", dev_addr, errno, strerror(errno)); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) { RTE_LOG(ERR, EAL, " %s VFIO group is not viable!\n", dev_addr); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } @@ -319,7 +319,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, RTE_LOG(ERR, EAL, " %s cannot add VFIO group to container, " "error %i (%s)\n", dev_addr, errno, strerror(errno)); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } @@ -341,7 +341,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, " %s failed to select IOMMU type\n", dev_addr); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } ret = t->dma_map_func(vfio_cfg.vfio_container_fd); @@ -350,7 +350,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, " %s DMA remapping failed, error %i (%s)\n", dev_addr, errno, strerror(errno)); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } } @@ -366,7 +366,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, RTE_LOG(WARNING, EAL, "Getting a vfio_dev_fd for %s failed\n", dev_addr); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } @@ -378,7 +378,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, strerror(errno)); close(*vfio_dev_fd); close(vfio_group_fd); - clear_group(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); return -1; } vfio_group_device_get(vfio_group_fd); @@ -438,7 +438,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr, return -1; } - if (clear_group(vfio_group_fd) < 0) { + if (rte_vfio_clear_group(vfio_group_fd) < 0) { RTE_LOG(INFO, EAL, "Error when clearing group for %s\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 b34d5d0..359589e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -148,10 +148,6 @@ vfio_get_group_no(const char *sysfs_base, int vfio_get_group_fd(int iommu_group_no); -/* remove group fd from internal VFIO group fd array */ -int -clear_group(int vfio_group_fd); - 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 9b474dc..7cc3c15 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c @@ -304,7 +304,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) continue; } - ret = clear_group(vfio_data); + ret = rte_vfio_clear_group(vfio_data); if (ret < 0) vfio_mp_sync_send_request(conn_sock, SOCKET_NO_FD); diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 3fa1e13..7088b72 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -205,6 +205,7 @@ DPDK_18.02 { rte_hypervisor_get; rte_hypervisor_get_name; + rte_vfio_clear_group; } DPDK_17.11; -- 2.7.4