diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_scsi.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 581837b3c71a..c97751c95d77 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -621,10 +621,13 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba, | |||
621 | struct sli4_wcqe_xri_aborted *axri) | 621 | struct sli4_wcqe_xri_aborted *axri) |
622 | { | 622 | { |
623 | uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri); | 623 | uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri); |
624 | uint16_t rxid = bf_get(lpfc_wcqe_xa_remote_xid, axri); | ||
624 | struct lpfc_scsi_buf *psb, *next_psb; | 625 | struct lpfc_scsi_buf *psb, *next_psb; |
625 | unsigned long iflag = 0; | 626 | unsigned long iflag = 0; |
626 | struct lpfc_iocbq *iocbq; | 627 | struct lpfc_iocbq *iocbq; |
627 | int i; | 628 | int i; |
629 | struct lpfc_nodelist *ndlp; | ||
630 | int rrq_empty = 0; | ||
628 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | 631 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; |
629 | 632 | ||
630 | spin_lock_irqsave(&phba->hbalock, iflag); | 633 | spin_lock_irqsave(&phba->hbalock, iflag); |
@@ -637,8 +640,14 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba, | |||
637 | psb->status = IOSTAT_SUCCESS; | 640 | psb->status = IOSTAT_SUCCESS; |
638 | spin_unlock( | 641 | spin_unlock( |
639 | &phba->sli4_hba.abts_scsi_buf_list_lock); | 642 | &phba->sli4_hba.abts_scsi_buf_list_lock); |
643 | ndlp = psb->rdata->pnode; | ||
644 | rrq_empty = list_empty(&phba->active_rrq_list); | ||
640 | spin_unlock_irqrestore(&phba->hbalock, iflag); | 645 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
646 | if (ndlp) | ||
647 | lpfc_set_rrq_active(phba, ndlp, xri, rxid, 1); | ||
641 | lpfc_release_scsi_buf_s4(phba, psb); | 648 | lpfc_release_scsi_buf_s4(phba, psb); |
649 | if (rrq_empty) | ||
650 | lpfc_worker_wake_up(phba); | ||
642 | return; | 651 | return; |
643 | } | 652 | } |
644 | } | 653 | } |
@@ -914,7 +923,7 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport, int num_to_alloc) | |||
914 | } | 923 | } |
915 | 924 | ||
916 | /** | 925 | /** |
917 | * lpfc_get_scsi_buf - Get a scsi buffer from lpfc_scsi_buf_list of the HBA | 926 | * lpfc_get_scsi_buf_s3 - Get a scsi buffer from lpfc_scsi_buf_list of the HBA |
918 | * @phba: The HBA for which this call is being executed. | 927 | * @phba: The HBA for which this call is being executed. |
919 | * | 928 | * |
920 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list | 929 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list |
@@ -925,7 +934,7 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport, int num_to_alloc) | |||
925 | * Pointer to lpfc_scsi_buf - Success | 934 | * Pointer to lpfc_scsi_buf - Success |
926 | **/ | 935 | **/ |
927 | static struct lpfc_scsi_buf* | 936 | static struct lpfc_scsi_buf* |
928 | lpfc_get_scsi_buf(struct lpfc_hba * phba) | 937 | lpfc_get_scsi_buf_s3(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
929 | { | 938 | { |
930 | struct lpfc_scsi_buf * lpfc_cmd = NULL; | 939 | struct lpfc_scsi_buf * lpfc_cmd = NULL; |
931 | struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; | 940 | struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; |
@@ -941,6 +950,67 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba) | |||
941 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | 950 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); |
942 | return lpfc_cmd; | 951 | return lpfc_cmd; |
943 | } | 952 | } |
953 | /** | ||
954 | * lpfc_get_scsi_buf_s4 - Get a scsi buffer from lpfc_scsi_buf_list of the HBA | ||
955 | * @phba: The HBA for which this call is being executed. | ||
956 | * | ||
957 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list | ||
958 | * and returns to caller. | ||
959 | * | ||
960 | * Return codes: | ||
961 | * NULL - Error | ||
962 | * Pointer to lpfc_scsi_buf - Success | ||
963 | **/ | ||
964 | static struct lpfc_scsi_buf* | ||
965 | lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
966 | { | ||
967 | struct lpfc_scsi_buf *lpfc_cmd = NULL; | ||
968 | struct lpfc_scsi_buf *start_lpfc_cmd = NULL; | ||
969 | struct list_head *scsi_buf_list = &phba->lpfc_scsi_buf_list; | ||
970 | unsigned long iflag = 0; | ||
971 | int found = 0; | ||
972 | |||
973 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | ||
974 | list_remove_head(scsi_buf_list, lpfc_cmd, struct lpfc_scsi_buf, list); | ||
975 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, iflag); | ||
976 | while (!found && lpfc_cmd) { | ||
977 | if (lpfc_test_rrq_active(phba, ndlp, | ||
978 | lpfc_cmd->cur_iocbq.sli4_xritag)) { | ||
979 | lpfc_release_scsi_buf_s4(phba, lpfc_cmd); | ||
980 | spin_lock_irqsave(&phba->scsi_buf_list_lock, iflag); | ||
981 | list_remove_head(scsi_buf_list, lpfc_cmd, | ||
982 | struct lpfc_scsi_buf, list); | ||
983 | spin_unlock_irqrestore(&phba->scsi_buf_list_lock, | ||
984 | iflag); | ||
985 | if (lpfc_cmd == start_lpfc_cmd) { | ||
986 | lpfc_cmd = NULL; | ||
987 | break; | ||
988 | } else | ||
989 | continue; | ||
990 | } | ||
991 | found = 1; | ||
992 | lpfc_cmd->seg_cnt = 0; | ||
993 | lpfc_cmd->nonsg_phys = 0; | ||
994 | lpfc_cmd->prot_seg_cnt = 0; | ||
995 | } | ||
996 | return lpfc_cmd; | ||
997 | } | ||
998 | /** | ||
999 | * lpfc_get_scsi_buf - Get a scsi buffer from lpfc_scsi_buf_list of the HBA | ||
1000 | * @phba: The HBA for which this call is being executed. | ||
1001 | * | ||
1002 | * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list | ||
1003 | * and returns to caller. | ||
1004 | * | ||
1005 | * Return codes: | ||
1006 | * NULL - Error | ||
1007 | * Pointer to lpfc_scsi_buf - Success | ||
1008 | **/ | ||
1009 | static struct lpfc_scsi_buf* | ||
1010 | lpfc_get_scsi_buf(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1011 | { | ||
1012 | return phba->lpfc_get_scsi_buf(phba, ndlp); | ||
1013 | } | ||
944 | 1014 | ||
945 | /** | 1015 | /** |
946 | * lpfc_release_scsi_buf - Return a scsi buffer back to hba scsi buf list | 1016 | * lpfc_release_scsi_buf - Return a scsi buffer back to hba scsi buf list |
@@ -2744,18 +2814,19 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) | |||
2744 | 2814 | ||
2745 | phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; | 2815 | phba->lpfc_scsi_unprep_dma_buf = lpfc_scsi_unprep_dma_buf; |
2746 | phba->lpfc_scsi_prep_cmnd = lpfc_scsi_prep_cmnd; | 2816 | phba->lpfc_scsi_prep_cmnd = lpfc_scsi_prep_cmnd; |
2747 | phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf; | ||
2748 | 2817 | ||
2749 | switch (dev_grp) { | 2818 | switch (dev_grp) { |
2750 | case LPFC_PCI_DEV_LP: | 2819 | case LPFC_PCI_DEV_LP: |
2751 | phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s3; | 2820 | phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s3; |
2752 | phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; | 2821 | phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s3; |
2753 | phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; | 2822 | phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s3; |
2823 | phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s3; | ||
2754 | break; | 2824 | break; |
2755 | case LPFC_PCI_DEV_OC: | 2825 | case LPFC_PCI_DEV_OC: |
2756 | phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s4; | 2826 | phba->lpfc_new_scsi_buf = lpfc_new_scsi_buf_s4; |
2757 | phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; | 2827 | phba->lpfc_scsi_prep_dma_buf = lpfc_scsi_prep_dma_buf_s4; |
2758 | phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; | 2828 | phba->lpfc_release_scsi_buf = lpfc_release_scsi_buf_s4; |
2829 | phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf_s4; | ||
2759 | break; | 2830 | break; |
2760 | default: | 2831 | default: |
2761 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2832 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
@@ -2764,7 +2835,6 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) | |||
2764 | return -ENODEV; | 2835 | return -ENODEV; |
2765 | break; | 2836 | break; |
2766 | } | 2837 | } |
2767 | phba->lpfc_get_scsi_buf = lpfc_get_scsi_buf; | ||
2768 | phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; | 2838 | phba->lpfc_rampdown_queue_depth = lpfc_rampdown_queue_depth; |
2769 | phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; | 2839 | phba->lpfc_scsi_cmd_iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; |
2770 | return 0; | 2840 | return 0; |
@@ -2940,7 +3010,7 @@ lpfc_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) | |||
2940 | if (atomic_read(&ndlp->cmd_pending) >= ndlp->cmd_qdepth) | 3010 | if (atomic_read(&ndlp->cmd_pending) >= ndlp->cmd_qdepth) |
2941 | goto out_host_busy; | 3011 | goto out_host_busy; |
2942 | 3012 | ||
2943 | lpfc_cmd = lpfc_get_scsi_buf(phba); | 3013 | lpfc_cmd = lpfc_get_scsi_buf(phba, ndlp); |
2944 | if (lpfc_cmd == NULL) { | 3014 | if (lpfc_cmd == NULL) { |
2945 | lpfc_rampdown_queue_depth(phba); | 3015 | lpfc_rampdown_queue_depth(phba); |
2946 | 3016 | ||
@@ -3239,7 +3309,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, | |||
3239 | if (!pnode || !NLP_CHK_NODE_ACT(pnode)) | 3309 | if (!pnode || !NLP_CHK_NODE_ACT(pnode)) |
3240 | return FAILED; | 3310 | return FAILED; |
3241 | 3311 | ||
3242 | lpfc_cmd = lpfc_get_scsi_buf(phba); | 3312 | lpfc_cmd = lpfc_get_scsi_buf(phba, rdata->pnode); |
3243 | if (lpfc_cmd == NULL) | 3313 | if (lpfc_cmd == NULL) |
3244 | return FAILED; | 3314 | return FAILED; |
3245 | lpfc_cmd->timeout = 60; | 3315 | lpfc_cmd->timeout = 60; |