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 2F92943220; Sat, 28 Oct 2023 08:54:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10F49410FA; Sat, 28 Oct 2023 08:53:59 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2132.outbound.protection.outlook.com [40.107.101.132]) by mails.dpdk.org (Postfix) with ESMTP id 3B2664064A for ; Sat, 28 Oct 2023 08:53:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MsBg50kwWi3G3aFs5X8PDEkm7oHFTvRu+9rrf01xNW7qKnZPPJNFn9jFzIlK3OCgymySbDYl09I7cvzU57apEi7RlENHgGn5L1uUfFsHzxGdH4sfdXGKmHuBQOmrUoyB4vi6Wi7tqJgv9MtxdxxdDlQk0EL0zjzBISIpXILVKJccKQnib53BWnLRrOD3g9QPHyEBME5JTQCimfW2kRYlWBCmIU/NP16hJQuT+i3wBOXjkSD28GULmxmuWxfusuXxx5xpcuPAINQBqrqSetaaHaqzuqeK2AA6uG1i1yjOi2+slhad5mHM2xO17GtypeVtAAPIjGXOQHeYx+tPkBJL7w== 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=NkfMDfRrTLE3qt/C6yfAZREhgUecWJRL16YRoImUBX0=; b=KYfAtOdse9CyuSvuSNcVPpMcyW6YdoNI+5cXUBGMKKLA/TLtbS7IeUeaAG32ohpDaWUfOZwblB1o4LcUDTIaF1o157yHpsRzEeLEpOINMNNYg9zkTLQhSym5Uxm+DoBWjc0oEb3SRIl9WkG8Wx0t0JnwHviUy1HecgabiAWHHXVL+31sRKhu2KlhciecCimzDOQi97fZxbdczwgP+gUeWQ4k2eRgRceC/egdMXBl3TWlqiOivkIpp6462u6on2TmnZIqT3DICS2gq5wRto1BYHnvWpFdkteAEKm4yBzU/fFpjjjjixYyMeE93i7q/bGvgDijtHdO15El43D0uO5SOw== 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=NkfMDfRrTLE3qt/C6yfAZREhgUecWJRL16YRoImUBX0=; b=YJYKhq+FYvf9Uu+RoZ1y2SmJFCTX7tA725RmGz3dH4cBtOGcDI3DmOwiuH416lA2PYOal3J0ydtzhViQKG7UJqCcDl4O5xF20bDCMuLWorRlFkjPWh2MIN4tKIKWwtyGS+jtesDh8EwidX6JPWzn3L4zK6+44ZtDfaBExnJaYQc= 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 SA1PR13MB6055.namprd13.prod.outlook.com (2603:10b6:806:338::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Sat, 28 Oct 2023 06:53:54 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.6933.022; Sat, 28 Oct 2023 06:53:54 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH v2 06/11] net/nfp: remove redundancy logic of init control BAR Date: Sat, 28 Oct 2023 14:53:10 +0800 Message-Id: <20231028065315.1937188-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028065315.1937188-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> <20231028065315.1937188-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:d3::25) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: 00d592fa-b820-4881-b2b4-08dbd782a687 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tRi5PyORdR2DtbtDdn2QPEHi7HKn6a8XNQxw2bjnjR4mNsxcWZYntSNb5dfHY+k2yFRaxytvvTlDWaEZZFPXilWSlMwt/D8HPCQy8hqqVBSU/tDpNp0D0FrKt5+S0dLi3PSh2ohYBdIKAjcO+5UurhU8gQjbsdjlRNt5CBWZKc2KDXxefT78i4mnCFVy7Tcx5V2TfbF2N2rF96m0cPyogBx7gJkJeIncb4k5jOQort2xVfmt5g2cWz0tE5UH1VA+fDuJC9yFxAuKXg2Ik6fSPNvkw2qr2Z45PUO2R5rkABLCxHTXduJ4JWXthHBPYNVDkvdGfcbC5Ys0Iiqxq+cjsvu/aPxn2mmTcRoxdPJ9ufbyI/zzjfCqoFrOkAdd3VT8SSn3K3upVRZkZb5q2pKGJ+Ka5PyOEnXDXa82mdmvGU1tXncGhqncb/8Dt32u5iqXom5jHnW8jSfFGrm3O5WV445U5DNQbc0p4CCVLrjpNv9MYYuGXd0NGKxaiQJTjYmfNftk0tzf0+QTx7rzSZaqV7QDHUJEMvp4x4toWD7R4wQnmhyHZZuE69Fq9WLibkE2NAN5gpvsQatQqkbi9Daur+xpXJnX5niFHHUjPoeWc6SH7/4ka5eZ1d6RajLEwhtR9IzZVys0s6SAmzOjg8V9XSLsNdYOCiPXgVr38SxFHJg= 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:(13230031)(346002)(136003)(396003)(366004)(39830400003)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(6486002)(8676002)(8936002)(478600001)(6666004)(54906003)(66476007)(66946007)(66556008)(86362001)(4326008)(41300700001)(5660300002)(6916009)(2906002)(44832011)(316002)(6506007)(52116002)(38100700002)(36756003)(2616005)(1076003)(107886003)(6512007)(26005)(38350700005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pFWafQunqY+W35xi8sOJ4C6T3NcMn6mPX08pKugbtd65l2v6kBFsZsK+MsOS?= =?us-ascii?Q?6LQ5pbEExBowj7jwMrRgAGXOxbFJd5irSXDp62G0s2oTd3L5CzmvyfYCTgL5?= =?us-ascii?Q?Qpl+raZFU964pA5rfT1QkXbzDx0EK3VFlYkcTA/rFofKZ8H6rXTn7HVuJ+h8?= =?us-ascii?Q?E/MvUgr8LkUh0Ft1Dwy7JMyVO7O+uP45rOnShGlRAoUnepvgX2XemqSf5Jtz?= =?us-ascii?Q?4/gcVPu9PdP+1djJ/hNNvumIoJcvK1Jcw37jfeyrkNM4J3haYzX2jYMWhfU6?= =?us-ascii?Q?Ut6ckQ8ochAVFOQMWnRgh+O3eh8On3gkuQLGTmV/EQBv7zJkFPs40y0gvS9q?= =?us-ascii?Q?j/IT1HyTdBMODUAew5E/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-ascii?Q?2iooSGUgMDU20PBbc1P8jbfov+7XeOGP0jKr77H3cnYTSlvABYxTX8bIHuGs?= =?us-ascii?Q?XDOZv+6Q+0C0wDr2/NPfjmV9gJ3aCpKzd/go0SR047xHY07+pj9/yOaISUXx?= =?us-ascii?Q?JylF06ckukWI3uj1bL3+lKHqtgjOXwbYC29rnfUJtzV4JM2VUTWadYZLRVnw?= =?us-ascii?Q?+Vkb57bM36Xam7rygNyzSjPIj7z97lmu4usds+Mo5LytnN3yEDlk4lVtXTzQ?= =?us-ascii?Q?rdD07u2BqhsexLfKglLW8Y2GucO0HqSNX/QU/uKDLWV5kt7cEggsGS/Rgmdv?= =?us-ascii?Q?tn9xIYP2m+UO/wih6IqIYyP+Ps91VJQPWdzPtSCPTfmyeghduhfSyuPM1xKs?= =?us-ascii?Q?Rw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00d592fa-b820-4881-b2b4-08dbd782a687 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2023 06:53:54.5997 (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: 8qUHa4v8wCZOU1WBt/3n9WgKbY5qBGxqYXOBfHNyLk3hxRo4H86Zm6SRAR03XYoWFeuyYtXNAwHdPLLNFylSqNceZ3ATtOxRA0wE9PQ8KjE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB6055 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 There are two initialize statements of control BAR in 'nfp_net_init()' and the first one is unneeded, and what it really use is the check of NULL value of the 'mem_resource'. So we move the check of 'mem_resource' to the start of probe logic. Signed-off-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/nfp_ethdev.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 7c5b780e82..8057452799 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -503,12 +503,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) rte_eth_copy_pci_info(eth_dev, pci_dev); - hw->ctrl_bar = pci_dev->mem_resource[0].addr; - if (hw->ctrl_bar == NULL) { - PMD_DRV_LOG(ERR, "hw->ctrl_bar is NULL. BAR0 not configured"); - return -ENODEV; - } - if (port == 0) { uint32_t min_size; @@ -890,6 +884,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev) if (pci_dev == NULL) return -ENODEV; + if (pci_dev->mem_resource[0].addr == NULL) { + PMD_INIT_LOG(ERR, "The address of BAR0 is NULL."); + return -ENODEV; + } + dev_info = nfp_dev_info_get(pci_dev->id.device_id); if (dev_info == NULL) { PMD_INIT_LOG(ERR, "Not supported device ID"); @@ -1089,6 +1088,11 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev) if (pci_dev == NULL) return -ENODEV; + if (pci_dev->mem_resource[0].addr == NULL) { + PMD_INIT_LOG(ERR, "The address of BAR0 is NULL."); + return -ENODEV; + } + dev_info = nfp_dev_info_get(pci_dev->id.device_id); if (dev_info == NULL) { PMD_INIT_LOG(ERR, "Not supported device ID"); -- 2.39.1