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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

James Smart and committed by
Martin K. Petersen
05116ef9 a6269f83

+11 -2
+1 -1
drivers/scsi/lpfc/lpfc.h
··· 1028 1028 */ 1029 1029 #define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */ 1030 1030 #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ 1031 - #define HBA_CGN_RSVD1 0x200000 /* Reserved CGN flag */ 1031 + #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ 1032 1032 #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ 1033 1033 #define HBA_DEFER_FLOGI 0x800000 /* Defer FLOGI till read_sparm cmpl */ 1034 1034 #define HBA_SETUP 0x1000000 /* Signifies HBA setup is completed */
+10 -1
drivers/scsi/lpfc/lpfc_init.c
··· 6004 6004 if (ms && ms < LPFC_CMF_INTERVAL) { 6005 6005 cnt = div_u64(total, ms); /* bytes per ms */ 6006 6006 cnt *= LPFC_CMF_INTERVAL; /* what total should be */ 6007 - if (cnt > mbpi) 6007 + 6008 + /* If the timeout is scheduled to be shorter, 6009 + * this value may skew the data, so cap it at mbpi. 6010 + */ 6011 + if ((phba->hba_flag & HBA_SHORT_CMF) && cnt > mbpi) 6008 6012 cnt = mbpi; 6013 + 6009 6014 extra = cnt - total; 6010 6015 } 6011 6016 lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); ··· 6093 6088 /* Each minute save Fabric and Driver congestion information */ 6094 6089 lpfc_cgn_save_evt_cnt(phba); 6095 6090 6091 + phba->hba_flag &= ~HBA_SHORT_CMF; 6092 + 6096 6093 /* Since we need to call lpfc_cgn_save_evt_cnt every minute, on the 6097 6094 * minute, adjust our next timer interval, if needed, to ensure a 6098 6095 * 1 minute granularity when we get the next timer interrupt. ··· 6105 6098 jiffies); 6106 6099 if (timer_interval <= 0) 6107 6100 timer_interval = LPFC_CMF_INTERVAL; 6101 + else 6102 + phba->hba_flag |= HBA_SHORT_CMF; 6108 6103 6109 6104 /* If we adjust timer_interval, max_bytes_per_interval 6110 6105 * needs to be adjusted as well.