[SCSI] lpfc 8.1.11 : Misc Fixes
authorJames Smart <James.Smart@Emulex.Com>
Sat, 2 Dec 2006 18:35:43 +0000 (13:35 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 3 Dec 2006 15:35:04 +0000 (09:35 -0600)
Misc Fixes:
 - Prevent references to NULL node list element in reset routines.
 - Add missing IOCB types to switch tables
 - Reset the card on Port Error 5
 - Fix infinite loop in LUN reset

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/lpfc/lpfc_hw.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c

index 3ba1ee4ace9ab230d3d6bb335eb998d2fa93cd37..f79cb61369065007a88ca4dccb6e50c2bb1ec174 100644 (file)
@@ -1294,6 +1294,10 @@ typedef struct {         /* FireFly BIU registers */
 #define CMD_FCP_IREAD_CX        0x1B
 #define CMD_FCP_ICMND_CR        0x1C
 #define CMD_FCP_ICMND_CX        0x1D
+#define CMD_FCP_TSEND_CX        0x1F
+#define CMD_FCP_TRECEIVE_CX     0x21
+#define CMD_FCP_TRSP_CX                0x23
+#define CMD_FCP_AUTO_TRSP_CX    0x29
 
 #define CMD_ADAPTER_MSG         0x20
 #define CMD_ADAPTER_DUMP        0x22
@@ -1320,6 +1324,9 @@ typedef struct {          /* FireFly BIU registers */
 #define CMD_FCP_IREAD64_CX      0x9B
 #define CMD_FCP_ICMND64_CR      0x9C
 #define CMD_FCP_ICMND64_CX      0x9D
+#define CMD_FCP_TSEND64_CX      0x9F
+#define CMD_FCP_TRECEIVE64_CX   0xA1
+#define CMD_FCP_TRSP64_CX       0xA3
 
 #define CMD_GEN_REQUEST64_CR    0xC2
 #define CMD_GEN_REQUEST64_CX    0xC3
index cf9081c262d7a92d6950cf88efd9c6feab896f64..afca45cdbcefa0b29356ec8267697c8c029be4ef 100644 (file)
@@ -519,7 +519,8 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
        struct lpfc_sli_ring  *pring;
        uint32_t event_data;
 
-       if (phba->work_hs & HS_FFER6) {
+       if (phba->work_hs & HS_FFER6 ||
+           phba->work_hs & HS_FFER5) {
                /* Re-establishing Link */
                lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
                                "%d:1301 Re-establishing Link "
index 125179af470c197bba3a4adb1a754cee153b0217..c3e68e0d8f7445e426fa0ee28cc35ab5903c37cc 100644 (file)
@@ -679,6 +679,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba,
        struct lpfc_iocbq *iocbqrsp;
        int ret;
 
+       if (!rdata->pnode)
+               return FAILED;
+
        lpfc_cmd->rdata = rdata;
        ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, lun,
                                           FCP_TARGET_RESET);
@@ -985,20 +988,34 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
 
        lpfc_block_error_handler(cmnd);
        spin_lock_irq(shost->host_lock);
+       loopcnt = 0;
        /*
         * If target is not in a MAPPED state, delay the reset until
         * target is rediscovered or devloss timeout expires.
         */
        while ( 1 ) {
                if (!pnode)
-                       break;
+                       return FAILED;
 
                if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
                        spin_unlock_irq(phba->host->host_lock);
                        schedule_timeout_uninterruptible(msecs_to_jiffies(500));
                        spin_lock_irq(phba->host->host_lock);
+                       loopcnt++;
+                       rdata = cmnd->device->hostdata;
+                       if (!rdata ||
+                               (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) {
+                               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
+                                       "%d:0721 LUN Reset rport failure:"
+                                       " cnt x%x rdata x%p\n",
+                                       phba->brd_no, loopcnt, rdata);
+                               goto out;
+                       }
+                       pnode = rdata->pnode;
+                       if (!pnode)
+                               return FAILED;
                }
-               if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE))
+               if (pnode->nlp_state == NLP_STE_MAPPED_NODE)
                        break;
        }
 
index 120af3db635a0faa65f358f19593add7b6009ab9..a4128e19338af4e74e843cfcc1588c74eadde0fe 100644 (file)
@@ -117,6 +117,10 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
        case CMD_FCP_IREAD_CX:
        case CMD_FCP_ICMND_CR:
        case CMD_FCP_ICMND_CX:
+       case CMD_FCP_TSEND_CX:
+       case CMD_FCP_TRSP_CX:
+       case CMD_FCP_TRECEIVE_CX:
+       case CMD_FCP_AUTO_TRSP_CX:
        case CMD_ADAPTER_MSG:
        case CMD_ADAPTER_DUMP:
        case CMD_XMIT_SEQUENCE64_CR:
@@ -131,6 +135,9 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
        case CMD_FCP_IREAD64_CX:
        case CMD_FCP_ICMND64_CR:
        case CMD_FCP_ICMND64_CX:
+       case CMD_FCP_TSEND64_CX:
+       case CMD_FCP_TRSP64_CX:
+       case CMD_FCP_TRECEIVE64_CX:
        case CMD_GEN_REQUEST64_CR:
        case CMD_GEN_REQUEST64_CX:
        case CMD_XMIT_ELS_RSP64_CX: