blob: fa226de48ef38c0c0696aca767c69cc2ac8dbdd8 [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 */
120DECLARE_EVENT_CLASS(smb3_fd_err_class,
121 TP_PROTO(unsigned int xid,
122 __u64 fid,
123 __u32 tid,
124 __u64 sesid,
125 int rc),
126 TP_ARGS(xid, fid, tid, sesid, rc),
127 TP_STRUCT__entry(
128 __field(unsigned int, xid)
129 __field(__u64, fid)
130 __field(__u32, tid)
131 __field(__u64, sesid)
132 __field(int, rc)
133 ),
134 TP_fast_assign(
135 __entry->xid = xid;
136 __entry->fid = fid;
137 __entry->tid = tid;
138 __entry->sesid = sesid;
139 __entry->rc = rc;
140 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500141 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
142 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -0500143 __entry->rc)
144)
145
146#define DEFINE_SMB3_FD_ERR_EVENT(name) \
147DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \
148 TP_PROTO(unsigned int xid, \
149 __u64 fid, \
150 __u32 tid, \
151 __u64 sesid, \
152 int rc), \
153 TP_ARGS(xid, fid, tid, sesid, rc))
154
155DEFINE_SMB3_FD_ERR_EVENT(flush_err);
156DEFINE_SMB3_FD_ERR_EVENT(lock_err);
157DEFINE_SMB3_FD_ERR_EVENT(close_err);
158
159/*
160 * For handle based query/set info calls
161 */
Steve Frenchd42043a2019-02-26 21:58:30 -0600162DECLARE_EVENT_CLASS(smb3_inf_enter_class,
163 TP_PROTO(unsigned int xid,
164 __u64 fid,
165 __u32 tid,
166 __u64 sesid,
167 __u8 infclass,
168 __u32 type),
169 TP_ARGS(xid, fid, tid, sesid, infclass, type),
170 TP_STRUCT__entry(
171 __field(unsigned int, xid)
172 __field(__u64, fid)
173 __field(__u32, tid)
174 __field(__u64, sesid)
175 __field(__u8, infclass)
176 __field(__u32, type)
177 ),
178 TP_fast_assign(
179 __entry->xid = xid;
180 __entry->fid = fid;
181 __entry->tid = tid;
182 __entry->sesid = sesid;
183 __entry->infclass = infclass;
184 __entry->type = type;
185 ),
186 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
187 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
188 __entry->infclass, __entry->type)
189)
190
191#define DEFINE_SMB3_INF_ENTER_EVENT(name) \
192DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \
193 TP_PROTO(unsigned int xid, \
194 __u64 fid, \
195 __u32 tid, \
196 __u64 sesid, \
197 __u8 infclass, \
198 __u32 type), \
199 TP_ARGS(xid, fid, tid, sesid, infclass, type))
200
201DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
202DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
203
Steve Frencheccb4422018-05-17 21:16:55 -0500204DECLARE_EVENT_CLASS(smb3_inf_err_class,
205 TP_PROTO(unsigned int xid,
206 __u64 fid,
207 __u32 tid,
208 __u64 sesid,
209 __u8 infclass,
210 __u32 type,
211 int rc),
212 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
213 TP_STRUCT__entry(
214 __field(unsigned int, xid)
215 __field(__u64, fid)
216 __field(__u32, tid)
217 __field(__u64, sesid)
218 __field(__u8, infclass)
219 __field(__u32, type)
220 __field(int, rc)
221 ),
222 TP_fast_assign(
223 __entry->xid = xid;
224 __entry->fid = fid;
225 __entry->tid = tid;
226 __entry->sesid = sesid;
227 __entry->infclass = infclass;
228 __entry->type = type;
229 __entry->rc = rc;
230 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500231 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
232 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
Steve Frencheccb4422018-05-17 21:16:55 -0500233 __entry->infclass, __entry->type, __entry->rc)
234)
235
236#define DEFINE_SMB3_INF_ERR_EVENT(name) \
237DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \
238 TP_PROTO(unsigned int xid, \
239 __u64 fid, \
240 __u32 tid, \
241 __u64 sesid, \
242 __u8 infclass, \
243 __u32 type, \
244 int rc), \
245 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
246
247DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
248DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
249DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
250
Steve French81915762019-03-13 00:02:47 -0500251DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
252 TP_PROTO(unsigned int xid,
253 __u32 tid,
254 __u64 sesid,
255 const char *full_path),
256 TP_ARGS(xid, tid, sesid, full_path),
257 TP_STRUCT__entry(
258 __field(unsigned int, xid)
259 __field(__u32, tid)
260 __field(__u64, sesid)
261 __string(path, full_path)
262 ),
263 TP_fast_assign(
264 __entry->xid = xid;
265 __entry->tid = tid;
266 __entry->sesid = sesid;
267 __assign_str(path, full_path);
268 ),
269 TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
270 __entry->xid, __entry->sesid, __entry->tid,
271 __get_str(path))
272)
273
274#define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name) \
275DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name, \
276 TP_PROTO(unsigned int xid, \
277 __u32 tid, \
278 __u64 sesid, \
279 const char *full_path), \
280 TP_ARGS(xid, tid, sesid, full_path))
281
282DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
283DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
284DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
285DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
286DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
287DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
288DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
289DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
290
291
292DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
293 TP_PROTO(unsigned int xid,
294 __u32 tid,
295 __u64 sesid),
296 TP_ARGS(xid, tid, sesid),
297 TP_STRUCT__entry(
298 __field(unsigned int, xid)
299 __field(__u32, tid)
300 __field(__u64, sesid)
301 ),
302 TP_fast_assign(
303 __entry->xid = xid;
304 __entry->tid = tid;
305 __entry->sesid = sesid;
306 ),
307 TP_printk("xid=%u sid=0x%llx tid=0x%x",
308 __entry->xid, __entry->sesid, __entry->tid)
309)
310
311#define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \
312DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \
313 TP_PROTO(unsigned int xid, \
314 __u32 tid, \
315 __u64 sesid), \
316 TP_ARGS(xid, tid, sesid))
317
318DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
319DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
320DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
321DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
322DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
323DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
324DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
325DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
326
327
328DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
329 TP_PROTO(unsigned int xid,
330 __u32 tid,
331 __u64 sesid,
332 int rc),
333 TP_ARGS(xid, tid, sesid, rc),
334 TP_STRUCT__entry(
335 __field(unsigned int, xid)
336 __field(__u32, tid)
337 __field(__u64, sesid)
338 __field(int, rc)
339 ),
340 TP_fast_assign(
341 __entry->xid = xid;
342 __entry->tid = tid;
343 __entry->sesid = sesid;
344 __entry->rc = rc;
345 ),
346 TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
347 __entry->xid, __entry->sesid, __entry->tid,
348 __entry->rc)
349)
350
351#define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \
352DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \
353 TP_PROTO(unsigned int xid, \
354 __u32 tid, \
355 __u64 sesid, \
356 int rc), \
357 TP_ARGS(xid, tid, sesid, rc))
358
359DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
360DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
361DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
362DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
363DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
364DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
365DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
366DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
367
Steve Frencheccb4422018-05-17 21:16:55 -0500368/*
369 * For logging SMB3 Status code and Command for responses which return errors
370 */
371DECLARE_EVENT_CLASS(smb3_cmd_err_class,
Steve Frenchd683bcd2018-05-19 02:28:53 -0500372 TP_PROTO(__u32 tid,
Steve Frencheccb4422018-05-17 21:16:55 -0500373 __u64 sesid,
374 __u16 cmd,
375 __u64 mid,
376 __u32 status,
377 int rc),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500378 TP_ARGS(tid, sesid, cmd, mid, status, rc),
Steve Frencheccb4422018-05-17 21:16:55 -0500379 TP_STRUCT__entry(
Steve Frencheccb4422018-05-17 21:16:55 -0500380 __field(__u32, tid)
381 __field(__u64, sesid)
382 __field(__u16, cmd)
383 __field(__u64, mid)
384 __field(__u32, status)
385 __field(int, rc)
386 ),
387 TP_fast_assign(
Steve Frencheccb4422018-05-17 21:16:55 -0500388 __entry->tid = tid;
389 __entry->sesid = sesid;
390 __entry->cmd = cmd;
391 __entry->mid = mid;
392 __entry->status = status;
393 __entry->rc = rc;
394 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500395 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
396 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
397 __entry->status, __entry->rc)
Steve Frencheccb4422018-05-17 21:16:55 -0500398)
399
400#define DEFINE_SMB3_CMD_ERR_EVENT(name) \
401DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500402 TP_PROTO(__u32 tid, \
Steve Frencheccb4422018-05-17 21:16:55 -0500403 __u64 sesid, \
404 __u16 cmd, \
405 __u64 mid, \
406 __u32 status, \
407 int rc), \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500408 TP_ARGS(tid, sesid, cmd, mid, status, rc))
Steve Frencheccb4422018-05-17 21:16:55 -0500409
410DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
411
412DECLARE_EVENT_CLASS(smb3_cmd_done_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),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500417 TP_ARGS(tid, sesid, cmd, mid),
Steve Frencheccb4422018-05-17 21:16:55 -0500418 TP_STRUCT__entry(
Steve Frencheccb4422018-05-17 21:16:55 -0500419 __field(__u32, tid)
420 __field(__u64, sesid)
421 __field(__u16, cmd)
422 __field(__u64, mid)
423 ),
424 TP_fast_assign(
Steve Frencheccb4422018-05-17 21:16:55 -0500425 __entry->tid = tid;
426 __entry->sesid = sesid;
427 __entry->cmd = cmd;
428 __entry->mid = mid;
429 ),
Steve Frenchd683bcd2018-05-19 02:28:53 -0500430 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
431 __entry->sesid, __entry->tid,
Steve Frencheccb4422018-05-17 21:16:55 -0500432 __entry->cmd, __entry->mid)
433)
434
435#define DEFINE_SMB3_CMD_DONE_EVENT(name) \
436DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500437 TP_PROTO(__u32 tid, \
Steve Frencheccb4422018-05-17 21:16:55 -0500438 __u64 sesid, \
439 __u16 cmd, \
440 __u64 mid), \
Steve Frenchd683bcd2018-05-19 02:28:53 -0500441 TP_ARGS(tid, sesid, cmd, mid))
Steve Frencheccb4422018-05-17 21:16:55 -0500442
Steve French53a3e0d2019-02-26 21:26:20 -0600443DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
Steve Frencheccb4422018-05-17 21:16:55 -0500444DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
Steve Frenche68a9322018-07-30 14:23:58 -0500445DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
Steve Frencheccb4422018-05-17 21:16:55 -0500446
Steve French020eec52018-08-01 16:38:07 -0500447DECLARE_EVENT_CLASS(smb3_mid_class,
448 TP_PROTO(__u16 cmd,
449 __u64 mid,
450 __u32 pid,
451 unsigned long when_sent,
452 unsigned long when_received),
453 TP_ARGS(cmd, mid, pid, when_sent, when_received),
454 TP_STRUCT__entry(
455 __field(__u16, cmd)
456 __field(__u64, mid)
457 __field(__u32, pid)
458 __field(unsigned long, when_sent)
459 __field(unsigned long, when_received)
460 ),
461 TP_fast_assign(
462 __entry->cmd = cmd;
463 __entry->mid = mid;
464 __entry->pid = pid;
465 __entry->when_sent = when_sent;
466 __entry->when_received = when_received;
467 ),
468 TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
469 __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
470 __entry->when_received)
471)
472
473#define DEFINE_SMB3_MID_EVENT(name) \
474DEFINE_EVENT(smb3_mid_class, smb3_##name, \
475 TP_PROTO(__u16 cmd, \
476 __u64 mid, \
477 __u32 pid, \
478 unsigned long when_sent, \
479 unsigned long when_received), \
480 TP_ARGS(cmd, mid, pid, when_sent, when_received))
481
482DEFINE_SMB3_MID_EVENT(slow_rsp);
483
Steve Frenchd683bcd2018-05-19 02:28:53 -0500484DECLARE_EVENT_CLASS(smb3_exit_err_class,
485 TP_PROTO(unsigned int xid,
486 const char *func_name,
487 int rc),
488 TP_ARGS(xid, func_name, rc),
489 TP_STRUCT__entry(
490 __field(unsigned int, xid)
491 __field(const char *, func_name)
492 __field(int, rc)
493 ),
494 TP_fast_assign(
495 __entry->xid = xid;
496 __entry->func_name = func_name;
497 __entry->rc = rc;
498 ),
499 TP_printk("\t%s: xid=%u rc=%d",
500 __entry->func_name, __entry->xid, __entry->rc)
501)
502
503#define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
504DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
505 TP_PROTO(unsigned int xid, \
506 const char *func_name, \
507 int rc), \
508 TP_ARGS(xid, func_name, rc))
509
510DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
511
512DECLARE_EVENT_CLASS(smb3_enter_exit_class,
513 TP_PROTO(unsigned int xid,
514 const char *func_name),
515 TP_ARGS(xid, func_name),
516 TP_STRUCT__entry(
517 __field(unsigned int, xid)
518 __field(const char *, func_name)
519 ),
520 TP_fast_assign(
521 __entry->xid = xid;
522 __entry->func_name = func_name;
523 ),
524 TP_printk("\t%s: xid=%u",
525 __entry->func_name, __entry->xid)
526)
527
528#define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
529DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \
530 TP_PROTO(unsigned int xid, \
531 const char *func_name), \
532 TP_ARGS(xid, func_name))
533
534DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
535DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
536
Steve French28d59362018-05-30 21:42:34 -0500537/*
Steve Frenchf8af49d2018-10-28 00:47:11 -0500538 * For SMB2/SMB3 tree connect
539 */
540
541DECLARE_EVENT_CLASS(smb3_tcon_class,
542 TP_PROTO(unsigned int xid,
543 __u32 tid,
544 __u64 sesid,
545 const char *unc_name,
546 int rc),
547 TP_ARGS(xid, tid, sesid, unc_name, rc),
548 TP_STRUCT__entry(
549 __field(unsigned int, xid)
550 __field(__u32, tid)
551 __field(__u64, sesid)
552 __field(const char *, unc_name)
553 __field(int, rc)
554 ),
555 TP_fast_assign(
556 __entry->xid = xid;
557 __entry->tid = tid;
558 __entry->sesid = sesid;
559 __entry->unc_name = unc_name;
560 __entry->rc = rc;
561 ),
562 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
563 __entry->xid, __entry->sesid, __entry->tid,
564 __entry->unc_name, __entry->rc)
565)
566
567#define DEFINE_SMB3_TCON_EVENT(name) \
568DEFINE_EVENT(smb3_tcon_class, smb3_##name, \
569 TP_PROTO(unsigned int xid, \
570 __u32 tid, \
571 __u64 sesid, \
572 const char *unc_name, \
573 int rc), \
574 TP_ARGS(xid, tid, sesid, unc_name, rc))
575
576DEFINE_SMB3_TCON_EVENT(tcon);
577
578
579/*
Steve Frenchefe2e9f2019-02-26 19:08:12 -0600580 * For smb2/smb3 open (including create and mkdir) calls
Steve French28d59362018-05-30 21:42:34 -0500581 */
Steve Frenchefe2e9f2019-02-26 19:08:12 -0600582
583DECLARE_EVENT_CLASS(smb3_open_enter_class,
584 TP_PROTO(unsigned int xid,
585 __u32 tid,
586 __u64 sesid,
587 int create_options,
588 int desired_access),
589 TP_ARGS(xid, tid, sesid, create_options, desired_access),
590 TP_STRUCT__entry(
591 __field(unsigned int, xid)
592 __field(__u32, tid)
593 __field(__u64, sesid)
594 __field(int, create_options)
595 __field(int, desired_access)
596 ),
597 TP_fast_assign(
598 __entry->xid = xid;
599 __entry->tid = tid;
600 __entry->sesid = sesid;
601 __entry->create_options = create_options;
602 __entry->desired_access = desired_access;
603 ),
604 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
605 __entry->xid, __entry->sesid, __entry->tid,
606 __entry->create_options, __entry->desired_access)
607)
608
609#define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \
610DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
611 TP_PROTO(unsigned int xid, \
612 __u32 tid, \
613 __u64 sesid, \
614 int create_options, \
615 int desired_access), \
616 TP_ARGS(xid, tid, sesid, create_options, desired_access))
617
618DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
619DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
620
Steve French28d59362018-05-30 21:42:34 -0500621DECLARE_EVENT_CLASS(smb3_open_err_class,
622 TP_PROTO(unsigned int xid,
623 __u32 tid,
624 __u64 sesid,
625 int create_options,
626 int desired_access,
627 int rc),
628 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
629 TP_STRUCT__entry(
630 __field(unsigned int, xid)
631 __field(__u32, tid)
632 __field(__u64, sesid)
633 __field(int, create_options)
634 __field(int, desired_access)
635 __field(int, rc)
636 ),
637 TP_fast_assign(
638 __entry->xid = xid;
639 __entry->tid = tid;
640 __entry->sesid = sesid;
641 __entry->create_options = create_options;
642 __entry->desired_access = desired_access;
643 __entry->rc = rc;
644 ),
645 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
646 __entry->xid, __entry->sesid, __entry->tid,
647 __entry->create_options, __entry->desired_access, __entry->rc)
648)
649
650#define DEFINE_SMB3_OPEN_ERR_EVENT(name) \
651DEFINE_EVENT(smb3_open_err_class, smb3_##name, \
652 TP_PROTO(unsigned int xid, \
653 __u32 tid, \
654 __u64 sesid, \
655 int create_options, \
656 int desired_access, \
657 int rc), \
658 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
659
660DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
Steve Frenchbea851b2018-06-14 21:56:32 -0500661DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
Steve French28d59362018-05-30 21:42:34 -0500662
663DECLARE_EVENT_CLASS(smb3_open_done_class,
664 TP_PROTO(unsigned int xid,
665 __u64 fid,
666 __u32 tid,
667 __u64 sesid,
668 int create_options,
669 int desired_access),
670 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
671 TP_STRUCT__entry(
672 __field(unsigned int, xid)
673 __field(__u64, fid)
674 __field(__u32, tid)
675 __field(__u64, sesid)
676 __field(int, create_options)
677 __field(int, desired_access)
678 ),
679 TP_fast_assign(
680 __entry->xid = xid;
681 __entry->fid = fid;
682 __entry->tid = tid;
683 __entry->sesid = sesid;
684 __entry->create_options = create_options;
685 __entry->desired_access = desired_access;
686 ),
687 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
688 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
689 __entry->create_options, __entry->desired_access)
690)
691
692#define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
693DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
694 TP_PROTO(unsigned int xid, \
695 __u64 fid, \
696 __u32 tid, \
697 __u64 sesid, \
698 int create_options, \
699 int desired_access), \
700 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
701
702DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
Steve Frenchbea851b2018-06-14 21:56:32 -0500703DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
Steve French28d59362018-05-30 21:42:34 -0500704
Steve French179e44d2018-09-28 19:44:23 -0500705
706DECLARE_EVENT_CLASS(smb3_lease_done_class,
707 TP_PROTO(__u32 lease_state,
708 __u32 tid,
709 __u64 sesid,
710 __u64 lease_key_low,
711 __u64 lease_key_high),
712 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
713 TP_STRUCT__entry(
714 __field(__u32, lease_state)
715 __field(__u32, tid)
716 __field(__u64, sesid)
717 __field(__u64, lease_key_low)
718 __field(__u64, lease_key_high)
719 ),
720 TP_fast_assign(
721 __entry->lease_state = lease_state;
722 __entry->tid = tid;
723 __entry->sesid = sesid;
724 __entry->lease_key_low = lease_key_low;
725 __entry->lease_key_high = lease_key_high;
726 ),
727 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
728 __entry->sesid, __entry->tid, __entry->lease_key_high,
729 __entry->lease_key_low, __entry->lease_state)
730)
731
732#define DEFINE_SMB3_LEASE_DONE_EVENT(name) \
733DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \
734 TP_PROTO(__u32 lease_state, \
735 __u32 tid, \
736 __u64 sesid, \
737 __u64 lease_key_low, \
738 __u64 lease_key_high), \
739 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
740
741DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
742
743DECLARE_EVENT_CLASS(smb3_lease_err_class,
744 TP_PROTO(__u32 lease_state,
745 __u32 tid,
746 __u64 sesid,
747 __u64 lease_key_low,
748 __u64 lease_key_high,
749 int rc),
750 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
751 TP_STRUCT__entry(
752 __field(__u32, lease_state)
753 __field(__u32, tid)
754 __field(__u64, sesid)
755 __field(__u64, lease_key_low)
756 __field(__u64, lease_key_high)
757 __field(int, rc)
758 ),
759 TP_fast_assign(
760 __entry->lease_state = lease_state;
761 __entry->tid = tid;
762 __entry->sesid = sesid;
763 __entry->lease_key_low = lease_key_low;
764 __entry->lease_key_high = lease_key_high;
765 __entry->rc = rc;
766 ),
767 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
768 __entry->sesid, __entry->tid, __entry->lease_key_high,
769 __entry->lease_key_low, __entry->lease_state, __entry->rc)
770)
771
772#define DEFINE_SMB3_LEASE_ERR_EVENT(name) \
773DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \
774 TP_PROTO(__u32 lease_state, \
775 __u32 tid, \
776 __u64 sesid, \
777 __u64 lease_key_low, \
778 __u64 lease_key_high, \
779 int rc), \
780 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
781
782DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
783
Steve Frenchbf1fdeb2018-07-30 19:23:09 -0500784DECLARE_EVENT_CLASS(smb3_reconnect_class,
785 TP_PROTO(__u64 currmid,
786 char *hostname),
787 TP_ARGS(currmid, hostname),
788 TP_STRUCT__entry(
789 __field(__u64, currmid)
790 __field(char *, hostname)
791 ),
792 TP_fast_assign(
793 __entry->currmid = currmid;
794 __entry->hostname = hostname;
795 ),
796 TP_printk("server=%s current_mid=0x%llx",
797 __entry->hostname,
798 __entry->currmid)
799)
800
801#define DEFINE_SMB3_RECONNECT_EVENT(name) \
802DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \
803 TP_PROTO(__u64 currmid, \
804 char *hostname), \
805 TP_ARGS(currmid, hostname))
806
807DEFINE_SMB3_RECONNECT_EVENT(reconnect);
808DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
809
Steve Frenchb340a4d2018-09-01 01:10:17 -0500810DECLARE_EVENT_CLASS(smb3_credit_class,
811 TP_PROTO(__u64 currmid,
812 char *hostname,
813 int credits),
814 TP_ARGS(currmid, hostname, credits),
815 TP_STRUCT__entry(
816 __field(__u64, currmid)
817 __field(char *, hostname)
818 __field(int, credits)
819 ),
820 TP_fast_assign(
821 __entry->currmid = currmid;
822 __entry->hostname = hostname;
823 __entry->credits = credits;
824 ),
825 TP_printk("server=%s current_mid=0x%llx credits=%d",
826 __entry->hostname,
827 __entry->currmid,
828 __entry->credits)
829)
830
831#define DEFINE_SMB3_CREDIT_EVENT(name) \
832DEFINE_EVENT(smb3_credit_class, smb3_##name, \
833 TP_PROTO(__u64 currmid, \
834 char *hostname, \
835 int credits), \
836 TP_ARGS(currmid, hostname, credits))
837
838DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
Steve French7937ca92019-03-09 20:29:55 -0600839DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
Steve Frenchb340a4d2018-09-01 01:10:17 -0500840
Steve Frencheccb4422018-05-17 21:16:55 -0500841#endif /* _CIFS_TRACE_H */
842
843#undef TRACE_INCLUDE_PATH
844#define TRACE_INCLUDE_PATH .
845#define TRACE_INCLUDE_FILE trace
846#include <trace/define_trace.h>