From patchwork Mon Jul 2 17:06:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10502115 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 1A4B760284 for ; Mon, 2 Jul 2018 17:06:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0015928D58 for ; Mon, 2 Jul 2018 17:06:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E550128D61; Mon, 2 Jul 2018 17:06:54 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 7E9DB28D58 for ; Mon, 2 Jul 2018 17:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752069AbeGBRGx (ORCPT ); Mon, 2 Jul 2018 13:06:53 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:10307 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042AbeGBRGw (ORCPT ); Mon, 2 Jul 2018 13:06:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530551213; x=1562087213; h=from:to:cc:subject:date:message-id; bh=gneNgY6G7/cV03x0L9QxHZpzpeoeyzyqo9u1F6jU0AE=; b=YO/w5gAsqkVhE4Lgi/8lmhUcn9OordMRMbvtZ7CX2U8sCqvpwU/E+ZJm gq5F37oMSpI0EjfTFAjnNiTpDkcK906/CcKHqZy9gevERS8upCLuo0Tfq xAOPhdVmCPkbzVVfNdMROMo2VGCfDbBlM7bAZH/znmv9ewUssjtji7a34 d8kSmk4/vWCBsVyic/dOnbEXzOVCzK7E08UQD8dWoemwxrKDjwojnCTt2 rpufcBi9clPmOYXKQdtfgwXPmCUJsdgBZHjyprf8dPLKyGUG9CduhYRh1 VOZsy2M7QYcyNP78OYxlDr03kG3kaTxOIMIAGCAaJ4xru7959FSrb5YkQ Q==; X-IronPort-AV: E=Sophos;i="5.51,299,1526313600"; d="scan'208";a="82861182" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2018 01:06:53 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jul 2018 09:55:57 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Jul 2018 10:06:52 -0700 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche , Venkata Sandeep Dhanalakota , Mike Marciniszyn , Dennis Dalessandro Subject: [PATCH] include/rdma/opa_addr.h: Fix an endianness issue Date: Mon, 2 Jul 2018 10:06:51 -0700 Message-Id: <20180702170651.9062-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 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 IB_MULTICAST_LID_BASE is defined as follows: #define IB_MULTICAST_LID_BASE cpu_to_be16(0xC000) Hence use be16_to_cpu() to convert it to CPU endianness. Compile-tested only. Fixes: af808ece5ce9 ("IB/SA: Check dlid before SA agent queries for ClassPortInfo") Signed-off-by: Bart Van Assche Cc: Venkata Sandeep Dhanalakota Cc: Mike Marciniszyn Cc: Dennis Dalessandro --- include/rdma/opa_addr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h index 2bbb7a67e643..66d4393d339c 100644 --- a/include/rdma/opa_addr.h +++ b/include/rdma/opa_addr.h @@ -120,7 +120,7 @@ static inline bool rdma_is_valid_unicast_lid(struct rdma_ah_attr *attr) if (attr->type == RDMA_AH_ATTR_TYPE_IB) { if (!rdma_ah_get_dlid(attr) || rdma_ah_get_dlid(attr) >= - be32_to_cpu(IB_MULTICAST_LID_BASE)) + be16_to_cpu(IB_MULTICAST_LID_BASE)) return false; } else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) { if (!rdma_ah_get_dlid(attr) ||