Lines Matching refs:snic
80 static void snic_scsi_cleanup(struct snic *, int);
112 snic_io_lock_hash(struct snic *snic, struct scsi_cmnd *sc) in snic_io_lock_hash() argument
116 return &snic->io_req_lock[hash]; in snic_io_lock_hash()
120 snic_io_lock_tag(struct snic *snic, int tag) in snic_io_lock_tag() argument
122 return &snic->io_req_lock[tag & (SNIC_IO_LOCKS - 1)]; in snic_io_lock_tag()
127 snic_release_req_buf(struct snic *snic, in snic_release_req_buf() argument
142 SNIC_SCSI_DBG(snic->shost, in snic_release_req_buf()
149 dma_unmap_single(&snic->pdev->dev, in snic_release_req_buf()
156 snic_req_free(snic, rqi); in snic_release_req_buf()
163 snic_queue_icmnd_req(struct snic *snic, in snic_queue_icmnd_req() argument
188 pa = dma_map_single(&snic->pdev->dev, in snic_queue_icmnd_req()
192 if (dma_mapping_error(&snic->pdev->dev, pa)) { in snic_queue_icmnd_req()
193 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
210 snic->config.hid, /* hid */ in snic_queue_icmnd_req()
223 atomic64_inc(&snic->s_stats.io.active); in snic_queue_icmnd_req()
224 ret = snic_queue_wq_desc(snic, rqi->req, rqi->req_len); in snic_queue_icmnd_req()
226 atomic64_dec(&snic->s_stats.io.active); in snic_queue_icmnd_req()
227 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
231 snic_stats_update_active_ios(&snic->s_stats); in snic_queue_icmnd_req()
240 snic_issue_scsi_req(struct snic *snic, in snic_issue_scsi_req() argument
256 SNIC_TRC((u16)snic->shost->host_no, tag, (ulong) sc, 0, in snic_issue_scsi_req()
259 SNIC_HOST_ERR(snic->shost, "issue_sc:Failed to map SG List.\n"); in snic_issue_scsi_req()
265 rqi = snic_req_init(snic, sg_cnt); in snic_issue_scsi_req()
281 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_scsi_req()
284 ret = snic_queue_icmnd_req(snic, rqi, sc, sg_cnt); in snic_issue_scsi_req()
286 SNIC_HOST_ERR(snic->shost, in snic_issue_scsi_req()
298 snic_release_req_buf(snic, rqi, sc); in snic_issue_scsi_req()
300 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, 0, 0, 0, in snic_issue_scsi_req()
305 struct snic_io_stats *iostats = &snic->s_stats.io; in snic_issue_scsi_req()
313 SNIC_SCSI_DBG(snic->shost, in snic_issue_scsi_req()
317 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, (ulong) rqi, in snic_issue_scsi_req()
336 struct snic *snic = shost_priv(shost); in snic_queuecommand() local
343 atomic64_inc(&snic->s_stats.misc.tgt_not_rdy); in snic_queuecommand()
350 if (snic_get_state(snic) != SNIC_ONLINE) { in snic_queuecommand()
352 snic_state_str[snic_get_state(snic)]); in snic_queuecommand()
356 atomic_inc(&snic->ios_inflight); in snic_queuecommand()
361 ret = snic_issue_scsi_req(snic, tgt, sc); in snic_queuecommand()
367 atomic_dec(&snic->ios_inflight); in snic_queuecommand()
377 snic_proc_tmreq_pending_state(struct snic *snic, in snic_proc_tmreq_pending_state() argument
409 snic_process_io_failed_state(struct snic *snic, in snic_process_io_failed_state() argument
418 atomic64_inc(&snic->s_stats.misc.io_tmo); in snic_process_io_failed_state()
423 atomic64_inc(&snic->s_stats.misc.io_aborted); in snic_process_io_failed_state()
428 atomic64_inc(&snic->s_stats.misc.data_cnt_mismat); in snic_process_io_failed_state()
434 atomic64_inc(&snic->s_stats.fw.out_of_res); in snic_process_io_failed_state()
439 atomic64_inc(&snic->s_stats.io.io_not_found); in snic_process_io_failed_state()
444 atomic64_inc(&snic->s_stats.misc.sgl_inval); in snic_process_io_failed_state()
449 atomic64_inc(&snic->s_stats.fw.io_errs); in snic_process_io_failed_state()
454 atomic64_inc(&snic->s_stats.fw.scsi_errs); in snic_process_io_failed_state()
468 SNIC_SCSI_DBG(snic->shost, in snic_process_io_failed_state()
474 SNIC_HOST_ERR(snic->shost, "fw returns failed status %s flags 0x%llx\n", in snic_process_io_failed_state()
498 snic_process_icmnd_cmpl_status(struct snic *snic, in snic_process_icmnd_cmpl_status() argument
520 atomic64_inc(&snic->s_stats.misc.io_under_run); in snic_process_icmnd_cmpl_status()
524 atomic64_inc(&snic->s_stats.misc.qfull); in snic_process_icmnd_cmpl_status()
528 snic_process_io_failed_state(snic, icmnd_cmpl, sc, cmpl_stat); in snic_process_icmnd_cmpl_status()
529 atomic64_inc(&snic->s_stats.io.fail); in snic_process_icmnd_cmpl_status()
530 SNIC_HOST_ERR(snic->shost, in snic_process_icmnd_cmpl_status()
545 snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_icmnd_cmpl_handler() argument
562 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
566 if (cmnd_id >= snic->max_tag_id) { in snic_icmnd_cmpl_handler()
567 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
573 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_icmnd_cmpl_handler()
577 atomic64_inc(&snic->s_stats.io.sc_null); in snic_icmnd_cmpl_handler()
578 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
584 SNIC_TRC(snic->shost->host_no, cmnd_id, 0, in snic_icmnd_cmpl_handler()
592 io_lock = snic_io_lock_hash(snic, sc); in snic_icmnd_cmpl_handler()
596 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
610 atomic64_inc(&snic->s_stats.io.req_null); in snic_icmnd_cmpl_handler()
614 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
632 snic_proc_tmreq_pending_state(snic, sc, hdr_stat); in snic_icmnd_cmpl_handler()
635 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
641 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
648 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
655 if (snic_process_icmnd_cmpl_status(snic, icmnd_cmpl, hdr_stat, sc)) { in snic_icmnd_cmpl_handler()
657 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
670 snic_calc_io_process_time(snic, rqi); in snic_icmnd_cmpl_handler()
672 snic_release_req_buf(snic, rqi, sc); in snic_icmnd_cmpl_handler()
674 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
682 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
686 snic_proc_dr_cmpl_locked(struct snic *snic, in snic_proc_dr_cmpl_locked() argument
697 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", in snic_proc_dr_cmpl_locked()
703 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
707 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
718 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
722 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
734 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
748 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) in snic_update_abort_stats() argument
750 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; in snic_update_abort_stats()
752 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); in snic_update_abort_stats()
773 snic_process_itmf_cmpl(struct snic *snic, in snic_process_itmf_cmpl() argument
786 io_lock = snic_io_lock_hash(snic, sc); in snic_process_itmf_cmpl()
797 atomic64_inc(&snic->s_stats.io.req_null); in snic_process_itmf_cmpl()
800 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
817 snic_update_abort_stats(snic, cmpl_stat); in snic_process_itmf_cmpl()
830 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
850 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
856 snic_release_req_buf(snic, rqi, sc); in snic_process_itmf_cmpl()
859 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_process_itmf_cmpl()
871 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); in snic_process_itmf_cmpl()
884 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
898 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
901 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
920 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_itmf_cmpl_handler() argument
932 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
937 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
949 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { in snic_itmf_cmpl_handler()
950 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
958 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); in snic_itmf_cmpl_handler()
963 atomic64_inc(&snic->s_stats.io.sc_null); in snic_itmf_cmpl_handler()
964 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
971 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); in snic_itmf_cmpl_handler()
977 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) in snic_hba_reset_scsi_cleanup() argument
979 struct snic_stats *st = &snic->s_stats; in snic_hba_reset_scsi_cleanup()
982 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); in snic_hba_reset_scsi_cleanup()
983 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); in snic_hba_reset_scsi_cleanup()
1002 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_hba_reset_cmpl_handler() argument
1016 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1020 SNIC_SCSI_DBG(snic->shost, in snic_hba_reset_cmpl_handler()
1027 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1035 if (cmnd_id >= snic->max_tag_id) { in snic_hba_reset_cmpl_handler()
1036 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1044 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_hba_reset_cmpl_handler()
1047 atomic64_inc(&snic->s_stats.io.sc_null); in snic_hba_reset_cmpl_handler()
1048 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1056 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1060 io_lock = snic_io_lock_hash(snic, sc); in snic_hba_reset_cmpl_handler()
1063 if (!snic->remove_wait) { in snic_hba_reset_cmpl_handler()
1065 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1076 atomic64_inc(&snic->s_stats.io.req_null); in snic_hba_reset_cmpl_handler()
1079 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1092 snic_hba_reset_scsi_cleanup(snic, sc); in snic_hba_reset_cmpl_handler()
1094 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && in snic_hba_reset_cmpl_handler()
1095 snic_get_state(snic) != SNIC_FWRESET); in snic_hba_reset_cmpl_handler()
1099 spin_lock_irqsave(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1100 if (snic_get_state(snic) == SNIC_FWRESET) in snic_hba_reset_cmpl_handler()
1101 snic_set_state(snic, SNIC_ONLINE); in snic_hba_reset_cmpl_handler()
1102 spin_unlock_irqrestore(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1104 if (snic->remove_wait) in snic_hba_reset_cmpl_handler()
1105 complete(snic->remove_wait); in snic_hba_reset_cmpl_handler()
1108 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); in snic_hba_reset_cmpl_handler()
1112 if (snic->config.xpt_type == SNIC_DAS) in snic_hba_reset_cmpl_handler()
1115 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); in snic_hba_reset_cmpl_handler()
1116 queue_work(snic_glob->event_q, &snic->disc_work); in snic_hba_reset_cmpl_handler()
1122 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_msg_ack_handler() argument
1124 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); in snic_msg_ack_handler()
1130 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_aen_handler() argument
1139 SNIC_SCSI_DBG(snic->shost, in snic_aen_handler()
1147 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1151 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); in snic_aen_handler()
1155 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1159 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); in snic_aen_handler()
1163 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); in snic_aen_handler()
1167 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); in snic_aen_handler()
1171 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); in snic_aen_handler()
1175 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); in snic_aen_handler()
1179 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); in snic_aen_handler()
1183 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); in snic_aen_handler()
1187 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); in snic_aen_handler()
1204 struct snic *snic = svnic_dev_priv(vdev); in snic_io_cmpl_handler() local
1212 atomic64_dec(&snic->s_stats.fw.actv_reqs); in snic_io_cmpl_handler()
1220 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1225 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1232 snic_io_exch_ver_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1236 snic_report_tgt_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1240 snic_icmnd_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1244 snic_itmf_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1248 snic_hba_reset_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1252 snic_msg_ack_handler(snic, fwreq); in snic_io_cmpl_handler()
1256 snic_aen_handler(snic, fwreq); in snic_io_cmpl_handler()
1261 SNIC_SCSI_DBG(snic->shost, in snic_io_cmpl_handler()
1269 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) in snic_io_cmpl_handler()
1270 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); in snic_io_cmpl_handler()
1281 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) in snic_fwcq_cmpl_handler() argument
1286 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; in snic_fwcq_cmpl_handler()
1288 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { in snic_fwcq_cmpl_handler()
1289 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], in snic_fwcq_cmpl_handler()
1307 snic_queue_itmf_req(struct snic *snic, in snic_queue_itmf_req() argument
1327 snic->config.hid, in snic_queue_itmf_req()
1342 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); in snic_queue_itmf_req()
1344 SNIC_HOST_ERR(snic->shost, in snic_queue_itmf_req()
1348 SNIC_SCSI_DBG(snic->shost, in snic_queue_itmf_req()
1356 snic_issue_tm_req(struct snic *snic, in snic_issue_tm_req() argument
1365 if (snic_get_state(snic) == SNIC_FWRESET) in snic_issue_tm_req()
1368 atomic_inc(&snic->ios_inflight); in snic_issue_tm_req()
1370 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1376 tmreq = snic_dr_req_init(snic, rqi); in snic_issue_tm_req()
1379 tmreq = snic_abort_req_init(snic, rqi); in snic_issue_tm_req()
1389 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); in snic_issue_tm_req()
1393 SNIC_HOST_ERR(snic->shost, in snic_issue_tm_req()
1397 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1402 atomic_dec(&snic->ios_inflight); in snic_issue_tm_req()
1411 snic_queue_abort_req(struct snic *snic, in snic_queue_abort_req() argument
1416 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", in snic_queue_abort_req()
1422 return snic_issue_tm_req(snic, rqi, sc, tmf); in snic_queue_abort_req()
1429 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_abort_finish() argument
1436 io_lock = snic_io_lock_hash(snic, sc); in snic_abort_finish()
1440 atomic64_inc(&snic->s_stats.io.req_null); in snic_abort_finish()
1443 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1460 atomic64_inc(&snic->s_stats.abts.drv_tmo); in snic_abort_finish()
1461 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1489 SNIC_HOST_INFO(snic->shost, in snic_abort_finish()
1497 snic_release_req_buf(snic, rqi, sc); in snic_abort_finish()
1506 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_abort_and_wait() argument
1524 io_lock = snic_io_lock_hash(snic, sc); in snic_send_abort_and_wait()
1543 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1573 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); in snic_send_abort_and_wait()
1578 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_send_abort_and_wait()
1580 atomic64_inc(&snic->s_stats.abts.q_fail); in snic_send_abort_and_wait()
1581 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1600 atomic64_inc(&snic->s_stats.abts.num); in snic_send_abort_and_wait()
1607 SNIC_SCSI_DBG(snic->shost, in snic_send_abort_and_wait()
1634 struct snic *snic = shost_priv(sc->device->host); in snic_abort_cmd() local
1638 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", in snic_abort_cmd()
1641 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_abort_cmd()
1642 SNIC_HOST_ERR(snic->shost, in snic_abort_cmd()
1651 ret = snic_send_abort_and_wait(snic, sc); in snic_abort_cmd()
1655 ret = snic_abort_finish(snic, sc); in snic_abort_cmd()
1658 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_abort_cmd()
1662 SNIC_SCSI_DBG(snic->shost, in snic_abort_cmd()
1673 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_is_abts_pending() argument
1686 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_is_abts_pending()
1687 io_lock = snic_io_lock_tag(snic, tag); in snic_is_abts_pending()
1690 sc = scsi_host_find_tag(snic->shost, tag); in snic_is_abts_pending()
1709 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", in snic_is_abts_pending()
1725 snic_dr_clean_single_req(struct snic *snic, in snic_dr_clean_single_req() argument
1738 io_lock = snic_io_lock_tag(snic, tag); in snic_dr_clean_single_req()
1740 sc = scsi_host_find_tag(snic->shost, tag); in snic_dr_clean_single_req()
1759 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1766 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1787 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1802 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_dr_clean_single_req()
1804 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1841 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1855 snic_release_req_buf(snic, rqi, sc); in snic_dr_clean_single_req()
1871 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_dr_clean_pending_req() argument
1877 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_dr_clean_pending_req()
1881 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); in snic_dr_clean_pending_req()
1883 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); in snic_dr_clean_pending_req()
1892 if (snic_is_abts_pending(snic, lr_sc)) { in snic_dr_clean_pending_req()
1899 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); in snic_dr_clean_pending_req()
1905 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_pending_req()
1917 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_dr_finish() argument
1925 io_lock = snic_io_lock_hash(snic, sc); in snic_dr_finish()
1930 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1945 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1955 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1962 SNIC_HOST_ERR(snic->shost, in snic_dr_finish()
1979 ret = snic_dr_clean_pending_req(snic, sc); in snic_dr_finish()
1982 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
2005 snic_release_req_buf(snic, rqi, sc); in snic_dr_finish()
2012 snic_queue_dr_req(struct snic *snic, in snic_queue_dr_req() argument
2019 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); in snic_queue_dr_req()
2023 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_dr_and_wait() argument
2032 io_lock = snic_io_lock_hash(snic, sc); in snic_send_dr_and_wait()
2037 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2052 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); in snic_send_dr_and_wait()
2065 ret = snic_queue_dr_req(snic, rqi, sc); in snic_send_dr_and_wait()
2067 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2112 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) in snic_unlink_and_release_req() argument
2119 io_lock = snic_io_lock_hash(snic, sc); in snic_unlink_and_release_req()
2131 snic_release_req_buf(snic, rqi, sc); in snic_unlink_and_release_req()
2133 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, in snic_unlink_and_release_req()
2147 struct snic *snic = shost_priv(shost); in snic_device_reset() local
2161 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); in snic_device_reset()
2166 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_device_reset()
2167 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2175 SNIC_HOST_INFO(snic->shost, in snic_device_reset()
2178 rqi = snic_req_init(snic, 0); in snic_device_reset()
2192 ret = snic_send_dr_and_wait(snic, sc); in snic_device_reset()
2194 SNIC_HOST_ERR(snic->shost, in snic_device_reset()
2198 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2203 ret = snic_dr_finish(snic, sc); in snic_device_reset()
2206 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_device_reset()
2210 SNIC_SCSI_DBG(snic->shost, in snic_device_reset()
2228 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) in snic_issue_hba_reset() argument
2237 rqi = snic_req_init(snic, 0); in snic_issue_hba_reset()
2247 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); in snic_issue_hba_reset()
2253 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_hba_reset()
2259 snic->remove_wait = &wait; in snic_issue_hba_reset()
2264 snic->config.hid, 0, (ulong) rqi); in snic_issue_hba_reset()
2268 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); in snic_issue_hba_reset()
2270 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2280 atomic64_inc(&snic->s_stats.reset.hba_resets); in snic_issue_hba_reset()
2281 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); in snic_issue_hba_reset()
2283 wait_for_completion_timeout(snic->remove_wait, in snic_issue_hba_reset()
2286 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_issue_hba_reset()
2287 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); in snic_issue_hba_reset()
2294 snic->remove_wait = NULL; in snic_issue_hba_reset()
2300 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2308 snic->remove_wait = NULL; in snic_issue_hba_reset()
2314 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2317 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2327 struct snic *snic = shost_priv(shost); in snic_reset() local
2333 sv_state = snic_get_state(snic); in snic_reset()
2335 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2336 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_reset()
2337 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2346 snic_set_state(snic, SNIC_FWRESET); in snic_reset()
2347 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2351 while (atomic_read(&snic->ios_inflight)) in snic_reset()
2354 ret = snic_issue_hba_reset(snic, sc); in snic_reset()
2359 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2360 snic_set_state(snic, sv_state); in snic_reset()
2361 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2362 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); in snic_reset()
2406 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) in snic_cmpl_pending_tmreq() argument
2410 SNIC_SCSI_DBG(snic->shost, in snic_cmpl_pending_tmreq()
2435 snic_scsi_cleanup(struct snic *snic, int ex_tag) in snic_scsi_cleanup() argument
2444 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); in snic_scsi_cleanup()
2446 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_scsi_cleanup()
2451 io_lock = snic_io_lock_tag(snic, tag); in snic_scsi_cleanup()
2453 sc = scsi_host_find_tag(snic->shost, tag); in snic_scsi_cleanup()
2465 snic_cmpl_pending_tmreq(snic, sc); in snic_scsi_cleanup()
2478 SNIC_SCSI_DBG(snic->shost, in snic_scsi_cleanup()
2487 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2491 snic_release_req_buf(snic, rqi, sc); in snic_scsi_cleanup()
2495 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2501 snic_stats_update_io_cmpl(&snic->s_stats); in snic_scsi_cleanup()
2504 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_scsi_cleanup()
2515 snic_shutdown_scsi_cleanup(struct snic *snic) in snic_shutdown_scsi_cleanup() argument
2517 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); in snic_shutdown_scsi_cleanup()
2519 snic_scsi_cleanup(snic, SCSI_NO_TAG); in snic_shutdown_scsi_cleanup()
2527 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) in snic_internal_abort_io() argument
2535 io_lock = snic_io_lock_hash(snic, sc); in snic_internal_abort_io()
2547 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2556 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2571 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); in snic_internal_abort_io()
2574 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", in snic_internal_abort_io()
2579 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_internal_abort_io()
2581 SNIC_HOST_ERR(snic->shost, in snic_internal_abort_io()
2614 struct snic *snic = NULL; in snic_tgt_scsi_abort_io() local
2624 snic = shost_priv(snic_tgt_to_shost(tgt)); in snic_tgt_scsi_abort_io()
2625 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); in snic_tgt_scsi_abort_io()
2632 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_tgt_scsi_abort_io()
2633 io_lock = snic_io_lock_tag(snic, tag); in snic_tgt_scsi_abort_io()
2636 sc = scsi_host_find_tag(snic->shost, tag); in snic_tgt_scsi_abort_io()
2651 ret = snic_internal_abort_io(snic, sc, tmf); in snic_tgt_scsi_abort_io()
2653 SNIC_HOST_ERR(snic->shost, in snic_tgt_scsi_abort_io()
2664 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); in snic_tgt_scsi_abort_io()