From patchwork Thu Apr 16 08:10:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6224571 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 9E90B9F1AC for ; Thu, 16 Apr 2015 08:11:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89864201C0 for ; Thu, 16 Apr 2015 08:11:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E6FF20108 for ; Thu, 16 Apr 2015 08:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756975AbbDPIKm (ORCPT ); Thu, 16 Apr 2015 04:10:42 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:36503 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964906AbbDPIKP (ORCPT ); Thu, 16 Apr 2015 04:10:15 -0400 Received: by wizk4 with SMTP id k4so184532410wiz.1 for ; Thu, 16 Apr 2015 01:10:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=55EhC5WqgAD1cb3Ji020T2wh5vQnu9DhF7j27JEC4B8=; b=WQpzjWKxP1ZnbjsBBEK8q1O+MIbZZ+Ocd0DiK/VXo24H2cQjh1CgpkdZ+w/RGJvmvO qkPiTjCMXXpk3AW2GS2OSfTihix4cSL54M5MlRTUvJC6EWf+C/dyfJXTbbfCEn5wWI9H 04CrXW82kesV6XUnJ7MBfkIwxJw07SnnIHlJJslr2LsMHJZa4AgbOmtjuyfMZqtls89t +QMjHAQmqxIgUos9k85BzA4gPzvIfQUPRWabf/h3p8PUUYadCyGgXpdYhPxPZYF3qrLG OBXrzdmvN/IgRJXJ4HGJPjqFh4denGJaEDJVos1+h6A7WI2tL4HHKxLWx8YMwHaByj8d zvjg== X-Gm-Message-State: ALoCoQnJ3w+D70IzrU89dtSthwfmP9gD0LRoSByCJQlXCnJcH9hA/ij1hxk5W9R+CYHQmtiqOqQZ X-Received: by 10.195.11.73 with SMTP id eg9mr56348033wjd.62.1429171813768; Thu, 16 Apr 2015 01:10:13 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id kc4sm9271173wjc.2.2015.04.16.01.10.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2015 01:10:12 -0700 (PDT) Message-ID: <552F6E63.4080709@profitbricks.com> Date: Thu, 16 Apr 2015 10:10:11 +0200 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org CC: Tom Tucker , Steve Wise , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Ira Weiny , Tom Talpey , Jason Gunthorpe , Doug Ledford , hal@dev.mellanox.co.il, Michael Wang Subject: [PATCH v4 15/27] IB/Verbs: Reform rest part in IB-core cma References: <552F6CF2.4000606@profitbricks.com> In-Reply-To: <552F6CF2.4000606@profitbricks.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=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 Use raw management helpers to reform rest part in IB-core cma. Cc: Steve Wise Cc: Tom Talpey Cc: Jason Gunthorpe Cc: Doug Ledford Cc: Ira Weiny Cc: Sean Hefty Signed-off-by: Michael Wang --- drivers/infiniband/core/cma.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 902cc1a..40ca5c6 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -469,10 +469,10 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) pkey = ntohs(addr->sib_pkey); list_for_each_entry(cur_dev, &dev_list, list) { - if (rdma_node_get_transport(cur_dev->device->node_type) != RDMA_TRANSPORT_IB) - continue; - for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { + if (!rdma_ib_or_iboe(cur_dev->device, p)) + continue; + if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index)) continue; @@ -667,10 +667,9 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv, if (ret) goto out; - if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) - == RDMA_TRANSPORT_IB && - rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num) - == IB_LINK_LAYER_ETHERNET) { + BUG_ON(id_priv->cma_dev->device != id_priv->id.device); + + if (rdma_tech_iboe(id_priv->id.device, id_priv->id.port_num)) { ret = rdma_addr_find_smac_by_sgid(&sgid, qp_attr.smac, NULL); if (ret) @@ -734,8 +733,7 @@ static int cma_ib_init_qp_attr(struct rdma_id_private *id_priv, int ret; u16 pkey; - if (rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num) == - IB_LINK_LAYER_INFINIBAND) + if (rdma_tech_ib(id_priv->id.device, id_priv->id.port_num)) pkey = ib_addr_get_pkey(dev_addr); else pkey = 0xffff;