]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Add lttng tracepoints for bgp_path_info_add/free 12562/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 22 Dec 2022 21:58:24 +0000 (23:58 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 23 Dec 2022 08:04:41 +0000 (10:04 +0200)
```
[00:05:25.690812414] (+0.000004699) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 8 }
[00:05:25.690816732] (+0.000004318) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.71/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 9 }
[00:05:25.690821251] (+0.000004519) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.72/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 10 }
[00:05:25.690826050] (+0.000004799) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.13.0/24", peer = "10.0.0.3", dest_lock = 1, peer_lock = 11 }
[00:05:25.690830438] (+0.000004388) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.24.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 12 }
[00:05:25.690834666] (+0.000004228) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.35.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 13 }
[00:05:25.690839145] (+0.000004479) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.67.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 14 }
[00:05:26.361779328] (+0.670940183) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.2/32", peer = "10.0.0.2", dest_lock = 3, peer_lock = 13 }
[00:05:26.361790669] (+0.000011341) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.3/32", peer = "10.0.0.3", dest_lock = 3, peer_lock = 13 }
[00:05:26.361792282] (+0.000001613) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 12 }
[00:05:26.361912420] (+0.000120138) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 12 }
[00:05:26.361914153] (+0.000001733) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 11 }
[00:05:26.361915425] (+0.000001272) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 11 }
[00:05:26.361916878] (+0.000001453) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 10 }
[00:05:26.361920645] (+0.000003767) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 10 }
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_trace.h

index 95493c11f850234005a6ec5051dadda9b9e2ff3e..4062da14e653cff6c30432e026c61c066bd6bc95 100644 (file)
@@ -277,8 +277,10 @@ struct bgp_path_info_extra *bgp_path_info_extra_get(struct bgp_path_info *pi)
 }
 
 /* Free bgp route information. */
-static void bgp_path_info_free(struct bgp_path_info *path)
+void bgp_path_info_free_with_caller(const char *name,
+                                   struct bgp_path_info *path)
 {
+       frrtrace(2, frr_bgp, bgp_path_info_free, path, name);
        bgp_attr_unintern(&path->attr);
 
        bgp_unlink_nexthop(path);
@@ -389,8 +391,10 @@ static int bgp_dest_set_defer_flag(struct bgp_dest *dest, bool delete)
        return -1;
 }
 
-void bgp_path_info_add(struct bgp_dest *dest, struct bgp_path_info *pi)
+void bgp_path_info_add_with_caller(const char *name, struct bgp_dest *dest,
+                                  struct bgp_path_info *pi)
 {
+       frrtrace(2, frr_bgp, bgp_path_info_add, dest, pi, name);
        struct bgp_path_info *top;
 
        top = bgp_dest_get_bgp_path_info(dest);
index 3fa58c0dfb6904bebbfc4c17cdd2b504b1f7bee3..28f741c43be62503b174489d3f8cf3d8fa440436 100644 (file)
@@ -882,4 +882,12 @@ bgp_path_selection_reason2str(enum bgp_path_selection_reason reason);
 extern bool bgp_addpath_encode_rx(struct peer *peer, afi_t afi, safi_t safi);
 extern const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest,
                                                safi_t safi);
+extern void bgp_path_info_free_with_caller(const char *caller,
+                                          struct bgp_path_info *path);
+extern void bgp_path_info_add_with_caller(const char *caller,
+                                         struct bgp_dest *dest,
+                                         struct bgp_path_info *pi);
+#define bgp_path_info_add(A, B)                                                \
+       bgp_path_info_add_with_caller(__func__, (A), (B))
+#define bgp_path_info_free(B) bgp_path_info_free_with_caller(__func__, (B))
 #endif /* _QUAGGA_BGP_ROUTE_H */
index f2e0eac0a1dc055c3bfbc02eb6ab8f14926533db..7cc8f24e06be76229ed1c9133f32aa6b524e69a3 100644 (file)
@@ -276,6 +276,42 @@ TRACEPOINT_EVENT(
 )
 TRACEPOINT_LOGLEVEL(frr_bgp, bgp_peer_unlock, TRACE_INFO)
 
+/*
+ * bgp_path_info_add/bgp_path_info_free
+ */
+TRACEPOINT_EVENT(
+       frr_bgp,
+       bgp_path_info_add,
+       TP_ARGS(struct bgp_dest *, dest,
+               struct bgp_path_info *, bpi,
+               const char *, name),
+       TP_FIELDS(
+               ctf_string(caller, name)
+               ctf_string(prefix, bgp_dest_get_prefix_str(dest))
+               ctf_string(peer, PEER_HOSTNAME(bpi->peer))
+               ctf_integer(unsigned int, dest_lock,
+                           bgp_dest_get_lock_count(dest))
+               ctf_integer(unsigned int, peer_lock, bpi->peer->lock)
+       )
+)
+TRACEPOINT_LOGLEVEL(frr_bgp, bgp_path_info_add, TRACE_INFO)
+
+TRACEPOINT_EVENT(
+       frr_bgp,
+       bgp_path_info_free,
+       TP_ARGS(struct bgp_path_info *, bpi,
+               const char *, name),
+       TP_FIELDS(
+               ctf_string(caller, name)
+               ctf_string(prefix, bgp_dest_get_prefix_str(bpi->net))
+               ctf_string(peer, PEER_HOSTNAME(bpi->peer))
+               ctf_integer(unsigned int, dest_lock,
+                           bgp_dest_get_lock_count(bpi->net))
+               ctf_integer(unsigned int, peer_lock, bpi->peer->lock)
+       )
+)
+TRACEPOINT_LOGLEVEL(frr_bgp, bgp_path_info_free, TRACE_INFO)
+
 TRACEPOINT_EVENT(
        frr_bgp,
        evpn_mac_ip_zsend,