Lines Matching refs:phba

77 	if (vport->phba->cfg_fof)  in lpfc_rport_data_from_scsi_device()
84 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *psb);
86 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb);
88 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
123 lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, in lpfc_sli4_set_rsp_sgl_last() argument
146 struct lpfc_hba *phba = vport->phba; in lpfc_update_stats() local
167 (phba->bucket_type == LPFC_NO_BUCKET)) { in lpfc_update_stats()
172 if (phba->bucket_type == LPFC_LINEAR_BUCKET) { in lpfc_update_stats()
173 i = (latency + phba->bucket_step - 1 - phba->bucket_base)/ in lpfc_update_stats()
174 phba->bucket_step; in lpfc_update_stats()
182 if (latency <= (phba->bucket_base + in lpfc_update_stats()
183 ((1<<i)*phba->bucket_step))) in lpfc_update_stats()
203 lpfc_rampdown_queue_depth(struct lpfc_hba *phba) in lpfc_rampdown_queue_depth() argument
209 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
210 atomic_inc(&phba->num_rsrc_err); in lpfc_rampdown_queue_depth()
211 phba->last_rsrc_error_time = jiffies; in lpfc_rampdown_queue_depth()
213 expires = phba->last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL; in lpfc_rampdown_queue_depth()
215 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
219 phba->last_ramp_down_time = jiffies; in lpfc_rampdown_queue_depth()
221 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
223 spin_lock_irqsave(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
224 evt_posted = phba->pport->work_port_events & WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
226 phba->pport->work_port_events |= WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
227 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
230 lpfc_worker_wake_up(phba); in lpfc_rampdown_queue_depth()
243 lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) in lpfc_ramp_down_queue_handler() argument
252 num_rsrc_err = atomic_read(&phba->num_rsrc_err); in lpfc_ramp_down_queue_handler()
253 num_cmd_success = atomic_read(&phba->num_cmd_success); in lpfc_ramp_down_queue_handler()
263 vports = lpfc_create_vport_work_array(phba); in lpfc_ramp_down_queue_handler()
265 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_ramp_down_queue_handler()
279 lpfc_destroy_vport_work_array(phba, vports); in lpfc_ramp_down_queue_handler()
280 atomic_set(&phba->num_rsrc_err, 0); in lpfc_ramp_down_queue_handler()
281 atomic_set(&phba->num_cmd_success, 0); in lpfc_ramp_down_queue_handler()
293 lpfc_scsi_dev_block(struct lpfc_hba *phba) in lpfc_scsi_dev_block() argument
301 vports = lpfc_create_vport_work_array(phba); in lpfc_scsi_dev_block()
303 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_scsi_dev_block()
310 lpfc_destroy_vport_work_array(phba, vports); in lpfc_scsi_dev_block()
332 struct lpfc_hba *phba = vport->phba; in lpfc_new_scsi_buf_s3() local
342 bpl_size = phba->cfg_sg_dma_buf_size - in lpfc_new_scsi_buf_s3()
347 num_to_alloc, phba->cfg_sg_dma_buf_size, in lpfc_new_scsi_buf_s3()
362 psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, in lpfc_new_scsi_buf_s3()
371 iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); in lpfc_new_scsi_buf_s3()
373 dma_pool_free(phba->lpfc_sg_dma_buf_pool, in lpfc_new_scsi_buf_s3()
416 if ((phba->sli_rev == 3) && in lpfc_new_scsi_buf_s3()
417 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) { in lpfc_new_scsi_buf_s3()
451 lpfc_release_scsi_buf_s3(phba, psb); in lpfc_new_scsi_buf_s3()
468 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_vport_delete_fcp_xri_aborted() local
477 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
478 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { in lpfc_sli4_vport_delete_fcp_xri_aborted()
479 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_vport_delete_fcp_xri_aborted()
493 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
505 lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, in lpfc_sli4_io_xri_aborted() argument
517 struct lpfc_sli_ring *pring = phba->sli4_hba.els_wq->pring; in lpfc_sli4_io_xri_aborted()
519 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_sli4_io_xri_aborted()
522 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_sli4_io_xri_aborted()
523 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
534 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
535 lpfc_sli4_nvme_xri_aborted(phba, axri, psb); in lpfc_sli4_io_xri_aborted()
546 rrq_empty = list_empty(&phba->active_rrq_list); in lpfc_sli4_io_xri_aborted()
547 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
549 lpfc_set_rrq_active(phba, ndlp, in lpfc_sli4_io_xri_aborted()
551 lpfc_sli4_abts_err_handler(phba, ndlp, axri); in lpfc_sli4_io_xri_aborted()
553 lpfc_release_scsi_buf_s4(phba, psb); in lpfc_sli4_io_xri_aborted()
555 lpfc_worker_wake_up(phba); in lpfc_sli4_io_xri_aborted()
560 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli4_io_xri_aborted()
561 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli4_io_xri_aborted()
570 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
572 lpfc_worker_wake_up(phba); in lpfc_sli4_io_xri_aborted()
576 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_io_xri_aborted()
591 lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf_s3() argument
595 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; in lpfc_get_scsi_buf_s3()
598 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
602 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
603 list_splice(&phba->lpfc_scsi_buf_list_put, in lpfc_get_scsi_buf_s3()
604 &phba->lpfc_scsi_buf_list_get); in lpfc_get_scsi_buf_s3()
605 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_get_scsi_buf_s3()
608 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
610 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
612 if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) { in lpfc_get_scsi_buf_s3()
630 lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf_s4() argument
644 if (cmnd && phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_HDWQ) { in lpfc_get_scsi_buf_s4()
648 idx = phba->sli4_hba.cpu_map[cpu].hdwq; in lpfc_get_scsi_buf_s4()
651 lpfc_cmd = lpfc_get_io_buf(phba, ndlp, idx, in lpfc_get_scsi_buf_s4()
652 !phba->cfg_xri_rebalancing); in lpfc_get_scsi_buf_s4()
654 qp = &phba->sli4_hba.hdwq[idx]; in lpfc_get_scsi_buf_s4()
673 tmp = lpfc_get_cmd_rsp_buf_per_hdwq(phba, lpfc_cmd); in lpfc_get_scsi_buf_s4()
675 lpfc_release_io_buf(phba, lpfc_cmd, lpfc_cmd->hdwq); in lpfc_get_scsi_buf_s4()
724 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { in lpfc_get_scsi_buf_s4()
742 lpfc_get_scsi_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, in lpfc_get_scsi_buf() argument
745 return phba->lpfc_get_scsi_buf(phba, ndlp, cmnd); in lpfc_get_scsi_buf()
757 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf_s3() argument
764 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
767 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); in lpfc_release_scsi_buf_s3()
768 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
782 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf_s4() argument
798 lpfc_release_io_buf(phba, (struct lpfc_io_buf *)psb, qp); in lpfc_release_scsi_buf_s4()
811 lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_release_scsi_buf() argument
817 phba->lpfc_release_scsi_buf(phba, psb); in lpfc_release_scsi_buf()
835 lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s3() argument
863 nseg = dma_map_sg(&phba->pcidev->dev, scsi_sglist(scsi_cmnd), in lpfc_scsi_prep_dma_buf_s3()
869 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s3()
870 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_prep_dma_buf_s3()
873 " %d\n", __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s3()
875 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_scsi_prep_dma_buf_s3()
892 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
893 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
920 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
921 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
984 lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_inject() argument
1006 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { in lpfc_bg_err_inject()
1011 if ((phba->lpfc_injerr_lba < lba) || in lpfc_bg_err_inject()
1012 (phba->lpfc_injerr_lba >= (lba + numblks))) in lpfc_bg_err_inject()
1015 blockoff = phba->lpfc_injerr_lba - lba; in lpfc_bg_err_inject()
1029 if (phba->lpfc_injerr_nportid && in lpfc_bg_err_inject()
1030 (phba->lpfc_injerr_nportid != ndlp->nlp_DID)) in lpfc_bg_err_inject()
1037 if (phba->lpfc_injerr_wwpn.u.wwn[0] && in lpfc_bg_err_inject()
1038 (memcmp(&ndlp->nlp_portname, &phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1052 if (phba->lpfc_injerr_wref_cnt) { in lpfc_bg_err_inject()
1064 lpfc_printf_log(phba, KERN_ERR, 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()
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()
1126 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1127 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1128 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1129 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1131 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1136 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1142 if (phba->lpfc_injerr_rref_cnt) { in lpfc_bg_err_inject()
1153 phba->lpfc_injerr_rref_cnt--; in lpfc_bg_err_inject()
1154 if (phba->lpfc_injerr_rref_cnt == 0) { in lpfc_bg_err_inject()
1155 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1156 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1158 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1163 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1173 if (phba->lpfc_injerr_wapp_cnt) { in lpfc_bg_err_inject()
1185 lpfc_printf_log(phba, KERN_ERR, in lpfc_bg_err_inject()
1205 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1206 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1207 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1208 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1210 memset(&phba->lpfc_injerr_wwpn, 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()
1246 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1247 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1248 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1249 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1251 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1256 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1262 if (phba->lpfc_injerr_rapp_cnt) { in lpfc_bg_err_inject()
1273 phba->lpfc_injerr_rapp_cnt--; in lpfc_bg_err_inject()
1274 if (phba->lpfc_injerr_rapp_cnt == 0) { in lpfc_bg_err_inject()
1275 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1276 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1278 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1283 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1294 if (phba->lpfc_injerr_wgrd_cnt) { in lpfc_bg_err_inject()
1306 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1307 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1308 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1309 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1311 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1318 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1328 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1329 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1330 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1331 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1333 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1340 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1346 if (phba->lpfc_injerr_rgrd_cnt) { in lpfc_bg_err_inject()
1356 phba->lpfc_injerr_rgrd_cnt--; in lpfc_bg_err_inject()
1357 if (phba->lpfc_injerr_rgrd_cnt == 0) { in lpfc_bg_err_inject()
1358 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1359 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1361 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1368 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_err_inject()
1391 lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_sc_to_bg_opcodes() argument
1418 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sc_to_bg_opcodes()
1447 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_sc_to_bg_opcodes()
1471 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_opcodes() argument
1563 lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl() argument
1579 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1587 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl()
1590 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1703 lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl_prot() argument
1733 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1739 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
1748 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl_prot()
1751 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
1760 if (num_bde >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_bpl_prot()
1841 if (num_bde >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_bpl_prot()
1845 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1908 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_bpl_prot()
1948 lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl() argument
1968 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
1976 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl()
1979 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2033 if (!lsp_just_set && !((j + 1) % phba->border_sge_num) && in lpfc_bg_setup_sgl()
2038 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl()
2074 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl()
2128 lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl_prot() argument
2159 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2165 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2174 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl_prot()
2177 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2186 if ((num_sge >= (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_setup_sgl_prot()
2187 !(phba->cfg_xpsgl)) in lpfc_bg_setup_sgl_prot()
2191 if (!((j + 1) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2192 !((j + 2) % phba->border_sge_num) || in lpfc_bg_setup_sgl_prot()
2193 !((j + 3) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2199 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, lpfc_cmd); in lpfc_bg_setup_sgl_prot()
2211 sgl->sge_len = cpu_to_le32(phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2307 if ((num_sge >= phba->cfg_total_seg_cnt) && in lpfc_bg_setup_sgl_prot()
2308 !phba->cfg_xpsgl) in lpfc_bg_setup_sgl_prot()
2312 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2318 if (!((j + 1) % phba->border_sge_num)) { in lpfc_bg_setup_sgl_prot()
2325 sgl_xtra = lpfc_get_sgl_per_hdwq(phba, in lpfc_bg_setup_sgl_prot()
2339 phba->cfg_sg_dma_buf_size); in lpfc_bg_setup_sgl_prot()
2417 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_setup_sgl_prot()
2440 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) in lpfc_prot_group_type() argument
2457 if (phba) in lpfc_prot_group_type()
2458 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_prot_group_type()
2477 lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, in lpfc_bg_scsi_adjust_dl() argument
2520 lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s3() argument
2532 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s3()
2546 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2555 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2556 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s3()
2561 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s3()
2567 if ((lpfc_cmd->seg_cnt + 2) > phba->cfg_total_seg_cnt) { in lpfc_bg_scsi_prep_dma_buf_s3()
2572 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2587 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2602 (phba->cfg_total_seg_cnt - 2)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2607 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2611 (num_bde > phba->cfg_total_seg_cnt)) { in lpfc_bg_scsi_prep_dma_buf_s3()
2622 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2640 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s3()
2662 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s3()
2666 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s3()
2670 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s3()
2713 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_calc_bg_err() argument
2852 phba->bg_guard_err_cnt++; in lpfc_calc_bg_err()
2853 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2864 phba->bg_reftag_err_cnt++; in lpfc_calc_bg_err()
2865 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2876 phba->bg_apptag_err_cnt++; in lpfc_calc_bg_err()
2877 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
2898 lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, in lpfc_parse_bg_err() argument
2910 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2922 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2939 phba->bg_guard_err_cnt++; in lpfc_parse_bg_err()
2940 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2956 phba->bg_reftag_err_cnt++; in lpfc_parse_bg_err()
2957 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
2973 phba->bg_apptag_err_cnt++; in lpfc_parse_bg_err()
2974 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3018 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3026 lpfc_calc_bg_err(phba, lpfc_cmd); in lpfc_parse_bg_err()
3046 lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s4() argument
3088 if (!phba->cfg_xpsgl && in lpfc_scsi_prep_dma_buf_s4()
3089 lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s4()
3090 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_prep_dma_buf_s4()
3094 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s4()
3096 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_scsi_prep_dma_buf_s4()
3126 !((j + 1) % phba->border_sge_num) && in lpfc_scsi_prep_dma_buf_s4()
3133 phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf_s4()
3176 phba->cfg_sg_dma_buf_size); in lpfc_scsi_prep_dma_buf_s4()
3191 if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3192 phba->cfg_enable_pbde) { in lpfc_scsi_prep_dma_buf_s4()
3209 if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) || in lpfc_scsi_prep_dma_buf_s4()
3210 phba->cfg_enable_pbde) { in lpfc_scsi_prep_dma_buf_s4()
3235 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_scsi_prep_dma_buf_s4()
3259 lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s4() argument
3271 struct lpfc_vport *vport = phba->pport; in lpfc_bg_scsi_prep_dma_buf_s4()
3284 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3300 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt && in lpfc_bg_scsi_prep_dma_buf_s4()
3301 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3302 WARN_ON_ONCE(lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt); in lpfc_bg_scsi_prep_dma_buf_s4()
3307 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s4()
3313 phba->cfg_total_seg_cnt) && in lpfc_bg_scsi_prep_dma_buf_s4()
3314 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3319 num_sge = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3335 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3349 (phba->cfg_total_seg_cnt - 2)) && in lpfc_bg_scsi_prep_dma_buf_s4()
3350 !phba->cfg_xpsgl) { in lpfc_bg_scsi_prep_dma_buf_s4()
3355 num_sge = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3360 (num_sge > 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()
3372 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3394 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s4()
3415 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_bg_scsi_prep_dma_buf_s4()
3424 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s4()
3428 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_bg_scsi_prep_dma_buf_s4()
3432 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s4()
3453 lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf() argument
3455 return phba->lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf()
3472 lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) in lpfc_bg_scsi_prep_dma_buf() argument
3474 return phba->lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf()
3488 lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, in lpfc_send_scsi_error_event() argument
3505 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3520 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3546 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3565 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3566 list_add_tail(&fast_path_evt->work_evt.evt_listp, &phba->work_list); in lpfc_send_scsi_error_event()
3567 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3568 lpfc_worker_wake_up(phba); in lpfc_send_scsi_error_event()
3581 lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb) in lpfc_scsi_unprep_dma_buf() argument
3592 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(psb->pCmd), in lpfc_scsi_unprep_dma_buf()
3611 struct lpfc_hba *phba = vport->phba; in lpfc_handle_fcp_err() local
3754 ((phba->sli_rev == LPFC_SLI_REV4) ? in lpfc_handle_fcp_err()
3783 lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb); in lpfc_handle_fcp_err()
3797 lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, in lpfc_scsi_cmd_iocb_cmpl() argument
3817 if (!cmd || !phba) { in lpfc_scsi_cmd_iocb_cmpl()
3825 if (phba->sli4_hba.hdwq) in lpfc_scsi_cmd_iocb_cmpl()
3826 phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; in lpfc_scsi_cmd_iocb_cmpl()
3829 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_scsi_cmd_iocb_cmpl()
3830 this_cpu_inc(phba->sli4_hba.c_stat->cmpl_io); in lpfc_scsi_cmd_iocb_cmpl()
3898 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_scsi_cmd_iocb_cmpl()
3911 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_scsi_cmd_iocb_cmpl()
3930 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
3932 &phba->work_list); in lpfc_scsi_cmd_iocb_cmpl()
3933 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
3934 lpfc_worker_wake_up(phba); in lpfc_scsi_cmd_iocb_cmpl()
3962 lpfc_parse_bg_err(phba, lpfc_cmd, in lpfc_scsi_cmd_iocb_cmpl()
3973 && (phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_cmd_iocb_cmpl()
3979 lpfc_set_rrq_active(phba, pnode, in lpfc_scsi_cmd_iocb_cmpl()
4026 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4035 phba->ktime_last_cmd = lpfc_cmd->ts_data_io; in lpfc_scsi_cmd_iocb_cmpl()
4036 lpfc_io_ktime(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4052 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4086 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_prep_cmnd() local
4117 sli4 = (phba->sli_rev == LPFC_SLI_REV4); in lpfc_scsi_prep_cmnd()
4120 if (phba->sli4_hba.hdwq) in lpfc_scsi_prep_cmnd()
4121 hdwq = &phba->sli4_hba.hdwq[idx]; in lpfc_scsi_prep_cmnd()
4160 if (phba->sli_rev == 3 && in lpfc_scsi_prep_cmnd()
4161 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_cmnd()
4170 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]; in lpfc_scsi_prep_cmnd()
4223 if (vport->phba->sli_rev == 3 && in lpfc_scsi_prep_task_mgmt_cmd()
4224 !(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_task_mgmt_cmd()
4228 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_scsi_prep_task_mgmt_cmd()
4230 vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_scsi_prep_task_mgmt_cmd()
4247 if (vport->phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_prep_task_mgmt_cmd()
4248 lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd()
4263 lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_scsi_api_table_setup() argument
4266 phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; in lpfc_scsi_api_table_setup()
4267 phba->lpfc_scsi_prep_cmnd = lpfc_scsi_prep_cmnd; in lpfc_scsi_api_table_setup()
4271 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4272 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4273 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4274 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4277 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4278 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4279 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4280 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4283 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_scsi_api_table_setup()
4289 phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; in lpfc_scsi_api_table_setup()
4290 phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; in lpfc_scsi_api_table_setup()
4304 lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, in lpfc_tskmgmt_def_cmpl() argument
4311 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_tskmgmt_def_cmpl()
4330 lpfc_check_pci_resettable(struct lpfc_hba *phba) in lpfc_check_pci_resettable() argument
4332 const struct pci_dev *pdev = phba->pcidev; in lpfc_check_pci_resettable()
4340 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
4353 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
4364 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, in lpfc_check_pci_resettable()
4388 struct lpfc_hba *phba = vport->phba; in lpfc_info() local
4394 if (phba && phba->pcidev){ in lpfc_info()
4396 scnprintf(tmp, sizeof(tmp), phba->ModelDesc); in lpfc_info()
4404 phba->pcidev->bus->number, phba->pcidev->devfn, in lpfc_info()
4405 phba->pcidev->irq); in lpfc_info()
4411 if (phba->Port[0]) { in lpfc_info()
4412 scnprintf(tmp, sizeof(tmp), " port %s", phba->Port); in lpfc_info()
4419 link_speed = lpfc_sli_port_speed_get(phba); in lpfc_info()
4429 if (!lpfc_check_pci_resettable(phba)) { in lpfc_info()
4446 static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) in lpfc_poll_rearm_timer() argument
4449 (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); in lpfc_poll_rearm_timer()
4451 if (!list_empty(&phba->sli.sli3_ring[LPFC_FCP_RING].txcmplq)) in lpfc_poll_rearm_timer()
4452 mod_timer(&phba->fcp_poll_timer, in lpfc_poll_rearm_timer()
4462 void lpfc_poll_start_timer(struct lpfc_hba * phba) in lpfc_poll_start_timer() argument
4464 lpfc_poll_rearm_timer(phba); in lpfc_poll_start_timer()
4477 struct lpfc_hba *phba = from_timer(phba, t, fcp_poll_timer); in lpfc_poll_timeout() local
4479 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_poll_timeout()
4480 lpfc_sli_handle_fast_ring_event(phba, in lpfc_poll_timeout()
4481 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_poll_timeout()
4483 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_poll_timeout()
4484 lpfc_poll_rearm_timer(phba); in lpfc_poll_timeout()
4505 struct lpfc_hba *phba = vport->phba; in lpfc_queuecommand() local
4514 if (phba->ktime_on) in lpfc_queuecommand()
4532 (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { in lpfc_queuecommand()
4534 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, in lpfc_queuecommand()
4549 if (lpfc_ndlp_check_qdepth(phba, ndlp)) { in lpfc_queuecommand()
4580 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp, cmnd); in lpfc_queuecommand()
4582 lpfc_rampdown_queue_depth(phba); in lpfc_queuecommand()
4600 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4611 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4613 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4623 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4637 if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) in lpfc_queuecommand()
4638 this_cpu_inc(phba->sli4_hba.c_stat->xmt_io); in lpfc_queuecommand()
4640 err = lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_queuecommand()
4645 lpfc_cmd->ts_last_cmd = phba->ktime_last_cmd; in lpfc_queuecommand()
4661 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
4671 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_queuecommand()
4672 lpfc_sli_handle_fast_ring_event(phba, in lpfc_queuecommand()
4673 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_queuecommand()
4675 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_queuecommand()
4676 lpfc_poll_rearm_timer(phba); in lpfc_queuecommand()
4679 if (phba->cfg_xri_rebalancing) in lpfc_queuecommand()
4680 lpfc_keep_pvt_pool_above_lowwm(phba, lpfc_cmd->hdwq_no); in lpfc_queuecommand()
4686 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4687 if (phba->sli4_hba.hdwq) { in lpfc_queuecommand()
4690 phba->sli4_hba.hdwq[idx].scsi_cstat.output_requests--; in lpfc_queuecommand()
4693 phba->sli4_hba.hdwq[idx].scsi_cstat.input_requests--; in lpfc_queuecommand()
4696 phba->sli4_hba.hdwq[idx].scsi_cstat.control_requests--; in lpfc_queuecommand()
4699 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4707 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4730 struct lpfc_hba *phba = vport->phba; in lpfc_abort_handler() local
4749 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_abort_handler()
4751 if (phba->hba_flag & HBA_IOQ_FLUSH) { in lpfc_abort_handler()
4771 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
4772 pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring; in lpfc_abort_handler()
4806 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
4809 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4813 abtsiocb = __lpfc_sli_get_iocbq(phba); in lpfc_abort_handler()
4832 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
4846 if (lpfc_is_link_up(phba)) in lpfc_abort_handler()
4854 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
4856 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_abort_handler()
4860 ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_abort_handler()
4869 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4870 lpfc_sli_release_iocbq(phba, abtsiocb); in lpfc_abort_handler()
4877 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4879 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_abort_handler()
4880 lpfc_sli_handle_fast_ring_event(phba, in lpfc_abort_handler()
4881 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_abort_handler()
4907 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
4912 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
5036 struct lpfc_hba *phba = vport->phba; in lpfc_send_taskmgmt() local
5050 lpfc_cmd = lpfc_get_scsi_buf(phba, pnode, NULL); in lpfc_send_taskmgmt()
5053 lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; in lpfc_send_taskmgmt()
5061 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5066 iocbqrsp = lpfc_sli_get_iocbq(phba); in lpfc_send_taskmgmt()
5068 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5080 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, in lpfc_send_taskmgmt()
5110 lpfc_sli_release_iocbq(phba, iocbqrsp); in lpfc_send_taskmgmt()
5113 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5186 struct lpfc_hba *phba = vport->phba; in lpfc_reset_flush_io_context() local
5193 &phba->sli.sli3_ring[LPFC_FCP_RING], in lpfc_reset_flush_io_context()
5407 if (vport->phba->cfg_fcp2_no_tgt_reset && in lpfc_bus_reset_handler()
5469 struct lpfc_hba *phba = vport->phba; in lpfc_host_reset_handler() local
5475 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_host_reset_handler()
5476 lpfc_offline(phba); in lpfc_host_reset_handler()
5477 rc = lpfc_sli_brdrestart(phba); in lpfc_host_reset_handler()
5481 rc = lpfc_online(phba); in lpfc_host_reset_handler()
5485 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
5491 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
5512 struct lpfc_hba *phba = vport->phba; in lpfc_slave_alloc() local
5525 if (phba->cfg_fof) { in lpfc_slave_alloc()
5533 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5534 device_data = __lpfc_get_device_data(phba, in lpfc_slave_alloc()
5535 &phba->luns, in lpfc_slave_alloc()
5540 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5541 device_data = lpfc_create_device_data(phba, in lpfc_slave_alloc()
5545 phba->cfg_XLanePriority, in lpfc_slave_alloc()
5549 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5550 list_add_tail(&device_data->listentry, &phba->luns); in lpfc_slave_alloc()
5554 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5559 sdev_cnt = atomic_inc_return(&phba->sdev_cnt); in lpfc_slave_alloc()
5562 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_slave_alloc()
5574 total = phba->total_scsi_bufs; in lpfc_slave_alloc()
5582 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5589 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5594 num_to_alloc, phba->cfg_hba_queue_depth, in lpfc_slave_alloc()
5595 (phba->cfg_hba_queue_depth - total)); in lpfc_slave_alloc()
5596 num_to_alloc = phba->cfg_hba_queue_depth - total; in lpfc_slave_alloc()
5607 phba->total_scsi_bufs += num_allocated; in lpfc_slave_alloc()
5626 struct lpfc_hba *phba = vport->phba; in lpfc_slave_configure() local
5630 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_slave_configure()
5631 lpfc_sli_handle_fast_ring_event(phba, in lpfc_slave_configure()
5632 &phba->sli.sli3_ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_slave_configure()
5633 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_slave_configure()
5634 lpfc_poll_rearm_timer(phba); in lpfc_slave_configure()
5650 struct lpfc_hba *phba = vport->phba; in lpfc_slave_destroy() local
5654 atomic_dec(&phba->sdev_cnt); in lpfc_slave_destroy()
5655 if ((phba->cfg_fof) && (device_data)) { in lpfc_slave_destroy()
5656 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_destroy()
5659 lpfc_delete_device_data(phba, device_data); in lpfc_slave_destroy()
5660 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_destroy()
5685 lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_create_device_data() argument
5693 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_create_device_data()
5694 !(phba->cfg_fof)) in lpfc_create_device_data()
5703 lun_info = mempool_alloc(phba->device_data_mem_pool, memory_flags); in lpfc_create_device_data()
5728 lpfc_delete_device_data(struct lpfc_hba *phba, in lpfc_delete_device_data() argument
5732 if (unlikely(!phba) || !lun_info || in lpfc_delete_device_data()
5733 !(phba->cfg_fof)) in lpfc_delete_device_data()
5738 mempool_free(lun_info, phba->device_data_mem_pool); in lpfc_delete_device_data()
5759 __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list, in __lpfc_get_device_data() argument
5766 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || in __lpfc_get_device_data()
5767 !phba->cfg_fof) in __lpfc_get_device_data()
5811 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_find_next_oas_lun() argument
5826 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_find_next_oas_lun()
5830 !phba->cfg_fof) in lpfc_find_next_oas_lun()
5839 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5840 list_for_each_entry(lun_info, &phba->luns, listentry) { in lpfc_find_next_oas_lun()
5865 if (phba->cfg_oas_flags & OAS_FIND_ANY_VPORT) in lpfc_find_next_oas_lun()
5868 if (phba->cfg_oas_flags & OAS_FIND_ANY_TARGET) in lpfc_find_next_oas_lun()
5882 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5907 lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_enable_oas_lun() argument
5914 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_enable_oas_lun()
5915 !phba->cfg_fof) in lpfc_enable_oas_lun()
5918 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5921 lun_info = __lpfc_get_device_data(phba, &phba->luns, vport_wwpn, in lpfc_enable_oas_lun()
5927 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5932 lun_info = lpfc_create_device_data(phba, vport_wwpn, target_wwpn, lun, in lpfc_enable_oas_lun()
5938 list_add_tail(&lun_info->listentry, &phba->luns); in lpfc_enable_oas_lun()
5939 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5942 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5966 lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_disable_oas_lun() argument
5973 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_disable_oas_lun()
5974 !phba->cfg_fof) in lpfc_disable_oas_lun()
5977 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5980 lun_info = __lpfc_get_device_data(phba, in lpfc_disable_oas_lun()
5981 &phba->luns, vport_wwpn, in lpfc_disable_oas_lun()
5987 lpfc_delete_device_data(phba, lun_info); in lpfc_disable_oas_lun()
5988 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5992 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()