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

scsi: lpfc: Fix incorrect logical link speed on trunks when links down

Invalid logical speed is displayed for trunk enabled ports when all ports
are down. Also noted that link speed is incorrectly reported for the units
when links are up.

Current code is returning the logical link speed from the last event from
the adapter. In cases where the last link went down, the link speed in the
event was not valid - meaning that although the links where down the field
had a bogus value.

Rework the event handling to qualify the trunk link state before using the
event speed data.

Also correct units on other areas where the logical link speed was taken
from a link event.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

James Smart and committed by
Martin K. Petersen
b8e6f136 04d210c9

+9 -3
+1 -1
drivers/scsi/lpfc/lpfc_bsg.c
··· 5741 5741 5742 5742 event_reply->port_speed = phba->sli4_hba.link_state.speed / 1000; 5743 5743 event_reply->logical_speed = 5744 - phba->sli4_hba.link_state.logical_speed / 100; 5744 + phba->sli4_hba.link_state.logical_speed / 1000; 5745 5745 job_error: 5746 5746 bsg_reply->result = rc; 5747 5747 bsg_job_done(job, bsg_reply->result,
+8 -2
drivers/scsi/lpfc/lpfc_init.c
··· 5055 5055 bf_get(lpfc_acqe_fc_la_speed, acqe_fc)); 5056 5056 5057 5057 phba->sli4_hba.link_state.logical_speed = 5058 - bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc); 5058 + bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; 5059 5059 /* We got FC link speed, convert to fc_linkspeed (READ_TOPOLOGY) */ 5060 5060 phba->fc_linkspeed = 5061 5061 lpfc_async_link_speed_to_read_top( ··· 5158 5158 bf_get(lpfc_acqe_fc_la_port_number, acqe_fc); 5159 5159 phba->sli4_hba.link_state.fault = 5160 5160 bf_get(lpfc_acqe_link_fault, acqe_fc); 5161 - phba->sli4_hba.link_state.logical_speed = 5161 + 5162 + if (bf_get(lpfc_acqe_fc_la_att_type, acqe_fc) == 5163 + LPFC_FC_LA_TYPE_LINK_DOWN) 5164 + phba->sli4_hba.link_state.logical_speed = 0; 5165 + else if (!phba->sli4_hba.conf_trunk) 5166 + phba->sli4_hba.link_state.logical_speed = 5162 5167 bf_get(lpfc_acqe_fc_la_llink_spd, acqe_fc) * 10; 5168 + 5163 5169 lpfc_printf_log(phba, KERN_INFO, LOG_SLI, 5164 5170 "2896 Async FC event - Speed:%dGBaud Topology:x%x " 5165 5171 "LA Type:x%x Port Type:%d Port Number:%d Logical speed:"