diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 2fb0396c3806..38a4119d6294 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -820,6 +820,52 @@ lpfc_hba_down_prep(struct lpfc_hba *phba) | |||
820 | } | 820 | } |
821 | 821 | ||
822 | /** | 822 | /** |
823 | * lpfc_sli4_free_sp_events - Cleanup sp_queue_events to free | ||
824 | * rspiocb which got deferred | ||
825 | * | ||
826 | * @phba: pointer to lpfc HBA data structure. | ||
827 | * | ||
828 | * This routine will cleanup completed slow path events after HBA is reset | ||
829 | * when bringing down the SLI Layer. | ||
830 | * | ||
831 | * | ||
832 | * Return codes | ||
833 | * void. | ||
834 | **/ | ||
835 | static void | ||
836 | lpfc_sli4_free_sp_events(struct lpfc_hba *phba) | ||
837 | { | ||
838 | struct lpfc_iocbq *rspiocbq; | ||
839 | struct hbq_dmabuf *dmabuf; | ||
840 | struct lpfc_cq_event *cq_event; | ||
841 | |||
842 | spin_lock_irq(&phba->hbalock); | ||
843 | phba->hba_flag &= ~HBA_SP_QUEUE_EVT; | ||
844 | spin_unlock_irq(&phba->hbalock); | ||
845 | |||
846 | while (!list_empty(&phba->sli4_hba.sp_queue_event)) { | ||
847 | /* Get the response iocb from the head of work queue */ | ||
848 | spin_lock_irq(&phba->hbalock); | ||
849 | list_remove_head(&phba->sli4_hba.sp_queue_event, | ||
850 | cq_event, struct lpfc_cq_event, list); | ||
851 | spin_unlock_irq(&phba->hbalock); | ||
852 | |||
853 | switch (bf_get(lpfc_wcqe_c_code, &cq_event->cqe.wcqe_cmpl)) { | ||
854 | case CQE_CODE_COMPL_WQE: | ||
855 | rspiocbq = container_of(cq_event, struct lpfc_iocbq, | ||
856 | cq_event); | ||
857 | lpfc_sli_release_iocbq(phba, rspiocbq); | ||
858 | break; | ||
859 | case CQE_CODE_RECEIVE: | ||
860 | case CQE_CODE_RECEIVE_V1: | ||
861 | dmabuf = container_of(cq_event, struct hbq_dmabuf, | ||
862 | cq_event); | ||
863 | lpfc_in_buf_free(phba, &dmabuf->dbuf); | ||
864 | } | ||
865 | } | ||
866 | } | ||
867 | |||
868 | /** | ||
823 | * lpfc_hba_free_post_buf - Perform lpfc uninitialization after HBA reset | 869 | * lpfc_hba_free_post_buf - Perform lpfc uninitialization after HBA reset |
824 | * @phba: pointer to lpfc HBA data structure. | 870 | * @phba: pointer to lpfc HBA data structure. |
825 | * | 871 | * |
@@ -981,6 +1027,8 @@ lpfc_hba_down_post_s4(struct lpfc_hba *phba) | |||
981 | spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); | 1027 | spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); |
982 | list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); | 1028 | list_splice(&aborts, &phba->lpfc_scsi_buf_list_put); |
983 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); | 1029 | spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); |
1030 | |||
1031 | lpfc_sli4_free_sp_events(phba); | ||
984 | return 0; | 1032 | return 0; |
985 | } | 1033 | } |
986 | 1034 | ||