scsi: lpfc: Cap CMF read bytes to MBPI
Ensure read bytes data does not go over MBPI for CMF timer intervals that are purposely shortened. Link: https://lore.kernel.org/r/20211204002644.116455-8-jsmart2021@gmail.com Co-developed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a6269f8370
commit
05116ef9c4
|
@ -1028,7 +1028,7 @@ struct lpfc_hba {
|
||||||
*/
|
*/
|
||||||
#define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */
|
#define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */
|
||||||
#define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */
|
#define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */
|
||||||
#define HBA_CGN_RSVD1 0x200000 /* Reserved CGN flag */
|
#define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */
|
||||||
#define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */
|
#define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */
|
||||||
#define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */
|
#define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */
|
||||||
#define HBA_SETUP 0x1000000 /* Signifies HBA setup is completed */
|
#define HBA_SETUP 0x1000000 /* Signifies HBA setup is completed */
|
||||||
|
|
|
@ -6004,8 +6004,13 @@ lpfc_cmf_timer(struct hrtimer *timer)
|
||||||
if (ms && ms < LPFC_CMF_INTERVAL) {
|
if (ms && ms < LPFC_CMF_INTERVAL) {
|
||||||
cnt = div_u64(total, ms); /* bytes per ms */
|
cnt = div_u64(total, ms); /* bytes per ms */
|
||||||
cnt *= LPFC_CMF_INTERVAL; /* what total should be */
|
cnt *= LPFC_CMF_INTERVAL; /* what total should be */
|
||||||
if (cnt > mbpi)
|
|
||||||
|
/* If the timeout is scheduled to be shorter,
|
||||||
|
* this value may skew the data, so cap it at mbpi.
|
||||||
|
*/
|
||||||
|
if ((phba->hba_flag & HBA_SHORT_CMF) && cnt > mbpi)
|
||||||
cnt = mbpi;
|
cnt = mbpi;
|
||||||
|
|
||||||
extra = cnt - total;
|
extra = cnt - total;
|
||||||
}
|
}
|
||||||
lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra);
|
lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra);
|
||||||
|
@ -6088,6 +6093,8 @@ lpfc_cmf_timer(struct hrtimer *timer)
|
||||||
/* Each minute save Fabric and Driver congestion information */
|
/* Each minute save Fabric and Driver congestion information */
|
||||||
lpfc_cgn_save_evt_cnt(phba);
|
lpfc_cgn_save_evt_cnt(phba);
|
||||||
|
|
||||||
|
phba->hba_flag &= ~HBA_SHORT_CMF;
|
||||||
|
|
||||||
/* Since we need to call lpfc_cgn_save_evt_cnt every minute, on the
|
/* Since we need to call lpfc_cgn_save_evt_cnt every minute, on the
|
||||||
* minute, adjust our next timer interval, if needed, to ensure a
|
* minute, adjust our next timer interval, if needed, to ensure a
|
||||||
* 1 minute granularity when we get the next timer interrupt.
|
* 1 minute granularity when we get the next timer interrupt.
|
||||||
|
@ -6098,6 +6105,8 @@ lpfc_cmf_timer(struct hrtimer *timer)
|
||||||
jiffies);
|
jiffies);
|
||||||
if (timer_interval <= 0)
|
if (timer_interval <= 0)
|
||||||
timer_interval = LPFC_CMF_INTERVAL;
|
timer_interval = LPFC_CMF_INTERVAL;
|
||||||
|
else
|
||||||
|
phba->hba_flag |= HBA_SHORT_CMF;
|
||||||
|
|
||||||
/* If we adjust timer_interval, max_bytes_per_interval
|
/* If we adjust timer_interval, max_bytes_per_interval
|
||||||
* needs to be adjusted as well.
|
* needs to be adjusted as well.
|
||||||
|
|
Loading…
Reference in New Issue