From patchwork Fri Sep 23 17:44:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 9348547 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 69E05607F2 for ; Fri, 23 Sep 2016 17:44:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 609642AD55 for ; Fri, 23 Sep 2016 17:44:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 556F72AD56; Fri, 23 Sep 2016 17:44:58 +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 ED4CB2AB8A for ; Fri, 23 Sep 2016 17:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965989AbcIWRoz (ORCPT ); Fri, 23 Sep 2016 13:44:55 -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 S965874AbcIWRou (ORCPT ); Fri, 23 Sep 2016 13:44:50 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 23 Sep 2016 10:44:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,382,1470726000"; d="scan'208";a="172471882" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by fmsmga004.fm.intel.com with ESMTP; 23 Sep 2016 10:44:42 -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 u8NHigDS013568; Fri, 23 Sep 2016 13:44:42 -0400 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id u8NHigZi013565; Fri, 23 Sep 2016 13:44:42 -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 02/11] IB/core: Change port_attr.sm_lid from 16 to 32 bits Date: Fri, 23 Sep 2016 13:44:25 -0400 Message-Id: <1474652674-13110-3-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 sm_lid field in port_attr is increased to 32 bits. This enables core components to use the larger addresses if needed. The user ABI is unchanged and return 16 bit values when queried. Reviewed-by: Ira Weiny Signed-off-by: Dasaratharaman Chandramouli Signed-off-by: Don Hiatt --- drivers/infiniband/core/uverbs_cmd.c | 6 +++++- drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +- include/rdma/ib_addr.h | 3 +++ include/rdma/ib_verbs.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index f6647318138d..4cb5238edceb 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -39,6 +39,7 @@ #include #include +#include #include "uverbs.h" #include "core_priv.h" @@ -515,7 +516,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.qkey_viol_cntr = attr.qkey_viol_cntr; resp.pkey_tbl_len = attr.pkey_tbl_len; resp.lid = attr.lid; - resp.sm_lid = attr.sm_lid; + if (rdma_cap_opa_ah(ib_dev, cmd.port_num)) + resp.sm_lid = OPA_TO_IB_UCAST_LID(attr.sm_lid); + else + resp.sm_lid = (u16)attr.sm_lid; resp.lmc = attr.lmc; resp.max_vl_num = attr.max_vl_num; resp.sm_sl = attr.sm_sl; diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 883bbfe08e0e..87c911804d62 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -514,7 +514,7 @@ static int srpt_refresh_port(struct srpt_port *sport) if (ret) goto err_query_port; - sport->sm_lid = port_attr.sm_lid; + sport->sm_lid = (u16)port_attr.sm_lid; sport->lid = port_attr.lid; ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid, diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index 931a47ba4571..04074d7e0763 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h @@ -49,6 +49,9 @@ #include #include +#define OPA_TO_IB_UCAST_LID(x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ + ? 0 : x) + struct rdma_addr_client { atomic_t refcount; struct completion comp; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index a57fedbc83ed..b4c070a3ecdf 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -509,7 +509,7 @@ struct ib_port_attr { u32 qkey_viol_cntr; u16 pkey_tbl_len; u16 lid; - u16 sm_lid; + u32 sm_lid; u8 lmc; u8 max_vl_num; u8 sm_sl;