From patchwork Wed Jul 25 09:03:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 10543727 X-Patchwork-Delegate: leon@leon.nu Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EFCF139A for ; Wed, 25 Jul 2018 09:04:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F08120881 for ; Wed, 25 Jul 2018 09:04:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5397A29BAB; Wed, 25 Jul 2018 09:04:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB62720881 for ; Wed, 25 Jul 2018 09:04:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728637AbeGYKPk (ORCPT ); Wed, 25 Jul 2018 06:15:40 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53769 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728632AbeGYKPk (ORCPT ); Wed, 25 Jul 2018 06:15:40 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 41F8895F7F960; Wed, 25 Jul 2018 17:04:52 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.382.0; Wed, 25 Jul 2018 17:04:48 +0800 From: Lijun Ou To: , , CC: Subject: [PATCH rdma-core 1/2] libhns: Update the data type of immediate data Date: Wed, 25 Jul 2018 17:03:28 +0800 Message-ID: <1532509409-183771-2-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532509409-183771-1-git-send-email-oulijun@huawei.com> References: <1532509409-183771-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 --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;