Commit 48e61962 authored by Anantha Prabhu's avatar Anantha Prabhu Committed by Paolo Abeni
Browse files

bnxt_en: Support for RoCE resources dynamically shared within VFs.



Add support for dynamic RoCE SRIOV resource configuration.  Instead of
statically dividing the RoCE resources by the number of VFs, provide
the maximum resources and let the FW dynamically dsitribute to the VFs
on the fly.

Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: default avatarAnantha Prabhu <anantha.prabhu@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250917040839.1924698-8-michael.chan@broadcom.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 6f115863
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -9632,10 +9632,10 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)

static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
{
	u32 flags, flags_ext, flags_ext2, flags_ext3;
	struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
	struct hwrm_func_qcaps_output *resp;
	struct hwrm_func_qcaps_input *req;
	struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
	u32 flags, flags_ext, flags_ext2;
	int rc;

	rc = hwrm_req_init(bp, req, HWRM_FUNC_QCAPS);
@@ -9702,6 +9702,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
	    (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_ROCE_VF_RESOURCE_MGMT_SUPPORTED))
		bp->fw_cap |= BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED;

	flags_ext3 = le32_to_cpu(resp->flags_ext3);
	if (flags_ext3 & FUNC_QCAPS_RESP_FLAGS_EXT3_ROCE_VF_DYN_ALLOC_SUPPORT)
		bp->fw_cap |= BNXT_FW_CAP_ROCE_VF_DYN_ALLOC_SUPPORT;

	bp->tx_push_thresh = 0;
	if ((flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) &&
	    BNXT_FW_MAJ(bp) > 217)
+3 −0
Original line number Diff line number Diff line
@@ -2479,6 +2479,7 @@ struct bnxt {
	#define BNXT_FW_CAP_ENABLE_RDMA_SRIOV           BIT_ULL(5)
	#define BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED	BIT_ULL(6)
	#define BNXT_FW_CAP_KONG_MB_CHNL		BIT_ULL(7)
	#define BNXT_FW_CAP_ROCE_VF_DYN_ALLOC_SUPPORT	BIT_ULL(8)
	#define BNXT_FW_CAP_OVS_64BIT_HANDLE		BIT_ULL(10)
	#define BNXT_FW_CAP_TRUSTED_VF			BIT_ULL(11)
	#define BNXT_FW_CAP_ERROR_RECOVERY		BIT_ULL(13)
@@ -2523,6 +2524,8 @@ struct bnxt {
#define BNXT_SUPPORTS_MULTI_RSS_CTX(bp)				\
	(BNXT_PF(bp) && BNXT_SUPPORTS_NTUPLE_VNIC(bp) &&	\
	 ((bp)->rss_cap & BNXT_RSS_CAP_MULTI_RSS_CTX))
#define BNXT_ROCE_VF_DYN_ALLOC_CAP(bp)				\
	((bp)->fw_cap & BNXT_FW_CAP_ROCE_VF_DYN_ALLOC_SUPPORT)
#define BNXT_SUPPORTS_QUEUE_API(bp)				\
	(BNXT_PF(bp) && BNXT_SUPPORTS_NTUPLE_VNIC(bp) &&	\
	 ((bp)->fw_cap & BNXT_FW_CAP_VNIC_RE_FLUSH))
+7 −0
Original line number Diff line number Diff line
@@ -541,6 +541,13 @@ static void bnxt_hwrm_roce_sriov_cfg(struct bnxt *bp, int num_vfs)
	if (rc)
		goto err;

	/* In case of VF Dynamic resource allocation, driver will provision
	 * maximum resources to all the VFs. FW will dynamically allocate
	 * resources to VFs on the fly, so always divide the resources by 1.
	 */
	if (BNXT_ROCE_VF_DYN_ALLOC_CAP(bp))
		num_vfs = 1;

	cfg_req->fid = cpu_to_le16(0xffff);
	cfg_req->enables2 =
		cpu_to_le32(FUNC_CFG_REQ_ENABLES2_ROCE_MAX_AV_PER_VF |