From patchwork Tue Apr 19 12:51:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erez Shitrit X-Patchwork-Id: 8879821 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CAECA9F36E for ; Tue, 19 Apr 2016 12:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CE65420263 for ; Tue, 19 Apr 2016 12:52:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7B43200F2 for ; Tue, 19 Apr 2016 12:52:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754313AbcDSMwH (ORCPT ); Tue, 19 Apr 2016 08:52:07 -0400 Received: from [193.47.165.129] ([193.47.165.129]:51071 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754312AbcDSMwF (ORCPT ); Tue, 19 Apr 2016 08:52:05 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from erezsh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 19 Apr 2016 15:51:34 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u3JCpYVo010065; Tue, 19 Apr 2016 15:51:34 +0300 From: Erez Shitrit To: dledford@redhat.com Cc: ogerlitz@mellanox.com, linux-rdma@vger.kernel.org, Erez Shitrit Subject: [PATCH for-next 1/4] IB/core: Add support for get ClassPortInfo from the SA Date: Tue, 19 Apr 2016 15:51:24 +0300 Message-Id: <1461070287-13469-2-git-send-email-erezsh@mellanox.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1461070287-13469-1-git-send-email-erezsh@mellanox.com> References: <1461070287-13469-1-git-send-email-erezsh@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change struct ib_class_port_info to conform to IB Spec 1.3 That in order to get specific capability mask from ClassPortInfo mad. From the IB Spec, ClassPortInfo section: "CapabilityMask2 Bits 0-26: Additional class-specific capabilities... RespTimeValue the rest 5 bits" The new struct now has one field that contains both of cap_mask2 (which was reserved and resp_time which now is 27 bits for cap_mask2 and 5 bits for resp_time in the new field) More changes to adjust the new structure: IB/qib: Change pma_get_classportinfo IB/srpt: Adjust the use of ib_class_port_info Signed-off-by: Erez Shitrit Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/qib/qib_mad.c | 6 ++++-- drivers/infiniband/ulp/srpt/ib_srpt.c | 5 ++++- include/rdma/ib_mad.h | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 0bd1837..c5d029d 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c @@ -1158,6 +1158,7 @@ static int pma_get_classportinfo(struct ib_pma_mad *pmp, struct ib_class_port_info *p = (struct ib_class_port_info *)pmp->data; struct qib_devdata *dd = dd_from_ibdev(ibdev); + char *p_cap_mask2; memset(pmp->data, 0, sizeof(pmp->data)); @@ -1172,11 +1173,12 @@ static int pma_get_classportinfo(struct ib_pma_mad *pmp, * Set the most significant bit of CM2 to indicate support for * congestion statistics */ - p->reserved[0] = dd->psxmitwait_supported << 7; + p_cap_mask2 = (char *)&p->cap_mask2_resp_time; + p_cap_mask2[0] = dd->psxmitwait_supported << 7; /* * Expected response time is 4.096 usec. * 2^18 == 1.073741824 sec. */ - p->resp_time_value = 18; + p_cap_mask2[3] = 18; return reply((struct ib_smp *) pmp); } diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0bd3cb2..d12b602 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -249,12 +249,15 @@ static void srpt_set_ioc(u8 *c_list, u32 slot, u8 value) static void srpt_get_class_port_info(struct ib_dm_mad *mad) { struct ib_class_port_info *cif; + char *p_cap_mask2; cif = (struct ib_class_port_info *)mad->data; memset(cif, 0, sizeof(*cif)); cif->base_version = 1; cif->class_version = 1; - cif->resp_time_value = 20; + + p_cap_mask2 = (char *)&cif->cap_mask2_resp_time; + p_cap_mask2[3] = 20; mad->mad_hdr.status = 0; } diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index 37dd534c..2aaf1cb 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h @@ -243,8 +243,8 @@ struct ib_class_port_info { u8 base_version; u8 class_version; __be16 capability_mask; - u8 reserved[3]; - u8 resp_time_value; + /* 27 bits for cap_mask2, 5 bits for resp_time */ + __be32 cap_mask2_resp_time; u8 redirect_gid[16]; __be32 redirect_tcslfl; __be16 redirect_lid;