From patchwork Tue Apr 28 15:10:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6290321 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 658019F4F5 for ; Tue, 28 Apr 2015 15:14:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B08C20222 for ; Tue, 28 Apr 2015 15:14:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EA9920218 for ; Tue, 28 Apr 2015 15:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030410AbbD1PK7 (ORCPT ); Tue, 28 Apr 2015 11:10:59 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:36100 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030394AbbD1PK4 (ORCPT ); Tue, 28 Apr 2015 11:10:56 -0400 Received: by wizk4 with SMTP id k4so144626863wiz.1 for ; Tue, 28 Apr 2015 08:10:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CkF5nsvxiGt9fmG0qNaEj6rMqheOnhOBxDIHxWq2B2s=; b=bdWFjx58rsn2JVbdoldNTFA0tpPUuEh3/Dwu8WaO51QHBzoeuHVvFSisKaMQ2LOEEi YmOZN+CamjHCWC3vwBhhhva+9AXc6ncu8cFA1IsKXxllwE8s+HP9U9BXEQz/zExPeiXy 8JkdF5k/F9FkJGlzJEkgJQmgClx1LzSKVvs1nGlipcewzir+lRhljUB031vLE2+HRe27 B7xkym/couyxJqbA/Lov74wYLG6SsvONrqzFa0FqNM0mYw0DVoOfK4hYg9jQw1YaSSn3 v8aflzf711wI/CyMTdaG00CGOhIIEQIJ7qMx6Zwywc/PWWYEyJlX8MympAO3nOYsqFx0 +A3Q== X-Gm-Message-State: ALoCoQnjdTqTsAIi7HzWaG04N2qTTN7VSIb2toC1m7jWmS7aFQbHHqscFm8NigplbngEvzlMRdI9 X-Received: by 10.194.2.47 with SMTP id 15mr33529800wjr.101.1430233855377; Tue, 28 Apr 2015 08:10:55 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id be3sm16820459wib.21.2015.04.28.08.10.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Apr 2015 08:10:54 -0700 (PDT) From: Michael Wang To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Wang , Steve Wise , Tom Talpey , Jason Gunthorpe , Doug Ledford , Ira Weiny , Tom Tucker , Hoang-Nam Nguyen , Christoph Raisch , Mike Marciniszyn , Eli Cohen , Faisal Latif , Jack Morgenstein , Or Gerlitz , Haggai Eran , Devesh Sharma , Liran Liss , Dave Goodell Subject: [PATCH v7 14/23] IB/Verbs: Reform rest part in IB-core cma Date: Tue, 28 Apr 2015 17:10:14 +0200 Message-Id: <1430233823-7075-15-git-send-email-yun.wang@profitbricks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430233823-7075-1-git-send-email-yun.wang@profitbricks.com> References: <1430233823-7075-1-git-send-email-yun.wang@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: 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 --- 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 3fb3458..d43f492f 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -447,10 +447,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; @@ -645,10 +645,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_protocol_iboe(id_priv->id.device, id_priv->id.port_num)) { ret = rdma_addr_find_smac_by_sgid(&sgid, qp_attr.smac, NULL); if (ret) @@ -712,11 +711,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_protocol_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);