Lines Matching refs:evt

213 static void ibmvfc_trc_start(struct ibmvfc_event *evt)  in ibmvfc_trc_start()  argument
215 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_trc_start()
216 struct ibmvfc_cmd *vfc_cmd = &evt->iu.cmd; in ibmvfc_trc_start()
217 struct ibmvfc_mad_common *mad = &evt->iu.mad_common; in ibmvfc_trc_start()
223 entry->evt = evt; in ibmvfc_trc_start()
225 entry->fmt = evt->crq.format; in ibmvfc_trc_start()
249 static void ibmvfc_trc_end(struct ibmvfc_event *evt) in ibmvfc_trc_end() argument
251 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_trc_end()
252 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_trc_end()
253 struct ibmvfc_mad_common *mad = &evt->xfer_iu->mad_common; in ibmvfc_trc_end()
260 entry->evt = evt; in ibmvfc_trc_end()
262 entry->fmt = evt->crq.format; in ibmvfc_trc_end()
288 #define ibmvfc_trc_start(evt) do { } while (0) argument
289 #define ibmvfc_trc_end(evt) do { } while (0) argument
813 struct ibmvfc_event *evt = &pool->events[i]; in ibmvfc_init_event_pool() local
821 atomic_set(&evt->active, -1); in ibmvfc_init_event_pool()
822 atomic_set(&evt->free, 1); in ibmvfc_init_event_pool()
823 evt->crq.valid = 0x80; in ibmvfc_init_event_pool()
824 evt->crq.ioba = cpu_to_be64(pool->iu_token + (sizeof(*evt->xfer_iu) * i)); in ibmvfc_init_event_pool()
825 evt->xfer_iu = pool->iu_storage + i; in ibmvfc_init_event_pool()
826 evt->vhost = vhost; in ibmvfc_init_event_pool()
827 evt->queue = queue; in ibmvfc_init_event_pool()
828 evt->ext_list = NULL; in ibmvfc_init_event_pool()
829 list_add_tail(&evt->queue_list, &queue->free); in ibmvfc_init_event_pool()
1010 struct ibmvfc_event *evt) in ibmvfc_valid_event() argument
1012 int index = evt - pool->events; in ibmvfc_valid_event()
1015 if (evt != pool->events + index) /* unaligned */ in ibmvfc_valid_event()
1025 static void ibmvfc_free_event(struct ibmvfc_event *evt) in ibmvfc_free_event() argument
1027 struct ibmvfc_event_pool *pool = &evt->queue->evt_pool; in ibmvfc_free_event()
1030 BUG_ON(!ibmvfc_valid_event(pool, evt)); in ibmvfc_free_event()
1031 BUG_ON(atomic_inc_return(&evt->free) != 1); in ibmvfc_free_event()
1032 BUG_ON(atomic_dec_and_test(&evt->active)); in ibmvfc_free_event()
1034 spin_lock_irqsave(&evt->queue->l_lock, flags); in ibmvfc_free_event()
1035 list_add_tail(&evt->queue_list, &evt->queue->free); in ibmvfc_free_event()
1036 if (evt->eh_comp) in ibmvfc_free_event()
1037 complete(evt->eh_comp); in ibmvfc_free_event()
1038 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_free_event()
1048 static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt) in ibmvfc_scsi_eh_done() argument
1050 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_scsi_eh_done()
1057 ibmvfc_free_event(evt); in ibmvfc_scsi_eh_done()
1069 struct ibmvfc_event *evt, *pos; in ibmvfc_complete_purge() local
1071 list_for_each_entry_safe(evt, pos, purge_list, queue_list) { in ibmvfc_complete_purge()
1072 list_del(&evt->queue_list); in ibmvfc_complete_purge()
1073 ibmvfc_trc_end(evt); in ibmvfc_complete_purge()
1074 evt->done(evt); in ibmvfc_complete_purge()
1086 static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code) in ibmvfc_fail_request() argument
1093 BUG_ON(!atomic_dec_and_test(&evt->active)); in ibmvfc_fail_request()
1094 if (evt->cmnd) { in ibmvfc_fail_request()
1095 evt->cmnd->result = (error_code << 16); in ibmvfc_fail_request()
1096 evt->done = ibmvfc_scsi_eh_done; in ibmvfc_fail_request()
1098 evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_DRIVER_FAILED); in ibmvfc_fail_request()
1100 del_timer(&evt->timer); in ibmvfc_fail_request()
1113 struct ibmvfc_event *evt, *pos; in ibmvfc_purge_requests() local
1124 list_for_each_entry_safe(evt, pos, &vhost->crq.sent, queue_list) in ibmvfc_purge_requests()
1125 ibmvfc_fail_request(evt, error_code); in ibmvfc_purge_requests()
1132 list_for_each_entry_safe(evt, pos, &queues[i].sent, queue_list) in ibmvfc_purge_requests()
1133 ibmvfc_fail_request(evt, error_code); in ibmvfc_purge_requests()
1518 struct ibmvfc_event *evt; in ibmvfc_get_event() local
1523 evt = list_entry(queue->free.next, struct ibmvfc_event, queue_list); in ibmvfc_get_event()
1524 atomic_set(&evt->free, 0); in ibmvfc_get_event()
1525 list_del(&evt->queue_list); in ibmvfc_get_event()
1527 return evt; in ibmvfc_get_event()
1538 static void ibmvfc_locked_done(struct ibmvfc_event *evt) in ibmvfc_locked_done() argument
1542 spin_lock_irqsave(evt->vhost->host->host_lock, flags); in ibmvfc_locked_done()
1543 evt->_done(evt); in ibmvfc_locked_done()
1544 spin_unlock_irqrestore(evt->vhost->host->host_lock, flags); in ibmvfc_locked_done()
1554 static void ibmvfc_init_event(struct ibmvfc_event *evt, in ibmvfc_init_event() argument
1557 evt->cmnd = NULL; in ibmvfc_init_event()
1558 evt->sync_iu = NULL; in ibmvfc_init_event()
1559 evt->eh_comp = NULL; in ibmvfc_init_event()
1560 evt->crq.format = format; in ibmvfc_init_event()
1562 evt->done = done; in ibmvfc_init_event()
1564 evt->_done = done; in ibmvfc_init_event()
1565 evt->done = ibmvfc_locked_done; in ibmvfc_init_event()
1567 evt->hwq = 0; in ibmvfc_init_event()
1600 struct ibmvfc_event *evt, in ibmvfc_map_sg_data() argument
1607 struct ibmvfc_fcp_cmd_iu *iu = ibmvfc_get_fcp_iu(evt->vhost, vfc_cmd); in ibmvfc_map_sg_data()
1637 if (!evt->ext_list) { in ibmvfc_map_sg_data()
1638 evt->ext_list = dma_pool_alloc(vhost->sg_pool, GFP_ATOMIC, in ibmvfc_map_sg_data()
1639 &evt->ext_list_token); in ibmvfc_map_sg_data()
1641 if (!evt->ext_list) { in ibmvfc_map_sg_data()
1649 ibmvfc_map_sg_list(scmd, sg_mapped, evt->ext_list); in ibmvfc_map_sg_data()
1651 data->va = cpu_to_be64(evt->ext_list_token); in ibmvfc_map_sg_data()
1665 struct ibmvfc_event *evt = from_timer(evt, t, timer); in ibmvfc_timeout() local
1666 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_timeout()
1667 dev_err(vhost->dev, "Command timed out (%p). Resetting connection\n", evt); in ibmvfc_timeout()
1679 static int ibmvfc_send_event(struct ibmvfc_event *evt, in ibmvfc_send_event() argument
1682 __be64 *crq_as_u64 = (__be64 *) &evt->crq; in ibmvfc_send_event()
1687 *evt->xfer_iu = evt->iu; in ibmvfc_send_event()
1688 if (evt->crq.format == IBMVFC_CMD_FORMAT) in ibmvfc_send_event()
1689 evt->xfer_iu->cmd.tag = cpu_to_be64((u64)evt); in ibmvfc_send_event()
1690 else if (evt->crq.format == IBMVFC_MAD_FORMAT) in ibmvfc_send_event()
1691 evt->xfer_iu->mad_common.tag = cpu_to_be64((u64)evt); in ibmvfc_send_event()
1695 timer_setup(&evt->timer, ibmvfc_timeout, 0); in ibmvfc_send_event()
1698 evt->timer.expires = jiffies + (timeout * HZ); in ibmvfc_send_event()
1699 add_timer(&evt->timer); in ibmvfc_send_event()
1702 spin_lock_irqsave(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1703 list_add_tail(&evt->queue_list, &evt->queue->sent); in ibmvfc_send_event()
1704 atomic_set(&evt->active, 1); in ibmvfc_send_event()
1708 if (evt->queue->fmt == IBMVFC_SUB_CRQ_FMT) in ibmvfc_send_event()
1710 evt->queue->vios_cookie, in ibmvfc_send_event()
1719 atomic_set(&evt->active, 0); in ibmvfc_send_event()
1720 list_del(&evt->queue_list); in ibmvfc_send_event()
1721 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1722 del_timer(&evt->timer); in ibmvfc_send_event()
1732 if (evt->cmnd) in ibmvfc_send_event()
1733 scsi_dma_unmap(evt->cmnd); in ibmvfc_send_event()
1734 ibmvfc_free_event(evt); in ibmvfc_send_event()
1739 if (evt->cmnd) { in ibmvfc_send_event()
1740 evt->cmnd->result = DID_ERROR << 16; in ibmvfc_send_event()
1741 evt->done = ibmvfc_scsi_eh_done; in ibmvfc_send_event()
1743 evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_CRQ_ERROR); in ibmvfc_send_event()
1745 evt->done(evt); in ibmvfc_send_event()
1747 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1748 ibmvfc_trc_start(evt); in ibmvfc_send_event()
1759 static void ibmvfc_log_error(struct ibmvfc_event *evt) in ibmvfc_log_error() argument
1761 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_log_error()
1762 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_log_error()
1764 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_log_error()
1817 static void ibmvfc_scsi_done(struct ibmvfc_event *evt) in ibmvfc_scsi_done() argument
1819 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_scsi_done()
1820 struct ibmvfc_fcp_rsp *rsp = ibmvfc_get_fcp_rsp(evt->vhost, vfc_cmd); in ibmvfc_scsi_done()
1821 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_scsi_done()
1834 cmnd->result = ibmvfc_get_err_result(evt->vhost, vfc_cmd); in ibmvfc_scsi_done()
1849 ibmvfc_log_error(evt); in ibmvfc_scsi_done()
1860 ibmvfc_free_event(evt); in ibmvfc_scsi_done()
1893 static struct ibmvfc_cmd *ibmvfc_init_vfc_cmd(struct ibmvfc_event *evt, struct scsi_device *sdev) in ibmvfc_init_vfc_cmd() argument
1896 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_init_vfc_cmd()
1897 struct ibmvfc_cmd *vfc_cmd = &evt->iu.cmd; in ibmvfc_init_vfc_cmd()
1908 vfc_cmd->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offset); in ibmvfc_init_vfc_cmd()
1934 struct ibmvfc_event *evt; in ibmvfc_queuecommand() local
1950 evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[scsi_channel]); in ibmvfc_queuecommand()
1951 evt->hwq = hwq % vhost->scsi_scrqs.active_queues; in ibmvfc_queuecommand()
1953 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_queuecommand()
1955 ibmvfc_init_event(evt, ibmvfc_scsi_done, IBMVFC_CMD_FORMAT); in ibmvfc_queuecommand()
1956 evt->cmnd = cmnd; in ibmvfc_queuecommand()
1958 vfc_cmd = ibmvfc_init_vfc_cmd(evt, cmnd->device); in ibmvfc_queuecommand()
1969 vfc_cmd->correlation = cpu_to_be64((u64)evt); in ibmvfc_queuecommand()
1971 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) in ibmvfc_queuecommand()
1972 return ibmvfc_send_event(evt, vhost, 0); in ibmvfc_queuecommand()
1974 ibmvfc_free_event(evt); in ibmvfc_queuecommand()
1992 static void ibmvfc_sync_completion(struct ibmvfc_event *evt) in ibmvfc_sync_completion() argument
1995 if (evt->sync_iu) in ibmvfc_sync_completion()
1996 *evt->sync_iu = *evt->xfer_iu; in ibmvfc_sync_completion()
1998 complete(&evt->comp); in ibmvfc_sync_completion()
2006 static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt) in ibmvfc_bsg_timeout_done() argument
2008 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_bsg_timeout_done()
2010 ibmvfc_free_event(evt); in ibmvfc_bsg_timeout_done()
2026 struct ibmvfc_event *evt; in ibmvfc_bsg_timeout() local
2040 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_bsg_timeout()
2041 ibmvfc_init_event(evt, ibmvfc_bsg_timeout_done, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_timeout()
2043 tmf = &evt->iu.tmf; in ibmvfc_bsg_timeout()
2051 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_bsg_timeout()
2079 struct ibmvfc_event *evt; in ibmvfc_bsg_plogi() local
2098 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_bsg_plogi()
2099 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_plogi()
2100 plogi = &evt->iu.plogi; in ibmvfc_bsg_plogi()
2106 evt->sync_iu = &rsp_iu; in ibmvfc_bsg_plogi()
2107 init_completion(&evt->comp); in ibmvfc_bsg_plogi()
2109 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_bsg_plogi()
2115 wait_for_completion(&evt->comp); in ibmvfc_bsg_plogi()
2121 ibmvfc_free_event(evt); in ibmvfc_bsg_plogi()
2140 struct ibmvfc_event *evt; in ibmvfc_bsg_request() local
2216 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_bsg_request()
2217 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_request()
2218 mad = &evt->iu.passthru; in ibmvfc_bsg_request()
2225 mad->cmd_ioba.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + in ibmvfc_bsg_request()
2239 mad->iu.tag = cpu_to_be64((u64)evt); in ibmvfc_bsg_request()
2242 evt->sync_iu = &rsp_iu; in ibmvfc_bsg_request()
2243 init_completion(&evt->comp); in ibmvfc_bsg_request()
2244 rc = ibmvfc_send_event(evt, vhost, 0); in ibmvfc_bsg_request()
2252 wait_for_completion(&evt->comp); in ibmvfc_bsg_request()
2260 ibmvfc_free_event(evt); in ibmvfc_bsg_request()
2290 struct ibmvfc_event *evt = NULL; in ibmvfc_reset_device() local
2301 evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[0]); in ibmvfc_reset_device()
2303 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_reset_device()
2305 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); in ibmvfc_reset_device()
2306 tmf = ibmvfc_init_vfc_cmd(evt, sdev); in ibmvfc_reset_device()
2313 evt->sync_iu = &rsp_iu; in ibmvfc_reset_device()
2315 init_completion(&evt->comp); in ibmvfc_reset_device()
2316 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_reset_device()
2327 wait_for_completion(&evt->comp); in ibmvfc_reset_device()
2346 ibmvfc_free_event(evt); in ibmvfc_reset_device()
2359 static int ibmvfc_match_rport(struct ibmvfc_event *evt, void *rport) in ibmvfc_match_rport() argument
2363 if (evt->cmnd) { in ibmvfc_match_rport()
2364 cmd_rport = starget_to_rport(scsi_target(evt->cmnd->device)); in ibmvfc_match_rport()
2379 static int ibmvfc_match_target(struct ibmvfc_event *evt, void *device) in ibmvfc_match_target() argument
2381 if (evt->cmnd && scsi_target(evt->cmnd->device) == device) in ibmvfc_match_target()
2394 static int ibmvfc_match_lun(struct ibmvfc_event *evt, void *device) in ibmvfc_match_lun() argument
2396 if (evt->cmnd && evt->cmnd->device == device) in ibmvfc_match_lun()
2408 static bool ibmvfc_event_is_free(struct ibmvfc_event *evt) in ibmvfc_event_is_free() argument
2412 list_for_each_entry(loop_evt, &evt->queue->free, queue_list) in ibmvfc_event_is_free()
2413 if (loop_evt == evt) in ibmvfc_event_is_free()
2431 struct ibmvfc_event *evt; in ibmvfc_wait_for_ops() local
2453 evt = &queues[q_index].evt_pool.events[i]; in ibmvfc_wait_for_ops()
2454 if (!ibmvfc_event_is_free(evt)) { in ibmvfc_wait_for_ops()
2455 if (match(evt, device)) { in ibmvfc_wait_for_ops()
2456 evt->eh_comp = &comp; in ibmvfc_wait_for_ops()
2474 evt = &queues[q_index].evt_pool.events[i]; in ibmvfc_wait_for_ops()
2475 if (!ibmvfc_event_is_free(evt)) { in ibmvfc_wait_for_ops()
2476 if (match(evt, device)) { in ibmvfc_wait_for_ops()
2477 evt->eh_comp = NULL; in ibmvfc_wait_for_ops()
2504 struct ibmvfc_event *evt; in ibmvfc_init_tmf() local
2507 evt = ibmvfc_get_event(queue); in ibmvfc_init_tmf()
2508 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_init_tmf()
2510 tmf = &evt->iu.tmf; in ibmvfc_init_tmf()
2531 init_completion(&evt->comp); in ibmvfc_init_tmf()
2533 return evt; in ibmvfc_init_tmf()
2539 struct ibmvfc_event *evt, *found_evt, *temp; in ibmvfc_cancel_all_mq() local
2554 list_for_each_entry(evt, &queues[i].sent, queue_list) { in ibmvfc_cancel_all_mq()
2555 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_cancel_all_mq()
2556 found_evt = evt; in ibmvfc_cancel_all_mq()
2563 evt = ibmvfc_init_tmf(&queues[i], sdev, type); in ibmvfc_cancel_all_mq()
2564 evt->sync_iu = &queues[i].cancel_rsp; in ibmvfc_cancel_all_mq()
2565 ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_cancel_all_mq()
2566 list_add_tail(&evt->cancel, &cancelq); in ibmvfc_cancel_all_mq()
2581 list_for_each_entry_safe(evt, temp, &cancelq, cancel) { in ibmvfc_cancel_all_mq()
2582 wait_for_completion(&evt->comp); in ibmvfc_cancel_all_mq()
2583 status = be16_to_cpu(evt->queue->cancel_rsp.mad_common.status); in ibmvfc_cancel_all_mq()
2584 list_del(&evt->cancel); in ibmvfc_cancel_all_mq()
2585 ibmvfc_free_event(evt); in ibmvfc_cancel_all_mq()
2614 struct ibmvfc_event *evt, *found_evt; in ibmvfc_cancel_all_sq() local
2624 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_cancel_all_sq()
2625 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_cancel_all_sq()
2626 found_evt = evt; in ibmvfc_cancel_all_sq()
2640 evt = ibmvfc_init_tmf(&vhost->crq, sdev, type); in ibmvfc_cancel_all_sq()
2641 evt->sync_iu = &rsp; in ibmvfc_cancel_all_sq()
2642 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_cancel_all_sq()
2657 wait_for_completion(&evt->comp); in ibmvfc_cancel_all_sq()
2660 ibmvfc_free_event(evt); in ibmvfc_cancel_all_sq()
2709 static int ibmvfc_match_key(struct ibmvfc_event *evt, void *key) in ibmvfc_match_key() argument
2713 if (evt->crq.format == IBMVFC_CMD_FORMAT && in ibmvfc_match_key()
2714 be32_to_cpu(evt->iu.cmd.cancel_key) == cancel_key) in ibmvfc_match_key()
2727 static int ibmvfc_match_evt(struct ibmvfc_event *evt, void *match) in ibmvfc_match_evt() argument
2729 if (evt == match) in ibmvfc_match_evt()
2749 struct ibmvfc_event *evt, *found_evt; in ibmvfc_abort_task_set() local
2760 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_abort_task_set()
2761 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_abort_task_set()
2762 found_evt = evt; in ibmvfc_abort_task_set()
2776 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_abort_task_set()
2777 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); in ibmvfc_abort_task_set()
2778 tmf = ibmvfc_init_vfc_cmd(evt, sdev); in ibmvfc_abort_task_set()
2785 evt->sync_iu = &rsp_iu; in ibmvfc_abort_task_set()
2787 tmf->correlation = cpu_to_be64((u64)evt); in ibmvfc_abort_task_set()
2789 init_completion(&evt->comp); in ibmvfc_abort_task_set()
2790 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_abort_task_set()
2801 timeout = wait_for_completion_timeout(&evt->comp, timeout); in ibmvfc_abort_task_set()
2820 rc = ibmvfc_wait_for_ops(vhost, evt, ibmvfc_match_evt); in ibmvfc_abort_task_set()
2850 ibmvfc_free_event(evt); in ibmvfc_abort_task_set()
3213 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_crq() local
3272 if (unlikely(!ibmvfc_valid_event(&vhost->crq.evt_pool, evt))) { in ibmvfc_handle_crq()
3278 if (unlikely(atomic_dec_if_positive(&evt->active))) { in ibmvfc_handle_crq()
3284 spin_lock(&evt->queue->l_lock); in ibmvfc_handle_crq()
3285 list_move_tail(&evt->queue_list, evt_doneq); in ibmvfc_handle_crq()
3286 spin_unlock(&evt->queue->l_lock); in ibmvfc_handle_crq()
3718 struct ibmvfc_event *evt, *temp; in ibmvfc_tasklet() local
3758 list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { in ibmvfc_tasklet()
3759 del_timer(&evt->timer); in ibmvfc_tasklet()
3760 list_del(&evt->queue_list); in ibmvfc_tasklet()
3761 ibmvfc_trc_end(evt); in ibmvfc_tasklet()
3762 evt->done(evt); in ibmvfc_tasklet()
3789 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_scrq() local
3805 if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) { in ibmvfc_handle_scrq()
3811 if (unlikely(atomic_dec_if_positive(&evt->active))) { in ibmvfc_handle_scrq()
3817 spin_lock(&evt->queue->l_lock); in ibmvfc_handle_scrq()
3818 list_move_tail(&evt->queue_list, evt_doneq); in ibmvfc_handle_scrq()
3819 spin_unlock(&evt->queue->l_lock); in ibmvfc_handle_scrq()
3840 struct ibmvfc_event *evt, *temp; in ibmvfc_drain_sub_crq() local
3864 list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { in ibmvfc_drain_sub_crq()
3865 del_timer(&evt->timer); in ibmvfc_drain_sub_crq()
3866 list_del(&evt->queue_list); in ibmvfc_drain_sub_crq()
3867 ibmvfc_trc_end(evt); in ibmvfc_drain_sub_crq()
3868 evt->done(evt); in ibmvfc_drain_sub_crq()
3955 static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) in ibmvfc_tgt_prli_done() argument
3957 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_prli_done()
3958 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_prli_done()
3959 struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; in ibmvfc_tgt_prli_done()
4015 ibmvfc_free_event(evt); in ibmvfc_tgt_prli_done()
4028 struct ibmvfc_event *evt; in ibmvfc_tgt_send_prli() local
4034 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_tgt_send_prli()
4036 ibmvfc_init_event(evt, ibmvfc_tgt_prli_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_send_prli()
4037 evt->tgt = tgt; in ibmvfc_tgt_send_prli()
4038 prli = &evt->iu.prli; in ibmvfc_tgt_send_prli()
4059 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_send_prli()
4072 static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) in ibmvfc_tgt_plogi_done() argument
4074 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_plogi_done()
4075 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_plogi_done()
4076 struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; in ibmvfc_tgt_plogi_done()
4121 ibmvfc_free_event(evt); in ibmvfc_tgt_plogi_done()
4134 struct ibmvfc_event *evt; in ibmvfc_tgt_send_plogi() local
4141 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_tgt_send_plogi()
4144 ibmvfc_init_event(evt, ibmvfc_tgt_plogi_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_send_plogi()
4145 evt->tgt = tgt; in ibmvfc_tgt_send_plogi()
4146 plogi = &evt->iu.plogi; in ibmvfc_tgt_send_plogi()
4158 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_send_plogi()
4171 static void ibmvfc_tgt_implicit_logout_done(struct ibmvfc_event *evt) in ibmvfc_tgt_implicit_logout_done() argument
4173 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_implicit_logout_done()
4174 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_implicit_logout_done()
4175 struct ibmvfc_implicit_logout *rsp = &evt->xfer_iu->implicit_logout; in ibmvfc_tgt_implicit_logout_done()
4179 ibmvfc_free_event(evt); in ibmvfc_tgt_implicit_logout_done()
4214 struct ibmvfc_event *evt; in __ibmvfc_tgt_get_implicit_logout_evt() local
4217 evt = ibmvfc_get_event(&vhost->crq); in __ibmvfc_tgt_get_implicit_logout_evt()
4218 ibmvfc_init_event(evt, done, IBMVFC_MAD_FORMAT); in __ibmvfc_tgt_get_implicit_logout_evt()
4219 evt->tgt = tgt; in __ibmvfc_tgt_get_implicit_logout_evt()
4220 mad = &evt->iu.implicit_logout; in __ibmvfc_tgt_get_implicit_logout_evt()
4226 return evt; in __ibmvfc_tgt_get_implicit_logout_evt()
4237 struct ibmvfc_event *evt; in ibmvfc_tgt_implicit_logout() local
4243 evt = __ibmvfc_tgt_get_implicit_logout_evt(tgt, in ibmvfc_tgt_implicit_logout()
4247 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_implicit_logout()
4260 static void ibmvfc_tgt_implicit_logout_and_del_done(struct ibmvfc_event *evt) in ibmvfc_tgt_implicit_logout_and_del_done() argument
4262 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_implicit_logout_and_del_done()
4263 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_implicit_logout_and_del_done()
4264 struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; in ibmvfc_tgt_implicit_logout_and_del_done()
4268 ibmvfc_free_event(evt); in ibmvfc_tgt_implicit_logout_and_del_done()
4295 struct ibmvfc_event *evt; in ibmvfc_tgt_implicit_logout_and_del() local
4306 evt = __ibmvfc_tgt_get_implicit_logout_evt(tgt, in ibmvfc_tgt_implicit_logout_and_del()
4310 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_implicit_logout_and_del()
4323 static void ibmvfc_tgt_move_login_done(struct ibmvfc_event *evt) in ibmvfc_tgt_move_login_done() argument
4325 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_move_login_done()
4326 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_move_login_done()
4327 struct ibmvfc_move_login *rsp = &evt->xfer_iu->move_login; in ibmvfc_tgt_move_login_done()
4363 ibmvfc_free_event(evt); in ibmvfc_tgt_move_login_done()
4377 struct ibmvfc_event *evt; in ibmvfc_tgt_move_login() local
4383 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_tgt_move_login()
4386 ibmvfc_init_event(evt, ibmvfc_tgt_move_login_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_move_login()
4387 evt->tgt = tgt; in ibmvfc_tgt_move_login()
4388 move = &evt->iu.move_login; in ibmvfc_tgt_move_login()
4399 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_move_login()
4432 static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt) in ibmvfc_tgt_adisc_done() argument
4434 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_adisc_done()
4435 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_adisc_done()
4436 struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; in ibmvfc_tgt_adisc_done()
4466 ibmvfc_free_event(evt); in ibmvfc_tgt_adisc_done()
4475 static void ibmvfc_init_passthru(struct ibmvfc_event *evt) in ibmvfc_init_passthru() argument
4477 struct ibmvfc_passthru_mad *mad = &evt->iu.passthru; in ibmvfc_init_passthru()
4483 mad->cmd_ioba.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4488 mad->iu.cmd.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4492 mad->iu.rsp.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4508 static void ibmvfc_tgt_adisc_cancel_done(struct ibmvfc_event *evt) in ibmvfc_tgt_adisc_cancel_done() argument
4510 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_adisc_cancel_done()
4511 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_adisc_cancel_done()
4515 ibmvfc_free_event(evt); in ibmvfc_tgt_adisc_cancel_done()
4532 struct ibmvfc_event *evt; in ibmvfc_adisc_timeout() local
4549 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_adisc_timeout()
4550 ibmvfc_init_event(evt, ibmvfc_tgt_adisc_cancel_done, IBMVFC_MAD_FORMAT); in ibmvfc_adisc_timeout()
4552 evt->tgt = tgt; in ibmvfc_adisc_timeout()
4553 tmf = &evt->iu.tmf; in ibmvfc_adisc_timeout()
4566 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_adisc_timeout()
4593 struct ibmvfc_event *evt; in ibmvfc_tgt_adisc() local
4599 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_tgt_adisc()
4601 ibmvfc_init_event(evt, ibmvfc_tgt_adisc_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_adisc()
4602 evt->tgt = tgt; in ibmvfc_tgt_adisc()
4604 ibmvfc_init_passthru(evt); in ibmvfc_tgt_adisc()
4605 mad = &evt->iu.passthru; in ibmvfc_tgt_adisc()
4625 if (ibmvfc_send_event(evt, vhost, IBMVFC_ADISC_PLUS_CANCEL_TIMEOUT)) { in ibmvfc_tgt_adisc()
4639 static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) in ibmvfc_tgt_query_target_done() argument
4641 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_query_target_done()
4642 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_query_target_done()
4643 struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; in ibmvfc_tgt_query_target_done()
4683 ibmvfc_free_event(evt); in ibmvfc_tgt_query_target_done()
4696 struct ibmvfc_event *evt; in ibmvfc_tgt_query_target() local
4702 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_tgt_query_target()
4704 evt->tgt = tgt; in ibmvfc_tgt_query_target()
4705 ibmvfc_init_event(evt, ibmvfc_tgt_query_target_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_query_target()
4706 query_tgt = &evt->iu.query_tgt; in ibmvfc_tgt_query_target()
4714 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_query_target()
4835 static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt) in ibmvfc_discover_targets_done() argument
4837 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_discover_targets_done()
4838 struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; in ibmvfc_discover_targets_done()
4862 ibmvfc_free_event(evt); in ibmvfc_discover_targets_done()
4874 struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_discover_targets() local
4876 ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); in ibmvfc_discover_targets()
4877 mad = &evt->iu.discover_targets; in ibmvfc_discover_targets()
4888 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_discover_targets()
4894 static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) in ibmvfc_channel_setup_done() argument
4896 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_channel_setup_done()
4899 u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status); in ibmvfc_channel_setup_done()
4903 ibmvfc_free_event(evt); in ibmvfc_channel_setup_done()
4948 struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_channel_setup() local
4963 ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT); in ibmvfc_channel_setup()
4964 mad = &evt->iu.channel_setup; in ibmvfc_channel_setup()
4974 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_channel_setup()
4980 static void ibmvfc_channel_enquiry_done(struct ibmvfc_event *evt) in ibmvfc_channel_enquiry_done() argument
4982 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_channel_enquiry_done()
4983 struct ibmvfc_channel_enquiry *rsp = &evt->xfer_iu->channel_enquiry; in ibmvfc_channel_enquiry_done()
4991 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
4998 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
5004 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
5014 struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_channel_enquiry() local
5016 ibmvfc_init_event(evt, ibmvfc_channel_enquiry_done, IBMVFC_MAD_FORMAT); in ibmvfc_channel_enquiry()
5017 mad = &evt->iu.channel_enquiry; in ibmvfc_channel_enquiry()
5030 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_channel_enquiry()
5041 static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) in ibmvfc_npiv_login_done() argument
5043 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_npiv_login_done()
5044 u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_login.common.status); in ibmvfc_npiv_login_done()
5051 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5061 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5067 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5072 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5135 struct ibmvfc_event *evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_npiv_login() local
5139 ibmvfc_init_event(evt, ibmvfc_npiv_login_done, IBMVFC_MAD_FORMAT); in ibmvfc_npiv_login()
5142 mad = &evt->iu.npiv_login; in ibmvfc_npiv_login()
5152 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_npiv_login()
5163 static void ibmvfc_npiv_logout_done(struct ibmvfc_event *evt) in ibmvfc_npiv_logout_done() argument
5165 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_npiv_logout_done()
5166 u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_logout.common.status); in ibmvfc_npiv_logout_done()
5168 ibmvfc_free_event(evt); in ibmvfc_npiv_logout_done()
5198 struct ibmvfc_event *evt; in ibmvfc_npiv_logout() local
5200 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_npiv_logout()
5201 ibmvfc_init_event(evt, ibmvfc_npiv_logout_done, IBMVFC_MAD_FORMAT); in ibmvfc_npiv_logout()
5203 mad = &evt->iu.npiv_logout; in ibmvfc_npiv_logout()
5211 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_npiv_logout()