Skip to content

Commit

Permalink
scsi: lpfc: Update congestion mode logging for Emulex SAN Manager app…
Browse files Browse the repository at this point in the history
…lication

If there is a congestion or automated congestion response mode change, then
log the reported change to kmsg.

Link: https://lore.kernel.org/r/20220911221505.117655-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>
  • Loading branch information
jsmart-gh authored and martinkpetersen committed Sep 16, 2022
1 parent 6e5c5d2 commit 21828e3
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions drivers/scsi/lpfc/lpfc_init.c
Expand Up @@ -7038,6 +7038,12 @@ lpfc_cgn_params_val(struct lpfc_hba *phba, struct lpfc_cgn_param *p_cfg_param)
spin_unlock_irq(&phba->hbalock);
}

static const char * const lpfc_cmf_mode_to_str[] = {
"OFF",
"MANAGED",
"MONITOR",
};

/**
* lpfc_cgn_params_parse - Process a FW cong parm change event
* @phba: pointer to lpfc hba data structure.
Expand All @@ -7057,6 +7063,7 @@ lpfc_cgn_params_parse(struct lpfc_hba *phba,
{
struct lpfc_cgn_info *cp;
uint32_t crc, oldmode;
char acr_string[4] = {0};

/* Make sure the FW has encoded the correct magic number to
* validate the congestion parameter in FW memory.
Expand Down Expand Up @@ -7133,9 +7140,6 @@ lpfc_cgn_params_parse(struct lpfc_hba *phba,
lpfc_issue_els_edc(phba->pport, 0);
break;
case LPFC_CFG_MONITOR:
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"4661 Switch from MANAGED to "
"`MONITOR mode\n");
phba->cmf_max_bytes_per_interval =
phba->cmf_link_byte_count;

Expand All @@ -7154,14 +7158,26 @@ lpfc_cgn_params_parse(struct lpfc_hba *phba,
lpfc_issue_els_edc(phba->pport, 0);
break;
case LPFC_CFG_MANAGED:
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
"4662 Switch from MONITOR to "
"MANAGED mode\n");
lpfc_cmf_signal_init(phba);
break;
}
break;
}
if (oldmode != LPFC_CFG_OFF ||
oldmode != phba->cgn_p.cgn_param_mode) {
if (phba->cgn_p.cgn_param_mode == LPFC_CFG_MANAGED)
scnprintf(acr_string, sizeof(acr_string), "%u",
phba->cgn_p.cgn_param_level0);
else
scnprintf(acr_string, sizeof(acr_string), "NA");

dev_info(&phba->pcidev->dev, "%d: "
"4663 CMF: Mode %s acr %s\n",
phba->brd_no,
lpfc_cmf_mode_to_str
[phba->cgn_p.cgn_param_mode],
acr_string);
}
} else {
lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT | LOG_INIT,
"4669 FW cgn parm buf wrong magic 0x%x "
Expand Down

0 comments on commit 21828e3

Please sign in to comment.