From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
Long Wu <long.wu@corigine.com>,
stable@dpdk.org, Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 1/2] net/nfp: fix representor name too long
Date: Thu, 15 Jun 2023 14:51:30 +0800 [thread overview]
Message-ID: <20230615065131.1267711-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20230615065131.1267711-1-chaoyong.he@corigine.com>
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
next prev parent reply other threads:[~2023-06-15 6:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 6:51 [PATCH 0/2] reduce the length of PCI name Chaoyong He
2023-06-15 6:51 ` Chaoyong He [this message]
2023-06-15 6:51 ` [PATCH 2/2] net/nfp: " Chaoyong He
2023-06-21 17:28 ` [PATCH 0/2] " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230615065131.1267711-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).