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 0BD34A0C4A; Wed, 7 Jul 2021 10:26:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 793404149C; Wed, 7 Jul 2021 10:25:36 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by mails.dpdk.org (Postfix) with ESMTP id B8CD34128B for ; Tue, 6 Jul 2021 18:49:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WX98e0ZebMOaN9V181weQzclAw7olcxCxO9g6t3vK44parXXkObVoO2kK5iJ0QoU5nOWn6ZRiXnPtm314QO535rVwbxL1hmEr+7C0i2g2mHCO+e40V45kF/l+WOm/yCyNk5pGYybMvUD4PQ029Zrfh1A/X2FLYwUlnRJPr5rOG5fDWO4y6V0owsxaoBrXh4SJldw+9M/rItxEIct+r1MwBWs1cODGy9Dkc8nWxCUuvLBY+Rpoj/cIt756B5PuH7WUmGJr82tUQK+DpYzmzbkM0lFapSWXJO7q0fVbEMJYFuHJew3dFQsAaEHy2fEppeS95+NScD1u4Hokf85KIZZlg== 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-SenderADCheck; bh=BVA8Vkm9urQrlui1m/s6WcutjuQ0m8iWGkeWm6MF0rg=; b=Y9hgc6lM3FHhWEPNnWsoh3ygfHi2GjMXopnGVk7Zsfs8pNRxhXb2YvILMECtolue7mBCy9OsvfFoJURyGjkbo6xKEKBEfDCwI10Cg8M8LWWiPOA7/Eied0ZQC6NUCcA6bvCNECuOCeVVHcHnlpvGM9lw0gX8Ahyi/w65TtKW2Re4kpiMbBTCewny6+SDlOF4uZfeiOF9wCphHA2A+F+GTbJu6RqBPlZWTZbNT9hYmucR6X27e+JUdZY/wmfFXhTI5i1xwxCVhqxRlf3RUC/3PAwu8OStK0aQPJUQPgpDwIUe3p3sivf77IbebbJx5Jqcuij5aN0HTtsDKRyAKVWspw== 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=bRsQx32sRUPW0Cr07IvP7KCUrvHeWIig4bGe9gVw7gBUXIAy9Yp+W0Ydf/M9mzNJFhc4j6L8lSxrDwJA+BqT/GEehoJLPMCkZurlVzqq023Tf3dlcrav0zOs5iDVstT9KrlnyYa90Ikk3q1flgeUJyZzJ+P23BX+NlCOy/io/es= Received: from DM5PR13CA0039.namprd13.prod.outlook.com (2603:10b6:3:7b::25) by DM5PR02MB2250.namprd02.prod.outlook.com (2603:10b6:3:51::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.32; Tue, 6 Jul 2021 16:49:28 +0000 Received: from DM3NAM02FT053.eop-nam02.prod.protection.outlook.com (2603:10b6:3:7b:cafe::66) by DM5PR13CA0039.outlook.office365.com (2603:10b6:3:7b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.8 via Frontend Transport; Tue, 6 Jul 2021 16:49:28 +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 DM3NAM02FT053.mail.protection.outlook.com (10.13.5.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4287.22 via Frontend Transport; Tue, 6 Jul 2021 16:49:28 +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.2; Tue, 6 Jul 2021 09:49:27 -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.2 via Frontend Transport; Tue, 6 Jul 2021 09:49:27 -0700 Envelope-to: dev@dpdk.org, maxime.coquelin@redhat.com, chenbo.xia@intel.com, andrew.rybchenko@oktetlabs.ru Received: from [10.177.4.108] (port=54950 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1m0oGF-0000pF-5m; Tue, 06 Jul 2021 09:49:27 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Tue, 6 Jul 2021 22:14:13 +0530 Message-ID: <20210706164418.32615-6-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210706164418.32615-1-vsrivast@xilinx.com> References: <20210706164418.32615-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: a4f8faaa-861c-4a3c-f2ae-08d9409e0511 X-MS-TrafficTypeDiagnostic: DM5PR02MB2250: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HP83W4/84pQR8G6qI5276Rq1g2mc0oUJ5FcxMXjiK6OXYtJr8c6BjTcheYbLuvDrl6PkDe8pzdHuykndCfsYHxcF6T66afHqQa/EkNmMqEv2ZoaocYRizu1FDWSuLYyZwTm8pO5/Z8zgo35Swz8V9cNssRBsbvoC/2XZypqhkVeH9zTFR+NEjDODYd6xvbPi6I3DLSog9zk4McD97+ETKdf8NoRFSyMiH+K94bFLeWprCeMWEgTiVe6JRGa3dYWg17DU/xIIgXckAlKPB8iwqQLuyeRDjaK4o9EODatBhr6RgSCS3RRYPaTFeudieojYbyN5HHtt9AXFaBcWWkJJ8IHlLgWLrFHtHMBaygt6cCq18DqcBIQeH5izw4EfAoFzz5wDkplVxDXdcU++GpDCA/0c7Zpe6+WLnxjK9oKUd9mbd+/w6y5pcmv1TbPxlF1PqrvsaEZOa4p5212uWbMW2GSDteoAGZwxoOcbLd0Q7xL6s+PrQcmqTztmQBo/8rWCTUrmkzqcxkTuSh39dmKtIZKENB3SigjE4vuG6jGofeXhP+svHgLO1j2S7i/sZTpJ1ymB2fcY7gkGzrFm3HXzGxhnIouYHDHu/IlgJE2qgYBBVy+Reij+3/fFzZtqIPhwN0OXGHiRZx083A9S1NalCYOHlNtOg79fzjqMpZK07uo/THi7Wx0Py3FUmrs9hMIWcFyn3I99Isd/cwv9MnXPYtEF3ZTBbDOfTs0z3FRAZ9k= 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:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966006)(36840700001)(54906003)(316002)(70586007)(36906005)(36860700001)(7696005)(44832011)(4326008)(82310400003)(2616005)(5660300002)(6666004)(47076005)(70206006)(8936002)(186003)(8676002)(83380400001)(26005)(9786002)(1076003)(6916009)(336012)(426003)(478600001)(36756003)(107886003)(2906002)(82740400003)(7636003)(356005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2021 16:49:28.2818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4f8faaa-861c-4a3c-f2ae-08d9409e0511 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: DM3NAM02FT053.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2250 X-Mailman-Approved-At: Wed, 07 Jul 2021 10:25:28 +0200 Subject: [dpdk-dev] [PATCH 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