From: Shuanglin Wang 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 Signed-off-by: Ajit Khaparde Reviewed-by: Shahaji Bhosle --- 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)