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 186DBA00C5; Tue, 21 Jun 2022 12:34:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD9A54281B; Tue, 21 Jun 2022 12:34:02 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2108.outbound.protection.outlook.com [40.107.237.108]) by mails.dpdk.org (Postfix) with ESMTP id 61734427EE for ; Tue, 21 Jun 2022 12:34:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bB13TuosvZ+66YKVrJKZrZiynsIweN2zE1tB+i7PVbTBwkWjmv5QVvm2mMzK9WXBwTQFZHFferham7d+hO8fhOeQGtD4PZiUBwZVLlZnUPDqqntG2PduSC3AGjVuZ3haK5SjAxQc0ZiYYkS5LOhRfRWoJjF+7A1aWQlkeNAbHanu7bnMgAUumu74h3UxdU3pNvZG7ehxp4NHDVmm4PTzIRPGv/ciyYR/ZvxPrg072s1Qh01eQOsly0fsGBfbnhRZixveWVdIOpdrGSkBvaelFMa4WRDsJegbtXvZ4aRq5dy76GMqCyM6emnz8a4XuAMe8uoVifG6BbCRRKXd6EuL4Q== 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=anBN+iiAZdZ3iactpmi+plYqBXB9ymYLO9PVvh4OMOFvl24RTErGDEqat6jdmxDphjPNVwnSHJP7W8GkT9QWgd/pKKKYkECTjS75d4t53BDaQN08nZGV+sprvwylFRewV8JGswmoY3aquEcDRK235y6bwet7qbgyNTZ2g3VcYUuLUkf7DZ0HC9p7ypKWBmemEjBC9VTKy1sLz78kgkWFVAuJEXXaws81r3vsEWxosk3jzQHsNS9sc5/7dIatPbeO5BgfvnsLLynUcrmLYydFnJaitXA/HNgOCDniv4laZ7coTEJcjgaLCfSGw189Udkw1+6JHN0B2LwKwXsqtMFsKg== 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=nJtj8n97z8QolBqkhXTFYlo8rklHDVRNVoJJB07270jnVkDzoQzvdJ17D0lmX3LtL+Zdyk+2RBpPRwrFRjnF0I1mdWAAgxDIWcD6nnOwu+gFZulJlj0Szk1fh58grA3ALdZDSu6S3kAHLEtjfGWsfAFHTsA7fU9l9e3DNTrzQrg= 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 MN2PR13MB3086.namprd13.prod.outlook.com (2603:10b6:208:135::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 21 Jun 2022 10:33:59 +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 10:33:59 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 02/12] net/nfp: simplify initialization and remove dead code Date: Tue, 21 Jun 2022 18:32:58 +0800 Message-Id: <1655807588-7320-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655807588-7320-1-git-send-email-chaoyong.he@corigine.com> References: <1655807588-7320-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: OS0PR01CA0018.jpnprd01.prod.outlook.com (2603:1096:604:24::23) 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: cfe1bea7-b2ab-4c63-c6b5-08da53718d09 X-MS-TrafficTypeDiagnostic: MN2PR13MB3086: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: 3s83zockDScXLmyb/DRqJFW2WtD/fK5FyZb5aSN9+nPoiIwi/bWZWIiJx/rHohh5HQLAdvuH4Rk+SFI99wEFQQwdJtcUKOHJdsezdflMgn1s6LcCIfFhvogyVfqvvf6jdTbh/+CHb+1P8lM37zMVInp0szI11XXKby+IARSgEge9zrynaU8u4k0IIivp3kih2TmmR9AvCFIGjww41yS2UeAjaVDogzYIC9kqyifUtHNyntcMynDSI//7+wNrmzOFW3L/hDZEl3TjNJiFaag0FYfhQBDBIDKCaZtbOl6JZiPA9rtxlSLSSWGImgEA6O5m0w+SY0Vhk6obkZ7RXRxlFkBK964c3kaYetmxPtVhZgwBd8rXvZ9h++bbFLABnUsoZa6mJxi4CEGucpIHp5Xn6n0CFg28LfO8awZg/EfrHWmG8ueGttESca49o+123xzaGIBbOlo7VkacsxfkPKrt9YMdGLdkFXlZT+OHDpkn57uQSh7Mx04E4pDFNiRLfxteQJcwN4ckxL5zhNZQfo9wELR19lLaFKQ65bVuxfdpla1Ikk/5kZ8RNvM2Dihy7XwL97bZ/b3ShNafSXBnKu13f2p/jbrykMkPFitktsiSTClznX5pD/P6qW1amsEPDlqjdM7qByBGq98BPJRhMxl16Hsbl0rROD0k+7mIBpqZj44yHHxy+lAIOO8i6Jp0RJY7G/azHsfT7LHfPlSqFrpXMxvEXTQFg/65aGF2MBnYHukiY1yi/P3WN7sg72+EBGYp 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)(376002)(396003)(136003)(366004)(39830400003)(346002)(83380400001)(107886003)(186003)(41300700001)(2616005)(38100700002)(38350700002)(66476007)(4326008)(86362001)(5660300002)(8936002)(44832011)(6506007)(2906002)(52116002)(26005)(6512007)(6916009)(316002)(8676002)(66556008)(66946007)(6486002)(478600001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eGZGeGx6aEpMQjBHRGJweC96aDlLWVp6Zm1ROEVtTUtiTHI5M2wrdGVyUXY5?= =?utf-8?B?dlNOMEJNVjY2WnJ3Uzh2K21qQm1CK1c2RWFpZnRFYVBGVHh6VWp3QzdQRTQr?= =?utf-8?B?ZFhSTnNxZXQzYk1Vd2hQZUVPMGJXYkxFVFphcjd0YlhBZGQzemVqQS9IUEhH?= =?utf-8?B?NmJybTVhOTZmMHlPRHBORzFuRFpMRkRrK2VRcy9qUWNadG9HcTFRVitUYzda?= =?utf-8?B?VG9BQmVmL2doT0IyS1NubG9nV2VoSXFkODBDU3FHY0FSc3JnY2pIbituQW8x?= =?utf-8?B?SldnODkxMVhwc2Z4Ky9nZE96a0J0cHFZMUVTWHhBWjc3WTEydlZzbDJCaUZM?= =?utf-8?B?QmZTem9kR2JacmkyR1do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dXNtSThscGVh?= =?utf-8?B?Mjd2aHI5b2hDNlZCeUJmdGxBU0hHYWtRcUIvdjNiVzBJdnBqa2pKRC9UVmxt?= =?utf-8?B?R2JWdURGdG5lUHEwUzZvVzY2OWlwRFF5WG94TDYzSjNreXJlNWZwQ09SeFdm?= =?utf-8?B?eGRCYzRjRXZGRXJTYTNqM29KRlhMeit5LzBJYURIUE1ZZU9RdCt1MVhoM1pk?= =?utf-8?Q?2ahC1nnIhD5rNR0g=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: cfe1bea7-b2ab-4c63-c6b5-08da53718d09 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 10:33:59.0859 (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: p9brsoiwIkaClqzNLXuGlrKqJ5TZ2r9bP0mL3itfBtP/v+KyQTH9kfDcR0hxMH0YX65OIkGq1q7lLYnx2JcKkPqa41ZTMOGv2+TbV4dgmVI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3086 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