From patchwork Tue Apr 28 15:10:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6290481 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 6FD5B9F1C2 for ; Tue, 28 Apr 2015 15:18:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 878B62024F for ; Tue, 28 Apr 2015 15:18:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 996362024C for ; Tue, 28 Apr 2015 15:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030295AbbD1PKp (ORCPT ); Tue, 28 Apr 2015 11:10:45 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:34811 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030274AbbD1PKm (ORCPT ); Tue, 28 Apr 2015 11:10:42 -0400 Received: by wicmx19 with SMTP id mx19so110381968wic.1 for ; Tue, 28 Apr 2015 08:10:41 -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=U9MFJ2VAP6/5XrIwXrns2uyxIqvghVcETCd96/gVTBo=; b=lQlW/5l46UO+0NxOTXFE04sIZi1CK+YAeIVil239R8EI2YdIRmDOkhaZpgcZfI+nVV CpWlIpZkm9XC9kubW4h9i8TS9FHUocmPbfCZ8jhoHqonhJAq4ZfcW3Q0dqhEgjRzTb+t ot0PAEtnIomuZ1ZzzyoBCJkmh+DPs8JctFAaLY/YWpPOBKy0UmfIxbWWOKH0aj6L3/IR StCKdIsJ1jreL56vpoMasAsdaTzpvKYFlGMkCziIjXVpryiBRvdfIaohtYo2HRzMFhxZ tkxZ2yTXIxx+6fcYtBBgP/zHxsJg+X4zSxZRa0gqiv9drspeZ/okMo9AKh6OW/lfiMGJ skZw== X-Gm-Message-State: ALoCoQnfbunRC7CT94vyYAHL7/tnjb5QoXOQBvHgUCJgO+HC0DXYS7sSN5MLYPy8h5OSJ+35xtyy X-Received: by 10.181.13.113 with SMTP id ex17mr9288673wid.12.1430233841327; Tue, 28 Apr 2015 08:10:41 -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.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Apr 2015 08:10:40 -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 07/23] IB/Verbs: Reform IB-ulp ipoib Date: Tue, 28 Apr 2015 17:10:07 +0200 Message-Id: <1430233823-7075-8-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=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK 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 --- 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;