Skip to content

Commit 80c4c25

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "Collected driver fixes from the last few weeks, I was surprised how significant many of them seemed to be. - Fix rdma-core test failures due to wrong startup ordering in rxe - Don't crash in bnxt_re if the FW supports more than 64k QPs - Fix wrong QP table indexing math in bnxt_re - Calculate the max SRQs for userspace properly in bnxt_re - Don't try to do math on errno for mlx5's rate calculation - Properly allow userspace to control the VLAN in the QP state during INIT->RTR for bnxt_re - 6 bug fixes for HNS: - Soft lockup when processing huge MRs, add a cond_resched() - Fix missed error unwind for doorbell allocation - Prevent bad send queue parameters from userspace - Wrong error unwind in qp creation - Missed xa_destroy during driver shutdown - Fix reporting to userspace of max_sge_rd, hns doesn't have a read/write difference" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/hns: Fix wrong value of max_sge_rd RDMA/hns: Fix missing xa_destroy() RDMA/hns: Fix a missing rollback in error path of hns_roce_create_qp_common() RDMA/hns: Fix invalid sq params not being blocked RDMA/hns: Fix unmatched condition in error path of alloc_user_qp_db() RDMA/hns: Fix soft lockup during bt pages loop RDMA/bnxt_re: Avoid clearing VLAN_ID mask in modify qp path RDMA/mlx5: Handle errors returned from mlx5r_ib_rate() RDMA/bnxt_re: Fix reporting maximum SRQs on P7 chips RDMA/bnxt_re: Add missing paranthesis in map_qp_id_to_tbl_indx RDMA/bnxt_re: Fix allocation of QP table RDMA/rxe: Fix the failure of ibv_query_device() and ibv_query_device_ex() tests
2 parents 05b880b + 6b5e41a commit 80c4c25

File tree

16 files changed

+77
-59
lines changed

16 files changed

+77
-59
lines changed

drivers/infiniband/hw/bnxt_re/bnxt_re.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@
5353
#define BNXT_RE_MAX_MR_SIZE_HIGH BIT_ULL(39)
5454
#define BNXT_RE_MAX_MR_SIZE BNXT_RE_MAX_MR_SIZE_HIGH
5555

56-
#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)
57-
#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)
58-
#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
59-
#define BNXT_RE_MAX_CQ_COUNT (64 * 1024)
60-
#define BNXT_RE_MAX_MRW_COUNT_64K (64 * 1024)
61-
#define BNXT_RE_MAX_MRW_COUNT_256K (256 * 1024)
6256

6357
/* Number of MRs to reserve for PF, leaving remainder for VFs */
6458
#define BNXT_RE_RESVD_MR_FOR_PF (32 * 1024)

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,8 +2130,7 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)
21302130
* memory for the function and all child VFs
21312131
*/
21322132
rc = bnxt_qplib_alloc_rcfw_channel(&rdev->qplib_res, &rdev->rcfw,
2133-
&rdev->qplib_ctx,
2134-
BNXT_RE_MAX_QPC_COUNT);
2133+
&rdev->qplib_ctx);
21352134
if (rc) {
21362135
ibdev_err(&rdev->ibdev,
21372136
"Failed to allocate RCFW Channel: %#x\n", rc);

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,6 @@ static void __modify_flags_from_init_state(struct bnxt_qplib_qp *qp)
12171217
qp->path_mtu =
12181218
CMDQ_MODIFY_QP_PATH_MTU_MTU_2048;
12191219
}
1220-
qp->modify_flags &=
1221-
~CMDQ_MODIFY_QP_MODIFY_MASK_VLAN_ID;
12221220
/* Bono FW require the max_dest_rd_atomic to be >= 1 */
12231221
if (qp->max_dest_rd_atomic < 1)
12241222
qp->max_dest_rd_atomic = 1;

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,6 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
915915

916916
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
917917
{
918-
kfree(rcfw->qp_tbl);
919918
kfree(rcfw->crsqe_tbl);
920919
bnxt_qplib_free_hwq(rcfw->res, &rcfw->cmdq.hwq);
921920
bnxt_qplib_free_hwq(rcfw->res, &rcfw->creq.hwq);
@@ -924,8 +923,7 @@ void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)
924923

925924
int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
926925
struct bnxt_qplib_rcfw *rcfw,
927-
struct bnxt_qplib_ctx *ctx,
928-
int qp_tbl_sz)
926+
struct bnxt_qplib_ctx *ctx)
929927
{
930928
struct bnxt_qplib_hwq_attr hwq_attr = {};
931929
struct bnxt_qplib_sg_info sginfo = {};
@@ -969,12 +967,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
969967
if (!rcfw->crsqe_tbl)
970968
goto fail;
971969

972-
/* Allocate one extra to hold the QP1 entries */
973-
rcfw->qp_tbl_size = qp_tbl_sz + 1;
974-
rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
975-
GFP_KERNEL);
976-
if (!rcfw->qp_tbl)
977-
goto fail;
978970
spin_lock_init(&rcfw->tbl_lock);
979971

980972
rcfw->max_timeout = res->cctx->hwrm_cmd_max_timeout;

drivers/infiniband/hw/bnxt_re/qplib_rcfw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ static inline void bnxt_qplib_fill_cmdqmsg(struct bnxt_qplib_cmdqmsg *msg,
262262
void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
263263
int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
264264
struct bnxt_qplib_rcfw *rcfw,
265-
struct bnxt_qplib_ctx *ctx,
266-
int qp_tbl_sz);
265+
struct bnxt_qplib_ctx *ctx);
267266
void bnxt_qplib_rcfw_stop_irq(struct bnxt_qplib_rcfw *rcfw, bool kill);
268267
void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw);
269268
int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector,
@@ -285,9 +284,10 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw);
285284
int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
286285
struct bnxt_qplib_ctx *ctx, int is_virtfn);
287286
void bnxt_qplib_mark_qp_error(void *qp_handle);
287+
288288
static inline u32 map_qp_id_to_tbl_indx(u32 qid, struct bnxt_qplib_rcfw *rcfw)
289289
{
290290
/* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/
291-
return (qid == 1) ? rcfw->qp_tbl_size - 1 : qid % rcfw->qp_tbl_size - 2;
291+
return (qid == 1) ? rcfw->qp_tbl_size - 1 : (qid % (rcfw->qp_tbl_size - 2));
292292
}
293293
#endif /* __BNXT_QPLIB_RCFW_H__ */

drivers/infiniband/hw/bnxt_re/qplib_res.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,19 +871,28 @@ int bnxt_qplib_init_res(struct bnxt_qplib_res *res)
871871

872872
void bnxt_qplib_free_res(struct bnxt_qplib_res *res)
873873
{
874+
kfree(res->rcfw->qp_tbl);
874875
bnxt_qplib_free_sgid_tbl(res, &res->sgid_tbl);
875876
bnxt_qplib_free_pd_tbl(&res->pd_tbl);
876877
bnxt_qplib_free_dpi_tbl(res, &res->dpi_tbl);
877878
}
878879

879880
int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct net_device *netdev)
880881
{
882+
struct bnxt_qplib_rcfw *rcfw = res->rcfw;
881883
struct bnxt_qplib_dev_attr *dev_attr;
882884
int rc;
883885

884886
res->netdev = netdev;
885887
dev_attr = res->dattr;
886888

889+
/* Allocate one extra to hold the QP1 entries */
890+
rcfw->qp_tbl_size = max_t(u32, BNXT_RE_MAX_QPC_COUNT + 1, dev_attr->max_qp);
891+
rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
892+
GFP_KERNEL);
893+
if (!rcfw->qp_tbl)
894+
return -ENOMEM;
895+
887896
rc = bnxt_qplib_alloc_sgid_tbl(res, &res->sgid_tbl, dev_attr->max_sgid);
888897
if (rc)
889898
goto fail;

drivers/infiniband/hw/bnxt_re/qplib_res.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;
4949
#define CHIP_NUM_58818 0xd818
5050
#define CHIP_NUM_57608 0x1760
5151

52+
#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)
53+
#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)
54+
#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
55+
#define BNXT_RE_MAX_CQ_COUNT (64 * 1024)
56+
#define BNXT_RE_MAX_MRW_COUNT_64K (64 * 1024)
57+
#define BNXT_RE_MAX_MRW_COUNT_256K (256 * 1024)
58+
5259
#define BNXT_QPLIB_DBR_VALID (0x1UL << 26)
5360
#define BNXT_QPLIB_DBR_EPOCH_SHIFT 24
5461
#define BNXT_QPLIB_DBR_TOGGLE_SHIFT 25
@@ -600,4 +607,9 @@ static inline bool _is_cq_coalescing_supported(u16 dev_cap_ext_flags2)
600607
return dev_cap_ext_flags2 & CREQ_QUERY_FUNC_RESP_SB_CQ_COALESCING_SUPPORTED;
601608
}
602609

610+
static inline bool _is_max_srq_ext_supported(u16 dev_cap_ext_flags_2)
611+
{
612+
return !!(dev_cap_ext_flags_2 & CREQ_QUERY_FUNC_RESP_SB_MAX_SRQ_EXTENDED);
613+
}
614+
603615
#endif /* __BNXT_QPLIB_RES_H__ */

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw)
176176
attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags);
177177
attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);
178178

179+
if (_is_max_srq_ext_supported(attr->dev_cap_flags2))
180+
attr->max_srq += le16_to_cpu(sb->max_srq_ext);
181+
179182
bnxt_qplib_query_version(rcfw, attr->fw_ver);
180183

181184
for (i = 0; i < MAX_TQM_ALLOC_REQ / 4; i++) {

drivers/infiniband/hw/bnxt_re/roce_hsi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,11 +2215,12 @@ struct creq_query_func_resp_sb {
22152215
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE (0x2UL << 4)
22162216
#define CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_LAST \
22172217
CREQ_QUERY_FUNC_RESP_SB_REQ_RETRANSMISSION_SUPPORT_IQM_MSN_TABLE
2218+
#define CREQ_QUERY_FUNC_RESP_SB_MAX_SRQ_EXTENDED 0x40UL
22182219
#define CREQ_QUERY_FUNC_RESP_SB_MIN_RNR_RTR_RTS_OPT_SUPPORTED 0x1000UL
22192220
__le16 max_xp_qp_size;
22202221
__le16 create_qp_batch_size;
22212222
__le16 destroy_qp_batch_size;
2222-
__le16 reserved16;
2223+
__le16 max_srq_ext;
22232224
__le64 reserved64;
22242225
};
22252226

drivers/infiniband/hw/hns/hns_roce_alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,10 @@ void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev)
175175
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)
176176
ida_destroy(&hr_dev->xrcd_ida.ida);
177177

178-
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ)
178+
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
179179
ida_destroy(&hr_dev->srq_table.srq_ida.ida);
180+
xa_destroy(&hr_dev->srq_table.xa);
181+
}
180182
hns_roce_cleanup_qp_table(hr_dev);
181183
hns_roce_cleanup_cq_table(hr_dev);
182184
ida_destroy(&hr_dev->mr_table.mtpt_ida.ida);

0 commit comments

Comments
 (0)