Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lpfc: Add logging for misconfigured optics.

Add logging for misconfigured optics acqe reported by fw.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
448193b5 4360ca9c

+87 -32
+39 -12
drivers/scsi/lpfc/lpfc_hw4.h
··· 3448 3448 struct lpfc_acqe_misconfigured_event { 3449 3449 struct { 3450 3450 uint32_t word0; 3451 - #define lpfc_sli_misconfigured_port0_SHIFT 0 3452 - #define lpfc_sli_misconfigured_port0_MASK 0x000000FF 3453 - #define lpfc_sli_misconfigured_port0_WORD word0 3454 - #define lpfc_sli_misconfigured_port1_SHIFT 8 3455 - #define lpfc_sli_misconfigured_port1_MASK 0x000000FF 3456 - #define lpfc_sli_misconfigured_port1_WORD word0 3457 - #define lpfc_sli_misconfigured_port2_SHIFT 16 3458 - #define lpfc_sli_misconfigured_port2_MASK 0x000000FF 3459 - #define lpfc_sli_misconfigured_port2_WORD word0 3460 - #define lpfc_sli_misconfigured_port3_SHIFT 24 3461 - #define lpfc_sli_misconfigured_port3_MASK 0x000000FF 3462 - #define lpfc_sli_misconfigured_port3_WORD word0 3451 + #define lpfc_sli_misconfigured_port0_state_SHIFT 0 3452 + #define lpfc_sli_misconfigured_port0_state_MASK 0x000000FF 3453 + #define lpfc_sli_misconfigured_port0_state_WORD word0 3454 + #define lpfc_sli_misconfigured_port1_state_SHIFT 8 3455 + #define lpfc_sli_misconfigured_port1_state_MASK 0x000000FF 3456 + #define lpfc_sli_misconfigured_port1_state_WORD word0 3457 + #define lpfc_sli_misconfigured_port2_state_SHIFT 16 3458 + #define lpfc_sli_misconfigured_port2_state_MASK 0x000000FF 3459 + #define lpfc_sli_misconfigured_port2_state_WORD word0 3460 + #define lpfc_sli_misconfigured_port3_state_SHIFT 24 3461 + #define lpfc_sli_misconfigured_port3_state_MASK 0x000000FF 3462 + #define lpfc_sli_misconfigured_port3_state_WORD word0 3463 + uint32_t word1; 3464 + #define lpfc_sli_misconfigured_port0_op_SHIFT 0 3465 + #define lpfc_sli_misconfigured_port0_op_MASK 0x00000001 3466 + #define lpfc_sli_misconfigured_port0_op_WORD word1 3467 + #define lpfc_sli_misconfigured_port0_severity_SHIFT 1 3468 + #define lpfc_sli_misconfigured_port0_severity_MASK 0x00000003 3469 + #define lpfc_sli_misconfigured_port0_severity_WORD word1 3470 + #define lpfc_sli_misconfigured_port1_op_SHIFT 8 3471 + #define lpfc_sli_misconfigured_port1_op_MASK 0x00000001 3472 + #define lpfc_sli_misconfigured_port1_op_WORD word1 3473 + #define lpfc_sli_misconfigured_port1_severity_SHIFT 9 3474 + #define lpfc_sli_misconfigured_port1_severity_MASK 0x00000003 3475 + #define lpfc_sli_misconfigured_port1_severity_WORD word1 3476 + #define lpfc_sli_misconfigured_port2_op_SHIFT 16 3477 + #define lpfc_sli_misconfigured_port2_op_MASK 0x00000001 3478 + #define lpfc_sli_misconfigured_port2_op_WORD word1 3479 + #define lpfc_sli_misconfigured_port2_severity_SHIFT 17 3480 + #define lpfc_sli_misconfigured_port2_severity_MASK 0x00000003 3481 + #define lpfc_sli_misconfigured_port2_severity_WORD word1 3482 + #define lpfc_sli_misconfigured_port3_op_SHIFT 24 3483 + #define lpfc_sli_misconfigured_port3_op_MASK 0x00000001 3484 + #define lpfc_sli_misconfigured_port3_op_WORD word1 3485 + #define lpfc_sli_misconfigured_port3_severity_SHIFT 25 3486 + #define lpfc_sli_misconfigured_port3_severity_MASK 0x00000003 3487 + #define lpfc_sli_misconfigured_port3_severity_WORD word1 3463 3488 } theEvent; 3464 3489 #define LPFC_SLI_EVENT_STATUS_VALID 0x00 3465 3490 #define LPFC_SLI_EVENT_STATUS_NOT_PRESENT 0x01 3466 3491 #define LPFC_SLI_EVENT_STATUS_WRONG_TYPE 0x02 3467 3492 #define LPFC_SLI_EVENT_STATUS_UNSUPPORTED 0x03 3493 + #define LPFC_SLI_EVENT_STATUS_UNQUALIFIED 0x04 3494 + #define LPFC_SLI_EVENT_STATUS_UNCERTIFIED 0x05 3468 3495 }; 3469 3496 3470 3497 struct lpfc_acqe_sli {
+47 -20
drivers/scsi/lpfc/lpfc_init.c
··· 4079 4079 char message[128]; 4080 4080 uint8_t status; 4081 4081 uint8_t evt_type; 4082 + uint8_t operational = 0; 4082 4083 struct temp_event temp_event_data; 4083 4084 struct lpfc_acqe_misconfigured_event *misconfigured; 4084 4085 struct Scsi_Host *shost; 4085 4086 4086 4087 evt_type = bf_get(lpfc_trailer_type, acqe_sli); 4087 4088 4088 - /* Special case Lancer */ 4089 - if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != 4090 - LPFC_SLI_INTF_IF_TYPE_2) { 4091 - lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 4092 - "2901 Async SLI event - Event Data1:x%08x Event Data2:" 4093 - "x%08x SLI Event Type:%d\n", 4094 - acqe_sli->event_data1, acqe_sli->event_data2, 4095 - evt_type); 4096 - return; 4097 - } 4089 + lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 4090 + "2901 Async SLI event - Event Data1:x%08x Event Data2:" 4091 + "x%08x SLI Event Type:%d\n", 4092 + acqe_sli->event_data1, acqe_sli->event_data2, 4093 + evt_type); 4098 4094 4099 4095 port_name = phba->Port[0]; 4100 4096 if (port_name == 0x00) ··· 4136 4140 /* fetch the status for this port */ 4137 4141 switch (phba->sli4_hba.lnk_info.lnk_no) { 4138 4142 case LPFC_LINK_NUMBER_0: 4139 - status = bf_get(lpfc_sli_misconfigured_port0, 4143 + status = bf_get(lpfc_sli_misconfigured_port0_state, 4144 + &misconfigured->theEvent); 4145 + operational = bf_get(lpfc_sli_misconfigured_port0_op, 4140 4146 &misconfigured->theEvent); 4141 4147 break; 4142 4148 case LPFC_LINK_NUMBER_1: 4143 - status = bf_get(lpfc_sli_misconfigured_port1, 4149 + status = bf_get(lpfc_sli_misconfigured_port1_state, 4150 + &misconfigured->theEvent); 4151 + operational = bf_get(lpfc_sli_misconfigured_port1_op, 4144 4152 &misconfigured->theEvent); 4145 4153 break; 4146 4154 case LPFC_LINK_NUMBER_2: 4147 - status = bf_get(lpfc_sli_misconfigured_port2, 4155 + status = bf_get(lpfc_sli_misconfigured_port2_state, 4156 + &misconfigured->theEvent); 4157 + operational = bf_get(lpfc_sli_misconfigured_port2_op, 4148 4158 &misconfigured->theEvent); 4149 4159 break; 4150 4160 case LPFC_LINK_NUMBER_3: 4151 - status = bf_get(lpfc_sli_misconfigured_port3, 4161 + status = bf_get(lpfc_sli_misconfigured_port3_state, 4162 + &misconfigured->theEvent); 4163 + operational = bf_get(lpfc_sli_misconfigured_port3_op, 4152 4164 &misconfigured->theEvent); 4153 4165 break; 4154 4166 default: 4155 - status = ~LPFC_SLI_EVENT_STATUS_VALID; 4156 - break; 4167 + lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 4168 + "3296 " 4169 + "LPFC_SLI_EVENT_TYPE_MISCONFIGURED " 4170 + "event: Invalid link %d", 4171 + phba->sli4_hba.lnk_info.lnk_no); 4172 + return; 4157 4173 } 4174 + 4175 + /* Skip if optic state unchanged */ 4176 + if (phba->sli4_hba.lnk_info.optic_state == status) 4177 + return; 4158 4178 4159 4179 switch (status) { 4160 4180 case LPFC_SLI_EVENT_STATUS_VALID: 4161 - return; /* no message if the sfp is okay */ 4181 + sprintf(message, "Physical Link is functional"); 4182 + break; 4162 4183 case LPFC_SLI_EVENT_STATUS_NOT_PRESENT: 4163 4184 sprintf(message, "Optics faulted/incorrectly " 4164 4185 "installed/not installed - Reseat optics, " ··· 4190 4177 sprintf(message, "Incompatible optics - Replace with " 4191 4178 "compatible optics for card to function."); 4192 4179 break; 4180 + case LPFC_SLI_EVENT_STATUS_UNQUALIFIED: 4181 + sprintf(message, "Unqualified optics - Replace with " 4182 + "Avago optics for Warranty and Technical " 4183 + "Support - Link is%s operational", 4184 + (operational) ? "" : " not"); 4185 + break; 4186 + case LPFC_SLI_EVENT_STATUS_UNCERTIFIED: 4187 + sprintf(message, "Uncertified optics - Replace with " 4188 + "Avago-certified optics to enable link " 4189 + "operation - Link is%s operational", 4190 + (operational) ? "" : " not"); 4191 + break; 4193 4192 default: 4194 4193 /* firmware is reporting a status we don't know about */ 4195 4194 sprintf(message, "Unknown event status x%02x", status); 4196 4195 break; 4197 4196 } 4198 - 4197 + phba->sli4_hba.lnk_info.optic_state = status; 4199 4198 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 4200 - "3176 Misconfigured Physical Port - " 4201 - "Port Name %c %s\n", port_name, message); 4199 + "3176 Port Name %c %s\n", port_name, message); 4202 4200 break; 4203 4201 case LPFC_SLI_EVENT_TYPE_REMOTE_DPORT: 4204 4202 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, ··· 5282 5258 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_xri_blk_list); 5283 5259 INIT_LIST_HEAD(&phba->sli4_hba.lpfc_vfi_blk_list); 5284 5260 INIT_LIST_HEAD(&phba->lpfc_vpi_blk_list); 5261 + 5262 + /* initialize optic_state to 0xFF */ 5263 + phba->sli4_hba.lnk_info.optic_state = 0xff; 5285 5264 5286 5265 /* Initialize the driver internal SLI layer lists. */ 5287 5266 lpfc_sli_setup(phba);
+1
drivers/scsi/lpfc/lpfc_sli4.h
··· 442 442 #define LPFC_LNK_GE 0x0 /* FCoE */ 443 443 #define LPFC_LNK_FC 0x1 /* FC */ 444 444 uint8_t lnk_no; 445 + uint8_t optic_state; 445 446 }; 446 447 447 448 #define LPFC_SLI4_HANDLER_CNT (LPFC_FCP_IO_CHAN_MAX+ \