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 D0790A0547; Fri, 29 Oct 2021 16:48:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C679426F5; Fri, 29 Oct 2021 16:48:41 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) by mails.dpdk.org (Postfix) with ESMTP id B460E411DD for ; Fri, 29 Oct 2021 16:48:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lHwBrvpBuieAOEl/DLeTIPtBDltmmrpFI75o8SKywpjLqoPhoPkcc/AePC1hB2tImvBAaaM8c7lxOW3vllKTzvVB4tRzGD6xuV32Ep/0oVLvwHh9zoFwKO/Qn9xcRUCEh+9GCKJLlOHyQeCz6okuoYVBRbZ7I8NABX4iD33jEVisQhznly4oUNScBHeQCK66XwnTGsVoSpOIl4KwZ/rj4cgejk5FvVaRVTukF/BkieCfz9njGULjP8+L401hkqyw8hgHkg68SwgzT1tW13oWjm1An15rYR5qElr9MfS8FrGP3eJzlSbx+ceL77HB7kcTmiizuzKSVHTlkYXCbV15rQ== 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=+fs6t3CUV78kLCw9pb1rTWdeTCA1VSIwpzZ6r9CBFW8=; b=K9OwcYt3T52wQIQ2jjCNM40Y2uutApNQIni7X67lImX+WFQd2yw4ZH3mp6TmJC1HNjbDr7zsdLeJ7+Xf7WYKuoMb4BENeDaoTi0gcIkEQ3EdVIyyWesK/sjO33AZsYJDzn/m23ckVctX+PvgHxtYSek5We1R+pRIcCPkIgjxwdIkmX0mh+lyJZVJLCBewXCMNuDYr9MxoNMpJUyh98dYgC4+B55bTyYutKRPGRTMSL7+95l/Arx14Z8RNMGyTZv6LBBEFfv1qBsvD3O8Hrvwh5P+VPKMPE569wuVQhSj4Ip4UMyRejnrauIACAQeNtAxLaOJ7d4tX0eSUOr9JP7F0w== 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=+fs6t3CUV78kLCw9pb1rTWdeTCA1VSIwpzZ6r9CBFW8=; b=CE4iWIwf1qPqN0K8lK6KXQwtHIq2r1SyPyx02arY96cCbEldauJHKYyFNGSzVpj4VDnQJduaL3TJ+e21XWjINjQN2D9nunibI3j/kPD92/+8pJ6HnYEmRHDX91oVxGRYOnXs3rdz3gHbP/4pcx5s8MhOCF3p1bJhZ+RcEV1hUh8= Received: from DM5PR05CA0012.namprd05.prod.outlook.com (2603:10b6:3:d4::22) by DM5PR02MB2332.namprd02.prod.outlook.com (2603:10b6:3:59::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Fri, 29 Oct 2021 14:48:36 +0000 Received: from DM3NAM02FT026.eop-nam02.prod.protection.outlook.com (2603:10b6:3:d4:cafe::52) by DM5PR05CA0012.outlook.office365.com (2603:10b6:3:d4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.6 via Frontend Transport; Fri, 29 Oct 2021 14:48:36 +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-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT026.mail.protection.outlook.com (10.13.5.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Fri, 29 Oct 2021 14:48:35 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 29 Oct 2021 07:48:35 -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; Fri, 29 Oct 2021 07:48:35 -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=36706 helo=xndengvm004108.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mgTBL-0008YO-3h; Fri, 29 Oct 2021 07:48:35 -0700 From: Vijay Srivastava To: CC: , , , Vijay Kumar Srivastava Date: Fri, 29 Oct 2021 20:16:40 +0530 Message-ID: <20211029144645.30295-6-vsrivast@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20211029144645.30295-1-vsrivast@xilinx.com> References: <20210706164418.32615-1-vsrivast@xilinx.com> <20211029144645.30295-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: 12980564-eb40-4731-276d-08d99aeb2fd3 X-MS-TrafficTypeDiagnostic: DM5PR02MB2332: 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: KA0E4Q0NnpziYdG7GQsQEiT0YeS7Jtkc+ws4Q14gz091qxUhBqllUUjNI8wdkvequZxjvcNM/UpebpGAQiqNbfQfZN8XVJPmJqTZj1dCKpkVueeDcfM3XL0KG9NwBtV4EFaEPqikFjkCI8pQRj5mNY9SOhYrmdWIv3ZMID3MRdDpheV/J3TcZSD1LfKci7Tq83QTXt3B9bL8MxSXQZDaFcdQ2n61zIJr6jTZ53F8P8py8uaFezDxIcm3FtZqW9S/j/bitUBQKZp3d7+rPeNvWTU3WQPdkoqY2rmKvr3L4KjZwG8ArdaaY0VCvs6j1R+FbMfGg73s09ELUsQpMI/jf4sXYcLsckgfpjN3weGbeWLN0SkxmlMQlXXzfJztk8RCuPhsFCgRkkgHy7xpX2chxH8mS2mG1LBvjw9mV/TwpC+ElAz6yLKizd1YjriHVuZvspBW+w77l6tWJI9xJxmNxy7z00zQZz0Euzs6LxmPs3VKLugFqaT2YrqIaXh2dAyvnnwLya7H5r/VhDkhnvlLG08jd+LjilB/SQpeDgvzPyehENeXWroG2aU4lERH31zbdJkg5UUvQ1Pr/20fD9ENifvYqGRhFNZ6aznkhO+MZh3WsoVMWfxC8F4ZLVWgVWGG47s/7LQTJd8FUXfmpzy1C+b3EN0FveXVPi45MkkIfapnukd83mHxJBydeaOs+CTKpTAIesol7pIh9t81K89kzZ4ein4OP6xdCprl2q8JS6I= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(1076003)(36906005)(107886003)(7696005)(6916009)(316002)(356005)(9786002)(6666004)(8676002)(508600001)(8936002)(5660300002)(186003)(54906003)(4326008)(26005)(7636003)(83380400001)(47076005)(36756003)(2906002)(36860700001)(82310400003)(70586007)(70206006)(44832011)(426003)(2616005)(336012)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2021 14:48:35.9095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12980564-eb40-4731-276d-08d99aeb2fd3 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-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT026.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2332 Subject: [dpdk-dev] [PATCH v3 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 --- 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