diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2021-09-24 13:53:03 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-24 13:53:03 -0400 | 
| commit | 05c587b029fedcfa26053aac6920420c5e866988 (patch) | |
| tree | 044187587859db3b3fc52515283230ae0afbf7a7 /bgpd | |
| parent | b8beb67ef5a1c6e276a11ee346ea4a84c1c0b76f (diff) | |
| parent | 63836a9647abfa0a067134076ff8a401d6ad7e74 (diff) | |
Merge pull request #9661 from ton31337/fix/bgp_frrtrace_for_lttng
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_table.c | 37 | ||||
| -rw-r--r-- | bgpd/bgp_table.h | 25 | ||||
| -rw-r--r-- | bgpd/bgp_trace.h | 25 | 
3 files changed, 65 insertions, 22 deletions
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 833bdec2ed..376172a6f9 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -31,6 +31,7 @@  #include "bgpd/bgpd.h"  #include "bgpd/bgp_table.h"  #include "bgp_addpath.h" +#include "bgp_trace.h"  void bgp_table_lock(struct bgp_table *rt)  { @@ -61,6 +62,42 @@ void bgp_table_finish(struct bgp_table **rt)  }  /* + * bgp_dest_unlock_node + */ +void bgp_dest_unlock_node(struct bgp_dest *dest) +{ +	frrtrace(1, frr_bgp, bgp_dest_unlock, dest); +	bgp_delete_listnode(dest); +	route_unlock_node(bgp_dest_to_rnode(dest)); +} + +/* + * bgp_dest_lock_node + */ +struct bgp_dest *bgp_dest_lock_node(struct bgp_dest *dest) +{ +	frrtrace(1, frr_bgp, bgp_dest_lock, dest); +	struct route_node *rn = route_lock_node(bgp_dest_to_rnode(dest)); + +	return bgp_dest_from_rnode(rn); +} + +/* + * bgp_dest_get_prefix_str + */ +const char *bgp_dest_get_prefix_str(struct bgp_dest *dest) +{ +	const struct prefix *p = NULL; +	char str[PREFIX_STRLEN] = {0}; + +	p = bgp_dest_get_prefix(dest); +	if (p) +		return prefix2str(p, str, sizeof(str)); + +	return NULL; +} + +/*   * bgp_node_create   */  static struct route_node *bgp_node_create(route_table_delegate_t *delegate, diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 8a5ed2442f..d832383ab4 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -31,7 +31,6 @@  #include "linklist.h"  #include "bgpd.h"  #include "bgp_advertise.h" -#include "bgpd/bgp_trace.h"  struct bgp_table {  	/* table belongs to this instance */ @@ -135,6 +134,9 @@ extern struct bgp_table *bgp_table_init(struct bgp *bgp, afi_t, safi_t);  extern void bgp_table_lock(struct bgp_table *);  extern void bgp_table_unlock(struct bgp_table *);  extern void bgp_table_finish(struct bgp_table **); +extern void bgp_dest_unlock_node(struct bgp_dest *dest); +extern struct bgp_dest *bgp_dest_lock_node(struct bgp_dest *dest); +extern const char *bgp_dest_get_prefix_str(struct bgp_dest *dest);  /* @@ -180,16 +182,6 @@ static inline struct bgp_dest *bgp_dest_parent_nolock(struct bgp_dest *dest)  }  /* - * bgp_dest_unlock_node - */ -static inline void bgp_dest_unlock_node(struct bgp_dest *dest) -{ -	frrtrace(1, frr_bgp, bgp_dest_unlock, dest); -	bgp_delete_listnode(dest); -	route_unlock_node(bgp_dest_to_rnode(dest)); -} - -/*   * bgp_table_top_nolock   *   * Gets the top dest in the table without locking it. @@ -254,17 +246,6 @@ bgp_node_lookup(const struct bgp_table *const table, const struct prefix *p)  }  /* - * bgp_dest_lock_node - */ -static inline struct bgp_dest *bgp_dest_lock_node(struct bgp_dest *dest) -{ -	frrtrace(1, frr_bgp, bgp_dest_lock, dest); -	struct route_node *rn = route_lock_node(bgp_dest_to_rnode(dest)); - -	return bgp_dest_from_rnode(rn); -} - -/*   * bgp_node_match   */  static inline struct bgp_dest *bgp_node_match(const struct bgp_table *table, diff --git a/bgpd/bgp_trace.h b/bgpd/bgp_trace.h index 8bc513009d..303e06c9c9 100644 --- a/bgpd/bgp_trace.h +++ b/bgpd/bgp_trace.h @@ -218,6 +218,31 @@ TRACEPOINT_EVENT(  TRACEPOINT_LOGLEVEL(frr_bgp, bmp_process, TRACE_DEBUG) +/* + * bgp_dest_lock/bgp_dest_unlock + */ +TRACEPOINT_EVENT( +	frr_bgp, +	bgp_dest_lock, +	TP_ARGS(struct bgp_dest *, dest), +	TP_FIELDS( +		ctf_string(prefix, bgp_dest_get_prefix_str(dest)) +		ctf_integer(unsigned int, count, bgp_dest_get_lock_count(dest)) +	) +) +TRACEPOINT_LOGLEVEL(frr_bgp, bgp_dest_lock, TRACE_INFO) + +TRACEPOINT_EVENT( +	frr_bgp, +	bgp_dest_unlock, +	TP_ARGS(struct bgp_dest *, dest), +	TP_FIELDS( +		ctf_string(prefix, bgp_dest_get_prefix_str(dest)) +		ctf_integer(unsigned int, count, bgp_dest_get_lock_count(dest)) +	) +) +TRACEPOINT_LOGLEVEL(frr_bgp, bgp_dest_unlock, TRACE_INFO) +  /* clang-format on */  #include <lttng/tracepoint-event.h>  | 
