From patchwork Mon Aug 5 02:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 142886 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 18E1D4573B; Mon, 5 Aug 2024 04:13:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 296AD402C5; Mon, 5 Aug 2024 04:13:20 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2129.outbound.protection.outlook.com [40.107.220.129]) by mails.dpdk.org (Postfix) with ESMTP id 431CB402B2 for ; Mon, 5 Aug 2024 04:13:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aK8leGS9qWREm33ZWOjqh6aQkUH4rmIugEVwEwrYyMBqj/urCYm5mdVYoa1NgUNRAk5WraxMDQaQxbrfhp7wCN8f3L5YgUSvRqeCe2G1KHqkP+HZgSOqs3yY12MkMaTeFPJFuAPw8QmO9qObt7D2j6QI4Skt9ZtEKXijIVWH3OUFDm52P1560DzgWUAW41DX4Vs0qm5Z6Mm2tcc/ua+WP2jp3zooeDHd1NSu/S3bJ0OE0HP1HP6VaSbfZbYuMFUuqrB15YRI3nIbtlnhlfKX6MFEEB76uUsUbNZxNJAD2xVPq8iMGD+DjmME9CZFmyPv+XwQ+s6kvORoKvugpu7BTQ== 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=8dL5volN4drhgwKebXlG3thK7sRZwSnMiuim/9V0F9s=; b=w5gvNEJNIkDCUnAtu1osF4cfE14niffrOd7kU3ynHLlNZLgKp6eb0WVhIojoWLp9EKDI5gx6ioFXoHZG4VIakjmrFpbIOMhIfLTZALCefT0qtnEB+Sg8eywRjGPqaSB+yjbo4vQBeppukJ+9ITi/cPq0ZtsVO/zhWwHM0X5WP1DiEMrizJqarWPjcf9+ZNxi75PcA6fm9F2MlGcgTMS6d0RWJPPKgz51xtW6xrQ0hcGPkUM41V+bh8s/LIEnHZoWtk/T67nAgrvfhQyG8kXDWNOxCbKD9YSO6oVcoJZo8jUCpfMfNGA/bS4xpv4uVKN4HycmPffqCXCdiu0W2kEBIQ== 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=8dL5volN4drhgwKebXlG3thK7sRZwSnMiuim/9V0F9s=; b=MDe+Nr6BIGWOrbwQWLb7BEjKV0lSf1h50E7pQ6VmxXi//E/fHCl52AjeXfpfnePg3VpIwBH7zkD4JCtF5oJE6f4rgBcVqD0HQ+91GnlaOv6hY0OjfQ5O5918Dav1i0TqC0QHtrmJZ4KPgnPuSlXjFoDiZPAQKLZSZJU8gmJk0tg= 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:15 +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:15 +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 04/11] vdpa/nfp: refactor the logic of datapath update Date: Mon, 5 Aug 2024 10:12:41 +0800 Message-Id: <20240805021248.1051198-5-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> 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: c567b240-0578-40c0-ed30-08dcb4f42a0b 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: 12bpYzfhc33oUYxRzSoOuQT2zSf5p9r2sAl9UEZ/lvvCXTZ8/8eTY5cbk75BUpT+EFKrriUTYNQ8MSAJZoAc/AinL3wxdTAUgHzUNWJO3LI/W7OxCWwKUU4J+MjHvHwtYQ6nK+jkOcmBSqGV8ljVFU4F32N28e9wZw8xDRbGUijGbCYSbe+p13UZddOXJ8+VvYpYmKnQPuIE9r0JkkCFXc7WrM5kmAFfnYqtdobuCH1CbkIReZbRy1n45KS4NMlKK1dCDOEns2BVWNXx/EJn2JIifT58NRg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ae4Ul++m6DiM2zU1pvjq+DGn30+bR28Bm5DzjDsTsPdu2S9dappbY76pPvtkrBw== 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: 8nH6r4e1fqk9nqQ/xoTZDNXXc5jF7sPeNjtpb/M+xO1ZVMF0GriBLSIDiSVa/PNBiF5onP1e8/AJE9lrBnZNxK7w+wn601tQHq0lPNeJKtLnzm2ly/fsUmMzcPdsNAwuNvr6BKBhMqN3dlfUvef0cBBZCu1WbdrmRNxnkUcbY1uFSbamMScUO8LBKhp/fLQySRIn2bpgHKhSa7jC+TjiMPxp5ZQXMIwkkgaPnHcwtn83UCvpbL10+mEt42O23OJRdyO+KnZtC3tzgru0naqvY/Pgrf9fCe0fNsgJzyzbFxm23DDaPDGqZx6P4NkLPMAYrwzU+JcaKFMf/z5GvphKA015rhk6R6WrPX32tfgYm8aDnZR94whRBMqPGNbzzi/Ge0TB6sGVPcbhXQuY0DlFKWStROpdodfMg/Pc6Vf7SumdP7CH1xeD/VKobXz99GFrxhPsDHegXQ1uEm4Cb+2GD6KTaLyp23VduGnH3itPESGgdHgHBcfIPOQcr/1Q/u+2ZnlfnChfhgwg1RO/pR3RsFqsfJjjD4fTCx93fqzCYpleueo7ry/2LFJyxIjRBsvbmsNV90phG1TjoUmXSQfQRuAO4Alyz0XVkjm0j/BdICWFfO9QovHurmFARK/uN7nWf5v+h3XvAXuEP7LuhONdiSaCjdN6QfLMPsDZVkbdzPTG4hjj4jMqLklXs0H1gTw/wdco6h7hCcFdHWdXnbuNnRBSQtezG08kJmJS5YdCdaP9x3lO2CJOPhhx6mEjqaCcgKww/bKHlO3duY5mr8XxeMpGKuidcJU0bhku3dEPMGZ6y0h4nuH3hgiTiHL1Xl15w+rT/rk22LT2OrJ22NMbetS/89I4nKfwpmoqdUrek3Jg2BipNWh2o3kAkME39gXNPi8VlvZNsdB2hswn+Bb3wMdwXp5AEqdmsTffrXzJh0fCgLyKcc1G/Tl5Mjyi321whljGkeVKtGk3LiQp188Hm0CUDhGdkYYZX07womn9eN2W+Ij/3OKjCs4acKR3IqaAcADNVNtVh70Tu5US9NzQTCi43E1GQo/GEd7k7CdREcfiqSdOpiKilEFO+ULBg9mQaUHFbcII4FZwPYn3/0TUca2Kfp7O9Oj0sU2XpX7sbTBxSm49cYcIP57uXxSKJBJUllosExmx2HAeyZcK7gB+CeIbS7Jxo1LfJcOlVJBaIMgpdaOCzWXfFMyM2Egyk1Bww0tqXDhiHRS0ynd4eVjgJfzOtGbrDTUsPKOKSHDcblPKQEdTz1wjX0oL/+tK96ce4PhCje6QfASU7HV1xWEa6qaNkarojki3+ua5L+HafmpAAcjJRvD+f214WlaycKL4ou89gOyrnX4h0NBKG/04WoG0Tjd1m+iJSMInallgLrH/OV+GibtcoGaxdIW99/F/D4qVHyRfNPxjEsRBrvfaKsxBrnH9wVRS0QYpC6ypnhT0Kb0sHoIg6d/+jiEln9keE4gVL2qTzMR6q5YZrYPPur/aBu2+5DNeI4+454KMS75f5gXnO4oSadI+5MPqMX5/9t0AEM4xuc7QjOy/ci0ugo0PkRei3NffGNki9/SVEblieeRbMWjTiqb/DA4WPumitNUHaQaexpp9uhKHWARMrg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c567b240-0578-40c0-ed30-08dcb4f42a0b 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:15.2923 (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: 5nYSrurOO5KCmWPxM0c+Blq11/UBio8VIVkAPS+sdG07MXBZZlXVlkwNU8jROZKs5VtuTkXcLeSi9P661gkpxkGktgrnbus8EHPOIcy5I1o= 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 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 Reviewed-by: Maxime Coquelin --- 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) {