IB/hfi1: Modify logging frequency of DCC errors
authorJakub Byczkowski <jakub.byczkowski@intel.com>
Wed, 8 Feb 2017 13:27:55 +0000 (05:27 -0800)
committerDoug Ledford <dledford@redhat.com>
Sun, 19 Feb 2017 14:18:43 +0000 (09:18 -0500)
Use rate-limit state to limit number of messages logged
to kernel message buffer for DCC errors. Add new macro
dd_dev_info_ratelimited for that propose. Replace all
dd_dev_info calls in handle_dcc_err function with
rate-limited version.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jakub Byczkowski <jakub.byczkowski@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/chip.c
drivers/infiniband/hw/hfi1/hfi.h

index ef72bc2a9e1db41c195ee8044a8f385f3f018031..b9d491c9071a44d565721892e430948f56eab3bc 100644 (file)
@@ -7827,7 +7827,8 @@ static void handle_dcc_err(struct hfi1_devdata *dd, u32 unused, u64 reg)
                }
 
                /* just report this */
-               dd_dev_info(dd, "DCC Error: fmconfig error: %s\n", extra);
+               dd_dev_info_ratelimited(dd, "DCC Error: fmconfig error: %s\n",
+                                       extra);
                reg &= ~DCC_ERR_FLG_FMCONFIG_ERR_SMASK;
        }
 
@@ -7878,34 +7879,35 @@ static void handle_dcc_err(struct hfi1_devdata *dd, u32 unused, u64 reg)
                }
 
                /* just report this */
-               dd_dev_info(dd, "DCC Error: PortRcv error: %s\n", extra);
-               dd_dev_info(dd, "           hdr0 0x%llx, hdr1 0x%llx\n",
-                           hdr0, hdr1);
+               dd_dev_info_ratelimited(dd, "DCC Error: PortRcv error: %s\n"
+                                       "               hdr0 0x%llx, hdr1 0x%llx\n",
+                                       extra, hdr0, hdr1);
 
                reg &= ~DCC_ERR_FLG_RCVPORT_ERR_SMASK;
        }
 
        if (reg & DCC_ERR_FLG_EN_CSR_ACCESS_BLOCKED_UC_SMASK) {
                /* informative only */
-               dd_dev_info(dd, "8051 access to LCB blocked\n");
+               dd_dev_info_ratelimited(dd, "8051 access to LCB blocked\n");
                reg &= ~DCC_ERR_FLG_EN_CSR_ACCESS_BLOCKED_UC_SMASK;
        }
        if (reg & DCC_ERR_FLG_EN_CSR_ACCESS_BLOCKED_HOST_SMASK) {
                /* informative only */
-               dd_dev_info(dd, "host access to LCB blocked\n");
+               dd_dev_info_ratelimited(dd, "host access to LCB blocked\n");
                reg &= ~DCC_ERR_FLG_EN_CSR_ACCESS_BLOCKED_HOST_SMASK;
        }
 
        /* report any remaining errors */
        if (reg)
-               dd_dev_info(dd, "DCC Error: %s\n",
-                           dcc_err_string(buf, sizeof(buf), reg));
+               dd_dev_info_ratelimited(dd, "DCC Error: %s\n",
+                                       dcc_err_string(buf, sizeof(buf), reg));
 
        if (lcl_reason == 0)
                lcl_reason = OPA_LINKDOWN_REASON_UNKNOWN;
 
        if (do_bounce) {
-               dd_dev_info(dd, "%s: PortErrorAction bounce\n", __func__);
+               dd_dev_info_ratelimited(dd, "%s: PortErrorAction bounce\n",
+                                       __func__);
                set_link_down_reason(ppd, lcl_reason, 0, lcl_reason);
                queue_work(ppd->hfi1_wq, &ppd->link_bounce_work);
        }
index 9c3be919c0b74b357b374b0d089c2dfea2e981f9..0808e3c3ba39592e92c2238279f8c5a364661e23 100644 (file)
@@ -1942,6 +1942,10 @@ static inline u64 hfi1_pkt_base_sdma_integrity(struct hfi1_devdata *dd)
        dev_info(&(dd)->pcidev->dev, "%s: " fmt, \
                        get_unit_name((dd)->unit), ##__VA_ARGS__)
 
+#define dd_dev_info_ratelimited(dd, fmt, ...) \
+       dev_info_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
+                       get_unit_name((dd)->unit), ##__VA_ARGS__)
+
 #define dd_dev_dbg(dd, fmt, ...) \
        dev_dbg(&(dd)->pcidev->dev, "%s: " fmt, \
                get_unit_name((dd)->unit), ##__VA_ARGS__)