Skip to content

Commit f3894cf

Browse files
committed
Merge: RDMA/bnxt_re: driver adds missing upstream fixes upto 6.12.
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5771 JIRA: https://issues.redhat.com/browse/RHEL-67317 Add missing upstream fixes for bnxt_re driver from kernel 6.12. Brew: - https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=65893193 Testing: - https://beaker.engineering.redhat.com/jobs/10182682 Signed-off-by: Mohammad Heib <mheib@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: Chris von Recklinghausen <crecklin@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents 367d53d + eacfb7f commit f3894cf

File tree

6 files changed

+43
-45
lines changed

6 files changed

+43
-45
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,
25302530
break;
25312531
case IB_WR_SEND_WITH_IMM:
25322532
wqe->type = BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM;
2533-
wqe->send.imm_data = wr->ex.imm_data;
2533+
wqe->send.imm_data = be32_to_cpu(wr->ex.imm_data);
25342534
break;
25352535
case IB_WR_SEND_WITH_INV:
25362536
wqe->type = BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV;
@@ -2560,7 +2560,7 @@ static int bnxt_re_build_rdma_wqe(const struct ib_send_wr *wr,
25602560
break;
25612561
case IB_WR_RDMA_WRITE_WITH_IMM:
25622562
wqe->type = BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE_WITH_IMM;
2563-
wqe->rdma.imm_data = wr->ex.imm_data;
2563+
wqe->rdma.imm_data = be32_to_cpu(wr->ex.imm_data);
25642564
break;
25652565
case IB_WR_RDMA_READ:
25662566
wqe->type = BNXT_QPLIB_SWQE_TYPE_RDMA_READ;
@@ -3633,7 +3633,7 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp,
36333633
wc->byte_len = orig_cqe->length;
36343634
wc->qp = &gsi_qp->ib_qp;
36353635

3636-
wc->ex.imm_data = orig_cqe->immdata;
3636+
wc->ex.imm_data = cpu_to_be32(orig_cqe->immdata);
36373637
wc->src_qp = orig_cqe->src_qp;
36383638
memcpy(wc->smac, orig_cqe->smac, ETH_ALEN);
36393639
if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) {
@@ -3778,7 +3778,10 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)
37783778
(unsigned long)(cqe->qp_handle),
37793779
struct bnxt_re_qp, qplib_qp);
37803780
wc->qp = &qp->ib_qp;
3781-
wc->ex.imm_data = cqe->immdata;
3781+
if (cqe->flags & CQ_RES_RC_FLAGS_IMM)
3782+
wc->ex.imm_data = cpu_to_be32(cqe->immdata);
3783+
else
3784+
wc->ex.invalidate_rkey = cqe->invrkey;
37823785
wc->src_qp = cqe->src_qp;
37833786
memcpy(wc->smac, cqe->smac, ETH_ALEN);
37843787
wc->port_num = 1;

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,6 @@ static void bnxt_re_shutdown(struct auxiliary_device *adev)
300300
struct bnxt_re_en_dev_info *en_info = auxiliary_get_drvdata(adev);
301301
struct bnxt_re_dev *rdev;
302302

303-
if (!en_info)
304-
return;
305-
306303
rdev = en_info->rdev;
307304
ib_unregister_device(&rdev->ibdev);
308305
bnxt_re_dev_uninit(rdev, BNXT_RE_COMPLETE_REMOVE);
@@ -316,9 +313,6 @@ static void bnxt_re_stop_irq(void *handle)
316313
struct bnxt_qplib_nq *nq;
317314
int indx;
318315

319-
if (!en_info)
320-
return;
321-
322316
rdev = en_info->rdev;
323317
rcfw = &rdev->rcfw;
324318

@@ -339,9 +333,6 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
339333
struct bnxt_qplib_nq *nq;
340334
int indx, rc;
341335

342-
if (!en_info)
343-
return;
344-
345336
rdev = en_info->rdev;
346337
msix_ent = rdev->en_dev->msix_entries;
347338
rcfw = &rdev->rcfw;
@@ -1991,10 +1982,6 @@ static void bnxt_re_remove(struct auxiliary_device *adev)
19911982
struct bnxt_re_dev *rdev;
19921983

19931984
mutex_lock(&bnxt_re_mutex);
1994-
if (!en_info) {
1995-
mutex_unlock(&bnxt_re_mutex);
1996-
return;
1997-
}
19981985
rdev = en_info->rdev;
19991986

20001987
if (rdev)
@@ -2025,7 +2012,15 @@ static int bnxt_re_probe(struct auxiliary_device *adev,
20252012
auxiliary_set_drvdata(adev, en_info);
20262013

20272014
rc = bnxt_re_add_device(adev, BNXT_RE_COMPLETE_INIT);
2015+
if (rc)
2016+
goto err;
20282017
mutex_unlock(&bnxt_re_mutex);
2018+
return 0;
2019+
2020+
err:
2021+
mutex_unlock(&bnxt_re_mutex);
2022+
kfree(en_info);
2023+
20292024
return rc;
20302025
}
20312026

@@ -2035,9 +2030,6 @@ static int bnxt_re_suspend(struct auxiliary_device *adev, pm_message_t state)
20352030
struct bnxt_en_dev *en_dev;
20362031
struct bnxt_re_dev *rdev;
20372032

2038-
if (!en_info)
2039-
return 0;
2040-
20412033
rdev = en_info->rdev;
20422034
en_dev = en_info->en_dev;
20432035
mutex_lock(&bnxt_re_mutex);
@@ -2082,9 +2074,6 @@ static int bnxt_re_resume(struct auxiliary_device *adev)
20822074
struct bnxt_re_en_dev_info *en_info = auxiliary_get_drvdata(adev);
20832075
struct bnxt_re_dev *rdev;
20842076

2085-
if (!en_info)
2086-
return 0;
2087-
20882077
mutex_lock(&bnxt_re_mutex);
20892078
/* L2 driver may invoke this callback during device recovery, resume.
20902079
* reset. Current RoCE driver doesn't recover the device in case of

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,9 +1532,11 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
15321532
u32 tbl_indx;
15331533
int rc;
15341534

1535+
spin_lock_bh(&rcfw->tbl_lock);
15351536
tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw);
15361537
rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID;
15371538
rcfw->qp_tbl[tbl_indx].qp_handle = NULL;
1539+
spin_unlock_bh(&rcfw->tbl_lock);
15381540

15391541
bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
15401542
CMDQ_BASE_OPCODE_DESTROY_QP,
@@ -1545,8 +1547,10 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
15451547
sizeof(resp), 0);
15461548
rc = bnxt_qplib_rcfw_send_message(rcfw, &msg);
15471549
if (rc) {
1550+
spin_lock_bh(&rcfw->tbl_lock);
15481551
rcfw->qp_tbl[tbl_indx].qp_id = qp->id;
15491552
rcfw->qp_tbl[tbl_indx].qp_handle = qp;
1553+
spin_unlock_bh(&rcfw->tbl_lock);
15501554
return rc;
15511555
}
15521556

drivers/infiniband/hw/bnxt_re/qplib_fp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ struct bnxt_qplib_swqe {
165165
/* Send, with imm, inval key */
166166
struct {
167167
union {
168-
__be32 imm_data;
168+
u32 imm_data;
169169
u32 inv_key;
170170
};
171171
u32 q_key;
@@ -183,7 +183,7 @@ struct bnxt_qplib_swqe {
183183
/* RDMA write, with imm, read */
184184
struct {
185185
union {
186-
__be32 imm_data;
186+
u32 imm_data;
187187
u32 inv_key;
188188
};
189189
u64 remote_va;
@@ -391,7 +391,7 @@ struct bnxt_qplib_cqe {
391391
u16 cfa_meta;
392392
u64 wr_id;
393393
union {
394-
__be32 immdata;
394+
u32 immdata;
395395
u32 invrkey;
396396
};
397397
u64 qp_handle;

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
290290
struct bnxt_qplib_hwq *hwq;
291291
u32 sw_prod, cmdq_prod;
292292
struct pci_dev *pdev;
293-
unsigned long flags;
294293
u16 cookie;
295294
u8 *preq;
296295

@@ -301,7 +300,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
301300
/* Cmdq are in 16-byte units, each request can consume 1 or more
302301
* cmdqe
303302
*/
304-
spin_lock_irqsave(&hwq->lock, flags);
303+
spin_lock_bh(&hwq->lock);
305304
required_slots = bnxt_qplib_get_cmd_slots(msg->req);
306305
free_slots = HWQ_FREE_SLOTS(hwq);
307306
cookie = cmdq->seq_num & RCFW_MAX_COOKIE_VALUE;
@@ -311,7 +310,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
311310
dev_info_ratelimited(&pdev->dev,
312311
"CMDQ is full req/free %d/%d!",
313312
required_slots, free_slots);
314-
spin_unlock_irqrestore(&hwq->lock, flags);
313+
spin_unlock_bh(&hwq->lock);
315314
return -EAGAIN;
316315
}
317316
if (msg->block)
@@ -367,7 +366,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
367366
wmb();
368367
writel(cmdq_prod, cmdq->cmdq_mbox.prod);
369368
writel(RCFW_CMDQ_TRIG_VAL, cmdq->cmdq_mbox.db);
370-
spin_unlock_irqrestore(&hwq->lock, flags);
369+
spin_unlock_bh(&hwq->lock);
371370
/* Return the CREQ response pointer */
372371
return 0;
373372
}
@@ -486,7 +485,6 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
486485
{
487486
struct creq_qp_event *evnt = (struct creq_qp_event *)msg->resp;
488487
struct bnxt_qplib_crsqe *crsqe;
489-
unsigned long flags;
490488
u16 cookie;
491489
int rc;
492490
u8 opcode;
@@ -512,12 +510,12 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,
512510
rc = __poll_for_resp(rcfw, cookie);
513511

514512
if (rc) {
515-
spin_lock_irqsave(&rcfw->cmdq.hwq.lock, flags);
513+
spin_lock_bh(&rcfw->cmdq.hwq.lock);
516514
crsqe = &rcfw->crsqe_tbl[cookie];
517515
crsqe->is_waiter_alive = false;
518516
if (rc == -ENODEV)
519517
set_bit(FIRMWARE_STALL_DETECTED, &rcfw->cmdq.flags);
520-
spin_unlock_irqrestore(&rcfw->cmdq.hwq.lock, flags);
518+
spin_unlock_bh(&rcfw->cmdq.hwq.lock);
521519
return -ETIMEDOUT;
522520
}
523521

@@ -628,7 +626,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
628626
u16 cookie, blocked = 0;
629627
bool is_waiter_alive;
630628
struct pci_dev *pdev;
631-
unsigned long flags;
632629
u32 wait_cmds = 0;
633630
int rc = 0;
634631

@@ -637,17 +634,21 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
637634
case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION:
638635
err_event = (struct creq_qp_error_notification *)qp_event;
639636
qp_id = le32_to_cpu(err_event->xid);
637+
spin_lock(&rcfw->tbl_lock);
640638
tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw);
641639
qp = rcfw->qp_tbl[tbl_indx].qp_handle;
640+
if (!qp) {
641+
spin_unlock(&rcfw->tbl_lock);
642+
break;
643+
}
644+
bnxt_qplib_mark_qp_error(qp);
645+
rc = rcfw->creq.aeq_handler(rcfw, qp_event, qp);
646+
spin_unlock(&rcfw->tbl_lock);
642647
dev_dbg(&pdev->dev, "Received QP error notification\n");
643648
dev_dbg(&pdev->dev,
644649
"qpid 0x%x, req_err=0x%x, resp_err=0x%x\n",
645650
qp_id, err_event->req_err_state_reason,
646651
err_event->res_err_state_reason);
647-
if (!qp)
648-
break;
649-
bnxt_qplib_mark_qp_error(qp);
650-
rc = rcfw->creq.aeq_handler(rcfw, qp_event, qp);
651652
break;
652653
default:
653654
/*
@@ -659,8 +660,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
659660
*
660661
*/
661662

662-
spin_lock_irqsave_nested(&hwq->lock, flags,
663-
SINGLE_DEPTH_NESTING);
663+
spin_lock_nested(&hwq->lock, SINGLE_DEPTH_NESTING);
664664
cookie = le16_to_cpu(qp_event->cookie);
665665
blocked = cookie & RCFW_CMD_IS_BLOCKING;
666666
cookie &= RCFW_MAX_COOKIE_VALUE;
@@ -672,7 +672,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
672672
dev_info(&pdev->dev,
673673
"rcfw timedout: cookie = %#x, free_slots = %d",
674674
cookie, crsqe->free_slots);
675-
spin_unlock_irqrestore(&hwq->lock, flags);
675+
spin_unlock(&hwq->lock);
676676
return rc;
677677
}
678678

@@ -720,7 +720,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
720720
__destroy_timedout_ah(rcfw,
721721
(struct creq_create_ah_resp *)
722722
qp_event);
723-
spin_unlock_irqrestore(&hwq->lock, flags);
723+
spin_unlock(&hwq->lock);
724724
}
725725
*num_wait += wait_cmds;
726726
return rc;
@@ -734,12 +734,11 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t)
734734
u32 type, budget = CREQ_ENTRY_POLL_BUDGET;
735735
struct bnxt_qplib_hwq *hwq = &creq->hwq;
736736
struct creq_base *creqe;
737-
unsigned long flags;
738737
u32 num_wakeup = 0;
739738
u32 hw_polled = 0;
740739

741740
/* Service the CREQ until budget is over */
742-
spin_lock_irqsave(&hwq->lock, flags);
741+
spin_lock_bh(&hwq->lock);
743742
while (budget > 0) {
744743
creqe = bnxt_qplib_get_qe(hwq, hwq->cons, NULL);
745744
if (!CREQ_CMP_VALID(creqe, creq->creq_db.dbinfo.flags))
@@ -782,7 +781,7 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t)
782781
if (hw_polled)
783782
bnxt_qplib_ring_nq_db(&creq->creq_db.dbinfo,
784783
rcfw->res->cctx, true);
785-
spin_unlock_irqrestore(&hwq->lock, flags);
784+
spin_unlock_bh(&hwq->lock);
786785
if (num_wakeup)
787786
wake_up_nr(&rcfw->cmdq.waitq, num_wakeup);
788787
}
@@ -978,6 +977,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,
978977
GFP_KERNEL);
979978
if (!rcfw->qp_tbl)
980979
goto fail;
980+
spin_lock_init(&rcfw->tbl_lock);
981981

982982
rcfw->max_timeout = res->cctx->hwrm_cmd_max_timeout;
983983

drivers/infiniband/hw/bnxt_re/qplib_rcfw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ struct bnxt_qplib_rcfw {
224224
struct bnxt_qplib_crsqe *crsqe_tbl;
225225
int qp_tbl_size;
226226
struct bnxt_qplib_qp_node *qp_tbl;
227+
/* To synchronize the qp-handle hash table */
228+
spinlock_t tbl_lock;
227229
u64 oos_prev;
228230
u32 init_oos_stats;
229231
u32 cmdq_depth;

0 commit comments

Comments
 (0)