* [PATCH 1/2] net/nfp: fix representor name too long
2023-06-15 6:51 [PATCH 0/2] reduce the length of PCI name Chaoyong He
@ 2023-06-15 6:51 ` Chaoyong He
2023-06-15 6:51 ` [PATCH 2/2] net/nfp: reduce the length of PCI name Chaoyong He
2023-06-21 17:28 ` [PATCH 0/2] " Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-06-15 6:51 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, stable, Chaoyong He
From: Long Wu <long.wu@corigine.com>
The length of representor name may exceed the limit when we use
it to create rte_ring, so we reduce the length of its name.
For example:
old: 0000:af:00.0_fl_repr_p1
new: af:00.0_repr_p1
Fixes: 2003cb447aa5 ("net/nfp: fix representor creation")
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_representor.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 5118c9c57c..5585e1ed9e 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -723,8 +723,9 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower)
{
int i;
int ret;
- struct rte_device *device;
+ const char *pci_name;
struct rte_eth_dev *eth_dev;
+ struct rte_pci_device *pci_dev;
struct nfp_eth_table *nfp_eth_table;
struct nfp_eth_table_port *eth_port;
struct nfp_flower_representor flower_repr = {
@@ -748,10 +749,12 @@ 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);
- device = &app_fw_flower->pf_hw->pf_dev->pci_dev->device;
+ pci_dev = app_fw_flower->pf_hw->pf_dev->pci_dev;
+
+ pci_name = strchr(pci_dev->name, ':') + 1;
snprintf(flower_repr.name, sizeof(flower_repr.name),
- "%s_flower_repr_pf", device->name);
+ "%s_repr_pf", pci_name);
/* Create a eth_dev for this representor */
ret = rte_eth_dev_create(eth_dev->device, flower_repr.name,
@@ -773,7 +776,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_fl_repr_p%d", device->name, i);
+ "%s_repr_p%d", pci_name, i);
/*
* Create a eth_dev for this representor
@@ -805,7 +808,7 @@ 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);
snprintf(flower_repr.name, sizeof(flower_repr.name),
- "%s_fl_repr_vf%d", device->name, i);
+ "%s_repr_vf%d", pci_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] 4+ messages in thread
* [PATCH 2/2] net/nfp: reduce the length of PCI name
2023-06-15 6:51 [PATCH 0/2] reduce the length of PCI name Chaoyong He
2023-06-15 6:51 ` [PATCH 1/2] net/nfp: fix representor name too long Chaoyong He
@ 2023-06-15 6:51 ` Chaoyong He
2023-06-21 17:28 ` [PATCH 0/2] " Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-06-15 6:51 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He
From: Long Wu <long.wu@corigine.com>
The whole PCI name is too long and we remove the part before
the first colon.
For example:
old: 0000:af:00.0_ctrlmp
new: af:00.0_ctrlmp
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
drivers/net/nfp/flower/nfp_flower.c | 2 +-
drivers/net/nfp/nfp_flow.c | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 53ee936f4c..6a4d3c7dae 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -456,7 +456,7 @@ nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw)
/* Create a mbuf pool for the ctrl vNIC */
numa_node = rte_socket_id();
snprintf(ctrl_pktmbuf_pool_name, sizeof(ctrl_pktmbuf_pool_name),
- "%s_ctrlmp", pf_dev->pci_dev->device.name);
+ "%s_ctrlmp", (strchr(pf_dev->pci_dev->name, ':') + 1));
app_fw_flower->ctrl_pktmbuf_pool =
rte_pktmbuf_pool_create(ctrl_pktmbuf_pool_name,
4 * CTRL_VNIC_NB_DESC, 64, 0, 9216, numa_node);
diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 5acb7f6ff3..3446adb766 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -4135,13 +4135,11 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
char pretun_name[RTE_HASH_NAMESIZE];
struct nfp_flow_priv *priv;
struct nfp_app_fw_flower *app_fw_flower;
+ const char *pci_name = strchr(pf_dev->pci_dev->name, ':') + 1;
- 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);
+ snprintf(mask_name, sizeof(mask_name), "%s_mask", pci_name);
+ snprintf(flow_name, sizeof(flow_name), "%s_flow", pci_name);
+ snprintf(pretun_name, sizeof(pretun_name), "%s_pretun", pci_name);
struct rte_hash_parameters mask_hash_params = {
.name = mask_name,
--
2.39.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] reduce the length of PCI name
2023-06-15 6:51 [PATCH 0/2] reduce the length of PCI name Chaoyong He
2023-06-15 6:51 ` [PATCH 1/2] net/nfp: fix representor name too long Chaoyong He
2023-06-15 6:51 ` [PATCH 2/2] net/nfp: reduce the length of PCI name Chaoyong He
@ 2023-06-21 17:28 ` Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2023-06-21 17:28 UTC (permalink / raw)
To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund
On 6/15/2023 7:51 AM, Chaoyong He wrote:
> Use the complete PCI name as the part of representor port name cause the
> app crash, because the name is too long.
>
> Fix this by reduce the length, using only the parts after the first ':'.
>
> To keep unification, also use the same approach for the name of hash
> parameters.
>
> Long Wu (2):
> net/nfp: fix representor name too long
> net/nfp: reduce the length of PCI name
>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread