From patchwork Mon Aug 5 02:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 142885 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 80CD14573B; Mon, 5 Aug 2024 04:13:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2DBB402E6; Mon, 5 Aug 2024 04:13:18 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2094.outbound.protection.outlook.com [40.107.243.94]) by mails.dpdk.org (Postfix) with ESMTP id 883BB402CA; Mon, 5 Aug 2024 04:13:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cqLIByV5tVHCbRnjXsMAD9YBHaIxVBid8tt8RaaQYqRZmYMfO7vkXCoGlXSUEBAbF4idFrJ/iHovhFgNQtCzp9LBNZaOzgsgcbpe1cFlIeF9gZXOqqUf/IrV7GbR/s8ksW48N+scKMWmXk+ZQfRrEQLV4uvy//QePJGl1GL5R1XH7j5dDHBg39b5DVWrNnqGwQiNO2HSCuNnv8qxHNUl8+uTGQ4f3dHrkakg7P9mNywmvTjfq8msnaps+N9HIdMTrKOEBElVu16MNhSeSrBvgNhW0P0Lge8M8LNdmYDPi8zFpbn2Oqj8dp4UhW78StK4ZNyEZy2HsuU6QDzwdyH3Vw== 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=YGD0WNjxPTYQI2LMCta7hnIIdK7uTk433A7bhJUYi5s=; b=a3t1ZDlL9X4T3/DRnIggIpcKhIoUDWQa8HLjAGYva3zyoxVnSQD973A7hRe6Zdt3n4PGsyayGvMCB61NI7UF1Dj7N4mj9lQGf/790XXRbEBxI+uckLw1Gic5m3uyZ6crLZP0Gx+AJe6lghSLUSeaq7IpRyqREabmKbA0ONRzjoNUuQXqGBK2SvpKQUoa3MC3BKqq8xFAFMhL+0wNhaoKb44fvHEOZBpayYnKZYSkxF4oGbwtuPpsFVoy2hDddgMP8l3wF+5/Fvd2FHOGgyqkIXwf9NZAUim7FkfRKWm71GKpACPprjwAZVZX/oVhXEDlIYszPwWL8EToDO4qiUWr9w== 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=YGD0WNjxPTYQI2LMCta7hnIIdK7uTk433A7bhJUYi5s=; b=lJustIfzYafKUnJys68HxnvnkZWLFER7oLGZpett0HWYzaK9fPZLr5yhvfoXS9gMQ5Zz1Cs4oGUCHt8yXwvp3Jq+nrFpMfOCwjpNvcUShAeOPy+cDUdsiB6SdCUnV4TpiP5eW8dts6kesdWuzEjtqJHzIjMIIfdAW4p2rhauYL0= 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:13 +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:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Xinying Yu , chaoyong.he@corigine.com, stable@dpdk.org, Long Wu , Peng Zhang , Maxime Coquelin Subject: [PATCH v4 03/11] vdpa/nfp: fix the logic of reconfiguration Date: Mon, 5 Aug 2024 10:12:40 +0800 Message-Id: <20240805021248.1051198-4-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: d0763a4c-eb9e-4121-0124-08dcb4f428b3 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: ZCuec28L4Eqc4kBBDQMTydDpXiK8abZf+t5gUUGz3DpJuHMLHlYOq4ID3BWKC/C2mgRYtEpA/8VvSOYq6uirSkuihkAA7uh5XEPCabl2fG0CRo7muv92JmUt6jmnkINgtwnoyJZBiApVgSFXufZgNH+jPopkiQjDT9aFvKZYRAs2FrukfBp8oEdit0wiP1X12yYPx1Y5nWi7kUqJsQlFAJRR34Bj8O4PFW3vekmWawvkp0ZkeD7Pe9kMXHN2gilsk1kNR7evPmEupjL8CIyNcjo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QB3MPwlgXir0pJCuZqmfUZMhjrih+W5bnQmhJLMPhXBRTBbkFV0n8E0nF0Mt9sts4llLoRb04rRWMtCofTg== 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: sInCdYaLm4EsCPx/Z9lwtTib7rvRxs8ug76Knmp/6DOPwt5U+FBVk+qLCBVVhlsqvuYGQMJT4Z3WRGZYxGGuPWz2pHTg/cZb5zMDjj+fDyHrBfnBp0sN62XZqDNjedzTWtpJpnRMXDrK7gihch58E7eMKzjNrNy4eztBdDn2EKHFpa7fVZFa6AigzijoUcsAEOSAqKbJK/swwoardEC0jdRmYjDVAuNOZRVDlmXWRY3E1iXJme8N5wOfsd81cwnhEWGJAIokTbL557GmqCOE/DXh8HYzcLRnjpC3NFvO02ZII9giKD+VpSkdu44O1f7MgC1+0jr3Jx5bT8/j/31kXW6hQUPzJT4aFmvCxMiT/wgbc+4HpBYhmhgBvLTosi3boPbTs8TsLSIV/+5+28/mj9e36IYSs5m7DyzWm7SRsaTx0jSDeg/t82QvwtCd94nuAoB8LPx/WILVBwt4KimgyELb4YAG9uATYq5HoRkUP4CwMywikVlxcmUavCOjmvtAAi1b3eR631LDMD16x+kxyJXHYLl5QmZ0Izhe2khrfGDj8hhA/IvXennWjAFMmgyizWDKhSxlCK9KePAAXkge3lRmW25nMgsYwjdfFKNH++G4aZVlaOcI+Y5Xu55pvnOy1ZM/gMjk+f5K+WUrG6t1fRoHr3wV15UQSjv4yzmq1zXMhgLxIrlooQFIiAyZqhh3Ewnh7gooNQ49jC001LK8SwZsZYy1pEcYRrKnXDyCfW26rRnDRTrHgGQ3FTYhU20hjfoAZIroFVtY5m4mSU0Onbsh91kltQpo2EnD0zzQ1iojtXGVVIg5WEhQVVFP0Bbtpjv+mR7bVhlH3QZtSrvt6VWOysouvKjECUeE18Zz0O8uJlsj7ZvIr4OP4ZuAGNw+hCe4BlPY/ouBF2/nEHFTG89cr9pKU3xQfsUOfy/ma4XkcOuFQ4Re3iLOTf+Wama7bAFAP7WECnqN3j89td/mCDonE1DwvwcLq3qn8tbrYZUWgUhaCKljqFUPg3/pJ3G5sCNDmbt7BFUFbraE3HYYWBc58h2ZZpeVJwH71hc86+OV+yT4Id4f9FvQMd51Tw84EUjTYAOwRbG7A+wb+2zHTf2ZpW7YR/QthlK3pkG3tnELTM6co+K7Vh9yQ4ZnCvg5L3YcI71eMwziwX4xPIwxuKa5vXT9gXizpQoLwSfwCZzzcdoNV0Dk6OZHv02zUc3JJToXEuUlKWVlMh3YgDW78gKY5nRk31wJhk+DVxjINCsjH1bU/Yx7W0+cibbsQnMqLkYQv+uDK0cVAKNI/8sC0cVVOF8fTZ++YF5dOF6RzY1qsxUWMYC8BfDEE1Gp2tE2LNhNtrHST9BuvJ9imOgmqTS5OUusQkO1NYfq7cv80BZQzvFCLG+exJpeeCBcBQlmhEx/3cbfcEzePkG0blXIndUCiJtzGi9bT5uP37hetoURX0iqq7aix8ZYbEOBt0IBOFTkg44flRsWabcNJ5tZDh1sBq0Wf/vBOI/6EH7l3pMZqB7Ek1B+nlzr9jrwYHw1Xkn18+iPUGMlC/773sUw9tuUu8zOnBPr1Z0rdTgDcd7+kLrOfzVbJWbw4jrk8nCo8haVl1JDEyJhTwxUh1b1hg== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0763a4c-eb9e-4121-0124-08dcb4f428b3 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:13.0466 (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: hqtFdbd67TxNUsU/xSIaZ0IDFo1cnS+9pGnX5I5E9FD7wMuE1SHA0eS2ZI6sSTpZlckrZi0wiQU0L0jJ1JHtObBqvccvyfLjSnlfwAXAZME= 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 The ctrl words of vDPA is located on the extended word, so it should use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'. Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro with 'NFP_NET_CFG_CTRL_VIRTIO'. Fixes: b47a0373903f ("vdpa/nfp: add datapath update") Cc: chaoyong.he@corigine.com Cc: stable@dpdk.org Signed-off-by: Xinying Yu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang Reviewed-by: Maxime Coquelin --- drivers/common/nfp/nfp_common_ctrl.h | 1 + drivers/vdpa/nfp/nfp_vdpa_core.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index 69596dd6f5..1b30f81fdb 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -205,6 +205,7 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP (0x1 << 4) /**< SA long match lookup */ #define NFP_NET_CFG_CTRL_MULTI_PF (0x1 << 5) #define NFP_NET_CFG_CTRL_FLOW_STEER (0x1 << 8) /**< Flow Steering */ +#define NFP_NET_CFG_CTRL_VIRTIO (0x1 << 10) /**< Virtio offload */ #define NFP_NET_CFG_CTRL_IN_ORDER (0x1 << 11) /**< Virtio in-order flag */ #define NFP_NET_CFG_CTRL_USO (0x1 << 16) /**< UDP segmentation offload */ diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c index 291798196c..6d07356581 100644 --- a/drivers/vdpa/nfp/nfp_vdpa_core.c +++ b/drivers/vdpa/nfp/nfp_vdpa_core.c @@ -101,7 +101,7 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw, static uint32_t nfp_vdpa_check_offloads(void) { - return NFP_NET_CFG_CTRL_SCATTER | + return NFP_NET_CFG_CTRL_VIRTIO | NFP_NET_CFG_CTRL_IN_ORDER; } @@ -112,6 +112,7 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, int ret; uint32_t update; 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]; @@ -131,8 +132,6 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, nfp_disable_queues(hw); nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES); - new_ctrl = nfp_vdpa_check_offloads(); - nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216); nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240); @@ -147,8 +146,17 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw, /* Writing new MAC to the specific port BAR address */ nfp_write_mac(hw, (uint8_t *)mac_addr); + new_ext_ctrl = nfp_vdpa_check_offloads(); + + update = NFP_NET_CFG_UPDATE_GEN; + ret = nfp_ext_reconfig(hw, new_ext_ctrl, update); + if (ret != 0) + return -EIO; + + hw->ctrl_ext = new_ext_ctrl; + /* Enable device */ - new_ctrl |= NFP_NET_CFG_CTRL_ENABLE; + new_ctrl = NFP_NET_CFG_CTRL_ENABLE; /* Signal the NIC about the change */ update = NFP_NET_CFG_UPDATE_MACADDR |