From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
peng.zhang@corigine.com, stable@dpdk.org,
Long Wu <long.wu@corigine.com>
Subject: [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process
Date: Sat, 12 Oct 2024 10:40:59 +0800 [thread overview]
Message-ID: <20241012024107.3795935-3-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20241012024107.3795935-1-chaoyong.he@corigine.com>
The original logic keeps using the same name parameter when malloc
memory in secondary process, which may cause error when using
multiple PF cards.
Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 64a06440f5..3732abc9fe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2669,7 +2669,8 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Allocate memory for the PF "device" */
- snprintf(name, sizeof(name), "nfp_pf%d", 0);
+ function_id = pci_dev->addr.function & 0x7;
+ snprintf(name, sizeof(name), "nfp_pf%d", function_id);
pf_dev = rte_zmalloc(name, sizeof(*pf_dev), 0);
if (pf_dev == NULL) {
PMD_INIT_LOG(ERR, "Can't allocate memory for the PF device");
@@ -2714,7 +2715,6 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Read the app ID of the firmware loaded */
- function_id = pci_dev->addr.function & 0x7;
snprintf(app_name, sizeof(app_name), "_pf%u_net_app_id", function_id);
app_fw_id = nfp_rtsym_read_le(sym_tbl, app_name, &ret);
if (ret != 0) {
--
2.39.1
next prev parent reply other threads:[~2024-10-12 2:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
2024-10-10 9:17 ` [PATCH " Chaoyong He
2024-10-10 15:07 ` Stephen Hemminger
2024-10-11 2:31 ` Chaoyong He
2024-10-10 9:17 ` [PATCH 05/10] net/nfp: fix problem caused by configure function Chaoyong He
2024-10-10 15:13 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
2024-10-10 15:19 ` Stephen Hemminger
2024-10-11 2:38 ` Chaoyong He
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
2024-10-12 2:40 ` Chaoyong He [this message]
2024-10-12 2:45 ` [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process Stephen Hemminger
2024-10-12 2:47 ` Chaoyong He
2024-10-12 2:41 ` [PATCH v2 05/10] net/nfp: fix problem caused by configure function Chaoyong He
2024-10-12 2:41 ` [PATCH v2 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
2024-10-12 2:41 ` [PATCH v2 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
2024-10-12 2:41 ` [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
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=20241012024107.3795935-3-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@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).