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 EFB38A0543; Fri, 12 Aug 2022 12:23:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA23042C14; Fri, 12 Aug 2022 12:22:51 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2125.outbound.protection.outlook.com [40.107.100.125]) by mails.dpdk.org (Postfix) with ESMTP id 8AEB4427F2 for ; Fri, 12 Aug 2022 12:22:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AK45bLxyepaqulgk+mMvvLUyth7PRbdsxW+hrq2uISrYl7wlB6EJiFM6bVVkysuI5d1jzNFJPdDuRDg3hVtLUwNaQLJpGVzvSs4VGGCPDev/JxQcWSsKAldrd3FY1PtpT1YO7Adx8k3U89VYPXi794z2/k9eXlwEu5Zbma2eiJT2KKReqt9Nmda+cxXbvI17F6cl2N4pPJKB/WduZc4m/JQNk5qWYN02yTt57B+sN/vk5N4I8rcrRP6DAU7pI4qQ4ub5Ht/Aar7EaxsM/tPYAxIdFw3Ppqzad4ReYHh1OCVSGoLCGBq7arXMhVUOxieeGsXMVHVCZVJlLK409sr7aw== 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=Nrx00xGlmRM/x/3pjI5Ws6QCltq0llwwyIYTnsk+CWk=; b=SLFSEu/NqXSvPgvtofh9X/Rp9J5h8pVAbnkCK4v0QiDr3eawQrOFpa4ndDEtGVXGvhsEWn07ShlYra7pefRD4H0qzILvzyXJw9Vl065NW9afeViUhp8bVxwSLRIRlAu8aPE6W0hkzVWKJoKHSCJix4cwqJ2+MVk4ED3S/91A4zeC/Vdy25ayQHJnlpr/vzybRZMSj5A2WkkvOIvFqLu/n7YnALHZjb41dagwxW36wKsRhLoUqQ0AutxW90fx3Ocu6gNUxec7YQezeit44dcV8OkJ4fjs2/VBukc2vjfeXZjAIuXXsSy1uwAXXVKsSj+eMQvqXOEpfynuHsJMMKgmKw== 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=Nrx00xGlmRM/x/3pjI5Ws6QCltq0llwwyIYTnsk+CWk=; b=TMCpLyC1WQBTR8EoBPFmwbki7NRnNl2eu9COFtkc+tmhM08pief/JDu/HgsBAHstBJVyeJ4uHOSQaCClV88tjvjEk0sLH2tSuBLjGD3TTBsYczyJZdEf7BbxQNAsvgAs6eV8Hc8elMPW3U8EhJzj6VNvwhbjmC/uaZN1B+RplAI= 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 MN2PR13MB2624.namprd13.prod.outlook.com (2603:10b6:208:ed::10) 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 10:22:49 +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 10:22:48 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v7 02/12] net/nfp: simplify initialization and remove dead code Date: Fri, 12 Aug 2022 18:22:20 +0800 Message-Id: <1660299750-10668-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> References: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR01CA0019.prod.exchangelabs.com (2603:10b6:a02:80::32) 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: 46e16574-4ab0-4c1c-57f3-08da7c4c9b06 X-MS-TrafficTypeDiagnostic: MN2PR13MB2624:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wvJFDzDqXc8zPXFoMo71PkA1Ia02ipyE+pPklcIQnwl6Gp7jncS5s/goLIK0A8FrciDvFbxi5l3pdqdg4QnjGWBqVCwxbM9a+YHy7/tQE7ka8n0d/osZ/3GXr/Eu4EpFIYvwb6Z8lNkeaWhnRqpAnLnI0xugoPJMxms0Vdwj3B/K2PudHoQZnvg5by3558FgQf3u7BnoVElVx4N3QPvmZ6QqFaR2knrMhQifM5xvssggfwCIFSP8M3xJvBiq0L0MgtzuoOld+IIdjdqjXi6gVxSPtkQN2lC/2kkEaK//EHVIW3UDzhj6TbKIqZubJejYL6laZdFJYWHSnqxlbxqSo0Da4iQsb3i+IwJoPOq44b9em9sQKN3v/jsEMNFFv5Cclq4visaki4vfq+YOmK58jEm4jepa09H4tyfbl36d1QVLSVGIYYwnU7dNhatEeBPf810mh/lZvuPDHOEIQnU+K55gfCJgAJDxX+4SUPcK3VorktWQIPsEgqyyaDONhZVh0UaK9YBua0dtq0UA5MwCenHDncin+RBt+qMkTbdNVmOT//xfquxTPtOAf6VVM+9JIkU+oVQnedx/ZZBF21KOrdmkWqr+dL+dkLAbPfMjRokDrkfGDvpH4YjW1ZutToukj0FEPCZn/iQHZGsiP4B2jYX56ycWImtHCnf9pG7Y5czSsCw6ZOcJppx+lZBfSo5URLlYfEqsQ0GFs6kwpxwNy13nqk6PZyYWPwLsSiX2gD9QT+agOygpe9s3NNVKJVNJvXA/6JyK5UobIhA40U0AHANGRKgfedCv57mNEUHi7kLNSFUUfk28+jpMYglpnmPQ 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)(366004)(396003)(346002)(39840400004)(376002)(136003)(52116002)(41300700001)(6916009)(316002)(26005)(478600001)(6486002)(6512007)(186003)(6666004)(36756003)(83380400001)(5660300002)(2616005)(107886003)(6506007)(66476007)(8676002)(4326008)(66556008)(66946007)(44832011)(86362001)(2906002)(8936002)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cDRpbmlQdzA0K2hJSUxsdVNxRVhkTVJROWxHNEpiemhveU9jdUpTQ3d1aWRv?= =?utf-8?B?TVJ4V2lZMjgraThyV082VlFiMWxNVi9LRDVaVjhQbzBXbmFad21STTdQcTQ1?= =?utf-8?B?OWtQQlJjSnZ1dmNmODFFdllxeFpuV21pdXEvZE5aSjZUL2FhMjdLL2NVNk5s?= =?utf-8?B?V3BJd3M2Yk1Td21ibzJQYlppc0JlSFJGR1RzSUtEY25HK1IvcERmRjE4a1VV?= =?utf-8?B?cFBVN0wwKysvdTg2c1Vyc21GeUloazFCQm53ZDFCVHYwOVdnSnVjQURucG42?= =?utf-8?B?clZmTUE0ZHByMHM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zWW5VU01zQmZG?= =?utf-8?B?RklxaHFDK2NVTWlHdGFoZ0FvK01YRTcvQ1dZODJnMkk0YXgvaXVDNjcrUFpH?= =?utf-8?B?U0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46e16574-4ab0-4c1c-57f3-08da7c4c9b06 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 10:22:48.8776 (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: yZhL5TjHVMuBcr9Z9ZFL43+Yye8i3t6exvIxH5ZHQ+lNflAlaivlN67ymhkEJq+Zsha/Xpm1l+rikiYjLJmFbQ3ZBl/UPEpokklwyDCRK5Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB2624 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 9be91f5..088140a 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); @@ -1006,7 +988,7 @@ free(hwinfo); cpp_cleanup: nfp_cpp_free(cpp); -error: + return ret; } -- 1.8.3.1