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 "bgpd/bgp_attr.h"
38 #include "lib/stream.h"
39 #include "bgpd/bgp_evpn_private.h"
40 #include "bgpd/bgp_evpn_mh.h"
43 /* clang-format off */
45 TRACEPOINT_EVENT_CLASS(
48 TP_ARGS(struct peer
*, peer
, bgp_size_t
, size
),
50 ctf_string(peer
, PEER_HOSTNAME(peer
))
54 #define PKT_PROCESS_TRACEPOINT_INSTANCE(name) \
55 TRACEPOINT_EVENT_INSTANCE( \
56 frr_bgp, packet_process, name, \
57 TP_ARGS(struct peer *, peer, bgp_size_t, size)) \
58 TRACEPOINT_LOGLEVEL(frr_bgp, name, TRACE_INFO)
60 PKT_PROCESS_TRACEPOINT_INSTANCE(open_process
)
61 PKT_PROCESS_TRACEPOINT_INSTANCE(keepalive_process
)
62 PKT_PROCESS_TRACEPOINT_INSTANCE(update_process
)
63 PKT_PROCESS_TRACEPOINT_INSTANCE(notification_process
)
64 PKT_PROCESS_TRACEPOINT_INSTANCE(capability_process
)
65 PKT_PROCESS_TRACEPOINT_INSTANCE(refresh_process
)
70 TP_ARGS(struct peer
*, peer
, struct stream
*, pkt
),
72 ctf_string(peer
, PEER_HOSTNAME(peer
))
73 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
78 TRACEPOINT_LOGLEVEL(frr_bgp
, packet_read
, TRACE_INFO
)
83 TP_ARGS(struct peer
*, peer
, char *, pfx
, uint32_t, addpath_id
, afi_t
,
84 afi
, safi_t
, safi
, struct attr
*, attr
),
86 ctf_string(peer
, PEER_HOSTNAME(peer
))
87 ctf_string(prefix
, pfx
)
88 ctf_integer(uint32_t, addpath_id
, addpath_id
)
89 ctf_integer(afi_t
, afi
, afi
)
90 ctf_integer(safi_t
, safi
, safi
)
91 ctf_integer_hex(intptr_t, attribute_ptr
, attr
)
95 TRACEPOINT_LOGLEVEL(frr_bgp
, process_update
, TRACE_INFO
)
100 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
, afi
, safi_t
, safi
,
101 const char *, result
),
103 ctf_string(peer
, PEER_HOSTNAME(peer
))
104 ctf_string(prefix
, pfx
)
105 ctf_integer(afi_t
, afi
, afi
)
106 ctf_integer(safi_t
, safi
, safi
)
107 ctf_string(action
, result
)
111 TRACEPOINT_LOGLEVEL(frr_bgp
, input_filter
, TRACE_INFO
)
116 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
, afi
, safi_t
, safi
,
117 const char *, result
),
119 ctf_string(peer
, PEER_HOSTNAME(peer
))
120 ctf_string(prefix
, pfx
)
121 ctf_integer(afi_t
, afi
, afi
)
122 ctf_integer(safi_t
, safi
, safi
)
123 ctf_string(action
, result
)
127 TRACEPOINT_LOGLEVEL(frr_bgp
, output_filter
, TRACE_INFO
)
129 /* BMP tracepoints */
131 /* BMP mirrors a packet to all mirror-enabled targets */
135 TP_ARGS(struct peer
*, peer
, uint8_t, type
, struct stream
*, pkt
),
137 ctf_string(peer
, PEER_HOSTNAME(peer
))
138 ctf_integer(uint8_t, type
, type
)
139 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
140 STREAM_READABLE(pkt
))
144 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_mirror_packet
, TRACE_INFO
)
147 /* BMP sends an EOR */
151 TP_ARGS(afi_t
, afi
, safi_t
, safi
, uint8_t, flags
),
153 ctf_integer(afi_t
, afi
, afi
)
154 ctf_integer(safi_t
, safi
, safi
)
155 ctf_integer(uint8_t, flags
, flags
)
159 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_eor
, TRACE_INFO
)
162 /* BMP updates its copy of the last OPEN a peer sent */
165 bmp_update_saved_open
,
166 TP_ARGS(struct peer
*, peer
, struct stream
*, pkt
),
168 ctf_string(peer
, PEER_HOSTNAME(peer
))
169 ctf_sequence_hex(uint8_t, packet
, pkt
->data
, size_t,
170 STREAM_READABLE(pkt
))
174 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_update_saved_open
, TRACE_DEBUG
)
177 /* BMP is notified of a peer status change internally */
180 bmp_peer_status_changed
,
181 TP_ARGS(struct peer
*, peer
),
183 ctf_string(peer
, PEER_HOSTNAME(peer
))
187 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_peer_status_changed
, TRACE_DEBUG
)
191 * BMP is notified that a peer has transitioned in the opposite direction of
192 * Established internally
196 bmp_peer_backward_transition
,
197 TP_ARGS(struct peer
*, peer
),
199 ctf_string(peer
, PEER_HOSTNAME(peer
))
203 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_peer_backward
, TRACE_DEBUG
)
207 * BMP is hooked for a route process
212 TP_ARGS(struct peer
*, peer
, char *, pfx
, afi_t
,
213 afi
, safi_t
, safi
, bool, withdraw
),
215 ctf_string(peer
, PEER_HOSTNAME(peer
))
216 ctf_string(prefix
, pfx
)
217 ctf_integer(afi_t
, afi
, afi
)
218 ctf_integer(safi_t
, safi
, safi
)
219 ctf_integer(bool, withdraw
, withdraw
)
223 TRACEPOINT_LOGLEVEL(frr_bgp
, bmp_process
, TRACE_DEBUG
)
226 * bgp_dest_lock/bgp_dest_unlock
231 TP_ARGS(struct bgp_dest
*, dest
),
233 ctf_string(prefix
, bgp_dest_get_prefix_str(dest
))
234 ctf_integer(unsigned int, count
, bgp_dest_get_lock_count(dest
))
237 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_dest_lock
, TRACE_INFO
)
242 TP_ARGS(struct bgp_dest
*, dest
),
244 ctf_string(prefix
, bgp_dest_get_prefix_str(dest
))
245 ctf_integer(unsigned int, count
, bgp_dest_get_lock_count(dest
))
248 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_dest_unlock
, TRACE_INFO
)
253 TP_ARGS(int, add
, struct bgpevpn
*, vpn
,
254 const struct prefix_evpn
*, pfx
,
255 struct in_addr
, vtep
, esi_t
*, esi
),
257 ctf_string(action
, add
? "add" : "del")
258 ctf_integer(vni_t
, vni
, vpn
->vni
)
259 ctf_array(unsigned char, mac
, &pfx
->prefix
.macip_addr
.mac
,
260 sizeof(struct ethaddr
))
261 ctf_array(unsigned char, ip
, &pfx
->prefix
.macip_addr
.ip
,
262 sizeof(struct ipaddr
))
263 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
264 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
267 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mac_ip_zsend
, TRACE_INFO
)
272 TP_ARGS(int, add
, struct bgpevpn
*, vpn
,
273 const struct prefix_evpn
*, pfx
),
275 ctf_string(action
, add
? "add" : "del")
276 ctf_integer(vni_t
, vni
, vpn
->vni
)
277 ctf_integer_network_hex(unsigned int, vtep
,
278 pfx
->prefix
.imet_addr
.ip
.ipaddr_v4
.s_addr
)
281 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_bum_vtep_zsend
, TRACE_INFO
)
286 TP_ARGS(bool, add
, struct bgp_evpn_es
*, es
,
287 struct bgp_evpn_es_vtep
*, es_vtep
),
289 ctf_string(action
, add
? "add" : "del")
290 ctf_string(esi
, es
->esi_str
)
291 ctf_string(vtep
, es_vtep
->vtep_str
)
294 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_vtep_zsend
, TRACE_INFO
)
299 TP_ARGS(bool, add
, bool, type_v4
, uint32_t, nhg_id
,
300 struct bgp_evpn_es_vrf
*, es_vrf
),
302 ctf_string(action
, add
? "add" : "del")
303 ctf_string(type
, type_v4
? "v4" : "v6")
304 ctf_integer(unsigned int, nhg
, nhg_id
)
305 ctf_string(esi
, es_vrf
->es
->esi_str
)
306 ctf_integer(int, vrf
, es_vrf
->bgp_vrf
->vrf_id
)
309 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_nhg_zsend
, TRACE_INFO
)
314 TP_ARGS(uint32_t, nhg_id
, struct bgp_evpn_es_vtep
*, vtep
,
315 struct bgp_evpn_es_vrf
*, es_vrf
),
317 ctf_integer(unsigned int, nhg
, nhg_id
)
318 ctf_string(vtep
, vtep
->vtep_str
)
319 ctf_integer(int, svi
, es_vrf
->bgp_vrf
->l3vni_svi_ifindex
)
322 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_nh_zsend
, TRACE_INFO
)
326 evpn_mh_nh_rmac_zsend
,
327 TP_ARGS(bool, add
, struct bgp_evpn_nh
*, nh
),
329 ctf_string(action
, add
? "add" : "del")
330 ctf_integer(int, vrf
, nh
->bgp_vrf
->vrf_id
)
331 ctf_string(nh
, nh
->nh_str
)
332 ctf_array(unsigned char, rmac
, &nh
->rmac
,
333 sizeof(struct ethaddr
))
336 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_nh_rmac_zsend
, TRACE_INFO
)
340 evpn_mh_local_es_add_zrecv
,
341 TP_ARGS(esi_t
*, esi
, struct in_addr
, vtep
,
342 uint8_t, active
, uint8_t, bypass
, uint16_t, df_pref
),
344 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
345 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
346 ctf_integer(uint8_t, active
, active
)
347 ctf_integer(uint8_t, bypass
, bypass
)
348 ctf_integer(uint16_t, df_pref
, df_pref
)
351 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_add_zrecv
, TRACE_INFO
)
355 evpn_mh_local_es_del_zrecv
,
356 TP_ARGS(esi_t
*, esi
),
358 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
361 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_del_zrecv
, TRACE_INFO
)
365 evpn_mh_local_es_evi_add_zrecv
,
366 TP_ARGS(esi_t
*, esi
, vni_t
, vni
),
368 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
369 ctf_integer(vni_t
, vni
, vni
)
372 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_evi_add_zrecv
, TRACE_INFO
)
376 evpn_mh_local_es_evi_del_zrecv
,
377 TP_ARGS(esi_t
*, esi
, vni_t
, vni
),
379 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
380 ctf_integer(vni_t
, vni
, vni
)
383 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_evi_del_zrecv
, TRACE_INFO
)
387 evpn_local_vni_add_zrecv
,
388 TP_ARGS(vni_t
, vni
, struct in_addr
, vtep
, vrf_id_t
, vrf
,
389 struct in_addr
, mc_grp
),
391 ctf_integer(vni_t
, vni
, vni
)
392 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
393 ctf_integer_network_hex(unsigned int, mc_grp
,
395 ctf_integer(int, vrf
, vrf
)
398 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_vni_add_zrecv
, TRACE_INFO
)
402 evpn_local_vni_del_zrecv
,
405 ctf_integer(vni_t
, vni
, vni
)
408 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_vni_del_zrecv
, TRACE_INFO
)
412 evpn_local_macip_add_zrecv
,
413 TP_ARGS(vni_t
, vni
, struct ethaddr
*, mac
,
414 struct ipaddr
*, ip
, uint32_t, flags
,
415 uint32_t, seqnum
, esi_t
*, esi
),
417 ctf_integer(vni_t
, vni
, vni
)
418 ctf_array(unsigned char, mac
, mac
,
419 sizeof(struct ethaddr
))
420 ctf_array(unsigned char, ip
, ip
,
421 sizeof(struct ipaddr
))
422 ctf_integer(uint32_t, flags
, flags
)
423 ctf_integer(uint32_t, seq
, seqnum
)
424 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
427 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_macip_add_zrecv
, TRACE_INFO
)
431 evpn_local_macip_del_zrecv
,
432 TP_ARGS(vni_t
, vni
, struct ethaddr
*, mac
, struct ipaddr
*, ip
,
435 ctf_integer(vni_t
, vni
, vni
)
436 ctf_array(unsigned char, mac
, mac
,
437 sizeof(struct ethaddr
))
438 ctf_array(unsigned char, ip
, ip
,
439 sizeof(struct ipaddr
))
440 ctf_integer(int, state
, state
)
443 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_macip_del_zrecv
, TRACE_INFO
)
447 evpn_local_l3vni_add_zrecv
,
448 TP_ARGS(vni_t
, vni
, vrf_id_t
, vrf
,
449 struct ethaddr
*, svi_rmac
,
450 struct ethaddr
*, vrr_rmac
, int, filter
,
451 struct in_addr
, vtep
, int, svi_ifindex
,
454 ctf_integer(vni_t
, vni
, vni
)
455 ctf_integer(int, vrf
, vrf
)
456 ctf_array(unsigned char, svi_rmac
, svi_rmac
,
457 sizeof(struct ethaddr
))
458 ctf_array(unsigned char, vrr_rmac
, vrr_rmac
,
459 sizeof(struct ethaddr
))
460 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
461 ctf_integer(int, filter
, filter
)
462 ctf_integer(int, svi_ifindex
, svi_ifindex
)
463 ctf_string(anycast_mac
, anycast_mac
? "y" : "n")
466 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_l3vni_add_zrecv
, TRACE_INFO
)
470 evpn_local_l3vni_del_zrecv
,
471 TP_ARGS(vni_t
, vni
, vrf_id_t
, vrf
),
473 ctf_integer(vni_t
, vni
, vni
)
474 ctf_integer(int, vrf
, vrf
)
477 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_l3vni_del_zrecv
, TRACE_INFO
)
478 /* clang-format on */
480 #include <lttng/tracepoint-event.h>
482 #endif /* HAVE_LTTNG */
484 #endif /* _BGP_TRACE_H */