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 41756A0543; Fri, 12 Aug 2022 11:22:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83AB842C0E; Fri, 12 Aug 2022 11:22:41 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2094.outbound.protection.outlook.com [40.107.95.94]) by mails.dpdk.org (Postfix) with ESMTP id 5892E42C03 for ; Fri, 12 Aug 2022 11:22:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dAs2VoReqm9Quj9NRDRfk3w8HQuH7iQo6GEQkAoFSKEFaXC9B7zfWMDHiSCgnHOnjbucmdL8cK04M5ULN+IvoBL7rvRYfxY6uC96x8cFDjGxUQypX/Kzs4qqVCEIQiyHLRopK2Hu/e8Hng9sLUPngokr5vBGToXz+4CLGQuOGIe5rTGSMEWOjEDnAgA0LLSe5mVrjnx4bFlf+ow4AsCS1t0lHc5+/7Zew8cjVp0W524t0l4Ce4uog6axxFm0AesxsNdMO1wNTU5Ca9GXRXOYgQsH+3i6q8y/S6o2pUL2vnyuQmD0/MEYf2Tbi3oVWnQcnvCSi+ID4Y8OA+t+YTNtcQ== 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=vkk64040CHWwjneSfqyqSg0GIxp4v3oSUmXPGSwt+9A=; b=eIHiAefMiCyDSZu8pUagu+oUMRFnetayTTc9myvTX0wDqiPAWK8806WB4AEB/faCbonvaZq7Ph204doDOEVHn6NAxHItAdijchovKSMZQrEBwnnq0krAI79LEOmRPCShTpYV/NBp2yDE6t7reO+aFWcptc7JfCPScpnaiP/lGhI3kAX5QJRfnykOcEvqGeAX4HyvmKPfwXJY2fBJvPrKBki8oBjk/hOtwaY+rd2Mx2k4ITCGeoWPGdgGM8xx1YQqT6ozPgo2aVtE4JgM7bg9uljkMQqfylt7EGvXhH1P4my2Fal8WXEEXSQ7Pll31+1P5DADqure1CpsMuBe9UgeKQ== 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=vkk64040CHWwjneSfqyqSg0GIxp4v3oSUmXPGSwt+9A=; b=PMdn6xy4rse3V1oH5czk5qT+JchXFKrxc+seEpKAvECl5pmg4RYbG8MpG5LRmJWq0yppfKjQHER8ZtiUaGuA7cx5pP062Ma376+5RiBipu7Aj7UEdfgjLb1EfdJ6ua6XSREJl7pNb8esNeWM63hfY5IAZlKAvITZJoONoqYqils= 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 PH0PR13MB5284.namprd13.prod.outlook.com (2603:10b6:510:f5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.9; Fri, 12 Aug 2022 09:22:39 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%5]) with mapi id 15.20.5525.009; Fri, 12 Aug 2022 09:22:39 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 02/12] net/nfp: simplify initialization and remove dead code Date: Fri, 12 Aug 2022 17:22:03 +0800 Message-Id: <1660296133-35266-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660296133-35266-1-git-send-email-chaoyong.he@corigine.com> References: <1660296133-35266-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0046.apcprd01.prod.exchangelabs.com (2603:1096:4:193::18) 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: 68b7ec12-08d9-4e99-b931-08da7c443374 X-MS-TrafficTypeDiagnostic: PH0PR13MB5284:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yn3z0b/k33xV6FBs06iT+J/riiWuBMVagnh8GPfCdJFKmPAfsNFucG7rRzjhXkSvVqy2QK/xdQqkQLd7FNLvkwVxZ4emU/17zYvdnyB6xX9dlqqbUm2PYRuAcGv/kLl8FLgEjpJTt/Ix1cM6F+FeugX6pxdaj2rmF3lEGq1bLMgj/oJSP8eSdmnpgwxoP3YqNOoJQ99VJ4kMmEqPaEr+5xg15+3SvrWGZCcBmfDrN1AgCDuUuhpWAxQGsT1ywSGZriHlvmJzaHQsNlv5eFyH7Bvs4OCZNXYD3rAOKPsSQkPnIG0IQg4X2kzrlI1Ph6dTpmRccv3mhOJZA9dcBzOMuL0+2ODjjq0S78TszHmRRFpAXBw/xA3UiGHFClSDqCnst0J4wfXTc+GXD9/HXwmbdVjHRHd3z2n2M3RRrBQ32hqCAwKtOEsfeJ6naWh0As7Xzpn21lzPqPpFQZ0d9VbekuBqqxmhsQ1v1xsGN1IIEauoCOpyw2oWSWGXKx4P2QJi+mBjitljxOSSXgT5jMJPc+uJLTn0xSVfizBut62iWG8kMIKii08B52+/C08etsh76DKNhwRAfUvWyc75EPJf+SSf4/5g7pdNjb4Qv5kDHrVPEBmzNEykJzzn80BNrldHawxg67d4rh4IXOI4wuQFDbnIwLPbG09+a8+mqjDt1arIbedvUUCuvovKRUk8n2NHmWsh6u3uF3MSuiEWI1j6+UAKg0tD7hmOhXQmDmbEeu/p96GoHi6YYIyDgVdXATNg1crKoMYfj3Ll8OnhKq+h+WKuK1i/InMJmQCxcYYhfOSHqqE2ea8JEf+6zlk7njvk2go9B9D27aKB6fulFreUutXp9DwLFGHaE10IK8ke+9E= 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)(346002)(376002)(39850400004)(136003)(396003)(366004)(86362001)(36756003)(6666004)(41300700001)(44832011)(38100700002)(38350700002)(83380400001)(186003)(6506007)(6916009)(26005)(107886003)(6512007)(2616005)(5660300002)(8936002)(478600001)(52116002)(2906002)(6486002)(8676002)(316002)(66476007)(4326008)(66946007)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TS9rRjd5WlBwZzZvaTJmTHVSdnhVUFhKWUtXSFBtUERDOGs1UVpBQnJ5SUQ4?= =?utf-8?B?UHhqNnRwWHZ1Wi9XckcvMFIveGh5WmIrd01QcEh3VFh4NW1vaThOc3FiZER0?= =?utf-8?B?QmRkbG9BVGRYak01VEpDNE1sdGV4cE5ycnZQV0RiZUNRVDhrRlhEM1AxTmxw?= =?utf-8?B?OXdHNjRTMm54TitRQjkrT01RT0h6bzN3RWdqMU1WTU1KWThMZitUekpJRktU?= =?utf-8?B?d0VCY0hzTDBGVFpBSVJ6MGgrWS9XZFR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?LzNuaXZQL3hYT0FTczZTcy9mSlN6TnUzYUVVYmxMeUVtVlN4SkVtdkZGTnFV?= =?utf-8?B?ZXVLUms4Y1RiVDBoRkxqVC8wM2pNNDNHblpKWlRydGNsaDg5RE9NdXBtQlR3?= =?utf-8?B?T1E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68b7ec12-08d9-4e99-b931-08da7c443374 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 09:22:39.1597 (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: KR4w/b7oBwtacKaB1JBcK8QJDgS3itt1OH5G2IIpo47lkX7kcndmC7ytfPj3ogU5/lLYZws7C9gCSutTPf9cPNwZNLIO5yqfp7BQPMscJyc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5284 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 42e322b..b99971b 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 3e3a264..3e4dc8d 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