Lines Matching refs:qpair

113 static void qlt_send_notify_ack(struct qla_qpair *qpair,
126 static int qlt_check_reserve_free_req(struct qla_qpair *qpair, uint32_t);
1644 if (h->qpair) { in qlt_release()
1645 spin_lock_irqsave(h->qpair->qp_lock_ptr, flags); in qlt_release()
1647 spin_unlock_irqrestore(h->qpair->qp_lock_ptr, flags); in qlt_release()
1648 h->qpair = NULL; in qlt_release()
1710 static void qlt_send_notify_ack(struct qla_qpair *qpair, in qlt_send_notify_ack() argument
1715 struct scsi_qla_host *vha = qpair->vha; in qlt_send_notify_ack()
1725 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL); in qlt_send_notify_ack()
1772 qla2x00_start_iocbs(vha, qpair->req); in qlt_send_notify_ack()
1785 struct qla_qpair *qpair = mcmd->qpair; in qlt_build_abts_resp_iocb() local
1791 rc = qlt_check_reserve_free_req(qpair, 1); in qlt_build_abts_resp_iocb()
1799 resp = (struct abts_resp_to_24xx *)qpair->req->ring_ptr; in qlt_build_abts_resp_iocb()
1802 h = qlt_make_handle(qpair); in qlt_build_abts_resp_iocb()
1811 qpair->req->outstanding_cmds[h] = (srb_t *)mcmd; in qlt_build_abts_resp_iocb()
1814 resp->handle = make_handle(qpair->req->id, h); in qlt_build_abts_resp_iocb()
1852 if (qpair->reqq_start_iocbs) in qlt_build_abts_resp_iocb()
1853 qpair->reqq_start_iocbs(qpair); in qlt_build_abts_resp_iocb()
1855 qla2x00_start_iocbs(vha, qpair->req); in qlt_build_abts_resp_iocb()
1863 static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair, in qlt_24xx_send_abts_resp() argument
1867 struct scsi_qla_host *vha = qpair->vha; in qlt_24xx_send_abts_resp()
1877 resp = (struct abts_resp_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, in qlt_24xx_send_abts_resp()
1927 if (qpair->reqq_start_iocbs) in qlt_24xx_send_abts_resp()
1928 qpair->reqq_start_iocbs(qpair); in qlt_24xx_send_abts_resp()
1930 qla2x00_start_iocbs(vha, qpair->req); in qlt_24xx_send_abts_resp()
1937 struct qla_qpair *qpair, response_t *pkt, struct qla_tgt_mgmt_cmd *mcmd) in qlt_24xx_retry_term_exchange() argument
1943 ctio = (struct ctio7_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, NULL); in qlt_24xx_retry_term_exchange()
1977 else if (qpair->retry_term_cnt & 1) in qlt_24xx_retry_term_exchange()
1982 if (qpair->retry_term_cnt & 1) in qlt_24xx_retry_term_exchange()
1996 if (qpair->reqq_start_iocbs) in qlt_24xx_retry_term_exchange()
1997 qpair->reqq_start_iocbs(qpair); in qlt_24xx_retry_term_exchange()
1999 qla2x00_start_iocbs(vha, qpair->req); in qlt_24xx_retry_term_exchange()
2004 qlt_24xx_send_abts_resp(qpair, in qlt_24xx_retry_term_exchange()
2086 spin_lock_irqsave(mcmd->qpair->qp_lock_ptr, flags); in qlt_do_tmr_work()
2097 qlt_send_busy(mcmd->qpair, &mcmd->orig_iocb.atio, in qlt_do_tmr_work()
2104 qlt_send_notify_ack(mcmd->qpair, in qlt_do_tmr_work()
2108 spin_unlock_irqrestore(mcmd->qpair->qp_lock_ptr, flags); in qlt_do_tmr_work()
2143 mcmd->qpair = h->qpair; in __qlt_24xx_handle_abts()
2160 if (abort_cmd->qpair) { in __qlt_24xx_handle_abts()
2161 mcmd->qpair = abort_cmd->qpair; in __qlt_24xx_handle_abts()
2247 static void qlt_24xx_send_task_mgmt_ctio(struct qla_qpair *qpair, in qlt_24xx_send_task_mgmt_ctio() argument
2260 ctio = (struct ctio7_to_24xx *)__qla2x00_alloc_iocbs(qpair, NULL); in qlt_24xx_send_task_mgmt_ctio()
2288 if (qpair->reqq_start_iocbs) in qlt_24xx_send_task_mgmt_ctio()
2289 qpair->reqq_start_iocbs(qpair); in qlt_24xx_send_task_mgmt_ctio()
2291 qla2x00_start_iocbs(ha, qpair->req); in qlt_24xx_send_task_mgmt_ctio()
2304 void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, in qlt_send_resp_ctio() argument
2359 if (qpair->reqq_start_iocbs) in qlt_send_resp_ctio()
2360 qpair->reqq_start_iocbs(qpair); in qlt_send_resp_ctio()
2362 qla2x00_start_iocbs(vha, qpair->req); in qlt_send_resp_ctio()
2374 struct qla_qpair *qpair = mcmd->qpair; in qlt_xmit_tm_rsp() local
2381 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2383 if (!vha->flags.online || mcmd->reset_count != qpair->chip_reset) { in qlt_xmit_tm_rsp()
2391 mcmd->reset_count, qpair->chip_reset); in qlt_xmit_tm_rsp()
2393 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2418 qlt_24xx_send_task_mgmt_ctio(qpair, mcmd, in qlt_xmit_tm_rsp()
2432 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2444 prm->seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev, cmd->sg, in qlt_pci_map_calc_cnt()
2471 prm->prot_seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev, in qlt_pci_map_calc_cnt()
2491 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe04d, in qlt_pci_map_calc_cnt()
2500 struct qla_qpair *qpair; in qlt_unmap_sg() local
2505 qpair = cmd->qpair; in qlt_unmap_sg()
2507 dma_unmap_sg(&qpair->pdev->dev, cmd->sg, cmd->sg_cnt, in qlt_unmap_sg()
2512 dma_unmap_sg(&qpair->pdev->dev, cmd->prot_sg, cmd->prot_sg_cnt, in qlt_unmap_sg()
2524 static int qlt_check_reserve_free_req(struct qla_qpair *qpair, in qlt_check_reserve_free_req() argument
2528 struct req_que *req = qpair->req; in qlt_check_reserve_free_req()
2531 cnt = (uint16_t)(qpair->use_shadow_reg ? *req->out_ptr : in qlt_check_reserve_free_req()
2565 static inline uint32_t qlt_make_handle(struct qla_qpair *qpair) in qlt_make_handle() argument
2570 struct req_que *req = qpair->req; in qlt_make_handle()
2591 ql_dbg(ql_dbg_io, qpair->vha, 0x305b, in qlt_make_handle()
2593 qpair->vha->vp_idx); in qlt_make_handle()
2601 static int qlt_24xx_build_ctio_pkt(struct qla_qpair *qpair, in qlt_24xx_build_ctio_pkt() argument
2610 pkt = (struct ctio7_to_24xx *)qpair->req->ring_ptr; in qlt_24xx_build_ctio_pkt()
2618 h = qlt_make_handle(qpair); in qlt_24xx_build_ctio_pkt()
2627 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd; in qlt_24xx_build_ctio_pkt()
2629 pkt->handle = make_handle(qpair->req->id, h); in qlt_24xx_build_ctio_pkt()
2666 prm->cmd->qpair->req); in qlt_load_cont_data_segments()
2789 struct qla_qpair *qpair = cmd->qpair; in qlt_pre_xmit_response() local
2815 ql_dbg_qp(ql_dbg_io + ql_dbg_verbose, qpair, 0x305c, in qlt_pre_xmit_response()
2823 ql_dbg_qp(ql_dbg_io, qpair, 0x305d, in qlt_pre_xmit_response()
2851 if (cmd->qpair->enable_class_2) in qlt_need_explicit_conf()
2857 return cmd->qpair->enable_explicit_conf && in qlt_need_explicit_conf()
2879 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe017, in qlt_24xx_init_ctio_to_isp()
3051 qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm) in qlt_build_ctio_crc2_pkt() argument
3073 pkt = (struct ctio_crc2_to_fw *)qpair->req->ring_ptr; in qlt_build_ctio_crc2_pkt()
3077 ql_dbg_qp(ql_dbg_tgt, cmd->qpair, 0xe071, in qlt_build_ctio_crc2_pkt()
3144 h = qlt_make_handle(qpair); in qlt_build_ctio_crc2_pkt()
3153 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd; in qlt_build_ctio_crc2_pkt()
3155 pkt->handle = make_handle(qpair->req->id, h); in qlt_build_ctio_crc2_pkt()
3253 qpair->req->outstanding_cmds[h] = NULL; in qlt_build_ctio_crc2_pkt()
3266 struct qla_qpair *qpair = cmd->qpair; in qlt_xmit_response() local
3273 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || in qlt_xmit_response()
3279 ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, in qlt_xmit_response()
3283 &cmd->se_cmd, qpair->id); in qlt_xmit_response()
3291 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3294 qpair->tgt_counters.core_qla_snd_status++; in qlt_xmit_response()
3296 qpair->tgt_counters.core_qla_que_buf++; in qlt_xmit_response()
3298 if (!qpair->fw_started || cmd->reset_count != qpair->chip_reset) { in qlt_xmit_response()
3304 ql_dbg_qp(ql_dbg_async, qpair, 0xe101, in qlt_xmit_response()
3307 cmd->reset_count, qpair->chip_reset); in qlt_xmit_response()
3313 res = qlt_check_reserve_free_req(qpair, full_req_cnt); in qlt_xmit_response()
3318 res = qlt_build_ctio_crc2_pkt(qpair, &prm); in qlt_xmit_response()
3320 res = qlt_24xx_build_ctio_pkt(qpair, &prm); in qlt_xmit_response()
3322 qpair->req->cnt += full_req_cnt; in qlt_xmit_response()
3362 qpair->req); in qlt_xmit_response()
3364 ql_dbg_qp(ql_dbg_tgt, qpair, 0x305e, in qlt_xmit_response()
3402 if (qpair->reqq_start_iocbs) in qlt_xmit_response()
3403 qpair->reqq_start_iocbs(qpair); in qlt_xmit_response()
3405 qla2x00_start_iocbs(vha, qpair->req); in qlt_xmit_response()
3406 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3412 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3426 struct qla_qpair *qpair = cmd->qpair; in qlt_rdy_to_xfer() local
3434 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || in qlt_rdy_to_xfer()
3444 ql_dbg_qp(ql_dbg_async, qpair, 0xe102, in qlt_rdy_to_xfer()
3447 cmd->reset_count, qpair->chip_reset); in qlt_rdy_to_xfer()
3455 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3457 res = qlt_check_reserve_free_req(qpair, prm.req_cnt); in qlt_rdy_to_xfer()
3461 res = qlt_build_ctio_crc2_pkt(qpair, &prm); in qlt_rdy_to_xfer()
3463 res = qlt_24xx_build_ctio_pkt(qpair, &prm); in qlt_rdy_to_xfer()
3466 qpair->req->cnt += prm.req_cnt; in qlt_rdy_to_xfer()
3483 if (qpair->reqq_start_iocbs) in qlt_rdy_to_xfer()
3484 qpair->reqq_start_iocbs(qpair); in qlt_rdy_to_xfer()
3486 qla2x00_start_iocbs(vha, qpair->req); in qlt_rdy_to_xfer()
3487 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3493 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3504 qlt_handle_dif_error(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, in qlt_handle_dif_error() argument
3593 qlt_send_resp_ctio(qpair, cmd, scsi_status, sense_key, asc, in qlt_handle_dif_error()
3668 static int __qlt_send_term_exchange(struct qla_qpair *qpair, in __qlt_send_term_exchange() argument
3672 struct scsi_qla_host *vha = qpair->vha; in __qlt_send_term_exchange()
3684 pkt = (request_t *)qla2x00_alloc_iocbs_ready(qpair, NULL); in __qlt_send_term_exchange()
3702 qpair->tgt_counters.num_term_xchg_sent++; in __qlt_send_term_exchange()
3721 if (qpair->reqq_start_iocbs) in __qlt_send_term_exchange()
3722 qpair->reqq_start_iocbs(qpair); in __qlt_send_term_exchange()
3724 qla2x00_start_iocbs(vha, qpair->req); in __qlt_send_term_exchange()
3728 static void qlt_send_term_exchange(struct qla_qpair *qpair, in qlt_send_term_exchange() argument
3740 vha = qpair->vha; in qlt_send_term_exchange()
3743 rc = __qlt_send_term_exchange(qpair, cmd, atio); in qlt_send_term_exchange()
3748 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_send_term_exchange()
3749 rc = __qlt_send_term_exchange(qpair, cmd, atio); in qlt_send_term_exchange()
3761 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_send_term_exchange()
3846 qlt_send_term_exchange(cmd->qpair, cmd, &cmd->atio, 0, 1); in qlt_abort_cmd()
3880 static int qlt_term_ctio_exchange(struct qla_qpair *qpair, void *ctio, in qlt_term_ctio_exchange() argument
3884 struct scsi_qla_host *vha = qpair->vha; in qlt_term_ctio_exchange()
3905 qlt_send_term_exchange(qpair, cmd, &cmd->atio, 1, 0); in qlt_term_ctio_exchange()
3972 struct qla_qpair *qpair = rsp->qpair; in qlt_do_ctio_completion() local
4061 qlt_handle_dif_error(qpair, cmd, ctio); in qlt_do_ctio_completion()
4091 if (qlt_term_ctio_exchange(qpair, ctio, cmd, status)) in qlt_do_ctio_completion()
4171 struct qla_qpair *qpair = cmd->qpair; in __qlt_do_work() local
4219 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qlt_do_work()
4220 qlt_send_term_exchange(qpair, NULL, &cmd->atio, 1, 0); in __qlt_do_work()
4224 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qlt_do_work()
4270 struct qla_qpair *qpair, *qp; in qlt_assign_qpair() local
4282 qpair = vha->hw->base_qpair; in qlt_assign_qpair()
4283 if (qpair->lun_cnt == 0) { in qlt_assign_qpair()
4284 qpair->lun_cnt++; in qlt_assign_qpair()
4285 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4290 qpair->lun_cnt--; in qlt_assign_qpair()
4297 lcnt = qpair->lun_cnt; in qlt_assign_qpair()
4315 qpair = qp; in qlt_assign_qpair()
4320 qpair = qp; in qlt_assign_qpair()
4325 BUG_ON(!qpair); in qlt_assign_qpair()
4326 qpair->lun_cnt++; in qlt_assign_qpair()
4327 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4332 qpair->lun_cnt--; in qlt_assign_qpair()
4342 cmd->qpair = h->qpair; in qlt_assign_qpair()
4485 mcmd->qpair = h->qpair; in qlt_issue_task_mgmt()
4498 mcmd->qpair = h->qpair; in qlt_issue_task_mgmt()
4571 mcmd->qpair = ha->base_qpair; in __qlt_abort_task()
5396 static int __qlt_send_busy(struct qla_qpair *qpair, in __qlt_send_busy() argument
5399 struct scsi_qla_host *vha = qpair->vha; in __qlt_send_busy()
5414 qlt_send_term_exchange(qpair, NULL, atio, 1, 0); in __qlt_send_busy()
5419 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL); in __qlt_send_busy()
5427 qpair->tgt_counters.num_q_full_sent++; in __qlt_send_busy()
5457 if (qpair->reqq_start_iocbs) in __qlt_send_busy()
5458 qpair->reqq_start_iocbs(qpair); in __qlt_send_busy()
5460 qla2x00_start_iocbs(vha, qpair->req); in __qlt_send_busy()
5530 cmd->qpair = ha->base_qpair; in qlt_alloc_qfull_cmd()
5551 qlt_free_qfull_cmds(struct qla_qpair *qpair) in qlt_free_qfull_cmds() argument
5553 struct scsi_qla_host *vha = qpair->vha; in qlt_free_qfull_cmds()
5575 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_free_qfull_cmds()
5579 rc = __qlt_send_busy(qpair, &cmd->atio, cmd->state); in qlt_free_qfull_cmds()
5581 rc = __qlt_send_term_exchange(qpair, NULL, &cmd->atio); in qlt_free_qfull_cmds()
5604 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_free_qfull_cmds()
5626 qlt_send_busy(struct qla_qpair *qpair, struct atio_from_isp *atio, in qlt_send_busy() argument
5630 struct scsi_qla_host *vha = qpair->vha; in qlt_send_busy()
5632 rc = __qlt_send_busy(qpair, atio, status); in qlt_send_busy()
5638 qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, struct qla_qpair *qpair, in qlt_chk_qfull_thresh_hold() argument
5649 qlt_send_busy(qpair, atio, qla_sam_status); in qlt_chk_qfull_thresh_hold()
5777 struct qla_qpair *qpair, struct abts_resp_from_24xx_fw *entry) in qlt_chk_unresolv_exchg() argument
5788 if (qpair->retry_term_exchg_addr == entry->exchange_addr_to_abort && in qlt_chk_unresolv_exchg()
5789 qpair->retry_term_jiff == jiffies) { in qlt_chk_unresolv_exchg()
5791 qpair->retry_term_cnt++; in qlt_chk_unresolv_exchg()
5792 if (qpair->retry_term_cnt >= 5) { in qlt_chk_unresolv_exchg()
5794 qpair->retry_term_cnt = 0; in qlt_chk_unresolv_exchg()
5800 if (qpair == ha->base_qpair) in qlt_chk_unresolv_exchg()
5808 } else if (qpair->retry_term_jiff != jiffies) { in qlt_chk_unresolv_exchg()
5809 qpair->retry_term_exchg_addr = entry->exchange_addr_to_abort; in qlt_chk_unresolv_exchg()
5810 qpair->retry_term_cnt = 0; in qlt_chk_unresolv_exchg()
5811 qpair->retry_term_jiff = jiffies; in qlt_chk_unresolv_exchg()
5846 if (qlt_chk_unresolv_exchg(vha, rsp->qpair, entry)) { in qlt_handle_abts_completion()
5850 qlt_24xx_retry_term_exchange(vha, rsp->qpair, in qlt_handle_abts_completion()
5910 rc = qlt_chk_qfull_thresh_hold(vha, rsp->qpair, atio, 1); in qlt_response_pkt()
5924 qlt_send_term_exchange(rsp->qpair, NULL, in qlt_response_pkt()
5931 qlt_send_busy(rsp->qpair, atio, in qlt_response_pkt()
5938 qlt_send_busy(rsp->qpair, atio, in qlt_response_pkt()
6427 h->qpair = ha->base_qpair; in qlt_add_target()
6435 struct qla_qpair *qpair = ha->queue_pair_map[i]; in qlt_add_target() local
6439 if (qpair) { in qlt_add_target()
6440 h->qpair = qpair; in qlt_add_target()
6441 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_add_target()
6442 list_add_tail(&h->hint_elem, &qpair->hints_list); in qlt_add_target()
6443 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_add_target()
6444 h->cpuid = qpair->cpuid; in qlt_add_target()