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 DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mknod_enter); 379 380 DECLARE_EVENT_CLASS(smb3_inf_compound_done_class, 381 TP_PROTO(unsigned int xid, 382 __u32 tid, 383 __u64 sesid), 384 TP_ARGS(xid, tid, sesid), 385 TP_STRUCT__entry( 386 __field(unsigned int, xid) 387 __field(__u32, tid) 388 __field(__u64, sesid) 389 ), 390 TP_fast_assign( 391 __entry->xid = xid; 392 __entry->tid = tid; 393 __entry->sesid = sesid; 394 ), 395 TP_printk("xid=%u sid=0x%llx tid=0x%x", 396 __entry->xid, __entry->sesid, __entry->tid) 397 ) 398 399 #define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \ 400 DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \ 401 TP_PROTO(unsigned int xid, \ 402 __u32 tid, \ 403 __u64 sesid), \ 404 TP_ARGS(xid, tid, sesid)) 405 406 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done); 407 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done); 408 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done); 409 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done); 410 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done); 411 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done); 412 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done); 413 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_reparse_compound_done); 414 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(get_reparse_compound_done); 415 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_wsl_ea_compound_done); 416 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done); 417 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done); 418 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(tdis_done); 419 DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mknod_done); 420 421 DECLARE_EVENT_CLASS(smb3_inf_compound_err_class, 422 TP_PROTO(unsigned int xid, 423 __u32 tid, 424 __u64 sesid, 425 int rc), 426 TP_ARGS(xid, tid, sesid, rc), 427 TP_STRUCT__entry( 428 __field(unsigned int, xid) 429 __field(__u32, tid) 430 __field(__u64, sesid) 431 __field(int, rc) 432 ), 433 TP_fast_assign( 434 __entry->xid = xid; 435 __entry->tid = tid; 436 __entry->sesid = sesid; 437 __entry->rc = rc; 438 ), 439 TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d", 440 __entry->xid, __entry->sesid, __entry->tid, 441 __entry->rc) 442 ) 443 444 #define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \ 445 DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \ 446 TP_PROTO(unsigned int xid, \ 447 __u32 tid, \ 448 __u64 sesid, \ 449 int rc), \ 450 TP_ARGS(xid, tid, sesid, rc)) 451 452 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err); 453 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err); 454 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err); 455 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err); 456 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err); 457 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err); 458 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err); 459 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_reparse_compound_err); 460 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(get_reparse_compound_err); 461 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_wsl_ea_compound_err); 462 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err); 463 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err); 464 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(tdis_err); 465 DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mknod_err); 466 467 /* 468 * For logging SMB3 Status code and Command for responses which return errors 469 */ 470 DECLARE_EVENT_CLASS(smb3_cmd_err_class, 471 TP_PROTO(__u32 tid, 472 __u64 sesid, 473 __u16 cmd, 474 __u64 mid, 475 __u32 status, 476 int rc), 477 TP_ARGS(tid, sesid, cmd, mid, status, rc), 478 TP_STRUCT__entry( 479 __field(__u32, tid) 480 __field(__u64, sesid) 481 __field(__u16, cmd) 482 __field(__u64, mid) 483 __field(__u32, status) 484 __field(int, rc) 485 ), 486 TP_fast_assign( 487 __entry->tid = tid; 488 __entry->sesid = sesid; 489 __entry->cmd = cmd; 490 __entry->mid = mid; 491 __entry->status = status; 492 __entry->rc = rc; 493 ), 494 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d", 495 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid, 496 __entry->status, __entry->rc) 497 ) 498 499 #define DEFINE_SMB3_CMD_ERR_EVENT(name) \ 500 DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \ 501 TP_PROTO(__u32 tid, \ 502 __u64 sesid, \ 503 __u16 cmd, \ 504 __u64 mid, \ 505 __u32 status, \ 506 int rc), \ 507 TP_ARGS(tid, sesid, cmd, mid, status, rc)) 508 509 DEFINE_SMB3_CMD_ERR_EVENT(cmd_err); 510 511 DECLARE_EVENT_CLASS(smb3_cmd_done_class, 512 TP_PROTO(__u32 tid, 513 __u64 sesid, 514 __u16 cmd, 515 __u64 mid), 516 TP_ARGS(tid, sesid, cmd, mid), 517 TP_STRUCT__entry( 518 __field(__u32, tid) 519 __field(__u64, sesid) 520 __field(__u16, cmd) 521 __field(__u64, mid) 522 ), 523 TP_fast_assign( 524 __entry->tid = tid; 525 __entry->sesid = sesid; 526 __entry->cmd = cmd; 527 __entry->mid = mid; 528 ), 529 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu", 530 __entry->sesid, __entry->tid, 531 __entry->cmd, __entry->mid) 532 ) 533 534 #define DEFINE_SMB3_CMD_DONE_EVENT(name) \ 535 DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \ 536 TP_PROTO(__u32 tid, \ 537 __u64 sesid, \ 538 __u16 cmd, \ 539 __u64 mid), \ 540 TP_ARGS(tid, sesid, cmd, mid)) 541 542 DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter); 543 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done); 544 DEFINE_SMB3_CMD_DONE_EVENT(ses_expired); 545 546 DECLARE_EVENT_CLASS(smb3_mid_class, 547 TP_PROTO(__u16 cmd, 548 __u64 mid, 549 __u32 pid, 550 unsigned long when_sent, 551 unsigned long when_received), 552 TP_ARGS(cmd, mid, pid, when_sent, when_received), 553 TP_STRUCT__entry( 554 __field(__u16, cmd) 555 __field(__u64, mid) 556 __field(__u32, pid) 557 __field(unsigned long, when_sent) 558 __field(unsigned long, when_received) 559 ), 560 TP_fast_assign( 561 __entry->cmd = cmd; 562 __entry->mid = mid; 563 __entry->pid = pid; 564 __entry->when_sent = when_sent; 565 __entry->when_received = when_received; 566 ), 567 TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu", 568 __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent, 569 __entry->when_received) 570 ) 571 572 #define DEFINE_SMB3_MID_EVENT(name) \ 573 DEFINE_EVENT(smb3_mid_class, smb3_##name, \ 574 TP_PROTO(__u16 cmd, \ 575 __u64 mid, \ 576 __u32 pid, \ 577 unsigned long when_sent, \ 578 unsigned long when_received), \ 579 TP_ARGS(cmd, mid, pid, when_sent, when_received)) 580 581 DEFINE_SMB3_MID_EVENT(slow_rsp); 582 583 DECLARE_EVENT_CLASS(smb3_exit_err_class, 584 TP_PROTO(unsigned int xid, 585 const char *func_name, 586 int rc), 587 TP_ARGS(xid, func_name, rc), 588 TP_STRUCT__entry( 589 __field(unsigned int, xid) 590 __string(func_name, func_name) 591 __field(int, rc) 592 ), 593 TP_fast_assign( 594 __entry->xid = xid; 595 __assign_str(func_name, func_name); 596 __entry->rc = rc; 597 ), 598 TP_printk("\t%s: xid=%u rc=%d", 599 __get_str(func_name), __entry->xid, __entry->rc) 600 ) 601 602 #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \ 603 DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \ 604 TP_PROTO(unsigned int xid, \ 605 const char *func_name, \ 606 int rc), \ 607 TP_ARGS(xid, func_name, rc)) 608 609 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err); 610 611 612 DECLARE_EVENT_CLASS(smb3_sync_err_class, 613 TP_PROTO(unsigned long ino, 614 int rc), 615 TP_ARGS(ino, rc), 616 TP_STRUCT__entry( 617 __field(unsigned long, ino) 618 __field(int, rc) 619 ), 620 TP_fast_assign( 621 __entry->ino = ino; 622 __entry->rc = rc; 623 ), 624 TP_printk("\tino=%lu rc=%d", 625 __entry->ino, __entry->rc) 626 ) 627 628 #define DEFINE_SMB3_SYNC_ERR_EVENT(name) \ 629 DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \ 630 TP_PROTO(unsigned long ino, \ 631 int rc), \ 632 TP_ARGS(ino, rc)) 633 634 DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err); 635 DEFINE_SMB3_SYNC_ERR_EVENT(flush_err); 636 637 638 DECLARE_EVENT_CLASS(smb3_enter_exit_class, 639 TP_PROTO(unsigned int xid, 640 const char *func_name), 641 TP_ARGS(xid, func_name), 642 TP_STRUCT__entry( 643 __field(unsigned int, xid) 644 __string(func_name, func_name) 645 ), 646 TP_fast_assign( 647 __entry->xid = xid; 648 __assign_str(func_name, func_name); 649 ), 650 TP_printk("\t%s: xid=%u", 651 __get_str(func_name), __entry->xid) 652 ) 653 654 #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \ 655 DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \ 656 TP_PROTO(unsigned int xid, \ 657 const char *func_name), \ 658 TP_ARGS(xid, func_name)) 659 660 DEFINE_SMB3_ENTER_EXIT_EVENT(enter); 661 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done); 662 663 /* 664 * For SMB2/SMB3 tree connect 665 */ 666 667 DECLARE_EVENT_CLASS(smb3_tcon_class, 668 TP_PROTO(unsigned int xid, 669 __u32 tid, 670 __u64 sesid, 671 const char *unc_name, 672 int rc), 673 TP_ARGS(xid, tid, sesid, unc_name, rc), 674 TP_STRUCT__entry( 675 __field(unsigned int, xid) 676 __field(__u32, tid) 677 __field(__u64, sesid) 678 __string(name, unc_name) 679 __field(int, rc) 680 ), 681 TP_fast_assign( 682 __entry->xid = xid; 683 __entry->tid = tid; 684 __entry->sesid = sesid; 685 __assign_str(name, unc_name); 686 __entry->rc = rc; 687 ), 688 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d", 689 __entry->xid, __entry->sesid, __entry->tid, 690 __get_str(name), __entry->rc) 691 ) 692 693 #define DEFINE_SMB3_TCON_EVENT(name) \ 694 DEFINE_EVENT(smb3_tcon_class, smb3_##name, \ 695 TP_PROTO(unsigned int xid, \ 696 __u32 tid, \ 697 __u64 sesid, \ 698 const char *unc_name, \ 699 int rc), \ 700 TP_ARGS(xid, tid, sesid, unc_name, rc)) 701 702 DEFINE_SMB3_TCON_EVENT(tcon); 703 DEFINE_SMB3_TCON_EVENT(qfs_done); 704 705 /* 706 * For smb2/smb3 open (including create and mkdir) calls 707 */ 708 709 DECLARE_EVENT_CLASS(smb3_open_enter_class, 710 TP_PROTO(unsigned int xid, 711 __u32 tid, 712 __u64 sesid, 713 const char *full_path, 714 int create_options, 715 int desired_access), 716 TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access), 717 TP_STRUCT__entry( 718 __field(unsigned int, xid) 719 __field(__u32, tid) 720 __field(__u64, sesid) 721 __string(path, full_path) 722 __field(int, create_options) 723 __field(int, desired_access) 724 ), 725 TP_fast_assign( 726 __entry->xid = xid; 727 __entry->tid = tid; 728 __entry->sesid = sesid; 729 __assign_str(path, full_path); 730 __entry->create_options = create_options; 731 __entry->desired_access = desired_access; 732 ), 733 TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x", 734 __entry->xid, __entry->sesid, __entry->tid, __get_str(path), 735 __entry->create_options, __entry->desired_access) 736 ) 737 738 #define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \ 739 DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \ 740 TP_PROTO(unsigned int xid, \ 741 __u32 tid, \ 742 __u64 sesid, \ 743 const char *full_path, \ 744 int create_options, \ 745 int desired_access), \ 746 TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access)) 747 748 DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); 749 DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter); 750 751 DECLARE_EVENT_CLASS(smb3_open_err_class, 752 TP_PROTO(unsigned int xid, 753 __u32 tid, 754 __u64 sesid, 755 int create_options, 756 int desired_access, 757 int rc), 758 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc), 759 TP_STRUCT__entry( 760 __field(unsigned int, xid) 761 __field(__u32, tid) 762 __field(__u64, sesid) 763 __field(int, create_options) 764 __field(int, desired_access) 765 __field(int, rc) 766 ), 767 TP_fast_assign( 768 __entry->xid = xid; 769 __entry->tid = tid; 770 __entry->sesid = sesid; 771 __entry->create_options = create_options; 772 __entry->desired_access = desired_access; 773 __entry->rc = rc; 774 ), 775 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d", 776 __entry->xid, __entry->sesid, __entry->tid, 777 __entry->create_options, __entry->desired_access, __entry->rc) 778 ) 779 780 #define DEFINE_SMB3_OPEN_ERR_EVENT(name) \ 781 DEFINE_EVENT(smb3_open_err_class, smb3_##name, \ 782 TP_PROTO(unsigned int xid, \ 783 __u32 tid, \ 784 __u64 sesid, \ 785 int create_options, \ 786 int desired_access, \ 787 int rc), \ 788 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc)) 789 790 DEFINE_SMB3_OPEN_ERR_EVENT(open_err); 791 DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err); 792 793 DECLARE_EVENT_CLASS(smb3_open_done_class, 794 TP_PROTO(unsigned int xid, 795 __u64 fid, 796 __u32 tid, 797 __u64 sesid, 798 int create_options, 799 int desired_access), 800 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access), 801 TP_STRUCT__entry( 802 __field(unsigned int, xid) 803 __field(__u64, fid) 804 __field(__u32, tid) 805 __field(__u64, sesid) 806 __field(int, create_options) 807 __field(int, desired_access) 808 ), 809 TP_fast_assign( 810 __entry->xid = xid; 811 __entry->fid = fid; 812 __entry->tid = tid; 813 __entry->sesid = sesid; 814 __entry->create_options = create_options; 815 __entry->desired_access = desired_access; 816 ), 817 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x", 818 __entry->xid, __entry->sesid, __entry->tid, __entry->fid, 819 __entry->create_options, __entry->desired_access) 820 ) 821 822 #define DEFINE_SMB3_OPEN_DONE_EVENT(name) \ 823 DEFINE_EVENT(smb3_open_done_class, smb3_##name, \ 824 TP_PROTO(unsigned int xid, \ 825 __u64 fid, \ 826 __u32 tid, \ 827 __u64 sesid, \ 828 int create_options, \ 829 int desired_access), \ 830 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access)) 831 832 DEFINE_SMB3_OPEN_DONE_EVENT(open_done); 833 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done); 834 835 836 DECLARE_EVENT_CLASS(smb3_lease_done_class, 837 TP_PROTO(__u32 lease_state, 838 __u32 tid, 839 __u64 sesid, 840 __u64 lease_key_low, 841 __u64 lease_key_high), 842 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high), 843 TP_STRUCT__entry( 844 __field(__u32, lease_state) 845 __field(__u32, tid) 846 __field(__u64, sesid) 847 __field(__u64, lease_key_low) 848 __field(__u64, lease_key_high) 849 ), 850 TP_fast_assign( 851 __entry->lease_state = lease_state; 852 __entry->tid = tid; 853 __entry->sesid = sesid; 854 __entry->lease_key_low = lease_key_low; 855 __entry->lease_key_high = lease_key_high; 856 ), 857 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x", 858 __entry->sesid, __entry->tid, __entry->lease_key_high, 859 __entry->lease_key_low, __entry->lease_state) 860 ) 861 862 #define DEFINE_SMB3_LEASE_DONE_EVENT(name) \ 863 DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \ 864 TP_PROTO(__u32 lease_state, \ 865 __u32 tid, \ 866 __u64 sesid, \ 867 __u64 lease_key_low, \ 868 __u64 lease_key_high), \ 869 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high)) 870 871 DEFINE_SMB3_LEASE_DONE_EVENT(lease_done); 872 DEFINE_SMB3_LEASE_DONE_EVENT(lease_not_found); 873 874 DECLARE_EVENT_CLASS(smb3_lease_err_class, 875 TP_PROTO(__u32 lease_state, 876 __u32 tid, 877 __u64 sesid, 878 __u64 lease_key_low, 879 __u64 lease_key_high, 880 int rc), 881 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc), 882 TP_STRUCT__entry( 883 __field(__u32, lease_state) 884 __field(__u32, tid) 885 __field(__u64, sesid) 886 __field(__u64, lease_key_low) 887 __field(__u64, lease_key_high) 888 __field(int, rc) 889 ), 890 TP_fast_assign( 891 __entry->lease_state = lease_state; 892 __entry->tid = tid; 893 __entry->sesid = sesid; 894 __entry->lease_key_low = lease_key_low; 895 __entry->lease_key_high = lease_key_high; 896 __entry->rc = rc; 897 ), 898 TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d", 899 __entry->sesid, __entry->tid, __entry->lease_key_high, 900 __entry->lease_key_low, __entry->lease_state, __entry->rc) 901 ) 902 903 #define DEFINE_SMB3_LEASE_ERR_EVENT(name) \ 904 DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \ 905 TP_PROTO(__u32 lease_state, \ 906 __u32 tid, \ 907 __u64 sesid, \ 908 __u64 lease_key_low, \ 909 __u64 lease_key_high, \ 910 int rc), \ 911 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc)) 912 913 DEFINE_SMB3_LEASE_ERR_EVENT(lease_err); 914 915 DECLARE_EVENT_CLASS(smb3_connect_class, 916 TP_PROTO(char *hostname, 917 __u64 conn_id, 918 const struct __kernel_sockaddr_storage *dst_addr), 919 TP_ARGS(hostname, conn_id, dst_addr), 920 TP_STRUCT__entry( 921 __string(hostname, hostname) 922 __field(__u64, conn_id) 923 __array(__u8, dst_addr, sizeof(struct sockaddr_storage)) 924 ), 925 TP_fast_assign( 926 struct sockaddr_storage *pss = NULL; 927 928 __entry->conn_id = conn_id; 929 pss = (struct sockaddr_storage *)__entry->dst_addr; 930 *pss = *dst_addr; 931 __assign_str(hostname, hostname); 932 ), 933 TP_printk("conn_id=0x%llx server=%s addr=%pISpsfc", 934 __entry->conn_id, 935 __get_str(hostname), 936 __entry->dst_addr) 937 ) 938 939 #define DEFINE_SMB3_CONNECT_EVENT(name) \ 940 DEFINE_EVENT(smb3_connect_class, smb3_##name, \ 941 TP_PROTO(char *hostname, \ 942 __u64 conn_id, \ 943 const struct __kernel_sockaddr_storage *addr), \ 944 TP_ARGS(hostname, conn_id, addr)) 945 946 DEFINE_SMB3_CONNECT_EVENT(connect_done); 947 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done); 948 DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err); 949 950 DECLARE_EVENT_CLASS(smb3_connect_err_class, 951 TP_PROTO(char *hostname, __u64 conn_id, 952 const struct __kernel_sockaddr_storage *dst_addr, int rc), 953 TP_ARGS(hostname, conn_id, dst_addr, rc), 954 TP_STRUCT__entry( 955 __string(hostname, hostname) 956 __field(__u64, conn_id) 957 __array(__u8, dst_addr, sizeof(struct sockaddr_storage)) 958 __field(int, rc) 959 ), 960 TP_fast_assign( 961 struct sockaddr_storage *pss = NULL; 962 963 __entry->conn_id = conn_id; 964 __entry->rc = rc; 965 pss = (struct sockaddr_storage *)__entry->dst_addr; 966 *pss = *dst_addr; 967 __assign_str(hostname, hostname); 968 ), 969 TP_printk("rc=%d conn_id=0x%llx server=%s addr=%pISpsfc", 970 __entry->rc, 971 __entry->conn_id, 972 __get_str(hostname), 973 __entry->dst_addr) 974 ) 975 976 #define DEFINE_SMB3_CONNECT_ERR_EVENT(name) \ 977 DEFINE_EVENT(smb3_connect_err_class, smb3_##name, \ 978 TP_PROTO(char *hostname, \ 979 __u64 conn_id, \ 980 const struct __kernel_sockaddr_storage *addr, \ 981 int rc), \ 982 TP_ARGS(hostname, conn_id, addr, rc)) 983 984 DEFINE_SMB3_CONNECT_ERR_EVENT(connect_err); 985 986 DECLARE_EVENT_CLASS(smb3_reconnect_class, 987 TP_PROTO(__u64 currmid, 988 __u64 conn_id, 989 char *hostname), 990 TP_ARGS(currmid, conn_id, hostname), 991 TP_STRUCT__entry( 992 __field(__u64, currmid) 993 __field(__u64, conn_id) 994 __string(hostname, hostname) 995 ), 996 TP_fast_assign( 997 __entry->currmid = currmid; 998 __entry->conn_id = conn_id; 999 __assign_str(hostname, hostname); 1000 ), 1001 TP_printk("conn_id=0x%llx server=%s current_mid=%llu", 1002 __entry->conn_id, 1003 __get_str(hostname), 1004 __entry->currmid) 1005 ) 1006 1007 #define DEFINE_SMB3_RECONNECT_EVENT(name) \ 1008 DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \ 1009 TP_PROTO(__u64 currmid, \ 1010 __u64 conn_id, \ 1011 char *hostname), \ 1012 TP_ARGS(currmid, conn_id, hostname)) 1013 1014 DEFINE_SMB3_RECONNECT_EVENT(reconnect); 1015 DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect); 1016 1017 DECLARE_EVENT_CLASS(smb3_ses_class, 1018 TP_PROTO(__u64 sesid), 1019 TP_ARGS(sesid), 1020 TP_STRUCT__entry( 1021 __field(__u64, sesid) 1022 ), 1023 TP_fast_assign( 1024 __entry->sesid = sesid; 1025 ), 1026 TP_printk("sid=0x%llx", 1027 __entry->sesid) 1028 ) 1029 1030 #define DEFINE_SMB3_SES_EVENT(name) \ 1031 DEFINE_EVENT(smb3_ses_class, smb3_##name, \ 1032 TP_PROTO(__u64 sesid), \ 1033 TP_ARGS(sesid)) 1034 1035 DEFINE_SMB3_SES_EVENT(ses_not_found); 1036 1037 DECLARE_EVENT_CLASS(smb3_ioctl_class, 1038 TP_PROTO(unsigned int xid, 1039 __u64 fid, 1040 unsigned int command), 1041 TP_ARGS(xid, fid, command), 1042 TP_STRUCT__entry( 1043 __field(unsigned int, xid) 1044 __field(__u64, fid) 1045 __field(unsigned int, command) 1046 ), 1047 TP_fast_assign( 1048 __entry->xid = xid; 1049 __entry->fid = fid; 1050 __entry->command = command; 1051 ), 1052 TP_printk("xid=%u fid=0x%llx ioctl cmd=0x%x", 1053 __entry->xid, __entry->fid, __entry->command) 1054 ) 1055 1056 #define DEFINE_SMB3_IOCTL_EVENT(name) \ 1057 DEFINE_EVENT(smb3_ioctl_class, smb3_##name, \ 1058 TP_PROTO(unsigned int xid, \ 1059 __u64 fid, \ 1060 unsigned int command), \ 1061 TP_ARGS(xid, fid, command)) 1062 1063 DEFINE_SMB3_IOCTL_EVENT(ioctl); 1064 1065 1066 1067 1068 1069 DECLARE_EVENT_CLASS(smb3_credit_class, 1070 TP_PROTO(__u64 currmid, 1071 __u64 conn_id, 1072 char *hostname, 1073 int credits, 1074 int credits_to_add, 1075 int in_flight), 1076 TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight), 1077 TP_STRUCT__entry( 1078 __field(__u64, currmid) 1079 __field(__u64, conn_id) 1080 __string(hostname, hostname) 1081 __field(int, credits) 1082 __field(int, credits_to_add) 1083 __field(int, in_flight) 1084 ), 1085 TP_fast_assign( 1086 __entry->currmid = currmid; 1087 __entry->conn_id = conn_id; 1088 __assign_str(hostname, hostname); 1089 __entry->credits = credits; 1090 __entry->credits_to_add = credits_to_add; 1091 __entry->in_flight = in_flight; 1092 ), 1093 TP_printk("conn_id=0x%llx server=%s current_mid=%llu " 1094 "credits=%d credit_change=%d in_flight=%d", 1095 __entry->conn_id, 1096 __get_str(hostname), 1097 __entry->currmid, 1098 __entry->credits, 1099 __entry->credits_to_add, 1100 __entry->in_flight) 1101 ) 1102 1103 #define DEFINE_SMB3_CREDIT_EVENT(name) \ 1104 DEFINE_EVENT(smb3_credit_class, smb3_##name, \ 1105 TP_PROTO(__u64 currmid, \ 1106 __u64 conn_id, \ 1107 char *hostname, \ 1108 int credits, \ 1109 int credits_to_add, \ 1110 int in_flight), \ 1111 TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight)) 1112 1113 DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits); 1114 DEFINE_SMB3_CREDIT_EVENT(reconnect_detected); 1115 DEFINE_SMB3_CREDIT_EVENT(credit_timeout); 1116 DEFINE_SMB3_CREDIT_EVENT(insufficient_credits); 1117 DEFINE_SMB3_CREDIT_EVENT(too_many_credits); 1118 DEFINE_SMB3_CREDIT_EVENT(add_credits); 1119 DEFINE_SMB3_CREDIT_EVENT(adj_credits); 1120 DEFINE_SMB3_CREDIT_EVENT(hdr_credits); 1121 DEFINE_SMB3_CREDIT_EVENT(nblk_credits); 1122 DEFINE_SMB3_CREDIT_EVENT(pend_credits); 1123 DEFINE_SMB3_CREDIT_EVENT(wait_credits); 1124 DEFINE_SMB3_CREDIT_EVENT(waitff_credits); 1125 DEFINE_SMB3_CREDIT_EVENT(overflow_credits); 1126 DEFINE_SMB3_CREDIT_EVENT(set_credits); 1127 1128 #endif /* _CIFS_TRACE_H */ 1129 1130 #undef TRACE_INCLUDE_PATH 1131 #define TRACE_INCLUDE_PATH . 1132 #define TRACE_INCLUDE_FILE trace 1133 #include <trace/define_trace.h> 1134