rxrpc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /* AF_RXRPC tracepoints
  2. *
  3. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells ([email protected])
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #undef TRACE_SYSTEM
  12. #define TRACE_SYSTEM rxrpc
  13. #if !defined(_TRACE_RXRPC_H) || defined(TRACE_HEADER_MULTI_READ)
  14. #define _TRACE_RXRPC_H
  15. #include <linux/tracepoint.h>
  16. TRACE_EVENT(rxrpc_conn,
  17. TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
  18. int usage, const void *where),
  19. TP_ARGS(conn, op, usage, where),
  20. TP_STRUCT__entry(
  21. __field(struct rxrpc_connection *, conn )
  22. __field(int, op )
  23. __field(int, usage )
  24. __field(const void *, where )
  25. ),
  26. TP_fast_assign(
  27. __entry->conn = conn;
  28. __entry->op = op;
  29. __entry->usage = usage;
  30. __entry->where = where;
  31. ),
  32. TP_printk("C=%p %s u=%d sp=%pSR",
  33. __entry->conn,
  34. rxrpc_conn_traces[__entry->op],
  35. __entry->usage,
  36. __entry->where)
  37. );
  38. TRACE_EVENT(rxrpc_client,
  39. TP_PROTO(struct rxrpc_connection *conn, int channel,
  40. enum rxrpc_client_trace op),
  41. TP_ARGS(conn, channel, op),
  42. TP_STRUCT__entry(
  43. __field(struct rxrpc_connection *, conn )
  44. __field(u32, cid )
  45. __field(int, channel )
  46. __field(int, usage )
  47. __field(enum rxrpc_client_trace, op )
  48. __field(enum rxrpc_conn_cache_state, cs )
  49. ),
  50. TP_fast_assign(
  51. __entry->conn = conn;
  52. __entry->channel = channel;
  53. __entry->usage = atomic_read(&conn->usage);
  54. __entry->op = op;
  55. __entry->cid = conn->proto.cid;
  56. __entry->cs = conn->cache_state;
  57. ),
  58. TP_printk("C=%p h=%2d %s %s i=%08x u=%d",
  59. __entry->conn,
  60. __entry->channel,
  61. rxrpc_client_traces[__entry->op],
  62. rxrpc_conn_cache_states[__entry->cs],
  63. __entry->cid,
  64. __entry->usage)
  65. );
  66. TRACE_EVENT(rxrpc_call,
  67. TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
  68. int usage, const void *where, const void *aux),
  69. TP_ARGS(call, op, usage, where, aux),
  70. TP_STRUCT__entry(
  71. __field(struct rxrpc_call *, call )
  72. __field(int, op )
  73. __field(int, usage )
  74. __field(const void *, where )
  75. __field(const void *, aux )
  76. ),
  77. TP_fast_assign(
  78. __entry->call = call;
  79. __entry->op = op;
  80. __entry->usage = usage;
  81. __entry->where = where;
  82. __entry->aux = aux;
  83. ),
  84. TP_printk("c=%p %s u=%d sp=%pSR a=%p",
  85. __entry->call,
  86. rxrpc_call_traces[__entry->op],
  87. __entry->usage,
  88. __entry->where,
  89. __entry->aux)
  90. );
  91. TRACE_EVENT(rxrpc_skb,
  92. TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op,
  93. int usage, int mod_count, const void *where),
  94. TP_ARGS(skb, op, usage, mod_count, where),
  95. TP_STRUCT__entry(
  96. __field(struct sk_buff *, skb )
  97. __field(enum rxrpc_skb_trace, op )
  98. __field(int, usage )
  99. __field(int, mod_count )
  100. __field(const void *, where )
  101. ),
  102. TP_fast_assign(
  103. __entry->skb = skb;
  104. __entry->op = op;
  105. __entry->usage = usage;
  106. __entry->mod_count = mod_count;
  107. __entry->where = where;
  108. ),
  109. TP_printk("s=%p %s u=%d m=%d p=%pSR",
  110. __entry->skb,
  111. rxrpc_skb_traces[__entry->op],
  112. __entry->usage,
  113. __entry->mod_count,
  114. __entry->where)
  115. );
  116. TRACE_EVENT(rxrpc_rx_packet,
  117. TP_PROTO(struct rxrpc_skb_priv *sp),
  118. TP_ARGS(sp),
  119. TP_STRUCT__entry(
  120. __field_struct(struct rxrpc_host_header, hdr )
  121. ),
  122. TP_fast_assign(
  123. memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
  124. ),
  125. TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s",
  126. __entry->hdr.epoch, __entry->hdr.cid,
  127. __entry->hdr.callNumber, __entry->hdr.serviceId,
  128. __entry->hdr.serial, __entry->hdr.seq,
  129. __entry->hdr.type, __entry->hdr.flags,
  130. __entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK")
  131. );
  132. TRACE_EVENT(rxrpc_rx_done,
  133. TP_PROTO(int result, int abort_code),
  134. TP_ARGS(result, abort_code),
  135. TP_STRUCT__entry(
  136. __field(int, result )
  137. __field(int, abort_code )
  138. ),
  139. TP_fast_assign(
  140. __entry->result = result;
  141. __entry->abort_code = abort_code;
  142. ),
  143. TP_printk("r=%d a=%d", __entry->result, __entry->abort_code)
  144. );
  145. TRACE_EVENT(rxrpc_abort,
  146. TP_PROTO(const char *why, u32 cid, u32 call_id, rxrpc_seq_t seq,
  147. int abort_code, int error),
  148. TP_ARGS(why, cid, call_id, seq, abort_code, error),
  149. TP_STRUCT__entry(
  150. __array(char, why, 4 )
  151. __field(u32, cid )
  152. __field(u32, call_id )
  153. __field(rxrpc_seq_t, seq )
  154. __field(int, abort_code )
  155. __field(int, error )
  156. ),
  157. TP_fast_assign(
  158. memcpy(__entry->why, why, 4);
  159. __entry->cid = cid;
  160. __entry->call_id = call_id;
  161. __entry->abort_code = abort_code;
  162. __entry->error = error;
  163. __entry->seq = seq;
  164. ),
  165. TP_printk("%08x:%08x s=%u a=%d e=%d %s",
  166. __entry->cid, __entry->call_id, __entry->seq,
  167. __entry->abort_code, __entry->error, __entry->why)
  168. );
  169. TRACE_EVENT(rxrpc_transmit,
  170. TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why),
  171. TP_ARGS(call, why),
  172. TP_STRUCT__entry(
  173. __field(struct rxrpc_call *, call )
  174. __field(enum rxrpc_transmit_trace, why )
  175. __field(rxrpc_seq_t, tx_hard_ack )
  176. __field(rxrpc_seq_t, tx_top )
  177. ),
  178. TP_fast_assign(
  179. __entry->call = call;
  180. __entry->why = why;
  181. __entry->tx_hard_ack = call->tx_hard_ack;
  182. __entry->tx_top = call->tx_top;
  183. ),
  184. TP_printk("c=%p %s f=%08x n=%u",
  185. __entry->call,
  186. rxrpc_transmit_traces[__entry->why],
  187. __entry->tx_hard_ack + 1,
  188. __entry->tx_top - __entry->tx_hard_ack)
  189. );
  190. TRACE_EVENT(rxrpc_rx_ack,
  191. TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first, u8 reason, u8 n_acks),
  192. TP_ARGS(call, first, reason, n_acks),
  193. TP_STRUCT__entry(
  194. __field(struct rxrpc_call *, call )
  195. __field(rxrpc_seq_t, first )
  196. __field(u8, reason )
  197. __field(u8, n_acks )
  198. ),
  199. TP_fast_assign(
  200. __entry->call = call;
  201. __entry->first = first;
  202. __entry->reason = reason;
  203. __entry->n_acks = n_acks;
  204. ),
  205. TP_printk("c=%p %s f=%08x n=%u",
  206. __entry->call,
  207. rxrpc_ack_names[__entry->reason],
  208. __entry->first,
  209. __entry->n_acks)
  210. );
  211. TRACE_EVENT(rxrpc_tx_data,
  212. TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
  213. rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
  214. TP_ARGS(call, seq, serial, flags, retrans, lose),
  215. TP_STRUCT__entry(
  216. __field(struct rxrpc_call *, call )
  217. __field(rxrpc_seq_t, seq )
  218. __field(rxrpc_serial_t, serial )
  219. __field(u8, flags )
  220. __field(bool, retrans )
  221. __field(bool, lose )
  222. ),
  223. TP_fast_assign(
  224. __entry->call = call;
  225. __entry->seq = seq;
  226. __entry->serial = serial;
  227. __entry->flags = flags;
  228. __entry->retrans = retrans;
  229. __entry->lose = lose;
  230. ),
  231. TP_printk("c=%p DATA %08x q=%08x fl=%02x%s%s",
  232. __entry->call,
  233. __entry->serial,
  234. __entry->seq,
  235. __entry->flags,
  236. __entry->retrans ? " *RETRANS*" : "",
  237. __entry->lose ? " *LOSE*" : "")
  238. );
  239. TRACE_EVENT(rxrpc_tx_ack,
  240. TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
  241. rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial,
  242. u8 reason, u8 n_acks),
  243. TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks),
  244. TP_STRUCT__entry(
  245. __field(struct rxrpc_call *, call )
  246. __field(rxrpc_serial_t, serial )
  247. __field(rxrpc_seq_t, ack_first )
  248. __field(rxrpc_serial_t, ack_serial )
  249. __field(u8, reason )
  250. __field(u8, n_acks )
  251. ),
  252. TP_fast_assign(
  253. __entry->call = call;
  254. __entry->serial = serial;
  255. __entry->ack_first = ack_first;
  256. __entry->ack_serial = ack_serial;
  257. __entry->reason = reason;
  258. __entry->n_acks = n_acks;
  259. ),
  260. TP_printk(" c=%p ACK %08x %s f=%08x r=%08x n=%u",
  261. __entry->call,
  262. __entry->serial,
  263. rxrpc_ack_names[__entry->reason],
  264. __entry->ack_first,
  265. __entry->ack_serial,
  266. __entry->n_acks)
  267. );
  268. TRACE_EVENT(rxrpc_receive,
  269. TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
  270. rxrpc_serial_t serial, rxrpc_seq_t seq),
  271. TP_ARGS(call, why, serial, seq),
  272. TP_STRUCT__entry(
  273. __field(struct rxrpc_call *, call )
  274. __field(enum rxrpc_receive_trace, why )
  275. __field(rxrpc_serial_t, serial )
  276. __field(rxrpc_seq_t, seq )
  277. __field(rxrpc_seq_t, hard_ack )
  278. __field(rxrpc_seq_t, top )
  279. ),
  280. TP_fast_assign(
  281. __entry->call = call;
  282. __entry->why = why;
  283. __entry->serial = serial;
  284. __entry->seq = seq;
  285. __entry->hard_ack = call->rx_hard_ack;
  286. __entry->top = call->rx_top;
  287. ),
  288. TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
  289. __entry->call,
  290. rxrpc_receive_traces[__entry->why],
  291. __entry->serial,
  292. __entry->seq,
  293. __entry->hard_ack,
  294. __entry->top)
  295. );
  296. TRACE_EVENT(rxrpc_recvmsg,
  297. TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
  298. rxrpc_seq_t seq, unsigned int offset, unsigned int len,
  299. int ret),
  300. TP_ARGS(call, why, seq, offset, len, ret),
  301. TP_STRUCT__entry(
  302. __field(struct rxrpc_call *, call )
  303. __field(enum rxrpc_recvmsg_trace, why )
  304. __field(rxrpc_seq_t, seq )
  305. __field(unsigned int, offset )
  306. __field(unsigned int, len )
  307. __field(int, ret )
  308. ),
  309. TP_fast_assign(
  310. __entry->call = call;
  311. __entry->why = why;
  312. __entry->seq = seq;
  313. __entry->offset = offset;
  314. __entry->len = len;
  315. __entry->ret = ret;
  316. ),
  317. TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
  318. __entry->call,
  319. rxrpc_recvmsg_traces[__entry->why],
  320. __entry->seq,
  321. __entry->offset,
  322. __entry->len,
  323. __entry->ret)
  324. );
  325. TRACE_EVENT(rxrpc_rtt_tx,
  326. TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
  327. rxrpc_serial_t send_serial),
  328. TP_ARGS(call, why, send_serial),
  329. TP_STRUCT__entry(
  330. __field(struct rxrpc_call *, call )
  331. __field(enum rxrpc_rtt_tx_trace, why )
  332. __field(rxrpc_serial_t, send_serial )
  333. ),
  334. TP_fast_assign(
  335. __entry->call = call;
  336. __entry->why = why;
  337. __entry->send_serial = send_serial;
  338. ),
  339. TP_printk("c=%p %s sr=%08x",
  340. __entry->call,
  341. rxrpc_rtt_tx_traces[__entry->why],
  342. __entry->send_serial)
  343. );
  344. TRACE_EVENT(rxrpc_rtt_rx,
  345. TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
  346. rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
  347. s64 rtt, u8 nr, s64 avg),
  348. TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
  349. TP_STRUCT__entry(
  350. __field(struct rxrpc_call *, call )
  351. __field(enum rxrpc_rtt_rx_trace, why )
  352. __field(u8, nr )
  353. __field(rxrpc_serial_t, send_serial )
  354. __field(rxrpc_serial_t, resp_serial )
  355. __field(s64, rtt )
  356. __field(u64, avg )
  357. ),
  358. TP_fast_assign(
  359. __entry->call = call;
  360. __entry->why = why;
  361. __entry->send_serial = send_serial;
  362. __entry->resp_serial = resp_serial;
  363. __entry->rtt = rtt;
  364. __entry->nr = nr;
  365. __entry->avg = avg;
  366. ),
  367. TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
  368. __entry->call,
  369. rxrpc_rtt_rx_traces[__entry->why],
  370. __entry->send_serial,
  371. __entry->resp_serial,
  372. __entry->rtt,
  373. __entry->nr,
  374. __entry->avg)
  375. );
  376. TRACE_EVENT(rxrpc_timer,
  377. TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why,
  378. ktime_t now, unsigned long now_j),
  379. TP_ARGS(call, why, now, now_j),
  380. TP_STRUCT__entry(
  381. __field(struct rxrpc_call *, call )
  382. __field(enum rxrpc_timer_trace, why )
  383. __field_struct(ktime_t, now )
  384. __field_struct(ktime_t, expire_at )
  385. __field_struct(ktime_t, ack_at )
  386. __field_struct(ktime_t, resend_at )
  387. __field(unsigned long, now_j )
  388. __field(unsigned long, timer )
  389. ),
  390. TP_fast_assign(
  391. __entry->call = call;
  392. __entry->why = why;
  393. __entry->now = now;
  394. __entry->expire_at = call->expire_at;
  395. __entry->ack_at = call->ack_at;
  396. __entry->resend_at = call->resend_at;
  397. __entry->now_j = now_j;
  398. __entry->timer = call->timer.expires;
  399. ),
  400. TP_printk("c=%p %s x=%lld a=%lld r=%lld t=%ld",
  401. __entry->call,
  402. rxrpc_timer_traces[__entry->why],
  403. ktime_to_ns(ktime_sub(__entry->expire_at, __entry->now)),
  404. ktime_to_ns(ktime_sub(__entry->ack_at, __entry->now)),
  405. ktime_to_ns(ktime_sub(__entry->resend_at, __entry->now)),
  406. __entry->timer - __entry->now_j)
  407. );
  408. TRACE_EVENT(rxrpc_rx_lose,
  409. TP_PROTO(struct rxrpc_skb_priv *sp),
  410. TP_ARGS(sp),
  411. TP_STRUCT__entry(
  412. __field_struct(struct rxrpc_host_header, hdr )
  413. ),
  414. TP_fast_assign(
  415. memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
  416. ),
  417. TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*",
  418. __entry->hdr.epoch, __entry->hdr.cid,
  419. __entry->hdr.callNumber, __entry->hdr.serviceId,
  420. __entry->hdr.serial, __entry->hdr.seq,
  421. __entry->hdr.type, __entry->hdr.flags,
  422. __entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK")
  423. );
  424. TRACE_EVENT(rxrpc_propose_ack,
  425. TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
  426. u8 ack_reason, rxrpc_serial_t serial, bool immediate,
  427. bool background, enum rxrpc_propose_ack_outcome outcome),
  428. TP_ARGS(call, why, ack_reason, serial, immediate, background,
  429. outcome),
  430. TP_STRUCT__entry(
  431. __field(struct rxrpc_call *, call )
  432. __field(enum rxrpc_propose_ack_trace, why )
  433. __field(rxrpc_serial_t, serial )
  434. __field(u8, ack_reason )
  435. __field(bool, immediate )
  436. __field(bool, background )
  437. __field(enum rxrpc_propose_ack_outcome, outcome )
  438. ),
  439. TP_fast_assign(
  440. __entry->call = call;
  441. __entry->why = why;
  442. __entry->serial = serial;
  443. __entry->ack_reason = ack_reason;
  444. __entry->immediate = immediate;
  445. __entry->background = background;
  446. __entry->outcome = outcome;
  447. ),
  448. TP_printk("c=%p %s %s r=%08x i=%u b=%u%s",
  449. __entry->call,
  450. rxrpc_propose_ack_traces[__entry->why],
  451. rxrpc_ack_names[__entry->ack_reason],
  452. __entry->serial,
  453. __entry->immediate,
  454. __entry->background,
  455. rxrpc_propose_ack_outcomes[__entry->outcome])
  456. );
  457. TRACE_EVENT(rxrpc_retransmit,
  458. TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
  459. s64 expiry),
  460. TP_ARGS(call, seq, annotation, expiry),
  461. TP_STRUCT__entry(
  462. __field(struct rxrpc_call *, call )
  463. __field(rxrpc_seq_t, seq )
  464. __field(u8, annotation )
  465. __field(s64, expiry )
  466. ),
  467. TP_fast_assign(
  468. __entry->call = call;
  469. __entry->seq = seq;
  470. __entry->annotation = annotation;
  471. __entry->expiry = expiry;
  472. ),
  473. TP_printk("c=%p q=%x a=%02x xp=%lld",
  474. __entry->call,
  475. __entry->seq,
  476. __entry->annotation,
  477. __entry->expiry)
  478. );
  479. TRACE_EVENT(rxrpc_congest,
  480. TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary,
  481. rxrpc_serial_t ack_serial, enum rxrpc_congest_change change),
  482. TP_ARGS(call, summary, ack_serial, change),
  483. TP_STRUCT__entry(
  484. __field(struct rxrpc_call *, call )
  485. __field(enum rxrpc_congest_change, change )
  486. __field(rxrpc_seq_t, hard_ack )
  487. __field(rxrpc_seq_t, top )
  488. __field(rxrpc_seq_t, lowest_nak )
  489. __field(rxrpc_serial_t, ack_serial )
  490. __field_struct(struct rxrpc_ack_summary, sum )
  491. ),
  492. TP_fast_assign(
  493. __entry->call = call;
  494. __entry->change = change;
  495. __entry->hard_ack = call->tx_hard_ack;
  496. __entry->top = call->tx_top;
  497. __entry->lowest_nak = call->acks_lowest_nak;
  498. __entry->ack_serial = ack_serial;
  499. memcpy(&__entry->sum, summary, sizeof(__entry->sum));
  500. ),
  501. TP_printk("c=%p %08x %s %08x %s cw=%u ss=%u nr=%u,%u nw=%u,%u r=%u b=%u u=%u d=%u l=%x%s%s%s",
  502. __entry->call,
  503. __entry->ack_serial,
  504. rxrpc_ack_names[__entry->sum.ack_reason],
  505. __entry->hard_ack,
  506. rxrpc_congest_modes[__entry->sum.mode],
  507. __entry->sum.cwnd,
  508. __entry->sum.ssthresh,
  509. __entry->sum.nr_acks, __entry->sum.nr_nacks,
  510. __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks,
  511. __entry->sum.nr_rot_new_acks,
  512. __entry->top - __entry->hard_ack,
  513. __entry->sum.cumulative_acks,
  514. __entry->sum.dup_acks,
  515. __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "",
  516. rxrpc_congest_changes[__entry->change],
  517. __entry->sum.retrans_timeo ? " rTxTo" : "")
  518. );
  519. #endif /* _TRACE_RXRPC_H */
  520. /* This part must be outside protection */
  521. #include <trace/define_trace.h>