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 E6A3B45459; Fri, 14 Jun 2024 09:02:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C0E7427B8; Fri, 14 Jun 2024 09:02:14 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2098.outbound.protection.outlook.com [40.107.244.98]) by mails.dpdk.org (Postfix) with ESMTP id 34208402C6 for ; Fri, 14 Jun 2024 09:01:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WKVI4hzBsM5rpSYJj5+f8xIzY9Lx8UiTI56Wm/12x7xZUZstcvTbahbSPclihydPd2IAZ7VfKATBMbkSAs2ijRUuobPxoMl+yJVDQILZyZes5ngKVXi2f7TqkVWq1loVE2TXWTYi89fbwdUJY92/ikpoFEFRz0no9PHIZg3BD0G3VW6TbIl/rZzdPeM36eYftPKQr/4m2Q6cdKb+wq75H7IapAiLR+G5ysxl85W3Dw21/FLVSbByAUXoWSHHNnFWi+fc9HMas7ic+HOPKQaDnZOPjy/+fQhDy4VIkgQnBDS+NLjyPMezW4Tiotc9qPJ8nk2aGLJa8u6gukFHjpE7Vw== 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=oYQgWVTGpRGKK5U9d0KMU5BCm6wQuXnIHLYnFjafQHIfqOdPS/eafnOfZi5NulFosfuy5rH5A6+3MtiCaaaRaZ0ctfRvqjAlj7GuTKqjJwlFKaXhIgowF2+ZXQoaGXeun6tNnhTXCjzLl+68vBxTWyqzzIShvI4Nbdj8H5RhJIrD4lepK190QWnqiyYixbWR8B0Utso72LPxPH/gnkiZilJsvZUCnrOtUK7MSTWR7tc90KLuO5/YIM0bwNhE27KLqA/Y+QAUWGMsJHb3ghxsXQsEHwPklf+ELs3R1MfQVxNWDwdJKXU6IdFX2X/+mt9busNeLKizACfwFNvAoUXE4Q== 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=YRRWMDjDrPRB7kk8bx1Esy6o9L2jR4SVgnDlCIDQ0CmZfLi/ZHW/FaZEkdk4hLzq5e5JS11FyeN8u9qz1IHZf+er5utDveZny2BCwlWHJ4qi4wiFMg/snhUvrFxFnaOfs5dP1LGy/AHvucT/y7Rp7GSpZEGxTnPLm6y2U3T6/20= 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:49 +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:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 04/11] vdpa/nfp: refactor the logic of datapath update Date: Fri, 14 Jun 2024 15:01:13 +0800 Message-Id: <20240614070120.2663160-5-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: 69ff6369-1ee4-4e8c-9b5a-08dc8c3fdc7f 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?sF3oKtqi8ldnYcFhHyve4M1AKtHwoz8utkCHsIn4gMOXEKmED3VASMm9MLab?= =?us-ascii?Q?e7wGU0i4C31znsTW1mL3KZBnjYC/lEO5uLlYMGuuqfVXVSU1139++ACexfQK?= =?us-ascii?Q?7hTUIS3QjOGlZ27mnIa4UcIZCNcMkov/eACJoneuzrUkmC7XLUlvAocO0aMG?= =?us-ascii?Q?OUIJnZCi4nZQWYtG2Tyi+hLaU7bMgKe39Necf7MQn9Bt0EhtsfxBijAIDCVQ?= =?us-ascii?Q?h9pG5V6JdZiebMe2lZgvMC52utSKCOrX7TjiDEWcKWOMlYu2ThAuZCqUMUJf?= =?us-ascii?Q?tDWyrnx2JYpGtgMUPZojEwXOeCJZXh07eVpHaU/SVCJNFn2BbCkJiPb/qAi6?= =?us-ascii?Q?75i9yLCE81ha/594vNY38AXL0MAlnqLuTgnjATB0bUWHV83Qwb20zzsn9zNl?= =?us-ascii?Q?ntlkoenwAjRf8ILKpBQzd9zdSH/IeylRSui4Jv+KKvIMQtoCSg/VH7WG32if?= =?us-ascii?Q?nvBDCSn2WD2/K2DKIohZdqqZ4tS6H8ZOx/J1AjKnjbnKv9f6idQEn1o3nE2Y?= =?us-ascii?Q?HsmOQCnWOpxHjK5Q204MsiCKckKhvmg+rthKRUcG2EO77kGbZSl7uKXfLfa1?= =?us-ascii?Q?a1WBHc1vS5FkMVE2wMXRbZLn7rRmWg/3tjalN963COxZkuyHMx/TuL/swCr6?= =?us-ascii?Q?CTqzzfFYQ94bLeCif3PZGS44J7wbBiY8+5JJx0xZyiYBmS53IvvaFGMBXqP2?= =?us-ascii?Q?8ca77b/Lllu3mBtnfEwKRyZm/sfSblqzSedn8lpHg01Pspz+801t7RcIOpGz?= =?us-ascii?Q?ifgbntQnwP0rHg2WUBhBkDBaor0ovH8GlwbrM4k/pPP7xOOZT+E9Xdq2BJiq?= =?us-ascii?Q?NaognIo27W/DBZXYpcLnmjpygBTliR1xq33LM6OwZfui+zqntClzKOg9fqac?= =?us-ascii?Q?kVInnOefCOk2LmMiHxw8ITl9ti0lqyEGvdhb4hNBKqbLlgNfNC4d4D5tPvEX?= =?us-ascii?Q?cfBJtkCswZStwM+dEssZFHkNUnr4SChva2pVgDuhIfRnPnLg7l8EZGOadihG?= =?us-ascii?Q?O0Dr3NlVvmo17cm27teng6HVRo2oXo+qWRoOLckwp65p2o3PL9/WEZcJtl+L?= =?us-ascii?Q?3ssTQW3eGzGIqdPeYrGESnzbKJTaYAYNPxRjCgYsX/Beb8kz8+RplhJgqS6/?= =?us-ascii?Q?6YAv9oSYIiLGgiqHafcja62cAAqjtfAA9ZAdqhRmjB1wRTRqxVnVV2LKz0Hk?= =?us-ascii?Q?qYpA20TFCFwdqZcwSpjO9jyjXprpuFI+KBHxiAuyXi8iClAT7xMwgf+78vZ/?= =?us-ascii?Q?uI1kHH2BaYqI6D+a44tzl5oYQ3Gdlth4Q5jIDUzO/gbLaOjyeoIfVCtWBRTk?= =?us-ascii?Q?XhatCxjIoTjBROh6Js0u9sEPhkh7EvNGASUXZnaHfRW4bV8W2ZtP7I+USkbH?= =?us-ascii?Q?oKwH2BE=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?38DX+jjSaIE417klcvUUB8LJ4/10Oq6gIcHbG6Yw/pOTsAoqoWVEa2cNDrJM?= =?us-ascii?Q?NLeHuz8AwFClTTdnO71/Z5YFtz7xwfvSvizE3MGrJwX61HjkUkw/HwFBlXTA?= =?us-ascii?Q?fCGsfonX3KxT+k9ELz1GdMvhyIgeqAQ8drtN++MfYVuoFt8D4OaFh9D3BT1r?= =?us-ascii?Q?hfAC2Xgm9OHaBq3fdso6iCzvqeWF9Nm9BoIg5bgI6S4+u2XMS1C//aEsBut6?= =?us-ascii?Q?GoNIxfgkyoTO6sIuu3cqysi90K31kx0FuffHUj+zY0CZGKcBApw6e1umXzxo?= =?us-ascii?Q?pPWD28GLbWDvCx4arT4pAJAPybhu1qy1gblshUSrED93CVaMN0ViUVbBf2Je?= =?us-ascii?Q?Idd+b/HHVClA3xIQKnEtYj2rvzUitd6C+b8U5KcQzgN+s3+QKk3TgMNMB5T7?= =?us-ascii?Q?mWvOJonqjxA69Rrd1GgeA0/vy7jgcCquZ3k8MVg8d+g4K7JS4xY8yWPcUWBf?= =?us-ascii?Q?gCzNLUN1i6utFMntfn+V2xy0WAi30y8NShwznrXkq44xfrK95An6t1+d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o1v3HBVna44TreaB3rx6XEHDeAhYcE9ycGJg+0xhMkNnytT?= =?us-ascii?Q?I8CqkO9liLe+IG49nXlYs/Eo0LHJNuc2zRBcI0oBdd+PP8bauJfmTJHfCJu5?= =?us-ascii?Q?tQVosxE/1wnh7jmrgNbZRguJFzhQ+d+4WX7ykhjI/zjXP8hzYIyHMoxL8uNx?= =?us-ascii?Q?yoaOvahkJCklf+8tvVRunbEHdJziquK0mP2vb92OkUZQMLCULEjAb8VVf494?= =?us-ascii?Q?VQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69ff6369-1ee4-4e8c-9b5a-08dc8c3fdc7f 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:49.2424 (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: 3Vx63U0u5LJf1MgFK5CYca+KH1QvqD+6p67uRBj+LI55ZZ3gFfie2AL1moG+wmGJWfEUgkgfj1/onNPbeV+iG4RdCwtlnKqV9RmgmNurdl8= 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 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