From patchwork Fri Sep 23 17:44:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 9348557 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 B0100607F2 for ; Fri, 23 Sep 2016 17:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A62D62AB8A for ; Fri, 23 Sep 2016 17:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A7C22AD56; Fri, 23 Sep 2016 17:45:03 +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 2FCCA2AB8A for ; Fri, 23 Sep 2016 17:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966025AbcIWRpB (ORCPT ); Fri, 23 Sep 2016 13:45:01 -0400 Received: from mga03.intel.com ([134.134.136.65]:21423 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966003AbcIWRo5 (ORCPT ); Fri, 23 Sep 2016 13:44:57 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP; 23 Sep 2016 10:44:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,382,1470726000"; d="scan'208";a="12669296" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by orsmga005.jf.intel.com with ESMTP; 23 Sep 2016 10:44:51 -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 u8NHipKe013607; Fri, 23 Sep 2016 13:44:51 -0400 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id u8NHipFM013604; Fri, 23 Sep 2016 13:44:51 -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 08/11] IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA devices Date: Fri, 23 Sep 2016 13:44:31 -0400 Message-Id: <1474652674-13110-9-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 Path record responses will contain the 32 bit LID information in the SGID and DGID field of the responses. Modify IPoIB to use these extended LIDs in datagram and connected mode communication. Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli Signed-off-by: Don Hiatt --- drivers/infiniband/ulp/ipoib/ipoib.h | 4 +++- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 11 +++++++++++ drivers/infiniband/ulp/ipoib/ipoib_main.c | 26 ++++++++++++++++++++++++++ drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 9dbfcc0ab577..448a46bec769 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -352,7 +352,7 @@ struct ipoib_dev_priv { u32 qkey; union ib_gid local_gid; - u16 local_lid; + u32 local_lid; unsigned int admin_mtu; unsigned int mcast_mtu; @@ -421,6 +421,8 @@ struct ipoib_path { struct rb_node rb_node; struct list_head list; int valid; + u32 dlid; + u32 slid; }; struct ipoib_neigh { diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 4ad297d3de89..3499171913ef 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "ipoib.h" @@ -1356,6 +1357,16 @@ static void ipoib_cm_tx_start(struct work_struct *work) } memcpy(&pathrec, &p->path->pathrec, sizeof pathrec); + if (rdma_cap_opa_ah(priv->ca, priv->port)) { + if (p->path->dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) + pathrec.dgid.global.interface_id = + OPA_MAKE_ID(p->path->dlid); + + if (p->path->slid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) + pathrec.sgid.global.interface_id = + OPA_MAKE_ID(p->path->slid); + } + spin_unlock_irqrestore(&priv->lock, flags); netif_tx_unlock_bh(dev); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index cc1c1b062ea5..2bcde9822e3a 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -52,6 +52,7 @@ #include #include #include +#include #define DRV_VERSION "1.0.0" @@ -766,6 +767,31 @@ static void path_rec_completion(int status, spin_lock_irqsave(&priv->lock, flags); if (!IS_ERR_OR_NULL(ah)) { + /* + * Extended LIDs might get programmed into GIDs in the + * case of OPA devices. Since we have created the ah + * above which would have made use of the lids, now is + * a good time to change them back to regular GIDs after + * saving the extended LIDs. + */ + if (rdma_cap_opa_ah(priv->ca, priv->port) && + ib_is_opa_gid(&pathrec->sgid)) { + path->slid = opa_get_lid_from_gid(&pathrec->sgid); + pathrec->sgid = path->pathrec.sgid; + } else { + path->slid = be16_to_cpu(pathrec->slid); + } + + if (rdma_cap_opa_ah(priv->ca, priv->port) && + ib_is_opa_gid(&pathrec->dgid)) { + path->dlid = opa_get_lid_from_gid(&pathrec->dgid); + pathrec->dgid = path->pathrec.dgid; + } else { + path->dlid = be16_to_cpu(pathrec->dlid); + } + ipoib_dbg(priv, "PathRec SGID %pI6 DGID %pI6\n", + pathrec->sgid.raw, pathrec->dgid.raw); + path->pathrec = *pathrec; old_ah = path->ah; diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index bff73b53bff8..d3394b6add24 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -581,7 +581,7 @@ void ipoib_mcast_join_task(struct work_struct *work) port_attr.state); return; } - priv->local_lid = (u16)port_attr.lid; + priv->local_lid = port_attr.lid; netif_addr_lock_bh(dev); if (!test_bit(IPOIB_FLAG_DEV_ADDR_SET, &priv->flags)) {