PageRenderTime 3413ms CodeModel.GetById 51ms RepoModel.GetById 8ms app.codeStats 0ms

/fs/cifs/trace.h

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