From patchwork Fri Sep 23 17:44:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 9348541 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 E2689607F2 for ; Fri, 23 Sep 2016 17:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D93712AD55 for ; Fri, 23 Sep 2016 17:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE4782AD59; Fri, 23 Sep 2016 17:44: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 5DFA82AD56 for ; Fri, 23 Sep 2016 17:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934976AbcIWRos (ORCPT ); Fri, 23 Sep 2016 13:44:48 -0400 Received: from mga05.intel.com ([192.55.52.43]:26052 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934778AbcIWRop (ORCPT ); Fri, 23 Sep 2016 13:44:45 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 23 Sep 2016 10:44:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,382,1470726000"; d="scan'208";a="13059162" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga004.jf.intel.com with ESMTP; 23 Sep 2016 10:44:44 -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 u8NHiibm013574; Fri, 23 Sep 2016 13:44:44 -0400 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id u8NHiin0013571; Fri, 23 Sep 2016 13:44:44 -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: Don Hiatt , Dasaratharaman Chandramouli Subject: [RFC PATCH 03/11] IB/sa: Modify SM Address handle to program GRH when using large lids Date: Fri, 23 Sep 2016 13:44:26 -0400 Message-Id: <1474652674-13110-4-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: Don Hiatt When either the port lid or the sm lid is above the ib unicast lid space, the SMI creates an address handle with the revelant GRH information. Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli Signed-off-by: Don Hiatt --- drivers/infiniband/core/sa_query.c | 20 +++++++++++++++++++- include/rdma/ib_addr.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index b9bf7aa055e7..0f5fdfb787fb 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -958,7 +958,6 @@ static void update_sm_ah(struct work_struct *work) pr_err("Couldn't find index for default PKey\n"); memset(&ah_attr, 0, sizeof ah_attr); - ah_attr.dlid = port_attr.sm_lid; ah_attr.sl = port_attr.sm_sl; ah_attr.port_num = port->port_num; if (port_attr.grh_required) { @@ -967,6 +966,25 @@ static void update_sm_ah(struct work_struct *work) ah_attr.grh.dgid.global.interface_id = cpu_to_be64(IB_SA_WELL_KNOWN_GUID); } + if (rdma_cap_opa_ah(port->agent->device, port->port_num)) { + ah_attr.dlid = OPA_TO_IB_UCAST_LID(port_attr.sm_lid); + if ((port_attr.sm_lid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) || + (port_attr.lid >= be16_to_cpu(IB_MULTICAST_LID_BASE))) { + if (port_attr.grh_required) + pr_warn("Overwriting GRH specified in SM AH\n"); + ah_attr.ah_flags = IB_AH_GRH; + ah_attr.grh.hop_limit = 1; + ah_attr.grh.sgid_index = 0; + /* Same prefix as sgid */ + ah_attr.grh.dgid.global.subnet_prefix = + cpu_to_be64(port_attr.subnet_prefix); + ah_attr.grh.dgid.global.interface_id = + OPA_MAKE_ID(port_attr.sm_lid); + } + } else { + ah_attr.dlid = (u16)port_attr.sm_lid; + } + new_ah->ah = ib_create_ah(port->agent->qp->pd, &ah_attr); if (IS_ERR(new_ah->ah)) { pr_warn("Couldn't create new SM AH\n"); diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 04074d7e0763..e6293338dfb1 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h @@ -51,6 +51,8 @@ #define OPA_TO_IB_UCAST_LID(x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ ? 0 : x) +#define OPA_STL_OUI (0x00066AULL) +#define OPA_MAKE_ID(x) (cpu_to_be64(OPA_STL_OUI << 40 | (x))) struct rdma_addr_client { atomic_t refcount;