From patchwork Tue Nov 22 19:38:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dasaratharaman Chandramouli X-Patchwork-Id: 9442025 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 7A383605EE for ; Tue, 22 Nov 2016 19:42:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 690091FF0B for ; Tue, 22 Nov 2016 19:42:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DEB91FF13; Tue, 22 Nov 2016 19:42:47 +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 11C021FF0B for ; Tue, 22 Nov 2016 19:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933970AbcKVTmp (ORCPT ); Tue, 22 Nov 2016 14:42:45 -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 S933961AbcKVTmo (ORCPT ); Tue, 22 Nov 2016 14:42:44 -0500 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 22 Nov 2016 11:42:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,682,1473145200"; d="scan'208";a="33543009" Received: from phwtpriv01.ph.intel.com ([10.228.208.76]) by orsmga004.jf.intel.com with ESMTP; 22 Nov 2016 11:42:42 -0800 From: Dasaratharaman Chandramouli To: Dasaratharaman Chandramouli , Ira Weiny , Don Hiatt , linux-rdma , Doug Ledford Subject: [PATCH v2 08/11] IB/SA: Program extended LID in SM Address handle Date: Tue, 22 Nov 2016 14:38:49 -0500 Message-Id: <1479843532-47496-9-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 Reuse port_attr.grh_required field to let IB SA know that extended LID information needs to be set in the SM Address handle for OPA devices Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli Signed-off-by: Don Hiatt --- drivers/infiniband/core/sa_query.c | 8 +++++++- include/rdma/opa_addr.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 81b742c..d59ee67 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "sa.h" #include "core_priv.h" @@ -964,7 +965,12 @@ static void update_sm_ah(struct work_struct *work) if (port_attr.grh_required) { ah_attr.ah_flags = IB_AH_GRH; ah_attr.grh.dgid.global.subnet_prefix = cpu_to_be64(port_attr.subnet_prefix); - 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.grh.dgid.global.interface_id = + OPA_MAKE_ID(ah_attr.dlid); + else + ah_attr.grh.dgid.global.interface_id = + cpu_to_be64(IB_SA_WELL_KNOWN_GUID); } new_ah->ah = ib_create_ah(port->agent->qp->pd, &ah_attr); diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h index 3e22937..5c713bc 100644 --- a/include/rdma/opa_addr.h +++ b/include/rdma/opa_addr.h @@ -38,6 +38,7 @@ #define OPA_TO_IB_UCAST_LID(x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ ? 0 : x) #define OPA_SPECIAL_OUI (0x00066AULL) +#define OPA_MAKE_ID(x) (cpu_to_be64(OPA_SPECIAL_OUI << 40 | (x))) /** * ib_is_opa_gid: Returns true if the top 24 bits of the gid