From patchwork Thu Jan 11 21:43:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10158641 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 619B560170 for ; Thu, 11 Jan 2018 21:43:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F7B728682 for ; Thu, 11 Jan 2018 21:43:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 440E828716; Thu, 11 Jan 2018 21:43:30 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 D360B28682 for ; Thu, 11 Jan 2018 21:43:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932751AbeAKVn2 (ORCPT ); Thu, 11 Jan 2018 16:43:28 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45669 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932472AbeAKVn1 (ORCPT ); Thu, 11 Jan 2018 16:43:27 -0500 Received: by mail-wr0-f194.google.com with SMTP id 16so3561800wry.12 for ; Thu, 11 Jan 2018 13:43:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7pU525IsMsPLVcCtYHT/xQz4tfQ85VI4Y1ad12OlSUs=; b=Ado8Ti6W1vZfBCJTNZlvKwKcQQ3dO0AuTJF7aNJuqS+K+qtEgPi24lCc0EQWBo0DxJ snZ2pF+lJ10GtMyO8ZID21Lk9S+6OAR8LAR+eD3gKxJRNWZQLvjFBOJoHUO79E/YXeuG 7tXehQ/e/7bWhhgcy0WoauIbILevV1VYQZLooJUcskQ+FOQQUwRpeOD6pyoHsFWBDLY1 jk9D2ZTr5jcpGFxpDViR+LSspS51W/G2M+fkIeO+V+tN4m3QjSH/ivRltjmqru2EqKHe 68Wd1ZH05fqXJ8g92OIRmnKpC52m9I5R0kDKF4Mc4vBfNcnMmxF4e64y4JfRR+dOx8n9 vtvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7pU525IsMsPLVcCtYHT/xQz4tfQ85VI4Y1ad12OlSUs=; b=HEvBmsCKIf98j5cRCnAjK4YiLp9bJp3RwddCqje1Qof1cgw+CPKtI5y2HD8nOmPl1N eo5IrlM4bWcIlrRHeXgLls/puSFP9EdyN8sCvMomlivru8SZ4xBmEykmYj4x2QJu/gp8 KsWbhxRa6sWEg9O3xGCkq/gTHYaIc+4XRkciWz3CzIr/stiRm7Q6gH5IPS/MAl52Hqmf l85UsJGFjZr9UfreO5FQtKVAdjUGRpqd60k87Lw2SkhT3SESIH4bmB1kor64PGRihhSl PWcvI58ns6Mv8HVNkfxOhue6kqRjZQIp4d2xlt7wBjRte8gSTvRccYQIWv0vU/p/FHvd p6gQ== X-Gm-Message-State: AKGB3mLi4nqf9Iy8up6tuzYAhBIBaC7Zr6TbjJrP9tL5tDY/KZ8VxLJG ZlVJGEjgS0oqC6Xl5G1AAsk8/j/ReBY= X-Google-Smtp-Source: ACJfBouLSo1jwV2CIbvUn098OTACu91Et4GOLm32ZFvel+DL2i1ZVi0ae0LuosirZATm7tzLgZ24ug== X-Received: by 10.223.162.138 with SMTP id s10mr20291526wra.239.1515707005754; Thu, 11 Jan 2018 13:43:25 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id g41sm7395981wrg.4.2018.01.11.13.43.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 13:43:25 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eZkd8-0000Ai-MY; Thu, 11 Jan 2018 14:43:22 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Lijun Ou , "Wei Hu(Xavier)" Subject: [PATCH 2/3] RDMA/hns: Fix endian problems around imm_data and rkey Date: Thu, 11 Jan 2018 14:43:06 -0700 Message-Id: <20180111214307.501-3-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180111214307.501-1-jgg@ziepe.ca> References: <20180111214307.501-1-jgg@ziepe.ca> 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 From: Jason Gunthorpe This matches the changes made recently to the userspace hns driver when it was made sparse clean. See rdma-core commit bffd380cfe56 ("libhns: Make the provider sparse clean") wc->imm_data is not used in the kernel so this change has no practical impact. Signed-off-by: Jason Gunthorpe --- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 7 ++++--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++--- drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index 939355ede14ab7..833a305085efe1 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c @@ -2311,15 +2311,16 @@ static int hns_roce_v1_poll_one(struct hns_roce_cq *hr_cq, case HNS_ROCE_OPCODE_RDMA_WITH_IMM_RECEIVE: wc->opcode = IB_WC_RECV_RDMA_WITH_IMM; wc->wc_flags = IB_WC_WITH_IMM; - wc->ex.imm_data = le32_to_cpu(cqe->immediate_data); + wc->ex.imm_data = + cpu_to_be32(le32_to_cpu(cqe->immediate_data)); break; case HNS_ROCE_OPCODE_SEND_DATA_RECEIVE: if (roce_get_bit(cqe->cqe_byte_4, CQE_BYTE_4_IMM_INDICATOR_S)) { wc->opcode = IB_WC_RECV; wc->wc_flags = IB_WC_WITH_IMM; - wc->ex.imm_data = le32_to_cpu( - cqe->immediate_data); + wc->ex.imm_data = cpu_to_be32( + le32_to_cpu(cqe->immediate_data)); } else { wc->opcode = IB_WC_RECV; wc->wc_flags = 0; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 2ca35e341d0912..34f13c3cb088c7 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -1709,7 +1709,7 @@ static int hns_roce_v2_poll_one(struct hns_roce_cq *hr_cq, case HNS_ROCE_V2_OPCODE_RDMA_WRITE_IMM: wc->opcode = IB_WC_RECV_RDMA_WITH_IMM; wc->wc_flags = IB_WC_WITH_IMM; - wc->ex.imm_data = le32_to_cpu(cqe->rkey_immtdata); + wc->ex.imm_data = cqe->immtdata; break; case HNS_ROCE_V2_OPCODE_SEND: wc->opcode = IB_WC_RECV; @@ -1718,12 +1718,12 @@ static int hns_roce_v2_poll_one(struct hns_roce_cq *hr_cq, case HNS_ROCE_V2_OPCODE_SEND_WITH_IMM: wc->opcode = IB_WC_RECV; wc->wc_flags = IB_WC_WITH_IMM; - wc->ex.imm_data = le32_to_cpu(cqe->rkey_immtdata); + wc->ex.imm_data = cqe->immtdata; break; case HNS_ROCE_V2_OPCODE_SEND_WITH_INV: wc->opcode = IB_WC_RECV; wc->wc_flags = IB_WC_WITH_INVALIDATE; - wc->ex.invalidate_rkey = cqe->rkey_immtdata; + wc->ex.invalidate_rkey = le32_to_cpu(cqe->rkey); break; default: wc->status = IB_WC_GENERAL_ERR; diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h index 463edab9b7193f..cbf61ad2539c78 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h @@ -762,7 +762,10 @@ struct hns_roce_v2_qp_context { struct hns_roce_v2_cqe { u32 byte_4; - u32 rkey_immtdata; + union { + __le32 rkey; + __be32 immtdata; + }; u32 byte_12; u32 byte_16; u32 byte_cnt;