summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJustin Tee <justin.tee@broadcom.com>2022-11-16 02:19:17 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2022-11-17 19:18:42 +0100
commitae696255d655bec673e5a5707f37ff6a098e89c2 (patch)
tree972d971bd01511e494851648f0c66e8193b11e3e /drivers/scsi/lpfc
parentscsi: lpfc: Fix WQ|CQ|EQ resource check (diff)
downloadlinux-ae696255d655bec673e5a5707f37ff6a098e89c2.tar.xz
linux-ae696255d655bec673e5a5707f37ff6a098e89c2.zip
scsi: lpfc: Correct bandwidth logging during receipt of congestion sync WCQE
The lpfc_cmf_timer adjusts phba->cmf_link_byte_count periodically and can artifically inflate bandwidth percent. During bandwidth calculation, correct for this by setting a cap of logging a maximum of 100%. Bandwidth calculation is only used for display under LOG_CGN_MGMT so there is no expectation of impacts on performance. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20221116011921.105995-3-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 35c9404d5e49..182aaae60386 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1846,6 +1846,12 @@ lpfc_cmf_sync_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
phba->cmf_link_byte_count);
bwpcent = div64_u64(bw * 100 + slop,
phba->cmf_link_byte_count);
+ /* Because of bytes adjustment due to shorter timer in
+ * lpfc_cmf_timer() the cmf_link_byte_count can be shorter and
+ * may seem like BW is above 100%.
+ */
+ if (bwpcent > 100)
+ bwpcent = 100;
if (phba->cmf_max_bytes_per_interval < bw &&
bwpcent > 95)