0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-18 17:18:42 +00:00

Also next hop update routines are corking themselves when congestion is detected

This commit is contained in:
Maria Matejka 2022-08-02 17:51:58 +02:00
parent 449cd471ad
commit db9153e216
2 changed files with 36 additions and 0 deletions

View File

@ -2392,6 +2392,22 @@ rt_event(void *ptr)
if (tab->export_used) if (tab->export_used)
rt_export_cleanup(tab); rt_export_cleanup(tab);
if (
tab->hcu_corked ||
tab->nhu_corked ||
(tab->hcu_scheduled || tab->nhu_state) && rt_cork_check(tab->uncork_event)
)
{
if (!tab->hcu_corked && !tab->nhu_corked && config->table_debug)
log(L_TRACE "%s: Auxiliary routines corked", tab->name);
tab->hcu_corked |= tab->hcu_scheduled;
tab->hcu_scheduled = 0;
tab->nhu_corked |= tab->nhu_state;
tab->nhu_state = 0;
}
if (tab->hcu_scheduled) if (tab->hcu_scheduled)
rt_update_hostcache(tab); rt_update_hostcache(tab);
@ -2404,6 +2420,22 @@ rt_event(void *ptr)
rt_unlock_table(tab); rt_unlock_table(tab);
} }
static void
rt_uncork_event(void *ptr)
{
rtable *tab = ptr;
tab->hcu_scheduled |= tab->hcu_corked;
tab->hcu_corked = 0;
tab->nhu_state |= tab->nhu_corked;
tab->nhu_corked = 0;
if (config->table_debug)
log(L_TRACE "%s: Auxiliary routines uncorked", tab->name);
ev_schedule(tab->rt_event);
}
static void static void
rt_prune_timer(timer *t) rt_prune_timer(timer *t)
@ -2669,6 +2701,7 @@ rt_setup(pool *pp, struct rtable_config *cf)
init_list(&t->subscribers); init_list(&t->subscribers);
t->rt_event = ev_new_init(p, rt_event, t); t->rt_event = ev_new_init(p, rt_event, t);
t->uncork_event = ev_new_init(p, rt_uncork_event, t);
t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0); t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0);
t->exporter.export_timer = tm_new_init(p, rt_announce_exports, t, 0, 0); t->exporter.export_timer = tm_new_init(p, rt_announce_exports, t, 0, 0);
t->last_rt_change = t->gc_time = current_time(); t->last_rt_change = t->gc_time = current_time();

View File

@ -107,6 +107,7 @@ typedef struct rtable {
* obstacle from this routing table. * obstacle from this routing table.
*/ */
struct event *rt_event; /* Routing table event */ struct event *rt_event; /* Routing table event */
struct event *uncork_event; /* Called when uncork happens */
struct timer *prune_timer; /* Timer for periodic pruning / GC */ struct timer *prune_timer; /* Timer for periodic pruning / GC */
btime last_rt_change; /* Last time when route changed */ btime last_rt_change; /* Last time when route changed */
btime base_settle_time; /* Start time of rtable settling interval */ btime base_settle_time; /* Start time of rtable settling interval */
@ -115,7 +116,9 @@ typedef struct rtable {
byte prune_state; /* Table prune state, 1 -> scheduled, 2-> running */ byte prune_state; /* Table prune state, 1 -> scheduled, 2-> running */
byte prune_trie; /* Prune prefix trie during next table prune */ byte prune_trie; /* Prune prefix trie during next table prune */
byte hcu_scheduled; /* Hostcache update is scheduled */ byte hcu_scheduled; /* Hostcache update is scheduled */
byte hcu_corked; /* Hostcache update is corked with this state */
byte nhu_state; /* Next Hop Update state */ byte nhu_state; /* Next Hop Update state */
byte nhu_corked; /* Next Hop Update is corked with this state */
byte export_used; /* Pending Export pruning is scheduled */ byte export_used; /* Pending Export pruning is scheduled */
byte cork_active; /* Cork has been activated */ byte cork_active; /* Cork has been activated */
struct rt_cork_threshold cork_threshold; /* Threshold for table cork */ struct rt_cork_threshold cork_threshold; /* Threshold for table cork */