Lines Matching refs:phba

78 	if (vport->phba->cfg_fof)  in lpfc_rport_data_from_scsi_device()
85 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *psb);
87 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb);
89 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
100 lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, in lpfc_sli4_set_rsp_sgl_last() argument
126 lpfc_rampdown_queue_depth(struct lpfc_hba *phba) in lpfc_rampdown_queue_depth() argument
132 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
133 atomic_inc(&phba->num_rsrc_err); in lpfc_rampdown_queue_depth()
134 phba->last_rsrc_error_time = jiffies; in lpfc_rampdown_queue_depth()
136 expires = phba->last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL; in lpfc_rampdown_queue_depth()
138 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
142 phba->last_ramp_down_time = jiffies; in lpfc_rampdown_queue_depth()
144 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
146 spin_lock_irqsave(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
147 evt_posted = phba->pport->work_port_events & WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
149 phba->pport->work_port_events |= WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
150 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
153 lpfc_worker_wake_up(phba); in lpfc_rampdown_queue_depth()
166 lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) in lpfc_ramp_down_queue_handler() argument
175 num_rsrc_err = atomic_read(&phba->num_rsrc_err); in lpfc_ramp_down_queue_handler()
176 num_cmd_success = atomic_read(&phba->num_cmd_success); in lpfc_ramp_down_queue_handler()
186 vports = lpfc_create_vport_work_array(phba); in lpfc_ramp_down_queue_handler()
188 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_ramp_down_queue_handler()
202 lpfc_destroy_vport_work_array(phba, vports); in lpfc_ramp_down_queue_handler()
203 atomic_set(&phba->num_rsrc_err, 0); in lpfc_ramp_down_queue_handler()
204 atomic_set(&phba->num_cmd_success, 0); in lpfc_ramp_down_queue_handler()
216 lpfc_scsi_dev_block(struct lpfc_hba *phba) in lpfc_scsi_dev_block() argument
224 vports = lpfc_create_vport_work_array(phba); in lpfc_scsi_dev_block()
226 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_scsi_dev_block()
233 lpfc_destroy_vport_work_array(phba, vports); in lpfc_scsi_dev_block()
255 struct lpfc_hba *phba = vport->phba; in lpfc_new_scsi_buf_s3() local
265 bpl_size = phba->cfg_sg_dma_buf_size - in lpfc_new_scsi_buf_s3()
270 num_to_alloc, phba->cfg_sg_dma_buf_size, in lpfc_new_scsi_buf_s3()
285 psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_scsi_buf_s3()
294 iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); in lpfc_new_scsi_buf_s3()
296 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_scsi_buf_s3()
339 if ((phba->sli_rev == 3) && in lpfc_new_scsi_buf_s3()
340 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) { in lpfc_new_scsi_buf_s3()
374 lpfc_release_scsi_buf_s3(phba, psb); in lpfc_new_scsi_buf_s3()
391 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_vport_delete_fcp_xri_aborted() local
400 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
401 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_vport_delete_fcp_xri_aborted()
402 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_vport_delete_fcp_xri_aborted()
416 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
429 lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, in lpfc_sli4_io_xri_aborted() argument
441 struct lpfc_sli_ring *pring = phba->sli4_hba.els_wq->pring; in lpfc_sli4_io_xri_aborted()
445 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_sli4_io_xri_aborted()
447 offline = pci_channel_offline(phba->pcidev); in lpfc_sli4_io_xri_aborted()
452 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_io_xri_aborted()
453 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
466 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
468 lpfc_sli4_nvme_xri_aborted(phba, axri, in lpfc_sli4_io_xri_aborted()
472 lpfc_sli4_nvme_pci_offline_aborted(phba, psb); in lpfc_sli4_io_xri_aborted()
473 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
485 rrq_empty = list_empty(&phba->active_rrq_list); in lpfc_sli4_io_xri_aborted()
486 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
488 lpfc_set_rrq_active(phba, ndlp, in lpfc_sli4_io_xri_aborted()
490 lpfc_sli4_abts_err_handler(phba, ndlp, axri); in lpfc_sli4_io_xri_aborted()
493 if (phba->cfg_fcp_wait_abts_rsp || offline) { in lpfc_sli4_io_xri_aborted()
517 lpfc_release_scsi_buf_s4(phba, psb); in lpfc_sli4_io_xri_aborted()
519 lpfc_worker_wake_up(phba); in lpfc_sli4_io_xri_aborted()
522 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
529 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli4_io_xri_aborted()
530 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli4_io_xri_aborted()
539 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
541 lpfc_worker_wake_up(phba); in lpfc_sli4_io_xri_aborted()
545 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
562 lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf_s3() argument
566 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; in lpfc_get_scsi_buf_s3()
569 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
573 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
574 list_splice(&phba->lpfc_scsi_buf_list_put, in lpfc_get_scsi_buf_s3()
575 &phba->lpfc_scsi_buf_list_get); in lpfc_get_scsi_buf_s3()
576 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_get_scsi_buf_s3()
579 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
581 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
583 if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) { in lpfc_get_scsi_buf_s3()
603 lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf_s4() argument
616 if (cmnd && phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_HDWQ) { in lpfc_get_scsi_buf_s4()
620 idx = phba->sli4_hba.cpu_map[cpu].hdwq; in lpfc_get_scsi_buf_s4()
623 lpfc_cmd = lpfc_get_io_buf(phba, ndlp, idx, in lpfc_get_scsi_buf_s4()
624 !phba->cfg_xri_rebalancing); in lpfc_get_scsi_buf_s4()
626 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_get_scsi_buf_s4()
645 tmp = lpfc_get_cmd_rsp_buf_per_hdwq(phba, lpfc_cmd); in lpfc_get_scsi_buf_s4()
647 lpfc_release_io_buf(phba, lpfc_cmd, lpfc_cmd->hdwq); in lpfc_get_scsi_buf_s4()
678 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { in lpfc_get_scsi_buf_s4()
698 lpfc_get_scsi_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf() argument
701 return phba->lpfc_get_scsi_buf(phba, ndlp, cmnd); in lpfc_get_scsi_buf()
713 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf_s3() argument
720 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
723 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); in lpfc_release_scsi_buf_s3()
724 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
738 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf_s4() argument
749 if (!phba->cfg_fcp_wait_abts_rsp) in lpfc_release_scsi_buf_s4()
755 lpfc_release_io_buf(phba, (struct lpfc_io_buf *)psb, qp); in lpfc_release_scsi_buf_s4()
768 lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf() argument
774 phba->lpfc_release_scsi_buf(phba, psb); in lpfc_release_scsi_buf()
811 lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s3() argument
839 nseg = dma_map_sg(&phba->pcidev->dev, scsi_sglist(scsi_cmnd), in lpfc_scsi_prep_dma_buf_s3()
845 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s3()
846 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_prep_dma_buf_s3()
849 " %d\n", __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s3()
851 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_scsi_prep_dma_buf_s3()
868 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
869 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
896 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
897 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
961 lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_inject() argument
985 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { in lpfc_bg_err_inject()
990 if (phba->lpfc_injerr_lba < (u64)lba || in lpfc_bg_err_inject()
991 (phba->lpfc_injerr_lba >= (u64)(lba + numblks))) in lpfc_bg_err_inject()
994 blockoff = phba->lpfc_injerr_lba - (u64)lba; in lpfc_bg_err_inject()
1008 if (phba->lpfc_injerr_nportid && in lpfc_bg_err_inject()
1009 (phba->lpfc_injerr_nportid != ndlp->nlp_DID)) in lpfc_bg_err_inject()
1016 if (phba->lpfc_injerr_wwpn.u.wwn[0] && in lpfc_bg_err_inject()
1017 (memcmp(&ndlp->nlp_portname, &phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1031 if (phba->lpfc_injerr_wref_cnt) { in lpfc_bg_err_inject()
1043 lpfc_printf_log(phba, KERN_ERR, in lpfc_bg_err_inject()
1063 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1064 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1065 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1066 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1068 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1084 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1085 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1086 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1087 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1089 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1094 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1105 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1106 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1107 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1108 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1110 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1115 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1121 if (phba->lpfc_injerr_rref_cnt) { in lpfc_bg_err_inject()
1132 phba->lpfc_injerr_rref_cnt--; in lpfc_bg_err_inject()
1133 if (phba->lpfc_injerr_rref_cnt == 0) { in lpfc_bg_err_inject()
1134 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1135 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1137 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1142 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1152 if (phba->lpfc_injerr_wapp_cnt) { in lpfc_bg_err_inject()
1164 lpfc_printf_log(phba, KERN_ERR, in lpfc_bg_err_inject()
1184 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1185 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1186 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1187 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1189 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1204 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1205 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1206 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1207 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1209 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1214 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1225 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1226 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1227 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1228 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1230 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1235 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1241 if (phba->lpfc_injerr_rapp_cnt) { in lpfc_bg_err_inject()
1252 phba->lpfc_injerr_rapp_cnt--; in lpfc_bg_err_inject()
1253 if (phba->lpfc_injerr_rapp_cnt == 0) { in lpfc_bg_err_inject()
1254 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1255 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1257 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1262 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1273 if (phba->lpfc_injerr_wgrd_cnt) { in lpfc_bg_err_inject()
1285 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1286 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1287 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1288 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1290 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1297 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1307 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1308 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1309 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1310 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1312 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1319 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1325 if (phba->lpfc_injerr_rgrd_cnt) { in lpfc_bg_err_inject()
1335 phba->lpfc_injerr_rgrd_cnt--; in lpfc_bg_err_inject()
1336 if (phba->lpfc_injerr_rgrd_cnt == 0) { in lpfc_bg_err_inject()
1337 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1338 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1340 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1347 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1370 lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_sc_to_bg_opcodes() argument
1397 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sc_to_bg_opcodes()
1426 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sc_to_bg_opcodes()
1450 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_opcodes() argument
1541 lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl() argument
1557 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1567 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl()
1570 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1683 lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl_prot() argument
1713 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1719 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
1730 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl_prot()
1733 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
1742 if (num_bde >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_bpl_prot()
1823 if (num_bde >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_bpl_prot()
1827 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1890 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1931 lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl() argument
1951 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
1961 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl()
1964 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2018 if (!lsp_just_set && !((j + 1) % phba->border_sge_num) && in lpfc_bg_setup_sgl()
2023 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl()
2059 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl()
2114 lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl_prot() argument
2145 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2151 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2162 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl_prot()
2165 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2174 if ((num_sge >= (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_setup_sgl_prot()
2175 !(phba->cfg_xpsgl)) in lpfc_bg_setup_sgl_prot()
2179 if (!((j + 1) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2180 !((j + 2) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2181 !((j + 3) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2187 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl_prot()
2199 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2294 if ((num_sge >= phba->cfg_total_seg_cnt) && in lpfc_bg_setup_sgl_prot()
2295 !phba->cfg_xpsgl) in lpfc_bg_setup_sgl_prot()
2299 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2305 if (!((j + 1) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2312 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, in lpfc_bg_setup_sgl_prot()
2326 phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2404 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2427 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) in lpfc_prot_group_type() argument
2444 if (phba) in lpfc_prot_group_type()
2445 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_prot_group_type()
2464 lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, in lpfc_bg_scsi_adjust_dl() argument
2507 lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s3() argument
2519 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s3()
2533 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2542 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2543 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s3()
2548 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s3()
2554 if ((lpfc_cmd->seg_cnt + 2) > phba->cfg_total_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2559 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2574 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2589 (phba->cfg_total_seg_cnt - 2)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2594 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2598 (num_bde > phba->cfg_total_seg_cnt)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2609 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2627 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s3()
2649 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s3()
2653 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2657 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s3()
2700 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_calc_bg_err() argument
2840 phba->bg_guard_err_cnt++; in lpfc_calc_bg_err()
2841 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2850 phba->bg_reftag_err_cnt++; in lpfc_calc_bg_err()
2851 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2860 phba->bg_apptag_err_cnt++; in lpfc_calc_bg_err()
2861 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2881 lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, in lpfc_parse_bg_err() argument
2893 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_parse_bg_err()
2936 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2948 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2962 phba->bg_guard_err_cnt++; in lpfc_parse_bg_err()
2963 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2975 phba->bg_reftag_err_cnt++; in lpfc_parse_bg_err()
2976 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2988 phba->bg_apptag_err_cnt++; in lpfc_parse_bg_err()
2989 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3033 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3041 lpfc_calc_bg_err(phba, lpfc_cmd); in lpfc_parse_bg_err()
3061 lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s4() argument
3069 struct lpfc_vport *vport = phba->pport; in lpfc_scsi_prep_dma_buf_s4()
3104 if (!phba->cfg_xpsgl && in lpfc_scsi_prep_dma_buf_s4()
3105 lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s4()
3106 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_prep_dma_buf_s4()
3110 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s4()
3112 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_scsi_prep_dma_buf_s4()
3142 !((j + 1) % phba->border_sge_num) && in lpfc_scsi_prep_dma_buf_s4()
3149 phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf_s4()
3192 phba->cfg_sg_dma_buf_size); in lpfc_scsi_prep_dma_buf_s4()
3208 ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3209 phba->cfg_enable_pbde)) { in lpfc_scsi_prep_dma_buf_s4()
3233 if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3234 phba->cfg_enable_pbde) { in lpfc_scsi_prep_dma_buf_s4()
3249 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_scsi_prep_dma_buf_s4()
3270 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_scsi_prep_dma_buf_s4()
3285 (phba->cfg_XLanePriority << 1)); in lpfc_scsi_prep_dma_buf_s4()
3305 lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s4() argument
3318 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s4()
3331 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3347 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt && in lpfc_bg_scsi_prep_dma_buf_s4()
3348 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3349 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s4()
3354 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s4()
3360 phba->cfg_total_seg_cnt) && in lpfc_bg_scsi_prep_dma_buf_s4()
3361 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3366 num_sge = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3382 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3396 (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_scsi_prep_dma_buf_s4()
3397 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3402 num_sge = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3407 (num_sge > phba->cfg_total_seg_cnt && in lpfc_bg_scsi_prep_dma_buf_s4()
3408 !phba->cfg_xpsgl)) { in lpfc_bg_scsi_prep_dma_buf_s4()
3419 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3441 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s4()
3445 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_bg_scsi_prep_dma_buf_s4()
3466 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_bg_scsi_prep_dma_buf_s4()
3474 (phba->cfg_XLanePriority << 1)); in lpfc_bg_scsi_prep_dma_buf_s4()
3493 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s4()
3497 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3501 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s4()
3522 lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf() argument
3524 return phba->lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf()
3541 lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_bg_scsi_prep_dma_buf() argument
3543 return phba->lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf()
3563 return vport->phba->lpfc_scsi_prep_cmnd_buf(vport, lpfc_cmd, tmo); in lpfc_scsi_prep_cmnd_buf()
3577 lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, in lpfc_send_scsi_error_event() argument
3593 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3608 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3634 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3653 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3654 list_add_tail(&fast_path_evt->work_evt.evt_listp, &phba->work_list); in lpfc_send_scsi_error_event()
3655 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3656 lpfc_worker_wake_up(phba); in lpfc_send_scsi_error_event()
3669 lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_scsi_unprep_dma_buf() argument
3680 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(psb->pCmd), in lpfc_scsi_unprep_dma_buf()
3693 lpfc_unblock_requests(struct lpfc_hba *phba) in lpfc_unblock_requests() argument
3699 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_unblock_requests()
3700 !phba->sli4_hba.max_cfg_param.vpi_used) { in lpfc_unblock_requests()
3701 shost = lpfc_shost_from_vport(phba->pport); in lpfc_unblock_requests()
3706 vports = lpfc_create_vport_work_array(phba); in lpfc_unblock_requests()
3708 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_unblock_requests()
3712 lpfc_destroy_vport_work_array(phba, vports); in lpfc_unblock_requests()
3723 lpfc_block_requests(struct lpfc_hba *phba) in lpfc_block_requests() argument
3729 if (atomic_read(&phba->cmf_stop_io)) in lpfc_block_requests()
3732 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_block_requests()
3733 !phba->sli4_hba.max_cfg_param.vpi_used) { in lpfc_block_requests()
3734 shost = lpfc_shost_from_vport(phba->pport); in lpfc_block_requests()
3739 vports = lpfc_create_vport_work_array(phba); in lpfc_block_requests()
3741 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_block_requests()
3745 lpfc_destroy_vport_work_array(phba, vports); in lpfc_block_requests()
3762 lpfc_update_cmf_cmpl(struct lpfc_hba *phba, in lpfc_update_cmf_cmpl() argument
3774 cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); in lpfc_update_cmf_cmpl()
3791 lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t size) in lpfc_update_cmf_cmd() argument
3798 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_update_cmf_cmd()
3799 phba->cmf_max_bytes_per_interval) { in lpfc_update_cmf_cmd()
3802 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_update_cmf_cmd()
3805 if (total >= phba->cmf_max_bytes_per_interval) { in lpfc_update_cmf_cmd()
3806 if (!atomic_xchg(&phba->cmf_bw_wait, 1)) { in lpfc_update_cmf_cmd()
3807 lpfc_block_requests(phba); in lpfc_update_cmf_cmd()
3808 phba->cmf_last_ts = in lpfc_update_cmf_cmd()
3809 lpfc_calc_cmf_latency(phba); in lpfc_update_cmf_cmd()
3811 atomic_inc(&phba->cmf_busy); in lpfc_update_cmf_cmd()
3814 if (size > atomic_read(&phba->rx_max_read_cnt)) in lpfc_update_cmf_cmd()
3815 atomic_set(&phba->rx_max_read_cnt, size); in lpfc_update_cmf_cmd()
3818 cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); in lpfc_update_cmf_cmd()
4004 lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, fcpi_parm); in lpfc_handle_fcp_err()
4018 lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, in lpfc_fcp_io_cmd_wqe_cmpl() argument
4051 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4057 if (phba->sli4_hba.hdwq) in lpfc_fcp_io_cmd_wqe_cmpl()
4058 phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; in lpfc_fcp_io_cmd_wqe_cmpl()
4061 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_fcp_io_cmd_wqe_cmpl()
4062 this_cpu_inc(phba->sli4_hba.c_stat->cmpl_io); in lpfc_fcp_io_cmd_wqe_cmpl()
4073 if (phba->cfg_fcp_wait_abts_rsp) in lpfc_fcp_io_cmd_wqe_cmpl()
4149 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_fcp_io_cmd_wqe_cmpl()
4168 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_fcp_io_cmd_wqe_cmpl()
4170 &phba->work_list); in lpfc_fcp_io_cmd_wqe_cmpl()
4171 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_fcp_io_cmd_wqe_cmpl()
4172 lpfc_worker_wake_up(phba); in lpfc_fcp_io_cmd_wqe_cmpl()
4196 lpfc_set_rrq_active(phba, ndlp, in lpfc_fcp_io_cmd_wqe_cmpl()
4231 lpfc_parse_bg_err(phba, lpfc_cmd, pwqeOut); in lpfc_fcp_io_cmd_wqe_cmpl()
4300 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4306 phba->ktime_last_cmd = lpfc_cmd->ts_data_io; in lpfc_fcp_io_cmd_wqe_cmpl()
4307 lpfc_io_ktime(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4315 if (phba->cmf_active_mode != LPFC_CFG_OFF && in lpfc_fcp_io_cmd_wqe_cmpl()
4320 lpfc_update_cmf_cmpl(phba, lat, scsi_bufflen(cmd), shost); in lpfc_fcp_io_cmd_wqe_cmpl()
4339 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4353 lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, in lpfc_scsi_cmd_iocb_cmpl() argument
4373 if (!cmd || !phba) { in lpfc_scsi_cmd_iocb_cmpl()
4381 if (phba->sli4_hba.hdwq) in lpfc_scsi_cmd_iocb_cmpl()
4382 phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; in lpfc_scsi_cmd_iocb_cmpl()
4385 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_scsi_cmd_iocb_cmpl()
4386 this_cpu_inc(phba->sli4_hba.c_stat->cmpl_io); in lpfc_scsi_cmd_iocb_cmpl()
4453 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_scsi_cmd_iocb_cmpl()
4467 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_scsi_cmd_iocb_cmpl()
4486 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4488 &phba->work_list); in lpfc_scsi_cmd_iocb_cmpl()
4489 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4490 lpfc_worker_wake_up(phba); in lpfc_scsi_cmd_iocb_cmpl()
4518 lpfc_parse_bg_err(phba, lpfc_cmd, in lpfc_scsi_cmd_iocb_cmpl()
4529 && (phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_cmd_iocb_cmpl()
4535 lpfc_set_rrq_active(phba, pnode, in lpfc_scsi_cmd_iocb_cmpl()
4580 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4589 phba->ktime_last_cmd = lpfc_cmd->ts_data_io; in lpfc_scsi_cmd_iocb_cmpl()
4590 lpfc_io_ktime(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4607 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4703 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_prep_cmnd_buf_s4() local
4713 hdwq = &phba->sli4_hba.hdwq[idx]; in lpfc_scsi_prep_cmnd_buf_s4()
4746 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_scsi_prep_cmnd_buf_s4()
4774 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]); in lpfc_scsi_prep_cmnd_buf_s4()
4877 if (!(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_task_mgmt_cmd_s3()
4946 vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4963 lpfc_prep_embed_io(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4968 lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4983 lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_scsi_api_table_setup() argument
4986 phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; in lpfc_scsi_api_table_setup()
4990 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4991 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4992 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4993 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4994 phba->lpfc_scsi_prep_cmnd_buf = lpfc_scsi_prep_cmnd_buf_s3; in lpfc_scsi_api_table_setup()
4995 phba->lpfc_scsi_prep_task_mgmt_cmd = in lpfc_scsi_api_table_setup()
4999 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
5000 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
5001 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; in lpfc_scsi_api_table_setup()
5002 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; in lpfc_scsi_api_table_setup()
5003 phba->lpfc_scsi_prep_cmnd_buf = lpfc_scsi_prep_cmnd_buf_s4; in lpfc_scsi_api_table_setup()
5004 phba->lpfc_scsi_prep_task_mgmt_cmd = in lpfc_scsi_api_table_setup()
5008 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_scsi_api_table_setup()
5013 phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; in lpfc_scsi_api_table_setup()
5014 phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; in lpfc_scsi_api_table_setup()
5028 lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, in lpfc_tskmgmt_def_cmpl() argument
5034 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_tskmgmt_def_cmpl()
5053 lpfc_check_pci_resettable(struct lpfc_hba *phba) in lpfc_check_pci_resettable() argument
5055 const struct pci_dev *pdev = phba->pcidev; in lpfc_check_pci_resettable()
5063 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5070 if (phba->sli_rev != LPFC_SLI_REV4 || in lpfc_check_pci_resettable()
5071 phba->hba_flag & HBA_FCOE_MODE) { in lpfc_check_pci_resettable()
5072 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5083 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5107 struct lpfc_hba *phba = vport->phba; in lpfc_info() local
5113 if (phba && phba->pcidev){ in lpfc_info()
5115 scnprintf(tmp, sizeof(tmp), phba->ModelDesc); in lpfc_info()
5123 phba->pcidev->bus->number, phba->pcidev->devfn, in lpfc_info()
5124 phba->pcidev->irq); in lpfc_info()
5130 if (phba->Port[0]) { in lpfc_info()
5131 scnprintf(tmp, sizeof(tmp), " port %s", phba->Port); in lpfc_info()
5138 link_speed = lpfc_sli_port_speed_get(phba); in lpfc_info()
5148 if (!lpfc_check_pci_resettable(phba)) { in lpfc_info()
5165 static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) in lpfc_poll_rearm_timer() argument
5168 (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); in lpfc_poll_rearm_timer()
5170 if (!list_empty(&phba->sli.sli3_ring[LPFC_FCP_RING].txcmplq)) in lpfc_poll_rearm_timer()
5171 mod_timer(&phba->fcp_poll_timer, in lpfc_poll_rearm_timer()
5181 void lpfc_poll_start_timer(struct lpfc_hba * phba) in lpfc_poll_start_timer() argument
5183 lpfc_poll_rearm_timer(phba); in lpfc_poll_start_timer()
5195 struct lpfc_hba *phba = from_timer(phba, t, fcp_poll_timer); in lpfc_poll_timeout() local
5197 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_poll_timeout()
5198 lpfc_sli_handle_fast_ring_event(phba, in lpfc_poll_timeout()
5199 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_poll_timeout()
5201 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_poll_timeout()
5202 lpfc_poll_rearm_timer(phba); in lpfc_poll_timeout()
5237 struct lpfc_hba *phba = vport->phba; in lpfc_queuecommand() local
5262 (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { in lpfc_queuecommand()
5264 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_queuecommand()
5281 if (phba->cmf_active_mode != LPFC_CFG_OFF && in lpfc_queuecommand()
5285 err = lpfc_update_cmf_cmd(phba, scsi_bufflen(cmnd)); in lpfc_queuecommand()
5290 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { in lpfc_queuecommand()
5321 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp, cmnd); in lpfc_queuecommand()
5323 lpfc_rampdown_queue_depth(phba); in lpfc_queuecommand()
5348 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
5359 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5361 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
5371 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5383 if (lpfc_is_vmid_enabled(phba) && in lpfc_queuecommand()
5385 phba->pport->vmid_priority_tagging == in lpfc_queuecommand()
5402 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_queuecommand()
5403 this_cpu_inc(phba->sli4_hba.c_stat->xmt_io); in lpfc_queuecommand()
5406 err = lpfc_sli_issue_fcp_io(phba, LPFC_FCP_RING, cur_iocbq, in lpfc_queuecommand()
5411 lpfc_cmd->ts_last_cmd = phba->ktime_last_cmd; in lpfc_queuecommand()
5427 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5429 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5430 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi] : in lpfc_queuecommand()
5433 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5442 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_queuecommand()
5443 lpfc_sli_handle_fast_ring_event(phba, in lpfc_queuecommand()
5444 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_queuecommand()
5446 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_queuecommand()
5447 lpfc_poll_rearm_timer(phba); in lpfc_queuecommand()
5450 if (phba->cfg_xri_rebalancing) in lpfc_queuecommand()
5451 lpfc_keep_pvt_pool_above_lowwm(phba, lpfc_cmd->hdwq_no); in lpfc_queuecommand()
5457 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5458 if (phba->sli4_hba.hdwq) { in lpfc_queuecommand()
5461 phba->sli4_hba.hdwq[idx].scsi_cstat.output_requests--; in lpfc_queuecommand()
5464 phba->sli4_hba.hdwq[idx].scsi_cstat.input_requests--; in lpfc_queuecommand()
5467 phba->sli4_hba.hdwq[idx].scsi_cstat.control_requests--; in lpfc_queuecommand()
5471 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5473 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5478 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5484 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5485 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5503 del_timer_sync(&vport->phba->inactive_vmid_poll); in lpfc_vmid_vport_cleanup()
5535 struct lpfc_hba *phba = vport->phba; in lpfc_abort_handler() local
5556 spin_lock(&phba->hbalock); in lpfc_abort_handler()
5558 if (phba->hba_flag & HBA_IOQ_FLUSH) { in lpfc_abort_handler()
5575 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
5576 pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; in lpfc_abort_handler()
5610 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
5612 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5618 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
5620 ret_val = lpfc_sli4_issue_abort_iotag(phba, iocb, in lpfc_abort_handler()
5623 pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; in lpfc_abort_handler()
5624 ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, in lpfc_abort_handler()
5629 lpfc_issue_hb_tmo(phba); in lpfc_abort_handler()
5639 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5642 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_abort_handler()
5643 lpfc_sli_handle_fast_ring_event(phba, in lpfc_abort_handler()
5644 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_abort_handler()
5673 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
5676 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5801 struct lpfc_hba *phba = vport->phba; in lpfc_send_taskmgmt() local
5815 lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode, NULL); in lpfc_send_taskmgmt()
5818 lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; in lpfc_send_taskmgmt()
5823 status = phba->lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, in lpfc_send_taskmgmt()
5826 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5831 iocbqrsp = lpfc_sli_get_iocbq(phba); in lpfc_send_taskmgmt()
5833 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5846 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, in lpfc_send_taskmgmt()
5849 (get_job_ulpstatus(phba, iocbqrsp) != IOSTAT_SUCCESS)) { in lpfc_send_taskmgmt()
5851 get_job_ulpstatus(phba, iocbqrsp) != IOSTAT_FCP_RSP_ERROR) in lpfc_send_taskmgmt()
5857 get_job_ulpstatus(phba, iocbqrsp), in lpfc_send_taskmgmt()
5858 get_job_word4(phba, iocbqrsp), in lpfc_send_taskmgmt()
5862 if (get_job_ulpstatus(phba, iocbqrsp) == in lpfc_send_taskmgmt()
5878 lpfc_sli_release_iocbq(phba, iocbqrsp); in lpfc_send_taskmgmt()
5881 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5954 struct lpfc_hba *phba = vport->phba; in lpfc_reset_flush_io_context() local
5961 &phba->sli.sli3_ring[LPFC_FCP_RING], in lpfc_reset_flush_io_context()
6204 struct lpfc_hba *phba = vport->phba; in lpfc_host_reset_handler() local
6210 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_host_reset_handler()
6211 lpfc_offline(phba); in lpfc_host_reset_handler()
6212 rc = lpfc_sli_brdrestart(phba); in lpfc_host_reset_handler()
6217 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_host_reset_handler()
6218 rc = lpfc_sli_chipset_init(phba); in lpfc_host_reset_handler()
6223 rc = lpfc_online(phba); in lpfc_host_reset_handler()
6227 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
6233 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
6254 struct lpfc_hba *phba = vport->phba; in lpfc_slave_alloc() local
6267 if (phba->cfg_fof) { in lpfc_slave_alloc()
6275 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
6276 device_data = __lpfc_get_device_data(phba, in lpfc_slave_alloc()
6277 &phba->luns, in lpfc_slave_alloc()
6282 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
6283 device_data = lpfc_create_device_data(phba, in lpfc_slave_alloc()
6287 phba->cfg_XLanePriority, in lpfc_slave_alloc()
6291 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
6292 list_add_tail(&device_data->listentry, &phba->luns); in lpfc_slave_alloc()
6296 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
6301 sdev_cnt = atomic_inc_return(&phba->sdev_cnt); in lpfc_slave_alloc()
6304 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_slave_alloc()
6316 total = phba->total_scsi_bufs; in lpfc_slave_alloc()
6324 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
6331 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
6336 num_to_alloc, phba->cfg_hba_queue_depth, in lpfc_slave_alloc()
6337 (phba->cfg_hba_queue_depth - total)); in lpfc_slave_alloc()
6338 num_to_alloc = phba->cfg_hba_queue_depth - total; in lpfc_slave_alloc()
6349 phba->total_scsi_bufs += num_allocated; in lpfc_slave_alloc()
6368 struct lpfc_hba *phba = vport->phba; in lpfc_slave_configure() local
6372 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_slave_configure()
6373 lpfc_sli_handle_fast_ring_event(phba, in lpfc_slave_configure()
6374 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_slave_configure()
6375 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_slave_configure()
6376 lpfc_poll_rearm_timer(phba); in lpfc_slave_configure()
6392 struct lpfc_hba *phba = vport->phba; in lpfc_slave_destroy() local
6396 atomic_dec(&phba->sdev_cnt); in lpfc_slave_destroy()
6397 if ((phba->cfg_fof) && (device_data)) { in lpfc_slave_destroy()
6398 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_destroy()
6401 lpfc_delete_device_data(phba, device_data); in lpfc_slave_destroy()
6402 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_destroy()
6428 lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_create_device_data() argument
6436 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_create_device_data()
6437 !(phba->cfg_fof)) in lpfc_create_device_data()
6446 lun_info = mempool_alloc(phba->device_data_mem_pool, memory_flags); in lpfc_create_device_data()
6471 lpfc_delete_device_data(struct lpfc_hba *phba, in lpfc_delete_device_data() argument
6475 if (unlikely(!phba) || !lun_info || in lpfc_delete_device_data()
6476 !(phba->cfg_fof)) in lpfc_delete_device_data()
6481 mempool_free(lun_info, phba->device_data_mem_pool); in lpfc_delete_device_data()
6502 __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list, in __lpfc_get_device_data() argument
6509 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || in __lpfc_get_device_data()
6510 !phba->cfg_fof) in __lpfc_get_device_data()
6555 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_find_next_oas_lun() argument
6570 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_find_next_oas_lun()
6574 !phba->cfg_fof) in lpfc_find_next_oas_lun()
6583 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
6584 list_for_each_entry(lun_info, &phba->luns, listentry) { in lpfc_find_next_oas_lun()
6609 if (phba->cfg_oas_flags & OAS_FIND_ANY_VPORT) in lpfc_find_next_oas_lun()
6612 if (phba->cfg_oas_flags & OAS_FIND_ANY_TARGET) in lpfc_find_next_oas_lun()
6626 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
6652 lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_enable_oas_lun() argument
6659 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_enable_oas_lun()
6660 !phba->cfg_fof) in lpfc_enable_oas_lun()
6663 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6666 lun_info = __lpfc_get_device_data(phba, &phba->luns, vport_wwpn, in lpfc_enable_oas_lun()
6672 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6677 lun_info = lpfc_create_device_data(phba, vport_wwpn, target_wwpn, lun, in lpfc_enable_oas_lun()
6683 list_add_tail(&lun_info->listentry, &phba->luns); in lpfc_enable_oas_lun()
6684 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6687 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6712 lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_disable_oas_lun() argument
6719 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_disable_oas_lun()
6720 !phba->cfg_fof) in lpfc_disable_oas_lun()
6723 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_disable_oas_lun()
6726 lun_info = __lpfc_get_device_data(phba, in lpfc_disable_oas_lun()
6727 &phba->luns, vport_wwpn, in lpfc_disable_oas_lun()
6733 lpfc_delete_device_data(phba, lun_info); in lpfc_disable_oas_lun()
6734 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()
6738 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()