From patchwork Fri Sep 23 17:44:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 9348537 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 EA313607F2 for ; Fri, 23 Sep 2016 17:44:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1CA22AD55 for ; Fri, 23 Sep 2016 17:44:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D67BC2AD5B; Fri, 23 Sep 2016 17:44:53 +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 3AA482AD55 for ; Fri, 23 Sep 2016 17:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934960AbcIWRoq (ORCPT ); Fri, 23 Sep 2016 13:44:46 -0400 Received: from mga07.intel.com ([134.134.136.100]:62699 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965874AbcIWRon (ORCPT ); Fri, 23 Sep 2016 13:44:43 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 23 Sep 2016 10:44:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,382,1470726000"; d="scan'208";a="883144397" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga003.jf.intel.com with ESMTP; 23 Sep 2016 10:44:41 -0700 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id u8NHifZW013562; Fri, 23 Sep 2016 13:44:41 -0400 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id u8NHifx5013559; Fri, 23 Sep 2016 13:44:41 -0400 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Dasaratharaman Chandramouli , Don Hiatt Subject: [RFC PATCH 01/11] IB/core: Add rdma_cap_opa_ah to expose opa address handles Date: Fri, 23 Sep 2016 13:44:24 -0400 Message-Id: <1474652674-13110-2-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1474652674-13110-1-git-send-email-ira.weiny@intel.com> References: <1474652674-13110-1-git-send-email-ira.weiny@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 From: Dasaratharaman Chandramouli 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 e1f96737c2a1..a57fedbc83ed 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -467,6 +467,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 @@ -2418,6 +2419,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