Lines Matching refs:qpair
120 static void qlt_send_notify_ack(struct qla_qpair *qpair,
133 static int qlt_check_reserve_free_req(struct qla_qpair *qpair, uint32_t);
1603 if (h->qpair) { in qlt_release()
1604 spin_lock_irqsave(h->qpair->qp_lock_ptr, flags); in qlt_release()
1606 spin_unlock_irqrestore(h->qpair->qp_lock_ptr, flags); in qlt_release()
1607 h->qpair = NULL; in qlt_release()
1669 static void qlt_send_notify_ack(struct qla_qpair *qpair, in qlt_send_notify_ack() argument
1674 struct scsi_qla_host *vha = qpair->vha; in qlt_send_notify_ack()
1684 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL); in qlt_send_notify_ack()
1725 qla2x00_start_iocbs(vha, qpair->req); in qlt_send_notify_ack()
1738 struct qla_qpair *qpair = mcmd->qpair; in qlt_build_abts_resp_iocb() local
1744 rc = qlt_check_reserve_free_req(qpair, 1); in qlt_build_abts_resp_iocb()
1752 resp = (struct abts_resp_to_24xx *)qpair->req->ring_ptr; in qlt_build_abts_resp_iocb()
1755 h = qlt_make_handle(qpair); in qlt_build_abts_resp_iocb()
1764 qpair->req->outstanding_cmds[h] = (srb_t *)mcmd; in qlt_build_abts_resp_iocb()
1767 resp->handle = make_handle(qpair->req->id, h); in qlt_build_abts_resp_iocb()
1805 if (qpair->reqq_start_iocbs) in qlt_build_abts_resp_iocb()
1806 qpair->reqq_start_iocbs(qpair); in qlt_build_abts_resp_iocb()
1808 qla2x00_start_iocbs(vha, qpair->req); in qlt_build_abts_resp_iocb()
1816 static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair, in qlt_24xx_send_abts_resp() argument
1820 struct scsi_qla_host *vha = qpair->vha; in qlt_24xx_send_abts_resp()
1830 resp = (struct abts_resp_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, in qlt_24xx_send_abts_resp()
1880 if (qpair->reqq_start_iocbs) in qlt_24xx_send_abts_resp()
1881 qpair->reqq_start_iocbs(qpair); in qlt_24xx_send_abts_resp()
1883 qla2x00_start_iocbs(vha, qpair->req); in qlt_24xx_send_abts_resp()
1890 struct qla_qpair *qpair, response_t *pkt, struct qla_tgt_mgmt_cmd *mcmd) in qlt_24xx_retry_term_exchange() argument
1896 ctio = (struct ctio7_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, NULL); in qlt_24xx_retry_term_exchange()
1930 else if (qpair->retry_term_cnt & 1) in qlt_24xx_retry_term_exchange()
1935 if (qpair->retry_term_cnt & 1) in qlt_24xx_retry_term_exchange()
1949 if (qpair->reqq_start_iocbs) in qlt_24xx_retry_term_exchange()
1950 qpair->reqq_start_iocbs(qpair); in qlt_24xx_retry_term_exchange()
1952 qla2x00_start_iocbs(vha, qpair->req); in qlt_24xx_retry_term_exchange()
1957 qlt_24xx_send_abts_resp(qpair, in qlt_24xx_retry_term_exchange()
2050 spin_lock_irqsave(mcmd->qpair->qp_lock_ptr, flags); in qlt_do_tmr_work()
2061 qlt_send_busy(mcmd->qpair, &mcmd->orig_iocb.atio, in qlt_do_tmr_work()
2068 qlt_send_notify_ack(mcmd->qpair, in qlt_do_tmr_work()
2072 spin_unlock_irqrestore(mcmd->qpair->qp_lock_ptr, flags); in qlt_do_tmr_work()
2106 mcmd->qpair = h->qpair; in __qlt_24xx_handle_abts()
2120 if (abort_cmd && abort_cmd->qpair) { in __qlt_24xx_handle_abts()
2121 mcmd->qpair = abort_cmd->qpair; in __qlt_24xx_handle_abts()
2208 static void qlt_24xx_send_task_mgmt_ctio(struct qla_qpair *qpair, in qlt_24xx_send_task_mgmt_ctio() argument
2221 ctio = (struct ctio7_to_24xx *)__qla2x00_alloc_iocbs(qpair, NULL); in qlt_24xx_send_task_mgmt_ctio()
2249 if (qpair->reqq_start_iocbs) in qlt_24xx_send_task_mgmt_ctio()
2250 qpair->reqq_start_iocbs(qpair); in qlt_24xx_send_task_mgmt_ctio()
2252 qla2x00_start_iocbs(ha, qpair->req); in qlt_24xx_send_task_mgmt_ctio()
2265 void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, in qlt_send_resp_ctio() argument
2320 if (qpair->reqq_start_iocbs) in qlt_send_resp_ctio()
2321 qpair->reqq_start_iocbs(qpair); in qlt_send_resp_ctio()
2323 qla2x00_start_iocbs(vha, qpair->req); in qlt_send_resp_ctio()
2335 struct qla_qpair *qpair = mcmd->qpair; in qlt_xmit_tm_rsp() local
2342 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2344 if (!vha->flags.online || mcmd->reset_count != qpair->chip_reset) { in qlt_xmit_tm_rsp()
2352 mcmd->reset_count, qpair->chip_reset); in qlt_xmit_tm_rsp()
2354 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2379 qlt_24xx_send_task_mgmt_ctio(qpair, mcmd, in qlt_xmit_tm_rsp()
2393 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_tm_rsp()
2405 prm->seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev, cmd->sg, in qlt_pci_map_calc_cnt()
2432 prm->prot_seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev, in qlt_pci_map_calc_cnt()
2452 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe04d, in qlt_pci_map_calc_cnt()
2461 struct qla_qpair *qpair; in qlt_unmap_sg() local
2466 qpair = cmd->qpair; in qlt_unmap_sg()
2468 dma_unmap_sg(&qpair->pdev->dev, cmd->sg, cmd->sg_cnt, in qlt_unmap_sg()
2473 dma_unmap_sg(&qpair->pdev->dev, cmd->prot_sg, cmd->prot_sg_cnt, in qlt_unmap_sg()
2485 static int qlt_check_reserve_free_req(struct qla_qpair *qpair, in qlt_check_reserve_free_req() argument
2489 struct req_que *req = qpair->req; in qlt_check_reserve_free_req()
2492 cnt = (uint16_t)(qpair->use_shadow_reg ? *req->out_ptr : in qlt_check_reserve_free_req()
2526 static inline uint32_t qlt_make_handle(struct qla_qpair *qpair) in qlt_make_handle() argument
2531 struct req_que *req = qpair->req; in qlt_make_handle()
2552 ql_dbg(ql_dbg_io, qpair->vha, 0x305b, in qlt_make_handle()
2554 qpair->vha->vp_idx); in qlt_make_handle()
2562 static int qlt_24xx_build_ctio_pkt(struct qla_qpair *qpair, in qlt_24xx_build_ctio_pkt() argument
2570 pkt = (struct ctio7_to_24xx *)qpair->req->ring_ptr; in qlt_24xx_build_ctio_pkt()
2578 h = qlt_make_handle(qpair); in qlt_24xx_build_ctio_pkt()
2587 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd; in qlt_24xx_build_ctio_pkt()
2589 pkt->handle = make_handle(qpair->req->id, h); in qlt_24xx_build_ctio_pkt()
2617 prm->cmd->qpair->req); in qlt_load_cont_data_segments()
2740 struct qla_qpair *qpair = cmd->qpair; in qlt_pre_xmit_response() local
2766 ql_dbg_qp(ql_dbg_io + ql_dbg_verbose, qpair, 0x305c, in qlt_pre_xmit_response()
2774 ql_dbg_qp(ql_dbg_io, qpair, 0x305d, in qlt_pre_xmit_response()
2802 if (cmd->qpair->enable_class_2) in qlt_need_explicit_conf()
2808 return cmd->qpair->enable_explicit_conf && in qlt_need_explicit_conf()
2830 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe017, in qlt_24xx_init_ctio_to_isp()
3002 qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm) in qlt_build_ctio_crc2_pkt() argument
3024 pkt = (struct ctio_crc2_to_fw *)qpair->req->ring_ptr; in qlt_build_ctio_crc2_pkt()
3028 ql_dbg_qp(ql_dbg_tgt, cmd->qpair, 0xe071, in qlt_build_ctio_crc2_pkt()
3095 h = qlt_make_handle(qpair); in qlt_build_ctio_crc2_pkt()
3104 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd; in qlt_build_ctio_crc2_pkt()
3106 pkt->handle = make_handle(qpair->req->id, h); in qlt_build_ctio_crc2_pkt()
3204 qpair->req->outstanding_cmds[h] = NULL; in qlt_build_ctio_crc2_pkt()
3217 struct qla_qpair *qpair = cmd->qpair; in qlt_xmit_response() local
3224 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || in qlt_xmit_response()
3230 ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018, in qlt_xmit_response()
3234 &cmd->se_cmd, qpair->id); in qlt_xmit_response()
3242 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3245 qpair->tgt_counters.core_qla_snd_status++; in qlt_xmit_response()
3247 qpair->tgt_counters.core_qla_que_buf++; in qlt_xmit_response()
3249 if (!qpair->fw_started || cmd->reset_count != qpair->chip_reset) { in qlt_xmit_response()
3255 ql_dbg_qp(ql_dbg_async, qpair, 0xe101, in qlt_xmit_response()
3258 cmd->reset_count, qpair->chip_reset); in qlt_xmit_response()
3264 res = qlt_check_reserve_free_req(qpair, full_req_cnt); in qlt_xmit_response()
3269 res = qlt_build_ctio_crc2_pkt(qpair, &prm); in qlt_xmit_response()
3271 res = qlt_24xx_build_ctio_pkt(qpair, &prm); in qlt_xmit_response()
3273 qpair->req->cnt += full_req_cnt; in qlt_xmit_response()
3311 qpair->req); in qlt_xmit_response()
3313 ql_dbg_qp(ql_dbg_tgt, qpair, 0x305e, in qlt_xmit_response()
3351 if (qpair->reqq_start_iocbs) in qlt_xmit_response()
3352 qpair->reqq_start_iocbs(qpair); in qlt_xmit_response()
3354 qla2x00_start_iocbs(vha, qpair->req); in qlt_xmit_response()
3355 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3361 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_xmit_response()
3375 struct qla_qpair *qpair = cmd->qpair; in qlt_rdy_to_xfer() local
3383 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) || in qlt_rdy_to_xfer()
3393 ql_dbg_qp(ql_dbg_async, qpair, 0xe102, in qlt_rdy_to_xfer()
3396 cmd->reset_count, qpair->chip_reset); in qlt_rdy_to_xfer()
3404 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3406 res = qlt_check_reserve_free_req(qpair, prm.req_cnt); in qlt_rdy_to_xfer()
3410 res = qlt_build_ctio_crc2_pkt(qpair, &prm); in qlt_rdy_to_xfer()
3412 res = qlt_24xx_build_ctio_pkt(qpair, &prm); in qlt_rdy_to_xfer()
3415 qpair->req->cnt += prm.req_cnt; in qlt_rdy_to_xfer()
3432 if (qpair->reqq_start_iocbs) in qlt_rdy_to_xfer()
3433 qpair->reqq_start_iocbs(qpair); in qlt_rdy_to_xfer()
3435 qla2x00_start_iocbs(vha, qpair->req); in qlt_rdy_to_xfer()
3436 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3442 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_rdy_to_xfer()
3453 qlt_handle_dif_error(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd, in qlt_handle_dif_error() argument
3542 qlt_send_resp_ctio(qpair, cmd, scsi_status, sense_key, asc, in qlt_handle_dif_error()
3617 static int __qlt_send_term_exchange(struct qla_qpair *qpair, in __qlt_send_term_exchange() argument
3621 struct scsi_qla_host *vha = qpair->vha; in __qlt_send_term_exchange()
3633 pkt = (request_t *)qla2x00_alloc_iocbs_ready(qpair, NULL); in __qlt_send_term_exchange()
3651 qpair->tgt_counters.num_term_xchg_sent++; in __qlt_send_term_exchange()
3670 if (qpair->reqq_start_iocbs) in __qlt_send_term_exchange()
3671 qpair->reqq_start_iocbs(qpair); in __qlt_send_term_exchange()
3673 qla2x00_start_iocbs(vha, qpair->req); in __qlt_send_term_exchange()
3677 static void qlt_send_term_exchange(struct qla_qpair *qpair, in qlt_send_term_exchange() argument
3689 vha = qpair->vha; in qlt_send_term_exchange()
3692 rc = __qlt_send_term_exchange(qpair, cmd, atio); in qlt_send_term_exchange()
3697 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_send_term_exchange()
3698 rc = __qlt_send_term_exchange(qpair, cmd, atio); in qlt_send_term_exchange()
3710 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_send_term_exchange()
3795 qlt_send_term_exchange(cmd->qpair, cmd, &cmd->atio, 0, 1); in qlt_abort_cmd()
3831 static int qlt_term_ctio_exchange(struct qla_qpair *qpair, void *ctio, in qlt_term_ctio_exchange() argument
3835 struct scsi_qla_host *vha = qpair->vha; in qlt_term_ctio_exchange()
3856 qlt_send_term_exchange(qpair, cmd, &cmd->atio, 1, 0); in qlt_term_ctio_exchange()
3923 struct qla_qpair *qpair = rsp->qpair; in qlt_do_ctio_completion() local
4006 qlt_handle_dif_error(qpair, cmd, ctio); in qlt_do_ctio_completion()
4026 if (qlt_term_ctio_exchange(qpair, ctio, cmd, status)) in qlt_do_ctio_completion()
4106 struct qla_qpair *qpair = cmd->qpair; in __qlt_do_work() local
4154 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qlt_do_work()
4155 qlt_send_term_exchange(qpair, NULL, &cmd->atio, 1, 0); in __qlt_do_work()
4159 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qlt_do_work()
4205 struct qla_qpair *qpair, *qp; in qlt_assign_qpair() local
4217 qpair = vha->hw->base_qpair; in qlt_assign_qpair()
4218 if (qpair->lun_cnt == 0) { in qlt_assign_qpair()
4219 qpair->lun_cnt++; in qlt_assign_qpair()
4220 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4225 qpair->lun_cnt--; in qlt_assign_qpair()
4232 lcnt = qpair->lun_cnt; in qlt_assign_qpair()
4250 qpair = qp; in qlt_assign_qpair()
4255 qpair = qp; in qlt_assign_qpair()
4260 BUG_ON(!qpair); in qlt_assign_qpair()
4261 qpair->lun_cnt++; in qlt_assign_qpair()
4262 h = qla_qpair_to_hint(tgt, qpair); in qlt_assign_qpair()
4267 qpair->lun_cnt--; in qlt_assign_qpair()
4277 cmd->qpair = h->qpair; in qlt_assign_qpair()
4418 mcmd->qpair = h->qpair; in qlt_issue_task_mgmt()
4431 mcmd->qpair = h->qpair; in qlt_issue_task_mgmt()
4504 mcmd->qpair = ha->base_qpair; in __qlt_abort_task()
5275 static int __qlt_send_busy(struct qla_qpair *qpair, in __qlt_send_busy() argument
5278 struct scsi_qla_host *vha = qpair->vha; in __qlt_send_busy()
5293 qlt_send_term_exchange(qpair, NULL, atio, 1, 0); in __qlt_send_busy()
5298 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL); in __qlt_send_busy()
5306 qpair->tgt_counters.num_q_full_sent++; in __qlt_send_busy()
5336 if (qpair->reqq_start_iocbs) in __qlt_send_busy()
5337 qpair->reqq_start_iocbs(qpair); in __qlt_send_busy()
5339 qla2x00_start_iocbs(vha, qpair->req); in __qlt_send_busy()
5409 cmd->qpair = ha->base_qpair; in qlt_alloc_qfull_cmd()
5430 qlt_free_qfull_cmds(struct qla_qpair *qpair) in qlt_free_qfull_cmds() argument
5432 struct scsi_qla_host *vha = qpair->vha; in qlt_free_qfull_cmds()
5454 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_free_qfull_cmds()
5458 rc = __qlt_send_busy(qpair, &cmd->atio, cmd->state); in qlt_free_qfull_cmds()
5460 rc = __qlt_send_term_exchange(qpair, NULL, &cmd->atio); in qlt_free_qfull_cmds()
5484 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_free_qfull_cmds()
5506 qlt_send_busy(struct qla_qpair *qpair, struct atio_from_isp *atio, in qlt_send_busy() argument
5510 struct scsi_qla_host *vha = qpair->vha; in qlt_send_busy()
5512 rc = __qlt_send_busy(qpair, atio, status); in qlt_send_busy()
5518 qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, struct qla_qpair *qpair, in qlt_chk_qfull_thresh_hold() argument
5529 qlt_send_busy(qpair, atio, qla_sam_status); in qlt_chk_qfull_thresh_hold()
5657 struct qla_qpair *qpair, struct abts_resp_from_24xx_fw *entry) in qlt_chk_unresolv_exchg() argument
5668 if (qpair->retry_term_exchg_addr == entry->exchange_addr_to_abort && in qlt_chk_unresolv_exchg()
5669 qpair->retry_term_jiff == jiffies) { in qlt_chk_unresolv_exchg()
5671 qpair->retry_term_cnt++; in qlt_chk_unresolv_exchg()
5672 if (qpair->retry_term_cnt >= 5) { in qlt_chk_unresolv_exchg()
5674 qpair->retry_term_cnt = 0; in qlt_chk_unresolv_exchg()
5680 if (qpair == ha->base_qpair) in qlt_chk_unresolv_exchg()
5688 } else if (qpair->retry_term_jiff != jiffies) { in qlt_chk_unresolv_exchg()
5689 qpair->retry_term_exchg_addr = entry->exchange_addr_to_abort; in qlt_chk_unresolv_exchg()
5690 qpair->retry_term_cnt = 0; in qlt_chk_unresolv_exchg()
5691 qpair->retry_term_jiff = jiffies; in qlt_chk_unresolv_exchg()
5726 if (qlt_chk_unresolv_exchg(vha, rsp->qpair, entry)) { in qlt_handle_abts_completion()
5730 qlt_24xx_retry_term_exchange(vha, rsp->qpair, in qlt_handle_abts_completion()
5790 rc = qlt_chk_qfull_thresh_hold(vha, rsp->qpair, atio, 1); in qlt_response_pkt()
5804 qlt_send_term_exchange(rsp->qpair, NULL, in qlt_response_pkt()
5811 qlt_send_busy(rsp->qpair, atio, in qlt_response_pkt()
5818 qlt_send_busy(rsp->qpair, atio, in qlt_response_pkt()
6373 h->qpair = ha->base_qpair; in qlt_add_target()
6381 struct qla_qpair *qpair = ha->queue_pair_map[i]; in qlt_add_target() local
6385 if (qpair) { in qlt_add_target()
6386 h->qpair = qpair; in qlt_add_target()
6387 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qlt_add_target()
6388 list_add_tail(&h->hint_elem, &qpair->hints_list); in qlt_add_target()
6389 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qlt_add_target()
6390 h->cpuid = qpair->cpuid; in qlt_add_target()