0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-02 23:21:54 +00:00

Next hop update is split by time, not by number of routes

This commit is contained in:
Maria Matejka 2024-06-10 14:17:28 +02:00
parent 2e882d4a7d
commit ab1697d7a0

View File

@ -3916,7 +3916,7 @@ rt_flowspec_resolve_rte(rte *r, struct channel *c)
#endif #endif
} }
static inline int static inline void
rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n) rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n)
{ {
uint count = 0; uint count = 0;
@ -3924,13 +3924,13 @@ rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n)
struct rte_storage *old_best = NET_BEST_ROUTE(tab, n); struct rte_storage *old_best = NET_BEST_ROUTE(tab, n);
if (!old_best) if (!old_best)
return 0; return;
NET_WALK_ROUTES(tab, n, ep, e) NET_WALK_ROUTES(tab, n, ep, e)
count++; count++;
if (!count) if (!count)
return 0; return;
struct rte_multiupdate { struct rte_multiupdate {
struct rte_storage *old, *new_stored; struct rte_storage *old, *new_stored;
@ -3951,7 +3951,7 @@ rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n)
mod += rt_next_hop_update_rte(&updates[i].old->rte, &updates[i].new); mod += rt_next_hop_update_rte(&updates[i].old->rte, &updates[i].new);
if (!mod) if (!mod)
return 0; return;
/* We add a spinlock sentinel to the beginning */ /* We add a spinlock sentinel to the beginning */
struct rte_storage local_sentinel = { struct rte_storage local_sentinel = {
@ -4095,7 +4095,7 @@ rt_next_hop_update_net(struct rtable_private *tab, struct netindex *ni, net *n)
/* Now we can finally release the changes back into the table */ /* Now we can finally release the changes back into the table */
atomic_store_explicit(&n->routes, new_best, memory_order_release); atomic_store_explicit(&n->routes, new_best, memory_order_release);
return total; return;
} }
static void static void
@ -4144,8 +4144,6 @@ rt_next_hop_update(void *_tab)
return; return;
} }
int max_feed = 32;
/* Initialize a new run */ /* Initialize a new run */
if (tab->nhu_state == NHU_SCHEDULED) if (tab->nhu_state == NHU_SCHEDULED)
{ {
@ -4166,14 +4164,11 @@ rt_next_hop_update(void *_tab)
if (!s) if (!s)
continue; continue;
if (max_feed <= 0) MAYBE_DEFER_TASK(birdloop_event_list(tab->loop), tab->nhu_event,
{ "next hop updater in %s", tab->name);
ev_send_loop(tab->loop, tab->nhu_event);
return;
}
TMP_SAVED TMP_SAVED
max_feed -= rt_next_hop_update_net(tab, RTE_GET_NETINDEX(&s->rte), n); rt_next_hop_update_net(tab, RTE_GET_NETINDEX(&s->rte), n);
} }
/* Finished NHU, cleanup */ /* Finished NHU, cleanup */