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 46510A00C5; Thu, 15 Sep 2022 12:45:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCA92427FF; Thu, 15 Sep 2022 12:44:57 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2111.outbound.protection.outlook.com [40.107.101.111]) by mails.dpdk.org (Postfix) with ESMTP id 43B1340A80 for ; Thu, 15 Sep 2022 12:44:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B/5WmBe4rsCxdxdij61Wn1hujsjvmd2GW5D9LT6K2L7qJ3LfCmSf8X32clhnx03AZ248UdfnJ4krSG+t5qz5pT/buVc4Bam85XEleYintcjn6saDTvtHXreVpqxU/FAsOKGqS4W/6x/NAwE8DUBGn4gKcQI3jbfhcLt5o1CExVX8SvJbVtFj/FyNh0zj1ZuNS6yKCXKO7HlDOXMAz+kQnlB/58RulRTn/QQptS1B5VrX72QLX0qUpHmmSNoFEzITZwxOoeLpOg4ySC7W0XH6lpaHkAsiTi0fbxMddFYDbMZLpcZxZijCi6G6LEvJVPKB/kWFo1SfAYH2aMc9r3+FUQ== 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=oyLQGXpiN0BiwZD9djrcyNyt/SEuGOVXNc5eMJpddc4=; b=BaFZA/K0xCNKnNgKDQ/AW8XqGMepghu+XDveg61XlmtHH7RVYe4MEiv7HnM3fLAIeg7N3TNDwqy7lF4E7FYFyntC3Q3EfcPOZ9bRd/H+L9LyvhS7b6wM5dNmI1urdx1J09RK9gFcbNb3AHQCVkTod9rUiUQmCMWmatXtNikb73UcOyrL7ZgpwmHHb2UPX9GKJGw5qbp+QlqgkjXxQ8k97OnCKhnfTA7g96b0JM1WuONFk/L4nv5/OGz5fu3nH3Z7L0amfoUIe/m3YUJV0dlW6LOwC/hFxhekKiDaM2XjEeEa0YgCs9dOm8PkiatOuPMSDubCkuWy6SB8e8X9ZP04Ng== 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=oyLQGXpiN0BiwZD9djrcyNyt/SEuGOVXNc5eMJpddc4=; b=XUsEbyQ5HQmPiFKgWBNOV1PkqSCBi8Fx0d5ZpY2t2+3uDAJRUQj7MWHifMjVvfnWZvQl99j8HPIdP3UkBIGA1+uhVkFrcYULGfFFG0tRhyW+RR2z+w4lZ0R5yQ9vRDgLI8Ub/LMnOqJ8+6TEAipXiIFs2GH/GFM4cXtacU9Hxrw= 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 SA0PR13MB4158.namprd13.prod.outlook.com (2603:10b6:806:9b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.5; Thu, 15 Sep 2022 10:44:55 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15%4]) with mapi id 15.20.5632.012; Thu, 15 Sep 2022 10:44:55 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v9 02/12] net/nfp: simplify initialization and remove dead code Date: Thu, 15 Sep 2022 18:44:19 +0800 Message-Id: <1663238669-12244-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> References: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR11CA0071.namprd11.prod.outlook.com (2603:10b6:a03:80::48) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB4158:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ad295d0-ec17-4263-2a68-08da970753a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qCbXnMkbQSGPV3+e2fJjYThhdu+YnTvPdI7q783g5y9x/okt+VTPDGxMB8YuM7ZKPg1kzButCnwpHSjZuOfLM8j25HHNFs8QDzOrw4eJr1iX07+ENOUgqMvGtn9IQYH8Q/OEl7/NWZhH+PapRMvVJ/RkwjlVr3KBmITSizklINjCkOEJ12pkZ72eG0zlrsdLQxzgESCCTJfW8SKhbCxQRXLzxYid+knfaR6L4udtSC/NTj+drtZxum8NLTyU6M/g8Tqe1IidbNJXsKlbJWV0wVo0pwTuzHLAf/ppU9RuTaqJtoGG2SqZDG6nfJp9RJVxjhUhh7H+ktnqYZcnA2ij5sPbi/svE5ujv6sNlOLO8dDte/Tg5BZvO1KtJiMId8EERp2K02tDA4NfZ7A5RxP94lwBtatyCHy6Ff7njFrG9PSmvd1BXSV2mJJoK9Z1s8s6enFR4x5bvvfGw0Y6jQuGG58n5QCBuNFerXM9jHb5NPIttDI3nIsPkQiNoRZ0uIVtH9x+7D5szwWq5U+Q/KJ4Mlz4/upeZrtLT5xbqVndWHZmYW9YiDw0VZInuQv1xGRi8yVbXWntvJ7iVT5Kr9LyTAm0fDBpUiVqzSUAQscFeufKqAL71iXFqZtEczR9eVasq7iJYBwDza3ETP2BpCl+67aFFBZxuRA73zwHLEcOfCTYPT65eCKnA0e1UU5zCDSMqvnA5Cndg2P0Ufv/KY4b5enrufmpXkh2xoTxF5qYfKDkYy2lktDAgHqhLRbldcJ8RokresyPLA1KV0E+qf+QvA== 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:(13230022)(4636009)(396003)(346002)(366004)(376002)(39840400004)(136003)(451199015)(2616005)(38350700002)(38100700002)(186003)(86362001)(83380400001)(107886003)(8676002)(66946007)(66476007)(4326008)(66556008)(44832011)(8936002)(41300700001)(2906002)(5660300002)(6506007)(478600001)(6666004)(316002)(6512007)(26005)(6486002)(52116002)(6916009)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SDlCWEFWOHNCd2ZsaEpJMVhUMVp4YVFCRGhNUFAxZzhMeXhWQzB4LysvR1hy?= =?utf-8?B?bXk2WkFKZ0hUYTBiYm1aYWNHdXhCVkRTSFAvcWprSkNyb3JZcFAyMzJlY0Mw?= =?utf-8?B?M1BYdjhXTjFDc0xWN0R5MEFDUzNWYjU3am1KY3FQTnlaRndyK0o1TlVyT3dI?= =?utf-8?B?UERyWTQ0anU0eGZOZTF5V0d6RjFtUWRZbDErQ1hmTWlOdkh5TlI1QjNoZGY3?= =?utf-8?B?RkNQL2VrbG1nM2xpZ1RWbDk2NEhKN2p3UnpZMDQ2cjExV0ZFbXppYm1GZEUx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KR0VCdi84YVNvaFoyWE40QTRNc2JBK1RUSlNjR29p?= =?utf-8?B?L05zL0VMUnlLTzhFNUZhaFMrMktLSDdINEdXdTYzVFFKU293b000S0dkbS92?= =?utf-8?B?VGc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4158 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 bea5f95..6af8481 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -235,7 +235,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 40d21e4..5c96f0b 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_fw_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" @@ -820,7 +804,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; @@ -886,8 +869,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); @@ -1008,7 +990,7 @@ free(hwinfo); cpp_cleanup: nfp_cpp_free(cpp); -error: + return ret; } -- 1.8.3.1