Commit 71ddeeaf authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Add warning notification period to CMF_SYNC_WQE

Add capability to specify warning notification period to help firmware
adjust to congestion accordingly.

Link: https://lore.kernel.org/r/20220819011736.14141-5-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent bd269188
...@@ -1564,7 +1564,7 @@ struct lpfc_hba { ...@@ -1564,7 +1564,7 @@ struct lpfc_hba {
/* cgn_reg_signal and cgn_init_reg_signal use /* cgn_reg_signal and cgn_init_reg_signal use
* enum fc_edc_cg_signal_cap_types * enum fc_edc_cg_signal_cap_types
*/ */
u16 cgn_fpin_frequency; u16 cgn_fpin_frequency; /* In units of msecs */
#define LPFC_FPIN_INIT_FREQ 0xffff #define LPFC_FPIN_INIT_FREQ 0xffff
u32 cgn_sig_freq; u32 cgn_sig_freq;
u32 cgn_acqe_cnt; u32 cgn_acqe_cnt;
......
...@@ -738,6 +738,7 @@ struct lpfc_register { ...@@ -738,6 +738,7 @@ struct lpfc_register {
#define lpfc_sliport_eqdelay_id_WORD word0 #define lpfc_sliport_eqdelay_id_WORD word0
#define LPFC_SEC_TO_USEC 1000000 #define LPFC_SEC_TO_USEC 1000000
#define LPFC_SEC_TO_MSEC 1000 #define LPFC_SEC_TO_MSEC 1000
#define LPFC_MSECS_TO_SECS(msecs) ((msecs) / 1000)
/* The following Registers apply to SLI4 if_type 0 UCNAs. They typically /* The following Registers apply to SLI4 if_type 0 UCNAs. They typically
* reside in BAR 2. * reside in BAR 2.
...@@ -4798,6 +4799,9 @@ struct cmf_sync_wqe { ...@@ -4798,6 +4799,9 @@ struct cmf_sync_wqe {
#define cmf_sync_cqid_WORD word11 #define cmf_sync_cqid_WORD word11
uint32_t read_bytes; uint32_t read_bytes;
uint32_t word13; uint32_t word13;
#define cmf_sync_period_SHIFT 16
#define cmf_sync_period_MASK 0x0000ffff
#define cmf_sync_period_WORD word13
uint32_t word14; uint32_t word14;
uint32_t word15; uint32_t word15;
}; };
......
...@@ -1916,6 +1916,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total) ...@@ -1916,6 +1916,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
unsigned long iflags; unsigned long iflags;
u32 ret_val; u32 ret_val;
u32 atot, wtot, max; u32 atot, wtot, max;
u16 warn_sync_period = 0;
/* First address any alarm / warning activity */ /* First address any alarm / warning activity */
atot = atomic_xchg(&phba->cgn_sync_alarm_cnt, 0); atot = atomic_xchg(&phba->cgn_sync_alarm_cnt, 0);
...@@ -1970,10 +1971,14 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total) ...@@ -1970,10 +1971,14 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
lpfc_acqe_cgn_frequency; lpfc_acqe_cgn_frequency;
bf_set(cmf_sync_wsigmax, &wqe->cmf_sync, max); bf_set(cmf_sync_wsigmax, &wqe->cmf_sync, max);
bf_set(cmf_sync_wsigcnt, &wqe->cmf_sync, wtot); bf_set(cmf_sync_wsigcnt, &wqe->cmf_sync, wtot);
warn_sync_period = lpfc_acqe_cgn_frequency;
} else { } else {
/* We hit a FPIN warning condition */ /* We hit a FPIN warning condition */
bf_set(cmf_sync_wfpinmax, &wqe->cmf_sync, 1); bf_set(cmf_sync_wfpinmax, &wqe->cmf_sync, 1);
bf_set(cmf_sync_wfpincnt, &wqe->cmf_sync, 1); bf_set(cmf_sync_wfpincnt, &wqe->cmf_sync, 1);
if (phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ)
warn_sync_period =
LPFC_MSECS_TO_SECS(phba->cgn_fpin_frequency);
} }
} }
...@@ -1989,6 +1994,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total) ...@@ -1989,6 +1994,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
bf_set(cmf_sync_reqtag, &wqe->cmf_sync, sync_buf->iotag); bf_set(cmf_sync_reqtag, &wqe->cmf_sync, sync_buf->iotag);
bf_set(cmf_sync_qosd, &wqe->cmf_sync, 1); bf_set(cmf_sync_qosd, &wqe->cmf_sync, 1);
bf_set(cmf_sync_period, &wqe->cmf_sync, warn_sync_period);
bf_set(cmf_sync_cmd_type, &wqe->cmf_sync, CMF_SYNC_COMMAND); bf_set(cmf_sync_cmd_type, &wqe->cmf_sync, CMF_SYNC_COMMAND);
bf_set(cmf_sync_wqec, &wqe->cmf_sync, 1); bf_set(cmf_sync_wqec, &wqe->cmf_sync, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment