Lines Matching refs:ha

32 	struct qla_hw_data *ha = vha->hw;  in qla24xx_allocate_vp_id()  local
36 mutex_lock(&ha->vport_lock); in qla24xx_allocate_vp_id()
37 vp_id = find_first_zero_bit(ha->vp_idx_map, ha->max_npiv_vports + 1); in qla24xx_allocate_vp_id()
38 if (vp_id > ha->max_npiv_vports) { in qla24xx_allocate_vp_id()
41 vp_id, ha->max_npiv_vports); in qla24xx_allocate_vp_id()
42 mutex_unlock(&ha->vport_lock); in qla24xx_allocate_vp_id()
46 set_bit(vp_id, ha->vp_idx_map); in qla24xx_allocate_vp_id()
47 ha->num_vhosts++; in qla24xx_allocate_vp_id()
50 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_allocate_vp_id()
51 list_add_tail(&vha->list, &ha->vp_list); in qla24xx_allocate_vp_id()
52 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_allocate_vp_id()
54 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_allocate_vp_id()
56 spin_unlock_irqrestore(&ha->hardware_lock, 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
70 mutex_lock(&ha->vport_lock); in qla24xx_deallocate_vp_id()
84 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
92 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_deallocate_vp_id()
95 ha->num_vhosts--; in qla24xx_deallocate_vp_id()
96 clear_bit(vp_id, ha->vp_idx_map); in qla24xx_deallocate_vp_id()
98 mutex_unlock(&ha->vport_lock); in qla24xx_deallocate_vp_id()
102 qla24xx_find_vhost_by_name(struct qla_hw_data *ha, uint8_t *port_name) in qla24xx_find_vhost_by_name() argument
108 spin_lock_irqsave(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
110 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { in qla24xx_find_vhost_by_name()
112 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
116 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla24xx_find_vhost_by_name()
192 struct qla_hw_data *ha = vha->hw; in qla24xx_enable_vp() local
193 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_enable_vp()
198 !(ha->current_topology & ISP_CFG_F)) { in qla24xx_enable_vp()
204 ha->current_topology); in qla24xx_enable_vp()
210 mutex_lock(&ha->vport_lock); in qla24xx_enable_vp()
212 mutex_unlock(&ha->vport_lock); in qla24xx_enable_vp()
261 struct qla_hw_data *ha = rsp->hw; in qla2x00_alert_all_vps() local
265 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
266 list_for_each_entry(vha, &ha->vp_list, list) { in qla2x00_alert_all_vps()
272 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
297 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
303 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_alert_all_vps()
344 struct qla_hw_data *ha = vha->hw; in qla2x00_do_dpc_vp() local
345 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc_vp()
418 struct qla_hw_data *ha = vha->hw; in qla2x00_do_dpc_all_vps() local
424 if (list_empty(&ha->vp_list)) in qla2x00_do_dpc_all_vps()
429 if (!(ha->current_topology & ISP_CFG_F)) in qla2x00_do_dpc_all_vps()
432 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
433 list_for_each_entry(vp, &ha->vp_list, list) { in qla2x00_do_dpc_all_vps()
436 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
440 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
444 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_do_dpc_all_vps()
451 struct qla_hw_data *ha = base_vha->hw; in qla24xx_vport_create_req_sanity_check() local
459 if (!ha->flags.npiv_supported) in qla24xx_vport_create_req_sanity_check()
463 if (!(ha->switch_cap & FLOGI_MID_SUPPORT)) in qla24xx_vport_create_req_sanity_check()
470 vha = qla24xx_find_vhost_by_name(ha, port_name); in qla24xx_vport_create_req_sanity_check()
475 if (ha->num_vhosts > ha->max_npiv_vports) { in qla24xx_vport_create_req_sanity_check()
479 ha->num_vhosts, ha->max_npiv_vports); in qla24xx_vport_create_req_sanity_check()
489 struct qla_hw_data *ha = base_vha->hw; in qla24xx_create_vhost() local
494 vha = qla2x00_create_host(sht, ha); in qla24xx_create_vhost()
510 if (vha->vp_idx > ha->max_npiv_vports) { in qla24xx_create_vhost()
518 ha->dpc_active = 0; in qla24xx_create_vhost()
536 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) in qla24xx_create_vhost()
543 host->max_id = ha->max_fibre_devices; in qla24xx_create_vhost()
552 mutex_lock(&ha->vport_lock); in qla24xx_create_vhost()
553 set_bit(vha->vp_idx, ha->vp_idx_map); in qla24xx_create_vhost()
554 ha->cur_vport_count++; in qla24xx_create_vhost()
555 mutex_unlock(&ha->vport_lock); in qla24xx_create_vhost()
566 struct qla_hw_data *ha = vha->hw; in qla25xx_free_req_que() local
569 dma_free_coherent(&ha->pdev->dev, (req->length + 1) * in qla25xx_free_req_que()
574 ha->req_q_map[que_id] = NULL; in qla25xx_free_req_que()
575 mutex_lock(&ha->vport_lock); in qla25xx_free_req_que()
576 clear_bit(que_id, ha->req_qid_map); in qla25xx_free_req_que()
577 mutex_unlock(&ha->vport_lock); in qla25xx_free_req_que()
587 struct qla_hw_data *ha = vha->hw; in qla25xx_free_rsp_que() local
596 dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) * in qla25xx_free_rsp_que()
601 ha->rsp_q_map[que_id] = NULL; in qla25xx_free_rsp_que()
602 mutex_lock(&ha->vport_lock); in qla25xx_free_rsp_que()
603 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_free_rsp_que()
604 mutex_unlock(&ha->vport_lock); in qla25xx_free_rsp_que()
651 struct qla_hw_data *ha = vha->hw; in qla25xx_delete_queues() local
660 for (cnt = 1; cnt < ha->max_req_queues; cnt++) { in qla25xx_delete_queues()
661 req = ha->req_q_map[cnt]; in qla25xx_delete_queues()
662 if (req && test_bit(cnt, ha->req_qid_map)) { in qla25xx_delete_queues()
674 for (cnt = 1; cnt < ha->max_rsp_queues; cnt++) { in qla25xx_delete_queues()
675 rsp = ha->rsp_q_map[cnt]; in qla25xx_delete_queues()
676 if (rsp && test_bit(cnt, ha->rsp_qid_map)) { in qla25xx_delete_queues()
692 qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_req_que() argument
697 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_req_que()
698 struct scsi_qla_host *vha = pci_get_drvdata(ha->pdev); in qla25xx_create_req_que()
711 req->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_req_que()
720 ret = qla2x00_alloc_outstanding_cmds(ha, req); in qla25xx_create_req_que()
724 mutex_lock(&ha->mq_lock); in qla25xx_create_req_que()
725 que_id = find_first_zero_bit(ha->req_qid_map, ha->max_req_queues); in qla25xx_create_req_que()
726 if (que_id >= ha->max_req_queues) { in qla25xx_create_req_que()
727 mutex_unlock(&ha->mq_lock); in qla25xx_create_req_que()
732 set_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
733 ha->req_q_map[que_id] = req; in qla25xx_create_req_que()
747 req->rsp = ha->rsp_q_map[rsp_que]; in qla25xx_create_req_que()
768 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_req_que()
771 req->max_q_depth = ha->req_q_map[0]->max_q_depth; in qla25xx_create_req_que()
773 mutex_unlock(&ha->mq_lock); in qla25xx_create_req_que()
790 mutex_lock(&ha->mq_lock); in qla25xx_create_req_que()
791 clear_bit(que_id, ha->req_qid_map); in qla25xx_create_req_que()
792 mutex_unlock(&ha->mq_lock); in qla25xx_create_req_que()
820 qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, in qla25xx_create_rsp_que() argument
825 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla25xx_create_rsp_que()
826 struct scsi_qla_host *vha = pci_get_drvdata(ha->pdev); in qla25xx_create_rsp_que()
838 rsp->ring = dma_alloc_coherent(&ha->pdev->dev, in qla25xx_create_rsp_que()
847 mutex_lock(&ha->mq_lock); in qla25xx_create_rsp_que()
848 que_id = find_first_zero_bit(ha->rsp_qid_map, ha->max_rsp_queues); in qla25xx_create_rsp_que()
849 if (que_id >= ha->max_rsp_queues) { in qla25xx_create_rsp_que()
850 mutex_unlock(&ha->mq_lock); in qla25xx_create_rsp_que()
855 set_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
859 ha->rsp_q_map[que_id] = rsp; in qla25xx_create_rsp_que()
862 rsp->hw = ha; in qla25xx_create_rsp_que()
873 if (!IS_MSIX_NACK_CAPABLE(ha)) in qla25xx_create_rsp_que()
881 reg = ISP_QUE_REG(ha, que_id); in qla25xx_create_rsp_que()
885 mutex_unlock(&ha->mq_lock); in qla25xx_create_rsp_que()
895 ret = qla25xx_request_irq(ha, qpair, qpair->msix, in qla25xx_create_rsp_que()
896 ha->flags.disable_msix_handshake ? in qla25xx_create_rsp_que()
906 mutex_lock(&ha->mq_lock); in qla25xx_create_rsp_que()
907 clear_bit(que_id, ha->rsp_qid_map); in qla25xx_create_rsp_que()
908 mutex_unlock(&ha->mq_lock); in qla25xx_create_rsp_que()
943 struct qla_hw_data *ha = vha->hw; in qla24xx_control_vp() local
945 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla24xx_control_vp()
952 if (vp_index == 0 || vp_index >= ha->max_npiv_vports) in qla24xx_control_vp()