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()
1889 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1930 lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl() argument
1950 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
1960 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl()
1963 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2017 if (!lsp_just_set && !((j + 1) % phba->border_sge_num) && in lpfc_bg_setup_sgl()
2022 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl()
2058 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl()
2113 lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl_prot() argument
2144 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2150 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2161 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl_prot()
2164 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2173 if ((num_sge >= (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_setup_sgl_prot()
2174 !(phba->cfg_xpsgl)) in lpfc_bg_setup_sgl_prot()
2178 if (!((j + 1) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2179 !((j + 2) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2180 !((j + 3) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2186 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl_prot()
2198 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2293 if ((num_sge >= phba->cfg_total_seg_cnt) && in lpfc_bg_setup_sgl_prot()
2294 !phba->cfg_xpsgl) in lpfc_bg_setup_sgl_prot()
2298 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2304 if (!((j + 1) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2311 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, in lpfc_bg_setup_sgl_prot()
2325 phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2402 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2425 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) in lpfc_prot_group_type() argument
2442 if (phba) in lpfc_prot_group_type()
2443 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_prot_group_type()
2462 lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, in lpfc_bg_scsi_adjust_dl() argument
2505 lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s3() argument
2517 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s3()
2531 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2540 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2541 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s3()
2546 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s3()
2552 if ((lpfc_cmd->seg_cnt + 2) > phba->cfg_total_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2557 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2572 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2587 (phba->cfg_total_seg_cnt - 2)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2592 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2596 (num_bde > phba->cfg_total_seg_cnt)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2607 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2625 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s3()
2647 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s3()
2651 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2655 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s3()
2698 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_calc_bg_err() argument
2838 phba->bg_guard_err_cnt++; in lpfc_calc_bg_err()
2839 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2848 phba->bg_reftag_err_cnt++; in lpfc_calc_bg_err()
2849 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2858 phba->bg_apptag_err_cnt++; in lpfc_calc_bg_err()
2859 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2879 lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, in lpfc_parse_bg_err() argument
2891 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_parse_bg_err()
2934 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2946 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2960 phba->bg_guard_err_cnt++; in lpfc_parse_bg_err()
2961 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2973 phba->bg_reftag_err_cnt++; in lpfc_parse_bg_err()
2974 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2986 phba->bg_apptag_err_cnt++; in lpfc_parse_bg_err()
2987 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3031 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3039 lpfc_calc_bg_err(phba, lpfc_cmd); in lpfc_parse_bg_err()
3059 lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s4() argument
3067 struct lpfc_vport *vport = phba->pport; in lpfc_scsi_prep_dma_buf_s4()
3102 if (!phba->cfg_xpsgl && in lpfc_scsi_prep_dma_buf_s4()
3103 lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s4()
3104 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_prep_dma_buf_s4()
3108 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s4()
3110 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_scsi_prep_dma_buf_s4()
3140 !((j + 1) % phba->border_sge_num) && in lpfc_scsi_prep_dma_buf_s4()
3147 phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf_s4()
3190 phba->cfg_sg_dma_buf_size); in lpfc_scsi_prep_dma_buf_s4()
3206 ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3207 phba->cfg_enable_pbde)) { in lpfc_scsi_prep_dma_buf_s4()
3231 if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3232 phba->cfg_enable_pbde) { in lpfc_scsi_prep_dma_buf_s4()
3247 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_scsi_prep_dma_buf_s4()
3268 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_scsi_prep_dma_buf_s4()
3283 (phba->cfg_XLanePriority << 1)); in lpfc_scsi_prep_dma_buf_s4()
3303 lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s4() argument
3316 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s4()
3329 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3345 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt && in lpfc_bg_scsi_prep_dma_buf_s4()
3346 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3347 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s4()
3352 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s4()
3358 phba->cfg_total_seg_cnt) && in lpfc_bg_scsi_prep_dma_buf_s4()
3359 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3364 num_sge = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3380 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3394 (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_scsi_prep_dma_buf_s4()
3395 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3400 num_sge = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3405 (num_sge > phba->cfg_total_seg_cnt && in lpfc_bg_scsi_prep_dma_buf_s4()
3406 !phba->cfg_xpsgl)) { in lpfc_bg_scsi_prep_dma_buf_s4()
3417 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3439 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s4()
3443 if (!(phba->hba_flag & HBA_FCOE_MODE) && in lpfc_bg_scsi_prep_dma_buf_s4()
3464 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_bg_scsi_prep_dma_buf_s4()
3472 (phba->cfg_XLanePriority << 1)); in lpfc_bg_scsi_prep_dma_buf_s4()
3491 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s4()
3495 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3499 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s4()
3520 lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf() argument
3522 return phba->lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf()
3539 lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_bg_scsi_prep_dma_buf() argument
3541 return phba->lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf()
3561 return vport->phba->lpfc_scsi_prep_cmnd_buf(vport, lpfc_cmd, tmo); in lpfc_scsi_prep_cmnd_buf()
3575 lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, in lpfc_send_scsi_error_event() argument
3591 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3606 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3632 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3651 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3652 list_add_tail(&fast_path_evt->work_evt.evt_listp, &phba->work_list); in lpfc_send_scsi_error_event()
3653 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3654 lpfc_worker_wake_up(phba); in lpfc_send_scsi_error_event()
3667 lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_scsi_unprep_dma_buf() argument
3678 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(psb->pCmd), in lpfc_scsi_unprep_dma_buf()
3691 lpfc_unblock_requests(struct lpfc_hba *phba) in lpfc_unblock_requests() argument
3697 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_unblock_requests()
3698 !phba->sli4_hba.max_cfg_param.vpi_used) { in lpfc_unblock_requests()
3699 shost = lpfc_shost_from_vport(phba->pport); in lpfc_unblock_requests()
3704 vports = lpfc_create_vport_work_array(phba); in lpfc_unblock_requests()
3706 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_unblock_requests()
3710 lpfc_destroy_vport_work_array(phba, vports); in lpfc_unblock_requests()
3721 lpfc_block_requests(struct lpfc_hba *phba) in lpfc_block_requests() argument
3727 if (atomic_read(&phba->cmf_stop_io)) in lpfc_block_requests()
3730 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_block_requests()
3731 !phba->sli4_hba.max_cfg_param.vpi_used) { in lpfc_block_requests()
3732 shost = lpfc_shost_from_vport(phba->pport); in lpfc_block_requests()
3737 vports = lpfc_create_vport_work_array(phba); in lpfc_block_requests()
3739 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_block_requests()
3743 lpfc_destroy_vport_work_array(phba, vports); in lpfc_block_requests()
3760 lpfc_update_cmf_cmpl(struct lpfc_hba *phba, in lpfc_update_cmf_cmpl() argument
3772 cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); in lpfc_update_cmf_cmpl()
3789 lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t size) in lpfc_update_cmf_cmd() argument
3796 if (phba->cmf_active_mode == LPFC_CFG_MANAGED && in lpfc_update_cmf_cmd()
3797 phba->cmf_max_bytes_per_interval) { in lpfc_update_cmf_cmd()
3800 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_update_cmf_cmd()
3803 if (total >= phba->cmf_max_bytes_per_interval) { in lpfc_update_cmf_cmd()
3804 if (!atomic_xchg(&phba->cmf_bw_wait, 1)) { in lpfc_update_cmf_cmd()
3805 lpfc_block_requests(phba); in lpfc_update_cmf_cmd()
3806 phba->cmf_last_ts = in lpfc_update_cmf_cmd()
3807 lpfc_calc_cmf_latency(phba); in lpfc_update_cmf_cmd()
3809 atomic_inc(&phba->cmf_busy); in lpfc_update_cmf_cmd()
3812 if (size > atomic_read(&phba->rx_max_read_cnt)) in lpfc_update_cmf_cmd()
3813 atomic_set(&phba->rx_max_read_cnt, size); in lpfc_update_cmf_cmd()
3816 cgs = per_cpu_ptr(phba->cmf_stat, raw_smp_processor_id()); in lpfc_update_cmf_cmd()
4002 lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, fcpi_parm); in lpfc_handle_fcp_err()
4016 lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, in lpfc_fcp_io_cmd_wqe_cmpl() argument
4049 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4055 if (phba->sli4_hba.hdwq) in lpfc_fcp_io_cmd_wqe_cmpl()
4056 phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; in lpfc_fcp_io_cmd_wqe_cmpl()
4059 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_fcp_io_cmd_wqe_cmpl()
4060 this_cpu_inc(phba->sli4_hba.c_stat->cmpl_io); in lpfc_fcp_io_cmd_wqe_cmpl()
4071 if (phba->cfg_fcp_wait_abts_rsp) in lpfc_fcp_io_cmd_wqe_cmpl()
4147 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_fcp_io_cmd_wqe_cmpl()
4166 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_fcp_io_cmd_wqe_cmpl()
4168 &phba->work_list); in lpfc_fcp_io_cmd_wqe_cmpl()
4169 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_fcp_io_cmd_wqe_cmpl()
4170 lpfc_worker_wake_up(phba); in lpfc_fcp_io_cmd_wqe_cmpl()
4194 lpfc_set_rrq_active(phba, ndlp, in lpfc_fcp_io_cmd_wqe_cmpl()
4229 lpfc_parse_bg_err(phba, lpfc_cmd, pwqeOut); in lpfc_fcp_io_cmd_wqe_cmpl()
4298 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4304 phba->ktime_last_cmd = lpfc_cmd->ts_data_io; in lpfc_fcp_io_cmd_wqe_cmpl()
4305 lpfc_io_ktime(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4313 if (phba->cmf_active_mode != LPFC_CFG_OFF && in lpfc_fcp_io_cmd_wqe_cmpl()
4318 lpfc_update_cmf_cmpl(phba, lat, scsi_bufflen(cmd), shost); in lpfc_fcp_io_cmd_wqe_cmpl()
4337 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_fcp_io_cmd_wqe_cmpl()
4351 lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, in lpfc_scsi_cmd_iocb_cmpl() argument
4371 if (!cmd || !phba) { in lpfc_scsi_cmd_iocb_cmpl()
4379 if (phba->sli4_hba.hdwq) in lpfc_scsi_cmd_iocb_cmpl()
4380 phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; in lpfc_scsi_cmd_iocb_cmpl()
4383 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_scsi_cmd_iocb_cmpl()
4384 this_cpu_inc(phba->sli4_hba.c_stat->cmpl_io); in lpfc_scsi_cmd_iocb_cmpl()
4451 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_scsi_cmd_iocb_cmpl()
4465 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_scsi_cmd_iocb_cmpl()
4484 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4486 &phba->work_list); in lpfc_scsi_cmd_iocb_cmpl()
4487 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4488 lpfc_worker_wake_up(phba); in lpfc_scsi_cmd_iocb_cmpl()
4516 lpfc_parse_bg_err(phba, lpfc_cmd, in lpfc_scsi_cmd_iocb_cmpl()
4527 && (phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_cmd_iocb_cmpl()
4533 lpfc_set_rrq_active(phba, pnode, in lpfc_scsi_cmd_iocb_cmpl()
4578 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4587 phba->ktime_last_cmd = lpfc_cmd->ts_data_io; in lpfc_scsi_cmd_iocb_cmpl()
4588 lpfc_io_ktime(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4605 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4701 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_prep_cmnd_buf_s4() local
4711 hdwq = &phba->sli4_hba.hdwq[idx]; in lpfc_scsi_prep_cmnd_buf_s4()
4744 if (phba->cmf_active_mode == LPFC_CFG_MANAGED) in lpfc_scsi_prep_cmnd_buf_s4()
4772 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]); in lpfc_scsi_prep_cmnd_buf_s4()
4875 if (!(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_task_mgmt_cmd_s3()
4944 vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4961 lpfc_prep_embed_io(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4966 lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd_s4()
4981 lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_scsi_api_table_setup() argument
4984 phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; in lpfc_scsi_api_table_setup()
4988 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4989 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4990 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4991 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4992 phba->lpfc_scsi_prep_cmnd_buf = lpfc_scsi_prep_cmnd_buf_s3; in lpfc_scsi_api_table_setup()
4993 phba->lpfc_scsi_prep_task_mgmt_cmd = in lpfc_scsi_api_table_setup()
4997 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4998 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4999 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; in lpfc_scsi_api_table_setup()
5000 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; in lpfc_scsi_api_table_setup()
5001 phba->lpfc_scsi_prep_cmnd_buf = lpfc_scsi_prep_cmnd_buf_s4; in lpfc_scsi_api_table_setup()
5002 phba->lpfc_scsi_prep_task_mgmt_cmd = in lpfc_scsi_api_table_setup()
5006 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_scsi_api_table_setup()
5011 phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; in lpfc_scsi_api_table_setup()
5012 phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; in lpfc_scsi_api_table_setup()
5026 lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, in lpfc_tskmgmt_def_cmpl() argument
5032 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_tskmgmt_def_cmpl()
5051 lpfc_check_pci_resettable(struct lpfc_hba *phba) in lpfc_check_pci_resettable() argument
5053 const struct pci_dev *pdev = phba->pcidev; in lpfc_check_pci_resettable()
5061 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5068 if (phba->sli_rev != LPFC_SLI_REV4 || in lpfc_check_pci_resettable()
5069 phba->hba_flag & HBA_FCOE_MODE) { in lpfc_check_pci_resettable()
5070 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5081 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
5105 struct lpfc_hba *phba = vport->phba; in lpfc_info() local
5111 if (phba && phba->pcidev){ in lpfc_info()
5113 scnprintf(tmp, sizeof(tmp), phba->ModelDesc); in lpfc_info()
5121 phba->pcidev->bus->number, phba->pcidev->devfn, in lpfc_info()
5122 phba->pcidev->irq); in lpfc_info()
5128 if (phba->Port[0]) { in lpfc_info()
5129 scnprintf(tmp, sizeof(tmp), " port %s", phba->Port); in lpfc_info()
5136 link_speed = lpfc_sli_port_speed_get(phba); in lpfc_info()
5146 if (!lpfc_check_pci_resettable(phba)) { in lpfc_info()
5163 static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) in lpfc_poll_rearm_timer() argument
5166 (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); in lpfc_poll_rearm_timer()
5168 if (!list_empty(&phba->sli.sli3_ring[LPFC_FCP_RING].txcmplq)) in lpfc_poll_rearm_timer()
5169 mod_timer(&phba->fcp_poll_timer, in lpfc_poll_rearm_timer()
5179 void lpfc_poll_start_timer(struct lpfc_hba * phba) in lpfc_poll_start_timer() argument
5181 lpfc_poll_rearm_timer(phba); in lpfc_poll_start_timer()
5193 struct lpfc_hba *phba = from_timer(phba, t, fcp_poll_timer); in lpfc_poll_timeout() local
5195 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_poll_timeout()
5196 lpfc_sli_handle_fast_ring_event(phba, in lpfc_poll_timeout()
5197 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_poll_timeout()
5199 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_poll_timeout()
5200 lpfc_poll_rearm_timer(phba); in lpfc_poll_timeout()
5235 struct lpfc_hba *phba = vport->phba; in lpfc_queuecommand() local
5260 (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { in lpfc_queuecommand()
5262 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_queuecommand()
5279 if (phba->cmf_active_mode != LPFC_CFG_OFF && in lpfc_queuecommand()
5283 err = lpfc_update_cmf_cmd(phba, scsi_bufflen(cmnd)); in lpfc_queuecommand()
5288 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { in lpfc_queuecommand()
5319 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp, cmnd); in lpfc_queuecommand()
5321 lpfc_rampdown_queue_depth(phba); in lpfc_queuecommand()
5346 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
5357 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5359 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
5369 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5381 if (lpfc_is_vmid_enabled(phba) && in lpfc_queuecommand()
5383 phba->pport->vmid_priority_tagging == in lpfc_queuecommand()
5400 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_queuecommand()
5401 this_cpu_inc(phba->sli4_hba.c_stat->xmt_io); in lpfc_queuecommand()
5404 err = lpfc_sli_issue_fcp_io(phba, LPFC_FCP_RING, cur_iocbq, in lpfc_queuecommand()
5409 lpfc_cmd->ts_last_cmd = phba->ktime_last_cmd; in lpfc_queuecommand()
5425 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5427 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5428 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi] : in lpfc_queuecommand()
5431 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
5440 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_queuecommand()
5441 lpfc_sli_handle_fast_ring_event(phba, in lpfc_queuecommand()
5442 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_queuecommand()
5444 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_queuecommand()
5445 lpfc_poll_rearm_timer(phba); in lpfc_queuecommand()
5448 if (phba->cfg_xri_rebalancing) in lpfc_queuecommand()
5449 lpfc_keep_pvt_pool_above_lowwm(phba, lpfc_cmd->hdwq_no); in lpfc_queuecommand()
5455 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5456 if (phba->sli4_hba.hdwq) { in lpfc_queuecommand()
5459 phba->sli4_hba.hdwq[idx].scsi_cstat.output_requests--; in lpfc_queuecommand()
5462 phba->sli4_hba.hdwq[idx].scsi_cstat.input_requests--; in lpfc_queuecommand()
5465 phba->sli4_hba.hdwq[idx].scsi_cstat.control_requests--; in lpfc_queuecommand()
5469 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5471 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5476 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5482 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
5483 lpfc_update_cmf_cmpl(phba, LPFC_CGN_NOT_SENT, scsi_bufflen(cmnd), in lpfc_queuecommand()
5501 del_timer_sync(&vport->phba->inactive_vmid_poll); in lpfc_vmid_vport_cleanup()
5533 struct lpfc_hba *phba = vport->phba; in lpfc_abort_handler() local
5554 spin_lock(&phba->hbalock); in lpfc_abort_handler()
5556 if (phba->hba_flag & HBA_IOQ_FLUSH) { in lpfc_abort_handler()
5573 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
5574 pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; in lpfc_abort_handler()
5608 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
5610 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5616 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
5618 ret_val = lpfc_sli4_issue_abort_iotag(phba, iocb, in lpfc_abort_handler()
5621 pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; in lpfc_abort_handler()
5622 ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, in lpfc_abort_handler()
5627 lpfc_issue_hb_tmo(phba); in lpfc_abort_handler()
5637 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5640 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_abort_handler()
5641 lpfc_sli_handle_fast_ring_event(phba, in lpfc_abort_handler()
5642 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_abort_handler()
5671 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
5674 spin_unlock(&phba->hbalock); in lpfc_abort_handler()
5799 struct lpfc_hba *phba = vport->phba; in lpfc_send_taskmgmt() local
5813 lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode, NULL); in lpfc_send_taskmgmt()
5816 lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; in lpfc_send_taskmgmt()
5821 status = phba->lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, in lpfc_send_taskmgmt()
5824 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5829 iocbqrsp = lpfc_sli_get_iocbq(phba); in lpfc_send_taskmgmt()
5831 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5844 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, in lpfc_send_taskmgmt()
5847 (get_job_ulpstatus(phba, iocbqrsp) != IOSTAT_SUCCESS)) { in lpfc_send_taskmgmt()
5849 get_job_ulpstatus(phba, iocbqrsp) != IOSTAT_FCP_RSP_ERROR) in lpfc_send_taskmgmt()
5855 get_job_ulpstatus(phba, iocbqrsp), in lpfc_send_taskmgmt()
5856 get_job_word4(phba, iocbqrsp), in lpfc_send_taskmgmt()
5860 if (get_job_ulpstatus(phba, iocbqrsp) == in lpfc_send_taskmgmt()
5876 lpfc_sli_release_iocbq(phba, iocbqrsp); in lpfc_send_taskmgmt()
5879 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5952 struct lpfc_hba *phba = vport->phba; in lpfc_reset_flush_io_context() local
5959 &phba->sli.sli3_ring[LPFC_FCP_RING], in lpfc_reset_flush_io_context()
6202 struct lpfc_hba *phba = vport->phba; in lpfc_host_reset_handler() local
6208 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_host_reset_handler()
6209 lpfc_offline(phba); in lpfc_host_reset_handler()
6210 rc = lpfc_sli_brdrestart(phba); in lpfc_host_reset_handler()
6215 if (phba->sli_rev < LPFC_SLI_REV4) { in lpfc_host_reset_handler()
6216 rc = lpfc_sli_chipset_init(phba); in lpfc_host_reset_handler()
6221 rc = lpfc_online(phba); in lpfc_host_reset_handler()
6225 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
6231 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
6252 struct lpfc_hba *phba = vport->phba; in lpfc_slave_alloc() local
6265 if (phba->cfg_fof) { in lpfc_slave_alloc()
6273 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
6274 device_data = __lpfc_get_device_data(phba, in lpfc_slave_alloc()
6275 &phba->luns, in lpfc_slave_alloc()
6280 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
6281 device_data = lpfc_create_device_data(phba, in lpfc_slave_alloc()
6285 phba->cfg_XLanePriority, in lpfc_slave_alloc()
6289 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
6290 list_add_tail(&device_data->listentry, &phba->luns); in lpfc_slave_alloc()
6294 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
6299 sdev_cnt = atomic_inc_return(&phba->sdev_cnt); in lpfc_slave_alloc()
6302 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_slave_alloc()
6314 total = phba->total_scsi_bufs; in lpfc_slave_alloc()
6322 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
6329 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
6334 num_to_alloc, phba->cfg_hba_queue_depth, in lpfc_slave_alloc()
6335 (phba->cfg_hba_queue_depth - total)); in lpfc_slave_alloc()
6336 num_to_alloc = phba->cfg_hba_queue_depth - total; in lpfc_slave_alloc()
6347 phba->total_scsi_bufs += num_allocated; in lpfc_slave_alloc()
6366 struct lpfc_hba *phba = vport->phba; in lpfc_slave_configure() local
6370 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_slave_configure()
6371 lpfc_sli_handle_fast_ring_event(phba, in lpfc_slave_configure()
6372 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_slave_configure()
6373 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_slave_configure()
6374 lpfc_poll_rearm_timer(phba); in lpfc_slave_configure()
6390 struct lpfc_hba *phba = vport->phba; in lpfc_slave_destroy() local
6394 atomic_dec(&phba->sdev_cnt); in lpfc_slave_destroy()
6395 if ((phba->cfg_fof) && (device_data)) { in lpfc_slave_destroy()
6396 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_destroy()
6399 lpfc_delete_device_data(phba, device_data); in lpfc_slave_destroy()
6400 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_destroy()
6426 lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_create_device_data() argument
6434 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_create_device_data()
6435 !(phba->cfg_fof)) in lpfc_create_device_data()
6444 lun_info = mempool_alloc(phba->device_data_mem_pool, memory_flags); in lpfc_create_device_data()
6469 lpfc_delete_device_data(struct lpfc_hba *phba, in lpfc_delete_device_data() argument
6473 if (unlikely(!phba) || !lun_info || in lpfc_delete_device_data()
6474 !(phba->cfg_fof)) in lpfc_delete_device_data()
6479 mempool_free(lun_info, phba->device_data_mem_pool); in lpfc_delete_device_data()
6500 __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list, in __lpfc_get_device_data() argument
6507 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || in __lpfc_get_device_data()
6508 !phba->cfg_fof) in __lpfc_get_device_data()
6553 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_find_next_oas_lun() argument
6568 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_find_next_oas_lun()
6572 !phba->cfg_fof) in lpfc_find_next_oas_lun()
6581 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
6582 list_for_each_entry(lun_info, &phba->luns, listentry) { in lpfc_find_next_oas_lun()
6607 if (phba->cfg_oas_flags & OAS_FIND_ANY_VPORT) in lpfc_find_next_oas_lun()
6610 if (phba->cfg_oas_flags & OAS_FIND_ANY_TARGET) in lpfc_find_next_oas_lun()
6624 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
6650 lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_enable_oas_lun() argument
6657 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_enable_oas_lun()
6658 !phba->cfg_fof) in lpfc_enable_oas_lun()
6661 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6664 lun_info = __lpfc_get_device_data(phba, &phba->luns, vport_wwpn, in lpfc_enable_oas_lun()
6670 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6675 lun_info = lpfc_create_device_data(phba, vport_wwpn, target_wwpn, lun, in lpfc_enable_oas_lun()
6681 list_add_tail(&lun_info->listentry, &phba->luns); in lpfc_enable_oas_lun()
6682 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6685 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
6710 lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_disable_oas_lun() argument
6717 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_disable_oas_lun()
6718 !phba->cfg_fof) in lpfc_disable_oas_lun()
6721 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_disable_oas_lun()
6724 lun_info = __lpfc_get_device_data(phba, in lpfc_disable_oas_lun()
6725 &phba->luns, vport_wwpn, in lpfc_disable_oas_lun()
6731 lpfc_delete_device_data(phba, lun_info); in lpfc_disable_oas_lun()
6732 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()
6736 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()