summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-03-18 02:34:55 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-18 02:34:55 +0100
commitbfc920192804b2ce65f8ea11331c2e1cd3568b8b (patch)
treee514babe675a220c2a900f943c6bcc60e568db3f /pimd
parentpimd: make igmp_source_forward_reevaluate_all vrf aware (diff)
downloadfrr-bfc920192804b2ce65f8ea11331c2e1cd3568b8b.tar.xz
frr-bfc920192804b2ce65f8ea11331c2e1cd3568b8b.zip
pimd: Move some data tracking variables per VRF
There were a few more global variables that needed to be per vrf. So move them over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_cmd.c22
-rw-r--r--pimd/pim_instance.c1
-rw-r--r--pimd/pim_instance.h9
-rw-r--r--pimd/pim_nht.c2
-rw-r--r--pimd/pim_rp.c2
-rw-r--r--pimd/pim_rpf.c24
-rw-r--r--pimd/pim_rpf.h4
-rw-r--r--pimd/pim_zebra.c12
-rw-r--r--pimd/pim_zlookup.c2
-rw-r--r--pimd/pimd.c6
-rw-r--r--pimd/pimd.h6
11 files changed, 42 insertions, 48 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a8935bf80..2b21d661c 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -2572,7 +2572,7 @@ static void show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
char refresh_uptime[10];
pim_time_uptime_begin(refresh_uptime, sizeof(refresh_uptime), now,
- qpim_rpf_cache_refresh_last);
+ pim->rpf_cache_refresh_last);
if (json) {
json_object_int_add(json, "rpfCacheRefreshDelayMsecs",
@@ -2581,15 +2581,15 @@ static void show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
json, "rpfCacheRefreshTimer",
pim_time_timer_remain_msec(pim->rpf_cache_refresher));
json_object_int_add(json, "rpfCacheRefreshRequests",
- qpim_rpf_cache_refresh_requests);
+ pim->rpf_cache_refresh_requests);
json_object_int_add(json, "rpfCacheRefreshEvents",
- qpim_rpf_cache_refresh_events);
+ pim->rpf_cache_refresh_events);
json_object_string_add(json, "rpfCacheRefreshLast",
refresh_uptime);
json_object_int_add(json, "nexthopLookups",
- qpim_nexthop_lookups);
+ pim->nexthop_lookups);
json_object_int_add(json, "nexthopLookupsAvoided",
- nexthop_lookups_avoided);
+ pim->nexthop_lookups_avoided);
} else {
vty_out(vty,
"RPF Cache Refresh Delay: %ld msecs\n"
@@ -2601,10 +2601,10 @@ static void show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
"Nexthop Lookups Avoided: %lld\n",
qpim_rpf_cache_refresh_delay_msec,
pim_time_timer_remain_msec(pim->rpf_cache_refresher),
- (long long)qpim_rpf_cache_refresh_requests,
- (long long)qpim_rpf_cache_refresh_events,
- refresh_uptime, (long long)qpim_nexthop_lookups,
- (long long)nexthop_lookups_avoided);
+ (long long)pim->rpf_cache_refresh_requests,
+ (long long)pim->rpf_cache_refresh_events,
+ refresh_uptime, (long long)pim->nexthop_lookups,
+ (long long)pim->nexthop_lookups_avoided);
}
}
@@ -2616,7 +2616,7 @@ static void show_scan_oil_stats(struct pim_instance *pim, struct vty *vty,
char uptime_mroute_del[10];
pim_time_uptime_begin(uptime_scan_oil, sizeof(uptime_scan_oil), now,
- qpim_scan_oil_last);
+ pim->scan_oil_last);
pim_time_uptime_begin(uptime_mroute_add, sizeof(uptime_mroute_add), now,
pim->mroute_add_last);
pim_time_uptime_begin(uptime_mroute_del, sizeof(uptime_mroute_del), now,
@@ -2626,7 +2626,7 @@ static void show_scan_oil_stats(struct pim_instance *pim, struct vty *vty,
"Scan OIL - Last: %s Events: %lld\n"
"MFC Add - Last: %s Events: %lld\n"
"MFC Del - Last: %s Events: %lld\n",
- uptime_scan_oil, (long long)qpim_scan_oil_events,
+ uptime_scan_oil, (long long)pim->scan_oil_events,
uptime_mroute_add, (long long)pim->mroute_add_events,
uptime_mroute_del, (long long)pim->mroute_del_events);
}
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c
index 60a3308a0..ab4ffc26a 100644
--- a/pimd/pim_instance.c
+++ b/pimd/pim_instance.c
@@ -119,6 +119,7 @@ static struct pim_instance *pim_instance_init(struct vrf *vrf)
pim_upstream_init(pim);
+ pim->last_route_change_time = -1;
return pim;
}
diff --git a/pimd/pim_instance.h b/pimd/pim_instance.h
index e672c39fd..75f011513 100644
--- a/pimd/pim_instance.h
+++ b/pimd/pim_instance.h
@@ -97,6 +97,15 @@ struct pim_instance {
/* If we need to rescan all our upstreams */
struct thread *rpf_cache_refresher;
+ int64_t rpf_cache_refresh_requests;
+ int64_t rpf_cache_refresh_events;
+ int64_t rpf_cache_refresh_last;
+ int64_t scan_oil_events;
+ int64_t scan_oil_last;
+
+ int64_t nexthop_lookups;
+ int64_t nexthop_lookups_avoided;
+ int64_t last_route_change_time;
};
void pim_vrf_init(void);
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 94f19bea7..94cb32bc2 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -759,7 +759,7 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
pnc->upstream_hash->count, listcount(pnc->rp_list));
}
- pim_rpf_set_refresh_time();
+ pim_rpf_set_refresh_time(pim);
if (listcount(pnc->rp_list))
pim_update_rp_nh(pim, pnc);
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index 239536118..1ad4b33a7 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -868,7 +868,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)
"%s: Nexthop cache not found for RP %s grp %s register with Zebra",
__PRETTY_FUNCTION__, buf, buf1);
}
- pim_rpf_set_refresh_time();
+ pim_rpf_set_refresh_time(pim);
pim_nexthop_lookup(pim, &rp_info->rp.source_nexthop,
rp_info->rp.rpf_addr.u.prefix4, 1);
}
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c
index b5d5f006f..221c1ee4a 100644
--- a/pimd/pim_rpf.c
+++ b/pimd/pim_rpf.c
@@ -37,17 +37,15 @@
#include "pim_nht.h"
#include "pim_oil.h"
-static long long last_route_change_time = -1;
-long long nexthop_lookups_avoided = 0;
-
static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up);
-void pim_rpf_set_refresh_time(void)
+void pim_rpf_set_refresh_time(struct pim_instance *pim)
{
- last_route_change_time = pim_time_monotonic_usec();
+ pim->last_route_change_time = pim_time_monotonic_usec();
if (PIM_DEBUG_TRACE)
- zlog_debug("%s: New last route change time: %lld",
- __PRETTY_FUNCTION__, last_route_change_time);
+ zlog_debug("%s: vrf(%s) New last route change time: %" PRId64,
+ __PRETTY_FUNCTION__, pim->vrf->name,
+ pim->last_route_change_time);
}
int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
@@ -70,7 +68,7 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
return -1;
if ((nexthop->last_lookup.s_addr == addr.s_addr)
- && (nexthop->last_lookup_time > last_route_change_time)) {
+ && (nexthop->last_lookup_time > pim->last_route_change_time)) {
if (PIM_DEBUG_TRACE) {
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str,
@@ -79,12 +77,12 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
pim_addr_dump("<nexthop?>", &nexthop->mrib_nexthop_addr,
nexthop_str, sizeof(nexthop_str));
zlog_debug(
- "%s: Using last lookup for %s at %lld, %lld addr%s",
+ "%s: Using last lookup for %s at %lld, %" PRId64 " addr%s",
__PRETTY_FUNCTION__, addr_str,
nexthop->last_lookup_time,
- last_route_change_time, nexthop_str);
+ pim->last_route_change_time, nexthop_str);
}
- nexthop_lookups_avoided++;
+ pim->nexthop_lookups_avoided++;
return 0;
} else {
if (PIM_DEBUG_TRACE) {
@@ -92,10 +90,10 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
zlog_debug(
- "%s: Looking up: %s, last lookup time: %lld, %lld",
+ "%s: Looking up: %s, last lookup time: %lld, %" PRId64,
__PRETTY_FUNCTION__, addr_str,
nexthop->last_lookup_time,
- last_route_change_time);
+ pim->last_route_change_time);
}
}
diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h
index 86032f1c2..78bbfc7ed 100644
--- a/pimd/pim_rpf.h
+++ b/pimd/pim_rpf.h
@@ -56,8 +56,6 @@ enum pim_rpf_result { PIM_RPF_OK = 0, PIM_RPF_CHANGED, PIM_RPF_FAILURE };
struct pim_upstream;
-extern long long nexthop_lookups_avoided;
-
unsigned int pim_rpf_hash_key(void *arg);
int pim_rpf_equal(const void *arg1, const void *arg2);
@@ -71,5 +69,5 @@ int pim_rpf_addr_is_inaddr_none(struct pim_rpf *rpf);
int pim_rpf_addr_is_inaddr_any(struct pim_rpf *rpf);
int pim_rpf_is_same(struct pim_rpf *rpf1, struct pim_rpf *rpf2);
-void pim_rpf_set_refresh_time(void);
+void pim_rpf_set_refresh_time(struct pim_instance *pim);
#endif /* PIM_RPF_H */
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index ef9d9068f..6cce69720 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -637,8 +637,8 @@ void pim_scan_oil(struct pim_instance *pim)
ifindex_t ifindex;
int vif_index = 0;
- qpim_scan_oil_last = pim_time_monotonic_sec();
- ++qpim_scan_oil_events;
+ pim->scan_oil_last = pim_time_monotonic_sec();
+ ++pim->scan_oil_events;
for (ALL_LIST_ELEMENTS(pim->channel_oil_list, node, nextnode, c_oil)) {
if (c_oil->up && c_oil->up->rpf.source_nexthop.interface) {
@@ -665,8 +665,8 @@ static int on_rpf_cache_refresh(struct thread *t)
/* update kernel multicast forwarding cache (MFC) */
pim_scan_oil(pim);
- qpim_rpf_cache_refresh_last = pim_time_monotonic_sec();
- ++qpim_rpf_cache_refresh_events;
+ pim->rpf_cache_refresh_last = pim_time_monotonic_sec();
+ ++pim->rpf_cache_refresh_events;
// It is called as part of pim_neighbor_add
// pim_rp_setup ();
@@ -675,9 +675,9 @@ static int on_rpf_cache_refresh(struct thread *t)
void sched_rpf_cache_refresh(struct pim_instance *pim)
{
- ++qpim_rpf_cache_refresh_requests;
+ ++pim->rpf_cache_refresh_requests;
- pim_rpf_set_refresh_time();
+ pim_rpf_set_refresh_time(pim);
if (pim->rpf_cache_refresher) {
/* Refresh timer is already running */
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index 8006148f9..275baedf7 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -352,7 +352,7 @@ int zclient_lookup_nexthop(struct pim_instance *pim,
uint32_t route_metric = 0xFFFFFFFF;
uint8_t protocol_distance = 0xFF;
- qpim_nexthop_lookups++;
+ pim->nexthop_lookups++;
for (lookup = 0; lookup < max_lookup; ++lookup) {
int num_ifindex;
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 0532ce873..551f6047d 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -52,12 +52,6 @@ int qpim_t_periodic =
PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
struct pim_assert_metric qpim_infinite_assert_metric;
long qpim_rpf_cache_refresh_delay_msec = 50;
-int64_t qpim_rpf_cache_refresh_requests = 0;
-int64_t qpim_rpf_cache_refresh_events = 0;
-int64_t qpim_rpf_cache_refresh_last = 0;
-int64_t qpim_scan_oil_events = 0;
-int64_t qpim_scan_oil_last = 0;
-int64_t qpim_nexthop_lookups = 0;
int qpim_packet_process = PIM_DEFAULT_PACKET_PROCESS;
uint8_t qpim_ecmp_enable = 0;
uint8_t qpim_ecmp_rebalance_enable = 0;
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 89582b991..840e0d7e3 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -140,12 +140,6 @@ struct in_addr qpim_all_pim_routers_addr;
int qpim_t_periodic; /* Period between Join/Prune Messages */
struct pim_assert_metric qpim_infinite_assert_metric;
long qpim_rpf_cache_refresh_delay_msec;
-int64_t qpim_rpf_cache_refresh_requests;
-int64_t qpim_rpf_cache_refresh_events;
-int64_t qpim_rpf_cache_refresh_last;
-int64_t qpim_scan_oil_events;
-int64_t qpim_scan_oil_last;
-int64_t qpim_nexthop_lookups;
extern int qpim_packet_process;
extern uint8_t qpim_ecmp_enable;
extern uint8_t qpim_ecmp_rebalance_enable;