diff mbox series

[rdma-core,1/2] libhns: Update the data type of immediate data

Message ID 1532509409-183771-2-git-send-email-oulijun@huawei.com (mailing list archive)
State Not Applicable
Delegated to: Leon Romanovsky
Headers show
Series Two updates for libhns | expand

Commit Message

Lijun Ou July 25, 2018, 9:03 a.m. UTC
Because the data structure of hip08 is little endian,
it need to fix the immediate field of wqe and cqe into
__le32. This patch fixes it.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 providers/hns/hns_roce_u_hw_v2.c | 6 +++---
 providers/hns/hns_roce_u_hw_v2.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 9a1bd49..bc2ef47 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -406,7 +406,7 @@  static int hns_roce_v2_poll_one(struct hns_roce_cq *cq,
 		case HNS_ROCE_RECV_OP_RDMA_WRITE_IMM:
 			wc->opcode = IBV_WC_RECV_RDMA_WITH_IMM;
 			wc->wc_flags = IBV_WC_WITH_IMM;
-			wc->imm_data = cqe->immtdata;
+			wc->imm_data = htobe32(le32toh(cqe->immtdata));
 			break;
 
 		case HNS_ROCE_RECV_OP_SEND:
@@ -417,7 +417,7 @@  static int hns_roce_v2_poll_one(struct hns_roce_cq *cq,
 		case HNS_ROCE_RECV_OP_SEND_WITH_IMM:
 			wc->opcode = IBV_WC_RECV;
 			wc->wc_flags = IBV_WC_WITH_IMM;
-			wc->imm_data = cqe->immtdata;
+			wc->imm_data = htobe32(le32toh(cqe->immtdata));
 			break;
 
 		case HNS_ROCE_RECV_OP_SEND_WITH_INV:
@@ -593,7 +593,7 @@  static int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
 
 		if (wr->opcode == IBV_WR_SEND_WITH_IMM ||
 		    wr->opcode == IBV_WR_RDMA_WRITE_WITH_IMM)
-			rc_sq_wqe->immtdata = wr->imm_data;
+			rc_sq_wqe->immtdata = htole32(be32toh(wr->imm_data));
 
 		roce_set_field(rc_sq_wqe->byte_16, RC_SQ_WQE_BYTE_16_SGE_NUM_M,
 			       RC_SQ_WQE_BYTE_16_SGE_NUM_S, wr->num_sge);
diff --git a/providers/hns/hns_roce_u_hw_v2.h b/providers/hns/hns_roce_u_hw_v2.h
index 73b65bc..0cb264f 100644
--- a/providers/hns/hns_roce_u_hw_v2.h
+++ b/providers/hns/hns_roce_u_hw_v2.h
@@ -173,7 +173,7 @@  struct hns_roce_v2_cqe {
 	__le32	byte_4;
 	union {
 		__le32	rkey;
-		__be32	immtdata;
+		__le32	immtdata;
 	};
 	__le32	byte_12;
 	__le32	byte_16;
@@ -227,7 +227,7 @@  struct hns_roce_rc_sq_wqe {
 	__le32	msg_len;
 	union {
 		__le32	inv_key;
-		__be32	immtdata;
+		__le32	immtdata;
 	};
 	__le32	byte_16;
 	__le32	byte_20;