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
)
251 * peer_lock/peer_unlock
256 TP_ARGS(struct peer
*, peer
,
259 ctf_string(caller
, name
)
260 ctf_string(peer
, PEER_HOSTNAME(peer
))
261 ctf_integer(unsigned int, count
, peer
->lock
)
264 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_peer_lock
, TRACE_INFO
)
269 TP_ARGS(struct peer
*, peer
,
272 ctf_string(caller
, name
)
273 ctf_string(peer
, PEER_HOSTNAME(peer
))
274 ctf_integer(unsigned int, count
, peer
->lock
)
277 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_peer_unlock
, TRACE_INFO
)
280 * bgp_path_info_add/bgp_path_info_free
285 TP_ARGS(struct bgp_dest
*, dest
,
286 struct bgp_path_info
*, bpi
,
289 ctf_string(caller
, name
)
290 ctf_string(prefix
, bgp_dest_get_prefix_str(dest
))
291 ctf_string(peer
, PEER_HOSTNAME(bpi
->peer
))
292 ctf_integer(unsigned int, dest_lock
,
293 bgp_dest_get_lock_count(dest
))
294 ctf_integer(unsigned int, peer_lock
, bpi
->peer
->lock
)
297 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_path_info_add
, TRACE_INFO
)
302 TP_ARGS(struct bgp_path_info
*, bpi
,
305 ctf_string(caller
, name
)
306 ctf_string(prefix
, bgp_dest_get_prefix_str(bpi
->net
))
307 ctf_string(peer
, PEER_HOSTNAME(bpi
->peer
))
308 ctf_integer(unsigned int, dest_lock
,
309 bgp_dest_get_lock_count(bpi
->net
))
310 ctf_integer(unsigned int, peer_lock
, bpi
->peer
->lock
)
313 TRACEPOINT_LOGLEVEL(frr_bgp
, bgp_path_info_free
, TRACE_INFO
)
318 TP_ARGS(int, add
, struct bgpevpn
*, vpn
,
319 const struct prefix_evpn
*, pfx
,
320 struct in_addr
, vtep
, esi_t
*, esi
),
322 ctf_string(action
, add
? "add" : "del")
323 ctf_integer(vni_t
, vni
, vpn
->vni
)
324 ctf_array(unsigned char, mac
, &pfx
->prefix
.macip_addr
.mac
,
325 sizeof(struct ethaddr
))
326 ctf_array(unsigned char, ip
, &pfx
->prefix
.macip_addr
.ip
,
327 sizeof(struct ipaddr
))
328 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
329 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
332 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mac_ip_zsend
, TRACE_INFO
)
337 TP_ARGS(int, add
, struct bgpevpn
*, vpn
,
338 const struct prefix_evpn
*, pfx
),
340 ctf_string(action
, add
? "add" : "del")
341 ctf_integer(vni_t
, vni
, vpn
->vni
)
342 ctf_integer_network_hex(unsigned int, vtep
,
343 pfx
->prefix
.imet_addr
.ip
.ipaddr_v4
.s_addr
)
346 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_bum_vtep_zsend
, TRACE_INFO
)
351 TP_ARGS(bool, add
, struct bgp_evpn_es
*, es
,
352 struct bgp_evpn_es_vtep
*, es_vtep
),
354 ctf_string(action
, add
? "add" : "del")
355 ctf_string(esi
, es
->esi_str
)
356 ctf_string(vtep
, es_vtep
->vtep_str
)
359 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_vtep_zsend
, TRACE_INFO
)
364 TP_ARGS(bool, add
, bool, type_v4
, uint32_t, nhg_id
,
365 struct bgp_evpn_es_vrf
*, es_vrf
),
367 ctf_string(action
, add
? "add" : "del")
368 ctf_string(type
, type_v4
? "v4" : "v6")
369 ctf_integer(unsigned int, nhg
, nhg_id
)
370 ctf_string(esi
, es_vrf
->es
->esi_str
)
371 ctf_integer(int, vrf
, es_vrf
->bgp_vrf
->vrf_id
)
374 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_nhg_zsend
, TRACE_INFO
)
379 TP_ARGS(uint32_t, nhg_id
, struct bgp_evpn_es_vtep
*, vtep
,
380 struct bgp_evpn_es_vrf
*, es_vrf
),
382 ctf_integer(unsigned int, nhg
, nhg_id
)
383 ctf_string(vtep
, vtep
->vtep_str
)
384 ctf_integer(int, svi
, es_vrf
->bgp_vrf
->l3vni_svi_ifindex
)
387 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_nh_zsend
, TRACE_INFO
)
391 evpn_mh_nh_rmac_zsend
,
392 TP_ARGS(bool, add
, struct bgp_evpn_nh
*, nh
),
394 ctf_string(action
, add
? "add" : "del")
395 ctf_integer(int, vrf
, nh
->bgp_vrf
->vrf_id
)
396 ctf_string(nh
, nh
->nh_str
)
397 ctf_array(unsigned char, rmac
, &nh
->rmac
,
398 sizeof(struct ethaddr
))
401 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_nh_rmac_zsend
, TRACE_INFO
)
405 evpn_mh_local_es_add_zrecv
,
406 TP_ARGS(esi_t
*, esi
, struct in_addr
, vtep
,
407 uint8_t, active
, uint8_t, bypass
, uint16_t, df_pref
),
409 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
410 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
411 ctf_integer(uint8_t, active
, active
)
412 ctf_integer(uint8_t, bypass
, bypass
)
413 ctf_integer(uint16_t, df_pref
, df_pref
)
416 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_add_zrecv
, TRACE_INFO
)
420 evpn_mh_local_es_del_zrecv
,
421 TP_ARGS(esi_t
*, esi
),
423 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
426 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_del_zrecv
, TRACE_INFO
)
430 evpn_mh_local_es_evi_add_zrecv
,
431 TP_ARGS(esi_t
*, esi
, vni_t
, vni
),
433 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
434 ctf_integer(vni_t
, vni
, vni
)
437 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_evi_add_zrecv
, TRACE_INFO
)
441 evpn_mh_local_es_evi_del_zrecv
,
442 TP_ARGS(esi_t
*, esi
, vni_t
, vni
),
444 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
445 ctf_integer(vni_t
, vni
, vni
)
448 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_mh_local_es_evi_del_zrecv
, TRACE_INFO
)
452 evpn_local_vni_add_zrecv
,
453 TP_ARGS(vni_t
, vni
, struct in_addr
, vtep
, vrf_id_t
, vrf
,
454 struct in_addr
, mc_grp
),
456 ctf_integer(vni_t
, vni
, vni
)
457 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
458 ctf_integer_network_hex(unsigned int, mc_grp
,
460 ctf_integer(int, vrf
, vrf
)
463 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_vni_add_zrecv
, TRACE_INFO
)
467 evpn_local_vni_del_zrecv
,
470 ctf_integer(vni_t
, vni
, vni
)
473 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_vni_del_zrecv
, TRACE_INFO
)
477 evpn_local_macip_add_zrecv
,
478 TP_ARGS(vni_t
, vni
, struct ethaddr
*, mac
,
479 struct ipaddr
*, ip
, uint32_t, flags
,
480 uint32_t, seqnum
, esi_t
*, esi
),
482 ctf_integer(vni_t
, vni
, vni
)
483 ctf_array(unsigned char, mac
, mac
,
484 sizeof(struct ethaddr
))
485 ctf_array(unsigned char, ip
, ip
,
486 sizeof(struct ipaddr
))
487 ctf_integer(uint32_t, flags
, flags
)
488 ctf_integer(uint32_t, seq
, seqnum
)
489 ctf_array(unsigned char, esi
, esi
, sizeof(esi_t
))
492 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_macip_add_zrecv
, TRACE_INFO
)
496 evpn_local_macip_del_zrecv
,
497 TP_ARGS(vni_t
, vni
, struct ethaddr
*, mac
, struct ipaddr
*, ip
,
500 ctf_integer(vni_t
, vni
, vni
)
501 ctf_array(unsigned char, mac
, mac
,
502 sizeof(struct ethaddr
))
503 ctf_array(unsigned char, ip
, ip
,
504 sizeof(struct ipaddr
))
505 ctf_integer(int, state
, state
)
508 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_macip_del_zrecv
, TRACE_INFO
)
512 evpn_local_l3vni_add_zrecv
,
513 TP_ARGS(vni_t
, vni
, vrf_id_t
, vrf
,
514 struct ethaddr
*, svi_rmac
,
515 struct ethaddr
*, vrr_rmac
, int, filter
,
516 struct in_addr
, vtep
, int, svi_ifindex
,
519 ctf_integer(vni_t
, vni
, vni
)
520 ctf_integer(int, vrf
, vrf
)
521 ctf_array(unsigned char, svi_rmac
, svi_rmac
,
522 sizeof(struct ethaddr
))
523 ctf_array(unsigned char, vrr_rmac
, vrr_rmac
,
524 sizeof(struct ethaddr
))
525 ctf_integer_network_hex(unsigned int, vtep
, vtep
.s_addr
)
526 ctf_integer(int, filter
, filter
)
527 ctf_integer(int, svi_ifindex
, svi_ifindex
)
528 ctf_string(anycast_mac
, anycast_mac
? "y" : "n")
531 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_l3vni_add_zrecv
, TRACE_INFO
)
535 evpn_local_l3vni_del_zrecv
,
536 TP_ARGS(vni_t
, vni
, vrf_id_t
, vrf
),
538 ctf_integer(vni_t
, vni
, vni
)
539 ctf_integer(int, vrf
, vrf
)
542 TRACEPOINT_LOGLEVEL(frr_bgp
, evpn_local_l3vni_del_zrecv
, TRACE_INFO
)
543 /* clang-format on */
545 #include <lttng/tracepoint-event.h>
547 #endif /* HAVE_LTTNG */
549 #endif /* _BGP_TRACE_H */