rpcrdma.h 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2017, 2018 Oracle. All rights reserved.
  4. *
  5. * Trace point definitions for the "rpcrdma" subsystem.
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM rpcrdma
  9. #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _TRACE_RPCRDMA_H
  11. #include <linux/scatterlist.h>
  12. #include <linux/sunrpc/rpc_rdma_cid.h>
  13. #include <linux/tracepoint.h>
  14. #include <rdma/ib_cm.h>
  15. #include <trace/misc/rdma.h>
  16. #include <trace/misc/sunrpc.h>
  17. /**
  18. ** Event classes
  19. **/
  20. DECLARE_EVENT_CLASS(rpcrdma_simple_cid_class,
  21. TP_PROTO(
  22. const struct rpc_rdma_cid *cid
  23. ),
  24. TP_ARGS(cid),
  25. TP_STRUCT__entry(
  26. __field(u32, cq_id)
  27. __field(int, completion_id)
  28. ),
  29. TP_fast_assign(
  30. __entry->cq_id = cid->ci_queue_id;
  31. __entry->completion_id = cid->ci_completion_id;
  32. ),
  33. TP_printk("cq.id=%d cid=%d",
  34. __entry->cq_id, __entry->completion_id
  35. )
  36. );
  37. #define DEFINE_SIMPLE_CID_EVENT(name) \
  38. DEFINE_EVENT(rpcrdma_simple_cid_class, name, \
  39. TP_PROTO( \
  40. const struct rpc_rdma_cid *cid \
  41. ), \
  42. TP_ARGS(cid) \
  43. )
  44. DECLARE_EVENT_CLASS(rpcrdma_completion_class,
  45. TP_PROTO(
  46. const struct ib_wc *wc,
  47. const struct rpc_rdma_cid *cid
  48. ),
  49. TP_ARGS(wc, cid),
  50. TP_STRUCT__entry(
  51. __field(u32, cq_id)
  52. __field(int, completion_id)
  53. __field(unsigned long, status)
  54. __field(unsigned int, vendor_err)
  55. ),
  56. TP_fast_assign(
  57. __entry->cq_id = cid->ci_queue_id;
  58. __entry->completion_id = cid->ci_completion_id;
  59. __entry->status = wc->status;
  60. if (wc->status)
  61. __entry->vendor_err = wc->vendor_err;
  62. else
  63. __entry->vendor_err = 0;
  64. ),
  65. TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
  66. __entry->cq_id, __entry->completion_id,
  67. rdma_show_wc_status(__entry->status),
  68. __entry->status, __entry->vendor_err
  69. )
  70. );
  71. #define DEFINE_COMPLETION_EVENT(name) \
  72. DEFINE_EVENT(rpcrdma_completion_class, name, \
  73. TP_PROTO( \
  74. const struct ib_wc *wc, \
  75. const struct rpc_rdma_cid *cid \
  76. ), \
  77. TP_ARGS(wc, cid))
  78. DECLARE_EVENT_CLASS(rpcrdma_send_flush_class,
  79. TP_PROTO(
  80. const struct ib_wc *wc,
  81. const struct rpc_rdma_cid *cid
  82. ),
  83. TP_ARGS(wc, cid),
  84. TP_STRUCT__entry(
  85. __field(u32, cq_id)
  86. __field(int, completion_id)
  87. __field(unsigned long, status)
  88. __field(unsigned int, vendor_err)
  89. ),
  90. TP_fast_assign(
  91. __entry->cq_id = cid->ci_queue_id;
  92. __entry->completion_id = cid->ci_completion_id;
  93. __entry->status = wc->status;
  94. __entry->vendor_err = wc->vendor_err;
  95. ),
  96. TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
  97. __entry->cq_id, __entry->completion_id,
  98. rdma_show_wc_status(__entry->status),
  99. __entry->status, __entry->vendor_err
  100. )
  101. );
  102. #define DEFINE_SEND_FLUSH_EVENT(name) \
  103. DEFINE_EVENT(rpcrdma_send_flush_class, name, \
  104. TP_PROTO( \
  105. const struct ib_wc *wc, \
  106. const struct rpc_rdma_cid *cid \
  107. ), \
  108. TP_ARGS(wc, cid))
  109. DECLARE_EVENT_CLASS(rpcrdma_mr_completion_class,
  110. TP_PROTO(
  111. const struct ib_wc *wc,
  112. const struct rpc_rdma_cid *cid
  113. ),
  114. TP_ARGS(wc, cid),
  115. TP_STRUCT__entry(
  116. __field(u32, cq_id)
  117. __field(int, completion_id)
  118. __field(unsigned long, status)
  119. __field(unsigned int, vendor_err)
  120. ),
  121. TP_fast_assign(
  122. __entry->cq_id = cid->ci_queue_id;
  123. __entry->completion_id = cid->ci_completion_id;
  124. __entry->status = wc->status;
  125. if (wc->status)
  126. __entry->vendor_err = wc->vendor_err;
  127. else
  128. __entry->vendor_err = 0;
  129. ),
  130. TP_printk("cq.id=%u mr.id=%d status=%s (%lu/0x%x)",
  131. __entry->cq_id, __entry->completion_id,
  132. rdma_show_wc_status(__entry->status),
  133. __entry->status, __entry->vendor_err
  134. )
  135. );
  136. #define DEFINE_MR_COMPLETION_EVENT(name) \
  137. DEFINE_EVENT(rpcrdma_mr_completion_class, name, \
  138. TP_PROTO( \
  139. const struct ib_wc *wc, \
  140. const struct rpc_rdma_cid *cid \
  141. ), \
  142. TP_ARGS(wc, cid))
  143. DECLARE_EVENT_CLASS(rpcrdma_receive_completion_class,
  144. TP_PROTO(
  145. const struct ib_wc *wc,
  146. const struct rpc_rdma_cid *cid
  147. ),
  148. TP_ARGS(wc, cid),
  149. TP_STRUCT__entry(
  150. __field(u32, cq_id)
  151. __field(int, completion_id)
  152. __field(u32, received)
  153. __field(unsigned long, status)
  154. __field(unsigned int, vendor_err)
  155. ),
  156. TP_fast_assign(
  157. __entry->cq_id = cid->ci_queue_id;
  158. __entry->completion_id = cid->ci_completion_id;
  159. __entry->status = wc->status;
  160. if (wc->status) {
  161. __entry->received = 0;
  162. __entry->vendor_err = wc->vendor_err;
  163. } else {
  164. __entry->received = wc->byte_len;
  165. __entry->vendor_err = 0;
  166. }
  167. ),
  168. TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x) received=%u",
  169. __entry->cq_id, __entry->completion_id,
  170. rdma_show_wc_status(__entry->status),
  171. __entry->status, __entry->vendor_err,
  172. __entry->received
  173. )
  174. );
  175. #define DEFINE_RECEIVE_COMPLETION_EVENT(name) \
  176. DEFINE_EVENT(rpcrdma_receive_completion_class, name, \
  177. TP_PROTO( \
  178. const struct ib_wc *wc, \
  179. const struct rpc_rdma_cid *cid \
  180. ), \
  181. TP_ARGS(wc, cid))
  182. DECLARE_EVENT_CLASS(rpcrdma_receive_success_class,
  183. TP_PROTO(
  184. const struct ib_wc *wc,
  185. const struct rpc_rdma_cid *cid
  186. ),
  187. TP_ARGS(wc, cid),
  188. TP_STRUCT__entry(
  189. __field(u32, cq_id)
  190. __field(int, completion_id)
  191. __field(u32, received)
  192. ),
  193. TP_fast_assign(
  194. __entry->cq_id = cid->ci_queue_id;
  195. __entry->completion_id = cid->ci_completion_id;
  196. __entry->received = wc->byte_len;
  197. ),
  198. TP_printk("cq.id=%u cid=%d received=%u",
  199. __entry->cq_id, __entry->completion_id,
  200. __entry->received
  201. )
  202. );
  203. #define DEFINE_RECEIVE_SUCCESS_EVENT(name) \
  204. DEFINE_EVENT(rpcrdma_receive_success_class, name, \
  205. TP_PROTO( \
  206. const struct ib_wc *wc, \
  207. const struct rpc_rdma_cid *cid \
  208. ), \
  209. TP_ARGS(wc, cid))
  210. DECLARE_EVENT_CLASS(rpcrdma_receive_flush_class,
  211. TP_PROTO(
  212. const struct ib_wc *wc,
  213. const struct rpc_rdma_cid *cid
  214. ),
  215. TP_ARGS(wc, cid),
  216. TP_STRUCT__entry(
  217. __field(u32, cq_id)
  218. __field(int, completion_id)
  219. __field(unsigned long, status)
  220. __field(unsigned int, vendor_err)
  221. ),
  222. TP_fast_assign(
  223. __entry->cq_id = cid->ci_queue_id;
  224. __entry->completion_id = cid->ci_completion_id;
  225. __entry->status = wc->status;
  226. __entry->vendor_err = wc->vendor_err;
  227. ),
  228. TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
  229. __entry->cq_id, __entry->completion_id,
  230. rdma_show_wc_status(__entry->status),
  231. __entry->status, __entry->vendor_err
  232. )
  233. );
  234. #define DEFINE_RECEIVE_FLUSH_EVENT(name) \
  235. DEFINE_EVENT(rpcrdma_receive_flush_class, name, \
  236. TP_PROTO( \
  237. const struct ib_wc *wc, \
  238. const struct rpc_rdma_cid *cid \
  239. ), \
  240. TP_ARGS(wc, cid))
  241. DECLARE_EVENT_CLASS(xprtrdma_reply_class,
  242. TP_PROTO(
  243. const struct rpcrdma_rep *rep
  244. ),
  245. TP_ARGS(rep),
  246. TP_STRUCT__entry(
  247. __field(u32, xid)
  248. __field(u32, version)
  249. __field(u32, proc)
  250. __string(addr, rpcrdma_addrstr(rep->rr_rxprt))
  251. __string(port, rpcrdma_portstr(rep->rr_rxprt))
  252. ),
  253. TP_fast_assign(
  254. __entry->xid = be32_to_cpu(rep->rr_xid);
  255. __entry->version = be32_to_cpu(rep->rr_vers);
  256. __entry->proc = be32_to_cpu(rep->rr_proc);
  257. __assign_str(addr);
  258. __assign_str(port);
  259. ),
  260. TP_printk("peer=[%s]:%s xid=0x%08x version=%u proc=%u",
  261. __get_str(addr), __get_str(port),
  262. __entry->xid, __entry->version, __entry->proc
  263. )
  264. );
  265. #define DEFINE_REPLY_EVENT(name) \
  266. DEFINE_EVENT(xprtrdma_reply_class, \
  267. xprtrdma_reply_##name##_err, \
  268. TP_PROTO( \
  269. const struct rpcrdma_rep *rep \
  270. ), \
  271. TP_ARGS(rep))
  272. DECLARE_EVENT_CLASS(xprtrdma_rxprt,
  273. TP_PROTO(
  274. const struct rpcrdma_xprt *r_xprt
  275. ),
  276. TP_ARGS(r_xprt),
  277. TP_STRUCT__entry(
  278. __string(addr, rpcrdma_addrstr(r_xprt))
  279. __string(port, rpcrdma_portstr(r_xprt))
  280. ),
  281. TP_fast_assign(
  282. __assign_str(addr);
  283. __assign_str(port);
  284. ),
  285. TP_printk("peer=[%s]:%s",
  286. __get_str(addr), __get_str(port)
  287. )
  288. );
  289. #define DEFINE_RXPRT_EVENT(name) \
  290. DEFINE_EVENT(xprtrdma_rxprt, name, \
  291. TP_PROTO( \
  292. const struct rpcrdma_xprt *r_xprt \
  293. ), \
  294. TP_ARGS(r_xprt))
  295. DECLARE_EVENT_CLASS(xprtrdma_connect_class,
  296. TP_PROTO(
  297. const struct rpcrdma_xprt *r_xprt,
  298. int rc
  299. ),
  300. TP_ARGS(r_xprt, rc),
  301. TP_STRUCT__entry(
  302. __field(int, rc)
  303. __field(int, connect_status)
  304. __string(addr, rpcrdma_addrstr(r_xprt))
  305. __string(port, rpcrdma_portstr(r_xprt))
  306. ),
  307. TP_fast_assign(
  308. __entry->rc = rc;
  309. __entry->connect_status = r_xprt->rx_ep->re_connect_status;
  310. __assign_str(addr);
  311. __assign_str(port);
  312. ),
  313. TP_printk("peer=[%s]:%s rc=%d connection status=%d",
  314. __get_str(addr), __get_str(port),
  315. __entry->rc, __entry->connect_status
  316. )
  317. );
  318. #define DEFINE_CONN_EVENT(name) \
  319. DEFINE_EVENT(xprtrdma_connect_class, xprtrdma_##name, \
  320. TP_PROTO( \
  321. const struct rpcrdma_xprt *r_xprt, \
  322. int rc \
  323. ), \
  324. TP_ARGS(r_xprt, rc))
  325. DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
  326. TP_PROTO(
  327. const struct rpc_task *task,
  328. unsigned int pos,
  329. struct rpcrdma_mr *mr,
  330. int nsegs
  331. ),
  332. TP_ARGS(task, pos, mr, nsegs),
  333. TP_STRUCT__entry(
  334. __field(unsigned int, task_id)
  335. __field(unsigned int, client_id)
  336. __field(unsigned int, pos)
  337. __field(int, nents)
  338. __field(u32, handle)
  339. __field(u32, length)
  340. __field(u64, offset)
  341. __field(int, nsegs)
  342. ),
  343. TP_fast_assign(
  344. __entry->task_id = task->tk_pid;
  345. __entry->client_id = task->tk_client->cl_clid;
  346. __entry->pos = pos;
  347. __entry->nents = mr->mr_nents;
  348. __entry->handle = mr->mr_handle;
  349. __entry->length = mr->mr_length;
  350. __entry->offset = mr->mr_offset;
  351. __entry->nsegs = nsegs;
  352. ),
  353. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
  354. " pos=%u %u@0x%016llx:0x%08x (%s)",
  355. __entry->task_id, __entry->client_id,
  356. __entry->pos, __entry->length,
  357. (unsigned long long)__entry->offset, __entry->handle,
  358. __entry->nents < __entry->nsegs ? "more" : "last"
  359. )
  360. );
  361. #define DEFINE_RDCH_EVENT(name) \
  362. DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\
  363. TP_PROTO( \
  364. const struct rpc_task *task, \
  365. unsigned int pos, \
  366. struct rpcrdma_mr *mr, \
  367. int nsegs \
  368. ), \
  369. TP_ARGS(task, pos, mr, nsegs))
  370. DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
  371. TP_PROTO(
  372. const struct rpc_task *task,
  373. struct rpcrdma_mr *mr,
  374. int nsegs
  375. ),
  376. TP_ARGS(task, mr, nsegs),
  377. TP_STRUCT__entry(
  378. __field(unsigned int, task_id)
  379. __field(unsigned int, client_id)
  380. __field(int, nents)
  381. __field(u32, handle)
  382. __field(u32, length)
  383. __field(u64, offset)
  384. __field(int, nsegs)
  385. ),
  386. TP_fast_assign(
  387. __entry->task_id = task->tk_pid;
  388. __entry->client_id = task->tk_client->cl_clid;
  389. __entry->nents = mr->mr_nents;
  390. __entry->handle = mr->mr_handle;
  391. __entry->length = mr->mr_length;
  392. __entry->offset = mr->mr_offset;
  393. __entry->nsegs = nsegs;
  394. ),
  395. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
  396. " %u@0x%016llx:0x%08x (%s)",
  397. __entry->task_id, __entry->client_id,
  398. __entry->length, (unsigned long long)__entry->offset,
  399. __entry->handle,
  400. __entry->nents < __entry->nsegs ? "more" : "last"
  401. )
  402. );
  403. #define DEFINE_WRCH_EVENT(name) \
  404. DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\
  405. TP_PROTO( \
  406. const struct rpc_task *task, \
  407. struct rpcrdma_mr *mr, \
  408. int nsegs \
  409. ), \
  410. TP_ARGS(task, mr, nsegs))
  411. TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL);
  412. TRACE_DEFINE_ENUM(DMA_TO_DEVICE);
  413. TRACE_DEFINE_ENUM(DMA_FROM_DEVICE);
  414. TRACE_DEFINE_ENUM(DMA_NONE);
  415. #define xprtrdma_show_direction(x) \
  416. __print_symbolic(x, \
  417. { DMA_BIDIRECTIONAL, "BIDIR" }, \
  418. { DMA_TO_DEVICE, "TO_DEVICE" }, \
  419. { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
  420. { DMA_NONE, "NONE" })
  421. DECLARE_EVENT_CLASS(xprtrdma_mr_class,
  422. TP_PROTO(
  423. const struct rpcrdma_mr *mr
  424. ),
  425. TP_ARGS(mr),
  426. TP_STRUCT__entry(
  427. __field(unsigned int, task_id)
  428. __field(unsigned int, client_id)
  429. __field(u32, mr_id)
  430. __field(int, nents)
  431. __field(u32, handle)
  432. __field(u32, length)
  433. __field(u64, offset)
  434. __field(u32, dir)
  435. ),
  436. TP_fast_assign(
  437. const struct rpcrdma_req *req = mr->mr_req;
  438. if (req) {
  439. const struct rpc_task *task = req->rl_slot.rq_task;
  440. __entry->task_id = task->tk_pid;
  441. __entry->client_id = task->tk_client->cl_clid;
  442. } else {
  443. __entry->task_id = 0;
  444. __entry->client_id = -1;
  445. }
  446. __entry->mr_id = mr->mr_ibmr->res.id;
  447. __entry->nents = mr->mr_nents;
  448. __entry->handle = mr->mr_handle;
  449. __entry->length = mr->mr_length;
  450. __entry->offset = mr->mr_offset;
  451. __entry->dir = mr->mr_dir;
  452. ),
  453. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
  454. " mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
  455. __entry->task_id, __entry->client_id,
  456. __entry->mr_id, __entry->nents, __entry->length,
  457. (unsigned long long)__entry->offset, __entry->handle,
  458. xprtrdma_show_direction(__entry->dir)
  459. )
  460. );
  461. #define DEFINE_MR_EVENT(name) \
  462. DEFINE_EVENT(xprtrdma_mr_class, \
  463. xprtrdma_mr_##name, \
  464. TP_PROTO( \
  465. const struct rpcrdma_mr *mr \
  466. ), \
  467. TP_ARGS(mr))
  468. DECLARE_EVENT_CLASS(xprtrdma_anonymous_mr_class,
  469. TP_PROTO(
  470. const struct rpcrdma_mr *mr
  471. ),
  472. TP_ARGS(mr),
  473. TP_STRUCT__entry(
  474. __field(u32, mr_id)
  475. __field(int, nents)
  476. __field(u32, handle)
  477. __field(u32, length)
  478. __field(u64, offset)
  479. __field(u32, dir)
  480. ),
  481. TP_fast_assign(
  482. __entry->mr_id = mr->mr_ibmr->res.id;
  483. __entry->nents = mr->mr_nents;
  484. __entry->handle = mr->mr_handle;
  485. __entry->length = mr->mr_length;
  486. __entry->offset = mr->mr_offset;
  487. __entry->dir = mr->mr_dir;
  488. ),
  489. TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
  490. __entry->mr_id, __entry->nents, __entry->length,
  491. (unsigned long long)__entry->offset, __entry->handle,
  492. xprtrdma_show_direction(__entry->dir)
  493. )
  494. );
  495. #define DEFINE_ANON_MR_EVENT(name) \
  496. DEFINE_EVENT(xprtrdma_anonymous_mr_class, \
  497. xprtrdma_mr_##name, \
  498. TP_PROTO( \
  499. const struct rpcrdma_mr *mr \
  500. ), \
  501. TP_ARGS(mr))
  502. DECLARE_EVENT_CLASS(xprtrdma_callback_class,
  503. TP_PROTO(
  504. const struct rpcrdma_xprt *r_xprt,
  505. const struct rpc_rqst *rqst
  506. ),
  507. TP_ARGS(r_xprt, rqst),
  508. TP_STRUCT__entry(
  509. __field(u32, xid)
  510. __string(addr, rpcrdma_addrstr(r_xprt))
  511. __string(port, rpcrdma_portstr(r_xprt))
  512. ),
  513. TP_fast_assign(
  514. __entry->xid = be32_to_cpu(rqst->rq_xid);
  515. __assign_str(addr);
  516. __assign_str(port);
  517. ),
  518. TP_printk("peer=[%s]:%s xid=0x%08x",
  519. __get_str(addr), __get_str(port), __entry->xid
  520. )
  521. );
  522. #define DEFINE_CALLBACK_EVENT(name) \
  523. DEFINE_EVENT(xprtrdma_callback_class, \
  524. xprtrdma_cb_##name, \
  525. TP_PROTO( \
  526. const struct rpcrdma_xprt *r_xprt, \
  527. const struct rpc_rqst *rqst \
  528. ), \
  529. TP_ARGS(r_xprt, rqst))
  530. /**
  531. ** Connection events
  532. **/
  533. TRACE_EVENT(xprtrdma_inline_thresh,
  534. TP_PROTO(
  535. const struct rpcrdma_ep *ep
  536. ),
  537. TP_ARGS(ep),
  538. TP_STRUCT__entry(
  539. __field(unsigned int, inline_send)
  540. __field(unsigned int, inline_recv)
  541. __field(unsigned int, max_send)
  542. __field(unsigned int, max_recv)
  543. __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
  544. __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
  545. ),
  546. TP_fast_assign(
  547. const struct rdma_cm_id *id = ep->re_id;
  548. __entry->inline_send = ep->re_inline_send;
  549. __entry->inline_recv = ep->re_inline_recv;
  550. __entry->max_send = ep->re_max_inline_send;
  551. __entry->max_recv = ep->re_max_inline_recv;
  552. memcpy(__entry->srcaddr, &id->route.addr.src_addr,
  553. sizeof(struct sockaddr_in6));
  554. memcpy(__entry->dstaddr, &id->route.addr.dst_addr,
  555. sizeof(struct sockaddr_in6));
  556. ),
  557. TP_printk("%pISpc -> %pISpc neg send/recv=%u/%u, calc send/recv=%u/%u",
  558. __entry->srcaddr, __entry->dstaddr,
  559. __entry->inline_send, __entry->inline_recv,
  560. __entry->max_send, __entry->max_recv
  561. )
  562. );
  563. DEFINE_CONN_EVENT(connect);
  564. DEFINE_CONN_EVENT(disconnect);
  565. TRACE_EVENT(xprtrdma_device_removal,
  566. TP_PROTO(
  567. const struct rdma_cm_id *id
  568. ),
  569. TP_ARGS(id),
  570. TP_STRUCT__entry(
  571. __string(name, id->device->name)
  572. __array(unsigned char, addr, sizeof(struct sockaddr_in6))
  573. ),
  574. TP_fast_assign(
  575. __assign_str(name);
  576. memcpy(__entry->addr, &id->route.addr.dst_addr,
  577. sizeof(struct sockaddr_in6));
  578. ),
  579. TP_printk("device %s to be removed, disconnecting %pISpc\n",
  580. __get_str(name), __entry->addr
  581. )
  582. );
  583. DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc);
  584. TRACE_EVENT(xprtrdma_op_connect,
  585. TP_PROTO(
  586. const struct rpcrdma_xprt *r_xprt,
  587. unsigned long delay
  588. ),
  589. TP_ARGS(r_xprt, delay),
  590. TP_STRUCT__entry(
  591. __field(unsigned long, delay)
  592. __string(addr, rpcrdma_addrstr(r_xprt))
  593. __string(port, rpcrdma_portstr(r_xprt))
  594. ),
  595. TP_fast_assign(
  596. __entry->delay = delay;
  597. __assign_str(addr);
  598. __assign_str(port);
  599. ),
  600. TP_printk("peer=[%s]:%s delay=%lu",
  601. __get_str(addr), __get_str(port), __entry->delay
  602. )
  603. );
  604. TRACE_EVENT(xprtrdma_op_set_cto,
  605. TP_PROTO(
  606. const struct rpcrdma_xprt *r_xprt,
  607. unsigned long connect,
  608. unsigned long reconnect
  609. ),
  610. TP_ARGS(r_xprt, connect, reconnect),
  611. TP_STRUCT__entry(
  612. __field(unsigned long, connect)
  613. __field(unsigned long, reconnect)
  614. __string(addr, rpcrdma_addrstr(r_xprt))
  615. __string(port, rpcrdma_portstr(r_xprt))
  616. ),
  617. TP_fast_assign(
  618. __entry->connect = connect;
  619. __entry->reconnect = reconnect;
  620. __assign_str(addr);
  621. __assign_str(port);
  622. ),
  623. TP_printk("peer=[%s]:%s connect=%lu reconnect=%lu",
  624. __get_str(addr), __get_str(port),
  625. __entry->connect / HZ, __entry->reconnect / HZ
  626. )
  627. );
  628. /**
  629. ** Call events
  630. **/
  631. TRACE_EVENT(xprtrdma_createmrs,
  632. TP_PROTO(
  633. const struct rpcrdma_xprt *r_xprt,
  634. unsigned int count
  635. ),
  636. TP_ARGS(r_xprt, count),
  637. TP_STRUCT__entry(
  638. __string(addr, rpcrdma_addrstr(r_xprt))
  639. __string(port, rpcrdma_portstr(r_xprt))
  640. __field(unsigned int, count)
  641. ),
  642. TP_fast_assign(
  643. __entry->count = count;
  644. __assign_str(addr);
  645. __assign_str(port);
  646. ),
  647. TP_printk("peer=[%s]:%s created %u MRs",
  648. __get_str(addr), __get_str(port), __entry->count
  649. )
  650. );
  651. TRACE_EVENT(xprtrdma_nomrs_err,
  652. TP_PROTO(
  653. const struct rpcrdma_xprt *r_xprt,
  654. const struct rpcrdma_req *req
  655. ),
  656. TP_ARGS(r_xprt, req),
  657. TP_STRUCT__entry(
  658. __field(unsigned int, task_id)
  659. __field(unsigned int, client_id)
  660. __string(addr, rpcrdma_addrstr(r_xprt))
  661. __string(port, rpcrdma_portstr(r_xprt))
  662. ),
  663. TP_fast_assign(
  664. const struct rpc_rqst *rqst = &req->rl_slot;
  665. __entry->task_id = rqst->rq_task->tk_pid;
  666. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  667. __assign_str(addr);
  668. __assign_str(port);
  669. ),
  670. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " peer=[%s]:%s",
  671. __entry->task_id, __entry->client_id,
  672. __get_str(addr), __get_str(port)
  673. )
  674. );
  675. DEFINE_RDCH_EVENT(read);
  676. DEFINE_WRCH_EVENT(write);
  677. DEFINE_WRCH_EVENT(reply);
  678. DEFINE_WRCH_EVENT(wp);
  679. TRACE_DEFINE_ENUM(rpcrdma_noch);
  680. TRACE_DEFINE_ENUM(rpcrdma_noch_pullup);
  681. TRACE_DEFINE_ENUM(rpcrdma_noch_mapped);
  682. TRACE_DEFINE_ENUM(rpcrdma_readch);
  683. TRACE_DEFINE_ENUM(rpcrdma_areadch);
  684. TRACE_DEFINE_ENUM(rpcrdma_writech);
  685. TRACE_DEFINE_ENUM(rpcrdma_replych);
  686. #define xprtrdma_show_chunktype(x) \
  687. __print_symbolic(x, \
  688. { rpcrdma_noch, "inline" }, \
  689. { rpcrdma_noch_pullup, "pullup" }, \
  690. { rpcrdma_noch_mapped, "mapped" }, \
  691. { rpcrdma_readch, "read list" }, \
  692. { rpcrdma_areadch, "*read list" }, \
  693. { rpcrdma_writech, "write list" }, \
  694. { rpcrdma_replych, "reply chunk" })
  695. TRACE_EVENT(xprtrdma_marshal,
  696. TP_PROTO(
  697. const struct rpcrdma_req *req,
  698. unsigned int rtype,
  699. unsigned int wtype
  700. ),
  701. TP_ARGS(req, rtype, wtype),
  702. TP_STRUCT__entry(
  703. __field(unsigned int, task_id)
  704. __field(unsigned int, client_id)
  705. __field(u32, xid)
  706. __field(unsigned int, hdrlen)
  707. __field(unsigned int, headlen)
  708. __field(unsigned int, pagelen)
  709. __field(unsigned int, taillen)
  710. __field(unsigned int, rtype)
  711. __field(unsigned int, wtype)
  712. ),
  713. TP_fast_assign(
  714. const struct rpc_rqst *rqst = &req->rl_slot;
  715. __entry->task_id = rqst->rq_task->tk_pid;
  716. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  717. __entry->xid = be32_to_cpu(rqst->rq_xid);
  718. __entry->hdrlen = req->rl_hdrbuf.len;
  719. __entry->headlen = rqst->rq_snd_buf.head[0].iov_len;
  720. __entry->pagelen = rqst->rq_snd_buf.page_len;
  721. __entry->taillen = rqst->rq_snd_buf.tail[0].iov_len;
  722. __entry->rtype = rtype;
  723. __entry->wtype = wtype;
  724. ),
  725. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
  726. " xid=0x%08x hdr=%u xdr=%u/%u/%u %s/%s",
  727. __entry->task_id, __entry->client_id, __entry->xid,
  728. __entry->hdrlen,
  729. __entry->headlen, __entry->pagelen, __entry->taillen,
  730. xprtrdma_show_chunktype(__entry->rtype),
  731. xprtrdma_show_chunktype(__entry->wtype)
  732. )
  733. );
  734. TRACE_EVENT(xprtrdma_marshal_failed,
  735. TP_PROTO(const struct rpc_rqst *rqst,
  736. int ret
  737. ),
  738. TP_ARGS(rqst, ret),
  739. TP_STRUCT__entry(
  740. __field(unsigned int, task_id)
  741. __field(unsigned int, client_id)
  742. __field(u32, xid)
  743. __field(int, ret)
  744. ),
  745. TP_fast_assign(
  746. __entry->task_id = rqst->rq_task->tk_pid;
  747. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  748. __entry->xid = be32_to_cpu(rqst->rq_xid);
  749. __entry->ret = ret;
  750. ),
  751. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
  752. __entry->task_id, __entry->client_id, __entry->xid,
  753. __entry->ret
  754. )
  755. );
  756. TRACE_EVENT(xprtrdma_prepsend_failed,
  757. TP_PROTO(const struct rpc_rqst *rqst,
  758. int ret
  759. ),
  760. TP_ARGS(rqst, ret),
  761. TP_STRUCT__entry(
  762. __field(unsigned int, task_id)
  763. __field(unsigned int, client_id)
  764. __field(u32, xid)
  765. __field(int, ret)
  766. ),
  767. TP_fast_assign(
  768. __entry->task_id = rqst->rq_task->tk_pid;
  769. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  770. __entry->xid = be32_to_cpu(rqst->rq_xid);
  771. __entry->ret = ret;
  772. ),
  773. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
  774. __entry->task_id, __entry->client_id, __entry->xid,
  775. __entry->ret
  776. )
  777. );
  778. TRACE_EVENT(xprtrdma_post_send,
  779. TP_PROTO(
  780. const struct rpcrdma_req *req
  781. ),
  782. TP_ARGS(req),
  783. TP_STRUCT__entry(
  784. __field(u32, cq_id)
  785. __field(int, completion_id)
  786. __field(unsigned int, task_id)
  787. __field(unsigned int, client_id)
  788. __field(int, num_sge)
  789. __field(int, signaled)
  790. ),
  791. TP_fast_assign(
  792. const struct rpc_rqst *rqst = &req->rl_slot;
  793. const struct rpcrdma_sendctx *sc = req->rl_sendctx;
  794. __entry->cq_id = sc->sc_cid.ci_queue_id;
  795. __entry->completion_id = sc->sc_cid.ci_completion_id;
  796. __entry->task_id = rqst->rq_task->tk_pid;
  797. __entry->client_id = rqst->rq_task->tk_client ?
  798. rqst->rq_task->tk_client->cl_clid : -1;
  799. __entry->num_sge = req->rl_wr.num_sge;
  800. __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
  801. ),
  802. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u cid=%d (%d SGE%s) %s",
  803. __entry->task_id, __entry->client_id,
  804. __entry->cq_id, __entry->completion_id,
  805. __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"),
  806. (__entry->signaled ? "signaled" : "")
  807. )
  808. );
  809. TRACE_EVENT(xprtrdma_post_send_err,
  810. TP_PROTO(
  811. const struct rpcrdma_xprt *r_xprt,
  812. const struct rpcrdma_req *req,
  813. int rc
  814. ),
  815. TP_ARGS(r_xprt, req, rc),
  816. TP_STRUCT__entry(
  817. __field(u32, cq_id)
  818. __field(unsigned int, task_id)
  819. __field(unsigned int, client_id)
  820. __field(int, rc)
  821. ),
  822. TP_fast_assign(
  823. const struct rpc_rqst *rqst = &req->rl_slot;
  824. const struct rpcrdma_ep *ep = r_xprt->rx_ep;
  825. __entry->cq_id = ep ? ep->re_attr.recv_cq->res.id : 0;
  826. __entry->task_id = rqst->rq_task->tk_pid;
  827. __entry->client_id = rqst->rq_task->tk_client ?
  828. rqst->rq_task->tk_client->cl_clid : -1;
  829. __entry->rc = rc;
  830. ),
  831. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u rc=%d",
  832. __entry->task_id, __entry->client_id,
  833. __entry->cq_id, __entry->rc
  834. )
  835. );
  836. DEFINE_SIMPLE_CID_EVENT(xprtrdma_post_recv);
  837. TRACE_EVENT(xprtrdma_post_recvs,
  838. TP_PROTO(
  839. const struct rpcrdma_xprt *r_xprt,
  840. unsigned int count
  841. ),
  842. TP_ARGS(r_xprt, count),
  843. TP_STRUCT__entry(
  844. __field(u32, cq_id)
  845. __field(unsigned int, count)
  846. __field(int, posted)
  847. __string(addr, rpcrdma_addrstr(r_xprt))
  848. __string(port, rpcrdma_portstr(r_xprt))
  849. ),
  850. TP_fast_assign(
  851. const struct rpcrdma_ep *ep = r_xprt->rx_ep;
  852. __entry->cq_id = ep->re_attr.recv_cq->res.id;
  853. __entry->count = count;
  854. __entry->posted = ep->re_receive_count;
  855. __assign_str(addr);
  856. __assign_str(port);
  857. ),
  858. TP_printk("peer=[%s]:%s cq.id=%d %u new recvs, %d active",
  859. __get_str(addr), __get_str(port), __entry->cq_id,
  860. __entry->count, __entry->posted
  861. )
  862. );
  863. TRACE_EVENT(xprtrdma_post_recvs_err,
  864. TP_PROTO(
  865. const struct rpcrdma_xprt *r_xprt,
  866. int status
  867. ),
  868. TP_ARGS(r_xprt, status),
  869. TP_STRUCT__entry(
  870. __field(u32, cq_id)
  871. __field(int, status)
  872. __string(addr, rpcrdma_addrstr(r_xprt))
  873. __string(port, rpcrdma_portstr(r_xprt))
  874. ),
  875. TP_fast_assign(
  876. const struct rpcrdma_ep *ep = r_xprt->rx_ep;
  877. __entry->cq_id = ep->re_attr.recv_cq->res.id;
  878. __entry->status = status;
  879. __assign_str(addr);
  880. __assign_str(port);
  881. ),
  882. TP_printk("peer=[%s]:%s cq.id=%d rc=%d",
  883. __get_str(addr), __get_str(port), __entry->cq_id,
  884. __entry->status
  885. )
  886. );
  887. TRACE_EVENT(xprtrdma_post_linv_err,
  888. TP_PROTO(
  889. const struct rpcrdma_req *req,
  890. int status
  891. ),
  892. TP_ARGS(req, status),
  893. TP_STRUCT__entry(
  894. __field(unsigned int, task_id)
  895. __field(unsigned int, client_id)
  896. __field(int, status)
  897. ),
  898. TP_fast_assign(
  899. const struct rpc_task *task = req->rl_slot.rq_task;
  900. __entry->task_id = task->tk_pid;
  901. __entry->client_id = task->tk_client->cl_clid;
  902. __entry->status = status;
  903. ),
  904. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d",
  905. __entry->task_id, __entry->client_id, __entry->status
  906. )
  907. );
  908. /**
  909. ** Completion events
  910. **/
  911. DEFINE_RECEIVE_COMPLETION_EVENT(xprtrdma_wc_receive);
  912. DEFINE_COMPLETION_EVENT(xprtrdma_wc_send);
  913. DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_fastreg);
  914. DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li);
  915. DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li_wake);
  916. DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li_done);
  917. TRACE_EVENT(xprtrdma_frwr_alloc,
  918. TP_PROTO(
  919. const struct rpcrdma_mr *mr,
  920. int rc
  921. ),
  922. TP_ARGS(mr, rc),
  923. TP_STRUCT__entry(
  924. __field(u32, mr_id)
  925. __field(int, rc)
  926. ),
  927. TP_fast_assign(
  928. __entry->mr_id = mr->mr_ibmr->res.id;
  929. __entry->rc = rc;
  930. ),
  931. TP_printk("mr.id=%u: rc=%d",
  932. __entry->mr_id, __entry->rc
  933. )
  934. );
  935. TRACE_EVENT(xprtrdma_frwr_dereg,
  936. TP_PROTO(
  937. const struct rpcrdma_mr *mr,
  938. int rc
  939. ),
  940. TP_ARGS(mr, rc),
  941. TP_STRUCT__entry(
  942. __field(u32, mr_id)
  943. __field(int, nents)
  944. __field(u32, handle)
  945. __field(u32, length)
  946. __field(u64, offset)
  947. __field(u32, dir)
  948. __field(int, rc)
  949. ),
  950. TP_fast_assign(
  951. __entry->mr_id = mr->mr_ibmr->res.id;
  952. __entry->nents = mr->mr_nents;
  953. __entry->handle = mr->mr_handle;
  954. __entry->length = mr->mr_length;
  955. __entry->offset = mr->mr_offset;
  956. __entry->dir = mr->mr_dir;
  957. __entry->rc = rc;
  958. ),
  959. TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s): rc=%d",
  960. __entry->mr_id, __entry->nents, __entry->length,
  961. (unsigned long long)__entry->offset, __entry->handle,
  962. xprtrdma_show_direction(__entry->dir),
  963. __entry->rc
  964. )
  965. );
  966. TRACE_EVENT(xprtrdma_frwr_sgerr,
  967. TP_PROTO(
  968. const struct rpcrdma_mr *mr,
  969. int sg_nents
  970. ),
  971. TP_ARGS(mr, sg_nents),
  972. TP_STRUCT__entry(
  973. __field(u32, mr_id)
  974. __field(u64, addr)
  975. __field(u32, dir)
  976. __field(int, nents)
  977. ),
  978. TP_fast_assign(
  979. __entry->mr_id = mr->mr_ibmr->res.id;
  980. __entry->addr = mr->mr_sg->dma_address;
  981. __entry->dir = mr->mr_dir;
  982. __entry->nents = sg_nents;
  983. ),
  984. TP_printk("mr.id=%u DMA addr=0x%llx (%s) sg_nents=%d",
  985. __entry->mr_id, __entry->addr,
  986. xprtrdma_show_direction(__entry->dir),
  987. __entry->nents
  988. )
  989. );
  990. TRACE_EVENT(xprtrdma_frwr_maperr,
  991. TP_PROTO(
  992. const struct rpcrdma_mr *mr,
  993. int num_mapped
  994. ),
  995. TP_ARGS(mr, num_mapped),
  996. TP_STRUCT__entry(
  997. __field(u32, mr_id)
  998. __field(u64, addr)
  999. __field(u32, dir)
  1000. __field(int, num_mapped)
  1001. __field(int, nents)
  1002. ),
  1003. TP_fast_assign(
  1004. __entry->mr_id = mr->mr_ibmr->res.id;
  1005. __entry->addr = mr->mr_sg->dma_address;
  1006. __entry->dir = mr->mr_dir;
  1007. __entry->num_mapped = num_mapped;
  1008. __entry->nents = mr->mr_nents;
  1009. ),
  1010. TP_printk("mr.id=%u DMA addr=0x%llx (%s) nents=%d of %d",
  1011. __entry->mr_id, __entry->addr,
  1012. xprtrdma_show_direction(__entry->dir),
  1013. __entry->num_mapped, __entry->nents
  1014. )
  1015. );
  1016. DEFINE_MR_EVENT(fastreg);
  1017. DEFINE_MR_EVENT(localinv);
  1018. DEFINE_MR_EVENT(reminv);
  1019. DEFINE_MR_EVENT(map);
  1020. DEFINE_ANON_MR_EVENT(unmap);
  1021. TRACE_EVENT(xprtrdma_dma_maperr,
  1022. TP_PROTO(
  1023. u64 addr
  1024. ),
  1025. TP_ARGS(addr),
  1026. TP_STRUCT__entry(
  1027. __field(u64, addr)
  1028. ),
  1029. TP_fast_assign(
  1030. __entry->addr = addr;
  1031. ),
  1032. TP_printk("dma addr=0x%llx\n", __entry->addr)
  1033. );
  1034. /**
  1035. ** Reply events
  1036. **/
  1037. TRACE_EVENT(xprtrdma_reply,
  1038. TP_PROTO(
  1039. const struct rpc_task *task,
  1040. const struct rpcrdma_rep *rep,
  1041. unsigned int credits
  1042. ),
  1043. TP_ARGS(task, rep, credits),
  1044. TP_STRUCT__entry(
  1045. __field(unsigned int, task_id)
  1046. __field(unsigned int, client_id)
  1047. __field(u32, xid)
  1048. __field(unsigned int, credits)
  1049. ),
  1050. TP_fast_assign(
  1051. __entry->task_id = task->tk_pid;
  1052. __entry->client_id = task->tk_client->cl_clid;
  1053. __entry->xid = be32_to_cpu(rep->rr_xid);
  1054. __entry->credits = credits;
  1055. ),
  1056. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x credits=%u",
  1057. __entry->task_id, __entry->client_id, __entry->xid,
  1058. __entry->credits
  1059. )
  1060. );
  1061. DEFINE_REPLY_EVENT(vers);
  1062. DEFINE_REPLY_EVENT(rqst);
  1063. DEFINE_REPLY_EVENT(short);
  1064. DEFINE_REPLY_EVENT(hdr);
  1065. TRACE_EVENT(xprtrdma_err_vers,
  1066. TP_PROTO(
  1067. const struct rpc_rqst *rqst,
  1068. __be32 *min,
  1069. __be32 *max
  1070. ),
  1071. TP_ARGS(rqst, min, max),
  1072. TP_STRUCT__entry(
  1073. __field(unsigned int, task_id)
  1074. __field(unsigned int, client_id)
  1075. __field(u32, xid)
  1076. __field(u32, min)
  1077. __field(u32, max)
  1078. ),
  1079. TP_fast_assign(
  1080. __entry->task_id = rqst->rq_task->tk_pid;
  1081. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  1082. __entry->xid = be32_to_cpu(rqst->rq_xid);
  1083. __entry->min = be32_to_cpup(min);
  1084. __entry->max = be32_to_cpup(max);
  1085. ),
  1086. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x versions=[%u, %u]",
  1087. __entry->task_id, __entry->client_id, __entry->xid,
  1088. __entry->min, __entry->max
  1089. )
  1090. );
  1091. TRACE_EVENT(xprtrdma_err_chunk,
  1092. TP_PROTO(
  1093. const struct rpc_rqst *rqst
  1094. ),
  1095. TP_ARGS(rqst),
  1096. TP_STRUCT__entry(
  1097. __field(unsigned int, task_id)
  1098. __field(unsigned int, client_id)
  1099. __field(u32, xid)
  1100. ),
  1101. TP_fast_assign(
  1102. __entry->task_id = rqst->rq_task->tk_pid;
  1103. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  1104. __entry->xid = be32_to_cpu(rqst->rq_xid);
  1105. ),
  1106. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x",
  1107. __entry->task_id, __entry->client_id, __entry->xid
  1108. )
  1109. );
  1110. TRACE_EVENT(xprtrdma_err_unrecognized,
  1111. TP_PROTO(
  1112. const struct rpc_rqst *rqst,
  1113. __be32 *procedure
  1114. ),
  1115. TP_ARGS(rqst, procedure),
  1116. TP_STRUCT__entry(
  1117. __field(unsigned int, task_id)
  1118. __field(unsigned int, client_id)
  1119. __field(u32, xid)
  1120. __field(u32, procedure)
  1121. ),
  1122. TP_fast_assign(
  1123. __entry->task_id = rqst->rq_task->tk_pid;
  1124. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  1125. __entry->procedure = be32_to_cpup(procedure);
  1126. ),
  1127. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x procedure=%u",
  1128. __entry->task_id, __entry->client_id, __entry->xid,
  1129. __entry->procedure
  1130. )
  1131. );
  1132. TRACE_EVENT(xprtrdma_fixup,
  1133. TP_PROTO(
  1134. const struct rpc_rqst *rqst,
  1135. unsigned long fixup
  1136. ),
  1137. TP_ARGS(rqst, fixup),
  1138. TP_STRUCT__entry(
  1139. __field(unsigned int, task_id)
  1140. __field(unsigned int, client_id)
  1141. __field(unsigned long, fixup)
  1142. __field(size_t, headlen)
  1143. __field(unsigned int, pagelen)
  1144. __field(size_t, taillen)
  1145. ),
  1146. TP_fast_assign(
  1147. __entry->task_id = rqst->rq_task->tk_pid;
  1148. __entry->client_id = rqst->rq_task->tk_client->cl_clid;
  1149. __entry->fixup = fixup;
  1150. __entry->headlen = rqst->rq_rcv_buf.head[0].iov_len;
  1151. __entry->pagelen = rqst->rq_rcv_buf.page_len;
  1152. __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len;
  1153. ),
  1154. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " fixup=%lu xdr=%zu/%u/%zu",
  1155. __entry->task_id, __entry->client_id, __entry->fixup,
  1156. __entry->headlen, __entry->pagelen, __entry->taillen
  1157. )
  1158. );
  1159. TRACE_EVENT(xprtrdma_decode_seg,
  1160. TP_PROTO(
  1161. u32 handle,
  1162. u32 length,
  1163. u64 offset
  1164. ),
  1165. TP_ARGS(handle, length, offset),
  1166. TP_STRUCT__entry(
  1167. __field(u32, handle)
  1168. __field(u32, length)
  1169. __field(u64, offset)
  1170. ),
  1171. TP_fast_assign(
  1172. __entry->handle = handle;
  1173. __entry->length = length;
  1174. __entry->offset = offset;
  1175. ),
  1176. TP_printk("%u@0x%016llx:0x%08x",
  1177. __entry->length, (unsigned long long)__entry->offset,
  1178. __entry->handle
  1179. )
  1180. );
  1181. TRACE_EVENT(xprtrdma_mrs_zap,
  1182. TP_PROTO(
  1183. const struct rpc_task *task
  1184. ),
  1185. TP_ARGS(task),
  1186. TP_STRUCT__entry(
  1187. __field(unsigned int, task_id)
  1188. __field(unsigned int, client_id)
  1189. ),
  1190. TP_fast_assign(
  1191. __entry->task_id = task->tk_pid;
  1192. __entry->client_id = task->tk_client->cl_clid;
  1193. ),
  1194. TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
  1195. __entry->task_id, __entry->client_id
  1196. )
  1197. );
  1198. /**
  1199. ** Callback events
  1200. **/
  1201. TRACE_EVENT(xprtrdma_cb_setup,
  1202. TP_PROTO(
  1203. const struct rpcrdma_xprt *r_xprt,
  1204. unsigned int reqs
  1205. ),
  1206. TP_ARGS(r_xprt, reqs),
  1207. TP_STRUCT__entry(
  1208. __field(unsigned int, reqs)
  1209. __string(addr, rpcrdma_addrstr(r_xprt))
  1210. __string(port, rpcrdma_portstr(r_xprt))
  1211. ),
  1212. TP_fast_assign(
  1213. __entry->reqs = reqs;
  1214. __assign_str(addr);
  1215. __assign_str(port);
  1216. ),
  1217. TP_printk("peer=[%s]:%s %u reqs",
  1218. __get_str(addr), __get_str(port), __entry->reqs
  1219. )
  1220. );
  1221. DEFINE_CALLBACK_EVENT(call);
  1222. DEFINE_CALLBACK_EVENT(reply);
  1223. /**
  1224. ** Server-side RPC/RDMA events
  1225. **/
  1226. DECLARE_EVENT_CLASS(svcrdma_accept_class,
  1227. TP_PROTO(
  1228. const struct svcxprt_rdma *rdma,
  1229. long status
  1230. ),
  1231. TP_ARGS(rdma, status),
  1232. TP_STRUCT__entry(
  1233. __field(long, status)
  1234. __string(addr, rdma->sc_xprt.xpt_remotebuf)
  1235. ),
  1236. TP_fast_assign(
  1237. __entry->status = status;
  1238. __assign_str(addr);
  1239. ),
  1240. TP_printk("addr=%s status=%ld",
  1241. __get_str(addr), __entry->status
  1242. )
  1243. );
  1244. #define DEFINE_ACCEPT_EVENT(name) \
  1245. DEFINE_EVENT(svcrdma_accept_class, svcrdma_##name##_err, \
  1246. TP_PROTO( \
  1247. const struct svcxprt_rdma *rdma, \
  1248. long status \
  1249. ), \
  1250. TP_ARGS(rdma, status))
  1251. DEFINE_ACCEPT_EVENT(pd);
  1252. DEFINE_ACCEPT_EVENT(qp);
  1253. DEFINE_ACCEPT_EVENT(fabric);
  1254. DEFINE_ACCEPT_EVENT(initdepth);
  1255. DEFINE_ACCEPT_EVENT(accept);
  1256. TRACE_DEFINE_ENUM(RDMA_MSG);
  1257. TRACE_DEFINE_ENUM(RDMA_NOMSG);
  1258. TRACE_DEFINE_ENUM(RDMA_MSGP);
  1259. TRACE_DEFINE_ENUM(RDMA_DONE);
  1260. TRACE_DEFINE_ENUM(RDMA_ERROR);
  1261. #define show_rpcrdma_proc(x) \
  1262. __print_symbolic(x, \
  1263. { RDMA_MSG, "RDMA_MSG" }, \
  1264. { RDMA_NOMSG, "RDMA_NOMSG" }, \
  1265. { RDMA_MSGP, "RDMA_MSGP" }, \
  1266. { RDMA_DONE, "RDMA_DONE" }, \
  1267. { RDMA_ERROR, "RDMA_ERROR" })
  1268. TRACE_EVENT(svcrdma_decode_rqst,
  1269. TP_PROTO(
  1270. const struct svc_rdma_recv_ctxt *ctxt,
  1271. __be32 *p,
  1272. unsigned int hdrlen
  1273. ),
  1274. TP_ARGS(ctxt, p, hdrlen),
  1275. TP_STRUCT__entry(
  1276. __field(u32, cq_id)
  1277. __field(int, completion_id)
  1278. __field(u32, xid)
  1279. __field(u32, vers)
  1280. __field(u32, proc)
  1281. __field(u32, credits)
  1282. __field(unsigned int, hdrlen)
  1283. ),
  1284. TP_fast_assign(
  1285. __entry->cq_id = ctxt->rc_cid.ci_queue_id;
  1286. __entry->completion_id = ctxt->rc_cid.ci_completion_id;
  1287. __entry->xid = be32_to_cpup(p++);
  1288. __entry->vers = be32_to_cpup(p++);
  1289. __entry->credits = be32_to_cpup(p++);
  1290. __entry->proc = be32_to_cpup(p);
  1291. __entry->hdrlen = hdrlen;
  1292. ),
  1293. TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u",
  1294. __entry->cq_id, __entry->completion_id,
  1295. __entry->xid, __entry->vers, __entry->credits,
  1296. show_rpcrdma_proc(__entry->proc), __entry->hdrlen)
  1297. );
  1298. TRACE_EVENT(svcrdma_decode_short_err,
  1299. TP_PROTO(
  1300. const struct svc_rdma_recv_ctxt *ctxt,
  1301. unsigned int hdrlen
  1302. ),
  1303. TP_ARGS(ctxt, hdrlen),
  1304. TP_STRUCT__entry(
  1305. __field(u32, cq_id)
  1306. __field(int, completion_id)
  1307. __field(unsigned int, hdrlen)
  1308. ),
  1309. TP_fast_assign(
  1310. __entry->cq_id = ctxt->rc_cid.ci_queue_id;
  1311. __entry->completion_id = ctxt->rc_cid.ci_completion_id;
  1312. __entry->hdrlen = hdrlen;
  1313. ),
  1314. TP_printk("cq.id=%u cid=%d hdrlen=%u",
  1315. __entry->cq_id, __entry->completion_id,
  1316. __entry->hdrlen)
  1317. );
  1318. DECLARE_EVENT_CLASS(svcrdma_badreq_event,
  1319. TP_PROTO(
  1320. const struct svc_rdma_recv_ctxt *ctxt,
  1321. __be32 *p
  1322. ),
  1323. TP_ARGS(ctxt, p),
  1324. TP_STRUCT__entry(
  1325. __field(u32, cq_id)
  1326. __field(int, completion_id)
  1327. __field(u32, xid)
  1328. __field(u32, vers)
  1329. __field(u32, proc)
  1330. __field(u32, credits)
  1331. ),
  1332. TP_fast_assign(
  1333. __entry->cq_id = ctxt->rc_cid.ci_queue_id;
  1334. __entry->completion_id = ctxt->rc_cid.ci_completion_id;
  1335. __entry->xid = be32_to_cpup(p++);
  1336. __entry->vers = be32_to_cpup(p++);
  1337. __entry->credits = be32_to_cpup(p++);
  1338. __entry->proc = be32_to_cpup(p);
  1339. ),
  1340. TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%u",
  1341. __entry->cq_id, __entry->completion_id,
  1342. __entry->xid, __entry->vers, __entry->credits, __entry->proc)
  1343. );
  1344. #define DEFINE_BADREQ_EVENT(name) \
  1345. DEFINE_EVENT(svcrdma_badreq_event, \
  1346. svcrdma_decode_##name##_err, \
  1347. TP_PROTO( \
  1348. const struct svc_rdma_recv_ctxt *ctxt, \
  1349. __be32 *p \
  1350. ), \
  1351. TP_ARGS(ctxt, p))
  1352. DEFINE_BADREQ_EVENT(badvers);
  1353. DEFINE_BADREQ_EVENT(drop);
  1354. DEFINE_BADREQ_EVENT(badproc);
  1355. DEFINE_BADREQ_EVENT(parse);
  1356. TRACE_EVENT(svcrdma_encode_wseg,
  1357. TP_PROTO(
  1358. const struct svc_rdma_send_ctxt *ctxt,
  1359. u32 segno,
  1360. u32 handle,
  1361. u32 length,
  1362. u64 offset
  1363. ),
  1364. TP_ARGS(ctxt, segno, handle, length, offset),
  1365. TP_STRUCT__entry(
  1366. __field(u32, cq_id)
  1367. __field(int, completion_id)
  1368. __field(u32, segno)
  1369. __field(u32, handle)
  1370. __field(u32, length)
  1371. __field(u64, offset)
  1372. ),
  1373. TP_fast_assign(
  1374. __entry->cq_id = ctxt->sc_cid.ci_queue_id;
  1375. __entry->completion_id = ctxt->sc_cid.ci_completion_id;
  1376. __entry->segno = segno;
  1377. __entry->handle = handle;
  1378. __entry->length = length;
  1379. __entry->offset = offset;
  1380. ),
  1381. TP_printk("cq.id=%u cid=%d segno=%u %u@0x%016llx:0x%08x",
  1382. __entry->cq_id, __entry->completion_id,
  1383. __entry->segno, __entry->length,
  1384. (unsigned long long)__entry->offset, __entry->handle
  1385. )
  1386. );
  1387. TRACE_EVENT(svcrdma_decode_rseg,
  1388. TP_PROTO(
  1389. const struct rpc_rdma_cid *cid,
  1390. const struct svc_rdma_chunk *chunk,
  1391. const struct svc_rdma_segment *segment
  1392. ),
  1393. TP_ARGS(cid, chunk, segment),
  1394. TP_STRUCT__entry(
  1395. __field(u32, cq_id)
  1396. __field(int, completion_id)
  1397. __field(u32, segno)
  1398. __field(u32, position)
  1399. __field(u32, handle)
  1400. __field(u32, length)
  1401. __field(u64, offset)
  1402. ),
  1403. TP_fast_assign(
  1404. __entry->cq_id = cid->ci_queue_id;
  1405. __entry->completion_id = cid->ci_completion_id;
  1406. __entry->segno = chunk->ch_segcount;
  1407. __entry->position = chunk->ch_position;
  1408. __entry->handle = segment->rs_handle;
  1409. __entry->length = segment->rs_length;
  1410. __entry->offset = segment->rs_offset;
  1411. ),
  1412. TP_printk("cq.id=%u cid=%d segno=%u position=%u %u@0x%016llx:0x%08x",
  1413. __entry->cq_id, __entry->completion_id,
  1414. __entry->segno, __entry->position, __entry->length,
  1415. (unsigned long long)__entry->offset, __entry->handle
  1416. )
  1417. );
  1418. TRACE_EVENT(svcrdma_decode_wseg,
  1419. TP_PROTO(
  1420. const struct rpc_rdma_cid *cid,
  1421. const struct svc_rdma_chunk *chunk,
  1422. u32 segno
  1423. ),
  1424. TP_ARGS(cid, chunk, segno),
  1425. TP_STRUCT__entry(
  1426. __field(u32, cq_id)
  1427. __field(int, completion_id)
  1428. __field(u32, segno)
  1429. __field(u32, handle)
  1430. __field(u32, length)
  1431. __field(u64, offset)
  1432. ),
  1433. TP_fast_assign(
  1434. const struct svc_rdma_segment *segment =
  1435. &chunk->ch_segments[segno];
  1436. __entry->cq_id = cid->ci_queue_id;
  1437. __entry->completion_id = cid->ci_completion_id;
  1438. __entry->segno = segno;
  1439. __entry->handle = segment->rs_handle;
  1440. __entry->length = segment->rs_length;
  1441. __entry->offset = segment->rs_offset;
  1442. ),
  1443. TP_printk("cq.id=%u cid=%d segno=%u %u@0x%016llx:0x%08x",
  1444. __entry->cq_id, __entry->completion_id,
  1445. __entry->segno, __entry->length,
  1446. (unsigned long long)__entry->offset, __entry->handle
  1447. )
  1448. );
  1449. DECLARE_EVENT_CLASS(svcrdma_error_event,
  1450. TP_PROTO(
  1451. __be32 xid
  1452. ),
  1453. TP_ARGS(xid),
  1454. TP_STRUCT__entry(
  1455. __field(u32, xid)
  1456. ),
  1457. TP_fast_assign(
  1458. __entry->xid = be32_to_cpu(xid);
  1459. ),
  1460. TP_printk("xid=0x%08x",
  1461. __entry->xid
  1462. )
  1463. );
  1464. #define DEFINE_ERROR_EVENT(name) \
  1465. DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name, \
  1466. TP_PROTO( \
  1467. __be32 xid \
  1468. ), \
  1469. TP_ARGS(xid))
  1470. DEFINE_ERROR_EVENT(vers);
  1471. DEFINE_ERROR_EVENT(chunk);
  1472. /**
  1473. ** Server-side RDMA API events
  1474. **/
  1475. DECLARE_EVENT_CLASS(svcrdma_dma_map_class,
  1476. TP_PROTO(
  1477. const struct rpc_rdma_cid *cid,
  1478. u64 dma_addr,
  1479. u32 length
  1480. ),
  1481. TP_ARGS(cid, dma_addr, length),
  1482. TP_STRUCT__entry(
  1483. __field(u32, cq_id)
  1484. __field(int, completion_id)
  1485. __field(u64, dma_addr)
  1486. __field(u32, length)
  1487. ),
  1488. TP_fast_assign(
  1489. __entry->cq_id = cid->ci_queue_id;
  1490. __entry->completion_id = cid->ci_completion_id;
  1491. __entry->dma_addr = dma_addr;
  1492. __entry->length = length;
  1493. ),
  1494. TP_printk("cq.id=%u cid=%d dma_addr=%llu length=%u",
  1495. __entry->cq_id, __entry->completion_id,
  1496. __entry->dma_addr, __entry->length
  1497. )
  1498. );
  1499. #define DEFINE_SVC_DMA_EVENT(name) \
  1500. DEFINE_EVENT(svcrdma_dma_map_class, svcrdma_##name, \
  1501. TP_PROTO( \
  1502. const struct rpc_rdma_cid *cid, \
  1503. u64 dma_addr, \
  1504. u32 length \
  1505. ), \
  1506. TP_ARGS(cid, dma_addr, length) \
  1507. )
  1508. DEFINE_SVC_DMA_EVENT(dma_map_page);
  1509. DEFINE_SVC_DMA_EVENT(dma_map_err);
  1510. DEFINE_SVC_DMA_EVENT(dma_unmap_page);
  1511. TRACE_EVENT(svcrdma_dma_map_rw_err,
  1512. TP_PROTO(
  1513. const struct svcxprt_rdma *rdma,
  1514. u64 offset,
  1515. u32 handle,
  1516. unsigned int nents,
  1517. int status
  1518. ),
  1519. TP_ARGS(rdma, offset, handle, nents, status),
  1520. TP_STRUCT__entry(
  1521. __field(u32, cq_id)
  1522. __field(u32, handle)
  1523. __field(u64, offset)
  1524. __field(unsigned int, nents)
  1525. __field(int, status)
  1526. ),
  1527. TP_fast_assign(
  1528. __entry->cq_id = rdma->sc_sq_cq->res.id;
  1529. __entry->handle = handle;
  1530. __entry->offset = offset;
  1531. __entry->nents = nents;
  1532. __entry->status = status;
  1533. ),
  1534. TP_printk("cq.id=%u 0x%016llx:0x%08x nents=%u status=%d",
  1535. __entry->cq_id, (unsigned long long)__entry->offset,
  1536. __entry->handle, __entry->nents, __entry->status
  1537. )
  1538. );
  1539. TRACE_EVENT(svcrdma_rwctx_empty,
  1540. TP_PROTO(
  1541. const struct svcxprt_rdma *rdma,
  1542. unsigned int num_sges
  1543. ),
  1544. TP_ARGS(rdma, num_sges),
  1545. TP_STRUCT__entry(
  1546. __field(u32, cq_id)
  1547. __field(unsigned int, num_sges)
  1548. ),
  1549. TP_fast_assign(
  1550. __entry->cq_id = rdma->sc_sq_cq->res.id;
  1551. __entry->num_sges = num_sges;
  1552. ),
  1553. TP_printk("cq.id=%u num_sges=%d",
  1554. __entry->cq_id, __entry->num_sges
  1555. )
  1556. );
  1557. TRACE_EVENT(svcrdma_page_overrun_err,
  1558. TP_PROTO(
  1559. const struct rpc_rdma_cid *cid,
  1560. unsigned int pageno
  1561. ),
  1562. TP_ARGS(cid, pageno),
  1563. TP_STRUCT__entry(
  1564. __field(u32, cq_id)
  1565. __field(int, completion_id)
  1566. __field(unsigned int, pageno)
  1567. ),
  1568. TP_fast_assign(
  1569. __entry->cq_id = cid->ci_queue_id;
  1570. __entry->completion_id = cid->ci_completion_id;
  1571. __entry->pageno = pageno;
  1572. ),
  1573. TP_printk("cq.id=%u cid=%d pageno=%u",
  1574. __entry->cq_id, __entry->completion_id,
  1575. __entry->pageno
  1576. )
  1577. );
  1578. TRACE_EVENT(svcrdma_small_wrch_err,
  1579. TP_PROTO(
  1580. const struct rpc_rdma_cid *cid,
  1581. unsigned int remaining,
  1582. unsigned int seg_no,
  1583. unsigned int num_segs
  1584. ),
  1585. TP_ARGS(cid, remaining, seg_no, num_segs),
  1586. TP_STRUCT__entry(
  1587. __field(u32, cq_id)
  1588. __field(int, completion_id)
  1589. __field(unsigned int, remaining)
  1590. __field(unsigned int, seg_no)
  1591. __field(unsigned int, num_segs)
  1592. ),
  1593. TP_fast_assign(
  1594. __entry->cq_id = cid->ci_queue_id;
  1595. __entry->completion_id = cid->ci_completion_id;
  1596. __entry->remaining = remaining;
  1597. __entry->seg_no = seg_no;
  1598. __entry->num_segs = num_segs;
  1599. ),
  1600. TP_printk("cq.id=%u cid=%d remaining=%u seg_no=%u num_segs=%u",
  1601. __entry->cq_id, __entry->completion_id,
  1602. __entry->remaining, __entry->seg_no, __entry->num_segs
  1603. )
  1604. );
  1605. TRACE_EVENT(svcrdma_send_pullup,
  1606. TP_PROTO(
  1607. const struct svc_rdma_send_ctxt *ctxt,
  1608. unsigned int msglen
  1609. ),
  1610. TP_ARGS(ctxt, msglen),
  1611. TP_STRUCT__entry(
  1612. __field(u32, cq_id)
  1613. __field(int, completion_id)
  1614. __field(unsigned int, hdrlen)
  1615. __field(unsigned int, msglen)
  1616. ),
  1617. TP_fast_assign(
  1618. __entry->cq_id = ctxt->sc_cid.ci_queue_id;
  1619. __entry->completion_id = ctxt->sc_cid.ci_completion_id;
  1620. __entry->hdrlen = ctxt->sc_hdrbuf.len,
  1621. __entry->msglen = msglen;
  1622. ),
  1623. TP_printk("cq.id=%u cid=%d hdr=%u msg=%u (total %u)",
  1624. __entry->cq_id, __entry->completion_id,
  1625. __entry->hdrlen, __entry->msglen,
  1626. __entry->hdrlen + __entry->msglen)
  1627. );
  1628. TRACE_EVENT(svcrdma_send_err,
  1629. TP_PROTO(
  1630. const struct svc_rqst *rqst,
  1631. int status
  1632. ),
  1633. TP_ARGS(rqst, status),
  1634. TP_STRUCT__entry(
  1635. __field(int, status)
  1636. __field(u32, xid)
  1637. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  1638. ),
  1639. TP_fast_assign(
  1640. __entry->status = status;
  1641. __entry->xid = __be32_to_cpu(rqst->rq_xid);
  1642. __assign_str(addr);
  1643. ),
  1644. TP_printk("addr=%s xid=0x%08x status=%d", __get_str(addr),
  1645. __entry->xid, __entry->status
  1646. )
  1647. );
  1648. TRACE_EVENT(svcrdma_post_send,
  1649. TP_PROTO(
  1650. const struct svc_rdma_send_ctxt *ctxt
  1651. ),
  1652. TP_ARGS(ctxt),
  1653. TP_STRUCT__entry(
  1654. __field(u32, cq_id)
  1655. __field(int, completion_id)
  1656. __field(unsigned int, num_sge)
  1657. __field(u32, inv_rkey)
  1658. ),
  1659. TP_fast_assign(
  1660. const struct ib_send_wr *wr = &ctxt->sc_send_wr;
  1661. __entry->cq_id = ctxt->sc_cid.ci_queue_id;
  1662. __entry->completion_id = ctxt->sc_cid.ci_completion_id;
  1663. __entry->num_sge = wr->num_sge;
  1664. __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ?
  1665. wr->ex.invalidate_rkey : 0;
  1666. ),
  1667. TP_printk("cq.id=%u cid=%d num_sge=%u inv_rkey=0x%08x",
  1668. __entry->cq_id, __entry->completion_id,
  1669. __entry->num_sge, __entry->inv_rkey
  1670. )
  1671. );
  1672. DEFINE_SIMPLE_CID_EVENT(svcrdma_wc_send);
  1673. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush);
  1674. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err);
  1675. DEFINE_SIMPLE_CID_EVENT(svcrdma_post_recv);
  1676. DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv);
  1677. DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush);
  1678. DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_err);
  1679. TRACE_EVENT(svcrdma_rq_post_err,
  1680. TP_PROTO(
  1681. const struct svcxprt_rdma *rdma,
  1682. int status
  1683. ),
  1684. TP_ARGS(rdma, status),
  1685. TP_STRUCT__entry(
  1686. __field(int, status)
  1687. __string(addr, rdma->sc_xprt.xpt_remotebuf)
  1688. ),
  1689. TP_fast_assign(
  1690. __entry->status = status;
  1691. __assign_str(addr);
  1692. ),
  1693. TP_printk("addr=%s status=%d",
  1694. __get_str(addr), __entry->status
  1695. )
  1696. );
  1697. DECLARE_EVENT_CLASS(svcrdma_post_chunk_class,
  1698. TP_PROTO(
  1699. const struct rpc_rdma_cid *cid,
  1700. int sqecount
  1701. ),
  1702. TP_ARGS(cid, sqecount),
  1703. TP_STRUCT__entry(
  1704. __field(u32, cq_id)
  1705. __field(int, completion_id)
  1706. __field(int, sqecount)
  1707. ),
  1708. TP_fast_assign(
  1709. __entry->cq_id = cid->ci_queue_id;
  1710. __entry->completion_id = cid->ci_completion_id;
  1711. __entry->sqecount = sqecount;
  1712. ),
  1713. TP_printk("cq.id=%u cid=%d sqecount=%d",
  1714. __entry->cq_id, __entry->completion_id,
  1715. __entry->sqecount
  1716. )
  1717. );
  1718. #define DEFINE_POST_CHUNK_EVENT(name) \
  1719. DEFINE_EVENT(svcrdma_post_chunk_class, \
  1720. svcrdma_post_##name##_chunk, \
  1721. TP_PROTO( \
  1722. const struct rpc_rdma_cid *cid, \
  1723. int sqecount \
  1724. ), \
  1725. TP_ARGS(cid, sqecount))
  1726. DEFINE_POST_CHUNK_EVENT(read);
  1727. DEFINE_POST_CHUNK_EVENT(write);
  1728. DEFINE_POST_CHUNK_EVENT(reply);
  1729. DEFINE_EVENT(svcrdma_post_chunk_class, svcrdma_cc_release,
  1730. TP_PROTO(
  1731. const struct rpc_rdma_cid *cid,
  1732. int sqecount
  1733. ),
  1734. TP_ARGS(cid, sqecount)
  1735. );
  1736. TRACE_EVENT(svcrdma_wc_read,
  1737. TP_PROTO(
  1738. const struct ib_wc *wc,
  1739. const struct rpc_rdma_cid *cid,
  1740. unsigned int totalbytes,
  1741. const ktime_t posttime
  1742. ),
  1743. TP_ARGS(wc, cid, totalbytes, posttime),
  1744. TP_STRUCT__entry(
  1745. __field(u32, cq_id)
  1746. __field(int, completion_id)
  1747. __field(s64, read_latency)
  1748. __field(unsigned int, totalbytes)
  1749. ),
  1750. TP_fast_assign(
  1751. __entry->cq_id = cid->ci_queue_id;
  1752. __entry->completion_id = cid->ci_completion_id;
  1753. __entry->totalbytes = totalbytes;
  1754. __entry->read_latency = ktime_us_delta(ktime_get(), posttime);
  1755. ),
  1756. TP_printk("cq.id=%u cid=%d totalbytes=%u latency-us=%lld",
  1757. __entry->cq_id, __entry->completion_id,
  1758. __entry->totalbytes, __entry->read_latency
  1759. )
  1760. );
  1761. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush);
  1762. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err);
  1763. DEFINE_SIMPLE_CID_EVENT(svcrdma_read_finished);
  1764. DEFINE_SIMPLE_CID_EVENT(svcrdma_wc_write);
  1765. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush);
  1766. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err);
  1767. DEFINE_SIMPLE_CID_EVENT(svcrdma_wc_reply);
  1768. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_reply_flush);
  1769. DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_reply_err);
  1770. TRACE_EVENT(svcrdma_qp_error,
  1771. TP_PROTO(
  1772. const struct ib_event *event,
  1773. const struct sockaddr *sap
  1774. ),
  1775. TP_ARGS(event, sap),
  1776. TP_STRUCT__entry(
  1777. __field(unsigned int, event)
  1778. __string(device, event->device->name)
  1779. __array(__u8, addr, INET6_ADDRSTRLEN + 10)
  1780. ),
  1781. TP_fast_assign(
  1782. __entry->event = event->event;
  1783. __assign_str(device);
  1784. snprintf(__entry->addr, sizeof(__entry->addr) - 1,
  1785. "%pISpc", sap);
  1786. ),
  1787. TP_printk("addr=%s dev=%s event=%s (%u)",
  1788. __entry->addr, __get_str(device),
  1789. rdma_show_ib_event(__entry->event), __entry->event
  1790. )
  1791. );
  1792. TRACE_EVENT(svcrdma_device_removal,
  1793. TP_PROTO(
  1794. const struct rdma_cm_id *id
  1795. ),
  1796. TP_ARGS(id),
  1797. TP_STRUCT__entry(
  1798. __string(name, id->device->name)
  1799. __array(unsigned char, addr, sizeof(struct sockaddr_in6))
  1800. ),
  1801. TP_fast_assign(
  1802. __assign_str(name);
  1803. memcpy(__entry->addr, &id->route.addr.dst_addr,
  1804. sizeof(struct sockaddr_in6));
  1805. ),
  1806. TP_printk("device %s to be removed, disconnecting %pISpc\n",
  1807. __get_str(name), __entry->addr
  1808. )
  1809. );
  1810. DECLARE_EVENT_CLASS(svcrdma_sendqueue_class,
  1811. TP_PROTO(
  1812. const struct svcxprt_rdma *rdma,
  1813. const struct rpc_rdma_cid *cid
  1814. ),
  1815. TP_ARGS(rdma, cid),
  1816. TP_STRUCT__entry(
  1817. __field(u32, cq_id)
  1818. __field(int, completion_id)
  1819. __field(int, avail)
  1820. __field(int, depth)
  1821. ),
  1822. TP_fast_assign(
  1823. __entry->cq_id = cid->ci_queue_id;
  1824. __entry->completion_id = cid->ci_completion_id;
  1825. __entry->avail = atomic_read(&rdma->sc_sq_avail);
  1826. __entry->depth = rdma->sc_sq_depth;
  1827. ),
  1828. TP_printk("cq.id=%u cid=%d sc_sq_avail=%d/%d",
  1829. __entry->cq_id, __entry->completion_id,
  1830. __entry->avail, __entry->depth
  1831. )
  1832. );
  1833. #define DEFINE_SQ_EVENT(name) \
  1834. DEFINE_EVENT(svcrdma_sendqueue_class, name, \
  1835. TP_PROTO( \
  1836. const struct svcxprt_rdma *rdma, \
  1837. const struct rpc_rdma_cid *cid \
  1838. ), \
  1839. TP_ARGS(rdma, cid) \
  1840. )
  1841. DEFINE_SQ_EVENT(svcrdma_sq_full);
  1842. DEFINE_SQ_EVENT(svcrdma_sq_retry);
  1843. TRACE_EVENT(svcrdma_sq_post_err,
  1844. TP_PROTO(
  1845. const struct svcxprt_rdma *rdma,
  1846. const struct rpc_rdma_cid *cid,
  1847. int status
  1848. ),
  1849. TP_ARGS(rdma, cid, status),
  1850. TP_STRUCT__entry(
  1851. __field(u32, cq_id)
  1852. __field(int, completion_id)
  1853. __field(int, avail)
  1854. __field(int, depth)
  1855. __field(int, status)
  1856. ),
  1857. TP_fast_assign(
  1858. __entry->cq_id = cid->ci_queue_id;
  1859. __entry->completion_id = cid->ci_completion_id;
  1860. __entry->avail = atomic_read(&rdma->sc_sq_avail);
  1861. __entry->depth = rdma->sc_sq_depth;
  1862. __entry->status = status;
  1863. ),
  1864. TP_printk("cq.id=%u cid=%d sc_sq_avail=%d/%d status=%d",
  1865. __entry->cq_id, __entry->completion_id,
  1866. __entry->avail, __entry->depth, __entry->status
  1867. )
  1868. );
  1869. DECLARE_EVENT_CLASS(rpcrdma_client_device_class,
  1870. TP_PROTO(
  1871. const struct ib_device *device
  1872. ),
  1873. TP_ARGS(device),
  1874. TP_STRUCT__entry(
  1875. __string(name, device->name)
  1876. ),
  1877. TP_fast_assign(
  1878. __assign_str(name);
  1879. ),
  1880. TP_printk("device=%s",
  1881. __get_str(name)
  1882. )
  1883. );
  1884. #define DEFINE_CLIENT_DEVICE_EVENT(name) \
  1885. DEFINE_EVENT(rpcrdma_client_device_class, name, \
  1886. TP_PROTO( \
  1887. const struct ib_device *device \
  1888. ), \
  1889. TP_ARGS(device) \
  1890. )
  1891. DEFINE_CLIENT_DEVICE_EVENT(rpcrdma_client_completion);
  1892. DEFINE_CLIENT_DEVICE_EVENT(rpcrdma_client_add_one);
  1893. DEFINE_CLIENT_DEVICE_EVENT(rpcrdma_client_remove_one);
  1894. DEFINE_CLIENT_DEVICE_EVENT(rpcrdma_client_wait_on);
  1895. DEFINE_CLIENT_DEVICE_EVENT(rpcrdma_client_remove_one_done);
  1896. DECLARE_EVENT_CLASS(rpcrdma_client_register_class,
  1897. TP_PROTO(
  1898. const struct ib_device *device,
  1899. const struct rpcrdma_notification *rn
  1900. ),
  1901. TP_ARGS(device, rn),
  1902. TP_STRUCT__entry(
  1903. __string(name, device->name)
  1904. __field(void *, callback)
  1905. __field(u32, index)
  1906. ),
  1907. TP_fast_assign(
  1908. __assign_str(name);
  1909. __entry->callback = rn->rn_done;
  1910. __entry->index = rn->rn_index;
  1911. ),
  1912. TP_printk("device=%s index=%u done callback=%pS\n",
  1913. __get_str(name), __entry->index, __entry->callback
  1914. )
  1915. );
  1916. #define DEFINE_CLIENT_REGISTER_EVENT(name) \
  1917. DEFINE_EVENT(rpcrdma_client_register_class, name, \
  1918. TP_PROTO( \
  1919. const struct ib_device *device, \
  1920. const struct rpcrdma_notification *rn \
  1921. ), \
  1922. TP_ARGS(device, rn))
  1923. DEFINE_CLIENT_REGISTER_EVENT(rpcrdma_client_register);
  1924. DEFINE_CLIENT_REGISTER_EVENT(rpcrdma_client_unregister);
  1925. #endif /* _TRACE_RPCRDMA_H */
  1926. #include <trace/define_trace.h>