Linux Audio

Check our new training course

Loading...
Note: File does not exist in v5.4.
   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_rw_credits_traces \
  24	EM(cifs_trace_rw_credits_call_readv_adjust,	"rd-call-adj") \
  25	EM(cifs_trace_rw_credits_call_writev_adjust,	"wr-call-adj") \
  26	EM(cifs_trace_rw_credits_free_subreq,		"free-subreq") \
  27	EM(cifs_trace_rw_credits_issue_read_adjust,	"rd-issu-adj") \
  28	EM(cifs_trace_rw_credits_issue_write_adjust,	"wr-issu-adj") \
  29	EM(cifs_trace_rw_credits_no_adjust_up,		"no-adj-up  ") \
  30	EM(cifs_trace_rw_credits_old_session,		"old-session") \
  31	EM(cifs_trace_rw_credits_read_response_add,	"rd-resp-add") \
  32	EM(cifs_trace_rw_credits_read_response_clear,	"rd-resp-clr") \
  33	EM(cifs_trace_rw_credits_read_resubmit,		"rd-resubmit") \
  34	EM(cifs_trace_rw_credits_read_submit,		"rd-submit  ") \
  35	EM(cifs_trace_rw_credits_write_prepare,		"wr-prepare ") \
  36	EM(cifs_trace_rw_credits_write_response_add,	"wr-resp-add") \
  37	EM(cifs_trace_rw_credits_write_response_clear,	"wr-resp-clr") \
  38	E_(cifs_trace_rw_credits_zero_in_flight,	"ZERO-IN-FLT")
  39
  40#define smb3_tcon_ref_traces					      \
  41	EM(netfs_trace_tcon_ref_dec_dfs_refer,		"DEC DfsRef") \
  42	EM(netfs_trace_tcon_ref_free,			"FRE       ") \
  43	EM(netfs_trace_tcon_ref_free_fail,		"FRE Fail  ") \
  44	EM(netfs_trace_tcon_ref_free_ipc,		"FRE Ipc   ") \
  45	EM(netfs_trace_tcon_ref_free_ipc_fail,		"FRE Ipc-F ") \
  46	EM(netfs_trace_tcon_ref_free_reconnect_server,	"FRE Reconn") \
  47	EM(netfs_trace_tcon_ref_get_cached_laundromat,	"GET Ch-Lau") \
  48	EM(netfs_trace_tcon_ref_get_cached_lease_break,	"GET Ch-Lea") \
  49	EM(netfs_trace_tcon_ref_get_cancelled_close,	"GET Cn-Cls") \
  50	EM(netfs_trace_tcon_ref_get_dfs_refer,		"GET DfsRef") \
  51	EM(netfs_trace_tcon_ref_get_find,		"GET Find  ") \
  52	EM(netfs_trace_tcon_ref_get_find_sess_tcon,	"GET FndSes") \
  53	EM(netfs_trace_tcon_ref_get_reconnect_server,	"GET Reconn") \
  54	EM(netfs_trace_tcon_ref_new,			"NEW       ") \
  55	EM(netfs_trace_tcon_ref_new_ipc,		"NEW Ipc   ") \
  56	EM(netfs_trace_tcon_ref_new_reconnect_server,	"NEW Reconn") \
  57	EM(netfs_trace_tcon_ref_put_cached_close,	"PUT Ch-Cls") \
  58	EM(netfs_trace_tcon_ref_put_cancelled_close,	"PUT Cn-Cls") \
  59	EM(netfs_trace_tcon_ref_put_cancelled_close_fid, "PUT Cn-Fid") \
  60	EM(netfs_trace_tcon_ref_put_cancelled_mid,	"PUT Cn-Mid") \
  61	EM(netfs_trace_tcon_ref_put_mnt_ctx,		"PUT MntCtx") \
  62	EM(netfs_trace_tcon_ref_put_reconnect_server,	"PUT Reconn") \
  63	EM(netfs_trace_tcon_ref_put_tlink,		"PUT Tlink ") \
  64	EM(netfs_trace_tcon_ref_see_cancelled_close,	"SEE Cn-Cls") \
  65	EM(netfs_trace_tcon_ref_see_fscache_collision,	"SEE FV-CO!") \
  66	EM(netfs_trace_tcon_ref_see_fscache_okay,	"SEE FV-Ok ") \
  67	EM(netfs_trace_tcon_ref_see_fscache_relinq,	"SEE FV-Rlq") \
  68	E_(netfs_trace_tcon_ref_see_umount,		"SEE Umount")
  69
  70#undef EM
  71#undef E_
  72
  73/*
  74 * Define those tracing enums.
  75 */
  76#ifndef __SMB3_DECLARE_TRACE_ENUMS_ONCE_ONLY
  77#define __SMB3_DECLARE_TRACE_ENUMS_ONCE_ONLY
  78
  79#define EM(a, b) a,
  80#define E_(a, b) a
  81
  82enum smb3_rw_credits_trace	{ smb3_rw_credits_traces } __mode(byte);
  83enum smb3_tcon_ref_trace	{ smb3_tcon_ref_traces } __mode(byte);
  84
  85#undef EM
  86#undef E_
  87#endif
  88
  89/*
  90 * Export enum symbols via userspace.
  91 */
  92#define EM(a, b) TRACE_DEFINE_ENUM(a);
  93#define E_(a, b) TRACE_DEFINE_ENUM(a);
  94
  95smb3_rw_credits_traces;
  96smb3_tcon_ref_traces;
  97
  98#undef EM
  99#undef E_
 100
 101/*
 102 * Now redefine the EM() and E_() macros to map the enums to the strings that
 103 * will be printed in the output.
 104 */
 105#define EM(a, b)	{ a, b },
 106#define E_(a, b)	{ a, b }
 107
 108/* For logging errors in read or write */
 109DECLARE_EVENT_CLASS(smb3_rw_err_class,
 110	TP_PROTO(unsigned int rreq_debug_id,
 111		 unsigned int rreq_debug_index,
 112		 unsigned int xid,
 113		 __u64	fid,
 114		 __u32	tid,
 115		 __u64	sesid,
 116		 __u64	offset,
 117		 __u32	len,
 118		 int	rc),
 119	TP_ARGS(rreq_debug_id, rreq_debug_index,
 120		xid, fid, tid, sesid, offset, len, rc),
 121	TP_STRUCT__entry(
 122		__field(unsigned int, rreq_debug_id)
 123		__field(unsigned int, rreq_debug_index)
 124		__field(unsigned int, xid)
 125		__field(__u64, fid)
 126		__field(__u32, tid)
 127		__field(__u64, sesid)
 128		__field(__u64, offset)
 129		__field(__u32, len)
 130		__field(int, rc)
 131	),
 132	TP_fast_assign(
 133		__entry->rreq_debug_id = rreq_debug_id;
 134		__entry->rreq_debug_index = rreq_debug_index;
 135		__entry->xid = xid;
 136		__entry->fid = fid;
 137		__entry->tid = tid;
 138		__entry->sesid = sesid;
 139		__entry->offset = offset;
 140		__entry->len = len;
 141		__entry->rc = rc;
 142	),
 143	TP_printk("\tR=%08x[%x] xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
 144		  __entry->rreq_debug_id, __entry->rreq_debug_index,
 145		  __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 146		  __entry->offset, __entry->len, __entry->rc)
 147)
 148
 149#define DEFINE_SMB3_RW_ERR_EVENT(name)          \
 150DEFINE_EVENT(smb3_rw_err_class, smb3_##name,    \
 151	TP_PROTO(unsigned int rreq_debug_id,	\
 152		 unsigned int rreq_debug_index,		\
 153		 unsigned int xid,			\
 154		 __u64	fid,				\
 155		 __u32	tid,				\
 156		 __u64	sesid,				\
 157		 __u64	offset,				\
 158		 __u32	len,				\
 159		 int	rc),				\
 160	TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len, rc))
 161
 162DEFINE_SMB3_RW_ERR_EVENT(read_err);
 163DEFINE_SMB3_RW_ERR_EVENT(write_err);
 164
 165/* For logging errors in other file I/O ops */
 166DECLARE_EVENT_CLASS(smb3_other_err_class,
 167	TP_PROTO(unsigned int xid,
 168		__u64	fid,
 169		__u32	tid,
 170		__u64	sesid,
 171		__u64	offset,
 172		__u32	len,
 173		int	rc),
 174	TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
 175	TP_STRUCT__entry(
 176		__field(unsigned int, xid)
 177		__field(__u64, fid)
 178		__field(__u32, tid)
 179		__field(__u64, sesid)
 180		__field(__u64, offset)
 181		__field(__u32, len)
 182		__field(int, rc)
 183	),
 184	TP_fast_assign(
 185		__entry->xid = xid;
 186		__entry->fid = fid;
 187		__entry->tid = tid;
 188		__entry->sesid = sesid;
 189		__entry->offset = offset;
 190		__entry->len = len;
 191		__entry->rc = rc;
 192	),
 193	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
 194		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 195		__entry->offset, __entry->len, __entry->rc)
 196)
 197
 198#define DEFINE_SMB3_OTHER_ERR_EVENT(name)	\
 199DEFINE_EVENT(smb3_other_err_class, smb3_##name, \
 200	TP_PROTO(unsigned int xid,		\
 201		__u64	fid,			\
 202		__u32	tid,			\
 203		__u64	sesid,			\
 204		__u64	offset,			\
 205		__u32	len,			\
 206		int	rc),			\
 207	TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
 208
 209DEFINE_SMB3_OTHER_ERR_EVENT(query_dir_err);
 210DEFINE_SMB3_OTHER_ERR_EVENT(zero_err);
 211DEFINE_SMB3_OTHER_ERR_EVENT(falloc_err);
 212
 213/*
 214 * For logging errors in reflink and copy_range ops e.g. smb2_copychunk_range
 215 * and smb2_duplicate_extents
 216 */
 217DECLARE_EVENT_CLASS(smb3_copy_range_err_class,
 218	TP_PROTO(unsigned int xid,
 219		__u64	src_fid,
 220		__u64   target_fid,
 221		__u32	tid,
 222		__u64	sesid,
 223		__u64	src_offset,
 224		__u64   target_offset,
 225		__u32	len,
 226		int	rc),
 227	TP_ARGS(xid, src_fid, target_fid, tid, sesid, src_offset, target_offset, len, rc),
 228	TP_STRUCT__entry(
 229		__field(unsigned int, xid)
 230		__field(__u64, src_fid)
 231		__field(__u64, target_fid)
 232		__field(__u32, tid)
 233		__field(__u64, sesid)
 234		__field(__u64, src_offset)
 235		__field(__u64, target_offset)
 236		__field(__u32, len)
 237		__field(int, rc)
 238	),
 239	TP_fast_assign(
 240		__entry->xid = xid;
 241		__entry->src_fid = src_fid;
 242		__entry->target_fid = target_fid;
 243		__entry->tid = tid;
 244		__entry->sesid = sesid;
 245		__entry->src_offset = src_offset;
 246		__entry->target_offset = target_offset;
 247		__entry->len = len;
 248		__entry->rc = rc;
 249	),
 250	TP_printk("\txid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x rc=%d",
 251		__entry->xid, __entry->sesid, __entry->tid, __entry->target_fid,
 252		__entry->src_offset, __entry->target_fid, __entry->target_offset, __entry->len, __entry->rc)
 253)
 254
 255#define DEFINE_SMB3_COPY_RANGE_ERR_EVENT(name)	\
 256DEFINE_EVENT(smb3_copy_range_err_class, smb3_##name, \
 257	TP_PROTO(unsigned int xid,		\
 258		__u64	src_fid,		\
 259		__u64   target_fid,		\
 260		__u32	tid,			\
 261		__u64	sesid,			\
 262		__u64	src_offset,		\
 263		__u64	target_offset,		\
 264		__u32	len,			\
 265		int	rc),			\
 266	TP_ARGS(xid, src_fid, target_fid, tid, sesid, src_offset, target_offset, len, rc))
 267
 268DEFINE_SMB3_COPY_RANGE_ERR_EVENT(clone_err);
 269/* TODO: Add SMB3_COPY_RANGE_ERR_EVENT(copychunk_err) */
 270
 271DECLARE_EVENT_CLASS(smb3_copy_range_done_class,
 272	TP_PROTO(unsigned int xid,
 273		__u64	src_fid,
 274		__u64   target_fid,
 275		__u32	tid,
 276		__u64	sesid,
 277		__u64	src_offset,
 278		__u64   target_offset,
 279		__u32	len),
 280	TP_ARGS(xid, src_fid, target_fid, tid, sesid, src_offset, target_offset, len),
 281	TP_STRUCT__entry(
 282		__field(unsigned int, xid)
 283		__field(__u64, src_fid)
 284		__field(__u64, target_fid)
 285		__field(__u32, tid)
 286		__field(__u64, sesid)
 287		__field(__u64, src_offset)
 288		__field(__u64, target_offset)
 289		__field(__u32, len)
 290	),
 291	TP_fast_assign(
 292		__entry->xid = xid;
 293		__entry->src_fid = src_fid;
 294		__entry->target_fid = target_fid;
 295		__entry->tid = tid;
 296		__entry->sesid = sesid;
 297		__entry->src_offset = src_offset;
 298		__entry->target_offset = target_offset;
 299		__entry->len = len;
 300	),
 301	TP_printk("\txid=%u sid=0x%llx tid=0x%x source fid=0x%llx source offset=0x%llx target fid=0x%llx target offset=0x%llx len=0x%x",
 302		__entry->xid, __entry->sesid, __entry->tid, __entry->target_fid,
 303		__entry->src_offset, __entry->target_fid, __entry->target_offset, __entry->len)
 304)
 305
 306#define DEFINE_SMB3_COPY_RANGE_DONE_EVENT(name)	\
 307DEFINE_EVENT(smb3_copy_range_done_class, smb3_##name, \
 308	TP_PROTO(unsigned int xid,		\
 309		__u64	src_fid,		\
 310		__u64   target_fid,		\
 311		__u32	tid,			\
 312		__u64	sesid,			\
 313		__u64	src_offset,		\
 314		__u64	target_offset,		\
 315		__u32	len),			\
 316	TP_ARGS(xid, src_fid, target_fid, tid, sesid, src_offset, target_offset, len))
 317
 318DEFINE_SMB3_COPY_RANGE_DONE_EVENT(copychunk_enter);
 319DEFINE_SMB3_COPY_RANGE_DONE_EVENT(clone_enter);
 320DEFINE_SMB3_COPY_RANGE_DONE_EVENT(copychunk_done);
 321DEFINE_SMB3_COPY_RANGE_DONE_EVENT(clone_done);
 322
 323
 324/* For logging successful read or write */
 325DECLARE_EVENT_CLASS(smb3_rw_done_class,
 326	TP_PROTO(unsigned int rreq_debug_id,
 327		 unsigned int rreq_debug_index,
 328		 unsigned int xid,
 329		 __u64	fid,
 330		 __u32	tid,
 331		 __u64	sesid,
 332		 __u64	offset,
 333		 __u32	len),
 334	TP_ARGS(rreq_debug_id, rreq_debug_index,
 335		xid, fid, tid, sesid, offset, len),
 336	TP_STRUCT__entry(
 337		__field(unsigned int, rreq_debug_id)
 338		__field(unsigned int, rreq_debug_index)
 339		__field(unsigned int, xid)
 340		__field(__u64, fid)
 341		__field(__u32, tid)
 342		__field(__u64, sesid)
 343		__field(__u64, offset)
 344		__field(__u32, len)
 345	),
 346	TP_fast_assign(
 347		__entry->rreq_debug_id = rreq_debug_id;
 348		__entry->rreq_debug_index = rreq_debug_index;
 349		__entry->xid = xid;
 350		__entry->fid = fid;
 351		__entry->tid = tid;
 352		__entry->sesid = sesid;
 353		__entry->offset = offset;
 354		__entry->len = len;
 355	),
 356	TP_printk("R=%08x[%x] xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
 357		  __entry->rreq_debug_id, __entry->rreq_debug_index,
 358		  __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 359		  __entry->offset, __entry->len)
 360)
 361
 362#define DEFINE_SMB3_RW_DONE_EVENT(name)         \
 363DEFINE_EVENT(smb3_rw_done_class, smb3_##name,   \
 364	TP_PROTO(unsigned int rreq_debug_id,	\
 365		 unsigned int rreq_debug_index,	\
 366		 unsigned int xid,		\
 367		__u64	fid,			\
 368		__u32	tid,			\
 369		__u64	sesid,			\
 370		__u64	offset,			\
 371		__u32	len),			\
 372	TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len))
 373
 374DEFINE_SMB3_RW_DONE_EVENT(read_enter);
 375DEFINE_SMB3_RW_DONE_EVENT(read_done);
 376DEFINE_SMB3_RW_DONE_EVENT(write_enter);
 377DEFINE_SMB3_RW_DONE_EVENT(write_done);
 378
 379/* For logging successful other op */
 380DECLARE_EVENT_CLASS(smb3_other_done_class,
 381	TP_PROTO(unsigned int xid,
 382		__u64	fid,
 383		__u32	tid,
 384		__u64	sesid,
 385		__u64	offset,
 386		__u32	len),
 387	TP_ARGS(xid, fid, tid, sesid, offset, len),
 388	TP_STRUCT__entry(
 389		__field(unsigned int, xid)
 390		__field(__u64, fid)
 391		__field(__u32, tid)
 392		__field(__u64, sesid)
 393		__field(__u64, offset)
 394		__field(__u32, len)
 395	),
 396	TP_fast_assign(
 397		__entry->xid = xid;
 398		__entry->fid = fid;
 399		__entry->tid = tid;
 400		__entry->sesid = sesid;
 401		__entry->offset = offset;
 402		__entry->len = len;
 403	),
 404	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
 405		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 406		__entry->offset, __entry->len)
 407)
 408
 409#define DEFINE_SMB3_OTHER_DONE_EVENT(name)         \
 410DEFINE_EVENT(smb3_other_done_class, smb3_##name,   \
 411	TP_PROTO(unsigned int xid,		\
 412		__u64	fid,			\
 413		__u32	tid,			\
 414		__u64	sesid,			\
 415		__u64	offset,			\
 416		__u32	len),			\
 417	TP_ARGS(xid, fid, tid, sesid, offset, len))
 418
 419DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_enter);
 420DEFINE_SMB3_OTHER_DONE_EVENT(zero_enter);
 421DEFINE_SMB3_OTHER_DONE_EVENT(falloc_enter);
 422DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_done);
 423DEFINE_SMB3_OTHER_DONE_EVENT(zero_done);
 424DEFINE_SMB3_OTHER_DONE_EVENT(falloc_done);
 425
 426/* For logging successful set EOF (truncate) */
 427DECLARE_EVENT_CLASS(smb3_eof_class,
 428	TP_PROTO(unsigned int xid,
 429		__u64	fid,
 430		__u32	tid,
 431		__u64	sesid,
 432		__u64	offset),
 433	TP_ARGS(xid, fid, tid, sesid, offset),
 434	TP_STRUCT__entry(
 435		__field(unsigned int, xid)
 436		__field(__u64, fid)
 437		__field(__u32, tid)
 438		__field(__u64, sesid)
 439		__field(__u64, offset)
 440	),
 441	TP_fast_assign(
 442		__entry->xid = xid;
 443		__entry->fid = fid;
 444		__entry->tid = tid;
 445		__entry->sesid = sesid;
 446		__entry->offset = offset;
 447	),
 448	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx",
 449		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 450		__entry->offset)
 451)
 452
 453#define DEFINE_SMB3_EOF_EVENT(name)         \
 454DEFINE_EVENT(smb3_eof_class, smb3_##name,   \
 455	TP_PROTO(unsigned int xid,		\
 456		__u64	fid,			\
 457		__u32	tid,			\
 458		__u64	sesid,			\
 459		__u64	offset),		\
 460	TP_ARGS(xid, fid, tid, sesid, offset))
 461
 462DEFINE_SMB3_EOF_EVENT(set_eof);
 463
 464/*
 465 * For handle based calls other than read and write, and get/set info
 466 */
 467DECLARE_EVENT_CLASS(smb3_fd_class,
 468	TP_PROTO(unsigned int xid,
 469		__u64	fid,
 470		__u32	tid,
 471		__u64	sesid),
 472	TP_ARGS(xid, fid, tid, sesid),
 473	TP_STRUCT__entry(
 474		__field(unsigned int, xid)
 475		__field(__u64, fid)
 476		__field(__u32, tid)
 477		__field(__u64, sesid)
 478	),
 479	TP_fast_assign(
 480		__entry->xid = xid;
 481		__entry->fid = fid;
 482		__entry->tid = tid;
 483		__entry->sesid = sesid;
 484	),
 485	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx",
 486		__entry->xid, __entry->sesid, __entry->tid, __entry->fid)
 487)
 488
 489#define DEFINE_SMB3_FD_EVENT(name)          \
 490DEFINE_EVENT(smb3_fd_class, smb3_##name,    \
 491	TP_PROTO(unsigned int xid,		\
 492		__u64	fid,			\
 493		__u32	tid,			\
 494		__u64	sesid),			\
 495	TP_ARGS(xid, fid, tid, sesid))
 496
 497DEFINE_SMB3_FD_EVENT(flush_enter);
 498DEFINE_SMB3_FD_EVENT(flush_done);
 499DEFINE_SMB3_FD_EVENT(close_enter);
 500DEFINE_SMB3_FD_EVENT(close_done);
 501DEFINE_SMB3_FD_EVENT(oplock_not_found);
 502
 503DECLARE_EVENT_CLASS(smb3_fd_err_class,
 504	TP_PROTO(unsigned int xid,
 505		__u64	fid,
 506		__u32	tid,
 507		__u64	sesid,
 508		int	rc),
 509	TP_ARGS(xid, fid, tid, sesid, rc),
 510	TP_STRUCT__entry(
 511		__field(unsigned int, xid)
 512		__field(__u64, fid)
 513		__field(__u32, tid)
 514		__field(__u64, sesid)
 515		__field(int, rc)
 516	),
 517	TP_fast_assign(
 518		__entry->xid = xid;
 519		__entry->fid = fid;
 520		__entry->tid = tid;
 521		__entry->sesid = sesid;
 522		__entry->rc = rc;
 523	),
 524	TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
 525		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 526		__entry->rc)
 527)
 528
 529#define DEFINE_SMB3_FD_ERR_EVENT(name)          \
 530DEFINE_EVENT(smb3_fd_err_class, smb3_##name,    \
 531	TP_PROTO(unsigned int xid,		\
 532		__u64	fid,			\
 533		__u32	tid,			\
 534		__u64	sesid,			\
 535		int	rc),			\
 536	TP_ARGS(xid, fid, tid, sesid, rc))
 537
 538DEFINE_SMB3_FD_ERR_EVENT(flush_err);
 539DEFINE_SMB3_FD_ERR_EVENT(lock_err);
 540DEFINE_SMB3_FD_ERR_EVENT(close_err);
 541
 542/*
 543 * For handle based query/set info calls
 544 */
 545DECLARE_EVENT_CLASS(smb3_inf_enter_class,
 546	TP_PROTO(unsigned int xid,
 547		__u64	fid,
 548		__u32	tid,
 549		__u64	sesid,
 550		__u8	infclass,
 551		__u32	type),
 552	TP_ARGS(xid, fid, tid, sesid, infclass, type),
 553	TP_STRUCT__entry(
 554		__field(unsigned int, xid)
 555		__field(__u64, fid)
 556		__field(__u32, tid)
 557		__field(__u64, sesid)
 558		__field(__u8, infclass)
 559		__field(__u32, type)
 560	),
 561	TP_fast_assign(
 562		__entry->xid = xid;
 563		__entry->fid = fid;
 564		__entry->tid = tid;
 565		__entry->sesid = sesid;
 566		__entry->infclass = infclass;
 567		__entry->type = type;
 568	),
 569	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
 570		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 571		__entry->infclass, __entry->type)
 572)
 573
 574#define DEFINE_SMB3_INF_ENTER_EVENT(name)          \
 575DEFINE_EVENT(smb3_inf_enter_class, smb3_##name,    \
 576	TP_PROTO(unsigned int xid,		\
 577		__u64	fid,			\
 578		__u32	tid,			\
 579		__u64	sesid,			\
 580		__u8	infclass,		\
 581		__u32	type),			\
 582	TP_ARGS(xid, fid, tid, sesid, infclass, type))
 583
 584DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
 585DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
 586DEFINE_SMB3_INF_ENTER_EVENT(notify_enter);
 587DEFINE_SMB3_INF_ENTER_EVENT(notify_done);
 588
 589DECLARE_EVENT_CLASS(smb3_inf_err_class,
 590	TP_PROTO(unsigned int xid,
 591		__u64	fid,
 592		__u32	tid,
 593		__u64	sesid,
 594		__u8	infclass,
 595		__u32	type,
 596		int	rc),
 597	TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
 598	TP_STRUCT__entry(
 599		__field(unsigned int, xid)
 600		__field(__u64, fid)
 601		__field(__u32, tid)
 602		__field(__u64, sesid)
 603		__field(__u8, infclass)
 604		__field(__u32, type)
 605		__field(int, rc)
 606	),
 607	TP_fast_assign(
 608		__entry->xid = xid;
 609		__entry->fid = fid;
 610		__entry->tid = tid;
 611		__entry->sesid = sesid;
 612		__entry->infclass = infclass;
 613		__entry->type = type;
 614		__entry->rc = rc;
 615	),
 616	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
 617		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
 618		__entry->infclass, __entry->type, __entry->rc)
 619)
 620
 621#define DEFINE_SMB3_INF_ERR_EVENT(name)          \
 622DEFINE_EVENT(smb3_inf_err_class, smb3_##name,    \
 623	TP_PROTO(unsigned int xid,		\
 624		__u64	fid,			\
 625		__u32	tid,			\
 626		__u64	sesid,			\
 627		__u8	infclass,		\
 628		__u32	type,			\
 629		int	rc),			\
 630	TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
 631
 632DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
 633DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
 634DEFINE_SMB3_INF_ERR_EVENT(notify_err);
 635DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
 636
 637DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
 638	TP_PROTO(unsigned int xid,
 639		__u32	tid,
 640		__u64	sesid,
 641		const char *full_path),
 642	TP_ARGS(xid, tid, sesid, full_path),
 643	TP_STRUCT__entry(
 644		__field(unsigned int, xid)
 645		__field(__u32, tid)
 646		__field(__u64, sesid)
 647		__string(path, full_path)
 648	),
 649	TP_fast_assign(
 650		__entry->xid = xid;
 651		__entry->tid = tid;
 652		__entry->sesid = sesid;
 653		__assign_str(path);
 654	),
 655	TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
 656		__entry->xid, __entry->sesid, __entry->tid,
 657		__get_str(path))
 658)
 659
 660#define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name)     \
 661DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name,    \
 662	TP_PROTO(unsigned int xid,		\
 663		__u32	tid,			\
 664		__u64	sesid,			\
 665		const char *full_path),		\
 666	TP_ARGS(xid, tid, sesid, full_path))
 667
 668DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
 669DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter);
 670DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
 671DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
 672DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
 673DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
 674DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
 675DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_reparse_compound_enter);
 676DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(get_reparse_compound_enter);
 677DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
 678DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
 679DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter);
 680DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mknod_enter);
 681
 682DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
 683	TP_PROTO(unsigned int xid,
 684		__u32	tid,
 685		__u64	sesid),
 686	TP_ARGS(xid, tid, sesid),
 687	TP_STRUCT__entry(
 688		__field(unsigned int, xid)
 689		__field(__u32, tid)
 690		__field(__u64, sesid)
 691	),
 692	TP_fast_assign(
 693		__entry->xid = xid;
 694		__entry->tid = tid;
 695		__entry->sesid = sesid;
 696	),
 697	TP_printk("xid=%u sid=0x%llx tid=0x%x",
 698		__entry->xid, __entry->sesid, __entry->tid)
 699)
 700
 701#define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name)     \
 702DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name,    \
 703	TP_PROTO(unsigned int xid,		\
 704		__u32	tid,			\
 705		__u64	sesid),			\
 706	TP_ARGS(xid, tid, sesid))
 707
 708DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
 709DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done);
 710DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
 711DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
 712DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
 713DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
 714DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
 715DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_reparse_compound_done);
 716DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(get_reparse_compound_done);
 717DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_wsl_ea_compound_done);
 718DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
 719DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
 720DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done);
 721DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mknod_done);
 722
 723DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
 724	TP_PROTO(unsigned int xid,
 725		__u32	tid,
 726		__u64	sesid,
 727		int	rc),
 728	TP_ARGS(xid, tid, sesid, rc),
 729	TP_STRUCT__entry(
 730		__field(unsigned int, xid)
 731		__field(__u32, tid)
 732		__field(__u64, sesid)
 733		__field(int, rc)
 734	),
 735	TP_fast_assign(
 736		__entry->xid = xid;
 737		__entry->tid = tid;
 738		__entry->sesid = sesid;
 739		__entry->rc = rc;
 740	),
 741	TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
 742		__entry->xid, __entry->sesid, __entry->tid,
 743		__entry->rc)
 744)
 745
 746#define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name)     \
 747DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name,    \
 748	TP_PROTO(unsigned int xid,		\
 749		__u32	tid,			\
 750		__u64	sesid,			\
 751		int rc),			\
 752	TP_ARGS(xid, tid, sesid, rc))
 753
 754DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
 755DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err);
 756DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
 757DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
 758DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
 759DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
 760DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
 761DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_reparse_compound_err);
 762DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(get_reparse_compound_err);
 763DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_wsl_ea_compound_err);
 764DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
 765DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
 766DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err);
 767DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mknod_err);
 768
 769/*
 770 * For logging SMB3 Status code and Command for responses which return errors
 771 */
 772DECLARE_EVENT_CLASS(smb3_cmd_err_class,
 773	TP_PROTO(__u32	tid,
 774		__u64	sesid,
 775		__u16	cmd,
 776		__u64	mid,
 777		__u32	status,
 778		int	rc),
 779	TP_ARGS(tid, sesid, cmd, mid, status, rc),
 780	TP_STRUCT__entry(
 781		__field(__u32, tid)
 782		__field(__u64, sesid)
 783		__field(__u16, cmd)
 784		__field(__u64, mid)
 785		__field(__u32, status)
 786		__field(int, rc)
 787	),
 788	TP_fast_assign(
 789		__entry->tid = tid;
 790		__entry->sesid = sesid;
 791		__entry->cmd = cmd;
 792		__entry->mid = mid;
 793		__entry->status = status;
 794		__entry->rc = rc;
 795	),
 796	TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
 797		__entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
 798		__entry->status, __entry->rc)
 799)
 800
 801#define DEFINE_SMB3_CMD_ERR_EVENT(name)          \
 802DEFINE_EVENT(smb3_cmd_err_class, smb3_##name,    \
 803	TP_PROTO(__u32	tid,			\
 804		__u64	sesid,			\
 805		__u16	cmd,			\
 806		__u64	mid,			\
 807		__u32	status,			\
 808		int	rc),			\
 809	TP_ARGS(tid, sesid, cmd, mid, status, rc))
 810
 811DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
 812
 813DECLARE_EVENT_CLASS(smb3_cmd_done_class,
 814	TP_PROTO(__u32	tid,
 815		__u64	sesid,
 816		__u16	cmd,
 817		__u64	mid),
 818	TP_ARGS(tid, sesid, cmd, mid),
 819	TP_STRUCT__entry(
 820		__field(__u32, tid)
 821		__field(__u64, sesid)
 822		__field(__u16, cmd)
 823		__field(__u64, mid)
 824	),
 825	TP_fast_assign(
 826		__entry->tid = tid;
 827		__entry->sesid = sesid;
 828		__entry->cmd = cmd;
 829		__entry->mid = mid;
 830	),
 831	TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
 832		__entry->sesid, __entry->tid,
 833		__entry->cmd, __entry->mid)
 834)
 835
 836#define DEFINE_SMB3_CMD_DONE_EVENT(name)          \
 837DEFINE_EVENT(smb3_cmd_done_class, smb3_##name,    \
 838	TP_PROTO(__u32	tid,			\
 839		__u64	sesid,			\
 840		__u16	cmd,			\
 841		__u64	mid),			\
 842	TP_ARGS(tid, sesid, cmd, mid))
 843
 844DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
 845DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
 846DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
 847
 848DECLARE_EVENT_CLASS(smb3_mid_class,
 849	TP_PROTO(__u16	cmd,
 850		__u64	mid,
 851		__u32	pid,
 852		unsigned long when_sent,
 853		unsigned long when_received),
 854	TP_ARGS(cmd, mid, pid, when_sent, when_received),
 855	TP_STRUCT__entry(
 856		__field(__u16, cmd)
 857		__field(__u64, mid)
 858		__field(__u32, pid)
 859		__field(unsigned long, when_sent)
 860		__field(unsigned long, when_received)
 861	),
 862	TP_fast_assign(
 863		__entry->cmd = cmd;
 864		__entry->mid = mid;
 865		__entry->pid = pid;
 866		__entry->when_sent = when_sent;
 867		__entry->when_received = when_received;
 868	),
 869	TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
 870		__entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
 871		__entry->when_received)
 872)
 873
 874#define DEFINE_SMB3_MID_EVENT(name)          \
 875DEFINE_EVENT(smb3_mid_class, smb3_##name,    \
 876	TP_PROTO(__u16	cmd,			\
 877		__u64	mid,			\
 878		__u32	pid,			\
 879		unsigned long when_sent,	\
 880		unsigned long when_received),	\
 881	TP_ARGS(cmd, mid, pid, when_sent, when_received))
 882
 883DEFINE_SMB3_MID_EVENT(slow_rsp);
 884
 885DECLARE_EVENT_CLASS(smb3_exit_err_class,
 886	TP_PROTO(unsigned int xid,
 887		const char *func_name,
 888		int	rc),
 889	TP_ARGS(xid, func_name, rc),
 890	TP_STRUCT__entry(
 891		__field(unsigned int, xid)
 892		__string(func_name, func_name)
 893		__field(int, rc)
 894	),
 895	TP_fast_assign(
 896		__entry->xid = xid;
 897		__assign_str(func_name);
 898		__entry->rc = rc;
 899	),
 900	TP_printk("\t%s: xid=%u rc=%d",
 901		__get_str(func_name), __entry->xid, __entry->rc)
 902)
 903
 904#define DEFINE_SMB3_EXIT_ERR_EVENT(name)          \
 905DEFINE_EVENT(smb3_exit_err_class, smb3_##name,    \
 906	TP_PROTO(unsigned int xid,		\
 907		const char *func_name,		\
 908		int	rc),			\
 909	TP_ARGS(xid, func_name, rc))
 910
 911DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
 912
 913
 914DECLARE_EVENT_CLASS(smb3_sync_err_class,
 915	TP_PROTO(unsigned long ino,
 916		int	rc),
 917	TP_ARGS(ino, rc),
 918	TP_STRUCT__entry(
 919		__field(unsigned long, ino)
 920		__field(int, rc)
 921	),
 922	TP_fast_assign(
 923		__entry->ino = ino;
 924		__entry->rc = rc;
 925	),
 926	TP_printk("\tino=%lu rc=%d",
 927		__entry->ino, __entry->rc)
 928)
 929
 930#define DEFINE_SMB3_SYNC_ERR_EVENT(name)          \
 931DEFINE_EVENT(smb3_sync_err_class, cifs_##name,    \
 932	TP_PROTO(unsigned long ino,		\
 933		int	rc),			\
 934	TP_ARGS(ino, rc))
 935
 936DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
 937DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
 938
 939
 940DECLARE_EVENT_CLASS(smb3_enter_exit_class,
 941	TP_PROTO(unsigned int xid,
 942		const char *func_name),
 943	TP_ARGS(xid, func_name),
 944	TP_STRUCT__entry(
 945		__field(unsigned int, xid)
 946		__string(func_name, func_name)
 947	),
 948	TP_fast_assign(
 949		__entry->xid = xid;
 950		__assign_str(func_name);
 951	),
 952	TP_printk("\t%s: xid=%u",
 953		__get_str(func_name), __entry->xid)
 954)
 955
 956#define DEFINE_SMB3_ENTER_EXIT_EVENT(name)        \
 957DEFINE_EVENT(smb3_enter_exit_class, smb3_##name,  \
 958	TP_PROTO(unsigned int xid,		\
 959		const char *func_name),		\
 960	TP_ARGS(xid, func_name))
 961
 962DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
 963DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
 964
 965/*
 966 * For SMB2/SMB3 tree connect
 967 */
 968
 969DECLARE_EVENT_CLASS(smb3_tcon_class,
 970	TP_PROTO(unsigned int xid,
 971		__u32	tid,
 972		__u64	sesid,
 973		const char *unc_name,
 974		int	rc),
 975	TP_ARGS(xid, tid, sesid, unc_name, rc),
 976	TP_STRUCT__entry(
 977		__field(unsigned int, xid)
 978		__field(__u32, tid)
 979		__field(__u64, sesid)
 980		__string(name, unc_name)
 981		__field(int, rc)
 982	),
 983	TP_fast_assign(
 984		__entry->xid = xid;
 985		__entry->tid = tid;
 986		__entry->sesid = sesid;
 987		__assign_str(name);
 988		__entry->rc = rc;
 989	),
 990	TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
 991		__entry->xid, __entry->sesid, __entry->tid,
 992		__get_str(name), __entry->rc)
 993)
 994
 995#define DEFINE_SMB3_TCON_EVENT(name)          \
 996DEFINE_EVENT(smb3_tcon_class, smb3_##name,    \
 997	TP_PROTO(unsigned int xid,		\
 998		__u32	tid,			\
 999		__u64	sesid,			\
1000		const char *unc_name,		\
1001		int	rc),			\
1002	TP_ARGS(xid, tid, sesid, unc_name, rc))
1003
1004DEFINE_SMB3_TCON_EVENT(tcon);
1005DEFINE_SMB3_TCON_EVENT(qfs_done);
1006
1007/*
1008 * For smb2/smb3 open (including create and mkdir) calls
1009 */
1010
1011DECLARE_EVENT_CLASS(smb3_open_enter_class,
1012	TP_PROTO(unsigned int xid,
1013		__u32	tid,
1014		__u64	sesid,
1015		const char *full_path,
1016		int	create_options,
1017		int	desired_access),
1018	TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access),
1019	TP_STRUCT__entry(
1020		__field(unsigned int, xid)
1021		__field(__u32, tid)
1022		__field(__u64, sesid)
1023		__string(path, full_path)
1024		__field(int, create_options)
1025		__field(int, desired_access)
1026	),
1027	TP_fast_assign(
1028		__entry->xid = xid;
1029		__entry->tid = tid;
1030		__entry->sesid = sesid;
1031		__assign_str(path);
1032		__entry->create_options = create_options;
1033		__entry->desired_access = desired_access;
1034	),
1035	TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x",
1036		__entry->xid, __entry->sesid, __entry->tid, __get_str(path),
1037		__entry->create_options, __entry->desired_access)
1038)
1039
1040#define DEFINE_SMB3_OPEN_ENTER_EVENT(name)        \
1041DEFINE_EVENT(smb3_open_enter_class, smb3_##name,  \
1042	TP_PROTO(unsigned int xid,		\
1043		__u32	tid,			\
1044		__u64	sesid,			\
1045		const char *full_path,		\
1046		int	create_options,		\
1047		int	desired_access),	\
1048	TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access))
1049
1050DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
1051DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
1052
1053DECLARE_EVENT_CLASS(smb3_open_err_class,
1054	TP_PROTO(unsigned int xid,
1055		__u32	tid,
1056		__u64	sesid,
1057		int	create_options,
1058		int	desired_access,
1059		int	rc),
1060	TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
1061	TP_STRUCT__entry(
1062		__field(unsigned int, xid)
1063		__field(__u32, tid)
1064		__field(__u64, sesid)
1065		__field(int,   create_options)
1066		__field(int, desired_access)
1067		__field(int, rc)
1068	),
1069	TP_fast_assign(
1070		__entry->xid = xid;
1071		__entry->tid = tid;
1072		__entry->sesid = sesid;
1073		__entry->create_options = create_options;
1074		__entry->desired_access = desired_access;
1075		__entry->rc = rc;
1076	),
1077	TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
1078		__entry->xid, __entry->sesid, __entry->tid,
1079		__entry->create_options, __entry->desired_access, __entry->rc)
1080)
1081
1082#define DEFINE_SMB3_OPEN_ERR_EVENT(name)          \
1083DEFINE_EVENT(smb3_open_err_class, smb3_##name,    \
1084	TP_PROTO(unsigned int xid,		\
1085		__u32	tid,			\
1086		__u64	sesid,			\
1087		int	create_options,		\
1088		int	desired_access,		\
1089		int	rc),			\
1090	TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
1091
1092DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
1093DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
1094
1095DECLARE_EVENT_CLASS(smb3_open_done_class,
1096	TP_PROTO(unsigned int xid,
1097		__u64	fid,
1098		__u32	tid,
1099		__u64	sesid,
1100		int	create_options,
1101		int	desired_access),
1102	TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
1103	TP_STRUCT__entry(
1104		__field(unsigned int, xid)
1105		__field(__u64, fid)
1106		__field(__u32, tid)
1107		__field(__u64, sesid)
1108		__field(int, create_options)
1109		__field(int, desired_access)
1110	),
1111	TP_fast_assign(
1112		__entry->xid = xid;
1113		__entry->fid = fid;
1114		__entry->tid = tid;
1115		__entry->sesid = sesid;
1116		__entry->create_options = create_options;
1117		__entry->desired_access = desired_access;
1118	),
1119	TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
1120		__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
1121		__entry->create_options, __entry->desired_access)
1122)
1123
1124#define DEFINE_SMB3_OPEN_DONE_EVENT(name)        \
1125DEFINE_EVENT(smb3_open_done_class, smb3_##name,  \
1126	TP_PROTO(unsigned int xid,		\
1127		__u64	fid,			\
1128		__u32	tid,			\
1129		__u64	sesid,			\
1130		int	create_options,		\
1131		int	desired_access),	\
1132	TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
1133
1134DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
1135DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
1136
1137
1138DECLARE_EVENT_CLASS(smb3_lease_done_class,
1139	TP_PROTO(__u32	lease_state,
1140		__u32	tid,
1141		__u64	sesid,
1142		__u64	lease_key_low,
1143		__u64	lease_key_high),
1144	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
1145	TP_STRUCT__entry(
1146		__field(__u32, lease_state)
1147		__field(__u32, tid)
1148		__field(__u64, sesid)
1149		__field(__u64, lease_key_low)
1150		__field(__u64, lease_key_high)
1151	),
1152	TP_fast_assign(
1153		__entry->lease_state = lease_state;
1154		__entry->tid = tid;
1155		__entry->sesid = sesid;
1156		__entry->lease_key_low = lease_key_low;
1157		__entry->lease_key_high = lease_key_high;
1158	),
1159	TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
1160		__entry->sesid, __entry->tid, __entry->lease_key_high,
1161		__entry->lease_key_low, __entry->lease_state)
1162)
1163
1164#define DEFINE_SMB3_LEASE_DONE_EVENT(name)        \
1165DEFINE_EVENT(smb3_lease_done_class, smb3_##name,  \
1166	TP_PROTO(__u32	lease_state,		\
1167		__u32	tid,			\
1168		__u64	sesid,			\
1169		__u64	lease_key_low,		\
1170		__u64	lease_key_high),	\
1171	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
1172
1173DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
1174DEFINE_SMB3_LEASE_DONE_EVENT(lease_not_found);
1175
1176DECLARE_EVENT_CLASS(smb3_lease_err_class,
1177	TP_PROTO(__u32	lease_state,
1178		__u32	tid,
1179		__u64	sesid,
1180		__u64	lease_key_low,
1181		__u64	lease_key_high,
1182		int	rc),
1183	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
1184	TP_STRUCT__entry(
1185		__field(__u32, lease_state)
1186		__field(__u32, tid)
1187		__field(__u64, sesid)
1188		__field(__u64, lease_key_low)
1189		__field(__u64, lease_key_high)
1190		__field(int, rc)
1191	),
1192	TP_fast_assign(
1193		__entry->lease_state = lease_state;
1194		__entry->tid = tid;
1195		__entry->sesid = sesid;
1196		__entry->lease_key_low = lease_key_low;
1197		__entry->lease_key_high = lease_key_high;
1198		__entry->rc = rc;
1199	),
1200	TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
1201		__entry->sesid, __entry->tid, __entry->lease_key_high,
1202		__entry->lease_key_low, __entry->lease_state, __entry->rc)
1203)
1204
1205#define DEFINE_SMB3_LEASE_ERR_EVENT(name)        \
1206DEFINE_EVENT(smb3_lease_err_class, smb3_##name,  \
1207	TP_PROTO(__u32	lease_state,		\
1208		__u32	tid,			\
1209		__u64	sesid,			\
1210		__u64	lease_key_low,		\
1211		__u64	lease_key_high,		\
1212		int	rc),			\
1213	TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
1214
1215DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
1216
1217DECLARE_EVENT_CLASS(smb3_connect_class,
1218	TP_PROTO(char *hostname,
1219		__u64 conn_id,
1220		const struct __kernel_sockaddr_storage *dst_addr),
1221	TP_ARGS(hostname, conn_id, dst_addr),
1222	TP_STRUCT__entry(
1223		__string(hostname, hostname)
1224		__field(__u64, conn_id)
1225		__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
1226	),
1227	TP_fast_assign(
1228		struct sockaddr_storage *pss = NULL;
1229
1230		__entry->conn_id = conn_id;
1231		pss = (struct sockaddr_storage *)__entry->dst_addr;
1232		*pss = *dst_addr;
1233		__assign_str(hostname);
1234	),
1235	TP_printk("conn_id=0x%llx server=%s addr=%pISpsfc",
1236		__entry->conn_id,
1237		__get_str(hostname),
1238		__entry->dst_addr)
1239)
1240
1241#define DEFINE_SMB3_CONNECT_EVENT(name)        \
1242DEFINE_EVENT(smb3_connect_class, smb3_##name,  \
1243	TP_PROTO(char *hostname,		\
1244		__u64 conn_id,			\
1245		const struct __kernel_sockaddr_storage *addr),	\
1246	TP_ARGS(hostname, conn_id, addr))
1247
1248DEFINE_SMB3_CONNECT_EVENT(connect_done);
1249DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done);
1250DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err);
1251
1252DECLARE_EVENT_CLASS(smb3_connect_err_class,
1253	TP_PROTO(char *hostname, __u64 conn_id,
1254		const struct __kernel_sockaddr_storage *dst_addr, int rc),
1255	TP_ARGS(hostname, conn_id, dst_addr, rc),
1256	TP_STRUCT__entry(
1257		__string(hostname, hostname)
1258		__field(__u64, conn_id)
1259		__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
1260		__field(int, rc)
1261	),
1262	TP_fast_assign(
1263		struct sockaddr_storage *pss = NULL;
1264
1265		__entry->conn_id = conn_id;
1266		__entry->rc = rc;
1267		pss = (struct sockaddr_storage *)__entry->dst_addr;
1268		*pss = *dst_addr;
1269		__assign_str(hostname);
1270	),
1271	TP_printk("rc=%d conn_id=0x%llx server=%s addr=%pISpsfc",
1272		__entry->rc,
1273		__entry->conn_id,
1274		__get_str(hostname),
1275		__entry->dst_addr)
1276)
1277
1278#define DEFINE_SMB3_CONNECT_ERR_EVENT(name)        \
1279DEFINE_EVENT(smb3_connect_err_class, smb3_##name,  \
1280	TP_PROTO(char *hostname,		\
1281		__u64 conn_id,			\
1282		const struct __kernel_sockaddr_storage *addr,	\
1283		int rc),			\
1284	TP_ARGS(hostname, conn_id, addr, rc))
1285
1286DEFINE_SMB3_CONNECT_ERR_EVENT(connect_err);
1287
1288DECLARE_EVENT_CLASS(smb3_sess_setup_err_class,
1289	TP_PROTO(char *hostname, char *username, __u64 conn_id,
1290		const struct __kernel_sockaddr_storage *dst_addr, int rc),
1291	TP_ARGS(hostname, username, conn_id, dst_addr, rc),
1292	TP_STRUCT__entry(
1293		__string(hostname, hostname)
1294		__string(username, username)
1295		__field(__u64, conn_id)
1296		__array(__u8, dst_addr, sizeof(struct sockaddr_storage))
1297		__field(int, rc)
1298	),
1299	TP_fast_assign(
1300		struct sockaddr_storage *pss = NULL;
1301
1302		__entry->conn_id = conn_id;
1303		__entry->rc = rc;
1304		pss = (struct sockaddr_storage *)__entry->dst_addr;
1305		*pss = *dst_addr;
1306		__assign_str(hostname);
1307		__assign_str(username);
1308	),
1309	TP_printk("rc=%d user=%s conn_id=0x%llx server=%s addr=%pISpsfc",
1310		__entry->rc,
1311		__get_str(username),
1312		__entry->conn_id,
1313		__get_str(hostname),
1314		__entry->dst_addr)
1315)
1316
1317#define DEFINE_SMB3_SES_SETUP_ERR_EVENT(name)        \
1318DEFINE_EVENT(smb3_sess_setup_err_class, smb3_##name,  \
1319	TP_PROTO(char *hostname,		\
1320		char *username,			\
1321		__u64 conn_id,			\
1322		const struct __kernel_sockaddr_storage *addr,	\
1323		int rc),			\
1324	TP_ARGS(hostname, username, conn_id, addr, rc))
1325
1326DEFINE_SMB3_SES_SETUP_ERR_EVENT(key_expired);
1327
1328DECLARE_EVENT_CLASS(smb3_reconnect_class,
1329	TP_PROTO(__u64	currmid,
1330		__u64 conn_id,
1331		char *hostname),
1332	TP_ARGS(currmid, conn_id, hostname),
1333	TP_STRUCT__entry(
1334		__field(__u64, currmid)
1335		__field(__u64, conn_id)
1336		__string(hostname, hostname)
1337	),
1338	TP_fast_assign(
1339		__entry->currmid = currmid;
1340		__entry->conn_id = conn_id;
1341		__assign_str(hostname);
1342	),
1343	TP_printk("conn_id=0x%llx server=%s current_mid=%llu",
1344		__entry->conn_id,
1345		__get_str(hostname),
1346		__entry->currmid)
1347)
1348
1349#define DEFINE_SMB3_RECONNECT_EVENT(name)        \
1350DEFINE_EVENT(smb3_reconnect_class, smb3_##name,  \
1351	TP_PROTO(__u64	currmid,		\
1352		__u64 conn_id,			\
1353		char *hostname),				\
1354	TP_ARGS(currmid, conn_id, hostname))
1355
1356DEFINE_SMB3_RECONNECT_EVENT(reconnect);
1357DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
1358
1359DECLARE_EVENT_CLASS(smb3_ses_class,
1360	TP_PROTO(__u64	sesid),
1361	TP_ARGS(sesid),
1362	TP_STRUCT__entry(
1363		__field(__u64, sesid)
1364	),
1365	TP_fast_assign(
1366		__entry->sesid = sesid;
1367	),
1368	TP_printk("sid=0x%llx",
1369		__entry->sesid)
1370)
1371
1372#define DEFINE_SMB3_SES_EVENT(name)        \
1373DEFINE_EVENT(smb3_ses_class, smb3_##name,  \
1374	TP_PROTO(__u64	sesid),				\
1375	TP_ARGS(sesid))
1376
1377DEFINE_SMB3_SES_EVENT(ses_not_found);
1378
1379DECLARE_EVENT_CLASS(smb3_ioctl_class,
1380	TP_PROTO(unsigned int xid,
1381		__u64	fid,
1382		unsigned int command),
1383	TP_ARGS(xid, fid, command),
1384	TP_STRUCT__entry(
1385		__field(unsigned int, xid)
1386		__field(__u64, fid)
1387		__field(unsigned int, command)
1388	),
1389	TP_fast_assign(
1390		__entry->xid = xid;
1391		__entry->fid = fid;
1392		__entry->command = command;
1393	),
1394	TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x",
1395		  __entry->xid, __entry->fid, __entry->command)
1396)
1397
1398#define DEFINE_SMB3_IOCTL_EVENT(name)        \
1399DEFINE_EVENT(smb3_ioctl_class, smb3_##name,  \
1400	TP_PROTO(unsigned int xid,	     \
1401		__u64 fid,		     \
1402		unsigned int command),	     \
1403	TP_ARGS(xid, fid, command))
1404
1405DEFINE_SMB3_IOCTL_EVENT(ioctl);
1406
1407DECLARE_EVENT_CLASS(smb3_shutdown_class,
1408	TP_PROTO(__u32 flags,
1409		__u32 tid),
1410	TP_ARGS(flags, tid),
1411	TP_STRUCT__entry(
1412		__field(__u32, flags)
1413		__field(__u32, tid)
1414	),
1415	TP_fast_assign(
1416		__entry->flags = flags;
1417		__entry->tid = tid;
1418	),
1419	TP_printk("flags=0x%x tid=0x%x",
1420		  __entry->flags, __entry->tid)
1421)
1422
1423#define DEFINE_SMB3_SHUTDOWN_EVENT(name)        \
1424DEFINE_EVENT(smb3_shutdown_class, smb3_##name,  \
1425	TP_PROTO(__u32 flags,		     \
1426		__u32 tid),		     \
1427	TP_ARGS(flags, tid))
1428
1429DEFINE_SMB3_SHUTDOWN_EVENT(shutdown_enter);
1430DEFINE_SMB3_SHUTDOWN_EVENT(shutdown_done);
1431
1432DECLARE_EVENT_CLASS(smb3_shutdown_err_class,
1433	TP_PROTO(int rc,
1434		__u32 flags,
1435		__u32 tid),
1436	TP_ARGS(rc, flags, tid),
1437	TP_STRUCT__entry(
1438		__field(int, rc)
1439		__field(__u32, flags)
1440		__field(__u32, tid)
1441	),
1442	TP_fast_assign(
1443		__entry->rc = rc;
1444		__entry->flags = flags;
1445		__entry->tid = tid;
1446	),
1447	TP_printk("rc=%d flags=0x%x tid=0x%x",
1448		__entry->rc, __entry->flags, __entry->tid)
1449)
1450
1451#define DEFINE_SMB3_SHUTDOWN_ERR_EVENT(name)        \
1452DEFINE_EVENT(smb3_shutdown_err_class, smb3_##name,  \
1453	TP_PROTO(int rc,		     \
1454		__u32 flags,		     \
1455		__u32 tid),		     \
1456	TP_ARGS(rc, flags, tid))
1457
1458DEFINE_SMB3_SHUTDOWN_ERR_EVENT(shutdown_err);
1459
1460DECLARE_EVENT_CLASS(smb3_credit_class,
1461	TP_PROTO(__u64	currmid,
1462		__u64 conn_id,
1463		char *hostname,
1464		int credits,
1465		int credits_to_add,
1466		int in_flight),
1467	TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight),
1468	TP_STRUCT__entry(
1469		__field(__u64, currmid)
1470		__field(__u64, conn_id)
1471		__string(hostname, hostname)
1472		__field(int, credits)
1473		__field(int, credits_to_add)
1474		__field(int, in_flight)
1475	),
1476	TP_fast_assign(
1477		__entry->currmid = currmid;
1478		__entry->conn_id = conn_id;
1479		__assign_str(hostname);
1480		__entry->credits = credits;
1481		__entry->credits_to_add = credits_to_add;
1482		__entry->in_flight = in_flight;
1483	),
1484	TP_printk("conn_id=0x%llx server=%s current_mid=%llu "
1485			"credits=%d credit_change=%d in_flight=%d",
1486		__entry->conn_id,
1487		__get_str(hostname),
1488		__entry->currmid,
1489		__entry->credits,
1490		__entry->credits_to_add,
1491		__entry->in_flight)
1492)
1493
1494#define DEFINE_SMB3_CREDIT_EVENT(name)        \
1495DEFINE_EVENT(smb3_credit_class, smb3_##name,  \
1496	TP_PROTO(__u64	currmid,		\
1497		__u64 conn_id,			\
1498		char *hostname,			\
1499		int  credits,			\
1500		int  credits_to_add,	\
1501		int in_flight),			\
1502	TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight))
1503
1504DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
1505DEFINE_SMB3_CREDIT_EVENT(reconnect_detected);
1506DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
1507DEFINE_SMB3_CREDIT_EVENT(insufficient_credits);
1508DEFINE_SMB3_CREDIT_EVENT(too_many_credits);
1509DEFINE_SMB3_CREDIT_EVENT(add_credits);
1510DEFINE_SMB3_CREDIT_EVENT(adj_credits);
1511DEFINE_SMB3_CREDIT_EVENT(hdr_credits);
1512DEFINE_SMB3_CREDIT_EVENT(nblk_credits);
1513DEFINE_SMB3_CREDIT_EVENT(pend_credits);
1514DEFINE_SMB3_CREDIT_EVENT(wait_credits);
1515DEFINE_SMB3_CREDIT_EVENT(waitff_credits);
1516DEFINE_SMB3_CREDIT_EVENT(overflow_credits);
1517DEFINE_SMB3_CREDIT_EVENT(set_credits);
1518
1519
1520TRACE_EVENT(smb3_tcon_ref,
1521	    TP_PROTO(unsigned int tcon_debug_id, int ref,
1522		     enum smb3_tcon_ref_trace trace),
1523	    TP_ARGS(tcon_debug_id, ref, trace),
1524	    TP_STRUCT__entry(
1525		    __field(unsigned int,		tcon)
1526		    __field(int,			ref)
1527		    __field(enum smb3_tcon_ref_trace,	trace)
1528			     ),
1529	    TP_fast_assign(
1530		    __entry->tcon	= tcon_debug_id;
1531		    __entry->ref	= ref;
1532		    __entry->trace	= trace;
1533			   ),
1534	    TP_printk("TC=%08x %s r=%u",
1535		      __entry->tcon,
1536		      __print_symbolic(__entry->trace, smb3_tcon_ref_traces),
1537		      __entry->ref)
1538	    );
1539
1540TRACE_EVENT(smb3_rw_credits,
1541	    TP_PROTO(unsigned int rreq_debug_id,
1542		     unsigned int subreq_debug_index,
1543		     unsigned int subreq_credits,
1544		     unsigned int server_credits,
1545		     int server_in_flight,
1546		     int credit_change,
1547		     enum smb3_rw_credits_trace trace),
1548	    TP_ARGS(rreq_debug_id, subreq_debug_index, subreq_credits,
1549		    server_credits, server_in_flight, credit_change, trace),
1550	    TP_STRUCT__entry(
1551		    __field(unsigned int, rreq_debug_id)
1552		    __field(unsigned int, subreq_debug_index)
1553		    __field(unsigned int, subreq_credits)
1554		    __field(unsigned int, server_credits)
1555		    __field(int,	  in_flight)
1556		    __field(int,	  credit_change)
1557		    __field(enum smb3_rw_credits_trace, trace)
1558			     ),
1559	    TP_fast_assign(
1560		    __entry->rreq_debug_id	= rreq_debug_id;
1561		    __entry->subreq_debug_index	= subreq_debug_index;
1562		    __entry->subreq_credits	= subreq_credits;
1563		    __entry->server_credits	= server_credits;
1564		    __entry->in_flight		= server_in_flight;
1565		    __entry->credit_change	= credit_change;
1566		    __entry->trace		= trace;
1567			   ),
1568	    TP_printk("R=%08x[%x] %s cred=%u chg=%d pool=%u ifl=%d",
1569		      __entry->rreq_debug_id, __entry->subreq_debug_index,
1570		      __print_symbolic(__entry->trace, smb3_rw_credits_traces),
1571		      __entry->subreq_credits, __entry->credit_change,
1572		      __entry->server_credits, __entry->in_flight)
1573	    );
1574
1575
1576#undef EM
1577#undef E_
1578#endif /* _CIFS_TRACE_H */
1579
1580#undef TRACE_INCLUDE_PATH
1581#define TRACE_INCLUDE_PATH .
1582#define TRACE_INCLUDE_FILE trace
1583#include <trace/define_trace.h>