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