Lines Matching refs:tgt
112 static void qlt_clear_tgt_db(struct qla_tgt *tgt);
210 BUG_ON(ha->tgt.tgt_vp_map == NULL); in qlt_find_host_by_vp_idx()
212 return ha->tgt.tgt_vp_map[vp_idx].vha; in qlt_find_host_by_vp_idx()
221 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); in qlt_incr_num_pend_cmds()
223 vha->hw->tgt.num_pend_cmds++; in qlt_incr_num_pend_cmds()
224 if (vha->hw->tgt.num_pend_cmds > vha->qla_stats.stat_max_pend_cmds) in qlt_incr_num_pend_cmds()
226 vha->hw->tgt.num_pend_cmds; in qlt_incr_num_pend_cmds()
227 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_incr_num_pend_cmds()
233 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); in qlt_decr_num_pend_cmds()
234 vha->hw->tgt.num_pend_cmds--; in qlt_decr_num_pend_cmds()
235 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_decr_num_pend_cmds()
243 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_queue_unknown_atio() local
246 if (tgt->tgt_stop) { in qlt_queue_unknown_atio()
280 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_try_to_dequeue_unknown_atios() local
299 } else if (tgt->tgt_stop) { in qlt_try_to_dequeue_unknown_atios()
561 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_async_nack_sp_done()
596 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_async_nack_sp_done()
598 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_async_nack_sp_done()
614 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_async_nack_sp_done()
690 vha->hw->tgt.tgt_ops->put_sess(e->u.nack.fcport); in qla24xx_do_nack_work()
709 ha->tgt.tgt_ops->shutdown_sess(fcport); in qla24xx_delete_sess_fn()
710 ha->tgt.tgt_ops->put_sess(fcport); in qla24xx_delete_sess_fn()
722 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_fc_port_added() local
726 if (!vha->hw->tgt.tgt_ops) in qlt_fc_port_added()
729 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
730 if (tgt->tgt_stop) { in qlt_fc_port_added()
731 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
736 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
741 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
747 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
750 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
758 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
770 ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, in qlt_fc_port_added()
782 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_fc_port_added()
784 ha->tgt.tgt_ops->put_sess(sess); in qlt_fc_port_added()
966 struct qla_tgt *tgt = sess->tgt; in qlt_free_session_done() local
1054 ha->tgt.tgt_ops->free_session(sess); in qlt_free_session_done()
1092 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_free_session_done()
1095 if (tgt && !IS_SW_RESV_ADDR(sess->d_id)) in qlt_free_session_done()
1096 tgt->sess_count--; in qlt_free_session_done()
1152 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_free_session_done()
1161 if (tgt && (tgt->sess_count == 0)) in qlt_free_session_done()
1162 wake_up_all(&tgt->waitQ); in qlt_free_session_done()
1166 (!tgt || !tgt->tgt_stop) && !LOOP_TRANSITION(vha)) { in qlt_free_session_done()
1208 vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess); in qlt_unreg_sess()
1232 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_reset()
1234 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_reset()
1236 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_reset()
1237 sess = ha->tgt.tgt_ops->find_sess_by_loop_id(vha, loop_id); in qlt_reset()
1238 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_reset()
1267 struct qla_tgt *tgt = sess->tgt; in qlt_schedule_sess_for_deletion() local
1277 if (tgt && tgt->tgt_stop && tgt->sess_count == 0) in qlt_schedule_sess_for_deletion()
1278 wake_up_all(&tgt->waitQ); in qlt_schedule_sess_for_deletion()
1324 static void qlt_clear_tgt_db(struct qla_tgt *tgt) in qlt_clear_tgt_db() argument
1327 scsi_qla_host_t *vha = tgt->vha; in qlt_clear_tgt_db()
1409 sess->tgt = vha->vha_tgt.qla_tgt; in qlt_create_sess()
1422 if (ha->tgt.tgt_ops->check_initiator_node_acl(vha, in qlt_create_sess()
1441 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_create_sess()
1446 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_create_sess()
1471 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_fc_port_deleted() local
1475 if (!vha->hw->tgt.tgt_ops) in qlt_fc_port_deleted()
1478 if (!tgt) in qlt_fc_port_deleted()
1481 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qlt_fc_port_deleted()
1482 if (tgt->tgt_stop) { in qlt_fc_port_deleted()
1483 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_fc_port_deleted()
1487 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_fc_port_deleted()
1492 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_fc_port_deleted()
1504 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_fc_port_deleted()
1508 static inline int test_tgt_sess_count(struct qla_tgt *tgt) in test_tgt_sess_count() argument
1510 struct qla_hw_data *ha = tgt->ha; in test_tgt_sess_count()
1517 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_tgt_sess_count()
1518 ql_dbg(ql_dbg_tgt, tgt->vha, 0xe002, in test_tgt_sess_count()
1520 tgt, tgt->sess_count); in test_tgt_sess_count()
1521 res = (tgt->sess_count == 0); in test_tgt_sess_count()
1522 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_tgt_sess_count()
1528 int qlt_stop_phase1(struct qla_tgt *tgt) in qlt_stop_phase1() argument
1530 struct scsi_qla_host *vha = tgt->vha; in qlt_stop_phase1()
1531 struct qla_hw_data *ha = tgt->ha; in qlt_stop_phase1()
1537 if (tgt->tgt_stop || tgt->tgt_stopped) { in qlt_stop_phase1()
1552 tgt->tgt_stop = 1; in qlt_stop_phase1()
1553 qlt_clear_tgt_db(tgt); in qlt_stop_phase1()
1558 "Waiting for sess works (tgt %p)", tgt); in qlt_stop_phase1()
1559 spin_lock_irqsave(&tgt->sess_work_lock, flags); in qlt_stop_phase1()
1561 spin_unlock_irqrestore(&tgt->sess_work_lock, flags); in qlt_stop_phase1()
1562 flush_work(&tgt->sess_work); in qlt_stop_phase1()
1563 spin_lock_irqsave(&tgt->sess_work_lock, flags); in qlt_stop_phase1()
1564 } while (!list_empty(&tgt->sess_works_list)); in qlt_stop_phase1()
1565 spin_unlock_irqrestore(&tgt->sess_work_lock, flags); in qlt_stop_phase1()
1568 "Waiting for tgt %p: sess_count=%d\n", tgt, tgt->sess_count); in qlt_stop_phase1()
1570 wait_event_timeout(tgt->waitQ, test_tgt_sess_count(tgt), 10*HZ); in qlt_stop_phase1()
1578 wait_event_timeout(tgt->waitQ, test_tgt_sess_count(tgt), 10*HZ); in qlt_stop_phase1()
1586 void qlt_stop_phase2(struct qla_tgt *tgt) in qlt_stop_phase2() argument
1588 scsi_qla_host_t *vha = tgt->vha; in qlt_stop_phase2()
1590 if (tgt->tgt_stopped) { in qlt_stop_phase2()
1596 if (!tgt->tgt_stop) { in qlt_stop_phase2()
1603 mutex_lock(&tgt->ha->optrom_mutex); in qlt_stop_phase2()
1605 tgt->tgt_stop = 0; in qlt_stop_phase2()
1606 tgt->tgt_stopped = 1; in qlt_stop_phase2()
1608 mutex_unlock(&tgt->ha->optrom_mutex); in qlt_stop_phase2()
1611 tgt); in qlt_stop_phase2()
1625 static void qlt_release(struct qla_tgt *tgt) in qlt_release() argument
1627 scsi_qla_host_t *vha = tgt->vha; in qlt_release()
1634 if (!tgt->tgt_stop && !tgt->tgt_stopped) in qlt_release()
1635 qlt_stop_phase1(tgt); in qlt_release()
1637 if (!tgt->tgt_stopped) in qlt_release()
1638 qlt_stop_phase2(tgt); in qlt_release()
1643 h = &tgt->qphints[i]; in qlt_release()
1651 kfree(tgt->qphints); in qlt_release()
1656 btree_for_each_safe64(&tgt->lun_qpair_map, key, node) in qlt_release()
1657 btree_remove64(&tgt->lun_qpair_map, key); in qlt_release()
1659 btree_destroy64(&tgt->lun_qpair_map); in qlt_release()
1662 if (ha->tgt.tgt_ops && in qlt_release()
1663 ha->tgt.tgt_ops->remove_target && in qlt_release()
1665 ha->tgt.tgt_ops->remove_target(vha); in qlt_release()
1670 "Release of tgt %p finished\n", tgt); in qlt_release()
1672 kfree(tgt); in qlt_release()
1676 static int qlt_sched_sess_work(struct qla_tgt *tgt, int type, in qlt_sched_sess_work() argument
1684 ql_dbg(ql_dbg_tgt_mgt, tgt->vha, 0xf050, in qlt_sched_sess_work()
1690 ql_dbg(ql_dbg_tgt_mgt, tgt->vha, 0xf00e, in qlt_sched_sess_work()
1693 type, prm, param, param_size, tgt); in qlt_sched_sess_work()
1698 spin_lock_irqsave(&tgt->sess_work_lock, flags); in qlt_sched_sess_work()
1699 list_add_tail(&prm->sess_works_list_entry, &tgt->sess_works_list); in qlt_sched_sess_work()
1700 spin_unlock_irqrestore(&tgt->sess_work_lock, flags); in qlt_sched_sess_work()
1702 schedule_work(&tgt->sess_work); in qlt_sched_sess_work()
2050 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_find_qphint() local
2054 h = btree_lookup64(&tgt->lun_qpair_map, unpacked_lun); in qlt_find_qphint()
2056 h = &tgt->qphints[0]; in qlt_find_qphint()
2058 h = &tgt->qphints[0]; in qlt_find_qphint()
2082 rc = ha->tgt.tgt_ops->handle_tmr(mcmd, mcmd->unpacked_lun, in qlt_do_tmr_work()
2152 abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess, in __qlt_24xx_handle_abts()
2212 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_24xx_handle_abts()
2213 sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, s_id); in qlt_24xx_handle_abts()
2218 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_24xx_handle_abts()
2224 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_24xx_handle_abts()
2392 ha->tgt.tgt_ops->free_mcmd(mcmd); in qlt_xmit_tm_rsp()
2430 ha->tgt.tgt_ops->free_mcmd(mcmd); in qlt_xmit_tm_rsp()
2792 prm->tgt = cmd->tgt; in qlt_pre_xmit_response()
2970 scsi_qla_host_t *vha = cmd->tgt->vha; in qla_tgt_set_dif_tags()
2991 t32 = ha->tgt.tgt_ops->get_dif_tags(cmd, pfw_prot_opts); in qla_tgt_set_dif_tags()
3014 !(ha->tgt.tgt_ops->chk_dif_tags(t32))) { in qla_tgt_set_dif_tags()
3031 !(ha->tgt.tgt_ops->chk_dif_tags(t32))) { in qla_tgt_set_dif_tags()
3422 struct qla_tgt *tgt = cmd->tgt; in qlt_rdy_to_xfer() local
3430 prm.tgt = tgt; in qlt_rdy_to_xfer()
3443 vha->hw->tgt.tgt_ops->handle_data(cmd); in qlt_rdy_to_xfer()
3582 vha->hw->tgt.tgt_ops->handle_data(cmd); in qlt_handle_dif_error()
3588 vha->hw->tgt.tgt_ops->free_cmd(cmd); in qlt_handle_dif_error()
3598 vha->hw->tgt.tgt_ops->free_cmd(cmd); in qlt_handle_dif_error()
3757 vha->hw->tgt.tgt_ops->free_cmd(cmd); in qlt_send_term_exchange()
3771 vha->hw->tgt.leak_exchg_thresh_hold = in qlt_init_term_exchange()
3775 if (!list_empty(&vha->hw->tgt.q_full_list)) { in qlt_init_term_exchange()
3777 list_splice_init(&vha->hw->tgt.q_full_list, &free_list); in qlt_init_term_exchange()
3785 vha->hw->tgt.num_qfull_cmds_alloc--; in qlt_init_term_exchange()
3788 vha->hw->tgt.num_qfull_cmds_dropped = 0; in qlt_init_term_exchange()
3795 total_leaked = vha->hw->tgt.num_qfull_cmds_dropped; in qlt_chk_exch_leak_thresh_hold()
3797 if (vha->hw->tgt.leak_exchg_thresh_hold && in qlt_chk_exch_leak_thresh_hold()
3798 (total_leaked > vha->hw->tgt.leak_exchg_thresh_hold)) { in qlt_chk_exch_leak_thresh_hold()
3815 struct qla_tgt *tgt = cmd->tgt; in qlt_abort_cmd() local
3816 struct scsi_qla_host *vha = tgt->vha; in qlt_abort_cmd()
3873 cmd->vha->hw->tgt.tgt_ops->rel_cmd(cmd); in qlt_free_cmd()
4104 ha->tgt.tgt_ops->handle_data(cmd); in qlt_do_ctio_completion()
4123 ha->tgt.tgt_ops->free_cmd(cmd); in qlt_do_ctio_completion()
4202 ret = ha->tgt.tgt_ops->handle_cmd(vha, cmd, cdb, data_length, in __qlt_do_work()
4209 ha->tgt.tgt_ops->put_sess(sess); in __qlt_do_work()
4223 cmd->vha->hw->tgt.tgt_ops->rel_cmd(cmd); in __qlt_do_work()
4226 ha->tgt.tgt_ops->put_sess(sess); in __qlt_do_work()
4246 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_clr_qp_table() local
4252 ha->tgt.num_act_qpairs); in qlt_clr_qp_table()
4254 spin_lock_irqsave(&ha->tgt.atio_lock, flags); in qlt_clr_qp_table()
4256 btree_for_each_safe64(&tgt->lun_qpair_map, key, node) in qlt_clr_qp_table()
4257 btree_remove64(&tgt->lun_qpair_map, key); in qlt_clr_qp_table()
4264 spin_unlock_irqrestore(&ha->tgt.atio_lock, flags); in qlt_clr_qp_table()
4271 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_assign_qpair() local
4275 h = btree_lookup64(&tgt->lun_qpair_map, cmd->unpacked_lun); in qlt_assign_qpair()
4285 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4287 rc = btree_insert64(&tgt->lun_qpair_map, in qlt_assign_qpair()
4305 h = qla_qpair_to_hint(tgt, qp); in qlt_assign_qpair()
4307 rc = btree_insert64(&tgt->lun_qpair_map, in qlt_assign_qpair()
4327 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4329 rc = btree_insert64(&tgt->lun_qpair_map, in qlt_assign_qpair()
4339 h = &tgt->qphints[0]; in qlt_assign_qpair()
4352 cmd = vha->hw->tgt.tgt_ops->get_cmd(sess); in qlt_get_tag()
4360 cmd->tgt = vha->vha_tgt.qla_tgt; in qlt_get_tag()
4385 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_handle_cmd_for_atio() local
4391 if (unlikely(tgt->tgt_stop)) { in qlt_handle_cmd_for_atio()
4393 "New command while device %p is shutting down\n", tgt); in qlt_handle_cmd_for_atio()
4401 sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, atio->u.isp24.fcp_hdr.s_id); in qlt_handle_cmd_for_atio()
4429 ha->tgt.tgt_ops->put_sess(sess); in qlt_handle_cmd_for_atio()
4530 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_handle_task_mgmt()
4531 sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, in qlt_handle_task_mgmt()
4533 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_handle_task_mgmt()
4573 rc = ha->tgt.tgt_ops->handle_tmr(mcmd, unpacked_lun, mcmd->tmr_func, in __qlt_abort_task()
4597 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_abort_task()
4598 sess = ha->tgt.tgt_ops->find_sess_by_loop_id(vha, loop_id); in qlt_abort_task()
4599 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_abort_task()
4765 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qlt_handle_login()
4768 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_handle_login()
4960 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_24xx_handle_els() local
5032 spin_lock_irqsave(&tgt->ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5035 spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5069 spin_lock_irqsave(&tgt->ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5082 spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, in qlt_24xx_handle_els()
5108 spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, in qlt_24xx_handle_els()
5144 spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5185 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5187 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in qlt_24xx_handle_els()
5220 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_24xx_handle_els() local
5222 if (tgt->link_reinit_iocb_pending) { in qlt_24xx_handle_els()
5224 &tgt->link_reinit_iocb, 0, 0, 0, 0, 0, 0); in qlt_24xx_handle_els()
5225 tgt->link_reinit_iocb_pending = 0; in qlt_24xx_handle_els()
5287 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_handle_imm_notify() local
5294 if (tgt->link_reinit_iocb_pending) { in qlt_handle_imm_notify()
5296 &tgt->link_reinit_iocb, 0, 0, 0, 0, 0, 0); in qlt_handle_imm_notify()
5298 memcpy(&tgt->link_reinit_iocb, iocb, sizeof(*iocb)); in qlt_handle_imm_notify()
5299 tgt->link_reinit_iocb_pending = 1; in qlt_handle_imm_notify()
5410 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in __qlt_send_busy()
5412 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in __qlt_send_busy()
5473 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_alloc_qfull_cmd() local
5479 if (unlikely(tgt->tgt_stop)) { in qlt_alloc_qfull_cmd()
5481 "New command while device %p is shutting down\n", tgt); in qlt_alloc_qfull_cmd()
5485 if ((vha->hw->tgt.num_qfull_cmds_alloc + 1) > MAX_QFULL_CMDS_ALLOC) { in qlt_alloc_qfull_cmd()
5486 vha->hw->tgt.num_qfull_cmds_dropped++; in qlt_alloc_qfull_cmd()
5487 if (vha->hw->tgt.num_qfull_cmds_dropped > in qlt_alloc_qfull_cmd()
5490 vha->hw->tgt.num_qfull_cmds_dropped; in qlt_alloc_qfull_cmd()
5495 vha->hw->tgt.num_qfull_cmds_dropped); in qlt_alloc_qfull_cmd()
5501 sess = ha->tgt.tgt_ops->find_sess_by_s_id in qlt_alloc_qfull_cmd()
5506 cmd = ha->tgt.tgt_ops->get_cmd(sess); in qlt_alloc_qfull_cmd()
5512 vha->hw->tgt.num_qfull_cmds_dropped++; in qlt_alloc_qfull_cmd()
5513 if (vha->hw->tgt.num_qfull_cmds_dropped > in qlt_alloc_qfull_cmd()
5516 vha->hw->tgt.num_qfull_cmds_dropped; in qlt_alloc_qfull_cmd()
5526 cmd->tgt = vha->vha_tgt.qla_tgt; in qlt_alloc_qfull_cmd()
5539 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); in qlt_alloc_qfull_cmd()
5540 list_add_tail(&cmd->cmd_list, &vha->hw->tgt.q_full_list); in qlt_alloc_qfull_cmd()
5542 vha->hw->tgt.num_qfull_cmds_alloc++; in qlt_alloc_qfull_cmd()
5543 if (vha->hw->tgt.num_qfull_cmds_alloc > in qlt_alloc_qfull_cmd()
5546 vha->hw->tgt.num_qfull_cmds_alloc; in qlt_alloc_qfull_cmd()
5547 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_alloc_qfull_cmd()
5560 if (list_empty(&ha->tgt.q_full_list)) in qlt_free_qfull_cmds()
5566 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); in qlt_free_qfull_cmds()
5567 if (list_empty(&ha->tgt.q_full_list)) { in qlt_free_qfull_cmds()
5568 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_free_qfull_cmds()
5572 list_splice_init(&vha->hw->tgt.q_full_list, &q_full_list); in qlt_free_qfull_cmds()
5573 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_free_qfull_cmds()
5602 vha->hw->tgt.num_qfull_cmds_alloc--; in qlt_free_qfull_cmds()
5617 spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags); in qlt_free_qfull_cmds()
5618 list_splice(&q_full_list, &vha->hw->tgt.q_full_list); in qlt_free_qfull_cmds()
5619 spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); in qlt_free_qfull_cmds()
5644 if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha)) in qlt_chk_qfull_thresh_hold()
5662 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_24xx_atio_pkt() local
5666 if (unlikely(tgt == NULL)) { in qlt_24xx_atio_pkt()
5676 tgt->atio_irq_cmd_count++; in qlt_24xx_atio_pkt()
5699 tgt->atio_irq_cmd_count--; in qlt_24xx_atio_pkt()
5768 tgt->atio_irq_cmd_count--; in qlt_24xx_atio_pkt()
5847 ha->tgt.tgt_ops->free_mcmd(mcmd); in qlt_handle_abts_completion()
5858 ha->tgt.tgt_ops->free_mcmd(mcmd); in qlt_handle_abts_completion()
5861 ha->tgt.tgt_ops->free_mcmd(mcmd); in qlt_handle_abts_completion()
5870 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_response_pkt() local
5872 if (unlikely(tgt == NULL)) { in qlt_response_pkt()
5972 if (tgt->notify_ack_expected > 0) { in qlt_response_pkt()
5979 tgt->notify_ack_expected--; in qlt_response_pkt()
6001 if (tgt->abts_resp_expected > 0) { in qlt_response_pkt()
6026 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_async_event() local
6029 if (!tgt || tgt->tgt_stop || tgt->tgt_stopped) in qlt_async_event()
6060 if (tgt->link_reinit_iocb_pending) { in qlt_async_event()
6062 &tgt->link_reinit_iocb, in qlt_async_event()
6064 tgt->link_reinit_iocb_pending = 0; in qlt_async_event()
6155 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qlt_get_port_database()
6181 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qlt_get_port_database()
6278 static void qlt_abort_work(struct qla_tgt *tgt, in qlt_abort_work() argument
6281 struct scsi_qla_host *vha = tgt->vha; in qlt_abort_work()
6288 spin_lock_irqsave(&ha->tgt.sess_lock, flags2); in qlt_abort_work()
6290 if (tgt->tgt_stop) in qlt_abort_work()
6295 sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, s_id); in qlt_abort_work()
6297 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); in qlt_abort_work()
6302 spin_lock_irqsave(&ha->tgt.sess_lock, flags2); in qlt_abort_work()
6321 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); in qlt_abort_work()
6323 ha->tgt.tgt_ops->put_sess(sess); in qlt_abort_work()
6330 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); in qlt_abort_work()
6341 struct qla_tgt *tgt = container_of(work, struct qla_tgt, sess_work); in qlt_sess_work_fn() local
6342 struct scsi_qla_host *vha = tgt->vha; in qlt_sess_work_fn()
6345 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf000, "Sess work (tgt %p)", tgt); in qlt_sess_work_fn()
6347 spin_lock_irqsave(&tgt->sess_work_lock, flags); in qlt_sess_work_fn()
6348 while (!list_empty(&tgt->sess_works_list)) { in qlt_sess_work_fn()
6350 tgt->sess_works_list.next, typeof(*prm), in qlt_sess_work_fn()
6359 spin_unlock_irqrestore(&tgt->sess_work_lock, flags); in qlt_sess_work_fn()
6363 qlt_abort_work(tgt, prm); in qlt_sess_work_fn()
6370 spin_lock_irqsave(&tgt->sess_work_lock, flags); in qlt_sess_work_fn()
6374 spin_unlock_irqrestore(&tgt->sess_work_lock, flags); in qlt_sess_work_fn()
6380 struct qla_tgt *tgt; in qlt_add_target() local
6398 tgt = kzalloc(sizeof(struct qla_tgt), GFP_KERNEL); in qlt_add_target()
6399 if (!tgt) { in qlt_add_target()
6405 tgt->qphints = kcalloc(ha->max_qpairs + 1, in qlt_add_target()
6408 if (!tgt->qphints) { in qlt_add_target()
6409 kfree(tgt); in qlt_add_target()
6418 rc = btree_init64(&tgt->lun_qpair_map); in qlt_add_target()
6420 kfree(tgt->qphints); in qlt_add_target()
6421 kfree(tgt); in qlt_add_target()
6426 h = &tgt->qphints[0]; in qlt_add_target()
6437 h = &tgt->qphints[i + 1]; in qlt_add_target()
6448 tgt->ha = ha; in qlt_add_target()
6449 tgt->vha = base_vha; in qlt_add_target()
6450 init_waitqueue_head(&tgt->waitQ); in qlt_add_target()
6451 spin_lock_init(&tgt->sess_work_lock); in qlt_add_target()
6452 INIT_WORK(&tgt->sess_work, qlt_sess_work_fn); in qlt_add_target()
6453 INIT_LIST_HEAD(&tgt->sess_works_list); in qlt_add_target()
6454 atomic_set(&tgt->tgt_global_resets_count, 0); in qlt_add_target()
6456 base_vha->vha_tgt.qla_tgt = tgt; in qlt_add_target()
6462 tgt->sg_tablesize = QLA_TGT_MAX_SG_24XX(base_vha->req->length - 3); in qlt_add_target()
6465 list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); in qlt_add_target()
6468 if (ha->tgt.tgt_ops && ha->tgt.tgt_ops->add_target) in qlt_add_target()
6469 ha->tgt.tgt_ops->add_target(base_vha); in qlt_add_target()
6528 struct qla_tgt *tgt; in qlt_lport_register() local
6537 list_for_each_entry(tgt, &qla_tgt_glist, tgt_list_entry) { in qlt_lport_register()
6538 vha = tgt->vha; in qlt_lport_register()
6558 if (tgt->tgt_stop) { in qlt_lport_register()
6604 ha->tgt.tgt_ops = NULL; in qlt_lport_deregister()
6659 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_enable_vha() local
6663 if (!tgt) { in qlt_enable_vha()
6673 if (ha->tgt.num_act_qpairs > ha->max_qpairs) in qlt_enable_vha()
6674 ha->tgt.num_act_qpairs = ha->max_qpairs; in qlt_enable_vha()
6676 tgt->tgt_stopped = 0; in qlt_enable_vha()
6704 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in qlt_disable_vha() local
6707 if (!tgt) { in qlt_disable_vha()
6752 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qlt_vport_create()
6788 struct atio_from_isp *pkt = (struct atio_from_isp *)ha->tgt.atio_ring; in qlt_init_atio_q_entries()
6793 for (cnt = 0; cnt < ha->tgt.atio_q_length; cnt++) { in qlt_init_atio_q_entries()
6814 while ((ha->tgt.atio_ring_ptr->signature != ATIO_PROCESSED) || in qlt_24xx_process_atio_queue()
6815 fcpcmd_is_corrupted(ha->tgt.atio_ring_ptr)) { in qlt_24xx_process_atio_queue()
6816 pkt = (struct atio_from_isp *)ha->tgt.atio_ring_ptr; in qlt_24xx_process_atio_queue()
6819 if (unlikely(fcpcmd_is_corrupted(ha->tgt.atio_ring_ptr))) { in qlt_24xx_process_atio_queue()
6840 ha->tgt.atio_ring_index++; in qlt_24xx_process_atio_queue()
6841 if (ha->tgt.atio_ring_index == ha->tgt.atio_q_length) { in qlt_24xx_process_atio_queue()
6842 ha->tgt.atio_ring_index = 0; in qlt_24xx_process_atio_queue()
6843 ha->tgt.atio_ring_ptr = ha->tgt.atio_ring; in qlt_24xx_process_atio_queue()
6845 ha->tgt.atio_ring_ptr++; in qlt_24xx_process_atio_queue()
6848 pkt = (struct atio_from_isp *)ha->tgt.atio_ring_ptr; in qlt_24xx_process_atio_queue()
6854 wrt_reg_dword(ISP_ATIO_Q_OUT(vha), ha->tgt.atio_ring_index); in qlt_24xx_process_atio_queue()
6900 if (!ha->tgt.saved_set) { in qlt_24xx_config_nvram_stage1()
6902 ha->tgt.saved_exchange_count = nv->exchange_count; in qlt_24xx_config_nvram_stage1()
6903 ha->tgt.saved_firmware_options_1 = in qlt_24xx_config_nvram_stage1()
6905 ha->tgt.saved_firmware_options_2 = in qlt_24xx_config_nvram_stage1()
6907 ha->tgt.saved_firmware_options_3 = in qlt_24xx_config_nvram_stage1()
6909 ha->tgt.saved_set = 1; in qlt_24xx_config_nvram_stage1()
6955 if (ha->tgt.saved_set) { in qlt_24xx_config_nvram_stage1()
6956 nv->exchange_count = ha->tgt.saved_exchange_count; in qlt_24xx_config_nvram_stage1()
6958 ha->tgt.saved_firmware_options_1; in qlt_24xx_config_nvram_stage1()
6960 ha->tgt.saved_firmware_options_2; in qlt_24xx_config_nvram_stage1()
6962 ha->tgt.saved_firmware_options_3; in qlt_24xx_config_nvram_stage1()
6990 if (ha->tgt.node_name_set) { in qlt_24xx_config_nvram_stage2()
6991 memcpy(icb->node_name, ha->tgt.tgt_node_name, WWN_SIZE); in qlt_24xx_config_nvram_stage2()
7006 if (!ha->tgt.saved_set) { in qlt_81xx_config_nvram_stage1()
7008 ha->tgt.saved_exchange_count = nv->exchange_count; in qlt_81xx_config_nvram_stage1()
7009 ha->tgt.saved_firmware_options_1 = in qlt_81xx_config_nvram_stage1()
7011 ha->tgt.saved_firmware_options_2 = in qlt_81xx_config_nvram_stage1()
7013 ha->tgt.saved_firmware_options_3 = in qlt_81xx_config_nvram_stage1()
7015 ha->tgt.saved_set = 1; in qlt_81xx_config_nvram_stage1()
7058 if (ha->tgt.saved_set) { in qlt_81xx_config_nvram_stage1()
7059 nv->exchange_count = ha->tgt.saved_exchange_count; in qlt_81xx_config_nvram_stage1()
7061 ha->tgt.saved_firmware_options_1; in qlt_81xx_config_nvram_stage1()
7063 ha->tgt.saved_firmware_options_2; in qlt_81xx_config_nvram_stage1()
7065 ha->tgt.saved_firmware_options_3; in qlt_81xx_config_nvram_stage1()
7093 if (ha->tgt.node_name_set) { in qlt_81xx_config_nvram_stage2()
7094 memcpy(icb->node_name, ha->tgt.tgt_node_name, WWN_SIZE); in qlt_81xx_config_nvram_stage2()
7160 spin_lock_irqsave(&ha->tgt.atio_lock, flags); in qla83xx_msix_atio_q()
7164 spin_unlock_irqrestore(&ha->tgt.atio_lock, flags); in qla83xx_msix_atio_q()
7182 spin_lock_irqsave(&ha->tgt.atio_lock, flags); in qlt_handle_abts_recv_work()
7184 spin_unlock_irqrestore(&ha->tgt.atio_lock, flags); in qlt_handle_abts_recv_work()
7224 ha->tgt.tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC, in qlt_mem_alloc()
7227 if (!ha->tgt.tgt_vp_map) in qlt_mem_alloc()
7230 ha->tgt.atio_ring = dma_alloc_coherent(&ha->pdev->dev, in qlt_mem_alloc()
7231 (ha->tgt.atio_q_length + 1) * sizeof(struct atio_from_isp), in qlt_mem_alloc()
7232 &ha->tgt.atio_dma, GFP_KERNEL); in qlt_mem_alloc()
7233 if (!ha->tgt.atio_ring) { in qlt_mem_alloc()
7234 kfree(ha->tgt.tgt_vp_map); in qlt_mem_alloc()
7246 if (ha->tgt.atio_ring) { in qlt_mem_free()
7247 dma_free_coherent(&ha->pdev->dev, (ha->tgt.atio_q_length + 1) * in qlt_mem_free()
7248 sizeof(struct atio_from_isp), ha->tgt.atio_ring, in qlt_mem_free()
7249 ha->tgt.atio_dma); in qlt_mem_free()
7251 ha->tgt.atio_ring = NULL; in qlt_mem_free()
7252 ha->tgt.atio_dma = 0; in qlt_mem_free()
7253 kfree(ha->tgt.tgt_vp_map); in qlt_mem_free()
7254 ha->tgt.tgt_vp_map = NULL; in qlt_mem_free()
7271 vha->hw->tgt.tgt_vp_map[vha->vp_idx].vha = vha; in qlt_update_vp_map()
7293 vha->hw->tgt.tgt_vp_map[vha->vp_idx].vha = NULL; in qlt_update_vp_map()