@@ -2962,6 +2962,169 @@ static const struct file_operations chcr_stats_debugfs_fops = {
2962
2962
.llseek = seq_lseek ,
2963
2963
.release = single_release ,
2964
2964
};
2965
+
2966
+ #define PRINT_ADAP_STATS (string , value ) \
2967
+ seq_printf(seq, "%-25s %-20llu\n", (string), \
2968
+ (unsigned long long)(value))
2969
+
2970
+ #define PRINT_CH_STATS (string , value ) \
2971
+ do { \
2972
+ seq_printf(seq, "%-25s ", (string)); \
2973
+ for (i = 0; i < adap->params.arch.nchan; i++) \
2974
+ seq_printf(seq, "%-20llu ", \
2975
+ (unsigned long long)stats.value[i]); \
2976
+ seq_printf(seq, "\n"); \
2977
+ } while (0)
2978
+
2979
+ #define PRINT_CH_STATS2 (string , value ) \
2980
+ do { \
2981
+ seq_printf(seq, "%-25s ", (string)); \
2982
+ for (i = 0; i < adap->params.arch.nchan; i++) \
2983
+ seq_printf(seq, "%-20llu ", \
2984
+ (unsigned long long)stats[i].value); \
2985
+ seq_printf(seq, "\n"); \
2986
+ } while (0)
2987
+
2988
+ static void show_tcp_stats (struct seq_file * seq )
2989
+ {
2990
+ struct adapter * adap = seq -> private ;
2991
+ struct tp_tcp_stats v4 , v6 ;
2992
+
2993
+ spin_lock (& adap -> stats_lock );
2994
+ t4_tp_get_tcp_stats (adap , & v4 , & v6 , false);
2995
+ spin_unlock (& adap -> stats_lock );
2996
+
2997
+ PRINT_ADAP_STATS ("tcp_ipv4_out_rsts:" , v4 .tcp_out_rsts );
2998
+ PRINT_ADAP_STATS ("tcp_ipv4_in_segs:" , v4 .tcp_in_segs );
2999
+ PRINT_ADAP_STATS ("tcp_ipv4_out_segs:" , v4 .tcp_out_segs );
3000
+ PRINT_ADAP_STATS ("tcp_ipv4_retrans_segs:" , v4 .tcp_retrans_segs );
3001
+ PRINT_ADAP_STATS ("tcp_ipv6_out_rsts:" , v6 .tcp_out_rsts );
3002
+ PRINT_ADAP_STATS ("tcp_ipv6_in_segs:" , v6 .tcp_in_segs );
3003
+ PRINT_ADAP_STATS ("tcp_ipv6_out_segs:" , v6 .tcp_out_segs );
3004
+ PRINT_ADAP_STATS ("tcp_ipv6_retrans_segs:" , v6 .tcp_retrans_segs );
3005
+ }
3006
+
3007
+ static void show_ddp_stats (struct seq_file * seq )
3008
+ {
3009
+ struct adapter * adap = seq -> private ;
3010
+ struct tp_usm_stats stats ;
3011
+
3012
+ spin_lock (& adap -> stats_lock );
3013
+ t4_get_usm_stats (adap , & stats , false);
3014
+ spin_unlock (& adap -> stats_lock );
3015
+
3016
+ PRINT_ADAP_STATS ("usm_ddp_frames:" , stats .frames );
3017
+ PRINT_ADAP_STATS ("usm_ddp_octets:" , stats .octets );
3018
+ PRINT_ADAP_STATS ("usm_ddp_drops:" , stats .drops );
3019
+ }
3020
+
3021
+ static void show_rdma_stats (struct seq_file * seq )
3022
+ {
3023
+ struct adapter * adap = seq -> private ;
3024
+ struct tp_rdma_stats stats ;
3025
+
3026
+ spin_lock (& adap -> stats_lock );
3027
+ t4_tp_get_rdma_stats (adap , & stats , false);
3028
+ spin_unlock (& adap -> stats_lock );
3029
+
3030
+ PRINT_ADAP_STATS ("rdma_no_rqe_mod_defer:" , stats .rqe_dfr_mod );
3031
+ PRINT_ADAP_STATS ("rdma_no_rqe_pkt_defer:" , stats .rqe_dfr_pkt );
3032
+ }
3033
+
3034
+ static void show_tp_err_adapter_stats (struct seq_file * seq )
3035
+ {
3036
+ struct adapter * adap = seq -> private ;
3037
+ struct tp_err_stats stats ;
3038
+
3039
+ spin_lock (& adap -> stats_lock );
3040
+ t4_tp_get_err_stats (adap , & stats , false);
3041
+ spin_unlock (& adap -> stats_lock );
3042
+
3043
+ PRINT_ADAP_STATS ("tp_err_ofld_no_neigh:" , stats .ofld_no_neigh );
3044
+ PRINT_ADAP_STATS ("tp_err_ofld_cong_defer:" , stats .ofld_cong_defer );
3045
+ }
3046
+
3047
+ static void show_cpl_stats (struct seq_file * seq )
3048
+ {
3049
+ struct adapter * adap = seq -> private ;
3050
+ struct tp_cpl_stats stats ;
3051
+ u8 i ;
3052
+
3053
+ spin_lock (& adap -> stats_lock );
3054
+ t4_tp_get_cpl_stats (adap , & stats , false);
3055
+ spin_unlock (& adap -> stats_lock );
3056
+
3057
+ PRINT_CH_STATS ("tp_cpl_requests:" , req );
3058
+ PRINT_CH_STATS ("tp_cpl_responses:" , rsp );
3059
+ }
3060
+
3061
+ static void show_tp_err_channel_stats (struct seq_file * seq )
3062
+ {
3063
+ struct adapter * adap = seq -> private ;
3064
+ struct tp_err_stats stats ;
3065
+ u8 i ;
3066
+
3067
+ spin_lock (& adap -> stats_lock );
3068
+ t4_tp_get_err_stats (adap , & stats , false);
3069
+ spin_unlock (& adap -> stats_lock );
3070
+
3071
+ PRINT_CH_STATS ("tp_mac_in_errs:" , mac_in_errs );
3072
+ PRINT_CH_STATS ("tp_hdr_in_errs:" , hdr_in_errs );
3073
+ PRINT_CH_STATS ("tp_tcp_in_errs:" , tcp_in_errs );
3074
+ PRINT_CH_STATS ("tp_tcp6_in_errs:" , tcp6_in_errs );
3075
+ PRINT_CH_STATS ("tp_tnl_cong_drops:" , tnl_cong_drops );
3076
+ PRINT_CH_STATS ("tp_tnl_tx_drops:" , tnl_tx_drops );
3077
+ PRINT_CH_STATS ("tp_ofld_vlan_drops:" , ofld_vlan_drops );
3078
+ PRINT_CH_STATS ("tp_ofld_chan_drops:" , ofld_chan_drops );
3079
+ }
3080
+
3081
+ static void show_fcoe_stats (struct seq_file * seq )
3082
+ {
3083
+ struct adapter * adap = seq -> private ;
3084
+ struct tp_fcoe_stats stats [NCHAN ];
3085
+ u8 i ;
3086
+
3087
+ spin_lock (& adap -> stats_lock );
3088
+ for (i = 0 ; i < adap -> params .arch .nchan ; i ++ )
3089
+ t4_get_fcoe_stats (adap , i , & stats [i ], false);
3090
+ spin_unlock (& adap -> stats_lock );
3091
+
3092
+ PRINT_CH_STATS2 ("fcoe_octets_ddp" , octets_ddp );
3093
+ PRINT_CH_STATS2 ("fcoe_frames_ddp" , frames_ddp );
3094
+ PRINT_CH_STATS2 ("fcoe_frames_drop" , frames_drop );
3095
+ }
3096
+
3097
+ #undef PRINT_CH_STATS2
3098
+ #undef PRINT_CH_STATS
3099
+ #undef PRINT_ADAP_STATS
3100
+
3101
+ static int tp_stats_show (struct seq_file * seq , void * v )
3102
+ {
3103
+ struct adapter * adap = seq -> private ;
3104
+
3105
+ seq_puts (seq , "\n--------Adapter Stats--------\n" );
3106
+ show_tcp_stats (seq );
3107
+ show_ddp_stats (seq );
3108
+ show_rdma_stats (seq );
3109
+ show_tp_err_adapter_stats (seq );
3110
+
3111
+ seq_puts (seq , "\n-------- Channel Stats --------\n" );
3112
+ if (adap -> params .arch .nchan == NCHAN )
3113
+ seq_printf (seq , "%-25s %-20s %-20s %-20s %-20s\n" ,
3114
+ " " , "channel 0" , "channel 1" ,
3115
+ "channel 2" , "channel 3" );
3116
+ else
3117
+ seq_printf (seq , "%-25s %-20s %-20s\n" ,
3118
+ " " , "channel 0" , "channel 1" );
3119
+ show_cpl_stats (seq );
3120
+ show_tp_err_channel_stats (seq );
3121
+ show_fcoe_stats (seq );
3122
+
3123
+ return 0 ;
3124
+ }
3125
+
3126
+ DEFINE_SIMPLE_DEBUGFS_FILE (tp_stats );
3127
+
2965
3128
/* Add an array of Debug FS files.
2966
3129
*/
2967
3130
void add_debugfs_files (struct adapter * adap ,
@@ -3038,6 +3201,7 @@ int t4_setup_debugfs(struct adapter *adap)
3038
3201
{ "blocked_fl" , & blocked_fl_fops , 0600 , 0 },
3039
3202
{ "meminfo" , & meminfo_fops , 0400 , 0 },
3040
3203
{ "crypto" , & chcr_stats_debugfs_fops , 0400 , 0 },
3204
+ { "tp_stats" , & tp_stats_debugfs_fops , 0400 , 0 },
3041
3205
};
3042
3206
3043
3207
/* Debug FS nodes common to all T5 and later adapters.
0 commit comments