Lines Matching +full:rx +full:- +full:sched +full:- +full:sp

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (c) 2003-2014 QLogic Corporation
16 #include <linux/blk-mq-pci.h>
66 "Enable/disable security. 0(Default) - Security disabled. 1 - Security enabled.");
72 "beginning. Default is 0 - class 2 not supported.");
84 "a PORT-DOWN status.");
91 "Default is 0 - no PLOGI. 1 - perform PLOGI.");
103 "vary by ISP type. Default is 1 - allocate memory.");
110 "\t\tDefault is 0 - no logging. 0x40000000 - Module Init & Probe.\n"
111 "\t\t0x20000000 - Mailbox Cmnds. 0x10000000 - Device Discovery.\n"
112 "\t\t0x08000000 - IO tracing. 0x04000000 - DPC Thread.\n"
113 "\t\t0x02000000 - Async events. 0x01000000 - Timer routines.\n"
114 "\t\t0x00800000 - User space. 0x00400000 - Task Management.\n"
115 "\t\t0x00200000 - AER/EEH. 0x00100000 - Multi Q.\n"
116 "\t\t0x00080000 - P3P Specific. 0x00040000 - Virtual Port.\n"
117 "\t\t0x00020000 - Buffer Dump. 0x00010000 - Misc.\n"
118 "\t\t0x00008000 - Verbose. 0x00004000 - Target.\n"
119 "\t\t0x00002000 - Target Mgmt. 0x00001000 - Target TMF.\n"
120 "\t\t0x7fffffff - For enabling all logs, can be too many logs.\n"
121 "\t\t0x1e400000 - Preferred value for capturing essential "
142 "0 - no FDMI registrations. "
143 "1 - provide FDMI registrations (default).");
155 " Enable T10-CRC-DIF:\n"
157 " 0 -- No DIF Support\n"
158 " 1 -- Enable DIF for all types\n"
159 " 2 -- Enable DIF for all types, except Type 0.\n");
169 "0 - no NVMe. Default is Y");
174 " Enable T10-CRC-DIF Error isolation by HBA:\n"
176 " 0 -- Error isolation disabled\n"
177 " 1 -- Error isolation enabled only for DIX Type 0\n"
178 " 2 -- Error isolation enabled for all Types\n");
184 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
198 " 2 -- load firmware via the request_firmware() (hotplug).\n"
200 " 1 -- load firmware from flash.\n"
201 " 0 -- use default semantics.\n");
207 "Default is 0 - skip ETS enablement.");
213 " 0 -- Regular doorbell.\n"
214 " 1 -- CAMRAM doorbell (faster).\n");
220 "Default is 0 - Do not use GFF_ID information.");
226 "Default is 1 - Issue TM IOCBs via mailbox mechanism.");
232 " 0 (Default) -- Reset on failure.\n"
233 " 1 -- Do not reset on failure.\n");
245 "Default is 0x1F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F.");
251 "0 - MiniDump disabled. "
252 "1 (Default) - MiniDump enabled.");
258 "0 (Default)- Disabled.");
275 "1 - Set fw option to hold ABTS.");
280 "Move PUREX, ABTS RX and RIDA IOCBs to ATIOQ"
282 "1 - Move IOCBs.");
293 "Set to enable MSI or MSI-X interrupt mechanism.\n"
294 " Default is 1, enable MSI-X interrupt mechanism.\n"
295 " 0 -- enable traditional pin-based mechanism.\n"
296 " 1 -- enable MSI-X interrupt mechanism.\n"
297 " 2 -- enable MSI interrupt mechanism.\n");
315 " 0 -- Let HBA firmware decide\n"
316 " 1 -- Force T10 CRC\n"
317 " 2 -- Force IP checksum\n");
331 " Default is 0 - No SmartSAN registration,"
332 " 1 - Register SmartSAN Management Attributes.");
339 "0 - no RDP responses (default). "
340 "1 - provide RDP responses.");
350 "Number of seconds delayed before qla begin PCI error self-handling (default: 5).\n");
362 "1 - Minimum number of queues supported\n"
363 "8 - Default value");
369 "0 - FC2 Target support is disabled. "
370 "1 - FC2 Target support is enabled (default).");
383 timer_setup(&vha->timer, qla2x00_timer, 0); in qla2x00_start_timer()
384 vha->timer.expires = jiffies + interval * HZ; in qla2x00_start_timer()
385 add_timer(&vha->timer); in qla2x00_start_timer()
386 vha->timer_active = 1; in qla2x00_start_timer()
393 if (vha->device_flags & DFLG_DEV_FAILED) { in qla2x00_restart_timer()
399 mod_timer(&vha->timer, jiffies + interval * HZ); in qla2x00_restart_timer()
405 del_timer_sync(&vha->timer); in qla2x00_stop_timer()
406 vha->timer_active = 0; in qla2x00_stop_timer()
420 /* -------------------------------------------------------------------------- */
424 struct qla_hw_data *ha = vha->hw; in qla_init_base_qpair()
426 rsp->qpair = ha->base_qpair; in qla_init_base_qpair()
427 rsp->req = req; in qla_init_base_qpair()
428 ha->base_qpair->hw = ha; in qla_init_base_qpair()
429 ha->base_qpair->req = req; in qla_init_base_qpair()
430 ha->base_qpair->rsp = rsp; in qla_init_base_qpair()
431 ha->base_qpair->vha = vha; in qla_init_base_qpair()
432 ha->base_qpair->qp_lock_ptr = &ha->hardware_lock; in qla_init_base_qpair()
433 ha->base_qpair->use_shadow_reg = IS_SHADOW_REG_CAPABLE(ha) ? 1 : 0; in qla_init_base_qpair()
434 ha->base_qpair->msix = &ha->msix_entries[QLA_MSIX_RSP_Q]; in qla_init_base_qpair()
435 ha->base_qpair->srb_mempool = ha->srb_mempool; in qla_init_base_qpair()
436 INIT_LIST_HEAD(&ha->base_qpair->hints_list); in qla_init_base_qpair()
437 INIT_LIST_HEAD(&ha->base_qpair->dsd_list); in qla_init_base_qpair()
438 ha->base_qpair->enable_class_2 = ql2xenableclass2; in qla_init_base_qpair()
440 qla_cpu_update(rsp->qpair, raw_smp_processor_id()); in qla_init_base_qpair()
441 ha->base_qpair->pdev = ha->pdev; in qla_init_base_qpair()
444 ha->base_qpair->reqq_start_iocbs = qla_83xx_start_iocbs; in qla_init_base_qpair()
450 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); in qla2x00_alloc_queues()
452 ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), in qla2x00_alloc_queues()
454 if (!ha->req_q_map) { in qla2x00_alloc_queues()
460 ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), in qla2x00_alloc_queues()
462 if (!ha->rsp_q_map) { in qla2x00_alloc_queues()
468 ha->base_qpair = kzalloc(sizeof(struct qla_qpair), GFP_KERNEL); in qla2x00_alloc_queues()
469 if (ha->base_qpair == NULL) { in qla2x00_alloc_queues()
477 if ((ql2xmqsupport || ql2xnvmeenable) && ha->max_qpairs) { in qla2x00_alloc_queues()
478 ha->queue_pair_map = kcalloc(ha->max_qpairs, sizeof(struct qla_qpair *), in qla2x00_alloc_queues()
480 if (!ha->queue_pair_map) { in qla2x00_alloc_queues()
486 kfree(ha->queue_pair_map); in qla2x00_alloc_queues()
487 ha->queue_pair_map = NULL; in qla2x00_alloc_queues()
496 ha->rsp_q_map[0] = rsp; in qla2x00_alloc_queues()
497 ha->req_q_map[0] = req; in qla2x00_alloc_queues()
498 set_bit(0, ha->rsp_qid_map); in qla2x00_alloc_queues()
499 set_bit(0, ha->req_qid_map); in qla2x00_alloc_queues()
503 kfree(ha->base_qpair); in qla2x00_alloc_queues()
504 ha->base_qpair = NULL; in qla2x00_alloc_queues()
506 kfree(ha->rsp_q_map); in qla2x00_alloc_queues()
507 ha->rsp_q_map = NULL; in qla2x00_alloc_queues()
509 kfree(ha->req_q_map); in qla2x00_alloc_queues()
510 ha->req_q_map = NULL; in qla2x00_alloc_queues()
512 return -ENOMEM; in qla2x00_alloc_queues()
518 if (req && req->ring_fx00) in qla2x00_free_req_que()
519 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
520 (req->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_req_que()
521 req->ring_fx00, req->dma_fx00); in qla2x00_free_req_que()
522 } else if (req && req->ring) in qla2x00_free_req_que()
523 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_req_que()
524 (req->length + 1) * sizeof(request_t), in qla2x00_free_req_que()
525 req->ring, req->dma); in qla2x00_free_req_que()
528 kfree(req->outstanding_cmds); in qla2x00_free_req_que()
536 if (rsp && rsp->ring_fx00) in qla2x00_free_rsp_que()
537 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
538 (rsp->length_fx00 + 1) * sizeof(request_t), in qla2x00_free_rsp_que()
539 rsp->ring_fx00, rsp->dma_fx00); in qla2x00_free_rsp_que()
540 } else if (rsp && rsp->ring) { in qla2x00_free_rsp_que()
541 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_rsp_que()
542 (rsp->length + 1) * sizeof(response_t), in qla2x00_free_rsp_que()
543 rsp->ring, rsp->dma); in qla2x00_free_rsp_que()
555 if (ha->queue_pair_map) { in qla2x00_free_queues()
556 kfree(ha->queue_pair_map); in qla2x00_free_queues()
557 ha->queue_pair_map = NULL; in qla2x00_free_queues()
559 if (ha->base_qpair) { in qla2x00_free_queues()
560 kfree(ha->base_qpair); in qla2x00_free_queues()
561 ha->base_qpair = NULL; in qla2x00_free_queues()
565 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
566 for (cnt = 0; cnt < ha->max_req_queues; cnt++) { in qla2x00_free_queues()
567 if (!test_bit(cnt, ha->req_qid_map)) in qla2x00_free_queues()
570 req = ha->req_q_map[cnt]; in qla2x00_free_queues()
571 clear_bit(cnt, ha->req_qid_map); in qla2x00_free_queues()
572 ha->req_q_map[cnt] = NULL; in qla2x00_free_queues()
574 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
576 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
578 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
580 kfree(ha->req_q_map); in qla2x00_free_queues()
581 ha->req_q_map = NULL; in qla2x00_free_queues()
584 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
585 for (cnt = 0; cnt < ha->max_rsp_queues; cnt++) { in qla2x00_free_queues()
586 if (!test_bit(cnt, ha->rsp_qid_map)) in qla2x00_free_queues()
589 rsp = ha->rsp_q_map[cnt]; in qla2x00_free_queues()
590 clear_bit(cnt, ha->rsp_qid_map); in qla2x00_free_queues()
591 ha->rsp_q_map[cnt] = NULL; in qla2x00_free_queues()
592 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
594 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_free_queues()
596 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_free_queues()
598 kfree(ha->rsp_q_map); in qla2x00_free_queues()
599 ha->rsp_q_map = NULL; in qla2x00_free_queues()
605 struct qla_hw_data *ha = vha->hw; in qla2x00_pci_info_str()
611 pci_bus = (ha->pci_attr & (BIT_9 | BIT_10)) >> 9; in qla2x00_pci_info_str()
613 snprintf(str, str_len, "PCI-X (%s MHz)", in qla2x00_pci_info_str()
616 pci_bus = (ha->pci_attr & BIT_8) >> 8; in qla2x00_pci_info_str()
629 struct qla_hw_data *ha = vha->hw; in qla24xx_pci_info_str()
632 if (pci_is_pcie(ha->pdev)) { in qla24xx_pci_info_str()
636 pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat); in qla24xx_pci_info_str()
662 pci_bus = (ha->pci_attr & CSRX_PCIX_BUS_MODE_MASK) >> 8; in qla24xx_pci_info_str()
667 snprintf(str, str_len, "PCI-X Mode %d (%s MHz)", in qla24xx_pci_info_str()
678 struct qla_hw_data *ha = vha->hw; in qla2x00_fw_version_str()
680 snprintf(str, size, "%d.%02d.%02d ", ha->fw_major_version, in qla2x00_fw_version_str()
681 ha->fw_minor_version, ha->fw_subminor_version); in qla2x00_fw_version_str()
683 if (ha->fw_attributes & BIT_9) { in qla2x00_fw_version_str()
688 switch (ha->fw_attributes & 0xFF) { in qla2x00_fw_version_str()
702 sprintf(un_str, "(%x)", ha->fw_attributes); in qla2x00_fw_version_str()
706 if (ha->fw_attributes & 0x100) in qla2x00_fw_version_str()
715 struct qla_hw_data *ha = vha->hw; in qla24xx_fw_version_str()
717 snprintf(str, size, "%d.%02d.%02d (%x)", ha->fw_major_version, in qla24xx_fw_version_str()
718 ha->fw_minor_version, ha->fw_subminor_version, ha->fw_attributes); in qla24xx_fw_version_str()
722 void qla2x00_sp_free_dma(srb_t *sp) in qla2x00_sp_free_dma() argument
724 struct qla_hw_data *ha = sp->vha->hw; in qla2x00_sp_free_dma()
725 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_free_dma()
727 if (sp->flags & SRB_DMA_VALID) { in qla2x00_sp_free_dma()
729 sp->flags &= ~SRB_DMA_VALID; in qla2x00_sp_free_dma()
732 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2x00_sp_free_dma()
733 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2x00_sp_free_dma()
734 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2x00_sp_free_dma()
735 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2x00_sp_free_dma()
738 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2x00_sp_free_dma()
740 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2x00_sp_free_dma()
741 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2x00_sp_free_dma()
744 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2x00_sp_free_dma()
745 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2x00_sp_free_dma()
747 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2x00_sp_free_dma()
748 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2x00_sp_free_dma()
751 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2x00_sp_free_dma()
752 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2x00_sp_free_dma()
754 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2x00_sp_free_dma()
755 ctx1->fcp_cmnd_dma); in qla2x00_sp_free_dma()
756 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2x00_sp_free_dma()
757 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
758 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2x00_sp_free_dma()
761 if (sp->flags & SRB_GOT_BUF) in qla2x00_sp_free_dma()
762 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2x00_sp_free_dma()
765 void qla2x00_sp_compl(srb_t *sp, int res) in qla2x00_sp_compl() argument
767 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_sp_compl()
768 struct completion *comp = sp->comp; in qla2x00_sp_compl()
771 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2x00_sp_compl()
772 cmd->result = res; in qla2x00_sp_compl()
773 sp->type = 0; in qla2x00_sp_compl()
779 void qla2xxx_qpair_sp_free_dma(srb_t *sp) in qla2xxx_qpair_sp_free_dma() argument
781 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_free_dma()
782 struct qla_hw_data *ha = sp->fcport->vha->hw; in qla2xxx_qpair_sp_free_dma()
784 if (sp->flags & SRB_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
786 sp->flags &= ~SRB_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
789 if (sp->flags & SRB_CRC_PROT_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
790 dma_unmap_sg(&ha->pdev->dev, scsi_prot_sglist(cmd), in qla2xxx_qpair_sp_free_dma()
791 scsi_prot_sg_count(cmd), cmd->sc_data_direction); in qla2xxx_qpair_sp_free_dma()
792 sp->flags &= ~SRB_CRC_PROT_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
795 if (sp->flags & SRB_CRC_CTX_DSD_VALID) { in qla2xxx_qpair_sp_free_dma()
797 qla2x00_clean_dsd_pool(ha, sp->u.scmd.crc_ctx); in qla2xxx_qpair_sp_free_dma()
798 sp->flags &= ~SRB_CRC_CTX_DSD_VALID; in qla2xxx_qpair_sp_free_dma()
801 if (sp->flags & SRB_DIF_BUNDL_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
802 struct crc_context *difctx = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
806 &difctx->ldif_dma_hndl_list, list) { in qla2xxx_qpair_sp_free_dma()
807 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
808 dma_pool_free(ha->dif_bundl_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
809 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
811 difctx->no_dif_bundl--; in qla2xxx_qpair_sp_free_dma()
815 &difctx->ldif_dsd_list, list) { in qla2xxx_qpair_sp_free_dma()
816 list_del(&dif_dsd->list); in qla2xxx_qpair_sp_free_dma()
817 dma_pool_free(ha->dl_dma_pool, dif_dsd->dsd_addr, in qla2xxx_qpair_sp_free_dma()
818 dif_dsd->dsd_list_dma); in qla2xxx_qpair_sp_free_dma()
820 difctx->no_ldif_dsd--; in qla2xxx_qpair_sp_free_dma()
823 if (difctx->no_ldif_dsd) { in qla2xxx_qpair_sp_free_dma()
824 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
825 "%s: difctx->no_ldif_dsd=%x\n", in qla2xxx_qpair_sp_free_dma()
826 __func__, difctx->no_ldif_dsd); in qla2xxx_qpair_sp_free_dma()
829 if (difctx->no_dif_bundl) { in qla2xxx_qpair_sp_free_dma()
830 ql_dbg(ql_dbg_tgt+ql_dbg_verbose, sp->vha, 0xe022, in qla2xxx_qpair_sp_free_dma()
831 "%s: difctx->no_dif_bundl=%x\n", in qla2xxx_qpair_sp_free_dma()
832 __func__, difctx->no_dif_bundl); in qla2xxx_qpair_sp_free_dma()
834 sp->flags &= ~SRB_DIF_BUNDL_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
837 if (sp->flags & SRB_FCP_CMND_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
838 struct ct6_dsd *ctx1 = &sp->u.scmd.ct6_ctx; in qla2xxx_qpair_sp_free_dma()
840 dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, in qla2xxx_qpair_sp_free_dma()
841 ctx1->fcp_cmnd_dma); in qla2xxx_qpair_sp_free_dma()
842 list_splice(&ctx1->dsd_list, &sp->qpair->dsd_list); in qla2xxx_qpair_sp_free_dma()
843 sp->qpair->dsd_inuse -= ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
844 sp->qpair->dsd_avail += ctx1->dsd_use_cnt; in qla2xxx_qpair_sp_free_dma()
845 sp->flags &= ~SRB_FCP_CMND_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
848 if (sp->flags & SRB_CRC_CTX_DMA_VALID) { in qla2xxx_qpair_sp_free_dma()
849 struct crc_context *ctx0 = sp->u.scmd.crc_ctx; in qla2xxx_qpair_sp_free_dma()
851 dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); in qla2xxx_qpair_sp_free_dma()
852 sp->flags &= ~SRB_CRC_CTX_DMA_VALID; in qla2xxx_qpair_sp_free_dma()
855 if (sp->flags & SRB_GOT_BUF) in qla2xxx_qpair_sp_free_dma()
856 qla_put_buf(sp->qpair, &sp->u.scmd.buf_dsc); in qla2xxx_qpair_sp_free_dma()
859 void qla2xxx_qpair_sp_compl(srb_t *sp, int res) in qla2xxx_qpair_sp_compl() argument
861 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2xxx_qpair_sp_compl()
862 struct completion *comp = sp->comp; in qla2xxx_qpair_sp_compl()
865 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_qpair_sp_compl()
866 cmd->result = res; in qla2xxx_qpair_sp_compl()
867 sp->type = 0; in qla2xxx_qpair_sp_compl()
877 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_queuecommand()
878 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_queuecommand()
879 struct qla_hw_data *ha = vha->hw; in qla2xxx_queuecommand()
880 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_queuecommand()
881 srb_t *sp; in qla2xxx_queuecommand() local
884 if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || in qla2xxx_queuecommand()
886 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
890 if (ha->mqenable) { in qla2xxx_queuecommand()
897 qpair = ha->queue_pair_map[hwq]; in qla2xxx_queuecommand()
903 if (ha->flags.eeh_busy) { in qla2xxx_queuecommand()
904 if (ha->flags.pci_channel_io_perm_failure) { in qla2xxx_queuecommand()
908 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
912 cmd->result = DID_REQUEUE << 16; in qla2xxx_queuecommand()
919 cmd->result = rval; in qla2xxx_queuecommand()
926 if (!vha->flags.difdix_supported && in qla2xxx_queuecommand()
931 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
935 if (!fcport || fcport->deleted) { in qla2xxx_queuecommand()
936 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_queuecommand()
940 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_queuecommand()
941 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_queuecommand()
942 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_queuecommand()
945 atomic_read(&fcport->state), in qla2xxx_queuecommand()
946 atomic_read(&base_vha->loop_state)); in qla2xxx_queuecommand()
947 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_queuecommand()
954 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_queuecommand()
957 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_queuecommand()
959 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_queuecommand()
960 fcport->retry_delay_timestamp = 0; in qla2xxx_queuecommand()
964 sp = scsi_cmd_priv(cmd); in qla2xxx_queuecommand()
966 qla2xxx_init_sp(sp, vha, vha->hw->base_qpair, fcport); in qla2xxx_queuecommand()
968 sp->u.scmd.cmd = cmd; in qla2xxx_queuecommand()
969 sp->type = SRB_SCSI_CMD; in qla2xxx_queuecommand()
970 sp->free = qla2x00_sp_free_dma; in qla2xxx_queuecommand()
971 sp->done = qla2x00_sp_compl; in qla2xxx_queuecommand()
973 rval = ha->isp_ops->start_scsi(sp); in qla2xxx_queuecommand()
984 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_queuecommand()
1001 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; in qla2xxx_mqueuecommand()
1002 struct fc_rport *rport = starget_to_rport(scsi_target(cmd->device)); in qla2xxx_mqueuecommand()
1003 struct qla_hw_data *ha = vha->hw; in qla2xxx_mqueuecommand()
1004 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_mqueuecommand()
1005 srb_t *sp; in qla2xxx_mqueuecommand() local
1010 cmd->result = rval; in qla2xxx_mqueuecommand()
1017 if (!qpair->online) { in qla2xxx_mqueuecommand()
1019 "qpair not online. eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2xxx_mqueuecommand()
1020 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1024 if (!fcport || fcport->deleted) { in qla2xxx_mqueuecommand()
1025 cmd->result = DID_IMM_RETRY << 16; in qla2xxx_mqueuecommand()
1029 if (atomic_read(&fcport->state) != FCS_ONLINE || fcport->deleted) { in qla2xxx_mqueuecommand()
1030 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || in qla2xxx_mqueuecommand()
1031 atomic_read(&base_vha->loop_state) == LOOP_DEAD) { in qla2xxx_mqueuecommand()
1034 atomic_read(&fcport->state), in qla2xxx_mqueuecommand()
1035 atomic_read(&base_vha->loop_state)); in qla2xxx_mqueuecommand()
1036 cmd->result = DID_NO_CONNECT << 16; in qla2xxx_mqueuecommand()
1043 * Return target busy if we've received a non-zero retry_delay_timer in qla2xxx_mqueuecommand()
1046 if (fcport->retry_delay_timestamp == 0) { in qla2xxx_mqueuecommand()
1048 } else if (time_after(jiffies, fcport->retry_delay_timestamp)) in qla2xxx_mqueuecommand()
1049 fcport->retry_delay_timestamp = 0; in qla2xxx_mqueuecommand()
1053 sp = scsi_cmd_priv(cmd); in qla2xxx_mqueuecommand()
1055 qla2xxx_init_sp(sp, vha, qpair, fcport); in qla2xxx_mqueuecommand()
1057 sp->u.scmd.cmd = cmd; in qla2xxx_mqueuecommand()
1058 sp->type = SRB_SCSI_CMD; in qla2xxx_mqueuecommand()
1059 sp->free = qla2xxx_qpair_sp_free_dma; in qla2xxx_mqueuecommand()
1060 sp->done = qla2xxx_qpair_sp_compl; in qla2xxx_mqueuecommand()
1062 rval = ha->isp_ops->start_scsi_mq(sp); in qla2xxx_mqueuecommand()
1073 kref_put(&sp->cmd_kref, qla2x00_sp_release); in qla2xxx_mqueuecommand()
1091 * ha - pointer to host adapter structure
1094 * Does context switching-Release SPIN_LOCK
1106 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_online()
1107 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_online()
1110 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_hba_online()
1111 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1112 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_hba_online()
1113 ha->dpc_active) && time_before(jiffies, wait_online)) { in qla2x00_wait_for_hba_online()
1117 if (base_vha->flags.online) in qla2x00_wait_for_hba_online()
1127 struct qla_hw_data *ha = vha->hw; in test_fcport_count()
1132 spin_lock_irqsave(&ha->tgt.sess_lock, flags); in test_fcport_count()
1135 vha, vha->fcport_count); in test_fcport_count()
1136 res = (vha->fcport_count == 0); in test_fcport_count()
1140 list_for_each_entry(fcport, &vha->vp_fcports, list) { in test_fcport_count()
1141 if (fcport->deleted != QLA_SESS_DELETED) { in test_fcport_count()
1152 spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); in test_fcport_count()
1169 if (wait_event_timeout(vha->fcport_waitQ, in qla2x00_wait_for_sess_deletion()
1174 flush_workqueue(vha->hw->wq); in qla2x00_wait_for_sess_deletion()
1182 * ha - pointer to host adapter structure
1185 * Does context switching-Release SPIN_LOCK
1192 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_hba_ready()
1193 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_hba_ready()
1195 while ((qla2x00_reset_active(vha) || ha->dpc_active || in qla2x00_wait_for_hba_ready()
1196 ha->flags.mbox_busy) || in qla2x00_wait_for_hba_ready()
1197 test_bit(FX00_RESET_RECOVERY, &vha->dpc_flags) || in qla2x00_wait_for_hba_ready()
1198 test_bit(FX00_TARGET_SCAN, &vha->dpc_flags)) { in qla2x00_wait_for_hba_ready()
1199 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_wait_for_hba_ready()
1210 struct qla_hw_data *ha = vha->hw; in qla2x00_wait_for_chip_reset()
1211 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_wait_for_chip_reset()
1214 while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) || in qla2x00_wait_for_chip_reset()
1215 test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1216 test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || in qla2x00_wait_for_chip_reset()
1217 ha->dpc_active) && time_before(jiffies, wait_reset)) { in qla2x00_wait_for_chip_reset()
1221 if (!test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_wait_for_chip_reset()
1222 ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1225 if (ha->flags.chip_reset_done) in qla2x00_wait_for_chip_reset()
1251 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_abort()
1253 srb_t *sp; in qla2xxx_eh_abort() local
1258 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_abort()
1276 sp = scsi_cmd_priv(cmd); in qla2xxx_eh_abort()
1277 qpair = sp->qpair; in qla2xxx_eh_abort()
1279 vha->cmd_timeout_cnt++; in qla2xxx_eh_abort()
1281 if ((sp->fcport && sp->fcport->deleted) || !qpair) in qla2xxx_eh_abort()
1284 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1285 sp->comp = &comp; in qla2xxx_eh_abort()
1286 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in qla2xxx_eh_abort()
1289 id = cmd->device->id; in qla2xxx_eh_abort()
1290 lun = cmd->device->lun; in qla2xxx_eh_abort()
1293 "Aborting from RISC nexus=%ld:%d:%llu sp=%p cmd=%p handle=%x\n", in qla2xxx_eh_abort()
1294 vha->host_no, id, lun, sp, cmd, sp->handle); in qla2xxx_eh_abort()
1297 * Abort will release the original Command/sp from FW. Let the in qla2xxx_eh_abort()
1301 rval = ha->isp_ops->abort_command(sp); in qla2xxx_eh_abort()
1307 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2xxx_eh_abort()
1314 __func__, ha->r_a_tov/10); in qla2xxx_eh_abort()
1325 sp->comp = NULL; in qla2xxx_eh_abort()
1328 "Abort command issued nexus=%ld:%d:%llu -- %x.\n", in qla2xxx_eh_abort()
1329 vha->host_no, id, lun, ret); in qla2xxx_eh_abort()
1346 scsi_qla_host_t *vha = qpair->vha; in __qla2x00_eh_wait_for_pending_commands()
1347 struct req_que *req = qpair->req; in __qla2x00_eh_wait_for_pending_commands()
1348 srb_t *sp; in __qla2x00_eh_wait_for_pending_commands() local
1352 struct qla_hw_data *ha = vha->hw; in __qla2x00_eh_wait_for_pending_commands()
1356 while (wait_iter--) { in __qla2x00_eh_wait_for_pending_commands()
1359 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1360 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_eh_wait_for_pending_commands()
1361 sp = req->outstanding_cmds[cnt]; in __qla2x00_eh_wait_for_pending_commands()
1362 if (!sp) in __qla2x00_eh_wait_for_pending_commands()
1364 if (sp->type != SRB_SCSI_CMD) in __qla2x00_eh_wait_for_pending_commands()
1366 if (vha->vp_idx != sp->vha->vp_idx) in __qla2x00_eh_wait_for_pending_commands()
1369 cmd = GET_CMD_SP(sp); in __qla2x00_eh_wait_for_pending_commands()
1375 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1376 match = sp->fcport->d_id.b24 == t; in __qla2x00_eh_wait_for_pending_commands()
1381 if (sp->fcport) in __qla2x00_eh_wait_for_pending_commands()
1382 match = (sp->fcport->d_id.b24 == t && in __qla2x00_eh_wait_for_pending_commands()
1383 cmd->device->lun == l); in __qla2x00_eh_wait_for_pending_commands()
1391 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1393 if (unlikely(pci_channel_offline(ha->pdev)) || in __qla2x00_eh_wait_for_pending_commands()
1394 ha->flags.eeh_busy) { in __qla2x00_eh_wait_for_pending_commands()
1406 spin_lock_irqsave(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1409 spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); in __qla2x00_eh_wait_for_pending_commands()
1415 if (wait_iter == -1) in __qla2x00_eh_wait_for_pending_commands()
1426 struct qla_hw_data *ha = vha->hw; in qla2x00_eh_wait_for_pending_commands()
1429 status = __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, in qla2x00_eh_wait_for_pending_commands()
1431 for (i = 0; status == QLA_SUCCESS && i < ha->max_qpairs; i++) { in qla2x00_eh_wait_for_pending_commands()
1432 qpair = ha->queue_pair_map[i]; in qla2x00_eh_wait_for_pending_commands()
1451 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_device_reset()
1452 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_eh_device_reset()
1454 fc_port_t *fcport = (struct fc_port *) sdev->hostdata; in qla2xxx_eh_device_reset()
1455 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_device_reset()
1473 if (fcport->deleted) in qla2xxx_eh_device_reset()
1477 "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, in qla2xxx_eh_device_reset()
1478 sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1487 if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) in qla2xxx_eh_device_reset()
1494 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, in qla2xxx_eh_device_reset()
1495 cmd->device->lun, in qla2xxx_eh_device_reset()
1504 vha->host_no, sdev->id, sdev->lun, cmd); in qla2xxx_eh_device_reset()
1511 reset_errors[err], vha->host_no, sdev->id, sdev->lun, in qla2xxx_eh_device_reset()
1513 vha->reset_cmd_err_cnt++; in qla2xxx_eh_device_reset()
1520 struct scsi_device *sdev = cmd->device; in qla2xxx_eh_target_reset()
1523 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_target_reset()
1524 fc_port_t *fcport = *(fc_port_t **)rport->dd_data; in qla2xxx_eh_target_reset()
1542 if (fcport->deleted) in qla2xxx_eh_target_reset()
1546 "TARGET RESET ISSUED nexus=%ld:%d cmd=%p.\n", vha->host_no, in qla2xxx_eh_target_reset()
1547 sdev->id, cmd); in qla2xxx_eh_target_reset()
1556 if (ha->isp_ops->target_reset(fcport, 0, 0) != QLA_SUCCESS) { in qla2xxx_eh_target_reset()
1562 if (qla2x00_eh_wait_for_pending_commands(vha, fcport->d_id.b24, 0, in qla2xxx_eh_target_reset()
1571 vha->host_no, sdev->id, cmd); in qla2xxx_eh_target_reset()
1578 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, in qla2xxx_eh_target_reset()
1580 vha->reset_cmd_err_cnt++; in qla2xxx_eh_target_reset()
1602 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_bus_reset()
1606 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_bus_reset()
1615 id = cmd->device->id; in qla2xxx_eh_bus_reset()
1616 lun = cmd->device->lun; in qla2xxx_eh_bus_reset()
1622 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1647 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_bus_reset()
1670 scsi_qla_host_t *vha = shost_priv(cmd->device->host); in qla2xxx_eh_host_reset()
1671 struct qla_hw_data *ha = vha->hw; in qla2xxx_eh_host_reset()
1675 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2xxx_eh_host_reset()
1684 id = cmd->device->id; in qla2xxx_eh_host_reset()
1685 lun = cmd->device->lun; in qla2xxx_eh_host_reset()
1688 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1694 if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING) in qla2xxx_eh_host_reset()
1701 if (IS_P3P_TYPE(vha->hw)) { in qla2xxx_eh_host_reset()
1709 if (ha->wq) in qla2xxx_eh_host_reset()
1710 flush_workqueue(ha->wq); in qla2xxx_eh_host_reset()
1712 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1713 if (ha->isp_ops->abort_isp(base_vha)) { in qla2xxx_eh_host_reset()
1714 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1716 set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1724 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_eh_host_reset()
1735 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); in qla2xxx_eh_host_reset()
1754 struct qla_hw_data *ha = vha->hw; in qla2x00_loop_reset()
1759 if (ha->flags.enable_lip_full_login && !IS_CNA_CAPABLE(ha)) { in qla2x00_loop_reset()
1760 atomic_set(&vha->loop_state, LOOP_DOWN); in qla2x00_loop_reset()
1761 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); in qla2x00_loop_reset()
1770 if (ha->flags.enable_lip_reset) { in qla2x00_loop_reset()
1778 vha->marker_needed = 1; in qla2x00_loop_reset()
1787 static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, in qla2x00_abort_srb() argument
1789 __releases(qp->qp_lock_ptr) in qla2x00_abort_srb()
1790 __acquires(qp->qp_lock_ptr) in qla2x00_abort_srb()
1793 scsi_qla_host_t *vha = qp->vha; in qla2x00_abort_srb()
1794 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_srb()
1795 struct scsi_cmnd *cmd = GET_CMD_SP(sp); in qla2x00_abort_srb()
1800 lockdep_assert_held(qp->qp_lock_ptr); in qla2x00_abort_srb()
1803 sp->done(sp, res); in qla2x00_abort_srb()
1807 if (sp->type == SRB_NVME_CMD || sp->type == SRB_NVME_LS || in qla2x00_abort_srb()
1808 (sp->type == SRB_SCSI_CMD && !ha->flags.eeh_busy && in qla2x00_abort_srb()
1809 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && in qla2x00_abort_srb()
1811 if (sp->comp) { in qla2x00_abort_srb()
1812 sp->done(sp, res); in qla2x00_abort_srb()
1816 sp->comp = &comp; in qla2x00_abort_srb()
1817 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1819 rval = ha->isp_ops->abort_command(sp); in qla2x00_abort_srb()
1822 ratov_j = ha->r_a_tov/10 * 4 * 1000; in qla2x00_abort_srb()
1829 __func__, ha->r_a_tov/10); in qla2x00_abort_srb()
1832 /* else FW return SP to driver */ in qla2x00_abort_srb()
1839 spin_lock_irqsave(qp->qp_lock_ptr, *flags); in qla2x00_abort_srb()
1840 switch (sp->type) { in qla2x00_abort_srb()
1843 sp->done(sp, res); in qla2x00_abort_srb()
1847 sp->done(sp, res); in qla2x00_abort_srb()
1851 sp->done(sp, res); in qla2x00_abort_srb()
1864 srb_t *sp; in __qla2x00_abort_all_cmds() local
1865 scsi_qla_host_t *vha = qp->vha; in __qla2x00_abort_all_cmds()
1866 struct qla_hw_data *ha = vha->hw; in __qla2x00_abort_all_cmds()
1868 struct qla_tgt *tgt = vha->vha_tgt.qla_tgt; in __qla2x00_abort_all_cmds()
1871 if (!ha->req_q_map) in __qla2x00_abort_all_cmds()
1873 spin_lock_irqsave(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1874 req = qp->req; in __qla2x00_abort_all_cmds()
1875 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { in __qla2x00_abort_all_cmds()
1876 sp = req->outstanding_cmds[cnt]; in __qla2x00_abort_all_cmds()
1877 if (sp) { in __qla2x00_abort_all_cmds()
1879 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1880 sp->done(sp, res); in __qla2x00_abort_all_cmds()
1884 switch (sp->cmd_type) { in __qla2x00_abort_all_cmds()
1886 qla2x00_abort_srb(qp, sp, res, &flags); in __qla2x00_abort_all_cmds()
1889 if (!vha->hw->tgt.tgt_ops || !tgt || in __qla2x00_abort_all_cmds()
1892 "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n", in __qla2x00_abort_all_cmds()
1893 vha->dpc_flags); in __qla2x00_abort_all_cmds()
1896 cmd = (struct qla_tgt_cmd *)sp; in __qla2x00_abort_all_cmds()
1897 cmd->aborted = 1; in __qla2x00_abort_all_cmds()
1905 req->outstanding_cmds[cnt] = NULL; in __qla2x00_abort_all_cmds()
1908 spin_unlock_irqrestore(qp->qp_lock_ptr, flags); in __qla2x00_abort_all_cmds()
1919 struct qla_hw_data *ha = vha->hw; in qla2x00_abort_all_cmds()
1922 if (!ha->base_qpair) in qla2x00_abort_all_cmds()
1924 __qla2x00_abort_all_cmds(ha->base_qpair, res); in qla2x00_abort_all_cmds()
1926 if (!ha->queue_pair_map) in qla2x00_abort_all_cmds()
1928 for (que = 0; que < ha->max_qpairs; que++) { in qla2x00_abort_all_cmds()
1929 if (!ha->queue_pair_map[que]) in qla2x00_abort_all_cmds()
1932 __qla2x00_abort_all_cmds(ha->queue_pair_map[que], res); in qla2x00_abort_all_cmds()
1942 return -ENXIO; in qla2xxx_slave_alloc()
1944 sdev->hostdata = *(fc_port_t **)rport->dd_data; in qla2xxx_slave_alloc()
1952 scsi_qla_host_t *vha = shost_priv(sdev->host); in qla2xxx_slave_configure()
1953 struct req_que *req = vha->req; in qla2xxx_slave_configure()
1955 scsi_change_queue_depth(sdev, req->max_q_depth); in qla2xxx_slave_configure()
1962 sdev->hostdata = NULL; in qla2xxx_slave_destroy()
1966 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1976 ha->flags.enable_64bit_addressing = 0; in qla2x00_config_dma_addressing()
1978 if (!dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1979 /* Any upper-dword bits set? */ in qla2x00_config_dma_addressing()
1980 if (MSD(dma_get_required_mask(&ha->pdev->dev)) && in qla2x00_config_dma_addressing()
1981 !dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla2x00_config_dma_addressing()
1983 ha->flags.enable_64bit_addressing = 1; in qla2x00_config_dma_addressing()
1984 ha->isp_ops->calc_req_entries = qla2x00_calc_iocbs_64; in qla2x00_config_dma_addressing()
1985 ha->isp_ops->build_iocbs = qla2x00_build_scsi_iocbs_64; in qla2x00_config_dma_addressing()
1990 dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1991 dma_set_coherent_mask(&ha->pdev->dev, DMA_BIT_MASK(32)); in qla2x00_config_dma_addressing()
1998 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_enable_intrs()
2000 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2001 ha->interrupts_on = 1; in qla2x00_enable_intrs()
2003 wrt_reg_word(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC); in qla2x00_enable_intrs()
2004 rd_reg_word(&reg->ictrl); in qla2x00_enable_intrs()
2005 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_enable_intrs()
2013 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2x00_disable_intrs()
2015 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2016 ha->interrupts_on = 0; in qla2x00_disable_intrs()
2018 wrt_reg_word(&reg->ictrl, 0); in qla2x00_disable_intrs()
2019 rd_reg_word(&reg->ictrl); in qla2x00_disable_intrs()
2020 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2x00_disable_intrs()
2027 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_enable_intrs()
2029 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2030 ha->interrupts_on = 1; in qla24xx_enable_intrs()
2031 wrt_reg_dword(&reg->ictrl, ICRX_EN_RISC_INT); in qla24xx_enable_intrs()
2032 rd_reg_dword(&reg->ictrl); in qla24xx_enable_intrs()
2033 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_enable_intrs()
2040 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; in qla24xx_disable_intrs()
2044 spin_lock_irqsave(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2045 ha->interrupts_on = 0; in qla24xx_disable_intrs()
2046 wrt_reg_dword(&reg->ictrl, 0); in qla24xx_disable_intrs()
2047 rd_reg_dword(&reg->ictrl); in qla24xx_disable_intrs()
2048 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla24xx_disable_intrs()
2057 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla2x00_iospace_config()
2059 ql_log_pci(ql_log_fatal, ha->pdev, 0x0011, in qla2x00_iospace_config()
2061 pci_name(ha->pdev)); in qla2x00_iospace_config()
2064 if (!(ha->bars & 1)) in qla2x00_iospace_config()
2068 pio = pci_resource_start(ha->pdev, 0); in qla2x00_iospace_config()
2069 if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) { in qla2x00_iospace_config()
2070 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2071 ql_log_pci(ql_log_warn, ha->pdev, 0x0012, in qla2x00_iospace_config()
2073 pci_name(ha->pdev)); in qla2x00_iospace_config()
2077 ql_log_pci(ql_log_warn, ha->pdev, 0x0013, in qla2x00_iospace_config()
2079 pci_name(ha->pdev)); in qla2x00_iospace_config()
2082 ha->pio_address = pio; in qla2x00_iospace_config()
2083 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0014, in qla2x00_iospace_config()
2085 (unsigned long long)ha->pio_address); in qla2x00_iospace_config()
2089 if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) { in qla2x00_iospace_config()
2090 ql_log_pci(ql_log_fatal, ha->pdev, 0x0015, in qla2x00_iospace_config()
2092 pci_name(ha->pdev)); in qla2x00_iospace_config()
2095 if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) { in qla2x00_iospace_config()
2096 ql_log_pci(ql_log_fatal, ha->pdev, 0x0016, in qla2x00_iospace_config()
2098 pci_name(ha->pdev)); in qla2x00_iospace_config()
2102 ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN); in qla2x00_iospace_config()
2103 if (!ha->iobase) { in qla2x00_iospace_config()
2104 ql_log_pci(ql_log_fatal, ha->pdev, 0x0017, in qla2x00_iospace_config()
2106 pci_name(ha->pdev)); in qla2x00_iospace_config()
2111 ha->max_req_queues = ha->max_rsp_queues = 1; in qla2x00_iospace_config()
2112 ha->msix_count = QLA_BASE_VECTORS; in qla2x00_iospace_config()
2115 if (!(ha->fw_attributes & BIT_6)) in qla2x00_iospace_config()
2122 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 3), in qla2x00_iospace_config()
2123 pci_resource_len(ha->pdev, 3)); in qla2x00_iospace_config()
2124 if (ha->mqiobase) { in qla2x00_iospace_config()
2125 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0018, in qla2x00_iospace_config()
2126 "MQIO Base=%p.\n", ha->mqiobase); in qla2x00_iospace_config()
2128 pci_read_config_word(ha->pdev, QLA_PCI_MSIX_CONTROL, &msix); in qla2x00_iospace_config()
2129 ha->msix_count = msix + 1; in qla2x00_iospace_config()
2132 ha->max_req_queues = ha->msix_count - 1; in qla2x00_iospace_config()
2133 ha->max_rsp_queues = ha->max_req_queues; in qla2x00_iospace_config()
2135 ha->max_qpairs = ha->max_rsp_queues - 1; in qla2x00_iospace_config()
2136 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0188, in qla2x00_iospace_config()
2137 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla2x00_iospace_config()
2139 ql_log_pci(ql_log_info, ha->pdev, 0x001a, in qla2x00_iospace_config()
2140 "MSI-X vector count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2142 ql_log_pci(ql_log_info, ha->pdev, 0x001b, in qla2x00_iospace_config()
2146 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x001c, in qla2x00_iospace_config()
2147 "MSIX Count: %d.\n", ha->msix_count); in qla2x00_iospace_config()
2151 return (-ENOMEM); in qla2x00_iospace_config()
2160 if (pci_request_selected_regions(ha->pdev, ha->bars, in qla83xx_iospace_config()
2162 ql_log_pci(ql_log_fatal, ha->pdev, 0x0117, in qla83xx_iospace_config()
2164 pci_name(ha->pdev)); in qla83xx_iospace_config()
2170 if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { in qla83xx_iospace_config()
2171 ql_log_pci(ql_log_warn, ha->pdev, 0x0118, in qla83xx_iospace_config()
2173 pci_name(ha->pdev)); in qla83xx_iospace_config()
2176 if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) { in qla83xx_iospace_config()
2177 ql_log_pci(ql_log_warn, ha->pdev, 0x0119, in qla83xx_iospace_config()
2179 pci_name(ha->pdev)); in qla83xx_iospace_config()
2183 ha->iobase = ioremap(pci_resource_start(ha->pdev, 0), MIN_IOBASE_LEN); in qla83xx_iospace_config()
2184 if (!ha->iobase) { in qla83xx_iospace_config()
2185 ql_log_pci(ql_log_fatal, ha->pdev, 0x011a, in qla83xx_iospace_config()
2187 pci_name(ha->pdev)); in qla83xx_iospace_config()
2191 /* 64bit PCI BAR - BAR2 will correspoond to region 4 */ in qla83xx_iospace_config()
2193 * - mbar 2, a.k.a region 4 */ in qla83xx_iospace_config()
2194 ha->max_req_queues = ha->max_rsp_queues = 1; in qla83xx_iospace_config()
2195 ha->msix_count = QLA_BASE_VECTORS; in qla83xx_iospace_config()
2196 ha->mqiobase = ioremap(pci_resource_start(ha->pdev, 4), in qla83xx_iospace_config()
2197 pci_resource_len(ha->pdev, 4)); in qla83xx_iospace_config()
2199 if (!ha->mqiobase) { in qla83xx_iospace_config()
2200 ql_log_pci(ql_log_fatal, ha->pdev, 0x011d, in qla83xx_iospace_config()
2205 ha->msixbase = ioremap(pci_resource_start(ha->pdev, 2), in qla83xx_iospace_config()
2206 pci_resource_len(ha->pdev, 2)); in qla83xx_iospace_config()
2207 if (ha->msixbase) { in qla83xx_iospace_config()
2209 pci_read_config_word(ha->pdev, in qla83xx_iospace_config()
2211 ha->msix_count = (msix & PCI_MSIX_FLAGS_QSIZE) + 1; in qla83xx_iospace_config()
2218 ha->max_req_queues = ha->msix_count - 1; in qla83xx_iospace_config()
2222 ha->max_req_queues--; in qla83xx_iospace_config()
2224 ha->max_rsp_queues = ha->max_req_queues; in qla83xx_iospace_config()
2228 ha->max_qpairs = ha->max_req_queues - 1; in qla83xx_iospace_config()
2229 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x00e3, in qla83xx_iospace_config()
2230 "Max no of queues pairs: %d.\n", ha->max_qpairs); in qla83xx_iospace_config()
2232 ql_log_pci(ql_log_info, ha->pdev, 0x011c, in qla83xx_iospace_config()
2233 "MSI-X vector count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2235 ql_log_pci(ql_log_info, ha->pdev, 0x011e, in qla83xx_iospace_config()
2239 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f, in qla83xx_iospace_config()
2240 "MSIX Count: %d.\n", ha->msix_count); in qla83xx_iospace_config()
2244 return -ENOMEM; in qla83xx_iospace_config()
2641 ha->device_type = DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2642 switch (ha->pdev->device) { in qla2x00_set_isp_flags()
2644 ha->isp_type |= DT_ISP2100; in qla2x00_set_isp_flags()
2645 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2646 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2649 ha->isp_type |= DT_ISP2200; in qla2x00_set_isp_flags()
2650 ha->device_type &= ~DT_EXTENDED_IDS; in qla2x00_set_isp_flags()
2651 ha->fw_srisc_address = RISC_START_ADDRESS_2100; in qla2x00_set_isp_flags()
2654 ha->isp_type |= DT_ISP2300; in qla2x00_set_isp_flags()
2655 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2656 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2659 ha->isp_type |= DT_ISP2312; in qla2x00_set_isp_flags()
2660 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2661 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2664 ha->isp_type |= DT_ISP2322; in qla2x00_set_isp_flags()
2665 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2666 if (ha->pdev->subsystem_vendor == 0x1028 && in qla2x00_set_isp_flags()
2667 ha->pdev->subsystem_device == 0x0170) in qla2x00_set_isp_flags()
2668 ha->device_type |= DT_OEM_001; in qla2x00_set_isp_flags()
2669 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2672 ha->isp_type |= DT_ISP6312; in qla2x00_set_isp_flags()
2673 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2676 ha->isp_type |= DT_ISP6322; in qla2x00_set_isp_flags()
2677 ha->fw_srisc_address = RISC_START_ADDRESS_2300; in qla2x00_set_isp_flags()
2680 ha->isp_type |= DT_ISP2422; in qla2x00_set_isp_flags()
2681 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2682 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2683 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2684 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2687 ha->isp_type |= DT_ISP2432; in qla2x00_set_isp_flags()
2688 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2689 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2690 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2691 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2694 ha->isp_type |= DT_ISP8432; in qla2x00_set_isp_flags()
2695 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2696 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2697 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2698 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2701 ha->isp_type |= DT_ISP5422; in qla2x00_set_isp_flags()
2702 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2703 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2706 ha->isp_type |= DT_ISP5432; in qla2x00_set_isp_flags()
2707 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2708 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2711 ha->isp_type |= DT_ISP2532; in qla2x00_set_isp_flags()
2712 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2713 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2714 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2715 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2718 ha->isp_type |= DT_ISP8001; in qla2x00_set_isp_flags()
2719 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2720 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2721 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2722 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2725 ha->isp_type |= DT_ISP8021; in qla2x00_set_isp_flags()
2726 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2727 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2728 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2733 ha->isp_type |= DT_ISP8044; in qla2x00_set_isp_flags()
2734 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2735 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2736 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2741 ha->isp_type |= DT_ISP2031; in qla2x00_set_isp_flags()
2742 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2743 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2744 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2745 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2746 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2749 ha->isp_type |= DT_ISP8031; in qla2x00_set_isp_flags()
2750 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2751 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2752 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2753 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2754 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2757 ha->isp_type |= DT_ISPFX00; in qla2x00_set_isp_flags()
2760 ha->isp_type |= DT_ISP2071; in qla2x00_set_isp_flags()
2761 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2762 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2763 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2764 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2765 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2768 ha->isp_type |= DT_ISP2271; in qla2x00_set_isp_flags()
2769 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2770 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2771 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2772 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2773 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2776 ha->isp_type |= DT_ISP2261; in qla2x00_set_isp_flags()
2777 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2778 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2779 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2780 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2781 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2785 ha->isp_type |= DT_ISP2081; in qla2x00_set_isp_flags()
2786 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2787 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2788 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2789 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2790 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2794 ha->isp_type |= DT_ISP2281; in qla2x00_set_isp_flags()
2795 ha->device_type |= DT_ZIO_SUPPORTED; in qla2x00_set_isp_flags()
2796 ha->device_type |= DT_FWI2; in qla2x00_set_isp_flags()
2797 ha->device_type |= DT_IIDMA; in qla2x00_set_isp_flags()
2798 ha->device_type |= DT_T10_PI; in qla2x00_set_isp_flags()
2799 ha->fw_srisc_address = RISC_START_ADDRESS_2400; in qla2x00_set_isp_flags()
2804 ha->port_no = ha->portnum & 1; in qla2x00_set_isp_flags()
2807 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no); in qla2x00_set_isp_flags()
2810 ha->port_no--; in qla2x00_set_isp_flags()
2812 ha->port_no = !(ha->port_no & 1); in qla2x00_set_isp_flags()
2815 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x000b, in qla2x00_set_isp_flags()
2817 ha->device_type, ha->port_no, ha->fw_srisc_address); in qla2x00_set_isp_flags()
2825 if (vha->hw->flags.running_gold_fw) in qla2xxx_scan_start()
2828 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2829 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2830 set_bit(RSCN_UPDATE, &vha->dpc_flags); in qla2xxx_scan_start()
2831 set_bit(NPIV_CONFIG_NEEDED, &vha->dpc_flags); in qla2xxx_scan_start()
2839 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2xxx_scan_finished()
2841 if (!vha->host) in qla2xxx_scan_finished()
2843 if (time > vha->hw->loop_reset_delay * HZ) in qla2xxx_scan_finished()
2846 return atomic_read(&vha->loop_state) == LOOP_READY; in qla2xxx_scan_finished()
2853 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_heartbeat_work_fn()
2855 if (!ha->flags.mbox_busy && base_vha->flags.init_done) in qla_heartbeat_work_fn()
2863 struct qla_hw_data *ha = vha->hw; in qla2x00_iocb_work_fn()
2864 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_iocb_work_fn()
2868 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_iocb_work_fn()
2871 while (!list_empty(&vha->work_list) && i > 0) { in qla2x00_iocb_work_fn()
2873 i--; in qla2x00_iocb_work_fn()
2876 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2877 clear_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags); in qla2x00_iocb_work_fn()
2878 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_iocb_work_fn()
2908 int ret = -ENODEV; in qla2x00_probe_one()
2923 if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || in qla2x00_probe_one()
2924 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432 || in qla2x00_probe_one()
2925 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8432 || in qla2x00_probe_one()
2926 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5422 || in qla2x00_probe_one()
2927 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP5432 || in qla2x00_probe_one()
2928 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2532 || in qla2x00_probe_one()
2929 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8001 || in qla2x00_probe_one()
2930 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8021 || in qla2x00_probe_one()
2931 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2031 || in qla2x00_probe_one()
2932 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 || in qla2x00_probe_one()
2933 pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 || in qla2x00_probe_one()
2934 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 || in qla2x00_probe_one()
2935 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 || in qla2x00_probe_one()
2936 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271 || in qla2x00_probe_one()
2937 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2261 || in qla2x00_probe_one()
2938 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2081 || in qla2x00_probe_one()
2939 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2281 || in qla2x00_probe_one()
2940 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2089 || in qla2x00_probe_one()
2941 pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2289) { in qla2x00_probe_one()
2971 ha->pdev = pdev; in qla2x00_probe_one()
2972 INIT_LIST_HEAD(&ha->tgt.q_full_list); in qla2x00_probe_one()
2973 spin_lock_init(&ha->tgt.q_full_lock); in qla2x00_probe_one()
2974 spin_lock_init(&ha->tgt.sess_lock); in qla2x00_probe_one()
2975 spin_lock_init(&ha->tgt.atio_lock); in qla2x00_probe_one()
2977 spin_lock_init(&ha->sadb_lock); in qla2x00_probe_one()
2978 INIT_LIST_HEAD(&ha->sadb_tx_index_list); in qla2x00_probe_one()
2979 INIT_LIST_HEAD(&ha->sadb_rx_index_list); in qla2x00_probe_one()
2981 spin_lock_init(&ha->sadb_fp_lock); in qla2x00_probe_one()
2988 atomic_set(&ha->nvme_active_aen_cnt, 0); in qla2x00_probe_one()
2991 ha->bars = bars; in qla2x00_probe_one()
2992 ha->mem_only = mem_only; in qla2x00_probe_one()
2993 spin_lock_init(&ha->hardware_lock); in qla2x00_probe_one()
2994 spin_lock_init(&ha->vport_slock); in qla2x00_probe_one()
2995 mutex_init(&ha->selflogin_lock); in qla2x00_probe_one()
2996 mutex_init(&ha->optrom_mutex); in qla2x00_probe_one()
2998 /* Set ISP-type information. */ in qla2x00_probe_one()
3004 pdev->needs_freset = 1; in qla2x00_probe_one()
3006 ha->prev_topology = 0; in qla2x00_probe_one()
3007 ha->init_cb_size = sizeof(init_cb_t); in qla2x00_probe_one()
3008 ha->link_data_rate = PORT_SPEED_UNKNOWN; in qla2x00_probe_one()
3009 ha->optrom_size = OPTROM_SIZE_2300; in qla2x00_probe_one()
3010 ha->max_exchg = FW_MAX_EXCHANGES_CNT; in qla2x00_probe_one()
3011 atomic_set(&ha->num_pend_mbx_stage1, 0); in qla2x00_probe_one()
3012 atomic_set(&ha->num_pend_mbx_stage2, 0); in qla2x00_probe_one()
3013 atomic_set(&ha->zio_threshold, DEFAULT_ZIO_THRESHOLD); in qla2x00_probe_one()
3014 ha->last_zio_threshold = DEFAULT_ZIO_THRESHOLD; in qla2x00_probe_one()
3015 INIT_LIST_HEAD(&ha->tmf_pending); in qla2x00_probe_one()
3016 INIT_LIST_HEAD(&ha->tmf_active); in qla2x00_probe_one()
3020 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3021 ha->mbx_count = MAILBOX_REGISTER_COUNT_2100; in qla2x00_probe_one()
3024 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3025 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3026 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3027 ha->flash_data_off = ~0; in qla2x00_probe_one()
3028 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3029 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3030 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3032 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3033 ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; in qla2x00_probe_one()
3036 ha->max_loop_id = SNS_LAST_LOOP_ID_2100; in qla2x00_probe_one()
3037 ha->gid_list_info_size = 4; in qla2x00_probe_one()
3038 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3039 ha->flash_data_off = ~0; in qla2x00_probe_one()
3040 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3041 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3042 ha->isp_ops = &qla2100_isp_ops; in qla2x00_probe_one()
3044 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2100; in qla2x00_probe_one()
3045 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3048 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3049 ha->gid_list_info_size = 6; in qla2x00_probe_one()
3051 ha->optrom_size = OPTROM_SIZE_2322; in qla2x00_probe_one()
3052 ha->flash_conf_off = ~0; in qla2x00_probe_one()
3053 ha->flash_data_off = ~0; in qla2x00_probe_one()
3054 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3055 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3056 ha->isp_ops = &qla2300_isp_ops; in qla2x00_probe_one()
3058 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3059 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3062 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3063 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3064 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3065 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3066 ha->optrom_size = OPTROM_SIZE_24XX; in qla2x00_probe_one()
3067 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA24XX; in qla2x00_probe_one()
3068 ha->isp_ops = &qla24xx_isp_ops; in qla2x00_probe_one()
3069 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3070 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3071 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3072 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3074 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3075 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3078 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3079 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3080 ha->init_cb_size = sizeof(struct mid_init_cb_24xx); in qla2x00_probe_one()
3081 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3082 ha->optrom_size = OPTROM_SIZE_25XX; in qla2x00_probe_one()
3083 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3084 ha->isp_ops = &qla25xx_isp_ops; in qla2x00_probe_one()
3085 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3086 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3087 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3088 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3090 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3091 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3094 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3095 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3096 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3097 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3098 ha->optrom_size = OPTROM_SIZE_81XX; in qla2x00_probe_one()
3099 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3100 ha->isp_ops = &qla81xx_isp_ops; in qla2x00_probe_one()
3101 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3102 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3103 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3104 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3106 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3107 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3110 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3111 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3112 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3113 ha->optrom_size = OPTROM_SIZE_82XX; in qla2x00_probe_one()
3114 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3115 ha->isp_ops = &qla82xx_isp_ops; in qla2x00_probe_one()
3116 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3117 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3118 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3119 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3121 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3122 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3125 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3126 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3127 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3128 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3129 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3130 ha->isp_ops = &qla8044_isp_ops; in qla2x00_probe_one()
3131 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; in qla2x00_probe_one()
3132 ha->flash_data_off = FARX_ACCESS_FLASH_DATA; in qla2x00_probe_one()
3133 ha->nvram_conf_off = FARX_ACCESS_NVRAM_CONF; in qla2x00_probe_one()
3134 ha->nvram_data_off = FARX_ACCESS_NVRAM_DATA; in qla2x00_probe_one()
3136 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3137 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3138 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3141 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3142 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3143 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3144 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3145 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3146 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3147 ha->isp_ops = &qla83xx_isp_ops; in qla2x00_probe_one()
3148 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3149 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3150 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3151 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3153 ha->max_fibre_devices = MAX_FIBRE_DEVICES_FX00; in qla2x00_probe_one()
3154 ha->mbx_count = MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3155 ha->aen_mbx_count = AEN_MAILBOX_REGISTER_COUNT_FX00; in qla2x00_probe_one()
3158 ha->isp_ops = &qlafx00_isp_ops; in qla2x00_probe_one()
3159 ha->port_down_retry_count = 30; /* default value */ in qla2x00_probe_one()
3160 ha->mr.fw_hbt_cnt = QLAFX00_HEARTBEAT_INTERVAL; in qla2x00_probe_one()
3161 ha->mr.fw_reset_timer_tick = QLAFX00_RESET_INTERVAL; in qla2x00_probe_one()
3162 ha->mr.fw_critemp_timer_tick = QLAFX00_CRITEMP_INTERVAL; in qla2x00_probe_one()
3163 ha->mr.fw_hbt_en = 1; in qla2x00_probe_one()
3164 ha->mr.host_info_resend = false; in qla2x00_probe_one()
3165 ha->mr.hinfo_resend_timer_tick = QLAFX00_HINFO_RESEND_INTERVAL; in qla2x00_probe_one()
3167 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3168 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3169 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3172 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3173 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3174 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3175 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3176 ha->optrom_size = OPTROM_SIZE_83XX; in qla2x00_probe_one()
3177 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3178 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3179 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_81XX; in qla2x00_probe_one()
3180 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_81XX; in qla2x00_probe_one()
3181 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3182 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3184 ha->portnum = PCI_FUNC(ha->pdev->devfn); in qla2x00_probe_one()
3185 ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400; in qla2x00_probe_one()
3186 ha->mbx_count = MAILBOX_REGISTER_COUNT; in qla2x00_probe_one()
3189 ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX; in qla2x00_probe_one()
3190 ha->max_loop_id = SNS_LAST_LOOP_ID_2300; in qla2x00_probe_one()
3191 ha->init_cb_size = sizeof(struct mid_init_cb_81xx); in qla2x00_probe_one()
3192 ha->gid_list_info_size = 8; in qla2x00_probe_one()
3193 ha->optrom_size = OPTROM_SIZE_28XX; in qla2x00_probe_one()
3194 ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; in qla2x00_probe_one()
3195 ha->isp_ops = &qla27xx_isp_ops; in qla2x00_probe_one()
3196 ha->flash_conf_off = FARX_ACCESS_FLASH_CONF_28XX; in qla2x00_probe_one()
3197 ha->flash_data_off = FARX_ACCESS_FLASH_DATA_28XX; in qla2x00_probe_one()
3198 ha->nvram_conf_off = ~0; in qla2x00_probe_one()
3199 ha->nvram_data_off = ~0; in qla2x00_probe_one()
3207 ha->mbx_count, req_length, rsp_length, ha->max_loop_id, in qla2x00_probe_one()
3208 ha->init_cb_size, ha->gid_list_info_size, ha->optrom_size, in qla2x00_probe_one()
3209 ha->nvram_npiv_size, ha->max_fibre_devices); in qla2x00_probe_one()
3213 ha->isp_ops, ha->flash_conf_off, ha->flash_data_off, in qla2x00_probe_one()
3214 ha->nvram_conf_off, ha->nvram_data_off); in qla2x00_probe_one()
3217 ret = ha->isp_ops->iospace_config(ha); in qla2x00_probe_one()
3223 pdev->device, pdev->irq, ha->iobase); in qla2x00_probe_one()
3224 mutex_init(&ha->vport_lock); in qla2x00_probe_one()
3225 mutex_init(&ha->mq_lock); in qla2x00_probe_one()
3226 init_completion(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3227 complete(&ha->mbx_cmd_comp); in qla2x00_probe_one()
3228 init_completion(&ha->mbx_intr_comp); in qla2x00_probe_one()
3229 init_completion(&ha->dcbx_comp); in qla2x00_probe_one()
3230 init_completion(&ha->lb_portup_comp); in qla2x00_probe_one()
3232 set_bit(0, (unsigned long *) ha->vp_idx_map); in qla2x00_probe_one()
3237 ha->flags.enable_64bit_addressing ? "enable" : in qla2x00_probe_one()
3247 req->max_q_depth = MAX_Q_DEPTH; in qla2x00_probe_one()
3249 req->max_q_depth = ql2xmaxqdepth; in qla2x00_probe_one()
3254 ret = -ENOMEM; in qla2x00_probe_one()
3259 set_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3261 host = base_vha->host; in qla2x00_probe_one()
3262 base_vha->req = req; in qla2x00_probe_one()
3264 base_vha->mgmt_svr_loop_id = in qla2x00_probe_one()
3267 base_vha->mgmt_svr_loop_id = MANAGEMENT_SERVER + in qla2x00_probe_one()
3268 base_vha->vp_idx; in qla2x00_probe_one()
3271 ha->mr.fcport.vha = base_vha; in qla2x00_probe_one()
3272 ha->mr.fcport.port_type = FCT_UNKNOWN; in qla2x00_probe_one()
3273 ha->mr.fcport.loop_id = FC_NO_LOOP_ID; in qla2x00_probe_one()
3274 qla2x00_set_fcport_state(&ha->mr.fcport, FCS_UNCONFIGURED); in qla2x00_probe_one()
3275 ha->mr.fcport.supported_classes = FC_COS_UNSPECIFIED; in qla2x00_probe_one()
3276 ha->mr.fcport.scan_state = 1; in qla2x00_probe_one()
3285 host->sg_tablesize = 32; in qla2x00_probe_one()
3288 host->sg_tablesize = QLA_SG_ALL; in qla2x00_probe_one()
3290 host->max_id = ha->max_fibre_devices; in qla2x00_probe_one()
3291 host->cmd_per_lun = 3; in qla2x00_probe_one()
3292 host->unique_id = host->host_no; in qla2x00_probe_one()
3301 host->max_cmd_len = 32; in qla2x00_probe_one()
3303 host->max_cmd_len = MAX_CMDSZ; in qla2x00_probe_one()
3304 host->max_channel = MAX_BUSES - 1; in qla2x00_probe_one()
3305 /* Older HBAs support only 16-bit LUNs */ in qla2x00_probe_one()
3308 host->max_lun = 0xffff; in qla2x00_probe_one()
3310 host->max_lun = ql2xmaxlun; in qla2x00_probe_one()
3311 host->transportt = qla2xxx_transport_template; in qla2x00_probe_one()
3312 sht->vendor_id = (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC); in qla2x00_probe_one()
3317 "max_lun=%llu transportt=%p, vendor_id=%llu.\n", host->max_id, in qla2x00_probe_one()
3318 host->this_id, host->cmd_per_lun, host->unique_id, in qla2x00_probe_one()
3319 host->max_cmd_len, host->max_channel, host->max_lun, in qla2x00_probe_one()
3320 host->transportt, sht->vendor_id); in qla2x00_probe_one()
3322 INIT_WORK(&ha->heartbeat_work, qla_heartbeat_work_fn); in qla2x00_probe_one()
3335 ret = -ENODEV; in qla2x00_probe_one()
3339 if (ha->mqenable) { in qla2x00_probe_one()
3340 /* number of hardware queues supported by blk/scsi-mq*/ in qla2x00_probe_one()
3341 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3344 "blk/scsi-mq enabled, HW queues = %d.\n", host->nr_hw_queues); in qla2x00_probe_one()
3347 host->nr_hw_queues = ha->max_qpairs; in qla2x00_probe_one()
3349 "FC-NVMe support is enabled, HW queues=%d\n", in qla2x00_probe_one()
3350 host->nr_hw_queues); in qla2x00_probe_one()
3353 "blk/scsi-mq disabled.\n"); in qla2x00_probe_one()
3362 rsp->req = req; in qla2x00_probe_one()
3363 req->rsp = rsp; in qla2x00_probe_one()
3366 ha->rsp_q_map[0] = rsp; in qla2x00_probe_one()
3367 ha->req_q_map[0] = req; in qla2x00_probe_one()
3368 set_bit(0, ha->req_qid_map); in qla2x00_probe_one()
3369 set_bit(0, ha->rsp_qid_map); in qla2x00_probe_one()
3372 /* FWI2-capable only. */ in qla2x00_probe_one()
3373 req->req_q_in = &ha->iobase->isp24.req_q_in; in qla2x00_probe_one()
3374 req->req_q_out = &ha->iobase->isp24.req_q_out; in qla2x00_probe_one()
3375 rsp->rsp_q_in = &ha->iobase->isp24.rsp_q_in; in qla2x00_probe_one()
3376 rsp->rsp_q_out = &ha->iobase->isp24.rsp_q_out; in qla2x00_probe_one()
3377 if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || in qla2x00_probe_one()
3379 req->req_q_in = &ha->mqiobase->isp25mq.req_q_in; in qla2x00_probe_one()
3380 req->req_q_out = &ha->mqiobase->isp25mq.req_q_out; in qla2x00_probe_one()
3381 rsp->rsp_q_in = &ha->mqiobase->isp25mq.rsp_q_in; in qla2x00_probe_one()
3382 rsp->rsp_q_out = &ha->mqiobase->isp25mq.rsp_q_out; in qla2x00_probe_one()
3386 req->req_q_in = &ha->iobase->ispfx00.req_q_in; in qla2x00_probe_one()
3387 req->req_q_out = &ha->iobase->ispfx00.req_q_out; in qla2x00_probe_one()
3388 rsp->rsp_q_in = &ha->iobase->ispfx00.rsp_q_in; in qla2x00_probe_one()
3389 rsp->rsp_q_out = &ha->iobase->ispfx00.rsp_q_out; in qla2x00_probe_one()
3393 req->req_q_out = &ha->iobase->isp82.req_q_out[0]; in qla2x00_probe_one()
3394 rsp->rsp_q_in = &ha->iobase->isp82.rsp_q_in[0]; in qla2x00_probe_one()
3395 rsp->rsp_q_out = &ha->iobase->isp82.rsp_q_out[0]; in qla2x00_probe_one()
3399 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3400 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3402 "req->req_q_in=%p req->req_q_out=%p " in qla2x00_probe_one()
3403 "rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3404 req->req_q_in, req->req_q_out, in qla2x00_probe_one()
3405 rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3407 "rsp_q_map=%p req_q_map=%p rsp->req=%p req->rsp=%p.\n", in qla2x00_probe_one()
3408 ha->rsp_q_map, ha->req_q_map, rsp->req, req->rsp); in qla2x00_probe_one()
3410 "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", in qla2x00_probe_one()
3411 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); in qla2x00_probe_one()
3413 ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); in qla2x00_probe_one()
3414 if (unlikely(!ha->wq)) { in qla2x00_probe_one()
3415 ret = -ENOMEM; in qla2x00_probe_one()
3419 if (ha->isp_ops->initialize_adapter(base_vha)) { in qla2x00_probe_one()
3421 "Failed to initialize adapter - Adapter flags %x.\n", in qla2x00_probe_one()
3422 base_vha->device_flags); in qla2x00_probe_one()
3441 ret = -ENODEV; in qla2x00_probe_one()
3446 host->can_queue = QLAFX00_MAX_CANQUEUE; in qla2x00_probe_one()
3448 host->can_queue = req->num_outstanding_cmds - 10; in qla2x00_probe_one()
3452 host->can_queue, base_vha->req, in qla2x00_probe_one()
3453 base_vha->mgmt_svr_loop_id, host->sg_tablesize); in qla2x00_probe_one()
3456 if (IS_QLA25XX(ha) && !(ha->fw_attributes & BIT_6)) in qla2x00_probe_one()
3457 ha->mqenable = 0; in qla2x00_probe_one()
3459 if (ha->mqenable) { in qla2x00_probe_one()
3469 for (i = 0; i < ha->max_qpairs; i++) in qla2x00_probe_one()
3474 if (ha->flags.running_gold_fw) in qla2x00_probe_one()
3480 ha->dpc_thread = kthread_create(qla2x00_do_dpc, ha, in qla2x00_probe_one()
3481 "%s_dpc", base_vha->host_str); in qla2x00_probe_one()
3482 if (IS_ERR(ha->dpc_thread)) { in qla2x00_probe_one()
3485 ret = PTR_ERR(ha->dpc_thread); in qla2x00_probe_one()
3486 ha->dpc_thread = NULL; in qla2x00_probe_one()
3500 INIT_WORK(&ha->board_disable, qla2x00_disable_board_on_pci_error); in qla2x00_probe_one()
3503 sprintf(wq_name, "qla2xxx_%lu_dpc_lp_wq", base_vha->host_no); in qla2x00_probe_one()
3504 ha->dpc_lp_wq = in qla2x00_probe_one()
3506 INIT_WORK(&ha->idc_aen, qla83xx_service_idc_aen); in qla2x00_probe_one()
3508 sprintf(wq_name, "qla2xxx_%lu_dpc_hp_wq", base_vha->host_no); in qla2x00_probe_one()
3509 ha->dpc_hp_wq = in qla2x00_probe_one()
3511 INIT_WORK(&ha->nic_core_reset, qla83xx_nic_core_reset_work); in qla2x00_probe_one()
3512 INIT_WORK(&ha->idc_state_handler, in qla2x00_probe_one()
3514 INIT_WORK(&ha->nic_core_unrecoverable, in qla2x00_probe_one()
3519 list_add_tail(&base_vha->list, &ha->vp_list); in qla2x00_probe_one()
3520 base_vha->host->irq = ha->pdev->irq; in qla2x00_probe_one()
3532 if (ha->fw_attributes & BIT_4) { in qla2x00_probe_one()
3535 base_vha->flags.difdix_supported = 1; in qla2x00_probe_one()
3560 base_vha->flags.difdix_supported = 0; in qla2x00_probe_one()
3563 ha->isp_ops->enable_intrs(ha); in qla2x00_probe_one()
3567 &base_vha->hw->mr.fcport, FXDISC_GET_CONFIG_INFO); in qla2x00_probe_one()
3568 host->sg_tablesize = (ha->mr.extended_io_enabled) ? in qla2x00_probe_one()
3572 if (IS_T10_PI_CAPABLE(base_vha->hw)) in qla2x00_probe_one()
3573 host->dma_alignment = 0x7; in qla2x00_probe_one()
3575 ret = scsi_add_host(host, &pdev->dev); in qla2x00_probe_one()
3579 base_vha->flags.init_done = 1; in qla2x00_probe_one()
3580 base_vha->flags.online = 1; in qla2x00_probe_one()
3581 ha->prev_minidump_failed = 0; in qla2x00_probe_one()
3591 "skipping scsi_scan_host() for non-initiator port\n"); in qla2x00_probe_one()
3597 &base_vha->hw->mr.fcport, FXDISC_GET_PORT_INFO); in qla2x00_probe_one()
3601 &base_vha->hw->mr.fcport, FXDISC_REG_HOST_INFO); in qla2x00_probe_one()
3609 "QLogic %s - %s.\n", ha->model_number, ha->model_desc); in qla2x00_probe_one()
3612 pdev->device, ha->isp_ops->pci_info_str(base_vha, pci_info, in qla2x00_probe_one()
3614 pci_name(pdev), ha->flags.enable_64bit_addressing ? '+' : '-', in qla2x00_probe_one()
3615 base_vha->host_no, in qla2x00_probe_one()
3616 ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str))); in qla2x00_probe_one()
3620 clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags); in qla2x00_probe_one()
3622 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_probe_one()
3623 return -ENODEV; in qla2x00_probe_one()
3630 vfree(base_vha->scan.l); in qla2x00_probe_one()
3631 if (base_vha->gnl.l) { in qla2x00_probe_one()
3632 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_probe_one()
3633 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_probe_one()
3634 base_vha->gnl.l = NULL; in qla2x00_probe_one()
3637 if (base_vha->timer_active) in qla2x00_probe_one()
3639 base_vha->flags.online = 0; in qla2x00_probe_one()
3640 if (ha->dpc_thread) { in qla2x00_probe_one()
3641 struct task_struct *t = ha->dpc_thread; in qla2x00_probe_one()
3643 ha->dpc_thread = NULL; in qla2x00_probe_one()
3648 scsi_host_put(base_vha->host); in qla2x00_probe_one()
3666 if (!ha->nx_pcibase) in qla2x00_probe_one()
3667 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_probe_one()
3669 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_probe_one()
3671 if (ha->iobase) in qla2x00_probe_one()
3672 iounmap(ha->iobase); in qla2x00_probe_one()
3673 if (ha->cregbase) in qla2x00_probe_one()
3674 iounmap(ha->cregbase); in qla2x00_probe_one()
3676 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_probe_one()
3693 ha = base_vha->hw; in __qla_set_remove_flag()
3695 spin_lock_irqsave(&ha->vport_slock, flags); in __qla_set_remove_flag()
3696 list_for_each_entry(vp, &ha->vp_list, list) in __qla_set_remove_flag()
3697 set_bit(PFLG_DRIVER_REMOVING, &vp->pci_flags); in __qla_set_remove_flag()
3703 set_bit(PFLG_DRIVER_REMOVING, &base_vha->pci_flags); in __qla_set_remove_flag()
3704 spin_unlock_irqrestore(&ha->vport_slock, flags); in __qla_set_remove_flag()
3714 ha = vha->hw; in qla2x00_shutdown()
3724 cancel_work_sync(&ha->board_disable); in qla2x00_shutdown()
3726 if (!atomic_read(&pdev->enable_cnt)) in qla2x00_shutdown()
3733 /* Turn-off FCE trace */ in qla2x00_shutdown()
3734 if (ha->flags.fce_enabled) { in qla2x00_shutdown()
3736 ha->flags.fce_enabled = 0; in qla2x00_shutdown()
3739 /* Turn-off EFT trace */ in qla2x00_shutdown()
3740 if (ha->eft) in qla2x00_shutdown()
3745 if (ha->flags.fw_started) in qla2x00_shutdown()
3753 if (vha->timer_active) in qla2x00_shutdown()
3757 vha->flags.online = 0; in qla2x00_shutdown()
3759 /* turn-off interrupts on the card */ in qla2x00_shutdown()
3760 if (ha->interrupts_on) { in qla2x00_shutdown()
3761 vha->flags.init_done = 0; in qla2x00_shutdown()
3762 ha->isp_ops->disable_intrs(ha); in qla2x00_shutdown()
3781 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3782 while (ha->cur_vport_count) { in qla2x00_delete_all_vps()
3783 spin_lock_irqsave(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3785 BUG_ON(base_vha->list.next == &ha->vp_list); in qla2x00_delete_all_vps()
3786 /* This assumes first entry in ha->vp_list is always base vha */ in qla2x00_delete_all_vps()
3787 vha = list_first_entry(&base_vha->list, scsi_qla_host_t, list); in qla2x00_delete_all_vps()
3788 scsi_host_get(vha->host); in qla2x00_delete_all_vps()
3790 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla2x00_delete_all_vps()
3791 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3795 fc_vport_terminate(vha->fc_vport); in qla2x00_delete_all_vps()
3796 scsi_host_put(vha->host); in qla2x00_delete_all_vps()
3798 mutex_lock(&ha->vport_lock); in qla2x00_delete_all_vps()
3800 mutex_unlock(&ha->vport_lock); in qla2x00_delete_all_vps()
3808 if (ha->dpc_lp_wq) { in qla2x00_destroy_deferred_work()
3809 cancel_work_sync(&ha->idc_aen); in qla2x00_destroy_deferred_work()
3810 destroy_workqueue(ha->dpc_lp_wq); in qla2x00_destroy_deferred_work()
3811 ha->dpc_lp_wq = NULL; in qla2x00_destroy_deferred_work()
3814 if (ha->dpc_hp_wq) { in qla2x00_destroy_deferred_work()
3815 cancel_work_sync(&ha->nic_core_reset); in qla2x00_destroy_deferred_work()
3816 cancel_work_sync(&ha->idc_state_handler); in qla2x00_destroy_deferred_work()
3817 cancel_work_sync(&ha->nic_core_unrecoverable); in qla2x00_destroy_deferred_work()
3818 destroy_workqueue(ha->dpc_hp_wq); in qla2x00_destroy_deferred_work()
3819 ha->dpc_hp_wq = NULL; in qla2x00_destroy_deferred_work()
3823 if (ha->dpc_thread) { in qla2x00_destroy_deferred_work()
3824 struct task_struct *t = ha->dpc_thread; in qla2x00_destroy_deferred_work()
3827 * qla2xxx_wake_dpc checks for ->dpc_thread in qla2x00_destroy_deferred_work()
3830 ha->dpc_thread = NULL; in qla2x00_destroy_deferred_work()
3840 iounmap((device_reg_t *)ha->nx_pcibase); in qla2x00_unmap_iobases()
3842 iounmap((device_reg_t *)ha->nxdb_wr_ptr); in qla2x00_unmap_iobases()
3844 if (ha->iobase) in qla2x00_unmap_iobases()
3845 iounmap(ha->iobase); in qla2x00_unmap_iobases()
3847 if (ha->cregbase) in qla2x00_unmap_iobases()
3848 iounmap(ha->cregbase); in qla2x00_unmap_iobases()
3850 if (ha->mqiobase) in qla2x00_unmap_iobases()
3851 iounmap(ha->mqiobase); in qla2x00_unmap_iobases()
3853 if (ha->msixbase) in qla2x00_unmap_iobases()
3854 iounmap(ha->msixbase); in qla2x00_unmap_iobases()
3879 ha = base_vha->hw; in qla2x00_remove_one()
3883 cancel_work_sync(&ha->board_disable); in qla2x00_remove_one()
3886 * If the PCI device is disabled then there was a PCI-disconnect and in qla2x00_remove_one()
3890 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_remove_one()
3891 dma_free_coherent(&ha->pdev->dev, base_vha->gnl.size, in qla2x00_remove_one()
3892 base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3893 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3894 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3905 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_remove_one()
3910 if (ha->flags.fw_started) in qla2x00_remove_one()
3918 "Error while clearing DRV-Presence.\n"); in qla2x00_remove_one()
3928 dma_free_coherent(&ha->pdev->dev, in qla2x00_remove_one()
3929 base_vha->gnl.size, base_vha->gnl.l, base_vha->gnl.ldma); in qla2x00_remove_one()
3931 base_vha->gnl.l = NULL; in qla2x00_remove_one()
3935 vfree(base_vha->scan.l); in qla2x00_remove_one()
3947 if (base_vha->timer_active) in qla2x00_remove_one()
3950 base_vha->flags.online = 0; in qla2x00_remove_one()
3953 if (ha->exlogin_buf) in qla2x00_remove_one()
3957 if (ha->exchoffld_buf) in qla2x00_remove_one()
3966 fc_remove_host(base_vha->host); in qla2x00_remove_one()
3968 scsi_remove_host(base_vha->host); in qla2x00_remove_one()
3974 scsi_host_put(base_vha->host); in qla2x00_remove_one()
3978 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_remove_one()
3990 spin_lock_irqsave(&list->lock, flags); in qla24xx_free_purex_list()
3991 list_for_each_entry_safe(item, next, &list->head, list) { in qla24xx_free_purex_list()
3992 list_del(&item->list); in qla24xx_free_purex_list()
3993 if (item == &item->vha->default_item) in qla24xx_free_purex_list()
3997 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_free_purex_list()
4003 struct qla_hw_data *ha = vha->hw; in qla2x00_free_device()
4008 if (vha->timer_active) in qla2x00_free_device()
4012 vha->flags.online = 0; in qla2x00_free_device()
4014 /* turn-off interrupts on the card */ in qla2x00_free_device()
4015 if (ha->interrupts_on) { in qla2x00_free_device()
4016 vha->flags.init_done = 0; in qla2x00_free_device()
4017 ha->isp_ops->disable_intrs(ha); in qla2x00_free_device()
4025 if (ha->wq) { in qla2x00_free_device()
4026 destroy_workqueue(ha->wq); in qla2x00_free_device()
4027 ha->wq = NULL; in qla2x00_free_device()
4031 qla24xx_free_purex_list(&vha->purex_list); in qla2x00_free_device()
4047 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) in qla2x00_free_fcports()
4056 if (!fcport->rport) in qla2x00_schedule_rport_del()
4059 if (fcport->rport) { in qla2x00_schedule_rport_del()
4060 ql_dbg(ql_dbg_disc, fcport->vha, 0x2109, in qla2x00_schedule_rport_del()
4062 __func__, fcport->port_name, fcport->rport, in qla2x00_schedule_rport_del()
4063 fcport->rport->roles); in qla2x00_schedule_rport_del()
4064 fc_remote_port_delete(fcport->rport); in qla2x00_schedule_rport_del()
4081 if (IS_QLAFX00(vha->hw)) { in qla2x00_mark_device_lost()
4087 if (atomic_read(&fcport->state) == FCS_ONLINE && in qla2x00_mark_device_lost()
4088 vha->vp_idx == fcport->vha->vp_idx) { in qla2x00_mark_device_lost()
4097 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) in qla2x00_mark_device_lost()
4103 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_mark_device_lost()
4114 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_mark_all_devices_lost()
4116 fcport->loop_id != FC_NO_LOOP_ID && in qla2x00_mark_all_devices_lost()
4117 (fcport->flags & FCF_FCP2_DEVICE) && in qla2x00_mark_all_devices_lost()
4118 fcport->port_type == FCT_TARGET && in qla2x00_mark_all_devices_lost()
4122 fcport->flags, fcport->port_type, in qla2x00_mark_all_devices_lost()
4123 fcport->d_id.b24, fcport->port_name); in qla2x00_mark_all_devices_lost()
4126 fcport->scan_state = 0; in qla2x00_mark_all_devices_lost()
4139 set_bit(i, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4140 set_bit(MANAGEMENT_SERVER, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4141 set_bit(BROADCAST, ha->loop_id_map); in qla2x00_set_reserved_loop_ids()
4160 ha->vp_map = kcalloc(MAX_MULTI_ID_FABRIC, sizeof(struct qla_vp_map), GFP_KERNEL); in qla2x00_mem_alloc()
4161 if (!ha->vp_map) in qla2x00_mem_alloc()
4165 ha->init_cb = dma_alloc_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_alloc()
4166 &ha->init_cb_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4167 if (!ha->init_cb) in qla2x00_mem_alloc()
4170 rc = btree_init32(&ha->host_map); in qla2x00_mem_alloc()
4177 ha->gid_list = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4178 qla2x00_gid_list_size(ha), &ha->gid_list_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4179 if (!ha->gid_list) in qla2x00_mem_alloc()
4182 ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); in qla2x00_mem_alloc()
4183 if (!ha->srb_mempool) in qla2x00_mem_alloc()
4195 ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ, in qla2x00_mem_alloc()
4197 if (!ha->ctx_mempool) in qla2x00_mem_alloc()
4199 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0021, in qla2x00_mem_alloc()
4201 ctx_cachep, ha->ctx_mempool); in qla2x00_mem_alloc()
4205 ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL); in qla2x00_mem_alloc()
4206 if (!ha->nvram) in qla2x00_mem_alloc()
4210 ha->pdev->device); in qla2x00_mem_alloc()
4211 ha->s_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4213 if (!ha->s_dma_pool) in qla2x00_mem_alloc()
4216 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0022, in qla2x00_mem_alloc()
4218 ha->init_cb, ha->gid_list, ha->srb_mempool, ha->s_dma_pool); in qla2x00_mem_alloc()
4221 ha->dl_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4223 if (!ha->dl_dma_pool) { in qla2x00_mem_alloc()
4224 ql_log_pci(ql_log_fatal, ha->pdev, 0x0023, in qla2x00_mem_alloc()
4229 ha->fcp_cmnd_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4231 if (!ha->fcp_cmnd_dma_pool) { in qla2x00_mem_alloc()
4232 ql_log_pci(ql_log_fatal, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4242 ha->dif_bundl_pool = dma_pool_create(name, in qla2x00_mem_alloc()
4243 &ha->pdev->dev, DIF_BUNDLING_DMA_POOL_SIZE, 8, 0); in qla2x00_mem_alloc()
4244 if (!ha->dif_bundl_pool) { in qla2x00_mem_alloc()
4245 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4251 INIT_LIST_HEAD(&ha->pool.good.head); in qla2x00_mem_alloc()
4252 INIT_LIST_HEAD(&ha->pool.unusable.head); in qla2x00_mem_alloc()
4253 ha->pool.good.count = 0; in qla2x00_mem_alloc()
4254 ha->pool.unusable.count = 0; in qla2x00_mem_alloc()
4258 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4261 return -ENOMEM; in qla2x00_mem_alloc()
4263 ha->dif_bundle_kallocs++; in qla2x00_mem_alloc()
4265 dsd->dsd_addr = dma_pool_alloc( in qla2x00_mem_alloc()
4266 ha->dif_bundl_pool, GFP_ATOMIC, in qla2x00_mem_alloc()
4267 &dsd->dsd_list_dma); in qla2x00_mem_alloc()
4268 if (!dsd->dsd_addr) { in qla2x00_mem_alloc()
4269 ql_dbg_pci(ql_dbg_init, ha->pdev, in qla2x00_mem_alloc()
4271 "%s: failed alloc ->dsd_addr\n", in qla2x00_mem_alloc()
4274 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4277 ha->dif_bundle_dma_allocs++; in qla2x00_mem_alloc()
4283 if (MSD(dsd->dsd_list_dma) ^ in qla2x00_mem_alloc()
4284 MSD(dsd->dsd_list_dma + bufsize)) { in qla2x00_mem_alloc()
4285 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4286 &ha->pool.unusable.head); in qla2x00_mem_alloc()
4287 ha->pool.unusable.count++; in qla2x00_mem_alloc()
4289 list_add_tail(&dsd->list, in qla2x00_mem_alloc()
4290 &ha->pool.good.head); in qla2x00_mem_alloc()
4291 ha->pool.good.count++; in qla2x00_mem_alloc()
4297 &ha->pool.good.head, list) { in qla2x00_mem_alloc()
4298 list_del(&dsd->list); in qla2x00_mem_alloc()
4299 dma_pool_free(ha->dif_bundl_pool, in qla2x00_mem_alloc()
4300 dsd->dsd_addr, dsd->dsd_list_dma); in qla2x00_mem_alloc()
4301 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4303 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4306 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0024, in qla2x00_mem_alloc()
4308 __func__, ha->pool.good.count, in qla2x00_mem_alloc()
4309 ha->pool.unusable.count); in qla2x00_mem_alloc()
4312 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0025, in qla2x00_mem_alloc()
4314 ha->dl_dma_pool, ha->fcp_cmnd_dma_pool, in qla2x00_mem_alloc()
4315 ha->dif_bundl_pool); in qla2x00_mem_alloc()
4321 ha->sns_cmd = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4322 sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4323 if (!ha->sns_cmd) in qla2x00_mem_alloc()
4325 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0026, in qla2x00_mem_alloc()
4326 "sns_cmd: %p.\n", ha->sns_cmd); in qla2x00_mem_alloc()
4329 ha->ms_iocb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4330 &ha->ms_iocb_dma); in qla2x00_mem_alloc()
4331 if (!ha->ms_iocb) in qla2x00_mem_alloc()
4334 ha->ct_sns = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4335 sizeof(struct ct_sns_pkt), &ha->ct_sns_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4336 if (!ha->ct_sns) in qla2x00_mem_alloc()
4338 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0027, in qla2x00_mem_alloc()
4340 ha->ms_iocb, ha->ct_sns); in qla2x00_mem_alloc()
4346 ql_log_pci(ql_log_fatal, ha->pdev, 0x0028, in qla2x00_mem_alloc()
4350 (*req)->length = req_len; in qla2x00_mem_alloc()
4351 (*req)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4352 ((*req)->length + 1) * sizeof(request_t), in qla2x00_mem_alloc()
4353 &(*req)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4354 if (!(*req)->ring) { in qla2x00_mem_alloc()
4355 ql_log_pci(ql_log_fatal, ha->pdev, 0x0029, in qla2x00_mem_alloc()
4362 ql_log_pci(ql_log_fatal, ha->pdev, 0x002a, in qla2x00_mem_alloc()
4366 (*rsp)->hw = ha; in qla2x00_mem_alloc()
4367 (*rsp)->length = rsp_len; in qla2x00_mem_alloc()
4368 (*rsp)->ring = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4369 ((*rsp)->length + 1) * sizeof(response_t), in qla2x00_mem_alloc()
4370 &(*rsp)->dma, GFP_KERNEL); in qla2x00_mem_alloc()
4371 if (!(*rsp)->ring) { in qla2x00_mem_alloc()
4372 ql_log_pci(ql_log_fatal, ha->pdev, 0x002b, in qla2x00_mem_alloc()
4376 (*req)->rsp = *rsp; in qla2x00_mem_alloc()
4377 (*rsp)->req = *req; in qla2x00_mem_alloc()
4378 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002c, in qla2x00_mem_alloc()
4379 "req=%p req->length=%d req->ring=%p rsp=%p " in qla2x00_mem_alloc()
4380 "rsp->length=%d rsp->ring=%p.\n", in qla2x00_mem_alloc()
4381 *req, (*req)->length, (*req)->ring, *rsp, (*rsp)->length, in qla2x00_mem_alloc()
4382 (*rsp)->ring); in qla2x00_mem_alloc()
4384 if (ha->nvram_npiv_size) { in qla2x00_mem_alloc()
4385 ha->npiv_info = kcalloc(ha->nvram_npiv_size, in qla2x00_mem_alloc()
4388 if (!ha->npiv_info) { in qla2x00_mem_alloc()
4389 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, in qla2x00_mem_alloc()
4394 ha->npiv_info = NULL; in qla2x00_mem_alloc()
4396 /* Get consistent memory allocated for EX-INIT-CB. */ in qla2x00_mem_alloc()
4399 ha->ex_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4400 &ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4401 if (!ha->ex_init_cb) in qla2x00_mem_alloc()
4403 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002e, in qla2x00_mem_alloc()
4404 "ex_init_cb=%p.\n", ha->ex_init_cb); in qla2x00_mem_alloc()
4407 /* Get consistent memory allocated for Special Features-CB. */ in qla2x00_mem_alloc()
4409 ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4410 &ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4411 if (!ha->sf_init_cb) in qla2x00_mem_alloc()
4413 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199, in qla2x00_mem_alloc()
4414 "sf_init_cb=%p.\n", ha->sf_init_cb); in qla2x00_mem_alloc()
4418 /* Get consistent memory allocated for Async Port-Database. */ in qla2x00_mem_alloc()
4420 ha->async_pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, in qla2x00_mem_alloc()
4421 &ha->async_pd_dma); in qla2x00_mem_alloc()
4422 if (!ha->async_pd) in qla2x00_mem_alloc()
4424 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x002f, in qla2x00_mem_alloc()
4425 "async_pd=%p.\n", ha->async_pd); in qla2x00_mem_alloc()
4428 INIT_LIST_HEAD(&ha->vp_list); in qla2x00_mem_alloc()
4431 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), in qla2x00_mem_alloc()
4434 if (!ha->loop_id_map) in qla2x00_mem_alloc()
4438 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123, in qla2x00_mem_alloc()
4439 "loop_id_map=%p.\n", ha->loop_id_map); in qla2x00_mem_alloc()
4442 ha->sfp_data = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4443 SFP_DEV_SIZE, &ha->sfp_data_dma, GFP_KERNEL); in qla2x00_mem_alloc()
4444 if (!ha->sfp_data) { in qla2x00_mem_alloc()
4445 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4446 "Unable to allocate memory for SFP read-data.\n"); in qla2x00_mem_alloc()
4450 ha->flt = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4451 sizeof(struct qla_flt_header) + FLT_REGIONS_SIZE, &ha->flt_dma, in qla2x00_mem_alloc()
4453 if (!ha->flt) { in qla2x00_mem_alloc()
4454 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4460 ha->purex_dma_pool = dma_pool_create(name, &ha->pdev->dev, in qla2x00_mem_alloc()
4463 if (!ha->purex_dma_pool) { in qla2x00_mem_alloc()
4464 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011b, in qla2x00_mem_alloc()
4469 ha->elsrej.size = sizeof(struct fc_els_ls_rjt) + 16; in qla2x00_mem_alloc()
4470 ha->elsrej.c = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_mem_alloc()
4471 ha->elsrej.size, in qla2x00_mem_alloc()
4472 &ha->elsrej.cdma, in qla2x00_mem_alloc()
4474 if (!ha->elsrej.c) { in qla2x00_mem_alloc()
4475 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4479 ha->elsrej.c->er_cmd = ELS_LS_RJT; in qla2x00_mem_alloc()
4480 ha->elsrej.c->er_reason = ELS_RJT_LOGIC; in qla2x00_mem_alloc()
4481 ha->elsrej.c->er_explan = ELS_EXPL_UNAB_DATA; in qla2x00_mem_alloc()
4483 ha->lsrjt.size = sizeof(struct fcnvme_ls_rjt); in qla2x00_mem_alloc()
4484 ha->lsrjt.c = dma_alloc_coherent(&ha->pdev->dev, ha->lsrjt.size, in qla2x00_mem_alloc()
4485 &ha->lsrjt.cdma, GFP_KERNEL); in qla2x00_mem_alloc()
4486 if (!ha->lsrjt.c) { in qla2x00_mem_alloc()
4487 ql_dbg_pci(ql_dbg_init, ha->pdev, 0xffff, in qla2x00_mem_alloc()
4495 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_alloc()
4496 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_alloc()
4498 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_alloc()
4500 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4501 ha->flt, ha->flt_dma); in qla2x00_mem_alloc()
4504 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, in qla2x00_mem_alloc()
4505 ha->sfp_data, ha->sfp_data_dma); in qla2x00_mem_alloc()
4507 kfree(ha->loop_id_map); in qla2x00_mem_alloc()
4509 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_alloc()
4511 dma_pool_free(ha->s_dma_pool, ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_alloc()
4513 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_alloc()
4515 kfree(ha->npiv_info); in qla2x00_mem_alloc()
4517 dma_free_coherent(&ha->pdev->dev, ((*rsp)->length + 1) * in qla2x00_mem_alloc()
4518 sizeof(response_t), (*rsp)->ring, (*rsp)->dma); in qla2x00_mem_alloc()
4519 (*rsp)->ring = NULL; in qla2x00_mem_alloc()
4520 (*rsp)->dma = 0; in qla2x00_mem_alloc()
4525 dma_free_coherent(&ha->pdev->dev, ((*req)->length + 1) * in qla2x00_mem_alloc()
4526 sizeof(request_t), (*req)->ring, (*req)->dma); in qla2x00_mem_alloc()
4527 (*req)->ring = NULL; in qla2x00_mem_alloc()
4528 (*req)->dma = 0; in qla2x00_mem_alloc()
4533 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_alloc()
4534 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_alloc()
4535 ha->ct_sns = NULL; in qla2x00_mem_alloc()
4536 ha->ct_sns_dma = 0; in qla2x00_mem_alloc()
4538 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_alloc()
4539 ha->ms_iocb = NULL; in qla2x00_mem_alloc()
4540 ha->ms_iocb_dma = 0; in qla2x00_mem_alloc()
4542 if (ha->sns_cmd) in qla2x00_mem_alloc()
4543 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_alloc()
4544 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_alloc()
4549 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_alloc()
4551 list_del(&dsd->list); in qla2x00_mem_alloc()
4552 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_alloc()
4553 dsd->dsd_list_dma); in qla2x00_mem_alloc()
4554 ha->dif_bundle_dma_allocs--; in qla2x00_mem_alloc()
4556 ha->dif_bundle_kallocs--; in qla2x00_mem_alloc()
4557 ha->pool.unusable.count--; in qla2x00_mem_alloc()
4559 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_alloc()
4560 ha->dif_bundl_pool = NULL; in qla2x00_mem_alloc()
4565 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_alloc()
4566 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_alloc()
4570 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_alloc()
4571 ha->dl_dma_pool = NULL; in qla2x00_mem_alloc()
4574 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_alloc()
4575 ha->s_dma_pool = NULL; in qla2x00_mem_alloc()
4577 kfree(ha->nvram); in qla2x00_mem_alloc()
4578 ha->nvram = NULL; in qla2x00_mem_alloc()
4580 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_alloc()
4581 ha->ctx_mempool = NULL; in qla2x00_mem_alloc()
4583 mempool_destroy(ha->srb_mempool); in qla2x00_mem_alloc()
4584 ha->srb_mempool = NULL; in qla2x00_mem_alloc()
4586 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_alloc()
4587 ha->gid_list, in qla2x00_mem_alloc()
4588 ha->gid_list_dma); in qla2x00_mem_alloc()
4589 ha->gid_list = NULL; in qla2x00_mem_alloc()
4590 ha->gid_list_dma = 0; in qla2x00_mem_alloc()
4594 btree_destroy32(&ha->host_map); in qla2x00_mem_alloc()
4596 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, ha->init_cb, in qla2x00_mem_alloc()
4597 ha->init_cb_dma); in qla2x00_mem_alloc()
4598 ha->init_cb = NULL; in qla2x00_mem_alloc()
4599 ha->init_cb_dma = 0; in qla2x00_mem_alloc()
4601 kfree(ha->vp_map); in qla2x00_mem_alloc()
4602 ha->vp_map = NULL; in qla2x00_mem_alloc()
4606 return -ENOMEM; in qla2x00_mem_alloc()
4615 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exlogins_buffer()
4628 ql_log_pci(ql_log_fatal, ha->pdev, 0xd029, in qla2x00_set_exlogins_buffer()
4636 if (temp != ha->exlogin_size) { in qla2x00_set_exlogins_buffer()
4638 ha->exlogin_size = temp; in qla2x00_set_exlogins_buffer()
4645 "EXLOGIN: requested size=0x%x\n", ha->exlogin_size); in qla2x00_set_exlogins_buffer()
4648 ha->exlogin_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exlogins_buffer()
4649 ha->exlogin_size, &ha->exlogin_buf_dma, GFP_KERNEL); in qla2x00_set_exlogins_buffer()
4650 if (!ha->exlogin_buf) { in qla2x00_set_exlogins_buffer()
4651 ql_log_pci(ql_log_fatal, ha->pdev, 0xd02a, in qla2x00_set_exlogins_buffer()
4653 return -ENOMEM; in qla2x00_set_exlogins_buffer()
4658 rval = qla_set_exlogin_mem_cfg(vha, ha->exlogin_buf_dma); in qla2x00_set_exlogins_buffer()
4677 if (ha->exlogin_buf) { in qla2x00_free_exlogin_buffer()
4678 dma_free_coherent(&ha->pdev->dev, ha->exlogin_size, in qla2x00_free_exlogin_buffer()
4679 ha->exlogin_buf, ha->exlogin_buf_dma); in qla2x00_free_exlogin_buffer()
4680 ha->exlogin_buf = NULL; in qla2x00_free_exlogin_buffer()
4681 ha->exlogin_size = 0; in qla2x00_free_exlogin_buffer()
4689 struct init_cb_81xx *icb = (struct init_cb_81xx *)vha->hw->init_cb; in qla2x00_number_of_exch()
4692 if (max_cnt > vha->hw->max_exchg) in qla2x00_number_of_exch()
4693 max_cnt = vha->hw->max_exchg; in qla2x00_number_of_exch()
4696 if (vha->ql2xiniexchg > max_cnt) in qla2x00_number_of_exch()
4697 vha->ql2xiniexchg = max_cnt; in qla2x00_number_of_exch()
4699 if (vha->ql2xiniexchg > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4700 *ret_cnt = vha->ql2xiniexchg; in qla2x00_number_of_exch()
4703 if (vha->ql2xexchoffld > max_cnt) { in qla2x00_number_of_exch()
4704 vha->ql2xexchoffld = max_cnt; in qla2x00_number_of_exch()
4705 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4708 if (vha->ql2xexchoffld > FW_DEF_EXCHANGES_CNT) in qla2x00_number_of_exch()
4709 *ret_cnt = vha->ql2xexchoffld; in qla2x00_number_of_exch()
4711 temp = vha->ql2xiniexchg + vha->ql2xexchoffld; in qla2x00_number_of_exch()
4713 vha->ql2xiniexchg -= (temp - max_cnt)/2; in qla2x00_number_of_exch()
4714 vha->ql2xexchoffld -= (((temp - max_cnt)/2) + 1); in qla2x00_number_of_exch()
4716 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_number_of_exch()
4730 struct qla_hw_data *ha = vha->hw; in qla2x00_set_exchoffld_buffer()
4732 if (!ha->flags.exchoffld_enabled) in qla2x00_set_exchoffld_buffer()
4741 ql_log_pci(ql_log_fatal, ha->pdev, 0xd012, in qla2x00_set_exchoffld_buffer()
4752 if (totsz != ha->exchoffld_size) { in qla2x00_set_exchoffld_buffer()
4755 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4756 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4760 ha->exchoffld_size = totsz; in qla2x00_set_exchoffld_buffer()
4768 ha->exchoffld_size); in qla2x00_set_exchoffld_buffer()
4771 ha->exchoffld_buf = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_set_exchoffld_buffer()
4772 ha->exchoffld_size, &ha->exchoffld_buf_dma, GFP_KERNEL); in qla2x00_set_exchoffld_buffer()
4773 if (!ha->exchoffld_buf) { in qla2x00_set_exchoffld_buffer()
4774 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4777 if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4779 ha->max_exchg -= REDUCE_EXCHANGES_CNT; in qla2x00_set_exchoffld_buffer()
4780 } else if (ha->max_exchg > in qla2x00_set_exchoffld_buffer()
4782 ha->max_exchg -= 512; in qla2x00_set_exchoffld_buffer()
4784 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4785 ql_log_pci(ql_log_fatal, ha->pdev, 0xd013, in qla2x00_set_exchoffld_buffer()
4788 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4790 return -ENOMEM; in qla2x00_set_exchoffld_buffer()
4792 } else if (!ha->exchoffld_buf || (actual_cnt <= FW_DEF_EXCHANGES_CNT)) { in qla2x00_set_exchoffld_buffer()
4795 ha->exchoffld_size = 0; in qla2x00_set_exchoffld_buffer()
4796 ha->flags.exchoffld_enabled = 0; in qla2x00_set_exchoffld_buffer()
4799 ha->exchoffld_size, actual_cnt, size, totsz); in qla2x00_set_exchoffld_buffer()
4810 /* re-adjust number of target exchange */ in qla2x00_set_exchoffld_buffer()
4811 struct init_cb_81xx *icb = (struct init_cb_81xx *)ha->init_cb; in qla2x00_set_exchoffld_buffer()
4814 icb->exchange_count = 0; in qla2x00_set_exchoffld_buffer()
4816 icb->exchange_count = cpu_to_le16(vha->ql2xexchoffld); in qla2x00_set_exchoffld_buffer()
4831 if (ha->exchoffld_buf) { in qla2x00_free_exchoffld_buffer()
4832 dma_free_coherent(&ha->pdev->dev, ha->exchoffld_size, in qla2x00_free_exchoffld_buffer()
4833 ha->exchoffld_buf, ha->exchoffld_buf_dma); in qla2x00_free_exchoffld_buffer()
4834 ha->exchoffld_buf = NULL; in qla2x00_free_exchoffld_buffer()
4835 ha->exchoffld_size = 0; in qla2x00_free_exchoffld_buffer()
4849 struct fwdt *fwdt = ha->fwdt; in qla2x00_free_fw_dump()
4852 if (ha->fce) in qla2x00_free_fw_dump()
4853 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4854 FCE_SIZE, ha->fce, ha->fce_dma); in qla2x00_free_fw_dump()
4856 if (ha->eft) in qla2x00_free_fw_dump()
4857 dma_free_coherent(&ha->pdev->dev, in qla2x00_free_fw_dump()
4858 EFT_SIZE, ha->eft, ha->eft_dma); in qla2x00_free_fw_dump()
4860 vfree(ha->fw_dump); in qla2x00_free_fw_dump()
4862 ha->fce = NULL; in qla2x00_free_fw_dump()
4863 ha->fce_dma = 0; in qla2x00_free_fw_dump()
4864 ha->flags.fce_enabled = 0; in qla2x00_free_fw_dump()
4865 ha->eft = NULL; in qla2x00_free_fw_dump()
4866 ha->eft_dma = 0; in qla2x00_free_fw_dump()
4867 ha->fw_dumped = false; in qla2x00_free_fw_dump()
4868 ha->fw_dump_cap_flags = 0; in qla2x00_free_fw_dump()
4869 ha->fw_dump_reading = 0; in qla2x00_free_fw_dump()
4870 ha->fw_dump = NULL; in qla2x00_free_fw_dump()
4871 ha->fw_dump_len = 0; in qla2x00_free_fw_dump()
4874 vfree(fwdt->template); in qla2x00_free_fw_dump()
4875 fwdt->template = NULL; in qla2x00_free_fw_dump()
4876 fwdt->length = 0; in qla2x00_free_fw_dump()
4892 if (ha->mctp_dump) in qla2x00_mem_free()
4893 dma_free_coherent(&ha->pdev->dev, MCTP_DUMP_SIZE, ha->mctp_dump, in qla2x00_mem_free()
4894 ha->mctp_dump_dma); in qla2x00_mem_free()
4895 ha->mctp_dump = NULL; in qla2x00_mem_free()
4897 mempool_destroy(ha->srb_mempool); in qla2x00_mem_free()
4898 ha->srb_mempool = NULL; in qla2x00_mem_free()
4900 if (ha->dcbx_tlv) in qla2x00_mem_free()
4901 dma_free_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, in qla2x00_mem_free()
4902 ha->dcbx_tlv, ha->dcbx_tlv_dma); in qla2x00_mem_free()
4903 ha->dcbx_tlv = NULL; in qla2x00_mem_free()
4905 if (ha->xgmac_data) in qla2x00_mem_free()
4906 dma_free_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE, in qla2x00_mem_free()
4907 ha->xgmac_data, ha->xgmac_data_dma); in qla2x00_mem_free()
4908 ha->xgmac_data = NULL; in qla2x00_mem_free()
4910 if (ha->sns_cmd) in qla2x00_mem_free()
4911 dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt), in qla2x00_mem_free()
4912 ha->sns_cmd, ha->sns_cmd_dma); in qla2x00_mem_free()
4913 ha->sns_cmd = NULL; in qla2x00_mem_free()
4914 ha->sns_cmd_dma = 0; in qla2x00_mem_free()
4916 if (ha->ct_sns) in qla2x00_mem_free()
4917 dma_free_coherent(&ha->pdev->dev, sizeof(struct ct_sns_pkt), in qla2x00_mem_free()
4918 ha->ct_sns, ha->ct_sns_dma); in qla2x00_mem_free()
4919 ha->ct_sns = NULL; in qla2x00_mem_free()
4920 ha->ct_sns_dma = 0; in qla2x00_mem_free()
4922 if (ha->sfp_data) in qla2x00_mem_free()
4923 dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->sfp_data, in qla2x00_mem_free()
4924 ha->sfp_data_dma); in qla2x00_mem_free()
4925 ha->sfp_data = NULL; in qla2x00_mem_free()
4927 if (ha->flt) in qla2x00_mem_free()
4928 dma_free_coherent(&ha->pdev->dev, in qla2x00_mem_free()
4930 ha->flt, ha->flt_dma); in qla2x00_mem_free()
4931 ha->flt = NULL; in qla2x00_mem_free()
4932 ha->flt_dma = 0; in qla2x00_mem_free()
4934 if (ha->ms_iocb) in qla2x00_mem_free()
4935 dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); in qla2x00_mem_free()
4936 ha->ms_iocb = NULL; in qla2x00_mem_free()
4937 ha->ms_iocb_dma = 0; in qla2x00_mem_free()
4939 if (ha->sf_init_cb) in qla2x00_mem_free()
4940 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4941 ha->sf_init_cb, ha->sf_init_cb_dma); in qla2x00_mem_free()
4943 if (ha->ex_init_cb) in qla2x00_mem_free()
4944 dma_pool_free(ha->s_dma_pool, in qla2x00_mem_free()
4945 ha->ex_init_cb, ha->ex_init_cb_dma); in qla2x00_mem_free()
4946 ha->ex_init_cb = NULL; in qla2x00_mem_free()
4947 ha->ex_init_cb_dma = 0; in qla2x00_mem_free()
4949 if (ha->async_pd) in qla2x00_mem_free()
4950 dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma); in qla2x00_mem_free()
4951 ha->async_pd = NULL; in qla2x00_mem_free()
4952 ha->async_pd_dma = 0; in qla2x00_mem_free()
4954 dma_pool_destroy(ha->s_dma_pool); in qla2x00_mem_free()
4955 ha->s_dma_pool = NULL; in qla2x00_mem_free()
4957 if (ha->gid_list) in qla2x00_mem_free()
4958 dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha), in qla2x00_mem_free()
4959 ha->gid_list, ha->gid_list_dma); in qla2x00_mem_free()
4960 ha->gid_list = NULL; in qla2x00_mem_free()
4961 ha->gid_list_dma = 0; in qla2x00_mem_free()
4963 if (ha->base_qpair && !list_empty(&ha->base_qpair->dsd_list)) { in qla2x00_mem_free()
4968 &ha->base_qpair->dsd_list, list) { in qla2x00_mem_free()
4969 dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, in qla2x00_mem_free()
4970 dsd_ptr->dsd_list_dma); in qla2x00_mem_free()
4971 list_del(&dsd_ptr->list); in qla2x00_mem_free()
4976 dma_pool_destroy(ha->dl_dma_pool); in qla2x00_mem_free()
4977 ha->dl_dma_pool = NULL; in qla2x00_mem_free()
4979 dma_pool_destroy(ha->fcp_cmnd_dma_pool); in qla2x00_mem_free()
4980 ha->fcp_cmnd_dma_pool = NULL; in qla2x00_mem_free()
4982 mempool_destroy(ha->ctx_mempool); in qla2x00_mem_free()
4983 ha->ctx_mempool = NULL; in qla2x00_mem_free()
4985 if (ql2xenabledif && ha->dif_bundl_pool) { in qla2x00_mem_free()
4988 list_for_each_entry_safe(dsd, nxt, &ha->pool.unusable.head, in qla2x00_mem_free()
4990 list_del(&dsd->list); in qla2x00_mem_free()
4991 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
4992 dsd->dsd_list_dma); in qla2x00_mem_free()
4993 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
4995 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
4996 ha->pool.unusable.count--; in qla2x00_mem_free()
4998 list_for_each_entry_safe(dsd, nxt, &ha->pool.good.head, list) { in qla2x00_mem_free()
4999 list_del(&dsd->list); in qla2x00_mem_free()
5000 dma_pool_free(ha->dif_bundl_pool, dsd->dsd_addr, in qla2x00_mem_free()
5001 dsd->dsd_list_dma); in qla2x00_mem_free()
5002 ha->dif_bundle_dma_allocs--; in qla2x00_mem_free()
5004 ha->dif_bundle_kallocs--; in qla2x00_mem_free()
5008 dma_pool_destroy(ha->dif_bundl_pool); in qla2x00_mem_free()
5009 ha->dif_bundl_pool = NULL; in qla2x00_mem_free()
5014 if (ha->init_cb) in qla2x00_mem_free()
5015 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, in qla2x00_mem_free()
5016 ha->init_cb, ha->init_cb_dma); in qla2x00_mem_free()
5018 dma_pool_destroy(ha->purex_dma_pool); in qla2x00_mem_free()
5019 ha->purex_dma_pool = NULL; in qla2x00_mem_free()
5021 if (ha->elsrej.c) { in qla2x00_mem_free()
5022 dma_free_coherent(&ha->pdev->dev, ha->elsrej.size, in qla2x00_mem_free()
5023 ha->elsrej.c, ha->elsrej.cdma); in qla2x00_mem_free()
5024 ha->elsrej.c = NULL; in qla2x00_mem_free()
5027 if (ha->lsrjt.c) { in qla2x00_mem_free()
5028 dma_free_coherent(&ha->pdev->dev, ha->lsrjt.size, ha->lsrjt.c, in qla2x00_mem_free()
5029 ha->lsrjt.cdma); in qla2x00_mem_free()
5030 ha->lsrjt.c = NULL; in qla2x00_mem_free()
5033 ha->init_cb = NULL; in qla2x00_mem_free()
5034 ha->init_cb_dma = 0; in qla2x00_mem_free()
5036 vfree(ha->optrom_buffer); in qla2x00_mem_free()
5037 ha->optrom_buffer = NULL; in qla2x00_mem_free()
5038 kfree(ha->nvram); in qla2x00_mem_free()
5039 ha->nvram = NULL; in qla2x00_mem_free()
5040 kfree(ha->npiv_info); in qla2x00_mem_free()
5041 ha->npiv_info = NULL; in qla2x00_mem_free()
5042 kfree(ha->swl); in qla2x00_mem_free()
5043 ha->swl = NULL; in qla2x00_mem_free()
5044 kfree(ha->loop_id_map); in qla2x00_mem_free()
5045 ha->sf_init_cb = NULL; in qla2x00_mem_free()
5046 ha->sf_init_cb_dma = 0; in qla2x00_mem_free()
5047 ha->loop_id_map = NULL; in qla2x00_mem_free()
5049 kfree(ha->vp_map); in qla2x00_mem_free()
5050 ha->vp_map = NULL; in qla2x00_mem_free()
5061 ql_log_pci(ql_log_fatal, ha->pdev, 0x0107, in qla2x00_create_host()
5070 vha->host = host; in qla2x00_create_host()
5071 vha->host_no = host->host_no; in qla2x00_create_host()
5072 vha->hw = ha; in qla2x00_create_host()
5074 vha->qlini_mode = ql2x_ini_mode; in qla2x00_create_host()
5075 vha->ql2xexchoffld = ql2xexchoffld; in qla2x00_create_host()
5076 vha->ql2xiniexchg = ql2xiniexchg; in qla2x00_create_host()
5078 INIT_LIST_HEAD(&vha->vp_fcports); in qla2x00_create_host()
5079 INIT_LIST_HEAD(&vha->work_list); in qla2x00_create_host()
5080 INIT_LIST_HEAD(&vha->list); in qla2x00_create_host()
5081 INIT_LIST_HEAD(&vha->qla_cmd_list); in qla2x00_create_host()
5082 INIT_LIST_HEAD(&vha->logo_list); in qla2x00_create_host()
5083 INIT_LIST_HEAD(&vha->plogi_ack_list); in qla2x00_create_host()
5084 INIT_LIST_HEAD(&vha->qp_list); in qla2x00_create_host()
5085 INIT_LIST_HEAD(&vha->gnl.fcports); in qla2x00_create_host()
5086 INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn); in qla2x00_create_host()
5088 INIT_LIST_HEAD(&vha->purex_list.head); in qla2x00_create_host()
5089 spin_lock_init(&vha->purex_list.lock); in qla2x00_create_host()
5091 spin_lock_init(&vha->work_lock); in qla2x00_create_host()
5092 spin_lock_init(&vha->cmd_list_lock); in qla2x00_create_host()
5093 init_waitqueue_head(&vha->fcport_waitQ); in qla2x00_create_host()
5094 init_waitqueue_head(&vha->vref_waitq); in qla2x00_create_host()
5099 vha->gnl.size = sizeof(struct get_name_list_extended) * in qla2x00_create_host()
5100 (ha->max_loop_id + 1); in qla2x00_create_host()
5101 vha->gnl.l = dma_alloc_coherent(&ha->pdev->dev, in qla2x00_create_host()
5102 vha->gnl.size, &vha->gnl.ldma, GFP_KERNEL); in qla2x00_create_host()
5103 if (!vha->gnl.l) { in qla2x00_create_host()
5106 scsi_host_put(vha->host); in qla2x00_create_host()
5111 vha->scan.size = ha->max_fibre_devices * sizeof(struct fab_scan_rp); in qla2x00_create_host()
5112 vha->scan.l = vmalloc(vha->scan.size); in qla2x00_create_host()
5113 if (!vha->scan.l) { in qla2x00_create_host()
5116 dma_free_coherent(&ha->pdev->dev, vha->gnl.size, in qla2x00_create_host()
5117 vha->gnl.l, vha->gnl.ldma); in qla2x00_create_host()
5118 vha->gnl.l = NULL; in qla2x00_create_host()
5119 scsi_host_put(vha->host); in qla2x00_create_host()
5122 INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn); in qla2x00_create_host()
5124 snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu", in qla2x00_create_host()
5125 QLA2XXX_DRIVER_NAME, vha->host_no); in qla2x00_create_host()
5128 vha->host, vha->hw, vha, in qla2x00_create_host()
5129 dev_name(&(ha->pdev->dev))); in qla2x00_create_host()
5139 if (test_bit(UNLOADING, &vha->dpc_flags)) in qla2x00_alloc_work()
5151 INIT_LIST_HEAD(&e->list); in qla2x00_alloc_work()
5152 e->type = type; in qla2x00_alloc_work()
5153 e->flags = QLA_EVT_FLAG_FREE; in qla2x00_alloc_work()
5163 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_post_work()
5164 list_add_tail(&e->list, &vha->work_list); in qla2x00_post_work()
5166 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_post_work()
5169 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_post_work()
5172 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_post_work()
5187 e->u.aen.code = code; in qla2x00_post_aen_work()
5188 e->u.aen.data = data; in qla2x00_post_aen_work()
5201 memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); in qla2x00_post_idc_ack_work()
5216 e->u.logio.fcport = fcport; \
5218 e->u.logio.data[0] = data[0]; \
5219 e->u.logio.data[1] = data[1]; \
5221 fcport->flags |= FCF_ASYNC_ACTIVE; \
5240 e->u.uevent.code = code; in qla2x00_post_uevent_work()
5253 vha->host_no); in qla2x00_uevent_emit()
5259 kobject_uevent_env(&vha->hw->pdev->dev.kobj, KOBJ_CHANGE, envp); in qla2x00_uevent_emit()
5272 e->u.aenfx.evtcode = evtcode; in qlafx00_post_aenfx_work()
5273 e->u.aenfx.count = cnt; in qlafx00_post_aenfx_work()
5274 memcpy(e->u.aenfx.mbx, data, sizeof(*data) * cnt); in qlafx00_post_aenfx_work()
5282 if (IS_SW_RESV_ADDR(fcport->d_id)) in qla24xx_sched_upd_fcport()
5285 spin_lock_irqsave(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5286 if (fcport->disc_state == DSC_UPD_FCPORT) { in qla24xx_sched_upd_fcport()
5287 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5290 fcport->jiffies_at_registration = jiffies; in qla24xx_sched_upd_fcport()
5291 fcport->sec_since_registration = 0; in qla24xx_sched_upd_fcport()
5292 fcport->next_disc_state = DSC_DELETED; in qla24xx_sched_upd_fcport()
5294 spin_unlock_irqrestore(&fcport->vha->work_lock, flags); in qla24xx_sched_upd_fcport()
5296 queue_work(system_unbound_wq, &fcport->reg_work); in qla24xx_sched_upd_fcport()
5305 (struct qlt_plogi_ack_t *)e->u.new_sess.pla; in qla24xx_create_new_sess()
5310 __func__, __LINE__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5312 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5313 fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5315 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5317 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5318 memcpy(fcport->node_name, in qla24xx_create_new_sess()
5319 pla->iocb.u.isp24.u.plogi.node_name, in qla24xx_create_new_sess()
5325 pla->ref_count--; in qla24xx_create_new_sess()
5328 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5331 fcport->d_id = e->u.new_sess.id; in qla24xx_create_new_sess()
5332 fcport->flags |= FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5333 fcport->fw_login_state = DSC_LS_PLOGI_PEND; in qla24xx_create_new_sess()
5334 fcport->tgt_short_link_down_cnt = 0; in qla24xx_create_new_sess()
5336 memcpy(fcport->port_name, e->u.new_sess.port_name, in qla24xx_create_new_sess()
5339 fcport->fc4_type = e->u.new_sess.fc4_type; in qla24xx_create_new_sess()
5340 if (NVME_PRIORITY(vha->hw, fcport)) in qla24xx_create_new_sess()
5341 fcport->do_prli_nvme = 1; in qla24xx_create_new_sess()
5343 fcport->do_prli_nvme = 0; in qla24xx_create_new_sess()
5345 if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) { in qla24xx_create_new_sess()
5346 fcport->dm_login_expire = jiffies + in qla24xx_create_new_sess()
5348 fcport->fc4_type = FS_FC4TYPE_FCP; in qla24xx_create_new_sess()
5349 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5350 if (vha->flags.nvme_enabled) in qla24xx_create_new_sess()
5351 fcport->fc4_type |= FS_FC4TYPE_NVME; in qla24xx_create_new_sess()
5357 __func__, e->u.new_sess.port_name); in qla24xx_create_new_sess()
5360 list_del(&pla->list); in qla24xx_create_new_sess()
5366 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5369 e->u.new_sess.port_name, 1); in qla24xx_create_new_sess()
5374 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5375 tfcp->fw_login_state); in qla24xx_create_new_sess()
5379 list_add_tail(&fcport->list, &vha->vp_fcports); in qla24xx_create_new_sess()
5385 pla->ref_count--; in qla24xx_create_new_sess()
5388 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5391 fcport->id_changed = 1; in qla24xx_create_new_sess()
5392 fcport->scan_state = QLA_FCPORT_FOUND; in qla24xx_create_new_sess()
5393 fcport->chip_reset = vha->hw->base_qpair->chip_reset; in qla24xx_create_new_sess()
5394 memcpy(fcport->node_name, e->u.new_sess.node_name, WWN_SIZE); in qla24xx_create_new_sess()
5397 if (pla->iocb.u.isp24.status_subcode == ELS_PRLI) { in qla24xx_create_new_sess()
5400 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5401 fcport->local = 0; in qla24xx_create_new_sess()
5402 fcport->loop_id = in qla24xx_create_new_sess()
5404 pla->iocb.u.isp24.nport_handle); in qla24xx_create_new_sess()
5405 fcport->fw_login_state = DSC_LS_PRLI_PEND; in qla24xx_create_new_sess()
5408 pla->iocb.u.isp24.u.prli.wd3_lo); in qla24xx_create_new_sess()
5411 fcport->conf_compl_supported = 1; in qla24xx_create_new_sess()
5414 fcport->port_type = FCT_INITIATOR; in qla24xx_create_new_sess()
5416 fcport->port_type = FCT_TARGET; in qla24xx_create_new_sess()
5422 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5424 &e->u.new_sess.id, 1); in qla24xx_create_new_sess()
5431 __func__, tfcp->port_name, tfcp->disc_state, in qla24xx_create_new_sess()
5432 tfcp->fw_login_state); in qla24xx_create_new_sess()
5434 switch (tfcp->disc_state) { in qla24xx_create_new_sess()
5438 fcport->login_pause = 1; in qla24xx_create_new_sess()
5439 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5442 fcport->login_pause = 1; in qla24xx_create_new_sess()
5443 tfcp->conflict = fcport; in qla24xx_create_new_sess()
5448 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla24xx_create_new_sess()
5452 if (N2N_TOPO(vha->hw)) { in qla24xx_create_new_sess()
5453 fcport->flags &= ~FCF_FABRIC_DEVICE; in qla24xx_create_new_sess()
5454 fcport->keep_nport_handle = 1; in qla24xx_create_new_sess()
5455 if (vha->flags.nvme_enabled) { in qla24xx_create_new_sess()
5456 fcport->fc4_type = in qla24xx_create_new_sess()
5458 fcport->n2n_flag = 1; in qla24xx_create_new_sess()
5460 fcport->fw_login_state = 0; in qla24xx_create_new_sess()
5462 schedule_delayed_work(&vha->scan.scan_work, 5); in qla24xx_create_new_sess()
5472 list_del(&pla->list); in qla24xx_create_new_sess()
5480 struct srb *sp = e->u.iosb.sp; in qla_sp_retry() local
5483 rval = qla2x00_start_sp(sp); in qla_sp_retry()
5486 "%s: %s: Re-issue IOCB failed (%d).\n", in qla_sp_retry()
5487 __func__, sp->name, rval); in qla_sp_retry()
5488 qla24xx_sp_unmap(vha, sp); in qla_sp_retry()
5500 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5501 list_splice_init(&vha->work_list, &work); in qla2x00_do_work()
5502 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5506 switch (e->type) { in qla2x00_do_work()
5508 fc_host_post_event(vha->host, fc_get_event_number(), in qla2x00_do_work()
5509 e->u.aen.code, e->u.aen.data); in qla2x00_do_work()
5512 qla81xx_idc_ack(vha, e->u.idc_ack.mb); in qla2x00_do_work()
5515 qla2x00_async_login(vha, e->u.logio.fcport, in qla2x00_do_work()
5516 e->u.logio.data); in qla2x00_do_work()
5519 rc = qla2x00_async_logout(vha, e->u.logio.fcport); in qla2x00_do_work()
5522 qla2x00_async_adisc(vha, e->u.logio.fcport, in qla2x00_do_work()
5523 e->u.logio.data); in qla2x00_do_work()
5526 qla2x00_uevent_emit(vha, e->u.uevent.code); in qla2x00_do_work()
5532 qla24xx_sp_unmap(vha, e->u.iosb.sp); in qla2x00_do_work()
5541 qla24xx_async_gpdb(vha, e->u.fcport.fcport, in qla2x00_do_work()
5542 e->u.fcport.opt); in qla2x00_do_work()
5545 qla24xx_async_prli(vha, e->u.fcport.fcport); in qla2x00_do_work()
5548 qla24xx_async_gpsc(vha, e->u.fcport.fcport); in qla2x00_do_work()
5551 qla24xx_async_gnl(vha, e->u.fcport.fcport); in qla2x00_do_work()
5557 rc = qla2x00_async_prlo(vha, e->u.logio.fcport); in qla2x00_do_work()
5560 qla2x00_async_prlo_done(vha, e->u.logio.fcport, in qla2x00_do_work()
5561 e->u.logio.data); in qla2x00_do_work()
5564 qla_fab_async_scan(vha, e->u.iosb.sp); in qla2x00_do_work()
5567 qla_fab_scan_finish(vha, e->u.iosb.sp); in qla2x00_do_work()
5570 qla24xx_async_gfpnid(vha, e->u.fcport.fcport); in qla2x00_do_work()
5576 qla_do_iidma_work(vha, e->u.fcport.fcport); in qla2x00_do_work()
5580 e->u.fcport.fcport); in qla2x00_do_work()
5588 /* put 'work' at head of 'vha->work_list' */ in qla2x00_do_work()
5589 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_do_work()
5590 list_splice(&work, &vha->work_list); in qla2x00_do_work()
5591 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_do_work()
5594 list_del_init(&e->list); in qla2x00_do_work()
5595 if (e->flags & QLA_EVT_FLAG_FREE) in qla2x00_do_work()
5610 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla24xx_post_relogin_work()
5626 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_relogin()
5631 if (atomic_read(&fcport->state) != FCS_ONLINE && in qla2x00_relogin()
5632 fcport->login_retry) { in qla2x00_relogin()
5633 if (fcport->scan_state != QLA_FCPORT_FOUND || in qla2x00_relogin()
5634 fcport->disc_state == DSC_LOGIN_AUTH_PEND || in qla2x00_relogin()
5635 fcport->disc_state == DSC_LOGIN_COMPLETE) in qla2x00_relogin()
5638 if (fcport->flags & (FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE) || in qla2x00_relogin()
5639 fcport->disc_state == DSC_DELETE_PEND) { in qla2x00_relogin()
5642 if (vha->hw->current_topology != ISP_CFG_NL) { in qla2x00_relogin()
5646 } else if (vha->hw->current_topology == in qla2x00_relogin()
5648 IS_QLA2XXX_MIDTYPE(vha->hw)) { in qla2x00_relogin()
5651 } else if (vha->hw->current_topology == in qla2x00_relogin()
5653 fcport->login_retry--; in qla2x00_relogin()
5658 fcport->old_loop_id = in qla2x00_relogin()
5659 fcport->loop_id; in qla2x00_relogin()
5662 fcport->loop_id); in qla2x00_relogin()
5667 &vha->dpc_flags); in qla2x00_relogin()
5671 fcport->login_retry, in qla2x00_relogin()
5672 fcport->loop_id); in qla2x00_relogin()
5674 fcport->login_retry = 0; in qla2x00_relogin()
5677 if (fcport->login_retry == 0 && in qla2x00_relogin()
5683 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) in qla2x00_relogin()
5688 set_bit(RELOGIN_NEEDED, &vha->dpc_flags); in qla2x00_relogin()
5694 /* Schedule work on any of the dpc-workqueues */
5698 struct qla_hw_data *ha = base_vha->hw; in qla83xx_schedule_work()
5702 if (ha->dpc_lp_wq) in qla83xx_schedule_work()
5703 queue_work(ha->dpc_lp_wq, &ha->idc_aen); in qla83xx_schedule_work()
5707 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_schedule_work()
5708 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5709 queue_work(ha->dpc_hp_wq, &ha->nic_core_reset); in qla83xx_schedule_work()
5716 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5717 queue_work(ha->dpc_hp_wq, &ha->idc_state_handler); in qla83xx_schedule_work()
5720 if (ha->dpc_hp_wq) in qla83xx_schedule_work()
5721 queue_work(ha->dpc_hp_wq, &ha->nic_core_unrecoverable); in qla83xx_schedule_work()
5725 "Unknown work-code=0x%x.\n", work_code); in qla83xx_schedule_work()
5737 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_unrecoverable_work()
5743 if (ha->flags.nic_core_reset_owner) { in qla83xx_nic_core_unrecoverable_work()
5744 ha->flags.nic_core_reset_owner = 0; in qla83xx_nic_core_unrecoverable_work()
5759 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_idc_state_handler_work()
5805 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_nic_core_reset_work()
5815 if (!ha->flags.nic_core_reset_hdlr_active) { in qla83xx_nic_core_reset_work()
5828 ha->flags.nic_core_reset_hdlr_active = 1; in qla83xx_nic_core_reset_work()
5834 ha->flags.nic_core_reset_hdlr_active = 0; in qla83xx_nic_core_reset_work()
5844 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla83xx_service_idc_aen()
5880 struct qla_hw_data *ha = base_vha->hw; in qla83xx_force_lock_recovery()
5892 data = (IDC_LOCK_RECOVERY_STAGE1) | (ha->portnum << 2); in qla83xx_force_lock_recovery()
5905 if (((data & idc_lck_rcvry_owner_mask) >> 2) == ha->portnum) { in qla83xx_force_lock_recovery()
5918 /* Clear lock-id by setting 0xff */ in qla83xx_force_lock_recovery()
5923 /* Clear lock-recovery by setting 0x0 */ in qla83xx_force_lock_recovery()
5978 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_lock()
5982 /* IDC-lock implementation using driver-lock/lock-id remote registers */ in qla83xx_idc_lock()
5987 /* Setting lock-id to our function-number */ in qla83xx_idc_lock()
5989 ha->portnum); in qla83xx_idc_lock()
5997 /* Retry/Perform IDC-Lock recovery */ in qla83xx_idc_lock()
6017 u32 sid = purex->s_id[2] << 16 | purex->s_id[1] << 8 | purex->s_id[0]; in qla25xx_rdp_rsp_reduce_size()
6020 /* Domain Controller is always logged-out. */ in qla25xx_rdp_rsp_reduce_size()
6032 le16_to_cpu(purex->nport_handle), pdb)) { in qla25xx_rdp_rsp_reduce_size()
6035 } else if (pdb->current_login_state != PDS_PLOGI_COMPLETE && in qla25xx_rdp_rsp_reduce_size()
6036 pdb->current_login_state != PDS_PRLI_COMPLETE) { in qla25xx_rdp_rsp_reduce_size()
6046 vha->hw->isp_ops->fw_version_str(vha, fwstr, sizeof(fwstr)); in qla25xx_rdp_rsp_reduce_size()
6071 struct qla_hw_data *ha = vha->hw; in qla24xx_process_purex_rdp()
6073 (struct purex_entry_24xx *)&item->iocb; in qla24xx_process_purex_rdp()
6090 "-------- ELS REQ -------\n"); in qla24xx_process_purex_rdp()
6102 rsp_els = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6110 rsp_payload = dma_alloc_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6118 sfp = dma_alloc_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6121 stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6125 rsp_els->entry_type = ELS_IOCB_TYPE; in qla24xx_process_purex_rdp()
6126 rsp_els->entry_count = 1; in qla24xx_process_purex_rdp()
6127 rsp_els->sys_define = 0; in qla24xx_process_purex_rdp()
6128 rsp_els->entry_status = 0; in qla24xx_process_purex_rdp()
6129 rsp_els->handle = 0; in qla24xx_process_purex_rdp()
6130 rsp_els->nport_handle = purex->nport_handle; in qla24xx_process_purex_rdp()
6131 rsp_els->tx_dsd_count = cpu_to_le16(1); in qla24xx_process_purex_rdp()
6132 rsp_els->vp_index = purex->vp_idx; in qla24xx_process_purex_rdp()
6133 rsp_els->sof_type = EST_SOFI3; in qla24xx_process_purex_rdp()
6134 rsp_els->rx_xchg_address = purex->rx_xchg_addr; in qla24xx_process_purex_rdp()
6135 rsp_els->rx_dsd_count = 0; in qla24xx_process_purex_rdp()
6136 rsp_els->opcode = purex->els_frame_payload[0]; in qla24xx_process_purex_rdp()
6138 rsp_els->d_id[0] = purex->s_id[0]; in qla24xx_process_purex_rdp()
6139 rsp_els->d_id[1] = purex->s_id[1]; in qla24xx_process_purex_rdp()
6140 rsp_els->d_id[2] = purex->s_id[2]; in qla24xx_process_purex_rdp()
6142 rsp_els->control_flags = cpu_to_le16(EPD_ELS_ACC); in qla24xx_process_purex_rdp()
6143 rsp_els->rx_byte_count = 0; in qla24xx_process_purex_rdp()
6144 rsp_els->tx_byte_count = cpu_to_le32(rsp_payload_length); in qla24xx_process_purex_rdp()
6146 put_unaligned_le64(rsp_payload_dma, &rsp_els->tx_address); in qla24xx_process_purex_rdp()
6147 rsp_els->tx_len = rsp_els->tx_byte_count; in qla24xx_process_purex_rdp()
6149 rsp_els->rx_address = 0; in qla24xx_process_purex_rdp()
6150 rsp_els->rx_len = 0; in qla24xx_process_purex_rdp()
6153 rsp_payload->hdr.cmd = cpu_to_be32(0x2 << 24); /* LS_ACC */ in qla24xx_process_purex_rdp()
6154 rsp_payload->hdr.len = cpu_to_be32(le32_to_cpu(rsp_els->tx_byte_count) - in qla24xx_process_purex_rdp()
6155 sizeof(rsp_payload->hdr)); in qla24xx_process_purex_rdp()
6158 rsp_payload->ls_req_info_desc.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6159 rsp_payload->ls_req_info_desc.desc_len = in qla24xx_process_purex_rdp()
6160 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc)); in qla24xx_process_purex_rdp()
6161 rsp_payload->ls_req_info_desc.req_payload_word_0 = in qla24xx_process_purex_rdp()
6162 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6165 rsp_payload->ls_req_info_desc2.desc_tag = cpu_to_be32(0x1); in qla24xx_process_purex_rdp()
6166 rsp_payload->ls_req_info_desc2.desc_len = in qla24xx_process_purex_rdp()
6167 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_req_info_desc2)); in qla24xx_process_purex_rdp()
6168 rsp_payload->ls_req_info_desc2.req_payload_word_0 = in qla24xx_process_purex_rdp()
6169 cpu_to_be32p((uint32_t *)purex->els_frame_payload); in qla24xx_process_purex_rdp()
6172 rsp_payload->sfp_diag_desc.desc_tag = cpu_to_be32(0x10000); in qla24xx_process_purex_rdp()
6173 rsp_payload->sfp_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6174 cpu_to_be32(RDP_DESC_LEN(rsp_payload->sfp_diag_desc)); in qla24xx_process_purex_rdp()
6181 /* SFP Flags bits 3-0: Port Tx Laser Type */ in qla24xx_process_purex_rdp()
6199 rsp_payload->sfp_diag_desc.sfp_flags = cpu_to_be16(sfp_flags); in qla24xx_process_purex_rdp()
6206 rsp_payload->sfp_diag_desc.temperature = trx[0]; in qla24xx_process_purex_rdp()
6207 rsp_payload->sfp_diag_desc.vcc = trx[1]; in qla24xx_process_purex_rdp()
6208 rsp_payload->sfp_diag_desc.tx_bias = trx[2]; in qla24xx_process_purex_rdp()
6209 rsp_payload->sfp_diag_desc.tx_power = trx[3]; in qla24xx_process_purex_rdp()
6210 rsp_payload->sfp_diag_desc.rx_power = trx[4]; in qla24xx_process_purex_rdp()
6215 rsp_payload->port_speed_desc.desc_tag = cpu_to_be32(0x10001); in qla24xx_process_purex_rdp()
6216 rsp_payload->port_speed_desc.desc_len = in qla24xx_process_purex_rdp()
6217 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_speed_desc)); in qla24xx_process_purex_rdp()
6218 rsp_payload->port_speed_desc.speed_capab = cpu_to_be16( in qla24xx_process_purex_rdp()
6220 rsp_payload->port_speed_desc.operating_speed = cpu_to_be16( in qla24xx_process_purex_rdp()
6224 rsp_payload->ls_err_desc.desc_tag = cpu_to_be32(0x10002); in qla24xx_process_purex_rdp()
6225 rsp_payload->ls_err_desc.desc_len = in qla24xx_process_purex_rdp()
6226 cpu_to_be32(RDP_DESC_LEN(rsp_payload->ls_err_desc)); in qla24xx_process_purex_rdp()
6231 rsp_payload->ls_err_desc.link_fail_cnt = in qla24xx_process_purex_rdp()
6232 cpu_to_be32(le32_to_cpu(stat->link_fail_cnt)); in qla24xx_process_purex_rdp()
6233 rsp_payload->ls_err_desc.loss_sync_cnt = in qla24xx_process_purex_rdp()
6234 cpu_to_be32(le32_to_cpu(stat->loss_sync_cnt)); in qla24xx_process_purex_rdp()
6235 rsp_payload->ls_err_desc.loss_sig_cnt = in qla24xx_process_purex_rdp()
6236 cpu_to_be32(le32_to_cpu(stat->loss_sig_cnt)); in qla24xx_process_purex_rdp()
6237 rsp_payload->ls_err_desc.prim_seq_err_cnt = in qla24xx_process_purex_rdp()
6238 cpu_to_be32(le32_to_cpu(stat->prim_seq_err_cnt)); in qla24xx_process_purex_rdp()
6239 rsp_payload->ls_err_desc.inval_xmit_word_cnt = in qla24xx_process_purex_rdp()
6240 cpu_to_be32(le32_to_cpu(stat->inval_xmit_word_cnt)); in qla24xx_process_purex_rdp()
6241 rsp_payload->ls_err_desc.inval_crc_cnt = in qla24xx_process_purex_rdp()
6242 cpu_to_be32(le32_to_cpu(stat->inval_crc_cnt)); in qla24xx_process_purex_rdp()
6243 rsp_payload->ls_err_desc.pn_port_phy_type |= BIT_6; in qla24xx_process_purex_rdp()
6248 rsp_payload->port_name_diag_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6249 rsp_payload->port_name_diag_desc.desc_len = in qla24xx_process_purex_rdp()
6250 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_diag_desc)); in qla24xx_process_purex_rdp()
6251 memcpy(rsp_payload->port_name_diag_desc.WWNN, in qla24xx_process_purex_rdp()
6252 vha->node_name, in qla24xx_process_purex_rdp()
6253 sizeof(rsp_payload->port_name_diag_desc.WWNN)); in qla24xx_process_purex_rdp()
6254 memcpy(rsp_payload->port_name_diag_desc.WWPN, in qla24xx_process_purex_rdp()
6255 vha->port_name, in qla24xx_process_purex_rdp()
6256 sizeof(rsp_payload->port_name_diag_desc.WWPN)); in qla24xx_process_purex_rdp()
6258 /* F-Port Portname Descriptor */ in qla24xx_process_purex_rdp()
6259 rsp_payload->port_name_direct_desc.desc_tag = cpu_to_be32(0x10003); in qla24xx_process_purex_rdp()
6260 rsp_payload->port_name_direct_desc.desc_len = in qla24xx_process_purex_rdp()
6261 cpu_to_be32(RDP_DESC_LEN(rsp_payload->port_name_direct_desc)); in qla24xx_process_purex_rdp()
6262 memcpy(rsp_payload->port_name_direct_desc.WWNN, in qla24xx_process_purex_rdp()
6263 vha->fabric_node_name, in qla24xx_process_purex_rdp()
6264 sizeof(rsp_payload->port_name_direct_desc.WWNN)); in qla24xx_process_purex_rdp()
6265 memcpy(rsp_payload->port_name_direct_desc.WWPN, in qla24xx_process_purex_rdp()
6266 vha->fabric_port_name, in qla24xx_process_purex_rdp()
6267 sizeof(rsp_payload->port_name_direct_desc.WWPN)); in qla24xx_process_purex_rdp()
6270 rsp_payload->buffer_credit_desc.desc_tag = cpu_to_be32(0x10006); in qla24xx_process_purex_rdp()
6271 rsp_payload->buffer_credit_desc.desc_len = in qla24xx_process_purex_rdp()
6272 cpu_to_be32(RDP_DESC_LEN(rsp_payload->buffer_credit_desc)); in qla24xx_process_purex_rdp()
6273 rsp_payload->buffer_credit_desc.fcport_b2b = 0; in qla24xx_process_purex_rdp()
6274 rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6275 rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0); in qla24xx_process_purex_rdp()
6277 if (ha->flags.plogi_template_valid) { in qla24xx_process_purex_rdp()
6279 be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred); in qla24xx_process_purex_rdp()
6280 rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp); in qla24xx_process_purex_rdp()
6287 rsp_payload->optical_elmt_desc[0].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6288 rsp_payload->optical_elmt_desc[0].desc_len = in qla24xx_process_purex_rdp()
6289 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6291 rsp_payload->optical_elmt_desc[1].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6292 rsp_payload->optical_elmt_desc[1].desc_len = in qla24xx_process_purex_rdp()
6293 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6295 rsp_payload->optical_elmt_desc[2].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6296 rsp_payload->optical_elmt_desc[2].desc_len = in qla24xx_process_purex_rdp()
6297 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6299 rsp_payload->optical_elmt_desc[3].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6300 rsp_payload->optical_elmt_desc[3].desc_len = in qla24xx_process_purex_rdp()
6301 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6302 /* Optical Element Descriptor, Rx Power */ in qla24xx_process_purex_rdp()
6303 rsp_payload->optical_elmt_desc[4].desc_tag = cpu_to_be32(0x10007); in qla24xx_process_purex_rdp()
6304 rsp_payload->optical_elmt_desc[4].desc_len = in qla24xx_process_purex_rdp()
6305 cpu_to_be32(RDP_DESC_LEN(*rsp_payload->optical_elmt_desc)); in qla24xx_process_purex_rdp()
6314 rsp_payload->optical_elmt_desc[0].high_alarm = trx[0]; in qla24xx_process_purex_rdp()
6315 rsp_payload->optical_elmt_desc[0].low_alarm = trx[1]; in qla24xx_process_purex_rdp()
6316 rsp_payload->optical_elmt_desc[0].high_warn = trx[2]; in qla24xx_process_purex_rdp()
6317 rsp_payload->optical_elmt_desc[0].low_warn = trx[3]; in qla24xx_process_purex_rdp()
6318 rsp_payload->optical_elmt_desc[0].element_flags = in qla24xx_process_purex_rdp()
6322 rsp_payload->optical_elmt_desc[1].high_alarm = trx[4]; in qla24xx_process_purex_rdp()
6323 rsp_payload->optical_elmt_desc[1].low_alarm = trx[5]; in qla24xx_process_purex_rdp()
6324 rsp_payload->optical_elmt_desc[1].high_warn = trx[6]; in qla24xx_process_purex_rdp()
6325 rsp_payload->optical_elmt_desc[1].low_warn = trx[7]; in qla24xx_process_purex_rdp()
6326 rsp_payload->optical_elmt_desc[1].element_flags = in qla24xx_process_purex_rdp()
6330 rsp_payload->optical_elmt_desc[2].high_alarm = trx[8]; in qla24xx_process_purex_rdp()
6331 rsp_payload->optical_elmt_desc[2].low_alarm = trx[9]; in qla24xx_process_purex_rdp()
6332 rsp_payload->optical_elmt_desc[2].high_warn = trx[10]; in qla24xx_process_purex_rdp()
6333 rsp_payload->optical_elmt_desc[2].low_warn = trx[11]; in qla24xx_process_purex_rdp()
6334 rsp_payload->optical_elmt_desc[2].element_flags = in qla24xx_process_purex_rdp()
6338 rsp_payload->optical_elmt_desc[3].high_alarm = trx[12]; in qla24xx_process_purex_rdp()
6339 rsp_payload->optical_elmt_desc[3].low_alarm = trx[13]; in qla24xx_process_purex_rdp()
6340 rsp_payload->optical_elmt_desc[3].high_warn = trx[14]; in qla24xx_process_purex_rdp()
6341 rsp_payload->optical_elmt_desc[3].low_warn = trx[15]; in qla24xx_process_purex_rdp()
6342 rsp_payload->optical_elmt_desc[3].element_flags = in qla24xx_process_purex_rdp()
6345 /* Optical Element Descriptor, Rx Power */ in qla24xx_process_purex_rdp()
6346 rsp_payload->optical_elmt_desc[4].high_alarm = trx[16]; in qla24xx_process_purex_rdp()
6347 rsp_payload->optical_elmt_desc[4].low_alarm = trx[17]; in qla24xx_process_purex_rdp()
6348 rsp_payload->optical_elmt_desc[4].high_warn = trx[18]; in qla24xx_process_purex_rdp()
6349 rsp_payload->optical_elmt_desc[4].low_warn = trx[19]; in qla24xx_process_purex_rdp()
6350 rsp_payload->optical_elmt_desc[4].element_flags = in qla24xx_process_purex_rdp()
6358 rsp_payload->optical_elmt_desc[0].element_flags |= in qla24xx_process_purex_rdp()
6366 rsp_payload->optical_elmt_desc[1].element_flags |= in qla24xx_process_purex_rdp()
6374 rsp_payload->optical_elmt_desc[2].element_flags |= in qla24xx_process_purex_rdp()
6382 rsp_payload->optical_elmt_desc[3].element_flags |= in qla24xx_process_purex_rdp()
6389 /* Rx Power high/low alarm/warning */ in qla24xx_process_purex_rdp()
6390 rsp_payload->optical_elmt_desc[4].element_flags |= in qla24xx_process_purex_rdp()
6400 rsp_payload->optical_prod_desc.desc_tag = cpu_to_be32(0x10008); in qla24xx_process_purex_rdp()
6401 rsp_payload->optical_prod_desc.desc_len = in qla24xx_process_purex_rdp()
6402 cpu_to_be32(RDP_DESC_LEN(rsp_payload->optical_prod_desc)); in qla24xx_process_purex_rdp()
6408 memcpy(rsp_payload->optical_prod_desc.vendor_name, in qla24xx_process_purex_rdp()
6410 sizeof(rsp_payload->optical_prod_desc.vendor_name)); in qla24xx_process_purex_rdp()
6411 memcpy(rsp_payload->optical_prod_desc.part_number, in qla24xx_process_purex_rdp()
6413 sizeof(rsp_payload->optical_prod_desc.part_number)); in qla24xx_process_purex_rdp()
6414 memcpy(rsp_payload->optical_prod_desc.revision, in qla24xx_process_purex_rdp()
6416 sizeof(rsp_payload->optical_prod_desc.revision)); in qla24xx_process_purex_rdp()
6417 memcpy(rsp_payload->optical_prod_desc.serial_number, in qla24xx_process_purex_rdp()
6419 sizeof(rsp_payload->optical_prod_desc.serial_number)); in qla24xx_process_purex_rdp()
6425 memcpy(rsp_payload->optical_prod_desc.date, in qla24xx_process_purex_rdp()
6427 sizeof(rsp_payload->optical_prod_desc.date)); in qla24xx_process_purex_rdp()
6435 "-------- ELS RSP -------\n"); in qla24xx_process_purex_rdp()
6439 "-------- ELS RSP PAYLOAD -------\n"); in qla24xx_process_purex_rdp()
6447 "%s: iocb failed to execute -> %x\n", __func__, rval); in qla24xx_process_purex_rdp()
6448 } else if (rsp_els->comp_status) { in qla24xx_process_purex_rdp()
6450 "%s: iocb failed to complete -> completion=%#x subcode=(%#x,%#x)\n", in qla24xx_process_purex_rdp()
6451 __func__, rsp_els->comp_status, in qla24xx_process_purex_rdp()
6452 rsp_els->error_subcode_1, rsp_els->error_subcode_2); in qla24xx_process_purex_rdp()
6459 dma_free_coherent(&ha->pdev->dev, sizeof(*stat), in qla24xx_process_purex_rdp()
6462 dma_free_coherent(&ha->pdev->dev, SFP_RTDI_LEN, in qla24xx_process_purex_rdp()
6465 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_payload), in qla24xx_process_purex_rdp()
6468 dma_free_coherent(&ha->pdev->dev, sizeof(*rsp_els), in qla24xx_process_purex_rdp()
6475 if (item == &item->vha->default_item) in qla24xx_free_purex_item()
6476 memset(&item->vha->default_item, 0, sizeof(struct purex_item)); in qla24xx_free_purex_item()
6487 spin_lock_irqsave(&list->lock, flags); in qla24xx_process_purex_list()
6488 list_splice_init(&list->head, &head); in qla24xx_process_purex_list()
6489 spin_unlock_irqrestore(&list->lock, flags); in qla24xx_process_purex_list()
6492 list_del(&item->list); in qla24xx_process_purex_list()
6493 item->process_item(item->vha, item); in qla24xx_process_purex_list()
6509 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_unlock()
6513 /* IDC-unlock implementation using driver-unlock/lock-id in qla83xx_idc_unlock()
6520 if (data == ha->portnum) { in qla83xx_idc_unlock()
6522 /* Clearing lock-id by setting 0xff */ in qla83xx_idc_unlock()
6527 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6535 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6539 "Failed to read drv-lockid, retrying=%d\n", retry); in qla83xx_idc_unlock()
6546 /* XXX: IDC-unlock implementation using access-control mbx */ in qla83xx_idc_unlock()
6551 /* Retry for IDC-unlock */ in qla83xx_idc_unlock()
6568 struct qla_hw_data *ha = vha->hw; in __qla83xx_set_drv_presence()
6573 drv_presence |= (1 << ha->portnum); in __qla83xx_set_drv_presence()
6597 struct qla_hw_data *ha = vha->hw; in __qla83xx_clear_drv_presence()
6602 drv_presence &= ~(1 << ha->portnum); in __qla83xx_clear_drv_presence()
6625 struct qla_hw_data *ha = vha->hw; in qla83xx_need_reset_handler()
6629 /* Wait for IDC ACK from all functions (DRV-ACK == DRV-PRESENCE) */ in qla83xx_need_reset_handler()
6630 ack_timeout = jiffies + (ha->fcoe_reset_timeout * HZ); in qla83xx_need_reset_handler()
6658 ql_log(ql_log_info, vha, 0xb068, "HW State: COLD/RE-INIT.\n"); in qla83xx_need_reset_handler()
6670 /* Clearing IDC-Control Graceful-Reset Bit before resetting f/w */ in qla83xx_device_bootstrap()
6698 struct qla_hw_data *ha = base_vha->hw; in qla83xx_idc_state_handler()
6703 /* Wait for MAX-INIT-TIMEOUT for the device to go ready */ in qla83xx_idc_state_handler()
6704 dev_init_timeout = jiffies + (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6723 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6726 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6729 ha->portnum); in qla83xx_idc_state_handler()
6732 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6735 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6742 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6748 if (!ql2xdontresethba && ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6751 /* Wait for AEN to change device-state */ in qla83xx_idc_state_handler()
6758 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6768 if (ha->flags.quiesce_owner) in qla83xx_idc_state_handler()
6775 (ha->fcoe_dev_init_timeout * HZ); in qla83xx_idc_state_handler()
6778 if (ha->flags.nic_core_reset_owner) in qla83xx_idc_state_handler()
6781 ha->flags.nic_core_reset_owner = 0; in qla83xx_idc_state_handler()
6813 struct pci_dev *pdev = ha->pdev; in qla2x00_disable_board_on_pci_error()
6814 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla2x00_disable_board_on_pci_error()
6819 if (!atomic_read(&pdev->enable_cnt)) { in qla2x00_disable_board_on_pci_error()
6822 base_vha->pci_flags); in qla2x00_disable_board_on_pci_error()
6830 if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_disable_board_on_pci_error()
6843 if (base_vha->timer_active) in qla2x00_disable_board_on_pci_error()
6846 base_vha->flags.online = 0; in qla2x00_disable_board_on_pci_error()
6856 fc_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6858 scsi_remove_host(base_vha->host); in qla2x00_disable_board_on_pci_error()
6860 base_vha->flags.init_done = 0; in qla2x00_disable_board_on_pci_error()
6870 pci_release_selected_regions(ha->pdev, ha->bars); in qla2x00_disable_board_on_pci_error()
6885 * is kick-off by the driver's detect code and starts up
6900 base_vha = pci_get_drvdata(ha->pdev); in qla2x00_do_dpc()
6911 if (test_and_clear_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6914 if (!base_vha->flags.init_done || ha->flags.mbox_busy) in qla2x00_do_dpc()
6917 if (ha->flags.eeh_busy) { in qla2x00_do_dpc()
6919 "eeh_busy=%d.\n", ha->flags.eeh_busy); in qla2x00_do_dpc()
6923 ha->dpc_active = 1; in qla2x00_do_dpc()
6927 base_vha->dpc_flags); in qla2x00_do_dpc()
6929 if (test_bit(UNLOADING, &base_vha->dpc_flags)) in qla2x00_do_dpc()
6935 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6949 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6962 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6967 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
6969 /* FCoE-ctx reset failed. in qla2x00_do_dpc()
6970 * Escalate to chip-reset in qla2x00_do_dpc()
6973 &base_vha->dpc_flags); in qla2x00_do_dpc()
6976 &base_vha->dpc_flags); in qla2x00_do_dpc()
6984 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6990 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
6992 &base_vha->dpc_flags); in qla2x00_do_dpc()
7001 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7006 &base_vha->dpc_flags)) in qla2x00_do_dpc()
7008 &base_vha->dpc_flags); in qla2x00_do_dpc()
7016 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7020 &base_vha->hw->mr.fcport, in qla2x00_do_dpc()
7026 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7028 * - NO-OP -- await next ISP-ABORT. Preferred method in qla2x00_do_dpc()
7030 * when a forced chip-reset occurs. in qla2x00_do_dpc()
7031 * - Force -- ISP-ABORT scheduled. in qla2x00_do_dpc()
7033 /* set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); */ in qla2x00_do_dpc()
7037 (ISP_ABORT_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7038 !test_bit(UNLOADING, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7041 switch (base_vha->qlini_mode) { in qla2x00_do_dpc()
7046 !ha->flags.fw_started) in qla2x00_do_dpc()
7051 !ha->flags.fw_started) in qla2x00_do_dpc()
7059 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7060 base_vha->flags.online = 1; in qla2x00_do_dpc()
7063 if (ha->isp_ops->abort_isp(base_vha)) { in qla2x00_do_dpc()
7066 &base_vha->dpc_flags); in qla2x00_do_dpc()
7069 &base_vha->dpc_flags); in qla2x00_do_dpc()
7075 if (test_bit(PROCESS_PUREX_IOCB, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7076 if (atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7078 (&base_vha->purex_list); in qla2x00_do_dpc()
7080 &base_vha->dpc_flags); in qla2x00_do_dpc()
7087 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7096 &base_vha->dpc_flags); in qla2x00_do_dpc()
7097 if (!ha->flags.quiesce_owner) { in qla2x00_do_dpc()
7113 &base_vha->dpc_flags); in qla2x00_do_dpc()
7121 &base_vha->dpc_flags) && in qla2x00_do_dpc()
7122 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { in qla2x00_do_dpc()
7127 clear_bit(RESET_ACTIVE, &base_vha->dpc_flags); in qla2x00_do_dpc()
7133 if (test_bit(RELOGIN_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7134 !test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7135 atomic_read(&base_vha->loop_state) != LOOP_DOWN) { in qla2x00_do_dpc()
7137 if (!base_vha->relogin_jif || in qla2x00_do_dpc()
7138 time_after_eq(jiffies, base_vha->relogin_jif)) { in qla2x00_do_dpc()
7139 base_vha->relogin_jif = jiffies + HZ; in qla2x00_do_dpc()
7140 clear_bit(RELOGIN_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7150 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7158 &base_vha->dpc_flags))) { in qla2x00_do_dpc()
7163 &base_vha->dpc_flags); in qla2x00_do_dpc()
7173 if (test_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags) && in qla2x00_do_dpc()
7174 atomic_read(&base_vha->loop_state) == LOOP_READY) { in qla2x00_do_dpc()
7175 clear_bit(NPIV_CONFIG_NEEDED, &base_vha->dpc_flags); in qla2x00_do_dpc()
7180 if (!ha->interrupts_on) in qla2x00_do_dpc()
7181 ha->isp_ops->enable_intrs(ha); in qla2x00_do_dpc()
7184 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7185 if (ha->beacon_blink_led == 1) in qla2x00_do_dpc()
7186 ha->isp_ops->beacon_blink(base_vha); in qla2x00_do_dpc()
7191 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7192 if (ha->flags.eeh_busy || in qla2x00_do_dpc()
7193 ha->flags.pci_channel_io_perm_failure) in qla2x00_do_dpc()
7198 mutex_lock(&ha->mq_lock); in qla2x00_do_dpc()
7199 list_for_each_entry(qpair, &base_vha->qp_list, in qla2x00_do_dpc()
7201 qpair->online = online; in qla2x00_do_dpc()
7202 mutex_unlock(&ha->mq_lock); in qla2x00_do_dpc()
7206 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7207 u16 threshold = ha->nvme_last_rptd_aen + ha->last_zio_threshold; in qla2x00_do_dpc()
7209 if (threshold > ha->orig_fw_xcb_count) in qla2x00_do_dpc()
7210 threshold = ha->orig_fw_xcb_count; in qla2x00_do_dpc()
7226 &base_vha->dpc_flags)) { in qla2x00_do_dpc()
7230 ha->dpc_active = 0; in qla2x00_do_dpc()
7242 ha->dpc_active = 0; in qla2x00_do_dpc()
7253 struct qla_hw_data *ha = vha->hw; in qla2xxx_wake_dpc()
7254 struct task_struct *t = ha->dpc_thread; in qla2xxx_wake_dpc()
7256 if (!test_bit(UNLOADING, &vha->dpc_flags) && t) in qla2xxx_wake_dpc()
7270 if (vha->flags.online && !vha->flags.reset_active && in qla2x00_rst_aen()
7271 !atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7272 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))) { in qla2x00_rst_aen()
7274 clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); in qla2x00_rst_aen()
7280 vha->marker_needed = 1; in qla2x00_rst_aen()
7281 } while (!atomic_read(&vha->loop_down_timer) && in qla2x00_rst_aen()
7282 (test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags))); in qla2x00_rst_aen()
7288 struct qla_hw_data *ha = vha->hw; in qla_do_heartbeat()
7297 cmpl_cnt = ha->base_qpair->cmd_completion_cnt; in qla_do_heartbeat()
7298 if (cmpl_cnt == ha->base_qpair->prev_completion_cnt && in qla_do_heartbeat()
7299 cmpl_cnt != ha->base_qpair->cmd_cnt) { in qla_do_heartbeat()
7303 ha->base_qpair->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7305 for (i = 0; i < ha->max_qpairs; i++) { in qla_do_heartbeat()
7306 if (ha->queue_pair_map[i]) { in qla_do_heartbeat()
7307 cmpl_cnt = ha->queue_pair_map[i]->cmd_completion_cnt; in qla_do_heartbeat()
7308 if (cmpl_cnt == ha->queue_pair_map[i]->prev_completion_cnt && in qla_do_heartbeat()
7309 cmpl_cnt != ha->queue_pair_map[i]->cmd_cnt) { in qla_do_heartbeat()
7313 ha->queue_pair_map[i]->prev_completion_cnt = cmpl_cnt; in qla_do_heartbeat()
7323 struct qla_hw_data *ha = vha->hw; in qla_heart_beat()
7325 if (vha->vp_idx) in qla_heart_beat()
7328 if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha)) in qla_heart_beat()
7337 time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ)) in qla_heart_beat()
7341 ha->last_heartbeat_run_jiffies = jiffies; in qla_heart_beat()
7342 queue_work(ha->wq, &ha->heartbeat_work); in qla_heart_beat()
7348 struct qla_hw_data *ha = vha->hw; in qla_wind_down_chip()
7350 if (!ha->flags.eeh_busy) in qla_wind_down_chip()
7352 if (ha->pci_error_state) in qla_wind_down_chip()
7360 if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handling * HZ) && in qla_wind_down_chip()
7361 !ha->flags.eeh_flush) { in qla_wind_down_chip()
7365 ha->isp_ops->reset_chip(vha); in qla_wind_down_chip()
7366 ha->isp_ops->disable_intrs(ha); in qla_wind_down_chip()
7368 ha->flags.eeh_flush = EEH_FLUSH_RDY; in qla_wind_down_chip()
7369 ha->eeh_jif = jiffies; in qla_wind_down_chip()
7371 } else if (ha->flags.eeh_flush == EEH_FLUSH_RDY && in qla_wind_down_chip()
7372 time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { in qla_wind_down_chip()
7373 pci_clear_master(ha->pdev); in qla_wind_down_chip()
7377 ha->flags.eeh_flush = EEH_FLUSH_DONE; in qla_wind_down_chip()
7399 srb_t *sp; in qla2x00_timer() local
7401 struct qla_hw_data *ha = vha->hw; in qla2x00_timer()
7406 if (ha->flags.eeh_busy) { in qla2x00_timer()
7411 ha->flags.eeh_busy); in qla2x00_timer()
7418 * the read returns -1 then disable the board. in qla2x00_timer()
7420 if (!pci_channel_offline(ha->pdev)) { in qla2x00_timer()
7421 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); in qla2x00_timer()
7426 if (!vha->vp_idx && IS_P3P_TYPE(ha)) { in qla2x00_timer()
7427 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7435 if (!vha->vp_idx && IS_QLAFX00(ha)) in qla2x00_timer()
7438 if (vha->link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7439 vha->link_down_time++; in qla2x00_timer()
7441 spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7442 list_for_each_entry(fcport, &vha->vp_fcports, list) { in qla2x00_timer()
7443 if (fcport->tgt_link_down_time < QLA2XX_MAX_LINK_DOWN_TIME) in qla2x00_timer()
7444 fcport->tgt_link_down_time++; in qla2x00_timer()
7446 spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); in qla2x00_timer()
7449 if (atomic_read(&vha->loop_down_timer) > 0 && in qla2x00_timer()
7450 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) && in qla2x00_timer()
7451 !(test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags)) in qla2x00_timer()
7452 && vha->flags.online) { in qla2x00_timer()
7454 if (atomic_read(&vha->loop_down_timer) == in qla2x00_timer()
7455 vha->loop_down_abort_time) { in qla2x00_timer()
7458 "Loop down - aborting the queues before time expires.\n"); in qla2x00_timer()
7460 if (!IS_QLA2100(ha) && vha->link_down_timeout) in qla2x00_timer()
7461 atomic_set(&vha->loop_state, LOOP_DEAD); in qla2x00_timer()
7464 * Schedule an ISP abort to return any FCP2-device in qla2x00_timer()
7467 /* NPIV - scan physical port only */ in qla2x00_timer()
7468 if (!vha->vp_idx) { in qla2x00_timer()
7469 spin_lock_irqsave(&ha->hardware_lock, in qla2x00_timer()
7471 req = ha->req_q_map[0]; in qla2x00_timer()
7473 index < req->num_outstanding_cmds; in qla2x00_timer()
7477 sp = req->outstanding_cmds[index]; in qla2x00_timer()
7478 if (!sp) in qla2x00_timer()
7480 if (sp->cmd_type != TYPE_SRB) in qla2x00_timer()
7482 if (sp->type != SRB_SCSI_CMD) in qla2x00_timer()
7484 sfcp = sp->fcport; in qla2x00_timer()
7485 if (!(sfcp->flags & FCF_FCP2_DEVICE)) in qla2x00_timer()
7490 &vha->dpc_flags); in qla2x00_timer()
7493 &vha->dpc_flags); in qla2x00_timer()
7496 spin_unlock_irqrestore(&ha->hardware_lock, in qla2x00_timer()
7503 if (atomic_dec_and_test(&vha->loop_down_timer) != 0) { in qla2x00_timer()
7504 if (!(vha->device_flags & DFLG_NO_CABLE) && !vha->vp_idx) { in qla2x00_timer()
7506 "Loop down - aborting ISP.\n"); in qla2x00_timer()
7510 &vha->dpc_flags); in qla2x00_timer()
7513 &vha->dpc_flags); in qla2x00_timer()
7517 "Loop down - seconds remaining %d.\n", in qla2x00_timer()
7518 atomic_read(&vha->loop_down_timer)); in qla2x00_timer()
7521 if (!vha->vp_idx && (ha->beacon_blink_led == 1)) { in qla2x00_timer()
7524 set_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7530 if (vha->hw->flags.edif_enabled) in qla2x00_timer()
7534 if (!list_empty(&vha->work_list)) { in qla2x00_timer()
7538 spin_lock_irqsave(&vha->work_lock, flags); in qla2x00_timer()
7539 if (!test_and_set_bit(IOCB_WORK_ACTIVE, &vha->dpc_flags)) in qla2x00_timer()
7541 spin_unlock_irqrestore(&vha->work_lock, flags); in qla2x00_timer()
7543 queue_work(vha->hw->wq, &vha->iocb_work); in qla2x00_timer()
7547 * FC-NVME in qla2x00_timer()
7550 index = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7551 if (!vha->vp_idx && in qla2x00_timer()
7552 (index != ha->nvme_last_rptd_aen) && in qla2x00_timer()
7553 ha->zio_mode == QLA_ZIO_MODE_6 && in qla2x00_timer()
7554 !ha->flags.host_shutting_down) { in qla2x00_timer()
7555 ha->nvme_last_rptd_aen = atomic_read(&ha->nvme_active_aen_cnt); in qla2x00_timer()
7557 "nvme: Sched: Set ZIO exchange threshold to %d.\n", in qla2x00_timer()
7558 ha->nvme_last_rptd_aen); in qla2x00_timer()
7559 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7563 if (!vha->vp_idx && in qla2x00_timer()
7564 atomic_read(&ha->zio_threshold) != ha->last_zio_threshold && in qla2x00_timer()
7567 "Sched: Set ZIO exchange threshold to %d.\n", in qla2x00_timer()
7568 ha->last_zio_threshold); in qla2x00_timer()
7569 ha->last_zio_threshold = atomic_read(&ha->zio_threshold); in qla2x00_timer()
7570 set_bit(SET_ZIO_THRESHOLD_NEEDED, &vha->dpc_flags); in qla2x00_timer()
7578 if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7579 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7581 test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7582 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7583 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags) || in qla2x00_timer()
7584 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7585 test_bit(VP_DPC_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7586 test_bit(RELOGIN_NEEDED, &vha->dpc_flags) || in qla2x00_timer()
7587 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags))) { in qla2x00_timer()
7591 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7592 test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7593 start_dpc, test_bit(RESET_MARKER_NEEDED, &vha->dpc_flags)); in qla2x00_timer()
7598 test_bit(BEACON_BLINK_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7599 test_bit(ISP_UNRECOVERABLE, &vha->dpc_flags), in qla2x00_timer()
7600 test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7601 test_bit(VP_DPC_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7602 test_bit(RELOGIN_NEEDED, &vha->dpc_flags), in qla2x00_timer()
7603 test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags)); in qla2x00_timer()
7663 struct qla_hw_data *ha = vha->hw; in qla2x00_request_firmware()
7694 if (!blob->name) in qla2x00_request_firmware()
7698 if (blob->fw) in qla2x00_request_firmware()
7701 if (request_firmware(&blob->fw, blob->name, &ha->pdev->dev)) { in qla2x00_request_firmware()
7703 "Failed to load firmware image (%s).\n", blob->name); in qla2x00_request_firmware()
7704 blob->fw = NULL; in qla2x00_request_firmware()
7719 for (blob = qla_fw_blobs; blob->name; blob++) in qla2x00_release_firmware()
7720 release_firmware(blob->fw); in qla2x00_release_firmware()
7726 struct qla_hw_data *ha = vha->hw; in qla_pci_error_cleanup()
7727 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_error_cleanup()
7736 ha->chip_reset++; in qla_pci_error_cleanup()
7738 ha->base_qpair->chip_reset = ha->chip_reset; in qla_pci_error_cleanup()
7739 for (i = 0; i < ha->max_qpairs; i++) { in qla_pci_error_cleanup()
7740 if (ha->queue_pair_map[i]) in qla_pci_error_cleanup()
7741 ha->queue_pair_map[i]->chip_reset = in qla_pci_error_cleanup()
7742 ha->base_qpair->chip_reset; in qla_pci_error_cleanup()
7750 mutex_lock(&ha->mq_lock); in qla_pci_error_cleanup()
7751 ha->base_qpair->online = 0; in qla_pci_error_cleanup()
7752 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_error_cleanup()
7753 qpair->online = 0; in qla_pci_error_cleanup()
7755 mutex_unlock(&ha->mq_lock); in qla_pci_error_cleanup()
7759 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7760 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7761 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7762 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7764 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7765 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7767 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7770 list_for_each_entry(fcport, &vha->vp_fcports, list) in qla_pci_error_cleanup()
7771 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7773 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7774 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { in qla_pci_error_cleanup()
7775 atomic_inc(&vp->vref_count); in qla_pci_error_cleanup()
7776 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7777 list_for_each_entry(fcport, &vp->vp_fcports, list) in qla_pci_error_cleanup()
7778 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); in qla_pci_error_cleanup()
7779 spin_lock_irqsave(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7780 atomic_dec(&vp->vref_count); in qla_pci_error_cleanup()
7782 spin_unlock_irqrestore(&ha->vport_slock, flags); in qla_pci_error_cleanup()
7790 struct qla_hw_data *ha = vha->hw; in qla2xxx_pci_error_detected()
7795 ha->pci_error_state = QLA_PCI_ERR_DETECTED; in qla2xxx_pci_error_detected()
7797 if (!atomic_read(&pdev->enable_cnt)) { in qla2xxx_pci_error_detected()
7808 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7818 ha->flags.pci_channel_io_perm_failure = 1; in qla2xxx_pci_error_detected()
7821 set_bit(QPAIR_ONLINE_CHECK_NEEDED, &vha->dpc_flags); in qla2xxx_pci_error_detected()
7839 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_mmio_enabled()
7840 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; in qla2xxx_pci_mmio_enabled()
7841 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; in qla2xxx_pci_mmio_enabled()
7846 ha->pci_error_state = QLA_PCI_MMIO_ENABLED; in qla2xxx_pci_mmio_enabled()
7857 spin_lock_irqsave(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7859 stat = rd_reg_word(&reg->hccr); in qla2xxx_pci_mmio_enabled()
7863 stat = rd_reg_dword(&reg->u.isp2300.host_status); in qla2xxx_pci_mmio_enabled()
7867 stat = rd_reg_dword(&reg24->host_status); in qla2xxx_pci_mmio_enabled()
7871 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla2xxx_pci_mmio_enabled()
7875 "RISC paused -- mmio_enabled, Dumping firmware.\n"); in qla2xxx_pci_mmio_enabled()
7890 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_slot_reset()
7897 ha->pci_error_state = QLA_PCI_SLOT_RESET; in qla2xxx_pci_slot_reset()
7902 pdev->error_state = pci_channel_io_normal; in qla2xxx_pci_slot_reset()
7911 if (ha->mem_only) in qla2xxx_pci_slot_reset()
7918 "Can't re-enable PCI device after reset.\n"); in qla2xxx_pci_slot_reset()
7923 if (ha->isp_ops->pci_config(base_vha)) in qla2xxx_pci_slot_reset()
7926 mutex_lock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7927 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla2xxx_pci_slot_reset()
7928 qpair->online = 1; in qla2xxx_pci_slot_reset()
7929 mutex_unlock(&ha->mq_lock); in qla2xxx_pci_slot_reset()
7931 ha->flags.eeh_busy = 0; in qla2xxx_pci_slot_reset()
7932 base_vha->flags.online = 1; in qla2xxx_pci_slot_reset()
7933 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7934 ha->isp_ops->abort_isp(base_vha); in qla2xxx_pci_slot_reset()
7935 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla2xxx_pci_slot_reset()
7938 ha->flags.eeh_busy = 1; in qla2xxx_pci_slot_reset()
7957 struct qla_hw_data *ha = base_vha->hw; in qla2xxx_pci_resume()
7969 ha->pci_error_state = QLA_PCI_RESUME; in qla2xxx_pci_resume()
7976 struct qla_hw_data *ha = vha->hw; in qla_pci_set_eeh_busy()
7977 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_pci_set_eeh_busy()
7981 if (ha->flags.eeh_busy) in qla_pci_set_eeh_busy()
7984 spin_lock_irqsave(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
7985 if (!ha->flags.eeh_busy) { in qla_pci_set_eeh_busy()
7986 ha->eeh_jif = jiffies; in qla_pci_set_eeh_busy()
7987 ha->flags.eeh_flush = 0; in qla_pci_set_eeh_busy()
7989 ha->flags.eeh_busy = 1; in qla_pci_set_eeh_busy()
7992 spin_unlock_irqrestore(&base_vha->work_lock, flags); in qla_pci_set_eeh_busy()
8004 struct qla_hw_data *ha = vha->hw; in qla_schedule_eeh_work()
8005 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev); in qla_schedule_eeh_work()
8007 if (ha->flags.eeh_busy) in qla_schedule_eeh_work()
8010 set_bit(DO_EEH_RECOVERY, &base_vha->dpc_flags); in qla_schedule_eeh_work()
8018 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_prepare()
8030 ha->flags.eeh_busy = 1; in qla_pci_reset_prepare()
8031 mutex_lock(&ha->mq_lock); in qla_pci_reset_prepare()
8032 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_prepare()
8033 qpair->online = 0; in qla_pci_reset_prepare()
8034 mutex_unlock(&ha->mq_lock); in qla_pci_reset_prepare()
8036 set_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_prepare()
8045 struct qla_hw_data *ha = base_vha->hw; in qla_pci_reset_done()
8054 ha->flags.eeh_busy = 0; in qla_pci_reset_done()
8055 mutex_lock(&ha->mq_lock); in qla_pci_reset_done()
8056 list_for_each_entry(qpair, &base_vha->qp_list, qp_list_elem) in qla_pci_reset_done()
8057 qpair->online = 1; in qla_pci_reset_done()
8058 mutex_unlock(&ha->mq_lock); in qla_pci_reset_done()
8060 base_vha->flags.online = 1; in qla_pci_reset_done()
8061 ha->isp_ops->abort_isp(base_vha); in qla_pci_reset_done()
8062 clear_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags); in qla_pci_reset_done()
8067 scsi_qla_host_t *vha = (scsi_qla_host_t *)shost->hostdata; in qla2xxx_map_queues()
8068 struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT]; in qla2xxx_map_queues()
8070 if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase) in qla2xxx_map_queues()
8073 blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); in qla2xxx_map_queues()
8097 .this_id = -1,
8165 * qla2x00_module_init - Module initialization.
8265 return -ENOMEM; in qla2x00_module_init()
8285 strcat(qla2x00_version_str, "-debug"); in qla2x00_module_init()
8294 ret = -ENODEV; in qla2x00_module_init()
8309 ret = -ENODEV; in qla2x00_module_init()
8343 * qla2x00_module_exit - Module cleanup.