linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, Justin Tee <justintee8345@gmail.com>,
	Justin Tee <justin.tee@broadcom.com>
Subject: [PATCH 2/6] lpfc: Correct bandwidth logging during receipt of congestion sync WCQE
Date: Tue, 15 Nov 2022 17:19:17 -0800	[thread overview]
Message-ID: <20221116011921.105995-3-justintee8345@gmail.com> (raw)
In-Reply-To: <20221116011921.105995-1-justintee8345@gmail.com>

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>
---
 drivers/scsi/lpfc/lpfc_sli.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index d25afc9dde14..a66026432572 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1848,6 +1848,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)
-- 
2.38.0


  parent reply	other threads:[~2022-11-16  1:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16  1:19 [PATCH 0/6] lpfc: Update lpfc to revision 14.2.0.9 Justin Tee
2022-11-16  1:19 ` [PATCH 1/6] lpfc: Fix WQ|CQ|EQ resource check Justin Tee
2022-11-16  1:19 ` Justin Tee [this message]
2022-11-16  1:19 ` [PATCH 3/6] lpfc: Fix MI capability display in cmf_info sysfs attribute Justin Tee
2022-11-16  1:19 ` [PATCH 4/6] lpfc: Fix crash involving race between FLOGI timeout and devloss handler Justin Tee
2022-11-16  1:19 ` [PATCH 5/6] lpfc: Change default lpfc_suppress_rsp mode to off Justin Tee
2022-11-16  1:19 ` [PATCH 6/6] lpfc: Update lpfc version to 14.2.0.9 Justin Tee
2022-11-17 18:19 ` [PATCH 0/6] lpfc: Update lpfc to revision 14.2.0.9 Martin K. Petersen
2022-11-26  3:27 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221116011921.105995-3-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).