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 BD1BAA0C53; Wed, 3 Nov 2021 15:01:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7394642744; Wed, 3 Nov 2021 15:00:49 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2088.outbound.protection.outlook.com [40.107.101.88]) by mails.dpdk.org (Postfix) with ESMTP id 09EB942744 for ; Wed, 3 Nov 2021 15:00:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bXf32hxengujLO9HAX3+ldfYNOub90Yvcpb0HraFz6u9u+CnUb5RUEyYXxJtTJmOckPkXW3YIMjBS6RJSDNg2fGFtAVLMG4r2qkLO7q/+2CE7+E0Q01MT2xoony+Zt21tkKyzJDN/znrJ+xXMzJfDXfLaJ1SxWvKTioS9v4TYsKHjTJfVBfyPZFpUr2I7NK/DnqFMIGxZYW9UK7QXr3hJg9ZEPhRiGo5eJcoX2wt8WDJOoXSoCe4nj88fiL+nWGCiQfDzk3fRV6tlFELis1a4hVpRn1LpIceFx+FO3EUV8PX1pQBstKuSAd5a9cDePoSo/uj6WIYdUo12EBVH6Luuw== 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=cTpYg7UFlLGhD5kdyYDCtR9nVyNzCMJeFWQQ31LySpQ=; b=VLgBMKCCJvkfIZe44SluuOSsvg8G8psYNUhRhCGdu47KzKbTHxStfQZDUab3EDDCSRC2Xl3eQsc+jnpN5sVB68pVmDo5nOq7XWJOxaDJ1G/9uK3+qCMpasZtv4Uybo7Q+BFGQfXIRohKcFQyJ6Wl/IEZ8t65fVdlWmoP5ox5P9/MdAB4wUnC8mqX8kw8+/YDLEHPo3H3INNdcLX0lQ0BohwDeN+4eVmbQm/mCjyznDNJeRkd/ioIwBYsNZgnr8N/fn+ghxSADXwZEIRWMYrsH0Knu3QMbf4idvjbOpB+Bb27crEBXtT7s4Uw6jhLI4eewQQjCLTnrVk0zxdX0CJRsg== 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=cTpYg7UFlLGhD5kdyYDCtR9nVyNzCMJeFWQQ31LySpQ=; b=rDC7cZ6U8+lAH8fmGt7ixlQ+JqDAiredipeiCGQJzZjl/XgvNi0c6uL8WR+Sd+vSi7WlXwjZrTqYwyt2QFwQQk+vQiPKEVN943gmwHcE/Fg86sdTQEEY3Wbmb91fJqMhCn2I24UWlgGI4GAolu3spea2thflz0+R+l/ayQsNrsE= Received: from SA9PR13CA0029.namprd13.prod.outlook.com (2603:10b6:806:21::34) by PH0PR02MB7416.namprd02.prod.outlook.com (2603:10b6:510:18::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14; Wed, 3 Nov 2021 14:00:45 +0000 Received: from SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com (2603:10b6:806:21:cafe::1) by SA9PR13CA0029.outlook.office365.com (2603:10b6:806:21::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.4 via Frontend Transport; Wed, 3 Nov 2021 14:00:45 +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 SN1NAM02FT0008.mail.protection.outlook.com (10.97.5.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Wed, 3 Nov 2021 14:00:45 +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; Wed, 3 Nov 2021 07:00:44 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 3 Nov 2021 07:00:44 -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=38886 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1miGom-0003SS-43; Wed, 03 Nov 2021 07:00:44 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Wed, 3 Nov 2021 19:27:49 +0530 Message-ID: <20211103135754.17411-6-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211103135754.17411-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211103135754.17411-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: 321ea52f-4920-4a95-8c1e-08d99ed25509 X-MS-TrafficTypeDiagnostic: PH0PR02MB7416: 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: Jl4NIjORIzJdeTjQG4Xk1lrUhMvZ24hXLrzOEuLaF5E3QTgXg/GFzry0qeCbdscCrQB/PSOt6Zi9XkFgMFl/lBInnjlPZGT2fI10DxEeOgA5uqvpxpNV8zWcndKYPUDFeISsQblUH6+K9JEq6B0FqBZFVXtYfT9L/UYY8+xYAo9Thrr2M3bqnjynbxm2HoTVVEnJ1KiXzDwTcRmVJ1Lne9kxi6TetiHGuyrLmTN8ND0wjYv/+QL/6G10dkA8+w7yxN1KUT6pvMdgRs/Lk3r/hTbCG4xrxvVKGVivIZ+qdOXv7AQt3KFPwlIjCNekE50u9Jnw2uvsHfogauUhP1afcw5QsC9dMbUNNDdn6vYVNrE/bDYBBGBAYrWNBZ8acOZR5UFZGW+i8Yu84uaF3myPUgSJ0pHVMcsy8VRv+U7N0dhSASjUZSuP1hCiroJiaHZEwqf/0GVUi5k88gKbf9+QDaMkQPYTm/gI6a/TIC5kj+uMmYYifaFSazDMyO2qUH/X1lXSMHEOHjfBtVnbrS+sfKC0ef8bv4TIICxtQHmH9sH2taRrKk/JQAlcpTf4JAKkPoROk0g7Vmq8nf0bue6u8Sd+AO5Ah3pVlIU0cmdB66qr8lSBaZLsAHfiJ4o2DbhjROLSuJdcnn20aXWDlJGWUM1cwrO+aRZw2i2MbrIiUBR2IDDhk+yOOAyGrHqjCd07teFr8VBbUvCqG6Yew3F+6oyu9UypEyA+/2pNN7A2bh4= 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)(36756003)(7636003)(9786002)(356005)(54906003)(7696005)(107886003)(426003)(82310400003)(36860700001)(508600001)(336012)(83380400001)(1076003)(316002)(6916009)(70206006)(8936002)(36906005)(5660300002)(2616005)(44832011)(186003)(47076005)(70586007)(8676002)(2906002)(26005)(4326008)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 14:00:45.5856 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 321ea52f-4920-4a95-8c1e-08d99ed25509 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: SN1NAM02FT0008.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7416 Subject: [dpdk-dev] [PATCH v4 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 Acked-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- 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 9a95211..b5815df 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