]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Babel now runs in the worker thread babel-in-threads
authorMaria Matejka <mq@ucw.cz>
Sat, 13 Apr 2024 13:55:52 +0000 (15:55 +0200)
committerMaria Matejka <mq@ucw.cz>
Sat, 13 Apr 2024 13:55:52 +0000 (15:55 +0200)
proto/babel/babel.c
proto/babel/config.Y
proto/babel/packets.c

index e215977dee3359ebd4b481e53b36a6139705750d..c49870aef798e2bdbbbb20fc2343dd2e26632394 100644 (file)
@@ -1752,14 +1752,14 @@ babel_iface_timer(timer *t)
 
   btime next_event = MIN(ifa->next_hello, ifa->next_regular);
   if (ifa->want_triggered) next_event = MIN(next_event, ifa->next_triggered);
-  tm_set(ifa->timer, next_event);
+  tm_set_in(ifa->timer, next_event, p->p.loop);
 }
 
 static inline void
 babel_iface_kick_timer(struct babel_iface *ifa)
 {
   if (ifa->timer->expires > (current_time() + 100 MS))
-    tm_start(ifa->timer, 100 MS);
+    tm_start_in(ifa->timer, 100 MS, ifa->proto->p.loop);
 }
 
 static void
@@ -1773,7 +1773,7 @@ babel_iface_start(struct babel_iface *ifa)
   ifa->next_regular = current_time() + (random() % ifa->cf->update_interval);
   ifa->next_triggered = current_time() + MIN(1 S, ifa->cf->update_interval / 2);
   ifa->want_triggered = 0;     /* We send an immediate update (below) */
-  tm_start(ifa->timer, 100 MS);
+  tm_start_in(ifa->timer, 100 MS, p->p.loop);
   ifa->up = 1;
 
   babel_send_hello(ifa, 0);
@@ -1938,7 +1938,7 @@ babel_add_iface(struct babel_proto *p, struct iface *new, struct babel_iface_con
     .hook = babel_iface_locked,
     .data = ifa,
   };
-  lock->target = &global_event_list;
+  lock->target = birdloop_event_list(p->p.loop);
 
   olock_acquire(lock);
 }
@@ -2416,7 +2416,7 @@ static inline void
 babel_kick_timer(struct babel_proto *p)
 {
   if (p->timer->expires > (current_time() + 100 MS))
-    tm_start(p->timer, 100 MS);
+    tm_start_in(p->timer, 100 MS, p->p.loop);
 }
 
 
@@ -2630,7 +2630,7 @@ babel_start(struct proto *P)
 
   init_list(&p->interfaces);
   p->timer = tm_new_init(P->pool, babel_timer, p, 1 S, 0);
-  tm_start(p->timer, 1 S);
+  tm_start_in(p->timer, 1 S, p->p.loop);
   p->update_seqno = 1;
   p->router_id = proto_get_router_id(&cf->c);
 
index 6a7c071f951751e0a3050199670625ffd4bd512e..06b8d98c14c6bdd9b5cc72e5b7af82936c04c132 100644 (file)
@@ -35,6 +35,7 @@ proto: babel_proto ;
 babel_proto_start: proto_start BABEL
 {
   this_proto = proto_config_new(&proto_babel, $1);
+  this_proto->loop_order = DOMAIN_ORDER(proto);
   init_list(&BABEL_CFG->iface_list);
   BABEL_CFG->hold_time = 1 S_;
 };
index 1c784c2135226421121b6c216a0c8702037429d2..23e3ed50d9f3789ae9a012e598e04a9cba6ecd5e 100644 (file)
@@ -1533,7 +1533,7 @@ babel_kick_queue(struct babel_iface *ifa)
    */
 
   if ((ifa->sk->tpos == ifa->sk->tbuf) && !ev_active(ifa->send_event))
-    ev_schedule(ifa->send_event);
+    ev_send_loop(ifa->proto->p.loop, ifa->send_event);
 }
 
 /**