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