net/qede/base: print various indication on Tx-timeouts
authorRasesh Mody <rasesh.mody@cavium.com>
Wed, 29 Mar 2017 20:36:04 +0000 (13:36 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:49 +0000 (19:02 +0200)
Print various indication on Tx-timeouts.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore_int.c
drivers/net/qede/base/ecore_int_api.h
drivers/net/qede/base/reg_addr.h
drivers/net/qede/qede_main.c

index b6b8e2d..e5a4359 100644 (file)
@@ -2255,3 +2255,30 @@ enum _ecore_status_t ecore_int_set_timer_res(struct ecore_hwfn *p_hwfn,
 
        return rc;
 }
+
+enum _ecore_status_t ecore_int_get_sb_dbg(struct ecore_hwfn *p_hwfn,
+                                         struct ecore_ptt *p_ptt,
+                                         struct ecore_sb_info *p_sb,
+                                         struct ecore_sb_info_dbg *p_info)
+{
+       u16 sbid = p_sb->igu_sb_id;
+       int i;
+
+       if (IS_VF(p_hwfn->p_dev))
+               return ECORE_INVAL;
+
+       if (sbid > NUM_OF_SBS(p_hwfn->p_dev))
+               return ECORE_INVAL;
+
+       p_info->igu_prod = ecore_rd(p_hwfn, p_ptt,
+                                   IGU_REG_PRODUCER_MEMORY + sbid * 4);
+       p_info->igu_cons = ecore_rd(p_hwfn, p_ptt,
+                                   IGU_REG_CONSUMER_MEM + sbid * 4);
+
+       for (i = 0; i < PIS_PER_SB; i++)
+               p_info->pi[i] = (u16)ecore_rd(p_hwfn, p_ptt,
+                                             CAU_REG_PI_MEMORY +
+                                             sbid * 4 * PIS_PER_SB +  i * 4);
+
+       return ECORE_SUCCESS;
+}
index a0d6a43..fdfcba8 100644 (file)
@@ -41,6 +41,12 @@ struct ecore_sb_info {
        struct ecore_dev *p_dev;
 };
 
+struct ecore_sb_info_dbg {
+       u32 igu_prod;
+       u32 igu_cons;
+       u16 pi[PIS_PER_SB];
+};
+
 struct ecore_sb_cnt_info {
        int sb_cnt;
        int sb_iov_cnt;
@@ -303,4 +309,19 @@ void ecore_int_disable_post_isr_release(struct ecore_dev *p_dev);
  */
 void ecore_int_attn_clr_enable(struct ecore_dev *p_dev, bool clr_enable);
 
+/**
+ * @brief Read debug information regarding a given SB.
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param p_sb - point to Status block for which we want to get info.
+ * @param p_info - pointer to struct to fill with information regarding SB.
+ *
+ * @return ECORE_SUCCESS if pointer is filled; failure otherwise.
+ */
+enum _ecore_status_t ecore_int_get_sb_dbg(struct ecore_hwfn *p_hwfn,
+                                         struct ecore_ptt *p_ptt,
+                                         struct ecore_sb_info *p_sb,
+                                         struct ecore_sb_info_dbg *p_info);
+
 #endif
index 21cbdbd..3cc7fd4 100644 (file)
 
 /* 8.18.7.0 FW */
 #define BRB_REG_INT_MASK_10 0x3401b8UL
+
+#define IGU_REG_PRODUCER_MEMORY 0x182000UL
+#define IGU_REG_CONSUMER_MEM 0x183000UL
index f0033a1..a604a5b 100644 (file)
@@ -687,6 +687,29 @@ static int qed_send_drv_state(struct ecore_dev *edev, bool active)
        return status;
 }
 
+static int qed_get_sb_info(struct ecore_dev *edev, struct ecore_sb_info *sb,
+                          u16 qid, struct ecore_sb_info_dbg *sb_dbg)
+{
+       struct ecore_hwfn *hwfn = &edev->hwfns[qid % edev->num_hwfns];
+       struct ecore_ptt *ptt;
+       int rc;
+
+       if (IS_VF(edev))
+               return -EINVAL;
+
+       ptt = ecore_ptt_acquire(hwfn);
+       if (!ptt) {
+               DP_NOTICE(hwfn, true, "Can't acquire PTT\n");
+               return -EAGAIN;
+       }
+
+       memset(sb_dbg, 0, sizeof(*sb_dbg));
+       rc = ecore_int_get_sb_dbg(hwfn, ptt, sb, sb_dbg);
+
+       ecore_ptt_release(hwfn, ptt);
+       return rc;
+}
+
 const struct qed_common_ops qed_common_ops_pass = {
        INIT_STRUCT_FIELD(probe, &qed_probe),
        INIT_STRUCT_FIELD(update_pf_params, &qed_update_pf_params),