From patchwork Thu Apr 16 08:07:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6224371 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 9A9319F1AC for ; Thu, 16 Apr 2015 08:07:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9378201C0 for ; Thu, 16 Apr 2015 08:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B7F45200CF for ; Thu, 16 Apr 2015 08:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933661AbbDPIHS (ORCPT ); Thu, 16 Apr 2015 04:07:18 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:36373 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964880AbbDPIHI (ORCPT ); Thu, 16 Apr 2015 04:07:08 -0400 Received: by wizk4 with SMTP id k4so184433342wiz.1 for ; Thu, 16 Apr 2015 01:07:07 -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=rOnr/UVV8QT5/0bSI+BSXfuWgskIEI8ilPEvYxZd2h4=; b=T8zuNW0yIBkFLE6WjsYNBTN1ojp6OQ4eyMSTdYIzc7ZmJM0O3VaWdq6j68RLs7SLkC Bk/upZOvW0ARxH2KvWBJzEQV5oghEdPK6xN6rVdEGLy9yn0cuUsaWh8Xw3XSGsDDnCYB uvdPfXufP2OAE1HdW2/RglLjO8eiAYGuivytJ5p1rdez4k9NJxJCHzGBM7DC3pk4Vei0 rycfH922gpAzGf8MnfRUHKnhCcOxhjPNmh0eTzgcdpX/LtzGnhIOJH9fVSw2j7arr90A nKSSrOFKyiFDZRZw9Xmu5ZbjhlDuJ7x28kFhw6Pa+wx69LA2QOdSGtuKKBrP4WbD7Gmf AWgQ== X-Gm-Message-State: ALoCoQnaLNTTVz07qM3CeVqcxXlNbsTx3EE9GmyH0/QzVkFff8XWZI4Z3h+i/BUiSKxwQuA5CB9L X-Received: by 10.181.11.129 with SMTP id ei1mr2785596wid.57.1429171627467; Thu, 16 Apr 2015 01:07:07 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id g14sm5752111wjs.47.2015.04.16.01.07.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2015 01:07:06 -0700 (PDT) Message-ID: <552F6DA9.2050807@profitbricks.com> Date: Thu, 16 Apr 2015 10:07:05 +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 07/27] IB/Verbs: Reform IB-ulp ipoib 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 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..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;