rmnet_trace.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  3. */
  4. #include <linux/version.h>
  5. #undef TRACE_SYSTEM
  6. #define TRACE_SYSTEM rmnet
  7. #undef TRACE_INCLUDE_PATH
  8. #if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)
  9. #ifdef CONFIG_ARCH_SDXNIGHTJAR
  10. #define TRACE_INCLUDE_PATH ../../../../../../../datarmnet/core
  11. #else
  12. #define TRACE_INCLUDE_PATH ../../../../../../../src/datarmnet/core
  13. #endif /* endif LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0) */
  14. #else
  15. #define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/datarmnet/core
  16. #endif
  17. #define TRACE_INCLUDE_FILE rmnet_trace
  18. #if !defined(_TRACE_RMNET_H) || defined(TRACE_HEADER_MULTI_READ)
  19. #define _TRACE_RMNET_H
  20. #include <linux/skbuff.h>
  21. #include <linux/tracepoint.h>
  22. /*****************************************************************************/
  23. /* Trace events for rmnet module */
  24. /*****************************************************************************/
  25. TRACE_EVENT(rmnet_xmit_skb,
  26. TP_PROTO(struct sk_buff *skb),
  27. TP_ARGS(skb),
  28. TP_STRUCT__entry(
  29. __string(dev_name, skb->dev->name)
  30. __field(unsigned int, len)
  31. ),
  32. TP_fast_assign(
  33. __assign_str(dev_name, skb->dev->name);
  34. __entry->len = skb->len;
  35. ),
  36. TP_printk("dev_name=%s len=%u", __get_str(dev_name), __entry->len)
  37. );
  38. DECLARE_EVENT_CLASS
  39. (rmnet_mod_template,
  40. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  41. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  42. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2),
  43. TP_STRUCT__entry(__field(u8, func)
  44. __field(u8, evt)
  45. __field(u32, uint1)
  46. __field(u32, uint2)
  47. __field(u64, ulong1)
  48. __field(u64, ulong2)
  49. __field(void *, ptr1)
  50. __field(void *, ptr2)
  51. ),
  52. TP_fast_assign(__entry->func = func;
  53. __entry->evt = evt;
  54. __entry->uint1 = uint1;
  55. __entry->uint2 = uint2;
  56. __entry->ulong1 = ulong1;
  57. __entry->ulong2 = ulong2;
  58. __entry->ptr1 = ptr1;
  59. __entry->ptr2 = ptr2;
  60. ),
  61. TP_printk("fun:%u ev:%u u1:%u u2:%u ul1:%llu ul2:%llu p1:0x%pK p2:0x%pK",
  62. __entry->func, __entry->evt,
  63. __entry->uint1, __entry->uint2,
  64. __entry->ulong1, __entry->ulong2,
  65. __entry->ptr1, __entry->ptr2)
  66. )
  67. DEFINE_EVENT
  68. (rmnet_mod_template, rmnet_low,
  69. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  70. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  71. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  72. );
  73. DEFINE_EVENT
  74. (rmnet_mod_template, rmnet_high,
  75. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  76. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  77. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  78. );
  79. DEFINE_EVENT
  80. (rmnet_mod_template, rmnet_err,
  81. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  82. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  83. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  84. );
  85. TRACE_EVENT(print_skb_gso,
  86. TP_PROTO(struct sk_buff *skb, __be16 src, __be16 dest,
  87. u16 ip_proto, u16 xport_proto, const char *saddr, const char *daddr),
  88. TP_ARGS(skb, src, dest, ip_proto, xport_proto, saddr, daddr),
  89. TP_STRUCT__entry(
  90. __field(void *, skbaddr)
  91. __field(int, len)
  92. __field(int, data_len)
  93. __field(__be16, src)
  94. __field(__be16, dest)
  95. __field(u16, ip_proto)
  96. __field(u16, xport_proto)
  97. __string(saddr, saddr)
  98. __string(daddr, daddr)
  99. ),
  100. TP_fast_assign(
  101. __entry->skbaddr = skb;
  102. __entry->len = skb->len;
  103. __entry->data_len = skb->data_len;
  104. __entry->src = src;
  105. __entry->dest = dest;
  106. __entry->ip_proto = ip_proto;
  107. __entry->xport_proto = xport_proto;
  108. __assign_str(saddr, saddr);
  109. __assign_str(daddr, daddr);
  110. ),
  111. TP_printk("GSO: skbaddr=%pK, len=%d, data_len=%d, [%s][%s] src=%s %u dest=%s %u",
  112. __entry->skbaddr, __entry->len, __entry->data_len,
  113. __entry->ip_proto == htons(ETH_P_IP) ? "IPv4" : "IPv6",
  114. __entry->xport_proto == IPPROTO_TCP ? "TCP" : "UDP",
  115. __get_str(saddr), be16_to_cpu(__entry->src),
  116. __get_str(daddr), be16_to_cpu(__entry->dest))
  117. );
  118. /*****************************************************************************/
  119. /* Trace events for rmnet_perf module */
  120. /*****************************************************************************/
  121. DEFINE_EVENT
  122. (rmnet_mod_template, rmnet_perf_low,
  123. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  124. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  125. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  126. );
  127. DEFINE_EVENT
  128. (rmnet_mod_template, rmnet_perf_high,
  129. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  130. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  131. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  132. );
  133. DEFINE_EVENT
  134. (rmnet_mod_template, rmnet_perf_err,
  135. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  136. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  137. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  138. );
  139. /*****************************************************************************/
  140. /* Trace events for rmnet_shs module */
  141. /*****************************************************************************/
  142. DEFINE_EVENT
  143. (rmnet_mod_template, rmnet_shs_low,
  144. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  145. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  146. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  147. );
  148. DEFINE_EVENT
  149. (rmnet_mod_template, rmnet_shs_high,
  150. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  151. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  152. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  153. );
  154. DEFINE_EVENT
  155. (rmnet_mod_template, rmnet_shs_err,
  156. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  157. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  158. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  159. );
  160. DEFINE_EVENT
  161. (rmnet_mod_template, rmnet_shs_wq_low,
  162. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  163. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  164. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  165. );
  166. DEFINE_EVENT
  167. (rmnet_mod_template, rmnet_shs_wq_high,
  168. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  169. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  170. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  171. );
  172. DEFINE_EVENT
  173. (rmnet_mod_template, rmnet_shs_wq_err,
  174. TP_PROTO(u8 func, u8 evt, u32 uint1, u32 uint2,
  175. u64 ulong1, u64 ulong2, void *ptr1, void *ptr2),
  176. TP_ARGS(func, evt, uint1, uint2, ulong1, ulong2, ptr1, ptr2)
  177. );
  178. DECLARE_EVENT_CLASS
  179. (rmnet_freq_template,
  180. TP_PROTO(u8 core, u32 newfreq),
  181. TP_ARGS(core, newfreq),
  182. TP_STRUCT__entry(__field(u8, core)
  183. __field(u32, newfreq)
  184. ),
  185. TP_fast_assign(__entry->core = core;
  186. __entry->newfreq = newfreq;
  187. ),
  188. TP_printk("freq policy core:%u freq floor :%u",
  189. __entry->core, __entry->newfreq)
  190. );
  191. DEFINE_EVENT
  192. (rmnet_freq_template, rmnet_freq_boost,
  193. TP_PROTO(u8 core, u32 newfreq),
  194. TP_ARGS(core, newfreq)
  195. );
  196. DEFINE_EVENT
  197. (rmnet_freq_template, rmnet_freq_reset,
  198. TP_PROTO(u8 core, u32 newfreq),
  199. TP_ARGS(core, newfreq)
  200. );
  201. TRACE_EVENT
  202. (rmnet_freq_update,
  203. TP_PROTO(u8 core, u32 lowfreq, u32 highfreq),
  204. TP_ARGS(core, lowfreq, highfreq),
  205. TP_STRUCT__entry(__field(u8, core)
  206. __field(u32, lowfreq)
  207. __field(u32, highfreq)
  208. ),
  209. TP_fast_assign(__entry->core = core;
  210. __entry->lowfreq = lowfreq;
  211. __entry->highfreq = highfreq;
  212. ),
  213. TP_printk("freq policy update core:%u policy freq floor :%u freq ceil :%u",
  214. __entry->core, __entry->lowfreq, __entry->highfreq)
  215. );
  216. #endif /* _TRACE_RMNET_H */
  217. #include <trace/define_trace.h>