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 CE55F43F12; Fri, 26 Apr 2024 09:49:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D2D943C97; Fri, 26 Apr 2024 09:49:07 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2132.outbound.protection.outlook.com [40.107.94.132]) by mails.dpdk.org (Postfix) with ESMTP id C04A743C8D for ; Fri, 26 Apr 2024 09:49:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0ig4ubRRZJcW7r5zIleki3X7aOCxwsKVKD+pvw+J8dt5o+KmRqqvGJcV4nduPb+jLS+jtSZVH7dGOgnMJm73068u5VmxmezM7n+zuWVPSHI3bzTXP4fKs8q9bdacojV2hBd5t6wk+AlRWHXYne/xZzvpZ3dL8yr6icraqp2yg0rJkeuxOe2P98ovmTR/jwEHyMSDD50d8RLsVKQbsLeSq25JIcVECuYcR4T4+oiidOpNnWgiD8/WSPQYQeQ9jjvHMlxds6sAswgwHkineR0Q/FbfMl9fi9pqnS4bwhC5B6GjM0AHUe+51j6WU7kf/u3L1Snrxc7Qb3oigN2OvKkkQ== 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=c+4h10S1KsKYSjaSJDusRruE5zwao1u+98aiJNPhoH2akgRx04fICphcuxYSZfU2oGctfH5DjZ9FZQhXIbG3gTr4Tl+lIgSpV+OuHcgCG27T1awFNepk/EIZugZ5fWXdqzice2XK5FQryglTJ2AHoKDW1W8w2cfq6qAmmTxdsLW/+g1Hfgpajxwnofx2riH8Q45C51r9loGmoudLAgS61blRjP/ThCdJyRy7STBdN3vTS2U48JQEWiG46ha/ja2uIdUq9dSoAWKIV2Mq/SN+71mEplfNfMIVycNwEf70dpge1KFQ/t2dK/xyDPJ399ZjXaoHYp/UfEqPEa3pAvsrUg== 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=HOYyur5FacVhzt/APxxuSYJNBBJ9tU6jYHG7XHgsCbgsyxM06MZbSMRBabh/+k9a8moCTc1cQ+Rdg1+pJGhIk3gem/lNaQCPX5aaEVGRt5NsU9UePs1A/p8Es/4/HK0Q96LFqcx4mXsSSmwbQHMruwrpV+h+gFQ3s23B0OZBqu8= 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 SN4PR13MB5279.namprd13.prod.outlook.com (2603:10b6:806:206::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.22; Fri, 26 Apr 2024 07:49:04 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7544.010; Fri, 26 Apr 2024 07:49:04 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 06/10] vdpa/nfp: add the interrupt logic of vring relay Date: Fri, 26 Apr 2024 15:48:27 +0800 Message-Id: <20240426074831.1729792-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240426074831.1729792-1-chaoyong.he@corigine.com> References: <20240426074831.1729792-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR02CA0007.namprd02.prod.outlook.com (2603:10b6:a02:ee::20) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SN4PR13MB5279:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a9981dd-57a2-4899-114d-08dc65c55810 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|1800799015|366007|376005|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?H0gPCAcic1fPUM3VnP26KWIRNFCk6SkKloytm9ph56XaZdAp/W9oABMx0ayN?= =?us-ascii?Q?pRI4kZnYJnWy7JEqfSq4egGlCkFFjVDbu3kQ+zPfYw2EchGi5DfkZZxk0MPa?= =?us-ascii?Q?emFMyLmEJJam0JPn6zaOe9+5y8N9ybzBNwgoRkd2MVGeOOWkZbxeGTH5MimA?= =?us-ascii?Q?LjHRzvZKXVPOogsUizW8opb3JxqVBwMN5oA6bgGXun21yutqP4eCk8CXBkRS?= =?us-ascii?Q?ZAGuWggclsVlX0PMoznQheYgvmg5lysj/AdA7gPjtA/pIGyz8aAfxsRr7N32?= =?us-ascii?Q?z10EcXTemwRz+DlypjIXKla4Blsu9kh/qkQVJyw2T6gLbHlOH3zHWlkC1bua?= =?us-ascii?Q?VNvA279LOl5vYEdDCsXOqOTo7l0gnLRrJ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ascii?Q?gwQo10BZ6jtf1aVQzTkqlbusb8PfI1TxNOM+kehifDBNcW+F+xt3FJfEUqNG?= =?us-ascii?Q?xfJ+fCS+TbiZrJ2ITuZHZHwlZXi+I23/CL7SfxLb8gygQw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(366007)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RIAnmLbMxj8YbEG34Vnvcftw3eaVQRGwuDZ4uwK01Bu2LvyvWXhpAo8dVgWJ?= =?us-ascii?Q?Kls3QYhAeyI1xQRSE9horZaKoKvB1bEasgsfsS0NdAbhfPf1maf6zUtRyaxg?= =?us-ascii?Q?Ie8rWzIYB0EJbcw4RIjO3YIOxMudPjtB3m9u33dwOgqc5VK1xm6mgeDxJroT?= =?us-ascii?Q?raYByWJ1RyjeR687dLdj51H9aQP7dEZMj3xtdbBYTJOIAsdTXNblwaQdk7fV?= =?us-ascii?Q?palWypJBqs0zOonorQVYlUciKjHxn9qy4VbV919RQFJYiy4ORyg101tNHKfm?= =?us-ascii?Q?n8JdGgO21yrxvw7eVbKnEGeaMV/3q5dHlIvwryWYCcuXZBjBVX4dh0g8c66r?= =?us-ascii?Q?L2vOIZbz1Yh3i+MOQnvCxu9cnz9dBWQ1SOQGy2GB7DtAxrH0vk8Br5TPifGx?= =?us-ascii?Q?d/HjY6n5jgTCS4Fkjp0qobQ1Uvpl3fUkgMwAHaGXEHBmFYkSs2dIN19fJde1?= =?us-ascii?Q?MSWibyT45ujqQ87NAOEvy0dvyG4zIkJlwYosh7G99JYEiXk27lQDSdBvKT/g?= =?us-ascii?Q?GewT9OrxYwd/HLoPoDb53WbGpQlxYgCL6OQ0BAayG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SfZojPfjSdh+HTBRHLwbud7KHGWNw+/6tZsBXLE7eN?= =?us-ascii?Q?voUHvSnM7ZTCvs6g9ORPUk7vr4YQpaF9jmjZ8kaU6HM02gZZ99gpIuZgfnTa?= =?us-ascii?Q?Ls+obcI5fDFrNIjvXDCL9kYAm4BKXKVsHn3RuBFGrz+rULIiTiC3u2Z6bNfr?= =?us-ascii?Q?6Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a9981dd-57a2-4899-114d-08dc65c55810 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2024 07:49:04.2969 (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: Q/b7KjHyj8nib7WE6hDljyE1djJrz/uIigsk5KVxz8X+lKdVdzMXJ7r+RDHUqxBZ8/DW5u6lhMwlzzBX8EoMXLqyLUxX2VMVcbhL7L91HzY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR13MB5279 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