OSDN Git Service

scsi: lpfc: Handle new link fault code returned by adapter firmware.
authorJames Smart <jsmart2021@gmail.com>
Sat, 5 May 2018 03:37:53 +0000 (20:37 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 May 2018 05:03:16 +0000 (01:03 -0400)
The driver encounters a link event ACQE with a fault code it doesn't
recognize, it logs an "Invalid" fault type and futher treats the unknown
value as a mailbox command failure.  First off, there is no "invalid"
value, only values that are unknown. Secondly, the fault code doesn't
indicate status - the rest of the ACQE contains that status so there is
no reason to "fail the commands".

Change the "Invalid" to "Unknown". There is no "invalid" code value.

Separate fault code parsing and message genaration from any mbx handling
status.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_hw4.h
drivers/scsi/lpfc/lpfc_init.c

index 571099f..eed8dea 100644 (file)
@@ -3924,6 +3924,7 @@ struct lpfc_acqe_link {
 #define LPFC_ASYNC_LINK_FAULT_NONE     0x0
 #define LPFC_ASYNC_LINK_FAULT_LOCAL    0x1
 #define LPFC_ASYNC_LINK_FAULT_REMOTE   0x2
+#define LPFC_ASYNC_LINK_FAULT_LR_LRR   0x3
 #define lpfc_acqe_logical_link_speed_SHIFT     16
 #define lpfc_acqe_logical_link_speed_MASK      0x0000FFFF
 #define lpfc_acqe_logical_link_speed_WORD      word1
index 70583e1..0ba49e6 100644 (file)
@@ -4279,32 +4279,24 @@ lpfc_sli4_fcf_redisc_wait_tmo(struct timer_list *t)
  * @phba: pointer to lpfc hba data structure.
  * @acqe_link: pointer to the async link completion queue entry.
  *
- * This routine is to parse the SLI4 link-attention link fault code and
- * translate it into the base driver's read link attention mailbox command
- * status.
- *
- * Return: Link-attention status in terms of base driver's coding.
+ * This routine is to parse the SLI4 link-attention link fault code.
  **/
-static uint16_t
+static void
 lpfc_sli4_parse_latt_fault(struct lpfc_hba *phba,
                           struct lpfc_acqe_link *acqe_link)
 {
-       uint16_t latt_fault;
-
        switch (bf_get(lpfc_acqe_link_fault, acqe_link)) {
        case LPFC_ASYNC_LINK_FAULT_NONE:
        case LPFC_ASYNC_LINK_FAULT_LOCAL:
        case LPFC_ASYNC_LINK_FAULT_REMOTE:
-               latt_fault = 0;
+       case LPFC_ASYNC_LINK_FAULT_LR_LRR:
                break;
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "0398 Invalid link fault code: x%x\n",
+                               "0398 Unknown link fault code: x%x\n",
                                bf_get(lpfc_acqe_link_fault, acqe_link));
-               latt_fault = MBXERR_ERROR;
                break;
        }
-       return latt_fault;
 }
 
 /**
@@ -4579,9 +4571,12 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
         * the READ_TOPOLOGY completion routine to continue without actually
         * sending the READ_TOPOLOGY mailbox command to the port.
         */
-       /* Parse and translate status field */
+       /* Initialize completion status */
        mb = &pmb->u.mb;
-       mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link);
+       mb->mbxStatus = MBX_SUCCESS;
+
+       /* Parse port fault information field */
+       lpfc_sli4_parse_latt_fault(phba, acqe_link);
 
        /* Parse and translate link attention fields */
        la = (struct lpfc_mbx_read_top *) &pmb->u.mb.un.varReadTop;
@@ -4709,10 +4704,12 @@ lpfc_sli4_async_fc_evt(struct lpfc_hba *phba, struct lpfc_acqe_fc_la *acqe_fc)
                        break;
                }
 
-               /* Parse and translate status field */
+               /* Initialize completion status */
                mb = &pmb->u.mb;
-               mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba,
-                                                          (void *)acqe_fc);
+               mb->mbxStatus = MBX_SUCCESS;
+
+               /* Parse port fault information field */
+               lpfc_sli4_parse_latt_fault(phba, (void *)acqe_fc);
 
                /* Parse and translate link attention fields */
                la = (struct lpfc_mbx_read_top *)&pmb->u.mb.un.varReadTop;