From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Shuanglin Wang <shuanglin.wang@broadcom.com>,
Shahaji Bhosle <sbhosle@broadcom.com>
Subject: [PATCH 5/7] net/bnxt: adjust session name on multi host system
Date: Thu, 8 Feb 2024 09:13:28 -0800 [thread overview]
Message-ID: <20240208171330.31139-6-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20240208171330.31139-1-ajit.khaparde@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 4161 bytes --]
From: Shuanglin Wang <shuanglin.wang@broadcom.com>
On multi-host system, pci-id on PFs are same on each host.
The currect code is using the pci-id as the session name to
create a session. This would cause a name confliction on firmware
then fw rejects the session creation.
The patch will change the session name with parent pci_id for
multi-host system. This solution works for single PF per EP only.
Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 1 +
drivers/net/bnxt/bnxt_hwrm.c | 8 +++++
drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 58 ++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 3b3df6ba28..4203e6a055 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -825,6 +825,7 @@ struct bnxt {
#define BNXT_TESTPMD_EN(bp) \
((bp)->flags2 & BNXT_FLAGS2_TESTPMD_EN)
+ uint16_t multi_host_pf_pci_id;
uint16_t chip_num;
#define CHIP_NUM_58818 0xd818
#define BNXT_CHIP_SR2(bp) ((bp)->chip_num == CHIP_NUM_58818)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1d523d6dec..2ceab555a5 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4207,6 +4207,14 @@ int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp)
bp->parent->port_id = rte_le_to_cpu_16(resp->port_id);
flags = rte_le_to_cpu_16(resp->flags);
+
+ /* check for the mulit-host support */
+ if (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST) {
+ bp->flags |= BNXT_FLAG_MULTI_HOST;
+ bp->multi_host_pf_pci_id = resp->pci_id;
+ PMD_DRV_LOG(INFO, "Mult-Host system Parent PCI-ID: 0x%x\n", resp->pci_id);
+ }
+
/* check for the multi-root support */
if (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_ROOT) {
bp->flags2 |= BNXT_FLAGS2_MULTIROOT_EN;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index b696b6dc3e..274e935a1f 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -641,6 +641,49 @@ ulp_ctx_shared_session_close(struct bnxt *bp,
bnxt_ulp_session_tfp_reset(session, session_type);
}
+static int32_t
+ulp_ctx_mh_get_session_name(struct bnxt *bp,
+ struct tf_open_session_parms *parms)
+{
+ int32_t rc = 0;
+ unsigned int domain = 0, bus = 0, slot = 0, device = 0;
+ rc = sscanf(parms->ctrl_chan_name,
+ "%x:%x:%x.%u",
+ &domain,
+ &bus,
+ &slot,
+ &device);
+ if (rc != 4) {
+ /* PCI Domain not provided (optional in DPDK), thus we
+ * force domain to 0 and recheck.
+ */
+ domain = 0;
+ /* Check parsing of bus/slot/device */
+ rc = sscanf(parms->ctrl_chan_name,
+ "%x:%x.%u",
+ &bus,
+ &slot,
+ &device);
+ if (rc != 3) {
+ BNXT_TF_DBG(DEBUG,
+ "Failed to scan device ctrl_chan_name\n");
+ return -EINVAL;
+ }
+ }
+
+ /* change domain name for multi-host system */
+ domain = domain + (0xf & bp->multi_host_pf_pci_id);
+ sprintf(parms->ctrl_chan_name,
+ "%x:%x:%x.%u",
+ domain,
+ bus,
+ slot,
+ device);
+ BNXT_TF_DBG(DEBUG,
+ "Session name for Multi-Host: ctrl_chan_name:%s\n", parms->ctrl_chan_name);
+ return 0;
+}
+
static int32_t
ulp_ctx_shared_session_open(struct bnxt *bp,
enum bnxt_ulp_session_type session_type,
@@ -664,6 +707,14 @@ ulp_ctx_shared_session_open(struct bnxt *bp,
ethdev->data->port_id, rc);
return rc;
}
+
+ /* On multi-host system, adjust ctrl_chan_name to avoid confliction */
+ if (BNXT_MH(bp)) {
+ rc = ulp_ctx_mh_get_session_name(bp, &parms);
+ if (rc)
+ return rc;
+ }
+
resources = &parms.resources;
/*
@@ -835,6 +886,13 @@ ulp_ctx_session_open(struct bnxt *bp,
return rc;
}
+ /* On multi-host system, adjust ctrl_chan_name to avoid confliction */
+ if (BNXT_MH(bp)) {
+ rc = ulp_ctx_mh_get_session_name(bp, ¶ms);
+ if (rc)
+ return rc;
+ }
+
rc = bnxt_ulp_cntxt_app_id_get(bp->ulp_ctx, &app_id);
if (rc) {
BNXT_TF_DBG(ERR, "Unable to get the app id from ulp.\n");
--
2.39.2 (Apple Git-143)
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]
next prev parent reply other threads:[~2024-02-08 17:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 17:13 [PATCH 0/7] bnxt bug fixes Ajit Khaparde
2024-02-08 17:13 ` [PATCH 1/7] net/bnxt: avoid seg fault in Tx queue release Ajit Khaparde
2024-02-08 17:13 ` [PATCH 2/7] net/bnxt: modify locking for representor Tx Ajit Khaparde
2024-02-08 17:13 ` [PATCH 3/7] net/bnxt: refactor VNIC context cleanup Ajit Khaparde
2024-02-08 17:13 ` [PATCH 4/7] net/bnxt: cleanup vnic ref count Ajit Khaparde
2024-02-08 17:13 ` Ajit Khaparde [this message]
2024-02-08 17:13 ` [PATCH 6/7] net/bnxt: update consumer index of NQ regularly Ajit Khaparde
2024-02-08 17:13 ` [PATCH 7/7] net/bnxt: update RSS algorithm capability Ajit Khaparde
2024-02-08 21:50 ` [PATCH 0/7] bnxt bug fixes Ajit Khaparde
2024-02-22 2:50 ` Patrick Robb
2024-02-22 3:20 ` Ajit Khaparde
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=20240208171330.31139-6-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=sbhosle@broadcom.com \
--cc=shuanglin.wang@broadcom.com \
/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).