Lines Matching refs:evt
220 static void ibmvfc_trc_start(struct ibmvfc_event *evt) in ibmvfc_trc_start() argument
222 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_trc_start()
223 struct ibmvfc_cmd *vfc_cmd = &evt->iu.cmd; in ibmvfc_trc_start()
224 struct ibmvfc_mad_common *mad = &evt->iu.mad_common; in ibmvfc_trc_start()
230 entry->evt = evt; in ibmvfc_trc_start()
232 entry->fmt = evt->crq.format; in ibmvfc_trc_start()
256 static void ibmvfc_trc_end(struct ibmvfc_event *evt) in ibmvfc_trc_end() argument
258 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_trc_end()
259 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_trc_end()
260 struct ibmvfc_mad_common *mad = &evt->xfer_iu->mad_common; in ibmvfc_trc_end()
267 entry->evt = evt; in ibmvfc_trc_end()
269 entry->fmt = evt->crq.format; in ibmvfc_trc_end()
295 #define ibmvfc_trc_start(evt) do { } while (0) argument
296 #define ibmvfc_trc_end(evt) do { } while (0) argument
820 struct ibmvfc_event *evt = &pool->events[i]; in ibmvfc_init_event_pool() local
828 atomic_set(&evt->active, -1); in ibmvfc_init_event_pool()
829 atomic_set(&evt->free, 1); in ibmvfc_init_event_pool()
830 evt->crq.valid = 0x80; in ibmvfc_init_event_pool()
831 evt->crq.ioba = cpu_to_be64(pool->iu_token + (sizeof(*evt->xfer_iu) * i)); in ibmvfc_init_event_pool()
832 evt->xfer_iu = pool->iu_storage + i; in ibmvfc_init_event_pool()
833 evt->vhost = vhost; in ibmvfc_init_event_pool()
834 evt->queue = queue; in ibmvfc_init_event_pool()
835 evt->ext_list = NULL; in ibmvfc_init_event_pool()
836 list_add_tail(&evt->queue_list, &queue->free); in ibmvfc_init_event_pool()
1017 struct ibmvfc_event *evt) in ibmvfc_valid_event() argument
1019 int index = evt - pool->events; in ibmvfc_valid_event()
1022 if (evt != pool->events + index) /* unaligned */ in ibmvfc_valid_event()
1032 static void ibmvfc_free_event(struct ibmvfc_event *evt) in ibmvfc_free_event() argument
1034 struct ibmvfc_event_pool *pool = &evt->queue->evt_pool; in ibmvfc_free_event()
1037 BUG_ON(!ibmvfc_valid_event(pool, evt)); in ibmvfc_free_event()
1038 BUG_ON(atomic_inc_return(&evt->free) != 1); in ibmvfc_free_event()
1039 BUG_ON(atomic_dec_and_test(&evt->active)); in ibmvfc_free_event()
1041 spin_lock_irqsave(&evt->queue->l_lock, flags); in ibmvfc_free_event()
1042 list_add_tail(&evt->queue_list, &evt->queue->free); in ibmvfc_free_event()
1043 if (evt->reserved) { in ibmvfc_free_event()
1044 evt->reserved = 0; in ibmvfc_free_event()
1045 evt->queue->reserved_free++; in ibmvfc_free_event()
1047 evt->queue->evt_free++; in ibmvfc_free_event()
1049 if (evt->eh_comp) in ibmvfc_free_event()
1050 complete(evt->eh_comp); in ibmvfc_free_event()
1051 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_free_event()
1061 static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt) in ibmvfc_scsi_eh_done() argument
1063 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_scsi_eh_done()
1070 ibmvfc_free_event(evt); in ibmvfc_scsi_eh_done()
1082 struct ibmvfc_event *evt, *pos; in ibmvfc_complete_purge() local
1084 list_for_each_entry_safe(evt, pos, purge_list, queue_list) { in ibmvfc_complete_purge()
1085 list_del(&evt->queue_list); in ibmvfc_complete_purge()
1086 ibmvfc_trc_end(evt); in ibmvfc_complete_purge()
1087 evt->done(evt); in ibmvfc_complete_purge()
1099 static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code) in ibmvfc_fail_request() argument
1106 BUG_ON(!atomic_dec_and_test(&evt->active)); in ibmvfc_fail_request()
1107 if (evt->cmnd) { in ibmvfc_fail_request()
1108 evt->cmnd->result = (error_code << 16); in ibmvfc_fail_request()
1109 evt->done = ibmvfc_scsi_eh_done; in ibmvfc_fail_request()
1111 evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_DRIVER_FAILED); in ibmvfc_fail_request()
1113 del_timer(&evt->timer); in ibmvfc_fail_request()
1126 struct ibmvfc_event *evt, *pos; in ibmvfc_purge_requests() local
1137 list_for_each_entry_safe(evt, pos, &vhost->crq.sent, queue_list) in ibmvfc_purge_requests()
1138 ibmvfc_fail_request(evt, error_code); in ibmvfc_purge_requests()
1145 list_for_each_entry_safe(evt, pos, &queues[i].sent, queue_list) in ibmvfc_purge_requests()
1146 ibmvfc_fail_request(evt, error_code); in ibmvfc_purge_requests()
1540 struct ibmvfc_event *evt = NULL; in __ibmvfc_get_event() local
1545 evt = list_entry(queue->free.next, struct ibmvfc_event, queue_list); in __ibmvfc_get_event()
1546 evt->reserved = 1; in __ibmvfc_get_event()
1549 evt = list_entry(queue->free.next, struct ibmvfc_event, queue_list); in __ibmvfc_get_event()
1555 atomic_set(&evt->free, 0); in __ibmvfc_get_event()
1556 list_del(&evt->queue_list); in __ibmvfc_get_event()
1559 return evt; in __ibmvfc_get_event()
1573 static void ibmvfc_locked_done(struct ibmvfc_event *evt) in ibmvfc_locked_done() argument
1577 spin_lock_irqsave(evt->vhost->host->host_lock, flags); in ibmvfc_locked_done()
1578 evt->_done(evt); in ibmvfc_locked_done()
1579 spin_unlock_irqrestore(evt->vhost->host->host_lock, flags); in ibmvfc_locked_done()
1589 static void ibmvfc_init_event(struct ibmvfc_event *evt, in ibmvfc_init_event() argument
1592 evt->cmnd = NULL; in ibmvfc_init_event()
1593 evt->sync_iu = NULL; in ibmvfc_init_event()
1594 evt->eh_comp = NULL; in ibmvfc_init_event()
1595 evt->crq.format = format; in ibmvfc_init_event()
1597 evt->done = done; in ibmvfc_init_event()
1599 evt->_done = done; in ibmvfc_init_event()
1600 evt->done = ibmvfc_locked_done; in ibmvfc_init_event()
1602 evt->hwq = 0; in ibmvfc_init_event()
1635 struct ibmvfc_event *evt, in ibmvfc_map_sg_data() argument
1642 struct ibmvfc_fcp_cmd_iu *iu = ibmvfc_get_fcp_iu(evt->vhost, vfc_cmd); in ibmvfc_map_sg_data()
1672 if (!evt->ext_list) { in ibmvfc_map_sg_data()
1673 evt->ext_list = dma_pool_alloc(vhost->sg_pool, GFP_ATOMIC, in ibmvfc_map_sg_data()
1674 &evt->ext_list_token); in ibmvfc_map_sg_data()
1676 if (!evt->ext_list) { in ibmvfc_map_sg_data()
1684 ibmvfc_map_sg_list(scmd, sg_mapped, evt->ext_list); in ibmvfc_map_sg_data()
1686 data->va = cpu_to_be64(evt->ext_list_token); in ibmvfc_map_sg_data()
1700 struct ibmvfc_event *evt = from_timer(evt, t, timer); in ibmvfc_timeout() local
1701 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_timeout()
1702 dev_err(vhost->dev, "Command timed out (%p). Resetting connection\n", evt); in ibmvfc_timeout()
1714 static int ibmvfc_send_event(struct ibmvfc_event *evt, in ibmvfc_send_event() argument
1717 __be64 *crq_as_u64 = (__be64 *) &evt->crq; in ibmvfc_send_event()
1722 *evt->xfer_iu = evt->iu; in ibmvfc_send_event()
1723 if (evt->crq.format == IBMVFC_CMD_FORMAT) in ibmvfc_send_event()
1724 evt->xfer_iu->cmd.tag = cpu_to_be64((u64)evt); in ibmvfc_send_event()
1725 else if (evt->crq.format == IBMVFC_MAD_FORMAT) in ibmvfc_send_event()
1726 evt->xfer_iu->mad_common.tag = cpu_to_be64((u64)evt); in ibmvfc_send_event()
1730 timer_setup(&evt->timer, ibmvfc_timeout, 0); in ibmvfc_send_event()
1733 evt->timer.expires = jiffies + (timeout * HZ); in ibmvfc_send_event()
1734 add_timer(&evt->timer); in ibmvfc_send_event()
1737 spin_lock_irqsave(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1738 list_add_tail(&evt->queue_list, &evt->queue->sent); in ibmvfc_send_event()
1739 atomic_set(&evt->active, 1); in ibmvfc_send_event()
1743 if (evt->queue->fmt == IBMVFC_SUB_CRQ_FMT) in ibmvfc_send_event()
1745 evt->queue->vios_cookie, in ibmvfc_send_event()
1754 atomic_set(&evt->active, 0); in ibmvfc_send_event()
1755 list_del(&evt->queue_list); in ibmvfc_send_event()
1756 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1757 del_timer(&evt->timer); in ibmvfc_send_event()
1767 if (evt->cmnd) in ibmvfc_send_event()
1768 scsi_dma_unmap(evt->cmnd); in ibmvfc_send_event()
1769 ibmvfc_free_event(evt); in ibmvfc_send_event()
1774 if (evt->cmnd) { in ibmvfc_send_event()
1775 evt->cmnd->result = DID_ERROR << 16; in ibmvfc_send_event()
1776 evt->done = ibmvfc_scsi_eh_done; in ibmvfc_send_event()
1778 evt->xfer_iu->mad_common.status = cpu_to_be16(IBMVFC_MAD_CRQ_ERROR); in ibmvfc_send_event()
1780 evt->done(evt); in ibmvfc_send_event()
1782 spin_unlock_irqrestore(&evt->queue->l_lock, flags); in ibmvfc_send_event()
1783 ibmvfc_trc_start(evt); in ibmvfc_send_event()
1794 static void ibmvfc_log_error(struct ibmvfc_event *evt) in ibmvfc_log_error() argument
1796 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_log_error()
1797 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_log_error()
1799 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_log_error()
1852 static void ibmvfc_scsi_done(struct ibmvfc_event *evt) in ibmvfc_scsi_done() argument
1854 struct ibmvfc_cmd *vfc_cmd = &evt->xfer_iu->cmd; in ibmvfc_scsi_done()
1855 struct ibmvfc_fcp_rsp *rsp = ibmvfc_get_fcp_rsp(evt->vhost, vfc_cmd); in ibmvfc_scsi_done()
1856 struct scsi_cmnd *cmnd = evt->cmnd; in ibmvfc_scsi_done()
1869 cmnd->result = ibmvfc_get_err_result(evt->vhost, vfc_cmd); in ibmvfc_scsi_done()
1884 ibmvfc_log_error(evt); in ibmvfc_scsi_done()
1895 ibmvfc_free_event(evt); in ibmvfc_scsi_done()
1928 static struct ibmvfc_cmd *ibmvfc_init_vfc_cmd(struct ibmvfc_event *evt, struct scsi_device *sdev) in ibmvfc_init_vfc_cmd() argument
1931 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_init_vfc_cmd()
1932 struct ibmvfc_cmd *vfc_cmd = &evt->iu.cmd; in ibmvfc_init_vfc_cmd()
1943 vfc_cmd->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offset); in ibmvfc_init_vfc_cmd()
1969 struct ibmvfc_event *evt; in ibmvfc_queuecommand() local
1985 evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[scsi_channel]); in ibmvfc_queuecommand()
1986 if (!evt) in ibmvfc_queuecommand()
1989 evt->hwq = hwq % vhost->scsi_scrqs.active_queues; in ibmvfc_queuecommand()
1991 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_queuecommand()
1992 if (!evt) in ibmvfc_queuecommand()
1996 ibmvfc_init_event(evt, ibmvfc_scsi_done, IBMVFC_CMD_FORMAT); in ibmvfc_queuecommand()
1997 evt->cmnd = cmnd; in ibmvfc_queuecommand()
1999 vfc_cmd = ibmvfc_init_vfc_cmd(evt, cmnd->device); in ibmvfc_queuecommand()
2010 vfc_cmd->correlation = cpu_to_be64((u64)evt); in ibmvfc_queuecommand()
2012 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) in ibmvfc_queuecommand()
2013 return ibmvfc_send_event(evt, vhost, 0); in ibmvfc_queuecommand()
2015 ibmvfc_free_event(evt); in ibmvfc_queuecommand()
2033 static void ibmvfc_sync_completion(struct ibmvfc_event *evt) in ibmvfc_sync_completion() argument
2036 if (evt->sync_iu) in ibmvfc_sync_completion()
2037 *evt->sync_iu = *evt->xfer_iu; in ibmvfc_sync_completion()
2039 complete(&evt->comp); in ibmvfc_sync_completion()
2047 static void ibmvfc_bsg_timeout_done(struct ibmvfc_event *evt) in ibmvfc_bsg_timeout_done() argument
2049 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_bsg_timeout_done()
2051 ibmvfc_free_event(evt); in ibmvfc_bsg_timeout_done()
2067 struct ibmvfc_event *evt; in ibmvfc_bsg_timeout() local
2081 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_timeout()
2082 if (!evt) { in ibmvfc_bsg_timeout()
2087 ibmvfc_init_event(evt, ibmvfc_bsg_timeout_done, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_timeout()
2089 tmf = &evt->iu.tmf; in ibmvfc_bsg_timeout()
2097 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_bsg_timeout()
2125 struct ibmvfc_event *evt; in ibmvfc_bsg_plogi() local
2144 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_plogi()
2145 if (!evt) { in ibmvfc_bsg_plogi()
2149 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_plogi()
2150 plogi = &evt->iu.plogi; in ibmvfc_bsg_plogi()
2156 evt->sync_iu = &rsp_iu; in ibmvfc_bsg_plogi()
2157 init_completion(&evt->comp); in ibmvfc_bsg_plogi()
2159 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_bsg_plogi()
2165 wait_for_completion(&evt->comp); in ibmvfc_bsg_plogi()
2171 ibmvfc_free_event(evt); in ibmvfc_bsg_plogi()
2190 struct ibmvfc_event *evt; in ibmvfc_bsg_request() local
2266 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_request()
2267 if (!evt) { in ibmvfc_bsg_request()
2272 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_bsg_request()
2273 mad = &evt->iu.passthru; in ibmvfc_bsg_request()
2280 mad->cmd_ioba.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + in ibmvfc_bsg_request()
2294 mad->iu.tag = cpu_to_be64((u64)evt); in ibmvfc_bsg_request()
2297 evt->sync_iu = &rsp_iu; in ibmvfc_bsg_request()
2298 init_completion(&evt->comp); in ibmvfc_bsg_request()
2299 rc = ibmvfc_send_event(evt, vhost, 0); in ibmvfc_bsg_request()
2307 wait_for_completion(&evt->comp); in ibmvfc_bsg_request()
2315 ibmvfc_free_event(evt); in ibmvfc_bsg_request()
2345 struct ibmvfc_event *evt = NULL; in ibmvfc_reset_device() local
2356 evt = ibmvfc_get_event(&vhost->scsi_scrqs.scrqs[0]); in ibmvfc_reset_device()
2358 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_reset_device()
2360 if (!evt) { in ibmvfc_reset_device()
2365 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); in ibmvfc_reset_device()
2366 tmf = ibmvfc_init_vfc_cmd(evt, sdev); in ibmvfc_reset_device()
2373 evt->sync_iu = &rsp_iu; in ibmvfc_reset_device()
2375 init_completion(&evt->comp); in ibmvfc_reset_device()
2376 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_reset_device()
2387 wait_for_completion(&evt->comp); in ibmvfc_reset_device()
2406 ibmvfc_free_event(evt); in ibmvfc_reset_device()
2419 static int ibmvfc_match_rport(struct ibmvfc_event *evt, void *rport) in ibmvfc_match_rport() argument
2423 if (evt->cmnd) { in ibmvfc_match_rport()
2424 cmd_rport = starget_to_rport(scsi_target(evt->cmnd->device)); in ibmvfc_match_rport()
2439 static int ibmvfc_match_target(struct ibmvfc_event *evt, void *device) in ibmvfc_match_target() argument
2441 if (evt->cmnd && scsi_target(evt->cmnd->device) == device) in ibmvfc_match_target()
2454 static int ibmvfc_match_lun(struct ibmvfc_event *evt, void *device) in ibmvfc_match_lun() argument
2456 if (evt->cmnd && evt->cmnd->device == device) in ibmvfc_match_lun()
2468 static bool ibmvfc_event_is_free(struct ibmvfc_event *evt) in ibmvfc_event_is_free() argument
2472 list_for_each_entry(loop_evt, &evt->queue->free, queue_list) in ibmvfc_event_is_free()
2473 if (loop_evt == evt) in ibmvfc_event_is_free()
2491 struct ibmvfc_event *evt; in ibmvfc_wait_for_ops() local
2513 evt = &queues[q_index].evt_pool.events[i]; in ibmvfc_wait_for_ops()
2514 if (!ibmvfc_event_is_free(evt)) { in ibmvfc_wait_for_ops()
2515 if (match(evt, device)) { in ibmvfc_wait_for_ops()
2516 evt->eh_comp = ∁ in ibmvfc_wait_for_ops()
2534 evt = &queues[q_index].evt_pool.events[i]; in ibmvfc_wait_for_ops()
2535 if (!ibmvfc_event_is_free(evt)) { in ibmvfc_wait_for_ops()
2536 if (match(evt, device)) { in ibmvfc_wait_for_ops()
2537 evt->eh_comp = NULL; in ibmvfc_wait_for_ops()
2564 struct ibmvfc_event *evt; in ibmvfc_init_tmf() local
2567 evt = ibmvfc_get_reserved_event(queue); in ibmvfc_init_tmf()
2568 if (!evt) in ibmvfc_init_tmf()
2570 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); in ibmvfc_init_tmf()
2572 tmf = &evt->iu.tmf; in ibmvfc_init_tmf()
2593 init_completion(&evt->comp); in ibmvfc_init_tmf()
2595 return evt; in ibmvfc_init_tmf()
2601 struct ibmvfc_event *evt, *found_evt, *temp; in ibmvfc_cancel_all_mq() local
2616 list_for_each_entry(evt, &queues[i].sent, queue_list) { in ibmvfc_cancel_all_mq()
2617 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_cancel_all_mq()
2618 found_evt = evt; in ibmvfc_cancel_all_mq()
2625 evt = ibmvfc_init_tmf(&queues[i], sdev, type); in ibmvfc_cancel_all_mq()
2626 if (!evt) { in ibmvfc_cancel_all_mq()
2631 evt->sync_iu = &queues[i].cancel_rsp; in ibmvfc_cancel_all_mq()
2632 ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_cancel_all_mq()
2633 list_add_tail(&evt->cancel, &cancelq); in ibmvfc_cancel_all_mq()
2648 list_for_each_entry_safe(evt, temp, &cancelq, cancel) { in ibmvfc_cancel_all_mq()
2649 wait_for_completion(&evt->comp); in ibmvfc_cancel_all_mq()
2650 status = be16_to_cpu(evt->queue->cancel_rsp.mad_common.status); in ibmvfc_cancel_all_mq()
2651 list_del(&evt->cancel); in ibmvfc_cancel_all_mq()
2652 ibmvfc_free_event(evt); in ibmvfc_cancel_all_mq()
2681 struct ibmvfc_event *evt, *found_evt; in ibmvfc_cancel_all_sq() local
2691 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_cancel_all_sq()
2692 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_cancel_all_sq()
2693 found_evt = evt; in ibmvfc_cancel_all_sq()
2707 evt = ibmvfc_init_tmf(&vhost->crq, sdev, type); in ibmvfc_cancel_all_sq()
2708 evt->sync_iu = &rsp; in ibmvfc_cancel_all_sq()
2709 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_cancel_all_sq()
2724 wait_for_completion(&evt->comp); in ibmvfc_cancel_all_sq()
2727 ibmvfc_free_event(evt); in ibmvfc_cancel_all_sq()
2776 static int ibmvfc_match_key(struct ibmvfc_event *evt, void *key) in ibmvfc_match_key() argument
2780 if (evt->crq.format == IBMVFC_CMD_FORMAT && in ibmvfc_match_key()
2781 be32_to_cpu(evt->iu.cmd.cancel_key) == cancel_key) in ibmvfc_match_key()
2794 static int ibmvfc_match_evt(struct ibmvfc_event *evt, void *match) in ibmvfc_match_evt() argument
2796 if (evt == match) in ibmvfc_match_evt()
2816 struct ibmvfc_event *evt, *found_evt; in ibmvfc_abort_task_set() local
2827 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_abort_task_set()
2828 if (evt->cmnd && evt->cmnd->device == sdev) { in ibmvfc_abort_task_set()
2829 found_evt = evt; in ibmvfc_abort_task_set()
2843 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_abort_task_set()
2844 if (!evt) { in ibmvfc_abort_task_set()
2848 ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_CMD_FORMAT); in ibmvfc_abort_task_set()
2849 tmf = ibmvfc_init_vfc_cmd(evt, sdev); in ibmvfc_abort_task_set()
2856 evt->sync_iu = &rsp_iu; in ibmvfc_abort_task_set()
2858 tmf->correlation = cpu_to_be64((u64)evt); in ibmvfc_abort_task_set()
2860 init_completion(&evt->comp); in ibmvfc_abort_task_set()
2861 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_abort_task_set()
2872 timeout = wait_for_completion_timeout(&evt->comp, timeout); in ibmvfc_abort_task_set()
2891 rc = ibmvfc_wait_for_ops(vhost, evt, ibmvfc_match_evt); in ibmvfc_abort_task_set()
2921 ibmvfc_free_event(evt); in ibmvfc_abort_task_set()
3288 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_crq() local
3347 if (unlikely(!ibmvfc_valid_event(&vhost->crq.evt_pool, evt))) { in ibmvfc_handle_crq()
3353 if (unlikely(atomic_dec_if_positive(&evt->active))) { in ibmvfc_handle_crq()
3359 spin_lock(&evt->queue->l_lock); in ibmvfc_handle_crq()
3360 list_move_tail(&evt->queue_list, evt_doneq); in ibmvfc_handle_crq()
3361 spin_unlock(&evt->queue->l_lock); in ibmvfc_handle_crq()
3792 struct ibmvfc_event *evt, *temp; in ibmvfc_tasklet() local
3832 list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { in ibmvfc_tasklet()
3833 del_timer(&evt->timer); in ibmvfc_tasklet()
3834 list_del(&evt->queue_list); in ibmvfc_tasklet()
3835 ibmvfc_trc_end(evt); in ibmvfc_tasklet()
3836 evt->done(evt); in ibmvfc_tasklet()
3863 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_scrq() local
3879 if (unlikely(!ibmvfc_valid_event(&evt->queue->evt_pool, evt))) { in ibmvfc_handle_scrq()
3885 if (unlikely(atomic_dec_if_positive(&evt->active))) { in ibmvfc_handle_scrq()
3891 spin_lock(&evt->queue->l_lock); in ibmvfc_handle_scrq()
3892 list_move_tail(&evt->queue_list, evt_doneq); in ibmvfc_handle_scrq()
3893 spin_unlock(&evt->queue->l_lock); in ibmvfc_handle_scrq()
3914 struct ibmvfc_event *evt, *temp; in ibmvfc_drain_sub_crq() local
3938 list_for_each_entry_safe(evt, temp, &evt_doneq, queue_list) { in ibmvfc_drain_sub_crq()
3939 del_timer(&evt->timer); in ibmvfc_drain_sub_crq()
3940 list_del(&evt->queue_list); in ibmvfc_drain_sub_crq()
3941 ibmvfc_trc_end(evt); in ibmvfc_drain_sub_crq()
3942 evt->done(evt); in ibmvfc_drain_sub_crq()
4029 static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) in ibmvfc_tgt_prli_done() argument
4031 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_prli_done()
4032 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_prli_done()
4033 struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; in ibmvfc_tgt_prli_done()
4089 ibmvfc_free_event(evt); in ibmvfc_tgt_prli_done()
4102 struct ibmvfc_event *evt; in ibmvfc_tgt_send_prli() local
4108 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_send_prli()
4109 if (!evt) { in ibmvfc_tgt_send_prli()
4116 ibmvfc_init_event(evt, ibmvfc_tgt_prli_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_send_prli()
4117 evt->tgt = tgt; in ibmvfc_tgt_send_prli()
4118 prli = &evt->iu.prli; in ibmvfc_tgt_send_prli()
4139 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_send_prli()
4152 static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) in ibmvfc_tgt_plogi_done() argument
4154 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_plogi_done()
4155 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_plogi_done()
4156 struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; in ibmvfc_tgt_plogi_done()
4201 ibmvfc_free_event(evt); in ibmvfc_tgt_plogi_done()
4214 struct ibmvfc_event *evt; in ibmvfc_tgt_send_plogi() local
4221 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_send_plogi()
4222 if (!evt) { in ibmvfc_tgt_send_plogi()
4230 ibmvfc_init_event(evt, ibmvfc_tgt_plogi_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_send_plogi()
4231 evt->tgt = tgt; in ibmvfc_tgt_send_plogi()
4232 plogi = &evt->iu.plogi; in ibmvfc_tgt_send_plogi()
4244 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_send_plogi()
4257 static void ibmvfc_tgt_implicit_logout_done(struct ibmvfc_event *evt) in ibmvfc_tgt_implicit_logout_done() argument
4259 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_implicit_logout_done()
4260 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_implicit_logout_done()
4261 struct ibmvfc_implicit_logout *rsp = &evt->xfer_iu->implicit_logout; in ibmvfc_tgt_implicit_logout_done()
4265 ibmvfc_free_event(evt); in ibmvfc_tgt_implicit_logout_done()
4300 struct ibmvfc_event *evt; in __ibmvfc_tgt_get_implicit_logout_evt() local
4303 evt = ibmvfc_get_reserved_event(&vhost->crq); in __ibmvfc_tgt_get_implicit_logout_evt()
4304 if (!evt) in __ibmvfc_tgt_get_implicit_logout_evt()
4306 ibmvfc_init_event(evt, done, IBMVFC_MAD_FORMAT); in __ibmvfc_tgt_get_implicit_logout_evt()
4307 evt->tgt = tgt; in __ibmvfc_tgt_get_implicit_logout_evt()
4308 mad = &evt->iu.implicit_logout; in __ibmvfc_tgt_get_implicit_logout_evt()
4314 return evt; in __ibmvfc_tgt_get_implicit_logout_evt()
4325 struct ibmvfc_event *evt; in ibmvfc_tgt_implicit_logout() local
4331 evt = __ibmvfc_tgt_get_implicit_logout_evt(tgt, in ibmvfc_tgt_implicit_logout()
4333 if (!evt) { in ibmvfc_tgt_implicit_logout()
4342 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_implicit_logout()
4355 static void ibmvfc_tgt_implicit_logout_and_del_done(struct ibmvfc_event *evt) in ibmvfc_tgt_implicit_logout_and_del_done() argument
4357 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_implicit_logout_and_del_done()
4358 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_implicit_logout_and_del_done()
4359 struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; in ibmvfc_tgt_implicit_logout_and_del_done()
4363 ibmvfc_free_event(evt); in ibmvfc_tgt_implicit_logout_and_del_done()
4390 struct ibmvfc_event *evt; in ibmvfc_tgt_implicit_logout_and_del() local
4401 evt = __ibmvfc_tgt_get_implicit_logout_evt(tgt, in ibmvfc_tgt_implicit_logout_and_del()
4405 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_implicit_logout_and_del()
4418 static void ibmvfc_tgt_move_login_done(struct ibmvfc_event *evt) in ibmvfc_tgt_move_login_done() argument
4420 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_move_login_done()
4421 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_move_login_done()
4422 struct ibmvfc_move_login *rsp = &evt->xfer_iu->move_login; in ibmvfc_tgt_move_login_done()
4458 ibmvfc_free_event(evt); in ibmvfc_tgt_move_login_done()
4472 struct ibmvfc_event *evt; in ibmvfc_tgt_move_login() local
4478 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_move_login()
4479 if (!evt) { in ibmvfc_tgt_move_login()
4487 ibmvfc_init_event(evt, ibmvfc_tgt_move_login_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_move_login()
4488 evt->tgt = tgt; in ibmvfc_tgt_move_login()
4489 move = &evt->iu.move_login; in ibmvfc_tgt_move_login()
4500 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_move_login()
4533 static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt) in ibmvfc_tgt_adisc_done() argument
4535 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_adisc_done()
4536 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_adisc_done()
4537 struct ibmvfc_passthru_mad *mad = &evt->xfer_iu->passthru; in ibmvfc_tgt_adisc_done()
4567 ibmvfc_free_event(evt); in ibmvfc_tgt_adisc_done()
4576 static void ibmvfc_init_passthru(struct ibmvfc_event *evt) in ibmvfc_init_passthru() argument
4578 struct ibmvfc_passthru_mad *mad = &evt->iu.passthru; in ibmvfc_init_passthru()
4584 mad->cmd_ioba.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4589 mad->iu.cmd.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4593 mad->iu.rsp.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4609 static void ibmvfc_tgt_adisc_cancel_done(struct ibmvfc_event *evt) in ibmvfc_tgt_adisc_cancel_done() argument
4611 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_adisc_cancel_done()
4612 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_adisc_cancel_done()
4616 ibmvfc_free_event(evt); in ibmvfc_tgt_adisc_cancel_done()
4633 struct ibmvfc_event *evt; in ibmvfc_adisc_timeout() local
4650 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_adisc_timeout()
4651 if (!evt) { in ibmvfc_adisc_timeout()
4659 ibmvfc_init_event(evt, ibmvfc_tgt_adisc_cancel_done, IBMVFC_MAD_FORMAT); in ibmvfc_adisc_timeout()
4661 evt->tgt = tgt; in ibmvfc_adisc_timeout()
4662 tmf = &evt->iu.tmf; in ibmvfc_adisc_timeout()
4675 rc = ibmvfc_send_event(evt, vhost, default_timeout); in ibmvfc_adisc_timeout()
4702 struct ibmvfc_event *evt; in ibmvfc_tgt_adisc() local
4708 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_adisc()
4709 if (!evt) { in ibmvfc_tgt_adisc()
4716 ibmvfc_init_event(evt, ibmvfc_tgt_adisc_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_adisc()
4717 evt->tgt = tgt; in ibmvfc_tgt_adisc()
4719 ibmvfc_init_passthru(evt); in ibmvfc_tgt_adisc()
4720 mad = &evt->iu.passthru; in ibmvfc_tgt_adisc()
4740 if (ibmvfc_send_event(evt, vhost, IBMVFC_ADISC_PLUS_CANCEL_TIMEOUT)) { in ibmvfc_tgt_adisc()
4754 static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) in ibmvfc_tgt_query_target_done() argument
4756 struct ibmvfc_target *tgt = evt->tgt; in ibmvfc_tgt_query_target_done()
4757 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_tgt_query_target_done()
4758 struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; in ibmvfc_tgt_query_target_done()
4798 ibmvfc_free_event(evt); in ibmvfc_tgt_query_target_done()
4811 struct ibmvfc_event *evt; in ibmvfc_tgt_query_target() local
4817 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_query_target()
4818 if (!evt) { in ibmvfc_tgt_query_target()
4825 evt->tgt = tgt; in ibmvfc_tgt_query_target()
4826 ibmvfc_init_event(evt, ibmvfc_tgt_query_target_done, IBMVFC_MAD_FORMAT); in ibmvfc_tgt_query_target()
4827 query_tgt = &evt->iu.query_tgt; in ibmvfc_tgt_query_target()
4835 if (ibmvfc_send_event(evt, vhost, default_timeout)) { in ibmvfc_tgt_query_target()
4956 static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt) in ibmvfc_discover_targets_done() argument
4958 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_discover_targets_done()
4959 struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; in ibmvfc_discover_targets_done()
4983 ibmvfc_free_event(evt); in ibmvfc_discover_targets_done()
4995 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_discover_targets() local
4998 if (!evt) { in ibmvfc_discover_targets()
5004 ibmvfc_init_event(evt, ibmvfc_discover_targets_done, IBMVFC_MAD_FORMAT); in ibmvfc_discover_targets()
5005 mad = &evt->iu.discover_targets; in ibmvfc_discover_targets()
5016 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_discover_targets()
5022 static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt) in ibmvfc_channel_setup_done() argument
5024 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_channel_setup_done()
5027 u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status); in ibmvfc_channel_setup_done()
5031 ibmvfc_free_event(evt); in ibmvfc_channel_setup_done()
5076 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_channel_setup() local
5083 if (!evt) { in ibmvfc_channel_setup()
5098 ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT); in ibmvfc_channel_setup()
5099 mad = &evt->iu.channel_setup; in ibmvfc_channel_setup()
5109 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_channel_setup()
5115 static void ibmvfc_channel_enquiry_done(struct ibmvfc_event *evt) in ibmvfc_channel_enquiry_done() argument
5117 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_channel_enquiry_done()
5118 struct ibmvfc_channel_enquiry *rsp = &evt->xfer_iu->channel_enquiry; in ibmvfc_channel_enquiry_done()
5126 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
5133 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
5139 ibmvfc_free_event(evt); in ibmvfc_channel_enquiry_done()
5149 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_channel_enquiry() local
5152 if (!evt) { in ibmvfc_channel_enquiry()
5158 ibmvfc_init_event(evt, ibmvfc_channel_enquiry_done, IBMVFC_MAD_FORMAT); in ibmvfc_channel_enquiry()
5159 mad = &evt->iu.channel_enquiry; in ibmvfc_channel_enquiry()
5172 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_channel_enquiry()
5183 static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) in ibmvfc_npiv_login_done() argument
5185 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_npiv_login_done()
5186 u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_login.common.status); in ibmvfc_npiv_login_done()
5193 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5203 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5209 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5214 ibmvfc_free_event(evt); in ibmvfc_npiv_login_done()
5277 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_npiv_login() local
5279 if (!evt) { in ibmvfc_npiv_login()
5287 ibmvfc_init_event(evt, ibmvfc_npiv_login_done, IBMVFC_MAD_FORMAT); in ibmvfc_npiv_login()
5290 mad = &evt->iu.npiv_login; in ibmvfc_npiv_login()
5300 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_npiv_login()
5311 static void ibmvfc_npiv_logout_done(struct ibmvfc_event *evt) in ibmvfc_npiv_logout_done() argument
5313 struct ibmvfc_host *vhost = evt->vhost; in ibmvfc_npiv_logout_done()
5314 u32 mad_status = be16_to_cpu(evt->xfer_iu->npiv_logout.common.status); in ibmvfc_npiv_logout_done()
5316 ibmvfc_free_event(evt); in ibmvfc_npiv_logout_done()
5346 struct ibmvfc_event *evt; in ibmvfc_npiv_logout() local
5348 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_npiv_logout()
5349 if (!evt) { in ibmvfc_npiv_logout()
5355 ibmvfc_init_event(evt, ibmvfc_npiv_logout_done, IBMVFC_MAD_FORMAT); in ibmvfc_npiv_logout()
5357 mad = &evt->iu.npiv_logout; in ibmvfc_npiv_logout()
5365 if (!ibmvfc_send_event(evt, vhost, default_timeout)) in ibmvfc_npiv_logout()