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