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 9453943F12; Fri, 26 Apr 2024 09:49:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D20143C72; Fri, 26 Apr 2024 09:49:03 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2117.outbound.protection.outlook.com [40.107.94.117]) by mails.dpdk.org (Postfix) with ESMTP id C4F7A43C8C for ; Fri, 26 Apr 2024 09:49:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3nDYb/PwP/pJ40xqlnYPNJKLq8BsPPLog4TNt6DghTOn01D6q3rrlafSsu/ZHees+SDRWTN+xVUNcbktXMMJJ6m9ulnnpa61n8udRBcsFQm4ZxmS/yKy+8mSEAfXaHklQeX9f8pLK16FHVepbflKRtPYth4ijGokn94o23wZjba81BIsi3VX3t1y6jzg+iPjgCJpapDOTyYjSxyUHrjitCsXwPlEs4ZbKzhdhyXKEyd/C9ZaTC4ZvPjDPtmkUgmMk4Az1iuLWWPVf0E5WqPrgKo8qA7e0//0+SX6U5ohlrcF2hNq3fI0Q5ZUS91lwkkLcX1h1VSnuW/7FtzDfBpPA== 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=UIEpqR/8qg8vF/YSUfr6zTrpNGD6XV6GS/nTPsl4P2E=; b=RDvNBk0FfxaLr1scYV4/RBbe2SKg1qZsLlbnuwze2eAO7lt5ba+6uczL64AYT1pY9tB+0HE4Jl1b4BM80K2xYrTIoEjh5JaGD4lNlW+g7X5KU5HPiCadhohRJ0BBuNtTDhRgsvR4prpGDednyS5+sdLzNAuNXxwFnZPKRh+H8//bQUrTQ2U4RlqkB0fgFFGCMsT9e+Y01VX8Y8evW+urdiA23/XaareqVWcXr0QKI7hGrIEeqVvqqNIBW4U+fXha9JvPmIywDS+z9QahHM22MPx2fYu/zzG/GeBaLPJM79UM0xPSn62G69cc+GzBm9jSzTH0y4FYr/9zyrNgmItWVg== 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=UIEpqR/8qg8vF/YSUfr6zTrpNGD6XV6GS/nTPsl4P2E=; b=LOZ+JYwRfPYYTxyrBqamhzE2edqXUgJ5HvbCGQ95o32a4KuqRdxGn/LY196uomglv4kVrH0i2PLG0H9USPQiB0rFiLtH90rkyJNn32Xp81e1jrrU0vKVpWUQuEXZ1zcH2IEo3NqxKD7hRMHV4JKLFLBQgAloJ7/Irbhe151RNBU= 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:00 +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:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 04/10] vdpa/nfp: refactor the logic of datapath update Date: Fri, 26 Apr 2024 15:48:25 +0800 Message-Id: <20240426074831.1729792-5-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: 0d5277e2-3600-422a-a31c-08dc65c5559b 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?33Ao2PDv6m7K0ApZ48U0fhGqECMVKnlJqTwoCpOhjW27cwLl4N3DouwK9KTh?= =?us-ascii?Q?mE8yr//Sdv4fx9NVkkp9aQ69q8gwjn7SCM37Nv5YUrRfdyryVwPWvJEsTUh2?= =?us-ascii?Q?idblDhrJ4utczHEWpNnVjY9PIp1HXYXyGUt/RAZMZPb9CrF93ZzyzQHmlOUG?= =?us-ascii?Q?C0ACx0J76Tb4L9hAOoo2PdiYFkEgA/FRrSRMZ6ntSa4I8LjOYEmOfxc/pfAZ?= =?us-ascii?Q?k8ttzVTI75Hqc/MztGyVsO1MwhMiqi5GLz0WeY6xjfUYgGQIuBQA9Ry2DZ0R?= =?us-ascii?Q?PCdCf3HFvZYQZSgB8LlhqlG9ie05BMw1By+sURNvbEoqpfd6XKGDYOWX9rAc?= =?us-ascii?Q?POXg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wB/mwQ9w6UjR0?= =?us-ascii?Q?7waO55vs3WwIBZ/p/yIcXBb8b9bkhtXfwRxux6p4wdVzD+eUwTaoGn2YPNFg?= =?us-ascii?Q?xZmLgvYoahv9iTom6dbyGeHg5G7Awm2KhNHZiSO4O7UcIg=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?rOVdoN0undgkMtaY9uLZWttPTNOtgjEsG+YdiDWg/dPMFkcxT1SPs1VIOOAO?= =?us-ascii?Q?HXTjsAEZ7WGO6My7HYLHvH73mlzqLMLy94Xvg+fQ5I+fr+B4X83k0k5ld/9Q?= =?us-ascii?Q?6JVTStWeOFnPE/aDbdcVFm1Cktp5CHLhR5WWPY4TYlkhPyZ4RuSfhNGDbokN?= =?us-ascii?Q?oi2i5Hnz6ZVhedfQSMXsPnrVFxWvPQ5IfvaSJ0a0jepkE+H73YN13AAsYf8p?= =?us-ascii?Q?wdEWD47BBM8GxnBqYVFh43xRx20dzFUIfxHuMwa8QGGLIJ/qevXot4R2J2Ln?= =?us-ascii?Q?I2TfUBrgXge4lqA1HZXk2lCNSJjdSth3r83cPKyrdT1KubkBe+UGRbvABfi4?= =?us-ascii?Q?6/om/M9q7dCjHqVNwhjmFI43F9B4b+67bNYu/RA0TLWN2d0fLXJB8YUB7GWr?= =?us-ascii?Q?ZjvfBLy85819n9OKgvk1KgcjLlYb9z1Rt4SLdNxre01Cuk4tCeMJI7evmMFE?= =?us-ascii?Q?n57NjGbLZcGdVOV+76JV7wyc7yCbLW3WCUzmwzYMy45NjR5Ip6+hkS+9oPaP?= =?us-ascii?Q?kwPvUVhZIrX/D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us-ascii?Q?ETH3H67j78oMfawR1YI4ECoECvZvXLuca8aVJpr+NAro3pYPg5N0JnU6LC4L?= =?us-ascii?Q?2fnb8vr1VAfnpsWR2NqjNvSSsAgVT8lyfbrO7rMvZMTClwEdIyVO5IIONK1G?= =?us-ascii?Q?Wsyn9R1xkNUi0/zkWwlsjZjn1T3NVGNAwRd+jNUP5QU0RebAIFl0piEO7Cym?= =?us-ascii?Q?zQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d5277e2-3600-422a-a31c-08dc65c5559b 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:00.1551 (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: KXYyQYuR9HrdfVLg0qeoNJxeOw1b8hJPFmiS3CG4HmnxBXpP0rh+AkZAbXCc+6kGxFxPTsCMBUhR5HF/aIDD5XRSy+xLmWMkBwtRef2WLDs= 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 In order to add the new configuration logic of software live migration, split the datapath update logic into two parts, queue configuration and VF configuration. Signed-off-by: Xinying Yu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/vdpa/nfp/nfp_vdpa_core.c | 54 +++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c index 6d07356581..79ecd2b4fc 100644 --- a/drivers/vdpa/nfp/nfp_vdpa_core.c +++ b/drivers/vdpa/nfp/nfp_vdpa_core.c @@ -105,8 +105,8 @@ nfp_vdpa_check_offloads(void) NFP_NET_CFG_CTRL_IN_ORDER; } -int -nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, +static int +nfp_vdpa_vf_config(struct nfp_hw *hw, int vid) { int ret; @@ -114,24 +114,8 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, uint32_t new_ctrl; uint32_t new_ext_ctrl; struct timespec wait_tst; - struct nfp_hw *hw = &vdpa_hw->super; uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(0), vdpa_hw->vring[1].desc); - nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(0), rte_log2_u32(vdpa_hw->vring[1].size)); - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(1), vdpa_hw->vring[1].avail); - nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(2), vdpa_hw->vring[1].used); - - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(0), vdpa_hw->vring[0].desc); - nn_cfg_writeb(hw, NFP_NET_CFG_RXR_SZ(0), rte_log2_u32(vdpa_hw->vring[0].size)); - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(1), vdpa_hw->vring[0].avail); - nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used); - - rte_wmb(); - - nfp_disable_queues(hw); - nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES); - nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216); nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240); @@ -177,6 +161,40 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, return 0; } +static void +nfp_vdpa_queue_config(struct nfp_vdpa_hw *vdpa_hw) +{ + struct nfp_hw *hw = &vdpa_hw->super; + + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(0), vdpa_hw->vring[1].desc); + nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(0), + rte_log2_u32(vdpa_hw->vring[1].size)); + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(1), vdpa_hw->vring[1].avail); + nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(2), vdpa_hw->vring[1].used); + + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(0), vdpa_hw->vring[0].desc); + nn_cfg_writeb(hw, NFP_NET_CFG_RXR_SZ(0), + rte_log2_u32(vdpa_hw->vring[0].size)); + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(1), vdpa_hw->vring[0].avail); + nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used); + + rte_wmb(); +} + +int +nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, + int vid) +{ + struct nfp_hw *hw = &vdpa_hw->super; + + nfp_vdpa_queue_config(vdpa_hw); + + nfp_disable_queues(hw); + nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES); + + return nfp_vdpa_vf_config(hw, vid); +} + void nfp_vdpa_hw_stop(struct nfp_vdpa_hw *vdpa_hw) { -- 2.39.1