@@ -44,6 +44,132 @@ static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v)
44
44
}
45
45
DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_mac_addr );
46
46
47
+ static int fbnic_dbg_tce_tcam_show (struct seq_file * s , void * v )
48
+ {
49
+ struct fbnic_dev * fbd = s -> private ;
50
+ int i , tcam_idx = 0 ;
51
+ char hdr [80 ];
52
+
53
+ /* Generate Header */
54
+ snprintf (hdr , sizeof (hdr ), "%3s %s %-17s %s\n" ,
55
+ "Idx" , "S" , "TCAM Bitmap" , "Addr/Mask" );
56
+ seq_puts (s , hdr );
57
+ fbnic_dbg_desc_break (s , strnlen (hdr , sizeof (hdr )));
58
+
59
+ for (i = 0 ; i < ARRAY_SIZE (fbd -> mac_addr ); i ++ ) {
60
+ struct fbnic_mac_addr * mac_addr = & fbd -> mac_addr [i ];
61
+
62
+ /* Verify BMC bit is set */
63
+ if (!test_bit (FBNIC_MAC_ADDR_T_BMC , mac_addr -> act_tcam ))
64
+ continue ;
65
+
66
+ if (tcam_idx == FBNIC_TCE_TCAM_NUM_ENTRIES )
67
+ break ;
68
+
69
+ seq_printf (s , "%02d %d %64pb %pm\n" ,
70
+ tcam_idx , mac_addr -> state , mac_addr -> act_tcam ,
71
+ mac_addr -> value .addr8 );
72
+ seq_printf (s , " %pm\n" ,
73
+ mac_addr -> mask .addr8 );
74
+ tcam_idx ++ ;
75
+ }
76
+
77
+ return 0 ;
78
+ }
79
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_tce_tcam );
80
+
81
+ static int fbnic_dbg_act_tcam_show (struct seq_file * s , void * v )
82
+ {
83
+ struct fbnic_dev * fbd = s -> private ;
84
+ char hdr [80 ];
85
+ int i ;
86
+
87
+ /* Generate Header */
88
+ snprintf (hdr , sizeof (hdr ), "%3s %s %-55s %-4s %s\n" ,
89
+ "Idx" , "S" , "Value/Mask" , "RSS" , "Dest" );
90
+ seq_puts (s , hdr );
91
+ fbnic_dbg_desc_break (s , strnlen (hdr , sizeof (hdr )));
92
+
93
+ for (i = 0 ; i < FBNIC_RPC_TCAM_ACT_NUM_ENTRIES ; i ++ ) {
94
+ struct fbnic_act_tcam * act_tcam = & fbd -> act_tcam [i ];
95
+
96
+ seq_printf (s , "%02d %d %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %08x\n" ,
97
+ i , act_tcam -> state ,
98
+ act_tcam -> value .tcam [10 ], act_tcam -> value .tcam [9 ],
99
+ act_tcam -> value .tcam [8 ], act_tcam -> value .tcam [7 ],
100
+ act_tcam -> value .tcam [6 ], act_tcam -> value .tcam [5 ],
101
+ act_tcam -> value .tcam [4 ], act_tcam -> value .tcam [3 ],
102
+ act_tcam -> value .tcam [2 ], act_tcam -> value .tcam [1 ],
103
+ act_tcam -> value .tcam [0 ], act_tcam -> rss_en_mask ,
104
+ act_tcam -> dest );
105
+ seq_printf (s , " %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x\n" ,
106
+ act_tcam -> mask .tcam [10 ], act_tcam -> mask .tcam [9 ],
107
+ act_tcam -> mask .tcam [8 ], act_tcam -> mask .tcam [7 ],
108
+ act_tcam -> mask .tcam [6 ], act_tcam -> mask .tcam [5 ],
109
+ act_tcam -> mask .tcam [4 ], act_tcam -> mask .tcam [3 ],
110
+ act_tcam -> mask .tcam [2 ], act_tcam -> mask .tcam [1 ],
111
+ act_tcam -> mask .tcam [0 ]);
112
+ }
113
+
114
+ return 0 ;
115
+ }
116
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_act_tcam );
117
+
118
+ static int fbnic_dbg_ip_addr_show (struct seq_file * s ,
119
+ struct fbnic_ip_addr * ip_addr )
120
+ {
121
+ char hdr [80 ];
122
+ int i ;
123
+
124
+ /* Generate Header */
125
+ snprintf (hdr , sizeof (hdr ), "%3s %s %-17s %s %s\n" ,
126
+ "Idx" , "S" , "TCAM Bitmap" , "V" , "Addr/Mask" );
127
+ seq_puts (s , hdr );
128
+ fbnic_dbg_desc_break (s , strnlen (hdr , sizeof (hdr )));
129
+
130
+ for (i = 0 ; i < FBNIC_RPC_TCAM_IP_ADDR_NUM_ENTRIES ; i ++ , ip_addr ++ ) {
131
+ seq_printf (s , "%02d %d %64pb %d %pi6\n" ,
132
+ i , ip_addr -> state , ip_addr -> act_tcam ,
133
+ ip_addr -> version , & ip_addr -> value );
134
+ seq_printf (s , " %pi6\n" ,
135
+ & ip_addr -> mask );
136
+ }
137
+
138
+ return 0 ;
139
+ }
140
+
141
+ static int fbnic_dbg_ip_src_show (struct seq_file * s , void * v )
142
+ {
143
+ struct fbnic_dev * fbd = s -> private ;
144
+
145
+ return fbnic_dbg_ip_addr_show (s , fbd -> ip_src );
146
+ }
147
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_ip_src );
148
+
149
+ static int fbnic_dbg_ip_dst_show (struct seq_file * s , void * v )
150
+ {
151
+ struct fbnic_dev * fbd = s -> private ;
152
+
153
+ return fbnic_dbg_ip_addr_show (s , fbd -> ip_dst );
154
+ }
155
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_ip_dst );
156
+
157
+ static int fbnic_dbg_ipo_src_show (struct seq_file * s , void * v )
158
+ {
159
+ struct fbnic_dev * fbd = s -> private ;
160
+
161
+ return fbnic_dbg_ip_addr_show (s , fbd -> ipo_src );
162
+ }
163
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_ipo_src );
164
+
165
+ static int fbnic_dbg_ipo_dst_show (struct seq_file * s , void * v )
166
+ {
167
+ struct fbnic_dev * fbd = s -> private ;
168
+
169
+ return fbnic_dbg_ip_addr_show (s , fbd -> ipo_dst );
170
+ }
171
+ DEFINE_SHOW_ATTRIBUTE (fbnic_dbg_ipo_dst );
172
+
47
173
static int fbnic_dbg_pcie_stats_show (struct seq_file * s , void * v )
48
174
{
49
175
struct fbnic_dev * fbd = s -> private ;
@@ -84,6 +210,18 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
84
210
& fbnic_dbg_pcie_stats_fops );
85
211
debugfs_create_file ("mac_addr" , 0400 , fbd -> dbg_fbd , fbd ,
86
212
& fbnic_dbg_mac_addr_fops );
213
+ debugfs_create_file ("tce_tcam" , 0400 , fbd -> dbg_fbd , fbd ,
214
+ & fbnic_dbg_tce_tcam_fops );
215
+ debugfs_create_file ("act_tcam" , 0400 , fbd -> dbg_fbd , fbd ,
216
+ & fbnic_dbg_act_tcam_fops );
217
+ debugfs_create_file ("ip_src" , 0400 , fbd -> dbg_fbd , fbd ,
218
+ & fbnic_dbg_ip_src_fops );
219
+ debugfs_create_file ("ip_dst" , 0400 , fbd -> dbg_fbd , fbd ,
220
+ & fbnic_dbg_ip_dst_fops );
221
+ debugfs_create_file ("ipo_src" , 0400 , fbd -> dbg_fbd , fbd ,
222
+ & fbnic_dbg_ipo_src_fops );
223
+ debugfs_create_file ("ipo_dst" , 0400 , fbd -> dbg_fbd , fbd ,
224
+ & fbnic_dbg_ipo_dst_fops );
87
225
}
88
226
89
227
void fbnic_dbg_fbd_exit (struct fbnic_dev * fbd )
0 commit comments