bnxt: Enhance the resource distribution for RoCE VFs
Subsystems (5)
Selvin Xavier
maintainerv2 cover bnxt: Enhance the resource distribution for RoCE VFs
Implements the mechanism to distribute the RoCE VF resource based on the active VFs. If the firmware support the feature, NIC driver will distribute the resources for Active VFs. For older Firmware, RoCE driver will continue to distribute the resources across the total number of VFs.
Please review and apply.
Thanks,
Selvin Xavier
v1 -> v2:
Updated the commit message of patch 1 of the series
Bhargava Chenna Marreddy (1):
RDMA/bnxt_re: Enhance RoCE SRIOV resource configuration design
Kalesh AP (1):
RDMA/bnxt_re: Add set_func_resources support for P5/P7 adapters
Vikas Gupta (1):
bnxt_en: Add support for RoCE sriov configuration
drivers/infiniband/hw/bnxt_re/main.c | 24 ++++++----- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 ++---- drivers/infiniband/hw/bnxt_re/qplib_res.h | 3 ++ drivers/infiniband/hw/bnxt_re/roce_hsi.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 +++ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 53 +++++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 + drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 1 + 9 files changed, 89 insertions(+), 20 deletions(-)
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 1/3 bnxt_en: Add support for RoCE sriov configuration
From: Vikas Gupta <[email protected]>
During driver load, PF RDMA driver provisions resources to the RDMA VFs. This logic takes into consideration of the total number of VFs supported on the PF while allocating resources. Firmware now advertises a capability where NIC driver can allocate resources for RDMA VFs when the user actually creates a VF. So this resource distribution can be based on the number of active VFs.
This patch adds the support to check for the firmware capability and follow the new RDMA VF resource allocation strategy. The current logic in the RDMA driver will be removed for the newer Firmware versions in a subsequent patch in this series.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 +++ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 53 +++++++++++++++++++++++++ 3 files changed, 65 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -0
@@ -8151,6 +8151,9 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)if (flags &FUNC_QCFG_RESP_FLAGS_RING_MONITOR_ENABLED ) bp->fw_cap |=BNXT_FW_CAP_RING_MONITOR ; +if (flags &FUNC_QCFG_RESP_FLAGS_ENABLE_RDMA_SRIOV ) + bp->fw_cap |=BNXT_FW_CAP_ENABLE_RDMA_SRIOV ; +switch (resp->port_partition_type) {case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0 :case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_5 :
@@ -9177,6 +9180,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags |=BNXT_FLAG_UDP_GSO_CAP ;if (flags_ext2 &FUNC_QCAPS_RESP_FLAGS_EXT2_TX_PKT_TS_CMPL_SUPPORTED ) bp->fw_cap |=BNXT_FW_CAP_TX_TS_CMP ; +if (BNXT_PF (bp) && + (flags_ext2 &FUNC_QCAPS_RESP_FLAGS_EXT2_ROCE_VF_RESOURCE_MGMT_SUPPORTED )) + bp->fw_cap |=BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED ; bp->tx_push_thresh =0 ; if ((flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) &&
drivers/net/ethernet/broadcom/bnxt/bnxt.h +6 -0
@@ -2406,6 +2406,8 @@ struct bnxt {#define BNXT_FW_CAP_DCBX_AGENT BIT_ULL(2)#define BNXT_FW_CAP_NEW_RM BIT_ULL(3)#define BNXT_FW_CAP_IF_CHANGE BIT_ULL(4) +#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_OVS_64BIT_HANDLE BIT_ULL(10)#define BNXT_FW_CAP_TRUSTED_VF BIT_ULL(11)
@@ -2452,6 +2454,10 @@ struct bnxt {#define BNXT_SUPPORTS_QUEUE_API (bp) \ (BNXT_PF(bp) && BNXT_SUPPORTS_NTUPLE_VNIC(bp) && \ ((bp)->fw_cap & BNXT_FW_CAP_VNIC_RE_FLUSH)) +#define BNXT_RDMA_SRIOV_EN (bp) \ + ((bp)->fw_cap & BNXT_FW_CAP_ENABLE_RDMA_SRIOV) +#define BNXT_ROCE_VF_RESC_CAP (bp) \ + ((bp)->fw_cap & BNXT_FW_CAP_ROCE_VF_RESC_MGMT_SUPPORTED)u32 hwrm_spec_code;u16 hwrm_cmd_seq;
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +53 -0
65 lines not on this page · raw message
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 2/3 RDMA/bnxt_re: Enhance RoCE SRIOV resource configuration design
In reply to Selvin XavierFrom: Bhargava Chenna Marreddy <[email protected]>
Refine RoCE SRIOV resource configuration design, using the INITIALIZE_FW's flag as an indication
for the new design to the firmware. RoCE driver does not have to provision resources to VF when firmware advertises support for RoCE resource management by NIC driver.
--- drivers/infiniband/hw/bnxt_re/main.c | 13 ++++++++----- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 ++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 3 +++ drivers/infiniband/hw/bnxt_re/roce_hsi.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h | 1 + 6 files changed, 17 insertions(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +8 -5
@@ -184,6 +184,7 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev) rdev->rcfw.res = &rdev->qplib_res; rdev->qplib_res.dattr = &rdev->dev_attr; rdev->qplib_res.is_vf =BNXT_EN_VF (en_dev); + rdev->qplib_res.en_dev = en_dev;bnxt_re_set_drv_mode (rdev);
@@ -285,6 +286,10 @@ static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev)static void bnxt_re_vf_res_config (struct bnxt_re_dev *rdev) { +/* +* Use the total VF count since the actual VF count may not be +* available at this point. +*/ rdev->num_vfs =pci_sriov_get_totalvfs (rdev->en_dev->pdev);if (!bnxt_qplib_is_chip_gen_p5_p7 (rdev->chip_ctx)) {bnxt_re_set_resource_limits (rdev);
@@ -2056,11 +2061,9 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)INIT_DELAYED_WORK (&rdev->worker, bnxt_re_worker);set_bit (BNXT_RE_FLAG_QOS_WORK_REG , &rdev->flags);schedule_delayed_work (&rdev->worker,msecs_to_jiffies (30000 )); -/* -* Use the total VF count since the actual VF count may not be -* available at this point. -*/ -bnxt_re_vf_res_config (rdev); + +if (!(rdev->qplib_res.en_dev->flags &BNXT_EN_FLAG_ROCE_VF_RES_MGMT )) +bnxt_re_vf_res_config (rdev); }hash_init (rdev->cq_hash);if (rdev->chip_ctx->modes.toggle_bits &BNXT_QPLIB_SRQ_TOGGLE_BIT )
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +2 -0
@@ -910,6 +910,8 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, flags |=CMDQ_INITIALIZE_FW_FLAGS_HW_REQUESTER_RETX_SUPPORTED ;if (_is_optimize_modify_qp_supported (rcfw->res->dattr->dev_cap_flags2)) flags |=CMDQ_INITIALIZE_FW_FLAGS_OPTIMIZE_MODIFY_QP_SUPPORTED ; +if (rcfw->res->en_dev->flags &BNXT_EN_FLAG_ROCE_VF_RES_MGMT ) + flags |=CMDQ_INITIALIZE_FW_FLAGS_L2_VF_RESOURCE_MGMT ; req.flags |=cpu_to_le16 (flags); req.stat_ctx_id =cpu_to_le32 (ctx->stats.fw_id);bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp,NULL ,sizeof (req),sizeof (resp),0 );
drivers/infiniband/hw/bnxt_re/qplib_res.h +3 -0
@@ -39,6 +39,8 @@#ifndef __BNXT_QPLIB_RES_H__#define __BNXT_QPLIB_RES_H__ +#include "bnxt_ulp.h" +extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;#define CHIP_NUM_57508 0x1750
@@ -302,6 +304,7 @@ struct bnxt_qplib_res {struct bnxt_qplib_chip_ctx *cctx;struct bnxt_qplib_dev_attr *dattr;struct net_device *netdev; +struct bnxt_en_dev *en_dev;struct bnxt_qplib_rcfw *rcfw;struct bnxt_qplib_pd_tbl pd_tbl;/* To protect the pd table bit map */
drivers/infiniband/hw/bnxt_re/roce_hsi.h +1 -0
@@ -217,6 +217,7 @@ struct cmdq_initialize_fw {#define CMDQ_INITIALIZE_FW_FLAGS_MRAV_RESERVATION_SPLIT 0x1UL#define CMDQ_INITIALIZE_FW_FLAGS_HW_REQUESTER_RETX_SUPPORTED 0x2UL#define CMDQ_INITIALIZE_FW_FLAGS_OPTIMIZE_MODIFY_QP_SUPPORTED 0x8UL +#define CMDQ_INITIALIZE_FW_FLAGS_L2_VF_RESOURCE_MGMT 0x10UL__le16 cookie;u8 resp_size;u8 reserved8;
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +2 -0
@@ -414,6 +414,8 @@ static void bnxt_set_edev_info(struct bnxt_en_dev *edev, struct bnxt *bp) edev->flags |=BNXT_EN_FLAG_ROCEV2_CAP ;if (bp->flags &BNXT_FLAG_VF ) edev->flags |=BNXT_EN_FLAG_VF ; +if (BNXT_ROCE_VF_RESC_CAP (bp)) + edev->flags |=BNXT_EN_FLAG_ROCE_VF_RES_MGMT ; edev->chip_num = bp->chip_num; edev->hw_ring_stats_size = bp->hw_ring_stats_size;
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h +1 -0
@@ -64,6 +64,7 @@ struct bnxt_en_dev {#define BNXT_EN_FLAG_ULP_STOPPED 0x8#define BNXT_EN_FLAG_VF 0x10#define BNXT_EN_VF (edev) ((edev)->flags & BNXT_EN_FLAG_VF) +#define BNXT_EN_FLAG_ROCE_VF_RES_MGMT 0x20struct bnxt_ulp *ulp_tbl;int l2_db_size;/* Doorbell BAR size in
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 3/3 RDMA/bnxt_re: Add set_func_resources support for P5/P7 adapters
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
Enable set_func_resources for P5 and P7 adapters to handle VF resource distribution. Remove setting max resources per VF during PF initialization. This change is required for firmwares which does not support RoCE VF resource management by NIC driver. The code is same for all adapters now.
--- drivers/infiniband/hw/bnxt_re/main.c | 11 ++++++----- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 11 +---------- 2 files changed, 7 insertions(+), 15 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +6 -5
@@ -291,11 +291,12 @@ static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev)* available at this point. */ rdev->num_vfs =pci_sriov_get_totalvfs (rdev->en_dev->pdev); -if (!bnxt_qplib_is_chip_gen_p5_p7 (rdev->chip_ctx)) { -bnxt_re_set_resource_limits (rdev); -bnxt_qplib_set_func_resources (&rdev->qplib_res, &rdev->rcfw, - &rdev->qplib_ctx); - } +if (!rdev->num_vfs) +return ; + +bnxt_re_set_resource_limits (rdev); +bnxt_qplib_set_func_resources (&rdev->qplib_res, &rdev->rcfw, + &rdev->qplib_ctx); }static void bnxt_re_shutdown (struct auxiliary_device *adev)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +1 -10
@@ -851,10 +851,8 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,* shall setup this area for VF. Skipping the * HW programming */ -if (is_virtfn) +if (is_virtfn ||bnxt_qplib_is_chip_gen_p5_p7 (rcfw->res->cctx)) goto skip_ctx_setup; -if (bnxt_qplib_is_chip_gen_p5_p7 (rcfw->res->cctx)) - goto config_vf_res; lvl = ctx->qpc_tbl.level; pgsz =bnxt_qplib_base_pg_size (&ctx->qpc_tbl);
@@ -898,13 +896,6 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, req.number_of_srq =cpu_to_le32 (ctx->srqc_tbl.max_elements); req.number_of_cq =cpu_to_le32 (ctx->cq_tbl.max_elements); -config_vf_res: - req.max_qp_per_vf =cpu_to_le32 (ctx->vf_res.max_qp_per_vf); - req.max_mrw_per_vf =cpu_to_le32 (ctx->vf_res.max_mrw_per_vf); - req.max_srq_per_vf =cpu_to_le32 (ctx->vf_res.max_srq_per_vf); - req.max_cq_per_vf =cpu_to_le32 (ctx->vf_res.max_cq_per_vf); - req.max_gid_per_vf =cpu_to_le32 (ctx->vf_res.max_gid_per_vf); - skip_ctx_setup:if (BNXT_RE_HW_RETX (rcfw->res->dattr->dev_cap_flags)) flags |=CMDQ_INITIALIZE_FW_FLAGS_HW_REQUESTER_RETX_SUPPORTED ;
Signature · 1 line
2.5.5
Leon Romanovsky
AppliedQuoted 9 lines · Selvin Xavier
Implements the mechanism to distribute the RoCE VF resource based on the active VFs. If the firmware support the feature, NIC driver will distribute the resources for Active VFs. For older Firmware, RoCE driver will continue to distribute the resources across the total number of VFs.
Please review and apply.
[...]
Applied, thanks!
[1/3] bnxt_en: Add support for RoCE sriov configuration
https://git.kernel.org/rdma/rdma/c/53371c5c218f9f [2/3] RDMA/bnxt_re: Enhance RoCE SRIOV resource configuration design https://git.kernel.org/rdma/rdma/c/304cc83807da5f [3/3] RDMA/bnxt_re: Add set_func_resources support for P5/P7 adapters https://git.kernel.org/rdma/rdma/c/cdb21c12adcb9e
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>