DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] support using several cards in one host
@ 2023-06-09  6:00 Chaoyong He
  2023-06-09  6:00 ` [PATCH 1/3] net/nfp: fix control mempool creation failed Chaoyong He
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chaoyong He @ 2023-06-09  6:00 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

The former logic does not consider using several cards with flower
firmware in one host, this patch series add the support of this
situation.

Long Wu (3):
  net/nfp: fix control mempool creation failed
  net/nfp: fix representor creation failed
  net/nfp: fix flow hash table creation failed

 drivers/net/nfp/flower/nfp_flower.c             |  6 +++++-
 drivers/net/nfp/flower/nfp_flower_representor.c | 13 ++++++++++---
 drivers/net/nfp/nfp_flow.c                      | 16 +++++++++++++---
 3 files changed, 28 insertions(+), 7 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] net/nfp: fix control mempool creation failed
  2023-06-09  6:00 [PATCH 0/3] support using several cards in one host Chaoyong He
@ 2023-06-09  6:00 ` Chaoyong He
  2023-06-09  6:00 ` [PATCH 2/3] net/nfp: fix representor " Chaoyong He
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-06-09  6:00 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, chaoyong.he, stable

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(-)

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");
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] net/nfp: fix representor creation failed
  2023-06-09  6:00 [PATCH 0/3] support using several cards in one host Chaoyong He
  2023-06-09  6:00 ` [PATCH 1/3] net/nfp: fix control mempool creation failed Chaoyong He
@ 2023-06-09  6:00 ` Chaoyong He
  2023-06-09  6:01 ` [PATCH 3/3] net/nfp: fix flow hash table " Chaoyong He
  2023-06-09 13:23 ` [PATCH 0/3] support using several cards in one host Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-06-09  6:00 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, chaoyong.he, stable

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_eth_dev_create().

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

Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
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_representor.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 3225a4b84a..5118c9c57c 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -723,6 +723,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower)
 {
 	int i;
 	int ret;
+	struct rte_device *device;
 	struct rte_eth_dev *eth_dev;
 	struct nfp_eth_table *nfp_eth_table;
 	struct nfp_eth_table_port *eth_port;
@@ -746,7 +747,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower)
 
 	/* PF vNIC reprs get a random MAC address */
 	rte_eth_random_addr(flower_repr.mac_addr.addr_bytes);
-	sprintf(flower_repr.name, "flower_repr_pf");
+
+	device = &app_fw_flower->pf_hw->pf_dev->pci_dev->device;
+
+	snprintf(flower_repr.name, sizeof(flower_repr.name),
+			"%s_flower_repr_pf", device->name);
 
 	/* Create a eth_dev for this representor */
 	ret = rte_eth_dev_create(eth_dev->device, flower_repr.name,
@@ -767,7 +772,8 @@ 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(&eth_port->mac_addr, &flower_repr.mac_addr);
-		sprintf(flower_repr.name, "flower_repr_p%d", i);
+		snprintf(flower_repr.name, sizeof(flower_repr.name),
+				"%s_fl_repr_p%d", device->name, i);
 
 		/*
 		 * Create a eth_dev for this representor
@@ -798,7 +804,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower)
 
 		/* VF reprs get a random MAC address */
 		rte_eth_random_addr(flower_repr.mac_addr.addr_bytes);
-		sprintf(flower_repr.name, "flower_repr_vf%d", i);
+		snprintf(flower_repr.name, sizeof(flower_repr.name),
+				"%s_fl_repr_vf%d", device->name, i);
 
 		 /* This will also allocate private memory for the device*/
 		ret = rte_eth_dev_create(eth_dev->device, flower_repr.name,
-- 
2.39.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] net/nfp: fix flow hash table creation failed
  2023-06-09  6:00 [PATCH 0/3] support using several cards in one host Chaoyong He
  2023-06-09  6:00 ` [PATCH 1/3] net/nfp: fix control mempool creation failed Chaoyong He
  2023-06-09  6:00 ` [PATCH 2/3] net/nfp: fix representor " Chaoyong He
@ 2023-06-09  6:01 ` Chaoyong He
  2023-06-09 13:23 ` [PATCH 0/3] support using several cards in one host Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-06-09  6:01 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, chaoyong.he, stable

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_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@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/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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] support using several cards in one host
  2023-06-09  6:00 [PATCH 0/3] support using several cards in one host Chaoyong He
                   ` (2 preceding siblings ...)
  2023-06-09  6:01 ` [PATCH 3/3] net/nfp: fix flow hash table " Chaoyong He
@ 2023-06-09 13:23 ` Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2023-06-09 13:23 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund

On 6/9/2023 7:00 AM, Chaoyong He wrote:
> The former logic does not consider using several cards with flower
> firmware in one host, this patch series add the support of this
> situation.
> 
> Long Wu (3):
>   net/nfp: fix control mempool creation failed
>   net/nfp: fix representor creation failed
>   net/nfp: fix flow hash table creation failed
> 

Series applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-09 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09  6:00 [PATCH 0/3] support using several cards in one host Chaoyong He
2023-06-09  6:00 ` [PATCH 1/3] net/nfp: fix control mempool creation failed Chaoyong He
2023-06-09  6:00 ` [PATCH 2/3] net/nfp: fix representor " Chaoyong He
2023-06-09  6:01 ` [PATCH 3/3] net/nfp: fix flow hash table " Chaoyong He
2023-06-09 13:23 ` [PATCH 0/3] support using several cards in one host Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).