]> www.infradead.org Git - users/hch/misc.git/commitdiff
bnxt_en: Support for RoCE resources dynamically shared within VFs.
authorAnantha Prabhu <anantha.prabhu@broadcom.com>
Wed, 17 Sep 2025 04:08:36 +0000 (21:08 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 18 Sep 2025 11:09:43 +0000 (13:09 +0200)
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: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Anantha Prabhu <anantha.prabhu@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250917040839.1924698-8-michael.chan@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c

index bdf8502d31316e0aa5979dfac9b709c53f100cfa..4ffc4632991bfb714d5138e4c79d4ae64f5a53de 100644 (file)
@@ -9632,10 +9632,10 @@ no_ptp:
 
 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)
index 57a1af40cc1906c81a2b4205783f79aa905ac87c..c0f46eaf91c037a3a238384842ae32db02793cc5 100644 (file)
@@ -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))
index e7fbfeb1a387a21d6e6c51816709e037733317af..1d8df44c3f9eb9dfc740ca1dd803b96f874d0f49 100644 (file)
@@ -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 |