[PATCH 3/3] net/nfp: fix flow hash table creation failed

Chaoyong He chaoyong.he at corigine.com
Fri Jun 9 08:01:00 CEST 2023


From: Long Wu <long.wu at 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_hash_create().

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

Fixes: ac09376096d8 ("net/nfp: add structures and functions for flow offload")
Cc: chaoyong.he at corigine.com
Cc: stable at dpdk.org

Signed-off-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
---
 drivers/net/nfp/nfp_flow.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index cb7073f361..d392f9c77b 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -4105,11 +4105,21 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	size_t stats_size;
 	uint64_t ctx_count;
 	uint64_t ctx_split;
+	char mask_name[RTE_HASH_NAMESIZE];
+	char flow_name[RTE_HASH_NAMESIZE];
+	char pretun_name[RTE_HASH_NAMESIZE];
 	struct nfp_flow_priv *priv;
 	struct nfp_app_fw_flower *app_fw_flower;
 
+	snprintf(mask_name, sizeof(mask_name), "%s_mask",
+			pf_dev->pci_dev->device.name);
+	snprintf(flow_name, sizeof(flow_name), "%s_flow",
+			pf_dev->pci_dev->device.name);
+	snprintf(pretun_name, sizeof(pretun_name), "%s_pretun",
+			pf_dev->pci_dev->device.name);
+
 	struct rte_hash_parameters mask_hash_params = {
-		.name       = "mask_hash_table",
+		.name       = mask_name,
 		.entries    = NFP_MASK_TABLE_ENTRIES,
 		.hash_func  = rte_jhash,
 		.socket_id  = rte_socket_id(),
@@ -4118,7 +4128,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	};
 
 	struct rte_hash_parameters flow_hash_params = {
-		.name       = "flow_hash_table",
+		.name       = flow_name,
 		.hash_func  = rte_jhash,
 		.socket_id  = rte_socket_id(),
 		.key_len    = sizeof(uint32_t),
@@ -4126,7 +4136,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	};
 
 	struct rte_hash_parameters pre_tun_hash_params = {
-		.name       = "pre_tunnel_table",
+		.name       = pretun_name,
 		.entries    = 32,
 		.hash_func  = rte_jhash,
 		.socket_id  = rte_socket_id(),
-- 
2.39.1



More information about the dev mailing list