From patchwork Sat Mar 5 00:02:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 610501 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p25024lV024745 for ; Sat, 5 Mar 2011 00:03:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760032Ab1CEADA (ORCPT ); Fri, 4 Mar 2011 19:03:00 -0500 Received: from mga09.intel.com ([134.134.136.24]:51776 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760072Ab1CEAC6 convert rfc822-to-8bit (ORCPT ); Fri, 4 Mar 2011 19:02:58 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 04 Mar 2011 16:02:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.62,267,1297065600"; d="scan'208";a="609268264" Received: from orsmsx603.amr.corp.intel.com ([10.22.226.49]) by orsmga002.jf.intel.com with ESMTP; 04 Mar 2011 16:02:36 -0800 Received: from orsmsx501.amr.corp.intel.com ([10.22.226.209]) by orsmsx603.amr.corp.intel.com ([10.22.226.49]) with mapi; Fri, 4 Mar 2011 16:02:35 -0800 From: "Hefty, Sean" To: linux-rdma Date: Fri, 4 Mar 2011 16:02:35 -0800 Subject: [PATCH 2/7] ibacm: Track inactive devices and ports Thread-Topic: [PATCH 2/7] ibacm: Track inactive devices and ports Thread-Index: AcvaxgSfoktHPkOORD6XfWr1lHcX3gAAGW/g Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 05 Mar 2011 00:03:00 +0000 (UTC) diff --git a/src/acm.c b/src/acm.c index 38f41d2..f21f702 100644 --- a/src/acm.c +++ b/src/acm.c @@ -123,7 +123,6 @@ struct acm_device struct ibv_pd *pd; uint64_t guid; DLIST_ENTRY entry; - uint8_t active; int port_cnt; struct acm_port port[0]; }; @@ -2646,7 +2645,6 @@ err2: ibv_destroy_ah(port->sa_dest.ah); err1: port->state = IBV_PORT_NOP; - port->dev->active--; } static int acm_activate_dev(struct acm_device *dev) @@ -2661,7 +2659,7 @@ static int acm_activate_dev(struct acm_device *dev) dev->channel = ibv_create_comp_channel(dev->verbs); if (!dev->channel) { acm_log(0, "ERROR - unable to create comp channel\n"); - goto err1; + goto err; } for (i = 0; i < dev->port_cnt; i++) { @@ -2670,16 +2668,11 @@ static int acm_activate_dev(struct acm_device *dev) acm_activate_port(&dev->port[i]); } - if (!dev->active) - goto err2; - acm_log(1, "starting completion thread\n"); beginthread(acm_comp_handler, dev); return 0; -err2: - ibv_destroy_comp_channel(dev->channel); -err1: +err: ibv_dealloc_pd(dev->pd); return -1; } @@ -2723,9 +2716,6 @@ static void acm_init_port(struct acm_port *port) port->sa_dest.av.sl = attr.sm_sl; port->sa_dest.av.port_num = port->port_num; port->sa_dest.remote_qpn = 1; - - if (port->state == IBV_PORT_ACTIVE) - port->dev->active++; } static void acm_open_dev(struct ibv_device *ibdev) @@ -2764,10 +2754,10 @@ static void acm_open_dev(struct ibv_device *ibdev) acm_init_port(&dev->port[i]); } - if (!dev->active || acm_activate_dev(dev)) + if (acm_activate_dev(dev)) goto err2; - acm_log(1, "%s now active\n", ibdev->name); + acm_log(1, "%s opened\n", ibdev->name); DListInsertHead(&dev->entry, &dev_list); return; @@ -2987,7 +2977,7 @@ int CDECL_FUNC main(int argc, char **argv) ibv_free_device_list(ibdev); if (DListEmpty(&dev_list)) { - acm_log(0, "ERROR - no active devices\n"); + acm_log(0, "ERROR - no devices\n"); return -1; }