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 6FFED4547D; Mon, 17 Jun 2024 08:28:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCCD740DC9; Mon, 17 Jun 2024 08:27:55 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2103.outbound.protection.outlook.com [40.107.220.103]) by mails.dpdk.org (Postfix) with ESMTP id 2DD7740A87 for ; Mon, 17 Jun 2024 08:27:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YSCQK1nH5xAtN5Cd+PoeO+O1VcyHIoG4BlcQMJIZ+zglbDhRrAPqoKW3u0fxZfmE2x7JchP4Njb7xeqJnSa7B3l8OcyPXbMX6EakihyUyIVPlYTOBID7pdqPV8c8Ul+Mmf7jHX6sEdmsCHVd5YK49y9NjVcq8VHy/Jwn9QbHZhG/sV118rF1QDEbPlBMLUKLFxir++PYFqTrkxvLC7yFSgsHZrglm/67fRjtW6rxMFUnUZI6Ep591Sbpupp9sOCmy8jvkat1OzueE3bwLkMovKkwtHipTyKwLUl9JPHq/aLCPpjfgapPpiC9gGXaTQfruz4bjvkKwwm/mVrorsbqIQ== 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=eFg3KMp56pHh063tZTWPaFNpLDX3PPX5PrjXcBwLR6FRCwVhVF+vIlxTufyL1HEr8s6oT3OdoEOxiv1qcPEObVAh69ATWhYf/rZlWQkYHRdRz0nrgJyhGbJ/laAqW/o6lkEVnCaG7k4StI1GKdpfkgDv1cIGulOisalwg1NpUJWOsUWvfCLBzJd1YEqH6aI3AxruJ6MxeugeyOWh4oHD1TZHUgRQqi1lFKP8jrSKjxk3msBP0QAL8Ca6tqY+DmosQmxqIQmc1tAHe1dhdgUl6qCliIykO4nai7b9IrOMSHduQnXR3QEXtfolRdgVbiw7qUDpFPosqDEFQVklAbXBLw== 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=uKybcYZo/6wwi17H5PCpx7h/M7l3nDope9uwkplmiUtVAgmooDwXsjc8UaoIvqzeDd0pbgyWy00H2LcYPGYX7mX/hyZq9gZeAr4mpoMi4Z7IWtEGivd1p2r8/2fs61sQgcrQ/jTkvHbES4tH562IWaaK9rvBWUx4Gfjh/Com4yQ= 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 MW3PR13MB4106.namprd13.prod.outlook.com (2603:10b6:303:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 06:27:52 +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.030; Mon, 17 Jun 2024 06:27:52 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v3 06/11] vdpa/nfp: add the interrupt logic of vring relay Date: Mon, 17 Jun 2024 14:27:03 +0800 Message-Id: <20240617062708.2932037-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240617062708.2932037-1-chaoyong.he@corigine.com> References: <20240614070120.2663160-1-chaoyong.he@corigine.com> <20240617062708.2932037-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0175.apcprd04.prod.outlook.com (2603:1096:4:14::13) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB4106:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d0899a9-6839-4036-bfd8-08dc8e969ded X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|376011|1800799021|52116011|366013|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GHfpok3XGY/hQEanWEhFWkl3hWj5RyJFYbLe2uhFckcKltB95Wj8bphXXDlT?= =?us-ascii?Q?zQxEke3v0ssMi6l1flaR5EyqhX6n2jBYpuTgHYVvyKz56LbO7hGkE9ZGt6c4?= =?us-ascii?Q?R537CgFyAteLwlybwxUt7qMHIfFxm+RgRywrHXZWfCJtZLtpRueRjS26ePwj?= =?us-ascii?Q?sip+l+6EIUJyYbTarTwvDHevTw4uemWcpxJhZ0s9WDqV/yz+SpozAKKw0s2B?= =?us-ascii?Q?wqNiTb5gD8iISokXbKF54oWnMqXZ0kyABW24w841A8QLOKQS3ROeA+9eZzgf?= =?us-ascii?Q?GglCJWGp4Ec6I61g1qL6ltpcQwWcDkU/s5gpUWmNpsBp1Lq1Ek9NX8fK8htB?= =?us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dwL2ht7EPNV0r?= =?us-ascii?Q?o4tkfEdKE+cxdrtIeCHvCU1bla/B8ddaz/jbJgX00VhMzvYTXPF/njvKMFZX?= =?us-ascii?Q?Ms0g3HrEUFucPyKXkB06GpKLmudjW12N/uRqJtWDZGJftAB2SJrrGm9cOzYh?= =?us-ascii?Q?pEILF48=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:(13230037)(376011)(1800799021)(52116011)(366013)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dhWeuNB14h0MbjICVobylEt1X+6WvxjbEPXJp6/k+IP4AwJ0nxbbotMGzBoc?= =?us-ascii?Q?nU0z0TGFmQBeU9PxtgoXSVYcORC9fz+dPVvE6L7yLRSc+wvSLdJMgVYDCIAK?= =?us-ascii?Q?colqMZilbnnvd5LQT05P55hL2djOB69yL4cWtxD3EPsbpP2D+SAe/U5BbJ3f?= =?us-ascii?Q?XtBLqr4F6H64s30YzX8HehGSbcmVTo2zKFPyJoUPdjreJ3XpSkxa+48/sjz1?= =?us-ascii?Q?l2fj+iXKNV54GwdFc4NIuvFF7AdojOhzm8jM7rd8QEHXwYFCSpiyFKMOGAyJ?= =?us-ascii?Q?XBRE/floamNe6T1V02oAzbfGifLesSO7GdXtfbfzvmSQcLB1wsWcmh+Tr+y/?= =?us-ascii?Q?menPeiGiECsGG8H9enG67STU16K69OaLdiADd2+XrYa2FUeYTkEeE3j6E/FA?= =?us-ascii?Q?BogGBuU/yg1ACEQbdbVV/+j42RUb5CQ98ATOohcOHVWPbIkBuUF1sQAg77Cw?= =?us-ascii?Q?nYANyY15TA9aqHWP+Prera989+/OyULQ+d3lOsqnyQD0s5cQScaLpB1gvQ22?= =?us-ascii?Q?vM0FfWgYt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/lZ4vjgh?= =?us-ascii?Q?gTzSf4YxAUtGLH41jp2G8iVa7n2lhxuPKURi1O3uuXoQ7CVqtFLOMJCzboT3?= =?us-ascii?Q?otomq10c/K2eQQP97LfQ7Az/IT0iC1R7oWk9slWyeovw+xGuSux8w+DP0D9T?= =?us-ascii?Q?JOAKFtfkQjQ9udQknoieAT+kqJ6pC6PZVuKYP14Yfdqu8ZUqhp4uKlH7sgxx?= =?us-ascii?Q?/g=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d0899a9-6839-4036-bfd8-08dc8e969ded X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 06:27:52.7432 (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: dulbbw7MXq4shxId2FAnEABpY858J+OzH5gMhQ7YiIePGxq1pIDBV8fnysGKxH7LXVEb/V23Y4iNJb02G+HZniziM5U/63Bn9nIUi5HtDTI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB4106 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