From patchwork Tue May 5 12:50:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6337481 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 1B1F99F373 for ; Tue, 5 May 2015 12:51:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4880820274 for ; Tue, 5 May 2015 12:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF4AC20270 for ; Tue, 5 May 2015 12:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758725AbbEEMvM (ORCPT ); Tue, 5 May 2015 08:51:12 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:35333 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758704AbbEEMu5 (ORCPT ); Tue, 5 May 2015 08:50:57 -0400 Received: by wgyo15 with SMTP id o15so181778626wgy.2 for ; Tue, 05 May 2015 05:50:56 -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=HRUm+SpW+zgB17iBWTWmkyYk1RiB34QkmNFRlSytbks=; b=X1knBhi4GTMa3B37bAraNQ1dAcWEoXwiICcMSVfrfWNAPhHkR2X27XnpNs5VzBXVs2 AdNvFxlwvsycnOAxa1i8+34ELh89jwpEVwxhRTE0y9GmqgmWbns9kkV+Z2Wr/1yhsdXP NWFUSPo62WsOozeohWGpsbKktwlPO6zpE1JGRYhhAqIY5COFr03vur36HdQNnVblPM2x ExXs1+Lqp+aHA03D16PKZPa9+7RIo+QyykdUaoZxhb5kOyqykLHUvefG9/q4oJux/9CA SIIHhes8/JOYN0Gk+H456od3q7FZSmXmzLdRDaKpdYkY9xH2YgGJ/Z0os0qkYOlb1/aU Rj/g== X-Gm-Message-State: ALoCoQmWJdRPpSqxNosfR9ypMioz8aJSoQBuOLKpOJDn8XtSFmgM9JW9FURNYezRTV3pd3mVMP77 X-Received: by 10.180.76.8 with SMTP id g8mr3721914wiw.79.1430830256240; Tue, 05 May 2015 05:50:56 -0700 (PDT) Received: from ubuntu.pb.local ([62.217.45.26]) by mx.google.com with ESMTPSA id gs7sm16033234wib.10.2015.05.05.05.50.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 05:50:55 -0700 (PDT) From: Michael Wang To: Roland Dreier , Sean Hefty , Hal Rosenstock , Doug Ledford , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org 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 , Devesh Sharma , Liran Liss , Dave Goodell Subject: [PATCH v8 07/23] IB/Verbs: Reform IB-ulp ipoib Date: Tue, 5 May 2015 14:50:24 +0200 Message-Id: <1430830240-32389-8-git-send-email-yun.wang@profitbricks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430830240-32389-1-git-send-email-yun.wang@profitbricks.com> References: <1430830240-32389-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=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. 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 7cad4dd..468fc2b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1680,9 +1680,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) @@ -1699,15 +1697,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_protocol_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); } @@ -1716,9 +1720,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;