Lines Matching full:crq

135 	{ IBMVFC_VIOS_FAILURE, IBMVFC_CRQ_FAILURE, DID_REQUEUE, 1, 1, "CRQ failure" },
232 entry->fmt = evt->crq.format; in ibmvfc_trc_start()
269 entry->fmt = evt->crq.format; in ibmvfc_trc_end()
733 * ibmvfc_send_crq - Send a CRQ
757 * ibmvfc_send_crq_init - Send a CRQ init message
765 ibmvfc_dbg(vhost, "Sending CRQ init\n"); in ibmvfc_send_crq_init()
770 * ibmvfc_send_crq_init_complete - Send a CRQ init complete message
778 ibmvfc_dbg(vhost, "Sending CRQ init complete\n"); in ibmvfc_send_crq_init_complete()
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()
892 * ibmvfc_release_crq_queue - Deallocates data and unregisters CRQ
896 * the crq with the hypervisor.
902 struct ibmvfc_queue *crq = &vhost->crq; in ibmvfc_release_crq_queue() local
904 ibmvfc_dbg(vhost, "Releasing CRQ\n"); in ibmvfc_release_crq_queue()
916 ibmvfc_free_queue(vhost, crq); in ibmvfc_release_crq_queue()
920 * ibmvfc_reenable_crq_queue - reenables the CRQ
934 /* Re-enable the CRQ */ in ibmvfc_reenable_crq_queue()
945 spin_lock(vhost->crq.q_lock); in ibmvfc_reenable_crq_queue()
948 spin_unlock(vhost->crq.q_lock); in ibmvfc_reenable_crq_queue()
957 * ibmvfc_reset_crq - resets a crq after a failure
968 struct ibmvfc_queue *crq = &vhost->crq; in ibmvfc_reset_crq() local
972 /* Close the CRQ */ in ibmvfc_reset_crq()
980 spin_lock(vhost->crq.q_lock); in ibmvfc_reset_crq()
987 memset(crq->msgs.crq, 0, PAGE_SIZE); in ibmvfc_reset_crq()
988 crq->cur = 0; in ibmvfc_reset_crq()
992 crq->msg_token, PAGE_SIZE); in ibmvfc_reset_crq()
998 dev_warn(vhost->dev, "Couldn't register crq (rc=%d)\n", rc); in ibmvfc_reset_crq()
1000 spin_unlock(vhost->crq.q_lock); in ibmvfc_reset_crq()
1136 spin_lock_irqsave(&vhost->crq.l_lock, flags); in ibmvfc_purge_requests()
1137 list_for_each_entry_safe(evt, pos, &vhost->crq.sent, queue_list) in ibmvfc_purge_requests()
1139 list_splice_init(&vhost->crq.sent, &vhost->purge); in ibmvfc_purge_requests()
1140 spin_unlock_irqrestore(&vhost->crq.l_lock, flags); in ibmvfc_purge_requests()
1154 * ibmvfc_hard_reset_host - Reset the connection to the server by breaking the CRQ
1595 evt->crq.format = format; in ibmvfc_init_event()
1717 __be64 *crq_as_u64 = (__be64 *) &evt->crq; in ibmvfc_send_event()
1723 if (evt->crq.format == IBMVFC_CMD_FORMAT) in ibmvfc_send_event()
1725 else if (evt->crq.format == IBMVFC_MAD_FORMAT) in ibmvfc_send_event()
1760 * Firmware will send a CRQ with a transport event (0xFF) to in ibmvfc_send_event()
1943 vfc_cmd->resp.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + offset); in ibmvfc_init_vfc_cmd()
1991 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_queuecommand()
2081 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_timeout()
2144 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_plogi()
2266 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_bsg_request()
2280 mad->cmd_ioba.va = cpu_to_be64(be64_to_cpu(evt->crq.ioba) + in ibmvfc_bsg_request()
2358 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_reset_device()
2503 queues = &vhost->crq; in ibmvfc_wait_for_ops()
2690 spin_lock(&vhost->crq.l_lock); in ibmvfc_cancel_all_sq()
2691 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_cancel_all_sq()
2697 spin_unlock(&vhost->crq.l_lock); in ibmvfc_cancel_all_sq()
2707 evt = ibmvfc_init_tmf(&vhost->crq, sdev, type); in ibmvfc_cancel_all_sq()
2780 if (evt->crq.format == IBMVFC_CMD_FORMAT && in ibmvfc_match_key()
2826 spin_lock(&vhost->crq.l_lock); in ibmvfc_abort_task_set()
2827 list_for_each_entry(evt, &vhost->crq.sent, queue_list) { in ibmvfc_abort_task_set()
2833 spin_unlock(&vhost->crq.l_lock); in ibmvfc_abort_task_set()
2843 evt = ibmvfc_get_event(&vhost->crq); in ibmvfc_abort_task_set()
3189 * @crq: crq to process
3193 static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, in ibmvfc_handle_async() argument
3196 const struct ibmvfc_async_desc *desc = ibmvfc_get_ae_desc(be64_to_cpu(crq->event)); in ibmvfc_handle_async()
3200 " node_name: %llx%s\n", desc->desc, be64_to_cpu(crq->scsi_id), in ibmvfc_handle_async()
3201 be64_to_cpu(crq->wwpn), be64_to_cpu(crq->node_name), in ibmvfc_handle_async()
3202 ibmvfc_get_link_state(crq->link_state)); in ibmvfc_handle_async()
3204 switch (be64_to_cpu(crq->event)) { in ibmvfc_handle_async()
3206 switch (crq->link_state) { in ibmvfc_handle_async()
3245 if (!crq->scsi_id && !crq->wwpn && !crq->node_name) in ibmvfc_handle_async()
3247 if (crq->scsi_id && cpu_to_be64(tgt->scsi_id) != crq->scsi_id) in ibmvfc_handle_async()
3249 if (crq->wwpn && cpu_to_be64(tgt->ids.port_name) != crq->wwpn) in ibmvfc_handle_async()
3251 if (crq->node_name && cpu_to_be64(tgt->ids.node_name) != crq->node_name) in ibmvfc_handle_async()
3253 if (tgt->need_login && be64_to_cpu(crq->event) == IBMVFC_AE_ELS_LOGO) in ibmvfc_handle_async()
3255 if (!tgt->need_login || be64_to_cpu(crq->event) == IBMVFC_AE_ELS_PLOGI) { in ibmvfc_handle_async()
3272 dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event); in ibmvfc_handle_async()
3278 * ibmvfc_handle_crq - Handles and frees received events in the CRQ
3279 * @crq: Command/Response queue
3284 static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost, in ibmvfc_handle_crq() argument
3288 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_crq()
3290 switch (crq->valid) { in ibmvfc_handle_crq()
3292 switch (crq->format) { in ibmvfc_handle_crq()
3307 dev_err(vhost->dev, "Unknown crq message type: %d\n", crq->format); in ibmvfc_handle_crq()
3314 if (crq->format == IBMVFC_PARTITION_MIGRATED) { in ibmvfc_handle_crq()
3324 } else if (crq->format == IBMVFC_PARTNER_FAILED || crq->format == IBMVFC_PARTNER_DEREGISTER) { in ibmvfc_handle_crq()
3325 dev_err(vhost->dev, "Host partner adapter deregistered or failed (rc=%d)\n", crq->format); in ibmvfc_handle_crq()
3330 dev_err(vhost->dev, "Received unknown transport event from partner (rc=%d)\n", crq->format); in ibmvfc_handle_crq()
3336 dev_err(vhost->dev, "Got an invalid message type 0x%02x\n", crq->valid); in ibmvfc_handle_crq()
3340 if (crq->format == IBMVFC_ASYNC_EVENT) in ibmvfc_handle_crq()
3347 if (unlikely(!ibmvfc_valid_event(&vhost->crq.evt_pool, evt))) { in ibmvfc_handle_crq()
3349 crq->ioba); in ibmvfc_handle_crq()
3355 crq->ioba); in ibmvfc_handle_crq()
3725 struct ibmvfc_async_crq *crq; in ibmvfc_next_async_crq() local
3727 crq = &async_crq->msgs.async[async_crq->cur]; in ibmvfc_next_async_crq()
3728 if (crq->valid & 0x80) { in ibmvfc_next_async_crq()
3733 crq = NULL; in ibmvfc_next_async_crq()
3735 return crq; in ibmvfc_next_async_crq()
3747 struct ibmvfc_queue *queue = &vhost->crq; in ibmvfc_next_crq()
3748 struct ibmvfc_crq *crq; in ibmvfc_next_crq() local
3750 crq = &queue->msgs.crq[queue->cur]; in ibmvfc_next_crq()
3751 if (crq->valid & 0x80) { in ibmvfc_next_crq()
3756 crq = NULL; in ibmvfc_next_crq()
3758 return crq; in ibmvfc_next_crq()
3792 struct ibmvfc_crq *crq; in ibmvfc_tasklet() local
3800 spin_lock(vhost->crq.q_lock); in ibmvfc_tasklet()
3802 /* Pull all the valid messages off the async CRQ */ in ibmvfc_tasklet()
3809 /* Pull all the valid messages off the CRQ */ in ibmvfc_tasklet()
3810 while ((crq = ibmvfc_next_crq(vhost)) != NULL) { in ibmvfc_tasklet()
3811 ibmvfc_handle_crq(crq, vhost, &evt_doneq); in ibmvfc_tasklet()
3812 crq->valid = 0; in ibmvfc_tasklet()
3822 } else if ((crq = ibmvfc_next_crq(vhost)) != NULL) { in ibmvfc_tasklet()
3824 ibmvfc_handle_crq(crq, vhost, &evt_doneq); in ibmvfc_tasklet()
3825 crq->valid = 0; in ibmvfc_tasklet()
3831 spin_unlock(vhost->crq.q_lock); in ibmvfc_tasklet()
3856 dev_err(dev, "Couldn't %s sub-crq[%lu] irq. rc=%ld\n", in ibmvfc_toggle_scrq_irq()
3862 static void ibmvfc_handle_scrq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost, in ibmvfc_handle_scrq() argument
3865 struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); in ibmvfc_handle_scrq()
3867 switch (crq->valid) { in ibmvfc_handle_scrq()
3873 dev_err(vhost->dev, "Got and invalid message type 0x%02x\n", crq->valid); in ibmvfc_handle_scrq()
3883 crq->ioba); in ibmvfc_handle_scrq()
3889 crq->ioba); in ibmvfc_handle_scrq()
3900 struct ibmvfc_crq *crq; in ibmvfc_next_scrq() local
3902 crq = &scrq->msgs.scrq[scrq->cur].crq; in ibmvfc_next_scrq()
3903 if (crq->valid & 0x80) { in ibmvfc_next_scrq()
3908 crq = NULL; in ibmvfc_next_scrq()
3910 return crq; in ibmvfc_next_scrq()
3915 struct ibmvfc_crq *crq; in ibmvfc_drain_sub_crq() local
3923 while ((crq = ibmvfc_next_scrq(scrq)) != NULL) { in ibmvfc_drain_sub_crq()
3924 ibmvfc_handle_scrq(crq, scrq->vhost, &evt_doneq); in ibmvfc_drain_sub_crq()
3925 crq->valid = 0; in ibmvfc_drain_sub_crq()
3930 if ((crq = ibmvfc_next_scrq(scrq)) != NULL) { in ibmvfc_drain_sub_crq()
3932 ibmvfc_handle_scrq(crq, scrq->vhost, &evt_doneq); in ibmvfc_drain_sub_crq()
3933 crq->valid = 0; in ibmvfc_drain_sub_crq()
4110 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_send_prli()
4223 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_send_plogi()
4305 evt = ibmvfc_get_reserved_event(&vhost->crq); in __ibmvfc_tgt_get_implicit_logout_evt()
4480 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_move_login()
4586 mad->cmd_ioba.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4591 mad->iu.cmd.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4595 mad->iu.rsp.va = cpu_to_be64((u64)be64_to_cpu(evt->crq.ioba) + in ibmvfc_init_passthru()
4608 * which will fire and cause the CRQ to get reset.
4628 * out, reset the CRQ. When the ADISC comes back as cancelled,
4652 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_adisc_timeout()
4698 * also failed, so we need to reset the CRQ.
4710 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_adisc()
4819 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_tgt_query_target()
4997 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_discover_targets()
5078 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_channel_setup()
5151 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_channel_enquiry()
5279 struct ibmvfc_event *evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_npiv_login()
5322 if (list_empty(&vhost->crq.sent) && in ibmvfc_npiv_logout_done()
5350 evt = ibmvfc_get_reserved_event(&vhost->crq); in ibmvfc_npiv_logout()
5590 * before sending the crq init. in ibmvfc_do_work()
5613 * sending the crq init. in ibmvfc_do_work()
5809 fmt_size = sizeof(*queue->msgs.crq); in ibmvfc_alloc_queue()
5856 * ibmvfc_init_crq - Initializes and registers CRQ with hypervisor
5860 * the crq with the hypervisor.
5870 struct ibmvfc_queue *crq = &vhost->crq; in ibmvfc_init_crq() local
5873 if (ibmvfc_alloc_queue(vhost, crq, IBMVFC_CRQ_FMT)) in ibmvfc_init_crq()
5877 crq->msg_token, PAGE_SIZE); in ibmvfc_init_crq()
5913 ibmvfc_free_queue(vhost, crq); in ibmvfc_init_crq()
5931 /* H_CLOSED indicates successful register, but no CRQ partner */ in ibmvfc_register_channel()
5933 dev_warn(dev, "Error registering sub-crq: %d\n", rc); in ibmvfc_register_channel()
5943 dev_err(dev, "Error mapping sub-crq[%d] irq\n", index); in ibmvfc_register_channel()
5967 dev_err(dev, "Couldn't register sub-crq[%d] irq\n", index); in ibmvfc_register_channel()
6007 dev_err(dev, "Failed to free sub-crq[%d]: rc=%ld\n", index, rc); in ibmvfc_deregister_channel()
6010 memset(scrq->msgs.crq, 0, PAGE_SIZE); in ibmvfc_deregister_channel()
6381 dev_err(dev, "Couldn't initialize crq. rc=%d\n", rc); in ibmvfc_probe()