From patchwork Thu Nov 13 19:54:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 5300471 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C7E5C11AC for ; Thu, 13 Nov 2014 19:58:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 215E6201F2 for ; Thu, 13 Nov 2014 19:58:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4627B200C6 for ; Thu, 13 Nov 2014 19:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933781AbaKMT6t (ORCPT ); Thu, 13 Nov 2014 14:58:49 -0500 Received: from mga14.intel.com ([192.55.52.115]:43563 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933146AbaKMT6t (ORCPT ); Thu, 13 Nov 2014 14:58:49 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 13 Nov 2014 11:52:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,379,1413270000"; d="scan'208";a="621992097" Received: from phlsvsds.ph.intel.com ([10.228.195.38]) by fmsmga001.fm.intel.com with ESMTP; 13 Nov 2014 11:58:37 -0800 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 sADJwbfN010118; Thu, 13 Nov 2014 14:58:37 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id sADJwaib010114; Thu, 13 Nov 2014 14:58:36 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, Ira Weiny Subject: [RFC PATCH 03/16] ib/mad: Add check for jumbo MADs support on a device Date: Thu, 13 Nov 2014 14:54:12 -0500 Message-Id: <1415908465-24392-4-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1415908465-24392-1-git-send-email-ira.weiny@intel.com> References: <1415908465-24392-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-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Ira Weiny Check for IB_DEVICE_JUMBO_MAD_SUPPORT in the device capabilities and if supported mark the special QPs created. Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 26 +++++++++++++++++++++++--- drivers/infiniband/core/mad_priv.h | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 4673262..9f5641d 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -2855,7 +2855,8 @@ static void init_mad_queue(struct ib_mad_qp_info *qp_info, } static void init_mad_qp(struct ib_mad_port_private *port_priv, - struct ib_mad_qp_info *qp_info) + struct ib_mad_qp_info *qp_info, + int supports_jumbo_mads) { qp_info->port_priv = port_priv; init_mad_queue(qp_info, &qp_info->send_queue); @@ -2865,6 +2866,7 @@ static void init_mad_qp(struct ib_mad_port_private *port_priv, qp_info->snoop_table = NULL; qp_info->snoop_table_size = 0; atomic_set(&qp_info->snoop_count, 0); + qp_info->supports_jumbo_mads = supports_jumbo_mads; } static int create_mad_qp(struct ib_mad_qp_info *qp_info, @@ -2911,6 +2913,17 @@ static void destroy_mad_qp(struct ib_mad_qp_info *qp_info) kfree(qp_info->snoop_table); } +static int +mad_device_supports_jumbo_mads(struct ib_device *device) +{ + struct ib_device_attr attr; + + if (!ib_query_device(device, &attr)) + return (attr.device_cap_flags + & IB_DEVICE_JUMBO_MAD_SUPPORT); + return 0; +} + /* * Open the port * Create the QP, PD, MR, and CQ if needed @@ -2923,6 +2936,7 @@ static int ib_mad_port_open(struct ib_device *device, unsigned long flags; char name[sizeof "ib_mad123"]; int has_smi; + int supports_jumbo_mads; /* Create new device info */ port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); @@ -2935,8 +2949,14 @@ static int ib_mad_port_open(struct ib_device *device, port_priv->port_num = port_num; spin_lock_init(&port_priv->reg_lock); INIT_LIST_HEAD(&port_priv->agent_list); - init_mad_qp(port_priv, &port_priv->qp_info[0]); - init_mad_qp(port_priv, &port_priv->qp_info[1]); + + supports_jumbo_mads = mad_device_supports_jumbo_mads(device); + if (supports_jumbo_mads) + pr_info("Jumbo MAD support enabled for %s:%d\n", + device->name, port_num); + + init_mad_qp(port_priv, &port_priv->qp_info[0], supports_jumbo_mads); + init_mad_qp(port_priv, &port_priv->qp_info[1], supports_jumbo_mads); cq_size = mad_sendq_size + mad_recvq_size; has_smi = rdma_port_get_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND; diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index d1a0b0e..4b4110d 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h @@ -192,6 +192,7 @@ struct ib_mad_qp_info { struct ib_mad_snoop_private **snoop_table; int snoop_table_size; atomic_t snoop_count; + int supports_jumbo_mads; }; struct ib_mad_port_private {