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 90FCE41D52; Thu, 23 Feb 2023 17:39:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4106C40DFD; Thu, 23 Feb 2023 17:39:36 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2059.outbound.protection.outlook.com [40.107.243.59]) by mails.dpdk.org (Postfix) with ESMTP id 45BEE40697 for ; Thu, 23 Feb 2023 17:39:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jipue/eIuMYjcd/gEtsfF9shMHSLegc3I3LkZJhlsbyZgURm7UDzF2oVnyCqujuvUNxUPlp3QPjS1UOpkzU76+CTTmT7ULWa/UEPl7USsDkZCdzCtfDbu0itBUm1n3l9DjRVWXpVRnH+N2RIA0qdsOF3I80etn/mo/S8DbpzGzkOtTR3QFwndu06QvjUNmLPscho0IWv4e/9cclocdqDoIYUHBvY92+Uk0lzuskRQALjUN7W4+eySZUkYm+0biZVkKy3Ph5TXQJLe0kNV5Y03NQ8/TL59e+w29xFtfI8M2Y7+Pe9PsnVbMC0TFL0QhvleOg3T3s5zil1VCariQ/NWQ== 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=2IDhW4X/ZLBnMf2wRAepapAvBidkAZWfft6KSURz64E=; b=TVPHp92xGnPIZDJ6rKTAIaZkF6UNA2X9lv8dMCDz02MMwfib80T8J+uoRozdeAn83iEqdpaiy+5FITnI2cvypoQqg4wz51Ay5TwrHKWm84jtuFPk52EFJcVsMSBG5di5AQ369iajlsqwxif3C0weI7T3ROJHHvuS3mObbckutWQhzBcmffblaf7OjCtFq4CxLImXcPnr7BLwqrayr/cH11r92jruoZPXv44dU0lPcQU3GZtpMzow3Q3/tt0gRxwvYAt5Zz21X0Uo810NxeGHpp/UwHz+HsMmCU6TbGMNeRWSD9slfx8ZZ2l6M4ZGG0awzeRVbEcwucchltBe/RoBaQ== 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=2IDhW4X/ZLBnMf2wRAepapAvBidkAZWfft6KSURz64E=; b=WFYvgcLVsywKDcBsC65p9TmWtwgQoH2U7gDUjIgLskrfGRwTBivZdwFbSlq2YvXzv/twckOSv/npnKgudssLBOra97OudCE2lg89TBJVNcQJzE7Ad8l3p8pnxQQ9tATST81JjM63iIsVVILrY3rymHzxp2btcbYuZG8qBSpgARw= 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 PH7PR12MB6905.namprd12.prod.outlook.com (2603:10b6:510:1b7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.21; Thu, 23 Feb 2023 16:39:33 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::3614:22ed:ed5:5b48%8]) with mapi id 15.20.6134.021; Thu, 23 Feb 2023 16:39:33 +0000 Message-ID: Date: Thu, 23 Feb 2023 16:39:27 +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@corigine.com, niklas.soderlund@corigine.com, 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: <20230221062955.34210-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LNXP123CA0024.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::36) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH7PR12MB6905:EE_ X-MS-Office365-Filtering-Correlation-Id: eac1b3e8-3e85-4566-e554-08db15bc8ab7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9wUnkHJ4yeNev/wOU6vjX6rK5D/ZHG2jebl7K9PEVF6ggSTbjsUml0nAql0jPQnXvG+JBSNrzkHOOxErxXsKBIHIpIgvsfk1iIGEfGdvOxxtaebAIYH0w4levkcCfXqwxVDme+ZcCNeHiJ7LLRy5hvyHZ2wQ47EbZJAvKMfbJKTqmJhKl8VDD5xpVBy/a/AhcG1DyLXWF03yzcotRtqru1pf+SGvqwm1dkzvZvL6tKphZxxoYqPqs8SOCxefdtWBdGGQwtULaN3LJKLOUI3yMPt6PaaVepdQCIYSMHlDCMGDdvbp56FZ1+wKygtxOBsdnrOycNlmKCI29y6Rfwj53CgekxIkUayR9V2d721TXkZN/32WAbbCUOtjUTd5QweHXjAogOmev+rnuKIvnYFa6a4vpQqOOam0fgDrzIvd80E542rkfmDl/8fRPoy5IrP9DNmKxjul13KNZwWjPP9ajpJFQJwDCjIaDCH8qOIMeR+FwuVJc0/9qhxfZzN/nNddgLD4PHmp8hk1p2dYXQVVMrJTDZsHW+Ixn51zNTKrg/uQiu3CLH++dzDhJiin1a1AY4v0M4HLtWJrPPKykLfMcbrJ2oYMcECViu/mhA08qfFnwnEBmgTXDn7/czf0NMeBz9DVIeaekI4bHzz3jWFRmPO78lnMmuJItrXHZ3N1ndyu0QWBcm7FmKjVx/s6h7Xd/EYn62lvMj7oC7eH66dNdngGVAVqQ9/vcBPWdB94WBE= 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)(396003)(376002)(366004)(346002)(39860400002)(136003)(451199018)(6486002)(83380400001)(478600001)(8936002)(5660300002)(36756003)(86362001)(2616005)(66556008)(66946007)(66476007)(4326008)(316002)(31696002)(41300700001)(66574015)(8676002)(44832011)(26005)(186003)(6666004)(31686004)(2906002)(53546011)(38100700002)(6512007)(6506007)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cUJNdmwrVDNaS1lzM0dXNFVGekN0cEs1MVFUcVpRNWdud1dWN2FFeW93Zith?= =?utf-8?B?dlo3aUZRM1pIZVJhenloK0R6SDRyOHZoVGxvbUdLcUVKNjN5d1M1YytVdXBj?= =?utf-8?B?UzJzTUczZ2g1NHZWbVc5MEk0ZllmTnhLWmhpNDhLdkVkY3BDSzJGQ09sWGlh?= =?utf-8?B?WE9KYWgwVzdnZjMrd0lzdU5DdWU3Z2l4UkU5dWo0Rkphb2FKQUJXTFhEbDRo?= =?utf-8?B?M21lTXVWMngvWHpXOVJUZTk4Z2UwWHZ1WlFDR21aL28vck83cEhVNDE3MTBY?= =?utf-8?B?OGsvWjVWVXd2MnM3czZUSHZ3RW9hN285WTlLenBFdisvRFVtWVR6RTkxaFJt?= =?utf-8?B?a2J1WXdoK0hnaGEreW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g: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: eac1b3e8-3e85-4566-e554-08db15bc8ab7 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2023 16:39:33.1514 (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: 3vMAYYYdRtp8XECp1fSACKBHg9kg9VNU9xz2ubJY127M+FFLk33/RtqyESAt5LFM X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6905 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 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?