Commit | Line | Data |
---|---|---|
9f36eaed | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
b283666f PW |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM net | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_NET_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_NET_H | |
b283666f | 7 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
b283666f PW |
9 | #include <linux/skbuff.h> |
10 | #include <linux/netdevice.h> | |
11 | #include <linux/ip.h> | |
e5990fd4 GB |
12 | #include <linux/ipv6.h> |
13 | #include <linux/tcp.h> | |
2d042821 | 14 | #include <lttng-kernel-version.h> |
e5990fd4 GB |
15 | #include <lttng-endian.h> |
16 | #include <net/sock.h> | |
17 | ||
18 | #ifndef ONCE_LTTNG_NET_H | |
19 | #define ONCE_LTTNG_NET_H | |
20 | ||
21 | static inline unsigned char __has_network_hdr(struct sk_buff *skb) | |
22 | { | |
23 | /* | |
aa900596 MD |
24 | * If the header is not set yet, the network header will point |
25 | * to the head. | |
e5990fd4 GB |
26 | */ |
27 | return skb_network_header(skb) != skb->head; | |
28 | } | |
29 | ||
30 | static struct lttng_event_field emptyfields[] = { | |
31 | }; | |
32 | ||
9cf9736a GB |
33 | /* Structures for transport headers. */ |
34 | ||
35 | static struct lttng_event_field tcpfields[] = { | |
36 | [0] = { | |
37 | .name = "source_port", | |
aa900596 | 38 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 39 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
40 | }, |
41 | [1] = { | |
42 | .name = "dest_port", | |
aa900596 | 43 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 44 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
45 | }, |
46 | [2] = { | |
47 | .name = "seq", | |
aa900596 | 48 | .type = __type_integer(uint32_t, 0, 0, 0, |
79282ffd | 49 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
50 | }, |
51 | [3] = { | |
52 | .name = "ack_seq", | |
aa900596 | 53 | .type = __type_integer(uint32_t, 0, 0, 0, |
79282ffd | 54 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
55 | }, |
56 | [4] = { | |
57 | .name = "data_offset", | |
aa900596 | 58 | .type = __type_integer(uint8_t, 4, 4, 0, |
79282ffd | 59 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
60 | }, |
61 | [5] = { | |
62 | .name = "reserved", | |
aa900596 | 63 | .type = __type_integer(uint8_t, 3, 1, 0, |
79282ffd | 64 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
65 | }, |
66 | [6] = { | |
67 | .name = "flags", | |
aa900596 | 68 | .type = __type_integer(uint8_t, 9, 1, 0, |
79282ffd | 69 | __BIG_ENDIAN, 0, 16, none), |
9cf9736a GB |
70 | }, |
71 | [7] = { | |
72 | .name = "window_size", | |
aa900596 | 73 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 74 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
75 | }, |
76 | [8] = { | |
77 | .name = "checksum", | |
aa900596 | 78 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 79 | __BIG_ENDIAN, 0, 16, none), |
9cf9736a GB |
80 | }, |
81 | [9] = { | |
82 | .name = "urg_ptr", | |
aa900596 | 83 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 84 | __BIG_ENDIAN, 0, 10, none), |
9cf9736a GB |
85 | }, |
86 | }; | |
87 | ||
88 | static struct lttng_event_field transport_fields[] = { | |
89 | [0] = { | |
90 | .name = "unknown", | |
91 | .type = { | |
92 | .atype = atype_struct, | |
93 | .u._struct.nr_fields = ARRAY_SIZE(emptyfields), | |
94 | .u._struct.fields = emptyfields, | |
95 | }, | |
96 | }, | |
97 | [1] = { | |
98 | .name = "tcp", | |
99 | .type = { | |
100 | .atype = atype_struct, | |
101 | .u._struct.nr_fields = ARRAY_SIZE(tcpfields), | |
102 | .u._struct.fields = tcpfields, | |
103 | }, | |
104 | }, | |
105 | }; | |
106 | ||
107 | enum transport_header_types { | |
0910ab71 MD |
108 | TH_NONE = 0, |
109 | TH_TCP = 1, | |
9cf9736a GB |
110 | }; |
111 | ||
0910ab71 | 112 | static inline enum transport_header_types __get_transport_header_type(struct sk_buff *skb) |
9cf9736a GB |
113 | { |
114 | if (__has_network_hdr(skb)) { | |
115 | /* | |
aa900596 MD |
116 | * When both transport and network headers are set, |
117 | * transport header is greater than network header, | |
118 | * otherwise it points to head. | |
9cf9736a GB |
119 | */ |
120 | if (skb->transport_header > skb->network_header) { | |
121 | /* | |
aa900596 MD |
122 | * Get the transport protocol from the network |
123 | * header's data. This method works both for | |
124 | * sent and received packets. | |
9cf9736a GB |
125 | */ |
126 | if ((skb->protocol == htons(ETH_P_IP) && | |
127 | ip_hdr(skb)->protocol == IPPROTO_TCP) || | |
128 | (skb->protocol == htons(ETH_P_IPV6) && | |
129 | ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)) | |
130 | return TH_TCP; | |
131 | } | |
132 | /* Fallthrough for other cases where header is not TCP. */ | |
133 | } | |
134 | return TH_NONE; | |
135 | } | |
136 | ||
7299e758 MD |
137 | static struct lttng_enum_entry proto_transport_enum_entries[] = { |
138 | [0] = { | |
139 | .start = { .value = 0, .signedness = 0, }, | |
140 | .end = { .value = IPPROTO_TCP - 1, .signedness = 0, }, | |
141 | .string = "_unknown", | |
142 | }, | |
143 | [1] = { | |
144 | .start = { .value = IPPROTO_TCP, .signedness = 0, }, | |
145 | .end = { .value = IPPROTO_TCP, .signedness = 0, }, | |
146 | .string = "_tcp", | |
147 | }, | |
148 | [2] = { | |
149 | .start = { .value = IPPROTO_TCP + 1, .signedness = 0, }, | |
150 | .end = { .value = 255, .signedness = 0, }, | |
151 | .string = "_unknown", | |
152 | }, | |
153 | }; | |
154 | ||
155 | static const struct lttng_enum_desc proto_transport_header_type = { | |
156 | .name = "proto_transport_header_type", | |
157 | .entries = proto_transport_enum_entries, | |
158 | .nr_entries = ARRAY_SIZE(proto_transport_enum_entries), | |
159 | }; | |
160 | ||
9cf9736a GB |
161 | static struct lttng_enum_entry transport_enum_entries[] = { |
162 | [0] = { | |
0910ab71 MD |
163 | .start = { .value = TH_NONE, .signedness = 0, }, |
164 | .end = { .value = TH_NONE, .signedness = 0, }, | |
9cf9736a GB |
165 | .string = "_unknown", |
166 | }, | |
167 | [1] = { | |
0910ab71 MD |
168 | .start = { .value = TH_TCP, .signedness = 0, }, |
169 | .end = { .value = TH_TCP, .signedness = 0, }, | |
9cf9736a GB |
170 | .string = "_tcp", |
171 | }, | |
9cf9736a GB |
172 | }; |
173 | ||
174 | static const struct lttng_enum_desc transport_header_type = { | |
175 | .name = "transport_header_type", | |
176 | .entries = transport_enum_entries, | |
177 | .nr_entries = ARRAY_SIZE(transport_enum_entries), | |
178 | }; | |
179 | ||
e5990fd4 GB |
180 | /* Structures for network headers. */ |
181 | ||
182 | static struct lttng_event_field ipv4fields[] = { | |
183 | [0] = { | |
184 | .name = "version", | |
aa900596 | 185 | .type = __type_integer(uint8_t, 4, 4, 0, |
79282ffd | 186 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
187 | }, |
188 | [1] = { | |
189 | .name = "ihl", | |
aa900596 | 190 | .type = __type_integer(uint8_t, 4, 4, 0, |
79282ffd | 191 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
192 | }, |
193 | [2] = { | |
194 | .name = "tos", | |
aa900596 | 195 | .type = __type_integer(uint8_t, 0, 0, 0, |
79282ffd | 196 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
197 | }, |
198 | [3] = { | |
199 | .name = "tot_len", | |
aa900596 | 200 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 201 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
202 | }, |
203 | [4] = { | |
204 | .name = "id", | |
aa900596 | 205 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 206 | __BIG_ENDIAN, 0, 16, none), |
e5990fd4 GB |
207 | }, |
208 | [5] = { | |
209 | .name = "frag_off", | |
aa900596 | 210 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 211 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
212 | }, |
213 | [6] = { | |
214 | .name = "ttl", | |
aa900596 | 215 | .type = __type_integer(uint8_t, 0, 0, 0, |
79282ffd | 216 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
217 | }, |
218 | [7] = { | |
219 | .name = "protocol", | |
9cf9736a GB |
220 | .type = { |
221 | .atype = atype_enum, | |
7299e758 MD |
222 | .u.basic.enumeration.desc = |
223 | &proto_transport_header_type, | |
9cf9736a GB |
224 | .u.basic.enumeration.container_type = { |
225 | .size = 8, | |
226 | .alignment = 8, | |
227 | .signedness = 0, | |
aa900596 MD |
228 | .reverse_byte_order = |
229 | __BIG_ENDIAN != __BYTE_ORDER, | |
9cf9736a | 230 | .base = 10, |
79282ffd | 231 | .user = 0, |
9cf9736a GB |
232 | .encoding = lttng_encode_none, |
233 | }, | |
234 | }, | |
e5990fd4 GB |
235 | }, |
236 | [8] = { | |
237 | .name = "checksum", | |
aa900596 | 238 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 239 | __BIG_ENDIAN, 0, 16, none), |
e5990fd4 GB |
240 | }, |
241 | [9] = { | |
242 | .name = "saddr", | |
243 | .type = { | |
244 | .atype = atype_array, | |
aa900596 MD |
245 | .u.array.elem_type = |
246 | __type_integer(uint8_t, 0, 0, 0, | |
79282ffd | 247 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
248 | .u.array.length = 4, |
249 | .u.array.elem_alignment = lttng_alignof(uint8_t), | |
250 | }, | |
251 | }, | |
252 | [10] = { | |
253 | .name = "daddr", | |
254 | .type = { | |
255 | .atype = atype_array, | |
aa900596 MD |
256 | .u.array.elem_type = |
257 | __type_integer(uint8_t, 0, 0, 0, | |
79282ffd | 258 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
259 | .u.array.length = 4, |
260 | .u.array.elem_alignment = lttng_alignof(uint8_t), | |
261 | }, | |
262 | }, | |
9cf9736a | 263 | [11] = { |
0910ab71 MD |
264 | .name = "transport_header_type", |
265 | .type = { | |
266 | .atype = atype_enum, | |
267 | .u.basic.enumeration.desc = &transport_header_type, | |
268 | .u.basic.enumeration.container_type = { | |
269 | .size = 8, | |
270 | .alignment = 8, | |
271 | .signedness = 0, | |
272 | .reverse_byte_order = 0, | |
273 | .base = 10, | |
79282ffd | 274 | .user = 0, |
0910ab71 MD |
275 | .encoding = lttng_encode_none, |
276 | }, | |
277 | }, | |
278 | }, | |
279 | [12] = { | |
9cf9736a GB |
280 | .name = "transport_header", |
281 | .type = { | |
282 | .atype = atype_variant, | |
0910ab71 | 283 | .u.variant.tag_name = "transport_header_type", |
9cf9736a GB |
284 | .u.variant.choices = transport_fields, |
285 | .u.variant.nr_choices = ARRAY_SIZE(transport_fields), | |
286 | }, | |
287 | }, | |
e5990fd4 GB |
288 | }; |
289 | ||
290 | static struct lttng_event_field ipv6fields[] = { | |
291 | [0] = { | |
292 | .name = "version", | |
aa900596 | 293 | .type = __type_integer(uint8_t, 4, 4, 0, |
79282ffd | 294 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
295 | }, |
296 | [1] = { | |
297 | .name = "prio", | |
aa900596 | 298 | .type = __type_integer(uint8_t, 4, 4, 0, |
79282ffd | 299 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
300 | }, |
301 | [2] = { | |
302 | .name = "flow_lbl", | |
303 | .type = { | |
304 | .atype = atype_array, | |
aa900596 MD |
305 | .u.array.elem_type = |
306 | __type_integer(uint8_t, 0, 0, 0, | |
79282ffd | 307 | __BIG_ENDIAN, 0, 16, none), |
e5990fd4 GB |
308 | .u.array.length = 3, |
309 | .u.array.elem_alignment = lttng_alignof(uint8_t), | |
310 | }, | |
311 | }, | |
312 | [3] = { | |
313 | .name = "payload_len", | |
aa900596 | 314 | .type = __type_integer(uint16_t, 0, 0, 0, |
79282ffd | 315 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
316 | }, |
317 | [4] = { | |
318 | .name = "nexthdr", | |
9cf9736a GB |
319 | .type = { |
320 | .atype = atype_enum, | |
7299e758 MD |
321 | .u.basic.enumeration.desc = |
322 | &proto_transport_header_type, | |
9cf9736a GB |
323 | .u.basic.enumeration.container_type = { |
324 | .size = 8, | |
325 | .alignment = 8, | |
326 | .signedness = 0, | |
aa900596 MD |
327 | .reverse_byte_order = |
328 | __BIG_ENDIAN != __BYTE_ORDER, | |
9cf9736a | 329 | .base = 10, |
79282ffd | 330 | .user = 0, |
9cf9736a GB |
331 | .encoding = lttng_encode_none, |
332 | }, | |
333 | }, | |
e5990fd4 GB |
334 | }, |
335 | [5] = { | |
336 | .name = "hop_limit", | |
aa900596 | 337 | .type = __type_integer(uint8_t, 0, 0, 0, |
79282ffd | 338 | __BIG_ENDIAN, 0, 10, none), |
e5990fd4 GB |
339 | }, |
340 | [6] = { | |
341 | .name = "saddr", | |
342 | .type = { | |
343 | .atype = atype_array, | |
aa900596 MD |
344 | .u.array.elem_type = |
345 | __type_integer(uint16_t, 0, 0, 0, | |
79282ffd | 346 | __BIG_ENDIAN, 0, 16, none), |
e5990fd4 GB |
347 | .u.array.length = 8, |
348 | .u.array.elem_alignment = lttng_alignof(uint16_t), | |
349 | }, | |
350 | }, | |
351 | [7] = { | |
352 | .name = "daddr", | |
353 | .type = { | |
354 | .atype = atype_array, | |
aa900596 MD |
355 | .u.array.elem_type = |
356 | __type_integer(uint16_t, 0, 0, 0, | |
79282ffd | 357 | __BIG_ENDIAN, 0, 16, none), |
e5990fd4 GB |
358 | .u.array.length = 8, |
359 | .u.array.elem_alignment = lttng_alignof(uint16_t), | |
360 | }, | |
361 | }, | |
9cf9736a | 362 | [8] = { |
0910ab71 MD |
363 | .name = "transport_header_type", |
364 | .type = { | |
365 | .atype = atype_enum, | |
366 | .u.basic.enumeration.desc = &transport_header_type, | |
367 | .u.basic.enumeration.container_type = { | |
368 | .size = 8, | |
369 | .alignment = 8, | |
370 | .signedness = 0, | |
371 | .reverse_byte_order = 0, | |
372 | .base = 10, | |
79282ffd | 373 | .user = 0, |
0910ab71 MD |
374 | .encoding = lttng_encode_none, |
375 | }, | |
376 | }, | |
377 | }, | |
378 | [9] = { | |
9cf9736a GB |
379 | .name = "transport_header", |
380 | .type = { | |
381 | .atype = atype_variant, | |
0910ab71 | 382 | .u.variant.tag_name = "transport_header_type", |
9cf9736a GB |
383 | .u.variant.choices = transport_fields, |
384 | .u.variant.nr_choices = ARRAY_SIZE(transport_fields), | |
385 | }, | |
386 | }, | |
e5990fd4 GB |
387 | }; |
388 | ||
389 | static struct lttng_event_field network_fields[] = { | |
390 | [0] = { | |
391 | .name = "unknown", | |
392 | .type = { | |
393 | .atype = atype_struct, | |
394 | .u._struct.nr_fields = 0, | |
395 | .u._struct.fields = emptyfields, | |
396 | }, | |
397 | }, | |
398 | [1] = { | |
399 | .name = "ipv4", | |
400 | .type = { | |
401 | .atype = atype_struct, | |
402 | .u._struct.nr_fields = ARRAY_SIZE(ipv4fields), | |
403 | .u._struct.fields = ipv4fields, | |
404 | }, | |
405 | }, | |
406 | [2] = { | |
407 | .name = "ipv6", | |
408 | .type = { | |
409 | .atype = atype_struct, | |
410 | .u._struct.nr_fields = ARRAY_SIZE(ipv6fields), | |
411 | .u._struct.fields = ipv6fields, | |
412 | }, | |
413 | }, | |
414 | }; | |
415 | ||
416 | enum network_header_types { | |
417 | NH_NONE, | |
418 | NH_IPV4, | |
419 | NH_IPV6, | |
420 | }; | |
421 | ||
422 | static inline unsigned char __get_network_header_type(struct sk_buff *skb) | |
423 | { | |
424 | if (__has_network_hdr(skb)) { | |
425 | if (skb->protocol == htons(ETH_P_IPV6)) | |
426 | return NH_IPV6; | |
427 | else if (skb->protocol == htons(ETH_P_IP)) | |
428 | return NH_IPV4; | |
429 | /* Fallthrough for other header types. */ | |
430 | } | |
431 | return NH_NONE; | |
432 | } | |
433 | ||
434 | #endif | |
435 | ||
436 | LTTNG_TRACEPOINT_ENUM(net_network_header, | |
437 | TP_ENUM_VALUES( | |
438 | ctf_enum_value("_unknown", NH_NONE) | |
439 | ctf_enum_value("_ipv4", NH_IPV4) | |
440 | ctf_enum_value("_ipv6", NH_IPV6) | |
441 | ) | |
442 | ) | |
b283666f | 443 | |
3bc29f0a | 444 | LTTNG_TRACEPOINT_EVENT(net_dev_xmit, |
b283666f PW |
445 | |
446 | TP_PROTO(struct sk_buff *skb, | |
447 | int rc, | |
448 | struct net_device *dev, | |
449 | unsigned int skb_len), | |
450 | ||
451 | TP_ARGS(skb, rc, dev, skb_len), | |
452 | ||
f127e61e | 453 | TP_FIELDS( |
fa91fcac | 454 | ctf_integer_hex(void *, skbaddr, skb) |
f127e61e | 455 | ctf_integer(int, rc, rc) |
974c0969 | 456 | ctf_integer(unsigned int, len, skb_len) |
f127e61e | 457 | ctf_string(name, dev->name) |
f127e61e | 458 | ) |
b283666f PW |
459 | ) |
460 | ||
3bc29f0a | 461 | LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_template, |
b283666f PW |
462 | |
463 | TP_PROTO(struct sk_buff *skb), | |
464 | ||
465 | TP_ARGS(skb), | |
466 | ||
f127e61e | 467 | TP_FIELDS( |
fa91fcac | 468 | ctf_integer_hex(void *, skbaddr, skb) |
f127e61e MD |
469 | ctf_integer(unsigned int, len, skb->len) |
470 | ctf_string(name, skb->dev->name) | |
e5990fd4 GB |
471 | ctf_enum(net_network_header, unsigned char, |
472 | network_header_type, __get_network_header_type(skb)) | |
473 | ctf_custom_field( | |
474 | ctf_custom_type( | |
475 | .atype = atype_variant, | |
476 | .u.variant.tag_name = "network_header_type", | |
477 | .u.variant.choices = network_fields, | |
aa900596 MD |
478 | .u.variant.nr_choices = |
479 | ARRAY_SIZE(network_fields), | |
e5990fd4 GB |
480 | ), |
481 | network_header, | |
482 | ctf_custom_code( | |
0910ab71 MD |
483 | bool has_network_header = false; |
484 | ||
aa900596 | 485 | /* Copy the network header. */ |
e5990fd4 GB |
486 | switch (__get_network_header_type(skb)) { |
487 | case NH_IPV4: { | |
488 | ctf_align(uint16_t) | |
489 | ctf_array_type(uint8_t, ip_hdr(skb), | |
490 | sizeof(struct iphdr)) | |
0910ab71 | 491 | has_network_header = true; |
e5990fd4 GB |
492 | break; |
493 | } | |
494 | case NH_IPV6: { | |
495 | ctf_align(uint16_t) | |
496 | ctf_array_type(uint8_t, ipv6_hdr(skb), | |
497 | sizeof(struct ipv6hdr)) | |
0910ab71 | 498 | has_network_header = true; |
e5990fd4 GB |
499 | break; |
500 | } | |
501 | default: | |
aa900596 MD |
502 | /* |
503 | * For any other network header | |
504 | * type, there is nothing to do. | |
505 | */ | |
e5990fd4 GB |
506 | break; |
507 | } | |
9cf9736a | 508 | |
0910ab71 MD |
509 | if (has_network_header) { |
510 | enum transport_header_types th_type = | |
511 | __get_transport_header_type(skb); | |
512 | ||
513 | /* Transport header type field. */ | |
514 | ctf_integer_type(unsigned char, th_type) | |
515 | ||
516 | /* Copy the transport header. */ | |
517 | if (th_type == TH_TCP) { | |
518 | ctf_align(uint32_t) | |
519 | ctf_array_type(uint8_t, tcp_hdr(skb), | |
520 | sizeof(struct tcphdr)) | |
521 | } | |
522 | /* | |
523 | * For any other transport header type, | |
524 | * there is nothing to do. | |
525 | */ | |
9cf9736a | 526 | } |
e5990fd4 GB |
527 | ) |
528 | ) | |
f127e61e | 529 | ) |
b283666f PW |
530 | ) |
531 | ||
3bc29f0a | 532 | LTTNG_TRACEPOINT_EVENT_INSTANCE(net_dev_template, net_dev_queue, |
b283666f PW |
533 | |
534 | TP_PROTO(struct sk_buff *skb), | |
535 | ||
536 | TP_ARGS(skb) | |
537 | ) | |
538 | ||
b7f5408a MD |
539 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_template, |
540 | ||
541 | netif_receive_skb, | |
542 | ||
543 | net_if_receive_skb, | |
b283666f PW |
544 | |
545 | TP_PROTO(struct sk_buff *skb), | |
546 | ||
547 | TP_ARGS(skb) | |
548 | ) | |
549 | ||
b7f5408a MD |
550 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_template, |
551 | ||
552 | netif_rx, | |
553 | ||
554 | net_if_rx, | |
b283666f PW |
555 | |
556 | TP_PROTO(struct sk_buff *skb), | |
557 | ||
558 | TP_ARGS(skb) | |
559 | ) | |
e9d818b9 | 560 | |
2d042821 | 561 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,14,0)) |
e9d818b9 GB |
562 | |
563 | /* Trace events for the receive entry points */ | |
564 | LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_receive_entry_template, | |
565 | ||
566 | TP_PROTO(const struct sk_buff *skb), | |
567 | ||
568 | TP_ARGS(skb), | |
569 | ||
570 | TP_FIELDS( | |
571 | ctf_integer_hex(const void *, skbaddr, skb) | |
572 | ) | |
573 | ) | |
574 | ||
575 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
576 | ||
577 | napi_gro_frags_entry, | |
578 | ||
579 | net_napi_gro_frags_entry, | |
580 | ||
581 | TP_PROTO(const struct sk_buff *skb), | |
582 | ||
583 | TP_ARGS(skb) | |
584 | ) | |
585 | ||
586 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
587 | ||
588 | napi_gro_receive_entry, | |
589 | ||
590 | net_napi_gro_receive_entry, | |
591 | ||
592 | TP_PROTO(const struct sk_buff *skb), | |
593 | ||
594 | TP_ARGS(skb) | |
595 | ) | |
596 | ||
597 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
598 | ||
599 | netif_receive_skb_entry, | |
600 | ||
601 | net_if_receive_skb_entry, | |
602 | ||
603 | TP_PROTO(const struct sk_buff *skb), | |
604 | ||
605 | TP_ARGS(skb) | |
606 | ) | |
607 | ||
608 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
609 | ||
610 | netif_rx_entry, | |
611 | ||
612 | net_if_rx_entry, | |
613 | ||
614 | TP_PROTO(const struct sk_buff *skb), | |
615 | ||
616 | TP_ARGS(skb) | |
617 | ) | |
618 | ||
619 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
620 | ||
621 | netif_rx_ni_entry, | |
622 | ||
623 | net_if_rx_ni_entry, | |
624 | ||
625 | TP_PROTO(const struct sk_buff *skb), | |
626 | ||
627 | TP_ARGS(skb) | |
628 | ) | |
629 | ||
630 | #endif /* kernel > 3.14 */ | |
631 | ||
2d042821 | 632 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0)) |
e9d818b9 GB |
633 | |
634 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_entry_template, | |
635 | ||
636 | netif_receive_skb_list_entry, | |
637 | ||
638 | net_if_receive_skb_list_entry, | |
639 | ||
640 | TP_PROTO(const struct sk_buff *skb), | |
641 | ||
642 | TP_ARGS(skb) | |
643 | ) | |
644 | ||
645 | #endif /* kernel > 4.19 */ | |
646 | ||
2d042821 | 647 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,0,0)) |
e9d818b9 GB |
648 | |
649 | /* Trace events for the receive exit points */ | |
650 | LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_receive_exit_template, | |
651 | ||
652 | TP_PROTO(int ret), | |
653 | ||
654 | TP_ARGS(ret), | |
655 | ||
656 | TP_FIELDS( | |
657 | ctf_integer(int, ret, ret) | |
658 | ) | |
659 | ) | |
660 | ||
661 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
662 | ||
663 | napi_gro_frags_exit, | |
664 | ||
665 | net_napi_gro_frags_exit, | |
666 | ||
667 | TP_PROTO(int ret), | |
668 | ||
669 | TP_ARGS(ret) | |
670 | ) | |
671 | ||
672 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
673 | ||
674 | napi_gro_receive_exit, | |
675 | ||
676 | net_napi_gro_receive_exit, | |
677 | ||
678 | TP_PROTO(int ret), | |
679 | ||
680 | TP_ARGS(ret) | |
681 | ) | |
682 | ||
683 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
684 | ||
685 | netif_receive_skb_exit, | |
686 | ||
687 | net_if_receive_skb_exit, | |
688 | ||
689 | TP_PROTO(int ret), | |
690 | ||
691 | TP_ARGS(ret) | |
692 | ) | |
693 | ||
694 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
695 | ||
696 | netif_rx_exit, | |
697 | ||
698 | net_if_rx_exit, | |
699 | ||
700 | TP_PROTO(int ret), | |
701 | ||
702 | TP_ARGS(ret) | |
703 | ) | |
704 | ||
705 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
706 | ||
707 | netif_rx_ni_exit, | |
708 | ||
709 | net_if_rx_ni_exit, | |
710 | ||
711 | TP_PROTO(int ret), | |
712 | ||
713 | TP_ARGS(ret) | |
714 | ) | |
715 | ||
716 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(net_dev_receive_exit_template, | |
717 | ||
718 | netif_receive_skb_list_exit, | |
719 | ||
720 | net_if_receive_skb_list_exit, | |
721 | ||
722 | TP_PROTO(int ret), | |
723 | ||
724 | TP_ARGS(ret) | |
725 | ) | |
726 | ||
727 | #endif /* kernel > 5.0.0 */ | |
728 | ||
3bc29f0a | 729 | #endif /* LTTNG_TRACE_NET_H */ |
b283666f PW |
730 | |
731 | /* This part must be outside protection */ | |
6ec43db8 | 732 | #include <probes/define_trace.h> |