Skip to content

Commit 2df4113

Browse files
chandramohan-akulajgunthorpe
authored andcommitted
RDMA/bnxt_re: Change the sequence of updating the CQ toggle value
Currently the CQ toggle value in the shared page (read by the userlib) is updated as part of the cqn_handler. There is a potential race of application calling the CQ ARM doorbell immediately and using the old toggle value. Change the sequence of updating CQ toggle value to update in the bnxt_qplib_service_nq function immediately after reading the toggle value to be in sync with the HW updated value. Fixes: e275919 ("RDMA/bnxt_re: Share a page to expose per CQ info with userspace") Link: https://patch.msgid.link/r/[email protected] Signed-off-by: Chandramohan Akula <[email protected]> Reviewed-by: Selvin Xavier <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a5e099e commit 2df4113

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,15 +1274,9 @@ static int bnxt_re_cqn_handler(struct bnxt_qplib_nq *nq,
12741274
{
12751275
struct bnxt_re_cq *cq = container_of(handle, struct bnxt_re_cq,
12761276
qplib_cq);
1277-
u32 *cq_ptr;
12781277

1279-
if (cq->ib_cq.comp_handler) {
1280-
if (cq->uctx_cq_page) {
1281-
cq_ptr = (u32 *)cq->uctx_cq_page;
1282-
*cq_ptr = cq->qplib_cq.toggle;
1283-
}
1278+
if (cq->ib_cq.comp_handler)
12841279
(*cq->ib_cq.comp_handler)(&cq->ib_cq, cq->ib_cq.cq_context);
1285-
}
12861280

12871281
return 0;
12881282
}

drivers/infiniband/hw/bnxt_re/qplib_fp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
327327
case NQ_BASE_TYPE_CQ_NOTIFICATION:
328328
{
329329
struct nq_cn *nqcne = (struct nq_cn *)nqe;
330+
struct bnxt_re_cq *cq_p;
330331

331332
q_handle = le32_to_cpu(nqcne->cq_handle_low);
332333
q_handle |= (u64)le32_to_cpu(nqcne->cq_handle_high)
@@ -337,6 +338,10 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t)
337338
cq->toggle = (le16_to_cpu(nqe->info10_type) &
338339
NQ_CN_TOGGLE_MASK) >> NQ_CN_TOGGLE_SFT;
339340
cq->dbinfo.toggle = cq->toggle;
341+
cq_p = container_of(cq, struct bnxt_re_cq, qplib_cq);
342+
if (cq_p->uctx_cq_page)
343+
*((u32 *)cq_p->uctx_cq_page) = cq->toggle;
344+
340345
bnxt_qplib_armen_db(&cq->dbinfo,
341346
DBC_DBC_TYPE_CQ_ARMENA);
342347
spin_lock_bh(&cq->compl_lock);

0 commit comments

Comments
 (0)