From patchwork Mon Nov 16 15:53:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 60419 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAGFupmq025045 for ; Mon, 16 Nov 2009 15:56:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753357AbZKPP4U (ORCPT ); Mon, 16 Nov 2009 10:56:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752790AbZKPP4S (ORCPT ); Mon, 16 Nov 2009 10:56:18 -0500 Received: from mail.mellanox.co.il ([194.90.237.43]:51565 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751927AbZKPP4Q (ORCPT ); Mon, 16 Nov 2009 10:56:16 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from eli@mellanox.co.il) with SMTP; 16 Nov 2009 17:59:18 +0200 Received: from localhost ([10.4.1.30]) by mtlexch01.mtl.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 16 Nov 2009 17:52:27 +0200 Date: Mon, 16 Nov 2009 17:53:36 +0200 From: Eli Cohen To: Roland Dreier Cc: Linux RDMA list , netdev , ewg Subject: [PATCHv6 04/10] IB/umad: Enable support only for IB ports Message-ID: <20091116155336.GE2463@mtls03> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginalArrivalTime: 16 Nov 2009 15:52:27.0825 (UTC) FILETIME=[CC2F9210:01CA66D4] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.000.1038-17012.007 X-TM-AS-Result: No--7.317000-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 6d6795d..d069689 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -1124,10 +1124,6 @@ static void ib_umad_add_one(struct ib_device *device) e = device->phys_port_cnt; } - for (i = s; i <= e; ++i) - if (rdma_port_get_transport(device, i) != RDMA_TRANSPORT_IB) - return; - umad_dev = kzalloc(sizeof *umad_dev + (e - s + 1) * sizeof (struct ib_umad_port), GFP_KERNEL); @@ -1142,8 +1138,9 @@ static void ib_umad_add_one(struct ib_device *device) for (i = s; i <= e; ++i) { umad_dev->port[i - s].umad_dev = umad_dev; - if (ib_umad_init_port(device, i, &umad_dev->port[i - s])) - goto err; + if (rdma_port_get_transport(device, i) == RDMA_TRANSPORT_IB) + if (ib_umad_init_port(device, i, &umad_dev->port[i - s])) + goto err; } ib_set_client_data(device, &umad_client, umad_dev); @@ -1152,7 +1149,8 @@ static void ib_umad_add_one(struct ib_device *device) err: while (--i >= s) - ib_umad_kill_port(&umad_dev->port[i - s]); + if (rdma_port_get_transport(device, i) == RDMA_TRANSPORT_IB) + ib_umad_kill_port(&umad_dev->port[i - s]); kref_put(&umad_dev->ref, ib_umad_release_dev); } @@ -1166,7 +1164,8 @@ static void ib_umad_remove_one(struct ib_device *device) return; for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) - ib_umad_kill_port(&umad_dev->port[i]); + if (rdma_port_get_transport(device, i + 1) == RDMA_TRANSPORT_IB) + ib_umad_kill_port(&umad_dev->port[i]); kref_put(&umad_dev->ref, ib_umad_release_dev); }