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 91ECC45495; Wed, 19 Jun 2024 12:00:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC23442E1C; Wed, 19 Jun 2024 11:59:10 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2109.outbound.protection.outlook.com [40.107.93.109]) by mails.dpdk.org (Postfix) with ESMTP id A940F42DD9 for ; Wed, 19 Jun 2024 11:59:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaL5DxdLJyVN6ol17VoOFK0y2GPQ/pMYPSBlhhKJ4do/x57KXpikyCtzysLXAL461ZN7rgDV+sa6Fm5lFWnNauvet6Ld/cA5ANkvac64sxGQCJaqPkS6EcgNZly+PVXn53oaavkWj9MgFSgm89B2MqgK1C2+Sws52kjT5wKzh50Wqs++LI+d60/dEhmf3UugXHuMw1sMo3CO2+JBx9BLjmb2vJgJVqYnRfXRN7JZ1JfMTrNDek37TR0qsgVtiBhmtIdJA+m6hxx0SBuPFdzOwTKTofBxBNcIHmSy/3CFXngkXIVnB0BMbCW944u8CCDio0Ak8T7x2iDUzkFiNBaBNg== 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=Mk2xnrjFKPsZS23TCIZOPfQlXDJ/ruDvJUXdy71KG3E=; b=doTi4Uk9CtKJFb7nHC7f0A4dOh5aSFWYXXjP3DCkuBY54LXfr/H0fojozNwyFqj6X78TpkGw3JmMNTbKQgnoQ29QWpu0f3Ys0D+P46vvzWMF3ohrw4KMJ59fidn+8LlwCQA5cR+G5CSyLG333/AFCc2i47JmtCxhWzZflP+J8DaXLiBuCy7EZ/AKDN4JHhd11qEsFezePJ5lpaTwXUZWU00rk6PpnGh1TRpTrezU+fB6H6V19E29xF91MX4h0FPN2GLD7DdiYHamkxcl1+wUJIoue94CkrVFHkgkILN/H4hl68q+3jQY3Q97OGIF7ROifTL7uBeMvXO+v4d9K9ld/A== 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=Mk2xnrjFKPsZS23TCIZOPfQlXDJ/ruDvJUXdy71KG3E=; b=VynF1QRCn7q38CZr/X6+HcRyDnDHpO6VyUdHv92JU8pgSjll6PPoi/nA4D0uYgr3XdDVd5LytZx56vdOVu0ZWK8KFbWsvWVHfsCapLRC7mR1kDNwdEPF52Hw8HcJ90ba8Ju7sjB6Ik5mVrfI5kgphdfBdeMsDM0iGWmTYZAskJs= 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:06 +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:06 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 09/23] net/nfp: extract total phyports Date: Wed, 19 Jun 2024 17:58:16 +0800 Message-Id: <20240619095830.3479757-10-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: 65c03329-a6ed-48ee-ff95-08dc904674bf 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?dgzu+AykbVrlCJlMcskHxykRD6p3r7IBRQ1mms5PtRWk+aQB6TfB7i6IKb9S?= =?us-ascii?Q?q29XaAGeRI7bJEyd735ylh0qgsYt2NHH7/jzQInage49hDXqyDglk5euQjYg?= =?us-ascii?Q?pICDlu+WIz8DdghlWo3InRodgAh4tGvFvt+LwtGijhpS4g3FeQOMWKTLPHzw?= =?us-ascii?Q?5dllhrdPyvh8AiFNk+B4O3A0Qmo9AF6tuDUatbHYIbrZZWzfBMtXqd2AHrCp?= =?us-ascii?Q?lwp8buNNkrZdaXiNmpjwhZ14LMcmMNbH2XwDHXnp3XVFNDR8jYCmym/P/X+W?= =?us-ascii?Q?0SC3QVsOFN6c7cIKPXAC0xXpYAkZV10oVhFA/E+wswpTNC7QkKUnjJntx0OM?= =?us-ascii?Q?FS6XUzj9kOFVSt79Z+60cwbn7VYdGz7mbQ6ls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DsVyBde2NHPT0O8MMgB2kphndnE42RCA4n+mkfRDjgKnyj2Ij0pESGW5?= =?us-ascii?Q?i+f1XVF/Q23t7kfV+gD78K2GZLKfSS3IkrzHmgIBDtrfwEfOTKxPDfGOJdP/?= =?us-ascii?Q?a0p+mhM=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?QrcXqD6Y7YW5Dw+TxzGT0OfQBKcHcvSFRAp9c/bdhwy+Oxrc/fWWk9/IgNfg?= =?us-ascii?Q?h4T/F5fb1eWy6hnIzzoIqx6ktswgMJxM0LsBa3J9wyzlwEFWBcUGUJo5o7YC?= =?us-ascii?Q?otJJdOHqXUpsBAs7JCWQCrYYSX6kTODulbGmhd38B+W4WOZ8HtP5L3WH4EXf?= =?us-ascii?Q?qYOvEmDYkXkrF5rw5H1liU1hVAEutiMwhXwDN6B+Yq4jQpUucWTxWaYIEI8F?= =?us-ascii?Q?rp6Do2RIShMX2Zekp4Y8Iz+ivcJLxSCOGmHkAB7wJiAxvBuo3JYN+IzHBLvz?= =?us-ascii?Q?ZW/+2LaGJrrGiYADPhejs1+2fdxozfi404PjIfvD1iKFwpd0ZEjw+/INHUsH?= =?us-ascii?Q?7KtDfRQ1114kAFtM2XdotwPc2HORGkcz3J4sMxGuXGYyOL+itiASdeWtvyrP?= =?us-ascii?Q?eGTyb6BMSXJamErxzlG+i1EyIaIlnVdqP9qyE0uolSuwkiIys2Wkc1di7Q//?= =?us-ascii?Q?0cXuQoiaErU251FBVPCjiZSlDAhvBEBPg2JCAOrARizvzgKdZPDTjIgtD8kM?= =?us-ascii?Q?gCsgcN90J5W842kmgK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utFusj2fN9JzedtDwKG4sNt6MIxo6e/UG9ekVOX/oIM3z3DGPeGIdAcJ78it?= =?us-ascii?Q?55IvCe1RcxSej5/1WGTUokkB7E6DmndFcrrtb3GTm55b17lo3DL+PMA1XHxt?= =?us-ascii?Q?0Dn2IgH3303iyLbJyJIIVFLnbqQm5n080HIZcjc8dN7LYUitVm3GjU/o49w2?= =?us-ascii?Q?pA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65c03329-a6ed-48ee-ff95-08dc904674bf 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:06.3147 (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: nf/Pm7HGwCZpxxgt9D64DG7QzzOp7axWhpYfYnlg1wKYYMt9JszFG1DtixcygfYjVTz+J2ouJUoRlncO5EaG2YlsbzhSz1QyqJYHZg56HEg= 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 'total_phyports' data field into the 'pf_dev' structure, make it also valid for the flower firmware. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 8 +- drivers/net/nfp/nfp_ethdev.c | 75 +++++++++++-------- drivers/net/nfp/nfp_net_common.h | 3 +- 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 1f34c4c263..a845253b01 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -917,7 +917,6 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, int ret; struct nfp_pf_dev *pf_dev; struct rte_pci_device *pci_dev; - struct nfp_eth_table *nfp_eth_table; struct rte_eth_devargs eth_da = { .nb_representor_ports = 0 }; @@ -945,8 +944,7 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, } /* There always exist phy repr */ - nfp_eth_table = pf_dev->nfp_eth_table; - if (eth_da.nb_representor_ports < nfp_eth_table->count + 1) { + if (eth_da.nb_representor_ports < pf_dev->total_phyports + 1) { PMD_INIT_LOG(ERR, "Should also create repr port for phy port and PF vNIC."); return -ERANGE; } @@ -958,9 +956,9 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, } /* Fill in flower app with repr counts */ - app_fw_flower->num_phyport_reprs = (uint8_t)nfp_eth_table->count; + app_fw_flower->num_phyport_reprs = pf_dev->total_phyports; app_fw_flower->num_vf_reprs = eth_da.nb_representor_ports - - nfp_eth_table->count - 1; + pf_dev->total_phyports - 1; PMD_INIT_LOG(INFO, "%d number of VF reprs", app_fw_flower->num_vf_reprs); PMD_INIT_LOG(INFO, "%d number of phyport reprs", app_fw_flower->num_phyport_reprs); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 469fa4602e..06811c7673 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -724,7 +724,7 @@ nfp_net_close(struct rte_eth_dev *dev) nfp_cleanup_port_app_fw_nic(pf_dev, hw->idx, dev); - for (i = 0; i < app_fw_nic->total_phyports; i++) { + for (i = 0; i < pf_dev->total_phyports; i++) { id = nfp_function_id_get(pf_dev, i); /* Check to see if ports are still in use */ @@ -1492,18 +1492,52 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev) return err; } +static bool +nfp_app_fw_nic_total_phyports_check(struct nfp_pf_dev *pf_dev) +{ + int ret; + uint8_t id; + uint8_t total_phyports; + char vnic_name[RTE_ETH_NAME_MAX_LEN]; + + /* Read the number of vNIC's created for the PF */ + id = nfp_function_id_get(pf_dev, 0); + snprintf(vnic_name, sizeof(vnic_name), "nfd_cfg_pf%u_num_ports", id); + total_phyports = nfp_rtsym_read_le(pf_dev->sym_tbl, vnic_name, &ret); + if (ret != 0 || total_phyports == 0 || total_phyports > 8) { + PMD_INIT_LOG(ERR, "%s symbol with wrong value", vnic_name); + return false; + } + + if (pf_dev->multi_pf.enabled) { + if (!nfp_check_multi_pf_from_fw(total_phyports)) { + PMD_INIT_LOG(ERR, "NSP report multipf, but FW report not multipf"); + return false; + } + } else { + /* + * For single PF the number of vNICs exposed should be the same as the + * number of physical ports. + */ + if (total_phyports != pf_dev->nfp_eth_table->count) { + PMD_INIT_LOG(ERR, "Total physical ports do not match number of vNICs"); + return false; + } + } + + return true; +} + static int nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) { uint8_t i; uint8_t id; int ret = 0; - uint32_t total_vnics; struct nfp_app_fw_nic *app_fw_nic; struct nfp_eth_table *nfp_eth_table; char bar_name[RTE_ETH_NAME_MAX_LEN]; char port_name[RTE_ETH_NAME_MAX_LEN]; - char vnic_name[RTE_ETH_NAME_MAX_LEN]; struct nfp_pf_dev *pf_dev = hw_priv->pf_dev; struct nfp_net_init hw_init = { .hw_priv = hw_priv, @@ -1521,42 +1555,20 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) /* Point the app_fw_priv pointer in the PF to the coreNIC app */ pf_dev->app_fw_priv = app_fw_nic; - /* Read the number of vNIC's created for the PF */ - snprintf(vnic_name, sizeof(vnic_name), "nfd_cfg_pf%u_num_ports", id); - total_vnics = nfp_rtsym_read_le(pf_dev->sym_tbl, vnic_name, &ret); - if (ret != 0 || total_vnics == 0 || total_vnics > 8) { - PMD_INIT_LOG(ERR, "%s symbol with wrong value", vnic_name); + /* Check the number of vNIC's created for the PF */ + if (!nfp_app_fw_nic_total_phyports_check(pf_dev)) { ret = -ENODEV; goto app_cleanup; } - if (pf_dev->multi_pf.enabled) { - if (!nfp_check_multi_pf_from_fw(total_vnics)) { - PMD_INIT_LOG(ERR, "NSP report multipf, but FW report not multipf"); - ret = -ENODEV; - goto app_cleanup; - } - } else { - /* - * For coreNIC the number of vNICs exposed should be the same as the - * number of physical ports. - */ - if (total_vnics != nfp_eth_table->count) { - PMD_INIT_LOG(ERR, "Total physical ports do not match number of vNICs"); - ret = -ENODEV; - goto app_cleanup; - } - } - /* Populate coreNIC app properties */ - app_fw_nic->total_phyports = total_vnics; - if (total_vnics > 1) + if (pf_dev->total_phyports > 1) app_fw_nic->multiport = true; /* Map the symbol table */ snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id); pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name, - app_fw_nic->total_phyports * NFP_NET_CFG_BAR_SZ, + pf_dev->total_phyports * NFP_NET_CFG_BAR_SZ, &pf_dev->ctrl_area); if (pf_dev->ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for %s", bar_name); @@ -1567,7 +1579,7 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) PMD_INIT_LOG(DEBUG, "ctrl bar: %p", pf_dev->ctrl_bar); /* Loop through all physical ports on PF */ - for (i = 0; i < app_fw_nic->total_phyports; i++) { + for (i = 0; i < pf_dev->total_phyports; i++) { if (pf_dev->multi_pf.enabled) snprintf(port_name, sizeof(port_name), "%s", pf_dev->pci_dev->device.name); @@ -1589,7 +1601,7 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) return 0; port_cleanup: - for (i = 0; i < app_fw_nic->total_phyports; i++) { + for (i = 0; i < pf_dev->total_phyports; i++) { struct rte_eth_dev *eth_dev; if (pf_dev->multi_pf.enabled) @@ -1961,6 +1973,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) pf_dev->pci_dev = pci_dev; pf_dev->nfp_eth_table = nfp_eth_table; pf_dev->sync = sync; + pf_dev->total_phyports = nfp_net_get_port_num(pf_dev, nfp_eth_table); ret = nfp_net_speed_cap_get(pf_dev); if (ret != 0) { diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index cbf96e5ab5..5c48b94d38 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -140,6 +140,8 @@ struct nfp_pf_dev { /** NFP devarg param */ struct nfp_devargs devargs; + + uint8_t total_phyports; }; #define NFP_NET_FLOW_LIMIT 1024 @@ -159,7 +161,6 @@ struct nfp_app_fw_nic { struct nfp_net_hw *ports[NFP_MAX_PHYPORTS]; bool multiport; - uint8_t total_phyports; }; struct nfp_net_hw_priv { -- 2.39.1