scsi: lpfc: Update congestion mode logging for Emulex SAN Manager application
authorJames Smart <jsmart2021@gmail.com>
Sun, 11 Sep 2022 22:14:59 +0000 (15:14 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 16 Sep 2022 02:18:27 +0000 (22:18 -0400)
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>
drivers/scsi/lpfc/lpfc_init.c

index 0a4a82f..b170e9e 100644 (file)
@@ -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.
@@ -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.
@@ -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;
 
@@ -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 "