From patchwork Mon Apr 20 08:38:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6240701 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 7AFC9BF4A6 for ; Mon, 20 Apr 2015 08:38:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9937020361 for ; Mon, 20 Apr 2015 08:38:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B02112035D for ; Mon, 20 Apr 2015 08:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754732AbbDTIix (ORCPT ); Mon, 20 Apr 2015 04:38:53 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:35786 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755178AbbDTIix (ORCPT ); Mon, 20 Apr 2015 04:38:53 -0400 Received: by widdi4 with SMTP id di4so89553102wid.0 for ; Mon, 20 Apr 2015 01:38:52 -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=qFy8452dlkLQIelIVPO4y07WiGCL6zJifE3qAMq9+a4=; b=g/IuVNqNNxedOVZEdUCzjIR4oKQrZ3gcyA/kw3kMUkgy1hx1bP1eR/dLOUfq30vhuI qdoqVN7YFioSbGwInNWvlGMoud9hVhkeJbp256xq09M8NPrikhbr2RymADLP6/zrbGFo aEj81zs1ln19ujkpUg55+Ccv9cs8Y9sd7zRYsPMZ2ve3w1lX3NDqk4VBbC1wKyLdLvNU AnxuPVkEg6l6P6aMeb1SCf257pqaVRlvGxLT3YI3wGzkbZA7aktp141pp1UkqfrM8Hp/ 2rEHKnz/xEaIakg/y/y1cBGrFxupb/KA1qt+qDgCtxleO4SzAp8ZfojYDf38Uca4mcM9 DZJw== X-Gm-Message-State: ALoCoQlM05hubx1d4Rhdp3wUfJtyhYoAXsBJmhS/Cr+8F/ACKNZgF/Iffd2e9PqCrM+/ZdXIBnaK X-Received: by 10.180.19.134 with SMTP id f6mr22971716wie.35.1429519131948; Mon, 20 Apr 2015 01:38:51 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id m4sm26231806wjb.25.2015.04.20.01.38.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 01:38:51 -0700 (PDT) Message-ID: <5534BB19.9000003@profitbricks.com> Date: Mon, 20 Apr 2015 10:38:49 +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 , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, hal@dev.mellanox.co.il CC: Michael Wang , 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 Subject: [PATCH v5 15/27] IB/Verbs: Reform rest part in IB-core cma References: <5534B8C9.506@profitbricks.com> In-Reply-To: <5534B8C9.506@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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK 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 Use raw management helpers to reform rest part in IB-core cma. Cc: Hal Rosenstock Cc: Steve Wise Cc: Tom Talpey Cc: Jason Gunthorpe Cc: Doug Ledford Cc: Ira Weiny Cc: Sean Hefty Signed-off-by: Michael Wang Reviewed-by: Ira Weiny --- drivers/infiniband/core/cma.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 44e7bb9..ec64b97 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -468,10 +468,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; @@ -666,10 +666,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) @@ -733,11 +732,10 @@ 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) - pkey = ib_addr_get_pkey(dev_addr); - else + if (rdma_tech_iboe(id_priv->id.device, id_priv->id.port_num)) pkey = 0xffff; + else + pkey = ib_addr_get_pkey(dev_addr); ret = ib_find_cached_pkey(id_priv->id.device, id_priv->id.port_num, pkey, &qp_attr->pkey_index);