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 906B7A00C4; Fri, 5 Aug 2022 08:33:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 72E7042C2C; Fri, 5 Aug 2022 08:33:09 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2108.outbound.protection.outlook.com [40.107.220.108]) by mails.dpdk.org (Postfix) with ESMTP id CB7BC42C1E for ; Fri, 5 Aug 2022 08:33:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JVng9/HuWpMkiXkRR+8o5ii+BWCh6aFgyHfyzd/7puxo297+lUqORk04kbGsvmgoL+YqYFYqBeSDYhmM6w4WhAo/aCNcpjM5nUbI8l7Q2B2w+r3Hoqy28Qe87xjAsNqHY1SwRPU03otlVwRq9b2MFmWnCEsJ2bOAw7nbWrkB5g3qwSiKc/F4YNzY5WGdy+jLWPEENBNxctcbNatCoy2uQivZwsDiMOabz5LgHTVZ+e6KJEPnfGqto5/3fm0mb1HyyLTwYJiiD1lY4a2+WIue5c+i7BGorJz2RRnhU/zZTksUrGRI4Q93dpNISX00e93826fQou9DZ8lsZ41go8RsZg== 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=dNdwTr7H0RWcOg00b1Io38BXZlPODwYRr18Y9u6zkSwWX/NRNHPWdwxFZKSJ2JmflnuuO/uzTjBA57L4tOZYV4OBjIAbbz8f05dJ2IsY+NOUXWTWHy/bcS/Jz35t04cdwTdNX7y1M3VsTyjDJwrBOtOa2HBsKRAUhbaGo/aZfv4NV+IMOjESbV4Zcx7+UESQ4ZfbqbNP61HOQLbifFt8cG5Pc2Dcv5JMMvMDqeIJlG/8AcFFWE1zmzFLGzCZGT+tX338AQ96ykSQLrEqnAAi7tIM5IYuhwpDHXm+0FJn4nkPWWWyPMjmlbXL4tLse8g9FItHBhVJuy39wRgjjKMBKQ== 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=if4ICz8OJh6P7gupgIcV/5PqEdYDCKk3IFFqKYZY2aXyQmqQ/t4LZruQwpRHIdXkA/ePnEPQrot2g2PLLi77kr5yozu1DcqmuK9Yev5Qoi8tp5OFIT3REMAiItfmdBDbtThdSOVR/68V/zzFUWeEOvPNoI+/WFOFwgoYsD7Sl64= 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 MW5PR13MB5854.namprd13.prod.outlook.com (2603:10b6:303:1c0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Fri, 5 Aug 2022 06:33:04 +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.5504.014; Fri, 5 Aug 2022 06:33:04 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 02/12] net/nfp: simplify initialization and remove dead code Date: Fri, 5 Aug 2022 14:32:25 +0800 Message-Id: <1659681155-16525-3-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1659681155-16525-1-git-send-email-chaoyong.he@corigine.com> References: <1659681155-16525-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR04CA0157.apcprd04.prod.outlook.com (2603:1096:4::19) 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: 5eda4002-2817-40c1-3c9c-08da76ac59e8 X-MS-TrafficTypeDiagnostic: MW5PR13MB5854:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KcgipW5dXWQolfL8841mdYDvcpoGW9Ku28swx5TAggXFS47YPq1ejeG20zcUGXiMUGARUhN9aeOj46iCruj07yPxTLg07E38lmvJ7SiNKKUbRLgEnn8S39KCX7C/0bc4pNYPYOGTRLALMeOZaj40z4LR1B2mR5wXrhNHgp8b7ttiyv72WxaTmXpfxMNg5IjpoOpXgDSVK3xlsgChqY0CQ8gxE7m81/YXf9IYzZAj8ia+nBuIRDgWhkIg68PwFmVge5toIPsTCRHInUmhD3ohQG5lMS6UONy9LnS2a9rYQgP3iIMa34s/Gx+sj9UbhAnjpqoEpNbvL3H5ZIo/Bvkk4tm0ciktfVSv0sJEkRk6DTLaAEb4vFjY6UXkTWVxNGn+7fLt2zeQBVhEBCgon68NJUQ7syOxyVx/9J27l0u7CNyon904cr3rqKi07IOBSyG3xkdDT3IYjDo/sVt3jlExKe9qpXDgJR2BuphCk52lGxO2WObANNEueIob3yg3RQvZ6NTJrAg2A4WS2mkfOj5Y8GT9BcKpRRPLJLVywv0BR+oWwpiLW80z29Aa8W0MIIBZpi7bkWofy3/UfsHXpt40mNxKqjjiUZjeYftYlCAWSKT2/9LocQLDXg5AX7ET6vOjoWR9UBGEdsvRQSSg0QaJLYer2vflEIh2BqkzSHa1a8ns9tOR2du6Ld82R998+zlbrqz/8pTn7B8OC0Rv2VPkTr5zI1PAy2bQxKunsVVpUMwEmPMoCOXXFl6HKlIy3SHwRLgQWdVOGFWtLcsQ/Njhn0wJzsf5vleUutGWYftCBAk= 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)(136003)(346002)(39840400004)(396003)(376002)(4326008)(6512007)(6506007)(52116002)(6486002)(36756003)(26005)(41300700001)(6666004)(6916009)(186003)(316002)(66556008)(86362001)(66476007)(44832011)(8936002)(8676002)(2906002)(5660300002)(478600001)(2616005)(83380400001)(107886003)(66946007)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OFBqZG1ZR1JrWjRhdjl0bm9ZZ2Ewa2pMQXpTYlVzanZVRkFFcmMzaE9tNTdG?= =?utf-8?B?MTIwMFhsaVkwRGFEKzhSOUlIK05XUTNGYVdjZUE5eFI4R0VPUG1LVkFmd0Nq?= =?utf-8?B?MEtLb2k3QlNGSzlYNzhwNzlDUG0xOUFtcFdOSnlxNDlYaXpodGJ2TWZtaFBI?= =?utf-8?B?aExFR2pQNDVjR3dXS2JRcjhtbW8zSmNEMlIrbGdETGdzYWcxTDhIMkNUazBF?= =?utf-8?B?NkxycDZvYnhRTWhMZXc4ZVNBSFV3UjBBcCt5cENLcFZ6My82ZStxMDJsKzUz?= =?utf-8?B?bUtVS0NjdUovQVJpL3IxVjh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ktQbDI5cHh2eEx0WXlNcWg0dlpyaG1id08vRldLNk9kU2hkTlpF?= =?utf-8?B?ZUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5eda4002-2817-40c1-3c9c-08da76ac59e8 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2022 06:33:04.4159 (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: mir+DrptiLxeWE+PQkngzhsALkDhMMnCcnmKOYDirObQzM47V7cA68F7O3XKH7zhfEhw0CKg/1356zxgAv7P18dEgh2765zk9MhrvAjdxHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5854 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