summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorNaveen Thanikachalam <nthanikachal@vmware.com>2019-08-11 13:24:15 +0200
committerNaveen Thanikachalam <nthanikachal@vmware.com>2019-08-12 09:51:46 +0200
commit47c8fa1f875ed1c8e2907c9ffe9c25ab69436ca1 (patch)
tree397a4c73530d68850de0da36a0a8eaa89e2f5e57 /bgpd
parentMerge pull request #4803 from ddutt/master (diff)
downloadfrr-47c8fa1f875ed1c8e2907c9ffe9c25ab69436ca1.tar.xz
frr-47c8fa1f875ed1c8e2907c9ffe9c25ab69436ca1.zip
bgpd: Optimizing route-map's processing of dependencies.
Say for eg., 256 prefix-list entries are pasted to VTYSH. This results in BGP processing the events for several minutes. BGPD starts a timer for 5 seconds when the first dependency configuraion is received. On timer expiry, BGP process dependent route-maps. After this processing, BGPD reads the configurations received in the next 5 seconds and then re-processes the route-maps from the beginning. This cyclic re-processing consumes time and CPU cycles. Instead of starting a timer when the first configuration is received, everytime a configuration is received, the existing timer is reset. This would mean that all the configurations are read first before the timer expires. This eliminates the cyclic re-processing. Signed-off-by: NaveenThanikachalam nthanikachal@vmware.com
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_routemap.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 5ffc416dc..7f1a9b71c 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -3406,31 +3406,34 @@ int bgp_route_map_update_timer(struct thread *thread)
static void bgp_route_map_mark_update(const char *rmap_name)
{
- if (bm->t_rmap_update == NULL) {
- struct listnode *node, *nnode;
- struct bgp *bgp;
-
- /* rmap_update_timer of 0 means don't do route updates */
- if (bm->rmap_update_timer) {
- bm->t_rmap_update = NULL;
- thread_add_timer(bm->master, bgp_route_map_update_timer,
- NULL, bm->rmap_update_timer,
- &bm->t_rmap_update);
-
- /* Signal the groups that a route-map update event has
- * started */
- for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
- update_group_policy_update(bgp,
- BGP_POLICY_ROUTE_MAP,
- rmap_name, 1, 1);
- } else {
- for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
- bgp_route_map_process_update(bgp, rmap_name, 0);
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+
+ /* If new update is received before the current timer timed out,
+ * turn it off and start a new timer.
+ */
+ if (bm->t_rmap_update != NULL)
+ THREAD_OFF(bm->t_rmap_update);
+
+ /* rmap_update_timer of 0 means don't do route updates */
+ if (bm->rmap_update_timer) {
+ thread_add_timer(bm->master, bgp_route_map_update_timer,
+ NULL, bm->rmap_update_timer,
+ &bm->t_rmap_update);
+
+ /* Signal the groups that a route-map update event has
+ * started */
+ for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
+ update_group_policy_update(bgp,
+ BGP_POLICY_ROUTE_MAP,
+ rmap_name, 1, 1);
+ } else {
+ for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp))
+ bgp_route_map_process_update(bgp, rmap_name, 0);
#if ENABLE_BGP_VNC
- zlog_debug("%s: calling vnc_routemap_update", __func__);
- vnc_routemap_update(bgp, __func__);
+ zlog_debug("%s: calling vnc_routemap_update", __func__);
+ vnc_routemap_update(bgp, __func__);
#endif
- }
}
}