diff options
author | Donald Sharp <sharpd@nvidia.com> | 2020-10-14 18:44:23 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2020-10-17 19:39:10 +0200 |
commit | c10e14e96dae32a3b52bc97ab197e58577cff709 (patch) | |
tree | af3db68b477518fdd84ce4cbf4cd6d7b4823011c /bgpd | |
parent | Merge pull request #7336 from donaldsharp/sharp_one_one (diff) | |
download | frr-c10e14e96dae32a3b52bc97ab197e58577cff709.tar.xz frr-c10e14e96dae32a3b52bc97ab197e58577cff709.zip |
*: Create/Use accessor functions for lock count
Create appropriate accessor functions for the rn->lock
data. We should be accessing this data through accessor
functions since it is private data to the data structure.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_evpn.c | 16 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_table.h | 5 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_import.c | 8 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_rib.c | 8 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_vty.c | 5 |
6 files changed, 25 insertions, 19 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 7f9ef0c9c..8f65b3afb 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2481,11 +2481,10 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, 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; } @@ -2620,10 +2619,9 @@ static int uninstall_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, 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); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 73f5526fe..f998a4d35 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -216,7 +216,7 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra) 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; diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 31ea5554d..9dd27628c 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -469,6 +469,11 @@ static inline const struct prefix *bgp_dest_get_prefix(const struct bgp_dest *de 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 *) diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index c3ad95ff2..1e8a381e2 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -265,11 +265,12 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset) } } - 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); } } @@ -3665,7 +3666,8 @@ void rfapiBgpInfoFilteredImportVPN( } 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); diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index e068eb7af..8109e7e3d 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -802,7 +802,7 @@ int rfapiRibPreloadBi( */ 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; @@ -1242,7 +1242,7 @@ callback: 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); @@ -1833,7 +1833,7 @@ int rfapiRibFTDFilterRecentPrefix( */ 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 @@ -2069,7 +2069,7 @@ rfapiRibPreload(struct bgp *bgp, struct rfapi_descriptor *rfd, */ 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); { diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index d74404ea5..850e8325c 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -751,7 +751,7 @@ void rfapiShowItNode(void *stream, struct agg_node *rn) 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); @@ -787,7 +787,8 @@ void rfapiShowImportTable(void *stream, const char *label, struct agg_table *rt, } 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) { |