From patchwork Wed May 5 14:30:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 97121 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o45ETR9b003170 for ; Wed, 5 May 2010 14:30:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932479Ab0EEOaM (ORCPT ); Wed, 5 May 2010 10:30:12 -0400 Received: from fwil.voltaire.com ([193.47.165.2]:48194 "EHLO exil.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932392Ab0EEOaL (ORCPT ); Wed, 5 May 2010 10:30:11 -0400 Received: from zuben.voltaire.com ([172.25.5.15]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 May 2010 17:30:10 +0300 Date: Wed, 5 May 2010 17:30:10 +0300 (IDT) From: Or Gerlitz To: Roland Dreier cc: linux-rdma , Mike Christie Subject: [PATCH 1/3] ib/iser: add event handler In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-OriginalArrivalTime: 05 May 2010 14:30:10.0158 (UTC) FILETIME=[7754E0E0:01CAEC5F] 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.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 14:30:16 +0000 (UTC) Index: linux-2.6.34-rc6/drivers/infiniband/ulp/iser/iscsi_iser.h =================================================================== --- linux-2.6.34-rc6.orig/drivers/infiniband/ulp/iser/iscsi_iser.h +++ linux-2.6.34-rc6/drivers/infiniband/ulp/iser/iscsi_iser.h @@ -232,6 +232,7 @@ struct iser_device { struct ib_cq *tx_cq; struct ib_mr *mr; struct tasklet_struct cq_tasklet; + struct ib_event_handler event_handler; struct list_head ig_list; /* entry in ig devices list */ int refcount; }; Index: linux-2.6.34-rc6/drivers/infiniband/ulp/iser/iser_verbs.c =================================================================== --- linux-2.6.34-rc6.orig/drivers/infiniband/ulp/iser/iser_verbs.c +++ linux-2.6.34-rc6/drivers/infiniband/ulp/iser/iser_verbs.c @@ -54,6 +54,13 @@ static void iser_qp_event_callback(struc iser_err("got qp event %d\n",cause->event); } +static void iser_event_handler(struct ib_event_handler *handler, + struct ib_event *event) +{ + iser_err("async event %d on device %s port %d\n", event->event, + event->device->name, event->element.port_num); +} + /** * iser_create_device_ib_res - creates Protection Domain (PD), Completion * Queue (CQ), DMA Memory Region (DMA MR) with the device associated with @@ -96,8 +103,15 @@ static int iser_create_device_ib_res(str if (IS_ERR(device->mr)) goto dma_mr_err; + INIT_IB_EVENT_HANDLER(&device->event_handler, device->ib_device, + iser_event_handler); + if (ib_register_event_handler(&device->event_handler)) + goto handler_err; + return 0; +handler_err: + ib_dereg_mr(device->mr); dma_mr_err: tasklet_kill(&device->cq_tasklet); cq_arm_err: @@ -120,7 +134,7 @@ static void iser_free_device_ib_res(stru BUG_ON(device->mr == NULL); tasklet_kill(&device->cq_tasklet); - + (void)ib_unregister_event_handler(&device->event_handler); (void)ib_dereg_mr(device->mr); (void)ib_destroy_cq(device->tx_cq); (void)ib_destroy_cq(device->rx_cq);