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
1316 if (phba->lpfc_injerr_lba != LPFC_INJERR_LBA_OFF) { in lpfc_bg_err_inject()
1321 if ((phba->lpfc_injerr_lba < lba) || in lpfc_bg_err_inject()
1322 (phba->lpfc_injerr_lba >= (lba + numblks))) in lpfc_bg_err_inject()
1325 blockoff = phba->lpfc_injerr_lba - lba; in lpfc_bg_err_inject()
1339 if (phba->lpfc_injerr_nportid && in lpfc_bg_err_inject()
1340 (phba->lpfc_injerr_nportid != ndlp->nlp_DID)) in lpfc_bg_err_inject()
1347 if (phba->lpfc_injerr_wwpn.u.wwn[0] && in lpfc_bg_err_inject()
1348 (memcmp(&ndlp->nlp_portname, &phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1362 if (phba->lpfc_injerr_wref_cnt) { in lpfc_bg_err_inject()
1374 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1393 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1394 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1395 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1396 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1398 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1414 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1415 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1416 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1417 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1419 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1424 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1435 phba->lpfc_injerr_wref_cnt--; in lpfc_bg_err_inject()
1436 if (phba->lpfc_injerr_wref_cnt == 0) { in lpfc_bg_err_inject()
1437 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1438 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1440 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1445 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1451 if (phba->lpfc_injerr_rref_cnt) { in lpfc_bg_err_inject()
1462 phba->lpfc_injerr_rref_cnt--; in lpfc_bg_err_inject()
1463 if (phba->lpfc_injerr_rref_cnt == 0) { in lpfc_bg_err_inject()
1464 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1465 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1467 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1472 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1482 if (phba->lpfc_injerr_wapp_cnt) { in lpfc_bg_err_inject()
1494 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1513 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1514 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1515 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1516 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1518 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1533 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1534 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1535 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1536 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1538 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1543 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1554 phba->lpfc_injerr_wapp_cnt--; in lpfc_bg_err_inject()
1555 if (phba->lpfc_injerr_wapp_cnt == 0) { in lpfc_bg_err_inject()
1556 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1557 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1559 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1564 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1570 if (phba->lpfc_injerr_rapp_cnt) { in lpfc_bg_err_inject()
1581 phba->lpfc_injerr_rapp_cnt--; in lpfc_bg_err_inject()
1582 if (phba->lpfc_injerr_rapp_cnt == 0) { in lpfc_bg_err_inject()
1583 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1584 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1586 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1591 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1602 if (phba->lpfc_injerr_wgrd_cnt) { in lpfc_bg_err_inject()
1614 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1615 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1616 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1617 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1619 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1626 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1636 phba->lpfc_injerr_wgrd_cnt--; in lpfc_bg_err_inject()
1637 if (phba->lpfc_injerr_wgrd_cnt == 0) { in lpfc_bg_err_inject()
1638 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1639 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1641 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1648 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1654 if (phba->lpfc_injerr_rgrd_cnt) { in lpfc_bg_err_inject()
1664 phba->lpfc_injerr_rgrd_cnt--; in lpfc_bg_err_inject()
1665 if (phba->lpfc_injerr_rgrd_cnt == 0) { in lpfc_bg_err_inject()
1666 phba->lpfc_injerr_nportid = 0; in lpfc_bg_err_inject()
1667 phba->lpfc_injerr_lba = in lpfc_bg_err_inject()
1669 memset(&phba->lpfc_injerr_wwpn, in lpfc_bg_err_inject()
1676 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_err_inject()
1699 lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_sc_to_bg_opcodes() argument
1726 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_sc_to_bg_opcodes()
1755 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_sc_to_bg_opcodes()
1779 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_err_opcodes() argument
1871 lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl() argument
1888 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
1897 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl()
1900 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl()
2013 lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_bpl_prot() argument
2043 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_setup_bpl_prot()
2049 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
2058 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_bpl_prot()
2061 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_bpl_prot()
2070 if (num_bde >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_bpl_prot()
2151 if (num_bde >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_bpl_prot()
2155 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_bpl_prot()
2218 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_bpl_prot()
2258 lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl() argument
2275 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2284 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl()
2287 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl()
2395 lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc, in lpfc_bg_setup_sgl_prot() argument
2424 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_setup_sgl_prot()
2430 status = lpfc_sc_to_bg_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2439 rc = lpfc_bg_err_inject(phba, sc, &reftag, NULL, 1); in lpfc_bg_setup_sgl_prot()
2442 lpfc_bg_err_opcodes(phba, sc, &txop, &rxop); in lpfc_bg_setup_sgl_prot()
2451 if (num_sge >= (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_setup_sgl_prot()
2537 if (num_sge >= phba->cfg_total_seg_cnt) in lpfc_bg_setup_sgl_prot()
2541 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_sgl_prot()
2605 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_bg_setup_sgl_prot()
2628 lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc) in lpfc_prot_group_type() argument
2645 if (phba) in lpfc_prot_group_type()
2646 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_prot_group_type()
2665 lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba, in lpfc_bg_scsi_adjust_dl() argument
2705 lpfc_bg_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s3() argument
2729 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2738 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s3()
2741 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s3()
2747 if ((lpfc_cmd->seg_cnt + 2) > phba->cfg_total_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s3()
2750 num_bde = lpfc_bg_setup_bpl(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2763 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s3()
2778 (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_scsi_prep_dma_buf_s3()
2781 num_bde = lpfc_bg_setup_bpl_prot(phba, scsi_cmnd, bpl, in lpfc_bg_scsi_prep_dma_buf_s3()
2785 (num_bde > phba->cfg_total_seg_cnt)) in lpfc_bg_scsi_prep_dma_buf_s3()
2794 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s3()
2812 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s3()
2826 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s3()
2830 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s3()
2834 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s3()
2877 lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_calc_bg_err() argument
3017 phba->bg_guard_err_cnt++; in lpfc_calc_bg_err()
3018 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3029 phba->bg_reftag_err_cnt++; in lpfc_calc_bg_err()
3030 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3041 phba->bg_apptag_err_cnt++; in lpfc_calc_bg_err()
3042 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_calc_bg_err()
3063 lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd, in lpfc_parse_bg_err() argument
3075 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9070 BLKGRD: Saving" in lpfc_parse_bg_err()
3078 lpfc_debug_save_data(phba, cmd); in lpfc_parse_bg_err()
3081 if (lpfc_prot_group_type(phba, cmd) == in lpfc_parse_bg_err()
3083 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9071 BLKGRD: " in lpfc_parse_bg_err()
3086 lpfc_debug_save_dif(phba, cmd); in lpfc_parse_bg_err()
3095 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3107 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3124 phba->bg_guard_err_cnt++; in lpfc_parse_bg_err()
3125 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3141 phba->bg_reftag_err_cnt++; in lpfc_parse_bg_err()
3142 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3158 phba->bg_apptag_err_cnt++; in lpfc_parse_bg_err()
3159 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3203 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, in lpfc_parse_bg_err()
3211 lpfc_calc_bg_err(phba, lpfc_cmd); in lpfc_parse_bg_err()
3230 lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf_s4() argument
3270 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) { in lpfc_scsi_prep_dma_buf_s4()
3271 lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9074 BLKGRD:" in lpfc_scsi_prep_dma_buf_s4()
3274 __func__, phba->cfg_sg_seg_cnt, in lpfc_scsi_prep_dma_buf_s4()
3308 if (phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) { in lpfc_scsi_prep_dma_buf_s4()
3344 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_scsi_prep_dma_buf_s4()
3360 lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, in lpfc_bg_scsi_prep_dma_buf_s4() argument
3383 datasegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3399 if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s4()
3402 prot_group_type = lpfc_prot_group_type(phba, scsi_cmnd); in lpfc_bg_scsi_prep_dma_buf_s4()
3407 if ((lpfc_cmd->seg_cnt + 1) > phba->cfg_total_seg_cnt) in lpfc_bg_scsi_prep_dma_buf_s4()
3410 num_sge = lpfc_bg_setup_sgl(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3424 protsegcnt = dma_map_sg(&phba->pcidev->dev, in lpfc_bg_scsi_prep_dma_buf_s4()
3438 (phba->cfg_total_seg_cnt - 2)) in lpfc_bg_scsi_prep_dma_buf_s4()
3441 num_sge = lpfc_bg_setup_sgl_prot(phba, scsi_cmnd, sgl, in lpfc_bg_scsi_prep_dma_buf_s4()
3446 (num_sge > phba->cfg_total_seg_cnt)) in lpfc_bg_scsi_prep_dma_buf_s4()
3455 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s4()
3477 fcpdl = lpfc_bg_scsi_adjust_dl(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf_s4()
3490 if ((phba->cfg_fof) && ((struct lpfc_device_data *) in lpfc_bg_scsi_prep_dma_buf_s4()
3499 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(scsi_cmnd), in lpfc_bg_scsi_prep_dma_buf_s4()
3503 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, in lpfc_bg_scsi_prep_dma_buf_s4()
3507 phba->cfg_total_seg_cnt, phba->cfg_sg_seg_cnt, in lpfc_bg_scsi_prep_dma_buf_s4()
3528 lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_scsi_prep_dma_buf() argument
3530 return phba->lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_prep_dma_buf()
3547 lpfc_bg_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) in lpfc_bg_scsi_prep_dma_buf() argument
3549 return phba->lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_bg_scsi_prep_dma_buf()
3563 lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport, in lpfc_send_scsi_error_event() argument
3580 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3595 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3621 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_send_scsi_error_event()
3640 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3641 list_add_tail(&fast_path_evt->work_evt.evt_listp, &phba->work_list); in lpfc_send_scsi_error_event()
3642 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_send_scsi_error_event()
3643 lpfc_worker_wake_up(phba); in lpfc_send_scsi_error_event()
3656 lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) in lpfc_scsi_unprep_dma_buf() argument
3667 dma_unmap_sg(&phba->pcidev->dev, scsi_prot_sglist(psb->pCmd), in lpfc_scsi_unprep_dma_buf()
3845 lpfc_send_scsi_error_event(vport->phba, vport, lpfc_cmd, rsp_iocb); in lpfc_handle_fcp_err()
3859 lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, in lpfc_scsi_cmd_iocb_cmpl() argument
3945 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_scsi_cmd_iocb_cmpl()
3958 fast_path_evt = lpfc_alloc_fast_evt(phba); in lpfc_scsi_cmd_iocb_cmpl()
3977 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
3979 &phba->work_list); in lpfc_scsi_cmd_iocb_cmpl()
3980 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
3981 lpfc_worker_wake_up(phba); in lpfc_scsi_cmd_iocb_cmpl()
4009 lpfc_parse_bg_err(phba, lpfc_cmd, in lpfc_scsi_cmd_iocb_cmpl()
4020 && (phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_cmd_iocb_cmpl()
4026 lpfc_set_rrq_active(phba, pnode, in lpfc_scsi_cmd_iocb_cmpl()
4054 lpfc_update_stats(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4089 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4096 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_scsi_cmd_iocb_cmpl()
4097 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4099 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4109 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4113 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4115 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_scsi_cmd_iocb_cmpl()
4126 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_scsi_cmd_iocb_cmpl()
4160 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_prep_cmnd() local
4189 sli4 = (phba->sli_rev == LPFC_SLI_REV4); in lpfc_scsi_prep_cmnd()
4212 phba->fc4OutputRequests++; in lpfc_scsi_prep_cmnd()
4217 phba->fc4InputRequests++; in lpfc_scsi_prep_cmnd()
4224 phba->fc4ControlRequests++; in lpfc_scsi_prep_cmnd()
4226 if (phba->sli_rev == 3 && in lpfc_scsi_prep_cmnd()
4227 !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_cmnd()
4236 phba->sli4_hba.rpi_ids[pnode->nlp_rpi]; in lpfc_scsi_prep_cmnd()
4289 if (vport->phba->sli_rev == 3 && in lpfc_scsi_prep_task_mgmt_cmd()
4290 !(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) in lpfc_scsi_prep_task_mgmt_cmd()
4294 if (vport->phba->sli_rev == LPFC_SLI_REV4) { in lpfc_scsi_prep_task_mgmt_cmd()
4296 vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_scsi_prep_task_mgmt_cmd()
4313 if (vport->phba->sli_rev == LPFC_SLI_REV4) in lpfc_scsi_prep_task_mgmt_cmd()
4314 lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); in lpfc_scsi_prep_task_mgmt_cmd()
4329 lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) in lpfc_scsi_api_table_setup() argument
4332 phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; in lpfc_scsi_api_table_setup()
4333 phba->lpfc_scsi_prep_cmnd = lpfc_scsi_prep_cmnd; in lpfc_scsi_api_table_setup()
4337 phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4338 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4339 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s3; in lpfc_scsi_api_table_setup()
4340 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4341 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; in lpfc_scsi_api_table_setup()
4344 phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4345 phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4346 phba->lpfc_bg_scsi_prep_dma_buf = lpfc_bg_scsi_prep_dma_buf_s4; in lpfc_scsi_api_table_setup()
4347 phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4348 phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; in lpfc_scsi_api_table_setup()
4351 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_scsi_api_table_setup()
4357 phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; in lpfc_scsi_api_table_setup()
4358 phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; in lpfc_scsi_api_table_setup()
4372 lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba, in lpfc_tskmgmt_def_cmpl() argument
4379 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_tskmgmt_def_cmpl()
4396 struct lpfc_hba *phba = vport->phba; in lpfc_info() local
4401 if (phba && phba->pcidev){ in lpfc_info()
4402 strncpy(lpfcinfobuf, phba->ModelDesc, 256); in lpfc_info()
4407 phba->pcidev->bus->number, in lpfc_info()
4408 phba->pcidev->devfn, in lpfc_info()
4409 phba->pcidev->irq); in lpfc_info()
4411 if (phba->Port[0]) { in lpfc_info()
4415 phba->Port); in lpfc_info()
4418 if (phba->sli_rev <= LPFC_SLI_REV3) { in lpfc_info()
4419 link_speed = lpfc_sli_port_speed_get(phba); in lpfc_info()
4421 if (phba->sli4_hba.link_state.logical_speed) in lpfc_info()
4423 phba->sli4_hba.link_state.logical_speed; in lpfc_info()
4425 link_speed = phba->sli4_hba.link_state.speed; in lpfc_info()
4441 static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) in lpfc_poll_rearm_timer() argument
4444 (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); in lpfc_poll_rearm_timer()
4446 if (!list_empty(&phba->sli.ring[LPFC_FCP_RING].txcmplq)) in lpfc_poll_rearm_timer()
4447 mod_timer(&phba->fcp_poll_timer, in lpfc_poll_rearm_timer()
4457 void lpfc_poll_start_timer(struct lpfc_hba * phba) in lpfc_poll_start_timer() argument
4459 lpfc_poll_rearm_timer(phba); in lpfc_poll_start_timer()
4472 struct lpfc_hba *phba = (struct lpfc_hba *) ptr; in lpfc_poll_timeout() local
4474 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_poll_timeout()
4475 lpfc_sli_handle_fast_ring_event(phba, in lpfc_poll_timeout()
4476 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_poll_timeout()
4478 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_poll_timeout()
4479 lpfc_poll_rearm_timer(phba); in lpfc_poll_timeout()
4500 struct lpfc_hba *phba = vport->phba; in lpfc_queuecommand() local
4516 (!(phba->sli3_options & LPFC_SLI3_BG_ENABLED))) { in lpfc_queuecommand()
4518 lpfc_printf_log(phba, KERN_ERR, LOG_BG, in lpfc_queuecommand()
4536 lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp); in lpfc_queuecommand()
4538 lpfc_rampdown_queue_depth(phba); in lpfc_queuecommand()
4557 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4568 err = lpfc_bg_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4570 if (vport->phba->cfg_enable_bg) { in lpfc_queuecommand()
4580 err = lpfc_scsi_prep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4589 err = lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_queuecommand()
4602 phba->sli_rev == LPFC_SLI_REV4 ? in lpfc_queuecommand()
4613 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_queuecommand()
4614 lpfc_sli_handle_fast_ring_event(phba, in lpfc_queuecommand()
4615 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_queuecommand()
4617 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_queuecommand()
4618 lpfc_poll_rearm_timer(phba); in lpfc_queuecommand()
4624 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4625 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_queuecommand()
4653 struct lpfc_hba *phba = vport->phba; in lpfc_abort_handler() local
4668 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_abort_handler()
4670 if (phba->hba_flag & HBA_FCP_IOQ_FLUSH) { in lpfc_abort_handler()
4671 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4680 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4691 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4716 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4720 abtsiocb = __lpfc_sli_get_iocbq(phba); in lpfc_abort_handler()
4739 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_abort_handler()
4753 if (lpfc_is_link_up(phba)) in lpfc_abort_handler()
4760 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_abort_handler()
4762 pring_s4 = &phba->sli.ring[ring_number]; in lpfc_abort_handler()
4765 ret_val = __lpfc_sli_issue_iocb(phba, pring_s4->ringno, in lpfc_abort_handler()
4769 ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, in lpfc_abort_handler()
4773 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4777 lpfc_sli_release_iocbq(phba, abtsiocb); in lpfc_abort_handler()
4782 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_abort_handler()
4783 lpfc_sli_handle_fast_ring_event(phba, in lpfc_abort_handler()
4784 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_abort_handler()
4809 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_abort_handler()
4928 struct lpfc_hba *phba = vport->phba; in lpfc_send_taskmgmt() local
4939 lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode); in lpfc_send_taskmgmt()
4942 lpfc_cmd->timeout = phba->cfg_task_mgmt_tmo; in lpfc_send_taskmgmt()
4948 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
4953 iocbqrsp = lpfc_sli_get_iocbq(phba); in lpfc_send_taskmgmt()
4955 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
4967 status = lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, in lpfc_send_taskmgmt()
4995 lpfc_sli_release_iocbq(phba, iocbqrsp); in lpfc_send_taskmgmt()
4998 lpfc_release_scsi_buf(phba, lpfc_cmd); in lpfc_send_taskmgmt()
5071 struct lpfc_hba *phba = vport->phba; in lpfc_reset_flush_io_context() local
5078 &phba->sli.ring[phba->sli.fcp_ring], in lpfc_reset_flush_io_context()
5291 if (vport->phba->cfg_fcp2_no_tgt_reset && in lpfc_bus_reset_handler()
5352 struct lpfc_hba *phba = vport->phba; in lpfc_host_reset_handler() local
5358 lpfc_offline_prep(phba, LPFC_MBX_WAIT); in lpfc_host_reset_handler()
5359 lpfc_offline(phba); in lpfc_host_reset_handler()
5360 rc = lpfc_sli_brdrestart(phba); in lpfc_host_reset_handler()
5363 rc = lpfc_online(phba); in lpfc_host_reset_handler()
5366 lpfc_unblock_mgmt_io(phba); in lpfc_host_reset_handler()
5371 lpfc_sli4_offline_eratt(phba); in lpfc_host_reset_handler()
5393 struct lpfc_hba *phba = vport->phba; in lpfc_slave_alloc() local
5406 if (phba->cfg_fof) { in lpfc_slave_alloc()
5414 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5415 device_data = __lpfc_get_device_data(phba, in lpfc_slave_alloc()
5416 &phba->luns, in lpfc_slave_alloc()
5421 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5422 device_data = lpfc_create_device_data(phba, in lpfc_slave_alloc()
5428 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_alloc()
5429 list_add_tail(&device_data->listentry, &phba->luns); in lpfc_slave_alloc()
5433 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_alloc()
5438 sdev_cnt = atomic_inc_return(&phba->sdev_cnt); in lpfc_slave_alloc()
5447 total = phba->total_scsi_bufs; in lpfc_slave_alloc()
5455 if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5462 phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) { in lpfc_slave_alloc()
5467 num_to_alloc, phba->cfg_hba_queue_depth, in lpfc_slave_alloc()
5468 (phba->cfg_hba_queue_depth - total)); in lpfc_slave_alloc()
5469 num_to_alloc = phba->cfg_hba_queue_depth - total; in lpfc_slave_alloc()
5480 phba->total_scsi_bufs += num_allocated; in lpfc_slave_alloc()
5499 struct lpfc_hba *phba = vport->phba; in lpfc_slave_configure() local
5503 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { in lpfc_slave_configure()
5504 lpfc_sli_handle_fast_ring_event(phba, in lpfc_slave_configure()
5505 &phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ); in lpfc_slave_configure()
5506 if (phba->cfg_poll & DISABLE_FCP_RING_INT) in lpfc_slave_configure()
5507 lpfc_poll_rearm_timer(phba); in lpfc_slave_configure()
5523 struct lpfc_hba *phba = vport->phba; in lpfc_slave_destroy() local
5527 atomic_dec(&phba->sdev_cnt); in lpfc_slave_destroy()
5528 if ((phba->cfg_fof) && (device_data)) { in lpfc_slave_destroy()
5529 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_slave_destroy()
5532 lpfc_delete_device_data(phba, device_data); in lpfc_slave_destroy()
5533 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_slave_destroy()
5558 lpfc_create_device_data(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_create_device_data() argument
5566 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_create_device_data()
5567 !(phba->cfg_fof)) in lpfc_create_device_data()
5576 lun_info = mempool_alloc(phba->device_data_mem_pool, memory_flags); in lpfc_create_device_data()
5600 lpfc_delete_device_data(struct lpfc_hba *phba, in lpfc_delete_device_data() argument
5604 if (unlikely(!phba) || !lun_info || in lpfc_delete_device_data()
5605 !(phba->cfg_fof)) in lpfc_delete_device_data()
5610 mempool_free(lun_info, phba->device_data_mem_pool); in lpfc_delete_device_data()
5631 __lpfc_get_device_data(struct lpfc_hba *phba, struct list_head *list, in __lpfc_get_device_data() argument
5638 if (unlikely(!phba) || !list || !vport_wwpn || !target_wwpn || in __lpfc_get_device_data()
5639 !phba->cfg_fof) in __lpfc_get_device_data()
5683 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_find_next_oas_lun() argument
5697 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_find_next_oas_lun()
5701 !phba->cfg_fof) in lpfc_find_next_oas_lun()
5710 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5711 list_for_each_entry(lun_info, &phba->luns, listentry) { in lpfc_find_next_oas_lun()
5735 if (phba->cfg_oas_flags & OAS_FIND_ANY_VPORT) in lpfc_find_next_oas_lun()
5738 if (phba->cfg_oas_flags & OAS_FIND_ANY_TARGET) in lpfc_find_next_oas_lun()
5752 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_find_next_oas_lun()
5777 lpfc_enable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_enable_oas_lun() argument
5784 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_enable_oas_lun()
5785 !phba->cfg_fof) in lpfc_enable_oas_lun()
5788 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5791 lun_info = __lpfc_get_device_data(phba, &phba->luns, vport_wwpn, in lpfc_enable_oas_lun()
5796 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5801 lun_info = lpfc_create_device_data(phba, vport_wwpn, target_wwpn, lun, in lpfc_enable_oas_lun()
5806 list_add_tail(&lun_info->listentry, &phba->luns); in lpfc_enable_oas_lun()
5807 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5810 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_enable_oas_lun()
5834 lpfc_disable_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn, in lpfc_disable_oas_lun() argument
5841 if (unlikely(!phba) || !vport_wwpn || !target_wwpn || in lpfc_disable_oas_lun()
5842 !phba->cfg_fof) in lpfc_disable_oas_lun()
5845 spin_lock_irqsave(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5848 lun_info = __lpfc_get_device_data(phba, in lpfc_disable_oas_lun()
5849 &phba->luns, vport_wwpn, in lpfc_disable_oas_lun()
5854 lpfc_delete_device_data(phba, lun_info); in lpfc_disable_oas_lun()
5855 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()
5859 spin_unlock_irqrestore(&phba->devicelock, flags); in lpfc_disable_oas_lun()