3 * Copyright (C) 2020 NVIDIA Corporation
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)
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
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
21 #if !defined(_BGP_TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
24 #include "lib/trace.h"
28 #undef TRACEPOINT_PROVIDER
29 #define TRACEPOINT_PROVIDER frr_bgp
31 #undef TRACEPOINT_INCLUDE
32 #define TRACEPOINT_INCLUDE "bgpd/bgp_trace.h"
34 #include <lttng/tracepoint.h>
36 #include "bgpd/bgpd.h"
37 #include "lib/stream.h"
39 /* clang-format off */
41 TRACEPOINT_EVENT_CLASS(
44 TP_ARGS(struct peer
*, peer
, bgp_size_t
, size
),
46 ctf_string(peer
, PEER_HOSTNAME(peer
))
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)
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
)
66 TP_ARGS(struct peer
*, peer
, struct stream
*, pkt
),
68 ctf_string(peer
, PEER_HOSTNAME(peer
))
69 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
74 TRACEPOINT_LOGLEVEL(frr_bgp
, packet_read
, TRACE_INFO
)
79 TP_ARGS(struct peer
*, peer
, char *, pfx
, uint32_t, addpath_id
, afi_t
,
80 afi
, safi_t
, safi
, struct attr
*, attr
),
82 ctf_string(peer
, PEER_HOSTNAME(peer
))
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
)
91 TRACEPOINT_LOGLEVEL(frr_bgp
, process_update
, TRACE_INFO
)
96 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
, afi
, safi_t
, safi
,
97 const char *, result
),
99 ctf_string(peer
, PEER_HOSTNAME(peer
))
100 ctf_string(prefix
, pfx
)
101 ctf_integer(afi_t
, afi
, afi
)
102 ctf_integer(safi_t
, safi
, safi
)
103 ctf_string(action
, result
)
107 TRACEPOINT_LOGLEVEL(frr_bgp
, input_filter
, TRACE_INFO
)
112 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
, afi
, safi_t
, safi
,
113 const char *, result
),
115 ctf_string(peer
, PEER_HOSTNAME(peer
))
116 ctf_string(prefix
, pfx
)
117 ctf_integer(afi_t
, afi
, afi
)
118 ctf_integer(safi_t
, safi
, safi
)
119 ctf_string(action
, result
)
123 TRACEPOINT_LOGLEVEL(frr_bgp
, output_filter
, TRACE_INFO
)
125 /* BMP tracepoints */
127 /* BMP mirrors a packet to all mirror-enabled targets */
131 TP_ARGS(struct peer
*, peer
, uint8_t, type
, struct stream
*, pkt
),
133 ctf_string(peer
, PEER_HOSTNAME(peer
))
134 ctf_integer(uint8_t, type
, type
)
135 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
136 STREAM_READABLE(pkt
))
140 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_mirror_packet
, TRACE_INFO
)
143 /* BMP sends an EOR */
147 TP_ARGS(afi_t
, afi
, safi_t
, safi
, uint8_t, flags
),
149 ctf_integer(afi_t
, afi
, afi
)
150 ctf_integer(safi_t
, safi
, safi
)
151 ctf_integer(uint8_t, flags
, flags
)
155 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_eor
, TRACE_INFO
)
158 /* BMP updates its copy of the last OPEN a peer sent */
161 bmp_update_saved_open
,
162 TP_ARGS(struct peer
*, peer
, struct stream
*, pkt
),
164 ctf_string(peer
, PEER_HOSTNAME(peer
))
165 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
166 STREAM_READABLE(pkt
))
170 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_update_saved_open
, TRACE_DEBUG
)
173 /* BMP is notified of a peer status change internally */
176 bmp_peer_status_changed
,
177 TP_ARGS(struct peer
*, peer
),
179 ctf_string(peer
, PEER_HOSTNAME(peer
))
183 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_peer_status_changed
, TRACE_DEBUG
)
187 * BMP is notified that a peer has transitioned in the opposite direction of
188 * Established internally
192 bmp_peer_backward_transition
,
193 TP_ARGS(struct peer
*, peer
),
195 ctf_string(peer
, PEER_HOSTNAME(peer
))
199 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_peer_backward
, TRACE_DEBUG
)
203 * BMP is hooked for a route process
208 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
,
209 afi
, safi_t
, safi
, bool, withdraw
),
211 ctf_string(peer
, PEER_HOSTNAME(peer
))
212 ctf_string(prefix
, pfx
)
213 ctf_integer(afi_t
, afi
, afi
)
214 ctf_integer(safi_t
, safi
, safi
)
215 ctf_integer(bool, withdraw
, withdraw
)
219 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_process
, TRACE_DEBUG
)
221 /* clang-format on */
223 #include <lttng/tracepoint-event.h>
225 #endif /* HAVE_LTTNG */
227 #endif /* _BGP_TRACE_H */