case RPORT_EV_READY:
                ids = rdata->ids;
                rdata->event = RPORT_EV_NONE;
+               rdata->major_retries = 0;
                kref_get(&rdata->kref);
                mutex_unlock(&rdata->rp_mutex);
 
                        if (port_id == FC_FID_DIR_SERV) {
                                rdata->event = RPORT_EV_NONE;
                                mutex_unlock(&rdata->rp_mutex);
-                       } else if (rdata->flags & FC_RP_STARTED) {
+                       } else if ((rdata->flags & FC_RP_STARTED) &&
+                                  rdata->major_retries <
+                                  lport->max_rport_retry_count) {
+                               rdata->major_retries++;
                                rdata->event = RPORT_EV_NONE;
                                FC_RPORT_DBG(rdata, "work restart\n");
                                fc_rport_enter_plogi(rdata);
 
  * @disc_id:        The discovery identifier
  * @maxframe_size:  The maximum frame size
  * @retries:        The retry count for the current state
+ * @major_retries:  The retry count for the entire PLOGI/PRLI state machine
  * @e_d_tov:        Error detect timeout value (in msec)
  * @r_a_tov:        Resource allocation timeout value (in msec)
  * @rp_mutex:       The mutex that protects the remote port
        u16                         disc_id;
        u16                         maxframe_size;
        unsigned int                retries;
+       unsigned int                major_retries;
        unsigned int                e_d_tov;
        unsigned int                r_a_tov;
        struct mutex                rp_mutex;