Lines Matching refs:phba
76 if (vport->phba->cfg_fof) in lpfc_rport_data_from_scsi_device()
83 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
85 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb);
87 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
90 lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) in lpfc_debug_save_data() argument
96 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_debug_save_data()
104 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_debug_save_data()
119 lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd) in lpfc_debug_save_dif() argument
125 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_debug_save_dif()
132 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_debug_save_dif()
179 lpfc_sli4_set_rsp_sgl_last(struct lpfc_hba *phba, in lpfc_sli4_set_rsp_sgl_last() argument
200 lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_update_stats() argument
221 (phba->bucket_type == LPFC_NO_BUCKET)) { in lpfc_update_stats()
226 if (phba->bucket_type == LPFC_LINEAR_BUCKET) { in lpfc_update_stats()
227 i = (latency + phba->bucket_step - 1 - phba->bucket_base)/ in lpfc_update_stats()
228 phba->bucket_step; in lpfc_update_stats()
236 if (latency <= (phba->bucket_base + in lpfc_update_stats()
237 ((1<<i)*phba->bucket_step))) in lpfc_update_stats()
257 lpfc_rampdown_queue_depth(struct lpfc_hba *phba) in lpfc_rampdown_queue_depth() argument
263 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
264 atomic_inc(&phba->num_rsrc_err); in lpfc_rampdown_queue_depth()
265 phba->last_rsrc_error_time = jiffies; in lpfc_rampdown_queue_depth()
267 expires = phba->last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL; in lpfc_rampdown_queue_depth()
269 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
273 phba->last_ramp_down_time = jiffies; in lpfc_rampdown_queue_depth()
275 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rampdown_queue_depth()
277 spin_lock_irqsave(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
278 evt_posted = phba->pport->work_port_events & WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
280 phba->pport->work_port_events |= WORKER_RAMP_DOWN_QUEUE; in lpfc_rampdown_queue_depth()
281 spin_unlock_irqrestore(&phba->pport->work_port_lock, flags); in lpfc_rampdown_queue_depth()
284 lpfc_worker_wake_up(phba); in lpfc_rampdown_queue_depth()
297 lpfc_ramp_down_queue_handler(struct lpfc_hba *phba) in lpfc_ramp_down_queue_handler() argument
306 num_rsrc_err = atomic_read(&phba->num_rsrc_err); in lpfc_ramp_down_queue_handler()
307 num_cmd_success = atomic_read(&phba->num_cmd_success); in lpfc_ramp_down_queue_handler()
317 vports = lpfc_create_vport_work_array(phba); in lpfc_ramp_down_queue_handler()
319 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_ramp_down_queue_handler()
333 lpfc_destroy_vport_work_array(phba, vports); in lpfc_ramp_down_queue_handler()
334 atomic_set(&phba->num_rsrc_err, 0); in lpfc_ramp_down_queue_handler()
335 atomic_set(&phba->num_cmd_success, 0); in lpfc_ramp_down_queue_handler()
347 lpfc_scsi_dev_block(struct lpfc_hba *phba) in lpfc_scsi_dev_block() argument
355 vports = lpfc_create_vport_work_array(phba); in lpfc_scsi_dev_block()
357 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_scsi_dev_block()
364 lpfc_destroy_vport_work_array(phba, vports); in lpfc_scsi_dev_block()
386 struct lpfc_hba *phba = vport->phba; in lpfc_new_scsi_buf_s3() local
396 bpl_size = phba->cfg_sg_dma_buf_size - in lpfc_new_scsi_buf_s3()
401 num_to_alloc, phba->cfg_sg_dma_buf_size, in lpfc_new_scsi_buf_s3()
416 psb->data = pci_pool_alloc(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s3()
424 memset(psb->data, 0, phba->cfg_sg_dma_buf_size); in lpfc_new_scsi_buf_s3()
427 iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); in lpfc_new_scsi_buf_s3()
429 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s3()
472 if ((phba->sli_rev == 3) && in lpfc_new_scsi_buf_s3()
473 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) { in lpfc_new_scsi_buf_s3()
506 lpfc_release_scsi_buf_s3(phba, psb); in lpfc_new_scsi_buf_s3()
523 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_vport_delete_fcp_xri_aborted() local
527 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
528 spin_lock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_vport_delete_fcp_xri_aborted()
530 &phba->sli4_hba.lpfc_abts_scsi_buf_list, list) { in lpfc_sli4_vport_delete_fcp_xri_aborted()
535 spin_unlock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_vport_delete_fcp_xri_aborted()
536 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_vport_delete_fcp_xri_aborted()
548 lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba, in lpfc_sli4_fcp_xri_aborted() argument
559 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; in lpfc_sli4_fcp_xri_aborted()
561 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_sli4_fcp_xri_aborted()
562 spin_lock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_fcp_xri_aborted()
564 &phba->sli4_hba.lpfc_abts_scsi_buf_list, list) { in lpfc_sli4_fcp_xri_aborted()
570 &phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_fcp_xri_aborted()
576 rrq_empty = list_empty(&phba->active_rrq_list); in lpfc_sli4_fcp_xri_aborted()
577 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_fcp_xri_aborted()
579 lpfc_set_rrq_active(phba, ndlp, in lpfc_sli4_fcp_xri_aborted()
581 lpfc_sli4_abts_err_handler(phba, ndlp, axri); in lpfc_sli4_fcp_xri_aborted()
583 lpfc_release_scsi_buf_s4(phba, psb); in lpfc_sli4_fcp_xri_aborted()
585 lpfc_worker_wake_up(phba); in lpfc_sli4_fcp_xri_aborted()
589 spin_unlock(&phba->sli4_hba.abts_scsi_buf_list_lock); in lpfc_sli4_fcp_xri_aborted()
590 for (i = 1; i <= phba->sli.last_iotag; i++) { in lpfc_sli4_fcp_xri_aborted()
591 iocbq = phba->sli.iocbq_lookup[i]; in lpfc_sli4_fcp_xri_aborted()
600 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_fcp_xri_aborted()
602 lpfc_worker_wake_up(phba); in lpfc_sli4_fcp_xri_aborted()
606 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_sli4_fcp_xri_aborted()
624 lpfc_sli4_post_scsi_sgl_list(struct lpfc_hba *phba, in lpfc_sli4_post_scsi_sgl_list() argument
640 sgl_size = phba->cfg_sg_dma_buf_size - in lpfc_sli4_post_scsi_sgl_list()
680 status = lpfc_sli4_post_sgl(phba, in lpfc_sli4_post_scsi_sgl_list()
703 status = lpfc_sli4_post_scsi_sgl_block(phba, &blck_sblist, in lpfc_sli4_post_scsi_sgl_list()
733 lpfc_release_scsi_buf_s4(phba, psb); in lpfc_sli4_post_scsi_sgl_list()
751 lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *phba) in lpfc_sli4_repost_scsi_sgl_list() argument
757 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_repost_scsi_sgl_list()
758 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_repost_scsi_sgl_list()
759 list_splice_init(&phba->lpfc_scsi_buf_list_get, &post_sblist); in lpfc_sli4_repost_scsi_sgl_list()
760 list_splice(&phba->lpfc_scsi_buf_list_put, &post_sblist); in lpfc_sli4_repost_scsi_sgl_list()
761 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_sli4_repost_scsi_sgl_list()
762 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_sli4_repost_scsi_sgl_list()
766 num_posted = lpfc_sli4_post_scsi_sgl_list(phba, &post_sblist, in lpfc_sli4_repost_scsi_sgl_list()
767 phba->sli4_hba.scsi_xri_cnt); in lpfc_sli4_repost_scsi_sgl_list()
792 struct lpfc_hba *phba = vport->phba; in lpfc_new_scsi_buf_s4() local
805 sgl_size = phba->cfg_sg_dma_buf_size - in lpfc_new_scsi_buf_s4()
810 num_to_alloc, phba->cfg_sg_dma_buf_size, sgl_size, in lpfc_new_scsi_buf_s4()
824 psb->data = pci_pool_alloc(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s4()
830 memset(psb->data, 0, phba->cfg_sg_dma_buf_size); in lpfc_new_scsi_buf_s4()
836 if (phba->cfg_enable_bg && (((unsigned long)(psb->data) & in lpfc_new_scsi_buf_s4()
838 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s4()
845 lxri = lpfc_sli4_next_xritag(phba); in lpfc_new_scsi_buf_s4()
847 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s4()
854 iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); in lpfc_new_scsi_buf_s4()
856 pci_pool_free(phba->lpfc_scsi_dma_buf_pool, in lpfc_new_scsi_buf_s4()
859 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_new_scsi_buf_s4()
862 lpfc_sli4_free_xri(phba, lxri); in lpfc_new_scsi_buf_s4()
866 psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri]; in lpfc_new_scsi_buf_s4()
922 spin_lock_irq(&phba->scsi_buf_list_get_lock); in lpfc_new_scsi_buf_s4()
923 phba->sli4_hba.scsi_xri_cnt++; in lpfc_new_scsi_buf_s4()
924 spin_unlock_irq(&phba->scsi_buf_list_get_lock); in lpfc_new_scsi_buf_s4()
926 lpfc_printf_log(phba, KERN_INFO, LOG_BG, in lpfc_new_scsi_buf_s4()
932 num_posted = lpfc_sli4_post_scsi_sgl_list(phba, in lpfc_new_scsi_buf_s4()
955 return vport->phba->lpfc_new_scsi_buf(vport, num_to_alloc); in lpfc_new_scsi_buf()
970 lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) in lpfc_get_scsi_buf_s3() argument
973 struct list_head *scsi_buf_list_get = &phba->lpfc_scsi_buf_list_get; in lpfc_get_scsi_buf_s3()
976 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
980 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
981 list_splice(&phba->lpfc_scsi_buf_list_put, in lpfc_get_scsi_buf_s3()
982 &phba->lpfc_scsi_buf_list_get); in lpfc_get_scsi_buf_s3()
983 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_get_scsi_buf_s3()
986 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s3()
988 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s3()
1003 lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) in lpfc_get_scsi_buf_s4() argument
1009 spin_lock_irqsave(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s4()
1011 &phba->lpfc_scsi_buf_list_get, list) { in lpfc_get_scsi_buf_s4()
1012 if (lpfc_test_rrq_active(phba, ndlp, in lpfc_get_scsi_buf_s4()
1020 spin_lock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s4()
1021 list_splice(&phba->lpfc_scsi_buf_list_put, in lpfc_get_scsi_buf_s4()
1022 &phba->lpfc_scsi_buf_list_get); in lpfc_get_scsi_buf_s4()
1023 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put); in lpfc_get_scsi_buf_s4()
1024 spin_unlock(&phba->scsi_buf_list_put_lock); in lpfc_get_scsi_buf_s4()
1026 &phba->lpfc_scsi_buf_list_get, list) { in lpfc_get_scsi_buf_s4()
1028 phba, ndlp, lpfc_cmd->cur_iocbq.sli4_lxritag)) in lpfc_get_scsi_buf_s4()
1035 spin_unlock_irqrestore(&phba->scsi_buf_list_get_lock, iflag); in lpfc_get_scsi_buf_s4()
1052 lpfc_get_scsi_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) in lpfc_get_scsi_buf() argument
1054 return phba->lpfc_get_scsi_buf(phba, ndlp); in lpfc_get_scsi_buf()
1066 lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) in lpfc_release_scsi_buf_s3() argument
1074 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
1077 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); in lpfc_release_scsi_buf_s3()
1078 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s3()
1092 lpfc_release_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) in lpfc_release_scsi_buf_s4() argument
1101 spin_lock_irqsave(&phba->sli4_hba.abts_scsi_buf_list_lock, in lpfc_release_scsi_buf_s4()
1105 &phba->sli4_hba.lpfc_abts_scsi_buf_list); in lpfc_release_scsi_buf_s4()
1106 spin_unlock_irqrestore(&phba->sli4_hba.abts_scsi_buf_list_lock, in lpfc_release_scsi_buf_s4()
1111 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s4()
1112 list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); in lpfc_release_scsi_buf_s4()
1113 spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); in lpfc_release_scsi_buf_s4()
1126 lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) in lpfc_release_scsi_buf() argument
1129 phba->lpfc_release_scsi_buf(phba, psb); in lpfc_release_scsi_buf()
1147 lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s3() argument
1175 nseg = dma_map_sg(&phba->pcidev->dev, scsi_sglist(scsi_cmnd), in lpfc_scsi_prep_dma_buf_s3()
1181 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s3()
1182 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_scsi_prep_dma_buf_s3()
1185 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s3()
1203 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
1204 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
1231 if (phba->sli_rev == 3 && in lpfc_scsi_prep_dma_buf_s3()
1232 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && in lpfc_scsi_prep_dma_buf_s3()
1292 lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_inject() argument
1314 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { in lpfc_bg_err_inject()
1319 if ((phba->lpfc_injerr_lba < lba) || in lpfc_bg_err_inject()
1320 (phba->lpfc_injerr_lba >= (lba + numblks))) in lpfc_bg_err_inject()
1323 blockoff = phba->lpfc_injerr_lba - lba; in lpfc_bg_err_inject()
1337 if (phba->lpfc_injerr_nportid && in lpfc_bg_err_inject()
1338 (phba->lpfc_injerr_nportid != ndlp->nlp_DID)) in lpfc_bg_err_inject()
1345 if (phba->lpfc_injerr_wwpn.u.wwn[0] && in lpfc_bg_err_inject()
1346 (memcmp(&ndlp->nlp_portname, &phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1360 if (phba->lpfc_injerr_wref_cnt) { in lpfc_bg_err_inject()
1372 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1391 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1392 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1393 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1394 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1396 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1412 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1413 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1414 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1415 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1417 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1422 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1433 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1434 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1435 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1436 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1438 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1443 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1449 if (phba->lpfc_injerr_rref_cnt) { in lpfc_bg_err_inject()
1460 phba->lpfc_injerr_rref_cnt--; in lpfc_bg_err_inject()
1461 if (phba->lpfc_injerr_rref_cnt == 0) { in lpfc_bg_err_inject()
1462 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1463 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1465 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1470 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1480 if (phba->lpfc_injerr_wapp_cnt) { in lpfc_bg_err_inject()
1492 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1511 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1512 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1513 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1514 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1516 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1531 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1532 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1533 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1534 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1536 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1541 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1552 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1553 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1554 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1555 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1557 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1562 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1568 if (phba->lpfc_injerr_rapp_cnt) { in lpfc_bg_err_inject()
1579 phba->lpfc_injerr_rapp_cnt--; in lpfc_bg_err_inject()
1580 if (phba->lpfc_injerr_rapp_cnt == 0) { in lpfc_bg_err_inject()
1581 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1582 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1584 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1589 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1600 if (phba->lpfc_injerr_wgrd_cnt) { in lpfc_bg_err_inject()
1612 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1613 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1614 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1615 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1617 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1624 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1634 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1635 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1636 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1637 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1639 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1646 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1652 if (phba->lpfc_injerr_rgrd_cnt) { in lpfc_bg_err_inject()
1662 phba->lpfc_injerr_rgrd_cnt--; in lpfc_bg_err_inject()
1663 if (phba->lpfc_injerr_rgrd_cnt == 0) { in lpfc_bg_err_inject()
1664 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1665 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1667 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1674 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1697 lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_sc_to_bg_opcodes() argument
1724 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_sc_to_bg_opcodes()
1753 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_sc_to_bg_opcodes()
1777 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_opcodes() argument
1869 lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl() argument
1885 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1893 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl()
1896 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
2009 lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl_prot() argument
2039 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_setup_bpl_prot()
2045 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
2054 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl_prot()
2057 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
2066 if (num_bde >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_bpl_prot()
2147 if (num_bde >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_bpl_prot()
2151 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_bpl_prot()
2214 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_bpl_prot()
2254 lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl() argument
2270 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2278 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl()
2281 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2389 lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl_prot() argument
2418 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_setup_sgl_prot()
2424 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2433 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl_prot()
2436 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2445 if (num_sge >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_sgl_prot()
2531 if (num_sge >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_sgl_prot()
2535 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_sgl_prot()
2599 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_sgl_prot()
2622 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) in lpfc_prot_group_type() argument
2639 if (phba) in lpfc_prot_group_type()
2640 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_prot_group_type()
2659 lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, in lpfc_bg_scsi_adjust_dl() argument
2699 lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s3() argument
2723 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2732 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s3()
2735 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s3()
2741 if ((lpfc_cmd->seg_cnt + 2) > phba->cfg_total_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s3()
2744 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2757 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2772 (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_scsi_prep_dma_buf_s3()
2775 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2779 (num_bde > phba->cfg_total_seg_cnt)) in lpfc_bg_scsi_prep_dma_buf_s3()
2788 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s3()
2806 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s3()
2820 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s3()
2824 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s3()
2828 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s3()
2871 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_calc_bg_err() argument
3010 phba->bg_guard_err_cnt++; in lpfc_calc_bg_err()
3011 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3022 phba->bg_reftag_err_cnt++; in lpfc_calc_bg_err()
3023 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3034 phba->bg_apptag_err_cnt++; in lpfc_calc_bg_err()
3035 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3056 lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, in lpfc_parse_bg_err() argument
3068 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9070 BLKGRD: Saving" in lpfc_parse_bg_err()
3071 lpfc_debug_save_data(phba, cmd); in lpfc_parse_bg_err()
3074 if (lpfc_prot_group_type(phba, cmd) == in lpfc_parse_bg_err()
3076 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9071 BLKGRD: " in lpfc_parse_bg_err()
3079 lpfc_debug_save_dif(phba, cmd); in lpfc_parse_bg_err()
3088 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3100 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3117 phba->bg_guard_err_cnt++; in lpfc_parse_bg_err()
3118 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3134 phba->bg_reftag_err_cnt++; in lpfc_parse_bg_err()
3135 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3151 phba->bg_apptag_err_cnt++; in lpfc_parse_bg_err()
3152 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3196 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3204 lpfc_calc_bg_err(phba, lpfc_cmd); in lpfc_parse_bg_err()
3223 lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s4() argument
3263 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s4()
3264 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:" in lpfc_scsi_prep_dma_buf_s4()
3267 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s4()
3301 if (phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) { in lpfc_scsi_prep_dma_buf_s4()
3337 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_scsi_prep_dma_buf_s4()
3353 lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s4() argument
3376 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3392 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s4()
3395 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s4()
3400 if ((lpfc_cmd->seg_cnt + 1) > phba->cfg_total_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s4()
3403 num_sge = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3417 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3431 (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_scsi_prep_dma_buf_s4()
3434 num_sge = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3439 (num_sge > phba->cfg_total_seg_cnt)) in lpfc_bg_scsi_prep_dma_buf_s4()
3448 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s4()
3470 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s4()
3483 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_bg_scsi_prep_dma_buf_s4()
3492 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s4()
3496 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s4()
3500 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s4()
3521 lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf() argument
3523 return phba->lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf()
3540 lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_bg_scsi_prep_dma_buf() argument
3542 return phba->lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf()
3556 lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, in lpfc_send_scsi_error_event() argument
3573 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3588 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3614 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3633 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3634 list_add_tail(&fast_path_evt->work_evt.evt_listp, &phba->work_list); in lpfc_send_scsi_error_event()
3635 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3636 lpfc_worker_wake_up(phba); in lpfc_send_scsi_error_event()
3649 lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) in lpfc_scsi_unprep_dma_buf() argument
3660 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(psb->pCmd), in lpfc_scsi_unprep_dma_buf()
3838 lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb); in lpfc_handle_fcp_err()
3853 int lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba, in lpfc_sli4_scmd_to_wqidx_distr() argument
3869 if (phba->cfg_fcp_io_sched == LPFC_FCP_SCHED_BY_CPU in lpfc_sli4_scmd_to_wqidx_distr()
3870 && phba->cfg_fcp_io_channel > 1) { in lpfc_sli4_scmd_to_wqidx_distr()
3872 if (cpu < phba->sli4_hba.num_present_cpu) { in lpfc_sli4_scmd_to_wqidx_distr()
3873 cpup = phba->sli4_hba.cpu_map; in lpfc_sli4_scmd_to_wqidx_distr()
3878 chann = atomic_add_return(1, &phba->fcp_qidx); in lpfc_sli4_scmd_to_wqidx_distr()
3879 chann = (chann % phba->cfg_fcp_io_channel); in lpfc_sli4_scmd_to_wqidx_distr()
3895 lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, in lpfc_scsi_cmd_iocb_cmpl() argument
3979 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_scsi_cmd_iocb_cmpl()
3992 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_scsi_cmd_iocb_cmpl()
4011 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4013 &phba->work_list); in lpfc_scsi_cmd_iocb_cmpl()
4014 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4015 lpfc_worker_wake_up(phba); in lpfc_scsi_cmd_iocb_cmpl()
4043 lpfc_parse_bg_err(phba, lpfc_cmd, in lpfc_scsi_cmd_iocb_cmpl()
4054 && (phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_cmd_iocb_cmpl()
4060 lpfc_set_rrq_active(phba, pnode, in lpfc_scsi_cmd_iocb_cmpl()
4088 lpfc_update_stats(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4122 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4127 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_scsi_cmd_iocb_cmpl()
4128 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4130 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4140 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4144 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4146 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4157 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4191 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_prep_cmnd() local
4220 sli4 = (phba->sli_rev == LPFC_SLI_REV4); in lpfc_scsi_prep_cmnd()
4243 phba->fc4OutputRequests++; in lpfc_scsi_prep_cmnd()
4248 phba->fc4InputRequests++; in lpfc_scsi_prep_cmnd()
4255 phba->fc4ControlRequests++; in lpfc_scsi_prep_cmnd()
4257 if (phba->sli_rev == 3 && in lpfc_scsi_prep_cmnd()
4258 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_cmnd()
4267 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]; in lpfc_scsi_prep_cmnd()
4320 if (vport->phba->sli_rev == 3 && in lpfc_scsi_prep_task_mgmt_cmd()
4321 !(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_task_mgmt_cmd()
4325 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_scsi_prep_task_mgmt_cmd()
4327 vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_scsi_prep_task_mgmt_cmd()
4344 if (vport->phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_prep_task_mgmt_cmd()
4345 lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd()
4360 lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_scsi_api_table_setup() argument
4363 phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; in lpfc_scsi_api_table_setup()
4364 phba->lpfc_scsi_prep_cmnd = lpfc_scsi_prep_cmnd; in lpfc_scsi_api_table_setup()
4368 phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4369 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4370 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4371 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4372 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4375 phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4376 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4377 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4378 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4379 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4382 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_scsi_api_table_setup()
4388 phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; in lpfc_scsi_api_table_setup()
4389 phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; in lpfc_scsi_api_table_setup()
4403 lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, in lpfc_tskmgmt_def_cmpl() argument
4410 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_tskmgmt_def_cmpl()
4427 struct lpfc_hba *phba = vport->phba; in lpfc_info() local
4432 if (phba && phba->pcidev){ in lpfc_info()
4433 strncpy(lpfcinfobuf, phba->ModelDesc, 256); in lpfc_info()
4438 phba->pcidev->bus->number, in lpfc_info()
4439 phba->pcidev->devfn, in lpfc_info()
4440 phba->pcidev->irq); in lpfc_info()
4442 if (phba->Port[0]) { in lpfc_info()
4446 phba->Port); in lpfc_info()
4449 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_info()
4450 link_speed = lpfc_sli_port_speed_get(phba); in lpfc_info()
4452 if (phba->sli4_hba.link_state.logical_speed) in lpfc_info()
4454 phba->sli4_hba.link_state.logical_speed; in lpfc_info()
4456 link_speed = phba->sli4_hba.link_state.speed; in lpfc_info()
4472 static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) in lpfc_poll_rearm_timer() argument
4475 (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); in lpfc_poll_rearm_timer()
4477 if (!list_empty(&phba->sli.ring[LPFC_FCP_RING].txcmplq)) in lpfc_poll_rearm_timer()
4478 mod_timer(&phba->fcp_poll_timer, in lpfc_poll_rearm_timer()
4488 void lpfc_poll_start_timer(struct lpfc_hba * phba) in lpfc_poll_start_timer() argument
4490 lpfc_poll_rearm_timer(phba); in lpfc_poll_start_timer()
4503 struct lpfc_hba *phba = (struct lpfc_hba *) ptr; in lpfc_poll_timeout() local
4505 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_poll_timeout()
4506 lpfc_sli_handle_fast_ring_event(phba, in lpfc_poll_timeout()
4507 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_poll_timeout()
4509 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_poll_timeout()
4510 lpfc_poll_rearm_timer(phba); in lpfc_poll_timeout()
4531 struct lpfc_hba *phba = vport->phba; in lpfc_queuecommand() local
4547 (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { in lpfc_queuecommand()
4549 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_queuecommand()
4567 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp); in lpfc_queuecommand()
4569 lpfc_rampdown_queue_depth(phba); in lpfc_queuecommand()
4588 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4599 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4601 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4611 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4620 err = lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_queuecommand()
4633 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
4644 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_queuecommand()
4645 lpfc_sli_handle_fast_ring_event(phba, in lpfc_queuecommand()
4646 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_queuecommand()
4648 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_queuecommand()
4649 lpfc_poll_rearm_timer(phba); in lpfc_queuecommand()
4655 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4656 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4684 struct lpfc_hba *phba = vport->phba; in lpfc_abort_handler() local
4699 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_abort_handler()
4701 if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { in lpfc_abort_handler()
4702 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4711 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4722 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4747 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4751 abtsiocb = __lpfc_sli_get_iocbq(phba); in lpfc_abort_handler()
4770 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
4784 if (lpfc_is_link_up(phba)) in lpfc_abort_handler()
4791 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
4793 pring_s4 = &phba->sli.ring[ring_number]; in lpfc_abort_handler()
4796 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_abort_handler()
4800 ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_abort_handler()
4804 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4808 lpfc_sli_release_iocbq(phba, abtsiocb); in lpfc_abort_handler()
4813 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_abort_handler()
4814 lpfc_sli_handle_fast_ring_event(phba, in lpfc_abort_handler()
4815 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_abort_handler()
4840 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4959 struct lpfc_hba *phba = vport->phba; in lpfc_send_taskmgmt() local
4970 lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode); in lpfc_send_taskmgmt()
4973 lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; in lpfc_send_taskmgmt()
4979 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
4984 iocbqrsp = lpfc_sli_get_iocbq(phba); in lpfc_send_taskmgmt()
4986 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
4998 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, in lpfc_send_taskmgmt()
5028 lpfc_sli_release_iocbq(phba, iocbqrsp); in lpfc_send_taskmgmt()
5031 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5104 struct lpfc_hba *phba = vport->phba; in lpfc_reset_flush_io_context() local
5111 &phba->sli.ring[phba->sli.fcp_ring], in lpfc_reset_flush_io_context()
5324 if (vport->phba->cfg_fcp2_no_tgt_reset && in lpfc_bus_reset_handler()
5385 struct lpfc_hba *phba = vport->phba; in lpfc_host_reset_handler() local
5391 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_host_reset_handler()
5392 lpfc_offline(phba); in lpfc_host_reset_handler()
5393 rc = lpfc_sli_brdrestart(phba); in lpfc_host_reset_handler()
5396 rc = lpfc_online(phba); in lpfc_host_reset_handler()
5399 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
5404 lpfc_sli4_offline_eratt(phba); in lpfc_host_reset_handler()
5426 struct lpfc_hba *phba = vport->phba; in lpfc_slave_alloc() local
5439 if (phba->cfg_fof) { in lpfc_slave_alloc()
5447 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5448 device_data = __lpfc_get_device_data(phba, in lpfc_slave_alloc()
5449 &phba->luns, in lpfc_slave_alloc()
5454 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5455 device_data = lpfc_create_device_data(phba, in lpfc_slave_alloc()
5461 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5462 list_add_tail(&device_data->listentry, &phba->luns); in lpfc_slave_alloc()
5466 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5471 sdev_cnt = atomic_inc_return(&phba->sdev_cnt); in lpfc_slave_alloc()
5480 total = phba->total_scsi_bufs; in lpfc_slave_alloc()
5488 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5495 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5500 num_to_alloc, phba->cfg_hba_queue_depth, in lpfc_slave_alloc()
5501 (phba->cfg_hba_queue_depth - total)); in lpfc_slave_alloc()
5502 num_to_alloc = phba->cfg_hba_queue_depth - total; in lpfc_slave_alloc()
5513 phba->total_scsi_bufs += num_allocated; in lpfc_slave_alloc()
5532 struct lpfc_hba *phba = vport->phba; in lpfc_slave_configure() local
5536 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_slave_configure()
5537 lpfc_sli_handle_fast_ring_event(phba, in lpfc_slave_configure()
5538 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_slave_configure()
5539 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_slave_configure()
5540 lpfc_poll_rearm_timer(phba); in lpfc_slave_configure()
5556 struct lpfc_hba *phba = vport->phba; in lpfc_slave_destroy() local
5560 atomic_dec(&phba->sdev_cnt); in lpfc_slave_destroy()
5561 if ((phba->cfg_fof) && (device_data)) { in lpfc_slave_destroy()
5562 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_destroy()
5565 lpfc_delete_device_data(phba, device_data); in lpfc_slave_destroy()
5566 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_destroy()
5591 lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_create_device_data() argument
5599 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_create_device_data()
5600 !(phba->cfg_fof)) in lpfc_create_device_data()
5609 lun_info = mempool_alloc(phba->device_data_mem_pool, memory_flags); in lpfc_create_device_data()
5633 lpfc_delete_device_data(struct lpfc_hba *phba, in lpfc_delete_device_data() argument
5637 if (unlikely(!phba) || !lun_info || in lpfc_delete_device_data()
5638 !(phba->cfg_fof)) in lpfc_delete_device_data()
5643 mempool_free(lun_info, phba->device_data_mem_pool); in lpfc_delete_device_data()
5664 __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list, in __lpfc_get_device_data() argument
5671 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || in __lpfc_get_device_data()
5672 !phba->cfg_fof) in __lpfc_get_device_data()
5716 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_find_next_oas_lun() argument
5730 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_find_next_oas_lun()
5734 !phba->cfg_fof) in lpfc_find_next_oas_lun()
5743 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5744 list_for_each_entry(lun_info, &phba->luns, listentry) { in lpfc_find_next_oas_lun()
5768 if (phba->cfg_oas_flags & OAS_FIND_ANY_VPORT) in lpfc_find_next_oas_lun()
5771 if (phba->cfg_oas_flags & OAS_FIND_ANY_TARGET) in lpfc_find_next_oas_lun()
5785 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5810 lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_enable_oas_lun() argument
5817 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_enable_oas_lun()
5818 !phba->cfg_fof) in lpfc_enable_oas_lun()
5821 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5824 lun_info = __lpfc_get_device_data(phba, &phba->luns, vport_wwpn, in lpfc_enable_oas_lun()
5829 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5834 lun_info = lpfc_create_device_data(phba, vport_wwpn, target_wwpn, lun, in lpfc_enable_oas_lun()
5839 list_add_tail(&lun_info->listentry, &phba->luns); in lpfc_enable_oas_lun()
5840 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5843 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5867 lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_disable_oas_lun() argument
5874 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_disable_oas_lun()
5875 !phba->cfg_fof) in lpfc_disable_oas_lun()
5878 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5881 lun_info = __lpfc_get_device_data(phba, in lpfc_disable_oas_lun()
5882 &phba->luns, vport_wwpn, in lpfc_disable_oas_lun()
5887 lpfc_delete_device_data(phba, lun_info); in lpfc_disable_oas_lun()
5888 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5892 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()