[SCSI] lpfc 8.3.31: Fix initiator sending flogi after acking flogi from target
authorJames Smart <james.smart@emulex.com>
Thu, 10 May 2012 01:16:42 +0000 (21:16 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 17 May 2012 09:32:47 +0000 (10:32 +0100)
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c

index 3407b39e0a3f82bfaf8239864ea1b764b2b386d6..c89c5c239e7efba66a91a116db2faad858053d4b 100644 (file)
@@ -3803,10 +3803,11 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
        /* Xmit ELS ACC response tag <ulpIoTag> */
        lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
                         "0128 Xmit ELS ACC response tag x%x, XRI: x%x, "
-                        "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n",
+                        "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x "
+                        "fc_flag x%x\n",
                         elsiocb->iotag, elsiocb->iocb.ulpContext,
                         ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
-                        ndlp->nlp_rpi);
+                        ndlp->nlp_rpi, vport->fc_flag);
        if (ndlp->nlp_flag & NLP_LOGO_ACC) {
                spin_lock_irq(shost->host_lock);
                ndlp->nlp_flag &= ~NLP_LOGO_ACC;
@@ -4976,7 +4977,10 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                        spin_lock_irq(shost->host_lock);
                        vport->fc_flag |= FC_PT2PT_PLOGI;
                        spin_unlock_irq(shost->host_lock);
-               }
+                       vport->fc_myDID = PT2PT_LocalID;
+               } else
+                       vport->fc_myDID = PT2PT_RemoteID;
+               vport->port_state = LPFC_FLOGI;
                spin_lock_irq(shost->host_lock);
                vport->fc_flag |= FC_PT2PT;
                vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
@@ -4995,7 +4999,25 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        /* Send back ACC */
        lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
 
+       if (!(vport->fc_flag & FC_PT2PT_PLOGI)) {
+               mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+               if (!mbox)
+                       goto fail;
+
+               lpfc_config_link(phba, mbox);
+
+               mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
+               mbox->vport = vport;
+               rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
+               if (rc == MBX_NOT_FINISHED) {
+                       mempool_free(mbox, phba->mbox_mem_pool);
+                       goto fail;
+               }
+       }
+
        return 0;
+fail:
+       return 1;
 }
 
 /**
index b507536dc5b569262f33b04df00cab96f48c4ab5..30991d8109280686898d97a66f8125cc1f708b69 100644 (file)
@@ -1094,7 +1094,7 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        /* Start discovery by sending a FLOGI. port_state is identically
         * LPFC_FLOGI while waiting for FLOGI cmpl
         */
-       if (vport->port_state != LPFC_FLOGI)
+       if (vport->port_state != LPFC_FLOGI || vport->fc_flag & FC_PT2PT_PLOGI)
                lpfc_initial_flogi(vport);
        return;