From: Long Wu <long...@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: sta...@dpdk.org Signed-off-by: Long Wu <long...@corigine.com> Reviewed-by: Chaoyong He <chaoyong...@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