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 successful read or write */ 211 DECLARE_EVENT_CLASS(smb3_rw_done_class, 212 TP_PROTO(unsigned int rreq_debug_id, 213 unsigned int rreq_debug_index, 214 unsigned int xid, 215 __u64 fid, 216 __u32 tid, 217 __u64 sesid, 218 __u64 offset, 219 __u32 len), 220 TP_ARGS(rreq_debug_id, rreq_debug_index, 221 xid, fid, tid, sesid, offset, len), 222 TP_STRUCT__entry( 223 __field(unsigned int, rreq_debug_id) 224 __field(unsigned int, rreq_debug_index) 225 __field(unsigned int, xid) 226 __field(__u64, fid) 227 __field(__u32, tid) 228 __field(__u64, sesid) 229 __field(__u64, offset) 230 __field(__u32, len) 231 ), 232 TP_fast_assign( 233 __entry->rreq_debug_id = rreq_debug_id; 234 __entry->rreq_debug_index = rreq_debug_index; 235 __entry->xid = xid; 236 __entry->fid = fid; 237 __entry->tid = tid; 238 __entry->sesid = sesid; 239 __entry->offset = offset; 240 __entry->len = len; 241 ), 242 TP_printk("R=%08x[%x] xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x", 243 __entry->rreq_debug_id, __entry->rreq_debug_index, 244 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 245 __entry->offset, __entry->len) 246 ) 247 248 #define DEFINE_SMB3_RW_DONE_EVENT(name) \ 249 DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \ 250 TP_PROTO(unsigned int rreq_debug_id, \ 251 unsigned int rreq_debug_index, \ 252 unsigned int xid, \ 253 __u64 fid, \ 254 __u32 tid, \ 255 __u64 sesid, \ 256 __u64 offset, \ 257 __u32 len), \ 258 TP_ARGS(rreq_debug_id, rreq_debug_index, xid, fid, tid, sesid, offset, len)) 259 260 DEFINE_SMB3_RW_DONE_EVENT(read_enter); 261 DEFINE_SMB3_RW_DONE_EVENT(read_done); 262 263 /* For logging successful other op */ 264 DECLARE_EVENT_CLASS(smb3_other_done_class, 265 TP_PROTO(unsigned int xid, 266 __u64 fid, 267 __u32 tid, 268 __u64 sesid, 269 __u64 offset, 270 __u32 len), 271 TP_ARGS(xid, fid, tid, sesid, offset, len), 272 TP_STRUCT__entry( 273 __field(unsigned int, xid) 274 __field(__u64, fid) 275 __field(__u32, tid) 276 __field(__u64, sesid) 277 __field(__u64, offset) 278 __field(__u32, len) 279 ), 280 TP_fast_assign( 281 __entry->xid = xid; 282 __entry->fid = fid; 283 __entry->tid = tid; 284 __entry->sesid = sesid; 285 __entry->offset = offset; 286 __entry->len = len; 287 ), 288 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x", 289 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 290 __entry->offset, __entry->len) 291 ) 292 293 #define DEFINE_SMB3_OTHER_DONE_EVENT(name) \ 294 DEFINE_EVENT(smb3_other_done_class, smb3_##name, \ 295 TP_PROTO(unsigned int xid, \ 296 __u64 fid, \ 297 __u32 tid, \ 298 __u64 sesid, \ 299 __u64 offset, \ 300 __u32 len), \ 301 TP_ARGS(xid, fid, tid, sesid, offset, len)) 302 303 DEFINE_SMB3_OTHER_DONE_EVENT(write_enter); 304 DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_enter); 305 DEFINE_SMB3_OTHER_DONE_EVENT(zero_enter); 306 DEFINE_SMB3_OTHER_DONE_EVENT(falloc_enter); 307 DEFINE_SMB3_OTHER_DONE_EVENT(write_done); 308 DEFINE_SMB3_OTHER_DONE_EVENT(query_dir_done); 309 DEFINE_SMB3_OTHER_DONE_EVENT(zero_done); 310 DEFINE_SMB3_OTHER_DONE_EVENT(falloc_done); 311 312 /* For logging successful set EOF (truncate) */ 313 DECLARE_EVENT_CLASS(smb3_eof_class, 314 TP_PROTO(unsigned int xid, 315 __u64 fid, 316 __u32 tid, 317 __u64 sesid, 318 __u64 offset), 319 TP_ARGS(xid, fid, tid, sesid, offset), 320 TP_STRUCT__entry( 321 __field(unsigned int, xid) 322 __field(__u64, fid) 323 __field(__u32, tid) 324 __field(__u64, sesid) 325 __field(__u64, offset) 326 ), 327 TP_fast_assign( 328 __entry->xid = xid; 329 __entry->fid = fid; 330 __entry->tid = tid; 331 __entry->sesid = sesid; 332 __entry->offset = offset; 333 ), 334 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx", 335 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 336 __entry->offset) 337 ) 338 339 #define DEFINE_SMB3_EOF_EVENT(name) \ 340 DEFINE_EVENT(smb3_eof_class, smb3_##name, \ 341 TP_PROTO(unsigned int xid, \ 342 __u64 fid, \ 343 __u32 tid, \ 344 __u64 sesid, \ 345 __u64 offset), \ 346 TP_ARGS(xid, fid, tid, sesid, offset)) 347 348 DEFINE_SMB3_EOF_EVENT(set_eof); 349 350 /* 351 * For handle based calls other than read and write, and get/set info 352 */ 353 DECLARE_EVENT_CLASS(smb3_fd_class, 354 TP_PROTO(unsigned int xid, 355 __u64 fid, 356 __u32 tid, 357 __u64 sesid), 358 TP_ARGS(xid, fid, tid, sesid), 359 TP_STRUCT__entry( 360 __field(unsigned int, xid) 361 __field(__u64, fid) 362 __field(__u32, tid) 363 __field(__u64, sesid) 364 ), 365 TP_fast_assign( 366 __entry->xid = xid; 367 __entry->fid = fid; 368 __entry->tid = tid; 369 __entry->sesid = sesid; 370 ), 371 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx", 372 __entry->xid, __entry->sesid, __entry->tid, __entry->fid) 373 ) 374 375 #define DEFINE_SMB3_FD_EVENT(name) \ 376 DEFINE_EVENT(smb3_fd_class, smb3_##name, \ 377 TP_PROTO(unsigned int xid, \ 378 __u64 fid, \ 379 __u32 tid, \ 380 __u64 sesid), \ 381 TP_ARGS(xid, fid, tid, sesid)) 382 383 DEFINE_SMB3_FD_EVENT(flush_enter); 384 DEFINE_SMB3_FD_EVENT(flush_done); 385 DEFINE_SMB3_FD_EVENT(close_enter); 386 DEFINE_SMB3_FD_EVENT(close_done); 387 DEFINE_SMB3_FD_EVENT(oplock_not_found); 388 389 DECLARE_EVENT_CLASS(smb3_fd_err_class, 390 TP_PROTO(unsigned int xid, 391 __u64 fid, 392 __u32 tid, 393 __u64 sesid, 394 int rc), 395 TP_ARGS(xid, fid, tid, sesid, rc), 396 TP_STRUCT__entry( 397 __field(unsigned int, xid) 398 __field(__u64, fid) 399 __field(__u32, tid) 400 __field(__u64, sesid) 401 __field(int, rc) 402 ), 403 TP_fast_assign( 404 __entry->xid = xid; 405 __entry->fid = fid; 406 __entry->tid = tid; 407 __entry->sesid = sesid; 408 __entry->rc = rc; 409 ), 410 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d", 411 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 412 __entry->rc) 413 ) 414 415 #define DEFINE_SMB3_FD_ERR_EVENT(name) \ 416 DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \ 417 TP_PROTO(unsigned int xid, \ 418 __u64 fid, \ 419 __u32 tid, \ 420 __u64 sesid, \ 421 int rc), \ 422 TP_ARGS(xid, fid, tid, sesid, rc)) 423 424 DEFINE_SMB3_FD_ERR_EVENT(flush_err); 425 DEFINE_SMB3_FD_ERR_EVENT(lock_err); 426 DEFINE_SMB3_FD_ERR_EVENT(close_err); 427 428 /* 429 * For handle based query/set info calls 430 */ 431 DECLARE_EVENT_CLASS(smb3_inf_enter_class, 432 TP_PROTO(unsigned int xid, 433 __u64 fid, 434 __u32 tid, 435 __u64 sesid, 436 __u8 infclass, 437 __u32 type), 438 TP_ARGS(xid, fid, tid, sesid, infclass, type), 439 TP_STRUCT__entry( 440 __field(unsigned int, xid) 441 __field(__u64, fid) 442 __field(__u32, tid) 443 __field(__u64, sesid) 444 __field(__u8, infclass) 445 __field(__u32, type) 446 ), 447 TP_fast_assign( 448 __entry->xid = xid; 449 __entry->fid = fid; 450 __entry->tid = tid; 451 __entry->sesid = sesid; 452 __entry->infclass = infclass; 453 __entry->type = type; 454 ), 455 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x", 456 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 457 __entry->infclass, __entry->type) 458 ) 459 460 #define DEFINE_SMB3_INF_ENTER_EVENT(name) \ 461 DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \ 462 TP_PROTO(unsigned int xid, \ 463 __u64 fid, \ 464 __u32 tid, \ 465 __u64 sesid, \ 466 __u8 infclass, \ 467 __u32 type), \ 468 TP_ARGS(xid, fid, tid, sesid, infclass, type)) 469 470 DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter); 471 DEFINE_SMB3_INF_ENTER_EVENT(query_info_done); 472 DEFINE_SMB3_INF_ENTER_EVENT(notify_enter); 473 DEFINE_SMB3_INF_ENTER_EVENT(notify_done); 474 475 DECLARE_EVENT_CLASS(smb3_inf_err_class, 476 TP_PROTO(unsigned int xid, 477 __u64 fid, 478 __u32 tid, 479 __u64 sesid, 480 __u8 infclass, 481 __u32 type, 482 int rc), 483 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc), 484 TP_STRUCT__entry( 485 __field(unsigned int, xid) 486 __field(__u64, fid) 487 __field(__u32, tid) 488 __field(__u64, sesid) 489 __field(__u8, infclass) 490 __field(__u32, type) 491 __field(int, rc) 492 ), 493 TP_fast_assign( 494 __entry->xid = xid; 495 __entry->fid = fid; 496 __entry->tid = tid; 497 __entry->sesid = sesid; 498 __entry->infclass = infclass; 499 __entry->type = type; 500 __entry->rc = rc; 501 ), 502 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d", 503 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 504 __entry->infclass, __entry->type, __entry->rc) 505 ) 506 507 #define DEFINE_SMB3_INF_ERR_EVENT(name) \ 508 DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \ 509 TP_PROTO(unsigned int xid, \ 510 __u64 fid, \ 511 __u32 tid, \ 512 __u64 sesid, \ 513 __u8 infclass, \ 514 __u32 type, \ 515 int rc), \ 516 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc)) 517 518 DEFINE_SMB3_INF_ERR_EVENT(query_info_err); 519 DEFINE_SMB3_INF_ERR_EVENT(set_info_err); 520 DEFINE_SMB3_INF_ERR_EVENT(notify_err); 521 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err); 522 523 DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class, 524 TP_PROTO(unsigned int xid, 525 __u32 tid, 526 __u64 sesid, 527 const char *full_path), 528 TP_ARGS(xid, tid, sesid, full_path), 529 TP_STRUCT__entry( 530 __field(unsigned int, xid) 531 __field(__u32, tid) 532 __field(__u64, sesid) 533 __string(path, full_path) 534 ), 535 TP_fast_assign( 536 __entry->xid = xid; 537 __entry->tid = tid; 538 __entry->sesid = sesid; 539 __assign_str(path); 540 ), 541 TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s", 542 __entry->xid, __entry->sesid, __entry->tid, 543 __get_str(path)) 544 ) 545 546 #define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name) \ 547 DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name, \ 548 TP_PROTO(unsigned int xid, \ 549 __u32 tid, \ 550 __u64 sesid, \ 551 const char *full_path), \ 552 TP_ARGS(xid, tid, sesid, full_path)) 553 554 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter); 555 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter); 556 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter); 557 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter); 558 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter); 559 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter); 560 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter); 561 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_reparse_compound_enter); 562 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(get_reparse_compound_enter); 563 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter); 564 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter); 565 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(tdis_enter); 566 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mknod_enter); 567 568 DECLARE_EVENT_CLASS(smb3_inf_compound_done_class, 569 TP_PROTO(unsigned int xid, 570 __u32 tid, 571 __u64 sesid), 572 TP_ARGS(xid, tid, sesid), 573 TP_STRUCT__entry( 574 __field(unsigned int, xid) 575 __field(__u32, tid) 576 __field(__u64, sesid) 577 ), 578 TP_fast_assign( 579 __entry->xid = xid; 580 __entry->tid = tid; 581 __entry->sesid = sesid; 582 ), 583 TP_printk("xid=%u sid=0x%llx tid=0x%x", 584 __entry->xid, __entry->sesid, __entry->tid) 585 ) 586 587 #define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \ 588 DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \ 589 TP_PROTO(unsigned int xid, \ 590 __u32 tid, \ 591 __u64 sesid), \ 592 TP_ARGS(xid, tid, sesid)) 593 594 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done); 595 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done); 596 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done); 597 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done); 598 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done); 599 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done); 600 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done); 601 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_reparse_compound_done); 602 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(get_reparse_compound_done); 603 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_wsl_ea_compound_done); 604 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done); 605 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done); 606 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done); 607 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mknod_done); 608 609 DECLARE_EVENT_CLASS(smb3_inf_compound_err_class, 610 TP_PROTO(unsigned int xid, 611 __u32 tid, 612 __u64 sesid, 613 int rc), 614 TP_ARGS(xid, tid, sesid, rc), 615 TP_STRUCT__entry( 616 __field(unsigned int, xid) 617 __field(__u32, tid) 618 __field(__u64, sesid) 619 __field(int, rc) 620 ), 621 TP_fast_assign( 622 __entry->xid = xid; 623 __entry->tid = tid; 624 __entry->sesid = sesid; 625 __entry->rc = rc; 626 ), 627 TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d", 628 __entry->xid, __entry->sesid, __entry->tid, 629 __entry->rc) 630 ) 631 632 #define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \ 633 DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \ 634 TP_PROTO(unsigned int xid, \ 635 __u32 tid, \ 636 __u64 sesid, \ 637 int rc), \ 638 TP_ARGS(xid, tid, sesid, rc)) 639 640 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err); 641 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err); 642 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err); 643 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err); 644 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err); 645 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err); 646 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err); 647 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_reparse_compound_err); 648 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(get_reparse_compound_err); 649 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_wsl_ea_compound_err); 650 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err); 651 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err); 652 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err); 653 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mknod_err); 654 655 /* 656 * For logging SMB3 Status code and Command for responses which return errors 657 */ 658 DECLARE_EVENT_CLASS(smb3_cmd_err_class, 659 TP_PROTO(__u32 tid, 660 __u64 sesid, 661 __u16 cmd, 662 __u64 mid, 663 __u32 status, 664 int rc), 665 TP_ARGS(tid, sesid, cmd, mid, status, rc), 666 TP_STRUCT__entry( 667 __field(__u32, tid) 668 __field(__u64, sesid) 669 __field(__u16, cmd) 670 __field(__u64, mid) 671 __field(__u32, status) 672 __field(int, rc) 673 ), 674 TP_fast_assign( 675 __entry->tid = tid; 676 __entry->sesid = sesid; 677 __entry->cmd = cmd; 678 __entry->mid = mid; 679 __entry->status = status; 680 __entry->rc = rc; 681 ), 682 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d", 683 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid, 684 __entry->status, __entry->rc) 685 ) 686 687 #define DEFINE_SMB3_CMD_ERR_EVENT(name) \ 688 DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \ 689 TP_PROTO(__u32 tid, \ 690 __u64 sesid, \ 691 __u16 cmd, \ 692 __u64 mid, \ 693 __u32 status, \ 694 int rc), \ 695 TP_ARGS(tid, sesid, cmd, mid, status, rc)) 696 697 DEFINE_SMB3_CMD_ERR_EVENT(cmd_err); 698 699 DECLARE_EVENT_CLASS(smb3_cmd_done_class, 700 TP_PROTO(__u32 tid, 701 __u64 sesid, 702 __u16 cmd, 703 __u64 mid), 704 TP_ARGS(tid, sesid, cmd, mid), 705 TP_STRUCT__entry( 706 __field(__u32, tid) 707 __field(__u64, sesid) 708 __field(__u16, cmd) 709 __field(__u64, mid) 710 ), 711 TP_fast_assign( 712 __entry->tid = tid; 713 __entry->sesid = sesid; 714 __entry->cmd = cmd; 715 __entry->mid = mid; 716 ), 717 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu", 718 __entry->sesid, __entry->tid, 719 __entry->cmd, __entry->mid) 720 ) 721 722 #define DEFINE_SMB3_CMD_DONE_EVENT(name) \ 723 DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \ 724 TP_PROTO(__u32 tid, \ 725 __u64 sesid, \ 726 __u16 cmd, \ 727 __u64 mid), \ 728 TP_ARGS(tid, sesid, cmd, mid)) 729 730 DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter); 731 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done); 732 DEFINE_SMB3_CMD_DONE_EVENT(ses_expired); 733 734 DECLARE_EVENT_CLASS(smb3_mid_class, 735 TP_PROTO(__u16 cmd, 736 __u64 mid, 737 __u32 pid, 738 unsigned long when_sent, 739 unsigned long when_received), 740 TP_ARGS(cmd, mid, pid, when_sent, when_received), 741 TP_STRUCT__entry( 742 __field(__u16, cmd) 743 __field(__u64, mid) 744 __field(__u32, pid) 745 __field(unsigned long, when_sent) 746 __field(unsigned long, when_received) 747 ), 748 TP_fast_assign( 749 __entry->cmd = cmd; 750 __entry->mid = mid; 751 __entry->pid = pid; 752 __entry->when_sent = when_sent; 753 __entry->when_received = when_received; 754 ), 755 TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu", 756 __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent, 757 __entry->when_received) 758 ) 759 760 #define DEFINE_SMB3_MID_EVENT(name) \ 761 DEFINE_EVENT(smb3_mid_class, smb3_##name, \ 762 TP_PROTO(__u16 cmd, \ 763 __u64 mid, \ 764 __u32 pid, \ 765 unsigned long when_sent, \ 766 unsigned long when_received), \ 767 TP_ARGS(cmd, mid, pid, when_sent, when_received)) 768 769 DEFINE_SMB3_MID_EVENT(slow_rsp); 770 771 DECLARE_EVENT_CLASS(smb3_exit_err_class, 772 TP_PROTO(unsigned int xid, 773 const char *func_name, 774 int rc), 775 TP_ARGS(xid, func_name, rc), 776 TP_STRUCT__entry( 777 __field(unsigned int, xid) 778 __string(func_name, func_name) 779 __field(int, rc) 780 ), 781 TP_fast_assign( 782 __entry->xid = xid; 783 __assign_str(func_name); 784 __entry->rc = rc; 785 ), 786 TP_printk("\t%s: xid=%u rc=%d", 787 __get_str(func_name), __entry->xid, __entry->rc) 788 ) 789 790 #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \ 791 DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \ 792 TP_PROTO(unsigned int xid, \ 793 const char *func_name, \ 794 int rc), \ 795 TP_ARGS(xid, func_name, rc)) 796 797 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err); 798 799 800 DECLARE_EVENT_CLASS(smb3_sync_err_class, 801 TP_PROTO(unsigned long ino, 802 int rc), 803 TP_ARGS(ino, rc), 804 TP_STRUCT__entry( 805 __field(unsigned long, ino) 806 __field(int, rc) 807 ), 808 TP_fast_assign( 809 __entry->ino = ino; 810 __entry->rc = rc; 811 ), 812 TP_printk("\tino=%lu rc=%d", 813 __entry->ino, __entry->rc) 814 ) 815 816 #define DEFINE_SMB3_SYNC_ERR_EVENT(name) \ 817 DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \ 818 TP_PROTO(unsigned long ino, \ 819 int rc), \ 820 TP_ARGS(ino, rc)) 821 822 DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err); 823 DEFINE_SMB3_SYNC_ERR_EVENT(flush_err); 824 825 826 DECLARE_EVENT_CLASS(smb3_enter_exit_class, 827 TP_PROTO(unsigned int xid, 828 const char *func_name), 829 TP_ARGS(xid, func_name), 830 TP_STRUCT__entry( 831 __field(unsigned int, xid) 832 __string(func_name, func_name) 833 ), 834 TP_fast_assign( 835 __entry->xid = xid; 836 __assign_str(func_name); 837 ), 838 TP_printk("\t%s: xid=%u", 839 __get_str(func_name), __entry->xid) 840 ) 841 842 #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \ 843 DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \ 844 TP_PROTO(unsigned int xid, \ 845 const char *func_name), \ 846 TP_ARGS(xid, func_name)) 847 848 DEFINE_SMB3_ENTER_EXIT_EVENT(enter); 849 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done); 850 851 /* 852 * For SMB2/SMB3 tree connect 853 */ 854 855 DECLARE_EVENT_CLASS(smb3_tcon_class, 856 TP_PROTO(unsigned int xid, 857 __u32 tid, 858 __u64 sesid, 859 const char *unc_name, 860 int rc), 861 TP_ARGS(xid, tid, sesid, unc_name, rc), 862 TP_STRUCT__entry( 863 __field(unsigned int, xid) 864 __field(__u32, tid) 865 __field(__u64, sesid) 866 __string(name, unc_name) 867 __field(int, rc) 868 ), 869 TP_fast_assign( 870 __entry->xid = xid; 871 __entry->tid = tid; 872 __entry->sesid = sesid; 873 __assign_str(name); 874 __entry->rc = rc; 875 ), 876 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d", 877 __entry->xid, __entry->sesid, __entry->tid, 878 __get_str(name), __entry->rc) 879 ) 880 881 #define DEFINE_SMB3_TCON_EVENT(name) \ 882 DEFINE_EVENT(smb3_tcon_class, smb3_##name, \ 883 TP_PROTO(unsigned int xid, \ 884 __u32 tid, \ 885 __u64 sesid, \ 886 const char *unc_name, \ 887 int rc), \ 888 TP_ARGS(xid, tid, sesid, unc_name, rc)) 889 890 DEFINE_SMB3_TCON_EVENT(tcon); 891 DEFINE_SMB3_TCON_EVENT(qfs_done); 892 893 /* 894 * For smb2/smb3 open (including create and mkdir) calls 895 */ 896 897 DECLARE_EVENT_CLASS(smb3_open_enter_class, 898 TP_PROTO(unsigned int xid, 899 __u32 tid, 900 __u64 sesid, 901 const char *full_path, 902 int create_options, 903 int desired_access), 904 TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access), 905 TP_STRUCT__entry( 906 __field(unsigned int, xid) 907 __field(__u32, tid) 908 __field(__u64, sesid) 909 __string(path, full_path) 910 __field(int, create_options) 911 __field(int, desired_access) 912 ), 913 TP_fast_assign( 914 __entry->xid = xid; 915 __entry->tid = tid; 916 __entry->sesid = sesid; 917 __assign_str(path); 918 __entry->create_options = create_options; 919 __entry->desired_access = desired_access; 920 ), 921 TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x", 922 __entry->xid, __entry->sesid, __entry->tid, __get_str(path), 923 __entry->create_options, __entry->desired_access) 924 ) 925 926 #define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \ 927 DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \ 928 TP_PROTO(unsigned int xid, \ 929 __u32 tid, \ 930 __u64 sesid, \ 931 const char *full_path, \ 932 int create_options, \ 933 int desired_access), \ 934 TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access)) 935 936 DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); 937 DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter); 938 939 DECLARE_EVENT_CLASS(smb3_open_err_class, 940 TP_PROTO(unsigned int xid, 941 __u32 tid, 942 __u64 sesid, 943 int create_options, 944 int desired_access, 945 int rc), 946 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc), 947 TP_STRUCT__entry( 948 __field(unsigned int, xid) 949 __field(__u32, tid) 950 __field(__u64, sesid) 951 __field(int, create_options) 952 __field(int, desired_access) 953 __field(int, rc) 954 ), 955 TP_fast_assign( 956 __entry->xid = xid; 957 __entry->tid = tid; 958 __entry->sesid = sesid; 959 __entry->create_options = create_options; 960 __entry->desired_access = desired_access; 961 __entry->rc = rc; 962 ), 963 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d", 964 __entry->xid, __entry->sesid, __entry->tid, 965 __entry->create_options, __entry->desired_access, __entry->rc) 966 ) 967 968 #define DEFINE_SMB3_OPEN_ERR_EVENT(name) \ 969 DEFINE_EVENT(smb3_open_err_class, smb3_##name, \ 970 TP_PROTO(unsigned int xid, \ 971 __u32 tid, \ 972 __u64 sesid, \ 973 int create_options, \ 974 int desired_access, \ 975 int rc), \ 976 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc)) 977 978 DEFINE_SMB3_OPEN_ERR_EVENT(open_err); 979 DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err); 980 981 DECLARE_EVENT_CLASS(smb3_open_done_class, 982 TP_PROTO(unsigned int xid, 983 __u64 fid, 984 __u32 tid, 985 __u64 sesid, 986 int create_options, 987 int desired_access), 988 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access), 989 TP_STRUCT__entry( 990 __field(unsigned int, xid) 991 __field(__u64, fid) 992 __field(__u32, tid) 993 __field(__u64, sesid) 994 __field(int, create_options) 995 __field(int, desired_access) 996 ), 997 TP_fast_assign( 998 __entry->xid = xid; 999 __entry->fid = fid; 1000 __entry->tid = tid; 1001 __entry->sesid = sesid; 1002 __entry->create_options = create_options; 1003 __entry->desired_access = desired_access; 1004 ), 1005 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x", 1006 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 1007 __entry->create_options, __entry->desired_access) 1008 ) 1009 1010 #define DEFINE_SMB3_OPEN_DONE_EVENT(name) \ 1011 DEFINE_EVENT(smb3_open_done_class, smb3_##name, \ 1012 TP_PROTO(unsigned int xid, \ 1013 __u64 fid, \ 1014 __u32 tid, \ 1015 __u64 sesid, \ 1016 int create_options, \ 1017 int desired_access), \ 1018 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access)) 1019 1020 DEFINE_SMB3_OPEN_DONE_EVENT(open_done); 1021 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done); 1022 1023 1024 DECLARE_EVENT_CLASS(smb3_lease_done_class, 1025 TP_PROTO(__u32 lease_state, 1026 __u32 tid, 1027 __u64 sesid, 1028 __u64 lease_key_low, 1029 __u64 lease_key_high), 1030 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high), 1031 TP_STRUCT__entry( 1032 __field(__u32, lease_state) 1033 __field(__u32, tid) 1034 __field(__u64, sesid) 1035 __field(__u64, lease_key_low) 1036 __field(__u64, lease_key_high) 1037 ), 1038 TP_fast_assign( 1039 __entry->lease_state = lease_state; 1040 __entry->tid = tid; 1041 __entry->sesid = sesid; 1042 __entry->lease_key_low = lease_key_low; 1043 __entry->lease_key_high = lease_key_high; 1044 ), 1045 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x", 1046 __entry->sesid, __entry->tid, __entry->lease_key_high, 1047 __entry->lease_key_low, __entry->lease_state) 1048 ) 1049 1050 #define DEFINE_SMB3_LEASE_DONE_EVENT(name) \ 1051 DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \ 1052 TP_PROTO(__u32 lease_state, \ 1053 __u32 tid, \ 1054 __u64 sesid, \ 1055 __u64 lease_key_low, \ 1056 __u64 lease_key_high), \ 1057 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high)) 1058 1059 DEFINE_SMB3_LEASE_DONE_EVENT(lease_done); 1060 DEFINE_SMB3_LEASE_DONE_EVENT(lease_not_found); 1061 1062 DECLARE_EVENT_CLASS(smb3_lease_err_class, 1063 TP_PROTO(__u32 lease_state, 1064 __u32 tid, 1065 __u64 sesid, 1066 __u64 lease_key_low, 1067 __u64 lease_key_high, 1068 int rc), 1069 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc), 1070 TP_STRUCT__entry( 1071 __field(__u32, lease_state) 1072 __field(__u32, tid) 1073 __field(__u64, sesid) 1074 __field(__u64, lease_key_low) 1075 __field(__u64, lease_key_high) 1076 __field(int, rc) 1077 ), 1078 TP_fast_assign( 1079 __entry->lease_state = lease_state; 1080 __entry->tid = tid; 1081 __entry->sesid = sesid; 1082 __entry->lease_key_low = lease_key_low; 1083 __entry->lease_key_high = lease_key_high; 1084 __entry->rc = rc; 1085 ), 1086 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d", 1087 __entry->sesid, __entry->tid, __entry->lease_key_high, 1088 __entry->lease_key_low, __entry->lease_state, __entry->rc) 1089 ) 1090 1091 #define DEFINE_SMB3_LEASE_ERR_EVENT(name) \ 1092 DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \ 1093 TP_PROTO(__u32 lease_state, \ 1094 __u32 tid, \ 1095 __u64 sesid, \ 1096 __u64 lease_key_low, \ 1097 __u64 lease_key_high, \ 1098 int rc), \ 1099 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc)) 1100 1101 DEFINE_SMB3_LEASE_ERR_EVENT(lease_err); 1102 1103 DECLARE_EVENT_CLASS(smb3_connect_class, 1104 TP_PROTO(char *hostname, 1105 __u64 conn_id, 1106 const struct __kernel_sockaddr_storage *dst_addr), 1107 TP_ARGS(hostname, conn_id, dst_addr), 1108 TP_STRUCT__entry( 1109 __string(hostname, hostname) 1110 __field(__u64, conn_id) 1111 __array(__u8, dst_addr, sizeof(struct sockaddr_storage)) 1112 ), 1113 TP_fast_assign( 1114 struct sockaddr_storage *pss = NULL; 1115 1116 __entry->conn_id = conn_id; 1117 pss = (struct sockaddr_storage *)__entry->dst_addr; 1118 *pss = *dst_addr; 1119 __assign_str(hostname); 1120 ), 1121 TP_printk("conn_id=0x%llx server=%s addr=%pISpsfc", 1122 __entry->conn_id, 1123 __get_str(hostname), 1124 __entry->dst_addr) 1125 ) 1126 1127 #define DEFINE_SMB3_CONNECT_EVENT(name) \ 1128 DEFINE_EVENT(smb3_connect_class, smb3_##name, \ 1129 TP_PROTO(char *hostname, \ 1130 __u64 conn_id, \ 1131 const struct __kernel_sockaddr_storage *addr), \ 1132 TP_ARGS(hostname, conn_id, addr)) 1133 1134 DEFINE_SMB3_CONNECT_EVENT(connect_done); 1135 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done); 1136 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err); 1137 1138 DECLARE_EVENT_CLASS(smb3_connect_err_class, 1139 TP_PROTO(char *hostname, __u64 conn_id, 1140 const struct __kernel_sockaddr_storage *dst_addr, int rc), 1141 TP_ARGS(hostname, conn_id, dst_addr, rc), 1142 TP_STRUCT__entry( 1143 __string(hostname, hostname) 1144 __field(__u64, conn_id) 1145 __array(__u8, dst_addr, sizeof(struct sockaddr_storage)) 1146 __field(int, rc) 1147 ), 1148 TP_fast_assign( 1149 struct sockaddr_storage *pss = NULL; 1150 1151 __entry->conn_id = conn_id; 1152 __entry->rc = rc; 1153 pss = (struct sockaddr_storage *)__entry->dst_addr; 1154 *pss = *dst_addr; 1155 __assign_str(hostname); 1156 ), 1157 TP_printk("rc=%d conn_id=0x%llx server=%s addr=%pISpsfc", 1158 __entry->rc, 1159 __entry->conn_id, 1160 __get_str(hostname), 1161 __entry->dst_addr) 1162 ) 1163 1164 #define DEFINE_SMB3_CONNECT_ERR_EVENT(name) \ 1165 DEFINE_EVENT(smb3_connect_err_class, smb3_##name, \ 1166 TP_PROTO(char *hostname, \ 1167 __u64 conn_id, \ 1168 const struct __kernel_sockaddr_storage *addr, \ 1169 int rc), \ 1170 TP_ARGS(hostname, conn_id, addr, rc)) 1171 1172 DEFINE_SMB3_CONNECT_ERR_EVENT(connect_err); 1173 1174 DECLARE_EVENT_CLASS(smb3_reconnect_class, 1175 TP_PROTO(__u64 currmid, 1176 __u64 conn_id, 1177 char *hostname), 1178 TP_ARGS(currmid, conn_id, hostname), 1179 TP_STRUCT__entry( 1180 __field(__u64, currmid) 1181 __field(__u64, conn_id) 1182 __string(hostname, hostname) 1183 ), 1184 TP_fast_assign( 1185 __entry->currmid = currmid; 1186 __entry->conn_id = conn_id; 1187 __assign_str(hostname); 1188 ), 1189 TP_printk("conn_id=0x%llx server=%s current_mid=%llu", 1190 __entry->conn_id, 1191 __get_str(hostname), 1192 __entry->currmid) 1193 ) 1194 1195 #define DEFINE_SMB3_RECONNECT_EVENT(name) \ 1196 DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \ 1197 TP_PROTO(__u64 currmid, \ 1198 __u64 conn_id, \ 1199 char *hostname), \ 1200 TP_ARGS(currmid, conn_id, hostname)) 1201 1202 DEFINE_SMB3_RECONNECT_EVENT(reconnect); 1203 DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect); 1204 1205 DECLARE_EVENT_CLASS(smb3_ses_class, 1206 TP_PROTO(__u64 sesid), 1207 TP_ARGS(sesid), 1208 TP_STRUCT__entry( 1209 __field(__u64, sesid) 1210 ), 1211 TP_fast_assign( 1212 __entry->sesid = sesid; 1213 ), 1214 TP_printk("sid=0x%llx", 1215 __entry->sesid) 1216 ) 1217 1218 #define DEFINE_SMB3_SES_EVENT(name) \ 1219 DEFINE_EVENT(smb3_ses_class, smb3_##name, \ 1220 TP_PROTO(__u64 sesid), \ 1221 TP_ARGS(sesid)) 1222 1223 DEFINE_SMB3_SES_EVENT(ses_not_found); 1224 1225 DECLARE_EVENT_CLASS(smb3_ioctl_class, 1226 TP_PROTO(unsigned int xid, 1227 __u64 fid, 1228 unsigned int command), 1229 TP_ARGS(xid, fid, command), 1230 TP_STRUCT__entry( 1231 __field(unsigned int, xid) 1232 __field(__u64, fid) 1233 __field(unsigned int, command) 1234 ), 1235 TP_fast_assign( 1236 __entry->xid = xid; 1237 __entry->fid = fid; 1238 __entry->command = command; 1239 ), 1240 TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x", 1241 __entry->xid, __entry->fid, __entry->command) 1242 ) 1243 1244 #define DEFINE_SMB3_IOCTL_EVENT(name) \ 1245 DEFINE_EVENT(smb3_ioctl_class, smb3_##name, \ 1246 TP_PROTO(unsigned int xid, \ 1247 __u64 fid, \ 1248 unsigned int command), \ 1249 TP_ARGS(xid, fid, command)) 1250 1251 DEFINE_SMB3_IOCTL_EVENT(ioctl); 1252 1253 1254 1255 1256 1257 DECLARE_EVENT_CLASS(smb3_credit_class, 1258 TP_PROTO(__u64 currmid, 1259 __u64 conn_id, 1260 char *hostname, 1261 int credits, 1262 int credits_to_add, 1263 int in_flight), 1264 TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight), 1265 TP_STRUCT__entry( 1266 __field(__u64, currmid) 1267 __field(__u64, conn_id) 1268 __string(hostname, hostname) 1269 __field(int, credits) 1270 __field(int, credits_to_add) 1271 __field(int, in_flight) 1272 ), 1273 TP_fast_assign( 1274 __entry->currmid = currmid; 1275 __entry->conn_id = conn_id; 1276 __assign_str(hostname); 1277 __entry->credits = credits; 1278 __entry->credits_to_add = credits_to_add; 1279 __entry->in_flight = in_flight; 1280 ), 1281 TP_printk("conn_id=0x%llx server=%s current_mid=%llu " 1282 "credits=%d credit_change=%d in_flight=%d", 1283 __entry->conn_id, 1284 __get_str(hostname), 1285 __entry->currmid, 1286 __entry->credits, 1287 __entry->credits_to_add, 1288 __entry->in_flight) 1289 ) 1290 1291 #define DEFINE_SMB3_CREDIT_EVENT(name) \ 1292 DEFINE_EVENT(smb3_credit_class, smb3_##name, \ 1293 TP_PROTO(__u64 currmid, \ 1294 __u64 conn_id, \ 1295 char *hostname, \ 1296 int credits, \ 1297 int credits_to_add, \ 1298 int in_flight), \ 1299 TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight)) 1300 1301 DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits); 1302 DEFINE_SMB3_CREDIT_EVENT(reconnect_detected); 1303 DEFINE_SMB3_CREDIT_EVENT(credit_timeout); 1304 DEFINE_SMB3_CREDIT_EVENT(insufficient_credits); 1305 DEFINE_SMB3_CREDIT_EVENT(too_many_credits); 1306 DEFINE_SMB3_CREDIT_EVENT(add_credits); 1307 DEFINE_SMB3_CREDIT_EVENT(adj_credits); 1308 DEFINE_SMB3_CREDIT_EVENT(hdr_credits); 1309 DEFINE_SMB3_CREDIT_EVENT(nblk_credits); 1310 DEFINE_SMB3_CREDIT_EVENT(pend_credits); 1311 DEFINE_SMB3_CREDIT_EVENT(wait_credits); 1312 DEFINE_SMB3_CREDIT_EVENT(waitff_credits); 1313 DEFINE_SMB3_CREDIT_EVENT(overflow_credits); 1314 DEFINE_SMB3_CREDIT_EVENT(set_credits); 1315 1316 1317 TRACE_EVENT(smb3_tcon_ref, 1318 TP_PROTO(unsigned int tcon_debug_id, int ref, 1319 enum smb3_tcon_ref_trace trace), 1320 TP_ARGS(tcon_debug_id, ref, trace), 1321 TP_STRUCT__entry( 1322 __field(unsigned int, tcon) 1323 __field(int, ref) 1324 __field(enum smb3_tcon_ref_trace, trace) 1325 ), 1326 TP_fast_assign( 1327 __entry->tcon = tcon_debug_id; 1328 __entry->ref = ref; 1329 __entry->trace = trace; 1330 ), 1331 TP_printk("TC=%08x %s r=%u", 1332 __entry->tcon, 1333 __print_symbolic(__entry->trace, smb3_tcon_ref_traces), 1334 __entry->ref) 1335 ); 1336 1337 TRACE_EVENT(smb3_rw_credits, 1338 TP_PROTO(unsigned int rreq_debug_id, 1339 unsigned int subreq_debug_index, 1340 unsigned int subreq_credits, 1341 unsigned int server_credits, 1342 int server_in_flight, 1343 int credit_change, 1344 enum smb3_rw_credits_trace trace), 1345 TP_ARGS(rreq_debug_id, subreq_debug_index, subreq_credits, 1346 server_credits, server_in_flight, credit_change, trace), 1347 TP_STRUCT__entry( 1348 __field(unsigned int, rreq_debug_id) 1349 __field(unsigned int, subreq_debug_index) 1350 __field(unsigned int, subreq_credits) 1351 __field(unsigned int, server_credits) 1352 __field(int, in_flight) 1353 __field(int, credit_change) 1354 __field(enum smb3_rw_credits_trace, trace) 1355 ), 1356 TP_fast_assign( 1357 __entry->rreq_debug_id = rreq_debug_id; 1358 __entry->subreq_debug_index = subreq_debug_index; 1359 __entry->subreq_credits = subreq_credits; 1360 __entry->server_credits = server_credits; 1361 __entry->in_flight = server_in_flight; 1362 __entry->credit_change = credit_change; 1363 __entry->trace = trace; 1364 ), 1365 TP_printk("R=%08x[%x] %s cred=%u chg=%d pool=%u ifl=%d", 1366 __entry->rreq_debug_id, __entry->subreq_debug_index, 1367 __print_symbolic(__entry->trace, smb3_rw_credits_traces), 1368 __entry->subreq_credits, __entry->credit_change, 1369 __entry->server_credits, __entry->in_flight) 1370 ); 1371 1372 1373 #undef EM 1374 #undef E_ 1375 #endif /* _CIFS_TRACE_H */ 1376 1377 #undef TRACE_INCLUDE_PATH 1378 #define TRACE_INCLUDE_PATH . 1379 #define TRACE_INCLUDE_FILE trace 1380 #include <trace/define_trace.h> 1381