trace.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM dccp
  4. #if !defined(_TRACE_DCCP_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_DCCP_H
  6. #include <net/sock.h>
  7. #include "dccp.h"
  8. #include "ccids/ccid3.h"
  9. #include <linux/tracepoint.h>
  10. #include <trace/events/net_probe_common.h>
  11. TRACE_EVENT(dccp_probe,
  12. TP_PROTO(struct sock *sk, size_t size),
  13. TP_ARGS(sk, size),
  14. TP_STRUCT__entry(
  15. /* sockaddr_in6 is always bigger than sockaddr_in */
  16. __array(__u8, saddr, sizeof(struct sockaddr_in6))
  17. __array(__u8, daddr, sizeof(struct sockaddr_in6))
  18. __field(__u16, sport)
  19. __field(__u16, dport)
  20. __field(__u16, size)
  21. __field(__u16, tx_s)
  22. __field(__u32, tx_rtt)
  23. __field(__u32, tx_p)
  24. __field(__u32, tx_x_calc)
  25. __field(__u64, tx_x_recv)
  26. __field(__u64, tx_x)
  27. __field(__u32, tx_t_ipi)
  28. ),
  29. TP_fast_assign(
  30. const struct inet_sock *inet = inet_sk(sk);
  31. struct ccid3_hc_tx_sock *hc = NULL;
  32. if (ccid_get_current_tx_ccid(dccp_sk(sk)) == DCCPC_CCID3)
  33. hc = ccid3_hc_tx_sk(sk);
  34. memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
  35. memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
  36. TP_STORE_ADDR_PORTS(__entry, inet, sk);
  37. /* For filtering use */
  38. __entry->sport = ntohs(inet->inet_sport);
  39. __entry->dport = ntohs(inet->inet_dport);
  40. __entry->size = size;
  41. if (hc) {
  42. __entry->tx_s = hc->tx_s;
  43. __entry->tx_rtt = hc->tx_rtt;
  44. __entry->tx_p = hc->tx_p;
  45. __entry->tx_x_calc = hc->tx_x_calc;
  46. __entry->tx_x_recv = hc->tx_x_recv >> 6;
  47. __entry->tx_x = hc->tx_x >> 6;
  48. __entry->tx_t_ipi = hc->tx_t_ipi;
  49. } else {
  50. __entry->tx_s = 0;
  51. memset(&__entry->tx_rtt, 0, (void *)&__entry->tx_t_ipi -
  52. (void *)&__entry->tx_rtt +
  53. sizeof(__entry->tx_t_ipi));
  54. }
  55. ),
  56. TP_printk("src=%pISpc dest=%pISpc size=%d tx_s=%d tx_rtt=%d "
  57. "tx_p=%d tx_x_calc=%u tx_x_recv=%llu tx_x=%llu tx_t_ipi=%d",
  58. __entry->saddr, __entry->daddr, __entry->size,
  59. __entry->tx_s, __entry->tx_rtt, __entry->tx_p,
  60. __entry->tx_x_calc, __entry->tx_x_recv, __entry->tx_x,
  61. __entry->tx_t_ipi)
  62. );
  63. #endif /* _TRACE_TCP_H */
  64. /* This part must be outside protection */
  65. #undef TRACE_INCLUDE_PATH
  66. #define TRACE_INCLUDE_PATH .
  67. #undef TRACE_INCLUDE_FILE
  68. #define TRACE_INCLUDE_FILE trace
  69. #include <trace/define_trace.h>