Skip to content

Commit 43bfc24

Browse files
mustafakismaildledford
authored andcommitted
i40iw: Add missing memory barriers
Remove duplicate set_64bit_val call to offset 24. Replace some instances of set_64bit_val with i40iw_insert_wqe_hdr as valid bit needs a write barrier and should be the last write operation for the WQE. Fixes: 786c6ad ("i40iw: add puda code") Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 1736b4c commit 43bfc24

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

drivers/infiniband/hw/i40iw/i40iw_ctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* @wqe: cqp wqe for header
4949
* @header: header for the cqp wqe
5050
*/
51-
static inline void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
51+
void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
5252
{
5353
wmb(); /* make sure WQE is populated before polarity is set */
5454
set_64bit_val(wqe, 24, header);

drivers/infiniband/hw/i40iw/i40iw_p.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp,
5959
struct i40iw_fast_reg_stag_info *info,
6060
bool post_sq);
6161

62+
void i40iw_insert_wqe_hdr(u64 *wqe, u64 header);
63+
6264
/* HMC/FPM functions */
6365
enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev,
6466
u8 hmc_fn_id);

drivers/infiniband/hw/i40iw/i40iw_puda.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ static void i40iw_puda_post_recvbuf(struct i40iw_puda_rsrc *rsrc, u32 wqe_idx,
123123
get_64bit_val(wqe, 24, &offset24);
124124

125125
offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID);
126-
set_64bit_val(wqe, 24, offset24);
127126

128127
set_64bit_val(wqe, 0, buf->mem.pa);
129128
set_64bit_val(wqe, 8,
130129
LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN));
131-
set_64bit_val(wqe, 24, offset24);
130+
i40iw_insert_wqe_hdr(wqe, offset24);
132131
}
133132

134133
/**
@@ -409,9 +408,7 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp,
409408
set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN));
410409
set_64bit_val(wqe, 16, header[0]);
411410

412-
/* Ensure all data is written before writing valid bit */
413-
wmb();
414-
set_64bit_val(wqe, 24, header[1]);
411+
i40iw_insert_wqe_hdr(wqe, header[1]);
415412

416413
i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32);
417414
i40iw_qp_post_wr(&qp->qp_uk);
@@ -539,7 +536,7 @@ static enum i40iw_status_code i40iw_puda_qp_wqe(struct i40iw_sc_dev *dev, struct
539536
LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) |
540537
LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
541538

542-
set_64bit_val(wqe, 24, header);
539+
i40iw_insert_wqe_hdr(wqe, header);
543540

544541
i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32);
545542
i40iw_sc_cqp_post_sq(cqp);
@@ -655,7 +652,7 @@ static enum i40iw_status_code i40iw_puda_cq_wqe(struct i40iw_sc_dev *dev, struct
655652
LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) |
656653
LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) |
657654
LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
658-
set_64bit_val(wqe, 24, header);
655+
i40iw_insert_wqe_hdr(wqe, header);
659656

660657
i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE",
661658
wqe, I40IW_CQP_WQE_SIZE * 8);

0 commit comments

Comments
 (0)