RDMA/bnxt_re: Bug fixes
Subsystems (2)
Selvin Xavier
maintainercover RDMA/bnxt_re: Bug fixes
Includes some of the critical fixes found while testing with increased resource limits. Please review and apply.
Thanks,
Selvin Xavier
Kashyap Desai (2):
RDMA/bnxt_re: Fix allocation of QP table RDMA/bnxt_re: Add missing paranthesis in map_qp_id_to_tbl_indx
Preethi G (1):
RDMA/bnxt_re: Fix reporting maximum SRQs on P7 chips
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 6 ------ drivers/infiniband/hw/bnxt_re/main.c | 3 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 10 +--------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 6 +++--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 9 +++++++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 12 ++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 +++ drivers/infiniband/hw/bnxt_re/roce_hsi.h | 3 ++- 8 files changed, 31 insertions(+), 21 deletions(-)
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 1/3 RDMA/bnxt_re: Fix allocation of QP table
From: Kashyap Desai <[email protected]>
Driver is creating QP table too early while probing before querying firmware capabilities. Driver currently is using a hard coded values of 64K as size while creating QP table. This resulted in a crash when firmwre supported QP count is more than 64K.
To fix the issue, move the QP tabel creation after the firmware capabilities are queried. Use the firmware returned maximum value of QPs while creating the QP table.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 6 ------ drivers/infiniband/hw/bnxt_re/main.c | 3 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 10 +--------- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 3 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 9 +++++++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 7 +++++++ 6 files changed, 19 insertions(+), 19 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +0 -6
@@ -53,12 +53,6 @@#define BNXT_RE_MAX_MR_SIZE_HIGH BIT_ULL(39)#define BNXT_RE_MAX_MR_SIZE BNXT_RE_MAX_MR_SIZE_HIGH -#define BNXT_RE_MAX_QPC_COUNT (64 * 1024) -#define BNXT_RE_MAX_MRW_COUNT (64 * 1024) -#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024) -#define BNXT_RE_MAX_CQ_COUNT (64 * 1024) -#define BNXT_RE_MAX_MRW_COUNT_64K (64 * 1024) -#define BNXT_RE_MAX_MRW_COUNT_256K (256 * 1024)/* Number of MRs to reserve for PF, leaving remainder for VFs */ #define BNXT_RE_RESVD_MR_FOR_PF (32 * 1024)
drivers/infiniband/hw/bnxt_re/main.c +1 -2
@@ -2130,8 +2130,7 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)* memory for the function and all child VFs */ rc =bnxt_qplib_alloc_rcfw_channel (&rdev->qplib_res, &rdev->rcfw, - &rdev->qplib_ctx, -BNXT_RE_MAX_QPC_COUNT ); + &rdev->qplib_ctx);if (rc) {ibdev_err (&rdev->ibdev,"Failed to allocate RCFW Channel: %#x\n" , rc);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +1 -9
@@ -915,7 +915,6 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw) { -kfree (rcfw->qp_tbl);kfree (rcfw->crsqe_tbl);bnxt_qplib_free_hwq (rcfw->res, &rcfw->cmdq.hwq);bnxt_qplib_free_hwq (rcfw->res, &rcfw->creq.hwq);
@@ -924,8 +923,7 @@ void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)int bnxt_qplib_alloc_rcfw_channel (struct bnxt_qplib_res *res,struct bnxt_qplib_rcfw *rcfw, -struct bnxt_qplib_ctx *ctx, -int qp_tbl_sz) +struct bnxt_qplib_ctx *ctx) {struct bnxt_qplib_hwq_attr hwq_attr = {};struct bnxt_qplib_sg_info sginfo = {};
@@ -969,12 +967,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,if (!rcfw->crsqe_tbl) goto fail; -/* Allocate one extra to hold the QP1 entries */ - rcfw->qp_tbl_size = qp_tbl_sz +1 ; - rcfw->qp_tbl =kcalloc (rcfw->qp_tbl_size,sizeof (struct bnxt_qplib_qp_node ), -GFP_KERNEL ); -if (!rcfw->qp_tbl) - goto fail;spin_lock_init (&rcfw->tbl_lock); rcfw->max_timeout = res->cctx->hwrm_cmd_max_timeout;
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 -2
@@ -262,8 +262,7 @@ static inline void bnxt_qplib_fill_cmdqmsg(struct bnxt_qplib_cmdqmsg *msg,void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw);int bnxt_qplib_alloc_rcfw_channel (struct bnxt_qplib_res *res,struct bnxt_qplib_rcfw *rcfw, -struct bnxt_qplib_ctx *ctx, -int qp_tbl_sz); +struct bnxt_qplib_ctx *ctx);void bnxt_qplib_rcfw_stop_irq (struct bnxt_qplib_rcfw *rcfw,bool kill);void bnxt_qplib_disable_rcfw_channel (struct bnxt_qplib_rcfw *rcfw); int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,
drivers/infiniband/hw/bnxt_re/qplib_res.c +9 -0
@@ -871,6 +871,7 @@ int bnxt_qplib_init_res(struct bnxt_qplib_res *res)void bnxt_qplib_free_res (struct bnxt_qplib_res *res) { +kfree (res->rcfw->qp_tbl);bnxt_qplib_free_sgid_tbl (res, &res->sgid_tbl);bnxt_qplib_free_pd_tbl (&res->pd_tbl);bnxt_qplib_free_dpi_tbl (res, &res->dpi_tbl);
@@ -878,12 +879,20 @@ void bnxt_qplib_free_res(struct bnxt_qplib_res *res)int bnxt_qplib_alloc_res (struct bnxt_qplib_res *res,struct net_device *netdev) { +struct bnxt_qplib_rcfw *rcfw = res->rcfw;struct bnxt_qplib_dev_attr *dev_attr;int rc; res->netdev = netdev; dev_attr = res->dattr; +/* Allocate one extra to hold the QP1 entries */ + rcfw->qp_tbl_size =max_t (u32,BNXT_RE_MAX_QPC_COUNT +1 , dev_attr->max_qp); + rcfw->qp_tbl =kcalloc (rcfw->qp_tbl_size,sizeof (struct bnxt_qplib_qp_node ), +GFP_KERNEL ); +if (!rcfw->qp_tbl) +return -ENOMEM ; + rc =bnxt_qplib_alloc_sgid_tbl (res, &res->sgid_tbl, dev_attr->max_sgid);if (rc) goto fail;
drivers/infiniband/hw/bnxt_re/qplib_res.h +7 -0
@@ -49,6 +49,13 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;#define CHIP_NUM_58818 0xd818#define CHIP_NUM_57608 0x1760 +#define BNXT_RE_MAX_QPC_COUNT (64 * 1024) +#define BNXT_RE_MAX_MRW_COUNT (64 * 1024) +#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024) +#define BNXT_RE_MAX_CQ_COUNT (64 * 1024) +#define BNXT_RE_MAX_MRW_COUNT_64K (64 * 1024) +#define BNXT_RE_MAX_MRW_COUNT_256K (256 * 1024) +#define BNXT_QPLIB_DBR_VALID (0x1UL << 26)#define BNXT_QPLIB_DBR_EPOCH_SHIFT 24#define BNXT_QPLIB_DBR_TOGGLE_SHIFT 25
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 2/3 RDMA/bnxt_re: Add missing paranthesis in map_qp_id_to_tbl_indx
In reply to Selvin XavierFrom: Kashyap Desai <[email protected]>
The modulo operation returns wrong result without the paranthesis and that resulted in wrong QP table indexing.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +2 -1
@@ -284,9 +284,10 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw);int bnxt_qplib_init_rcfw (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_ctx *ctx,int is_virtfn);void bnxt_qplib_mark_qp_error (void *qp_handle); +static inline u32 map_qp_id_to_tbl_indx (u32 qid,struct bnxt_qplib_rcfw *rcfw) {/* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/ -return (qid ==1 ) ? rcfw->qp_tbl_size -1 : qid % rcfw->qp_tbl_size -2 ; +return (qid ==1 ) ? rcfw->qp_tbl_size -1 : (qid % (rcfw->qp_tbl_size -2 )); }#endif /* __BNXT_QPLIB_RCFW_H__ */
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 3/3 RDMA/bnxt_re: Fix reporting maximum SRQs on P7 chips
In reply to Selvin XavierFrom: Preethi G <[email protected]>
Firmware reports support for additional SRQs in the max_srq_ext field. In CREQ_QUERY_FUNC response, if MAX_SRQ_EXTENDED flag is set, driver should derive the total number of max SRQs by the summation of "max_srq" and "max_srq_ext" fields.
--- drivers/infiniband/hw/bnxt_re/qplib_res.h | 5 +++++ drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 +++ drivers/infiniband/hw/bnxt_re/roce_hsi.h | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/qplib_res.h +5 -0
@@ -607,4 +607,9 @@ static inline bool _is_cq_coalescing_supported(u16 dev_cap_ext_flags2) return dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_CQ_COALESCING_SUPPORTED; } +static inline bool _is_max_srq_ext_supported (u16 dev_cap_ext_flags_2) +{ +return !!(dev_cap_ext_flags_2 &CREQ_QUERY_FUNC_RESP_SB_MAX_SRQ_EXTENDED ); +} +#endif /* __BNXT_QPLIB_RES_H__ */
drivers/infiniband/hw/bnxt_re/qplib_sp.c +3 -0
@@ -176,6 +176,9 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw) attr->dev_cap_flags =le16_to_cpu (sb->dev_cap_flags); attr->dev_cap_flags2 =le16_to_cpu (sb->dev_cap_ext_flags_2); +if (_is_max_srq_ext_supported (attr->dev_cap_flags2)) + attr->max_srq +=le16_to_cpu (sb->max_srq_ext); +bnxt_qplib_query_version (rcfw, attr->fw_ver);for (i =0 ; i <MAX_TQM_ALLOC_REQ /4 ; i++) {
drivers/infiniband/hw/bnxt_re/roce_hsi.h +2 -1
@@ -2215,11 +2215,12 @@ struct creq_query_func_resp_sb {#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE (0x2UL << 4)#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_LAST \ CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE +#define CREQ_QUERY_FUNC_RESP_SB_MAX_SRQ_EXTENDED 0x40UL#define CREQ_QUERY_FUNC_RESP_SB_MIN_RNR_RTR_RTS_OPT_SUPPORTED 0x1000UL__le16 max_xp_qp_size;__le16 create_qp_batch_size;__le16 destroy_qp_batch_size; -__le16 reserved16; +__le16 max_srq_ext;__le64 reserved64; };
Signature · 1 line
2.5.5
Leon Romanovsky
AppliedQuoted 11 lines · Selvin Xavier
Includes some of the critical fixes found while testing with increased resource limits. Please review and apply.
Thanks,
Selvin XavierKashyap Desai (2):
RDMA/bnxt_re: Fix allocation of QP table RDMA/bnxt_re: Add missing paranthesis inmap_qp_id_to_tbl_indx[...]
Applied, thanks!
[1/3] RDMA/bnxt_re: Fix allocation of QP table
https://git.kernel.org/rdma/rdma/c/82f1f575aa13a6 [2/3] RDMA/bnxt_re: Add missing paranthesis in map_qp_id_to_tbl_indx https://git.kernel.org/rdma/rdma/c/67ee8d496511ad [3/3] RDMA/bnxt_re: Fix reporting maximum SRQs on P7 chips https://git.kernel.org/rdma/rdma/c/e8e6087c2f7407
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>