Lines Matching refs:ha
33 struct qla_hw_data *ha = vha->hw; in qla24xx_allocate_vp_id() local
37 mutex_lock(&ha->vport_lock); in qla24xx_allocate_vp_id()
38 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); in qla24xx_allocate_vp_id()
39 if (vp_id > ha->max_npiv_vports) { in qla24xx_allocate_vp_id()
42 vp_id, ha->max_npiv_vports); in qla24xx_allocate_vp_id()
43 mutex_unlock(&ha->vport_lock); in qla24xx_allocate_vp_id()
47 set_bit(vp_id, ha->vp_idx_map); in qla24xx_allocate_vp_id()
48 ha->num_vhosts++; in qla24xx_allocate_vp_id()
51 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_allocate_vp_id()
52 list_add_tail(&vha->list, &ha->vp_list); in qla24xx_allocate_vp_id()
56 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_allocate_vp_id()
58 mutex_unlock(&ha->vport_lock); in qla24xx_allocate_vp_id()
66 struct qla_hw_data *ha = vha->hw; in qla24xx_deallocate_vp_id() local
69 mutex_lock(&ha->vport_lock); in qla24xx_deallocate_vp_id()
77 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
79 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
83 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
87 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
90 ha->num_vhosts--; in qla24xx_deallocate_vp_id()
91 clear_bit(vp_id, ha->vp_idx_map); in qla24xx_deallocate_vp_id()
93 mutex_unlock(&ha->vport_lock); in qla24xx_deallocate_vp_id()
97 qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name) in qla24xx_find_vhost_by_name() argument
103 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
105 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { in qla24xx_find_vhost_by_name()
107 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
111 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
180 struct qla_hw_data *ha = vha->hw; in qla24xx_enable_vp() local
181 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_enable_vp()
186 !(ha->current_topology & ISP_CFG_F)) { in qla24xx_enable_vp()
193 mutex_lock(&ha->vport_lock); in qla24xx_enable_vp()
195 mutex_unlock(&ha->vport_lock); in qla24xx_enable_vp()
244 struct qla_hw_data *ha = rsp->hw; in qla2x00_alert_all_vps() local
248 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
249 list_for_each_entry(vha, &ha->vp_list, list) { in qla2x00_alert_all_vps()
252 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
270 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
275 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
309 struct qla_hw_data *ha = vha->hw; in qla2x00_do_dpc_vp() local
310 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc_vp()
375 struct qla_hw_data *ha = vha->hw; in qla2x00_do_dpc_all_vps() local
381 if (list_empty(&ha->vp_list)) in qla2x00_do_dpc_all_vps()
386 if (!(ha->current_topology & ISP_CFG_F)) in qla2x00_do_dpc_all_vps()
389 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
390 list_for_each_entry(vp, &ha->vp_list, list) { in qla2x00_do_dpc_all_vps()
393 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
397 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
401 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
408 struct qla_hw_data *ha = base_vha->hw; in qla24xx_vport_create_req_sanity_check() local
416 if (!ha->flags.npiv_supported) in qla24xx_vport_create_req_sanity_check()
420 if (!(ha->switch_cap & FLOGI_MID_SUPPORT)) in qla24xx_vport_create_req_sanity_check()
427 vha = qla24xx_find_vhost_by_name(ha, port_name); in qla24xx_vport_create_req_sanity_check()
432 if (ha->num_vhosts > ha->max_npiv_vports) { in qla24xx_vport_create_req_sanity_check()
436 ha->num_vhosts, ha->max_npiv_vports); in qla24xx_vport_create_req_sanity_check()
446 struct qla_hw_data *ha = base_vha->hw; in qla24xx_create_vhost() local
451 vha = qla2x00_create_host(sht, ha); in qla24xx_create_vhost()
467 if (vha->vp_idx > ha->max_npiv_vports) { in qla24xx_create_vhost()
489 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) in qla24xx_create_vhost()
496 host->max_id = ha->max_fibre_devices; in qla24xx_create_vhost()
505 mutex_lock(&ha->vport_lock); in qla24xx_create_vhost()
506 set_bit(vha->vp_idx, ha->vp_idx_map); in qla24xx_create_vhost()
507 ha->cur_vport_count++; in qla24xx_create_vhost()
508 mutex_unlock(&ha->vport_lock); in qla24xx_create_vhost()
519 struct qla_hw_data *ha = vha->hw; in qla25xx_free_req_que() local
522 dma_free_coherent(&ha->pdev->dev, (req->length + 1) * in qla25xx_free_req_que()
527 ha->req_q_map[que_id] = NULL; in qla25xx_free_req_que()
528 mutex_lock(&ha->vport_lock); in qla25xx_free_req_que()
529 clear_bit(que_id, ha->req_qid_map); in qla25xx_free_req_que()
530 mutex_unlock(&ha->vport_lock); in qla25xx_free_req_que()
540 struct qla_hw_data *ha = vha->hw; in qla25xx_free_rsp_que() local
548 dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) * in qla25xx_free_rsp_que()
553 ha->rsp_q_map[que_id] = NULL; in qla25xx_free_rsp_que()
554 mutex_lock(&ha->vport_lock); in qla25xx_free_rsp_que()
555 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_free_rsp_que()
556 mutex_unlock(&ha->vport_lock); in qla25xx_free_rsp_que()
599 struct qla_hw_data *ha = vha->hw; in qla25xx_delete_queues() local
602 for (cnt = 1; cnt < ha->max_req_queues; cnt++) { in qla25xx_delete_queues()
603 req = ha->req_q_map[cnt]; in qla25xx_delete_queues()
604 if (req && test_bit(cnt, ha->req_qid_map)) { in qla25xx_delete_queues()
616 for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) { in qla25xx_delete_queues()
617 rsp = ha->rsp_q_map[cnt]; in qla25xx_delete_queues()
618 if (rsp && test_bit(cnt, ha->rsp_qid_map)) { in qla25xx_delete_queues()
632 qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_req_que() argument
637 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_req_que()
650 req->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_req_que()
659 ret = qla2x00_alloc_outstanding_cmds(ha, req); in qla25xx_create_req_que()
663 mutex_lock(&ha->vport_lock); in qla25xx_create_req_que()
664 que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues); in qla25xx_create_req_que()
665 if (que_id >= ha->max_req_queues) { in qla25xx_create_req_que()
666 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
671 set_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
672 ha->req_q_map[que_id] = req; in qla25xx_create_req_que()
686 req->rsp = ha->rsp_q_map[rsp_que]; in qla25xx_create_req_que()
707 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_req_que()
710 req->max_q_depth = ha->req_q_map[0]->max_q_depth; in qla25xx_create_req_que()
712 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
728 mutex_lock(&ha->vport_lock); in qla25xx_create_req_que()
729 clear_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
730 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
747 struct qla_hw_data *ha = rsp->hw; in qla_do_work() local
750 vha = pci_get_drvdata(ha->pdev); in qla_do_work()
757 qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_rsp_que() argument
762 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_rsp_que()
774 rsp->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_rsp_que()
783 mutex_lock(&ha->vport_lock); in qla25xx_create_rsp_que()
784 que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues); in qla25xx_create_rsp_que()
785 if (que_id >= ha->max_rsp_queues) { in qla25xx_create_rsp_que()
786 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
791 set_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
793 if (ha->flags.msix_enabled) in qla25xx_create_rsp_que()
794 rsp->msix = &ha->msix_entries[que_id + 1]; in qla25xx_create_rsp_que()
799 ha->rsp_q_map[que_id] = rsp; in qla25xx_create_rsp_que()
802 rsp->hw = ha; in qla25xx_create_rsp_que()
813 if (!IS_MSIX_NACK_CAPABLE(ha)) in qla25xx_create_rsp_que()
818 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_rsp_que()
822 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
840 mutex_lock(&ha->vport_lock); in qla25xx_create_rsp_que()
841 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
842 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
846 rsp->req = ha->req_q_map[req]; in qla25xx_create_rsp_que()