net.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM net
  4. #if !defined(_TRACE_NET_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_NET_H
  6. #include <linux/skbuff.h>
  7. #include <linux/netdevice.h>
  8. #include <linux/if_vlan.h>
  9. #include <linux/ip.h>
  10. #include <linux/tracepoint.h>
  11. TRACE_EVENT(net_dev_start_xmit,
  12. TP_PROTO(const struct sk_buff *skb, const struct net_device *dev),
  13. TP_ARGS(skb, dev),
  14. TP_STRUCT__entry(
  15. __string( name, dev->name )
  16. __field( u16, queue_mapping )
  17. __field( const void *, skbaddr )
  18. __field( bool, vlan_tagged )
  19. __field( u16, vlan_proto )
  20. __field( u16, vlan_tci )
  21. __field( u16, protocol )
  22. __field( u8, ip_summed )
  23. __field( unsigned int, len )
  24. __field( unsigned int, data_len )
  25. __field( int, network_offset )
  26. __field( bool, transport_offset_valid)
  27. __field( int, transport_offset)
  28. __field( u8, tx_flags )
  29. __field( u16, gso_size )
  30. __field( u16, gso_segs )
  31. __field( u16, gso_type )
  32. ),
  33. TP_fast_assign(
  34. __assign_str(name, dev->name);
  35. __entry->queue_mapping = skb->queue_mapping;
  36. __entry->skbaddr = skb;
  37. __entry->vlan_tagged = skb_vlan_tag_present(skb);
  38. __entry->vlan_proto = ntohs(skb->vlan_proto);
  39. __entry->vlan_tci = skb_vlan_tag_get(skb);
  40. __entry->protocol = ntohs(skb->protocol);
  41. __entry->ip_summed = skb->ip_summed;
  42. __entry->len = skb->len;
  43. __entry->data_len = skb->data_len;
  44. __entry->network_offset = skb_network_offset(skb);
  45. __entry->transport_offset_valid =
  46. skb_transport_header_was_set(skb);
  47. __entry->transport_offset = skb_transport_offset(skb);
  48. __entry->tx_flags = skb_shinfo(skb)->tx_flags;
  49. __entry->gso_size = skb_shinfo(skb)->gso_size;
  50. __entry->gso_segs = skb_shinfo(skb)->gso_segs;
  51. __entry->gso_type = skb_shinfo(skb)->gso_type;
  52. ),
  53. TP_printk("dev=%s queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d len=%u data_len=%u network_offset=%d transport_offset_valid=%d transport_offset=%d tx_flags=%d gso_size=%d gso_segs=%d gso_type=%#x",
  54. __get_str(name), __entry->queue_mapping, __entry->skbaddr,
  55. __entry->vlan_tagged, __entry->vlan_proto, __entry->vlan_tci,
  56. __entry->protocol, __entry->ip_summed, __entry->len,
  57. __entry->data_len,
  58. __entry->network_offset, __entry->transport_offset_valid,
  59. __entry->transport_offset, __entry->tx_flags,
  60. __entry->gso_size, __entry->gso_segs, __entry->gso_type)
  61. );
  62. TRACE_EVENT(net_dev_xmit,
  63. TP_PROTO(struct sk_buff *skb,
  64. int rc,
  65. struct net_device *dev,
  66. unsigned int skb_len),
  67. TP_ARGS(skb, rc, dev, skb_len),
  68. TP_STRUCT__entry(
  69. __field( void *, skbaddr )
  70. __field( unsigned int, len )
  71. __field( int, rc )
  72. __string( name, dev->name )
  73. ),
  74. TP_fast_assign(
  75. __entry->skbaddr = skb;
  76. __entry->len = skb_len;
  77. __entry->rc = rc;
  78. __assign_str(name, dev->name);
  79. ),
  80. TP_printk("dev=%s skbaddr=%p len=%u rc=%d",
  81. __get_str(name), __entry->skbaddr, __entry->len, __entry->rc)
  82. );
  83. DECLARE_EVENT_CLASS(net_dev_template,
  84. TP_PROTO(struct sk_buff *skb),
  85. TP_ARGS(skb),
  86. TP_STRUCT__entry(
  87. __field( void *, skbaddr )
  88. __field( unsigned int, len )
  89. __string( name, skb->dev->name )
  90. ),
  91. TP_fast_assign(
  92. __entry->skbaddr = skb;
  93. __entry->len = skb->len;
  94. __assign_str(name, skb->dev->name);
  95. ),
  96. TP_printk("dev=%s skbaddr=%p len=%u",
  97. __get_str(name), __entry->skbaddr, __entry->len)
  98. )
  99. DEFINE_EVENT(net_dev_template, net_dev_queue,
  100. TP_PROTO(struct sk_buff *skb),
  101. TP_ARGS(skb)
  102. );
  103. DEFINE_EVENT(net_dev_template, netif_receive_skb,
  104. TP_PROTO(struct sk_buff *skb),
  105. TP_ARGS(skb)
  106. );
  107. DEFINE_EVENT(net_dev_template, netif_rx,
  108. TP_PROTO(struct sk_buff *skb),
  109. TP_ARGS(skb)
  110. );
  111. DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
  112. TP_PROTO(const struct sk_buff *skb),
  113. TP_ARGS(skb),
  114. TP_STRUCT__entry(
  115. __string( name, skb->dev->name )
  116. __field( unsigned int, napi_id )
  117. __field( u16, queue_mapping )
  118. __field( const void *, skbaddr )
  119. __field( bool, vlan_tagged )
  120. __field( u16, vlan_proto )
  121. __field( u16, vlan_tci )
  122. __field( u16, protocol )
  123. __field( u8, ip_summed )
  124. __field( u32, hash )
  125. __field( bool, l4_hash )
  126. __field( unsigned int, len )
  127. __field( unsigned int, data_len )
  128. __field( unsigned int, truesize )
  129. __field( bool, mac_header_valid)
  130. __field( int, mac_header )
  131. __field( unsigned char, nr_frags )
  132. __field( u16, gso_size )
  133. __field( u16, gso_type )
  134. ),
  135. TP_fast_assign(
  136. __assign_str(name, skb->dev->name);
  137. #ifdef CONFIG_NET_RX_BUSY_POLL
  138. __entry->napi_id = skb->napi_id;
  139. #else
  140. __entry->napi_id = 0;
  141. #endif
  142. __entry->queue_mapping = skb->queue_mapping;
  143. __entry->skbaddr = skb;
  144. __entry->vlan_tagged = skb_vlan_tag_present(skb);
  145. __entry->vlan_proto = ntohs(skb->vlan_proto);
  146. __entry->vlan_tci = skb_vlan_tag_get(skb);
  147. __entry->protocol = ntohs(skb->protocol);
  148. __entry->ip_summed = skb->ip_summed;
  149. __entry->hash = skb->hash;
  150. __entry->l4_hash = skb->l4_hash;
  151. __entry->len = skb->len;
  152. __entry->data_len = skb->data_len;
  153. __entry->truesize = skb->truesize;
  154. __entry->mac_header_valid = skb_mac_header_was_set(skb);
  155. __entry->mac_header = skb_mac_header(skb) - skb->data;
  156. __entry->nr_frags = skb_shinfo(skb)->nr_frags;
  157. __entry->gso_size = skb_shinfo(skb)->gso_size;
  158. __entry->gso_type = skb_shinfo(skb)->gso_type;
  159. ),
  160. TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d hash=0x%08x l4_hash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x",
  161. __get_str(name), __entry->napi_id, __entry->queue_mapping,
  162. __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto,
  163. __entry->vlan_tci, __entry->protocol, __entry->ip_summed,
  164. __entry->hash, __entry->l4_hash, __entry->len,
  165. __entry->data_len, __entry->truesize,
  166. __entry->mac_header_valid, __entry->mac_header,
  167. __entry->nr_frags, __entry->gso_size, __entry->gso_type)
  168. );
  169. DEFINE_EVENT(net_dev_rx_verbose_template, napi_gro_frags_entry,
  170. TP_PROTO(const struct sk_buff *skb),
  171. TP_ARGS(skb)
  172. );
  173. DEFINE_EVENT(net_dev_rx_verbose_template, napi_gro_receive_entry,
  174. TP_PROTO(const struct sk_buff *skb),
  175. TP_ARGS(skb)
  176. );
  177. DEFINE_EVENT(net_dev_rx_verbose_template, netif_receive_skb_entry,
  178. TP_PROTO(const struct sk_buff *skb),
  179. TP_ARGS(skb)
  180. );
  181. DEFINE_EVENT(net_dev_rx_verbose_template, netif_receive_skb_list_entry,
  182. TP_PROTO(const struct sk_buff *skb),
  183. TP_ARGS(skb)
  184. );
  185. DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_entry,
  186. TP_PROTO(const struct sk_buff *skb),
  187. TP_ARGS(skb)
  188. );
  189. DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_ni_entry,
  190. TP_PROTO(const struct sk_buff *skb),
  191. TP_ARGS(skb)
  192. );
  193. #endif /* _TRACE_NET_H */
  194. /* This part must be outside protection */
  195. #include <trace/define_trace.h>