Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM net |
| 4 | |
| 5 | #if !defined(_TRACE_NET_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_NET_H |
| 7 | |
| 8 | #include <linux/skbuff.h> |
| 9 | #include <linux/netdevice.h> |
Ben Hutchings | d87d04a | 2014-01-10 22:17:03 +0000 | [diff] [blame] | 10 | #include <linux/if_vlan.h> |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 11 | #include <linux/ip.h> |
| 12 | #include <linux/tracepoint.h> |
| 13 | |
Ben Hutchings | d87d04a | 2014-01-10 22:17:03 +0000 | [diff] [blame] | 14 | TRACE_EVENT(net_dev_start_xmit, |
| 15 | |
| 16 | TP_PROTO(const struct sk_buff *skb, const struct net_device *dev), |
| 17 | |
| 18 | TP_ARGS(skb, dev), |
| 19 | |
| 20 | TP_STRUCT__entry( |
| 21 | __string( name, dev->name ) |
| 22 | __field( u16, queue_mapping ) |
| 23 | __field( const void *, skbaddr ) |
| 24 | __field( bool, vlan_tagged ) |
| 25 | __field( u16, vlan_proto ) |
| 26 | __field( u16, vlan_tci ) |
| 27 | __field( u16, protocol ) |
| 28 | __field( u8, ip_summed ) |
| 29 | __field( unsigned int, len ) |
| 30 | __field( unsigned int, data_len ) |
| 31 | __field( int, network_offset ) |
| 32 | __field( bool, transport_offset_valid) |
| 33 | __field( int, transport_offset) |
| 34 | __field( u8, tx_flags ) |
| 35 | __field( u16, gso_size ) |
| 36 | __field( u16, gso_segs ) |
| 37 | __field( u16, gso_type ) |
| 38 | ), |
| 39 | |
| 40 | TP_fast_assign( |
| 41 | __assign_str(name, dev->name); |
| 42 | __entry->queue_mapping = skb->queue_mapping; |
| 43 | __entry->skbaddr = skb; |
Jiri Pirko | df8a39d | 2015-01-13 17:13:44 +0100 | [diff] [blame] | 44 | __entry->vlan_tagged = skb_vlan_tag_present(skb); |
Ben Hutchings | d87d04a | 2014-01-10 22:17:03 +0000 | [diff] [blame] | 45 | __entry->vlan_proto = ntohs(skb->vlan_proto); |
Jiri Pirko | df8a39d | 2015-01-13 17:13:44 +0100 | [diff] [blame] | 46 | __entry->vlan_tci = skb_vlan_tag_get(skb); |
Ben Hutchings | d87d04a | 2014-01-10 22:17:03 +0000 | [diff] [blame] | 47 | __entry->protocol = ntohs(skb->protocol); |
| 48 | __entry->ip_summed = skb->ip_summed; |
| 49 | __entry->len = skb->len; |
| 50 | __entry->data_len = skb->data_len; |
| 51 | __entry->network_offset = skb_network_offset(skb); |
| 52 | __entry->transport_offset_valid = |
| 53 | skb_transport_header_was_set(skb); |
| 54 | __entry->transport_offset = skb_transport_offset(skb); |
| 55 | __entry->tx_flags = skb_shinfo(skb)->tx_flags; |
| 56 | __entry->gso_size = skb_shinfo(skb)->gso_size; |
| 57 | __entry->gso_segs = skb_shinfo(skb)->gso_segs; |
| 58 | __entry->gso_type = skb_shinfo(skb)->gso_type; |
| 59 | ), |
| 60 | |
| 61 | 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", |
| 62 | __get_str(name), __entry->queue_mapping, __entry->skbaddr, |
| 63 | __entry->vlan_tagged, __entry->vlan_proto, __entry->vlan_tci, |
| 64 | __entry->protocol, __entry->ip_summed, __entry->len, |
| 65 | __entry->data_len, |
| 66 | __entry->network_offset, __entry->transport_offset_valid, |
| 67 | __entry->transport_offset, __entry->tx_flags, |
| 68 | __entry->gso_size, __entry->gso_segs, __entry->gso_type) |
| 69 | ); |
| 70 | |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 71 | TRACE_EVENT(net_dev_xmit, |
| 72 | |
| 73 | TP_PROTO(struct sk_buff *skb, |
Koki Sanagi | ec764bf | 2011-05-30 21:48:34 +0000 | [diff] [blame] | 74 | int rc, |
| 75 | struct net_device *dev, |
| 76 | unsigned int skb_len), |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 77 | |
Koki Sanagi | ec764bf | 2011-05-30 21:48:34 +0000 | [diff] [blame] | 78 | TP_ARGS(skb, rc, dev, skb_len), |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 79 | |
| 80 | TP_STRUCT__entry( |
| 81 | __field( void *, skbaddr ) |
| 82 | __field( unsigned int, len ) |
| 83 | __field( int, rc ) |
Koki Sanagi | ec764bf | 2011-05-30 21:48:34 +0000 | [diff] [blame] | 84 | __string( name, dev->name ) |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 85 | ), |
| 86 | |
| 87 | TP_fast_assign( |
| 88 | __entry->skbaddr = skb; |
Koki Sanagi | ec764bf | 2011-05-30 21:48:34 +0000 | [diff] [blame] | 89 | __entry->len = skb_len; |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 90 | __entry->rc = rc; |
Koki Sanagi | ec764bf | 2011-05-30 21:48:34 +0000 | [diff] [blame] | 91 | __assign_str(name, dev->name); |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 92 | ), |
| 93 | |
| 94 | TP_printk("dev=%s skbaddr=%p len=%u rc=%d", |
| 95 | __get_str(name), __entry->skbaddr, __entry->len, __entry->rc) |
| 96 | ); |
| 97 | |
| 98 | DECLARE_EVENT_CLASS(net_dev_template, |
| 99 | |
| 100 | TP_PROTO(struct sk_buff *skb), |
| 101 | |
| 102 | TP_ARGS(skb), |
| 103 | |
| 104 | TP_STRUCT__entry( |
| 105 | __field( void *, skbaddr ) |
| 106 | __field( unsigned int, len ) |
| 107 | __string( name, skb->dev->name ) |
| 108 | ), |
| 109 | |
| 110 | TP_fast_assign( |
| 111 | __entry->skbaddr = skb; |
| 112 | __entry->len = skb->len; |
| 113 | __assign_str(name, skb->dev->name); |
| 114 | ), |
| 115 | |
| 116 | TP_printk("dev=%s skbaddr=%p len=%u", |
| 117 | __get_str(name), __entry->skbaddr, __entry->len) |
| 118 | ) |
| 119 | |
| 120 | DEFINE_EVENT(net_dev_template, net_dev_queue, |
| 121 | |
| 122 | TP_PROTO(struct sk_buff *skb), |
| 123 | |
| 124 | TP_ARGS(skb) |
| 125 | ); |
| 126 | |
| 127 | DEFINE_EVENT(net_dev_template, netif_receive_skb, |
| 128 | |
| 129 | TP_PROTO(struct sk_buff *skb), |
| 130 | |
| 131 | TP_ARGS(skb) |
| 132 | ); |
| 133 | |
| 134 | DEFINE_EVENT(net_dev_template, netif_rx, |
| 135 | |
| 136 | TP_PROTO(struct sk_buff *skb), |
| 137 | |
| 138 | TP_ARGS(skb) |
| 139 | ); |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 140 | |
| 141 | DECLARE_EVENT_CLASS(net_dev_rx_verbose_template, |
| 142 | |
| 143 | TP_PROTO(const struct sk_buff *skb), |
| 144 | |
| 145 | TP_ARGS(skb), |
| 146 | |
| 147 | TP_STRUCT__entry( |
| 148 | __string( name, skb->dev->name ) |
| 149 | __field( unsigned int, napi_id ) |
| 150 | __field( u16, queue_mapping ) |
| 151 | __field( const void *, skbaddr ) |
| 152 | __field( bool, vlan_tagged ) |
| 153 | __field( u16, vlan_proto ) |
| 154 | __field( u16, vlan_tci ) |
| 155 | __field( u16, protocol ) |
| 156 | __field( u8, ip_summed ) |
Tom Herbert | 61b905d | 2014-03-24 15:34:47 -0700 | [diff] [blame] | 157 | __field( u32, hash ) |
| 158 | __field( bool, l4_hash ) |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 159 | __field( unsigned int, len ) |
| 160 | __field( unsigned int, data_len ) |
| 161 | __field( unsigned int, truesize ) |
| 162 | __field( bool, mac_header_valid) |
| 163 | __field( int, mac_header ) |
| 164 | __field( unsigned char, nr_frags ) |
| 165 | __field( u16, gso_size ) |
| 166 | __field( u16, gso_type ) |
| 167 | ), |
| 168 | |
| 169 | TP_fast_assign( |
| 170 | __assign_str(name, skb->dev->name); |
| 171 | #ifdef CONFIG_NET_RX_BUSY_POLL |
| 172 | __entry->napi_id = skb->napi_id; |
| 173 | #else |
| 174 | __entry->napi_id = 0; |
| 175 | #endif |
| 176 | __entry->queue_mapping = skb->queue_mapping; |
| 177 | __entry->skbaddr = skb; |
Jiri Pirko | df8a39d | 2015-01-13 17:13:44 +0100 | [diff] [blame] | 178 | __entry->vlan_tagged = skb_vlan_tag_present(skb); |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 179 | __entry->vlan_proto = ntohs(skb->vlan_proto); |
Jiri Pirko | df8a39d | 2015-01-13 17:13:44 +0100 | [diff] [blame] | 180 | __entry->vlan_tci = skb_vlan_tag_get(skb); |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 181 | __entry->protocol = ntohs(skb->protocol); |
| 182 | __entry->ip_summed = skb->ip_summed; |
Tom Herbert | 61b905d | 2014-03-24 15:34:47 -0700 | [diff] [blame] | 183 | __entry->hash = skb->hash; |
| 184 | __entry->l4_hash = skb->l4_hash; |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 185 | __entry->len = skb->len; |
| 186 | __entry->data_len = skb->data_len; |
| 187 | __entry->truesize = skb->truesize; |
| 188 | __entry->mac_header_valid = skb_mac_header_was_set(skb); |
| 189 | __entry->mac_header = skb_mac_header(skb) - skb->data; |
| 190 | __entry->nr_frags = skb_shinfo(skb)->nr_frags; |
| 191 | __entry->gso_size = skb_shinfo(skb)->gso_size; |
| 192 | __entry->gso_type = skb_shinfo(skb)->gso_type; |
| 193 | ), |
| 194 | |
Tom Herbert | 61b905d | 2014-03-24 15:34:47 -0700 | [diff] [blame] | 195 | 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", |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 196 | __get_str(name), __entry->napi_id, __entry->queue_mapping, |
| 197 | __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto, |
| 198 | __entry->vlan_tci, __entry->protocol, __entry->ip_summed, |
Tom Herbert | 61b905d | 2014-03-24 15:34:47 -0700 | [diff] [blame] | 199 | __entry->hash, __entry->l4_hash, __entry->len, |
Ben Hutchings | ae78dbf | 2014-01-10 22:17:24 +0000 | [diff] [blame] | 200 | __entry->data_len, __entry->truesize, |
| 201 | __entry->mac_header_valid, __entry->mac_header, |
| 202 | __entry->nr_frags, __entry->gso_size, __entry->gso_type) |
| 203 | ); |
| 204 | |
| 205 | DEFINE_EVENT(net_dev_rx_verbose_template, napi_gro_frags_entry, |
| 206 | |
| 207 | TP_PROTO(const struct sk_buff *skb), |
| 208 | |
| 209 | TP_ARGS(skb) |
| 210 | ); |
| 211 | |
| 212 | DEFINE_EVENT(net_dev_rx_verbose_template, napi_gro_receive_entry, |
| 213 | |
| 214 | TP_PROTO(const struct sk_buff *skb), |
| 215 | |
| 216 | TP_ARGS(skb) |
| 217 | ); |
| 218 | |
| 219 | DEFINE_EVENT(net_dev_rx_verbose_template, netif_receive_skb_entry, |
| 220 | |
| 221 | TP_PROTO(const struct sk_buff *skb), |
| 222 | |
| 223 | TP_ARGS(skb) |
| 224 | ); |
| 225 | |
| 226 | DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_entry, |
| 227 | |
| 228 | TP_PROTO(const struct sk_buff *skb), |
| 229 | |
| 230 | TP_ARGS(skb) |
| 231 | ); |
| 232 | |
| 233 | DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_ni_entry, |
| 234 | |
| 235 | TP_PROTO(const struct sk_buff *skb), |
| 236 | |
| 237 | TP_ARGS(skb) |
| 238 | ); |
| 239 | |
Koki Sanagi | cf66ba5 | 2010-08-23 18:45:02 +0900 | [diff] [blame] | 240 | #endif /* _TRACE_NET_H */ |
| 241 | |
| 242 | /* This part must be outside protection */ |
| 243 | #include <trace/define_trace.h> |