Lines Matching refs:snic
66 static void snic_scsi_cleanup(struct snic *, int);
98 snic_io_lock_hash(struct snic *snic, struct scsi_cmnd *sc) in snic_io_lock_hash() argument
102 return &snic->io_req_lock[hash]; in snic_io_lock_hash()
106 snic_io_lock_tag(struct snic *snic, int tag) in snic_io_lock_tag() argument
108 return &snic->io_req_lock[tag & (SNIC_IO_LOCKS - 1)]; in snic_io_lock_tag()
113 snic_release_req_buf(struct snic *snic, in snic_release_req_buf() argument
128 SNIC_SCSI_DBG(snic->shost, in snic_release_req_buf()
135 dma_unmap_single(&snic->pdev->dev, in snic_release_req_buf()
142 snic_req_free(snic, rqi); in snic_release_req_buf()
149 snic_queue_icmnd_req(struct snic *snic, in snic_queue_icmnd_req() argument
174 pa = dma_map_single(&snic->pdev->dev, in snic_queue_icmnd_req()
178 if (dma_mapping_error(&snic->pdev->dev, pa)) { in snic_queue_icmnd_req()
179 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
196 snic->config.hid, /* hid */ in snic_queue_icmnd_req()
209 atomic64_inc(&snic->s_stats.io.active); in snic_queue_icmnd_req()
210 ret = snic_queue_wq_desc(snic, rqi->req, rqi->req_len); in snic_queue_icmnd_req()
212 atomic64_dec(&snic->s_stats.io.active); in snic_queue_icmnd_req()
213 SNIC_HOST_ERR(snic->shost, in snic_queue_icmnd_req()
217 snic_stats_update_active_ios(&snic->s_stats); in snic_queue_icmnd_req()
226 snic_issue_scsi_req(struct snic *snic, in snic_issue_scsi_req() argument
242 SNIC_TRC((u16)snic->shost->host_no, tag, (ulong) sc, 0, in snic_issue_scsi_req()
245 SNIC_HOST_ERR(snic->shost, "issue_sc:Failed to map SG List.\n"); in snic_issue_scsi_req()
251 rqi = snic_req_init(snic, sg_cnt); in snic_issue_scsi_req()
267 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_scsi_req()
270 ret = snic_queue_icmnd_req(snic, rqi, sc, sg_cnt); in snic_issue_scsi_req()
272 SNIC_HOST_ERR(snic->shost, in snic_issue_scsi_req()
284 snic_release_req_buf(snic, rqi, sc); in snic_issue_scsi_req()
286 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, 0, 0, 0, in snic_issue_scsi_req()
291 struct snic_io_stats *iostats = &snic->s_stats.io; in snic_issue_scsi_req()
299 SNIC_SCSI_DBG(snic->shost, in snic_issue_scsi_req()
303 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, (ulong) rqi, in snic_issue_scsi_req()
322 struct snic *snic = shost_priv(shost); in snic_queuecommand() local
329 atomic64_inc(&snic->s_stats.misc.tgt_not_rdy); in snic_queuecommand()
336 if (snic_get_state(snic) != SNIC_ONLINE) { in snic_queuecommand()
338 snic_state_str[snic_get_state(snic)]); in snic_queuecommand()
342 atomic_inc(&snic->ios_inflight); in snic_queuecommand()
347 ret = snic_issue_scsi_req(snic, tgt, sc); in snic_queuecommand()
353 atomic_dec(&snic->ios_inflight); in snic_queuecommand()
363 snic_proc_tmreq_pending_state(struct snic *snic, in snic_proc_tmreq_pending_state() argument
395 snic_process_io_failed_state(struct snic *snic, in snic_process_io_failed_state() argument
404 atomic64_inc(&snic->s_stats.misc.io_tmo); in snic_process_io_failed_state()
409 atomic64_inc(&snic->s_stats.misc.io_aborted); in snic_process_io_failed_state()
414 atomic64_inc(&snic->s_stats.misc.data_cnt_mismat); in snic_process_io_failed_state()
420 atomic64_inc(&snic->s_stats.fw.out_of_res); in snic_process_io_failed_state()
425 atomic64_inc(&snic->s_stats.io.io_not_found); in snic_process_io_failed_state()
430 atomic64_inc(&snic->s_stats.misc.sgl_inval); in snic_process_io_failed_state()
435 atomic64_inc(&snic->s_stats.fw.io_errs); in snic_process_io_failed_state()
440 atomic64_inc(&snic->s_stats.fw.scsi_errs); in snic_process_io_failed_state()
454 SNIC_SCSI_DBG(snic->shost, in snic_process_io_failed_state()
460 SNIC_HOST_ERR(snic->shost, "fw returns failed status %s flags 0x%llx\n", in snic_process_io_failed_state()
484 snic_process_icmnd_cmpl_status(struct snic *snic, in snic_process_icmnd_cmpl_status() argument
506 atomic64_inc(&snic->s_stats.misc.io_under_run); in snic_process_icmnd_cmpl_status()
510 atomic64_inc(&snic->s_stats.misc.qfull); in snic_process_icmnd_cmpl_status()
514 snic_process_io_failed_state(snic, icmnd_cmpl, sc, cmpl_stat); in snic_process_icmnd_cmpl_status()
515 atomic64_inc(&snic->s_stats.io.fail); in snic_process_icmnd_cmpl_status()
516 SNIC_HOST_ERR(snic->shost, in snic_process_icmnd_cmpl_status()
531 snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_icmnd_cmpl_handler() argument
548 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
552 if (cmnd_id >= snic->max_tag_id) { in snic_icmnd_cmpl_handler()
553 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
559 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_icmnd_cmpl_handler()
563 atomic64_inc(&snic->s_stats.io.sc_null); in snic_icmnd_cmpl_handler()
564 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
570 SNIC_TRC(snic->shost->host_no, cmnd_id, 0, in snic_icmnd_cmpl_handler()
578 io_lock = snic_io_lock_hash(snic, sc); in snic_icmnd_cmpl_handler()
582 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
596 atomic64_inc(&snic->s_stats.io.req_null); in snic_icmnd_cmpl_handler()
600 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
618 snic_proc_tmreq_pending_state(snic, sc, hdr_stat); in snic_icmnd_cmpl_handler()
621 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
627 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
634 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
641 if (snic_process_icmnd_cmpl_status(snic, icmnd_cmpl, hdr_stat, sc)) { in snic_icmnd_cmpl_handler()
643 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
656 snic_calc_io_process_time(snic, rqi); in snic_icmnd_cmpl_handler()
658 snic_release_req_buf(snic, rqi, sc); in snic_icmnd_cmpl_handler()
660 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
667 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
671 snic_proc_dr_cmpl_locked(struct snic *snic, in snic_proc_dr_cmpl_locked() argument
682 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", in snic_proc_dr_cmpl_locked()
688 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
692 SNIC_SCSI_DBG(snic->shost, 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()
719 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
733 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) in snic_update_abort_stats() argument
735 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; in snic_update_abort_stats()
737 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); in snic_update_abort_stats()
758 snic_process_itmf_cmpl(struct snic *snic, in snic_process_itmf_cmpl() argument
771 io_lock = snic_io_lock_hash(snic, sc); in snic_process_itmf_cmpl()
782 atomic64_inc(&snic->s_stats.io.req_null); in snic_process_itmf_cmpl()
785 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
802 snic_update_abort_stats(snic, cmpl_stat); in snic_process_itmf_cmpl()
815 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
835 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
841 snic_release_req_buf(snic, rqi, sc); in snic_process_itmf_cmpl()
843 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_process_itmf_cmpl()
854 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); in snic_process_itmf_cmpl()
867 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
881 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
884 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
903 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_itmf_cmpl_handler() argument
915 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
920 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
932 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { in snic_itmf_cmpl_handler()
933 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
941 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); in snic_itmf_cmpl_handler()
946 atomic64_inc(&snic->s_stats.io.sc_null); in snic_itmf_cmpl_handler()
947 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
954 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); in snic_itmf_cmpl_handler()
960 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) in snic_hba_reset_scsi_cleanup() argument
962 struct snic_stats *st = &snic->s_stats; in snic_hba_reset_scsi_cleanup()
965 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); in snic_hba_reset_scsi_cleanup()
966 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); in snic_hba_reset_scsi_cleanup()
985 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_hba_reset_cmpl_handler() argument
999 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1003 SNIC_SCSI_DBG(snic->shost, in snic_hba_reset_cmpl_handler()
1010 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1018 if (cmnd_id >= snic->max_tag_id) { in snic_hba_reset_cmpl_handler()
1019 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1027 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_hba_reset_cmpl_handler()
1030 atomic64_inc(&snic->s_stats.io.sc_null); in snic_hba_reset_cmpl_handler()
1031 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1039 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1043 io_lock = snic_io_lock_hash(snic, sc); in snic_hba_reset_cmpl_handler()
1046 if (!snic->remove_wait) { in snic_hba_reset_cmpl_handler()
1048 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1059 atomic64_inc(&snic->s_stats.io.req_null); in snic_hba_reset_cmpl_handler()
1062 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1075 snic_hba_reset_scsi_cleanup(snic, sc); in snic_hba_reset_cmpl_handler()
1077 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && in snic_hba_reset_cmpl_handler()
1078 snic_get_state(snic) != SNIC_FWRESET); in snic_hba_reset_cmpl_handler()
1082 spin_lock_irqsave(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1083 if (snic_get_state(snic) == SNIC_FWRESET) in snic_hba_reset_cmpl_handler()
1084 snic_set_state(snic, SNIC_ONLINE); in snic_hba_reset_cmpl_handler()
1085 spin_unlock_irqrestore(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1087 if (snic->remove_wait) in snic_hba_reset_cmpl_handler()
1088 complete(snic->remove_wait); in snic_hba_reset_cmpl_handler()
1091 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); in snic_hba_reset_cmpl_handler()
1095 if (snic->config.xpt_type == SNIC_DAS) in snic_hba_reset_cmpl_handler()
1098 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); in snic_hba_reset_cmpl_handler()
1099 queue_work(snic_glob->event_q, &snic->disc_work); in snic_hba_reset_cmpl_handler()
1105 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_msg_ack_handler() argument
1107 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); in snic_msg_ack_handler()
1113 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_aen_handler() argument
1122 SNIC_SCSI_DBG(snic->shost, in snic_aen_handler()
1130 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1134 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); in snic_aen_handler()
1138 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1142 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); in snic_aen_handler()
1146 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); in snic_aen_handler()
1150 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); in snic_aen_handler()
1154 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); in snic_aen_handler()
1158 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); in snic_aen_handler()
1162 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); in snic_aen_handler()
1166 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); in snic_aen_handler()
1170 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); in snic_aen_handler()
1187 struct snic *snic = svnic_dev_priv(vdev); in snic_io_cmpl_handler() local
1195 atomic64_dec(&snic->s_stats.fw.actv_reqs); in snic_io_cmpl_handler()
1203 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1208 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1215 snic_io_exch_ver_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1219 snic_report_tgt_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1223 snic_icmnd_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1227 snic_itmf_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1231 snic_hba_reset_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1235 snic_msg_ack_handler(snic, fwreq); in snic_io_cmpl_handler()
1239 snic_aen_handler(snic, fwreq); in snic_io_cmpl_handler()
1244 SNIC_SCSI_DBG(snic->shost, in snic_io_cmpl_handler()
1252 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) in snic_io_cmpl_handler()
1253 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); in snic_io_cmpl_handler()
1264 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) in snic_fwcq_cmpl_handler() argument
1269 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; in snic_fwcq_cmpl_handler()
1271 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { in snic_fwcq_cmpl_handler()
1272 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], in snic_fwcq_cmpl_handler()
1290 snic_queue_itmf_req(struct snic *snic, in snic_queue_itmf_req() argument
1310 snic->config.hid, in snic_queue_itmf_req()
1325 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); in snic_queue_itmf_req()
1327 SNIC_HOST_ERR(snic->shost, in snic_queue_itmf_req()
1331 SNIC_SCSI_DBG(snic->shost, in snic_queue_itmf_req()
1339 snic_issue_tm_req(struct snic *snic, in snic_issue_tm_req() argument
1348 if (snic_get_state(snic) == SNIC_FWRESET) in snic_issue_tm_req()
1351 atomic_inc(&snic->ios_inflight); in snic_issue_tm_req()
1353 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1359 tmreq = snic_dr_req_init(snic, rqi); in snic_issue_tm_req()
1362 tmreq = snic_abort_req_init(snic, rqi); in snic_issue_tm_req()
1372 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); in snic_issue_tm_req()
1376 SNIC_HOST_ERR(snic->shost, in snic_issue_tm_req()
1380 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1385 atomic_dec(&snic->ios_inflight); in snic_issue_tm_req()
1394 snic_queue_abort_req(struct snic *snic, in snic_queue_abort_req() argument
1399 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", in snic_queue_abort_req()
1405 return snic_issue_tm_req(snic, rqi, sc, tmf); in snic_queue_abort_req()
1412 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_abort_finish() argument
1419 io_lock = snic_io_lock_hash(snic, sc); in snic_abort_finish()
1423 atomic64_inc(&snic->s_stats.io.req_null); in snic_abort_finish()
1426 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1443 atomic64_inc(&snic->s_stats.abts.drv_tmo); in snic_abort_finish()
1444 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1472 SNIC_HOST_INFO(snic->shost, in snic_abort_finish()
1480 snic_release_req_buf(snic, rqi, sc); in snic_abort_finish()
1489 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_abort_and_wait() argument
1507 io_lock = snic_io_lock_hash(snic, sc); in snic_send_abort_and_wait()
1526 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1556 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); in snic_send_abort_and_wait()
1561 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_send_abort_and_wait()
1563 atomic64_inc(&snic->s_stats.abts.q_fail); in snic_send_abort_and_wait()
1564 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1583 atomic64_inc(&snic->s_stats.abts.num); in snic_send_abort_and_wait()
1590 SNIC_SCSI_DBG(snic->shost, in snic_send_abort_and_wait()
1617 struct snic *snic = shost_priv(sc->device->host); in snic_abort_cmd() local
1621 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", in snic_abort_cmd()
1624 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_abort_cmd()
1625 SNIC_HOST_ERR(snic->shost, in snic_abort_cmd()
1634 ret = snic_send_abort_and_wait(snic, sc); in snic_abort_cmd()
1638 ret = snic_abort_finish(snic, sc); in snic_abort_cmd()
1641 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_abort_cmd()
1645 SNIC_SCSI_DBG(snic->shost, in snic_abort_cmd()
1656 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_is_abts_pending() argument
1669 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_is_abts_pending()
1670 io_lock = snic_io_lock_tag(snic, tag); in snic_is_abts_pending()
1673 sc = scsi_host_find_tag(snic->shost, tag); in snic_is_abts_pending()
1692 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", in snic_is_abts_pending()
1708 snic_dr_clean_single_req(struct snic *snic, in snic_dr_clean_single_req() argument
1721 io_lock = snic_io_lock_tag(snic, tag); in snic_dr_clean_single_req()
1723 sc = scsi_host_find_tag(snic->shost, tag); in snic_dr_clean_single_req()
1742 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1749 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1770 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1785 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_dr_clean_single_req()
1787 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1824 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1838 snic_release_req_buf(snic, rqi, sc); in snic_dr_clean_single_req()
1854 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_dr_clean_pending_req() argument
1860 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_dr_clean_pending_req()
1864 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); in snic_dr_clean_pending_req()
1866 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); in snic_dr_clean_pending_req()
1875 if (snic_is_abts_pending(snic, lr_sc)) { in snic_dr_clean_pending_req()
1882 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); in snic_dr_clean_pending_req()
1888 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_pending_req()
1900 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_dr_finish() argument
1908 io_lock = snic_io_lock_hash(snic, sc); in snic_dr_finish()
1913 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1928 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1938 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1945 SNIC_HOST_ERR(snic->shost, in snic_dr_finish()
1962 ret = snic_dr_clean_pending_req(snic, sc); in snic_dr_finish()
1965 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1988 snic_release_req_buf(snic, rqi, sc); in snic_dr_finish()
1995 snic_queue_dr_req(struct snic *snic, in snic_queue_dr_req() argument
2002 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); in snic_queue_dr_req()
2006 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_dr_and_wait() argument
2015 io_lock = snic_io_lock_hash(snic, sc); in snic_send_dr_and_wait()
2020 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2035 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); in snic_send_dr_and_wait()
2048 ret = snic_queue_dr_req(snic, rqi, sc); in snic_send_dr_and_wait()
2050 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2095 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) in snic_unlink_and_release_req() argument
2102 io_lock = snic_io_lock_hash(snic, sc); in snic_unlink_and_release_req()
2114 snic_release_req_buf(snic, rqi, sc); in snic_unlink_and_release_req()
2116 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, in snic_unlink_and_release_req()
2130 struct snic *snic = shost_priv(shost); in snic_device_reset() local
2144 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); in snic_device_reset()
2149 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_device_reset()
2150 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2158 SNIC_HOST_INFO(snic->shost, in snic_device_reset()
2161 rqi = snic_req_init(snic, 0); in snic_device_reset()
2175 ret = snic_send_dr_and_wait(snic, sc); in snic_device_reset()
2177 SNIC_HOST_ERR(snic->shost, in snic_device_reset()
2181 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2186 ret = snic_dr_finish(snic, sc); in snic_device_reset()
2189 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_device_reset()
2193 SNIC_SCSI_DBG(snic->shost, in snic_device_reset()
2211 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) in snic_issue_hba_reset() argument
2220 rqi = snic_req_init(snic, 0); in snic_issue_hba_reset()
2230 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); in snic_issue_hba_reset()
2236 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_hba_reset()
2242 snic->remove_wait = &wait; in snic_issue_hba_reset()
2247 snic->config.hid, 0, (ulong) rqi); in snic_issue_hba_reset()
2251 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); in snic_issue_hba_reset()
2253 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2263 atomic64_inc(&snic->s_stats.reset.hba_resets); in snic_issue_hba_reset()
2264 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); in snic_issue_hba_reset()
2266 wait_for_completion_timeout(snic->remove_wait, in snic_issue_hba_reset()
2269 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_issue_hba_reset()
2270 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); in snic_issue_hba_reset()
2277 snic->remove_wait = NULL; in snic_issue_hba_reset()
2283 snic_req_free(snic, rqi); 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()
2300 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2310 struct snic *snic = shost_priv(shost); in snic_reset() local
2316 sv_state = snic_get_state(snic); in snic_reset()
2318 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2319 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_reset()
2320 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2329 snic_set_state(snic, SNIC_FWRESET); in snic_reset()
2330 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2334 while (atomic_read(&snic->ios_inflight)) in snic_reset()
2337 ret = snic_issue_hba_reset(snic, sc); in snic_reset()
2342 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2343 snic_set_state(snic, sv_state); in snic_reset()
2344 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2345 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); in snic_reset()
2389 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) in snic_cmpl_pending_tmreq() argument
2393 SNIC_SCSI_DBG(snic->shost, in snic_cmpl_pending_tmreq()
2418 snic_scsi_cleanup(struct snic *snic, int ex_tag) in snic_scsi_cleanup() argument
2427 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); in snic_scsi_cleanup()
2429 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_scsi_cleanup()
2434 io_lock = snic_io_lock_tag(snic, tag); in snic_scsi_cleanup()
2436 sc = scsi_host_find_tag(snic->shost, tag); in snic_scsi_cleanup()
2448 snic_cmpl_pending_tmreq(snic, sc); in snic_scsi_cleanup()
2461 SNIC_SCSI_DBG(snic->shost, in snic_scsi_cleanup()
2470 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2474 snic_release_req_buf(snic, rqi, sc); in snic_scsi_cleanup()
2478 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2484 snic_stats_update_io_cmpl(&snic->s_stats); in snic_scsi_cleanup()
2486 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_scsi_cleanup()
2496 snic_shutdown_scsi_cleanup(struct snic *snic) in snic_shutdown_scsi_cleanup() argument
2498 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); in snic_shutdown_scsi_cleanup()
2500 snic_scsi_cleanup(snic, SCSI_NO_TAG); in snic_shutdown_scsi_cleanup()
2508 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) in snic_internal_abort_io() argument
2516 io_lock = snic_io_lock_hash(snic, sc); in snic_internal_abort_io()
2528 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2537 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2552 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); in snic_internal_abort_io()
2555 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", in snic_internal_abort_io()
2560 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_internal_abort_io()
2562 SNIC_HOST_ERR(snic->shost, in snic_internal_abort_io()
2595 struct snic *snic = NULL; in snic_tgt_scsi_abort_io() local
2605 snic = shost_priv(snic_tgt_to_shost(tgt)); in snic_tgt_scsi_abort_io()
2606 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); in snic_tgt_scsi_abort_io()
2613 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_tgt_scsi_abort_io()
2614 io_lock = snic_io_lock_tag(snic, tag); in snic_tgt_scsi_abort_io()
2617 sc = scsi_host_find_tag(snic->shost, tag); in snic_tgt_scsi_abort_io()
2632 ret = snic_internal_abort_io(snic, sc, tmf); in snic_tgt_scsi_abort_io()
2634 SNIC_HOST_ERR(snic->shost, in snic_tgt_scsi_abort_io()
2645 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); in snic_tgt_scsi_abort_io()