aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_els.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_els.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c112
1 files changed, 89 insertions, 23 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index c4c7f0ad7468..afbed6bc31f0 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -796,7 +796,9 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
796 * due to new FCF discovery 796 * due to new FCF discovery
797 */ 797 */
798 if ((phba->hba_flag & HBA_FIP_SUPPORT) && 798 if ((phba->hba_flag & HBA_FIP_SUPPORT) &&
799 (phba->fcf.fcf_flag & FCF_DISCOVERY)) { 799 (phba->fcf.fcf_flag & FCF_DISCOVERY) &&
800 (irsp->ulpStatus != IOSTAT_LOCAL_REJECT) &&
801 (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED)) {
800 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS, 802 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS,
801 "2611 FLOGI failed on registered " 803 "2611 FLOGI failed on registered "
802 "FCF record fcf_index:%d, trying " 804 "FCF record fcf_index:%d, trying "
@@ -811,18 +813,21 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
811 */ 813 */
812 lpfc_printf_log(phba, KERN_WARNING, 814 lpfc_printf_log(phba, KERN_WARNING,
813 LOG_FIP | LOG_ELS, 815 LOG_FIP | LOG_ELS,
814 "2760 FLOGI exhausted FCF " 816 "2760 Completed one round "
815 "round robin failover list, " 817 "of FLOGI FCF round robin "
816 "retry FLOGI on the current " 818 "failover list, retry FLOGI "
817 "registered FCF index:%d\n", 819 "on currently registered "
820 "FCF index:%d\n",
818 phba->fcf.current_rec.fcf_indx); 821 phba->fcf.current_rec.fcf_indx);
819 spin_lock_irq(&phba->hbalock);
820 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
821 spin_unlock_irq(&phba->hbalock);
822 } else { 822 } else {
823 lpfc_printf_log(phba, KERN_INFO,
824 LOG_FIP | LOG_ELS,
825 "2794 FLOGI FCF round robin "
826 "failover to FCF index x%x\n",
827 fcf_index);
823 rc = lpfc_sli4_fcf_rr_read_fcf_rec(phba, 828 rc = lpfc_sli4_fcf_rr_read_fcf_rec(phba,
824 fcf_index); 829 fcf_index);
825 if (rc) { 830 if (rc)
826 lpfc_printf_log(phba, KERN_WARNING, 831 lpfc_printf_log(phba, KERN_WARNING,
827 LOG_FIP | LOG_ELS, 832 LOG_FIP | LOG_ELS,
828 "2761 FLOGI round " 833 "2761 FLOGI round "
@@ -831,10 +836,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
831 "rc:x%x, fcf_index:" 836 "rc:x%x, fcf_index:"
832 "%d\n", rc, 837 "%d\n", rc,
833 phba->fcf.current_rec.fcf_indx); 838 phba->fcf.current_rec.fcf_indx);
834 spin_lock_irq(&phba->hbalock); 839 else
835 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
836 spin_unlock_irq(&phba->hbalock);
837 } else
838 goto out; 840 goto out;
839 } 841 }
840 } 842 }
@@ -890,9 +892,39 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
890 */ 892 */
891 if (sp->cmn.fPort) 893 if (sp->cmn.fPort)
892 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp); 894 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp);
893 else 895 else if (!(phba->hba_flag & HBA_FCOE_SUPPORT))
894 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); 896 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp);
895 897 else {
898 lpfc_printf_vlog(vport, KERN_ERR,
899 LOG_FIP | LOG_ELS,
900 "2831 FLOGI response with cleared Fabric "
901 "bit fcf_index 0x%x "
902 "Switch Name %02x%02x%02x%02x%02x%02x%02x%02x "
903 "Fabric Name "
904 "%02x%02x%02x%02x%02x%02x%02x%02x\n",
905 phba->fcf.current_rec.fcf_indx,
906 phba->fcf.current_rec.switch_name[0],
907 phba->fcf.current_rec.switch_name[1],
908 phba->fcf.current_rec.switch_name[2],
909 phba->fcf.current_rec.switch_name[3],
910 phba->fcf.current_rec.switch_name[4],
911 phba->fcf.current_rec.switch_name[5],
912 phba->fcf.current_rec.switch_name[6],
913 phba->fcf.current_rec.switch_name[7],
914 phba->fcf.current_rec.fabric_name[0],
915 phba->fcf.current_rec.fabric_name[1],
916 phba->fcf.current_rec.fabric_name[2],
917 phba->fcf.current_rec.fabric_name[3],
918 phba->fcf.current_rec.fabric_name[4],
919 phba->fcf.current_rec.fabric_name[5],
920 phba->fcf.current_rec.fabric_name[6],
921 phba->fcf.current_rec.fabric_name[7]);
922 lpfc_nlp_put(ndlp);
923 spin_lock_irq(&phba->hbalock);
924 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
925 spin_unlock_irq(&phba->hbalock);
926 goto out;
927 }
896 if (!rc) { 928 if (!rc) {
897 /* Mark the FCF discovery process done */ 929 /* Mark the FCF discovery process done */
898 if (phba->hba_flag & HBA_FIP_SUPPORT) 930 if (phba->hba_flag & HBA_FIP_SUPPORT)
@@ -1472,8 +1504,12 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1472 } 1504 }
1473 goto out; 1505 goto out;
1474 } 1506 }
1475 /* PLOGI failed */ 1507 /* PLOGI failed Don't print the vport to vport rjts */
1476 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 1508 if (irsp->ulpStatus != IOSTAT_LS_RJT ||
1509 (((irsp->un.ulpWord[4]) >> 16 != LSRJT_INVALID_CMD) &&
1510 ((irsp->un.ulpWord[4]) >> 16 != LSRJT_UNABLE_TPC)) ||
1511 (phba)->pport->cfg_log_verbose & LOG_ELS)
1512 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
1477 "2753 PLOGI failure DID:%06X Status:x%x/x%x\n", 1513 "2753 PLOGI failure DID:%06X Status:x%x/x%x\n",
1478 ndlp->nlp_DID, irsp->ulpStatus, 1514 ndlp->nlp_DID, irsp->ulpStatus,
1479 irsp->un.ulpWord[4]); 1515 irsp->un.ulpWord[4]);
@@ -2740,6 +2776,15 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2740 retry = 1; 2776 retry = 1;
2741 break; 2777 break;
2742 } 2778 }
2779 if (stat.un.b.lsRjtRsnCodeExp ==
2780 LSEXP_CANT_GIVE_DATA) {
2781 if (cmd == ELS_CMD_PLOGI) {
2782 delay = 1000;
2783 maxretry = 48;
2784 }
2785 retry = 1;
2786 break;
2787 }
2743 if (cmd == ELS_CMD_PLOGI) { 2788 if (cmd == ELS_CMD_PLOGI) {
2744 delay = 1000; 2789 delay = 1000;
2745 maxretry = lpfc_max_els_tries + 1; 2790 maxretry = lpfc_max_els_tries + 1;
@@ -5135,6 +5180,7 @@ lpfc_els_timeout(unsigned long ptr)
5135 return; 5180 return;
5136} 5181}
5137 5182
5183
5138/** 5184/**
5139 * lpfc_els_timeout_handler - Process an els timeout event 5185 * lpfc_els_timeout_handler - Process an els timeout event
5140 * @vport: pointer to a virtual N_Port data structure. 5186 * @vport: pointer to a virtual N_Port data structure.
@@ -5155,13 +5201,19 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
5155 uint32_t els_command = 0; 5201 uint32_t els_command = 0;
5156 uint32_t timeout; 5202 uint32_t timeout;
5157 uint32_t remote_ID = 0xffffffff; 5203 uint32_t remote_ID = 0xffffffff;
5204 LIST_HEAD(txcmplq_completions);
5205 LIST_HEAD(abort_list);
5206
5158 5207
5159 spin_lock_irq(&phba->hbalock);
5160 timeout = (uint32_t)(phba->fc_ratov << 1); 5208 timeout = (uint32_t)(phba->fc_ratov << 1);
5161 5209
5162 pring = &phba->sli.ring[LPFC_ELS_RING]; 5210 pring = &phba->sli.ring[LPFC_ELS_RING];
5163 5211
5164 list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { 5212 spin_lock_irq(&phba->hbalock);
5213 list_splice_init(&pring->txcmplq, &txcmplq_completions);
5214 spin_unlock_irq(&phba->hbalock);
5215
5216 list_for_each_entry_safe(piocb, tmp_iocb, &txcmplq_completions, list) {
5165 cmd = &piocb->iocb; 5217 cmd = &piocb->iocb;
5166 5218
5167 if ((piocb->iocb_flag & LPFC_IO_LIBDFC) != 0 || 5219 if ((piocb->iocb_flag & LPFC_IO_LIBDFC) != 0 ||
@@ -5198,13 +5250,22 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
5198 if (ndlp && NLP_CHK_NODE_ACT(ndlp)) 5250 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
5199 remote_ID = ndlp->nlp_DID; 5251 remote_ID = ndlp->nlp_DID;
5200 } 5252 }
5253 list_add_tail(&piocb->dlist, &abort_list);
5254 }
5255 spin_lock_irq(&phba->hbalock);
5256 list_splice(&txcmplq_completions, &pring->txcmplq);
5257 spin_unlock_irq(&phba->hbalock);
5258
5259 list_for_each_entry_safe(piocb, tmp_iocb, &abort_list, dlist) {
5201 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 5260 lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
5202 "0127 ELS timeout Data: x%x x%x x%x " 5261 "0127 ELS timeout Data: x%x x%x x%x "
5203 "x%x\n", els_command, 5262 "x%x\n", els_command,
5204 remote_ID, cmd->ulpCommand, cmd->ulpIoTag); 5263 remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
5264 spin_lock_irq(&phba->hbalock);
5265 list_del_init(&piocb->dlist);
5205 lpfc_sli_issue_abort_iotag(phba, pring, piocb); 5266 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
5267 spin_unlock_irq(&phba->hbalock);
5206 } 5268 }
5207 spin_unlock_irq(&phba->hbalock);
5208 5269
5209 if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) 5270 if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt)
5210 mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout); 5271 mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout);
@@ -6901,6 +6962,7 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hba *phba,
6901 uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri); 6962 uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri);
6902 struct lpfc_sglq *sglq_entry = NULL, *sglq_next = NULL; 6963 struct lpfc_sglq *sglq_entry = NULL, *sglq_next = NULL;
6903 unsigned long iflag = 0; 6964 unsigned long iflag = 0;
6965 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
6904 6966
6905 spin_lock_irqsave(&phba->hbalock, iflag); 6967 spin_lock_irqsave(&phba->hbalock, iflag);
6906 spin_lock(&phba->sli4_hba.abts_sgl_list_lock); 6968 spin_lock(&phba->sli4_hba.abts_sgl_list_lock);
@@ -6913,6 +6975,10 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hba *phba,
6913 sglq_entry->state = SGL_FREED; 6975 sglq_entry->state = SGL_FREED;
6914 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock); 6976 spin_unlock(&phba->sli4_hba.abts_sgl_list_lock);
6915 spin_unlock_irqrestore(&phba->hbalock, iflag); 6977 spin_unlock_irqrestore(&phba->hbalock, iflag);
6978
6979 /* Check if TXQ queue needs to be serviced */
6980 if (pring->txq_cnt)
6981 lpfc_worker_wake_up(phba);
6916 return; 6982 return;
6917 } 6983 }
6918 } 6984 }