bgp_dest_unlock_node(dest);
if (bgp_debug_zebra(NULL))
- zlog_debug(
- "... %s pi dest %p (l %d) pi %p (l %d, f 0x%x)",
- new_pi ? "new" : "update",
- dest, bgp_dest_to_rnode(dest)->lock,
- pi, pi->lock, pi->flags);
+ zlog_debug("... %s pi dest %p (l %d) pi %p (l %d, f 0x%x)",
+ new_pi ? "new" : "update", dest,
+ bgp_dest_get_lock_count(dest), pi, pi->lock,
+ pi->flags);
return ret;
}
return 0;
if (bgp_debug_zebra(NULL))
- zlog_debug(
- "... delete dest %p (l %d) pi %p (l %d, f 0x%x)",
- dest, bgp_dest_to_rnode(dest)->lock,
- pi, pi->lock, pi->flags);
+ zlog_debug("... delete dest %p (l %d) pi %p (l %d, f 0x%x)",
+ dest, bgp_dest_get_lock_count(dest), pi, pi->lock,
+ pi->flags);
/* Process for route leaking. */
vpn_leak_from_vrf_withdraw(bgp_get_default(), bgp_vrf, pi);
unsigned refcount;
bpi = bgp_path_info_lock(bpi);
- refcount = bpi->net->lock - 1;
+ refcount = bgp_dest_get_lock_count(bpi->net) - 1;
bgp_dest_unlock_node((struct bgp_dest *)bpi->net);
if (!refcount)
bpi->net = NULL;
return &dest->p;
}
+static inline unsigned int bgp_dest_get_lock_count(const struct bgp_dest *dest)
+{
+ return dest->lock;
+}
+
#ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pRN" (struct bgp_node *)
#pragma FRR printfrr_ext "%pBD" (struct bgp_dest *)
}
}
- if (count_bpi + count_monitor + lockoffset != rn->lock) {
+ if (count_bpi + count_monitor + lockoffset
+ != agg_node_get_lock_count(rn)) {
vnc_zlog_debug_verbose(
"%s: count_bpi=%d, count_monitor=%d, lockoffset=%d, rn->lock=%d",
__func__, count_bpi, count_monitor, lockoffset,
- rn->lock);
+ agg_node_get_lock_count(rn));
assert(0);
}
}
}
vnc_zlog_debug_verbose("%s: inserting bpi %p at prefix %pRN #%d",
- __func__, info_new, rn, rn->lock);
+ __func__, info_new, rn,
+ agg_node_get_lock_count(rn));
rfapiBgpInfoAttachSorted(rn, info_new, afi, SAFI_MPLS_VPN);
rfapiItBiIndexAdd(rn, info_new);
*/
trn = agg_node_get(rfd->rsp_times[afi], p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
- if (trn->lock > 1)
+ if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
return 0;
trn = agg_node_get(rfd->rsp_times[afi],
p); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
- if (trn->lock > 1)
+ if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
rfapiRfapiIpAddr2Str(&new->vn_address, buf, BUFSIZ);
*/
trn = agg_node_get(rfd->rsp_times[afi], p); /* locks trn */
prefix_time = (time_t)trn->info;
- if (trn->lock > 1)
+ if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
#ifdef DEBUG_FTD_FILTER_RECENT
*/
trn = agg_node_get(rfd->rsp_times[afi], &pfx); /* locks trn */
trn->info = (void *)(uintptr_t)bgp_clock();
- if (trn->lock > 1)
+ if (agg_node_get_lock_count(trn) > 1)
agg_unlock_node(trn);
{
if (rfapiStream2Vty(stream, &fp, &vty, &out, &vty_newline) == 0)
return;
- fp(out, "%pRN @%p #%d%s", rn, rn, rn->lock, HVTYNL);
+ fp(out, "%pRN @%p #%d%s", rn, rn, agg_node_get_lock_count(rn), HVTYNL);
for (bpi = rn->info; bpi; bpi = bpi->next) {
rfapiPrintBi(stream, bpi);
}
fp(out, "%s/%d @%p #%d%s", buf, p->prefixlen, rn,
- rn->lock - 1, /* account for loop iterator locking */
+ agg_node_get_lock_count(rn)
+ - 1, /* account for loop iterator locking */
HVTYNL);
for (bpi = rn->info; bpi; bpi = bpi->next) {
return &node->p;
}
+static inline unsigned int agg_node_get_lock_count(const struct agg_node *node)
+{
+ return node->lock;
+}
+
#ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pRN" (struct agg_node *)
#endif
vty_out(vty, " %s/%d (%d)\n",
inet_ntop(p->family, &p->u.prefix, buf,
SU_ADDRSTRLEN),
- p->prefixlen, rn->lock);
+ p->prefixlen,
+ route_node_get_lock_count(rn));
vty_out(vty, "(P) ");
prn = rn->parent;
vty_out(vty, " %s/%d (%d)\n",
inet_ntop(p->family, &p->u.prefix, buf,
SU_ADDRSTRLEN),
- p->prefixlen, rn->lock);
+ p->prefixlen,
+ route_node_get_lock_count(rn));
vty_out(vty, "(P) ");
prn = rn->parent;
node = node->parent;
tmp_node->table->count--;
- tmp_node->lock = 0; /* to cause assert if unlocked after this */
+ tmp_node->lock =
+ 0; /* to cause assert if unlocked after this */
rn_hash_node_del(&rt->hash, tmp_node);
route_node_free(rt, tmp_node);
route_node_delete(node);
}
+static inline unsigned int route_node_get_lock_count(struct route_node *node)
+{
+ return node->lock;
+}
+
/*
* route_table_iter_next
*
"%s %p: route add %p cost %u: another path: prev %p, next %p node ref %u",
ospf6_route_table_name(table), (void *)table,
(void *)route, route->path.cost, (void *)prev,
- (void *)next, node->lock);
+ (void *)next, route_node_get_lock_count(node));
else if (IS_OSPF6_DEBUG_ROUTE(TABLE))
zlog_debug("%s: route add cost %u: another path found",
ospf6_route_table_name(table),
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"router_id %s already present in neighbor table. node refcount %u",
- inet_ntoa(router_id), rn->lock);
+ inet_ntoa(router_id),
+ route_node_get_lock_count(rn));
route_unlock_node(rn);
} else
rn->info = oi->nbr_self;
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
"Allocated: %p for rp_info: %p(224.0.0.0/4) Lock: %d",
- rn, rp_info, rn->lock);
+ rn, rp_info, route_node_get_lock_count(rn));
}
void pim_rp_free(struct pim_instance *pim)
zlog_debug("Lookedup: %p for rp_info: %p(%s) Lock: %d", rn,
rp_info,
prefix2str(&rp_info->group, buf, sizeof(buf)),
- rn->lock);
+ route_node_get_lock_count(rn));
}
route_unlock_node(rn);
zlog_debug("Allocated: %p for rp_info: %p(%s) Lock: %d", rn,
rp_info,
prefix2str(&rp_info->group, buf, sizeof(buf)),
- rn->lock);
+ route_node_get_lock_count(rn));
}
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
__func__, rn, rp_info,
prefix2str(&rp_info->group, buf,
sizeof(buf)),
- rn->lock);
+ route_node_get_lock_count(rn));
}
rn->info = NULL;
route_unlock_node(rn);
associated with rn */
expected_lock++;
- if (rn->lock != expected_lock)
+ if (route_node_get_lock_count(rn) != expected_lock)
test_failed(
test,
"Dest rnode lock count doesn't match expected count!",
!= NULL) /* The route node is not internal */
expected_lock++;
- if (rn->lock != expected_lock) {
+ if (route_node_get_lock_count(rn) != expected_lock) {
srcdest_rnode_prefixes(
rn, (const struct prefix **)&dst_p,
(const struct prefix **)&src_p);
else
{
zlog_debug ("%s: called for route_node (%p, %d) with no ribs",
- __func__, rnode, rnode->lock);
+ __func__, rnode, route_node_get_lock_count(rnode));
zlog_backtrace(LOG_DEBUG);
}
#endif
/* Pointless to queue a route_node with no RIB entries to add or remove
*/
if (!rnode_to_ribs(rn)) {
- zlog_debug("%s: called for route_node (%p, %d) with no ribs",
- __func__, (void *)rn, rn->lock);
+ zlog_debug("%s: called for route_node (%p, %u) with no ribs",
+ __func__, (void *)rn, route_node_get_lock_count(rn));
zlog_backtrace(LOG_DEBUG);
return -1;
}