blob: c3d1a584f251e4b584ab26b1784a153d72aa6d0c [file] [log] [blame]
Steve Frencheccb4422018-05-17 21:16:55 -05001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2018, Microsoft Corporation.
4 *
5 * Author(s): Steve French <stfrench@microsoft.com>
Steve Frencheccb4422018-05-17 21:16:55 -05006 */
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM cifs
9
10#if !defined(_CIFS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
11#define _CIFS_TRACE_H
12
13#include <linux/tracepoint.h>
14
15/* For logging errors in read or write */
16DECLARE_EVENT_CLASS(smb3_rw_err_class,
17 TP_PROTO(unsigned int xid,
18 __u64 fid,
19 __u32 tid,
20 __u64 sesid,
21 __u64 offset,
22 __u32 len,
23 int rc),
24 TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
25 TP_STRUCT__entry(
26 __field(unsigned int, xid)
27 __field(__u64, fid)
28 __field(__u32, tid)
29 __field(__u64, sesid)
30 __field(__u64, offset)
31 __field(__u32, len)
32 __field(int, rc)
33 ),
34 TP_fast_assign(
35 __entry->xid = xid;
36 __entry->fid = fid;
37 __entry->tid = tid;
38 __entry->sesid = sesid;
39 __entry->offset = offset;
40 __entry->len = len;
41 __entry->rc = rc;
42 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -050043 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
44 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -050045 __entry->offset, __entry->len, __entry->rc)
46)
47
48#define DEFINE_SMB3_RW_ERR_EVENT(name) \
49DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \
50 TP_PROTO(unsigned int xid, \
51 __u64 fid, \
52 __u32 tid, \
53 __u64 sesid, \
54 __u64 offset, \
55 __u32 len, \
56 int rc), \
57 TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
58
59DEFINE_SMB3_RW_ERR_EVENT(write_err);
60DEFINE_SMB3_RW_ERR_EVENT(read_err);
Steve Frenchadb3b4e2019-02-25 13:51:11 -060061DEFINE_SMB3_RW_ERR_EVENT(query_dir_err);
Steve French779ede02019-03-13 01:41:49 -050062DEFINE_SMB3_RW_ERR_EVENT(zero_err);
63DEFINE_SMB3_RW_ERR_EVENT(falloc_err);
Steve Frencheccb4422018-05-17 21:16:55 -050064
65
66/* For logging successful read or write */
67DECLARE_EVENT_CLASS(smb3_rw_done_class,
68 TP_PROTO(unsigned int xid,
69 __u64 fid,
70 __u32 tid,
71 __u64 sesid,
72 __u64 offset,
73 __u32 len),
74 TP_ARGS(xid, fid, tid, sesid, offset, len),
75 TP_STRUCT__entry(
76 __field(unsigned int, xid)
77 __field(__u64, fid)
78 __field(__u32, tid)
79 __field(__u64, sesid)
80 __field(__u64, offset)
81 __field(__u32, len)
82 ),
83 TP_fast_assign(
84 __entry->xid = xid;
85 __entry->fid = fid;
86 __entry->tid = tid;
87 __entry->sesid = sesid;
88 __entry->offset = offset;
89 __entry->len = len;
90 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -050091 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
92 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -050093 __entry->offset, __entry->len)
94)
95
96#define DEFINE_SMB3_RW_DONE_EVENT(name) \
97DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \
98 TP_PROTO(unsigned int xid, \
99 __u64 fid, \
100 __u32 tid, \
101 __u64 sesid, \
102 __u64 offset, \
103 __u32 len), \
104 TP_ARGS(xid, fid, tid, sesid, offset, len))
105
Steve Frenchd323c2462019-02-25 00:52:43 -0600106DEFINE_SMB3_RW_DONE_EVENT(write_enter);
107DEFINE_SMB3_RW_DONE_EVENT(read_enter);
108DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter);
Steve French779ede02019-03-13 01:41:49 -0500109DEFINE_SMB3_RW_DONE_EVENT(zero_enter);
110DEFINE_SMB3_RW_DONE_EVENT(falloc_enter);
Steve Frencheccb4422018-05-17 21:16:55 -0500111DEFINE_SMB3_RW_DONE_EVENT(write_done);
112DEFINE_SMB3_RW_DONE_EVENT(read_done);
Steve Frenchadb3b4e2019-02-25 13:51:11 -0600113DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
Steve French779ede02019-03-13 01:41:49 -0500114DEFINE_SMB3_RW_DONE_EVENT(zero_done);
115DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
Steve Frencheccb4422018-05-17 21:16:55 -0500116
117/*
118 * For handle based calls other than read and write, and get/set info
119 */
Steve Frenchf90f9792019-09-03 18:35:42 -0500120DECLARE_EVENT_CLASS(smb3_fd_class,
121 TP_PROTO(unsigned int xid,
122 __u64 fid,
123 __u32 tid,
124 __u64 sesid),
125 TP_ARGS(xid, fid, tid, sesid),
126 TP_STRUCT__entry(
127 __field(unsigned int, xid)
128 __field(__u64, fid)
129 __field(__u32, tid)
130 __field(__u64, sesid)
131 ),
132 TP_fast_assign(
133 __entry->xid = xid;
134 __entry->fid = fid;
135 __entry->tid = tid;
136 __entry->sesid = sesid;
137 ),
138 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx",
139 __entry->xid, __entry->sesid, __entry->tid, __entry->fid)
140)
141
142#define DEFINE_SMB3_FD_EVENT(name) \
143DEFINE_EVENT(smb3_fd_class, smb3_##name, \
144 TP_PROTO(unsigned int xid, \
145 __u64 fid, \
146 __u32 tid, \
147 __u64 sesid), \
148 TP_ARGS(xid, fid, tid, sesid))
149
150DEFINE_SMB3_FD_EVENT(flush_enter);
151DEFINE_SMB3_FD_EVENT(flush_done);
152DEFINE_SMB3_FD_EVENT(close_enter);
153DEFINE_SMB3_FD_EVENT(close_done);
154
Steve Frencheccb4422018-05-17 21:16:55 -0500155DECLARE_EVENT_CLASS(smb3_fd_err_class,
156 TP_PROTO(unsigned int xid,
157 __u64 fid,
158 __u32 tid,
159 __u64 sesid,
160 int rc),
161 TP_ARGS(xid, fid, tid, sesid, rc),
162 TP_STRUCT__entry(
163 __field(unsigned int, xid)
164 __field(__u64, fid)
165 __field(__u32, tid)
166 __field(__u64, sesid)
167 __field(int, rc)
168 ),
169 TP_fast_assign(
170 __entry->xid = xid;
171 __entry->fid = fid;
172 __entry->tid = tid;
173 __entry->sesid = sesid;
174 __entry->rc = rc;
175 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500176 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
177 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -0500178 __entry->rc)
179)
180
181#define DEFINE_SMB3_FD_ERR_EVENT(name) \
182DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \
183 TP_PROTO(unsigned int xid, \
184 __u64 fid, \
185 __u32 tid, \
186 __u64 sesid, \
187 int rc), \
188 TP_ARGS(xid, fid, tid, sesid, rc))
189
190DEFINE_SMB3_FD_ERR_EVENT(flush_err);
191DEFINE_SMB3_FD_ERR_EVENT(lock_err);
192DEFINE_SMB3_FD_ERR_EVENT(close_err);
193
194/*
195 * For handle based query/set info calls
196 */
Steve Frenchd42043a2019-02-26 21:58:30 -0600197DECLARE_EVENT_CLASS(smb3_inf_enter_class,
198 TP_PROTO(unsigned int xid,
199 __u64 fid,
200 __u32 tid,
201 __u64 sesid,
202 __u8 infclass,
203 __u32 type),
204 TP_ARGS(xid, fid, tid, sesid, infclass, type),
205 TP_STRUCT__entry(
206 __field(unsigned int, xid)
207 __field(__u64, fid)
208 __field(__u32, tid)
209 __field(__u64, sesid)
210 __field(__u8, infclass)
211 __field(__u32, type)
212 ),
213 TP_fast_assign(
214 __entry->xid = xid;
215 __entry->fid = fid;
216 __entry->tid = tid;
217 __entry->sesid = sesid;
218 __entry->infclass = infclass;
219 __entry->type = type;
220 ),
221 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
222 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
223 __entry->infclass, __entry->type)
224)
225
226#define DEFINE_SMB3_INF_ENTER_EVENT(name) \
227DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \
228 TP_PROTO(unsigned int xid, \
229 __u64 fid, \
230 __u32 tid, \
231 __u64 sesid, \
232 __u8 infclass, \
233 __u32 type), \
234 TP_ARGS(xid, fid, tid, sesid, infclass, type))
235
236DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
237DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
Steve Frenchc3498182019-09-15 22:38:52 -0500238DEFINE_SMB3_INF_ENTER_EVENT(notify_enter);
239DEFINE_SMB3_INF_ENTER_EVENT(notify_done);
Steve Frenchd42043a2019-02-26 21:58:30 -0600240
Steve Frencheccb4422018-05-17 21:16:55 -0500241DECLARE_EVENT_CLASS(smb3_inf_err_class,
242 TP_PROTO(unsigned int xid,
243 __u64 fid,
244 __u32 tid,
245 __u64 sesid,
246 __u8 infclass,
247 __u32 type,
248 int rc),
249 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
250 TP_STRUCT__entry(
251 __field(unsigned int, xid)
252 __field(__u64, fid)
253 __field(__u32, tid)
254 __field(__u64, sesid)
255 __field(__u8, infclass)
256 __field(__u32, type)
257 __field(int, rc)
258 ),
259 TP_fast_assign(
260 __entry->xid = xid;
261 __entry->fid = fid;
262 __entry->tid = tid;
263 __entry->sesid = sesid;
264 __entry->infclass = infclass;
265 __entry->type = type;
266 __entry->rc = rc;
267 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500268 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
269 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -0500270 __entry->infclass, __entry->type, __entry->rc)
271)
272
273#define DEFINE_SMB3_INF_ERR_EVENT(name) \
274DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \
275 TP_PROTO(unsigned int xid, \
276 __u64 fid, \
277 __u32 tid, \
278 __u64 sesid, \
279 __u8 infclass, \
280 __u32 type, \
281 int rc), \
282 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
283
284DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
285DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
Steve Frenchc3498182019-09-15 22:38:52 -0500286DEFINE_SMB3_INF_ERR_EVENT(notify_err);
Steve Frencheccb4422018-05-17 21:16:55 -0500287DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
288
Steve French81915762019-03-13 00:02:47 -0500289DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
290 TP_PROTO(unsigned int xid,
291 __u32 tid,
292 __u64 sesid,
293 const char *full_path),
294 TP_ARGS(xid, tid, sesid, full_path),
295 TP_STRUCT__entry(
296 __field(unsigned int, xid)
297 __field(__u32, tid)
298 __field(__u64, sesid)
299 __string(path, full_path)
300 ),
301 TP_fast_assign(
302 __entry->xid = xid;
303 __entry->tid = tid;
304 __entry->sesid = sesid;
305 __assign_str(path, full_path);
306 ),
307 TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
308 __entry->xid, __entry->sesid, __entry->tid,
309 __get_str(path))
310)
311
312#define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name) \
313DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name, \
314 TP_PROTO(unsigned int xid, \
315 __u32 tid, \
316 __u64 sesid, \
317 const char *full_path), \
318 TP_ARGS(xid, tid, sesid, full_path))
319
320DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
Steve Frenche4bd7c42020-06-11 23:02:33 -0500321DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter);
Steve French81915762019-03-13 00:02:47 -0500322DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
323DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
324DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
325DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
326DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
327DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
328DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
329
330
331DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
332 TP_PROTO(unsigned int xid,
333 __u32 tid,
334 __u64 sesid),
335 TP_ARGS(xid, tid, sesid),
336 TP_STRUCT__entry(
337 __field(unsigned int, xid)
338 __field(__u32, tid)
339 __field(__u64, sesid)
340 ),
341 TP_fast_assign(
342 __entry->xid = xid;
343 __entry->tid = tid;
344 __entry->sesid = sesid;
345 ),
346 TP_printk("xid=%u sid=0x%llx tid=0x%x",
347 __entry->xid, __entry->sesid, __entry->tid)
348)
349
350#define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \
351DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \
352 TP_PROTO(unsigned int xid, \
353 __u32 tid, \
354 __u64 sesid), \
355 TP_ARGS(xid, tid, sesid))
356
357DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
Steve Frenche4bd7c42020-06-11 23:02:33 -0500358DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done);
Steve French81915762019-03-13 00:02:47 -0500359DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
360DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
361DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
362DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
363DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
364DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
365DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
366
367
368DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
369 TP_PROTO(unsigned int xid,
370 __u32 tid,
371 __u64 sesid,
372 int rc),
373 TP_ARGS(xid, tid, sesid, rc),
374 TP_STRUCT__entry(
375 __field(unsigned int, xid)
376 __field(__u32, tid)
377 __field(__u64, sesid)
378 __field(int, rc)
379 ),
380 TP_fast_assign(
381 __entry->xid = xid;
382 __entry->tid = tid;
383 __entry->sesid = sesid;
384 __entry->rc = rc;
385 ),
386 TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
387 __entry->xid, __entry->sesid, __entry->tid,
388 __entry->rc)
389)
390
391#define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \
392DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \
393 TP_PROTO(unsigned int xid, \
394 __u32 tid, \
395 __u64 sesid, \
396 int rc), \
397 TP_ARGS(xid, tid, sesid, rc))
398
399DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
Steve Frenche4bd7c42020-06-11 23:02:33 -0500400DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err);
Steve French81915762019-03-13 00:02:47 -0500401DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
402DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
403DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
404DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
405DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
406DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
407DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
408
Steve Frencheccb4422018-05-17 21:16:55 -0500409/*
410 * For logging SMB3 Status code and Command for responses which return errors
411 */
412DECLARE_EVENT_CLASS(smb3_cmd_err_class,
Steve Frenchd683bcd2018-05-19 02:28:53 -0500413 TP_PROTO(__u32 tid,
Steve Frencheccb4422018-05-17 21:16:55 -0500414 __u64 sesid,
415 __u16 cmd,
416 __u64 mid,
417 __u32 status,
418 int rc),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500419 TP_ARGS(tid, sesid, cmd, mid, status, rc),
Steve Frencheccb4422018-05-17 21:16:55 -0500420 TP_STRUCT__entry(
Steve Frencheccb4422018-05-17 21:16:55 -0500421 __field(__u32, tid)
422 __field(__u64, sesid)
423 __field(__u16, cmd)
424 __field(__u64, mid)
425 __field(__u32, status)
426 __field(int, rc)
427 ),
428 TP_fast_assign(
Steve Frencheccb4422018-05-17 21:16:55 -0500429 __entry->tid = tid;
430 __entry->sesid = sesid;
431 __entry->cmd = cmd;
432 __entry->mid = mid;
433 __entry->status = status;
434 __entry->rc = rc;
435 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500436 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
437 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
438 __entry->status, __entry->rc)
Steve Frencheccb4422018-05-17 21:16:55 -0500439)
440
441#define DEFINE_SMB3_CMD_ERR_EVENT(name) \
442DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500443 TP_PROTO(__u32 tid, \
Steve Frencheccb4422018-05-17 21:16:55 -0500444 __u64 sesid, \
445 __u16 cmd, \
446 __u64 mid, \
447 __u32 status, \
448 int rc), \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500449 TP_ARGS(tid, sesid, cmd, mid, status, rc))
Steve Frencheccb4422018-05-17 21:16:55 -0500450
451DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
452
453DECLARE_EVENT_CLASS(smb3_cmd_done_class,
Steve Frenchd683bcd2018-05-19 02:28:53 -0500454 TP_PROTO(__u32 tid,
Steve Frencheccb4422018-05-17 21:16:55 -0500455 __u64 sesid,
456 __u16 cmd,
457 __u64 mid),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500458 TP_ARGS(tid, sesid, cmd, mid),
Steve Frencheccb4422018-05-17 21:16:55 -0500459 TP_STRUCT__entry(
Steve Frencheccb4422018-05-17 21:16:55 -0500460 __field(__u32, tid)
461 __field(__u64, sesid)
462 __field(__u16, cmd)
463 __field(__u64, mid)
464 ),
465 TP_fast_assign(
Steve Frencheccb4422018-05-17 21:16:55 -0500466 __entry->tid = tid;
467 __entry->sesid = sesid;
468 __entry->cmd = cmd;
469 __entry->mid = mid;
470 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500471 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
472 __entry->sesid, __entry->tid,
Steve Frencheccb4422018-05-17 21:16:55 -0500473 __entry->cmd, __entry->mid)
474)
475
476#define DEFINE_SMB3_CMD_DONE_EVENT(name) \
477DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500478 TP_PROTO(__u32 tid, \
Steve Frencheccb4422018-05-17 21:16:55 -0500479 __u64 sesid, \
480 __u16 cmd, \
481 __u64 mid), \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500482 TP_ARGS(tid, sesid, cmd, mid))
Steve Frencheccb4422018-05-17 21:16:55 -0500483
Steve French53a3e0d2019-02-26 21:26:20 -0600484DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
Steve Frencheccb4422018-05-17 21:16:55 -0500485DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
Steve Frenche68a9322018-07-30 14:23:58 -0500486DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
Steve Frencheccb4422018-05-17 21:16:55 -0500487
Steve French020eec52018-08-01 16:38:07 -0500488DECLARE_EVENT_CLASS(smb3_mid_class,
489 TP_PROTO(__u16 cmd,
490 __u64 mid,
491 __u32 pid,
492 unsigned long when_sent,
493 unsigned long when_received),
494 TP_ARGS(cmd, mid, pid, when_sent, when_received),
495 TP_STRUCT__entry(
496 __field(__u16, cmd)
497 __field(__u64, mid)
498 __field(__u32, pid)
499 __field(unsigned long, when_sent)
500 __field(unsigned long, when_received)
501 ),
502 TP_fast_assign(
503 __entry->cmd = cmd;
504 __entry->mid = mid;
505 __entry->pid = pid;
506 __entry->when_sent = when_sent;
507 __entry->when_received = when_received;
508 ),
509 TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
510 __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
511 __entry->when_received)
512)
513
514#define DEFINE_SMB3_MID_EVENT(name) \
515DEFINE_EVENT(smb3_mid_class, smb3_##name, \
516 TP_PROTO(__u16 cmd, \
517 __u64 mid, \
518 __u32 pid, \
519 unsigned long when_sent, \
520 unsigned long when_received), \
521 TP_ARGS(cmd, mid, pid, when_sent, when_received))
522
523DEFINE_SMB3_MID_EVENT(slow_rsp);
524
Steve Frenchd683bcd2018-05-19 02:28:53 -0500525DECLARE_EVENT_CLASS(smb3_exit_err_class,
526 TP_PROTO(unsigned int xid,
527 const char *func_name,
528 int rc),
529 TP_ARGS(xid, func_name, rc),
530 TP_STRUCT__entry(
531 __field(unsigned int, xid)
532 __field(const char *, func_name)
533 __field(int, rc)
534 ),
535 TP_fast_assign(
536 __entry->xid = xid;
537 __entry->func_name = func_name;
538 __entry->rc = rc;
539 ),
540 TP_printk("\t%s: xid=%u rc=%d",
541 __entry->func_name, __entry->xid, __entry->rc)
542)
543
544#define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
545DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
546 TP_PROTO(unsigned int xid, \
547 const char *func_name, \
548 int rc), \
549 TP_ARGS(xid, func_name, rc))
550
551DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
552
Steve Frenchf2bf09e2020-02-05 18:22:37 -0600553
554DECLARE_EVENT_CLASS(smb3_sync_err_class,
555 TP_PROTO(unsigned long ino,
556 int rc),
557 TP_ARGS(ino, rc),
558 TP_STRUCT__entry(
559 __field(unsigned long, ino)
560 __field(int, rc)
561 ),
562 TP_fast_assign(
563 __entry->ino = ino;
564 __entry->rc = rc;
565 ),
566 TP_printk("\tino=%lu rc=%d",
567 __entry->ino, __entry->rc)
568)
569
570#define DEFINE_SMB3_SYNC_ERR_EVENT(name) \
571DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \
572 TP_PROTO(unsigned long ino, \
573 int rc), \
574 TP_ARGS(ino, rc))
575
576DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
577DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
578
579
Steve Frenchd683bcd2018-05-19 02:28:53 -0500580DECLARE_EVENT_CLASS(smb3_enter_exit_class,
581 TP_PROTO(unsigned int xid,
582 const char *func_name),
583 TP_ARGS(xid, func_name),
584 TP_STRUCT__entry(
585 __field(unsigned int, xid)
586 __field(const char *, func_name)
587 ),
588 TP_fast_assign(
589 __entry->xid = xid;
590 __entry->func_name = func_name;
591 ),
592 TP_printk("\t%s: xid=%u",
593 __entry->func_name, __entry->xid)
594)
595
596#define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
597DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \
598 TP_PROTO(unsigned int xid, \
599 const char *func_name), \
600 TP_ARGS(xid, func_name))
601
602DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
603DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
604
Steve French28d59362018-05-30 21:42:34 -0500605/*
Steve Frenchf8af49d2018-10-28 00:47:11 -0500606 * For SMB2/SMB3 tree connect
607 */
608
609DECLARE_EVENT_CLASS(smb3_tcon_class,
610 TP_PROTO(unsigned int xid,
611 __u32 tid,
612 __u64 sesid,
613 const char *unc_name,
614 int rc),
615 TP_ARGS(xid, tid, sesid, unc_name, rc),
616 TP_STRUCT__entry(
617 __field(unsigned int, xid)
618 __field(__u32, tid)
619 __field(__u64, sesid)
Paulo Alcantara (SUSE)68ddb492019-03-21 19:31:22 -0300620 __string(name, unc_name)
Steve Frenchf8af49d2018-10-28 00:47:11 -0500621 __field(int, rc)
622 ),
623 TP_fast_assign(
624 __entry->xid = xid;
625 __entry->tid = tid;
626 __entry->sesid = sesid;
Paulo Alcantara (SUSE)68ddb492019-03-21 19:31:22 -0300627 __assign_str(name, unc_name);
Steve Frenchf8af49d2018-10-28 00:47:11 -0500628 __entry->rc = rc;
629 ),
630 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
631 __entry->xid, __entry->sesid, __entry->tid,
Paulo Alcantara (SUSE)68ddb492019-03-21 19:31:22 -0300632 __get_str(name), __entry->rc)
Steve Frenchf8af49d2018-10-28 00:47:11 -0500633)
634
635#define DEFINE_SMB3_TCON_EVENT(name) \
636DEFINE_EVENT(smb3_tcon_class, smb3_##name, \
637 TP_PROTO(unsigned int xid, \
638 __u32 tid, \
639 __u64 sesid, \
640 const char *unc_name, \
641 int rc), \
642 TP_ARGS(xid, tid, sesid, unc_name, rc))
643
644DEFINE_SMB3_TCON_EVENT(tcon);
645
646
647/*
Steve Frenchefe2e9f2019-02-26 19:08:12 -0600648 * For smb2/smb3 open (including create and mkdir) calls
Steve French28d59362018-05-30 21:42:34 -0500649 */
Steve Frenchefe2e9f2019-02-26 19:08:12 -0600650
651DECLARE_EVENT_CLASS(smb3_open_enter_class,
652 TP_PROTO(unsigned int xid,
653 __u32 tid,
654 __u64 sesid,
655 int create_options,
656 int desired_access),
657 TP_ARGS(xid, tid, sesid, create_options, desired_access),
658 TP_STRUCT__entry(
659 __field(unsigned int, xid)
660 __field(__u32, tid)
661 __field(__u64, sesid)
662 __field(int, create_options)
663 __field(int, desired_access)
664 ),
665 TP_fast_assign(
666 __entry->xid = xid;
667 __entry->tid = tid;
668 __entry->sesid = sesid;
669 __entry->create_options = create_options;
670 __entry->desired_access = desired_access;
671 ),
672 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
673 __entry->xid, __entry->sesid, __entry->tid,
674 __entry->create_options, __entry->desired_access)
675)
676
677#define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \
678DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
679 TP_PROTO(unsigned int xid, \
680 __u32 tid, \
681 __u64 sesid, \
682 int create_options, \
683 int desired_access), \
684 TP_ARGS(xid, tid, sesid, create_options, desired_access))
685
686DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
687DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
688
Steve French28d59362018-05-30 21:42:34 -0500689DECLARE_EVENT_CLASS(smb3_open_err_class,
690 TP_PROTO(unsigned int xid,
691 __u32 tid,
692 __u64 sesid,
693 int create_options,
694 int desired_access,
695 int rc),
696 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
697 TP_STRUCT__entry(
698 __field(unsigned int, xid)
699 __field(__u32, tid)
700 __field(__u64, sesid)
701 __field(int, create_options)
702 __field(int, desired_access)
703 __field(int, rc)
704 ),
705 TP_fast_assign(
706 __entry->xid = xid;
707 __entry->tid = tid;
708 __entry->sesid = sesid;
709 __entry->create_options = create_options;
710 __entry->desired_access = desired_access;
711 __entry->rc = rc;
712 ),
713 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
714 __entry->xid, __entry->sesid, __entry->tid,
715 __entry->create_options, __entry->desired_access, __entry->rc)
716)
717
718#define DEFINE_SMB3_OPEN_ERR_EVENT(name) \
719DEFINE_EVENT(smb3_open_err_class, smb3_##name, \
720 TP_PROTO(unsigned int xid, \
721 __u32 tid, \
722 __u64 sesid, \
723 int create_options, \
724 int desired_access, \
725 int rc), \
726 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
727
728DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
Steve Frenchbea851b2018-06-14 21:56:32 -0500729DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
Steve French28d59362018-05-30 21:42:34 -0500730
731DECLARE_EVENT_CLASS(smb3_open_done_class,
732 TP_PROTO(unsigned int xid,
733 __u64 fid,
734 __u32 tid,
735 __u64 sesid,
736 int create_options,
737 int desired_access),
738 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
739 TP_STRUCT__entry(
740 __field(unsigned int, xid)
741 __field(__u64, fid)
742 __field(__u32, tid)
743 __field(__u64, sesid)
744 __field(int, create_options)
745 __field(int, desired_access)
746 ),
747 TP_fast_assign(
748 __entry->xid = xid;
749 __entry->fid = fid;
750 __entry->tid = tid;
751 __entry->sesid = sesid;
752 __entry->create_options = create_options;
753 __entry->desired_access = desired_access;
754 ),
755 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
756 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
757 __entry->create_options, __entry->desired_access)
758)
759
760#define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
761DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
762 TP_PROTO(unsigned int xid, \
763 __u64 fid, \
764 __u32 tid, \
765 __u64 sesid, \
766 int create_options, \
767 int desired_access), \
768 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
769
770DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
Steve Frenchbea851b2018-06-14 21:56:32 -0500771DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
Steve French28d59362018-05-30 21:42:34 -0500772
Steve French179e44d2018-09-28 19:44:23 -0500773
774DECLARE_EVENT_CLASS(smb3_lease_done_class,
775 TP_PROTO(__u32 lease_state,
776 __u32 tid,
777 __u64 sesid,
778 __u64 lease_key_low,
779 __u64 lease_key_high),
780 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
781 TP_STRUCT__entry(
782 __field(__u32, lease_state)
783 __field(__u32, tid)
784 __field(__u64, sesid)
785 __field(__u64, lease_key_low)
786 __field(__u64, lease_key_high)
787 ),
788 TP_fast_assign(
789 __entry->lease_state = lease_state;
790 __entry->tid = tid;
791 __entry->sesid = sesid;
792 __entry->lease_key_low = lease_key_low;
793 __entry->lease_key_high = lease_key_high;
794 ),
795 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
796 __entry->sesid, __entry->tid, __entry->lease_key_high,
797 __entry->lease_key_low, __entry->lease_state)
798)
799
800#define DEFINE_SMB3_LEASE_DONE_EVENT(name) \
801DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \
802 TP_PROTO(__u32 lease_state, \
803 __u32 tid, \
804 __u64 sesid, \
805 __u64 lease_key_low, \
806 __u64 lease_key_high), \
807 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
808
809DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
810
811DECLARE_EVENT_CLASS(smb3_lease_err_class,
812 TP_PROTO(__u32 lease_state,
813 __u32 tid,
814 __u64 sesid,
815 __u64 lease_key_low,
816 __u64 lease_key_high,
817 int rc),
818 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
819 TP_STRUCT__entry(
820 __field(__u32, lease_state)
821 __field(__u32, tid)
822 __field(__u64, sesid)
823 __field(__u64, lease_key_low)
824 __field(__u64, lease_key_high)
825 __field(int, rc)
826 ),
827 TP_fast_assign(
828 __entry->lease_state = lease_state;
829 __entry->tid = tid;
830 __entry->sesid = sesid;
831 __entry->lease_key_low = lease_key_low;
832 __entry->lease_key_high = lease_key_high;
833 __entry->rc = rc;
834 ),
835 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
836 __entry->sesid, __entry->tid, __entry->lease_key_high,
837 __entry->lease_key_low, __entry->lease_state, __entry->rc)
838)
839
840#define DEFINE_SMB3_LEASE_ERR_EVENT(name) \
841DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \
842 TP_PROTO(__u32 lease_state, \
843 __u32 tid, \
844 __u64 sesid, \
845 __u64 lease_key_low, \
846 __u64 lease_key_high, \
847 int rc), \
848 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
849
850DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
851
Steve Frenchbf1fdeb2018-07-30 19:23:09 -0500852DECLARE_EVENT_CLASS(smb3_reconnect_class,
853 TP_PROTO(__u64 currmid,
854 char *hostname),
855 TP_ARGS(currmid, hostname),
856 TP_STRUCT__entry(
857 __field(__u64, currmid)
858 __field(char *, hostname)
859 ),
860 TP_fast_assign(
861 __entry->currmid = currmid;
862 __entry->hostname = hostname;
863 ),
864 TP_printk("server=%s current_mid=0x%llx",
865 __entry->hostname,
866 __entry->currmid)
867)
868
869#define DEFINE_SMB3_RECONNECT_EVENT(name) \
870DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \
871 TP_PROTO(__u64 currmid, \
872 char *hostname), \
873 TP_ARGS(currmid, hostname))
874
875DEFINE_SMB3_RECONNECT_EVENT(reconnect);
876DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
877
Steve Frenchb340a4d2018-09-01 01:10:17 -0500878DECLARE_EVENT_CLASS(smb3_credit_class,
879 TP_PROTO(__u64 currmid,
880 char *hostname,
Steve French9eec21b2020-10-19 18:18:15 -0500881 int credits,
882 int credits_to_add),
883 TP_ARGS(currmid, hostname, credits, credits_to_add),
Steve Frenchb340a4d2018-09-01 01:10:17 -0500884 TP_STRUCT__entry(
885 __field(__u64, currmid)
886 __field(char *, hostname)
887 __field(int, credits)
Steve French9eec21b2020-10-19 18:18:15 -0500888 __field(int, credits_to_add)
Steve Frenchb340a4d2018-09-01 01:10:17 -0500889 ),
890 TP_fast_assign(
891 __entry->currmid = currmid;
892 __entry->hostname = hostname;
893 __entry->credits = credits;
Steve French9eec21b2020-10-19 18:18:15 -0500894 __entry->credits_to_add = credits_to_add;
Steve Frenchb340a4d2018-09-01 01:10:17 -0500895 ),
Steve French9eec21b2020-10-19 18:18:15 -0500896 TP_printk("server=%s current_mid=0x%llx credits=%d credits_to_add=%d",
Steve Frenchb340a4d2018-09-01 01:10:17 -0500897 __entry->hostname,
898 __entry->currmid,
Steve French9eec21b2020-10-19 18:18:15 -0500899 __entry->credits,
900 __entry->credits_to_add)
Steve Frenchb340a4d2018-09-01 01:10:17 -0500901)
902
903#define DEFINE_SMB3_CREDIT_EVENT(name) \
904DEFINE_EVENT(smb3_credit_class, smb3_##name, \
905 TP_PROTO(__u64 currmid, \
906 char *hostname, \
Steve French9eec21b2020-10-19 18:18:15 -0500907 int credits, \
908 int credits_to_add), \
909 TP_ARGS(currmid, hostname, credits, credits_to_add))
Steve Frenchb340a4d2018-09-01 01:10:17 -0500910
911DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
Shyam Prasad Ncd7b6992020-11-12 08:56:49 -0800912DEFINE_SMB3_CREDIT_EVENT(reconnect_detected);
Steve French7937ca92019-03-09 20:29:55 -0600913DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
Shyam Prasad Ncd7b6992020-11-12 08:56:49 -0800914DEFINE_SMB3_CREDIT_EVENT(insufficient_credits);
915DEFINE_SMB3_CREDIT_EVENT(too_many_credits);
Steve French9eec21b2020-10-19 18:18:15 -0500916DEFINE_SMB3_CREDIT_EVENT(add_credits);
Shyam Prasad Ncd7b6992020-11-12 08:56:49 -0800917DEFINE_SMB3_CREDIT_EVENT(set_credits);
Steve Frenchb340a4d2018-09-01 01:10:17 -0500918
Steve Frencheccb4422018-05-17 21:16:55 -0500919#endif /* _CIFS_TRACE_H */
920
921#undef TRACE_INCLUDE_PATH
922#define TRACE_INCLUDE_PATH .
923#define TRACE_INCLUDE_FILE trace
924#include <trace/define_trace.h>