scsi: lpfc: fcoe: Fix link down issue after 1000+ link bounces
authorJames Smart <jsmart2021@gmail.com>
Tue, 23 Oct 2018 20:41:06 +0000 (13:41 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 7 Nov 2018 01:42:51 +0000 (20:42 -0500)
On FCoE adapters, when running link bounce test in a loop, initiator
failed to login with switch switch and required driver reload to
recover. Switch reached a point where all subsequent FLOGIs would be
LS_RJT'd. Further testing showed the condition to be related to not
performing FCF discovery between FLOGI's.

Fix by monitoring FLOGI failures and once a repeated error is seen
repeat FCF discovery.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli4.h

index e3e851931394493f0d2b897178c4cd4bba1fc7d1..25625c03a5b399fff089ba53f1111ec25281bf04 100644 (file)
@@ -1157,6 +1157,7 @@ stop_rr_fcf_flogi:
                        phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
                        phba->hba_flag &= ~(FCF_RR_INPROG | HBA_DEVLOSS_TMO);
                        spin_unlock_irq(&phba->hbalock);
+                       phba->fcf.fcf_redisc_attempted = 0; /* reset */
                        goto out;
                }
                if (!rc) {
@@ -1171,6 +1172,7 @@ stop_rr_fcf_flogi:
                        phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
                        phba->hba_flag &= ~(FCF_RR_INPROG | HBA_DEVLOSS_TMO);
                        spin_unlock_irq(&phba->hbalock);
+                       phba->fcf.fcf_redisc_attempted = 0; /* reset */
                        goto out;
                }
        }
index f4deb862efc6dd0ab7ba802cb70058bdc827a314..a26db7e1d82111c219f1b1227acef33e65838d7c 100644 (file)
@@ -1992,6 +1992,26 @@ int lpfc_sli4_fcf_rr_next_proc(struct lpfc_vport *vport, uint16_t fcf_index)
                                "failover and change port state:x%x/x%x\n",
                                phba->pport->port_state, LPFC_VPORT_UNKNOWN);
                phba->pport->port_state = LPFC_VPORT_UNKNOWN;
+
+               if (!phba->fcf.fcf_redisc_attempted) {
+                       lpfc_unregister_fcf(phba);
+
+                       rc = lpfc_sli4_redisc_fcf_table(phba);
+                       if (!rc) {
+                               lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
+                                               "3195 Rediscover FCF table\n");
+                               phba->fcf.fcf_redisc_attempted = 1;
+                               lpfc_sli4_clear_fcf_rr_bmask(phba);
+                       } else {
+                               lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
+                                               "3196 Rediscover FCF table "
+                                               "failed. Status:x%x\n", rc);
+                       }
+               } else {
+                       lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
+                                       "3197 Already rediscover FCF table "
+                                       "attempted. No more retry\n");
+               }
                goto stop_flogi_current_fcf;
        } else {
                lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_ELS,
index 7f63d32c3589fa7b3c6b813b4e14ef6f5d5376fd..4ddf0a9ca188dbd1263ac4f3332eff8fb171815e 100644 (file)
@@ -5069,7 +5069,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
                        break;
                }
                /* If fast FCF failover rescan event is pending, do nothing */
-               if (phba->fcf.fcf_flag & FCF_REDISC_EVT) {
+               if (phba->fcf.fcf_flag & (FCF_REDISC_EVT | FCF_REDISC_PEND)) {
                        spin_unlock_irq(&phba->hbalock);
                        break;
                }
index 783a1540cfbea6e918fb08ee71a13642e03164f8..ee56ab63c657c9299480816e289328f58bf86e7f 100644 (file)
@@ -18712,15 +18712,8 @@ next_priority:
                        goto initial_priority;
                lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
                                "2844 No roundrobin failover FCF available\n");
-               if (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX)
-                       return LPFC_FCOE_FCF_NEXT_NONE;
-               else {
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
-                               "3063 Only FCF available idx %d, flag %x\n",
-                               next_fcf_index,
-                       phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag);
-                       return next_fcf_index;
-               }
+
+               return LPFC_FCOE_FCF_NEXT_NONE;
        }
 
        if (next_fcf_index < LPFC_SLI4_FCF_TBL_INDX_MAX &&
index e76c380e1a84f82b3313a2a2ad8583c089a9b32a..8144e207cbf66f49b0bec53ad02692bd6f034c13 100644 (file)
@@ -279,6 +279,7 @@ struct lpfc_fcf {
 #define FCF_REDISC_EVT 0x100 /* FCF rediscovery event to worker thread */
 #define FCF_REDISC_FOV 0x200 /* Post FCF rediscovery fast failover */
 #define FCF_REDISC_PROG (FCF_REDISC_PEND | FCF_REDISC_EVT)
+       uint16_t fcf_redisc_attempted;
        uint32_t addr_mode;
        uint32_t eligible_fcf_cnt;
        struct lpfc_fcf_rec current_rec;