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