From patchwork Tue Nov 22 19:38:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dasaratharaman Chandramouli X-Patchwork-Id: 9442013 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 12652605EE for ; Tue, 22 Nov 2016 19:42:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 010711FF0B for ; Tue, 22 Nov 2016 19:42:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA0AF1FF15; Tue, 22 Nov 2016 19:42:41 +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.9 required=2.0 tests=BAYES_00,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 5ACFE1FF0B for ; Tue, 22 Nov 2016 19:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933960AbcKVTmj (ORCPT ); Tue, 22 Nov 2016 14:42:39 -0500 Received: from mga06.intel.com ([134.134.136.31]:62859 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933950AbcKVTmj (ORCPT ); Tue, 22 Nov 2016 14:42:39 -0500 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 22 Nov 2016 11:42:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,682,1473145200"; d="scan'208";a="33542944" Received: from phwtpriv01.ph.intel.com ([10.228.208.76]) by orsmga004.jf.intel.com with ESMTP; 22 Nov 2016 11:42:37 -0800 From: Dasaratharaman Chandramouli To: Dasaratharaman Chandramouli , Ira Weiny , Don Hiatt , linux-rdma , Doug Ledford Subject: [PATCH v2 01/11] IB/core: Add rdma_cap_opa_ah to expose opa address handles Date: Tue, 22 Nov 2016 14:38:42 -0500 Message-Id: <1479843532-47496-2-git-send-email-dasaratharaman.chandramouli@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1479843532-47496-1-git-send-email-dasaratharaman.chandramouli@intel.com> References: <1479843532-47496-1-git-send-email-dasaratharaman.chandramouli@intel.com> 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 rdma_cap_opa_ah(..) enables core components to check if the corresponding port supports extended addresses Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli Signed-off-by: Don Hiatt --- include/rdma/ib_verbs.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 5ad43a4..30fa96e 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -479,6 +479,7 @@ static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct( /* Address format 0x000FF000 */ #define RDMA_CORE_CAP_AF_IB 0x00001000 #define RDMA_CORE_CAP_ETH_AH 0x00002000 +#define RDMA_CORE_CAP_OPA_AH 0x00004000 /* Protocol 0xFFF00000 */ #define RDMA_CORE_CAP_PROT_IB 0x00100000 @@ -2472,6 +2473,26 @@ static inline bool rdma_cap_eth_ah(const struct ib_device *device, u8 port_num) } /** + * rdma_cap_opa_ah - Check if the port of device has the capability + * OPA Address handle + * @device: Device to check + * @port_num: Port number to check + * + * OPA Address handles enable use of 32 bit LIDs by using a specially + * formatted GID field to carry the LID. This check enables kernel + * components to identify such a scheme so that they can then try + * to make use of the LID in the GID field. + * + * Return: true if we are running as a OPA device which enables + * 32 bit LIDs to be used in the fabric. + */ +static inline bool rdma_cap_opa_ah(struct ib_device *device, u8 port_num) +{ + return (device->port_immutable[port_num].core_cap_flags & + RDMA_CORE_CAP_OPA_AH) == RDMA_CORE_CAP_OPA_AH; +} + +/** * rdma_max_mad_size - Return the max MAD size required by this RDMA Port. * * @device: Device