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 56B2BA0548; Thu, 8 Sep 2022 10:45:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7269142825; Thu, 8 Sep 2022 10:45:33 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2099.outbound.protection.outlook.com [40.107.223.99]) by mails.dpdk.org (Postfix) with ESMTP id 37E5A40DDC for ; Thu, 8 Sep 2022 10:45:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HqYUWCh+Ean9laJJE0ZPBnLdyIVjaMOf5P9OBBw3ADckx+Q/9+HSlN9YRO3cyCid6orIdZYoWRad9DgUr8is2YAGmE5yK9dAOpaZdcxGbtulQ/ssWvQ/2omWXK0f4JbyXQQOVRCBWNLkhhAU5BiaVcTK95amT3YsLAbdDXDy4ttLyo4XuoxtD6ZtmaChkAaFbuLyvcnYeM74Gka8PdAirtRgKPLiuWf/tBHZ11NLy+nAnKRzRBxsGEM5a4vUafUv8QqEmSjpz/PyXRJD5EOiQGDKpxaiR4x/N49T5mL4Wd+pYiS1JmQq2QmttDUhmLNWLqjGI8vnm22wg56SuP+44A== 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=xP/CmDEncw6XGBuIdANFTIgXXl67DvdBTi7ml6Xme/g=; b=W1+Q3oCAjk7h1qPqghcBe7742HWTU+YEJpsqkqtc2a6H4WdQpH/llUAbkETuEFuhBuOb338oBJtwdf4slUkaKWdI8UTVNblt2bTzbDIcHV4EF+lEU+bs11Baq4Nb8WxMXTMzD2AWd6ydY509mpptKAbA44QsllWXyCB/gyJUz+CMBYUBvu+zOCWXOstHuaz3xpBmOt5qgLXH5Ha0STnpUVjmXjIb6BlrNFxnqmyL5uuFE4rGQk5ZJpnfimSpaFj04Z/mmGfx2sbfU/ansCVXaYGC5LUaWMy2tAL/Lobd30tDjTnbi6iHnXXmRg3xI+rvhNxHkh372GjrNxtaemhKHQ== 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=xP/CmDEncw6XGBuIdANFTIgXXl67DvdBTi7ml6Xme/g=; b=Jnqrvn3SgW7rAexs8cNXWGnakjZM6e7PYluR8gt4OaO/Di2443MIj/Ec2tznPceydu7ahPLAcxUBR5A/S/UwC8d7Z8pc9VppvLXj0DpLXfzzEb2JBCnV9m82eHKobFQPDr5KCSzsaZ8mDkIkFFFFfarES6AE4k2nSqJBs7juwhQ= 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 MW4PR13MB5940.namprd13.prod.outlook.com (2603:10b6:303:1b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.3; Thu, 8 Sep 2022 08:45:29 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%6]) with mapi id 15.20.5612.009; Thu, 8 Sep 2022 08:45:29 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v8 02/12] net/nfp: simplify initialization and remove dead code Date: Thu, 8 Sep 2022 16:44:52 +0800 Message-Id: <1662626702-17254-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0023.apcprd01.prod.exchangelabs.com (2603:1096:4:192::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: 978360b9-21ee-491a-6fa2-08da91767bc1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UwgQquiyhnEd4JS4jsQ9X+NLqYX5OHErCu5W1kXOk7CFwythRclnbJ7bHPeORKdlUuAeH21DtFkD1fqzcS24b78MBT5mDMmr/1+LKahV/YovKgP3ow1nouroM2cIXuEyhd2uN5YOcwGoDaVhSJVkzS2jWLXlspwxs2SmiJo5JxjkzDA4+1ihNvQzK9eUDPoUsLcKY/qnPHgWrx7kEa5aPuXMov0S9nhLeDfRZ9ii1o82hiUOSxzwVBQPJqROJgKYSlRAM4By0U/KQCJE/GLWlLzHuYNFidIl6mvvZGMvzuBhQBwgnZMW8Pq3t3pjTMrQsKBPazUOzviukgbGolcuWS0nGAnM854AuXLiBcjhs9S/LEU4DlBT4ciW4pRYkJjDHk522UoNJmiMkdYJmmg22EBHepbcFcVbc01f2UUVc3i1NihUpbMohKDSfrUsuJAxqznUbZA6GcbsD13sBlowkI4TF8r4qx4Z2APJGiz6tzT18aBS5vjrfPwIQuV3g8oExmzmaV/+HpIQZGABdkWRSEUNdpdsIckIc5UaQdL3lhDhgevAfI8mILaovpTfEYENCl6Gx42pZeBp/hGwYISgQZOzH7tp/1NeSId3v7cKjOgPimn8dZUl75p6Rvqt7jntukh4pZ225ZpXJmeqaunU4Eq/w8lvSv6L6I4+g/b/vy1CQqNTutHbkN3f0vlMAeBCzd8LS0UI5hKiye3vSJvg69ibQV8qsXedFiuYbdOuqfbGJEcj/7qWqbyysyGqAsBXpRPIxkuW8UiXyzpIk4pwKA== 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)(396003)(366004)(39840400004)(346002)(376002)(136003)(107886003)(44832011)(2616005)(41300700001)(6916009)(38350700002)(83380400001)(26005)(6512007)(186003)(36756003)(38100700002)(4326008)(2906002)(6506007)(316002)(66946007)(478600001)(86362001)(5660300002)(66476007)(52116002)(6486002)(6666004)(8936002)(8676002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?anZOOWpUekp0YS9pdEpRQy9yUU5id2NNMGJXL2ZwTnhodWNCbm1nOFErSlBi?= =?utf-8?B?UkFnZWNZOGVIaFZIZjNDaUE0Q3ZqbkZNOStOcHhvNkYza2Nvd2Y1My9uNEdh?= =?utf-8?B?ckhNT09rdVUxN1M3WEJ1UlBNbVMyM0JPZlQ5aWNKQ1ZmSUVXSy93RmZJdG5N?= =?utf-8?B?UzBQTzJ3K2JldnRjVDFQcnB0RFNvaTNobm0wczJLMWFub1JhNkhCQXY0UUxF?= =?utf-8?B?NHBUck1JYzA0M1JEVk1sZ05lSml6L0MwWUcrQTdTZDhnOFcyY2xHbnhuVm9Y?= =?utf-8?B?eUJiOW5EN0RYc2xZL0RM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pV?= =?utf-8?B?OGo4bm5sL1pXUEVmck8zSmhOMUN5czh0cStKQnBaa3grNmdEbHV5czhIbXpO?= =?utf-8?B?bWc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5940 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 bd9cf67..955b214 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_hw_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