@@ -2482,50 +2482,29 @@ hclge_dbg_dump_mac_tnl_status(struct hclge_dev *hdev, char *buf, int len)
2482
2482
return 0 ;
2483
2483
}
2484
2484
2485
-
2486
- static const struct hclge_dbg_item mac_list_items [] = {
2487
- { "FUNC_ID" , 2 },
2488
- { "MAC_ADDR" , 12 },
2489
- { "STATE" , 2 },
2490
- };
2491
-
2492
- static void hclge_dbg_dump_mac_list (struct hclge_dev * hdev , char * buf , int len ,
2493
- bool is_unicast )
2485
+ static void hclge_dbg_dump_mac_list (struct seq_file * s , bool is_unicast )
2494
2486
{
2495
- char data_str [ARRAY_SIZE (mac_list_items )][HCLGE_DBG_DATA_STR_LEN ];
2496
- char content [HCLGE_DBG_INFO_LEN ], str_id [HCLGE_DBG_ID_LEN ];
2497
- char * result [ARRAY_SIZE (mac_list_items )];
2487
+ struct hclge_dev * hdev = hclge_seq_file_to_hdev (s );
2498
2488
struct hclge_mac_node * mac_node , * tmp ;
2499
2489
struct hclge_vport * vport ;
2500
2490
struct list_head * list ;
2501
- u32 func_id , i ;
2502
- int pos = 0 ;
2491
+ u32 func_id ;
2503
2492
2504
- for (i = 0 ; i < ARRAY_SIZE (mac_list_items ); i ++ )
2505
- result [i ] = & data_str [i ][0 ];
2506
-
2507
- pos += scnprintf (buf + pos , len - pos , "%s MAC_LIST:\n" ,
2508
- is_unicast ? "UC" : "MC" );
2509
- hclge_dbg_fill_content (content , sizeof (content ), mac_list_items ,
2510
- NULL , ARRAY_SIZE (mac_list_items ));
2511
- pos += scnprintf (buf + pos , len - pos , "%s" , content );
2493
+ seq_printf (s , "%s MAC_LIST:\n" , is_unicast ? "UC" : "MC" );
2494
+ seq_puts (s , "FUNC_ID MAC_ADDR STATE\n" );
2512
2495
2513
2496
for (func_id = 0 ; func_id < hdev -> num_alloc_vport ; func_id ++ ) {
2514
2497
vport = & hdev -> vport [func_id ];
2515
2498
list = is_unicast ? & vport -> uc_mac_list : & vport -> mc_mac_list ;
2516
2499
spin_lock_bh (& vport -> mac_list_lock );
2517
2500
list_for_each_entry_safe (mac_node , tmp , list , node ) {
2518
- i = 0 ;
2519
- result [i ++ ] = hclge_dbg_get_func_id_str (str_id ,
2520
- func_id );
2521
- sprintf (result [i ++ ], "%pM" , mac_node -> mac_addr );
2522
- sprintf (result [i ++ ], "%5s" ,
2523
- hclge_mac_state_str [mac_node -> state ]);
2524
- hclge_dbg_fill_content (content , sizeof (content ),
2525
- mac_list_items ,
2526
- (const char * * )result ,
2527
- ARRAY_SIZE (mac_list_items ));
2528
- pos += scnprintf (buf + pos , len - pos , "%s" , content );
2501
+ if (func_id )
2502
+ seq_printf (s , "vf%-7u" , func_id - 1U );
2503
+ else
2504
+ seq_puts (s , "pf " );
2505
+ seq_printf (s , "%pM " , mac_node -> mac_addr );
2506
+ seq_printf (s , "%5s\n" ,
2507
+ hclge_mac_state_str [mac_node -> state ]);
2529
2508
}
2530
2509
spin_unlock_bh (& vport -> mac_list_lock );
2531
2510
}
@@ -2893,16 +2872,16 @@ static int hclge_dbg_dump_ptp_info(struct hclge_dev *hdev, char *buf, int len)
2893
2872
return 0 ;
2894
2873
}
2895
2874
2896
- static int hclge_dbg_dump_mac_uc (struct hclge_dev * hdev , char * buf , int len )
2875
+ static int hclge_dbg_dump_mac_uc (struct seq_file * s , void * data )
2897
2876
{
2898
- hclge_dbg_dump_mac_list (hdev , buf , len , true);
2877
+ hclge_dbg_dump_mac_list (s , true);
2899
2878
2900
2879
return 0 ;
2901
2880
}
2902
2881
2903
- static int hclge_dbg_dump_mac_mc (struct hclge_dev * hdev , char * buf , int len )
2882
+ static int hclge_dbg_dump_mac_mc (struct seq_file * s , void * data )
2904
2883
{
2905
- hclge_dbg_dump_mac_list (hdev , buf , len , false);
2884
+ hclge_dbg_dump_mac_list (s , false);
2906
2885
2907
2886
return 0 ;
2908
2887
}
@@ -2954,11 +2933,11 @@ static const struct hclge_dbg_func hclge_dbg_cmd_func[] = {
2954
2933
},
2955
2934
{
2956
2935
.cmd = HNAE3_DBG_CMD_MAC_UC ,
2957
- .dbg_dump = hclge_dbg_dump_mac_uc ,
2936
+ .dbg_read_func = hclge_dbg_dump_mac_uc ,
2958
2937
},
2959
2938
{
2960
2939
.cmd = HNAE3_DBG_CMD_MAC_MC ,
2961
- .dbg_dump = hclge_dbg_dump_mac_mc ,
2940
+ .dbg_read_func = hclge_dbg_dump_mac_mc ,
2962
2941
},
2963
2942
{
2964
2943
.cmd = HNAE3_DBG_CMD_MNG_TBL ,
0 commit comments