@@ -258,12 +258,29 @@ hclge_dbg_dump_reg_common(struct hclge_dev *hdev,
258
258
return 0 ;
259
259
}
260
260
261
+ static const struct hclge_dbg_status_dfx_info hclge_dbg_mac_en_status [] = {
262
+ {HCLGE_MAC_TX_EN_B , "mac_trans_en" },
263
+ {HCLGE_MAC_RX_EN_B , "mac_rcv_en" },
264
+ {HCLGE_MAC_PAD_TX_B , "pad_trans_en" },
265
+ {HCLGE_MAC_PAD_RX_B , "pad_rcv_en" },
266
+ {HCLGE_MAC_1588_TX_B , "1588_trans_en" },
267
+ {HCLGE_MAC_1588_RX_B , "1588_rcv_en" },
268
+ {HCLGE_MAC_APP_LP_B , "mac_app_loop_en" },
269
+ {HCLGE_MAC_LINE_LP_B , "mac_line_loop_en" },
270
+ {HCLGE_MAC_FCS_TX_B , "mac_fcs_tx_en" },
271
+ {HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B , "mac_rx_oversize_truncate_en" },
272
+ {HCLGE_MAC_RX_FCS_STRIP_B , "mac_rx_fcs_strip_en" },
273
+ {HCLGE_MAC_RX_FCS_B , "mac_rx_fcs_en" },
274
+ {HCLGE_MAC_TX_UNDER_MIN_ERR_B , "mac_tx_under_min_err_en" },
275
+ {HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B , "mac_tx_oversize_truncate_en" }
276
+ };
277
+
261
278
static int hclge_dbg_dump_mac_enable_status (struct hclge_dev * hdev , char * buf ,
262
279
int len , int * pos )
263
280
{
264
281
struct hclge_config_mac_mode_cmd * req ;
265
282
struct hclge_desc desc ;
266
- u32 loop_en ;
283
+ u32 loop_en , i , offset ;
267
284
int ret ;
268
285
269
286
hclge_cmd_setup_basic_desc (& desc , HCLGE_OPC_CONFIG_MAC_MODE , true);
@@ -278,39 +295,12 @@ static int hclge_dbg_dump_mac_enable_status(struct hclge_dev *hdev, char *buf,
278
295
req = (struct hclge_config_mac_mode_cmd * )desc .data ;
279
296
loop_en = le32_to_cpu (req -> txrx_pad_fcs_loop_en );
280
297
281
- * pos += scnprintf (buf + * pos , len - * pos , "mac_trans_en: %#x\n" ,
282
- hnae3_get_bit (loop_en , HCLGE_MAC_TX_EN_B ));
283
- * pos += scnprintf (buf + * pos , len - * pos , "mac_rcv_en: %#x\n" ,
284
- hnae3_get_bit (loop_en , HCLGE_MAC_RX_EN_B ));
285
- * pos += scnprintf (buf + * pos , len - * pos , "pad_trans_en: %#x\n" ,
286
- hnae3_get_bit (loop_en , HCLGE_MAC_PAD_TX_B ));
287
- * pos += scnprintf (buf + * pos , len - * pos , "pad_rcv_en: %#x\n" ,
288
- hnae3_get_bit (loop_en , HCLGE_MAC_PAD_RX_B ));
289
- * pos += scnprintf (buf + * pos , len - * pos , "1588_trans_en: %#x\n" ,
290
- hnae3_get_bit (loop_en , HCLGE_MAC_1588_TX_B ));
291
- * pos += scnprintf (buf + * pos , len - * pos , "1588_rcv_en: %#x\n" ,
292
- hnae3_get_bit (loop_en , HCLGE_MAC_1588_RX_B ));
293
- * pos += scnprintf (buf + * pos , len - * pos , "mac_app_loop_en: %#x\n" ,
294
- hnae3_get_bit (loop_en , HCLGE_MAC_APP_LP_B ));
295
- * pos += scnprintf (buf + * pos , len - * pos , "mac_line_loop_en: %#x\n" ,
296
- hnae3_get_bit (loop_en , HCLGE_MAC_LINE_LP_B ));
297
- * pos += scnprintf (buf + * pos , len - * pos , "mac_fcs_tx_en: %#x\n" ,
298
- hnae3_get_bit (loop_en , HCLGE_MAC_FCS_TX_B ));
299
- * pos += scnprintf (buf + * pos , len - * pos ,
300
- "mac_rx_oversize_truncate_en: %#x\n" ,
301
- hnae3_get_bit (loop_en ,
302
- HCLGE_MAC_RX_OVERSIZE_TRUNCATE_B ));
303
- * pos += scnprintf (buf + * pos , len - * pos , "mac_rx_fcs_strip_en: %#x\n" ,
304
- hnae3_get_bit (loop_en , HCLGE_MAC_RX_FCS_STRIP_B ));
305
- * pos += scnprintf (buf + * pos , len - * pos , "mac_rx_fcs_en: %#x\n" ,
306
- hnae3_get_bit (loop_en , HCLGE_MAC_RX_FCS_B ));
307
- * pos += scnprintf (buf + * pos , len - * pos ,
308
- "mac_tx_under_min_err_en: %#x\n" ,
309
- hnae3_get_bit (loop_en , HCLGE_MAC_TX_UNDER_MIN_ERR_B ));
310
- * pos += scnprintf (buf + * pos , len - * pos ,
311
- "mac_tx_oversize_truncate_en: %#x\n" ,
312
- hnae3_get_bit (loop_en ,
313
- HCLGE_MAC_TX_OVERSIZE_TRUNCATE_B ));
298
+ for (i = 0 ; i < ARRAY_SIZE (hclge_dbg_mac_en_status ); i ++ ) {
299
+ offset = hclge_dbg_mac_en_status [i ].offset ;
300
+ * pos += scnprintf (buf + * pos , len - * pos , "%s: %#x\n" ,
301
+ hclge_dbg_mac_en_status [i ].message ,
302
+ hnae3_get_bit (loop_en , offset ));
303
+ }
314
304
315
305
return 0 ;
316
306
}
@@ -1614,8 +1604,19 @@ static int hclge_dbg_dump_fd_counter(struct hclge_dev *hdev, char *buf, int len)
1614
1604
return 0 ;
1615
1605
}
1616
1606
1607
+ static const struct hclge_dbg_status_dfx_info hclge_dbg_rst_info [] = {
1608
+ {HCLGE_MISC_VECTOR_REG_BASE , "vector0 interrupt enable status" },
1609
+ {HCLGE_MISC_RESET_STS_REG , "reset interrupt source" },
1610
+ {HCLGE_MISC_VECTOR_INT_STS , "reset interrupt status" },
1611
+ {HCLGE_RAS_PF_OTHER_INT_STS_REG , "RAS interrupt status" },
1612
+ {HCLGE_GLOBAL_RESET_REG , "hardware reset status" },
1613
+ {HCLGE_NIC_CSQ_DEPTH_REG , "handshake status" },
1614
+ {HCLGE_FUN_RST_ING , "function reset status" }
1615
+ };
1616
+
1617
1617
int hclge_dbg_dump_rst_info (struct hclge_dev * hdev , char * buf , int len )
1618
1618
{
1619
+ u32 i , offset ;
1619
1620
int pos = 0 ;
1620
1621
1621
1622
pos += scnprintf (buf + pos , len - pos , "PF reset count: %u\n" ,
@@ -1634,22 +1635,14 @@ int hclge_dbg_dump_rst_info(struct hclge_dev *hdev, char *buf, int len)
1634
1635
hdev -> rst_stats .reset_cnt );
1635
1636
pos += scnprintf (buf + pos , len - pos , "reset fail count: %u\n" ,
1636
1637
hdev -> rst_stats .reset_fail_cnt );
1637
- pos += scnprintf (buf + pos , len - pos ,
1638
- "vector0 interrupt enable status: 0x%x\n" ,
1639
- hclge_read_dev (& hdev -> hw , HCLGE_MISC_VECTOR_REG_BASE ));
1640
- pos += scnprintf (buf + pos , len - pos , "reset interrupt source: 0x%x\n" ,
1641
- hclge_read_dev (& hdev -> hw , HCLGE_MISC_RESET_STS_REG ));
1642
- pos += scnprintf (buf + pos , len - pos , "reset interrupt status: 0x%x\n" ,
1643
- hclge_read_dev (& hdev -> hw , HCLGE_MISC_VECTOR_INT_STS ));
1644
- pos += scnprintf (buf + pos , len - pos , "RAS interrupt status: 0x%x\n" ,
1645
- hclge_read_dev (& hdev -> hw ,
1646
- HCLGE_RAS_PF_OTHER_INT_STS_REG ));
1647
- pos += scnprintf (buf + pos , len - pos , "hardware reset status: 0x%x\n" ,
1648
- hclge_read_dev (& hdev -> hw , HCLGE_GLOBAL_RESET_REG ));
1649
- pos += scnprintf (buf + pos , len - pos , "handshake status: 0x%x\n" ,
1650
- hclge_read_dev (& hdev -> hw , HCLGE_NIC_CSQ_DEPTH_REG ));
1651
- pos += scnprintf (buf + pos , len - pos , "function reset status: 0x%x\n" ,
1652
- hclge_read_dev (& hdev -> hw , HCLGE_FUN_RST_ING ));
1638
+
1639
+ for (i = 0 ; i < ARRAY_SIZE (hclge_dbg_rst_info ); i ++ ) {
1640
+ offset = hclge_dbg_rst_info [i ].offset ;
1641
+ pos += scnprintf (buf + pos , len - pos , "%s: 0x%x\n" ,
1642
+ hclge_dbg_rst_info [i ].message ,
1643
+ hclge_read_dev (& hdev -> hw , offset ));
1644
+ }
1645
+
1653
1646
pos += scnprintf (buf + pos , len - pos , "hdev state: 0x%lx\n" ,
1654
1647
hdev -> state );
1655
1648
0 commit comments