From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB70CA0C45; Thu, 28 Oct 2021 09:57:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE7964111E; Thu, 28 Oct 2021 09:56:59 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2043.outbound.protection.outlook.com [40.107.212.43]) by mails.dpdk.org (Postfix) with ESMTP id 96E5441104 for ; Thu, 28 Oct 2021 09:56:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KtvBNzHeRfQaffHVig+9QC1L/r12/RqxVf/j4xQ49FzrQF3f/Rla62LZvc735A4Nnv7HnE1fjuymBxKfVZAJSx6WWfraAzsM74bR0AELipTDd/X2uDRIJ1a5N3MepFf0CuxrrSjexUs1e/w4x1qxbYdah4dQLrwXf26Ry+OyZfOoz0jf+7KhG3I7dztlUY/6kNd3dsknFmJz0dcW1ILttw63FHRuLmGpE54HI25AXxmC59CWXkaZICxmYVn93FsafEgjtLvSUn7PC01M24/pwlmwf+o/wRgtzU1D4q2a9qsJS8cthueQxNsCQAwqvTESSp0Bd0/4IS6HvabQHSNw3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BVA8Vkm9urQrlui1m/s6WcutjuQ0m8iWGkeWm6MF0rg=; b=XTYoXqRJr6WnZ2h+6NV+ZFaOgCcrd/ImTmSBUzj9BTkOoxObmcbZjgmQ+ghQX4tGOtpZeRYCiQWA/05jaZ0VIKQMBKdmDcx0ycQrZO6RaTbmnXeG3xKhKR1GIJTMDE6/G2e13lx2+HzfkieOJS4TTLYEWi6ogwkztrH24dZmV9JKA+/kh5M+baKJ3tHVZffY6GMzLPHsredKRv9rX9LCQ+n2kdypMdqTOODcW5C0fzbpKmoTmSqld21rf+BOQ67yX7RmUueejYLlH6gA89sCrHxHLNFY1s1gVKdftEtwoqGEX2OvSJTOZIcS2RnYKZl5bUOA7HtQZyDz+ciAYziUjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=dpdk.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BVA8Vkm9urQrlui1m/s6WcutjuQ0m8iWGkeWm6MF0rg=; b=enh4EUr/IORpUvpvrjV7mVEaMDhu7Eu8ubGUvFT7HD63Yg7klDt0iY0r/dItHq/Kp6usLBJ2l1gmxaFeEWM3dUwoaV6GCAqzpLQkXuqHVOenfBAaDHzA/u4zNmom/BIehHdPZxUlfW4tpFWWmwjz5I2kn2lgYoNLlx7SrR/DEBo= Received: from BN9PR03CA0749.namprd03.prod.outlook.com (2603:10b6:408:110::34) by MN2PR02MB6176.namprd02.prod.outlook.com (2603:10b6:208:1bb::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.20; Thu, 28 Oct 2021 07:56:56 +0000 Received: from BN1NAM02FT045.eop-nam02.prod.protection.outlook.com (2603:10b6:408:110:cafe::29) by BN9PR03CA0749.outlook.office365.com (2603:10b6:408:110::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.20 via Frontend Transport; Thu, 28 Oct 2021 07:56:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT045.mail.protection.outlook.com (10.13.2.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Thu, 28 Oct 2021 07:56:55 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 28 Oct 2021 00:56:52 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 28 Oct 2021 00:56:52 -0700 Envelope-to: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com, andrew.rybchenko@oktetlabs.ru Received: from [10.170.66.108] (port=35870 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mg0HL-0005p5-SB; Thu, 28 Oct 2021 00:56:52 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Thu, 28 Oct 2021 13:24:47 +0530 Message-ID: <20211028075452.11804-6-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211028075452.11804-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211028075452.11804-1-vsrivast@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f32cf62-1be9-41f5-bd9b-08d999e88302 X-MS-TrafficTypeDiagnostic: MN2PR02MB6176: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E+pEfdrw9REXlam9BEN0WmeFoGof46E7ZBK9ixpRCnb4BF2o0dw9Dv4Ydv9WjX4AO3diPxWlmK00dS4HnKuh3eLzaFWdtrtm9G/Fi9NKDMshPI+RpbrpAvv86KCosonsxZh7G3fs/ULs+ldxXtk+19qblYxQD4VEPa3qMef31BfnojGe/k2RzlZtejuWI57AVK/jlp8ZhhVGkM3qVjEKkd8tDimZtQmeO5hSZ2XcncjauNmDa9jyrgirJKFnqBuqseGndMiDRRFAGuYkuI4bh0j/Alh2dxLTAcAC35ellQPuPRJiM7qzwmMP8EDOg8pLyAKe0/nNUX2jJvIMKiD8ob7Vl82Xor0IRXxHA6VxhR6uEswqTBCJ32s2/mNw9VkIrN/5T/CFcL6rh6snc6VTAf/r4F6x9K1O38g5XdZn38mo1kt6qrye6RqSRcBgK/CY/La4KIyEbs3ADZFGb2S6aVMSQunLI5Mm/2IFx6jmmMRgzjKGIzCz+phN5XkSg/m8Yxux/T1PZ/EXze0xqPqkGxdIlxZ3FLlS+9mMy9+2yR3X3TykRLM2rs9gMRDvMULBE0qJphjN9ou2dfKrLUkhC54N7Wu5MXKgK0P4ZoAx3U/MN9IjprW3HX226dErwXYMbg6PR4zyWaDQJ9ChBjUbctOo3o+qz3PxhlH6iiLU9kLaFzeWRTzwpsZq1p80wNxlqwxLqUDDoxWTo6cGyczaFJtXXMkeAag5aVrQl0fRL4k= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(36840700001)(46966006)(54906003)(7636003)(356005)(2616005)(508600001)(82310400003)(426003)(107886003)(2906002)(70206006)(6666004)(4326008)(70586007)(44832011)(36860700001)(9786002)(47076005)(83380400001)(6916009)(1076003)(36756003)(8936002)(8676002)(26005)(36906005)(316002)(7696005)(336012)(5660300002)(186003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2021 07:56:55.7383 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f32cf62-1be9-41f5-bd9b-08d999e88302 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT045.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6176 Subject: [dpdk-dev] [PATCH v2 05/10] vdpa/sfc: add support to get VFIO device fd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Vijay Kumar Srivastava Implement vDPA ops get_vfio_device_fd to get the VFIO device fd. Signed-off-by: Vijay Kumar Srivastava --- drivers/vdpa/sfc/sfc_vdpa_ops.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c index 6c702e1..5253adb 100644 --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c @@ -145,6 +145,29 @@ return -1; } +static int +sfc_vdpa_get_vfio_device_fd(int vid) +{ + struct rte_vdpa_device *vdpa_dev; + struct sfc_vdpa_ops_data *ops_data; + int vfio_dev_fd; + void *dev; + + vdpa_dev = rte_vhost_get_vdpa_device(vid); + + ops_data = sfc_vdpa_get_data_by_dev(vdpa_dev); + if (ops_data == NULL) + return -1; + + dev = ops_data->dev_handle; + vfio_dev_fd = sfc_vdpa_adapter_by_dev_handle(dev)->vfio_dev_fd; + + sfc_vdpa_info(dev, "vDPA ops get_vfio_device_fd :: vfio fd : %d", + vfio_dev_fd); + + return vfio_dev_fd; +} + static struct rte_vdpa_dev_ops sfc_vdpa_ops = { .get_queue_num = sfc_vdpa_get_queue_num, .get_features = sfc_vdpa_get_features, @@ -153,6 +176,7 @@ .dev_close = sfc_vdpa_dev_close, .set_vring_state = sfc_vdpa_set_vring_state, .set_features = sfc_vdpa_set_features, + .get_vfio_device_fd = sfc_vdpa_get_vfio_device_fd, }; struct sfc_vdpa_ops_data * -- 1.8.3.1