Lines Matching defs: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);
1627 if (h->qpair) {
1628 spin_lock_irqsave(h->qpair->qp_lock_ptr, flags);
1630 spin_unlock_irqrestore(h->qpair->qp_lock_ptr, flags);
1631 h->qpair = NULL;
1693 static void qlt_send_notify_ack(struct qla_qpair *qpair,
1698 struct scsi_qla_host *vha = qpair->vha;
1708 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL);
1755 qla2x00_start_iocbs(vha, qpair->req);
1768 struct qla_qpair *qpair = mcmd->qpair;
1774 rc = qlt_check_reserve_free_req(qpair, 1);
1782 resp = (struct abts_resp_to_24xx *)qpair->req->ring_ptr;
1785 h = qlt_make_handle(qpair);
1794 qpair->req->outstanding_cmds[h] = (srb_t *)mcmd;
1797 resp->handle = make_handle(qpair->req->id, h);
1835 if (qpair->reqq_start_iocbs)
1836 qpair->reqq_start_iocbs(qpair);
1838 qla2x00_start_iocbs(vha, qpair->req);
1846 static void qlt_24xx_send_abts_resp(struct qla_qpair *qpair,
1850 struct scsi_qla_host *vha = qpair->vha;
1860 resp = (struct abts_resp_to_24xx *)qla2x00_alloc_iocbs_ready(qpair,
1910 if (qpair->reqq_start_iocbs)
1911 qpair->reqq_start_iocbs(qpair);
1913 qla2x00_start_iocbs(vha, qpair->req);
1920 struct qla_qpair *qpair, response_t *pkt, struct qla_tgt_mgmt_cmd *mcmd)
1926 ctio = (struct ctio7_to_24xx *)qla2x00_alloc_iocbs_ready(qpair, NULL);
1960 else if (qpair->retry_term_cnt & 1)
1965 if (qpair->retry_term_cnt & 1)
1979 if (qpair->reqq_start_iocbs)
1980 qpair->reqq_start_iocbs(qpair);
1982 qla2x00_start_iocbs(vha, qpair->req);
1987 qlt_24xx_send_abts_resp(qpair,
2069 spin_lock_irqsave(mcmd->qpair->qp_lock_ptr, flags);
2080 qlt_send_busy(mcmd->qpair, &mcmd->orig_iocb.atio,
2087 qlt_send_notify_ack(mcmd->qpair,
2091 spin_unlock_irqrestore(mcmd->qpair->qp_lock_ptr, flags);
2126 mcmd->qpair = h->qpair;
2143 if (abort_cmd->qpair) {
2144 mcmd->qpair = abort_cmd->qpair;
2230 static void qlt_24xx_send_task_mgmt_ctio(struct qla_qpair *qpair,
2243 ctio = (struct ctio7_to_24xx *)__qla2x00_alloc_iocbs(qpair, NULL);
2271 if (qpair->reqq_start_iocbs)
2272 qpair->reqq_start_iocbs(qpair);
2274 qla2x00_start_iocbs(ha, qpair->req);
2287 void qlt_send_resp_ctio(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd,
2342 if (qpair->reqq_start_iocbs)
2343 qpair->reqq_start_iocbs(qpair);
2345 qla2x00_start_iocbs(vha, qpair->req);
2357 struct qla_qpair *qpair = mcmd->qpair;
2364 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
2366 if (!vha->flags.online || mcmd->reset_count != qpair->chip_reset) {
2374 mcmd->reset_count, qpair->chip_reset);
2376 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
2401 qlt_24xx_send_task_mgmt_ctio(qpair, mcmd,
2415 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
2427 prm->seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev, cmd->sg,
2454 prm->prot_seg_cnt = dma_map_sg(&cmd->qpair->pdev->dev,
2474 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe04d,
2483 struct qla_qpair *qpair;
2488 qpair = cmd->qpair;
2490 dma_unmap_sg(&qpair->pdev->dev, cmd->sg, cmd->sg_cnt,
2495 dma_unmap_sg(&qpair->pdev->dev, cmd->prot_sg, cmd->prot_sg_cnt,
2507 static int qlt_check_reserve_free_req(struct qla_qpair *qpair,
2511 struct req_que *req = qpair->req;
2514 cnt = (uint16_t)(qpair->use_shadow_reg ? *req->out_ptr :
2548 static inline uint32_t qlt_make_handle(struct qla_qpair *qpair)
2553 struct req_que *req = qpair->req;
2574 ql_dbg(ql_dbg_io, qpair->vha, 0x305b,
2576 qpair->vha->vp_idx);
2584 static int qlt_24xx_build_ctio_pkt(struct qla_qpair *qpair,
2593 pkt = (struct ctio7_to_24xx *)qpair->req->ring_ptr;
2601 h = qlt_make_handle(qpair);
2610 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd;
2612 pkt->handle = make_handle(qpair->req->id, h);
2649 prm->cmd->qpair->req);
2772 struct qla_qpair *qpair = cmd->qpair;
2798 ql_dbg_qp(ql_dbg_io + ql_dbg_verbose, qpair, 0x305c,
2806 ql_dbg_qp(ql_dbg_io, qpair, 0x305d,
2834 if (cmd->qpair->enable_class_2)
2840 return cmd->qpair->enable_explicit_conf &&
2862 ql_dbg_qp(ql_dbg_tgt, prm->cmd->qpair, 0xe017,
3034 qlt_build_ctio_crc2_pkt(struct qla_qpair *qpair, struct qla_tgt_prm *prm)
3056 pkt = (struct ctio_crc2_to_fw *)qpair->req->ring_ptr;
3060 ql_dbg_qp(ql_dbg_tgt, cmd->qpair, 0xe071,
3127 h = qlt_make_handle(qpair);
3136 qpair->req->outstanding_cmds[h] = (srb_t *)prm->cmd;
3138 pkt->handle = make_handle(qpair->req->id, h);
3236 qpair->req->outstanding_cmds[h] = NULL;
3249 struct qla_qpair *qpair = cmd->qpair;
3256 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) ||
3262 ql_dbg_qp(ql_dbg_tgt, qpair, 0xe018,
3266 &cmd->se_cmd, qpair->id);
3274 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3277 qpair->tgt_counters.core_qla_snd_status++;
3279 qpair->tgt_counters.core_qla_que_buf++;
3281 if (!qpair->fw_started || cmd->reset_count != qpair->chip_reset) {
3287 ql_dbg_qp(ql_dbg_async, qpair, 0xe101,
3290 cmd->reset_count, qpair->chip_reset);
3296 res = qlt_check_reserve_free_req(qpair, full_req_cnt);
3301 res = qlt_build_ctio_crc2_pkt(qpair, &prm);
3303 res = qlt_24xx_build_ctio_pkt(qpair, &prm);
3305 qpair->req->cnt += full_req_cnt;
3345 qpair->req);
3347 ql_dbg_qp(ql_dbg_tgt, qpair, 0x305e,
3385 if (qpair->reqq_start_iocbs)
3386 qpair->reqq_start_iocbs(qpair);
3388 qla2x00_start_iocbs(vha, qpair->req);
3389 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3395 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3409 struct qla_qpair *qpair = cmd->qpair;
3417 if (!qpair->fw_started || (cmd->reset_count != qpair->chip_reset) ||
3427 ql_dbg_qp(ql_dbg_async, qpair, 0xe102,
3430 cmd->reset_count, qpair->chip_reset);
3438 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3440 res = qlt_check_reserve_free_req(qpair, prm.req_cnt);
3444 res = qlt_build_ctio_crc2_pkt(qpair, &prm);
3446 res = qlt_24xx_build_ctio_pkt(qpair, &prm);
3449 qpair->req->cnt += prm.req_cnt;
3466 if (qpair->reqq_start_iocbs)
3467 qpair->reqq_start_iocbs(qpair);
3469 qla2x00_start_iocbs(vha, qpair->req);
3470 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3476 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3484 * it is assumed either hardware_lock or qpair lock is held.
3487 qlt_handle_dif_error(struct qla_qpair *qpair, struct qla_tgt_cmd *cmd,
3576 qlt_send_resp_ctio(qpair, cmd, scsi_status, sense_key, asc,
3651 static int __qlt_send_term_exchange(struct qla_qpair *qpair,
3655 struct scsi_qla_host *vha = qpair->vha;
3667 pkt = (request_t *)qla2x00_alloc_iocbs_ready(qpair, NULL);
3685 qpair->tgt_counters.num_term_xchg_sent++;
3704 if (qpair->reqq_start_iocbs)
3705 qpair->reqq_start_iocbs(qpair);
3707 qla2x00_start_iocbs(vha, qpair->req);
3711 static void qlt_send_term_exchange(struct qla_qpair *qpair,
3723 vha = qpair->vha;
3726 rc = __qlt_send_term_exchange(qpair, cmd, atio);
3731 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3732 rc = __qlt_send_term_exchange(qpair, cmd, atio);
3744 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3829 qlt_send_term_exchange(cmd->qpair, cmd, &cmd->atio, 0, 1);
3863 static int qlt_term_ctio_exchange(struct qla_qpair *qpair, void *ctio,
3867 struct scsi_qla_host *vha = qpair->vha;
3888 qlt_send_term_exchange(qpair, cmd, &cmd->atio, 1, 0);
3955 struct qla_qpair *qpair = rsp->qpair;
4044 qlt_handle_dif_error(qpair, cmd, ctio);
4074 if (qlt_term_ctio_exchange(qpair, ctio, cmd, status))
4154 struct qla_qpair *qpair = cmd->qpair;
4202 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
4203 qlt_send_term_exchange(qpair, NULL, &cmd->atio, 1, 0);
4207 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
4253 struct qla_qpair *qpair, *qp;
4260 /* spread lun to qpair ratio evently */
4265 qpair = vha->hw->base_qpair;
4266 if (qpair->lun_cnt == 0) {
4267 qpair->lun_cnt++;
4268 h = qla_qpair_to_hint(tgt, qpair);
4273 qpair->lun_cnt--;
4280 lcnt = qpair->lun_cnt;
4298 qpair = qp;
4303 qpair = qp;
4308 BUG_ON(!qpair);
4309 qpair->lun_cnt++;
4310 h = qla_qpair_to_hint(tgt, qpair);
4315 qpair->lun_cnt--;
4325 cmd->qpair = h->qpair;
4467 mcmd->qpair = h->qpair;
4480 mcmd->qpair = h->qpair;
4553 mcmd->qpair = ha->base_qpair;
5378 static int __qlt_send_busy(struct qla_qpair *qpair,
5381 struct scsi_qla_host *vha = qpair->vha;
5396 qlt_send_term_exchange(qpair, NULL, atio, 1, 0);
5401 pkt = (request_t *)__qla2x00_alloc_iocbs(qpair, NULL);
5409 qpair->tgt_counters.num_q_full_sent++;
5439 if (qpair->reqq_start_iocbs)
5440 qpair->reqq_start_iocbs(qpair);
5442 qla2x00_start_iocbs(vha, qpair->req);
5512 cmd->qpair = ha->base_qpair;
5533 qlt_free_qfull_cmds(struct qla_qpair *qpair)
5535 struct scsi_qla_host *vha = qpair->vha;
5557 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
5561 rc = __qlt_send_busy(qpair, &cmd->atio, cmd->state);
5563 rc = __qlt_send_term_exchange(qpair, NULL, &cmd->atio);
5586 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
5608 qlt_send_busy(struct qla_qpair *qpair, struct atio_from_isp *atio,
5612 struct scsi_qla_host *vha = qpair->vha;
5614 rc = __qlt_send_busy(qpair, atio, status);
5620 qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, struct qla_qpair *qpair,
5631 qlt_send_busy(qpair, atio, qla_sam_status);
5754 * qpair lock is assume to be held
5759 struct qla_qpair *qpair, struct abts_resp_from_24xx_fw *entry)
5770 if (qpair->retry_term_exchg_addr == entry->exchange_addr_to_abort &&
5771 qpair->retry_term_jiff == jiffies) {
5773 qpair->retry_term_cnt++;
5774 if (qpair->retry_term_cnt >= 5) {
5776 qpair->retry_term_cnt = 0;
5782 if (qpair == ha->base_qpair)
5790 } else if (qpair->retry_term_jiff != jiffies) {
5791 qpair->retry_term_exchg_addr = entry->exchange_addr_to_abort;
5792 qpair->retry_term_cnt = 0;
5793 qpair->retry_term_jiff = jiffies;
5828 if (qlt_chk_unresolv_exchg(vha, rsp->qpair, entry)) {
5832 qlt_24xx_retry_term_exchange(vha, rsp->qpair,
5892 rc = qlt_chk_qfull_thresh_hold(vha, rsp->qpair, atio, 1);
5906 qlt_send_term_exchange(rsp->qpair, NULL,
5913 qlt_send_busy(rsp->qpair, atio,
5920 qlt_send_busy(rsp->qpair, atio,
6393 "Unable to allocate qpair hints.\n");
6408 h->qpair = ha->base_qpair;
6416 struct qla_qpair *qpair = ha->queue_pair_map[i];
6420 if (qpair) {
6421 h->qpair = qpair;
6422 spin_lock_irqsave(qpair->qp_lock_ptr, flags);
6423 list_add_tail(&h->hint_elem, &qpair->hints_list);
6424 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
6425 h->cpuid = qpair->cpuid;