Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[pandora-kernel.git] / drivers / scsi / lpfc / lpfc_hbadisc.c
index 6721e67..b2f1552 100644 (file)
@@ -311,8 +311,8 @@ lpfc_workq_post_event(struct lpfc_hba * phba, void *arg1, void *arg2,
        evtp->evt_arg2  = arg2;
        evtp->evt       = evt;
 
-       list_add_tail(&evtp->evt_listp, &phba->work_list);
        spin_lock_irq(phba->host->host_lock);
+       list_add_tail(&evtp->evt_listp, &phba->work_list);
        if (phba->work_wait)
                wake_up(phba->work_wait);
        spin_unlock_irq(phba->host->host_lock);
@@ -1071,10 +1071,6 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
        /* initialize static port data */
        rport->maxframe_size = ndlp->nlp_maxframe;
        rport->supported_classes = ndlp->nlp_class_sup;
-       if ((rport->scsi_target_id != -1) &&
-               (rport->scsi_target_id < MAX_FCP_TARGET)) {
-               ndlp->nlp_sid = rport->scsi_target_id;
-       }
        rdata = rport->dd_data;
        rdata->pnode = ndlp;
 
@@ -1087,6 +1083,10 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
        if (rport_ids.roles !=  FC_RPORT_ROLE_UNKNOWN)
                fc_remote_port_rolechg(rport, rport_ids.roles);
 
+       if ((rport->scsi_target_id != -1) &&
+               (rport->scsi_target_id < LPFC_MAX_TARGET)) {
+               ndlp->nlp_sid = rport->scsi_target_id;
+       }
 
        return;
 }
@@ -1238,6 +1238,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
                                                evt_listp);
 
                }
+               nlp->nlp_flag &= ~NLP_NODEV_REMOVE;
                nlp->nlp_type |= NLP_FC_NODE;
                break;
        case NLP_MAPPED_LIST:
@@ -1258,6 +1259,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
                                                evt_listp);
 
                }
+               nlp->nlp_flag &= ~NLP_NODEV_REMOVE;
                break;
        case NLP_NPR_LIST:
                nlp->nlp_flag |= list;
@@ -1311,7 +1313,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
                        if ((rport_add == mapped) &&
                            ((!nlp->rport) ||
                             (nlp->rport->scsi_target_id == -1) ||
-                            (nlp->rport->scsi_target_id >= MAX_FCP_TARGET))) {
+                            (nlp->rport->scsi_target_id >= LPFC_MAX_TARGET))) {
                                nlp->nlp_state = NLP_STE_UNMAPPED_NODE;
                                spin_lock_irq(phba->host->host_lock);
                                nlp->nlp_flag |= NLP_TGT_NO_SCSIID;
@@ -1402,6 +1404,8 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
                        if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi)
                                return 1;
                case CMD_ELS_REQUEST64_CR:
+                       if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)
+                               return 1;
                case CMD_XMIT_ELS_RSP64_CX:
                        if (iocb->context1 == (uint8_t *) ndlp)
                                return 1;
@@ -1553,6 +1557,8 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
                        mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
                }
        }
+
+       spin_lock_irq(phba->host->host_lock);
        list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) {
                if ((mb->mb.mbxCommand == MBX_REG_LOGIN64) &&
                   (ndlp == (struct lpfc_nodelist *) mb->context2)) {
@@ -1565,6 +1571,7 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
                        mempool_free(mb, phba->mbox_mem_pool);
                }
        }
+       spin_unlock_irq(phba->host->host_lock);
 
        lpfc_els_abort(phba,ndlp,0);
        spin_lock_irq(phba->host->host_lock);
@@ -1778,7 +1785,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
                                /* LOG change to REGLOGIN */
                                /* FIND node DID reglogin */
                                lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                                               "%d:0931 FIND node DID reglogin"
+                                               "%d:0901 FIND node DID reglogin"
                                                " Data: x%p x%x x%x x%x\n",
                                                phba->brd_no,
                                                ndlp, ndlp->nlp_DID,
@@ -1801,7 +1808,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
                                /* LOG change to PRLI */
                                /* FIND node DID prli */
                                lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                                               "%d:0931 FIND node DID prli "
+                                               "%d:0902 FIND node DID prli "
                                                "Data: x%p x%x x%x x%x\n",
                                                phba->brd_no,
                                                ndlp, ndlp->nlp_DID,
@@ -1824,7 +1831,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
                                /* LOG change to NPR */
                                /* FIND node DID npr */
                                lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                                               "%d:0931 FIND node DID npr "
+                                               "%d:0903 FIND node DID npr "
                                                "Data: x%p x%x x%x x%x\n",
                                                phba->brd_no,
                                                ndlp, ndlp->nlp_DID,
@@ -1847,7 +1854,7 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
                                /* LOG change to UNUSED */
                                /* FIND node DID unused */
                                lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                                               "%d:0931 FIND node DID unused "
+                                               "%d:0905 FIND node DID unused "
                                                "Data: x%p x%x x%x x%x\n",
                                                phba->brd_no,
                                                ndlp, ndlp->nlp_DID,
@@ -1901,10 +1908,8 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did)
                         */
                        if (ndlp->nlp_flag & NLP_DELAY_TMO)
                                lpfc_cancel_retry_delay_tmo(phba, ndlp);
-               } else {
-                       ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
+               } else
                        ndlp = NULL;
-               }
        } else {
                flg = ndlp->nlp_flag & NLP_LIST_MASK;
                if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST))
@@ -2333,7 +2338,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
                initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
                if (!initlinkmbox) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                       "%d:0226 Device Discovery "
+                                       "%d:0206 Device Discovery "
                                        "completion error\n",
                                        phba->brd_no);
                        phba->hba_state = LPFC_HBA_ERROR;
@@ -2363,7 +2368,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
                if (!clearlambox) {
                        clrlaerr = 1;
                        lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                       "%d:0226 Device Discovery "
+                                       "%d:0207 Device Discovery "
                                        "completion error\n",
                                        phba->brd_no);
                        phba->hba_state = LPFC_HBA_ERROR;