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 85F9E4573B; Mon, 5 Aug 2024 04:14:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 74C2C40647; Mon, 5 Aug 2024 04:13:23 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2120.outbound.protection.outlook.com [40.107.237.120]) by mails.dpdk.org (Postfix) with ESMTP id 480E1402EC for ; Mon, 5 Aug 2024 04:13:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ziq9bvZNkpeVi6WWqsmQ+HGOtawLBdMsR/KwCQ21vysM24lZ6TyxYEiNFtHz7ZdrxFIZvUZA6g93pNen5EYRSW7AvANs5bIKP+dRy0aWlZFd5MDUL7GY0hhEhDXr8X3TQQeQUc+m+0MJM44+blP4pFRWE8MlUYNSAgLEHMpGVf7xBUgAIXsHtDAY0G8ysIC6WrtuZ11X00SpoGT/Zmqc4H4SYKqDExgLvS91H4Nr43+LM8pDqOm8fW21Gji5eNv7OxPcR9RWKXK2+jO4vFQf+Zp2ZUnVL+L8RKdF+ADfvrgRGuHq2gzhRB4IY1tM2zYSLDUejdeDuSyfAJA7GnA+sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BpfT83rl7+TKUiatak1sw7FsLvaoeCRp3XMAcxiP1yk=; b=H4RHnno9kQ4JfSOJp5+u10otPXVJ6BvL+HrBMAJ7QQ7W53lq4cTy7Xw5lYwspsSLsakqu9/o6ugVlgx341CKR7w+XHyV216X6Pn8wXzmTPbTrccxGzL40MJh87AMd8MHtmqbqFfpFzQRNkvRp3Ejvq4rcZ6FBnGa+5GMUj86M7zD1IJwpPHX3K86Z99T1O9a327IOGYYSNA1sD/CaCd42i6SGw+IjSmrxzYYW9d/MD4klrQDaBe09N4RGtQBrjQ6DM2NQHcyt4y6ZwmRJbXizCWhM7oh6e9niCgC6d4pUvgnJ/jWXlsefsFwfsF5yPm4u8rALXKo/2ODuZE9IQNwVg== 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=BpfT83rl7+TKUiatak1sw7FsLvaoeCRp3XMAcxiP1yk=; b=V/eCHY/a3J4YTV3mw1O2WUU2gnEK5hHH5GVNd8aqLzY0Nh2C7DB4Rg6bweHYxk7mMo5Oe1FGsfb9WKwiTcXpkHU21PnVVUdk+SQTc8yfJbsuLPN6PtePdnTKBjjz++jdntS8Q4x3nNZPrKoSmGGujQxAMIvN4O+nZDh9B2x9jrI= 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 SJ0PR13MB5896.namprd13.prod.outlook.com (2603:10b6:a03:43a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.25; Mon, 5 Aug 2024 02:13:19 +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.7828.023; Mon, 5 Aug 2024 02:13:19 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang , Maxime Coquelin Subject: [PATCH v4 06/11] vdpa/nfp: add the interrupt logic of vring relay Date: Mon, 5 Aug 2024 10:12:43 +0800 Message-Id: <20240805021248.1051198-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240805021248.1051198-1-chaoyong.he@corigine.com> References: <20240617062708.2932037-1-chaoyong.he@corigine.com> <20240805021248.1051198-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR01CA0050.prod.exchangelabs.com (2603:10b6:a03:94::27) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5896:EE_ X-MS-Office365-Filtering-Correlation-Id: 9227f75c-9892-4273-3ee2-08dcb4f42cb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Qi7gQnnOZQusn1ShudUrlLtWhZ8WFSYr46Azy5J8DjzAolPQbcHlD3pg8Ut2?= =?us-ascii?Q?qWZ8zy1CaF8W/c63pe2YVJzUj2c1ABgQWrSGEBGIqrfEhP1cxMdMZuq15jGT?= =?us-ascii?Q?uJ8/mWCEMDJaEffzD55A3wUjF1yPvYyOmI/5ovyAcdaWWhoQm9Pg2ac9MLIs?= =?us-ascii?Q?dTF4yF2X9ysFr/85EoBDOsWD4RLnSCJ6QpF6FdZeAwSPSus2mAoIsUKmxLdD?= =?us-ascii?Q?CyP8JRvPBeY6ONUg1+p5nUWOjHONJXBhZa9NKtCfmg2DeNLChD+k7hlXrJoD?= =?us-ascii?Q?/sZ2nOvUkDxONA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FaZ4m?= =?us-ascii?Q?iFdBazeES+HYdZIGPVd8TeIpR5ojj2/Rakxxh36weq+bjvguwyQ3k4NCB/x1?= =?us-ascii?Q?2uaK6MIUf2dlcShzsms4l6WdW1hJ+VIm3D8jCK/EjtTLGOaXEEdZmUIaMLzm?= =?us-ascii?Q?QDeQSamZUtZf5I6KIDoDHUPwUYdlvIMg+mHpAdV5J4beibf3/PqzZMmjKgxu?= =?us-ascii?Q?lSf9iP8Xa1mGxsYUYWy9Lo96ZGEskHgfCUgpoqhpAUSDX1hC1g=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:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+MPoc8N1GBrBCEzGiQlXOQ4rNxvHzXp4BJBm7WZR23g0/4OHn4OIWtHXDjo3?= =?us-ascii?Q?O8+/cgjMmMalvmhdmudYxeCdFwGuRaD31X8VlFFfqgzQ1ntiGUcqWl1Vn69x?= =?us-ascii?Q?BZF+omVlPuu45/rbATQ+dSzWGRdcSymFAnIWZyC9xrbK+8UBlcRxkBfUA6zV?= =?us-ascii?Q?PSIevdnYDt9XALb7FXgj3QVeIIoMf53sit79eHCHEQNpU/j1YmqKBeTHS8oM?= =?us-ascii?Q?jH3GwTQzykwKMoZYBuc4n9vxdMyhWFgTXTmG/5dKsu5Wv6YWlWO/M3iyxa82?= =?us-ascii?Q?IapKhZgngusCfZHlSCAxCGtIXUseD6jPP6jv+OOureuAhLQ4FcRdI8SKc+a5?= =?us-ascii?Q?spDE5a2rCU6WErkThVRIeWyc1vRSbw2GVwcU4YSuLQOvFYyfQofx3hfMR3Za?= =?us-ascii?Q?l4RBl28TvS4nKvkcDBWjM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hgzFGrAGjytZiPnE?= =?us-ascii?Q?Ch5csFparUFOiMwa5sTRpDyizxjv3+CVVJGoFxG0PIQ5QgZ/bKQqeyEOV5Lf?= =?us-ascii?Q?G6I1aXL203cJbm2E32nNJPbq4/lK6akudwfixLnnrOgoy6Eerxvm+VC0++wJ?= =?us-ascii?Q?g5DS4hQbXAa70Lg0kjoUzfSQBnacA6e77uDy/do8WEiGvoedUgxp+4MrNAkI?= =?us-ascii?Q?uSDnsefn+AOwNssc2rwGhbYBtHUbdc4xp5XJtC1goM3b8F1M2YJAikPUOvOs?= =?us-ascii?Q?TE0x1UePDv1kMsgJdSXEKTI7ey99Wp8GayrF5Q5la6EYyYa/5F0mXIWM9EqC?= =?us-ascii?Q?uw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9227f75c-9892-4273-3ee2-08dcb4f42cb7 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 02:13:19.7670 (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: 5zjd/uRxvg7pmueMwnTB1qqtS4I3F0t+3YQyq5KERBJYdouEI+Z7Q7IYwNAuMBnw4PcuEUn3oWJTdBdXv5+L8ovuEXWH9qmKnCMZpr0Sx9c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5896 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 Reviewed-by: Maxime Coquelin --- 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