Skip to content

Commit 9fc5f9a

Browse files
selvintxavierrleon
authored andcommitted
RDMA/bnxt_re: Fix the handling of control path response data
Flag that indicate control path command completion should be cleared only after copying the command response data. As soon as the is_in_used flag is clear, the waiting thread can proceed with wrong response data. This wrong data is causing multiple issues like wrong lkey used in data traffic and wrong AH Id etc. Use a memory barrier to ensure that the response data is copied and visible to the process waiting on a different cpu core before clearing the is_in_used flag. Clear the is_in_used after copying the command response. Fixes: bcfee4c ("RDMA/bnxt_re: remove redundant cmdq_bitmap") Signed-off-by: Saravanan Vajravel <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 18126c7 commit 9fc5f9a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
665665
blocked = cookie & RCFW_CMD_IS_BLOCKING;
666666
cookie &= RCFW_MAX_COOKIE_VALUE;
667667
crsqe = &rcfw->crsqe_tbl[cookie];
668-
crsqe->is_in_used = false;
669668

670669
if (WARN_ONCE(test_bit(FIRMWARE_STALL_DETECTED,
671670
&rcfw->cmdq.flags),
@@ -681,8 +680,14 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
681680
atomic_dec(&rcfw->timeout_send);
682681

683682
if (crsqe->is_waiter_alive) {
684-
if (crsqe->resp)
683+
if (crsqe->resp) {
685684
memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
685+
/* Insert write memory barrier to ensure that
686+
* response data is copied before clearing the
687+
* flags
688+
*/
689+
smp_wmb();
690+
}
686691
if (!blocked)
687692
wait_cmds++;
688693
}
@@ -694,6 +699,8 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw,
694699
if (!is_waiter_alive)
695700
crsqe->resp = NULL;
696701

702+
crsqe->is_in_used = false;
703+
697704
hwq->cons += req_size;
698705

699706
/* This is a case to handle below scenario -

0 commit comments

Comments
 (0)