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