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 C27AA45495; Wed, 19 Jun 2024 12:00:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 028EA42E44; Wed, 19 Jun 2024 11:59:12 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2127.outbound.protection.outlook.com [40.107.93.127]) by mails.dpdk.org (Postfix) with ESMTP id 518E9427E2 for ; Wed, 19 Jun 2024 11:59:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f6HyTsdw2oqmHUancjJYcNwwdoUBfwxzpXD1wp6bHQFthuA3VrbJSjw06X7QPK4eukTb8blHjzcC48WVIJmzI/pGwZZu3NhamgEY2+Gp42t20e069zs6NKun5ooQBomzpph6kztdG/52W8HKSQ6wJP8HyJlVkq8jxy++1m18hwq0Lh4PBWop/ZxtC5FoTpNuwZG4MNhUnAcyRRcSpzKFEkkB+zydXB9py60+kYoISPP5agkAobi3WNF8PcqsiYax5HxKmieRSXEDuv6YefI6OGg6ssVh40VcUasRw+GctBvCllBepJUdV1G5/rbigx3l2opePA7RtCWJDi90kDWMLQ== 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=v7wiOvN3C2pd3kodU8enNhscy3QPfGWafHSRRrvzaxc=; b=iJ+Av6rSK237MX471sPbcQ5adxCoGmyv4Nsr1ZDXCmv5pI4PQxd+7off5GDEED7Y6irT6eSCtr1VSgqfObPKBxol/wn4tq30lTEB87GFWlMNfsK6Jm7RNb+n4e6bTDKsls3vUKDjoEsZgxQTVVjLhjkP36aEDSXoYWNoO4Ov0XMOlJhrw574Lukh4uT5kyCH7wOBIdINs4PuuDPzps7H1/eoxP9SeU9BIziSIW947w55K1aP1MeJVBkPE+pdhzkd9V92R81A9El2a5Ejbvq9kUTIP8vmQ2tID2qPHYi1yHCUjjT3kjKJg/KSdvnau7l+9cYfrNThYbkMGRlrOkUqTQ== 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=v7wiOvN3C2pd3kodU8enNhscy3QPfGWafHSRRrvzaxc=; b=G889ErPldEg/8py25d/jsTDSLE8KDiWgeJSfb3VTLaiCmo/FzOVXDcTNENjRqkAGSzUOgmExO6tjRVJDY4NtP5cTfU2ugGc07LsHX7o5XNq7JnuE1KaBFbTZDUR+n7rvl4i2Plx1r3+TaJmoxXQo6nVsyKwoyZLCVQvMwvJ4XoI= 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 MWHPR13MB7153.namprd13.prod.outlook.com (2603:10b6:303:283::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 09:59:08 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:59:08 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 10/23] net/nfp: extract the initialize helper function Date: Wed, 19 Jun 2024 17:58:17 +0800 Message-Id: <20240619095830.3479757-11-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com> References: <20240619095830.3479757-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MWHPR13MB7153:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d70cc5d-a934-44a3-18cb-08dc9046760b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|52116011|376011|1800799021|366013|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?swQHhfocOGVmLmg/wnSI5BER0pgbKnHDt5Eh3kyLdnzG+YYFfC2KSNSk8vAo?= =?us-ascii?Q?GesMQQUGzFiT4PJ0U1dHhpXiP73Muc/hDDg5akLEqy4YY5BNsXZXbIivlpLw?= =?us-ascii?Q?cNERkcaqSX34GprCFQG5G/AlIiTdK/65FwbdOEin8qIv8wOQJmW4ckM2i2hh?= =?us-ascii?Q?viwJv7E+N06g1+Nbv5h/Fj+ZYbouygRxnq4camMfHKwizhReKk59d3sH3HUf?= =?us-ascii?Q?QrRzWLFmeP1erfhz2xij0XWUrcsy3SED5PyCyuw5ayo59tsXQ4afprLXNimd?= =?us-ascii?Q?SLHmawxvk0NE/3wGb0ziqK3LtiyQdvj7AGRKugbs49yv0MDyN9XewjkhtfUU?= =?us-ascii?Q?n/l49pjZKxURre023Q+rNQBisjpOuwwydtkorrFiZjUwzOEjhcgCulX7wJxY?= =?us-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G69QeG3EE7aQIt74nJP?= =?us-ascii?Q?s3rZDo55sx7VRGU3pd5Du17l4hzs4s3/4leyuFkjADWp6tpqqu3H1HNS/d60?= =?us-ascii?Q?6ddIIo8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(52116011)(376011)(1800799021)(366013)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5GBbl1/D/4GusQZmbBo3nhcvicwq8+eArKa4exKSZm45smtgcTTKI4NPXieg?= =?us-ascii?Q?/lfq5AOFo36hV2tORMKUttqME+e7+qkK9C5cvff+jvYFVcUwSbrLpvqhVYnH?= =?us-ascii?Q?m44wtctmMtJgZQcMwkdMt5PFobO+04K2CQV+jCoZjYU6yqzG6LjrFE+bFSrK?= =?us-ascii?Q?XQlsD+dUzPYz6QbjDN7zNAEy532kuBlTnEM8UntFTwQwVSZRMM/zaT007cph?= =?us-ascii?Q?nWjA30FUqk/iy6GwbZ0Qxg60CnPmiwM1I1w1PU9B6D6CO6y/A7Ncg+hX11Dy?= =?us-ascii?Q?qQIVfJ4wLDFV9SZLIFhANIg+6w5Dyd68fwubXwwNCpzBMQ/XpkrXADZa1foK?= =?us-ascii?Q?ttKavjGtUeW0E9BWQdASDeEAX0cDO+nRV0b2D2p+EVTbPljanVKmhn+CNI71?= =?us-ascii?Q?3X3IuApAvWxT/mNx4nNTWZ9qPSOruC58pCIspwPU5m/aZYd62/x+70wz2p4I?= =?us-ascii?Q?EfJ1ZeJpQJY2MWw9UHnQ0/j6frKYndbmMR1BJtngvIwB27D24rhzDAulaj+0?= =?us-ascii?Q?YAcyGSKGqZn7WQzbhL2wlQ6elH+pvVfC0XijEtBphuNTqkd10/PNmh+qQoJE?= =?us-ascii?Q?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IIAC/+3Cq5qI30Ay?= =?us-ascii?Q?zdAvr5bKMWyAskXk6PlveliHvMUUu6KD3Oy1V/IxrmI4nmZmlPjcuBlyiUuj?= =?us-ascii?Q?0Lwts7c0CpT0Lk6hR37/aMOMdJcPaoIYSPBwJgZ56IQaigpiDmxAh2kMtkKW?= =?us-ascii?Q?iw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d70cc5d-a934-44a3-18cb-08dc9046760b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:59:08.4821 (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: Fg05x8QPPuZ5jjo9o6Yb04tG3kzw9zPU1b+EQ9eyqmsmwfCRHCLEt+Vn3utL4tYA50YUjRW0fYt790Xqmv7vy6rg1yjS48HAVaGyyERm70w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR13MB7153 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 From: Peng Zhang Extract the helper function of the firmware application initialization for both primary and secondary process. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/nfp_ethdev.c | 122 ++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 46 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 06811c7673..177e5d1e06 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1820,6 +1820,44 @@ nfp_net_force_port_down(struct nfp_pf_dev *pf_dev, return 0; } +static int +nfp_fw_app_primary_init(struct nfp_net_hw_priv *hw_priv) +{ + int ret; + struct nfp_pf_dev *pf_dev = hw_priv->pf_dev; + + switch (pf_dev->app_fw_id) { + case NFP_APP_FW_CORE_NIC: + if (pf_dev->multi_pf.enabled) { + ret = nfp_enable_multi_pf(pf_dev); + if (ret != 0) + return ret; + } + + PMD_INIT_LOG(INFO, "Initializing coreNIC"); + ret = nfp_init_app_fw_nic(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); + return ret; + } + break; + case NFP_APP_FW_FLOWER_NIC: + PMD_INIT_LOG(INFO, "Initializing Flower"); + ret = nfp_init_app_fw_flower(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize Flower!"); + return ret; + } + break; + default: + PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); + ret = -EINVAL; + return ret; + } + + return 0; +} + static int nfp_pf_init(struct rte_pci_device *pci_dev) { @@ -2011,32 +2049,9 @@ nfp_pf_init(struct rte_pci_device *pci_dev) * PF initialization has been done at this point. Call app specific * init code now. */ - switch (pf_dev->app_fw_id) { - case NFP_APP_FW_CORE_NIC: - if (pf_dev->multi_pf.enabled) { - ret = nfp_enable_multi_pf(pf_dev); - if (ret != 0) - goto mac_stats_cleanup; - } - - PMD_INIT_LOG(INFO, "Initializing coreNIC"); - ret = nfp_init_app_fw_nic(hw_priv); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); - goto mac_stats_cleanup; - } - break; - case NFP_APP_FW_FLOWER_NIC: - PMD_INIT_LOG(INFO, "Initializing Flower"); - ret = nfp_init_app_fw_flower(hw_priv); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not initialize Flower!"); - goto mac_stats_cleanup; - } - break; - default: - PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); - ret = -EINVAL; + ret = nfp_fw_app_primary_init(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to init hw app primary."); goto mac_stats_cleanup; } @@ -2135,6 +2150,38 @@ nfp_secondary_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) return ret; } +static int +nfp_fw_app_secondary_init(struct nfp_net_hw_priv *hw_priv) +{ + int ret; + struct nfp_pf_dev *pf_dev = hw_priv->pf_dev; + + switch (pf_dev->app_fw_id) { + case NFP_APP_FW_CORE_NIC: + PMD_INIT_LOG(INFO, "Initializing coreNIC"); + ret = nfp_secondary_init_app_fw_nic(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); + return ret; + } + break; + case NFP_APP_FW_FLOWER_NIC: + PMD_INIT_LOG(INFO, "Initializing Flower"); + ret = nfp_secondary_init_app_fw_flower(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not initialize Flower!"); + return ret; + } + break; + default: + PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); + ret = -EINVAL; + return ret; + } + + return 0; +} + /* * When attaching to the NFP4000/6000 PF on a secondary process there * is no need to initialise the PF again. Only minimal work is required @@ -2241,26 +2288,9 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev) hw_priv->dev_info = dev_info; /* Call app specific init code now */ - switch (app_fw_id) { - case NFP_APP_FW_CORE_NIC: - PMD_INIT_LOG(INFO, "Initializing coreNIC"); - ret = nfp_secondary_init_app_fw_nic(hw_priv); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); - goto sym_tbl_cleanup; - } - break; - case NFP_APP_FW_FLOWER_NIC: - PMD_INIT_LOG(INFO, "Initializing Flower"); - ret = nfp_secondary_init_app_fw_flower(hw_priv); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not initialize Flower!"); - goto sym_tbl_cleanup; - } - break; - default: - PMD_INIT_LOG(ERR, "Unsupported Firmware loaded"); - ret = -EINVAL; + ret = nfp_fw_app_secondary_init(hw_priv); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to init hw app primary."); goto sym_tbl_cleanup; } -- 2.39.1