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 21E75A0032; Fri, 24 Jun 2022 04:55:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D47FA4280C; Fri, 24 Jun 2022 04:55:03 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2107.outbound.protection.outlook.com [40.107.237.107]) by mails.dpdk.org (Postfix) with ESMTP id B0BAF40A8A for ; Fri, 24 Jun 2022 04:55:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OaiFNLrvpDDgq1ON7l+UCrWiQX8MMdc9BhP0nivzZYmXPyGXZFCesuk766HxqbKoIkP5T0GY601mxRwXj/zDKTepAn3hmAXu8QII5QyhaCAl4GS8+Re//DugW4eb/JWStqqg0l7H3Byzjjc12M653su+SVJU4vCUt2yvWLF8acoSwHsj98CiRAi8oNniu/2jdZz/8e8YPVrTbEXFTNvkl9S2ZA3n0Ssd1HE9poqTkQhegLT7nHLhEl37b8Ozojzro1XpL9DbxSrsT7rB6XqITshuho7rUzHEUQ32ziT5/jHHhYkiy9Q9GI/wlm6GQZ3P0aR4TaBKheRioIQnTosQHg== 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=Ft/XwXnwub++Lq508dydo4EZa+ijmdHevGF9s4Hph+s=; b=O6z9+mzJaOVMIxvPDzo5SrOrop+kzr6C1U1xk0NPD93jCemoc3FC2ysrHpYUiAcg17qraUijkDV1Q5rnk252AdJ+9qq4Ej61v6wZmoagR3XuxVTdgMs3jVGtGBLA7yL4M6Mja0L+Yh5LmcDIabhQBMinjFDXO01OQ4sUzgqak4KQB4+8VfEUqstZzwFVToG0J0Jou2/MTsOQVn4XIqiwc8YfzA2HiiHbUEyNPyQ4jwiWu1VuZXLsmrKAwZJRpld0IllfsJq+4yGaFHQDgXXcDvuNugfcs806FnZ2xNNJLNWGHFiCa0ZXJldGFSIY60Hjh5pDzQ8/imkY2Ps25LVWdQ== 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=Ft/XwXnwub++Lq508dydo4EZa+ijmdHevGF9s4Hph+s=; b=Oo1lfRK42quBeGBavUW6IuXOpAxKHYfHEA5eeQErGUetrctqLIzUzxDZVbkodD7GEAP18Gy/7M43TjEG9vng0iXONqs3gis0dDYlOkyWdruRhXjoZxHIsqQuLDkeXKGiOU1yClPtUZYnzsOJ4U6PGRkcaAG10IlNTBnMYi05d+U= 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 MN2PR13MB2752.namprd13.prod.outlook.com (2603:10b6:208:f2::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Fri, 24 Jun 2022 02:55:00 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5d9e:9ce5:51d1:2021]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5d9e:9ce5:51d1:2021%7]) with mapi id 15.20.5373.015; Fri, 24 Jun 2022 02:55:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 02/12] net/nfp: simplify initialization and remove dead code Date: Fri, 24 Jun 2022 10:53:51 +0800 Message-Id: <1656039241-20955-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1656039241-20955-1-git-send-email-chaoyong.he@corigine.com> References: <1656039241-20955-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0030.apcprd02.prod.outlook.com (2603:1096:4:195::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5d718bb-0f91-419c-b599-08da558cedc6 X-MS-TrafficTypeDiagnostic: MN2PR13MB2752:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yxPiL5eST2oejTB2E0Px6btsgMICRDdeaK/dXaD0rhYZFM940lrzygePoak/w73tvlvX5HwHwtFzRHbW0Cq8lnx/UwTvtWALNfksNUfE1NausmOw42FEFXrSFqMpzNNMhvO8eaU4Y4wUxjZ7nef7IdlFyOD0gLmQTjQO2o/NSPmaj4SOEH08AyK2T/8kjgCr9gDWYd796L4i+FyukNyrkrj4Yw2aWQ3A3ClzEJLbwv7u4e7z9E/lS76uw7i1jFvO2BjeZ+IX7ni0QP32BkbhOPHWCW/gE+7DP6lVQRMA93xmMQ2oEyTpFmp0t6AvMD94icZ0p++DUNvfsHAwpnLa6tUiYEa6g3ctq+OCFwvtPDlgqHk/5Ygeo2yCBsFm003d8lCLf1AeJTrxMjrjsevs2B2lZrAzDQgFtPxkpq1TXfzyUMDlgBCCDekSiZZR3Cpv9NPS9o0q+U3jlI/5AzOtz8lhDW2Tav2j5AUeEXx9iFfup4haaMMR/TyPx61p4C6npEVDZnmO/KCWnXkYV5VY8xqQYMjecgGDmJYdbPhA22Fg+vsMhXZ9fka8BphF5mKCAAWssgDj8LgdA5SvRjHH5GibSNlu8cQtxQasWb5ljjoT8dAfW8F4ROnEV4rk7mQsk6GGEzCkw/VN5lhWjsXQH8MWYGaIDOrb5mrjnNtV+h+9/G8rjFyPCmAqFKt6wwnwuIgPoxoWvEzA/34yq1ZeJ92xz+q82JNivdDXtjvJeB/aK0471BQEPJmvbpl58raA3zRfLzoF0Z3dY6Q1Su2eYvdVlyu/uJgFlZGAJSTNmQQZcB29+Iwexs/Hv1K8xnwCar1isMPcq+CZdmaxs8O9eg== 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:(13230016)(4636009)(39830400003)(376002)(366004)(136003)(346002)(396003)(66556008)(2906002)(66946007)(26005)(83380400001)(6916009)(66476007)(6486002)(2616005)(8676002)(41300700001)(38100700002)(4326008)(6506007)(6512007)(44832011)(86362001)(478600001)(36756003)(186003)(52116002)(316002)(6666004)(38350700002)(8936002)(107886003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aDFMdXYrUzBCWVNqRnlnbHlDa0JQa0RJOC9lb3pmRVozNU0ySitZcnNjV2Ev?= =?utf-8?B?dGs4UHkrNkwyZU9RbHZnSlhIbWdlRHNlTTlSalJRUURINk1MWklacWllc0xH?= =?utf-8?B?eXYxUDJETFlsTmR6WmFFSEhhbVUwNUJKWS80enBkZWxuVEpNbUFpMU16QjNP?= =?utf-8?B?OUdqN0dYbThnUWdxUDl5eld2Vmllb3NVeUxPd2p2T1doSnJJZnFQTWoxZjNt?= =?utf-8?B?ZDMrME9OQXhnMFBWOW1tc0loZjd6cHlCMFNTRHY0bUdvYnJpSWQ2RkVXa3NZ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xbmZhWmZLVVh1QnVua3Jhb1ZBNGpjREdmYi84NEFq?= =?utf-8?B?NzJpcEUrejJqSE1LaEZCZjdnbTJ2NGwvQytydzVQQ3VVWWVhUXFQY3FkTVRa?= =?utf-8?B?NGc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5d718bb-0f91-419c-b599-08da558cedc6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 02:55:00.1695 (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: 4eYdx7XMHpujyxP4D6bpoc8i8QWulM9UuRN+qJSSVhCZimTDCRLsrJNJO+T36qFC1pViBXyJ7vzvY9jTiOYLhFFvCjP7ml9IO9TWDPfRoZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB2752 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 Calling nfp_net_init() is only done for the corenic firmware flavor and it is guaranteed to always be called from the primary process, so the explicit check for RTE_PROC_PRIMARY can be dropped. The calling graph of nfp_net_init() already guaranteed the free of resources when it fail, so remove the necessary free logics inside it. While at it remove the unused member is_phyport from struct nfp_net_hw. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_common.h | 1 - drivers/net/nfp/nfp_ethdev.c | 40 +++++++++++----------------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 2aaf1d6..b28ebc9 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -238,7 +238,6 @@ struct nfp_net_hw { uint8_t idx; /* Internal port number as seen from NFP */ uint8_t nfp_idx; - bool is_phyport; union eth_table_entry *eth_table; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 3c4b0ac..2c5607c 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -417,7 +417,6 @@ uint32_t start_q; int stride = 4; int port = 0; - int err; PMD_INIT_FUNC_TRACE(); @@ -452,10 +451,6 @@ PMD_INIT_LOG(DEBUG, "Working with physical port number: %d, " "NFP internal port number: %d", port, hw->nfp_idx); - /* For secondary processes, the primary has done all the work */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - rte_eth_copy_pci_info(eth_dev, pci_dev); hw->device_id = pci_dev->id.device_id; @@ -506,8 +501,7 @@ break; default: PMD_DRV_LOG(ERR, "nfp_net: no device ID matching"); - err = -ENODEV; - goto dev_err_ctrl_map; + return -ENODEV; } PMD_INIT_LOG(DEBUG, "tx_bar_off: 0x%" PRIx64 "", tx_bar_off); @@ -573,8 +567,7 @@ RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to space for MAC address"); - err = -ENOMEM; - goto dev_err_queues_map; + return -ENOMEM; } nfp_net_pf_read_mac(app_nic, port); @@ -604,24 +597,15 @@ hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2], hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - /* Registering LSC interrupt handler */ - rte_intr_callback_register(pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, (void *)eth_dev); - /* Telling the firmware about the LSC interrupt entry */ - nn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX); - /* Recording current stats counters values */ - nfp_net_stats_reset(eth_dev); - } + /* Registering LSC interrupt handler */ + rte_intr_callback_register(pci_dev->intr_handle, + nfp_net_dev_interrupt_handler, (void *)eth_dev); + /* Telling the firmware about the LSC interrupt entry */ + nn_cfg_writeb(hw, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX); + /* Recording current stats counters values */ + nfp_net_stats_reset(eth_dev); return 0; - -dev_err_queues_map: - nfp_cpp_area_free(hw->hwqueues_area); -dev_err_ctrl_map: - nfp_cpp_area_free(hw->ctrl_area); - - return err; } #define DEFAULT_FW_PATH "/lib/firmware/netronome" @@ -818,7 +802,6 @@ hw->eth_dev = eth_dev; hw->idx = i; hw->nfp_idx = nfp_eth_table->ports[i].index; - hw->is_phyport = true; eth_dev->device = &pf_dev->pci_dev->device; @@ -884,8 +867,7 @@ if (cpp == NULL) { PMD_INIT_LOG(ERR, "A CPP handle can not be obtained"); - ret = -EIO; - goto error; + return -EIO; } hwinfo = nfp_hwinfo_read(cpp); @@ -1005,7 +987,7 @@ free(hwinfo); cpp_cleanup: nfp_cpp_free(cpp); -error: + return ret; } -- 1.8.3.1