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
502 atomic64_inc(&snic->s_stats.misc.io_under_run); in snic_process_icmnd_cmpl_status()
505 atomic64_inc(&snic->s_stats.misc.qfull); in snic_process_icmnd_cmpl_status()
509 snic_process_io_failed_state(snic, icmnd_cmpl, sc, cmpl_stat); in snic_process_icmnd_cmpl_status()
510 atomic64_inc(&snic->s_stats.io.fail); in snic_process_icmnd_cmpl_status()
511 SNIC_HOST_ERR(snic->shost, in snic_process_icmnd_cmpl_status()
526 snic_icmnd_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_icmnd_cmpl_handler() argument
543 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
547 if (cmnd_id >= snic->max_tag_id) { in snic_icmnd_cmpl_handler()
548 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
554 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_icmnd_cmpl_handler()
558 atomic64_inc(&snic->s_stats.io.sc_null); in snic_icmnd_cmpl_handler()
559 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
565 SNIC_TRC(snic->shost->host_no, cmnd_id, 0, in snic_icmnd_cmpl_handler()
573 io_lock = snic_io_lock_hash(snic, sc); in snic_icmnd_cmpl_handler()
577 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
591 atomic64_inc(&snic->s_stats.io.req_null); in snic_icmnd_cmpl_handler()
595 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
613 snic_proc_tmreq_pending_state(snic, sc, hdr_stat); in snic_icmnd_cmpl_handler()
616 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
622 SNIC_SCSI_DBG(snic->shost, in snic_icmnd_cmpl_handler()
629 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
636 if (snic_process_icmnd_cmpl_status(snic, icmnd_cmpl, hdr_stat, sc)) { in snic_icmnd_cmpl_handler()
638 SNIC_HOST_ERR(snic->shost, in snic_icmnd_cmpl_handler()
651 snic_calc_io_process_time(snic, rqi); in snic_icmnd_cmpl_handler()
653 snic_release_req_buf(snic, rqi, sc); in snic_icmnd_cmpl_handler()
655 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_icmnd_cmpl_handler()
662 snic_stats_update_io_cmpl(&snic->s_stats); in snic_icmnd_cmpl_handler()
666 snic_proc_dr_cmpl_locked(struct snic *snic, in snic_proc_dr_cmpl_locked() argument
677 SNIC_SCSI_DBG(snic->shost, "itmf_cmpl: Cmd State = %s\n", in snic_proc_dr_cmpl_locked()
683 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
687 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
698 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_proc_dr_cmpl_locked()
702 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
714 SNIC_SCSI_DBG(snic->shost, in snic_proc_dr_cmpl_locked()
728 snic_update_abort_stats(struct snic *snic, u8 cmpl_stat) in snic_update_abort_stats() argument
730 struct snic_abort_stats *abt_stats = &snic->s_stats.abts; in snic_update_abort_stats()
732 SNIC_SCSI_DBG(snic->shost, "Updating Abort stats.\n"); in snic_update_abort_stats()
753 snic_process_itmf_cmpl(struct snic *snic, in snic_process_itmf_cmpl() argument
766 io_lock = snic_io_lock_hash(snic, sc); in snic_process_itmf_cmpl()
777 atomic64_inc(&snic->s_stats.io.req_null); in snic_process_itmf_cmpl()
780 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
797 snic_update_abort_stats(snic, cmpl_stat); in snic_process_itmf_cmpl()
810 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
830 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
836 snic_release_req_buf(snic, rqi, sc); in snic_process_itmf_cmpl()
838 SNIC_TRC(snic->shost->host_no, cmnd_id, (ulong) sc, in snic_process_itmf_cmpl()
849 snic_proc_dr_cmpl_locked(snic, fwreq, cmpl_stat, cmnd_id, sc); in snic_process_itmf_cmpl()
862 SNIC_SCSI_DBG(snic->shost, in snic_process_itmf_cmpl()
876 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
879 SNIC_HOST_ERR(snic->shost, in snic_process_itmf_cmpl()
898 snic_itmf_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_itmf_cmpl_handler() argument
910 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
915 SNIC_SCSI_DBG(snic->shost, in snic_itmf_cmpl_handler()
927 if ((cmnd_id & SNIC_TAG_MASK) >= snic->max_tag_id) { in snic_itmf_cmpl_handler()
928 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
936 sc = scsi_host_find_tag(snic->shost, cmnd_id & SNIC_TAG_MASK); in snic_itmf_cmpl_handler()
941 atomic64_inc(&snic->s_stats.io.sc_null); in snic_itmf_cmpl_handler()
942 SNIC_HOST_ERR(snic->shost, in snic_itmf_cmpl_handler()
949 snic_process_itmf_cmpl(snic, fwreq, cmnd_id, hdr_stat, sc); in snic_itmf_cmpl_handler()
955 snic_hba_reset_scsi_cleanup(struct snic *snic, struct scsi_cmnd *sc) in snic_hba_reset_scsi_cleanup() argument
957 struct snic_stats *st = &snic->s_stats; in snic_hba_reset_scsi_cleanup()
960 SNIC_SCSI_DBG(snic->shost, "HBA Reset scsi cleanup.\n"); in snic_hba_reset_scsi_cleanup()
961 snic_scsi_cleanup(snic, snic_cmd_tag(sc)); in snic_hba_reset_scsi_cleanup()
980 snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_hba_reset_cmpl_handler() argument
994 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
998 SNIC_SCSI_DBG(snic->shost, in snic_hba_reset_cmpl_handler()
1005 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1013 if (cmnd_id >= snic->max_tag_id) { in snic_hba_reset_cmpl_handler()
1014 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1022 sc = scsi_host_find_tag(snic->shost, cmnd_id); in snic_hba_reset_cmpl_handler()
1025 atomic64_inc(&snic->s_stats.io.sc_null); in snic_hba_reset_cmpl_handler()
1026 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1034 SNIC_HOST_INFO(snic->shost, in snic_hba_reset_cmpl_handler()
1038 io_lock = snic_io_lock_hash(snic, sc); in snic_hba_reset_cmpl_handler()
1041 if (!snic->remove_wait) { in snic_hba_reset_cmpl_handler()
1043 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1054 atomic64_inc(&snic->s_stats.io.req_null); in snic_hba_reset_cmpl_handler()
1057 SNIC_HOST_ERR(snic->shost, in snic_hba_reset_cmpl_handler()
1070 snic_hba_reset_scsi_cleanup(snic, sc); in snic_hba_reset_cmpl_handler()
1072 SNIC_BUG_ON(snic_get_state(snic) != SNIC_OFFLINE && in snic_hba_reset_cmpl_handler()
1073 snic_get_state(snic) != SNIC_FWRESET); in snic_hba_reset_cmpl_handler()
1077 spin_lock_irqsave(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1078 if (snic_get_state(snic) == SNIC_FWRESET) in snic_hba_reset_cmpl_handler()
1079 snic_set_state(snic, SNIC_ONLINE); in snic_hba_reset_cmpl_handler()
1080 spin_unlock_irqrestore(&snic->snic_lock, gflags); in snic_hba_reset_cmpl_handler()
1082 if (snic->remove_wait) in snic_hba_reset_cmpl_handler()
1083 complete(snic->remove_wait); in snic_hba_reset_cmpl_handler()
1086 atomic64_inc(&snic->s_stats.reset.hba_reset_cmpl); in snic_hba_reset_cmpl_handler()
1090 if (snic->config.xpt_type == SNIC_DAS) in snic_hba_reset_cmpl_handler()
1093 SNIC_SCSI_DBG(snic->shost, "reset_cmpl: Queuing discovery work.\n"); in snic_hba_reset_cmpl_handler()
1094 queue_work(snic_glob->event_q, &snic->disc_work); in snic_hba_reset_cmpl_handler()
1100 snic_msg_ack_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_msg_ack_handler() argument
1102 SNIC_HOST_INFO(snic->shost, "Message Ack Received.\n"); in snic_msg_ack_handler()
1108 snic_aen_handler(struct snic *snic, struct snic_fw_req *fwreq) in snic_aen_handler() argument
1117 SNIC_SCSI_DBG(snic->shost, in snic_aen_handler()
1125 SNIC_HOST_INFO(snic->shost, "aen:TGT_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1129 SNIC_HOST_INFO(snic->shost, "aen:TGT_ONLINE Event Recvd.\n"); in snic_aen_handler()
1133 SNIC_HOST_INFO(snic->shost, "aen:LUN_OFFLINE Event Recvd.\n"); in snic_aen_handler()
1137 SNIC_HOST_INFO(snic->shost, "aen:LUN_ONLINE Event Recvd.\n"); in snic_aen_handler()
1141 SNIC_HOST_INFO(snic->shost, "aen:Config Change Event Recvd.\n"); in snic_aen_handler()
1145 SNIC_HOST_INFO(snic->shost, "aen:TGT_ADD Event Recvd.\n"); in snic_aen_handler()
1149 SNIC_HOST_INFO(snic->shost, "aen:TGT_DEL Event Recvd.\n"); in snic_aen_handler()
1153 SNIC_HOST_INFO(snic->shost, "aen:LUN_ADD Event Recvd.\n"); in snic_aen_handler()
1157 SNIC_HOST_INFO(snic->shost, "aen:LUN_DEL Event Recvd.\n"); in snic_aen_handler()
1161 SNIC_HOST_INFO(snic->shost, "aen:DISC_CMPL Event Recvd.\n"); in snic_aen_handler()
1165 SNIC_HOST_INFO(snic->shost, "aen:Unknown Event Recvd.\n"); in snic_aen_handler()
1182 struct snic *snic = svnic_dev_priv(vdev); in snic_io_cmpl_handler() local
1190 atomic64_dec(&snic->s_stats.fw.actv_reqs); in snic_io_cmpl_handler()
1198 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1203 SNIC_HOST_ERR(snic->shost, in snic_io_cmpl_handler()
1210 snic_io_exch_ver_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1214 snic_report_tgt_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1218 snic_icmnd_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1222 snic_itmf_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1226 snic_hba_reset_cmpl_handler(snic, fwreq); in snic_io_cmpl_handler()
1230 snic_msg_ack_handler(snic, fwreq); in snic_io_cmpl_handler()
1234 snic_aen_handler(snic, fwreq); in snic_io_cmpl_handler()
1239 SNIC_SCSI_DBG(snic->shost, in snic_io_cmpl_handler()
1247 if (cmpl_time > atomic64_read(&snic->s_stats.io.max_cmpl_time)) in snic_io_cmpl_handler()
1248 atomic64_set(&snic->s_stats.io.max_cmpl_time, cmpl_time); in snic_io_cmpl_handler()
1259 snic_fwcq_cmpl_handler(struct snic *snic, int io_cmpl_work) in snic_fwcq_cmpl_handler() argument
1264 struct snic_misc_stats *misc_stats = &snic->s_stats.misc; in snic_fwcq_cmpl_handler()
1266 for (cq_idx = snic->wq_count; cq_idx < snic->cq_count; cq_idx++) { in snic_fwcq_cmpl_handler()
1267 nent_per_cq = vnic_cq_fw_service(&snic->cq[cq_idx], in snic_fwcq_cmpl_handler()
1285 snic_queue_itmf_req(struct snic *snic, in snic_queue_itmf_req() argument
1305 snic->config.hid, in snic_queue_itmf_req()
1320 ret = snic_queue_wq_desc(snic, tmreq, sizeof(*tmreq)); in snic_queue_itmf_req()
1322 SNIC_HOST_ERR(snic->shost, in snic_queue_itmf_req()
1326 SNIC_SCSI_DBG(snic->shost, in snic_queue_itmf_req()
1334 snic_issue_tm_req(struct snic *snic, in snic_issue_tm_req() argument
1343 if (snic_get_state(snic) == SNIC_FWRESET) in snic_issue_tm_req()
1346 atomic_inc(&snic->ios_inflight); in snic_issue_tm_req()
1348 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1354 tmreq = snic_dr_req_init(snic, rqi); in snic_issue_tm_req()
1357 tmreq = snic_abort_req_init(snic, rqi); in snic_issue_tm_req()
1367 ret = snic_queue_itmf_req(snic, tmreq, sc, tmf, req_id); in snic_issue_tm_req()
1371 SNIC_HOST_ERR(snic->shost, in snic_issue_tm_req()
1375 SNIC_SCSI_DBG(snic->shost, in snic_issue_tm_req()
1380 atomic_dec(&snic->ios_inflight); in snic_issue_tm_req()
1389 snic_queue_abort_req(struct snic *snic, in snic_queue_abort_req() argument
1394 SNIC_SCSI_DBG(snic->shost, "q_abtreq: sc %p, rqi %p, tag %x, tmf %d\n", in snic_queue_abort_req()
1400 return snic_issue_tm_req(snic, rqi, sc, tmf); in snic_queue_abort_req()
1407 snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_abort_finish() argument
1414 io_lock = snic_io_lock_hash(snic, sc); in snic_abort_finish()
1418 atomic64_inc(&snic->s_stats.io.req_null); in snic_abort_finish()
1421 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1438 atomic64_inc(&snic->s_stats.abts.drv_tmo); in snic_abort_finish()
1439 SNIC_SCSI_DBG(snic->shost, in snic_abort_finish()
1467 SNIC_HOST_INFO(snic->shost, in snic_abort_finish()
1475 snic_release_req_buf(snic, rqi, sc); in snic_abort_finish()
1484 snic_send_abort_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_abort_and_wait() argument
1502 io_lock = snic_io_lock_hash(snic, sc); in snic_send_abort_and_wait()
1521 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1551 SNIC_SCSI_DBG(snic->shost, "send_abt_cmd: TAG 0x%x\n", tag); in snic_send_abort_and_wait()
1556 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_send_abort_and_wait()
1558 atomic64_inc(&snic->s_stats.abts.q_fail); in snic_send_abort_and_wait()
1559 SNIC_HOST_ERR(snic->shost, in snic_send_abort_and_wait()
1578 atomic64_inc(&snic->s_stats.abts.num); in snic_send_abort_and_wait()
1585 SNIC_SCSI_DBG(snic->shost, in snic_send_abort_and_wait()
1612 struct snic *snic = shost_priv(sc->device->host); in snic_abort_cmd() local
1616 SNIC_SCSI_DBG(snic->shost, "abt_cmd:sc %p :0x%x :req = %p :tag = %d\n", in snic_abort_cmd()
1619 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_abort_cmd()
1620 SNIC_HOST_ERR(snic->shost, in snic_abort_cmd()
1629 ret = snic_send_abort_and_wait(snic, sc); in snic_abort_cmd()
1633 ret = snic_abort_finish(snic, sc); in snic_abort_cmd()
1636 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_abort_cmd()
1640 SNIC_SCSI_DBG(snic->shost, in snic_abort_cmd()
1651 snic_is_abts_pending(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_is_abts_pending() argument
1664 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_is_abts_pending()
1665 io_lock = snic_io_lock_tag(snic, tag); in snic_is_abts_pending()
1668 sc = scsi_host_find_tag(snic->shost, tag); in snic_is_abts_pending()
1687 SNIC_SCSI_DBG(snic->shost, "Found IO in %s on LUN\n", in snic_is_abts_pending()
1703 snic_dr_clean_single_req(struct snic *snic, in snic_dr_clean_single_req() argument
1716 io_lock = snic_io_lock_tag(snic, tag); in snic_dr_clean_single_req()
1718 sc = scsi_host_find_tag(snic->shost, tag); in snic_dr_clean_single_req()
1737 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1744 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1765 SNIC_SCSI_DBG(snic->shost, in snic_dr_clean_single_req()
1780 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_dr_clean_single_req()
1782 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1819 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_single_req()
1833 snic_release_req_buf(snic, rqi, sc); in snic_dr_clean_single_req()
1849 snic_dr_clean_pending_req(struct snic *snic, struct scsi_cmnd *lr_sc) in snic_dr_clean_pending_req() argument
1855 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_dr_clean_pending_req()
1859 ret = snic_dr_clean_single_req(snic, tag, lr_sdev); in snic_dr_clean_pending_req()
1861 SNIC_HOST_ERR(snic->shost, "clean_err:tag = %d\n", tag); in snic_dr_clean_pending_req()
1869 if (snic_is_abts_pending(snic, lr_sc)) in snic_dr_clean_pending_req()
1872 SNIC_SCSI_DBG(snic->shost, "clean_pending_req: Success.\n"); in snic_dr_clean_pending_req()
1877 SNIC_HOST_ERR(snic->shost, in snic_dr_clean_pending_req()
1889 snic_dr_finish(struct snic *snic, struct scsi_cmnd *sc) in snic_dr_finish() argument
1897 io_lock = snic_io_lock_hash(snic, sc); in snic_dr_finish()
1902 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1917 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1927 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1934 SNIC_HOST_ERR(snic->shost, in snic_dr_finish()
1951 ret = snic_dr_clean_pending_req(snic, sc); in snic_dr_finish()
1954 SNIC_SCSI_DBG(snic->shost, in snic_dr_finish()
1977 snic_release_req_buf(snic, rqi, sc); in snic_dr_finish()
1984 snic_queue_dr_req(struct snic *snic, in snic_queue_dr_req() argument
1991 return snic_issue_tm_req(snic, rqi, sc, SNIC_ITMF_LUN_RESET); in snic_queue_dr_req()
1995 snic_send_dr_and_wait(struct snic *snic, struct scsi_cmnd *sc) in snic_send_dr_and_wait() argument
2004 io_lock = snic_io_lock_hash(snic, sc); in snic_send_dr_and_wait()
2009 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2024 SNIC_SCSI_DBG(snic->shost, "dr: TAG = %x\n", tag); in snic_send_dr_and_wait()
2037 ret = snic_queue_dr_req(snic, rqi, sc); in snic_send_dr_and_wait()
2039 SNIC_HOST_ERR(snic->shost, in snic_send_dr_and_wait()
2084 snic_unlink_and_release_req(struct snic *snic, struct scsi_cmnd *sc, int flag) in snic_unlink_and_release_req() argument
2091 io_lock = snic_io_lock_hash(snic, sc); in snic_unlink_and_release_req()
2103 snic_release_req_buf(snic, rqi, sc); in snic_unlink_and_release_req()
2105 SNIC_TRC(snic->shost->host_no, snic_cmd_tag(sc), (ulong) sc, in snic_unlink_and_release_req()
2119 struct snic *snic = shost_priv(shost); in snic_device_reset() local
2133 snic_unlink_and_release_req(snic, sc, SNIC_DEV_RST_NOTSUP); in snic_device_reset()
2138 if (unlikely(snic_get_state(snic) != SNIC_ONLINE)) { in snic_device_reset()
2139 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2147 SNIC_HOST_INFO(snic->shost, in snic_device_reset()
2150 rqi = snic_req_init(snic, 0); in snic_device_reset()
2164 ret = snic_send_dr_and_wait(snic, sc); in snic_device_reset()
2166 SNIC_HOST_ERR(snic->shost, in snic_device_reset()
2170 snic_unlink_and_release_req(snic, sc, 0); in snic_device_reset()
2175 ret = snic_dr_finish(snic, sc); in snic_device_reset()
2178 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_device_reset()
2182 SNIC_SCSI_DBG(snic->shost, in snic_device_reset()
2200 snic_issue_hba_reset(struct snic *snic, struct scsi_cmnd *sc) in snic_issue_hba_reset() argument
2209 rqi = snic_req_init(snic, 0); in snic_issue_hba_reset()
2219 SNIC_HOST_INFO(snic->shost, "issu_hr:Host reset thru ioctl.\n"); in snic_issue_hba_reset()
2225 io_lock = snic_io_lock_hash(snic, sc); in snic_issue_hba_reset()
2231 snic->remove_wait = &wait; in snic_issue_hba_reset()
2236 snic->config.hid, 0, (ulong) rqi); in snic_issue_hba_reset()
2240 ret = snic_queue_wq_desc(snic, req, sizeof(*req)); in snic_issue_hba_reset()
2242 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2252 atomic64_inc(&snic->s_stats.reset.hba_resets); in snic_issue_hba_reset()
2253 SNIC_HOST_INFO(snic->shost, "Queued HBA Reset Successfully.\n"); in snic_issue_hba_reset()
2255 wait_for_completion_timeout(snic->remove_wait, in snic_issue_hba_reset()
2258 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_issue_hba_reset()
2259 SNIC_HOST_ERR(snic->shost, "reset_cmpl: Reset Timedout.\n"); in snic_issue_hba_reset()
2266 snic->remove_wait = NULL; in snic_issue_hba_reset()
2272 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2280 snic->remove_wait = NULL; in snic_issue_hba_reset()
2286 snic_req_free(snic, rqi); in snic_issue_hba_reset()
2289 SNIC_HOST_ERR(snic->shost, in snic_issue_hba_reset()
2299 struct snic *snic = shost_priv(shost); in snic_reset() local
2305 sv_state = snic_get_state(snic); in snic_reset()
2307 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2308 if (snic_get_state(snic) == SNIC_FWRESET) { in snic_reset()
2309 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2318 snic_set_state(snic, SNIC_FWRESET); in snic_reset()
2319 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2323 while (atomic_read(&snic->ios_inflight)) in snic_reset()
2326 ret = snic_issue_hba_reset(snic, sc); in snic_reset()
2331 spin_lock_irqsave(&snic->snic_lock, flags); in snic_reset()
2332 snic_set_state(snic, sv_state); in snic_reset()
2333 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_reset()
2334 atomic64_inc(&snic->s_stats.reset.hba_reset_fail); in snic_reset()
2378 snic_cmpl_pending_tmreq(struct snic *snic, struct scsi_cmnd *sc) in snic_cmpl_pending_tmreq() argument
2382 SNIC_SCSI_DBG(snic->shost, in snic_cmpl_pending_tmreq()
2407 snic_scsi_cleanup(struct snic *snic, int ex_tag) in snic_scsi_cleanup() argument
2416 SNIC_SCSI_DBG(snic->shost, "sc_clean: scsi cleanup.\n"); in snic_scsi_cleanup()
2418 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_scsi_cleanup()
2423 io_lock = snic_io_lock_tag(snic, tag); in snic_scsi_cleanup()
2425 sc = scsi_host_find_tag(snic->shost, tag); in snic_scsi_cleanup()
2437 snic_cmpl_pending_tmreq(snic, sc); in snic_scsi_cleanup()
2450 SNIC_SCSI_DBG(snic->shost, in snic_scsi_cleanup()
2459 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2463 snic_release_req_buf(snic, rqi, sc); in snic_scsi_cleanup()
2467 SNIC_HOST_INFO(snic->shost, in snic_scsi_cleanup()
2473 snic_stats_update_io_cmpl(&snic->s_stats); in snic_scsi_cleanup()
2475 SNIC_TRC(snic->shost->host_no, tag, (ulong) sc, in snic_scsi_cleanup()
2485 snic_shutdown_scsi_cleanup(struct snic *snic) in snic_shutdown_scsi_cleanup() argument
2487 SNIC_HOST_INFO(snic->shost, "Shutdown time SCSI Cleanup.\n"); in snic_shutdown_scsi_cleanup()
2489 snic_scsi_cleanup(snic, SCSI_NO_TAG); in snic_shutdown_scsi_cleanup()
2497 snic_internal_abort_io(struct snic *snic, struct scsi_cmnd *sc, int tmf) in snic_internal_abort_io() argument
2505 io_lock = snic_io_lock_hash(snic, sc); in snic_internal_abort_io()
2517 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2526 SNIC_SCSI_DBG(snic->shost, in snic_internal_abort_io()
2541 SNIC_SCSI_DBG(snic->shost, "internal_abts:dev rst sc %p\n", sc); in snic_internal_abort_io()
2544 SNIC_SCSI_DBG(snic->shost, "internal_abts: Issuing abts tag %x\n", in snic_internal_abort_io()
2549 ret = snic_queue_abort_req(snic, rqi, sc, tmf); in snic_internal_abort_io()
2551 SNIC_HOST_ERR(snic->shost, in snic_internal_abort_io()
2584 struct snic *snic = NULL; in snic_tgt_scsi_abort_io() local
2594 snic = shost_priv(snic_tgt_to_shost(tgt)); in snic_tgt_scsi_abort_io()
2595 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: Cleaning Pending IOs.\n"); in snic_tgt_scsi_abort_io()
2602 for (tag = 0; tag < snic->max_tag_id; tag++) { in snic_tgt_scsi_abort_io()
2603 io_lock = snic_io_lock_tag(snic, tag); in snic_tgt_scsi_abort_io()
2606 sc = scsi_host_find_tag(snic->shost, tag); in snic_tgt_scsi_abort_io()
2621 ret = snic_internal_abort_io(snic, sc, tmf); in snic_tgt_scsi_abort_io()
2623 SNIC_HOST_ERR(snic->shost, in snic_tgt_scsi_abort_io()
2634 SNIC_SCSI_DBG(snic->shost, "tgt_abt_io: abt_cnt = %d\n", abt_cnt); in snic_tgt_scsi_abort_io()