net/qede: add notifying HW errors
authorHarish Patil <harish.patil@cavium.com>
Sat, 1 Jul 2017 19:29:56 +0000 (12:29 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 6 Jul 2017 13:00:57 +0000 (15:00 +0200)
Log HW errmsg on the stdout and do minimal handling to prevent HW
attentions from being reasserted.

Signed-off-by: Harish Patil <harish.patil@cavium.com>
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/bcm_osal.c
drivers/net/qede/base/bcm_osal.h
drivers/net/qede/base/ecore_int.c

index 1ccfad0..4dee4da 100644 (file)
@@ -255,3 +255,35 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
                       type);
        }
 }
+
+void
+qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
+{
+       char err_str[64];
+
+       switch (err_type) {
+       case ECORE_HW_ERR_FAN_FAIL:
+               strcpy(err_str, "Fan Failure");
+               break;
+       case ECORE_HW_ERR_MFW_RESP_FAIL:
+               strcpy(err_str, "MFW Response Failure");
+               break;
+       case ECORE_HW_ERR_HW_ATTN:
+               strcpy(err_str, "HW Attention");
+               break;
+       case ECORE_HW_ERR_DMAE_FAIL:
+               strcpy(err_str, "DMAE Failure");
+               break;
+       case ECORE_HW_ERR_RAMROD_FAIL:
+               strcpy(err_str, "Ramrod Failure");
+               break;
+       case ECORE_HW_ERR_FW_ASSERT:
+               strcpy(err_str, "FW Assertion");
+               break;
+       default:
+               strcpy(err_str, "Unknown");
+       }
+
+       DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+       ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
+}
index 444512c..3acf8f7 100644 (file)
@@ -27,6 +27,7 @@ struct ecore_vf_acquire_sw_info;
 struct vf_pf_resc_request;
 enum ecore_mcp_protocol_type;
 union ecore_mcp_protocol_stats;
+enum ecore_hw_err_type;
 
 void qed_link_update(struct ecore_hwfn *hwfn);
 
@@ -350,6 +351,8 @@ u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
                   u8 *input_buf, u32 max_size, u8 *unzip_buf);
 void qede_vf_fill_driver_data(struct ecore_hwfn *, struct vf_pf_resc_request *,
                              struct ecore_vf_acquire_sw_info *);
+void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
+                       enum ecore_hw_err_type err_type);
 #define OSAL_VF_FILL_ACQUIRE_RESC_REQ(_dev_p, _resc_req, _os_info) \
        qede_vf_fill_driver_data(_dev_p, _resc_req, _os_info)
 
@@ -358,7 +361,8 @@ void qede_vf_fill_driver_data(struct ecore_hwfn *, struct vf_pf_resc_request *,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
-#define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) nothing
+#define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
+       qede_hw_err_notify(hwfn, err_type)
 
 #define OSAL_NVM_IS_ACCESS_ENABLED(hwfn) (1)
 #define OSAL_NUM_ACTIVE_CPU()  0
index 8dc4d15..2afca29 100644 (file)
@@ -842,7 +842,7 @@ ecore_int_deassertion_aeu_bit(struct ecore_hwfn *p_hwfn,
                u32 mask = ~bitmask;
                val = ecore_rd(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg);
                ecore_wr(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg, (val & mask));
-               DP_INFO(p_hwfn, "`%s' - Disabled future attentions\n",
+               DP_ERR(p_hwfn, "`%s' - Disabled future attentions\n",
                        p_bit_name);
        }