]>
Commit | Line | Data |
---|---|---|
d9a03c57 QY |
1 | /* Tracing for BGP |
2 | * | |
3 | * Copyright (C) 2020 NVIDIA Corporation | |
4 | * Quentin Young | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the Free | |
8 | * Software Foundation; either version 2 of the License, or (at your option) | |
9 | * any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
14 | * more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; see the file COPYING; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #if !defined(_BGP_TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ) | |
22 | #define _BGP_TRACE_H | |
23 | ||
c7bb4f00 | 24 | #include "lib/trace.h" |
d9a03c57 QY |
25 | |
26 | #ifdef HAVE_LTTNG | |
27 | ||
28 | #undef TRACEPOINT_PROVIDER | |
29 | #define TRACEPOINT_PROVIDER frr_bgp | |
30 | ||
31 | #undef TRACEPOINT_INCLUDE | |
32 | #define TRACEPOINT_INCLUDE "bgpd/bgp_trace.h" | |
33 | ||
34 | #include <lttng/tracepoint.h> | |
35 | ||
36 | #include "bgpd/bgpd.h" | |
37 | #include "lib/stream.h" | |
38 | ||
39 | /* clang-format off */ | |
40 | ||
41 | TRACEPOINT_EVENT_CLASS( | |
42 | frr_bgp, | |
43 | packet_process, | |
44 | TP_ARGS(struct peer *, peer, bgp_size_t, size), | |
45 | TP_FIELDS( | |
169afe9d | 46 | ctf_string(peer, PEER_HOSTNAME(peer)) |
d9a03c57 QY |
47 | ) |
48 | ) | |
49 | ||
50 | #define PKT_PROCESS_TRACEPOINT_INSTANCE(name) \ | |
51 | TRACEPOINT_EVENT_INSTANCE( \ | |
52 | frr_bgp, packet_process, name, \ | |
53 | TP_ARGS(struct peer *, peer, bgp_size_t, size)) \ | |
54 | TRACEPOINT_LOGLEVEL(frr_bgp, name, TRACE_INFO) | |
55 | ||
56 | PKT_PROCESS_TRACEPOINT_INSTANCE(open_process) | |
57 | PKT_PROCESS_TRACEPOINT_INSTANCE(keepalive_process) | |
58 | PKT_PROCESS_TRACEPOINT_INSTANCE(update_process) | |
59 | PKT_PROCESS_TRACEPOINT_INSTANCE(notification_process) | |
60 | PKT_PROCESS_TRACEPOINT_INSTANCE(capability_process) | |
61 | PKT_PROCESS_TRACEPOINT_INSTANCE(refresh_process) | |
62 | ||
63 | TRACEPOINT_EVENT( | |
64 | frr_bgp, | |
65 | packet_read, | |
66 | TP_ARGS(struct peer *, peer, struct stream *, pkt), | |
67 | TP_FIELDS( | |
169afe9d | 68 | ctf_string(peer, PEER_HOSTNAME(peer)) |
fc3ee1e0 QY |
69 | ctf_sequence_hex(uint8_t, packet, pkt->data, size_t, |
70 | STREAM_READABLE(pkt)) | |
d9a03c57 QY |
71 | ) |
72 | ) | |
73 | ||
6401252f QY |
74 | TRACEPOINT_LOGLEVEL(frr_bgp, packet_read, TRACE_INFO) |
75 | ||
76 | TRACEPOINT_EVENT( | |
77 | frr_bgp, | |
78 | process_update, | |
fc3ee1e0 QY |
79 | TP_ARGS(struct peer *, peer, char *, pfx, uint32_t, addpath_id, afi_t, |
80 | afi, safi_t, safi, struct attr *, attr), | |
6401252f | 81 | TP_FIELDS( |
169afe9d | 82 | ctf_string(peer, PEER_HOSTNAME(peer)) |
6401252f QY |
83 | ctf_string(prefix, pfx) |
84 | ctf_integer(uint32_t, addpath_id, addpath_id) | |
85 | ctf_integer(afi_t, afi, afi) | |
86 | ctf_integer(safi_t, safi, safi) | |
87 | ctf_integer_hex(intptr_t, attribute_ptr, attr) | |
88 | ) | |
89 | ) | |
90 | ||
91 | TRACEPOINT_LOGLEVEL(frr_bgp, process_update, TRACE_INFO) | |
92 | ||
93 | TRACEPOINT_EVENT( | |
94 | frr_bgp, | |
95 | input_filter, | |
fc3ee1e0 QY |
96 | TP_ARGS(struct peer *, peer, char *, pfx, afi_t, afi, safi_t, safi, |
97 | const char *, result), | |
6401252f | 98 | TP_FIELDS( |
169afe9d | 99 | ctf_string(peer, PEER_HOSTNAME(peer)) |
6401252f QY |
100 | ctf_string(prefix, pfx) |
101 | ctf_integer(afi_t, afi, afi) | |
102 | ctf_integer(safi_t, safi, safi) | |
103 | ctf_string(action, result) | |
104 | ) | |
105 | ) | |
106 | ||
107 | TRACEPOINT_LOGLEVEL(frr_bgp, input_filter, TRACE_INFO) | |
108 | ||
109 | TRACEPOINT_EVENT( | |
110 | frr_bgp, | |
111 | output_filter, | |
fc3ee1e0 QY |
112 | TP_ARGS(struct peer *, peer, char *, pfx, afi_t, afi, safi_t, safi, |
113 | const char *, result), | |
6401252f | 114 | TP_FIELDS( |
169afe9d | 115 | ctf_string(peer, PEER_HOSTNAME(peer)) |
6401252f QY |
116 | ctf_string(prefix, pfx) |
117 | ctf_integer(afi_t, afi, afi) | |
118 | ctf_integer(safi_t, safi, safi) | |
119 | ctf_string(action, result) | |
120 | ) | |
121 | ) | |
122 | ||
123 | TRACEPOINT_LOGLEVEL(frr_bgp, output_filter, TRACE_INFO) | |
d9a03c57 | 124 | |
fc3ee1e0 QY |
125 | /* clang-format on */ |
126 | ||
d9a03c57 QY |
127 | #include <lttng/tracepoint-event.h> |
128 | ||
d9a03c57 QY |
129 | #endif /* HAVE_LTTNG */ |
130 | ||
131 | #endif /* _BGP_TRACE_H */ |