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 579AF43220; Sat, 28 Oct 2023 08:17:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31F5F406FF; Sat, 28 Oct 2023 08:16:40 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2109.outbound.protection.outlook.com [40.107.92.109]) by mails.dpdk.org (Postfix) with ESMTP id 357424067B for ; Sat, 28 Oct 2023 08:16:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVhD5Kn51ItyMbD1jbo8d4MLIp+0G39RXtPjy50mtSbp/Veq5jXfu4mrZ5bjrH6QBaB2M4hbEN95hWkV0G9lx21Td3i+wCBfRpqSbsMP9tp8cmRIxH3U551RKaKmWw9G+9Lhd5mAv7FIGHNiGeS/oRZJmir9eygMIxWzOUVGCNIsHkWuVxQwp4zhuFOeE3CnXaDJFOeDq4Ku6Nj/QxbqJH+PsVoqry73BcH895eJJ/YhjxAZSPmNIpkDfCTmQ/pRpraY2mZe4SYy1rY+JGTY3cR0KUljbDeDpyuForvSr2f7jUKwLZERNfWaOYxQ2JU+ZHpXGUkWtpR4vGzO3M3pyA== 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=jK9IUWQaRVgejeGFJli58F1VYFBSXxslS3QJB6bJo7FYuwHpcM45HrY5lOiSykm1FUlfOnde6aDWFpU4oDGplEv7XyDjwgu6K2VFJrt6Z52PTxKGNhf/Cbo5IJspNhVEDkBveBTpfSFwmLrXp7ik6PnA4lYUjqQbN8JnDYBmu5RBEWWVtwxoEX4MLOdyMXXdwJ9mjfoHR8ax+ZeH/3XFiiHNqOmOeZ0pHc5o3PtiiJ57oepjifWFiRYM5JrEJUc+2JApP5XM3XcyiLjnejCKHyApVKllF6fNqdSzE3DRYanE9vLQWO9KFk/lqfxBDSBkfN0G+CSRXcDsYI4gKtOZmA== 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=Nc4L4ygcSvLsXsKTMDmkLKS/wRR6clXB9dSfSkMNuOvcKuw9qFboPNAUzaNcEMuJaOfFT6OZtkc3dJkDvl2ffk82AiAGHrHgx2WojRxelUn1q0FFKu32td5phdEr2xkGNTz8FU8MwgTI85RObmqmmskYnxBjPjhRuliNArzOlDc= 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 PH7PR13MB6268.namprd13.prod.outlook.com (2603:10b6:510:24f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Sat, 28 Oct 2023 06:16:37 +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:16:37 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH 06/11] net/nfp: remove redundancy logic of init control BAR Date: Sat, 28 Oct 2023 14:15:53 +0800 Message-Id: <20231028061558.1842855-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028061558.1842855-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0246.namprd03.prod.outlook.com (2603:10b6:a03:3a0::11) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB6268:EE_ X-MS-Office365-Filtering-Correlation-Id: 191c80ae-d647-4dca-ef1b-08dbd77d70dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CO9EDswBAlQbRgQf++MMbAHI5a7/a14dHsTPKjMPjHcsgrWMxR/DuGJzy+/+w9caWXeUoQEWfOfMJznHD0QyVbBO6TMsksDxl4ashgZnH+dW8IW9ZHnPr4IqTnXa1xv723Jp1aIHBrdZNV/uQWojGahay2FSKGgiqUtU6PruuI5ipCB29vKXZMc/olRlvopI2myktyDkw+L+6tGLebxXsd8y7QH3iOPCVUQjxfmQbcb3+c02fQOmIMDCLrP1xa6qF7m2bUTTVTi6bYoiM/X4c6mkuNqSk7bJoIGyYzoOEuMrogm3d9kVQ/gyXs4XgbljGQxCk4hU5cHTpJArZE/A2m+gFPNAWkyCTSWrxXcCPorpbd23K4DNSmg1xYw5VKbU5kVvSp+NKByLOutV5qaC3DlW3A2k+HKyUy6dNNn53eb++v2YeBGZk3/L89Moz5HU+laAaU747bw5rKED09WMlCzjbMZFnXBTYnhkbWQEqxj3K7ycNTilXFyif3BTmEFXhh/e/he6dpuSbkESCk4regUXhDpu16SN6SNLrhN48bchV5nSGKwJiHPFchGUfQETxxDUf+sulmmABoG6BX1fio6PJzb3+0GXnC6aQsQ2HVhvyvYqDT4Dp4pHm4XH4WIDmh4SyPgBWUiaU2ntrQDoi4b3w8wvhDfIOdzMpi+f8RA= 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)(396003)(39830400003)(366004)(346002)(376002)(136003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(2906002)(38100700002)(83380400001)(1076003)(107886003)(5660300002)(2616005)(86362001)(6512007)(41300700001)(44832011)(36756003)(38350700005)(66476007)(316002)(6916009)(66946007)(54906003)(66556008)(52116002)(6666004)(6506007)(6486002)(8676002)(26005)(478600001)(4326008)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?z+JdfaSNcAVNgJ/YWx8zRTleYU7zs4tNyYTRyW05OT1oUEztrZzI9Nh2L4GO?= =?us-ascii?Q?4oeFhXnbOgu4f7hE+j8a2eDnheEFr97OWbJyTIjQEPi3KgDgZFf7sW8+XM9o?= =?us-ascii?Q?X/KTFlRGleIw8dxWMJBskLP71clBx7fL2TByau6+zQBx20bMs9AapIfM6Gku?= =?us-ascii?Q?80V8uNQ0uNIQcLdb+MX6oEMm3aWZEV/Im9aQvOd5bQfMCc58Ct45zSKa9oxr?= =?us-ascii?Q?HHWN7CU7UrMZ5GOuYb4zWzU4HbfexZbjd9hhOfQW5bxBwlo52VJyEHZMgcQU?= =?us-ascii?Q?1zZpZw2HGJ2Tw7HxYaT0iPY/15AL1ZL2fOGbE5u2lknWyuHokekJtsSLS4/Y?= =?us-ascii?Q?3A5+KLpXRkNV9orsThu7K4/ts0YAKuN/QLSqrFfR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J9hB9XN/KEstxxb5u2E1HP0O9yY/P0xhqQoYpXEQNfNOi?= =?us-ascii?Q?ImALDjuSBjyPnb9lM+t04cplJ6b1LKA8EkULDe8mlFr5lpObSY5/mMRxypSm?= =?us-ascii?Q?9aOpIx7gKU0BSM0mcu54Lh6iaYDkFjnp/9EV7zSyZcIzo6RyuPLp+ZVecsXu?= =?us-ascii?Q?MBKVlCQO3jFYEIlxm7T5Aj7/+MOA+Ak1s9d3H2ffJvXiIqQKBcAgYQMWoeQZ?= =?us-ascii?Q?c9VIe0f0O7UhHUogdJVEnOI6dA9Yz5bb6kdZKiWn8tOP9ismj7Vxw+KJLhF/?= =?us-ascii?Q?oF6t1xXVo5FPfBSj8iv2Z17bdsSw8kbOEjUDiy26MiQm1KC3F0Qe/KDEAEaF?= =?us-ascii?Q?PA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 191c80ae-d647-4dca-ef1b-08dbd77d70dc 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:16:37.0662 (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: 7VIUyiHt6FmJlPb7Gi8hH8bHNT3RB2pM0p+j52nuqRqtlfUTiiM4VwD0LZmxU+NqLL3Ff8yYmcGp6lTgZoGjTBqam2wF7hOIRJRIbYBKObo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6268 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