From patchwork Mon Apr 20 08:35:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6240521 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 63985BF4A6 for ; Mon, 20 Apr 2015 08:35:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EA792035B for ; Mon, 20 Apr 2015 08:35:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A16B82034B for ; Mon, 20 Apr 2015 08:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754989AbbDTIfV (ORCPT ); Mon, 20 Apr 2015 04:35:21 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:35809 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754985AbbDTIfT (ORCPT ); Mon, 20 Apr 2015 04:35:19 -0400 Received: by wgyo15 with SMTP id o15so170794387wgy.2 for ; Mon, 20 Apr 2015 01:35:17 -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=Lki8IJRbQ7hI3pwL8v9RSzv9m8NnO70tqQjZr/WDd6c=; b=hhJkQEpms7Y5KLSPQ9HgsyDmuFYXZoVOvOVpC8GyvviAjSQOhj5N0Z8C9TNLM2wzl7 OsaO7XVeK5iL9ydH/AqvvQfh6tJicmnJJQ1l1zUUBPTk7Iz0Ed1P8twE/KJsJyznfuVA SIiI3OQn5762FEd+f2Zm+B5KJkc2gy41WXhmE+zMtJLC8wJv5pH0xD5B38dkkDlXcJoQ FeDR6oj2rFI6zLS2x4l4+GdIFQO/gEAXLhMja7xcJNWmrLda/StjwOe7/Hv5iQtEXywC kyg7opi3pc1F4XVVO7D4ykw8nTA1MdAna/aIpFM95Xp2yaHE6KF0fs0cBBc5z4pn2Wui XOrg== X-Gm-Message-State: ALoCoQnsepRqeITBwg02Vg3DlowxrpNM+Mt4Zv5HGKh2dhWH+2HSRkV0NYix10OtpvNh2fixC+nl X-Received: by 10.180.216.103 with SMTP id op7mr22768673wic.90.1429518917879; Mon, 20 Apr 2015 01:35:17 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id it5sm14222340wid.3.2015.04.20.01.35.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 01:35:17 -0700 (PDT) Message-ID: <5534BA43.6060400@profitbricks.com> Date: Mon, 20 Apr 2015 10:35:15 +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 07/27] IB/Verbs: Reform IB-ulp ipoib 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=-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 IB-ulp ipoib. 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/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..60b379d 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,15 +1671,21 @@ 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;