Skip to content

Commit

Permalink
bgpd: Add unlikely for debugs in bgp_update()
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Nov 7, 2024
1 parent fc818fe commit bd03373
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -5035,7 +5035,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (get_active_bdc_from_pi(pi, afi, safi) &&
peer->sort == BGP_PEER_EBGP &&
CHECK_FLAG(pi->flags, BGP_PATH_HISTORY)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
if (unlikely(bgp_debug_update(peer, p, NULL, 1))) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label,
num_labels, addpath_id ? 1 : 0,
Expand All @@ -5053,7 +5053,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
}
} else /* Duplicate - odd */
{
if (bgp_debug_update(peer, p, NULL, 1)) {
if (unlikely(bgp_debug_update(peer, p, NULL, 1))) {
if (!peer->rcvd_attr_printed) {
zlog_debug(
"%pBP rcvd UPDATE w/ attr: %s",
Expand Down Expand Up @@ -5089,7 +5089,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,

/* Withdraw/Announce before we fully processed the withdraw */
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
if (bgp_debug_update(peer, p, NULL, 1)) {
if (unlikely(bgp_debug_update(peer, p, NULL, 1))) {
bgp_debug_rdpfxpath2str(
afi, safi, prd, p, label, num_labels,
addpath_id ? 1 : 0, addpath_id, evpn,
Expand Down Expand Up @@ -5117,7 +5117,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
}

/* Received Logging. */
if (bgp_debug_update(peer, p, NULL, 1)) {
if (unlikely(bgp_debug_update(peer, p, NULL, 1))) {
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label,
num_labels, addpath_id ? 1 : 0,
addpath_id, evpn, pfx_buf,
Expand Down Expand Up @@ -5188,7 +5188,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
bgp_attr_get_ecommunity(pi->attr),
bgp_attr_get_ecommunity(attr_new));
if (!cmp) {
if (bgp_debug_update(peer, p, NULL, 1))
if (unlikely(bgp_debug_update(peer, p, NULL, 1)))
zlog_debug(
"Change in EXT-COMM, existing %s new %s",
ecommunity_str(
Expand Down Expand Up @@ -5298,7 +5298,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
* EVPN nexthop is decremented appropriately.
*/
else if (!CHECK_FLAG(pi->flags, BGP_PATH_VALID)) {
if (BGP_DEBUG(nht, NHT))
if (unlikely(BGP_DEBUG(nht, NHT)))
zlog_debug("%s unimport EVPN %pFX as pi %p is not VALID",
__func__, p, pi);
bgp_evpn_unimport_route(bgp, afi, safi, p, pi);
Expand Down Expand Up @@ -5338,7 +5338,7 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
} // End of implicit withdraw

/* Received Logging. */
if (bgp_debug_update(peer, p, NULL, 1)) {
if (unlikely(bgp_debug_update(peer, p, NULL, 1))) {
if (!peer->rcvd_attr_printed) {
zlog_debug("%pBP rcvd UPDATE w/ attr: %s", peer,
peer->rcvd_attr_str);
Expand Down

0 comments on commit bd03373

Please sign in to comment.