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 068EBA0543; Tue, 21 Jun 2022 10:09:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FA9342B71; Tue, 21 Jun 2022 10:09:18 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2137.outbound.protection.outlook.com [40.107.93.137]) by mails.dpdk.org (Postfix) with ESMTP id 207B04069C for ; Tue, 21 Jun 2022 10:09:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fPyngA3mnkwiokZvQCey1XzRSjJhKb00GRWBqwSzQx+hyNOp7EzYhBcPxXesNEu2sggOodBemUSC66rq2U/et7pEskHgjQLU8s3q0EMm3wQ+OZJl0iAyJ9tG2iDj03EILgdTODGzwJlV4O80d0aY7OWZ7lxeZt4xq+w11zo5zZE/LgDuO6h+qeC3s6IDXw9TgbC2H3WknKXvFzfgRGdry+MwuOPkOAMbi0pKB9fsYaR7XWjl6B0GJnTDKfiNawEDLbizpE18XO8lFpGTiYGf57knpVvK6KttqBlYUxi8rSy3Sb+MrBrHglAsh4OxNEb0cOXfq+jgrzdNV5PFo+sF7Q== 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=KaboE2BW/sMLzI0ik2+NzaUJqpbkTz3gdbm4GzCxWEq6iF0rwxGTzp6scaoAGxrjCG4EWGd+3AKZ3HQvvqcEyrZ9U+ocfiGncqFxvR6FBsVugg5NiUlbreXAtvX4bVJnr1SqxeSzLDL40lKkLq5BifbLxd17NY0FbWN3GFvWoPCOpezUH7PenTGi+fIjCk57XLGChuel24yildqkm1eOtsG/XDRfGrHe1mC2GZxqfoFXUAPr5ZNSGsjkhYwGNUANqg+z5keuOj0fmOp8m2jcalLU32Lk9UPBX3o/TJ6Gt250UWE1coo1v81OmgoSnghPPBaEa4p09P+DOFw1G1ycrg== 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=BpT/n78QkIY6fET4BgVzhLHKngJfPW08pGqps5c4TO/CUKw9XLk0XO6Uxd9HcAzEuDVGARRyI1RvhN+0jaJ9PZzbRu9NZgHiglcNx+UcaUxU8FRHC1yqhUYCP44dPwPS0TOXNVghgG2LD8ENl4HVnzACgbo8XSjuSTMo70qwD8o= 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 DM6PR13MB2730.namprd13.prod.outlook.com (2603:10b6:5:13e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.13; Tue, 21 Jun 2022 08:09:15 +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; Tue, 21 Jun 2022 08:09:14 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 02/12] net/nfp: simplify initialization and remove dead code Date: Tue, 21 Jun 2022 16:08:29 +0800 Message-Id: <1655798919-38659-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655798919-38659-1-git-send-email-chaoyong.he@corigine.com> References: <1655798919-38659-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: OS0P286CA0009.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:9c::14) 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: ae29e7de-bbc5-48b6-71e4-08da535d54da X-MS-TrafficTypeDiagnostic: DM6PR13MB2730:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: It0nFpShpgSIWDWxXdAmW9ZCPJgGXb6Xk0MegCxr/BIXZKWmm4D7XBc2DMs+DsBjYspU2hNgOZ3Olx8cbCEmEZnwUgmTPKk0YPGZabLuXwhktdPd1Mq72M1bXNv5LknhYBwv+CzJuzRIrB5zF1KHqVJGA39rLAFLG2BPHSNPc5m2YK1/FghunFge79DoC31msjSDMJ31ANgm9pSXAaNkMPRZgsDFB4dZVTHO3wWuYCNlMGkzmh+JUp23GlQgLcvm0SCkMkGkoP00UReFT3eSmmDQO3FLBxsPEI3a9Rk8hNgJ2pVLReMprwi1L8yRWVj/pcCBrRydeUvevlM9zT0juTC4F5coG/Kf7c6UErE6qJawJkP0u2uYyw0dSP9Y4q9KtOfTKH8xYaTFAYm6Cx1q3azjvIBW16W4+q8cLP4b8dZNAiHV+ABSU14MQg/gFtnPzn8o1Obd6ggIxmMUCDdMfjlqiezR61n7IxaPAPWiySWv2fU+FMbvTK97xNxdKfNzvBGeHjvCwjNMBa2lwoNqBRobhXCztOcIjt/XxFNNhK5wHZ+tm+r4IgaZveOUFK64q/VtDptCPAi0whJTiqwY3t0d8/M+zULiGfxl0w3ee0e6PO1HIBLHFgERshNN3dLF4fALjyg2mxMe+MVPtbg6rj00VqU/1/e1f7DP+BkjU1w/MFmQD7T4bh2qfCoT9K5YB+labRFe50N5vQkkaknceQ== 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)(38100700002)(2616005)(38350700002)(86362001)(83380400001)(66946007)(66476007)(41300700001)(186003)(8936002)(8676002)(66556008)(5660300002)(107886003)(44832011)(2906002)(316002)(4326008)(6506007)(26005)(6512007)(6916009)(478600001)(52116002)(6666004)(36756003)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TXVncjg3cG5OOU9GaFJGWVZqZ09ETDl0WDRwMVQ1dlhRWXIySHFhOHR2R0s1?= =?utf-8?B?bnB6ejdZbzc2MmtTWjF1UUE2ZkFXNm9nRlZZNkp4cEFZTmwvei9FZ0pvaHNR?= =?utf-8?B?SlNmYVpKSGRzd2E3bEQyMzdWQmdCTTVxNGFTeGlDMVZKY21LSlp1MnYyS2Q2?= =?utf-8?B?bDVGOFVIZXVQMUM5Ry9ZR05LR2hsVHhqMmZPdnY2R2prWjRLQk5SY0FGUTBN?= =?utf-8?B?Nnc3elh3Wis0Zi85ZGZkanNJSjRyRzFxbEVvUDNvajR0YklGUVdvNmttSk9R?= =?utf-8?B?dGdrc1JNVUtJWHJhb0ovZm1OdVhnUUNTR2J0ZWJsbThHcHVmZkwra2ZZWjJj?= =?utf-8?B?VGp1UWhrenVWQnRXeX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dhaFEzVjZHQVkz?= =?utf-8?B?Z3pzczJEUFBNSmRvT0tzcTBRREJBL2JmQUF0RHZMQ3A2WnhrbjhxVkRveEhS?= =?utf-8?B?RXZwcVpaVXVZdWRVYzlTZVVHbHF1V3o5bHlwV3lUTWlMaEJwdko2R05IMldt?= =?utf-8?B?Q2FVajFKZXMxdUw1MWNuYkovbDkrYXZZYzMzMmJSTUZlTVg5NGFWdkhIY1N3?= =?utf-8?Q?k3kdGMzBce53zImQ=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae29e7de-bbc5-48b6-71e4-08da535d54da X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:09:14.9199 (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: /huKkKDhMyONt3KIltb9pKFzntUMMvTmwiLzAwS0o32/tc1EyRPUjlNEgZJ+jNGmKyiBh0Y4vcIbGKEUeqVaiM5FmKgfThy6ce6RUel2Y+E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2730 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