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 93DAF45492 for ; Wed, 19 Jun 2024 11:59:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8613742DD4; Wed, 19 Jun 2024 11:59:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2138.outbound.protection.outlook.com [40.107.236.138]) by mails.dpdk.org (Postfix) with ESMTP id 0187142D7D; Wed, 19 Jun 2024 11:59:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDw+YSre8aKkjbWHABIG0/v0/A0Di44rPflPa6Cpklg/ChdQ1CThuU74lAABLOlbkcbdETyYyUCZ6DCtGrnOiKpiDgvbsyDuCKcy+9v6YnHjTk8Hpwb55M4MZOiFNSAnBR0MgAY0DUdwN6cKWadUC6z0My6Zmvz6Ti0ZOR4AYU2alntykKedfi09oJQ0Ziri/2b/VpVCczBx7V40269tV6l7sxBz0Dhf4x814tHA1+ZCXq5xVDaNqC+agw8nr6t/QNhXqlq+E2vpIvALU7V5Bgb/C07hKYG8vDvi+0TTMOBgfX3cSEtSXi6xrGQMWYX1cVk3xagPvyzCjPiD3yFc5A== 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=C20hP0rDMb98p7vyG1Tg/WV0zDvCh3c/T/YDj5UNCzU=; b=QTkG1gP/6MNuMuOKHTqAVcatmcLBm41i0mLf+5VOmtUW8Is0OISRchaIwpHtBBaqosZkngq7phuVgZ0JOiwGtZR5gU2CJsrwQaFT0DNf1SbiqSiIjiVPpIA/fY7j05phSXCH/SreIoeXVcSUPE5wgqcsK3+6dkA099xirW6z41qHZZ9WJ+bR7bvRfKcM0wt8MLBLJPJ5Y68AmIWqwwtEf9HnxaieMxkjlUpUDhwg68PMWOMr+y+qUlD3ji9UuyckGeXxSjNZtYm6QQiB2Rfg28b9sj+Ql+m/w4UcTcfbWdgQT7P2RTVL+t/bvG5CAvzRZrvZa31ImrNVOVpBW/OMOw== 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=C20hP0rDMb98p7vyG1Tg/WV0zDvCh3c/T/YDj5UNCzU=; b=j3B+mYyjPAOYwZIMi/gP4TODheyEPL5dZ+fn8YdX61Bkg7lZ5tp3L9sd9zikbI1++SThXYz8Bdq0YL9h2nPXFAYDtJBeTasSZprZhGlRiOlxSEVYGmNNeJvR+S5D6kS7POlXOvs3N+ryUs6CNAHfZTqnauldeygafDiyhAl8cSI= 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 CO3PR13MB5782.namprd13.prod.outlook.com (2603:10b6:303:171::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.20; Wed, 19 Jun 2024 09:58:58 +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.030; Wed, 19 Jun 2024 09:58:58 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , zerun.fu@corigine.com, stable@dpdk.org, Chaoyong He , Long Wu Subject: [PATCH 05/23] net/nfp: fix repeat set the speed configure Date: Wed, 19 Jun 2024 17:58:12 +0800 Message-Id: <20240619095830.3479757-6-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com> References: <20240619095830.3479757-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5782:EE_ X-MS-Office365-Filtering-Correlation-Id: e0b09e16-60cd-4822-86e7-08dc90467034 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|366013|52116011|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+44/JHKluHX6Jp9iEO6FBvCqtnRmqvdR6Y6l8/zxq1ZdfFvcPcED37BREJVu?= =?us-ascii?Q?7FkkzyP1E4ChfYbwPs2lEyICOoReeMRBGKvU48MamoJVJ+oRoPwzzb4m8TBO?= =?us-ascii?Q?LmZwiTPqbDiDbdL3dclA2KoRqaU9Ehw/uHCPCyOWBDoXENBW84OdEjz08wja?= =?us-ascii?Q?X1F0rvDGO80nfwke643nWy8eDTiy1sm5XSFMLGTo05j/NdMszYADgudxKvMk?= =?us-ascii?Q?76jbU83eWvBiezTmOs42A9mfNJJR16vpeSdBsmgIpuNL1nP+EemxkQchjqmd?= =?us-ascii?Q?mT27G/CMB5frUXmNF000kih8CrT/m2dEy2g0faNQ012l41mma41hl5eSCFe6?= =?us-ascii?Q?jLyYEqHxsdjiSUz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X?= =?us-ascii?Q?fLMuDZ2WR+K+XcwSx3OzLgIGQJMBXBzeyjkONNIWB7G2LahX4TORlDg37pWK?= =?us-ascii?Q?ldc00PRd3q+lYEokQWUlsRtkxeWVUGNw3G250tPTu/QSnHzha+fEZZ9DpOIf?= =?us-ascii?Q?DQp5Jo0=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:(13230037)(366013)(52116011)(376011)(1800799021)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8qL2Xn/EJTC7dsKoIIoCxZEl2YsLsWo/C10tsXDlAhv4vyETqcotJEUJI2Oh?= =?us-ascii?Q?GNukESmxM31UNL4s1A0WT6t9qY7tEvrEQG89u8x4bZGJ/vreCNU/xkpjjyft?= =?us-ascii?Q?Gb1+UQbJMibzsBoHVqkQmm93IloW/+nPBCOJihm0XVhT7qliVwLa0CN5i7dJ?= =?us-ascii?Q?3U/6ejXgeeJt/h8xaE0WlH7HajCAwTJzdj0otjAtDUxncnTweWwb5KrQAtro?= =?us-ascii?Q?pJPH8EiOQVioZvhNoroNcVSQuEUVommRGDzsp7yAhsSMpar0wtdXGnnbKzaK?= =?us-ascii?Q?pmVNRQ6YZ5ULcRugbgXsOnbRQvhYL2+Omyprf3clurLtvTOakJu7d0y6tZEu?= =?us-ascii?Q?8y1/wZC6NhRXwFkj23EBaIDMhzzTYe/qW3eKONI0yHOhoj9lQbdf3VIjPX99?= =?us-ascii?Q?H2hQP7gtYIugBvouYTX4MetHyMrEGTP/Ig9lBd8OQDyFM3lI8RdBJiR4mtA1?= =?us-ascii?Q?SR0q26kVTyqcJXMovtu/AWEgyGow0fX/vXwPT7zlPQxSIWP3oASFtx0wA/Bp?= =?us-ascii?Q?YJgiAAtS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vb/4suiU3kynKPrRA5aT/YI?= =?us-ascii?Q?DhyXbZD/pd8yF2fMu06+/gRJGQJJmSgSALwp70LSSNTqO65JS4xepURlFd7F?= =?us-ascii?Q?d6iu9bExRM6e4y0lMKvRyaCSKjhwYvrifTh4k6uMh3FmTo5It8ltzIX/A2kN?= =?us-ascii?Q?vj/tP3ENRyYfRoCNPQZ5RTjAUGqKXcKXFEYLE1lmgnEqtoobakvysQ+lgwud?= =?us-ascii?Q?UQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0b09e16-60cd-4822-86e7-08dc90467034 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:58:58.7038 (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: XdHyfNDqX0vvrcdrl1M3HlFUWgFIM8aA+PbHF7YC4Bm8rY7k4czzqXmVdfqRiBpHwJ2PS+WV7K9J1gAQvobAlRRwUYZuLsZk/rv+pwhYEkk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5782 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Peng Zhang For firmware with multiple PFs, all the PFs share the same 'nfp_eth_table' data structure. So the original logic loop the ports in 'nfp_eth_table' will cause the speed capability field of the 'struct nfp_pf_dev' be covered. Fix this by adding the special logic for firmware with multiple PFs. Fixes: 3110ab733862 ("net/nfp: support getting speed capability") Cc: zerun.fu@corigine.com Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/nfp_ethdev.c | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 7479802a52..2c1300350c 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1741,7 +1741,7 @@ nfp_net_speed_capa_get_real(struct nfp_eth_media_buf *media_buf, } static int -nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev, +nfp_net_speed_cap_get_one(struct nfp_pf_dev *pf_dev, uint32_t port_id) { int ret; @@ -1773,6 +1773,27 @@ nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev, return 0; } +static int +nfp_net_speed_cap_get(struct nfp_pf_dev *pf_dev) +{ + int ret; + uint32_t i; + uint32_t id; + uint32_t count; + + count = nfp_net_get_port_num(pf_dev, pf_dev->nfp_eth_table); + for (i = 0; i < count; i++) { + id = nfp_function_id_get(pf_dev, i); + ret = nfp_net_speed_cap_get_one(pf_dev, id); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to get port %d speed capability.", id); + return ret; + } + } + + return 0; +} + /* Force the physical port down to clear the possible DMA error */ static int nfp_net_force_port_down(struct nfp_pf_dev *pf_dev, @@ -1801,8 +1822,6 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev) { void *sync; - uint32_t i; - uint32_t id; int ret = 0; uint64_t addr; uint32_t cpp_id; @@ -1953,15 +1972,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev) pf_dev->nfp_eth_table = nfp_eth_table; pf_dev->sync = sync; - /* Get the speed capability */ - for (i = 0; i < nfp_eth_table->count; i++) { - id = nfp_function_id_get(pf_dev, i); - ret = nfp_net_speed_capa_get(pf_dev, id); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Failed to get speed capability."); - ret = -EIO; - goto sym_tbl_cleanup; - } + ret = nfp_net_speed_cap_get(pf_dev); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to get speed capability."); + ret = -EIO; + goto sym_tbl_cleanup; } /* Configure access to tx/rx vNIC BARs */ -- 2.39.1