[SCSI] lpfc 8.2.6 : Miscellaneous Fixes
authorJames Smart <James.Smart@Emulex.Com>
Mon, 7 Apr 2008 14:16:05 +0000 (10:16 -0400)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Thu, 10 Apr 2008 12:53:12 +0000 (07:53 -0500)
Miscellaneous Fixes
- Allow WRITE_VPARAM command when the virtual port is in a stopped state
- Fixed handling of our queue depth max that was unconditionally raising
  the depth on all vports, rather than just the vport affected.
- Fix race in interrupt handler for mailbox processing that did not take
  out the host lock.
- Removed unused functions: find_node, findnode_rpi, and fabric_abort_flogi
- Correct misspelled word unsolicited in message 0146
- Correct HW-error 5 handling - it should not reset the adapter
- Correct handling of IOCBs, which did not null out our pCmd field before
  invoking the midlayer io done function.
- Changed our maximum supported target id to 4096

Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c

index c66d8d19c5777495fe1a74324f760a5faf6c5c16..ec0b0f6e5e1a950ea9f4436b4888f184471f9af0 100644 (file)
@@ -23,7 +23,7 @@
 
 struct lpfc_sli2_slim;
 
-#define LPFC_MAX_TARGET                256     /* max number of targets supported */
+#define LPFC_MAX_TARGET                4096    /* max number of targets supported */
 #define LPFC_MAX_DISC_THREADS  64      /* max outstanding discovery els
                                           requests */
 #define LPFC_MAX_NS_RETRY      3       /* Number of retry attempts to contact
index 6917800fc1a768fb590ce7feb26b2448c147afb4..74c9fc204211056204e9cb207cb06271642c43fc 100644 (file)
@@ -1954,7 +1954,9 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
                        (phba->sysfs_mbox.mbox->mb.mbxCommand !=
                                MBX_DUMP_MEMORY &&
                         phba->sysfs_mbox.mbox->mb.mbxCommand !=
-                               MBX_RESTART)) {
+                               MBX_RESTART &&
+                        phba->sysfs_mbox.mbox->mb.mbxCommand !=
+                               MBX_WRITE_VPARMS)) {
                        sysfs_mbox_idle(phba);
                        spin_unlock_irq(&phba->hbalock);
                        return -EPERM;
index b64dc711cd8deca1e077c6bd1ffa5b8a485d76ad..153afae567b5876d36f1a6978fa2fb8c03609e57 100644 (file)
@@ -63,7 +63,7 @@ lpfc_ct_ignore_hbq_buffer(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
 {
        if (!mp) {
                lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                               "0146 Ignoring unsolicted CT No HBQ "
+                               "0146 Ignoring unsolicited CT No HBQ "
                                "status = x%x\n",
                                piocbq->iocb.ulpStatus);
        }
index 6e0e991c644563af4249541a3838215c0e8635f9..886c5f1b11d2d7ce9663bdc009424a20a3f07552 100644 (file)
@@ -5097,39 +5097,3 @@ void lpfc_fabric_abort_hba(struct lpfc_hba *phba)
                (piocb->iocb_cmpl) (phba, piocb, piocb);
        }
 }
-
-
-#if 0
-void lpfc_fabric_abort_flogi(struct lpfc_hba *phba)
-{
-       LIST_HEAD(completions);
-       struct lpfc_iocbq *tmp_iocb, *piocb;
-       IOCB_t *cmd;
-       struct lpfc_nodelist *ndlp;
-
-       spin_lock_irq(&phba->hbalock);
-       list_for_each_entry_safe(piocb, tmp_iocb, &phba->fabric_iocb_list,
-                                list) {
-
-               cmd = &piocb->iocb;
-               ndlp = (struct lpfc_nodelist *) piocb->context1;
-               if (cmd->ulpCommand == CMD_ELS_REQUEST64_CR &&
-                   ndlp != NULL &&
-                   ndlp->nlp_DID == Fabric_DID)
-                       list_move_tail(&piocb->list, &completions);
-       }
-       spin_unlock_irq(&phba->hbalock);
-
-       while (!list_empty(&completions)) {
-               piocb = list_get_first(&completions, struct lpfc_iocbq, list);
-               list_del_init(&piocb->list);
-
-               cmd = &piocb->iocb;
-               cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
-               cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
-               (piocb->iocb_cmpl) (phba, piocb, piocb);
-       }
-}
-#endif  /*  0  */
-
-
index 7c8c3e6f399d57a7154bf7325531095caa70cf96..7cb68feb04fd11eb18c9a3e0d487ffe5a3b270a6 100644 (file)
@@ -2948,24 +2948,6 @@ __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param)
        return NULL;
 }
 
-#if 0
-/*
- * Search node lists for a remote port matching filter criteria
- * Caller needs to hold host_lock before calling this routine.
- */
-struct lpfc_nodelist *
-lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param)
-{
-       struct Scsi_Host     *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_nodelist *ndlp;
-
-       spin_lock_irq(shost->host_lock);
-       ndlp = __lpfc_find_node(vport, filter, param);
-       spin_unlock_irq(shost->host_lock);
-       return ndlp;
-}
-#endif  /*  0  */
-
 /*
  * This routine looks up the ndlp lists for the given RPI. If rpi found it
  * returns the node list element pointer else return NULL.
@@ -2976,20 +2958,6 @@ __lpfc_findnode_rpi(struct lpfc_vport *vport, uint16_t rpi)
        return __lpfc_find_node(vport, lpfc_filter_by_rpi, &rpi);
 }
 
-#if 0
-struct lpfc_nodelist *
-lpfc_findnode_rpi(struct lpfc_vport *vport, uint16_t rpi)
-{
-       struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_nodelist *ndlp;
-
-       spin_lock_irq(shost->host_lock);
-       ndlp = __lpfc_findnode_rpi(vport, rpi);
-       spin_unlock_irq(shost->host_lock);
-       return ndlp;
-}
-#endif  /*  0  */
-
 /*
  * This routine looks up the ndlp lists for the given WWPN. If WWPN found it
  * returns the node element list pointer else return NULL.
index dba6770b506b784eddc9d939d7f0e56ee95a982b..fa757b251f8287505a21f271897598ae0141d3ea 100644 (file)
@@ -729,8 +729,7 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
        if (!phba->cfg_enable_hba_reset)
                return;
 
-       if (phba->work_hs & HS_FFER6 ||
-           phba->work_hs & HS_FFER5) {
+       if (phba->work_hs & HS_FFER6) {
                /* Re-establishing Link */
                lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
                                "1301 Re-establishing Link "
index 6df8bc003a88eb73630662f64ffcb9240569d78d..0910a9ab76a506014073c7af98ad61df8a2a6100 100644 (file)
@@ -169,6 +169,9 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
                for(i = 0; i <= phba->max_vpi && vports[i] != NULL; i++) {
                        shost = lpfc_shost_from_vport(vports[i]);
                        shost_for_each_device(sdev, shost) {
+                               if (vports[i]->cfg_lun_queue_depth <=
+                                   sdev->queue_depth)
+                                       continue;
                                if (sdev->ordered_tags)
                                        scsi_adjust_queue_depth(sdev,
                                                        MSG_ORDERED_TAG,
@@ -606,6 +609,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
        result = cmd->result;
        sdev = cmd->device;
        lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
+       spin_lock_irqsave(sdev->host->host_lock, flags);
+       lpfc_cmd->pCmd = NULL;  /* This must be done before scsi_done */
+       spin_unlock_irqrestore(sdev->host->host_lock, flags);
        cmd->scsi_done(cmd);
 
        if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
@@ -614,7 +620,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                 * wake up the thread.
                 */
                spin_lock_irqsave(sdev->host->host_lock, flags);
-               lpfc_cmd->pCmd = NULL;
                if (lpfc_cmd->waitq)
                        wake_up(lpfc_cmd->waitq);
                spin_unlock_irqrestore(sdev->host->host_lock, flags);
@@ -685,7 +690,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
         * wake up the thread.
         */
        spin_lock_irqsave(sdev->host->host_lock, flags);
-       lpfc_cmd->pCmd = NULL;
        if (lpfc_cmd->waitq)
                wake_up(lpfc_cmd->waitq);
        spin_unlock_irqrestore(sdev->host->host_lock, flags);
index 741e94af4793873680463a74d105d37c8859484b..70a0a9eab21106a70cba3bef3589a1ee3261db29 100644 (file)
@@ -3481,26 +3481,21 @@ lpfc_sli_hba_down(struct lpfc_hba *phba)
        phba->pport->work_port_events &= ~WORKER_MBOX_TMO;
        spin_unlock(&phba->pport->work_port_lock);
 
+       /* Return any pending or completed mbox cmds */
+       list_splice_init(&phba->sli.mboxq, &completions);
        if (psli->mbox_active) {
                list_add_tail(&psli->mbox_active->list, &completions);
                psli->mbox_active = NULL;
                psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
        }
-
-       /* Return any pending or completed mbox cmds */
-       list_splice_init(&phba->sli.mboxq, &completions);
        list_splice_init(&phba->sli.mboxq_cmpl, &completions);
-       INIT_LIST_HEAD(&psli->mboxq);
-       INIT_LIST_HEAD(&psli->mboxq_cmpl);
-
        spin_unlock_irqrestore(&phba->hbalock, flags);
 
        while (!list_empty(&completions)) {
                list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list);
                pmb->mb.mbxStatus = MBX_NOT_FINISHED;
-               if (pmb->mbox_cmpl) {
+               if (pmb->mbox_cmpl)
                        pmb->mbox_cmpl(phba,pmb);
-               }
        }
        return 1;
 }
@@ -4201,6 +4196,7 @@ lpfc_intr_handler(int irq, void *dev_id)
                        phba->pport->stopped = 1;
                }
 
+               spin_lock(&phba->hbalock);
                if ((work_ha_copy & HA_MBATT) &&
                    (phba->sli.mbox_active)) {
                        pmb = phba->sli.mbox_active;
@@ -4211,6 +4207,7 @@ lpfc_intr_handler(int irq, void *dev_id)
                        /* First check out the status word */
                        lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof(uint32_t));
                        if (pmbox->mbxOwner != OWN_HOST) {
+                               spin_unlock(&phba->hbalock);
                                /*
                                 * Stray Mailbox Interrupt, mbxCommand <cmd>
                                 * mbxStatus <status>
@@ -4226,10 +4223,10 @@ lpfc_intr_handler(int irq, void *dev_id)
                                /* clear mailbox attention bit */
                                work_ha_copy &= ~HA_MBATT;
                        } else {
+                               phba->sli.mbox_active = NULL;
+                               spin_unlock(&phba->hbalock);
                                phba->last_completion_time = jiffies;
                                del_timer(&phba->sli.mbox_tmo);
-
-                               phba->sli.mbox_active = NULL;
                                if (pmb->mbox_cmpl) {
                                        lpfc_sli_pcimem_bcopy(mbox, pmbox,
                                                        MAILBOX_CMD_SIZE);
@@ -4282,7 +4279,8 @@ lpfc_intr_handler(int irq, void *dev_id)
                                spin_unlock(&phba->pport->work_port_lock);
                                lpfc_mbox_cmpl_put(phba, pmb);
                        }
-               }
+               } else
+                       spin_unlock(&phba->hbalock);
                if ((work_ha_copy & HA_MBATT) &&
                    (phba->sli.mbox_active == NULL)) {
 send_current_mbox: