xref: /openbmc/linux/fs/smb/client/trace.h (revision 71a15258f3c92eb1c4ae98bbfca9459f4723d5d3)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *   Copyright (C) 2018, Microsoft Corporation.
4  *
5  *   Author(s): Steve French <stfrench@microsoft.com>
6  *
7  * Please use this 3-part article as a reference for writing new tracepoints:
8  * https://lwn.net/Articles/379903/
9  */
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM cifs
12 
13 #if !defined(_CIFS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
14 #define _CIFS_TRACE_H
15 
16 #include <linux/tracepoint.h>
17 #include <linux/net.h>
18 #include <linux/inet.h>
19 
20 /*
21  * Specify enums for tracing information.
22  */
23 #define smb3_tcon_ref_traces					      \
24 	EM(netfs_trace_tcon_ref_dec_dfs_refer,		"DEC DfsRef") \
25 	EM(netfs_trace_tcon_ref_free,			"FRE       ") \
26 	EM(netfs_trace_tcon_ref_free_fail,		"FRE Fail  ") \
27 	EM(netfs_trace_tcon_ref_free_ipc,		"FRE Ipc   ") \
28 	EM(netfs_trace_tcon_ref_free_ipc_fail,		"FRE Ipc-F ") \
29 	EM(netfs_trace_tcon_ref_free_reconnect_server,	"FRE Reconn") \
30 	EM(netfs_trace_tcon_ref_get_cached_laundromat,	"GET Ch-Lau") \
31 	EM(netfs_trace_tcon_ref_get_cached_lease_break,	"GET Ch-Lea") \
32 	EM(netfs_trace_tcon_ref_get_cancelled_close,	"GET Cn-Cls") \
33 	EM(netfs_trace_tcon_ref_get_dfs_refer,		"GET DfsRef") \
34 	EM(netfs_trace_tcon_ref_get_find,		"GET Find  ") \
35 	EM(netfs_trace_tcon_ref_get_find_sess_tcon,	"GET FndSes") \
36 	EM(netfs_trace_tcon_ref_get_reconnect_server,	"GET Reconn") \
37 	EM(netfs_trace_tcon_ref_new,			"NEW       ") \
38 	EM(netfs_trace_tcon_ref_new_ipc,		"NEW Ipc   ") \
39 	EM(netfs_trace_tcon_ref_new_reconnect_server,	"NEW Reconn") \
40 	EM(netfs_trace_tcon_ref_put_cached_close,	"PUT Ch-Cls") \
41 	EM(netfs_trace_tcon_ref_put_cancelled_close,	"PUT Cn-Cls") \
42 	EM(netfs_trace_tcon_ref_put_cancelled_close_fid, "PUT Cn-Fid") \
43 	EM(netfs_trace_tcon_ref_put_cancelled_mid,	"PUT Cn-Mid") \
44 	EM(netfs_trace_tcon_ref_put_mnt_ctx,		"PUT MntCtx") \
45 	EM(netfs_trace_tcon_ref_put_reconnect_server,	"PUT Reconn") \
46 	EM(netfs_trace_tcon_ref_put_tlink,		"PUT Tlink ") \
47 	EM(netfs_trace_tcon_ref_see_cancelled_close,	"SEE Cn-Cls") \
48 	EM(netfs_trace_tcon_ref_see_fscache_collision,	"SEE FV-CO!") \
49 	EM(netfs_trace_tcon_ref_see_fscache_okay,	"SEE FV-Ok ") \
50 	EM(netfs_trace_tcon_ref_see_fscache_relinq,	"SEE FV-Rlq") \
51 	E_(netfs_trace_tcon_ref_see_umount,		"SEE Umount")
52 
53 #undef EM
54 #undef E_
55 
56 /*
57  * Define those tracing enums.
58  */
59 #ifndef __SMB3_DECLARE_TRACE_ENUMS_ONCE_ONLY
60 #define __SMB3_DECLARE_TRACE_ENUMS_ONCE_ONLY
61 
62 #define EM(a, b) a,
63 #define E_(a, b) a
64 
65 enum smb3_tcon_ref_trace { smb3_tcon_ref_traces } __mode(byte);
66 
67 #undef EM
68 #undef E_
69 #endif
70 
71 /*
72  * Export enum symbols via userspace.
73  */
74 #define EM(a, b) TRACE_DEFINE_ENUM(a);
75 #define E_(a, b) TRACE_DEFINE_ENUM(a);
76 
77 smb3_tcon_ref_traces;
78 
79 #undef EM
80 #undef E_
81 
82 /*
83  * Now redefine the EM() and E_() macros to map the enums to the strings that
84  * will be printed in the output.
85  */
86 #define EM(a, b)	{ a, b },
87 #define E_(a, b)	{ a, b }
88 
89 /* For logging errors in read or write */
90 DECLARE_EVENT_CLASS(smb3_rw_err_class,
91 	TP_PROTO(unsigned int xid,
92 		__u64	fid,
93 		__u32	tid,
94 		__u64	sesid,
95 		__u64	offset,
96 		__u32	len,
97 		int	rc),
98 	TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
99 	TP_STRUCT__entry(
100 		__field(unsigned int, xid)
101 		__field(__u64, fid)
102 		__field(__u32, tid)
103 		__field(__u64, sesid)
104 		__field(__u64, offset)
105 		__field(__u32, len)
106 		__field(int, rc)
107 	),
108 	TP_fast_assign(
109 		__entry->xid = xid;
110 		__entry->fid = fid;
111 		__entry->tid = tid;
112 		__entry->sesid = sesid;
113 		__entry->offset = offset;
114 		__entry->len = len;
115 		__entry->rc = rc;
116 	),
117 	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
118 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
119 		__entry->offset, __entry->len, __entry->rc)
120 )
121 
122 #define DEFINE_SMB3_RW_ERR_EVENT(name)          \
123 DEFINE_EVENT(smb3_rw_err_class, smb3_##name,    \
124 	TP_PROTO(unsigned int xid,		\
125 		__u64	fid,			\
126 		__u32	tid,			\
127 		__u64	sesid,			\
128 		__u64	offset,			\
129 		__u32	len,			\
130 		int	rc),			\
131 	TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
132 
133 DEFINE_SMB3_RW_ERR_EVENT(write_err);
134 DEFINE_SMB3_RW_ERR_EVENT(read_err);
135 DEFINE_SMB3_RW_ERR_EVENT(query_dir_err);
136 DEFINE_SMB3_RW_ERR_EVENT(zero_err);
137 DEFINE_SMB3_RW_ERR_EVENT(falloc_err);
138 
139 
140 /* For logging successful read or write */
141 DECLARE_EVENT_CLASS(smb3_rw_done_class,
142 	TP_PROTO(unsigned int xid,
143 		__u64	fid,
144 		__u32	tid,
145 		__u64	sesid,
146 		__u64	offset,
147 		__u32	len),
148 	TP_ARGS(xid, fid, tid, sesid, offset, len),
149 	TP_STRUCT__entry(
150 		__field(unsigned int, xid)
151 		__field(__u64, fid)
152 		__field(__u32, tid)
153 		__field(__u64, sesid)
154 		__field(__u64, offset)
155 		__field(__u32, len)
156 	),
157 	TP_fast_assign(
158 		__entry->xid = xid;
159 		__entry->fid = fid;
160 		__entry->tid = tid;
161 		__entry->sesid = sesid;
162 		__entry->offset = offset;
163 		__entry->len = len;
164 	),
165 	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
166 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
167 		__entry->offset, __entry->len)
168 )
169 
170 #define DEFINE_SMB3_RW_DONE_EVENT(name)         \
171 DEFINE_EVENT(smb3_rw_done_class, smb3_##name,   \
172 	TP_PROTO(unsigned int xid,		\
173 		__u64	fid,			\
174 		__u32	tid,			\
175 		__u64	sesid,			\
176 		__u64	offset,			\
177 		__u32	len),			\
178 	TP_ARGS(xid, fid, tid, sesid, offset, len))
179 
180 DEFINE_SMB3_RW_DONE_EVENT(write_enter);
181 DEFINE_SMB3_RW_DONE_EVENT(read_enter);
182 DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter);
183 DEFINE_SMB3_RW_DONE_EVENT(zero_enter);
184 DEFINE_SMB3_RW_DONE_EVENT(falloc_enter);
185 DEFINE_SMB3_RW_DONE_EVENT(write_done);
186 DEFINE_SMB3_RW_DONE_EVENT(read_done);
187 DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
188 DEFINE_SMB3_RW_DONE_EVENT(zero_done);
189 DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
190 
191 /* For logging successful set EOF (truncate) */
192 DECLARE_EVENT_CLASS(smb3_eof_class,
193 	TP_PROTO(unsigned int xid,
194 		__u64	fid,
195 		__u32	tid,
196 		__u64	sesid,
197 		__u64	offset),
198 	TP_ARGS(xid, fid, tid, sesid, offset),
199 	TP_STRUCT__entry(
200 		__field(unsigned int, xid)
201 		__field(__u64, fid)
202 		__field(__u32, tid)
203 		__field(__u64, sesid)
204 		__field(__u64, offset)
205 	),
206 	TP_fast_assign(
207 		__entry->xid = xid;
208 		__entry->fid = fid;
209 		__entry->tid = tid;
210 		__entry->sesid = sesid;
211 		__entry->offset = offset;
212 	),
213 	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx",
214 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
215 		__entry->offset)
216 )
217 
218 #define DEFINE_SMB3_EOF_EVENT(name)         \
219 DEFINE_EVENT(smb3_eof_class, smb3_##name,   \
220 	TP_PROTO(unsigned int xid,		\
221 		__u64	fid,			\
222 		__u32	tid,			\
223 		__u64	sesid,			\
224 		__u64	offset),		\
225 	TP_ARGS(xid, fid, tid, sesid, offset))
226 
227 DEFINE_SMB3_EOF_EVENT(set_eof);
228 
229 /*
230  * For handle based calls other than read and write, and get/set info
231  */
232 DECLARE_EVENT_CLASS(smb3_fd_class,
233 	TP_PROTO(unsigned int xid,
234 		__u64	fid,
235 		__u32	tid,
236 		__u64	sesid),
237 	TP_ARGS(xid, fid, tid, sesid),
238 	TP_STRUCT__entry(
239 		__field(unsigned int, xid)
240 		__field(__u64, fid)
241 		__field(__u32, tid)
242 		__field(__u64, sesid)
243 	),
244 	TP_fast_assign(
245 		__entry->xid = xid;
246 		__entry->fid = fid;
247 		__entry->tid = tid;
248 		__entry->sesid = sesid;
249 	),
250 	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx",
251 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid)
252 )
253 
254 #define DEFINE_SMB3_FD_EVENT(name)          \
255 DEFINE_EVENT(smb3_fd_class, smb3_##name,    \
256 	TP_PROTO(unsigned int xid,		\
257 		__u64	fid,			\
258 		__u32	tid,			\
259 		__u64	sesid),			\
260 	TP_ARGS(xid, fid, tid, sesid))
261 
262 DEFINE_SMB3_FD_EVENT(flush_enter);
263 DEFINE_SMB3_FD_EVENT(flush_done);
264 DEFINE_SMB3_FD_EVENT(close_enter);
265 DEFINE_SMB3_FD_EVENT(close_done);
266 DEFINE_SMB3_FD_EVENT(oplock_not_found);
267 
268 DECLARE_EVENT_CLASS(smb3_fd_err_class,
269 	TP_PROTO(unsigned int xid,
270 		__u64	fid,
271 		__u32	tid,
272 		__u64	sesid,
273 		int	rc),
274 	TP_ARGS(xid, fid, tid, sesid, rc),
275 	TP_STRUCT__entry(
276 		__field(unsigned int, xid)
277 		__field(__u64, fid)
278 		__field(__u32, tid)
279 		__field(__u64, sesid)
280 		__field(int, rc)
281 	),
282 	TP_fast_assign(
283 		__entry->xid = xid;
284 		__entry->fid = fid;
285 		__entry->tid = tid;
286 		__entry->sesid = sesid;
287 		__entry->rc = rc;
288 	),
289 	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
290 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
291 		__entry->rc)
292 )
293 
294 #define DEFINE_SMB3_FD_ERR_EVENT(name)          \
295 DEFINE_EVENT(smb3_fd_err_class, smb3_##name,    \
296 	TP_PROTO(unsigned int xid,		\
297 		__u64	fid,			\
298 		__u32	tid,			\
299 		__u64	sesid,			\
300 		int	rc),			\
301 	TP_ARGS(xid, fid, tid, sesid, rc))
302 
303 DEFINE_SMB3_FD_ERR_EVENT(flush_err);
304 DEFINE_SMB3_FD_ERR_EVENT(lock_err);
305 DEFINE_SMB3_FD_ERR_EVENT(close_err);
306 
307 /*
308  * For handle based query/set info calls
309  */
310 DECLARE_EVENT_CLASS(smb3_inf_enter_class,
311 	TP_PROTO(unsigned int xid,
312 		__u64	fid,
313 		__u32	tid,
314 		__u64	sesid,
315 		__u8	infclass,
316 		__u32	type),
317 	TP_ARGS(xid, fid, tid, sesid, infclass, type),
318 	TP_STRUCT__entry(
319 		__field(unsigned int, xid)
320 		__field(__u64, fid)
321 		__field(__u32, tid)
322 		__field(__u64, sesid)
323 		__field(__u8, infclass)
324 		__field(__u32, type)
325 	),
326 	TP_fast_assign(
327 		__entry->xid = xid;
328 		__entry->fid = fid;
329 		__entry->tid = tid;
330 		__entry->sesid = sesid;
331 		__entry->infclass = infclass;
332 		__entry->type = type;
333 	),
334 	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
335 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
336 		__entry->infclass, __entry->type)
337 )
338 
339 #define DEFINE_SMB3_INF_ENTER_EVENT(name)          \
340 DEFINE_EVENT(smb3_inf_enter_class, smb3_##name,    \
341 	TP_PROTO(unsigned int xid,		\
342 		__u64	fid,			\
343 		__u32	tid,			\
344 		__u64	sesid,			\
345 		__u8	infclass,		\
346 		__u32	type),			\
347 	TP_ARGS(xid, fid, tid, sesid, infclass, type))
348 
349 DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
350 DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
351 DEFINE_SMB3_INF_ENTER_EVENT(notify_enter);
352 DEFINE_SMB3_INF_ENTER_EVENT(notify_done);
353 
354 DECLARE_EVENT_CLASS(smb3_inf_err_class,
355 	TP_PROTO(unsigned int xid,
356 		__u64	fid,
357 		__u32	tid,
358 		__u64	sesid,
359 		__u8	infclass,
360 		__u32	type,
361 		int	rc),
362 	TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
363 	TP_STRUCT__entry(
364 		__field(unsigned int, xid)
365 		__field(__u64, fid)
366 		__field(__u32, tid)
367 		__field(__u64, sesid)
368 		__field(__u8, infclass)
369 		__field(__u32, type)
370 		__field(int, rc)
371 	),
372 	TP_fast_assign(
373 		__entry->xid = xid;
374 		__entry->fid = fid;
375 		__entry->tid = tid;
376 		__entry->sesid = sesid;
377 		__entry->infclass = infclass;
378 		__entry->type = type;
379 		__entry->rc = rc;
380 	),
381 	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
382 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
383 		__entry->infclass, __entry->type, __entry->rc)
384 )
385 
386 #define DEFINE_SMB3_INF_ERR_EVENT(name)          \
387 DEFINE_EVENT(smb3_inf_err_class, smb3_##name,    \
388 	TP_PROTO(unsigned int xid,		\
389 		__u64	fid,			\
390 		__u32	tid,			\
391 		__u64	sesid,			\
392 		__u8	infclass,		\
393 		__u32	type,			\
394 		int	rc),			\
395 	TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
396 
397 DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
398 DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
399 DEFINE_SMB3_INF_ERR_EVENT(notify_err);
400 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
401 
402 DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
403 	TP_PROTO(unsigned int xid,
404 		__u32	tid,
405 		__u64	sesid,
406 		const char *full_path),
407 	TP_ARGS(xid, tid, sesid, full_path),
408 	TP_STRUCT__entry(
409 		__field(unsigned int, xid)
410 		__field(__u32, tid)
411 		__field(__u64, sesid)
412 		__string(path, full_path)
413 	),
414 	TP_fast_assign(
415 		__entry->xid = xid;
416 		__entry->tid = tid;
417 		__entry->sesid = sesid;
418 		__assign_str(path, full_path);
419 	),
420 	TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
421 		__entry->xid, __entry->sesid, __entry->tid,
422 		__get_str(path))
423 )
424 
425 #define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name)     \
426 DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name,    \
427 	TP_PROTO(unsigned int xid,		\
428 		__u32	tid,			\
429 		__u64	sesid,			\
430 		const char *full_path),		\
431 	TP_ARGS(xid, tid, sesid, full_path))
432 
433 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
434 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter);
435 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
436 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
437 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
438 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
439 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
440 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_reparse_compound_enter);
441 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(get_reparse_compound_enter);
442 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
443 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
444 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter);
445 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mknod_enter);
446 
447 DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
448 	TP_PROTO(unsigned int xid,
449 		__u32	tid,
450 		__u64	sesid),
451 	TP_ARGS(xid, tid, sesid),
452 	TP_STRUCT__entry(
453 		__field(unsigned int, xid)
454 		__field(__u32, tid)
455 		__field(__u64, sesid)
456 	),
457 	TP_fast_assign(
458 		__entry->xid = xid;
459 		__entry->tid = tid;
460 		__entry->sesid = sesid;
461 	),
462 	TP_printk("xid=%u sid=0x%llx tid=0x%x",
463 		__entry->xid, __entry->sesid, __entry->tid)
464 )
465 
466 #define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name)     \
467 DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name,    \
468 	TP_PROTO(unsigned int xid,		\
469 		__u32	tid,			\
470 		__u64	sesid),			\
471 	TP_ARGS(xid, tid, sesid))
472 
473 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
474 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done);
475 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
476 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
477 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
478 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
479 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
480 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_reparse_compound_done);
481 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(get_reparse_compound_done);
482 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_wsl_ea_compound_done);
483 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
484 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
485 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done);
486 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mknod_done);
487 
488 DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
489 	TP_PROTO(unsigned int xid,
490 		__u32	tid,
491 		__u64	sesid,
492 		int	rc),
493 	TP_ARGS(xid, tid, sesid, rc),
494 	TP_STRUCT__entry(
495 		__field(unsigned int, xid)
496 		__field(__u32, tid)
497 		__field(__u64, sesid)
498 		__field(int, rc)
499 	),
500 	TP_fast_assign(
501 		__entry->xid = xid;
502 		__entry->tid = tid;
503 		__entry->sesid = sesid;
504 		__entry->rc = rc;
505 	),
506 	TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
507 		__entry->xid, __entry->sesid, __entry->tid,
508 		__entry->rc)
509 )
510 
511 #define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name)     \
512 DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name,    \
513 	TP_PROTO(unsigned int xid,		\
514 		__u32	tid,			\
515 		__u64	sesid,			\
516 		int rc),			\
517 	TP_ARGS(xid, tid, sesid, rc))
518 
519 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
520 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err);
521 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
522 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
523 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
524 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
525 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
526 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_reparse_compound_err);
527 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(get_reparse_compound_err);
528 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_wsl_ea_compound_err);
529 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
530 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
531 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err);
532 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mknod_err);
533 
534 /*
535  * For logging SMB3 Status code and Command for responses which return errors
536  */
537 DECLARE_EVENT_CLASS(smb3_cmd_err_class,
538 	TP_PROTO(__u32	tid,
539 		__u64	sesid,
540 		__u16	cmd,
541 		__u64	mid,
542 		__u32	status,
543 		int	rc),
544 	TP_ARGS(tid, sesid, cmd, mid, status, rc),
545 	TP_STRUCT__entry(
546 		__field(__u32, tid)
547 		__field(__u64, sesid)
548 		__field(__u16, cmd)
549 		__field(__u64, mid)
550 		__field(__u32, status)
551 		__field(int, rc)
552 	),
553 	TP_fast_assign(
554 		__entry->tid = tid;
555 		__entry->sesid = sesid;
556 		__entry->cmd = cmd;
557 		__entry->mid = mid;
558 		__entry->status = status;
559 		__entry->rc = rc;
560 	),
561 	TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
562 		__entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
563 		__entry->status, __entry->rc)
564 )
565 
566 #define DEFINE_SMB3_CMD_ERR_EVENT(name)          \
567 DEFINE_EVENT(smb3_cmd_err_class, smb3_##name,    \
568 	TP_PROTO(__u32	tid,			\
569 		__u64	sesid,			\
570 		__u16	cmd,			\
571 		__u64	mid,			\
572 		__u32	status,			\
573 		int	rc),			\
574 	TP_ARGS(tid, sesid, cmd, mid, status, rc))
575 
576 DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
577 
578 DECLARE_EVENT_CLASS(smb3_cmd_done_class,
579 	TP_PROTO(__u32	tid,
580 		__u64	sesid,
581 		__u16	cmd,
582 		__u64	mid),
583 	TP_ARGS(tid, sesid, cmd, mid),
584 	TP_STRUCT__entry(
585 		__field(__u32, tid)
586 		__field(__u64, sesid)
587 		__field(__u16, cmd)
588 		__field(__u64, mid)
589 	),
590 	TP_fast_assign(
591 		__entry->tid = tid;
592 		__entry->sesid = sesid;
593 		__entry->cmd = cmd;
594 		__entry->mid = mid;
595 	),
596 	TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
597 		__entry->sesid, __entry->tid,
598 		__entry->cmd, __entry->mid)
599 )
600 
601 #define DEFINE_SMB3_CMD_DONE_EVENT(name)          \
602 DEFINE_EVENT(smb3_cmd_done_class, smb3_##name,    \
603 	TP_PROTO(__u32	tid,			\
604 		__u64	sesid,			\
605 		__u16	cmd,			\
606 		__u64	mid),			\
607 	TP_ARGS(tid, sesid, cmd, mid))
608 
609 DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
610 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
611 DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
612 
613 DECLARE_EVENT_CLASS(smb3_mid_class,
614 	TP_PROTO(__u16	cmd,
615 		__u64	mid,
616 		__u32	pid,
617 		unsigned long when_sent,
618 		unsigned long when_received),
619 	TP_ARGS(cmd, mid, pid, when_sent, when_received),
620 	TP_STRUCT__entry(
621 		__field(__u16, cmd)
622 		__field(__u64, mid)
623 		__field(__u32, pid)
624 		__field(unsigned long, when_sent)
625 		__field(unsigned long, when_received)
626 	),
627 	TP_fast_assign(
628 		__entry->cmd = cmd;
629 		__entry->mid = mid;
630 		__entry->pid = pid;
631 		__entry->when_sent = when_sent;
632 		__entry->when_received = when_received;
633 	),
634 	TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
635 		__entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
636 		__entry->when_received)
637 )
638 
639 #define DEFINE_SMB3_MID_EVENT(name)          \
640 DEFINE_EVENT(smb3_mid_class, smb3_##name,    \
641 	TP_PROTO(__u16	cmd,			\
642 		__u64	mid,			\
643 		__u32	pid,			\
644 		unsigned long when_sent,	\
645 		unsigned long when_received),	\
646 	TP_ARGS(cmd, mid, pid, when_sent, when_received))
647 
648 DEFINE_SMB3_MID_EVENT(slow_rsp);
649 
650 DECLARE_EVENT_CLASS(smb3_exit_err_class,
651 	TP_PROTO(unsigned int xid,
652 		const char *func_name,
653 		int	rc),
654 	TP_ARGS(xid, func_name, rc),
655 	TP_STRUCT__entry(
656 		__field(unsigned int, xid)
657 		__string(func_name, func_name)
658 		__field(int, rc)
659 	),
660 	TP_fast_assign(
661 		__entry->xid = xid;
662 		__assign_str(func_name, func_name);
663 		__entry->rc = rc;
664 	),
665 	TP_printk("\t%s: xid=%u rc=%d",
666 		__get_str(func_name), __entry->xid, __entry->rc)
667 )
668 
669 #define DEFINE_SMB3_EXIT_ERR_EVENT(name)          \
670 DEFINE_EVENT(smb3_exit_err_class, smb3_##name,    \
671 	TP_PROTO(unsigned int xid,		\
672 		const char *func_name,		\
673 		int	rc),			\
674 	TP_ARGS(xid, func_name, rc))
675 
676 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
677 
678 
679 DECLARE_EVENT_CLASS(smb3_sync_err_class,
680 	TP_PROTO(unsigned long ino,
681 		int	rc),
682 	TP_ARGS(ino, rc),
683 	TP_STRUCT__entry(
684 		__field(unsigned long, ino)
685 		__field(int, rc)
686 	),
687 	TP_fast_assign(
688 		__entry->ino = ino;
689 		__entry->rc = rc;
690 	),
691 	TP_printk("\tino=%lu rc=%d",
692 		__entry->ino, __entry->rc)
693 )
694 
695 #define DEFINE_SMB3_SYNC_ERR_EVENT(name)          \
696 DEFINE_EVENT(smb3_sync_err_class, cifs_##name,    \
697 	TP_PROTO(unsigned long ino,		\
698 		int	rc),			\
699 	TP_ARGS(ino, rc))
700 
701 DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
702 DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
703 
704 
705 DECLARE_EVENT_CLASS(smb3_enter_exit_class,
706 	TP_PROTO(unsigned int xid,
707 		const char *func_name),
708 	TP_ARGS(xid, func_name),
709 	TP_STRUCT__entry(
710 		__field(unsigned int, xid)
711 		__string(func_name, func_name)
712 	),
713 	TP_fast_assign(
714 		__entry->xid = xid;
715 		__assign_str(func_name, func_name);
716 	),
717 	TP_printk("\t%s: xid=%u",
718 		__get_str(func_name), __entry->xid)
719 )
720 
721 #define DEFINE_SMB3_ENTER_EXIT_EVENT(name)        \
722 DEFINE_EVENT(smb3_enter_exit_class, smb3_##name,  \
723 	TP_PROTO(unsigned int xid,		\
724 		const char *func_name),		\
725 	TP_ARGS(xid, func_name))
726 
727 DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
728 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
729 
730 /*
731  * For SMB2/SMB3 tree connect
732  */
733 
734 DECLARE_EVENT_CLASS(smb3_tcon_class,
735 	TP_PROTO(unsigned int xid,
736 		__u32	tid,
737 		__u64	sesid,
738 		const char *unc_name,
739 		int	rc),
740 	TP_ARGS(xid, tid, sesid, unc_name, rc),
741 	TP_STRUCT__entry(
742 		__field(unsigned int, xid)
743 		__field(__u32, tid)
744 		__field(__u64, sesid)
745 		__string(name, unc_name)
746 		__field(int, rc)
747 	),
748 	TP_fast_assign(
749 		__entry->xid = xid;
750 		__entry->tid = tid;
751 		__entry->sesid = sesid;
752 		__assign_str(name, unc_name);
753 		__entry->rc = rc;
754 	),
755 	TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
756 		__entry->xid, __entry->sesid, __entry->tid,
757 		__get_str(name), __entry->rc)
758 )
759 
760 #define DEFINE_SMB3_TCON_EVENT(name)          \
761 DEFINE_EVENT(smb3_tcon_class, smb3_##name,    \
762 	TP_PROTO(unsigned int xid,		\
763 		__u32	tid,			\
764 		__u64	sesid,			\
765 		const char *unc_name,		\
766 		int	rc),			\
767 	TP_ARGS(xid, tid, sesid, unc_name, rc))
768 
769 DEFINE_SMB3_TCON_EVENT(tcon);
770 DEFINE_SMB3_TCON_EVENT(qfs_done);
771 
772 /*
773  * For smb2/smb3 open (including create and mkdir) calls
774  */
775 
776 DECLARE_EVENT_CLASS(smb3_open_enter_class,
777 	TP_PROTO(unsigned int xid,
778 		__u32	tid,
779 		__u64	sesid,
780 		const char *full_path,
781 		int	create_options,
782 		int	desired_access),
783 	TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access),
784 	TP_STRUCT__entry(
785 		__field(unsigned int, xid)
786 		__field(__u32, tid)
787 		__field(__u64, sesid)
788 		__string(path, full_path)
789 		__field(int, create_options)
790 		__field(int, desired_access)
791 	),
792 	TP_fast_assign(
793 		__entry->xid = xid;
794 		__entry->tid = tid;
795 		__entry->sesid = sesid;
796 		__assign_str(path, full_path);
797 		__entry->create_options = create_options;
798 		__entry->desired_access = desired_access;
799 	),
800 	TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x",
801 		__entry->xid, __entry->sesid, __entry->tid, __get_str(path),
802 		__entry->create_options, __entry->desired_access)
803 )
804 
805 #define DEFINE_SMB3_OPEN_ENTER_EVENT(name)        \
806 DEFINE_EVENT(smb3_open_enter_class, smb3_##name,  \
807 	TP_PROTO(unsigned int xid,		\
808 		__u32	tid,			\
809 		__u64	sesid,			\
810 		const char *full_path,		\
811 		int	create_options,		\
812 		int	desired_access),	\
813 	TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access))
814 
815 DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
816 DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
817 
818 DECLARE_EVENT_CLASS(smb3_open_err_class,
819 	TP_PROTO(unsigned int xid,
820 		__u32	tid,
821 		__u64	sesid,
822 		int	create_options,
823 		int	desired_access,
824 		int	rc),
825 	TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
826 	TP_STRUCT__entry(
827 		__field(unsigned int, xid)
828 		__field(__u32, tid)
829 		__field(__u64, sesid)
830 		__field(int,   create_options)
831 		__field(int, desired_access)
832 		__field(int, rc)
833 	),
834 	TP_fast_assign(
835 		__entry->xid = xid;
836 		__entry->tid = tid;
837 		__entry->sesid = sesid;
838 		__entry->create_options = create_options;
839 		__entry->desired_access = desired_access;
840 		__entry->rc = rc;
841 	),
842 	TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
843 		__entry->xid, __entry->sesid, __entry->tid,
844 		__entry->create_options, __entry->desired_access, __entry->rc)
845 )
846 
847 #define DEFINE_SMB3_OPEN_ERR_EVENT(name)          \
848 DEFINE_EVENT(smb3_open_err_class, smb3_##name,    \
849 	TP_PROTO(unsigned int xid,		\
850 		__u32	tid,			\
851 		__u64	sesid,			\
852 		int	create_options,		\
853 		int	desired_access,		\
854 		int	rc),			\
855 	TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
856 
857 DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
858 DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
859 
860 DECLARE_EVENT_CLASS(smb3_open_done_class,
861 	TP_PROTO(unsigned int xid,
862 		__u64	fid,
863 		__u32	tid,
864 		__u64	sesid,
865 		int	create_options,
866 		int	desired_access),
867 	TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
868 	TP_STRUCT__entry(
869 		__field(unsigned int, xid)
870 		__field(__u64, fid)
871 		__field(__u32, tid)
872 		__field(__u64, sesid)
873 		__field(int, create_options)
874 		__field(int, desired_access)
875 	),
876 	TP_fast_assign(
877 		__entry->xid = xid;
878 		__entry->fid = fid;
879 		__entry->tid = tid;
880 		__entry->sesid = sesid;
881 		__entry->create_options = create_options;
882 		__entry->desired_access = desired_access;
883 	),
884 	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
885 		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
886 		__entry->create_options, __entry->desired_access)
887 )
888 
889 #define DEFINE_SMB3_OPEN_DONE_EVENT(name)        \
890 DEFINE_EVENT(smb3_open_done_class, smb3_##name,  \
891 	TP_PROTO(unsigned int xid,		\
892 		__u64	fid,			\
893 		__u32	tid,			\
894 		__u64	sesid,			\
895 		int	create_options,		\
896 		int	desired_access),	\
897 	TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
898 
899 DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
900 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
901 
902 
903 DECLARE_EVENT_CLASS(smb3_lease_done_class,
904 	TP_PROTO(__u32	lease_state,
905 		__u32	tid,
906 		__u64	sesid,
907 		__u64	lease_key_low,
908 		__u64	lease_key_high),
909 	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
910 	TP_STRUCT__entry(
911 		__field(__u32, lease_state)
912 		__field(__u32, tid)
913 		__field(__u64, sesid)
914 		__field(__u64, lease_key_low)
915 		__field(__u64, lease_key_high)
916 	),
917 	TP_fast_assign(
918 		__entry->lease_state = lease_state;
919 		__entry->tid = tid;
920 		__entry->sesid = sesid;
921 		__entry->lease_key_low = lease_key_low;
922 		__entry->lease_key_high = lease_key_high;
923 	),
924 	TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
925 		__entry->sesid, __entry->tid, __entry->lease_key_high,
926 		__entry->lease_key_low, __entry->lease_state)
927 )
928 
929 #define DEFINE_SMB3_LEASE_DONE_EVENT(name)        \
930 DEFINE_EVENT(smb3_lease_done_class, smb3_##name,  \
931 	TP_PROTO(__u32	lease_state,		\
932 		__u32	tid,			\
933 		__u64	sesid,			\
934 		__u64	lease_key_low,		\
935 		__u64	lease_key_high),	\
936 	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
937 
938 DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
939 DEFINE_SMB3_LEASE_DONE_EVENT(lease_not_found);
940 
941 DECLARE_EVENT_CLASS(smb3_lease_err_class,
942 	TP_PROTO(__u32	lease_state,
943 		__u32	tid,
944 		__u64	sesid,
945 		__u64	lease_key_low,
946 		__u64	lease_key_high,
947 		int	rc),
948 	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
949 	TP_STRUCT__entry(
950 		__field(__u32, lease_state)
951 		__field(__u32, tid)
952 		__field(__u64, sesid)
953 		__field(__u64, lease_key_low)
954 		__field(__u64, lease_key_high)
955 		__field(int, rc)
956 	),
957 	TP_fast_assign(
958 		__entry->lease_state = lease_state;
959 		__entry->tid = tid;
960 		__entry->sesid = sesid;
961 		__entry->lease_key_low = lease_key_low;
962 		__entry->lease_key_high = lease_key_high;
963 		__entry->rc = rc;
964 	),
965 	TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
966 		__entry->sesid, __entry->tid, __entry->lease_key_high,
967 		__entry->lease_key_low, __entry->lease_state, __entry->rc)
968 )
969 
970 #define DEFINE_SMB3_LEASE_ERR_EVENT(name)        \
971 DEFINE_EVENT(smb3_lease_err_class, smb3_##name,  \
972 	TP_PROTO(__u32	lease_state,		\
973 		__u32	tid,			\
974 		__u64	sesid,			\
975 		__u64	lease_key_low,		\
976 		__u64	lease_key_high,		\
977 		int	rc),			\
978 	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
979 
980 DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
981 
982 DECLARE_EVENT_CLASS(smb3_connect_class,
983 	TP_PROTO(char *hostname,
984 		__u64 conn_id,
985 		const struct __kernel_sockaddr_storage *dst_addr),
986 	TP_ARGS(hostname, conn_id, dst_addr),
987 	TP_STRUCT__entry(
988 		__string(hostname, hostname)
989 		__field(__u64, conn_id)
990 		__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
991 	),
992 	TP_fast_assign(
993 		struct sockaddr_storage *pss = NULL;
994 
995 		__entry->conn_id = conn_id;
996 		pss = (struct sockaddr_storage *)__entry->dst_addr;
997 		*pss = *dst_addr;
998 		__assign_str(hostname, hostname);
999 	),
1000 	TP_printk("conn_id=0x%llx server=%s addr=%pISpsfc",
1001 		__entry->conn_id,
1002 		__get_str(hostname),
1003 		__entry->dst_addr)
1004 )
1005 
1006 #define DEFINE_SMB3_CONNECT_EVENT(name)        \
1007 DEFINE_EVENT(smb3_connect_class, smb3_##name,  \
1008 	TP_PROTO(char *hostname,		\
1009 		__u64 conn_id,			\
1010 		const struct __kernel_sockaddr_storage *addr),	\
1011 	TP_ARGS(hostname, conn_id, addr))
1012 
1013 DEFINE_SMB3_CONNECT_EVENT(connect_done);
1014 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done);
1015 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err);
1016 
1017 DECLARE_EVENT_CLASS(smb3_connect_err_class,
1018 	TP_PROTO(char *hostname, __u64 conn_id,
1019 		const struct __kernel_sockaddr_storage *dst_addr, int rc),
1020 	TP_ARGS(hostname, conn_id, dst_addr, rc),
1021 	TP_STRUCT__entry(
1022 		__string(hostname, hostname)
1023 		__field(__u64, conn_id)
1024 		__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
1025 		__field(int, rc)
1026 	),
1027 	TP_fast_assign(
1028 		struct sockaddr_storage *pss = NULL;
1029 
1030 		__entry->conn_id = conn_id;
1031 		__entry->rc = rc;
1032 		pss = (struct sockaddr_storage *)__entry->dst_addr;
1033 		*pss = *dst_addr;
1034 		__assign_str(hostname, hostname);
1035 	),
1036 	TP_printk("rc=%d conn_id=0x%llx server=%s addr=%pISpsfc",
1037 		__entry->rc,
1038 		__entry->conn_id,
1039 		__get_str(hostname),
1040 		__entry->dst_addr)
1041 )
1042 
1043 #define DEFINE_SMB3_CONNECT_ERR_EVENT(name)        \
1044 DEFINE_EVENT(smb3_connect_err_class, smb3_##name,  \
1045 	TP_PROTO(char *hostname,		\
1046 		__u64 conn_id,			\
1047 		const struct __kernel_sockaddr_storage *addr,	\
1048 		int rc),			\
1049 	TP_ARGS(hostname, conn_id, addr, rc))
1050 
1051 DEFINE_SMB3_CONNECT_ERR_EVENT(connect_err);
1052 
1053 DECLARE_EVENT_CLASS(smb3_reconnect_class,
1054 	TP_PROTO(__u64	currmid,
1055 		__u64 conn_id,
1056 		char *hostname),
1057 	TP_ARGS(currmid, conn_id, hostname),
1058 	TP_STRUCT__entry(
1059 		__field(__u64, currmid)
1060 		__field(__u64, conn_id)
1061 		__string(hostname, hostname)
1062 	),
1063 	TP_fast_assign(
1064 		__entry->currmid = currmid;
1065 		__entry->conn_id = conn_id;
1066 		__assign_str(hostname, hostname);
1067 	),
1068 	TP_printk("conn_id=0x%llx server=%s current_mid=%llu",
1069 		__entry->conn_id,
1070 		__get_str(hostname),
1071 		__entry->currmid)
1072 )
1073 
1074 #define DEFINE_SMB3_RECONNECT_EVENT(name)        \
1075 DEFINE_EVENT(smb3_reconnect_class, smb3_##name,  \
1076 	TP_PROTO(__u64	currmid,		\
1077 		__u64 conn_id,			\
1078 		char *hostname),				\
1079 	TP_ARGS(currmid, conn_id, hostname))
1080 
1081 DEFINE_SMB3_RECONNECT_EVENT(reconnect);
1082 DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
1083 
1084 DECLARE_EVENT_CLASS(smb3_ses_class,
1085 	TP_PROTO(__u64	sesid),
1086 	TP_ARGS(sesid),
1087 	TP_STRUCT__entry(
1088 		__field(__u64, sesid)
1089 	),
1090 	TP_fast_assign(
1091 		__entry->sesid = sesid;
1092 	),
1093 	TP_printk("sid=0x%llx",
1094 		__entry->sesid)
1095 )
1096 
1097 #define DEFINE_SMB3_SES_EVENT(name)        \
1098 DEFINE_EVENT(smb3_ses_class, smb3_##name,  \
1099 	TP_PROTO(__u64	sesid),				\
1100 	TP_ARGS(sesid))
1101 
1102 DEFINE_SMB3_SES_EVENT(ses_not_found);
1103 
1104 DECLARE_EVENT_CLASS(smb3_ioctl_class,
1105 	TP_PROTO(unsigned int xid,
1106 		__u64	fid,
1107 		unsigned int command),
1108 	TP_ARGS(xid, fid, command),
1109 	TP_STRUCT__entry(
1110 		__field(unsigned int, xid)
1111 		__field(__u64, fid)
1112 		__field(unsigned int, command)
1113 	),
1114 	TP_fast_assign(
1115 		__entry->xid = xid;
1116 		__entry->fid = fid;
1117 		__entry->command = command;
1118 	),
1119 	TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x",
1120 		__entry->xid, __entry->fid, __entry->command)
1121 )
1122 
1123 #define DEFINE_SMB3_IOCTL_EVENT(name)        \
1124 DEFINE_EVENT(smb3_ioctl_class, smb3_##name,  \
1125 	TP_PROTO(unsigned int xid,	     \
1126 		__u64 fid,		     \
1127 		unsigned int command),	     \
1128 	TP_ARGS(xid, fid, command))
1129 
1130 DEFINE_SMB3_IOCTL_EVENT(ioctl);
1131 
1132 
1133 
1134 
1135 
1136 DECLARE_EVENT_CLASS(smb3_credit_class,
1137 	TP_PROTO(__u64	currmid,
1138 		__u64 conn_id,
1139 		char *hostname,
1140 		int credits,
1141 		int credits_to_add,
1142 		int in_flight),
1143 	TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight),
1144 	TP_STRUCT__entry(
1145 		__field(__u64, currmid)
1146 		__field(__u64, conn_id)
1147 		__string(hostname, hostname)
1148 		__field(int, credits)
1149 		__field(int, credits_to_add)
1150 		__field(int, in_flight)
1151 	),
1152 	TP_fast_assign(
1153 		__entry->currmid = currmid;
1154 		__entry->conn_id = conn_id;
1155 		__assign_str(hostname, hostname);
1156 		__entry->credits = credits;
1157 		__entry->credits_to_add = credits_to_add;
1158 		__entry->in_flight = in_flight;
1159 	),
1160 	TP_printk("conn_id=0x%llx server=%s current_mid=%llu "
1161 			"credits=%d credit_change=%d in_flight=%d",
1162 		__entry->conn_id,
1163 		__get_str(hostname),
1164 		__entry->currmid,
1165 		__entry->credits,
1166 		__entry->credits_to_add,
1167 		__entry->in_flight)
1168 )
1169 
1170 #define DEFINE_SMB3_CREDIT_EVENT(name)        \
1171 DEFINE_EVENT(smb3_credit_class, smb3_##name,  \
1172 	TP_PROTO(__u64	currmid,		\
1173 		__u64 conn_id,			\
1174 		char *hostname,			\
1175 		int  credits,			\
1176 		int  credits_to_add,	\
1177 		int in_flight),			\
1178 	TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight))
1179 
1180 DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
1181 DEFINE_SMB3_CREDIT_EVENT(reconnect_detected);
1182 DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
1183 DEFINE_SMB3_CREDIT_EVENT(insufficient_credits);
1184 DEFINE_SMB3_CREDIT_EVENT(too_many_credits);
1185 DEFINE_SMB3_CREDIT_EVENT(add_credits);
1186 DEFINE_SMB3_CREDIT_EVENT(adj_credits);
1187 DEFINE_SMB3_CREDIT_EVENT(hdr_credits);
1188 DEFINE_SMB3_CREDIT_EVENT(nblk_credits);
1189 DEFINE_SMB3_CREDIT_EVENT(pend_credits);
1190 DEFINE_SMB3_CREDIT_EVENT(wait_credits);
1191 DEFINE_SMB3_CREDIT_EVENT(waitff_credits);
1192 DEFINE_SMB3_CREDIT_EVENT(overflow_credits);
1193 DEFINE_SMB3_CREDIT_EVENT(set_credits);
1194 
1195 
1196 TRACE_EVENT(smb3_tcon_ref,
1197 	    TP_PROTO(unsigned int tcon_debug_id, int ref,
1198 		     enum smb3_tcon_ref_trace trace),
1199 	    TP_ARGS(tcon_debug_id, ref, trace),
1200 	    TP_STRUCT__entry(
1201 		    __field(unsigned int,		tcon)
1202 		    __field(int,			ref)
1203 		    __field(enum smb3_tcon_ref_trace,	trace)
1204 			     ),
1205 	    TP_fast_assign(
1206 		    __entry->tcon	= tcon_debug_id;
1207 		    __entry->ref	= ref;
1208 		    __entry->trace	= trace;
1209 			   ),
1210 	    TP_printk("TC=%08x %s r=%u",
1211 		      __entry->tcon,
1212 		      __print_symbolic(__entry->trace, smb3_tcon_ref_traces),
1213 		      __entry->ref)
1214 	    );
1215 
1216 
1217 #undef EM
1218 #undef E_
1219 #endif /* _CIFS_TRACE_H */
1220 
1221 #undef TRACE_INCLUDE_PATH
1222 #define TRACE_INCLUDE_PATH .
1223 #define TRACE_INCLUDE_FILE trace
1224 #include <trace/define_trace.h>
1225