1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2018, Microsoft Corporation.
8 #define TRACE_SYSTEM cifs
10 #if !defined(_CIFS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
13 #include <linux/tracepoint.h>
15 /* For logging errors in read or write */
16 DECLARE_EVENT_CLASS(smb3_rw_err_class,
17 TP_PROTO(unsigned int xid,
24 TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
26 __field(unsigned int, xid)
30 __field(__u64, offset)
38 __entry->sesid = sesid;
39 __entry->offset = offset;
43 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,
45 __entry->offset, __entry->len, __entry->rc)
48 #define DEFINE_SMB3_RW_ERR_EVENT(name) \
49 DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \
50 TP_PROTO(unsigned int xid, \
57 TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
59 DEFINE_SMB3_RW_ERR_EVENT(write_err);
60 DEFINE_SMB3_RW_ERR_EVENT(read_err);
61 DEFINE_SMB3_RW_ERR_EVENT(query_dir_err);
64 /* For logging successful read or write */
65 DECLARE_EVENT_CLASS(smb3_rw_done_class,
66 TP_PROTO(unsigned int xid,
72 TP_ARGS(xid, fid, tid, sesid, offset, len),
74 __field(unsigned int, xid)
78 __field(__u64, offset)
85 __entry->sesid = sesid;
86 __entry->offset = offset;
89 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
90 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
91 __entry->offset, __entry->len)
94 #define DEFINE_SMB3_RW_DONE_EVENT(name) \
95 DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \
96 TP_PROTO(unsigned int xid, \
102 TP_ARGS(xid, fid, tid, sesid, offset, len))
104 DEFINE_SMB3_RW_DONE_EVENT(write_enter);
105 DEFINE_SMB3_RW_DONE_EVENT(read_enter);
106 DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter);
107 DEFINE_SMB3_RW_DONE_EVENT(write_done);
108 DEFINE_SMB3_RW_DONE_EVENT(read_done);
109 DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
112 * For handle based calls other than read and write, and get/set info
114 DECLARE_EVENT_CLASS(smb3_fd_err_class,
115 TP_PROTO(unsigned int xid,
120 TP_ARGS(xid, fid, tid, sesid, rc),
122 __field(unsigned int, xid)
125 __field(__u64, sesid)
132 __entry->sesid = sesid;
135 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
136 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
140 #define DEFINE_SMB3_FD_ERR_EVENT(name) \
141 DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \
142 TP_PROTO(unsigned int xid, \
147 TP_ARGS(xid, fid, tid, sesid, rc))
149 DEFINE_SMB3_FD_ERR_EVENT(flush_err);
150 DEFINE_SMB3_FD_ERR_EVENT(lock_err);
151 DEFINE_SMB3_FD_ERR_EVENT(close_err);
154 * For handle based query/set info calls
156 DECLARE_EVENT_CLASS(smb3_inf_enter_class,
157 TP_PROTO(unsigned int xid,
163 TP_ARGS(xid, fid, tid, sesid, infclass, type),
165 __field(unsigned int, xid)
168 __field(__u64, sesid)
169 __field(__u8, infclass)
176 __entry->sesid = sesid;
177 __entry->infclass = infclass;
178 __entry->type = type;
180 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
181 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
182 __entry->infclass, __entry->type)
185 #define DEFINE_SMB3_INF_ENTER_EVENT(name) \
186 DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \
187 TP_PROTO(unsigned int xid, \
193 TP_ARGS(xid, fid, tid, sesid, infclass, type))
195 DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
196 DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
198 DECLARE_EVENT_CLASS(smb3_inf_err_class,
199 TP_PROTO(unsigned int xid,
206 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
208 __field(unsigned int, xid)
211 __field(__u64, sesid)
212 __field(__u8, infclass)
220 __entry->sesid = sesid;
221 __entry->infclass = infclass;
222 __entry->type = type;
225 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
226 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
227 __entry->infclass, __entry->type, __entry->rc)
230 #define DEFINE_SMB3_INF_ERR_EVENT(name) \
231 DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \
232 TP_PROTO(unsigned int xid, \
239 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
241 DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
242 DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
243 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
246 * For logging SMB3 Status code and Command for responses which return errors
248 DECLARE_EVENT_CLASS(smb3_cmd_err_class,
255 TP_ARGS(tid, sesid, cmd, mid, status, rc),
258 __field(__u64, sesid)
261 __field(__u32, status)
266 __entry->sesid = sesid;
269 __entry->status = status;
272 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
273 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
274 __entry->status, __entry->rc)
277 #define DEFINE_SMB3_CMD_ERR_EVENT(name) \
278 DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \
279 TP_PROTO(__u32 tid, \
285 TP_ARGS(tid, sesid, cmd, mid, status, rc))
287 DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
289 DECLARE_EVENT_CLASS(smb3_cmd_done_class,
294 TP_ARGS(tid, sesid, cmd, mid),
297 __field(__u64, sesid)
303 __entry->sesid = sesid;
307 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
308 __entry->sesid, __entry->tid,
309 __entry->cmd, __entry->mid)
312 #define DEFINE_SMB3_CMD_DONE_EVENT(name) \
313 DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \
314 TP_PROTO(__u32 tid, \
318 TP_ARGS(tid, sesid, cmd, mid))
320 DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
321 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
322 DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
324 DECLARE_EVENT_CLASS(smb3_mid_class,
328 unsigned long when_sent,
329 unsigned long when_received),
330 TP_ARGS(cmd, mid, pid, when_sent, when_received),
335 __field(unsigned long, when_sent)
336 __field(unsigned long, when_received)
342 __entry->when_sent = when_sent;
343 __entry->when_received = when_received;
345 TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
346 __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
347 __entry->when_received)
350 #define DEFINE_SMB3_MID_EVENT(name) \
351 DEFINE_EVENT(smb3_mid_class, smb3_##name, \
352 TP_PROTO(__u16 cmd, \
355 unsigned long when_sent, \
356 unsigned long when_received), \
357 TP_ARGS(cmd, mid, pid, when_sent, when_received))
359 DEFINE_SMB3_MID_EVENT(slow_rsp);
361 DECLARE_EVENT_CLASS(smb3_exit_err_class,
362 TP_PROTO(unsigned int xid,
363 const char *func_name,
365 TP_ARGS(xid, func_name, rc),
367 __field(unsigned int, xid)
368 __field(const char *, func_name)
373 __entry->func_name = func_name;
376 TP_printk("\t%s: xid=%u rc=%d",
377 __entry->func_name, __entry->xid, __entry->rc)
380 #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
381 DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
382 TP_PROTO(unsigned int xid, \
383 const char *func_name, \
385 TP_ARGS(xid, func_name, rc))
387 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
389 DECLARE_EVENT_CLASS(smb3_enter_exit_class,
390 TP_PROTO(unsigned int xid,
391 const char *func_name),
392 TP_ARGS(xid, func_name),
394 __field(unsigned int, xid)
395 __field(const char *, func_name)
399 __entry->func_name = func_name;
401 TP_printk("\t%s: xid=%u",
402 __entry->func_name, __entry->xid)
405 #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
406 DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \
407 TP_PROTO(unsigned int xid, \
408 const char *func_name), \
409 TP_ARGS(xid, func_name))
411 DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
412 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
415 * For SMB2/SMB3 tree connect
418 DECLARE_EVENT_CLASS(smb3_tcon_class,
419 TP_PROTO(unsigned int xid,
422 const char *unc_name,
424 TP_ARGS(xid, tid, sesid, unc_name, rc),
426 __field(unsigned int, xid)
428 __field(__u64, sesid)
429 __field(const char *, unc_name)
435 __entry->sesid = sesid;
436 __entry->unc_name = unc_name;
439 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
440 __entry->xid, __entry->sesid, __entry->tid,
441 __entry->unc_name, __entry->rc)
444 #define DEFINE_SMB3_TCON_EVENT(name) \
445 DEFINE_EVENT(smb3_tcon_class, smb3_##name, \
446 TP_PROTO(unsigned int xid, \
449 const char *unc_name, \
451 TP_ARGS(xid, tid, sesid, unc_name, rc))
453 DEFINE_SMB3_TCON_EVENT(tcon);
457 * For smb2/smb3 open (including create and mkdir) calls
460 DECLARE_EVENT_CLASS(smb3_open_enter_class,
461 TP_PROTO(unsigned int xid,
466 TP_ARGS(xid, tid, sesid, create_options, desired_access),
468 __field(unsigned int, xid)
470 __field(__u64, sesid)
471 __field(int, create_options)
472 __field(int, desired_access)
477 __entry->sesid = sesid;
478 __entry->create_options = create_options;
479 __entry->desired_access = desired_access;
481 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
482 __entry->xid, __entry->sesid, __entry->tid,
483 __entry->create_options, __entry->desired_access)
486 #define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \
487 DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
488 TP_PROTO(unsigned int xid, \
491 int create_options, \
492 int desired_access), \
493 TP_ARGS(xid, tid, sesid, create_options, desired_access))
495 DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
496 DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
498 DECLARE_EVENT_CLASS(smb3_open_err_class,
499 TP_PROTO(unsigned int xid,
505 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
507 __field(unsigned int, xid)
509 __field(__u64, sesid)
510 __field(int, create_options)
511 __field(int, desired_access)
517 __entry->sesid = sesid;
518 __entry->create_options = create_options;
519 __entry->desired_access = desired_access;
522 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
523 __entry->xid, __entry->sesid, __entry->tid,
524 __entry->create_options, __entry->desired_access, __entry->rc)
527 #define DEFINE_SMB3_OPEN_ERR_EVENT(name) \
528 DEFINE_EVENT(smb3_open_err_class, smb3_##name, \
529 TP_PROTO(unsigned int xid, \
532 int create_options, \
533 int desired_access, \
535 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
537 DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
538 DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
540 DECLARE_EVENT_CLASS(smb3_open_done_class,
541 TP_PROTO(unsigned int xid,
547 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
549 __field(unsigned int, xid)
552 __field(__u64, sesid)
553 __field(int, create_options)
554 __field(int, desired_access)
560 __entry->sesid = sesid;
561 __entry->create_options = create_options;
562 __entry->desired_access = desired_access;
564 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
565 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
566 __entry->create_options, __entry->desired_access)
569 #define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
570 DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
571 TP_PROTO(unsigned int xid, \
575 int create_options, \
576 int desired_access), \
577 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
579 DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
580 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
583 DECLARE_EVENT_CLASS(smb3_lease_done_class,
584 TP_PROTO(__u32 lease_state,
588 __u64 lease_key_high),
589 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
591 __field(__u32, lease_state)
593 __field(__u64, sesid)
594 __field(__u64, lease_key_low)
595 __field(__u64, lease_key_high)
598 __entry->lease_state = lease_state;
600 __entry->sesid = sesid;
601 __entry->lease_key_low = lease_key_low;
602 __entry->lease_key_high = lease_key_high;
604 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
605 __entry->sesid, __entry->tid, __entry->lease_key_high,
606 __entry->lease_key_low, __entry->lease_state)
609 #define DEFINE_SMB3_LEASE_DONE_EVENT(name) \
610 DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \
611 TP_PROTO(__u32 lease_state, \
614 __u64 lease_key_low, \
615 __u64 lease_key_high), \
616 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
618 DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
620 DECLARE_EVENT_CLASS(smb3_lease_err_class,
621 TP_PROTO(__u32 lease_state,
625 __u64 lease_key_high,
627 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
629 __field(__u32, lease_state)
631 __field(__u64, sesid)
632 __field(__u64, lease_key_low)
633 __field(__u64, lease_key_high)
637 __entry->lease_state = lease_state;
639 __entry->sesid = sesid;
640 __entry->lease_key_low = lease_key_low;
641 __entry->lease_key_high = lease_key_high;
644 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
645 __entry->sesid, __entry->tid, __entry->lease_key_high,
646 __entry->lease_key_low, __entry->lease_state, __entry->rc)
649 #define DEFINE_SMB3_LEASE_ERR_EVENT(name) \
650 DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \
651 TP_PROTO(__u32 lease_state, \
654 __u64 lease_key_low, \
655 __u64 lease_key_high, \
657 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
659 DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
661 DECLARE_EVENT_CLASS(smb3_reconnect_class,
662 TP_PROTO(__u64 currmid,
664 TP_ARGS(currmid, hostname),
666 __field(__u64, currmid)
667 __field(char *, hostname)
670 __entry->currmid = currmid;
671 __entry->hostname = hostname;
673 TP_printk("server=%s current_mid=0x%llx",
678 #define DEFINE_SMB3_RECONNECT_EVENT(name) \
679 DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \
680 TP_PROTO(__u64 currmid, \
682 TP_ARGS(currmid, hostname))
684 DEFINE_SMB3_RECONNECT_EVENT(reconnect);
685 DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
687 DECLARE_EVENT_CLASS(smb3_credit_class,
688 TP_PROTO(__u64 currmid,
691 TP_ARGS(currmid, hostname, credits),
693 __field(__u64, currmid)
694 __field(char *, hostname)
695 __field(int, credits)
698 __entry->currmid = currmid;
699 __entry->hostname = hostname;
700 __entry->credits = credits;
702 TP_printk("server=%s current_mid=0x%llx credits=%d",
708 #define DEFINE_SMB3_CREDIT_EVENT(name) \
709 DEFINE_EVENT(smb3_credit_class, smb3_##name, \
710 TP_PROTO(__u64 currmid, \
713 TP_ARGS(currmid, hostname, credits))
715 DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
717 #endif /* _CIFS_TRACE_H */
719 #undef TRACE_INCLUDE_PATH
720 #define TRACE_INCLUDE_PATH .
721 #define TRACE_INCLUDE_FILE trace
722 #include <trace/define_trace.h>