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 8E59945459; Fri, 14 Jun 2024 09:03:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7D49427CC; Fri, 14 Jun 2024 09:02:16 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2124.outbound.protection.outlook.com [40.107.244.124]) by mails.dpdk.org (Postfix) with ESMTP id EA6B6402C6 for ; Fri, 14 Jun 2024 09:01:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PwFZY48lPZJWLRF3MaGM/GMemcsAXFmugOXhwOQwTEOCcw5VyjNYCabFHjPQ5bSsyGjNebuUeNNCGK1zHlE1525JmcdUxDdbw42Pgm+qYnkUmBMwV4pGA0y1usUjvXAFK9xxTSquOMykXsVEfhan94EZZ6mE9krrGeKizzPypJQJaSuTTIidxGff8VEJA7kPiMhtEx6+ZmmVhMkDMi7dvZMY7Pa01fK4YUieG0y00V9adYLjJ2NwB8II9S4wuYwcx20JbEozGMGL/FE2Tfvl3c2w9V0Ah5yDfYFj6SpOMO4xw/zQrNwj17xotUlHMZX3le5TJhUfTqq0w8dunxoTdw== 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=IJbr2Uut+3dBDNoSckXTZ323O13uQs1IQRrxZhtlpiQ=; b=a7THqY5lZ8mVfgu/dKks5fxCVwnZDAHlDAdS1Dm7J0ZLZ0lOB6Ssuqct1ZRYm20bnawf2Fafi6CbQy4jIEyK1xNOXuoQlL0kssWkysSpoNpmfs3z3g/ioNEREle4wHswCXOF4Wxqv/8UBD/4eUjBvCWND8Pw2ROR+YzMWpU31RPg537c5ZSUzC5ihSrw8V+M6E4jNcWvhB7aDpG5vlqR0s9nQokozpM1bWjwLFrJg/hfZCZiDKFOv8HS7LGiflkaWfkoCqd3PMVhB1slkwfz8HLrTxqWKuT2fhhbxyp9OzH+mwM1kXh0Rb1/g3FkeZntsLhHmUXriSeAatiu41niTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IJbr2Uut+3dBDNoSckXTZ323O13uQs1IQRrxZhtlpiQ=; b=PQ0i7MasjCKEePa9e45hTNEBpHLgdPlWNvE3yMWxy4dltZYXs+33Y6z3UUulTn7dqkvSGH1ZxdMOgmG9LZCqV2NHEUPizPBV1ibLZP/DN7m90nXJoJ7uB6pbsdZ6gGCFFwQin9D4Y2L5AtivIVslZnBxngWDO6vznYF2tiU95TU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH2PR13MB3831.namprd13.prod.outlook.com (2603:10b6:610:a3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.25; Fri, 14 Jun 2024 07:01:53 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.024; Fri, 14 Jun 2024 07:01:53 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 06/11] vdpa/nfp: add the interrupt logic of vring relay Date: Fri, 14 Jun 2024 15:01:15 +0800 Message-Id: <20240614070120.2663160-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240614070120.2663160-1-chaoyong.he@corigine.com> References: <20240426074831.1729792-1-chaoyong.he@corigine.com> <20240614070120.2663160-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR06CA0025.namprd06.prod.outlook.com (2603:10b6:a03:d4::38) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH2PR13MB3831:EE_ X-MS-Office365-Filtering-Correlation-Id: a32ed507-b5ae-49eb-c007-08dc8c3fdef2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230035|376009|366011|1800799019|52116009|38350700009; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?z7cU1oSQbCqFqbxQrbAirSRSaUkbuCM4v1RGbesdlwjarhAUWAHYVBOvPdSY?= =?us-ascii?Q?Tiwz4Jk+/X+ClPAaHNA06VD1EtVAsjp6New+Cvk6DTSrL5j6etY5GqqEbX//?= =?us-ascii?Q?18B/L83uHa0sXVMqdZlSqVqpFS26fUEoAeJTzph398uH4yZ8d1SrJwiSMuB3?= =?us-ascii?Q?y0aXbSYtTo0uObvDeS153ERe7WfaePBsC6r9B22nqm3zKqZYGddR8DhF+I0e?= =?us-ascii?Q?Bskb4MFNtfv+p2EDrzTtAQxJi+KbxQsMASjY5z1rK2J5iY+kewnpSIGYvsk4?= =?us-ascii?Q?0/FrTRePn0XqrRZafrZQDf2IK/qf6kAVRox1sz622K5gRZeEQS5FDPLl2IEI?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SaYhyZTQeL7pMnJPYuH8oWRadwaye3Zd4uC?= =?us-ascii?Q?khEC8V9WKcT3m9XF9A9RAuk+LA+uXUzDEk7pxWQPErewl77Po4exuBhADokg?= =?us-ascii?Q?J8USqJoDGLODriG2Ig75419i6VrFVCyvLcIPj/Or0hK2E1vV4baOWxB+NlEi?= =?us-ascii?Q?dI7+2Zs=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(366011)(1800799019)(52116009)(38350700009); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ckGV7wuGht4MyKtzP/ZfU11RZnx/lI59vQ7BiZKoxiy0mAGXArhZpHC3Mlmp?= =?us-ascii?Q?aTL7vHM9UuYWn7qkUL3o93KuP8z0FRKF7YbOe1bYjKdsaqr20gMnntS69T0u?= =?us-ascii?Q?/8M6Xa8zYZGC9fkbkmU5TgjXnTk3q69+OQs4tXJK1sWR/mPvBPsM/+sdM5/o?= =?us-ascii?Q?koNK07JUeG16/Pfd4AH3tplkSAn2GbATqk0cksQ0g595hRV/lZLPOc8iaT77?= =?us-ascii?Q?r4nBCq5+DBYRqFk/QU86Sjoeo2IdkaHbM+JnhD5tyzSGJylgZXXpc02Y/88r?= =?us-ascii?Q?eAB0I/tescqy5Ta4pJNulGw9/uTi4qeckuo3KfQbaiECXiZ8BqD7UjctAoUm?= =?us-ascii?Q?zan55CrODWngS2NVVPmCucJ78e5zGZurVZW1L63Or7ScP56DZcBtgbjAUgMZ?= =?us-ascii?Q?XssJFkPypqLbtAbPlLXbPxd2fYYKAD+qeq5Yin0tjHThX3YmRpKuWh2LUZPe?= =?us-ascii?Q?5mqoAZZNnasxkVTlbTLPxIcwfa8OgHEvsiajTp8ILv/8D/Z7u3w64R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VoO/vyxYdQ2PPgRCKSgyX1AF699D6TsmzQBiTQ3IuWYmGH?= =?us-ascii?Q?6lAUs9vYRXtkakEge+ws75vU+VxWA/vP2wLrxraGiYZZ4SutqXx5dxQIcazj?= =?us-ascii?Q?O2KAmMLrdro4hy7lGo2VxQYbSKSiK7vpiVY7A7CD19jxb33nGO5W5x+A+ph+?= =?us-ascii?Q?Zil2J3b8S4tYFPMxlGzkMYV5GzAUcDrfYYfvUj7Sho0UHqRzYmIEOcyTQVMz?= =?us-ascii?Q?0w=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a32ed507-b5ae-49eb-c007-08dc8c3fdef2 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2024 07:01:53.3632 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: njVOpIFy+E+EAZnmEz7tLp4NGaMnEznLSr14OA+PnU1WFwF67DbBDxbiaYU0pehkMrnBnijklajM9HoI0BMH6y1dMKB/hJEMv7xGFUQbN/s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3831 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 From: Xinying Yu Add the interrupt setup logic of vring relay. The epoll fd is provided here so host can get the interrupt from device on Rx direction, all other operations on vring relay are based on this. Signed-off-by: Xinying Yu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/vdpa/nfp/nfp_vdpa.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/nfp/nfp_vdpa.c b/drivers/vdpa/nfp/nfp_vdpa.c index 45092cb0af..1643ebbb8c 100644 --- a/drivers/vdpa/nfp/nfp_vdpa.c +++ b/drivers/vdpa/nfp/nfp_vdpa.c @@ -336,8 +336,10 @@ nfp_vdpa_stop(struct nfp_vdpa_dev *device) } static int -nfp_vdpa_enable_vfio_intr(struct nfp_vdpa_dev *device) +nfp_vdpa_enable_vfio_intr(struct nfp_vdpa_dev *device, + bool relay) { + int fd; int ret; uint16_t i; int *fd_ptr; @@ -366,6 +368,19 @@ nfp_vdpa_enable_vfio_intr(struct nfp_vdpa_dev *device) fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = vring.callfd; } + if (relay) { + for (i = 0; i < nr_vring; i += 2) { + fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); + if (fd < 0) { + DRV_VDPA_LOG(ERR, "Can't setup eventfd"); + return -EINVAL; + } + + device->intr_fd[i] = fd; + fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = fd; + } + } + ret = ioctl(device->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); if (ret != 0) { DRV_VDPA_LOG(ERR, "Error enabling MSI-X interrupts."); @@ -556,7 +571,7 @@ update_datapath(struct nfp_vdpa_dev *device) if (ret != 0) goto unlock_exit; - ret = nfp_vdpa_enable_vfio_intr(device); + ret = nfp_vdpa_enable_vfio_intr(device, false); if (ret != 0) goto dma_map_rollback; @@ -619,6 +634,11 @@ nfp_vdpa_sw_fallback(struct nfp_vdpa_dev *device) goto error; } + /* Setup interrupt for vring relay */ + ret = nfp_vdpa_enable_vfio_intr(device, true); + if (ret != 0) + goto error; + device->hw.sw_fallback_running = true; return 0; -- 2.39.1