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 B4A7C41E06; Tue, 7 Mar 2023 14:24:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72C2340E03; Tue, 7 Mar 2023 14:24:47 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2064.outbound.protection.outlook.com [40.107.212.64]) by mails.dpdk.org (Postfix) with ESMTP id 84CFD4067E for ; Tue, 7 Mar 2023 14:24:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLfUBqWMlPpNvX4pAI3H2uVam0D+igc/1mtLXDpKOsH3vtIgeCyUTUV/WyUWHPnSPsoa/ScUAa42lSjATjT80QA4Jhv4t4FSdWIsopYbmCD71HsqM/pqmtZUVY+DWUtyuBGix1nWYujHwm7wek1EhdQAIv830ShwyZXjVWhjQU6Tsdojsp2EIpDTn1edmhb4iuKmmdgBBO4aCxBbUweoRvi3q0DaJsIC/nZ218h6XARLjouOyoyG8TQWZZhBHOZbJ6cqjOKcJ8Q6Ax7CZLW16R5XB6KSvamomRRFqSVE/VU1NVDeDzBnuGwMe7zp5jkNqUCYb2cSej7oNojU9SibSw== 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=+zJpIdj9Lxj0ebs/Q9bJ9BYEXTc3HNCnNWxES0dOSc8=; b=faMA329VyVjm/FbSVEGTbvsmODKECcdiV3oaApTiJzjBM/IVXpt0zVDI5cN4Azi6xUM/NcfOwcOWXtNyQYCPgXjiRn6FXmMLXJLlRwhDtbFXaK8PTyG4WFkGKHPNj6HvYCTOZC9pyjh/0hfUFbE2kCn43RPsW1OsOJTDfAujV1B2wFDAw4LJjx2ouThzrbTosXhLn8PmwITyyyFGbe0aZpDt20QU/Lpo6bIlLbg77H4VxJVS9XWCG6b1rkbcBcAjAd3DZnme69blhhOCdhQL9b3jPYZ/EjkfbL871Y1kxwPtu4Dr0hH4QQ6ugdPRjyo18VJvGmgZ2b0KspsvT+46dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zJpIdj9Lxj0ebs/Q9bJ9BYEXTc3HNCnNWxES0dOSc8=; b=gnvi8v0PvAupVjVhJRo6kFUuDmG4as07JCqDk/cPgbG/58R9v6LWZeqPGte1Kp0x14q0FtsKNzJtBCWii0n5noTc2VDU8453a5ORbG+estDrklsn5Y/s6hgeml3tv/prsffhN/ofaFsJgMiU4qSw0uptcG3MHzr0Y4bU9SmUWn4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by DM4PR12MB5360.namprd12.prod.outlook.com (2603:10b6:5:39f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 13:24:42 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 13:24:42 +0000 Message-ID: Date: Tue, 7 Mar 2023 13:24:36 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Chaoyong He , "dev@dpdk.org" Cc: oss-drivers , Niklas Soderlund , James Hershaw References: <20230221062955.34210-1-chaoyong.he@corigine.com> From: Ferruh Yigit Subject: Re: [PATCH] net/nfp: write link speed to control BAR In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO3P123CA0010.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::15) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|DM4PR12MB5360:EE_ X-MS-Office365-Filtering-Correlation-Id: 1afb6091-1157-4788-2cb0-08db1f0f4f7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +WA+LE6AfyDT1bpbsRc9MW4Aidk1R4z+Eu4p72S2lAXgxWkrs5PXZIUy293pwL0ob8Vrb6/3rXGKn/mb5y8lv8N9coSHXLBPI8hrB+QaowsYrdXNF0LhQWneueJfR5gat3NR8wjGYYsZ6hxDj2aMajMBFpQ45eXb+dLP4A+MGNxRVt87b3tBneJzyGV7TG1VpIwl13tHu8kn7TWdhDefDCf/oN3Q42HNu8WGKe9S8NhZhteDSFJAxj1ux8wTH48WO/+fRYujPtNGYmFvRGOP5yzNO0B1gUFa0q5khZEsni9lrilCne5MjwJ+hqTkRZWNo3SesCQTX5tbHH/kDFiHXMkgRs1q+0+U9cwEG6X5zY2J+T9Q3qkwXJhKY8G1Caz1DRm535jJLHZ0XmGbuou/nR5i7mv1xpa8wpezrehGnR6I36fU+n9nsLznoibWn1l3n881TVJRtrynZhYhVKh9Idyfv3SHtysXiuLeEYHJn0KKsVCiaJRKPWZt4SbamPxydU4EfVbiyC/qJ6OASDyL1TZVH3VTKsn6YFsoz0xMbgBQ7he+T7v9MCKMS3vt3/m3B/oGtJ6ckjekmbeQvi5Pd7n4o05M8mASYoJoqJ9ZUXP4H7Gl78bu8S5PnXQaby1gUZegQqHyQPO1fZk4Xd6t47gvIaZk+facFYpmIMs+XY6uj+dNVCRdIhoYrmrciwuDFLNY8Vw3lObDL57OK6JnpshmU1R1zJD1oab9W02STBk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(396003)(39860400002)(136003)(376002)(366004)(451199018)(36756003)(83380400001)(66574015)(53546011)(26005)(110136005)(41300700001)(6506007)(186003)(5660300002)(6666004)(6512007)(6486002)(2616005)(8936002)(2906002)(66556008)(4326008)(8676002)(86362001)(31696002)(66946007)(44832011)(66476007)(316002)(38100700002)(478600001)(54906003)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cGM5VkF1UmpXeUphRDRNNkFCb1JNaEVVODZzaXM2U1ZjblBsbllFQm5BdWdn?= =?utf-8?B?L3k0dXFDU2dzeTlsa0hMU2t1VDRsZmJrNGRJOWp1WThua3k1NnZKdkZzbVFF?= =?utf-8?B?ZGxGMDhabXp6SjREbjBjODdJOEVrS0pGNEZTTEV1a3BwQUkvTFhKa2RTTlJU?= =?utf-8?B?WENkVWMrVFUxdmh2VlM3M1RvTlh3ZDNCalZYTzI3ejE3c1hMUWRtbWFPTjNG?= =?utf-8?B?dWppbjRHVXRzQzNkaWJmazBweFRWOEc0K1VYN1Y0bEJ1QTQzYmljMG5JOGJz?= =?utf-8?B?bFhwWHRuSGFwMUE2UGRiMXFDSElqVlh3MlgrY2hnRU9aSzFQVXZJRHJTOHNU?= =?utf-8?B?d3F4Y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d.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1afb6091-1157-4788-2cb0-08db1f0f4f7a X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 13:24:42.3934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7XiB2pdCTwsUMGsd8hGrYg82yKqjrpSoLPSbFRly2AaWF43PQKmStz3n+8uW0paE X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5360 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 On 3/6/2023 7:06 AM, Chaoyong He wrote: >> On 2/21/2023 6:29 AM, Chaoyong He wrote: >>> From: James Hershaw >>> >>> Due to changes in the firmware for NFPs, firmware will no longer write >>> the link speed of a port to the control BAR. In line with the >>> behaviour of the kernel NFP driver, this is now handled by the PMD by >>> reading the value provided by the NSP in the nfp_eth_table struct >>> within the pf_dev of the port and subsequently writing this value to the >> control BAR. >>> >> >> Don't you need some kind of FW version check to figure out if >> 'NFP_NET_CFG_STS_NSP_LINK_RATE' needs to be updated by driver or not? >> >> How do you manage driver <-> FW dependency? >> >> >>> Signed-off-by: James Hershaw >>> Reviewed-by: Niklas Söderlund >>> Reviewed-by: Chaoyong He >>> --- >>> drivers/net/nfp/nfp_common.c | 90 ++++++++++++++++++++++----------- >> --- >>> drivers/net/nfp/nfp_ctrl.h | 9 ++++ >>> 2 files changed, 65 insertions(+), 34 deletions(-) >>> >>> diff --git a/drivers/net/nfp/nfp_common.c >>> b/drivers/net/nfp/nfp_common.c index 5922bfea8e..006ea58008 100644 >>> --- a/drivers/net/nfp/nfp_common.c >>> +++ b/drivers/net/nfp/nfp_common.c >>> @@ -52,6 +52,53 @@ >>> #include >>> #include >>> >>> +static const uint32_t nfp_net_link_speed_nfp2rte[] = { >>> + [NFP_NET_CFG_STS_LINK_RATE_UNSUPPORTED] = >> RTE_ETH_SPEED_NUM_NONE, >>> + [NFP_NET_CFG_STS_LINK_RATE_UNKNOWN] = >> RTE_ETH_SPEED_NUM_NONE, >>> + [NFP_NET_CFG_STS_LINK_RATE_1G] = >> RTE_ETH_SPEED_NUM_1G, >>> + [NFP_NET_CFG_STS_LINK_RATE_10G] = >> RTE_ETH_SPEED_NUM_10G, >>> + [NFP_NET_CFG_STS_LINK_RATE_25G] = >> RTE_ETH_SPEED_NUM_25G, >>> + [NFP_NET_CFG_STS_LINK_RATE_40G] = >> RTE_ETH_SPEED_NUM_40G, >>> + [NFP_NET_CFG_STS_LINK_RATE_50G] = >> RTE_ETH_SPEED_NUM_50G, >>> + [NFP_NET_CFG_STS_LINK_RATE_100G] = >> RTE_ETH_SPEED_NUM_100G, >>> +}; >>> + >>> +static uint32_t >>> +nfp_net_link_speed_rte2nfp(uint32_t speed) { >>> + uint32_t i; >>> + >>> + for (i = 0; i < RTE_DIM(nfp_net_link_speed_nfp2rte); i++) { >>> + if (speed == nfp_net_link_speed_nfp2rte[i]) >>> + return i; >>> + } >>> + >>> + return NFP_NET_CFG_STS_LINK_RATE_UNKNOWN; >>> +} >>> + >>> +static void >>> +nfp_net_notify_port_speed(struct rte_eth_dev *dev) { >>> + struct nfp_net_hw *hw; >>> + struct nfp_eth_table *eth_table; >>> + uint32_t nn_link_status; >>> + >>> + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); >>> + eth_table = hw->pf_dev->nfp_eth_table; >>> + >>> + nn_link_status = nn_cfg_readl(hw, NFP_NET_CFG_STS); >>> + nn_link_status = (nn_link_status >> >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) & >>> + NFP_NET_CFG_STS_LINK_RATE_MASK; >>> + >>> + if ((nn_link_status & NFP_NET_CFG_STS_LINK) == 0) { >>> + nn_cfg_writel(hw, NFP_NET_CFG_STS_NSP_LINK_RATE, >> NFP_NET_CFG_STS_LINK_RATE_UNKNOWN); >>> + return; >>> + } >>> + >>> + nn_cfg_writel(hw, NFP_NET_CFG_STS_NSP_LINK_RATE, >>> + nfp_net_link_speed_rte2nfp(eth_table->ports[hw- >>> idx].speed)); >> >> PF driver writes link speed to 'NFP_NET_CFG_STS_NSP_LINK_RATE' register, >> but 'nfp_net_link_update()' still gets it from 'NFP_NET_CFG_STS' >> register (via 'nfp_net_link_speed_nfp2rte[nn_link_status]'). >> >> Shouldn't 'nfp_net_link_update()' needs to be updated to read speed from >> 'NFP_NET_CFG_STS_NSP_LINK_RATE' register? > > Sorry for the late response, we spend a lot of time to check and discuss. > > For older firmware, a full word is allocated (NFP_NET_CFG_STS) to report link status and port speed to the driver. > However, in the interests of keeping FW files port-speed agnostic in the future, > the upper 16 bits are no longer written to by FW, so we write the speed to that address (NFP_NET_CFG_STS_LINK_RATE). > The lower 16 bits (link status) are still handled by firmware. > But 'nfp_net_link_update()' still gets the links speed from lower 16 bits. Probably I am missing something but please let me understand. link_update() notify_port_speed() read(speed) writel(speed) ▲ │ │ │ │ │ ┌┴─────────────────────────┐▼────────────────────────┐ │ │ │ │ │ LINK_RATE │ └──────────────────────────┴─────────────────────────┘ 0x34 0x36 │ │ └──────────────── CFG_STS ───────────────────────────┘ Or is it something like when you update upper half of the register, FW reads it and reflects the value to the lower half of the register? And since 'NFP_NET_CFG_STS_NSP_LINK_RATE' is 16 bits, is it correct to use 'nn_cfg_writel()' to update it? > These changes are completely backwards compatible with older firmware versions, so no FW version check is required. ack