From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam01on0107.outbound.protection.outlook.com ([104.47.34.107]:36283 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726195AbeIBRWE (ORCPT ); Sun, 2 Sep 2018 13:22:04 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Lijun Ou , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL 4.18 127/131] RDMA/hns: Update the data type of immediate data Date: Sun, 2 Sep 2018 13:05:42 +0000 Message-ID: <20180902064601.183036-127-alexander.levin@microsoft.com> References: <20180902064601.183036-1-alexander.levin@microsoft.com> In-Reply-To: <20180902064601.183036-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Lijun Ou [ Upstream commit 0c4a0e2987a51415de73180ce9f389a99b3dddd1 ] Because the data structure of hip08 is little endian, it needs to fix the immediate field of wqe and cqe into __le32. Signed-off-by: Lijun Ou Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 12 ++++++++---- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniban= d/hw/hns/hns_roce_hw_v2.c index a6e11be0ea0f..c00925ed9da8 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -273,7 +273,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, st= ruct ib_send_wr *wr, switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: case IB_WR_RDMA_WRITE_WITH_IMM: - ud_sq_wqe->immtdata =3D wr->ex.imm_data; + ud_sq_wqe->immtdata =3D + cpu_to_le32(be32_to_cpu(wr->ex.imm_data)); break; default: ud_sq_wqe->immtdata =3D 0; @@ -371,7 +372,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, st= ruct ib_send_wr *wr, switch (wr->opcode) { case IB_WR_SEND_WITH_IMM: case IB_WR_RDMA_WRITE_WITH_IMM: - rc_sq_wqe->immtdata =3D wr->ex.imm_data; + rc_sq_wqe->immtdata =3D + cpu_to_le32(be32_to_cpu(wr->ex.imm_data)); break; case IB_WR_SEND_WITH_INV: rc_sq_wqe->inv_key =3D @@ -1931,7 +1933,8 @@ static int hns_roce_v2_poll_one(struct hns_roce_cq *h= r_cq, case HNS_ROCE_V2_OPCODE_RDMA_WRITE_IMM: wc->opcode =3D IB_WC_RECV_RDMA_WITH_IMM; wc->wc_flags =3D IB_WC_WITH_IMM; - wc->ex.imm_data =3D cqe->immtdata; + wc->ex.imm_data =3D + cpu_to_be32(le32_to_cpu(cqe->immtdata)); break; case HNS_ROCE_V2_OPCODE_SEND: wc->opcode =3D IB_WC_RECV; @@ -1940,7 +1943,8 @@ static int hns_roce_v2_poll_one(struct hns_roce_cq *h= r_cq, case HNS_ROCE_V2_OPCODE_SEND_WITH_IMM: wc->opcode =3D IB_WC_RECV; wc->wc_flags =3D IB_WC_WITH_IMM; - wc->ex.imm_data =3D cqe->immtdata; + wc->ex.imm_data =3D + cpu_to_be32(le32_to_cpu(cqe->immtdata)); break; case HNS_ROCE_V2_OPCODE_SEND_WITH_INV: wc->opcode =3D IB_WC_RECV; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniban= d/hw/hns/hns_roce_hw_v2.h index d47675f365c7..7e2c740e0df5 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h @@ -768,7 +768,7 @@ struct hns_roce_v2_cqe { __le32 byte_4; union { __le32 rkey; - __be32 immtdata; + __le32 immtdata; }; __le32 byte_12; __le32 byte_16; @@ -926,7 +926,7 @@ struct hns_roce_v2_cq_db { struct hns_roce_v2_ud_send_wqe { __le32 byte_4; __le32 msg_len; - __be32 immtdata; + __le32 immtdata; __le32 byte_16; __le32 byte_20; __le32 byte_24; @@ -1012,7 +1012,7 @@ struct hns_roce_v2_rc_send_wqe { __le32 msg_len; union { __le32 inv_key; - __be32 immtdata; + __le32 immtdata; }; __le32 byte_16; __le32 byte_20; --=20 2.17.1