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 169E945492 for ; Wed, 19 Jun 2024 11:59:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EDBA42D97; Wed, 19 Jun 2024 11:59:01 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2132.outbound.protection.outlook.com [40.107.236.132]) by mails.dpdk.org (Postfix) with ESMTP id 48EB4427E2; Wed, 19 Jun 2024 11:58:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dDgi3Bt8tqZEIR579A8Slk0LcZiNJBM3ezzMR9uCeVwQFaM4cItOH95i28Zxre38yI23N7NLimR2IYGJi+AX7pf08XCdWk+GjIDQ9rOH2AD52k8LTIUj0RhUt6w+uwy74HD5HIVy5c3YqFaFi36xuV3pu+DRbtvmzPZyXgQmNhzorDWOEiF+WuQwXUubhk0GdgUmf/Bu4Sv4UK/h6yhyVvvcUiZiFwsfcKPQ03UJio6vh4V3dS96bPqkBr2y8U3lBNKrT3DV8TL3kXmZWEno7Mijcnd3PMQINKbvlh5Ky8kTmmDDYtIUVoOGKqFJ8AYL33hxfMBDMpGvtybzqAoV8Q== 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=6xAbynoKRfmAFd7gNTork93mU7NV8MwJPji+/GHjYis=; b=H8Dq5hmr/t/4oL10dAS4FzQdYa8RfA3KYf8Lc/hKfwh7CdQ7rYjM+amKX7gXqWvwgpg/KnydaQzFiQrRFe7moY9u6wie5h/XrjJogtaRKwhOsUrv17rDDK09w0L3zF5937imzSj2d5tbdt7BNVQ0/rLTKDlLx9lzhK+6yrsFIKjmquyUMbuhYA1oD/rxUOo0SLdVDBxOOenPJBanShTPLmdMdk+XRmEOwHgrK2IOrscQvZOziz6IRErpmexnr7VaBXTDerZAJzXHfxLEboGJMqXmCc3PPwu1em9BTEitYkWewkaBsHORbkId1e9t1hfp6GlcozmsVTYuY7thGFxT5g== 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=6xAbynoKRfmAFd7gNTork93mU7NV8MwJPji+/GHjYis=; b=AO9PgaU9An2FAYR7KHPQO34EgcBzMXUV2xTRhOHtPtHLNIWYEQLznaqTkO6T9G4Ny7KSgdOxh2sqaxmzbnmvXI/ev5gWubR4qS3BPvbNffvG/w05U/xdRkO7cvfOcfUBDnJZoNIUSCENwRw3hz8mdmSw9nsyON4c+jz8FYKZPCI= 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:56 +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:56 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , stable@dpdk.org, Chaoyong He , Long Wu Subject: [PATCH 04/23] net/nfp: fix repeat disable the port Date: Wed, 19 Jun 2024 17:58:11 +0800 Message-Id: <20240619095830.3479757-5-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: 7e1b563a-2e65-4a48-1f3c-08dc90466edb 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?yfFHFc+KvK+9bPQ/8y+jnsPth4UAqSdPyTuNpdk7kuMoOu8SHfYyNkqiWA+V?= =?us-ascii?Q?iUM3kQe7If/Jb209q8ppPXcS4I50Wp74wimxIDdGbhKz1mXramtO3U/C98nX?= =?us-ascii?Q?eXQRJ5A1pcB6AAJZNxMoIDWl3XymV3qhkBSgWwVFlAgUIs8zkCRHTctNyeF0?= =?us-ascii?Q?qdYaEKmEAwEWFN8UbTJFzfkQvqeNiRvkBK9R30MJL+jrdOf14F1JC49q0aB1?= =?us-ascii?Q?GuiTjYRDoyucOE5vSzizeHP7LVRMFRL53Nqjrr1nh+Cuc5oSOHrrvw5JNdI+?= =?us-ascii?Q?5I7G6yCA8Wu/FX5ApWnOrusBEU9fGftJfdeDuKvEI7nUOp4ySRvlsD1PLI1+?= =?us-ascii?Q?RB8aOATwnEhsriyiWxlKdfP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0pc7Z5b7/YSWq2MFu8k+wSaKmOewAxRdcHGLG9JGJHbJQS57ptZoudQVZ?= =?us-ascii?Q?K1Ttr8TtPAv9f5edwCtnS/TODTGV1Tw8lYaM6EM0ZVwBLvlG93I0Ij7l0yxk?= =?us-ascii?Q?gd5H8TM=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?b1papHOLlNGIiCGnk3upboNpn44WqHj42mSQDHsvY0hDlgJtj43hi07Veg2p?= =?us-ascii?Q?RfCOflI7Al8d6F8jERtKGf/z7q/iOdTVztsr7jYd8TuzrSRhpAvd6CsRoQE7?= =?us-ascii?Q?ijYHCi1K815Pz21WusG1qyx/K76duIV7Q9gF5klw+0kpAn3xTBbsExCBwqAF?= =?us-ascii?Q?m7cNtVCB88mT8XbPb78HulK3BEKNcJ7lASXTCvsuIsLThdR+swrAL7L3VGFp?= =?us-ascii?Q?aluYeeGo5EioMj9FsdZ0+RDbjRstCY43Lx4XoEzEXve+Ck7DCGtb4reHB0D8?= =?us-ascii?Q?u+BCWpS0XU2DpB8mF+DSOkzdAAbT513aqxBlboffzYb0ItdzmAXQsHyxCSka?= =?us-ascii?Q?mR8DsV58Z96PIcdUFAtr2K+foo9jvT/JPRD6I27FDoTO51udCgikijwKnPUB?= =?us-ascii?Q?qzA+W36/xaFY2V/+cc+TRQKeCpklmr0m/vYlN74PLQCBuKsuP09zF/uPe7S0?= =?us-ascii?Q?RbudH/0Jylp2ki8LK7ONdubG4RXosBjUsCVZwfxbUU/WPktuG8OCsS+DUy0A?= =?us-ascii?Q?BM4hzQlmx3TK5nmkvqDW6nMAjXxYsVFynCo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OyvZO5i3iz/8PDOfIy+RimuPEnTO026c+zuUs5coRJKAoF/g?= =?us-ascii?Q?Jmw0Onw0rTUa3VisyV0Fjp38lKdprPiTwPvXV9KhqZkX6fDTT/73LltUieVn?= =?us-ascii?Q?MPaCoI7zZqLEVpxZWNEipeOowkqkRh/rok6E3t/+PDV+XnM6coXz84X934j8?= =?us-ascii?Q?HA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e1b563a-2e65-4a48-1f3c-08dc90466edb 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:56.4227 (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: D/N8YTN5Jjg6U5pmXNt5B8QNEmiSRHvG10P2vgpivLcOEmBoNVmWDPSDuYZ3afVLw1KGBhOz8F6ndxLlPPI6zzwlJsULcPPT/ZhCeMs5yc4= 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 make other PFs suddently down, which will cause problem. Fix this by adding the special logic for firmware with multiple PFs. Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols") Cc: stable@dpdk.org Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/nfp_ethdev.c | 35 ++++++++++++++++++++++++++------ drivers/net/nfp/nfp_net_common.c | 10 +++++++++ drivers/net/nfp/nfp_net_common.h | 2 ++ 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 181798e8e3..7479802a52 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1773,6 +1773,30 @@ nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev, 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, + struct nfp_eth_table *nfp_eth_table, + struct nfp_cpp *cpp) +{ + int ret; + uint32_t i; + uint32_t id; + uint32_t index; + uint32_t count; + + count = nfp_net_get_port_num(pf_dev, nfp_eth_table); + for (i = 0; i < count; i++) { + id = nfp_function_id_get(pf_dev, i); + index = nfp_eth_table->ports[id].index; + ret = nfp_eth_set_configured(cpp, index, 0); + if (ret < 0) + return ret; + } + + return 0; +} + static int nfp_pf_init(struct rte_pci_device *pci_dev) { @@ -1781,7 +1805,6 @@ nfp_pf_init(struct rte_pci_device *pci_dev) uint32_t id; int ret = 0; uint64_t addr; - uint32_t index; uint32_t cpp_id; uint8_t function_id; struct nfp_cpp *cpp; @@ -1875,11 +1898,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev) pf_dev->multi_pf.enabled = nfp_check_multi_pf_from_nsp(pci_dev, cpp); pf_dev->multi_pf.function_id = function_id; - /* Force the physical port down to clear the possible DMA error */ - for (i = 0; i < nfp_eth_table->count; i++) { - id = nfp_function_id_get(pf_dev, i); - index = nfp_eth_table->ports[id].index; - nfp_eth_set_configured(cpp, index, 0); + ret = nfp_net_force_port_down(pf_dev, nfp_eth_table, cpp); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to force port down"); + ret = -EIO; + goto eth_table_cleanup; } ret = nfp_devargs_parse(&pf_dev->devargs, pci_dev->device.devargs); diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 107306a4e3..d8b7045c3a 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -2554,3 +2554,13 @@ nfp_net_fec_set(struct rte_eth_dev *dev, return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec); } + +uint32_t +nfp_net_get_port_num(struct nfp_pf_dev *pf_dev, + struct nfp_eth_table *nfp_eth_table) +{ + if (pf_dev->multi_pf.enabled) + return 1; + else + return nfp_eth_table->count; +} diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 2feeb6f5bd..4016652cf9 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -326,6 +326,8 @@ void nfp_net_get_fw_version(struct nfp_cpp *cpp, uint32_t *fw_version); int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev); void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev); +uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev, + struct nfp_eth_table *nfp_eth_table); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) -- 2.39.1