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 66CDB45492; Wed, 19 Jun 2024 11:59:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3496C42DDE; Wed, 19 Jun 2024 11:59:08 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2128.outbound.protection.outlook.com [40.107.93.128]) by mails.dpdk.org (Postfix) with ESMTP id AB5A742DB0 for ; Wed, 19 Jun 2024 11:59:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ML7R5W18UvvnmNan5Q0/RrvcOUrgww3PoHLOBYk5YrvAnXLaJKj9ENO8cucReMBNOdXqW5ir8fPgZzJ6tlHJU3tFHNKCm1CVmnqyno6O+cyTyXEaKg+my/DIF1r2gBXjjmpdE1jHJp2zXrTcpp9BNcFSztq/ULEIWaaJGjKY7x38kZN/TVP6P4PWiiASnZ/N+7Phi7EQNThdDzOje4xMxYj1eGG1PdYvYAY3uH8jTW54yM13QcDGNZ8hsbCVVssqu2rzRtyS6ooucZBG7AIQzvu/vKIZDBiEaiCC4J/E5e30f8eQfpBGr7BUlA4Frl9iDiNsbJe3thSB2RGrli2bwQ== 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=/RX7Q5SDp9SYtWLgdmSfcuazgDvTNzs2POyYWaq0LXA=; b=K3ufCMW9vwNUw/UasQM+jkRJ5hE/r0kWz9uzvnZ0/kn+5q6Huwb5EwBzjXpyHU3CiyLbkDgcFoIXmcao/u1Qnx9i0IUfeaFx2CP2nIOw6udPTt3LBKjlM17Rgk4puVYuE3rSXbJvknaQBSE6XW8xQX1Yd4EPsgFVqu4H6QxOp5higggizOerc7g8bHyRARxOThzQnxQoDti0OVJCTyDFdXlweEqV6ZcMMolCb+u6JuD+GHIfFVBRhK8u6jB5P8G9HIbM4051fAtFwYGmZd5+rM0kWpcWunhpMSugAEFl7LykuSU03+3j9t1tQiY51MeYbBAc3VsHSDEek+RGId216Q== 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=/RX7Q5SDp9SYtWLgdmSfcuazgDvTNzs2POyYWaq0LXA=; b=A1IhTDyipVBGZVVk/peRxAgVwhg4LWdFQ4EH7QbML1TyQxWVZoZcL75tQmYP9Yqu0rMiAnAG0xENC98LdusRIIv3GkQQxb62uRiu5jJyrTneR0Ej6xbcaSS6BIn+eK55YxLPE4auis5iKxsg/XC2+Q2QrAoEGTd79QtyofUbjSk= 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:04 +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:04 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 08/23] net/nfp: export function ID get interface Date: Wed, 19 Jun 2024 17:58:15 +0800 Message-Id: <20240619095830.3479757-9-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: ded0b64b-dfdd-4714-125e-08dc90467399 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?Iy2yLUtesJAK9GgNpp1pE0vvzM++aLNhdzTuoOpn6Z4jviHtBGYd/pobMcZ8?= =?us-ascii?Q?BuIcNdPz9kNl6cfOCq8EyGsZTLThDjb+Ck2HUUm0UB+JzGYpL8kn5BRPmxTK?= =?us-ascii?Q?/ZePoizKUSkckRghiOhoq5x98tkMa6OIo/y/UIMC2IUqxnNfcwOWkWJZlpZx?= =?us-ascii?Q?E2j66bvnpjgKc3KErwMFbkIeMEMWytzgEBfgL1NkHzd5LLumWL+bFcwcls+y?= =?us-ascii?Q?TPDzphea3EcO/u0teH9vKt7+BP8TVJtwdQlZBivClD8oujKltu9TNE4D0LV5?= =?us-ascii?Q?A+DtikHGS12G7BlG4yy7r+ihrOiyd6lQ1FuQ0XRJghamKKaLE1g1t0L6H0FA?= =?us-ascii?Q?BSNQZRes20nnNHossPpHMsYT4cjfdYIPsU0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YHVzWS391s7+My5h1kBAnK6cYhkfJ1jUI8ZTZQD4?= =?us-ascii?Q?kSdaAHaWSduFmaLokR/dIMAV973hii38Ln3IXXvukk1dxV08bkm3oCc2AnYn?= =?us-ascii?Q?occtPDU=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?6BUexuBQxjsaC6ja45MX8W5dLXM6wO3R7Twnqx2aJNX2mBUhi/5O6j4HOE0t?= =?us-ascii?Q?2M5HHbKjDjF0bHhcGhYmcxWvu2oflvmspt2vUdVA57r5hl5KZnFL5QMhl6Yb?= =?us-ascii?Q?Nqb3GMJwHTF+u+UcYnpcoWSgaeABVG/1SqhYMZH2MxOj3DYCtC2K9iuy8cGY?= =?us-ascii?Q?1oybBpS98hKSOCmFlXY7SX5JVhfCLPvDl9/hSOTArLLiVqMSZLlYT1nltz4N?= =?us-ascii?Q?5cE12yIAm0vJI7H5WnJGLF4PcIJaktbDUtyzTxCzDp4HDHhFUed0uya9OIDG?= =?us-ascii?Q?pFmxYYjPV/9/ddRoVdQSuuTMQUGcuYR+qO9do72gO6eyeB5UeBIdiE8X32gQ?= =?us-ascii?Q?75oD0TNOMavB41G56lr19/VGVtDgCitvn3WEdElnYysEJrc6aWzcxSU2gFY0?= =?us-ascii?Q?bMaqaewg/sQ4Go8W8J3bvs8jLZr9MB6PVAp91rUgh7W2hZ9u1ymJm0wXPRUh?= =?us-ascii?Q?yT2PpAQ7YK1ouyuhQab65XqteyjztJFV3ZhUELkXJTS0oEp+EZFn9kL5aax6?= =?us-ascii?Q?D78rb/+nJULrI8bhGPzTfpYXDenYdOSqRNfdsAAPZDMM1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Maz1IPxChDNzzuclfHO5zJlubtD/2LTC?= =?us-ascii?Q?V4Ftn1eZTySAacO9s/DS1qrZwdGXm7d0U1iTBATJTlSIyNunm23X/bMc16ta?= =?us-ascii?Q?2kGuLGyR5fzvv1FCOzQGtbNfmTpW2QqTpSjcuqvhpESoAFTa9sSll/NnV5xl?= =?us-ascii?Q?Vg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ded0b64b-dfdd-4714-125e-08dc90467399 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:04.4227 (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: MjXScPdV8rQTEcWEkEQhv5SVcIQ0ZN13czPbJDMRf4EcvutjyanVePMRHHl0+QWSCgQBCGSgxjlF5/Nj7K1MGhahVA7Rh4LQpvqxXEt9XM4= 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 Export the function ID get interface, and adjust the logic to make it also valid for the flower firmware with multi-PF. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower.c | 11 +++++++++-- drivers/net/nfp/flower/nfp_flower_cmsg.c | 10 ++++++---- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- drivers/net/nfp/flower/nfp_flower_representor.c | 14 ++++++++++---- drivers/net/nfp/nfp_ethdev.c | 10 ---------- drivers/net/nfp/nfp_net_common.c | 10 ++++++++++ drivers/net/nfp/nfp_net_common.h | 2 ++ 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 5caaf9d745..70135574d4 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -647,14 +647,18 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) { int ret; int err; + uint8_t id; uint64_t ext_features; unsigned int numa_node; struct nfp_net_hw *pf_hw; struct nfp_net_hw *ctrl_hw; + char bar_name[RTE_ETH_NAME_MAX_LEN]; + char ctrl_name[RTE_ETH_NAME_MAX_LEN]; struct nfp_app_fw_flower *app_fw_flower; struct nfp_pf_dev *pf_dev = hw_priv->pf_dev; numa_node = rte_socket_id(); + id = nfp_function_id_get(pf_dev, 0); /* Allocate memory for the Flower app */ app_fw_flower = rte_zmalloc_socket("nfp_app_fw_flower", sizeof(*app_fw_flower), @@ -688,7 +692,8 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) } /* Map the PF ctrl bar */ - pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, "_pf0_net_bar0", + snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id); + pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name, NFP_NET_CFG_BAR_SZ, &pf_dev->ctrl_area); if (pf_dev->ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "Cloud not map the PF vNIC ctrl bar"); @@ -711,6 +716,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) /* Fill in the PF vNIC and populate app struct */ app_fw_flower->pf_hw = pf_hw; pf_hw->super.ctrl_bar = pf_dev->ctrl_bar; + pf_hw->nfp_idx = pf_dev->nfp_eth_table->ports[id].index; ret = nfp_flower_init_vnic_common(hw_priv, pf_hw, "pf_vnic"); if (ret != 0) { @@ -725,7 +731,8 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) ctrl_hw = app_fw_flower->ctrl_hw; /* Map the ctrl vNIC ctrl bar */ - ctrl_hw->super.ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, "_pf0_net_ctrl_bar", + snprintf(ctrl_name, sizeof(ctrl_name), "_pf%u_net_ctrl_bar", id); + ctrl_hw->super.ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, ctrl_name, NFP_NET_CFG_BAR_SZ, &ctrl_hw->ctrl_area); if (ctrl_hw->super.ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "Cloud not map the ctrl vNIC ctrl bar"); diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c index 2a0e9afe90..9a5b5f52b8 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c @@ -82,9 +82,10 @@ nfp_flower_cmsg_mac_repr_fill(struct rte_mbuf *m, int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower, - struct nfp_eth_table *nfp_eth_table) + struct nfp_pf_dev *pf_dev) { uint8_t i; + uint8_t id; uint16_t cnt; uint32_t nbi; uint32_t nbi_port; @@ -101,9 +102,10 @@ nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower, /* Fill in the mac repr cmsg */ for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) { - nbi = nfp_eth_table->ports[i].nbi; - nbi_port = nfp_eth_table->ports[i].base; - phys_port = nfp_eth_table->ports[i].index; + id = nfp_function_id_get(pf_dev, i); + nbi = pf_dev->nfp_eth_table->ports[id].nbi; + nbi_port = pf_dev->nfp_eth_table->ports[id].base; + phys_port = pf_dev->nfp_eth_table->ports[id].index; nfp_flower_cmsg_mac_repr_fill(mbuf, i, nbi, nbi_port, phys_port); } diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index afaf733ef7..bb03234035 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -976,7 +976,7 @@ struct nfp_fl_act_mark { }; int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower, - struct nfp_eth_table *nfp_eth_table); + struct nfp_pf_dev *pf_dev); int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower, struct nfp_flower_representor *repr); int nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower, diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 633e5d9eb6..1f34c4c263 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -790,6 +790,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, { int i; int ret; + uint8_t id; const char *pci_name; struct nfp_pf_dev *pf_dev; struct rte_pci_device *pci_dev; @@ -806,7 +807,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, repr_init.hw_priv = hw_priv; /* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */ - ret = nfp_flower_cmsg_mac_repr(app_fw_flower, nfp_eth_table); + ret = nfp_flower_cmsg_mac_repr(app_fw_flower, pf_dev); if (ret != 0) { PMD_INIT_LOG(ERR, "Cloud not send mac repr cmsgs"); return ret; @@ -822,7 +823,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, pci_name = strchr(pci_dev->name, ':') + 1; - snprintf(flower_repr.name, sizeof(flower_repr.name), + if (pf_dev->multi_pf.enabled) + snprintf(flower_repr.name, sizeof(flower_repr.name), + "%s_repr_pf%d", pci_name, pf_dev->multi_pf.function_id); + else + snprintf(flower_repr.name, sizeof(flower_repr.name), "%s_repr_pf", pci_name); /* Create a eth_dev for this representor */ @@ -836,7 +841,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, /* Create a rte_eth_dev for every phyport representor */ for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) { - eth_port = &nfp_eth_table->ports[i]; + id = nfp_function_id_get(pf_dev, i); + eth_port = &nfp_eth_table->ports[id]; flower_repr.repr_type = NFP_REPR_TYPE_PHYS_PORT; flower_repr.port_id = nfp_flower_get_phys_port_id(eth_port->index); flower_repr.nfp_idx = eth_port->eth_index; @@ -845,7 +851,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, /* Copy the real mac of the interface to the representor struct */ rte_ether_addr_copy(ð_port->mac_addr, &flower_repr.mac_addr); snprintf(flower_repr.name, sizeof(flower_repr.name), - "%s_repr_p%d", pci_name, i); + "%s_repr_p%d", pci_name, id); /* * Create a eth_dev for this representor. diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 2c1300350c..469fa4602e 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -497,16 +497,6 @@ nfp_net_set_link_down(struct rte_eth_dev *dev) return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0); } -static uint8_t -nfp_function_id_get(const struct nfp_pf_dev *pf_dev, - uint8_t phy_port) -{ - if (pf_dev->multi_pf.enabled) - return pf_dev->multi_pf.function_id; - - return phy_port; -} - static void nfp_net_beat_timer(void *arg) { diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index d8b7045c3a..0bfe7a514c 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -2564,3 +2564,13 @@ nfp_net_get_port_num(struct nfp_pf_dev *pf_dev, else return nfp_eth_table->count; } + +uint8_t +nfp_function_id_get(const struct nfp_pf_dev *pf_dev, + uint8_t port_id) +{ + if (pf_dev->multi_pf.enabled) + return pf_dev->multi_pf.function_id; + + return port_id; +} diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 4016652cf9..cbf96e5ab5 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -328,6 +328,8 @@ int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev); void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev); uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev, struct nfp_eth_table *nfp_eth_table); +uint8_t nfp_function_id_get(const struct nfp_pf_dev *pf_dev, + uint8_t port_id); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) -- 2.39.1