From patchwork Wed Oct 14 08:29:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haggai Eran X-Patchwork-Id: 7391311 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7AB13BEEA4 for ; Wed, 14 Oct 2015 08:30:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 95C2520710 for ; Wed, 14 Oct 2015 08:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A60E207C9 for ; Wed, 14 Oct 2015 08:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751990AbbJNIaJ (ORCPT ); Wed, 14 Oct 2015 04:30:09 -0400 Received: from [193.47.165.129] ([193.47.165.129]:56005 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751501AbbJNIaH (ORCPT ); Wed, 14 Oct 2015 04:30:07 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from haggaie@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 Oct 2015 10:29:44 +0200 Received: from arch003.mtl.labs.mlnx (arch003.mtl.labs.mlnx [10.137.35.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t9E8TitH013937; Wed, 14 Oct 2015 11:29:44 +0300 From: Haggai Eran To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Haggai Eran , Jason Gunthorpe , Hal Rosenstock , Sean Hefty , Or Gerlitz , Eli Cohen Subject: [PATCH 2/6] IB/mad: Add QP parameters to ib_mad_qp_info Date: Wed, 14 Oct 2015 11:29:44 +0300 Message-Id: <1444811388-22486-3-git-send-email-haggaie@mellanox.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1444811388-22486-1-git-send-email-haggaie@mellanox.com> References: <1444811388-22486-1-git-send-email-haggaie@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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 In preparation for having an array of QPs in each ib_mad_qp_info, add the qp_type and qp_num parameters to the ib_mad_qp_info struct so that clients won't need to access the QPs themselves for this information. Signed-off-by: Haggai Eran --- drivers/infiniband/core/mad.c | 16 ++++++++++------ drivers/infiniband/core/mad_priv.h | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 62ce3a4c20b7..7a1186173179 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -1799,7 +1799,7 @@ static int validate_mad(const struct ib_mad_hdr *mad_hdr, bool opa) { int valid = 0; - u32 qp_num = qp_info->qp->qp_num; + u32 qp_num = qp_info->qp_num; /* Make sure MAD base version is understood */ if (mad_hdr->base_version != IB_MGMT_BASE_VERSION && @@ -2054,7 +2054,7 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv &response->grh, wc, port_priv->device, smi_get_fwd_port(smp), - qp_info->qp->qp_num, + qp_info->qp_num, response->mad_size, false); @@ -2142,7 +2142,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv, &response->grh, wc, port_priv->device, opa_smi_get_fwd_port(smp), - qp_info->qp->qp_num, + qp_info->qp_num, recv->header.wc.byte_len, true); @@ -2264,7 +2264,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, &recv->grh, wc, port_priv->device, port_num, - qp_info->qp->qp_num, + qp_info->qp_num, mad_size, opa); goto out; } @@ -2283,7 +2283,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, generate_unmatched_resp(recv, response, &mad_size, opa)) { agent_send_response((const struct ib_mad_hdr *)response->mad, &recv->grh, wc, port_priv->device, port_num, - qp_info->qp->qp_num, mad_size, opa); + qp_info->qp_num, mad_size, opa); } out: @@ -3009,7 +3009,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) */ attr->qp_state = IB_QPS_INIT; attr->pkey_index = pkey_index; - attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; + attr->qkey = (port_priv->qp_info[i].qp_num == 0) ? 0 : + IB_QP1_QKEY; ret = ib_modify_qp(qp, attr, IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_QKEY); if (ret) { @@ -3101,6 +3102,8 @@ static int create_mad_qp(struct ib_mad_qp_info *qp_info, struct ib_qp_init_attr qp_init_attr; int ret; + qp_info->qp_type = qp_type; + memset(&qp_init_attr, 0, sizeof qp_init_attr); qp_init_attr.send_cq = qp_info->port_priv->cq; qp_init_attr.recv_cq = qp_info->port_priv->cq; @@ -3124,6 +3127,7 @@ static int create_mad_qp(struct ib_mad_qp_info *qp_info, /* Use minimum queue sizes unless the CQ is resized */ qp_info->send_queue.max_active = mad_sendq_size; qp_info->recv_queue.max_active = mad_recvq_size; + qp_info->qp_num = qp_info->qp->qp_num; return 0; error: diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index 4a4f7aad0978..ae099f0f9701 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h @@ -191,6 +191,8 @@ struct ib_mad_qp_info { struct ib_mad_snoop_private **snoop_table; int snoop_table_size; atomic_t snoop_count; + enum ib_qp_type qp_type; + u32 qp_num; }; struct ib_mad_port_private {