[1/3] net/nfp: fix control mempool creation failed

Message ID 20230609060100.1306648-2-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series support using several cards in one host |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He June 9, 2023, 6 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

The former logic does not consider the simultaneous initialization of
several NICs using flower firmware. The reason the initialization
failed was because several NICs use the same name parameter when we
call rte_pktmbuf_pool_create().

We use the PCI address to give each NIC a unique name parameter and let
the initializtion succeed.

Fixes: 945441ebdb9c ("net/nfp: add flower ctrl VNIC")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 8e1bc22747..53ee936f4c 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -421,6 +421,7 @@  nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)
 	struct rte_eth_dev *eth_dev;
 	const struct rte_memzone *tz;
 	struct nfp_app_fw_flower *app_fw_flower;
+	char ctrl_pktmbuf_pool_name[RTE_MEMZONE_NAMESIZE];
 
 	/* Set up some pointers here for ease of use */
 	pf_dev = hw->pf_dev;
@@ -454,7 +455,10 @@  nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)
 
 	/* Create a mbuf pool for the ctrl vNIC */
 	numa_node = rte_socket_id();
-	app_fw_flower->ctrl_pktmbuf_pool = rte_pktmbuf_pool_create("ctrl_mbuf_pool",
+	snprintf(ctrl_pktmbuf_pool_name, sizeof(ctrl_pktmbuf_pool_name),
+			"%s_ctrlmp", pf_dev->pci_dev->device.name);
+	app_fw_flower->ctrl_pktmbuf_pool =
+			rte_pktmbuf_pool_create(ctrl_pktmbuf_pool_name,
 			4 * CTRL_VNIC_NB_DESC, 64, 0, 9216, numa_node);
 	if (app_fw_flower->ctrl_pktmbuf_pool == NULL) {
 		PMD_INIT_LOG(ERR, "Create mbuf pool for ctrl vnic failed");