From patchwork Sat Apr 29 18:41:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dasaratharaman Chandramouli X-Patchwork-Id: 9705865 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 E5A7B602BF for ; Sat, 29 Apr 2017 18:41:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA3462807E for ; Sat, 29 Apr 2017 18:41:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF4F128334; Sat, 29 Apr 2017 18:41: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=-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 7EDC62807E for ; Sat, 29 Apr 2017 18:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S376842AbdD2Slw (ORCPT ); Sat, 29 Apr 2017 14:41:52 -0400 Received: from mga05.intel.com ([192.55.52.43]:56330 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S376846AbdD2Sln (ORCPT ); Sat, 29 Apr 2017 14:41:43 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 29 Apr 2017 11:41:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,392,1488873600"; d="scan'208";a="95797362" Received: from phwtpriv01.ph.intel.com ([10.228.208.76]) by fmsmga006.fm.intel.com with ESMTP; 29 Apr 2017 11:41:39 -0700 From: Dasaratharaman Chandramouli To: Doug Ledford Cc: linux-rdma Subject: [PATCH v4 rdma-next 18/18] IB/core: Define 'opa' rdma_ah_attr type Date: Sat, 29 Apr 2017 14:41:30 -0400 Message-Id: <1493491290-31621-19-git-send-email-dasaratharaman.chandramouli@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1493491290-31621-1-git-send-email-dasaratharaman.chandramouli@intel.com> References: <1493491290-31621-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 OPA ah_attr types allows core components to specify attributes that may be specific to opa devices. For instance, opa type ah_attr provides 32 bit lids enabling larger OPA fabric sizes. Reviewed-by: Ira Weiny Reviewed-by: Don Hiatt Reviewed-by: Sean Hefty Signed-off-by: Dasaratharaman Chandramouli --- include/rdma/ib_verbs.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 803927b..f0cb490 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -843,6 +843,7 @@ struct ib_mr_status { enum rdma_ah_attr_type { RDMA_AH_ATTR_TYPE_IB, RDMA_AH_ATTR_TYPE_ROCE, + RDMA_AH_ATTR_TYPE_OPA, }; struct ib_ah_attr { @@ -854,6 +855,11 @@ struct roce_ah_attr { u8 dmac[ETH_ALEN]; }; +struct opa_ah_attr { + u32 dlid; + u8 src_path_bits; +}; + struct rdma_ah_attr { struct ib_global_route grh; u8 sl; @@ -864,6 +870,7 @@ struct rdma_ah_attr { union { struct ib_ah_attr ib; struct roce_ah_attr roce; + struct opa_ah_attr opa; }; }; @@ -3490,16 +3497,20 @@ static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr) return NULL; } -static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u16 dlid) +static inline void rdma_ah_set_dlid(struct rdma_ah_attr *attr, u32 dlid) { if (attr->type == RDMA_AH_ATTR_TYPE_IB) - attr->ib.dlid = dlid; + attr->ib.dlid = (u16)dlid; + else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) + attr->opa.dlid = dlid; } -static inline u16 rdma_ah_get_dlid(const struct rdma_ah_attr *attr) +static inline u32 rdma_ah_get_dlid(const struct rdma_ah_attr *attr) { if (attr->type == RDMA_AH_ATTR_TYPE_IB) return attr->ib.dlid; + else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) + return attr->opa.dlid; return 0; } @@ -3518,12 +3529,16 @@ static inline void rdma_ah_set_path_bits(struct rdma_ah_attr *attr, { if (attr->type == RDMA_AH_ATTR_TYPE_IB) attr->ib.src_path_bits = src_path_bits; + else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) + attr->opa.src_path_bits = src_path_bits; } static inline u8 rdma_ah_get_path_bits(const struct rdma_ah_attr *attr) { if (attr->type == RDMA_AH_ATTR_TYPE_IB) return attr->ib.src_path_bits; + else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) + return attr->opa.src_path_bits; return 0; } @@ -3619,6 +3634,9 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev, if ((rdma_protocol_roce(dev, port_num)) || (rdma_protocol_iwarp(dev, port_num))) return RDMA_AH_ATTR_TYPE_ROCE; + else if ((rdma_protocol_ib(dev, port_num)) && + (rdma_cap_opa_ah(dev, port_num))) + return RDMA_AH_ATTR_TYPE_OPA; else return RDMA_AH_ATTR_TYPE_IB; }