diff options
author | Somnath Kotur <somnath.kotur@broadcom.com> | 2017-11-06 08:07:29 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-11-13 15:53:57 -0500 |
commit | 9b40183c08e48f1d26d06d39f29808c9c6037561 (patch) | |
tree | 377a0f40b396d2b98a65ae0c2c7979527576b1bd /drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | |
parent | 685894dd9bd03b92803fbc72565789713f067d4c (diff) |
RDMA/bnxt_re: Add memory barriers when processing CQ/EQ entries
The code determines if the next ring entry is valid before proceeding
further to read the rest of the entry. The CPU can re-order and read
the rest of the entry first, possibly reading a stale entry, if DMA
of a new entry happens right after reading it.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/bnxt_re/qplib_rcfw.c')
-rw-r--r-- | drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index a7b5de3e193c..bb5574adf195 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -359,6 +359,10 @@ static void bnxt_qplib_service_creq(unsigned long data) creqe = &creq_ptr[get_creq_pg(sw_cons)][get_creq_idx(sw_cons)]; if (!CREQ_CMP_VALID(creqe, raw_cons, creq->max_elements)) break; + /* The valid test of the entry must be done first before + * reading any further. + */ + dma_rmb(); type = creqe->type & CREQ_BASE_TYPE_MASK; switch (type) { |