Skip to content

Commit 48a5273

Browse files
committed
Merge: RDMA/bnxt_re: add missing fixes from v6.12+.
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6204 JIRA: https://issues.redhat.com/browse/RHEL-74367 Add missing upstream fixes from kernels 6.12+. Brew: - https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=66407609 Signed-off-by: Mohammad Heib <mheib@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Patrick Talbert <ptalbert@redhat.com>
2 parents bc0bacd + 8b312db commit 48a5273

File tree

6 files changed

+69
-81
lines changed

6 files changed

+69
-81
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int bnxt_re_query_device(struct ib_device *ibdev,
156156

157157
ib_attr->vendor_id = rdev->en_dev->pdev->vendor;
158158
ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
159-
ib_attr->hw_ver = rdev->en_dev->pdev->subsystem_device;
159+
ib_attr->hw_ver = rdev->en_dev->pdev->revision;
160160
ib_attr->max_qp = dev_attr->max_qp;
161161
ib_attr->max_qp_wr = dev_attr->max_qp_wqes;
162162
ib_attr->device_cap_flags =
@@ -2107,18 +2107,20 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
21072107
}
21082108
}
21092109

2110-
if (qp_attr_mask & IB_QP_PATH_MTU) {
2111-
qp->qplib_qp.modify_flags |=
2112-
CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU;
2113-
qp->qplib_qp.path_mtu = __from_ib_mtu(qp_attr->path_mtu);
2114-
qp->qplib_qp.mtu = ib_mtu_enum_to_int(qp_attr->path_mtu);
2115-
} else if (qp_attr->qp_state == IB_QPS_RTR) {
2116-
qp->qplib_qp.modify_flags |=
2117-
CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU;
2118-
qp->qplib_qp.path_mtu =
2119-
__from_ib_mtu(iboe_get_mtu(rdev->netdev->mtu));
2120-
qp->qplib_qp.mtu =
2121-
ib_mtu_enum_to_int(iboe_get_mtu(rdev->netdev->mtu));
2110+
if (qp_attr->qp_state == IB_QPS_RTR) {
2111+
enum ib_mtu qpmtu;
2112+
2113+
qpmtu = iboe_get_mtu(rdev->netdev->mtu);
2114+
if (qp_attr_mask & IB_QP_PATH_MTU) {
2115+
if (ib_mtu_enum_to_int(qp_attr->path_mtu) >
2116+
ib_mtu_enum_to_int(qpmtu))
2117+
return -EINVAL;
2118+
qpmtu = qp_attr->path_mtu;
2119+
}
2120+
2121+
qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_PATH_MTU;
2122+
qp->qplib_qp.path_mtu = __from_ib_mtu(qpmtu);
2123+
qp->qplib_qp.mtu = ib_mtu_enum_to_int(qpmtu);
21222124
}
21232125

21242126
if (qp_attr_mask & IB_QP_TIMEOUT) {
@@ -2763,7 +2765,8 @@ static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev,
27632765
wr = wr->next;
27642766
}
27652767
bnxt_qplib_post_send_db(&qp->qplib_qp);
2766-
bnxt_ud_qp_hw_stall_workaround(qp);
2768+
if (!bnxt_qplib_is_chip_gen_p5_p7(qp->rdev->chip_ctx))
2769+
bnxt_ud_qp_hw_stall_workaround(qp);
27672770
spin_unlock_irqrestore(&qp->sq_lock, flags);
27682771
return rc;
27692772
}
@@ -2875,7 +2878,8 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr,
28752878
wr = wr->next;
28762879
}
28772880
bnxt_qplib_post_send_db(&qp->qplib_qp);
2878-
bnxt_ud_qp_hw_stall_workaround(qp);
2881+
if (!bnxt_qplib_is_chip_gen_p5_p7(qp->rdev->chip_ctx))
2882+
bnxt_ud_qp_hw_stall_workaround(qp);
28792883
spin_unlock_irqrestore(&qp->sq_lock, flags);
28802884

28812885
return rc;

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,24 +1435,18 @@ static bool bnxt_re_is_qp1_or_shadow_qp(struct bnxt_re_dev *rdev,
14351435

14361436
static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev)
14371437
{
1438-
int mask = IB_QP_STATE;
1439-
struct ib_qp_attr qp_attr;
14401438
struct bnxt_re_qp *qp;
14411439

1442-
qp_attr.qp_state = IB_QPS_ERR;
14431440
mutex_lock(&rdev->qp_lock);
14441441
list_for_each_entry(qp, &rdev->qp_list, list) {
14451442
/* Modify the state of all QPs except QP1/Shadow QP */
14461443
if (!bnxt_re_is_qp1_or_shadow_qp(rdev, qp)) {
14471444
if (qp->qplib_qp.state !=
14481445
CMDQ_MODIFY_QP_NEW_STATE_RESET &&
14491446
qp->qplib_qp.state !=
1450-
CMDQ_MODIFY_QP_NEW_STATE_ERR) {
1447+
CMDQ_MODIFY_QP_NEW_STATE_ERR)
14511448
bnxt_re_dispatch_event(&rdev->ibdev, &qp->ib_qp,
14521449
1, IB_EVENT_QP_FATAL);
1453-
bnxt_re_modify_qp(&qp->ib_qp, &qp_attr, mask,
1454-
NULL);
1455-
}
14561450
}
14571451
}
14581452
mutex_unlock(&rdev->qp_lock);
@@ -2033,30 +2027,19 @@ static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state)
20332027
rdev = en_info->rdev;
20342028
en_dev = en_info->en_dev;
20352029
mutex_lock(&bnxt_re_mutex);
2036-
/* L2 driver may invoke this callback during device error/crash or device
2037-
* reset. Current RoCE driver doesn't recover the device in case of
2038-
* error. Handle the error by dispatching fatal events to all qps
2039-
* ie. by calling bnxt_re_dev_stop and release the MSIx vectors as
2040-
* L2 driver want to modify the MSIx table.
2041-
*/
20422030

20432031
ibdev_info(&rdev->ibdev, "Handle device suspend call");
20442032
/* Check the current device state from bnxt_en_dev and move the
20452033
* device to detached state if FW_FATAL_COND is set.
20462034
* This prevents more commands to HW during clean-up,
20472035
* in case the device is already in error.
20482036
*/
2049-
if (test_bit(BNXT_STATE_FW_FATAL_COND, &rdev->en_dev->en_state))
2037+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &rdev->en_dev->en_state)) {
20502038
set_bit(ERR_DEVICE_DETACHED, &rdev->rcfw.cmdq.flags);
2051-
2052-
bnxt_re_dev_stop(rdev);
2053-
bnxt_re_stop_irq(adev);
2054-
/* Move the device states to detached and avoid sending any more
2055-
* commands to HW
2056-
*/
2057-
set_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags);
2058-
set_bit(ERR_DEVICE_DETACHED, &rdev->rcfw.cmdq.flags);
2059-
wake_up_all(&rdev->rcfw.cmdq.waitq);
2039+
set_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags);
2040+
wake_up_all(&rdev->rcfw.cmdq.waitq);
2041+
bnxt_re_dev_stop(rdev);
2042+
}
20602043

20612044
if (rdev->pacing.dbr_pacing)
20622045
bnxt_re_set_pacing_dev_state(rdev);
@@ -2075,13 +2058,6 @@ static int bnxt_re_resume(struct auxiliary_device *adev)
20752058
struct bnxt_re_dev *rdev;
20762059

20772060
mutex_lock(&bnxt_re_mutex);
2078-
/* L2 driver may invoke this callback during device recovery, resume.
2079-
* reset. Current RoCE driver doesn't recover the device in case of
2080-
* error. Handle the error by dispatching fatal events to all qps
2081-
* ie. by calling bnxt_re_dev_stop and release the MSIx vectors as
2082-
* L2 driver want to modify the MSIx table.
2083-
*/
2084-
20852061
bnxt_re_add_device(adev, BNXT_RE_POST_RECOVERY_INIT);
20862062
rdev = en_info->rdev;
20872063
ibdev_info(&rdev->ibdev, "Device resume completed");

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,6 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
658658
rc = bnxt_qplib_alloc_init_hwq(&srq->hwq, &hwq_attr);
659659
if (rc)
660660
return rc;
661-
662-
srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
663-
GFP_KERNEL);
664-
if (!srq->swq) {
665-
rc = -ENOMEM;
666-
goto fail;
667-
}
668661
srq->dbinfo.flags = 0;
669662
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
670663
CMDQ_BASE_OPCODE_CREATE_SRQ,
@@ -693,9 +686,17 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
693686
spin_lock_init(&srq->lock);
694687
srq->start_idx = 0;
695688
srq->last_idx = srq->hwq.max_elements - 1;
696-
for (idx = 0; idx < srq->hwq.max_elements; idx++)
697-
srq->swq[idx].next_idx = idx + 1;
698-
srq->swq[srq->last_idx].next_idx = -1;
689+
if (!srq->hwq.is_user) {
690+
srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq),
691+
GFP_KERNEL);
692+
if (!srq->swq) {
693+
rc = -ENOMEM;
694+
goto fail;
695+
}
696+
for (idx = 0; idx < srq->hwq.max_elements; idx++)
697+
srq->swq[idx].next_idx = idx + 1;
698+
srq->swq[srq->last_idx].next_idx = -1;
699+
}
699700

700701
srq->id = le32_to_cpu(resp.xid);
701702
srq->dbinfo.hwq = &srq->hwq;
@@ -999,9 +1000,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
9991000
u32 tbl_indx;
10001001
u16 nsge;
10011002

1002-
if (res->dattr)
1003-
qp->is_host_msn_tbl = _is_host_msn_table(res->dattr->dev_cap_flags2);
1004-
1003+
qp->is_host_msn_tbl = _is_host_msn_table(res->dattr->dev_cap_flags2);
10051004
sq->dbinfo.flags = 0;
10061005
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
10071006
CMDQ_BASE_OPCODE_CREATE_QP,
@@ -1043,13 +1042,14 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
10431042
if (rc)
10441043
return rc;
10451044

1046-
rc = bnxt_qplib_alloc_init_swq(sq);
1047-
if (rc)
1048-
goto fail_sq;
1049-
1050-
if (psn_sz)
1051-
bnxt_qplib_init_psn_ptr(qp, psn_sz);
1045+
if (!sq->hwq.is_user) {
1046+
rc = bnxt_qplib_alloc_init_swq(sq);
1047+
if (rc)
1048+
goto fail_sq;
10521049

1050+
if (psn_sz)
1051+
bnxt_qplib_init_psn_ptr(qp, psn_sz);
1052+
}
10531053
req.sq_size = cpu_to_le32(bnxt_qplib_set_sq_size(sq, qp->wqe_mode));
10541054
pbl = &sq->hwq.pbl[PBL_LVL_0];
10551055
req.sq_pbl = cpu_to_le64(pbl->pg_map_arr[0]);
@@ -1075,9 +1075,11 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
10751075
rc = bnxt_qplib_alloc_init_hwq(&rq->hwq, &hwq_attr);
10761076
if (rc)
10771077
goto sq_swq;
1078-
rc = bnxt_qplib_alloc_init_swq(rq);
1079-
if (rc)
1080-
goto fail_rq;
1078+
if (!rq->hwq.is_user) {
1079+
rc = bnxt_qplib_alloc_init_swq(rq);
1080+
if (rc)
1081+
goto fail_rq;
1082+
}
10811083

10821084
req.rq_size = cpu_to_le32(rq->max_wqe);
10831085
pbl = &rq->hwq.pbl[PBL_LVL_0];
@@ -1173,9 +1175,11 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
11731175
rq->dbinfo.db = qp->dpi->dbr;
11741176
rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size);
11751177
}
1178+
spin_lock_bh(&rcfw->tbl_lock);
11761179
tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
11771180
rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
11781181
rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp;
1182+
spin_unlock_bh(&rcfw->tbl_lock);
11791183

11801184
return 0;
11811185
fail:
@@ -2596,10 +2600,12 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq,
25962600
bnxt_qplib_add_flush_qp(qp);
25972601
} else {
25982602
/* Before we complete, do WA 9060 */
2599-
if (do_wa9060(qp, cq, cq_cons, sq->swq_last,
2600-
cqe_sq_cons)) {
2601-
*lib_qp = qp;
2602-
goto out;
2603+
if (!bnxt_qplib_is_chip_gen_p5_p7(qp->cctx)) {
2604+
if (do_wa9060(qp, cq, cq_cons, sq->swq_last,
2605+
cqe_sq_cons)) {
2606+
*lib_qp = qp;
2607+
goto out;
2608+
}
26032609
}
26042610
if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) {
26052611
cqe->status = CQ_REQ_STATUS_OK;

drivers/infiniband/hw/bnxt_re/qplib_fp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ struct bnxt_qplib_sge {
114114
u32 size;
115115
};
116116

117-
#define BNXT_QPLIB_QP_MAX_SGL 6
118117
struct bnxt_qplib_swq {
119118
u64 wr_id;
120119
int next_idx;
@@ -154,7 +153,7 @@ struct bnxt_qplib_swqe {
154153
#define BNXT_QPLIB_SWQE_FLAGS_UC_FENCE BIT(2)
155154
#define BNXT_QPLIB_SWQE_FLAGS_SOLICIT_EVENT BIT(3)
156155
#define BNXT_QPLIB_SWQE_FLAGS_INLINE BIT(4)
157-
struct bnxt_qplib_sge sg_list[BNXT_QPLIB_QP_MAX_SGL];
156+
struct bnxt_qplib_sge sg_list[BNXT_VAR_MAX_SGE];
158157
int num_sge;
159158
/* Max inline data is 96 bytes */
160159
u32 inline_len;

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,8 @@ static int __send_message_basic_sanity(struct bnxt_qplib_rcfw *rcfw,
424424

425425
/* Prevent posting if f/w is not in a state to process */
426426
if (test_bit(ERR_DEVICE_DETACHED, &rcfw->cmdq.flags))
427-
return bnxt_qplib_map_rc(opcode);
427+
return -ENXIO;
428+
428429
if (test_bit(FIRMWARE_STALL_DETECTED, &cmdq->flags))
429430
return -ETIMEDOUT;
430431

@@ -493,7 +494,7 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
493494

494495
rc = __send_message_basic_sanity(rcfw, msg, opcode);
495496
if (rc)
496-
return rc;
497+
return rc == -ENXIO ? bnxt_qplib_map_rc(opcode) : rc;
497498

498499
rc = __send_message(rcfw, msg, opcode);
499500
if (rc)

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
129129
attr->max_qp_init_rd_atom =
130130
sb->max_qp_init_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ?
131131
BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom;
132-
attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr);
133-
/*
134-
* 128 WQEs needs to be reserved for the HW (8916). Prevent
135-
* reporting the max number
136-
*/
137-
attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS + 1;
132+
attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1;
133+
if (!bnxt_qplib_is_chip_gen_p5_p7(rcfw->res->cctx)) {
134+
/*
135+
* 128 WQEs needs to be reserved for the HW (8916). Prevent
136+
* reporting the max number on legacy devices
137+
*/
138+
attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS + 1;
139+
}
138140

139141
attr->max_qp_sges = cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE ?
140142
min_t(u32, sb->max_sge_var_wqe, BNXT_VAR_MAX_SGE) : 6;

0 commit comments

Comments
 (0)