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()
681 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
685 snic_proc_dr_cmpl_locked(struct snic *snic, in snic_proc_dr_cmpl_locked() argument
696 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", in snic_proc_dr_cmpl_locked()
702 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
706 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
717 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
721 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
733 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
747 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) in snic_update_abort_stats() argument
749 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; in snic_update_abort_stats()
751 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); in snic_update_abort_stats()
772 snic_process_itmf_cmpl(struct snic *snic, in snic_process_itmf_cmpl() argument
785 io_lock = snic_io_lock_hash(snic, sc); in snic_process_itmf_cmpl()
796 atomic64_inc(&snic->s_stats.io.req_null); in snic_process_itmf_cmpl()
799 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
816 snic_update_abort_stats(snic, cmpl_stat); in snic_process_itmf_cmpl()
829 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
849 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
855 snic_release_req_buf(snic, rqi, sc); in snic_process_itmf_cmpl()
857 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_process_itmf_cmpl()
868 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); in snic_process_itmf_cmpl()
881 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
895 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
898 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
917 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_itmf_cmpl_handler() argument
929 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
934 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
946 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { in snic_itmf_cmpl_handler()
947 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
955 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); in snic_itmf_cmpl_handler()
960 atomic64_inc(&snic->s_stats.io.sc_null); in snic_itmf_cmpl_handler()
961 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
968 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); in snic_itmf_cmpl_handler()
974 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) in snic_hba_reset_scsi_cleanup() argument
976 struct snic_stats *st = &snic->s_stats; in snic_hba_reset_scsi_cleanup()
979 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); in snic_hba_reset_scsi_cleanup()
980 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); in snic_hba_reset_scsi_cleanup()
999 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_hba_reset_cmpl_handler() argument
1013 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1017 SNIC_SCSI_DBG(snic->shost, in snic_hba_reset_cmpl_handler()
1024 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1032 if (cmnd_id >= snic->max_tag_id) { in snic_hba_reset_cmpl_handler()
1033 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1041 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_hba_reset_cmpl_handler()
1044 atomic64_inc(&snic->s_stats.io.sc_null); in snic_hba_reset_cmpl_handler()
1045 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1053 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1057 io_lock = snic_io_lock_hash(snic, sc); in snic_hba_reset_cmpl_handler()
1060 if (!snic->remove_wait) { in snic_hba_reset_cmpl_handler()
1062 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1073 atomic64_inc(&snic->s_stats.io.req_null); in snic_hba_reset_cmpl_handler()
1076 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1089 snic_hba_reset_scsi_cleanup(snic, sc); in snic_hba_reset_cmpl_handler()
1091 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && in snic_hba_reset_cmpl_handler()
1092 snic_get_state(snic) != SNIC_FWRESET); in snic_hba_reset_cmpl_handler()
1096 spin_lock_irqsave(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1097 if (snic_get_state(snic) == SNIC_FWRESET) in snic_hba_reset_cmpl_handler()
1098 snic_set_state(snic, SNIC_ONLINE); in snic_hba_reset_cmpl_handler()
1099 spin_unlock_irqrestore(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1101 if (snic->remove_wait) in snic_hba_reset_cmpl_handler()
1102 complete(snic->remove_wait); in snic_hba_reset_cmpl_handler()
1105 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); in snic_hba_reset_cmpl_handler()
1109 if (snic->config.xpt_type == SNIC_DAS) in snic_hba_reset_cmpl_handler()
1112 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); in snic_hba_reset_cmpl_handler()
1113 queue_work(snic_glob->event_q, &snic->disc_work); in snic_hba_reset_cmpl_handler()
1119 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_msg_ack_handler() argument
1121 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); in snic_msg_ack_handler()
1127 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_aen_handler() argument
1136 SNIC_SCSI_DBG(snic->shost, in snic_aen_handler()
1144 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1148 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); in snic_aen_handler()
1152 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1156 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); in snic_aen_handler()
1160 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); in snic_aen_handler()
1164 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); in snic_aen_handler()
1168 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); in snic_aen_handler()
1172 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); in snic_aen_handler()
1176 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); in snic_aen_handler()
1180 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); in snic_aen_handler()
1184 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); in snic_aen_handler()
1201 struct snic *snic = svnic_dev_priv(vdev); in snic_io_cmpl_handler() local
1209 atomic64_dec(&snic->s_stats.fw.actv_reqs); in snic_io_cmpl_handler()
1217 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1222 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1229 snic_io_exch_ver_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1233 snic_report_tgt_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1237 snic_icmnd_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1241 snic_itmf_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1245 snic_hba_reset_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1249 snic_msg_ack_handler(snic, fwreq); in snic_io_cmpl_handler()
1253 snic_aen_handler(snic, fwreq); in snic_io_cmpl_handler()
1258 SNIC_SCSI_DBG(snic->shost, in snic_io_cmpl_handler()
1266 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) in snic_io_cmpl_handler()
1267 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); in snic_io_cmpl_handler()
1278 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) in snic_fwcq_cmpl_handler() argument
1283 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; in snic_fwcq_cmpl_handler()
1285 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { in snic_fwcq_cmpl_handler()
1286 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], in snic_fwcq_cmpl_handler()
1304 snic_queue_itmf_req(struct snic *snic, in snic_queue_itmf_req() argument
1324 snic->config.hid, in snic_queue_itmf_req()
1339 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); in snic_queue_itmf_req()
1341 SNIC_HOST_ERR(snic->shost, in snic_queue_itmf_req()
1345 SNIC_SCSI_DBG(snic->shost, in snic_queue_itmf_req()
1353 snic_issue_tm_req(struct snic *snic, in snic_issue_tm_req() argument
1362 if (snic_get_state(snic) == SNIC_FWRESET) in snic_issue_tm_req()
1365 atomic_inc(&snic->ios_inflight); in snic_issue_tm_req()
1367 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1373 tmreq = snic_dr_req_init(snic, rqi); in snic_issue_tm_req()
1376 tmreq = snic_abort_req_init(snic, rqi); in snic_issue_tm_req()
1386 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); in snic_issue_tm_req()
1390 SNIC_HOST_ERR(snic->shost, in snic_issue_tm_req()
1394 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1399 atomic_dec(&snic->ios_inflight); in snic_issue_tm_req()
1408 snic_queue_abort_req(struct snic *snic, in snic_queue_abort_req() argument
1413 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", in snic_queue_abort_req()
1419 return snic_issue_tm_req(snic, rqi, sc, tmf); in snic_queue_abort_req()
1426 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_abort_finish() argument
1433 io_lock = snic_io_lock_hash(snic, sc); in snic_abort_finish()
1437 atomic64_inc(&snic->s_stats.io.req_null); in snic_abort_finish()
1440 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1457 atomic64_inc(&snic->s_stats.abts.drv_tmo); in snic_abort_finish()
1458 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1486 SNIC_HOST_INFO(snic->shost, in snic_abort_finish()
1494 snic_release_req_buf(snic, rqi, sc); in snic_abort_finish()
1503 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_abort_and_wait() argument
1521 io_lock = snic_io_lock_hash(snic, sc); in snic_send_abort_and_wait()
1540 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1570 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); in snic_send_abort_and_wait()
1575 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_send_abort_and_wait()
1577 atomic64_inc(&snic->s_stats.abts.q_fail); in snic_send_abort_and_wait()
1578 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1597 atomic64_inc(&snic->s_stats.abts.num); in snic_send_abort_and_wait()
1604 SNIC_SCSI_DBG(snic->shost, in snic_send_abort_and_wait()
1631 struct snic *snic = shost_priv(sc->device->host); in snic_abort_cmd() local
1635 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", in snic_abort_cmd()
1638 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_abort_cmd()
1639 SNIC_HOST_ERR(snic->shost, in snic_abort_cmd()
1648 ret = snic_send_abort_and_wait(snic, sc); in snic_abort_cmd()
1652 ret = snic_abort_finish(snic, sc); in snic_abort_cmd()
1655 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_abort_cmd()
1659 SNIC_SCSI_DBG(snic->shost, in snic_abort_cmd()
1670 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_is_abts_pending() argument
1683 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_is_abts_pending()
1684 io_lock = snic_io_lock_tag(snic, tag); in snic_is_abts_pending()
1687 sc = scsi_host_find_tag(snic->shost, tag); in snic_is_abts_pending()
1706 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", in snic_is_abts_pending()
1722 snic_dr_clean_single_req(struct snic *snic, in snic_dr_clean_single_req() argument
1735 io_lock = snic_io_lock_tag(snic, tag); in snic_dr_clean_single_req()
1737 sc = scsi_host_find_tag(snic->shost, tag); in snic_dr_clean_single_req()
1756 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1763 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1784 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1799 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_dr_clean_single_req()
1801 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1838 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1852 snic_release_req_buf(snic, rqi, sc); in snic_dr_clean_single_req()
1868 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_dr_clean_pending_req() argument
1874 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_dr_clean_pending_req()
1878 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); in snic_dr_clean_pending_req()
1880 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); in snic_dr_clean_pending_req()
1889 if (snic_is_abts_pending(snic, lr_sc)) { in snic_dr_clean_pending_req()
1896 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); in snic_dr_clean_pending_req()
1902 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_pending_req()
1914 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_dr_finish() argument
1922 io_lock = snic_io_lock_hash(snic, sc); in snic_dr_finish()
1927 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1942 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1952 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1959 SNIC_HOST_ERR(snic->shost, in snic_dr_finish()
1976 ret = snic_dr_clean_pending_req(snic, sc); in snic_dr_finish()
1979 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
2002 snic_release_req_buf(snic, rqi, sc); in snic_dr_finish()
2009 snic_queue_dr_req(struct snic *snic, in snic_queue_dr_req() argument
2016 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); in snic_queue_dr_req()
2020 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_dr_and_wait() argument
2029 io_lock = snic_io_lock_hash(snic, sc); in snic_send_dr_and_wait()
2034 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2049 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); in snic_send_dr_and_wait()
2062 ret = snic_queue_dr_req(snic, rqi, sc); in snic_send_dr_and_wait()
2064 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2109 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) in snic_unlink_and_release_req() argument
2116 io_lock = snic_io_lock_hash(snic, sc); in snic_unlink_and_release_req()
2128 snic_release_req_buf(snic, rqi, sc); in snic_unlink_and_release_req()
2130 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, in snic_unlink_and_release_req()
2144 struct snic *snic = shost_priv(shost); in snic_device_reset() local
2158 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); in snic_device_reset()
2163 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_device_reset()
2164 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2172 SNIC_HOST_INFO(snic->shost, in snic_device_reset()
2175 rqi = snic_req_init(snic, 0); in snic_device_reset()
2189 ret = snic_send_dr_and_wait(snic, sc); in snic_device_reset()
2191 SNIC_HOST_ERR(snic->shost, in snic_device_reset()
2195 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2200 ret = snic_dr_finish(snic, sc); in snic_device_reset()
2203 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_device_reset()
2207 SNIC_SCSI_DBG(snic->shost, in snic_device_reset()
2225 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) in snic_issue_hba_reset() argument
2234 rqi = snic_req_init(snic, 0); in snic_issue_hba_reset()
2244 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); in snic_issue_hba_reset()
2250 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_hba_reset()
2256 snic->remove_wait = &wait; in snic_issue_hba_reset()
2261 snic->config.hid, 0, (ulong) rqi); in snic_issue_hba_reset()
2265 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); in snic_issue_hba_reset()
2267 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2277 atomic64_inc(&snic->s_stats.reset.hba_resets); in snic_issue_hba_reset()
2278 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); in snic_issue_hba_reset()
2280 wait_for_completion_timeout(snic->remove_wait, in snic_issue_hba_reset()
2283 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_issue_hba_reset()
2284 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); in snic_issue_hba_reset()
2291 snic->remove_wait = NULL; in snic_issue_hba_reset()
2297 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2305 snic->remove_wait = NULL; in snic_issue_hba_reset()
2311 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2314 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2324 struct snic *snic = shost_priv(shost); in snic_reset() local
2330 sv_state = snic_get_state(snic); in snic_reset()
2332 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2333 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_reset()
2334 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2343 snic_set_state(snic, SNIC_FWRESET); in snic_reset()
2344 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2348 while (atomic_read(&snic->ios_inflight)) in snic_reset()
2351 ret = snic_issue_hba_reset(snic, sc); in snic_reset()
2356 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2357 snic_set_state(snic, sv_state); in snic_reset()
2358 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2359 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); in snic_reset()
2403 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) in snic_cmpl_pending_tmreq() argument
2407 SNIC_SCSI_DBG(snic->shost, in snic_cmpl_pending_tmreq()
2432 snic_scsi_cleanup(struct snic *snic, int ex_tag) in snic_scsi_cleanup() argument
2441 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); in snic_scsi_cleanup()
2443 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_scsi_cleanup()
2448 io_lock = snic_io_lock_tag(snic, tag); in snic_scsi_cleanup()
2450 sc = scsi_host_find_tag(snic->shost, tag); in snic_scsi_cleanup()
2462 snic_cmpl_pending_tmreq(snic, sc); in snic_scsi_cleanup()
2475 SNIC_SCSI_DBG(snic->shost, in snic_scsi_cleanup()
2484 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2488 snic_release_req_buf(snic, rqi, sc); in snic_scsi_cleanup()
2492 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2498 snic_stats_update_io_cmpl(&snic->s_stats); in snic_scsi_cleanup()
2500 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_scsi_cleanup()
2510 snic_shutdown_scsi_cleanup(struct snic *snic) in snic_shutdown_scsi_cleanup() argument
2512 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); in snic_shutdown_scsi_cleanup()
2514 snic_scsi_cleanup(snic, SCSI_NO_TAG); in snic_shutdown_scsi_cleanup()
2522 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) in snic_internal_abort_io() argument
2530 io_lock = snic_io_lock_hash(snic, sc); in snic_internal_abort_io()
2542 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2551 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2566 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); in snic_internal_abort_io()
2569 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", in snic_internal_abort_io()
2574 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_internal_abort_io()
2576 SNIC_HOST_ERR(snic->shost, in snic_internal_abort_io()
2609 struct snic *snic = NULL; in snic_tgt_scsi_abort_io() local
2619 snic = shost_priv(snic_tgt_to_shost(tgt)); in snic_tgt_scsi_abort_io()
2620 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); in snic_tgt_scsi_abort_io()
2627 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_tgt_scsi_abort_io()
2628 io_lock = snic_io_lock_tag(snic, tag); in snic_tgt_scsi_abort_io()
2631 sc = scsi_host_find_tag(snic->shost, tag); in snic_tgt_scsi_abort_io()
2646 ret = snic_internal_abort_io(snic, sc, tmf); in snic_tgt_scsi_abort_io()
2648 SNIC_HOST_ERR(snic->shost, in snic_tgt_scsi_abort_io()
2659 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); in snic_tgt_scsi_abort_io()