Skip to content

Commit 95b087f

Browse files
jinpuwangrleon
authored andcommitted
bnxt_re: Fix imm_data endianness
When map a device between servers with MLX and BCM RoCE nics, RTRS server complain about unknown imm type, and can't map the device, After more debug, it seems bnxt_re wrongly handle the imm_data, this patch fixed the compat issue with MLX for us. In off list discussion, Selvin confirmed HW is working in little endian format and all data needs to be converted to LE while providing. This patch fix the endianness for imm_data Fixes: 1ac5a40 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Signed-off-by: Jack Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Selvin Xavier <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 2043a14 commit 95b087f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,7 +2479,7 @@ static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,
24792479
break;
24802480
case IB_WR_SEND_WITH_IMM:
24812481
wqe->type = BNXT_QPLIB_SWQE_TYPE_SEND_WITH_IMM;
2482-
wqe->send.imm_data = wr->ex.imm_data;
2482+
wqe->send.imm_data = be32_to_cpu(wr->ex.imm_data);
24832483
break;
24842484
case IB_WR_SEND_WITH_INV:
24852485
wqe->type = BNXT_QPLIB_SWQE_TYPE_SEND_WITH_INV;
@@ -2509,7 +2509,7 @@ static int bnxt_re_build_rdma_wqe(const struct ib_send_wr *wr,
25092509
break;
25102510
case IB_WR_RDMA_WRITE_WITH_IMM:
25112511
wqe->type = BNXT_QPLIB_SWQE_TYPE_RDMA_WRITE_WITH_IMM;
2512-
wqe->rdma.imm_data = wr->ex.imm_data;
2512+
wqe->rdma.imm_data = be32_to_cpu(wr->ex.imm_data);
25132513
break;
25142514
case IB_WR_RDMA_READ:
25152515
wqe->type = BNXT_QPLIB_SWQE_TYPE_RDMA_READ;
@@ -3582,7 +3582,7 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp,
35823582
wc->byte_len = orig_cqe->length;
35833583
wc->qp = &gsi_qp->ib_qp;
35843584

3585-
wc->ex.imm_data = orig_cqe->immdata;
3585+
wc->ex.imm_data = cpu_to_be32(le32_to_cpu(orig_cqe->immdata));
35863586
wc->src_qp = orig_cqe->src_qp;
35873587
memcpy(wc->smac, orig_cqe->smac, ETH_ALEN);
35883588
if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) {
@@ -3727,7 +3727,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)
37273727
(unsigned long)(cqe->qp_handle),
37283728
struct bnxt_re_qp, qplib_qp);
37293729
wc->qp = &qp->ib_qp;
3730-
wc->ex.imm_data = cqe->immdata;
3730+
wc->ex.imm_data = cpu_to_be32(le32_to_cpu(cqe->immdata));
37313731
wc->src_qp = cqe->src_qp;
37323732
memcpy(wc->smac, cqe->smac, ETH_ALEN);
37333733
wc->port_num = 1;

drivers/infiniband/hw/bnxt_re/qplib_fp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct bnxt_qplib_swqe {
164164
/* Send, with imm, inval key */
165165
struct {
166166
union {
167-
__be32 imm_data;
167+
u32 imm_data;
168168
u32 inv_key;
169169
};
170170
u32 q_key;
@@ -182,7 +182,7 @@ struct bnxt_qplib_swqe {
182182
/* RDMA write, with imm, read */
183183
struct {
184184
union {
185-
__be32 imm_data;
185+
u32 imm_data;
186186
u32 inv_key;
187187
};
188188
u64 remote_va;
@@ -389,7 +389,7 @@ struct bnxt_qplib_cqe {
389389
u16 cfa_meta;
390390
u64 wr_id;
391391
union {
392-
__be32 immdata;
392+
__le32 immdata;
393393
u32 invrkey;
394394
};
395395
u64 qp_handle;

0 commit comments

Comments
 (0)