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 pci_unmap_single(snic->pdev, 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 = pci_map_single(snic->pdev, in snic_queue_icmnd_req()
193 if (pci_dma_mapping_error(snic->pdev, pa)) { in snic_queue_icmnd_req()
194 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
211 snic->config.hid, /* hid */ in snic_queue_icmnd_req()
224 atomic64_inc(&snic->s_stats.io.active); in snic_queue_icmnd_req()
225 ret = snic_queue_wq_desc(snic, rqi->req, rqi->req_len); in snic_queue_icmnd_req()
227 atomic64_dec(&snic->s_stats.io.active); in snic_queue_icmnd_req()
228 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
232 snic_stats_update_active_ios(&snic->s_stats); in snic_queue_icmnd_req()
241 snic_issue_scsi_req(struct snic *snic, in snic_issue_scsi_req() argument
257 SNIC_TRC((u16)snic->shost->host_no, tag, (ulong) sc, 0, in snic_issue_scsi_req()
260 SNIC_HOST_ERR(snic->shost, "issue_sc:Failed to map SG List.\n"); in snic_issue_scsi_req()
266 rqi = snic_req_init(snic, sg_cnt); in snic_issue_scsi_req()
282 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_scsi_req()
285 ret = snic_queue_icmnd_req(snic, rqi, sc, sg_cnt); in snic_issue_scsi_req()
287 SNIC_HOST_ERR(snic->shost, in snic_issue_scsi_req()
299 snic_release_req_buf(snic, rqi, sc); in snic_issue_scsi_req()
301 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, 0, 0, 0, in snic_issue_scsi_req()
306 struct snic_io_stats *iostats = &snic->s_stats.io; in snic_issue_scsi_req()
314 SNIC_SCSI_DBG(snic->shost, in snic_issue_scsi_req()
318 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, (ulong) rqi, in snic_issue_scsi_req()
337 struct snic *snic = shost_priv(shost); in snic_queuecommand() local
344 atomic64_inc(&snic->s_stats.misc.tgt_not_rdy); in snic_queuecommand()
351 if (snic_get_state(snic) != SNIC_ONLINE) { in snic_queuecommand()
353 snic_state_str[snic_get_state(snic)]); in snic_queuecommand()
357 atomic_inc(&snic->ios_inflight); in snic_queuecommand()
362 ret = snic_issue_scsi_req(snic, tgt, sc); in snic_queuecommand()
368 atomic_dec(&snic->ios_inflight); in snic_queuecommand()
378 snic_proc_tmreq_pending_state(struct snic *snic, in snic_proc_tmreq_pending_state() argument
410 snic_process_io_failed_state(struct snic *snic, in snic_process_io_failed_state() argument
419 atomic64_inc(&snic->s_stats.misc.io_tmo); in snic_process_io_failed_state()
424 atomic64_inc(&snic->s_stats.misc.io_aborted); in snic_process_io_failed_state()
429 atomic64_inc(&snic->s_stats.misc.data_cnt_mismat); in snic_process_io_failed_state()
435 atomic64_inc(&snic->s_stats.fw.out_of_res); in snic_process_io_failed_state()
440 atomic64_inc(&snic->s_stats.io.io_not_found); in snic_process_io_failed_state()
445 atomic64_inc(&snic->s_stats.misc.sgl_inval); in snic_process_io_failed_state()
450 atomic64_inc(&snic->s_stats.fw.io_errs); in snic_process_io_failed_state()
455 atomic64_inc(&snic->s_stats.fw.scsi_errs); in snic_process_io_failed_state()
469 SNIC_SCSI_DBG(snic->shost, in snic_process_io_failed_state()
475 SNIC_HOST_ERR(snic->shost, "fw returns failed status %s flags 0x%llx\n", in snic_process_io_failed_state()
499 snic_process_icmnd_cmpl_status(struct snic *snic, in snic_process_icmnd_cmpl_status() argument
521 atomic64_inc(&snic->s_stats.misc.io_under_run); in snic_process_icmnd_cmpl_status()
525 atomic64_inc(&snic->s_stats.misc.qfull); in snic_process_icmnd_cmpl_status()
529 snic_process_io_failed_state(snic, icmnd_cmpl, sc, cmpl_stat); in snic_process_icmnd_cmpl_status()
530 atomic64_inc(&snic->s_stats.io.fail); in snic_process_icmnd_cmpl_status()
531 SNIC_HOST_ERR(snic->shost, in snic_process_icmnd_cmpl_status()
546 snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_icmnd_cmpl_handler() argument
563 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
567 if (cmnd_id >= snic->max_tag_id) { in snic_icmnd_cmpl_handler()
568 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
574 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_icmnd_cmpl_handler()
578 atomic64_inc(&snic->s_stats.io.sc_null); in snic_icmnd_cmpl_handler()
579 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
585 SNIC_TRC(snic->shost->host_no, cmnd_id, 0, in snic_icmnd_cmpl_handler()
593 io_lock = snic_io_lock_hash(snic, sc); in snic_icmnd_cmpl_handler()
597 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
611 atomic64_inc(&snic->s_stats.io.req_null); in snic_icmnd_cmpl_handler()
615 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
633 snic_proc_tmreq_pending_state(snic, sc, hdr_stat); in snic_icmnd_cmpl_handler()
636 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
642 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
649 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
656 if (snic_process_icmnd_cmpl_status(snic, icmnd_cmpl, hdr_stat, sc)) { in snic_icmnd_cmpl_handler()
658 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
671 snic_calc_io_process_time(snic, rqi); in snic_icmnd_cmpl_handler()
673 snic_release_req_buf(snic, rqi, sc); in snic_icmnd_cmpl_handler()
675 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
683 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
687 snic_proc_dr_cmpl_locked(struct snic *snic, in snic_proc_dr_cmpl_locked() argument
698 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", in snic_proc_dr_cmpl_locked()
704 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
708 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
719 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
723 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
735 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
749 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) in snic_update_abort_stats() argument
751 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; in snic_update_abort_stats()
753 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); in snic_update_abort_stats()
774 snic_process_itmf_cmpl(struct snic *snic, in snic_process_itmf_cmpl() argument
787 io_lock = snic_io_lock_hash(snic, sc); in snic_process_itmf_cmpl()
798 atomic64_inc(&snic->s_stats.io.req_null); in snic_process_itmf_cmpl()
801 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
818 snic_update_abort_stats(snic, cmpl_stat); in snic_process_itmf_cmpl()
831 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
851 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
857 snic_release_req_buf(snic, rqi, sc); in snic_process_itmf_cmpl()
860 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_process_itmf_cmpl()
872 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); in snic_process_itmf_cmpl()
885 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
899 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
902 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
921 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_itmf_cmpl_handler() argument
933 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
938 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
950 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { in snic_itmf_cmpl_handler()
951 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
959 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); in snic_itmf_cmpl_handler()
964 atomic64_inc(&snic->s_stats.io.sc_null); in snic_itmf_cmpl_handler()
965 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
972 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); in snic_itmf_cmpl_handler()
978 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) in snic_hba_reset_scsi_cleanup() argument
980 struct snic_stats *st = &snic->s_stats; in snic_hba_reset_scsi_cleanup()
983 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); in snic_hba_reset_scsi_cleanup()
984 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); in snic_hba_reset_scsi_cleanup()
1003 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_hba_reset_cmpl_handler() argument
1017 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1021 SNIC_SCSI_DBG(snic->shost, in snic_hba_reset_cmpl_handler()
1028 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1036 if (cmnd_id >= snic->max_tag_id) { in snic_hba_reset_cmpl_handler()
1037 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1045 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_hba_reset_cmpl_handler()
1048 atomic64_inc(&snic->s_stats.io.sc_null); in snic_hba_reset_cmpl_handler()
1049 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1057 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1061 io_lock = snic_io_lock_hash(snic, sc); in snic_hba_reset_cmpl_handler()
1064 if (!snic->remove_wait) { in snic_hba_reset_cmpl_handler()
1066 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1077 atomic64_inc(&snic->s_stats.io.req_null); in snic_hba_reset_cmpl_handler()
1080 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1093 snic_hba_reset_scsi_cleanup(snic, sc); in snic_hba_reset_cmpl_handler()
1095 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && in snic_hba_reset_cmpl_handler()
1096 snic_get_state(snic) != SNIC_FWRESET); in snic_hba_reset_cmpl_handler()
1100 spin_lock_irqsave(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1101 if (snic_get_state(snic) == SNIC_FWRESET) in snic_hba_reset_cmpl_handler()
1102 snic_set_state(snic, SNIC_ONLINE); in snic_hba_reset_cmpl_handler()
1103 spin_unlock_irqrestore(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1105 if (snic->remove_wait) in snic_hba_reset_cmpl_handler()
1106 complete(snic->remove_wait); in snic_hba_reset_cmpl_handler()
1109 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); in snic_hba_reset_cmpl_handler()
1113 if (snic->config.xpt_type == SNIC_DAS) in snic_hba_reset_cmpl_handler()
1116 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); in snic_hba_reset_cmpl_handler()
1117 queue_work(snic_glob->event_q, &snic->disc_work); in snic_hba_reset_cmpl_handler()
1123 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_msg_ack_handler() argument
1125 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); in snic_msg_ack_handler()
1131 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_aen_handler() argument
1140 SNIC_SCSI_DBG(snic->shost, in snic_aen_handler()
1148 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1152 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); in snic_aen_handler()
1156 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1160 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); in snic_aen_handler()
1164 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); in snic_aen_handler()
1168 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); in snic_aen_handler()
1172 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); in snic_aen_handler()
1176 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); in snic_aen_handler()
1180 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); in snic_aen_handler()
1184 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); in snic_aen_handler()
1188 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); in snic_aen_handler()
1205 struct snic *snic = svnic_dev_priv(vdev); in snic_io_cmpl_handler() local
1213 atomic64_dec(&snic->s_stats.fw.actv_reqs); in snic_io_cmpl_handler()
1221 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1226 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1233 snic_io_exch_ver_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1237 snic_report_tgt_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1241 snic_icmnd_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1245 snic_itmf_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1249 snic_hba_reset_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1253 snic_msg_ack_handler(snic, fwreq); in snic_io_cmpl_handler()
1257 snic_aen_handler(snic, fwreq); in snic_io_cmpl_handler()
1262 SNIC_SCSI_DBG(snic->shost, in snic_io_cmpl_handler()
1270 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) in snic_io_cmpl_handler()
1271 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); in snic_io_cmpl_handler()
1282 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) in snic_fwcq_cmpl_handler() argument
1287 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; in snic_fwcq_cmpl_handler()
1289 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { in snic_fwcq_cmpl_handler()
1290 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], in snic_fwcq_cmpl_handler()
1308 snic_queue_itmf_req(struct snic *snic, in snic_queue_itmf_req() argument
1328 snic->config.hid, in snic_queue_itmf_req()
1343 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); in snic_queue_itmf_req()
1345 SNIC_HOST_ERR(snic->shost, in snic_queue_itmf_req()
1349 SNIC_SCSI_DBG(snic->shost, in snic_queue_itmf_req()
1357 snic_issue_tm_req(struct snic *snic, in snic_issue_tm_req() argument
1366 if (snic_get_state(snic) == SNIC_FWRESET) in snic_issue_tm_req()
1369 atomic_inc(&snic->ios_inflight); in snic_issue_tm_req()
1371 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1377 tmreq = snic_dr_req_init(snic, rqi); in snic_issue_tm_req()
1380 tmreq = snic_abort_req_init(snic, rqi); in snic_issue_tm_req()
1390 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); in snic_issue_tm_req()
1398 SNIC_HOST_ERR(snic->shost, in snic_issue_tm_req()
1402 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1407 atomic_dec(&snic->ios_inflight); in snic_issue_tm_req()
1416 snic_queue_abort_req(struct snic *snic, in snic_queue_abort_req() argument
1421 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", in snic_queue_abort_req()
1427 return snic_issue_tm_req(snic, rqi, sc, tmf); in snic_queue_abort_req()
1434 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_abort_finish() argument
1441 io_lock = snic_io_lock_hash(snic, sc); in snic_abort_finish()
1445 atomic64_inc(&snic->s_stats.io.req_null); in snic_abort_finish()
1448 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1465 atomic64_inc(&snic->s_stats.abts.drv_tmo); in snic_abort_finish()
1466 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1494 SNIC_HOST_INFO(snic->shost, in snic_abort_finish()
1502 snic_release_req_buf(snic, rqi, sc); in snic_abort_finish()
1511 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_abort_and_wait() argument
1529 io_lock = snic_io_lock_hash(snic, sc); in snic_send_abort_and_wait()
1548 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1578 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); in snic_send_abort_and_wait()
1583 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_send_abort_and_wait()
1585 atomic64_inc(&snic->s_stats.abts.q_fail); in snic_send_abort_and_wait()
1586 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1605 atomic64_inc(&snic->s_stats.abts.num); in snic_send_abort_and_wait()
1612 SNIC_SCSI_DBG(snic->shost, in snic_send_abort_and_wait()
1639 struct snic *snic = shost_priv(sc->device->host); in snic_abort_cmd() local
1643 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", in snic_abort_cmd()
1646 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_abort_cmd()
1647 SNIC_HOST_ERR(snic->shost, in snic_abort_cmd()
1656 ret = snic_send_abort_and_wait(snic, sc); in snic_abort_cmd()
1660 ret = snic_abort_finish(snic, sc); in snic_abort_cmd()
1663 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_abort_cmd()
1667 SNIC_SCSI_DBG(snic->shost, in snic_abort_cmd()
1678 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_is_abts_pending() argument
1691 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_is_abts_pending()
1692 io_lock = snic_io_lock_tag(snic, tag); in snic_is_abts_pending()
1695 sc = scsi_host_find_tag(snic->shost, tag); in snic_is_abts_pending()
1714 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", in snic_is_abts_pending()
1730 snic_dr_clean_single_req(struct snic *snic, in snic_dr_clean_single_req() argument
1743 io_lock = snic_io_lock_tag(snic, tag); in snic_dr_clean_single_req()
1745 sc = scsi_host_find_tag(snic->shost, tag); in snic_dr_clean_single_req()
1764 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1771 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1792 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1807 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_dr_clean_single_req()
1809 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1846 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1860 snic_release_req_buf(snic, rqi, sc); in snic_dr_clean_single_req()
1876 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_dr_clean_pending_req() argument
1882 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_dr_clean_pending_req()
1886 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); in snic_dr_clean_pending_req()
1888 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); in snic_dr_clean_pending_req()
1897 if (snic_is_abts_pending(snic, lr_sc)) { in snic_dr_clean_pending_req()
1904 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); in snic_dr_clean_pending_req()
1910 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_pending_req()
1922 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_dr_finish() argument
1930 io_lock = snic_io_lock_hash(snic, sc); in snic_dr_finish()
1935 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1950 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1960 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1967 SNIC_HOST_ERR(snic->shost, in snic_dr_finish()
1984 ret = snic_dr_clean_pending_req(snic, sc); in snic_dr_finish()
1987 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
2010 snic_release_req_buf(snic, rqi, sc); in snic_dr_finish()
2017 snic_queue_dr_req(struct snic *snic, in snic_queue_dr_req() argument
2024 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); in snic_queue_dr_req()
2028 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_dr_and_wait() argument
2037 io_lock = snic_io_lock_hash(snic, sc); in snic_send_dr_and_wait()
2042 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2057 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); in snic_send_dr_and_wait()
2070 ret = snic_queue_dr_req(snic, rqi, sc); in snic_send_dr_and_wait()
2072 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2117 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) in snic_unlink_and_release_req() argument
2124 io_lock = snic_io_lock_hash(snic, sc); in snic_unlink_and_release_req()
2136 snic_release_req_buf(snic, rqi, sc); in snic_unlink_and_release_req()
2138 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, in snic_unlink_and_release_req()
2152 struct snic *snic = shost_priv(shost); in snic_device_reset() local
2166 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); in snic_device_reset()
2171 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_device_reset()
2172 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2180 SNIC_HOST_INFO(snic->shost, in snic_device_reset()
2183 rqi = snic_req_init(snic, 0); in snic_device_reset()
2197 ret = snic_send_dr_and_wait(snic, sc); in snic_device_reset()
2199 SNIC_HOST_ERR(snic->shost, in snic_device_reset()
2203 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2208 ret = snic_dr_finish(snic, sc); in snic_device_reset()
2211 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_device_reset()
2215 SNIC_SCSI_DBG(snic->shost, in snic_device_reset()
2233 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) in snic_issue_hba_reset() argument
2242 rqi = snic_req_init(snic, 0); in snic_issue_hba_reset()
2252 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); in snic_issue_hba_reset()
2258 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_hba_reset()
2264 snic->remove_wait = &wait; in snic_issue_hba_reset()
2269 snic->config.hid, 0, (ulong) rqi); in snic_issue_hba_reset()
2273 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); in snic_issue_hba_reset()
2275 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2285 atomic64_inc(&snic->s_stats.reset.hba_resets); in snic_issue_hba_reset()
2286 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); in snic_issue_hba_reset()
2288 wait_for_completion_timeout(snic->remove_wait, in snic_issue_hba_reset()
2291 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_issue_hba_reset()
2292 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); in snic_issue_hba_reset()
2299 snic->remove_wait = NULL; in snic_issue_hba_reset()
2305 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2313 snic->remove_wait = NULL; in snic_issue_hba_reset()
2319 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2322 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2332 struct snic *snic = shost_priv(shost); in snic_reset() local
2338 sv_state = snic_get_state(snic); in snic_reset()
2340 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2341 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_reset()
2342 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2351 snic_set_state(snic, SNIC_FWRESET); in snic_reset()
2352 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2356 while (atomic_read(&snic->ios_inflight)) in snic_reset()
2359 ret = snic_issue_hba_reset(snic, sc); in snic_reset()
2364 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2365 snic_set_state(snic, sv_state); in snic_reset()
2366 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2367 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); in snic_reset()
2411 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) in snic_cmpl_pending_tmreq() argument
2415 SNIC_SCSI_DBG(snic->shost, in snic_cmpl_pending_tmreq()
2440 snic_scsi_cleanup(struct snic *snic, int ex_tag) in snic_scsi_cleanup() argument
2449 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); in snic_scsi_cleanup()
2451 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_scsi_cleanup()
2456 io_lock = snic_io_lock_tag(snic, tag); in snic_scsi_cleanup()
2458 sc = scsi_host_find_tag(snic->shost, tag); in snic_scsi_cleanup()
2470 snic_cmpl_pending_tmreq(snic, sc); in snic_scsi_cleanup()
2483 SNIC_SCSI_DBG(snic->shost, in snic_scsi_cleanup()
2492 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2496 snic_release_req_buf(snic, rqi, sc); in snic_scsi_cleanup()
2500 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2506 snic_stats_update_io_cmpl(&snic->s_stats); in snic_scsi_cleanup()
2509 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_scsi_cleanup()
2520 snic_shutdown_scsi_cleanup(struct snic *snic) in snic_shutdown_scsi_cleanup() argument
2522 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); in snic_shutdown_scsi_cleanup()
2524 snic_scsi_cleanup(snic, SCSI_NO_TAG); in snic_shutdown_scsi_cleanup()
2532 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) in snic_internal_abort_io() argument
2540 io_lock = snic_io_lock_hash(snic, sc); in snic_internal_abort_io()
2552 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2561 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2576 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); in snic_internal_abort_io()
2579 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", in snic_internal_abort_io()
2584 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_internal_abort_io()
2586 SNIC_HOST_ERR(snic->shost, in snic_internal_abort_io()
2619 struct snic *snic = NULL; in snic_tgt_scsi_abort_io() local
2629 snic = shost_priv(snic_tgt_to_shost(tgt)); in snic_tgt_scsi_abort_io()
2630 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); in snic_tgt_scsi_abort_io()
2637 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_tgt_scsi_abort_io()
2638 io_lock = snic_io_lock_tag(snic, tag); in snic_tgt_scsi_abort_io()
2641 sc = scsi_host_find_tag(snic->shost, tag); in snic_tgt_scsi_abort_io()
2656 ret = snic_internal_abort_io(snic, sc, tmf); in snic_tgt_scsi_abort_io()
2658 SNIC_HOST_ERR(snic->shost, in snic_tgt_scsi_abort_io()
2669 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); in snic_tgt_scsi_abort_io()