From patchwork Mon Apr 13 12:25:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6207711 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 09D92BF4A6 for ; Mon, 13 Apr 2015 12:25:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15F4D20253 for ; Mon, 13 Apr 2015 12:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E10320265 for ; Mon, 13 Apr 2015 12:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752889AbbDMMZW (ORCPT ); Mon, 13 Apr 2015 08:25:22 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37139 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbbDMMZV (ORCPT ); Mon, 13 Apr 2015 08:25:21 -0400 Received: by widdi4 with SMTP id di4so49439421wid.0 for ; Mon, 13 Apr 2015 05:25:20 -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=5IdzffBJnFnV5mXhylVpCOwA3zTAMTJNRjd7YIU3Xvk=; b=YEWOhoJJ+dh9Sbaun94x5xXmb5yRKvNSpf0O45SUkrU24SM8N+3gWzUVKiFWWcxuK5 +njxbVzEtnGeV7Sk8YE6liCNLJKHXXd2R1YxPNIWLdv6atbT5mQebwZL6nKxCMSZazaD hfIXifcS/ZKl/Gf2K5hL0ddfpO8h47uWXkcj8YiTPn8ZA24vmNenFbTW6Y4w0cIUZVwe wHVZ3CPn+4Ejh85GmTuF28yhLHJolGNX8lk49/UlGe02dz3gdpFuvPy5rZ0bj29LquqK 1k8HLmA0EBTkaVaVZk1dtLM9BP2b4MNPs2Y3il2xlXeSpZzqiKVUJLwFxh0YLenuXY3J 1CGA== X-Gm-Message-State: ALoCoQlIsYi4jI7SaI90W5gvzzhIQbrP9mMmWK3AyM/VeiLA6LHtNfvSYa6TZIxPlKTs0C2xa5bn X-Received: by 10.180.93.36 with SMTP id cr4mr20697466wib.61.1428927920046; Mon, 13 Apr 2015 05:25:20 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id gj7sm12595903wib.4.2015.04.13.05.25.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:25:19 -0700 (PDT) Message-ID: <552BB5AC.6050101@profitbricks.com> Date: Mon, 13 Apr 2015 14:25:16 +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 , Michael Wang Subject: [PATCH v3 07/28] IB/Verbs: Reform IB-ulp ipoib References: <552BB470.4090407@profitbricks.com> In-Reply-To: <552BB470.4090407@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=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 IB-ulp ipoib. 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/ulp/ipoib/ipoib_main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 58b5aa3..97372b1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1654,9 +1654,7 @@ static void ipoib_add_one(struct ib_device *device) struct net_device *dev; struct ipoib_dev_priv *priv; int s, e, p; - - if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) - return; + int count = 0; dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); if (!dev_list) @@ -1673,13 +1671,19 @@ static void ipoib_add_one(struct ib_device *device) } for (p = s; p <= e; ++p) { - if (rdma_port_get_link_layer(device, p) != IB_LINK_LAYER_INFINIBAND) + if (!rdma_tech_ib(device, p)) continue; dev = ipoib_add_port("ib%d", device, p); if (!IS_ERR(dev)) { priv = netdev_priv(dev); list_add_tail(&priv->list, dev_list); } + count++; + } + + if (!count) { + kfree(dev_list); + return; } ib_set_client_data(device, &ipoib_client, dev_list); @@ -1690,9 +1694,6 @@ static void ipoib_remove_one(struct ib_device *device) struct ipoib_dev_priv *priv, *tmp; struct list_head *dev_list; - if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) - return; - dev_list = ib_get_client_data(device, &ipoib_client); if (!dev_list) return;