Skip to content

Commit 7481811

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Add support for maintaining the cm statistics buffer
Add the logic to move the congestion management and event information into the cmd statistics buffer maintained for the adapter. The update includes rolling up values for the last minute, hour, and day information. Link: https://lore.kernel.org/r/[email protected] Co-developed-by: Justin Tee <[email protected]> Signed-off-by: Justin Tee <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 17b27ac commit 7481811

File tree

3 files changed

+542
-1
lines changed

3 files changed

+542
-1
lines changed

drivers/scsi/lpfc/lpfc_crtn.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ void lpfc_cmf_stop(struct lpfc_hba *phba);
8383
void lpfc_init_congestion_stat(struct lpfc_hba *phba);
8484
void lpfc_init_congestion_buf(struct lpfc_hba *phba);
8585
int lpfc_sli4_cgn_params_read(struct lpfc_hba *phba);
86+
uint32_t lpfc_cgn_calc_crc32(void *bufp, uint32_t sz, uint32_t seed);
8687
int lpfc_config_cgn_signal(struct lpfc_hba *phba);
8788
int lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total);
89+
void lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag);
8890
void lpfc_unblock_requests(struct lpfc_hba *phba);
8991
void lpfc_block_requests(struct lpfc_hba *phba);
9092

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3783,6 +3783,7 @@ lpfc_least_capable_settings(struct lpfc_hba *phba,
37833783
u32 rsp_sig_cap = 0, drv_sig_cap = 0;
37843784
u32 rsp_sig_freq_cyc = 0, rsp_sig_freq_scale = 0;
37853785
struct lpfc_cgn_info *cp;
3786+
u32 crc;
37863787
u16 sig_freq;
37873788

37883789
/* Get rsp signal and frequency capabilities. */
@@ -3856,6 +3857,8 @@ lpfc_least_capable_settings(struct lpfc_hba *phba,
38563857
cp->cgn_alarm_freq = cpu_to_le16(sig_freq);
38573858
cp->cgn_warn_freq = cpu_to_le16(sig_freq);
38583859
}
3860+
crc = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, LPFC_CGN_CRC32_SEED);
3861+
cp->cgn_info_crc = cpu_to_le32(crc);
38593862
return;
38603863

38613864
out_no_support:
@@ -9539,6 +9542,7 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)
95399542
const char *cgn_sev_str;
95409543
u32 cgn_sev;
95419544
uint16_t value;
9545+
u32 crc;
95429546
bool nm_log = false;
95439547
int rc = 1;
95449548

@@ -9601,6 +9605,11 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)
96019605
LPFC_CGN_FPIN_WARN)
96029606
cp->cgn_warn_freq =
96039607
cpu_to_le16(value);
9608+
crc = lpfc_cgn_calc_crc32
9609+
(cp,
9610+
LPFC_CGN_INFO_SZ,
9611+
LPFC_CGN_CRC32_SEED);
9612+
cp->cgn_info_crc = cpu_to_le32(crc);
96049613
}
96059614

96069615
/* Don't deliver to upper layer since
@@ -9688,6 +9697,7 @@ lpfc_els_rcv_fpin(struct lpfc_vport *vport, void *p, u32 fpin_length)
96889697
/* If descriptor is bad, drop the rest of the data */
96899698
return;
96909699
}
9700+
lpfc_cgn_update_stat(phba, dtag);
96919701
cnt = be32_to_cpu(tlv->desc_len);
96929702

96939703
/* Sanity check descriptor length. The desc_len value does not

0 commit comments

Comments
 (0)