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()
374 struct qla_hw_data *ha = vha->hw; in qla2x00_do_dpc_all_vps() local
380 if (list_empty(&ha->vp_list)) in qla2x00_do_dpc_all_vps()
385 if (!(ha->current_topology & ISP_CFG_F)) in qla2x00_do_dpc_all_vps()
388 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
389 list_for_each_entry(vp, &ha->vp_list, list) { in qla2x00_do_dpc_all_vps()
392 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
396 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
400 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
407 struct qla_hw_data *ha = base_vha->hw; in qla24xx_vport_create_req_sanity_check() local
415 if (!ha->flags.npiv_supported) in qla24xx_vport_create_req_sanity_check()
419 if (!(ha->switch_cap & FLOGI_MID_SUPPORT)) in qla24xx_vport_create_req_sanity_check()
426 vha = qla24xx_find_vhost_by_name(ha, port_name); in qla24xx_vport_create_req_sanity_check()
431 if (ha->num_vhosts > ha->max_npiv_vports) { in qla24xx_vport_create_req_sanity_check()
435 ha->num_vhosts, ha->max_npiv_vports); in qla24xx_vport_create_req_sanity_check()
445 struct qla_hw_data *ha = base_vha->hw; in qla24xx_create_vhost() local
450 vha = qla2x00_create_host(sht, ha); in qla24xx_create_vhost()
466 if (vha->vp_idx > ha->max_npiv_vports) { in qla24xx_create_vhost()
488 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) in qla24xx_create_vhost()
495 host->max_id = ha->max_fibre_devices; in qla24xx_create_vhost()
504 mutex_lock(&ha->vport_lock); in qla24xx_create_vhost()
505 set_bit(vha->vp_idx, ha->vp_idx_map); in qla24xx_create_vhost()
506 ha->cur_vport_count++; in qla24xx_create_vhost()
507 mutex_unlock(&ha->vport_lock); in qla24xx_create_vhost()
518 struct qla_hw_data *ha = vha->hw; in qla25xx_free_req_que() local
521 dma_free_coherent(&ha->pdev->dev, (req->length + 1) * in qla25xx_free_req_que()
526 ha->req_q_map[que_id] = NULL; in qla25xx_free_req_que()
527 mutex_lock(&ha->vport_lock); in qla25xx_free_req_que()
528 clear_bit(que_id, ha->req_qid_map); in qla25xx_free_req_que()
529 mutex_unlock(&ha->vport_lock); in qla25xx_free_req_que()
539 struct qla_hw_data *ha = vha->hw; in qla25xx_free_rsp_que() local
547 dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) * in qla25xx_free_rsp_que()
552 ha->rsp_q_map[que_id] = NULL; in qla25xx_free_rsp_que()
553 mutex_lock(&ha->vport_lock); in qla25xx_free_rsp_que()
554 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_free_rsp_que()
555 mutex_unlock(&ha->vport_lock); in qla25xx_free_rsp_que()
598 struct qla_hw_data *ha = vha->hw; in qla25xx_delete_queues() local
601 for (cnt = 1; cnt < ha->max_req_queues; cnt++) { in qla25xx_delete_queues()
602 req = ha->req_q_map[cnt]; in qla25xx_delete_queues()
603 if (req && test_bit(cnt, ha->req_qid_map)) { in qla25xx_delete_queues()
615 for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) { in qla25xx_delete_queues()
616 rsp = ha->rsp_q_map[cnt]; in qla25xx_delete_queues()
617 if (rsp && test_bit(cnt, ha->rsp_qid_map)) { in qla25xx_delete_queues()
631 qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_req_que() argument
636 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_req_que()
649 req->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_req_que()
658 ret = qla2x00_alloc_outstanding_cmds(ha, req); in qla25xx_create_req_que()
662 mutex_lock(&ha->vport_lock); in qla25xx_create_req_que()
663 que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues); in qla25xx_create_req_que()
664 if (que_id >= ha->max_req_queues) { in qla25xx_create_req_que()
665 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
670 set_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
671 ha->req_q_map[que_id] = req; in qla25xx_create_req_que()
685 req->rsp = ha->rsp_q_map[rsp_que]; in qla25xx_create_req_que()
706 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_req_que()
709 req->max_q_depth = ha->req_q_map[0]->max_q_depth; in qla25xx_create_req_que()
711 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
727 mutex_lock(&ha->vport_lock); in qla25xx_create_req_que()
728 clear_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
729 mutex_unlock(&ha->vport_lock); in qla25xx_create_req_que()
746 struct qla_hw_data *ha = rsp->hw; in qla_do_work() local
749 vha = pci_get_drvdata(ha->pdev); in qla_do_work()
756 qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_rsp_que() argument
761 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_rsp_que()
773 rsp->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_rsp_que()
782 mutex_lock(&ha->vport_lock); in qla25xx_create_rsp_que()
783 que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues); in qla25xx_create_rsp_que()
784 if (que_id >= ha->max_rsp_queues) { in qla25xx_create_rsp_que()
785 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
790 set_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
792 if (ha->flags.msix_enabled) in qla25xx_create_rsp_que()
793 rsp->msix = &ha->msix_entries[que_id + 1]; in qla25xx_create_rsp_que()
798 ha->rsp_q_map[que_id] = rsp; in qla25xx_create_rsp_que()
801 rsp->hw = ha; in qla25xx_create_rsp_que()
812 if (!IS_MSIX_NACK_CAPABLE(ha)) in qla25xx_create_rsp_que()
817 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_rsp_que()
821 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
839 mutex_lock(&ha->vport_lock); in qla25xx_create_rsp_que()
840 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
841 mutex_unlock(&ha->vport_lock); in qla25xx_create_rsp_que()
845 rsp->req = ha->req_q_map[req]; in qla25xx_create_rsp_que()