diff --git a/babeld/babeld.c b/babeld/babeld.c index 1cd913c766..7bcf8b9a78 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -148,9 +148,11 @@ babel_create_routing_process (void) } /* Threads. */ - thread_add_read(master, babel_read_protocol, NULL, protocol_socket, &babel_routing_process->t_read); + event_add_read(master, babel_read_protocol, NULL, protocol_socket, + &babel_routing_process->t_read); /* wait a little: zebra will announce interfaces, addresses, routes... */ - thread_add_timer_msec(master, babel_init_routing_process, NULL, 200L, &babel_routing_process->t_update); + event_add_timer_msec(master, babel_init_routing_process, NULL, 200L, + &babel_routing_process->t_update); /* Distribute list install. */ babel_routing_process->distribute_ctx = distribute_list_ctx_create (vrf_lookup_by_id(VRF_DEFAULT)); @@ -193,7 +195,8 @@ static void babel_read_protocol(struct event *thread) } /* re-add thread */ - thread_add_read(master, &babel_read_protocol, NULL, protocol_socket, &babel_routing_process->t_read); + event_add_read(master, &babel_read_protocol, NULL, protocol_socket, + &babel_routing_process->t_read); } /* Zebra will give some information, especially about interfaces. This function @@ -483,7 +486,8 @@ babel_set_timer(struct timeval *timeout) { long msecs = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; thread_cancel(&(babel_routing_process->t_update)); - thread_add_timer_msec(master, babel_main_loop, NULL, msecs, &babel_routing_process->t_update); + event_add_timer_msec(master, babel_main_loop, NULL, msecs, + &babel_routing_process->t_update); } void diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 0ca2ca1f02..184dfbc8f9 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1957,23 +1957,23 @@ static int bfd_vrf_enable(struct vrf *vrf) bvrf->bg_echov6 = bp_echov6_socket(vrf); if (!bvrf->bg_ev[0] && bvrf->bg_shop != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop, - &bvrf->bg_ev[0]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop, + &bvrf->bg_ev[0]); if (!bvrf->bg_ev[1] && bvrf->bg_mhop != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop, - &bvrf->bg_ev[1]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop, + &bvrf->bg_ev[1]); if (!bvrf->bg_ev[2] && bvrf->bg_shop6 != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6, - &bvrf->bg_ev[2]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6, + &bvrf->bg_ev[2]); if (!bvrf->bg_ev[3] && bvrf->bg_mhop6 != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6, - &bvrf->bg_ev[3]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6, + &bvrf->bg_ev[3]); if (!bvrf->bg_ev[4] && bvrf->bg_echo != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo, - &bvrf->bg_ev[4]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo, + &bvrf->bg_ev[4]); if (!bvrf->bg_ev[5] && bvrf->bg_echov6 != -1) - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6, - &bvrf->bg_ev[5]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6, + &bvrf->bg_ev[5]); if (vrf->vrf_id != VRF_DEFAULT) { bfdd_zclient_register(vrf->vrf_id); diff --git a/bfdd/bfd_packet.c b/bfdd/bfd_packet.c index 05ed2702d0..2e7bd835fb 100644 --- a/bfdd/bfd_packet.c +++ b/bfdd/bfd_packet.c @@ -702,28 +702,28 @@ static void bfd_sd_reschedule(struct bfd_vrf_global *bvrf, int sd) { if (sd == bvrf->bg_shop) { THREAD_OFF(bvrf->bg_ev[0]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop, - &bvrf->bg_ev[0]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop, + &bvrf->bg_ev[0]); } else if (sd == bvrf->bg_mhop) { THREAD_OFF(bvrf->bg_ev[1]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop, - &bvrf->bg_ev[1]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop, + &bvrf->bg_ev[1]); } else if (sd == bvrf->bg_shop6) { THREAD_OFF(bvrf->bg_ev[2]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6, - &bvrf->bg_ev[2]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6, + &bvrf->bg_ev[2]); } else if (sd == bvrf->bg_mhop6) { THREAD_OFF(bvrf->bg_ev[3]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6, - &bvrf->bg_ev[3]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6, + &bvrf->bg_ev[3]); } else if (sd == bvrf->bg_echo) { THREAD_OFF(bvrf->bg_ev[4]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo, - &bvrf->bg_ev[4]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo, + &bvrf->bg_ev[4]); } else if (sd == bvrf->bg_echov6) { THREAD_OFF(bvrf->bg_ev[5]); - thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6, - &bvrf->bg_ev[5]); + event_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6, + &bvrf->bg_ev[5]); } } diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c index a3751e4d33..77d66ae104 100644 --- a/bfdd/bfdd.c +++ b/bfdd/bfdd.c @@ -375,8 +375,8 @@ int main(int argc, char *argv[]) /* Initialize zebra connection. */ bfdd_zclient_init(&bglobal.bfdd_privs); - thread_add_read(master, control_accept, NULL, bglobal.bg_csock, - &bglobal.bg_csockev); + event_add_read(master, control_accept, NULL, bglobal.bg_csock, + &bglobal.bg_csockev); /* Install commands. */ bfdd_vty_init(); diff --git a/bfdd/control.c b/bfdd/control.c index db9778a8eb..95e0ef3d60 100644 --- a/bfdd/control.c +++ b/bfdd/control.c @@ -154,7 +154,7 @@ void control_accept(struct event *t) control_new(csock); - thread_add_read(master, control_accept, NULL, sd, &bglobal.bg_csockev); + event_add_read(master, control_accept, NULL, sd, &bglobal.bg_csockev); } @@ -171,7 +171,7 @@ struct bfd_control_socket *control_new(int sd) bcs->bcs_notify = 0; bcs->bcs_sd = sd; - thread_add_read(master, control_read, bcs, sd, &bcs->bcs_ev); + event_add_read(master, control_read, bcs, sd, &bcs->bcs_ev); TAILQ_INIT(&bcs->bcs_bcqueue); TAILQ_INIT(&bcs->bcs_bnplist); @@ -286,8 +286,8 @@ static int control_queue_dequeue(struct bfd_control_socket *bcs) bcs->bcs_bout = &bcq->bcq_bcb; bcs->bcs_outev = NULL; - thread_add_write(master, control_write, bcs, bcs->bcs_sd, - &bcs->bcs_outev); + event_add_write(master, control_write, bcs, bcs->bcs_sd, + &bcs->bcs_outev); return 1; @@ -315,8 +315,8 @@ static int control_queue_enqueue(struct bfd_control_socket *bcs, bcs->bcs_bout = bcb; /* New messages, active write events. */ - thread_add_write(master, control_write, bcs, bcs->bcs_sd, - &bcs->bcs_outev); + event_add_write(master, control_write, bcs, bcs->bcs_sd, + &bcs->bcs_outev); } return 0; @@ -511,7 +511,7 @@ skip_header: schedule_next_read: bcs->bcs_ev = NULL; - thread_add_read(master, control_read, bcs, sd, &bcs->bcs_ev); + event_add_read(master, control_read, bcs, sd, &bcs->bcs_ev); } static void control_write(struct event *t) @@ -529,8 +529,8 @@ static void control_write(struct event *t) if (bwrite < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { bcs->bcs_outev = NULL; - thread_add_write(master, control_write, bcs, - bcs->bcs_sd, &bcs->bcs_outev); + event_add_write(master, control_write, bcs, bcs->bcs_sd, + &bcs->bcs_outev); return; } @@ -543,8 +543,8 @@ static void control_write(struct event *t) bcb->bcb_left -= bwrite; if (bcb->bcb_left > 0) { bcs->bcs_outev = NULL; - thread_add_write(master, control_write, bcs, bcs->bcs_sd, - &bcs->bcs_outev); + event_add_write(master, control_write, bcs, bcs->bcs_sd, + &bcs->bcs_outev); return; } diff --git a/bfdd/dplane.c b/bfdd/dplane.c index b2c52f543f..7bdebfa1f4 100644 --- a/bfdd/dplane.c +++ b/bfdd/dplane.c @@ -429,8 +429,8 @@ static int bfd_dplane_enqueue(struct bfd_dplane_ctx *bdc, const void *buf, /* Schedule if it is not yet. */ if (bdc->outbufev == NULL) - thread_add_write(master, bfd_dplane_write, bdc, bdc->sock, - &bdc->outbufev); + event_add_write(master, bfd_dplane_write, bdc, bdc->sock, + &bdc->outbufev); return 0; } @@ -609,7 +609,7 @@ static void bfd_dplane_read(struct event *t) return; stream_pulldown(bdc->inbuf); - thread_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev); + event_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev); } static void _bfd_session_register_dplane(struct hash_bucket *hb, void *arg) @@ -641,7 +641,7 @@ static struct bfd_dplane_ctx *bfd_dplane_ctx_new(int sock) if (sock == -1) return bdc; - thread_add_read(master, bfd_dplane_read, bdc, sock, &bdc->inbufev); + event_add_read(master, bfd_dplane_read, bdc, sock, &bdc->inbufev); /* Register all unattached sessions. */ bfd_key_iterate(_bfd_session_register_dplane, bdc); @@ -682,8 +682,8 @@ static void bfd_dplane_ctx_free(struct bfd_dplane_ctx *bdc) socket_close(&bdc->sock); THREAD_OFF(bdc->inbufev); THREAD_OFF(bdc->outbufev); - thread_add_timer(master, bfd_dplane_client_connect, bdc, 3, - &bdc->connectev); + event_add_timer(master, bfd_dplane_client_connect, bdc, 3, + &bdc->connectev); return; } @@ -840,8 +840,8 @@ static void bfd_dplane_accept(struct event *t) zlog_debug("%s: new data plane client connected", __func__); reschedule_and_return: - thread_add_read(master, bfd_dplane_accept, bg, bg->bg_dplane_sock, - &bglobal.bg_dplane_sockev); + event_add_read(master, bfd_dplane_accept, bg, bg->bg_dplane_sock, + &bglobal.bg_dplane_sockev); } /* @@ -856,7 +856,7 @@ static void _bfd_dplane_client_bootstrap(struct bfd_dplane_ctx *bdc) stream_reset(bdc->outbuf); /* Ask for read notifications. */ - thread_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev); + event_add_read(master, bfd_dplane_read, bdc, bdc->sock, &bdc->inbufev); /* Remove all sessions then register again to send them all. */ bfd_key_iterate(_bfd_session_unregister_dplane, bdc); @@ -938,8 +938,8 @@ static void bfd_dplane_client_connect(struct event *t) /* If we are not connected yet, ask for write notifications. */ bdc->connecting = true; - thread_add_write(master, bfd_dplane_write, bdc, bdc->sock, - &bdc->outbufev); + event_add_write(master, bfd_dplane_write, bdc, bdc->sock, + &bdc->outbufev); } else { if (bglobal.debug_dplane) zlog_debug("%s: server connection: %d", __func__, sock); @@ -952,8 +952,8 @@ reschedule_connect: THREAD_OFF(bdc->inbufev); THREAD_OFF(bdc->outbufev); socket_close(&sock); - thread_add_timer(master, bfd_dplane_client_connect, bdc, 3, - &bdc->connectev); + event_add_timer(master, bfd_dplane_client_connect, bdc, 3, + &bdc->connectev); } static void bfd_dplane_client_init(const struct sockaddr *sa, socklen_t salen) @@ -974,8 +974,8 @@ static void bfd_dplane_client_init(const struct sockaddr *sa, socklen_t salen) bdc->client = true; - thread_add_timer(master, bfd_dplane_client_connect, bdc, 0, - &bdc->connectev); + event_add_timer(master, bfd_dplane_client_connect, bdc, 0, + &bdc->connectev); /* Insert into data plane lists. */ TAILQ_INSERT_TAIL(&bglobal.bg_dplaneq, bdc, entry); @@ -1067,8 +1067,8 @@ void bfd_dplane_init(const struct sockaddr *sa, socklen_t salen, bool client) } bglobal.bg_dplane_sock = sock; - thread_add_read(master, bfd_dplane_accept, &bglobal, sock, - &bglobal.bg_dplane_sockev); + event_add_read(master, bfd_dplane_accept, &bglobal, sock, + &bglobal.bg_dplane_sockev); } int bfd_dplane_add_session(struct bfd_session *bs) diff --git a/bfdd/event.c b/bfdd/event.c index 5a9ae39c3e..c6326ef91f 100644 --- a/bfdd/event.c +++ b/bfdd/event.c @@ -36,8 +36,8 @@ void bfd_recvtimer_update(struct bfd_session *bs) tv_normalize(&tv); - thread_add_timer_tv(master, bfd_recvtimer_cb, bs, &tv, - &bs->recvtimer_ev); + event_add_timer_tv(master, bfd_recvtimer_cb, bs, &tv, + &bs->recvtimer_ev); } void bfd_echo_recvtimer_update(struct bfd_session *bs) @@ -54,8 +54,8 @@ void bfd_echo_recvtimer_update(struct bfd_session *bs) tv_normalize(&tv); - thread_add_timer_tv(master, bfd_echo_recvtimer_cb, bs, &tv, - &bs->echo_recvtimer_ev); + event_add_timer_tv(master, bfd_echo_recvtimer_cb, bs, &tv, + &bs->echo_recvtimer_ev); } void bfd_xmttimer_update(struct bfd_session *bs, uint64_t jitter) @@ -72,7 +72,7 @@ void bfd_xmttimer_update(struct bfd_session *bs, uint64_t jitter) tv_normalize(&tv); - thread_add_timer_tv(master, bfd_xmt_cb, bs, &tv, &bs->xmttimer_ev); + event_add_timer_tv(master, bfd_xmt_cb, bs, &tv, &bs->xmttimer_ev); } void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter) @@ -89,8 +89,8 @@ void bfd_echo_xmttimer_update(struct bfd_session *bs, uint64_t jitter) tv_normalize(&tv); - thread_add_timer_tv(master, bfd_echo_xmt_cb, bs, &tv, - &bs->echo_xmttimer_ev); + event_add_timer_tv(master, bfd_echo_xmt_cb, bs, &tv, + &bs->echo_xmttimer_ev); } void bfd_recvtimer_delete(struct bfd_session *bs) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 1cce0d7df6..474ec0622c 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1344,8 +1344,8 @@ static void bmp_stats(struct event *thread) struct timeval tv; if (bt->stat_msec) - thread_add_timer_msec(bm->master, bmp_stats, bt, bt->stat_msec, - &bt->t_stats); + event_add_timer_msec(bm->master, bmp_stats, bt, bt->stat_msec, + &bt->t_stats); gettimeofday(&tv, NULL); @@ -1409,7 +1409,7 @@ static void bmp_read(struct event *t) return; } - thread_add_read(bm->master, bmp_read, bmp, bmp->socket, &bmp->t_read); + event_add_read(bm->master, bmp_read, bmp, bmp->socket, &bmp->t_read); } static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) @@ -1485,7 +1485,7 @@ static struct bmp *bmp_open(struct bmp_targets *bt, int bmp_sock) bmp->state = BMP_PeerUp; bmp->pullwr = pullwr_new(bm->master, bmp_sock, bmp, bmp_wrfill, bmp_wrerr); - thread_add_read(bm->master, bmp_read, bmp, bmp_sock, &bmp->t_read); + event_add_read(bm->master, bmp_read, bmp, bmp_sock, &bmp->t_read); bmp_send_initiation(bmp); return bmp; @@ -1499,7 +1499,7 @@ static void bmp_accept(struct event *thread) int bmp_sock; /* We continue hearing BMP socket. */ - thread_add_read(bm->master, bmp_accept, bl, bl->sock, &bl->t_accept); + event_add_read(bm->master, bmp_accept, bl, bl->sock, &bl->t_accept); memset(&su, 0, sizeof(union sockunion)); @@ -1721,7 +1721,7 @@ static void bmp_listener_start(struct bmp_listener *bl) goto out_sock; bl->sock = sock; - thread_add_read(bm->master, bmp_accept, bl, sock, &bl->t_accept); + event_add_read(bm->master, bmp_accept, bl, sock, &bl->t_accept); return; out_sock: close(sock); @@ -1980,12 +1980,12 @@ static void bmp_active_setup(struct bmp_active *ba) ba->curretry = ba->maxretry; if (ba->socket == -1) - thread_add_timer_msec(bm->master, bmp_active_thread, ba, - ba->curretry, &ba->t_timer); + event_add_timer_msec(bm->master, bmp_active_thread, ba, + ba->curretry, &ba->t_timer); else { - thread_add_read(bm->master, bmp_active_thread, ba, ba->socket, - &ba->t_read); - thread_add_write(bm->master, bmp_active_thread, ba, ba->socket, + event_add_read(bm->master, bmp_active_thread, ba, ba->socket, + &ba->t_read); + event_add_write(bm->master, bmp_active_thread, ba, ba->socket, &ba->t_write); } } @@ -2199,8 +2199,8 @@ DEFPY(bmp_stats_cfg, bt->stat_msec = BMP_STAT_DEFAULT_TIMER; if (bt->stat_msec) - thread_add_timer_msec(bm->master, bmp_stats, bt, bt->stat_msec, - &bt->t_stats); + event_add_timer_msec(bm->master, bmp_stats, bt, bt->stat_msec, + &bt->t_stats); return CMD_SUCCESS; } diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index 9818538454..32ff4bf2e4 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -168,8 +168,8 @@ static void bgp_conditional_adv_timer(struct event *t) bgp = THREAD_ARG(t); assert(bgp); - thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp, - bgp->condition_check_period, &bgp->t_condition_check); + event_add_timer(bm->master, bgp_conditional_adv_timer, bgp, + bgp->condition_check_period, &bgp->t_condition_check); /* loop through each peer and check if we have peers with * advmap_table_change attribute set, to make sure we send @@ -329,8 +329,8 @@ void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi) /* Register for conditional routes polling timer */ if (!thread_is_scheduled(bgp->t_condition_check)) - thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp, 0, - &bgp->t_condition_check); + event_add_timer(bm->master, bgp_conditional_adv_timer, bgp, 0, + &bgp->t_condition_check); } void bgp_conditional_adv_disable(struct peer *peer, afi_t afi, safi_t safi) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index e8dca2a75f..b33480b63e 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -107,8 +107,8 @@ static void bgp_reuse_timer(struct event *t) struct bgp_damp_config *bdc = THREAD_ARG(t); bdc->t_reuse = NULL; - thread_add_timer(bm->master, bgp_reuse_timer, bdc, DELTA_REUSE, - &bdc->t_reuse); + event_add_timer(bm->master, bgp_reuse_timer, bdc, DELTA_REUSE, + &bdc->t_reuse); t_now = monotime(NULL); @@ -395,8 +395,8 @@ int bgp_damp_enable(struct bgp *bgp, afi_t afi, safi_t safi, time_t half, bgp_damp_parameter_set(half, reuse, suppress, max, bdc); /* Register reuse timer. */ - thread_add_timer(bm->master, bgp_reuse_timer, bdc, DELTA_REUSE, - &bdc->t_reuse); + event_add_timer(bm->master, bgp_reuse_timer, bdc, DELTA_REUSE, + &bdc->t_reuse); return 0; } diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 25e921cff2..0087de95a8 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -154,13 +154,13 @@ static int bgp_dump_interval_add(struct bgp_dump *bgp_dump, int interval) interval = interval - secs_into_day % interval; /* always > 0 */ } - thread_add_timer(bm->master, bgp_dump_interval_func, bgp_dump, - interval, &bgp_dump->t_interval); + event_add_timer(bm->master, bgp_dump_interval_func, bgp_dump, + interval, &bgp_dump->t_interval); } else { /* One-off dump: execute immediately, don't affect any scheduled * dumps */ - thread_add_event(bm->master, bgp_dump_interval_func, bgp_dump, - 0, &bgp_dump->t_interval); + event_add_event(bm->master, bgp_dump_interval_func, bgp_dump, 0, + &bgp_dump->t_interval); } return 0; diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index bdee8a2fbd..c0daae45d0 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -4174,9 +4174,9 @@ static void bgp_evpn_es_cons_checks_timer_start(void) if (BGP_DEBUG(evpn_mh, EVPN_MH_ES)) zlog_debug("periodic consistency checking started"); - thread_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL, - BGP_EVPN_CONS_CHECK_INTERVAL, - &bgp_mh_info->t_cons_check); + event_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL, + BGP_EVPN_CONS_CHECK_INTERVAL, + &bgp_mh_info->t_cons_check); } /* queue up the es for background consistency checks */ @@ -4380,7 +4380,7 @@ static void bgp_evpn_run_consistency_checks(struct event *t) } /* restart the timer */ - thread_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL, + event_add_timer(bm->master, bgp_evpn_run_consistency_checks, NULL, BGP_EVPN_CONS_CHECK_INTERVAL, &bgp_mh_info->t_cons_check); } diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 79f0444e84..001a8da1cc 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -343,8 +343,8 @@ static struct peer *peer_xfer_conn(struct peer *from_peer) bgp_reads_on(peer); bgp_writes_on(peer); - thread_add_event(bm->master, bgp_process_packet, peer, 0, - &peer->t_process_packet); + event_add_event(bm->master, bgp_process_packet, peer, 0, + &peer->t_process_packet); return (peer); } @@ -583,8 +583,8 @@ void bgp_routeadv_timer(struct event *thread) peer->synctime = monotime(NULL); - thread_add_timer_msec(bm->master, bgp_generate_updgrp_packets, peer, 0, - &peer->t_generate_updgrp_packets); + event_add_timer_msec(bm->master, bgp_generate_updgrp_packets, peer, 0, + &peer->t_generate_updgrp_packets); /* MRAI timer will be started again when FIFO is built, no need to * do it here. @@ -820,10 +820,9 @@ static void bgp_graceful_restart_timer_expire(struct event *thread) bgp_set_llgr_stale(peer, afi, safi); bgp_clear_stale_route(peer, afi, safi); - thread_add_timer(bm->master, - bgp_llgr_stale_timer_expire, paf, - peer->llgr[afi][safi].stale_time, - &peer->t_llgr_stale[afi][safi]); + event_add_timer(bm->master, bgp_llgr_stale_timer_expire, + paf, peer->llgr[afi][safi].stale_time, + &peer->t_llgr_stale[afi][safi]); for (ALL_LIST_ELEMENTS(peer->bgp->peer, node, nnode, tmp_peer)) @@ -1147,8 +1146,8 @@ static void bgp_maxmed_onstartup_begin(struct bgp *bgp) zlog_info("Begin maxmed onstartup mode - timer %d seconds", bgp->v_maxmed_onstartup); - thread_add_timer(bm->master, bgp_maxmed_onstartup_timer, bgp, - bgp->v_maxmed_onstartup, &bgp->t_maxmed_onstartup); + event_add_timer(bm->master, bgp_maxmed_onstartup_timer, bgp, + bgp->v_maxmed_onstartup, &bgp->t_maxmed_onstartup); if (!bgp->v_maxmed_admin) { bgp->maxmed_active = 1; @@ -1206,12 +1205,12 @@ static void bgp_update_delay_begin(struct bgp *bgp) peer->update_delay_over = 0; /* Start the update-delay timer */ - thread_add_timer(bm->master, bgp_update_delay_timer, bgp, - bgp->v_update_delay, &bgp->t_update_delay); + event_add_timer(bm->master, bgp_update_delay_timer, bgp, + bgp->v_update_delay, &bgp->t_update_delay); if (bgp->v_establish_wait != bgp->v_update_delay) - thread_add_timer(bm->master, bgp_establish_wait_timer, bgp, - bgp->v_establish_wait, &bgp->t_establish_wait); + event_add_timer(bm->master, bgp_establish_wait_timer, bgp, + bgp->v_establish_wait, &bgp->t_establish_wait); frr_timestamp(3, bgp->update_delay_begin_time, sizeof(bgp->update_delay_begin_time)); @@ -1941,10 +1940,10 @@ enum bgp_fsm_state_progress bgp_start(struct peer *peer) * bgp_connect_check() as the handler for each and cancel the * unused event in that function. */ - thread_add_read(bm->master, bgp_connect_check, peer, peer->fd, - &peer->t_connect_check_r); - thread_add_write(bm->master, bgp_connect_check, peer, peer->fd, - &peer->t_connect_check_w); + event_add_read(bm->master, bgp_connect_check, peer, peer->fd, + &peer->t_connect_check_r); + event_add_write(bm->master, bgp_connect_check, peer, peer->fd, + &peer->t_connect_check_w); break; } return BGP_FSM_SUCCESS; @@ -2046,9 +2045,9 @@ static int bgp_start_deferral_timer(struct bgp *bgp, afi_t afi, safi_t safi, thread_info->safi = safi; thread_info->bgp = bgp; - thread_add_timer(bm->master, bgp_graceful_deferral_timer_expire, - thread_info, bgp->select_defer_time, - &gr_info->t_select_deferral); + event_add_timer(bm->master, bgp_graceful_deferral_timer_expire, + thread_info, bgp->select_defer_time, + &gr_info->t_select_deferral); } gr_info->eor_required++; /* Send message to RIB indicating route update pending */ diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index 432072edeb..9af02436cf 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -11,14 +11,14 @@ #define BGP_TIMER_ON(T, F, V) \ do { \ if ((peer->status != Deleted)) \ - thread_add_timer(bm->master, (F), peer, (V), &(T)); \ + event_add_timer(bm->master, (F), peer, (V), &(T)); \ } while (0) #define BGP_EVENT_ADD(P, E) \ do { \ if ((P)->status != Deleted) \ - thread_add_event(bm->master, bgp_event, (P), (E), \ - NULL); \ + event_add_event(bm->master, bgp_event, (P), (E), \ + NULL); \ } while (0) #define BGP_EVENT_FLUSH(P) \ @@ -27,17 +27,18 @@ thread_cancel_event_ready(bm->master, (P)); \ } while (0) -#define BGP_UPDATE_GROUP_TIMER_ON(T, F) \ - do { \ - if (BGP_SUPPRESS_FIB_ENABLED(peer->bgp) && \ - PEER_ROUTE_ADV_DELAY(peer)) \ - thread_add_timer_msec(bm->master, (F), peer, \ - (BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME * 1000),\ - (T)); \ - else \ - thread_add_timer_msec(bm->master, (F), peer, \ - 0, (T)); \ - } while (0) \ +#define BGP_UPDATE_GROUP_TIMER_ON(T, F) \ + do { \ + if (BGP_SUPPRESS_FIB_ENABLED(peer->bgp) && \ + PEER_ROUTE_ADV_DELAY(peer)) \ + event_add_timer_msec( \ + bm->master, (F), peer, \ + (BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME * \ + 1000), \ + (T)); \ + else \ + event_add_timer_msec(bm->master, (F), peer, 0, (T)); \ + } while (0) #define BGP_MSEC_JITTER 10 diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 6b8ae84481..6af01be315 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -55,8 +55,8 @@ void bgp_writes_on(struct peer *peer) assert(!peer->t_connect_check_w); assert(peer->fd); - thread_add_write(fpt->master, bgp_process_writes, peer, peer->fd, - &peer->t_write); + event_add_write(fpt->master, bgp_process_writes, peer, peer->fd, + &peer->t_write); SET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON); } @@ -85,8 +85,8 @@ void bgp_reads_on(struct peer *peer) assert(!peer->t_connect_check_w); assert(peer->fd); - thread_add_read(fpt->master, bgp_process_reads, peer, peer->fd, - &peer->t_read); + event_add_read(fpt->master, bgp_process_reads, peer, peer->fd, + &peer->t_read); SET_FLAG(peer->thread_flags, PEER_THREAD_READS_ON); } @@ -142,8 +142,8 @@ static void bgp_process_writes(struct event *thread) * sent in the update message */ if (reschedule) { - thread_add_write(fpt->master, bgp_process_writes, peer, - peer->fd, &peer->t_write); + event_add_write(fpt->master, bgp_process_writes, peer, peer->fd, + &peer->t_write); } else if (!fatal) { BGP_UPDATE_GROUP_TIMER_ON(&peer->t_generate_updgrp_packets, bgp_generate_updgrp_packets); @@ -247,8 +247,8 @@ static void bgp_process_reads(struct event *thread) /* Handle the error in the main pthread, include the * specific state change from 'bgp_read'. */ - thread_add_event(bm->master, bgp_packet_process_error, - peer, code, &peer->t_process_packet_error); + event_add_event(bm->master, bgp_packet_process_error, peer, + code, &peer->t_process_packet_error); goto done; } @@ -292,11 +292,11 @@ done: if (!ibuf_full) assert(ringbuf_space(peer->ibuf_work) >= peer->max_packet_size); - thread_add_read(fpt->master, bgp_process_reads, peer, peer->fd, - &peer->t_read); + event_add_read(fpt->master, bgp_process_reads, peer, peer->fd, + &peer->t_read); if (added_pkt) - thread_add_event(bm->master, bgp_process_packet, peer, 0, - &peer->t_process_packet); + event_add_event(bm->master, bgp_process_packet, peer, 0, + &peer->t_process_packet); } /* diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index c10f33a2d9..91c791499a 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -362,8 +362,8 @@ static void bgp_accept(struct event *thread) return; } - thread_add_read(bm->master, bgp_accept, listener, accept_sock, - &listener->thread); + event_add_read(bm->master, bgp_accept, listener, accept_sock, + &listener->thread); /* Accept client connection. */ bgp_sock = sockunion_accept(accept_sock, &su); @@ -861,8 +861,8 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen, listener->bgp = bgp; memcpy(&listener->su, sa, salen); - thread_add_read(bm->master, bgp_accept, listener, sock, - &listener->thread); + event_add_read(bm->master, bgp_accept, listener, sock, + &listener->thread); listnode_add(bm->listen_sockets, listener); return 0; diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 391332f4c2..9eef27f760 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -811,8 +811,8 @@ void bgp_nht_interface_events(struct peer *peer) return; if (bnc->ifindex) - thread_add_event(bm->master, bgp_nht_ifp_initial, bnc->bgp, - bnc->ifindex, NULL); + event_add_event(bm->master, bgp_nht_ifp_initial, bnc->bgp, + bnc->ifindex, NULL); } void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index e124095913..b8bf383047 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2595,10 +2595,10 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) } if (peer_established(peer)) - thread_add_timer(bm->master, - bgp_refresh_stalepath_timer_expire, - paf, peer->bgp->stalepath_time, - &peer->t_refresh_stalepath); + event_add_timer(bm->master, + bgp_refresh_stalepath_timer_expire, paf, + peer->bgp->stalepath_time, + &peer->t_refresh_stalepath); if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -3021,9 +3021,9 @@ void bgp_process_packet(struct event *thread) frr_with_mutex (&peer->io_mtx) { // more work to do, come back later if (peer->ibuf->count > 0) - thread_add_event( - bm->master, bgp_process_packet, peer, 0, - &peer->t_process_packet); + event_add_event(bm->master, bgp_process_packet, + peer, 0, + &peer->t_process_packet); } } } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3dcddf49ea..5a94da2f47 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3281,7 +3281,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest, if (!bgp->t_rmap_def_originate_eval) { bgp_lock(bgp); - thread_add_timer( + event_add_timer( bm->master, update_group_refresh_default_originate_route_map, bgp, RMAP_DEFAULT_ORIGINATE_EVAL_TIMER, @@ -3433,7 +3433,7 @@ void bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi) /* If there are more routes to be processed, start the * selection timer */ - thread_add_timer(bm->master, bgp_route_select_timer_expire, thread_info, + event_add_timer(bm->master, bgp_route_select_timer_expire, thread_info, BGP_ROUTE_SELECT_DELAY, &bgp->gr_info[afi][safi].t_route_select); } @@ -5109,11 +5109,11 @@ void bgp_announce_route(struct peer *peer, afi_t afi, safi_t safi, bool force) * multiple peers and the announcement doesn't happen in the * vty context. */ - thread_add_timer_msec(bm->master, bgp_announce_route_timer_expired, paf, - (subgrp->peer_count == 1) - ? BGP_ANNOUNCE_ROUTE_SHORT_DELAY_MS - : BGP_ANNOUNCE_ROUTE_DELAY_MS, - &paf->t_announce_route); + event_add_timer_msec(bm->master, bgp_announce_route_timer_expired, paf, + (subgrp->peer_count == 1) + ? BGP_ANNOUNCE_ROUTE_SHORT_DELAY_MS + : BGP_ANNOUNCE_ROUTE_DELAY_MS, + &paf->t_announce_route); } /* @@ -5263,8 +5263,8 @@ static void bgp_soft_reconfig_table_task(struct event *thread) */ if (dest || table->soft_reconfig_init) { table->soft_reconfig_init = false; - thread_add_event(bm->master, bgp_soft_reconfig_table_task, - table, 0, &table->soft_reconfig_thread); + event_add_event(bm->master, bgp_soft_reconfig_table_task, table, + 0, &table->soft_reconfig_thread); return; } /* we're done, clean up the background iteration context info and @@ -5365,9 +5365,9 @@ bool bgp_soft_reconfig_in(struct peer *peer, afi_t afi, safi_t safi) bgp_soft_reconfig_table_flag(table, true); if (!table->soft_reconfig_thread) - thread_add_event(bm->master, - bgp_soft_reconfig_table_task, table, 0, - &table->soft_reconfig_thread); + event_add_event(bm->master, + bgp_soft_reconfig_table_task, table, 0, + &table->soft_reconfig_thread); /* Cancel bgp_announce_route_timer_expired threads. * bgp_announce_route_timer_expired threads have been scheduled * to announce routes as soon as the soft_reconfigure process diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index db4d170731..4fcee75ae0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4361,9 +4361,8 @@ static void bgp_route_map_mark_update(const char *rmap_name) /* 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); + event_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 */ diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index efaa3c3636..0d46fccf3b 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -409,8 +409,8 @@ static void bgpd_sync_callback(struct event *thread) struct prefix prefix; struct pfx_record rec; - thread_add_read(bm->master, bgpd_sync_callback, NULL, - rpki_sync_socket_bgpd, NULL); + event_add_read(bm->master, bgpd_sync_callback, NULL, + rpki_sync_socket_bgpd, NULL); if (atomic_load_explicit(&rtr_update_overflow, memory_order_seq_cst)) { while (read(rpki_sync_socket_bgpd, &rec, @@ -448,8 +448,8 @@ static void bgpd_sync_callback(struct event *thread) rrp->prefix = prefix; rrp->afi = afi; rrp->safi = safi; - thread_add_event(bm->master, rpki_revalidate_prefix, - rrp, 0, &bgp->t_revalidate[afi][safi]); + event_add_event(bm->master, rpki_revalidate_prefix, rrp, + 0, &bgp->t_revalidate[afi][safi]); } } } @@ -529,7 +529,7 @@ static void revalidate_all_routes(void) rvp->afi = afi; rvp->safi = safi; - thread_add_event( + event_add_event( bm->master, bgp_rpki_revalidate_peer, rvp, 0, &peer->t_revalidate_all[afi][safi]); @@ -580,8 +580,8 @@ static void rpki_init_sync_socket(void) } - thread_add_read(bm->master, bgpd_sync_callback, NULL, - rpki_sync_socket_bgpd, NULL); + event_add_read(bm->master, bgpd_sync_callback, NULL, + rpki_sync_socket_bgpd, NULL); return; @@ -635,9 +635,9 @@ static void sync_expired(struct event *thread) { if (!rtr_mgr_conf_in_sync(rtr_config)) { RPKI_DEBUG("rtr_mgr is not synced, retrying."); - thread_add_timer(bm->master, sync_expired, NULL, - BGP_RPKI_CACHE_SERVER_SYNC_RETRY_TIMEOUT, - &t_rpki_sync); + event_add_timer(bm->master, sync_expired, NULL, + BGP_RPKI_CACHE_SERVER_SYNC_RETRY_TIMEOUT, + &t_rpki_sync); return; } @@ -680,7 +680,7 @@ static int start(void) return ERROR; } - thread_add_timer(bm->master, sync_expired, NULL, 0, &t_rpki_sync); + event_add_timer(bm->master, sync_expired, NULL, 0, &t_rpki_sync); XFREE(MTYPE_BGP_RPKI_CACHE_GROUP, groups); diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index e01df10d3e..b661303cef 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -1449,8 +1449,8 @@ bool update_subgroup_trigger_merge_check(struct update_subgroup *subgrp, return false; subgrp->t_merge_check = NULL; - thread_add_timer_msec(bm->master, update_subgroup_merge_check_thread_cb, - subgrp, 0, &subgrp->t_merge_check); + event_add_timer_msec(bm->master, update_subgroup_merge_check_thread_cb, + subgrp, 0, &subgrp->t_merge_check); SUBGRP_INCR_STAT(subgrp, merge_checks_triggered); @@ -2215,7 +2215,7 @@ void subgroup_trigger_write(struct update_subgroup *subgrp) */ SUBGRP_FOREACH_PEER (subgrp, paf) if (peer_established(paf->peer)) - thread_add_timer_msec( + event_add_timer_msec( bm->master, bgp_generate_updgrp_packets, paf->peer, 0, &paf->peer->t_generate_updgrp_packets); diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index f6321a368f..b45e9cf828 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -1021,9 +1021,9 @@ void subgroup_announce_all(struct update_subgroup *subgrp) * We should wait for the coalesce timer. Arm the timer if not done. */ if (!subgrp->t_coalesce) { - thread_add_timer_msec(bm->master, subgroup_coalesce_timer, - subgrp, subgrp->v_coalesce, - &subgrp->t_coalesce); + event_add_timer_msec(bm->master, subgroup_coalesce_timer, + subgrp, subgrp->v_coalesce, + &subgrp->t_coalesce); } } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4233488496..95f2b82e93 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -18784,8 +18784,8 @@ static void bgp_config_start(void) { #define BGP_PRE_CONFIG_MAX_WAIT_SECONDS 600 THREAD_OFF(t_bgp_cfg); - thread_add_timer(bm->master, bgp_config_finish, NULL, - BGP_PRE_CONFIG_MAX_WAIT_SECONDS, &t_bgp_cfg); + event_add_timer(bm->master, bgp_config_finish, NULL, + BGP_PRE_CONFIG_MAX_WAIT_SECONDS, &t_bgp_cfg); } /* When we receive a hook the configuration is read, @@ -18812,8 +18812,8 @@ static void bgp_config_end(void) /* Start a new timer to make sure we don't send EoR * before route-maps are processed. */ - thread_add_timer(bm->master, bgp_config_finish, NULL, - bgp_post_config_delay, &t_bgp_cfg); + event_add_timer(bm->master, bgp_config_finish, NULL, + bgp_post_config_delay, &t_bgp_cfg); } static int config_write_interface_one(struct vty *vty, struct vrf *vrf) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 11761ff58e..ea98d61687 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1082,8 +1082,8 @@ static void bgp_zebra_tm_connect(struct event *t) } } } - thread_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, - &bgp_tm_thread_connect); + event_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, + &bgp_tm_thread_connect); } bool bgp_zebra_tm_chunk_obtained(void) @@ -1113,8 +1113,8 @@ void bgp_zebra_init_tm_connect(struct bgp *bgp) bgp_tm_min = bgp_tm_max = 0; bgp_tm_chunk_size = BGP_FLOWSPEC_TABLE_CHUNK; bgp_tm_bgp = bgp; - thread_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, - &bgp_tm_thread_connect); + event_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, + &bgp_tm_thread_connect); } int bgp_zebra_get_table_range(uint32_t chunk_size, diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 6a71d9dfe2..eb91eaf084 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3355,8 +3355,8 @@ static struct bgp *bgp_create(as_t *as, const char *name, if (name) bgp->name = XSTRDUP(MTYPE_BGP, name); - thread_add_timer(bm->master, bgp_startup_timer_expire, bgp, - bgp->restart_time, &bgp->t_startup); + event_add_timer(bm->master, bgp_startup_timer_expire, bgp, + bgp->restart_time, &bgp->t_startup); /* printable name we can use in debug messages */ if (inst_type == BGP_INSTANCE_TYPE_DEFAULT) { diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 92b580ee12..5c02cd8af1 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -2789,8 +2789,8 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, if (lifetime > UINT32_MAX / 1001) { /* sub-optimal case, but will probably never happen */ bpi->extra->vnc.import.timer = NULL; - thread_add_timer(bm->master, timer_service_func, wcb, lifetime, - &bpi->extra->vnc.import.timer); + event_add_timer(bm->master, timer_service_func, wcb, lifetime, + &bpi->extra->vnc.import.timer); } else { static uint32_t jitter; uint32_t lifetime_msec; @@ -2805,9 +2805,9 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table, lifetime_msec = (lifetime * 1000) + jitter; bpi->extra->vnc.import.timer = NULL; - thread_add_timer_msec(bm->master, timer_service_func, wcb, - lifetime_msec, - &bpi->extra->vnc.import.timer); + event_add_timer_msec(bm->master, timer_service_func, wcb, + lifetime_msec, + &bpi->extra->vnc.import.timer); } /* re-sort route list (BGP_PATH_REMOVED routes are last) */ diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c index c69161841c..2bcfa5779c 100644 --- a/bgpd/rfapi/rfapi_monitor.c +++ b/bgpd/rfapi/rfapi_monitor.c @@ -764,8 +764,8 @@ static void rfapiMonitorTimerRestart(struct rfapi_monitor_vpn *m) m->rfd->response_lifetime); } - thread_add_timer(bm->master, rfapiMonitorTimerExpire, m, - m->rfd->response_lifetime, &m->timer); + event_add_timer(bm->master, rfapiMonitorTimerExpire, m, + m->rfd->response_lifetime, &m->timer); } /* @@ -1072,8 +1072,8 @@ static void rfapiMonitorEthTimerRestart(struct rfapi_monitor_eth *m) m->rfd->response_lifetime); } - thread_add_timer(bm->master, rfapiMonitorEthTimerExpire, m, - m->rfd->response_lifetime, &m->timer); + event_add_timer(bm->master, rfapiMonitorEthTimerExpire, m, + m->rfd->response_lifetime, &m->timer); } static int mon_eth_cmp(const void *a, const void *b) diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c index 7000fbf90c..3febea96bb 100644 --- a/bgpd/rfapi/rfapi_rib.c +++ b/bgpd/rfapi/rfapi_rib.c @@ -345,8 +345,8 @@ static void rfapiRibStartTimer(struct rfapi_descriptor *rfd, vnc_zlog_debug_verbose("%s: rfd %p pfx %pRN life %u", __func__, rfd, rn, ri->lifetime); - thread_add_timer(bm->master, rfapiRibExpireTimer, tcb, ri->lifetime, - &ri->timer); + event_add_timer(bm->master, rfapiRibExpireTimer, tcb, ri->lifetime, + &ri->timer); } extern void rfapi_rib_key_init(struct prefix *prefix, /* may be NULL */ diff --git a/bgpd/rfapi/vnc_export_bgp.c b/bgpd/rfapi/vnc_export_bgp.c index ef943fa407..e15c61e6da 100644 --- a/bgpd/rfapi/vnc_export_bgp.c +++ b/bgpd/rfapi/vnc_export_bgp.c @@ -1765,8 +1765,8 @@ void vnc_direct_bgp_rh_del_route(struct bgp *bgp, afi_t afi, if (!eti->timer && eti->lifetime <= INT32_MAX) { eti->timer = NULL; - thread_add_timer(bm->master, vncExportWithdrawTimer, eti, - eti->lifetime, &eti->timer); + event_add_timer(bm->master, vncExportWithdrawTimer, eti, + eti->lifetime, &eti->timer); vnc_zlog_debug_verbose( "%s: set expiration timer for %u seconds", __func__, eti->lifetime); diff --git a/doc/developer/process-architecture.rst b/doc/developer/process-architecture.rst index 0773f47b09..25decffb07 100644 --- a/doc/developer/process-architecture.rst +++ b/doc/developer/process-architecture.rst @@ -95,7 +95,7 @@ irrelevant for the time being) for the specific type. For example, to add a :: - thread_add_read(struct thread_master *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref); + event_add_read(struct thread_master *master, int (*handler)(struct event *), void *arg, int fd, struct event **ref); The ``struct event`` is then created and added to the appropriate internal datastructure within the ``threadmaster``. Note that the ``READ`` and @@ -137,14 +137,14 @@ Mapping the general names used in the figure to specific FRR functions: - ``fetch`` is ``thread_fetch()`` - ``exec()`` is ``thread_call`` - ``cancel()`` is ``thread_cancel()`` -- ``schedule()`` is any of the various task-specific ``thread_add_*`` functions +- ``schedule()`` is any of the various task-specific ``event_add_*`` functions Adding tasks is done with various task-specific function-like macros. These macros wrap underlying functions in :file:`thread.c` to provide additional information added at compile time, such as the line number the task was scheduled from, that can be accessed at runtime for debugging, logging and informational purposes. Each task type has its own specific scheduling function -that follow the naming convention ``thread_add_``; see :file:`event.h` +that follow the naming convention ``event_add_``; see :file:`event.h` for details. There are some gotchas to keep in mind: diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index a4d59db6b7..f39530877a 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -114,8 +114,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx, thread_cancel(&(e->t_distribute)); /* schedule Graceful restart for whole process in 10sec */ - thread_add_timer(master, eigrp_distribute_timer_process, e, - (10), &e->t_distribute); + event_add_timer(master, eigrp_distribute_timer_process, e, (10), + &e->t_distribute); return; } @@ -188,8 +188,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx, /* Cancel GR scheduled */ thread_cancel(&(ei->t_distribute)); /* schedule Graceful restart for interface in 10sec */ - thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10, - &ei->t_distribute); + event_add_timer(master, eigrp_distribute_timer_interface, ei, 10, + &ei->t_distribute); } /* diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index c6d3b879d9..02807dd31d 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -80,8 +80,8 @@ void eigrp_hello_timer(struct event *thread) eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL); /* Hello timer set. */ - thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, - &ei->t_hello); + event_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, + &ei->t_hello); } /** @@ -726,8 +726,8 @@ void eigrp_hello_send_ack(struct eigrp_neighbor *nbr) listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei); nbr->ei->on_write_q = 1; } - thread_add_write(master, eigrp_write, nbr->ei->eigrp, - nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); + event_add_write(master, eigrp_write, nbr->ei->eigrp, + nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); } } @@ -774,9 +774,9 @@ void eigrp_hello_send(struct eigrp_interface *ei, uint8_t flags, thread_execute(master, eigrp_write, ei->eigrp, ei->eigrp->fd); } else { - thread_add_write(master, eigrp_write, ei->eigrp, - ei->eigrp->fd, - &ei->eigrp->t_write); + event_add_write(master, eigrp_write, ei->eigrp, + ei->eigrp->fd, + &ei->eigrp->t_write); } } } diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index eeb2bd4d09..cd268fa9b9 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -251,7 +251,7 @@ int eigrp_if_up(struct eigrp_interface *ei) /* Set multicast memberships appropriately for new state. */ eigrp_if_set_multicast(ei); - thread_add_event(master, eigrp_hello_timer, ei, (1), &ei->t_hello); + event_add_event(master, eigrp_hello_timer, ei, (1), &ei->t_hello); /*Prepare metrics*/ metric.bandwidth = eigrp_bandwidth_to_scaled(ei->params.bandwidth); diff --git a/eigrpd/eigrp_macros.h b/eigrpd/eigrp_macros.h index b7cd22fee1..75f1d7e133 100644 --- a/eigrpd/eigrp_macros.h +++ b/eigrpd/eigrp_macros.h @@ -27,6 +27,6 @@ /* FSM macros*/ #define EIGRP_FSM_EVENT_SCHEDULE(I, E) \ - thread_add_event(master, eigrp_fsm_event, (I), (E)) + event_add_event(master, eigrp_fsm_event, (I), (E)) #endif /* _ZEBRA_EIGRP_MACROS_H_ */ diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index 582428ed1f..e40c4a50bd 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -261,15 +261,15 @@ void eigrp_nbr_state_update(struct eigrp_neighbor *nbr) case EIGRP_NEIGHBOR_PENDING: { /*Reset Hold Down Timer for neighbor*/ THREAD_OFF(nbr->t_holddown); - thread_add_timer(master, holddown_timer_expired, nbr, - nbr->v_holddown, &nbr->t_holddown); + event_add_timer(master, holddown_timer_expired, nbr, + nbr->v_holddown, &nbr->t_holddown); break; } case EIGRP_NEIGHBOR_UP: { /*Reset Hold Down Timer for neighbor*/ THREAD_OFF(nbr->t_holddown); - thread_add_timer(master, holddown_timer_expired, nbr, - nbr->v_holddown, &nbr->t_holddown); + event_add_timer(master, holddown_timer_expired, nbr, + nbr->v_holddown, &nbr->t_holddown); break; } } diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index 24603fa743..51b68fb34b 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -453,8 +453,8 @@ out: /* If packets still remain in queue, call write thread. */ if (!list_isempty(eigrp->oi_write_q)) { - thread_add_write(master, eigrp_write, eigrp, eigrp->fd, - &eigrp->t_write); + event_add_write(master, eigrp_write, eigrp, eigrp->fd, + &eigrp->t_write); } } @@ -477,7 +477,7 @@ void eigrp_read(struct event *thread) eigrp = THREAD_ARG(thread); /* prepare for next packet. */ - thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); + event_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); stream_reset(eigrp->ibuf); if (!(ibuf = eigrp_recv_packet(eigrp, eigrp->fd, &ifp, eigrp->ibuf))) { @@ -828,9 +828,9 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr) eigrp_fifo_push(nbr->ei->obuf, duplicate); /*Start retransmission timer*/ - thread_add_timer(master, eigrp_unack_packet_retrans, nbr, - EIGRP_PACKET_RETRANS_TIME, - &ep->t_retrans_timer); + event_add_timer(master, eigrp_unack_packet_retrans, nbr, + EIGRP_PACKET_RETRANS_TIME, + &ep->t_retrans_timer); /*Increment sequence number counter*/ nbr->ei->eigrp->sequence_number++; @@ -840,8 +840,8 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr) listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei); nbr->ei->on_write_q = 1; } - thread_add_write(master, eigrp_write, nbr->ei->eigrp, - nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); + event_add_write(master, eigrp_write, nbr->ei->eigrp, + nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); } } @@ -992,17 +992,17 @@ void eigrp_unack_packet_retrans(struct event *thread) } /*Start retransmission timer*/ - thread_add_timer(master, eigrp_unack_packet_retrans, nbr, - EIGRP_PACKET_RETRANS_TIME, - &ep->t_retrans_timer); + event_add_timer(master, eigrp_unack_packet_retrans, nbr, + EIGRP_PACKET_RETRANS_TIME, + &ep->t_retrans_timer); /* Hook thread to write packet. */ if (nbr->ei->on_write_q == 0) { listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei); nbr->ei->on_write_q = 1; } - thread_add_write(master, eigrp_write, nbr->ei->eigrp, - nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); + event_add_write(master, eigrp_write, nbr->ei->eigrp, + nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); } } @@ -1027,17 +1027,17 @@ void eigrp_unack_multicast_packet_retrans(struct event *thread) } /*Start retransmission timer*/ - thread_add_timer(master, eigrp_unack_multicast_packet_retrans, - nbr, EIGRP_PACKET_RETRANS_TIME, - &ep->t_retrans_timer); + event_add_timer(master, eigrp_unack_multicast_packet_retrans, + nbr, EIGRP_PACKET_RETRANS_TIME, + &ep->t_retrans_timer); /* Hook thread to write packet. */ if (nbr->ei->on_write_q == 0) { listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei); nbr->ei->on_write_q = 1; } - thread_add_write(master, eigrp_write, nbr->ei->eigrp, - nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); + event_add_write(master, eigrp_write, nbr->ei->eigrp, + nbr->ei->eigrp->fd, &nbr->ei->eigrp->t_write); } } diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index ccc0c9a4b2..5fa4695317 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -906,8 +906,8 @@ void eigrp_update_send_GR_thread(struct event *thread) /* if there is packet waiting in queue, * schedule this thread again with small delay */ if (nbr->retrans_queue->count > 0) { - thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, - 10, &nbr->t_nbr_send_gr); + event_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, + 10, &nbr->t_nbr_send_gr); return; } diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index 9db0531b59..f94bcea736 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -157,7 +157,7 @@ static struct eigrp *eigrp_new(uint16_t as, vrf_id_t vrf_id) eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1); - thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); + event_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); eigrp->oi_write_q = list_new(); eigrp->topology_table = route_table_init(); diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 40cc158812..52fd8df006 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -267,8 +267,8 @@ void fabricd_initial_sync_hello(struct isis_circuit *circuit) if (f->initial_sync_timeout) return; - thread_add_timer(master, fabricd_initial_sync_timeout, f, - timeout, &f->initial_sync_timeout); + event_add_timer(master, fabricd_initial_sync_timeout, f, timeout, + &f->initial_sync_timeout); f->initial_sync_start = monotime(NULL); if (IS_DEBUG_ADJ_PACKETS) @@ -408,10 +408,9 @@ static void fabricd_tier_calculation_cb(struct event *thread) zlog_info("OpenFabric: Got tier %hhu from algorithm. Arming timer.", tier); f->tier_pending = tier; - thread_add_timer(master, fabricd_tier_set_timer, f, - f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], - &f->tier_set_timer); - + event_add_timer(master, fabricd_tier_set_timer, f, + f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], + &f->tier_set_timer); } static void fabricd_bump_tier_calculation_timer(struct fabricd *f) @@ -427,9 +426,9 @@ static void fabricd_bump_tier_calculation_timer(struct fabricd *f) * the calculation */ THREAD_OFF(f->tier_calculation_timer); - thread_add_timer(master, fabricd_tier_calculation_cb, f, - 2 * f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], - &f->tier_calculation_timer); + event_add_timer(master, fabricd_tier_calculation_cb, f, + 2 * f->area->lsp_gen_interval[ISIS_LEVEL2 - 1], + &f->tier_calculation_timer); } static void fabricd_set_tier(struct fabricd *f, uint8_t tier) @@ -711,9 +710,9 @@ void fabricd_trigger_csnp(struct isis_area *area, bool circuit_scoped) continue; THREAD_OFF(circuit->t_send_csnp[ISIS_LEVEL2 - 1]); - thread_add_timer_msec(master, send_l2_csnp, circuit, - isis_jitter(f->csnp_delay, CSNP_JITTER), - &circuit->t_send_csnp[ISIS_LEVEL2 - 1]); + event_add_timer_msec(master, send_l2_csnp, circuit, + isis_jitter(f->csnp_delay, CSNP_JITTER), + &circuit->t_send_csnp[ISIS_LEVEL2 - 1]); } } diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 3eb4e0e8f8..4443f346db 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -396,13 +396,13 @@ void isis_adj_state_change(struct isis_adjacency **padj, adj->flaps++; if (level == IS_LEVEL_1) { - thread_add_timer(master, send_l1_csnp, - circuit, 0, - &circuit->t_send_csnp[0]); + event_add_timer( + master, send_l1_csnp, circuit, + 0, &circuit->t_send_csnp[0]); } else { - thread_add_timer(master, send_l2_csnp, - circuit, 0, - &circuit->t_send_csnp[1]); + event_add_timer( + master, send_l2_csnp, circuit, + 0, &circuit->t_send_csnp[1]); } } else if (old_state == ISIS_ADJ_UP) { circuit->upadjcount[level - 1]--; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 8593aee8be..f5c58dddbf 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -627,12 +627,12 @@ void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream) void isis_circuit_prepare(struct isis_circuit *circuit) { #if ISIS_METHOD != ISIS_METHOD_DLPI - thread_add_read(master, isis_receive, circuit, circuit->fd, - &circuit->t_read); + event_add_read(master, isis_receive, circuit, circuit->fd, + &circuit->t_read); #else - thread_add_timer_msec(master, isis_receive, circuit, - listcount(circuit->area->circuit_list) * 100, - &circuit->t_read); + event_add_timer_msec(master, isis_receive, circuit, + listcount(circuit->area->circuit_list) * 100, + &circuit->t_read); #endif } @@ -722,10 +722,10 @@ int isis_circuit_up(struct isis_circuit *circuit) send_hello_sched(circuit, level, TRIGGERED_IIH_DELAY); circuit->u.bc.lan_neighs[level - 1] = list_new(); - thread_add_timer(master, isis_run_dr, - &circuit->level_arg[level - 1], - 2 * circuit->hello_interval[level - 1], - &circuit->u.bc.t_run_dr[level - 1]); + event_add_timer(master, isis_run_dr, + &circuit->level_arg[level - 1], + 2 * circuit->hello_interval[level - 1], + &circuit->u.bc.t_run_dr[level - 1]); } /* 8.4.1 b) FIXME: solicit ES - 8.4.6 */ @@ -740,13 +740,13 @@ int isis_circuit_up(struct isis_circuit *circuit) /* initializing PSNP timers */ if (circuit->is_type & IS_LEVEL_1) - thread_add_timer( + event_add_timer( master, send_l1_psnp, circuit, isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), &circuit->t_send_psnp[0]); if (circuit->is_type & IS_LEVEL_2) - thread_add_timer( + event_add_timer( master, send_l2_psnp, circuit, isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), &circuit->t_send_psnp[1]); diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index 8949318cc4..9a10a61b29 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -223,29 +223,27 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) if (level == 1) { memset(circuit->u.bc.l1_desig_is, 0, ISIS_SYS_ID_LEN + 1); - thread_add_timer(master, send_l1_psnp, circuit, - isis_jitter(circuit->psnp_interval[level - 1], - PSNP_JITTER), - &circuit->t_send_psnp[0]); + event_add_timer(master, send_l1_psnp, circuit, + isis_jitter(circuit->psnp_interval[level - 1], + PSNP_JITTER), + &circuit->t_send_psnp[0]); } else { memset(circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1); - thread_add_timer(master, send_l2_psnp, circuit, - isis_jitter(circuit->psnp_interval[level - 1], - PSNP_JITTER), - &circuit->t_send_psnp[1]); + event_add_timer(master, send_l2_psnp, circuit, + isis_jitter(circuit->psnp_interval[level - 1], + PSNP_JITTER), + &circuit->t_send_psnp[1]); } THREAD_OFF(circuit->t_send_csnp[level - 1]); - thread_add_timer(master, isis_run_dr, - &circuit->level_arg[level - 1], - 2 * circuit->hello_interval[level - 1], - &circuit->u.bc.t_run_dr[level - 1]); + event_add_timer(master, isis_run_dr, &circuit->level_arg[level - 1], + 2 * circuit->hello_interval[level - 1], + &circuit->u.bc.t_run_dr[level - 1]); - thread_add_event(master, isis_event_dis_status_change, circuit, 0, - NULL); + event_add_event(master, isis_event_dis_status_change, circuit, 0, NULL); return ISIS_OK; } @@ -276,10 +274,10 @@ int isis_dr_commence(struct isis_circuit *circuit, int level) assert(circuit->circuit_id); /* must be non-zero */ lsp_generate_pseudo(circuit, 1); - thread_add_timer(master, send_l1_csnp, circuit, - isis_jitter(circuit->csnp_interval[level - 1], - CSNP_JITTER), - &circuit->t_send_csnp[0]); + event_add_timer(master, send_l1_csnp, circuit, + isis_jitter(circuit->csnp_interval[level - 1], + CSNP_JITTER), + &circuit->t_send_csnp[0]); } else { memcpy(old_dr, circuit->u.bc.l2_desig_is, ISIS_SYS_ID_LEN + 1); @@ -296,18 +294,16 @@ int isis_dr_commence(struct isis_circuit *circuit, int level) assert(circuit->circuit_id); /* must be non-zero */ lsp_generate_pseudo(circuit, 2); - thread_add_timer(master, send_l2_csnp, circuit, - isis_jitter(circuit->csnp_interval[level - 1], - CSNP_JITTER), - &circuit->t_send_csnp[1]); + event_add_timer(master, send_l2_csnp, circuit, + isis_jitter(circuit->csnp_interval[level - 1], + CSNP_JITTER), + &circuit->t_send_csnp[1]); } - thread_add_timer(master, isis_run_dr, - &circuit->level_arg[level - 1], - 2 * circuit->hello_interval[level - 1], - &circuit->u.bc.t_run_dr[level - 1]); - thread_add_event(master, isis_event_dis_status_change, circuit, 0, - NULL); + event_add_timer(master, isis_run_dr, &circuit->level_arg[level - 1], + 2 * circuit->hello_interval[level - 1], + &circuit->u.bc.t_run_dr[level - 1]); + event_add_event(master, isis_event_dis_status_change, circuit, 0, NULL); return ISIS_OK; } diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c index 78197561bd..e171419310 100644 --- a/isisd/isis_dynhn.c +++ b/isisd/isis_dynhn.c @@ -35,8 +35,8 @@ void dyn_cache_init(struct isis *isis) { isis->dyn_cache = list_new(); if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) - thread_add_timer(master, dyn_cache_cleanup, isis, 120, - &isis->t_dync_clean); + event_add_timer(master, dyn_cache_cleanup, isis, 120, + &isis->t_dync_clean); } void dyn_cache_finish(struct isis *isis) @@ -72,7 +72,7 @@ static void dyn_cache_cleanup(struct event *thread) XFREE(MTYPE_ISIS_DYNHN, dyn); } - thread_add_timer(master, dyn_cache_cleanup, isis, 120, + event_add_timer(master, dyn_cache_cleanup, isis, 120, &isis->t_dync_clean); } diff --git a/isisd/isis_events.c b/isisd/isis_events.c index 9baf58650d..4610bb2c93 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -63,23 +63,23 @@ static void circuit_commence_level(struct isis_circuit *circuit, int level) if (!circuit->is_passive) { if (level == 1) { - thread_add_timer(master, send_l1_psnp, circuit, - isis_jitter(circuit->psnp_interval[0], - PSNP_JITTER), - &circuit->t_send_psnp[0]); + event_add_timer(master, send_l1_psnp, circuit, + isis_jitter(circuit->psnp_interval[0], + PSNP_JITTER), + &circuit->t_send_psnp[0]); } else { - thread_add_timer(master, send_l2_psnp, circuit, - isis_jitter(circuit->psnp_interval[1], - PSNP_JITTER), - &circuit->t_send_psnp[1]); + event_add_timer(master, send_l2_psnp, circuit, + isis_jitter(circuit->psnp_interval[1], + PSNP_JITTER), + &circuit->t_send_psnp[1]); } } if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - thread_add_timer(master, isis_run_dr, - &circuit->level_arg[level - 1], - 2 * circuit->hello_interval[level - 1], - &circuit->u.bc.t_run_dr[level - 1]); + event_add_timer(master, isis_run_dr, + &circuit->level_arg[level - 1], + 2 * circuit->hello_interval[level - 1], + &circuit->u.bc.t_run_dr[level - 1]); send_hello_sched(circuit, level, TRIGGERED_IIH_DELAY); circuit->u.bc.lan_neighs[level - 1] = list_new(); diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 7ba04a1c17..65ca7ac3cc 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -373,9 +373,8 @@ void isis_ldp_sync_holddown_timer_add(struct isis_circuit *circuit) ils_debug("%s: start holddown timer for %s time %d", __func__, circuit->interface->name, ldp_sync_info->holddown); - thread_add_timer(master, isis_ldp_sync_holddown_timer, - circuit, ldp_sync_info->holddown, - &ldp_sync_info->t_holddown); + event_add_timer(master, isis_ldp_sync_holddown_timer, circuit, + ldp_sync_info->holddown, &ldp_sync_info->t_holddown); } /* diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 4d2d545683..323a25c260 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -1507,8 +1507,8 @@ int isis_rlfa_activate(struct isis_spftree *spftree, struct rlfa *rlfa, spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] += 1; THREAD_OFF(area->t_rlfa_rib_update); - thread_add_timer(master, isis_area_verify_routes_cb, area, 2, - &area->t_rlfa_rib_update); + event_add_timer(master, isis_area_verify_routes_cb, area, 2, + &area->t_rlfa_rib_update); return 0; } @@ -1526,8 +1526,8 @@ void isis_rlfa_deactivate(struct isis_spftree *spftree, struct rlfa *rlfa) spftree->lfa.protection_counters.rlfa[vertex->N.ip.priority] -= 1; THREAD_OFF(area->t_rlfa_rib_update); - thread_add_timer(master, isis_area_verify_routes_cb, area, 2, - &area->t_rlfa_rib_update); + event_add_timer(master, isis_area_verify_routes_cb, area, 2, + &area->t_rlfa_rib_update); } void isis_rlfa_list_init(struct isis_spftree *spftree) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 1498bbc0ea..62912addcb 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1384,9 +1384,9 @@ int lsp_generate(struct isis_area *area, int level) overload_time = isis_restart_read_overload_time(area); if (overload_time > 0) { isis_area_overload_bit_set(area, true); - thread_add_timer(master, set_overload_on_start_timer, - area, overload_time, - &area->t_overload_on_startup_timer); + event_add_timer(master, set_overload_on_start_timer, + area, overload_time, + &area->t_overload_on_startup_timer); } device_startup = false; } @@ -1420,9 +1420,8 @@ int lsp_generate(struct isis_area *area, int level) THREAD_OFF(area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; - thread_add_timer(master, lsp_refresh, - &area->lsp_refresh_arg[level - 1], refresh_time, - &area->t_lsp_refresh[level - 1]); + event_add_timer(master, lsp_refresh, &area->lsp_refresh_arg[level - 1], + refresh_time, &area->t_lsp_refresh[level - 1]); if (IS_DEBUG_UPDATE_PACKETS) { zlog_debug("ISIS-Upd (%s): Building L%d LSP %s, len %hu, seq 0x%08x, cksum 0x%04hx, lifetime %hus refresh %hus", @@ -1501,9 +1500,8 @@ static int lsp_regenerate(struct isis_area *area, int level) lsp_seqno_update(lsp); refresh_time = lsp_refresh_time(lsp, rem_lifetime); - thread_add_timer(master, lsp_refresh, - &area->lsp_refresh_arg[level - 1], refresh_time, - &area->t_lsp_refresh[level - 1]); + event_add_timer(master, lsp_refresh, &area->lsp_refresh_arg[level - 1], + refresh_time, &area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; if (IS_DEBUG_UPDATE_PACKETS) { @@ -1668,10 +1666,9 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level, } area->lsp_regenerate_pending[lvl - 1] = 1; - thread_add_timer_msec(master, lsp_refresh, - &area->lsp_refresh_arg[lvl - 1], - timeout, - &area->t_lsp_refresh[lvl - 1]); + event_add_timer_msec(master, lsp_refresh, + &area->lsp_refresh_arg[lvl - 1], timeout, + &area->t_lsp_refresh[lvl - 1]); } if (all_pseudo) { @@ -1825,13 +1822,13 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level) THREAD_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); circuit->lsp_regenerate_pending[level - 1] = 0; if (level == IS_LEVEL_1) - thread_add_timer( - master, lsp_l1_refresh_pseudo, circuit, refresh_time, - &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + event_add_timer(master, lsp_l1_refresh_pseudo, circuit, + refresh_time, + &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); else if (level == IS_LEVEL_2) - thread_add_timer( - master, lsp_l2_refresh_pseudo, circuit, refresh_time, - &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + event_add_timer(master, lsp_l2_refresh_pseudo, circuit, + refresh_time, + &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); if (IS_DEBUG_UPDATE_PACKETS) { zlog_debug( @@ -1880,13 +1877,13 @@ static int lsp_regenerate_pseudo(struct isis_circuit *circuit, int level) refresh_time = lsp_refresh_time(lsp, rem_lifetime); if (level == IS_LEVEL_1) - thread_add_timer( - master, lsp_l1_refresh_pseudo, circuit, refresh_time, - &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + event_add_timer(master, lsp_l1_refresh_pseudo, circuit, + refresh_time, + &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); else if (level == IS_LEVEL_2) - thread_add_timer( - master, lsp_l2_refresh_pseudo, circuit, refresh_time, - &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + event_add_timer(master, lsp_l2_refresh_pseudo, circuit, + refresh_time, + &circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); if (IS_DEBUG_UPDATE_PACKETS) { zlog_debug( @@ -2032,11 +2029,11 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) circuit->lsp_regenerate_pending[lvl - 1] = 1; if (lvl == IS_LEVEL_1) { - thread_add_timer_msec( + event_add_timer_msec( master, lsp_l1_refresh_pseudo, circuit, timeout, &circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); } else if (lvl == IS_LEVEL_2) { - thread_add_timer_msec( + event_add_timer_msec( master, lsp_l2_refresh_pseudo, circuit, timeout, &circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); } @@ -2060,7 +2057,7 @@ void lsp_tick(struct event *thread) area = THREAD_ARG(thread); assert(area); area->t_tick = NULL; - thread_add_timer(master, lsp_tick, area, 1, &area->t_tick); + event_add_timer(master, lsp_tick, area, 1, &area->t_tick); struct isis_circuit *fabricd_init_c = fabricd_initial_sync_circuit(area); diff --git a/isisd/isis_main.c b/isisd/isis_main.c index ad5ec9f89e..363543f5dc 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -186,8 +186,8 @@ static void isis_config_start(void) /* Max wait time for config to load before generating lsp */ #define ISIS_PRE_CONFIG_MAX_WAIT_SECONDS 600 THREAD_OFF(t_isis_cfg); - thread_add_timer(im->master, isis_config_finish, NULL, - ISIS_PRE_CONFIG_MAX_WAIT_SECONDS, &t_isis_cfg); + event_add_timer(im->master, isis_config_finish, NULL, + ISIS_PRE_CONFIG_MAX_WAIT_SECONDS, &t_isis_cfg); } static void isis_config_end(void) diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 9965b22732..3e8cb3f72a 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -193,8 +193,8 @@ static int process_p2p_hello(struct iih_info *iih) /* lets take care of the expiry */ THREAD_OFF(adj->t_expire); - thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, - &adj->t_expire); + event_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, + &adj->t_expire); /* While fabricds initial sync is in progress, ignore hellos from other * interfaces than the one we are performing the initial sync on. */ @@ -466,8 +466,8 @@ static int process_lan_hello(struct iih_info *iih) : iih->circuit->u.bc.l2_desig_is; if (memcmp(dis, iih->dis, ISIS_SYS_ID_LEN + 1)) { - thread_add_event(master, isis_event_dis_status_change, - iih->circuit, 0, NULL); + event_add_event(master, isis_event_dis_status_change, + iih->circuit, 0, NULL); memcpy(dis, iih->dis, ISIS_SYS_ID_LEN + 1); } } @@ -485,8 +485,8 @@ static int process_lan_hello(struct iih_info *iih) /* lets take care of the expiry */ THREAD_OFF(adj->t_expire); - thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, - &adj->t_expire); + event_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, + &adj->t_expire); /* * If the snpa for this circuit is found from LAN Neighbours TLV @@ -2059,10 +2059,9 @@ static void _send_hello_sched(struct isis_circuit *circuit, THREAD_OFF(*threadp); } - thread_add_timer_msec(master, send_hello_cb, - &circuit->level_arg[level - 1], - isis_jitter(delay, IIH_JITTER), - threadp); + event_add_timer_msec(master, send_hello_cb, + &circuit->level_arg[level - 1], + isis_jitter(delay, IIH_JITTER), threadp); } void send_hello_sched(struct isis_circuit *circuit, int level, long delay) @@ -2254,9 +2253,9 @@ void send_l1_csnp(struct event *thread) send_csnp(circuit, 1); } /* set next timer thread */ - thread_add_timer(master, send_l1_csnp, circuit, - isis_jitter(circuit->csnp_interval[0], CSNP_JITTER), - &circuit->t_send_csnp[0]); + event_add_timer(master, send_l1_csnp, circuit, + isis_jitter(circuit->csnp_interval[0], CSNP_JITTER), + &circuit->t_send_csnp[0]); } void send_l2_csnp(struct event *thread) @@ -2274,9 +2273,9 @@ void send_l2_csnp(struct event *thread) send_csnp(circuit, 2); } /* set next timer thread */ - thread_add_timer(master, send_l2_csnp, circuit, - isis_jitter(circuit->csnp_interval[1], CSNP_JITTER), - &circuit->t_send_csnp[1]); + event_add_timer(master, send_l2_csnp, circuit, + isis_jitter(circuit->csnp_interval[1], CSNP_JITTER), + &circuit->t_send_csnp[1]); } /* @@ -2405,9 +2404,9 @@ void send_l1_psnp(struct event *thread) send_psnp(1, circuit); /* set next timer thread */ - thread_add_timer(master, send_l1_psnp, circuit, - isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), - &circuit->t_send_psnp[0]); + event_add_timer(master, send_l1_psnp, circuit, + isis_jitter(circuit->psnp_interval[0], PSNP_JITTER), + &circuit->t_send_psnp[0]); } /* @@ -2426,9 +2425,9 @@ void send_l2_psnp(struct event *thread) send_psnp(2, circuit); /* set next timer thread */ - thread_add_timer(master, send_l2_psnp, circuit, - isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), - &circuit->t_send_psnp[1]); + event_add_timer(master, send_l2_psnp, circuit, + isis_jitter(circuit->psnp_interval[1], PSNP_JITTER), + &circuit->t_send_psnp[1]); } /* diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index feb2d235b8..aabf79024d 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1961,9 +1961,9 @@ int _isis_spf_schedule(struct isis_area *area, int level, if (area->spf_timer[level - 1]) return ISIS_OK; - thread_add_timer_msec(master, isis_run_spf_cb, - isis_run_spf_arg(area, level), delay, - &area->spf_timer[level - 1]); + event_add_timer_msec(master, isis_run_spf_cb, + isis_run_spf_arg(area, level), delay, + &area->spf_timer[level - 1]); return ISIS_OK; } @@ -1990,8 +1990,8 @@ int _isis_spf_schedule(struct isis_area *area, int level, timer = area->min_spf_interval[level - 1] - diff; } - thread_add_timer(master, isis_run_spf_cb, isis_run_spf_arg(area, level), - timer, &area->spf_timer[level - 1]); + event_add_timer(master, isis_run_spf_cb, isis_run_spf_arg(area, level), + timer, &area->spf_timer[level - 1]); if (IS_DEBUG_SPF_EVENTS) zlog_debug("ISIS-SPF (%s) L%d SPF scheduled %ld sec from now", diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 59209d3aca..791d221cf9 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1108,8 +1108,8 @@ int isis_sr_start(struct isis_area *area) if (!isis_zebra_label_manager_ready()) if (isis_zebra_label_manager_connect() < 0) { /* Re-attempt to connect to Label Manager in 1 sec. */ - thread_add_timer(master, sr_start_label_manager, area, - 1, &srdb->t_start_lm); + event_add_timer(master, sr_start_label_manager, area, 1, + &srdb->t_start_lm); return -1; } diff --git a/isisd/isis_tx_queue.c b/isisd/isis_tx_queue.c index 42e1d68e03..e0c5e164f6 100644 --- a/isisd/isis_tx_queue.c +++ b/isisd/isis_tx_queue.c @@ -105,7 +105,7 @@ static void tx_queue_send_event(struct event *thread) struct isis_tx_queue_entry *e = THREAD_ARG(thread); struct isis_tx_queue *queue = e->queue; - thread_add_timer(master, tx_queue_send_event, e, 5, &e->retry); + event_add_timer(master, tx_queue_send_event, e, 5, &e->retry); if (e->is_retry) queue->circuit->area->lsp_rxmt_count++; @@ -148,7 +148,7 @@ void _isis_tx_queue_add(struct isis_tx_queue *queue, e->type = type; THREAD_OFF(e->retry); - thread_add_event(master, tx_queue_send_event, e, 0, &e->retry); + event_add_event(master, tx_queue_send_event, e, 0, &e->retry); e->is_retry = false; } diff --git a/isisd/isisd.c b/isisd/isisd.c index 73049d2083..886849fed5 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -325,7 +325,7 @@ struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name) area->area_addrs->del = delete_area_addr; if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) - thread_add_timer(master, lsp_tick, area, 1, &area->t_tick); + event_add_timer(master, lsp_tick, area, 1, &area->t_tick); flags_initialize(&area->flags); isis_sr_area_init(area); diff --git a/ldpd/accept.c b/ldpd/accept.c index 6151c1a0b6..2088ce9770 100644 --- a/ldpd/accept.c +++ b/ldpd/accept.c @@ -46,7 +46,7 @@ int accept_add(int fd, void (*cb)(struct event *), void *arg) av->arg = arg; LIST_INSERT_HEAD(&accept_queue.queue, av, entry); - thread_add_read(master, accept_cb, av, av->fd, &av->ev); + event_add_read(master, accept_cb, av, av->fd, &av->ev); log_debug("%s: accepting on fd %d", __func__, fd); @@ -73,7 +73,7 @@ accept_pause(void) { log_debug(__func__); accept_unarm(); - thread_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt); + event_add_timer(master, accept_timeout, NULL, 1, &accept_queue.evt); } void @@ -91,7 +91,7 @@ accept_arm(void) { struct accept_ev *av; LIST_FOREACH(av, &accept_queue.queue, entry) { - thread_add_read(master, accept_cb, av, av->fd, &av->ev); + event_add_read(master, accept_cb, av, av->fd, &av->ev); } } @@ -106,7 +106,7 @@ accept_unarm(void) static void accept_cb(struct event *thread) { struct accept_ev *av = THREAD_ARG(thread); - thread_add_read(master, accept_cb, av, av->fd, &av->ev); + event_add_read(master, accept_cb, av, av->fd, &av->ev); av->accept_cb(thread); } diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c index 36c14a5622..d9a9d434a5 100644 --- a/ldpd/adjacency.c +++ b/ldpd/adjacency.c @@ -187,8 +187,8 @@ adj_start_itimer(struct adj *adj) { THREAD_OFF(adj->inactivity_timer); adj->inactivity_timer = NULL; - thread_add_timer(master, adj_itimer, adj, adj->holdtime, - &adj->inactivity_timer); + event_add_timer(master, adj_itimer, adj, adj->holdtime, + &adj->inactivity_timer); } void @@ -345,8 +345,8 @@ tnbr_start_hello_timer(struct tnbr *tnbr) { THREAD_OFF(tnbr->hello_timer); tnbr->hello_timer = NULL; - thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr), - &tnbr->hello_timer); + event_add_timer(master, tnbr_hello_timer, tnbr, + tnbr_get_hello_interval(tnbr), &tnbr->hello_timer); } static void diff --git a/ldpd/control.c b/ldpd/control.c index 2313e232fe..ade50edd4a 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -122,8 +122,8 @@ static void control_accept(struct event *thread) imsg_init(&c->iev.ibuf, connfd); c->iev.handler_read = control_dispatch_imsg; c->iev.ev_read = NULL; - thread_add_read(master, c->iev.handler_read, &c->iev, c->iev.ibuf.fd, - &c->iev.ev_read); + event_add_read(master, c->iev.handler_read, &c->iev, c->iev.ibuf.fd, + &c->iev.ev_read); c->iev.handler_write = ldp_write_handler; c->iev.ev_write = NULL; diff --git a/ldpd/interface.c b/ldpd/interface.c index 6996bf7c10..5a6ea9c518 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -457,8 +457,8 @@ static void if_start_hello_timer(struct iface_af *ia) { THREAD_OFF(ia->hello_timer); - thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia), - &ia->hello_timer); + event_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia), + &ia->hello_timer); } static void @@ -733,7 +733,7 @@ static void start_wait_for_ldp_sync_timer(struct iface *iface) return; THREAD_OFF(iface->ldp_sync.wait_for_sync_timer); - thread_add_timer(master, iface_wait_for_ldp_sync_timer, iface, + event_add_timer(master, iface_wait_for_ldp_sync_timer, iface, if_get_wait_for_sync_interval(), &iface->ldp_sync.wait_for_sync_timer); } diff --git a/ldpd/lde.c b/ldpd/lde.c index 3a38e165cc..a84c6635da 100644 --- a/ldpd/lde.c +++ b/ldpd/lde.c @@ -134,8 +134,8 @@ lde(void) fatal(NULL); imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC); iev_main->handler_read = lde_dispatch_parent; - thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd, - &iev_main->ev_read); + event_add_read(master, iev_main->handler_read, iev_main, + iev_main->ibuf.fd, &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; memset(&iev_main_sync_data, 0, sizeof(iev_main_sync_data)); @@ -523,8 +523,8 @@ static void lde_dispatch_parent(struct event *thread) fatal(NULL); imsg_init(&iev_ldpe->ibuf, fd); iev_ldpe->handler_read = lde_dispatch_imsg; - thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd, - &iev_ldpe->ev_read); + event_add_read(master, iev_ldpe->handler_read, iev_ldpe, + iev_ldpe->ibuf.fd, &iev_ldpe->ev_read); iev_ldpe->handler_write = ldp_write_handler; iev_ldpe->ev_write = NULL; break; @@ -2178,7 +2178,7 @@ retry: zclient_sync = NULL; /* Retry using a timer */ - thread_add_timer(master, zclient_sync_retry, NULL, 1, NULL); + event_add_timer(master, zclient_sync_retry, NULL, 1, NULL); } static void diff --git a/ldpd/lde_lib.c b/ldpd/lde_lib.c index 62d06dfb19..721a1c11ef 100644 --- a/ldpd/lde_lib.c +++ b/ldpd/lde_lib.c @@ -1058,8 +1058,7 @@ void lde_gc_start_timer(void) { THREAD_OFF(gc_timer); - thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL, - &gc_timer); + event_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL, &gc_timer); } void diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index f549b34ee2..c87bf1ea1a 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -383,7 +383,7 @@ main(int argc, char *argv[]) frr_config_fork(); /* apply configuration */ - thread_add_event(master, ldp_config_fork_apply, NULL, 0, NULL); + event_add_event(master, ldp_config_fork_apply, NULL, 0, NULL); /* setup pipes to children */ if ((iev_ldpe = calloc(1, sizeof(struct imsgev))) == NULL || @@ -394,26 +394,26 @@ main(int argc, char *argv[]) imsg_init(&iev_ldpe->ibuf, pipe_parent2ldpe[0]); iev_ldpe->handler_read = main_dispatch_ldpe; - thread_add_read(master, iev_ldpe->handler_read, iev_ldpe, iev_ldpe->ibuf.fd, - &iev_ldpe->ev_read); + event_add_read(master, iev_ldpe->handler_read, iev_ldpe, + iev_ldpe->ibuf.fd, &iev_ldpe->ev_read); iev_ldpe->handler_write = ldp_write_handler; imsg_init(&iev_ldpe_sync->ibuf, pipe_parent2ldpe_sync[0]); iev_ldpe_sync->handler_read = main_dispatch_ldpe; - thread_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync, iev_ldpe_sync->ibuf.fd, - &iev_ldpe_sync->ev_read); + event_add_read(master, iev_ldpe_sync->handler_read, iev_ldpe_sync, + iev_ldpe_sync->ibuf.fd, &iev_ldpe_sync->ev_read); iev_ldpe_sync->handler_write = ldp_write_handler; imsg_init(&iev_lde->ibuf, pipe_parent2lde[0]); iev_lde->handler_read = main_dispatch_lde; - thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd, - &iev_lde->ev_read); + event_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd, + &iev_lde->ev_read); iev_lde->handler_write = ldp_write_handler; imsg_init(&iev_lde_sync->ibuf, pipe_parent2lde_sync[0]); iev_lde_sync->handler_read = main_dispatch_lde; - thread_add_read(master, iev_lde_sync->handler_read, iev_lde_sync, iev_lde_sync->ibuf.fd, - &iev_lde_sync->ev_read); + event_add_read(master, iev_lde_sync->handler_read, iev_lde_sync, + iev_lde_sync->ibuf.fd, &iev_lde_sync->ev_read); iev_lde_sync->handler_write = ldp_write_handler; if (main_imsg_send_ipc_sockets(&iev_ldpe->ibuf, &iev_lde->ibuf)) @@ -787,12 +787,12 @@ void imsg_event_add(struct imsgev *iev) { if (iev->handler_read) - thread_add_read(master, iev->handler_read, iev, iev->ibuf.fd, - &iev->ev_read); + event_add_read(master, iev->handler_read, iev, iev->ibuf.fd, + &iev->ev_read); if (iev->handler_write && iev->ibuf.w.queued) - thread_add_write(master, iev->handler_write, iev, - iev->ibuf.fd, &iev->ev_write); + event_add_write(master, iev->handler_write, iev, iev->ibuf.fd, + &iev->ev_write); } int @@ -819,8 +819,8 @@ void evbuf_event_add(struct evbuf *eb) { if (eb->wbuf.queued) - thread_add_write(master, eb->handler, eb->arg, eb->wbuf.fd, - &eb->ev); + event_add_write(master, eb->handler, eb->arg, eb->wbuf.fd, + &eb->ev); } void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct event *), diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 61a1a2aa81..68f6bc8bc3 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -111,8 +111,8 @@ ldpe(void) fatal(NULL); imsg_init(&iev_main->ibuf, LDPD_FD_ASYNC); iev_main->handler_read = ldpe_dispatch_main; - thread_add_read(master, iev_main->handler_read, iev_main, iev_main->ibuf.fd, - &iev_main->ev_read); + event_add_read(master, iev_main->handler_read, iev_main, + iev_main->ibuf.fd, &iev_main->ev_read); iev_main->handler_write = ldp_write_handler; memset(&iev_main_data, 0, sizeof(iev_main_data)); @@ -137,8 +137,8 @@ ldpe_init(struct ldpd_init *init) /* This socket must be open before dropping privileges. */ global.pfkeysock = pfkey_init(); if (sysdep.no_pfkey == 0) { - thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, - &pfkey_ev); + event_add_read(master, ldpe_dispatch_pfkey, NULL, + global.pfkeysock, &pfkey_ev); } #endif @@ -363,8 +363,8 @@ static void ldpe_dispatch_main(struct event *thread) fatal(NULL); imsg_init(&iev_lde->ibuf, fd); iev_lde->handler_read = ldpe_dispatch_lde; - thread_add_read(master, iev_lde->handler_read, iev_lde, iev_lde->ibuf.fd, - &iev_lde->ev_read); + event_add_read(master, iev_lde->handler_read, iev_lde, + iev_lde->ibuf.fd, &iev_lde->ev_read); iev_lde->handler_write = ldp_write_handler; iev_lde->ev_write = NULL; break; @@ -763,8 +763,8 @@ static void ldpe_dispatch_pfkey(struct event *thread) { int fd = THREAD_FD(thread); - thread_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, - &pfkey_ev); + event_add_read(master, ldpe_dispatch_pfkey, NULL, global.pfkeysock, + &pfkey_ev); if (pfkey_read(fd, NULL) == -1) fatal("pfkey_read failed, exiting..."); @@ -781,13 +781,13 @@ ldpe_setup_sockets(int af, int disc_socket, int edisc_socket, /* discovery socket */ af_global->ldp_disc_socket = disc_socket; - thread_add_read(master, disc_recv_packet, &af_global->disc_ev, af_global->ldp_disc_socket, - &af_global->disc_ev); + event_add_read(master, disc_recv_packet, &af_global->disc_ev, + af_global->ldp_disc_socket, &af_global->disc_ev); /* extended discovery socket */ af_global->ldp_edisc_socket = edisc_socket; - thread_add_read(master, disc_recv_packet, &af_global->edisc_ev, af_global->ldp_edisc_socket, - &af_global->edisc_ev); + event_add_read(master, disc_recv_packet, &af_global->edisc_ev, + af_global->ldp_edisc_socket, &af_global->edisc_ev); /* session socket */ af_global->ldp_session_socket = session_socket; diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index e1c9e63375..e0cd0ec394 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -425,7 +425,7 @@ nbr_start_ktimer(struct nbr *nbr) secs = nbr->keepalive / KEEPALIVE_PER_PERIOD; THREAD_OFF(nbr->keepalive_timer); nbr->keepalive_timer = NULL; - thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer); + event_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer); } void @@ -452,8 +452,8 @@ nbr_start_ktimeout(struct nbr *nbr) { THREAD_OFF(nbr->keepalive_timeout); nbr->keepalive_timeout = NULL; - thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive, - &nbr->keepalive_timeout); + event_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive, + &nbr->keepalive_timeout); } void @@ -481,7 +481,7 @@ nbr_start_itimeout(struct nbr *nbr) secs = INIT_FSM_TIMEOUT; THREAD_OFF(nbr->init_timeout); nbr->init_timeout = NULL; - thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout); + event_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout); } void @@ -527,8 +527,7 @@ nbr_start_idtimer(struct nbr *nbr) THREAD_OFF(nbr->initdelay_timer); nbr->initdelay_timer = NULL; - thread_add_timer(master, nbr_idtimer, nbr, secs, - &nbr->initdelay_timer); + event_add_timer(master, nbr_idtimer, nbr, secs, &nbr->initdelay_timer); } void @@ -650,8 +649,8 @@ nbr_establish_connection(struct nbr *nbr) if (connect(nbr->fd, &remote_su.sa, sockaddr_len(&remote_su.sa)) == -1) { if (errno == EINPROGRESS) { - thread_add_write(master, nbr_connect_cb, nbr, nbr->fd, - &nbr->ev_connect); + event_add_write(master, nbr_connect_cb, nbr, nbr->fd, + &nbr->ev_connect); return (0); } log_warn("%s: error while connecting to %s", __func__, diff --git a/ldpd/packet.c b/ldpd/packet.c index 6770ab73ef..ef2f6e82b8 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -129,7 +129,7 @@ void disc_recv_packet(struct event *thread) struct in_addr lsr_id; /* reschedule read */ - thread_add_read(master, disc_recv_packet, threadp, fd, threadp); + event_add_read(master, disc_recv_packet, threadp, fd, threadp); /* setup buffer */ memset(&m, 0, sizeof(m)); @@ -406,7 +406,7 @@ static void session_read(struct event *thread) uint16_t pdu_len, msg_len, msg_size, max_pdu_len; int ret; - thread_add_read(master, session_read, nbr, fd, &tcp->rev); + event_add_read(master, session_read, nbr, fd, &tcp->rev); if ((n = read(fd, tcp->rbuf->buf + tcp->rbuf->wpos, sizeof(tcp->rbuf->buf) - tcp->rbuf->wpos)) == -1) { @@ -721,7 +721,7 @@ tcp_new(int fd, struct nbr *nbr) if ((tcp->rbuf = calloc(1, sizeof(struct ibuf_read))) == NULL) fatal(__func__); - thread_add_read(master, session_read, nbr, tcp->fd, &tcp->rev); + event_add_read(master, session_read, nbr, tcp->fd, &tcp->rev); tcp->nbr = nbr; } @@ -768,8 +768,8 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr) pconn->addr = *addr; TAILQ_INSERT_TAIL(&global.pending_conns, pconn, entry); pconn->ev_timeout = NULL; - thread_add_timer(master, pending_conn_timeout, pconn, PENDING_CONN_TIMEOUT, - &pconn->ev_timeout); + event_add_timer(master, pending_conn_timeout, pconn, + PENDING_CONN_TIMEOUT, &pconn->ev_timeout); return (pconn); } diff --git a/lib/agentx.c b/lib/agentx.c index a17ee17253..fc724e7d70 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -103,8 +103,8 @@ static void agentx_events_update(void) snmp_select_info(&maxfd, &fds, &timeout, &block); if (!block) { - thread_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout, - &timeout_thr); + event_add_timer_tv(agentx_tm, agentx_timeout, NULL, &timeout, + &timeout_thr); } ln = listhead(events); @@ -133,7 +133,7 @@ static void agentx_events_update(void) thr = XCALLOC(MTYPE_TMP, sizeof(struct event *)); newln = listnode_add_before(events, ln, thr); - thread_add_read(agentx_tm, agentx_read, newln, fd, thr); + event_add_read(agentx_tm, agentx_read, newln, fd, thr); } } diff --git a/lib/bfd.c b/lib/bfd.c index 04f1c27b85..e1aa45f097 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -75,7 +75,7 @@ struct bfd_session_params { * Next event. * * This variable controls what action to execute when the command batch - * finishes. Normally we'd use `thread_add_event` value, however since + * finishes. Normally we'd use `event_add_event` value, however since * that function is going to be called multiple times and the value * might be different we'll use this variable to keep track of it. */ @@ -733,13 +733,13 @@ void bfd_sess_set_auto_source(struct bfd_session_params *bsp, bool enable) void bfd_sess_install(struct bfd_session_params *bsp) { bsp->lastev = BSE_INSTALL; - thread_add_event(bsglobal.tm, _bfd_sess_send, bsp, 0, &bsp->installev); + event_add_event(bsglobal.tm, _bfd_sess_send, bsp, 0, &bsp->installev); } void bfd_sess_uninstall(struct bfd_session_params *bsp) { bsp->lastev = BSE_UNINSTALL; - thread_add_event(bsglobal.tm, _bfd_sess_send, bsp, 0, &bsp->installev); + event_add_event(bsglobal.tm, _bfd_sess_send, bsp, 0, &bsp->installev); } enum bfd_session_state bfd_sess_status(const struct bfd_session_params *bsp) diff --git a/lib/event.c b/lib/event.c index 266670e396..f081ec4274 100644 --- a/lib/event.c +++ b/lib/event.c @@ -948,10 +948,10 @@ done: } /* Add new read thread. */ -void _thread_add_read_write(const struct xref_threadsched *xref, - struct thread_master *m, - void (*func)(struct event *), void *arg, int fd, - struct event **t_ptr) +void _event_add_read_write(const struct xref_threadsched *xref, + struct thread_master *m, + void (*func)(struct event *), void *arg, int fd, + struct event **t_ptr) { int dir = xref->thread_type; struct event *thread = NULL; @@ -1028,11 +1028,11 @@ void _thread_add_read_write(const struct xref_threadsched *xref, } } -static void _thread_add_timer_timeval(const struct xref_threadsched *xref, - struct thread_master *m, - void (*func)(struct event *), void *arg, - struct timeval *time_relative, - struct event **t_ptr) +static void _event_add_timer_timeval(const struct xref_threadsched *xref, + struct thread_master *m, + void (*func)(struct event *), void *arg, + struct timeval *time_relative, + struct event **t_ptr) { struct event *thread; struct timeval t; @@ -1082,9 +1082,9 @@ static void _thread_add_timer_timeval(const struct xref_threadsched *xref, /* Add timer event thread. */ -void _thread_add_timer(const struct xref_threadsched *xref, - struct thread_master *m, void (*func)(struct event *), - void *arg, long timer, struct event **t_ptr) +void _event_add_timer(const struct xref_threadsched *xref, + struct thread_master *m, void (*func)(struct event *), + void *arg, long timer, struct event **t_ptr) { struct timeval trel; @@ -1093,14 +1093,14 @@ void _thread_add_timer(const struct xref_threadsched *xref, trel.tv_sec = timer; trel.tv_usec = 0; - _thread_add_timer_timeval(xref, m, func, arg, &trel, t_ptr); + _event_add_timer_timeval(xref, m, func, arg, &trel, t_ptr); } /* Add timer event thread with "millisecond" resolution */ -void _thread_add_timer_msec(const struct xref_threadsched *xref, - struct thread_master *m, - void (*func)(struct event *), void *arg, long timer, - struct event **t_ptr) +void _event_add_timer_msec(const struct xref_threadsched *xref, + struct thread_master *m, + void (*func)(struct event *), void *arg, long timer, + struct event **t_ptr) { struct timeval trel; @@ -1109,21 +1109,21 @@ void _thread_add_timer_msec(const struct xref_threadsched *xref, trel.tv_sec = timer / 1000; trel.tv_usec = 1000 * (timer % 1000); - _thread_add_timer_timeval(xref, m, func, arg, &trel, t_ptr); + _event_add_timer_timeval(xref, m, func, arg, &trel, t_ptr); } /* Add timer event thread with "timeval" resolution */ -void _thread_add_timer_tv(const struct xref_threadsched *xref, - struct thread_master *m, void (*func)(struct event *), - void *arg, struct timeval *tv, struct event **t_ptr) +void _event_add_timer_tv(const struct xref_threadsched *xref, + struct thread_master *m, void (*func)(struct event *), + void *arg, struct timeval *tv, struct event **t_ptr) { - _thread_add_timer_timeval(xref, m, func, arg, tv, t_ptr); + _event_add_timer_timeval(xref, m, func, arg, tv, t_ptr); } /* Add simple event thread. */ -void _thread_add_event(const struct xref_threadsched *xref, - struct thread_master *m, void (*func)(struct event *), - void *arg, int val, struct event **t_ptr) +void _event_add_event(const struct xref_threadsched *xref, + struct thread_master *m, void (*func)(struct event *), + void *arg, int val, struct event **t_ptr) { struct event *thread = NULL; diff --git a/lib/event.h b/lib/event.h index e1d3ad68ab..375cd46bbf 100644 --- a/lib/event.h +++ b/lib/event.h @@ -172,24 +172,26 @@ struct cpu_thread_history { #define _xref_t_a(addfn, type, m, f, a, v, t) \ ({ \ - static const struct xref_threadsched _xref \ - __attribute__((used)) = { \ + static const struct xref_threadsched _xref __attribute__( \ + (used)) = { \ .xref = XREF_INIT(XREFT_THREADSCHED, NULL, __func__), \ .funcname = #f, \ .dest = #t, \ - .thread_type = THREAD_ ## type, \ + .thread_type = THREAD_##type, \ }; \ XREF_LINK(_xref.xref); \ - _thread_add_ ## addfn(&_xref, m, f, a, v, t); \ - }) \ - /* end */ + _event_add_##addfn(&_xref, m, f, a, v, t); \ + }) /* end */ -#define thread_add_read(m,f,a,v,t) _xref_t_a(read_write, READ, m,f,a,v,t) -#define thread_add_write(m,f,a,v,t) _xref_t_a(read_write, WRITE, m,f,a,v,t) -#define thread_add_timer(m,f,a,v,t) _xref_t_a(timer, TIMER, m,f,a,v,t) -#define thread_add_timer_msec(m,f,a,v,t) _xref_t_a(timer_msec, TIMER, m,f,a,v,t) -#define thread_add_timer_tv(m,f,a,v,t) _xref_t_a(timer_tv, TIMER, m,f,a,v,t) -#define thread_add_event(m,f,a,v,t) _xref_t_a(event, EVENT, m,f,a,v,t) +#define event_add_read(m, f, a, v, t) _xref_t_a(read_write, READ, m, f, a, v, t) +#define event_add_write(m, f, a, v, t) \ + _xref_t_a(read_write, WRITE, m, f, a, v, t) +#define event_add_timer(m, f, a, v, t) _xref_t_a(timer, TIMER, m, f, a, v, t) +#define event_add_timer_msec(m, f, a, v, t) \ + _xref_t_a(timer_msec, TIMER, m, f, a, v, t) +#define event_add_timer_tv(m, f, a, v, t) \ + _xref_t_a(timer_tv, TIMER, m, f, a, v, t) +#define event_add_event(m, f, a, v, t) _xref_t_a(event, EVENT, m, f, a, v, t) #define thread_execute(m,f,a,v) \ ({ \ @@ -210,30 +212,30 @@ void thread_master_set_name(struct thread_master *master, const char *name); extern void thread_master_free(struct thread_master *); extern void thread_master_free_unused(struct thread_master *); -extern void _thread_add_read_write(const struct xref_threadsched *xref, - struct thread_master *master, - void (*fn)(struct event *), void *arg, - int fd, struct event **tref); +extern void _event_add_read_write(const struct xref_threadsched *xref, + struct thread_master *master, + void (*fn)(struct event *), void *arg, int fd, + struct event **tref); -extern void _thread_add_timer(const struct xref_threadsched *xref, - struct thread_master *master, - void (*fn)(struct event *), void *arg, long t, - struct event **tref); +extern void _event_add_timer(const struct xref_threadsched *xref, + struct thread_master *master, + void (*fn)(struct event *), void *arg, long t, + struct event **tref); -extern void _thread_add_timer_msec(const struct xref_threadsched *xref, - struct thread_master *master, - void (*fn)(struct event *), void *arg, - long t, struct event **tref); +extern void _event_add_timer_msec(const struct xref_threadsched *xref, + struct thread_master *master, + void (*fn)(struct event *), void *arg, long t, + struct event **tref); -extern void _thread_add_timer_tv(const struct xref_threadsched *xref, - struct thread_master *master, - void (*fn)(struct event *), void *arg, - struct timeval *tv, struct event **tref); +extern void _event_add_timer_tv(const struct xref_threadsched *xref, + struct thread_master *master, + void (*fn)(struct event *), void *arg, + struct timeval *tv, struct event **tref); -extern void _thread_add_event(const struct xref_threadsched *xref, - struct thread_master *master, - void (*fn)(struct event *), void *arg, int val, - struct event **tref); +extern void _event_add_event(const struct xref_threadsched *xref, + struct thread_master *master, + void (*fn)(struct event *), void *arg, int val, + struct event **tref); extern void _thread_execute(const struct xref_threadsched *xref, struct thread_master *master, diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 9f026868db..e7bbae0c59 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -239,7 +239,7 @@ static void fpt_finish(struct event *thread) /* stop function, called from other threads to halt this one */ static int fpt_halt(struct frr_pthread *fpt, void **res) { - thread_add_event(fpt->master, &fpt_finish, fpt, 0, NULL); + event_add_event(fpt->master, &fpt_finish, fpt, 0, NULL); pthread_join(fpt->thread, res); return 0; @@ -281,7 +281,7 @@ static void *fpt_run(void *arg) int sleeper[2]; pipe(sleeper); - thread_add_read(fpt->master, &fpt_dummy, NULL, sleeper[0], NULL); + event_add_read(fpt->master, &fpt_dummy, NULL, sleeper[0], NULL); fpt->master->handle_signals = false; diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index 30c51230cb..65e1cf5cfb 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -138,8 +138,8 @@ static void frrzmq_read_msg(struct event *t) if (read) frrzmq_check_events(cbp, &cb->write, ZMQ_POLLOUT); - thread_add_read(t->master, frrzmq_read_msg, cbp, - cb->fd, &cb->read.thread); + event_add_read(t->master, frrzmq_read_msg, cbp, cb->fd, + &cb->read.thread); return; out_err: @@ -149,14 +149,13 @@ out_err: cb->read.cb_error(cb->read.arg, cb->zmqsock); } -int _frrzmq_thread_add_read(const struct xref_threadsched *xref, - struct thread_master *master, - void (*msgfunc)(void *arg, void *zmqsock), - void (*partfunc)(void *arg, void *zmqsock, - zmq_msg_t *msg, unsigned partnum), - void (*errfunc)(void *arg, void *zmqsock), - void *arg, void *zmqsock, - struct frrzmq_cb **cbp) +int _frrzmq_event_add_read(const struct xref_threadsched *xref, + struct thread_master *master, + void (*msgfunc)(void *arg, void *zmqsock), + void (*partfunc)(void *arg, void *zmqsock, + zmq_msg_t *msg, unsigned partnum), + void (*errfunc)(void *arg, void *zmqsock), void *arg, + void *zmqsock, struct frrzmq_cb **cbp) { int fd, events; size_t len; @@ -193,11 +192,11 @@ int _frrzmq_thread_add_read(const struct xref_threadsched *xref, if (events & ZMQ_POLLIN) { thread_cancel(&cb->read.thread); - thread_add_event(master, frrzmq_read_msg, cbp, fd, - &cb->read.thread); - } else - thread_add_read(master, frrzmq_read_msg, cbp, fd, + event_add_event(master, frrzmq_read_msg, cbp, fd, &cb->read.thread); + } else + event_add_read(master, frrzmq_read_msg, cbp, fd, + &cb->read.thread); return 0; } @@ -247,8 +246,8 @@ static void frrzmq_write_msg(struct event *t) if (written) frrzmq_check_events(cbp, &cb->read, ZMQ_POLLIN); - thread_add_write(t->master, frrzmq_write_msg, cbp, - cb->fd, &cb->write.thread); + event_add_write(t->master, frrzmq_write_msg, cbp, cb->fd, + &cb->write.thread); return; out_err: @@ -258,11 +257,11 @@ out_err: cb->write.cb_error(cb->write.arg, cb->zmqsock); } -int _frrzmq_thread_add_write(const struct xref_threadsched *xref, - struct thread_master *master, - void (*msgfunc)(void *arg, void *zmqsock), - void (*errfunc)(void *arg, void *zmqsock), - void *arg, void *zmqsock, struct frrzmq_cb **cbp) +int _frrzmq_event_add_write(const struct xref_threadsched *xref, + struct thread_master *master, + void (*msgfunc)(void *arg, void *zmqsock), + void (*errfunc)(void *arg, void *zmqsock), + void *arg, void *zmqsock, struct frrzmq_cb **cbp) { int fd, events; size_t len; @@ -299,11 +298,11 @@ int _frrzmq_thread_add_write(const struct xref_threadsched *xref, if (events & ZMQ_POLLOUT) { thread_cancel(&cb->write.thread); - _thread_add_event(xref, master, frrzmq_write_msg, cbp, fd, - &cb->write.thread); - } else - thread_add_write(master, frrzmq_write_msg, cbp, fd, + _event_add_event(xref, master, frrzmq_write_msg, cbp, fd, &cb->write.thread); + } else + event_add_write(master, frrzmq_write_msg, cbp, fd, + &cb->write.thread); return 0; } @@ -348,10 +347,10 @@ void frrzmq_check_events(struct frrzmq_cb **cbp, struct cb_core *core, thread_cancel(&core->thread); if (event == ZMQ_POLLIN) - thread_add_event(tm, frrzmq_read_msg, - cbp, cb->fd, &core->thread); + event_add_event(tm, frrzmq_read_msg, cbp, cb->fd, + &core->thread); else - thread_add_event(tm, frrzmq_write_msg, - cbp, cb->fd, &core->thread); + event_add_event(tm, frrzmq_write_msg, cbp, cb->fd, + &core->thread); } } diff --git a/lib/frr_zmq.h b/lib/frr_zmq.h index d90088edb2..b12c0f754a 100644 --- a/lib/frr_zmq.h +++ b/lib/frr_zmq.h @@ -72,17 +72,17 @@ extern void frrzmq_finish(void); /* end */ /* core event registration, one of these 2 macros should be used */ -#define frrzmq_thread_add_read_msg(m, f, e, a, z, d) \ +#define frrzmq_event_add_read_msg(m, f, e, a, z, d) \ _xref_zmq_a(READ, f, d, \ - _frrzmq_thread_add_read(&_xref, m, f, NULL, e, a, z, d)) + _frrzmq_event_add_read(&_xref, m, f, NULL, e, a, z, d)) -#define frrzmq_thread_add_read_part(m, f, e, a, z, d) \ +#define frrzmq_event_add_read_part(m, f, e, a, z, d) \ _xref_zmq_a(READ, f, d, \ - _frrzmq_thread_add_read(&_xref, m, NULL, f, e, a, z, d)) + _frrzmq_event_add_read(&_xref, m, NULL, f, e, a, z, d)) -#define frrzmq_thread_add_write_msg(m, f, e, a, z, d) \ +#define frrzmq_event_add_write_msg(m, f, e, a, z, d) \ _xref_zmq_a(WRITE, f, d, \ - _frrzmq_thread_add_write(&_xref, m, f, e, a, z, d)) + _frrzmq_event_add_write(&_xref, m, f, e, a, z, d)) struct cb_core; struct frrzmq_cb; @@ -108,18 +108,20 @@ struct frrzmq_cb; * may schedule the event to run as soon as libfrr is back in its main * loop. */ -extern int _frrzmq_thread_add_read( - const struct xref_threadsched *xref, struct thread_master *master, - void (*msgfunc)(void *arg, void *zmqsock), - void (*partfunc)(void *arg, void *zmqsock, zmq_msg_t *msg, - unsigned partnum), - void (*errfunc)(void *arg, void *zmqsock), void *arg, void *zmqsock, - struct frrzmq_cb **cb); -extern int _frrzmq_thread_add_write( - const struct xref_threadsched *xref, struct thread_master *master, - void (*msgfunc)(void *arg, void *zmqsock), - void (*errfunc)(void *arg, void *zmqsock), void *arg, void *zmqsock, - struct frrzmq_cb **cb); +extern int +_frrzmq_event_add_read(const struct xref_threadsched *xref, + struct thread_master *master, + void (*msgfunc)(void *arg, void *zmqsock), + void (*partfunc)(void *arg, void *zmqsock, + zmq_msg_t *msg, unsigned partnum), + void (*errfunc)(void *arg, void *zmqsock), void *arg, + void *zmqsock, struct frrzmq_cb **cb); +extern int _frrzmq_event_add_write(const struct xref_threadsched *xref, + struct thread_master *master, + void (*msgfunc)(void *arg, void *zmqsock), + void (*errfunc)(void *arg, void *zmqsock), + void *arg, void *zmqsock, + struct frrzmq_cb **cb); extern void frrzmq_thread_cancel(struct frrzmq_cb **cb, struct cb_core *core); diff --git a/lib/libfrr.c b/lib/libfrr.c index 433e9cb148..9a57c2313c 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -1015,8 +1015,8 @@ void frr_config_fork(void) exit(0); } - thread_add_event(master, frr_config_read_in, NULL, 0, - &di->read_in); + event_add_event(master, frr_config_read_in, NULL, 0, + &di->read_in); } if (di->daemon_mode || di->terminal) @@ -1129,8 +1129,8 @@ static void frr_daemon_ctl(struct event *t) } out: - thread_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock, - &daemon_ctl_thread); + event_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock, + &daemon_ctl_thread); } void frr_detach(void) @@ -1158,8 +1158,8 @@ void frr_run(struct thread_master *master) vty_stdio(frr_terminal_close); if (daemon_ctl_sock != -1) { set_nonblocking(daemon_ctl_sock); - thread_add_read(master, frr_daemon_ctl, NULL, - daemon_ctl_sock, &daemon_ctl_thread); + event_add_read(master, frr_daemon_ctl, NULL, + daemon_ctl_sock, &daemon_ctl_thread); } } else if (di->daemon_mode) { int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); diff --git a/lib/mgmt_be_client.c b/lib/mgmt_be_client.c index b70c00635d..ca4e219480 100644 --- a/lib/mgmt_be_client.c +++ b/lib/mgmt_be_client.c @@ -1053,25 +1053,25 @@ mgmt_be_client_register_event(struct mgmt_be_client_ctx *client_ctx, switch (event) { case MGMTD_BE_CONN_READ: - thread_add_read(client_ctx->tm, mgmt_be_client_read, + event_add_read(client_ctx->tm, mgmt_be_client_read, client_ctx, client_ctx->conn_fd, &client_ctx->conn_read_ev); assert(client_ctx->conn_read_ev); break; case MGMTD_BE_CONN_WRITE: - thread_add_write(client_ctx->tm, mgmt_be_client_write, + event_add_write(client_ctx->tm, mgmt_be_client_write, client_ctx, client_ctx->conn_fd, &client_ctx->conn_write_ev); assert(client_ctx->conn_write_ev); break; case MGMTD_BE_PROC_MSG: tv.tv_usec = MGMTD_BE_MSG_PROC_DELAY_USEC; - thread_add_timer_tv(client_ctx->tm, mgmt_be_client_proc_msgbufs, + event_add_timer_tv(client_ctx->tm, mgmt_be_client_proc_msgbufs, client_ctx, &tv, &client_ctx->msg_proc_ev); assert(client_ctx->msg_proc_ev); break; case MGMTD_BE_CONN_WRITES_ON: - thread_add_timer_msec(client_ctx->tm, + event_add_timer_msec(client_ctx->tm, mgmt_be_client_resume_writes, client_ctx, MGMTD_BE_MSG_WRITE_DELAY_MSEC, &client_ctx->conn_writes_on); @@ -1095,7 +1095,7 @@ mgmt_be_client_schedule_conn_retry(struct mgmt_be_client_ctx *client_ctx, MGMTD_BE_CLIENT_DBG( "Scheduling MGMTD Backend server connection retry after %lu seconds", intvl_secs); - thread_add_timer(client_ctx->tm, mgmt_be_client_conn_timeout, + event_add_timer(client_ctx->tm, mgmt_be_client_conn_timeout, (void *)client_ctx, intvl_secs, &client_ctx->conn_retry_tmr); } diff --git a/lib/mgmt_fe_client.c b/lib/mgmt_fe_client.c index c0d897ab2c..f41217ce31 100644 --- a/lib/mgmt_fe_client.c +++ b/lib/mgmt_fe_client.c @@ -738,26 +738,26 @@ mgmt_fe_client_register_event(struct mgmt_fe_client_ctx *client_ctx, switch (event) { case MGMTD_FE_CONN_READ: - thread_add_read(client_ctx->tm, mgmt_fe_client_read, + event_add_read(client_ctx->tm, mgmt_fe_client_read, client_ctx, client_ctx->conn_fd, &client_ctx->conn_read_ev); assert(client_ctx->conn_read_ev); break; case MGMTD_FE_CONN_WRITE: - thread_add_write(client_ctx->tm, mgmt_fe_client_write, + event_add_write(client_ctx->tm, mgmt_fe_client_write, client_ctx, client_ctx->conn_fd, &client_ctx->conn_write_ev); assert(client_ctx->conn_write_ev); break; case MGMTD_FE_PROC_MSG: tv.tv_usec = MGMTD_FE_MSG_PROC_DELAY_USEC; - thread_add_timer_tv(client_ctx->tm, + event_add_timer_tv(client_ctx->tm, mgmt_fe_client_proc_msgbufs, client_ctx, &tv, &client_ctx->msg_proc_ev); assert(client_ctx->msg_proc_ev); break; case MGMTD_FE_CONN_WRITES_ON: - thread_add_timer_msec( + event_add_timer_msec( client_ctx->tm, mgmt_fe_client_resume_writes, client_ctx, MGMTD_FE_MSG_WRITE_DELAY_MSEC, &client_ctx->conn_writes_on); @@ -775,7 +775,7 @@ static void mgmt_fe_client_schedule_conn_retry( MGMTD_FE_CLIENT_DBG( "Scheduling MGMTD Frontend server connection retry after %lu seconds", intvl_secs); - thread_add_timer(client_ctx->tm, mgmt_fe_client_conn_timeout, + event_add_timer(client_ctx->tm, mgmt_fe_client_conn_timeout, (void *)client_ctx, intvl_secs, &client_ctx->conn_retry_tmr); } diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 6d0ee100bc..704904304c 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -329,10 +329,9 @@ static int nb_cli_commit(struct vty *vty, bool force, confirmed_timeout); thread_cancel(&vty->t_confirmed_commit_timeout); - thread_add_timer(master, - nb_cli_confirmed_commit_timeout, vty, - confirmed_timeout * 60, - &vty->t_confirmed_commit_timeout); + event_add_timer(master, nb_cli_confirmed_commit_timeout, + vty, confirmed_timeout * 60, + &vty->t_confirmed_commit_timeout); } else { /* Accept commit confirmation. */ vty_out(vty, "%% Commit complete.\n\n"); @@ -355,9 +354,9 @@ static int nb_cli_commit(struct vty *vty, bool force, vty->confirmed_commit_rollback = nb_config_dup(running_config); vty->t_confirmed_commit_timeout = NULL; - thread_add_timer(master, nb_cli_confirmed_commit_timeout, vty, - confirmed_timeout * 60, - &vty->t_confirmed_commit_timeout); + event_add_timer(master, nb_cli_confirmed_commit_timeout, vty, + confirmed_timeout * 60, + &vty->t_confirmed_commit_timeout); } context.client = NB_CLIENT_CLI; diff --git a/lib/northbound_confd.c b/lib/northbound_confd.c index f0084e576b..b674912354 100644 --- a/lib/northbound_confd.c +++ b/lib/northbound_confd.c @@ -409,7 +409,7 @@ static void frr_confd_cdb_read_cb(struct event *thread) int *subp = NULL; int reslen = 0; - thread_add_read(master, frr_confd_cdb_read_cb, NULL, fd, &t_cdb_sub); + event_add_read(master, frr_confd_cdb_read_cb, NULL, fd, &t_cdb_sub); if (cdb_read_subscription_socket2(fd, &cdb_ev, &flags, &subp, &reslen) != CONFD_OK) { @@ -574,8 +574,8 @@ static int frr_confd_init_cdb(void) } pthread_detach(cdb_trigger_thread); - thread_add_read(master, frr_confd_cdb_read_cb, NULL, cdb_sub_sock, - &t_cdb_sub); + event_add_read(master, frr_confd_cdb_read_cb, NULL, cdb_sub_sock, + &t_cdb_sub); return 0; @@ -1178,7 +1178,7 @@ static void frr_confd_dp_ctl_read(struct event *thread) struct confd_daemon_ctx *dctx = THREAD_ARG(thread); int fd = THREAD_FD(thread); - thread_add_read(master, frr_confd_dp_ctl_read, dctx, fd, &t_dp_ctl); + event_add_read(master, frr_confd_dp_ctl_read, dctx, fd, &t_dp_ctl); frr_confd_dp_read(dctx, fd); } @@ -1188,7 +1188,8 @@ static void frr_confd_dp_worker_read(struct event *thread) struct confd_daemon_ctx *dctx = THREAD_ARG(thread); int fd = THREAD_FD(thread); - thread_add_read(master, frr_confd_dp_worker_read, dctx, fd, &t_dp_worker); + event_add_read(master, frr_confd_dp_worker_read, dctx, fd, + &t_dp_worker); frr_confd_dp_read(dctx, fd); } @@ -1320,10 +1321,10 @@ static int frr_confd_init_dp(const char *program_name) goto error; } - thread_add_read(master, frr_confd_dp_ctl_read, dctx, dp_ctl_sock, - &t_dp_ctl); - thread_add_read(master, frr_confd_dp_worker_read, dctx, dp_worker_sock, - &t_dp_worker); + event_add_read(master, frr_confd_dp_ctl_read, dctx, dp_ctl_sock, + &t_dp_ctl); + event_add_read(master, frr_confd_dp_worker_read, dctx, dp_worker_sock, + &t_dp_worker); return 0; diff --git a/lib/northbound_grpc.cpp b/lib/northbound_grpc.cpp index 4de2b0e339..a06daa8676 100644 --- a/lib/northbound_grpc.cpp +++ b/lib/northbound_grpc.cpp @@ -157,8 +157,7 @@ class RpcStateBase * state will either be MORE or FINISH. It will always be FINISH * for Unary RPCs. */ - thread_add_event(main_master, c_callback, (void *)this, 0, - NULL); + event_add_event(main_master, c_callback, (void *)this, 0, NULL); pthread_mutex_lock(&this->cmux); while (this->state == PROCESS) @@ -1303,7 +1302,7 @@ static int frr_grpc_module_late_init(struct thread_master *tm) { main_master = tm; hook_register(frr_fini, frr_grpc_finish); - thread_add_event(tm, frr_grpc_module_very_late_init, NULL, 0, NULL); + event_add_event(tm, frr_grpc_module_very_late_init, NULL, 0, NULL); return 0; } diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index 9b0d2817d7..145e43ddb1 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -528,7 +528,7 @@ static void frr_sr_read_cb(struct event *thread) return; } - thread_add_read(master, frr_sr_read_cb, module, fd, &module->sr_thread); + event_add_read(master, frr_sr_read_cb, module, fd, &module->sr_thread); } static void frr_sr_subscribe_config(struct yang_module *module) @@ -688,8 +688,8 @@ static int frr_sr_init(void) sr_strerror(ret)); goto cleanup; } - thread_add_read(master, frr_sr_read_cb, module, - event_pipe, &module->sr_thread); + event_add_read(master, frr_sr_read_cb, module, event_pipe, + &module->sr_thread); } hook_register(nb_notification_send, frr_sr_notification_send); diff --git a/lib/pullwr.c b/lib/pullwr.c index de07ca1681..55ff4df011 100644 --- a/lib/pullwr.c +++ b/lib/pullwr.c @@ -80,7 +80,7 @@ void pullwr_bump(struct pullwr *pullwr) if (pullwr->writer) return; - thread_add_timer(pullwr->tm, pullwr_run, pullwr, 0, &pullwr->writer); + event_add_timer(pullwr->tm, pullwr_run, pullwr, 0, &pullwr->writer); } static size_t pullwr_iov(struct pullwr *pullwr, struct iovec *iov) @@ -206,7 +206,7 @@ static void pullwr_run(struct event *t) if (pullwr->valid == 0) { /* we made a fill() call above that didn't feed any * data in, and we have nothing more queued, so we go - * into idle, i.e. no calling thread_add_write() + * into idle, i.e. no calling event_add_write() */ pullwr_resize(pullwr, 0); return; @@ -237,7 +237,7 @@ static void pullwr_run(struct event *t) * is full and we go wait until it's available for writing again. */ - thread_add_write(pullwr->tm, pullwr_run, pullwr, pullwr->fd, + event_add_write(pullwr->tm, pullwr_run, pullwr, pullwr->fd, &pullwr->writer); /* if we hit the time limit, just keep the buffer, we'll probably need diff --git a/lib/resolver.c b/lib/resolver.c index c455b9bd2a..36bad20f37 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -113,8 +113,8 @@ static void resolver_cb_socket_readable(struct event *t) struct resolver_fd *resfd = THREAD_ARG(t); struct resolver_state *r = resfd->state; - thread_add_read(r->master, resolver_cb_socket_readable, resfd, - resfd->fd, &resfd->t_read); + event_add_read(r->master, resolver_cb_socket_readable, resfd, resfd->fd, + &resfd->t_read); /* ^ ordering important: * ares_process_fd may transitively call THREAD_OFF(resfd->t_read) * combined with resolver_fd_drop_maybe, so resfd may be free'd after! @@ -128,8 +128,8 @@ static void resolver_cb_socket_writable(struct event *t) struct resolver_fd *resfd = THREAD_ARG(t); struct resolver_state *r = resfd->state; - thread_add_write(r->master, resolver_cb_socket_writable, resfd, - resfd->fd, &resfd->t_write); + event_add_write(r->master, resolver_cb_socket_writable, resfd, + resfd->fd, &resfd->t_write); /* ^ ordering important: * ares_process_fd may transitively call THREAD_OFF(resfd->t_write) * combined with resolver_fd_drop_maybe, so resfd may be free'd after! @@ -147,8 +147,8 @@ static void resolver_update_timeouts(struct resolver_state *r) if (tv) { unsigned int timeoutms = tv->tv_sec * 1000 + tv->tv_usec / 1000; - thread_add_timer_msec(r->master, resolver_cb_timeout, r, - timeoutms, &r->timeout); + event_add_timer_msec(r->master, resolver_cb_timeout, r, + timeoutms, &r->timeout); } } @@ -167,14 +167,14 @@ static void ares_socket_cb(void *data, ares_socket_t fd, int readable, if (!readable) THREAD_OFF(resfd->t_read); else if (!resfd->t_read) - thread_add_read(r->master, resolver_cb_socket_readable, resfd, - fd, &resfd->t_read); + event_add_read(r->master, resolver_cb_socket_readable, resfd, + fd, &resfd->t_read); if (!writable) THREAD_OFF(resfd->t_write); else if (!resfd->t_write) - thread_add_write(r->master, resolver_cb_socket_writable, resfd, - fd, &resfd->t_write); + event_add_write(r->master, resolver_cb_socket_writable, resfd, + fd, &resfd->t_write); resolver_fd_drop_maybe(resfd); } @@ -264,8 +264,8 @@ void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, /* for consistency with proper name lookup, don't call the * callback immediately; defer to thread loop */ - thread_add_timer_msec(state.master, resolver_cb_literal, - query, 0, &query->literal_cb); + event_add_timer_msec(state.master, resolver_cb_literal, query, + 0, &query->literal_cb); return; } diff --git a/lib/sigevent.c b/lib/sigevent.c index 40da4f3fce..a7900466b8 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -133,8 +133,8 @@ void frr_signal_timer(struct event *t) sigm = THREAD_ARG(t); sigm->t = NULL; - thread_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, - FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); + event_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, + FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); frr_sigevent_process(); } #endif /* SIGEVENT_SCHEDULE_THREAD */ @@ -354,7 +354,7 @@ void signal_init(struct thread_master *m, int sigc, #ifdef SIGEVENT_SCHEDULE_THREAD sigmaster.t = NULL; - thread_add_timer(m, frr_signal_timer, &sigmaster, - FRR_SIGNAL_TIMER_INTERVAL, &sigmaster.t); + event_add_timer(m, frr_signal_timer, &sigmaster, + FRR_SIGNAL_TIMER_INTERVAL, &sigmaster.t); #endif /* SIGEVENT_SCHEDULE_THREAD */ } diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index b77f782ee5..f1fb84e0b5 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -139,21 +139,21 @@ long spf_backoff_schedule(struct spf_backoff *backoff) switch (backoff->state) { case SPF_BACKOFF_QUIET: backoff->state = SPF_BACKOFF_SHORT_WAIT; - thread_add_timer_msec( + event_add_timer_msec( backoff->m, spf_backoff_timetolearn_elapsed, backoff, backoff->timetolearn, &backoff->t_timetolearn); - thread_add_timer_msec(backoff->m, spf_backoff_holddown_elapsed, - backoff, backoff->holddown, - &backoff->t_holddown); + event_add_timer_msec(backoff->m, spf_backoff_holddown_elapsed, + backoff, backoff->holddown, + &backoff->t_holddown); backoff->first_event_time = now; rv = backoff->init_delay; break; case SPF_BACKOFF_SHORT_WAIT: case SPF_BACKOFF_LONG_WAIT: thread_cancel(&backoff->t_holddown); - thread_add_timer_msec(backoff->m, spf_backoff_holddown_elapsed, - backoff, backoff->holddown, - &backoff->t_holddown); + event_add_timer_msec(backoff->m, spf_backoff_holddown_elapsed, + backoff, backoff->holddown, + &backoff->t_holddown); if (backoff->state == SPF_BACKOFF_SHORT_WAIT) rv = backoff->short_delay; else diff --git a/lib/systemd.c b/lib/systemd.c index 14a09362dd..5a0668f74f 100644 --- a/lib/systemd.c +++ b/lib/systemd.c @@ -70,8 +70,8 @@ static void systemd_send_watchdog(struct event *t) systemd_send_information("WATCHDOG=1"); assert(watchdog_msec > 0); - thread_add_timer_msec(systemd_master, systemd_send_watchdog, NULL, - watchdog_msec, NULL); + event_add_timer_msec(systemd_master, systemd_send_watchdog, NULL, + watchdog_msec, NULL); } void systemd_send_started(struct thread_master *m) diff --git a/lib/vty.c b/lib/vty.c index aaf7db0f80..8324878c28 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -2807,13 +2807,13 @@ static void vty_event_serv(enum vty_event event, struct vty_serv *vty_serv) { switch (event) { case VTY_SERV: - thread_add_read(vty_master, vty_accept, vty_serv, - vty_serv->sock, &vty_serv->t_accept); + event_add_read(vty_master, vty_accept, vty_serv, vty_serv->sock, + &vty_serv->t_accept); break; #ifdef VTYSH case VTYSH_SERV: - thread_add_read(vty_master, vtysh_accept, vty_serv, - vty_serv->sock, &vty_serv->t_accept); + event_add_read(vty_master, vtysh_accept, vty_serv, + vty_serv->sock, &vty_serv->t_accept); break; #endif /* VTYSH */ case VTY_READ: @@ -2830,34 +2830,34 @@ static void vty_event(enum vty_event event, struct vty *vty) switch (event) { #ifdef VTYSH case VTYSH_READ: - thread_add_read(vty_master, vtysh_read, vty, vty->fd, - &vty->t_read); + event_add_read(vty_master, vtysh_read, vty, vty->fd, + &vty->t_read); break; case VTYSH_WRITE: - thread_add_write(vty_master, vtysh_write, vty, vty->wfd, - &vty->t_write); + event_add_write(vty_master, vtysh_write, vty, vty->wfd, + &vty->t_write); break; #endif /* VTYSH */ case VTY_READ: - thread_add_read(vty_master, vty_read, vty, vty->fd, - &vty->t_read); + event_add_read(vty_master, vty_read, vty, vty->fd, + &vty->t_read); /* Time out treatment. */ if (vty->v_timeout) { THREAD_OFF(vty->t_timeout); - thread_add_timer(vty_master, vty_timeout, vty, - vty->v_timeout, &vty->t_timeout); + event_add_timer(vty_master, vty_timeout, vty, + vty->v_timeout, &vty->t_timeout); } break; case VTY_WRITE: - thread_add_write(vty_master, vty_flush, vty, vty->wfd, - &vty->t_write); + event_add_write(vty_master, vty_flush, vty, vty->wfd, + &vty->t_write); break; case VTY_TIMEOUT_RESET: THREAD_OFF(vty->t_timeout); if (vty->v_timeout) - thread_add_timer(vty_master, vty_timeout, vty, - vty->v_timeout, &vty->t_timeout); + event_add_timer(vty_master, vty_timeout, vty, + vty->v_timeout, &vty->t_timeout); break; case VTY_SERV: case VTYSH_SERV: diff --git a/lib/wheel.c b/lib/wheel.c index 363b27ab13..27e087efc6 100644 --- a/lib/wheel.c +++ b/lib/wheel.c @@ -47,8 +47,8 @@ static void wheel_timer_thread_helper(struct event *t) slots_to_skip++; wheel->slots_to_skip = slots_to_skip; - thread_add_timer_msec(wheel->master, wheel_timer_thread, wheel, - wheel->nexttime * slots_to_skip, &wheel->timer); + event_add_timer_msec(wheel->master, wheel_timer_thread, wheel, + wheel->nexttime * slots_to_skip, &wheel->timer); } static void wheel_timer_thread(struct event *t) @@ -85,8 +85,8 @@ struct timer_wheel *wheel_init(struct thread_master *master, int period, for (i = 0; i < slots; i++) wheel->wheel_slot_lists[i] = list_new(); - thread_add_timer_msec(wheel->master, wheel_timer_thread, wheel, - wheel->nexttime, &wheel->timer); + event_add_timer_msec(wheel->master, wheel_timer_thread, wheel, + wheel->nexttime, &wheel->timer); return wheel; } diff --git a/lib/workqueue.c b/lib/workqueue.c index 50a0ad388c..4a8084bbc6 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -118,12 +118,12 @@ static int work_queue_schedule(struct work_queue *wq, unsigned int delay) * as an 'event' */ if (delay > 0) { - thread_add_timer_msec(wq->master, work_queue_run, wq, - delay, &wq->thread); + event_add_timer_msec(wq->master, work_queue_run, wq, + delay, &wq->thread); thread_ignore_late_timer(wq->thread); } else - thread_add_event(wq->master, work_queue_run, wq, 0, - &wq->thread); + event_add_event(wq->master, work_queue_run, wq, 0, + &wq->thread); /* set thread yield time, if needed */ if (thread_is_scheduled(wq->thread) && diff --git a/lib/zclient.c b/lib/zclient.c index bb5d66df5d..bd8a53d336 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -266,8 +266,8 @@ static void zclient_flush_data(struct event *thread) return; case BUFFER_PENDING: zclient->t_write = NULL; - thread_add_write(zclient->master, zclient_flush_data, zclient, - zclient->sock, &zclient->t_write); + event_add_write(zclient->master, zclient_flush_data, zclient, + zclient->sock, &zclient->t_write); break; case BUFFER_EMPTY: if (zclient->zebra_buffer_write_ready) @@ -298,8 +298,8 @@ enum zclient_send_status zclient_send_message(struct zclient *zclient) THREAD_OFF(zclient->t_write); return ZCLIENT_SEND_SUCCESS; case BUFFER_PENDING: - thread_add_write(zclient->master, zclient_flush_data, zclient, - zclient->sock, &zclient->t_write); + event_add_write(zclient->master, zclient_flush_data, zclient, + zclient->sock, &zclient->t_write); return ZCLIENT_SEND_BUFFERED; } @@ -4204,22 +4204,22 @@ static void zclient_event(enum zclient_event event, struct zclient *zclient) { switch (event) { case ZCLIENT_SCHEDULE: - thread_add_event(zclient->master, zclient_connect, zclient, 0, - &zclient->t_connect); + event_add_event(zclient->master, zclient_connect, zclient, 0, + &zclient->t_connect); break; case ZCLIENT_CONNECT: if (zclient_debug) zlog_debug( "zclient connect failures: %d schedule interval is now %d", zclient->fail, zclient->fail < 3 ? 10 : 60); - thread_add_timer(zclient->master, zclient_connect, zclient, - zclient->fail < 3 ? 10 : 60, - &zclient->t_connect); + event_add_timer(zclient->master, zclient_connect, zclient, + zclient->fail < 3 ? 10 : 60, + &zclient->t_connect); break; case ZCLIENT_READ: zclient->t_read = NULL; - thread_add_read(zclient->master, zclient_read, zclient, - zclient->sock, &zclient->t_read); + event_add_read(zclient->master, zclient_read, zclient, + zclient->sock, &zclient->t_read); break; } } diff --git a/lib/zlog_5424.c b/lib/zlog_5424.c index 14b6396b84..7bfc89bb22 100644 --- a/lib/zlog_5424.c +++ b/lib/zlog_5424.c @@ -800,8 +800,8 @@ static void zlog_5424_reconnect(struct event *t) ret = read(fd, dummy, sizeof(dummy)); if (ret > 0) { /* logger is sending us something?!?! */ - thread_add_read(t->master, zlog_5424_reconnect, zcf, fd, - &zcf->t_reconnect); + event_add_read(t->master, zlog_5424_reconnect, zcf, fd, + &zcf->t_reconnect); return; } @@ -1030,14 +1030,14 @@ static int zlog_5424_open(struct zlog_cfg_5424 *zcf, int sock_type) assert(zcf->master); if (fd != -1) { - thread_add_read(zcf->master, zlog_5424_reconnect, zcf, - fd, &zcf->t_reconnect); + event_add_read(zcf->master, zlog_5424_reconnect, zcf, + fd, &zcf->t_reconnect); zcf->reconn_backoff_cur = zcf->reconn_backoff; } else { - thread_add_timer_msec(zcf->master, zlog_5424_reconnect, - zcf, zcf->reconn_backoff_cur, - &zcf->t_reconnect); + event_add_timer_msec(zcf->master, zlog_5424_reconnect, + zcf, zcf->reconn_backoff_cur, + &zcf->t_reconnect); zcf->reconn_backoff_cur += zcf->reconn_backoff_cur / 2; if (zcf->reconn_backoff_cur > zcf->reconn_backoff_max) diff --git a/mgmtd/mgmt_be_adapter.c b/mgmtd/mgmt_be_adapter.c index c1a9fadb4b..66184ad2fc 100644 --- a/mgmtd/mgmt_be_adapter.c +++ b/mgmtd/mgmt_be_adapter.c @@ -733,14 +733,14 @@ mgmt_be_adapter_register_event(struct mgmt_be_client_adapter *adapter, switch (event) { case MGMTD_BE_CONN_INIT: - thread_add_timer_msec(mgmt_be_adapter_tm, + event_add_timer_msec(mgmt_be_adapter_tm, mgmt_be_adapter_conn_init, adapter, MGMTD_BE_CONN_INIT_DELAY_MSEC, &adapter->conn_init_ev); assert(adapter->conn_init_ev); break; case MGMTD_BE_CONN_READ: - thread_add_read(mgmt_be_adapter_tm, mgmt_be_adapter_read, + event_add_read(mgmt_be_adapter_tm, mgmt_be_adapter_read, adapter, adapter->conn_fd, &adapter->conn_read_ev); assert(adapter->conn_read_ev); break; @@ -753,19 +753,19 @@ mgmt_be_adapter_register_event(struct mgmt_be_client_adapter *adapter, MGMTD_BE_ADAPTER_DBG( "scheduling write ready notify for client %s", adapter->name); - thread_add_write(mgmt_be_adapter_tm, mgmt_be_adapter_write, + event_add_write(mgmt_be_adapter_tm, mgmt_be_adapter_write, adapter, adapter->conn_fd, &adapter->conn_write_ev); assert(adapter->conn_write_ev); break; case MGMTD_BE_PROC_MSG: tv.tv_usec = MGMTD_BE_MSG_PROC_DELAY_USEC; - thread_add_timer_tv(mgmt_be_adapter_tm, + event_add_timer_tv(mgmt_be_adapter_tm, mgmt_be_adapter_proc_msgbufs, adapter, &tv, &adapter->proc_msg_ev); assert(adapter->proc_msg_ev); break; case MGMTD_BE_CONN_WRITES_ON: - thread_add_timer_msec(mgmt_be_adapter_tm, + event_add_timer_msec(mgmt_be_adapter_tm, mgmt_be_adapter_resume_writes, adapter, MGMTD_BE_MSG_WRITE_DELAY_MSEC, &adapter->conn_writes_on); diff --git a/mgmtd/mgmt_be_server.c b/mgmtd/mgmt_be_server.c index 1fcc6bd6a1..083e8299ff 100644 --- a/mgmtd/mgmt_be_server.c +++ b/mgmtd/mgmt_be_server.c @@ -65,7 +65,7 @@ static void mgmt_be_conn_accept(struct event *thread) static void mgmt_be_server_register_event(enum mgmt_be_event event) { if (event == MGMTD_BE_SERVER) { - thread_add_read(mgmt_be_listen_tm, mgmt_be_conn_accept, + event_add_read(mgmt_be_listen_tm, mgmt_be_conn_accept, NULL, mgmt_be_listen_fd, &mgmt_be_listen_ev); assert(mgmt_be_listen_ev); diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c index eaa50367cb..5c6258dc69 100644 --- a/mgmtd/mgmt_fe_adapter.c +++ b/mgmtd/mgmt_fe_adapter.c @@ -656,13 +656,13 @@ mgmt_fe_session_register_event(struct mgmt_fe_session_ctx *session, switch (event) { case MGMTD_FE_SESSION_CFG_TXN_CLNUP: - thread_add_timer_tv(mgmt_fe_adapter_tm, + event_add_timer_tv(mgmt_fe_adapter_tm, mgmt_fe_session_cfg_txn_clnup, session, &tv, &session->proc_cfg_txn_clnp); assert(session->proc_cfg_txn_clnp); break; case MGMTD_FE_SESSION_SHOW_TXN_CLNUP: - thread_add_timer_tv(mgmt_fe_adapter_tm, + event_add_timer_tv(mgmt_fe_adapter_tm, mgmt_fe_session_show_txn_clnup, session, &tv, &session->proc_show_txn_clnp); assert(session->proc_show_txn_clnp); @@ -1495,25 +1495,25 @@ mgmt_fe_adapter_register_event(struct mgmt_fe_client_adapter *adapter, switch (event) { case MGMTD_FE_CONN_READ: - thread_add_read(mgmt_fe_adapter_tm, mgmt_fe_adapter_read, + event_add_read(mgmt_fe_adapter_tm, mgmt_fe_adapter_read, adapter, adapter->conn_fd, &adapter->conn_read_ev); assert(adapter->conn_read_ev); break; case MGMTD_FE_CONN_WRITE: - thread_add_write(mgmt_fe_adapter_tm, + event_add_write(mgmt_fe_adapter_tm, mgmt_fe_adapter_write, adapter, adapter->conn_fd, &adapter->conn_write_ev); assert(adapter->conn_write_ev); break; case MGMTD_FE_PROC_MSG: tv.tv_usec = MGMTD_FE_MSG_PROC_DELAY_USEC; - thread_add_timer_tv(mgmt_fe_adapter_tm, + event_add_timer_tv(mgmt_fe_adapter_tm, mgmt_fe_adapter_proc_msgbufs, adapter, &tv, &adapter->proc_msg_ev); assert(adapter->proc_msg_ev); break; case MGMTD_FE_CONN_WRITES_ON: - thread_add_timer_msec(mgmt_fe_adapter_tm, + event_add_timer_msec(mgmt_fe_adapter_tm, mgmt_fe_adapter_resume_writes, adapter, MGMTD_FE_MSG_WRITE_DELAY_MSEC, &adapter->conn_writes_on); diff --git a/mgmtd/mgmt_fe_server.c b/mgmtd/mgmt_fe_server.c index 6996070fa3..2d576663db 100644 --- a/mgmtd/mgmt_fe_server.c +++ b/mgmtd/mgmt_fe_server.c @@ -65,7 +65,7 @@ static void mgmt_fe_conn_accept(struct event *thread) static void mgmt_fe_server_register_event(enum mgmt_fe_event event) { if (event == MGMTD_FE_SERVER) { - thread_add_read(mgmt_fe_listen_tm, mgmt_fe_conn_accept, + event_add_read(mgmt_fe_listen_tm, mgmt_fe_conn_accept, NULL, mgmt_fe_listen_fd, &mgmt_fe_listen_ev); assert(mgmt_fe_listen_ev); diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c index bbc210614f..2610d7e85f 100644 --- a/mgmtd/mgmt_txn.c +++ b/mgmtd/mgmt_txn.c @@ -2226,27 +2226,27 @@ static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn, switch (event) { case MGMTD_TXN_PROC_SETCFG: - thread_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_set_cfg, + event_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_set_cfg, txn, &tv, &txn->proc_set_cfg); assert(txn->proc_set_cfg); break; case MGMTD_TXN_PROC_COMMITCFG: - thread_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_commit_cfg, + event_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_commit_cfg, txn, &tv, &txn->proc_comm_cfg); assert(txn->proc_comm_cfg); break; case MGMTD_TXN_PROC_GETCFG: - thread_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_get_cfg, + event_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_get_cfg, txn, &tv, &txn->proc_get_cfg); assert(txn->proc_get_cfg); break; case MGMTD_TXN_PROC_GETDATA: - thread_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_get_data, + event_add_timer_tv(mgmt_txn_tm, mgmt_txn_process_get_data, txn, &tv, &txn->proc_get_data); assert(txn->proc_get_data); break; case MGMTD_TXN_COMMITCFG_TIMEOUT: - thread_add_timer_msec(mgmt_txn_tm, + event_add_timer_msec(mgmt_txn_tm, mgmt_txn_cfg_commit_timedout, txn, MGMTD_TXN_CFG_COMMIT_MAX_DELAY_MSEC, &txn->comm_cfg_timeout); @@ -2254,7 +2254,7 @@ static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn, break; case MGMTD_TXN_CLEANUP: tv.tv_usec = MGMTD_TXN_CLEANUP_DELAY_USEC; - thread_add_timer_tv(mgmt_txn_tm, mgmt_txn_cleanup, txn, &tv, + event_add_timer_tv(mgmt_txn_tm, mgmt_txn_cleanup, txn, &tv, &txn->clnup); assert(txn->clnup); } diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 485aae7422..746cac044d 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -118,8 +118,8 @@ static void netlink_log_recv(struct event *t) } } - thread_add_read(master, netlink_log_recv, 0, netlink_log_fd, - &netlink_log_thread); + event_add_read(master, netlink_log_recv, 0, netlink_log_fd, + &netlink_log_thread); } void netlink_set_nflog_group(int nlgroup) @@ -136,8 +136,8 @@ void netlink_set_nflog_group(int nlgroup) return; netlink_log_register(netlink_log_fd, nlgroup); - thread_add_read(master, netlink_log_recv, 0, netlink_log_fd, - &netlink_log_thread); + event_add_read(master, netlink_log_recv, 0, netlink_log_fd, + &netlink_log_thread); } } diff --git a/nhrpd/nhrp_cache.c b/nhrpd/nhrp_cache.c index cb50dd52d9..8bc44f9474 100644 --- a/nhrpd/nhrp_cache.c +++ b/nhrpd/nhrp_cache.c @@ -325,8 +325,8 @@ static void nhrp_cache_update_timers(struct nhrp_cache *c) switch (c->cur.type) { case NHRP_CACHE_INVALID: if (!c->t_auth) - thread_add_timer_msec(master, nhrp_cache_do_free, c, 10, - &c->t_timeout); + event_add_timer_msec(master, nhrp_cache_do_free, c, 10, + &c->t_timeout); break; case NHRP_CACHE_INCOMPLETE: case NHRP_CACHE_NEGATIVE: @@ -337,9 +337,9 @@ static void nhrp_cache_update_timers(struct nhrp_cache *c) case NHRP_CACHE_LOCAL: case NHRP_CACHE_NUM_TYPES: if (c->cur.expires) - thread_add_timer(master, nhrp_cache_do_timeout, c, - c->cur.expires - monotime(NULL), - &c->t_timeout); + event_add_timer(master, nhrp_cache_do_timeout, c, + c->cur.expires - monotime(NULL), + &c->t_timeout); break; } } @@ -413,8 +413,8 @@ static void nhrp_cache_newpeer_notifier(struct notifier_block *n, if (nhrp_peer_check(c->new.peer, 1)) { evmgr_notify("authorize-binding", c, nhrp_cache_authorize_binding); - thread_add_timer(master, nhrp_cache_do_auth_timeout, c, - 10, &c->t_auth); + event_add_timer(master, nhrp_cache_do_auth_timeout, c, + 10, &c->t_auth); } break; case NOTIFY_PEER_DOWN: @@ -506,8 +506,8 @@ int nhrp_cache_update_binding(struct nhrp_cache *c, enum nhrp_cache_type type, nhrp_cache_newpeer_notifier); nhrp_cache_newpeer_notifier(&c->newpeer_notifier, NOTIFY_PEER_UP); - thread_add_timer(master, nhrp_cache_do_auth_timeout, c, - 60, &c->t_auth); + event_add_timer(master, nhrp_cache_do_auth_timeout, c, + 60, &c->t_auth); } } nhrp_cache_update_timers(c); diff --git a/nhrpd/nhrp_event.c b/nhrpd/nhrp_event.c index ad98da9baa..3bcd42691b 100644 --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -40,8 +40,8 @@ static void evmgr_connection_error(struct event_manager *evmgr) close(evmgr->fd); evmgr->fd = -1; if (nhrp_event_socket_path) - thread_add_timer_msec(master, evmgr_reconnect, evmgr, 10, - &evmgr->t_reconnect); + event_add_timer_msec(master, evmgr_reconnect, evmgr, 10, + &evmgr->t_reconnect); } static void evmgr_recv_message(struct event_manager *evmgr, struct zbuf *zb) @@ -89,7 +89,7 @@ static void evmgr_read(struct event *t) while (zbuf_may_pull_until(ibuf, "\n\n", &msg)) evmgr_recv_message(evmgr, &msg); - thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); + event_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); } static void evmgr_write(struct event *t) @@ -99,8 +99,8 @@ static void evmgr_write(struct event *t) r = zbufq_write(&evmgr->obuf, evmgr->fd); if (r > 0) { - thread_add_write(master, evmgr_write, evmgr, evmgr->fd, - &evmgr->t_write); + event_add_write(master, evmgr_write, evmgr, evmgr->fd, + &evmgr->t_write); } else if (r < 0) { evmgr_connection_error(evmgr); } @@ -175,8 +175,8 @@ static void evmgr_submit(struct event_manager *evmgr, struct zbuf *obuf) zbuf_put(obuf, "\n", 1); zbufq_queue(&evmgr->obuf, obuf); if (evmgr->fd >= 0) - thread_add_write(master, evmgr_write, evmgr, evmgr->fd, - &evmgr->t_write); + event_add_write(master, evmgr_write, evmgr, evmgr->fd, + &evmgr->t_write); } static void evmgr_reconnect(struct event *t) @@ -192,14 +192,14 @@ static void evmgr_reconnect(struct event *t) zlog_warn("%s: failure connecting nhrp-event socket: %s", __func__, strerror(errno)); zbufq_reset(&evmgr->obuf); - thread_add_timer(master, evmgr_reconnect, evmgr, 10, - &evmgr->t_reconnect); + event_add_timer(master, evmgr_reconnect, evmgr, 10, + &evmgr->t_reconnect); return; } zlog_info("Connected to Event Manager"); evmgr->fd = fd; - thread_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); + event_add_read(master, evmgr_read, evmgr, evmgr->fd, &evmgr->t_read); } static struct event_manager evmgr_connection; @@ -211,8 +211,8 @@ void evmgr_init(void) evmgr->fd = -1; zbuf_init(&evmgr->ibuf, evmgr->ibuf_data, sizeof(evmgr->ibuf_data), 0); zbufq_init(&evmgr->obuf); - thread_add_timer_msec(master, evmgr_reconnect, evmgr, 10, - &evmgr->t_reconnect); + event_add_timer_msec(master, evmgr_reconnect, evmgr, 10, + &evmgr->t_reconnect); } void evmgr_set_socket(const char *socket) diff --git a/nhrpd/nhrp_multicast.c b/nhrpd/nhrp_multicast.c index db85d550c2..759dbd1b92 100644 --- a/nhrpd/nhrp_multicast.c +++ b/nhrpd/nhrp_multicast.c @@ -160,8 +160,8 @@ static void netlink_mcast_log_recv(struct event *t) } } - thread_add_read(master, netlink_mcast_log_recv, 0, netlink_mcast_log_fd, - &netlink_mcast_log_thread); + event_add_read(master, netlink_mcast_log_recv, 0, netlink_mcast_log_fd, + &netlink_mcast_log_thread); } static void netlink_mcast_log_register(int fd, int group) @@ -202,9 +202,8 @@ void netlink_mcast_set_nflog_group(int nlgroup) return; netlink_mcast_log_register(netlink_mcast_log_fd, nlgroup); - thread_add_read(master, netlink_mcast_log_recv, 0, - netlink_mcast_log_fd, - &netlink_mcast_log_thread); + event_add_read(master, netlink_mcast_log_recv, 0, + netlink_mcast_log_fd, &netlink_mcast_log_thread); debugf(NHRP_DEBUG_COMMON, "Register nflog group: %d", netlink_mcast_nflog_group); } diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c index c6a6b8e75d..9ffb0c095f 100644 --- a/nhrpd/nhrp_nhs.c +++ b/nhrpd/nhrp_nhs.c @@ -92,8 +92,8 @@ static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg) /* RFC 2332 5.2.3 - Registration is recommend to be renewed * every one third of holdtime */ - thread_add_timer(master, nhrp_reg_send_req, r, holdtime / 3, - &r->t_register); + event_add_timer(master, nhrp_reg_send_req, r, holdtime / 3, + &r->t_register); r->proto_addr = p->dst_proto; c = nhrp_cache_get(ifp, &p->dst_proto, 1); @@ -133,7 +133,7 @@ static void nhrp_reg_timeout(struct event *t) } r->timeout = 2; } - thread_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register); + event_add_timer_msec(master, nhrp_reg_send_req, r, 10, &r->t_register); } static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) @@ -149,8 +149,8 @@ static void nhrp_reg_peer_notify(struct notifier_block *n, unsigned long cmd) debugf(NHRP_DEBUG_COMMON, "NHS: Flush timer for %pSU", &r->peer->vc->remote.nbma); THREAD_OFF(r->t_register); - thread_add_timer_msec(master, nhrp_reg_send_req, r, 10, - &r->t_register); + event_add_timer_msec(master, nhrp_reg_send_req, r, 10, + &r->t_register); break; } } @@ -171,13 +171,13 @@ static void nhrp_reg_send_req(struct event *t) if (!nhrp_peer_check(r->peer, 2)) { debugf(NHRP_DEBUG_COMMON, "NHS: Waiting link for %pSU", &r->peer->vc->remote.nbma); - thread_add_timer(master, nhrp_reg_send_req, r, 120, - &r->t_register); + event_add_timer(master, nhrp_reg_send_req, r, 120, + &r->t_register); return; } - thread_add_timer(master, nhrp_reg_timeout, r, r->timeout, - &r->t_register); + event_add_timer(master, nhrp_reg_timeout, r, r->timeout, + &r->t_register); /* RFC2332 5.2.3 NHC uses it's own address as dst if NHS is unknown */ dst_proto = &nhs->proto_addr; @@ -269,13 +269,13 @@ static void nhrp_nhs_resolve_cb(struct resolver_query *q, const char *errstr, if (n < 0) { /* Failed, retry in a moment */ - thread_add_timer(master, nhrp_nhs_resolve, nhs, 5, - &nhs->t_resolve); + event_add_timer(master, nhrp_nhs_resolve, nhs, 5, + &nhs->t_resolve); return; } - thread_add_timer(master, nhrp_nhs_resolve, nhs, 2 * 60 * 60, - &nhs->t_resolve); + event_add_timer(master, nhrp_nhs_resolve, nhs, 2 * 60 * 60, + &nhs->t_resolve); frr_each (nhrp_reglist, &nhs->reglist_head, reg) reg->mark = 1; @@ -300,8 +300,8 @@ static void nhrp_nhs_resolve_cb(struct resolver_query *q, const char *errstr, nhrp_reglist_add_tail(&nhs->reglist_head, reg); nhrp_peer_notify_add(reg->peer, ®->peer_notifier, nhrp_reg_peer_notify); - thread_add_timer_msec(master, nhrp_reg_send_req, reg, 50, - ®->t_register); + event_add_timer_msec(master, nhrp_reg_send_req, reg, 50, + ®->t_register); } frr_each_safe (nhrp_reglist, &nhs->reglist_head, reg) @@ -347,8 +347,8 @@ int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr, .reglist_head = INIT_DLIST(nhs->reglist_head), }; nhrp_nhslist_add_tail(&nifp->afi[afi].nhslist_head, nhs); - thread_add_timer_msec(master, nhrp_nhs_resolve, nhs, 1000, - &nhs->t_resolve); + event_add_timer_msec(master, nhrp_nhs_resolve, nhs, 1000, + &nhs->t_resolve); return NHRP_OK; } diff --git a/nhrpd/nhrp_packet.c b/nhrpd/nhrp_packet.c index 650b3ab875..6502cff51e 100644 --- a/nhrpd/nhrp_packet.c +++ b/nhrpd/nhrp_packet.c @@ -296,7 +296,7 @@ static void nhrp_packet_recvraw(struct event *t) uint8_t addr[64]; size_t len, addrlen; - thread_add_read(master, nhrp_packet_recvraw, 0, fd, NULL); + event_add_read(master, nhrp_packet_recvraw, 0, fd, NULL); zb = zbuf_alloc(1500); if (!zb) @@ -336,6 +336,6 @@ err: int nhrp_packet_init(void) { - thread_add_read(master, nhrp_packet_recvraw, 0, os_socket(), NULL); + event_add_read(master, nhrp_packet_recvraw, 0, os_socket(), NULL); return 0; } diff --git a/nhrpd/nhrp_peer.c b/nhrpd/nhrp_peer.c index 95694a41fd..9ca7b8441c 100644 --- a/nhrpd/nhrp_peer.c +++ b/nhrpd/nhrp_peer.c @@ -82,8 +82,8 @@ static void __nhrp_peer_check(struct nhrp_peer *p) * the up notification a bit to allow things * settle down. This allows IKE to install * SPDs and SAs. */ - thread_add_timer_msec(master, nhrp_peer_notify_up, p, - 50, &p->t_fallback); + event_add_timer_msec(master, nhrp_peer_notify_up, p, 50, + &p->t_fallback); } else { nhrp_peer_ref(p); p->online = online; @@ -264,8 +264,8 @@ static void nhrp_peer_request_timeout(struct event *t) p->fallback_requested = 1; vici_request_vc(nifp->ipsec_fallback_profile, &vc->local.nbma, &vc->remote.nbma, p->prio); - thread_add_timer(master, nhrp_peer_request_timeout, p, 30, - &p->t_fallback); + event_add_timer(master, nhrp_peer_request_timeout, p, 30, + &p->t_fallback); } else { p->requested = p->fallback_requested = 0; } @@ -287,10 +287,10 @@ static void nhrp_peer_defer_vici_request(struct event *t) } else { vici_request_vc(nifp->ipsec_profile, &vc->local.nbma, &vc->remote.nbma, p->prio); - thread_add_timer( - master, nhrp_peer_request_timeout, p, - (nifp->ipsec_fallback_profile && !p->prio) ? 15 : 30, - &p->t_fallback); + event_add_timer(master, nhrp_peer_request_timeout, p, + (nifp->ipsec_fallback_profile && !p->prio) ? 15 + : 30, + &p->t_fallback); } } @@ -320,10 +320,10 @@ int nhrp_peer_check(struct nhrp_peer *p, int establish) if (p->prio) { vici_request_vc(nifp->ipsec_profile, &vc->local.nbma, &vc->remote.nbma, p->prio); - thread_add_timer( - master, nhrp_peer_request_timeout, p, - (nifp->ipsec_fallback_profile && !p->prio) ? 15 : 30, - &p->t_fallback); + event_add_timer(master, nhrp_peer_request_timeout, p, + (nifp->ipsec_fallback_profile && !p->prio) ? 15 + : 30, + &p->t_fallback); } else { /* Maximum timeout is 1 second */ int r_time_ms = frr_weak_random() % 1000; @@ -331,8 +331,8 @@ int nhrp_peer_check(struct nhrp_peer *p, int establish) debugf(NHRP_DEBUG_COMMON, "Initiating IPsec connection request to %pSU after %d ms:", &vc->remote.nbma, r_time_ms); - thread_add_timer_msec(master, nhrp_peer_defer_vici_request, - p, r_time_ms, &p->t_timer); + event_add_timer_msec(master, nhrp_peer_defer_vici_request, p, + r_time_ms, &p->t_timer); } return 0; diff --git a/nhrpd/nhrp_shortcut.c b/nhrpd/nhrp_shortcut.c index b1e2b7cea4..838fac7528 100644 --- a/nhrpd/nhrp_shortcut.c +++ b/nhrpd/nhrp_shortcut.c @@ -35,8 +35,8 @@ static void nhrp_shortcut_do_expire(struct event *t) { struct nhrp_shortcut *s = THREAD_ARG(t); - thread_add_timer(master, nhrp_shortcut_do_purge, s, s->holding_time / 3, - &s->t_timer); + event_add_timer(master, nhrp_shortcut_do_purge, s, s->holding_time / 3, + &s->t_timer); s->expiring = 1; nhrp_shortcut_check_use(s); } @@ -127,8 +127,8 @@ static void nhrp_shortcut_update_binding(struct nhrp_shortcut *s, if (holding_time) { s->expiring = 0; s->holding_time = holding_time; - thread_add_timer(master, nhrp_shortcut_do_expire, s, - 2 * holding_time / 3, &s->t_timer); + event_add_timer(master, nhrp_shortcut_do_expire, s, + 2 * holding_time / 3, &s->t_timer); } } @@ -205,7 +205,7 @@ static void nhrp_shortcut_recv_resolution_rep(struct nhrp_reqid *reqid, nhrp_reqid_free(&nhrp_packet_reqid, &s->reqid); THREAD_OFF(s->t_timer); - thread_add_timer(master, nhrp_shortcut_do_purge, s, 1, &s->t_timer); + event_add_timer(master, nhrp_shortcut_do_purge, s, 1, &s->t_timer); if (pp->hdr->type != NHRP_PACKET_RESOLUTION_REPLY) { if (pp->hdr->type == NHRP_PACKET_ERROR_INDICATION @@ -455,8 +455,8 @@ void nhrp_shortcut_initiate(union sockunion *addr) if (s && s->type != NHRP_CACHE_INCOMPLETE) { s->addr = *addr; THREAD_OFF(s->t_timer); - thread_add_timer(master, nhrp_shortcut_do_purge, s, 30, - &s->t_timer); + event_add_timer(master, nhrp_shortcut_do_purge, s, 30, + &s->t_timer); nhrp_shortcut_send_resolution_req(s); } } @@ -504,8 +504,8 @@ void nhrp_shortcut_purge(struct nhrp_shortcut *s, int force) if (force) { /* Immediate purge on route with draw or pending shortcut */ - thread_add_timer_msec(master, nhrp_shortcut_do_purge, s, 5, - &s->t_timer); + event_add_timer_msec(master, nhrp_shortcut_do_purge, s, 5, + &s->t_timer); } else { /* Soft expire - force immediate renewal, but purge * in few seconds to make sure stale route is not @@ -514,8 +514,8 @@ void nhrp_shortcut_purge(struct nhrp_shortcut *s, int force) * This allows to keep nhrp route up, and to not * cause temporary rerouting via hubs causing latency * jitter. */ - thread_add_timer_msec(master, nhrp_shortcut_do_purge, s, 3000, - &s->t_timer); + event_add_timer_msec(master, nhrp_shortcut_do_purge, s, 3000, + &s->t_timer); s->expiring = 1; nhrp_shortcut_check_use(s); } diff --git a/nhrpd/vici.c b/nhrpd/vici.c index 02e36d2e6a..67a7877b6d 100644 --- a/nhrpd/vici.c +++ b/nhrpd/vici.c @@ -77,7 +77,7 @@ static void vici_connection_error(struct vici_conn *vici) close(vici->fd); vici->fd = -1; - thread_add_timer(master, vici_reconnect, vici, 2, &vici->t_reconnect); + event_add_timer(master, vici_reconnect, vici, 2, &vici->t_reconnect); } static void vici_parse_message(struct vici_conn *vici, struct zbuf *msg, @@ -384,7 +384,7 @@ static void vici_read(struct event *t) vici_recv_message(vici, &pktbuf); } while (1); - thread_add_read(master, vici_read, vici, vici->fd, &vici->t_read); + event_add_read(master, vici_read, vici, vici->fd, &vici->t_read); } static void vici_write(struct event *t) @@ -394,8 +394,8 @@ static void vici_write(struct event *t) r = zbufq_write(&vici->obuf, vici->fd); if (r > 0) { - thread_add_write(master, vici_write, vici, vici->fd, - &vici->t_write); + event_add_write(master, vici_write, vici, vici->fd, + &vici->t_write); } else if (r < 0) { vici_connection_error(vici); } @@ -409,7 +409,7 @@ static void vici_submit(struct vici_conn *vici, struct zbuf *obuf) } zbufq_queue(&vici->obuf, obuf); - thread_add_write(master, vici_write, vici, vici->fd, &vici->t_write); + event_add_write(master, vici_write, vici, vici->fd, &vici->t_write); } static void vici_submit_request(struct vici_conn *vici, const char *name, ...) @@ -519,14 +519,14 @@ static void vici_reconnect(struct event *t) debugf(NHRP_DEBUG_VICI, "%s: failure connecting VICI socket: %s", __func__, strerror(errno)); - thread_add_timer(master, vici_reconnect, vici, 2, - &vici->t_reconnect); + event_add_timer(master, vici_reconnect, vici, 2, + &vici->t_reconnect); return; } debugf(NHRP_DEBUG_COMMON, "VICI: Connected"); vici->fd = fd; - thread_add_read(master, vici_read, vici, vici->fd, &vici->t_read); + event_add_read(master, vici_read, vici, vici->fd, &vici->t_read); /* Send event subscribtions */ // vici_register_event(vici, "child-updown"); @@ -547,8 +547,8 @@ void vici_init(void) vici->fd = -1; zbuf_init(&vici->ibuf, vici->ibuf_data, sizeof(vici->ibuf_data), 0); zbufq_init(&vici->obuf); - thread_add_timer_msec(master, vici_reconnect, vici, 10, - &vici->t_reconnect); + event_add_timer_msec(master, vici_reconnect, vici, 10, + &vici->t_reconnect); } void vici_terminate(void) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index a2e77d9228..bb47b66755 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1110,9 +1110,8 @@ void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, if (IS_OSPF6_DEBUG_ASBR) zlog_debug("%s: trigger redistribute reset thread", __func__); - thread_add_timer_msec(master, ospf6_asbr_routemap_update_timer, ospf6, - OSPF_MIN_LS_INTERVAL, - &ospf6->t_distribute_update); + event_add_timer_msec(master, ospf6_asbr_routemap_update_timer, ospf6, + OSPF_MIN_LS_INTERVAL, &ospf6->t_distribute_update); } void ospf6_asbr_routemap_update(const char *mapname) @@ -3024,8 +3023,8 @@ static void ospf6_aggr_handle_external_info(void *data) zlog_debug("%s: LSA found, refresh it", __func__); THREAD_OFF(lsa->refresh); - thread_add_event(master, ospf6_lsa_refresh, lsa, 0, - &lsa->refresh); + event_add_event(master, ospf6_lsa_refresh, lsa, 0, + &lsa->refresh); return; } } @@ -3227,8 +3226,8 @@ static void ospf6_handle_exnl_rt_after_aggr_del(struct ospf6 *ospf6, if (lsa) { THREAD_OFF(lsa->refresh); - thread_add_event(master, ospf6_lsa_refresh, lsa, 0, - &lsa->refresh); + event_add_event(master, ospf6_lsa_refresh, lsa, 0, + &lsa->refresh); } else { if (IS_OSPF6_DEBUG_AGGR) zlog_debug("%s: Originate external route(%pFX)", @@ -3386,10 +3385,8 @@ ospf6_start_asbr_summary_delay_timer(struct ospf6 *ospf6, __func__, ospf6->aggr_delay_interval); ospf6->aggr_action = operation; - thread_add_timer(master, - ospf6_asbr_summary_process, - ospf6, ospf6->aggr_delay_interval, - &ospf6->t_external_aggr); + event_add_timer(master, ospf6_asbr_summary_process, ospf6, + ospf6->aggr_delay_interval, &ospf6->t_external_aggr); } int ospf6_asbr_external_rt_advertise(struct ospf6 *ospf6, diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 1b879ae280..bbe3fcd038 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -106,7 +106,7 @@ static void ospf6_bfd_callback(struct bfd_session_params *bsp, if (bss->state == BFD_STATUS_DOWN && bss->previous_state == BFD_STATUS_UP) { THREAD_OFF(on->inactivity_timer); - thread_add_event(master, inactivity_timer, on, 0, NULL); + event_add_event(master, inactivity_timer, on, 0, NULL); } } diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index a782d97304..ddf775d72d 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -104,8 +104,8 @@ void ospf6_lsa_originate(struct ospf6 *ospf6, struct ospf6_lsa *lsa) ospf6_lsdb_add(ospf6_lsa_copy(lsa), lsdb_self); THREAD_OFF(lsa->refresh); - thread_add_timer(master, ospf6_lsa_refresh, lsa, OSPF_LS_REFRESH_TIME, - &lsa->refresh); + event_add_timer(master, ospf6_lsa_refresh, lsa, OSPF_LS_REFRESH_TIME, + &lsa->refresh); if (IS_OSPF6_DEBUG_LSA_TYPE(lsa->header->type) || IS_OSPF6_DEBUG_ORIGINATE_TYPE(lsa->header->type)) { @@ -257,10 +257,10 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa) monotime(&now); if (!OSPF6_LSA_IS_MAXAGE(lsa)) { - thread_add_timer(master, ospf6_lsa_expire, lsa, - OSPF_LSA_MAXAGE + lsa->birth.tv_sec - - now.tv_sec, - &lsa->expire); + event_add_timer(master, ospf6_lsa_expire, lsa, + OSPF_LSA_MAXAGE + lsa->birth.tv_sec - + now.tv_sec, + &lsa->expire); } else lsa->expire = NULL; @@ -473,10 +473,10 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); - thread_add_timer( - master, ospf6_lsupdate_send_neighbor, - on, on->ospf6_if->rxmt_interval, - &on->thread_send_lsupdate); + event_add_timer(master, + ospf6_lsupdate_send_neighbor, + on, on->ospf6_if->rxmt_interval, + &on->thread_send_lsupdate); retrans_added++; } } @@ -520,14 +520,14 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa, if ((oi->type == OSPF_IFTYPE_BROADCAST) || (oi->type == OSPF_IFTYPE_POINTOPOINT)) { ospf6_lsdb_add(ospf6_lsa_copy(lsa), oi->lsupdate_list); - thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0, - &oi->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_interface, oi, 0, + &oi->thread_send_lsupdate); } else { /* reschedule retransmissions to all neighbors */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { THREAD_OFF(on->thread_send_lsupdate); - thread_add_event(master, ospf6_lsupdate_send_neighbor, - on, 0, &on->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_neighbor, + on, 0, &on->thread_send_lsupdate); } } } @@ -697,8 +697,8 @@ static void ospf6_acknowledge_lsa_bdrouter(struct ospf6_lsa *lsa, "Delayed acknowledgement (BDR & MoreRecent & from DR)"); /* Delayed acknowledgement */ ospf6_lsdb_add(ospf6_lsa_copy(lsa), oi->lsack_list); - thread_add_timer(master, ospf6_lsack_send_interface, oi, - 3, &oi->thread_send_lsack); + event_add_timer(master, ospf6_lsack_send_interface, oi, + 3, &oi->thread_send_lsack); } else { if (is_debug) zlog_debug( @@ -718,8 +718,8 @@ static void ospf6_acknowledge_lsa_bdrouter(struct ospf6_lsa *lsa, "Delayed acknowledgement (BDR & Duplicate & ImpliedAck & from DR)"); /* Delayed acknowledgement */ ospf6_lsdb_add(ospf6_lsa_copy(lsa), oi->lsack_list); - thread_add_timer(master, ospf6_lsack_send_interface, oi, - 3, &oi->thread_send_lsack); + event_add_timer(master, ospf6_lsack_send_interface, oi, + 3, &oi->thread_send_lsack); } else { if (is_debug) zlog_debug( @@ -736,8 +736,8 @@ static void ospf6_acknowledge_lsa_bdrouter(struct ospf6_lsa *lsa, if (is_debug) zlog_debug("Direct acknowledgement (BDR & Duplicate)"); ospf6_lsdb_add(ospf6_lsa_copy(lsa), from->lsack_list); - thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, - &from->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_neighbor, from, 0, + &from->thread_send_lsack); return; } @@ -778,8 +778,8 @@ static void ospf6_acknowledge_lsa_allother(struct ospf6_lsa *lsa, "Delayed acknowledgement (AllOther & MoreRecent)"); /* Delayed acknowledgement */ ospf6_lsdb_add(ospf6_lsa_copy(lsa), oi->lsack_list); - thread_add_timer(master, ospf6_lsack_send_interface, oi, 3, - &oi->thread_send_lsack); + event_add_timer(master, ospf6_lsack_send_interface, oi, 3, + &oi->thread_send_lsack); return; } @@ -802,8 +802,8 @@ static void ospf6_acknowledge_lsa_allother(struct ospf6_lsa *lsa, zlog_debug( "Direct acknowledgement (AllOther & Duplicate)"); ospf6_lsdb_add(ospf6_lsa_copy(lsa), from->lsack_list); - thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, - &from->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_neighbor, from, 0, + &from->thread_send_lsack); return; } @@ -973,8 +973,8 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, /* a) Acknowledge back to neighbor (Direct acknowledgement, * 13.5) */ ospf6_lsdb_add(ospf6_lsa_copy(new), from->lsack_list); - thread_add_event(master, ospf6_lsack_send_neighbor, from, 0, - &from->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_neighbor, from, 0, + &from->thread_send_lsack); /* b) Discard */ ospf6_lsa_delete(new); @@ -1105,8 +1105,8 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, "Newer instance of the self-originated LSA"); zlog_debug("Schedule reorigination"); } - thread_add_event(master, ospf6_lsa_refresh, new, 0, - &new->refresh); + event_add_event(master, ospf6_lsa_refresh, new, 0, + &new->refresh); } /* GR: check for network topology change. */ @@ -1134,7 +1134,7 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, new->name); /* BadLSReq */ - thread_add_event(master, bad_lsreq, from, 0, NULL); + event_add_event(master, bad_lsreq, from, 0, NULL); ospf6_lsa_delete(new); return; @@ -1231,8 +1231,8 @@ void ospf6_receive_lsa(struct ospf6_neighbor *from, ospf6_lsdb_add(ospf6_lsa_copy(old), from->lsupdate_list); - thread_add_event(master, ospf6_lsupdate_send_neighbor, - from, 0, &from->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_neighbor, + from, 0, &from->thread_send_lsupdate); ospf6_lsa_delete(new); return; diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c index b3f4859158..c79f3de9c3 100644 --- a/ospf6d/ospf6_gr.c +++ b/ospf6d/ospf6_gr.c @@ -592,9 +592,9 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6) zlog_debug( "GR: remaining time until grace period expires: %lu(s)", remaining_time); - thread_add_timer(master, ospf6_gr_grace_period_expired, - ospf6, remaining_time, - &ospf6->gr_info.t_grace_period); + event_add_timer(master, ospf6_gr_grace_period_expired, + ospf6, remaining_time, + &ospf6->gr_info.t_grace_period); } } diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c index fb710cc1cd..599c2944cf 100644 --- a/ospf6d/ospf6_gr_helper.c +++ b/ospf6d/ospf6_gr_helper.c @@ -415,9 +415,9 @@ int ospf6_process_grace_lsa(struct ospf6 *ospf6, struct ospf6_lsa *lsa, actual_grace_interval); /* Start the grace timer */ - thread_add_timer(master, ospf6_handle_grace_timer_expiry, restarter, - actual_grace_interval, - &restarter->gr_helper_info.t_grace_timer); + event_add_timer(master, ospf6_handle_grace_timer_expiry, restarter, + actual_grace_interval, + &restarter->gr_helper_info.t_grace_timer); return OSPF6_GR_ACTIVE_HELPER; } diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index f465d87630..baf9b7691a 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -671,8 +671,8 @@ uint8_t dr_election(struct ospf6_interface *oi) if (on->state < OSPF6_NEIGHBOR_TWOWAY) continue; /* Schedule AdjOK. */ - thread_add_event(master, adj_ok, on, 0, - &on->thread_adj_ok); + event_add_event(master, adj_ok, on, 0, + &on->thread_adj_ok); } } @@ -785,9 +785,8 @@ void interface_up(struct event *thread) zlog_info( "Interface %s is still in all routers group, rescheduling for SSO", oi->interface->name); - thread_add_timer(master, interface_up, oi, - OSPF6_INTERFACE_SSO_RETRY_INT, - &oi->thread_sso); + event_add_timer(master, interface_up, oi, + OSPF6_INTERFACE_SSO_RETRY_INT, &oi->thread_sso); return; } #endif /* __FreeBSD__ */ @@ -802,9 +801,9 @@ void interface_up(struct event *thread) zlog_info( "Scheduling %s for sso retry, trial count: %d", oi->interface->name, oi->sso_try_cnt); - thread_add_timer(master, interface_up, oi, - OSPF6_INTERFACE_SSO_RETRY_INT, - &oi->thread_sso); + event_add_timer(master, interface_up, oi, + OSPF6_INTERFACE_SSO_RETRY_INT, + &oi->thread_sso); } return; } @@ -816,8 +815,8 @@ void interface_up(struct event *thread) /* Schedule Hello */ if (!CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE) && !if_is_loopback(oi->interface)) { - thread_add_timer(master, ospf6_hello_send, oi, 0, - &oi->thread_send_hello); + event_add_timer(master, ospf6_hello_send, oi, 0, + &oi->thread_send_hello); } /* decide next interface state */ @@ -829,8 +828,8 @@ void interface_up(struct event *thread) ospf6_interface_state_change(OSPF6_INTERFACE_DROTHER, oi); else { ospf6_interface_state_change(OSPF6_INTERFACE_WAITING, oi); - thread_add_timer(master, wait_timer, oi, oi->dead_interval, - &oi->thread_wait_timer); + event_add_timer(master, wait_timer, oi, oi->dead_interval, + &oi->thread_wait_timer); } } @@ -1880,7 +1879,7 @@ DEFUN (ipv6_ospf6_ifmtu, /* re-establish adjacencies */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { THREAD_OFF(on->inactivity_timer); - thread_add_event(master, inactivity_timer, on, 0, NULL); + event_add_event(master, inactivity_timer, on, 0, NULL); } return CMD_SUCCESS; @@ -1926,7 +1925,7 @@ DEFUN (no_ipv6_ospf6_ifmtu, /* re-establish adjacencies */ for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { THREAD_OFF(on->inactivity_timer); - thread_add_event(master, inactivity_timer, on, 0, NULL); + event_add_event(master, inactivity_timer, on, 0, NULL); } return CMD_SUCCESS; @@ -2111,8 +2110,8 @@ DEFUN (ipv6_ospf6_hellointerval, if (thread_is_scheduled(oi->thread_send_hello)) { THREAD_OFF(oi->thread_send_hello); - thread_add_timer(master, ospf6_hello_send, oi, 0, - &oi->thread_send_hello); + event_add_timer(master, ospf6_hello_send, oi, 0, + &oi->thread_send_hello); } return CMD_SUCCESS; } @@ -2330,7 +2329,7 @@ DEFUN (ipv6_ospf6_passive, for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on)) { THREAD_OFF(on->inactivity_timer); - thread_add_event(master, inactivity_timer, on, 0, NULL); + event_add_event(master, inactivity_timer, on, 0, NULL); } return CMD_SUCCESS; @@ -2360,8 +2359,8 @@ DEFUN (no_ipv6_ospf6_passive, /* don't send hellos over loopback interface */ if (!if_is_loopback(oi->interface)) - thread_add_timer(master, ospf6_hello_send, oi, 0, - &oi->thread_send_hello); + event_add_timer(master, ospf6_hello_send, oi, 0, + &oi->thread_send_hello); return CMD_SUCCESS; } diff --git a/ospf6d/ospf6_intra.h b/ospf6d/ospf6_intra.h index f4b392f466..b09c4163f9 100644 --- a/ospf6d/ospf6_intra.h +++ b/ospf6d/ospf6_intra.h @@ -139,32 +139,32 @@ struct ospf6_intra_prefix_lsa { #define OSPF6_ROUTER_LSA_SCHEDULE(oa) \ do { \ if (CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \ - thread_add_event(master, ospf6_router_lsa_originate, \ - oa, 0, &(oa)->thread_router_lsa); \ + event_add_event(master, ospf6_router_lsa_originate, \ + oa, 0, &(oa)->thread_router_lsa); \ } while (0) #define OSPF6_NETWORK_LSA_SCHEDULE(oi) \ do { \ if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \ - thread_add_event(master, ospf6_network_lsa_originate, \ - oi, 0, &(oi)->thread_network_lsa); \ + event_add_event(master, ospf6_network_lsa_originate, \ + oi, 0, &(oi)->thread_network_lsa); \ } while (0) #define OSPF6_LINK_LSA_SCHEDULE(oi) \ do { \ if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \ - thread_add_event(master, ospf6_link_lsa_originate, oi, \ - 0, &(oi)->thread_link_lsa); \ + event_add_event(master, ospf6_link_lsa_originate, oi, \ + 0, &(oi)->thread_link_lsa); \ } while (0) #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oa) \ do { \ if (CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \ - thread_add_event( \ + event_add_event( \ master, ospf6_intra_prefix_lsa_originate_stub, \ oa, 0, &(oa)->thread_intra_prefix_lsa); \ } while (0) #define OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(oi) \ do { \ if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \ - thread_add_event( \ + event_add_event( \ master, \ ospf6_intra_prefix_lsa_originate_transit, oi, \ 0, &(oi)->thread_intra_prefix_lsa); \ @@ -173,8 +173,8 @@ struct ospf6_intra_prefix_lsa { #define OSPF6_AS_EXTERN_LSA_SCHEDULE(oi) \ do { \ if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \ - thread_add_event(master, ospf6_orig_as_external_lsa, \ - oi, 0, &(oi)->thread_as_extern_lsa); \ + event_add_event(master, ospf6_orig_as_external_lsa, \ + oi, 0, &(oi)->thread_as_extern_lsa); \ } while (0) #define OSPF6_ROUTER_LSA_EXECUTE(oa) \ diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 508cb6f5e0..a9dd7aa28c 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -875,8 +875,8 @@ void ospf6_lsa_refresh(struct event *thread) new = ospf6_lsa_create(self->header); new->lsdb = old->lsdb; - thread_add_timer(master, ospf6_lsa_refresh, new, OSPF_LS_REFRESH_TIME, - &new->refresh); + event_add_timer(master, ospf6_lsa_refresh, new, OSPF_LS_REFRESH_TIME, + &new->refresh); /* store it in the LSDB for self-originated LSAs */ ospf6_lsdb_add(ospf6_lsa_copy(new), lsdb_self); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 1d3d1f7e6f..ff73958742 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -594,9 +594,9 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst, /* Schedule interface events */ if (backupseen) - thread_add_event(master, backup_seen, oi, 0, NULL); + event_add_event(master, backup_seen, oi, 0, NULL); if (neighborchange) - thread_add_event(master, neighbor_change, oi, 0, NULL); + event_add_event(master, neighbor_change, oi, 0, NULL); if (neighbor_ifindex_change && on->state == OSPF6_NEIGHBOR_FULL) OSPF6_ROUTER_LSA_SCHEDULE(oi->area); @@ -667,24 +667,24 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, zlog_warn( "DbDesc recv: Master/Slave bit mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } if (CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)) { zlog_warn("DbDesc recv: Initialize bit mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } if (memcmp(on->options, dbdesc->options, sizeof(on->options))) { zlog_warn("DbDesc recv: Option field mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -693,7 +693,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, "DbDesc recv: Sequence number mismatch Nbr %s (received %#lx, %#lx expected)", on->name, (unsigned long)ntohl(dbdesc->seqnum), (unsigned long)on->dbdesc_seqnum); - thread_add_event(master, seqnumber_mismatch, on, 0, + event_add_event(master, seqnumber_mismatch, on, 0, NULL); return; } @@ -714,7 +714,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, zlog_warn( "DbDesc recv: Not duplicate dbdesc in state %s Nbr %s", ospf6_neighbor_state_str[on->state], on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, NULL); + event_add_event(master, seqnumber_mismatch, on, 0, NULL); return; default: @@ -758,8 +758,8 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, zlog_debug( "SeqNumMismatch (E-bit mismatch), discard"); ospf6_lsa_delete(his); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -787,19 +787,19 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh, /* schedule send lsreq */ if (on->request_list->count) - thread_add_event(master, ospf6_lsreq_send, on, 0, - &on->thread_send_lsreq); + event_add_event(master, ospf6_lsreq_send, on, 0, + &on->thread_send_lsreq); THREAD_OFF(on->thread_send_dbdesc); /* More bit check */ if (!CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_MBIT) && !CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT)) - thread_add_event(master, exchange_done, on, 0, - &on->thread_exchange_done); + event_add_event(master, exchange_done, on, 0, + &on->thread_exchange_done); else { - thread_add_event(master, ospf6_dbdesc_send_newone, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send_newone, on, 0, + &on->thread_send_dbdesc); } /* save last received dbdesc */ @@ -876,8 +876,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_debug( "Duplicated dbdesc causes retransmit"); THREAD_OFF(on->thread_send_dbdesc); - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); return; } @@ -885,8 +885,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_warn( "DbDesc slave recv: Master/Slave bit mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -894,8 +894,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_warn( "DbDesc slave recv: Initialize bit mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -903,8 +903,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_warn( "DbDesc slave recv: Option field mismatch Nbr %s", on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -913,7 +913,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, "DbDesc slave recv: Sequence number mismatch Nbr %s (received %#lx, %#lx expected)", on->name, (unsigned long)ntohl(dbdesc->seqnum), (unsigned long)on->dbdesc_seqnum + 1); - thread_add_event(master, seqnumber_mismatch, on, 0, + event_add_event(master, seqnumber_mismatch, on, 0, NULL); return; } @@ -929,15 +929,15 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, zlog_debug( "Duplicated dbdesc causes retransmit"); THREAD_OFF(on->thread_send_dbdesc); - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); return; } zlog_warn( "DbDesc slave recv: Not duplicate dbdesc in state %s Nbr %s", ospf6_neighbor_state_str[on->state], on->name); - thread_add_event(master, seqnumber_mismatch, on, 0, NULL); + event_add_event(master, seqnumber_mismatch, on, 0, NULL); return; default: @@ -977,8 +977,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV)) zlog_debug("E-bit mismatch with LSA Headers"); ospf6_lsa_delete(his); - thread_add_event(master, seqnumber_mismatch, on, 0, - NULL); + event_add_event(master, seqnumber_mismatch, on, 0, + NULL); return; } @@ -999,12 +999,12 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh, /* schedule send lsreq */ if (on->request_list->count) - thread_add_event(master, ospf6_lsreq_send, on, 0, - &on->thread_send_lsreq); + event_add_event(master, ospf6_lsreq_send, on, 0, + &on->thread_send_lsreq); THREAD_OFF(on->thread_send_dbdesc); - thread_add_event(master, ospf6_dbdesc_send_newone, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send_newone, on, 0, + &on->thread_send_dbdesc); /* save last received dbdesc */ memcpy(&on->dbdesc_last, dbdesc, sizeof(struct ospf6_dbdesc)); @@ -1126,7 +1126,7 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, "Can't find requested lsa [%s Id:%pI4 Adv:%pI4] send badLSReq", ospf6_lstype_name(e->type), &e->id, &e->adv_router); - thread_add_event(master, bad_lsreq, on, 0, NULL); + event_add_event(master, bad_lsreq, on, 0, NULL); return; } @@ -1137,8 +1137,8 @@ static void ospf6_lsreq_recv(struct in6_addr *src, struct in6_addr *dst, /* schedule send lsupdate */ THREAD_OFF(on->thread_send_lsupdate); - thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, - &on->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, + &on->thread_send_lsupdate); } /* Verify, that the specified memory area contains exactly N valid IPv6 @@ -1917,8 +1917,8 @@ void ospf6_receive(struct event *thread) ospf6 = THREAD_ARG(thread); sockfd = THREAD_FD(thread); - thread_add_read(master, ospf6_receive, ospf6, ospf6->fd, - &ospf6->t_ospf6_receive); + event_add_read(master, ospf6_receive, ospf6, ospf6->fd, + &ospf6->t_ospf6_receive); while (count < ospf6->write_oi_count) { count++; @@ -2232,8 +2232,8 @@ static void ospf6_write(struct event *thread) /* If packets still remain in queue, call write thread. */ if (!list_isempty(ospf6->oi_write_q)) - thread_add_write(master, ospf6_write, ospf6, ospf6->fd, - &ospf6->t_write); + event_add_write(master, ospf6_write, ospf6, ospf6->fd, + &ospf6->t_write); } void ospf6_hello_send(struct event *thread) @@ -2279,8 +2279,8 @@ void ospf6_hello_send(struct event *thread) ospf6_packet_add_top(oi, op); /* set next thread */ - thread_add_timer(master, ospf6_hello_send, oi, oi->hello_interval, - &oi->thread_send_hello); + event_add_timer(master, ospf6_hello_send, oi, oi->hello_interval, + &oi->thread_send_hello); OSPF6_MESSAGE_WRITE_ON(oi); } @@ -2351,9 +2351,9 @@ void ospf6_dbdesc_send(struct event *thread) /* set next thread if master */ if (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT)) - thread_add_timer(master, ospf6_dbdesc_send, on, - on->ospf6_if->rxmt_interval, - &on->thread_send_dbdesc); + event_add_timer(master, ospf6_dbdesc_send, on, + on->ospf6_if->rxmt_interval, + &on->thread_send_dbdesc); op = ospf6_packet_new(on->ospf6_if->ifmtu); ospf6_make_header(OSPF6_MESSAGE_TYPE_DBDESC, on->ospf6_if, op->s); @@ -2418,8 +2418,8 @@ void ospf6_dbdesc_send_newone(struct event *thread) if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) && /* Slave */ !CHECK_FLAG(on->dbdesc_last.bits, OSPF6_DBDESC_MBIT) && !CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT)) - thread_add_event(master, exchange_done, on, 0, - &on->thread_exchange_done); + event_add_event(master, exchange_done, on, 0, + &on->thread_exchange_done); thread_execute(master, ospf6_dbdesc_send, on, 0); } @@ -2518,7 +2518,7 @@ void ospf6_lsreq_send(struct event *thread) /* schedule loading_done if request list is empty */ if (on->request_list->count == 0) { - thread_add_event(master, loading_done, on, 0, NULL); + event_add_event(master, loading_done, on, 0, NULL); return; } @@ -2551,9 +2551,9 @@ void ospf6_lsreq_send(struct event *thread) /* set next thread */ if (on->request_list->count != 0) { - thread_add_timer(master, ospf6_lsreq_send, on, - on->ospf6_if->rxmt_interval, - &on->thread_send_lsreq); + event_add_timer(master, ospf6_lsreq_send, on, + on->ospf6_if->rxmt_interval, + &on->thread_send_lsreq); } } @@ -2734,12 +2734,12 @@ void ospf6_lsupdate_send_neighbor(struct event *thread) ospf6_packet_free(op); if (on->lsupdate_list->count != 0) { - thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, - &on->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_neighbor, on, 0, + &on->thread_send_lsupdate); } else if (on->retrans_list->count != 0) { - thread_add_timer(master, ospf6_lsupdate_send_neighbor, on, - on->ospf6_if->rxmt_interval, - &on->thread_send_lsupdate); + event_add_timer(master, ospf6_lsupdate_send_neighbor, on, + on->ospf6_if->rxmt_interval, + &on->thread_send_lsupdate); } } @@ -2847,8 +2847,8 @@ void ospf6_lsupdate_send_interface(struct event *thread) ospf6_packet_free(op); if (oi->lsupdate_list->count > 0) { - thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0, - &oi->thread_send_lsupdate); + event_add_event(master, ospf6_lsupdate_send_interface, oi, 0, + &oi->thread_send_lsupdate); } } @@ -2893,8 +2893,8 @@ void ospf6_lsack_send_neighbor(struct event *thread) OSPF6_MESSAGE_WRITE_ON(on->ospf6_if); if (on->lsack_list->count > 0) - thread_add_event(master, ospf6_lsack_send_neighbor, on, 0, - &on->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_neighbor, on, 0, + &on->thread_send_lsack); } static uint16_t ospf6_make_lsack_interface(struct ospf6_interface *oi, @@ -2910,8 +2910,8 @@ static uint16_t ospf6_make_lsack_interface(struct ospf6_interface *oi, /* if we run out of packet size/space here, better to try again soon. */ THREAD_OFF(oi->thread_send_lsack); - thread_add_event(master, ospf6_lsack_send_interface, oi, - 0, &oi->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_interface, oi, + 0, &oi->thread_send_lsack); ospf6_lsa_unlock(lsa); if (lsanext) @@ -2975,8 +2975,8 @@ void ospf6_lsack_send_interface(struct event *thread) OSPF6_MESSAGE_WRITE_ON(oi); if (oi->lsack_list->count > 0) - thread_add_event(master, ospf6_lsack_send_interface, oi, 0, - &oi->thread_send_lsack); + event_add_event(master, ospf6_lsack_send_interface, oi, 0, + &oi->thread_send_lsack); } /* Commands */ diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 95c8f189d0..aaa23659eb 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -284,8 +284,8 @@ void hello_received(struct event *thread) /* reset Inactivity Timer */ THREAD_OFF(on->inactivity_timer); - thread_add_timer(master, inactivity_timer, on, - on->ospf6_if->dead_interval, &on->inactivity_timer); + event_add_timer(master, inactivity_timer, on, + on->ospf6_if->dead_interval, &on->inactivity_timer); if (on->state <= OSPF6_NEIGHBOR_DOWN) ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on, @@ -305,7 +305,7 @@ void twoway_received(struct event *thread) if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) zlog_debug("Neighbor Event %s: *2Way-Received*", on->name); - thread_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); + event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); if (!need_adjacency(on)) { ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on, @@ -320,8 +320,8 @@ void twoway_received(struct event *thread) SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); THREAD_OFF(on->thread_send_dbdesc); - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); } void negotiation_done(struct event *thread) @@ -400,9 +400,9 @@ void exchange_done(struct event *thread) /* RFC 2328 (10.8): Release the last dbdesc after dead_interval */ if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT)) { THREAD_OFF(on->last_dbdesc_release_timer); - thread_add_timer(master, ospf6_neighbor_last_dbdesc_release, on, - on->ospf6_if->dead_interval, - &on->last_dbdesc_release_timer); + event_add_timer(master, ospf6_neighbor_last_dbdesc_release, on, + on->ospf6_if->dead_interval, + &on->last_dbdesc_release_timer); } if (on->request_list->count == 0) @@ -412,8 +412,8 @@ void exchange_done(struct event *thread) ospf6_neighbor_state_change(OSPF6_NEIGHBOR_LOADING, on, OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE); - thread_add_event(master, ospf6_lsreq_send, on, 0, - &on->thread_send_lsreq); + event_add_event(master, ospf6_lsreq_send, on, 0, + &on->thread_send_lsreq); } } @@ -428,11 +428,11 @@ void ospf6_check_nbr_loading(struct ospf6_neighbor *on) if ((on->state == OSPF6_NEIGHBOR_LOADING) || (on->state == OSPF6_NEIGHBOR_EXCHANGE)) { if (on->request_list->count == 0) - thread_add_event(master, loading_done, on, 0, NULL); + event_add_event(master, loading_done, on, 0, NULL); else if (on->last_ls_req == NULL) { THREAD_OFF(on->thread_send_lsreq); - thread_add_event(master, ospf6_lsreq_send, on, 0, - &on->thread_send_lsreq); + event_add_event(master, ospf6_lsreq_send, on, 0, + &on->thread_send_lsreq); } } } @@ -474,8 +474,8 @@ void adj_ok(struct event *thread) SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); THREAD_OFF(on->thread_send_dbdesc); - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); } else if (on->state >= OSPF6_NEIGHBOR_EXSTART && !need_adjacency(on)) { ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on, @@ -508,8 +508,8 @@ void seqnumber_mismatch(struct event *thread) THREAD_OFF(on->thread_send_dbdesc); on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); } void bad_lsreq(struct event *thread) @@ -536,9 +536,8 @@ void bad_lsreq(struct event *thread) THREAD_OFF(on->thread_send_dbdesc); on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ - thread_add_event(master, ospf6_dbdesc_send, on, 0, - &on->thread_send_dbdesc); - + event_add_event(master, ospf6_dbdesc_send, on, 0, + &on->thread_send_dbdesc); } void oneway_received(struct event *thread) @@ -556,7 +555,7 @@ void oneway_received(struct event *thread) ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on, OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD); - thread_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); + event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); ospf6_neighbor_clear_ls_lists(on); @@ -588,8 +587,7 @@ void inactivity_timer(struct event *thread) ospf6_neighbor_state_change( OSPF6_NEIGHBOR_DOWN, on, OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER); - thread_add_event(master, neighbor_change, on->ospf6_if, 0, - NULL); + event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); listnode_delete(on->ospf6_if->neighbor_list, on); ospf6_neighbor_delete(on); @@ -600,9 +598,9 @@ void inactivity_timer(struct event *thread) "%s, Acting as HELPER for this neighbour, So restart the dead timer.", __PRETTY_FUNCTION__); - thread_add_timer(master, inactivity_timer, on, - on->ospf6_if->dead_interval, - &on->inactivity_timer); + event_add_timer(master, inactivity_timer, on, + on->ospf6_if->dead_interval, + &on->inactivity_timer); } } diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index c5627212f8..60b7cc59e9 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -29,11 +29,11 @@ extern int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst, listnode_add(oi->area->ospf6->oi_write_q, (oi)); \ (oi)->on_write_q = 1; \ } \ - if (list_was_empty \ - && !list_isempty(oi->area->ospf6->oi_write_q)) \ - thread_add_write(master, ospf6_write, oi->area->ospf6, \ - oi->area->ospf6->fd, \ - &oi->area->ospf6->t_write); \ + if (list_was_empty && \ + !list_isempty(oi->area->ospf6->oi_write_q)) \ + event_add_write(master, ospf6_write, oi->area->ospf6, \ + oi->area->ospf6->fd, \ + &oi->area->ospf6->t_write); \ } while (0) #endif /* OSPF6_NETWORK_H */ diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 6bae9b6175..ca48b25d68 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -1001,8 +1001,8 @@ void ospf6_schedule_abr_task(struct ospf6 *ospf6) if (IS_OSPF6_DEBUG_ABR) zlog_debug("Scheduling ABR task"); - thread_add_timer(master, ospf6_abr_task_timer, ospf6, - OSPF6_ABR_TASK_DELAY, &ospf6->t_abr_task); + event_add_timer(master, ospf6_abr_task_timer, ospf6, + OSPF6_ABR_TASK_DELAY, &ospf6->t_abr_task); } /* Flush the NSSA LSAs from the area */ @@ -1090,8 +1090,8 @@ static void ospf6_ase_lsa_refresh(struct ospf6 *o) o->lsdb); if (old) { THREAD_OFF(old->refresh); - thread_add_event(master, ospf6_lsa_refresh, old, 0, - &old->refresh); + event_add_event(master, ospf6_lsa_refresh, old, 0, + &old->refresh); } else { ospf6_as_external_lsa_originate(route, o); } @@ -1165,8 +1165,8 @@ void ospf6_area_nssa_update(struct ospf6_area *area) if (IS_OSPF6_DEBUG_NSSA) ospf6_lsa_header_print(lsa); THREAD_OFF(lsa->refresh); - thread_add_event(master, ospf6_lsa_refresh, lsa, - 0, &lsa->refresh); + event_add_event(master, ospf6_lsa_refresh, lsa, + 0, &lsa->refresh); } } } diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index d2366be468..051fd83f6d 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -725,8 +725,8 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason) zlog_debug("SPF: Rescheduling in %ld msec", delay); THREAD_OFF(ospf6->t_spf_calc); - thread_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, - delay, &ospf6->t_spf_calc); + event_add_timer_msec(master, ospf6_spf_calculation_thread, ospf6, delay, + &ospf6->t_spf_calc); } void ospf6_spf_display_subtree(struct vty *vty, const char *prefix, int rest, @@ -1272,6 +1272,6 @@ void ospf6_ase_calculate_timer_add(struct ospf6 *ospf6) if (ospf6 == NULL) return; - thread_add_timer(master, ospf6_ase_calculate_timer, ospf6, - OSPF6_ASE_CALC_INTERVAL, &ospf6->t_ase_calc); + event_add_timer(master, ospf6_ase_calculate_timer, ospf6, + OSPF6_ASE_CALC_INTERVAL, &ospf6->t_ase_calc); } diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index ad4e58ae24..203d344b3a 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -207,8 +207,8 @@ static int ospf6_vrf_enable(struct vrf *vrf) ret = ospf6_serv_sock(ospf6); if (ret < 0 || ospf6->fd <= 0) return 0; - thread_add_read(master, ospf6_receive, ospf6, ospf6->fd, - &ospf6->t_ospf6_receive); + event_add_read(master, ospf6_receive, ospf6, ospf6->fd, + &ospf6->t_ospf6_receive); ospf6_router_id_update(ospf6, true); } @@ -471,8 +471,8 @@ struct ospf6 *ospf6_instance_create(const char *name) */ ospf6_gr_nvm_read(ospf6); - thread_add_read(master, ospf6_receive, ospf6, ospf6->fd, - &ospf6->t_ospf6_receive); + event_add_read(master, ospf6_receive, ospf6, ospf6->fd, + &ospf6->t_ospf6_receive); return ospf6; } @@ -619,9 +619,9 @@ static void ospf6_maxage_remover(struct event *thread) void ospf6_maxage_remove(struct ospf6 *o) { if (o) - thread_add_timer(master, ospf6_maxage_remover, o, - OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT, - &o->maxage_remover); + event_add_timer(master, ospf6_maxage_remover, o, + OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT, + &o->maxage_remover); } bool ospf6_router_id_update(struct ospf6 *ospf6, bool init) diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c index 2c554c9b76..689e58adde 100644 --- a/ospfclient/ospfclient.c +++ b/ospfclient/ospfclient.c @@ -157,7 +157,7 @@ static void lsa_read(struct event *thread) } /* Reschedule read thread */ - thread_add_read(master, lsa_read, oclient, fd, NULL); + event_add_read(master, lsa_read, oclient, fd, NULL); } /* --------------------------------------------------------- @@ -209,13 +209,13 @@ static void ready_callback(uint8_t lsa_type, uint8_t opaque_type, lsa_type, opaque_type, &addr); /* Schedule opaque LSA originate in 5 secs */ - thread_add_timer(master, lsa_inject, oclient, 5, NULL); + event_add_timer(master, lsa_inject, oclient, 5, NULL); /* Schedule opaque LSA update with new value */ - thread_add_timer(master, lsa_inject, oclient, 10, NULL); + event_add_timer(master, lsa_inject, oclient, 10, NULL); /* Schedule delete */ - thread_add_timer(master, lsa_delete, oclient, 30, NULL); + event_add_timer(master, lsa_delete, oclient, 30, NULL); } static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id) @@ -316,7 +316,7 @@ int main(int argc, char *argv[]) ospf_apiclient_sync_lsdb(oclient); /* Schedule thread that handles asynchronous messages */ - thread_add_read(master, lsa_read, oclient, oclient->fd_async, NULL); + event_add_read(master, lsa_read, oclient, oclient->fd_async, NULL); /* Now connection is established, run loop */ while (1) { diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index aa1798ff98..a00e58b2f1 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -2040,9 +2040,9 @@ void ospf_abr_task(struct ospf *ospf) * giving time for route synchronization in * all the routers. */ - thread_add_timer( - master, ospf_abr_announce_non_dna_routers, ospf, - OSPF_ABR_DNA_TIMER, &ospf->t_abr_fr); + event_add_timer(master, + ospf_abr_announce_non_dna_routers, ospf, + OSPF_ABR_DNA_TIMER, &ospf->t_abr_fr); } } @@ -2077,6 +2077,6 @@ void ospf_schedule_abr_task(struct ospf *ospf) if (IS_DEBUG_OSPF_EVENT) zlog_debug("Scheduling ABR task"); - thread_add_timer(master, ospf_abr_task_timer, ospf, OSPF_ABR_TASK_DELAY, - &ospf->t_abr_task); + event_add_timer(master, ospf_abr_task_timer, ospf, OSPF_ABR_TASK_DELAY, + &ospf->t_abr_task); } diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c index 56731b751a..79626142f1 100644 --- a/ospfd/ospf_apiserver.c +++ b/ospfd/ospf_apiserver.c @@ -278,28 +278,28 @@ void ospf_apiserver_event(enum ospf_apiserver_event event, int fd, { switch (event) { case OSPF_APISERVER_ACCEPT: - (void)thread_add_read(master, ospf_apiserver_accept, apiserv, - fd, NULL); + (void)event_add_read(master, ospf_apiserver_accept, apiserv, fd, + NULL); break; case OSPF_APISERVER_SYNC_READ: apiserv->t_sync_read = NULL; - thread_add_read(master, ospf_apiserver_read, apiserv, fd, - &apiserv->t_sync_read); + event_add_read(master, ospf_apiserver_read, apiserv, fd, + &apiserv->t_sync_read); break; #ifdef USE_ASYNC_READ case OSPF_APISERVER_ASYNC_READ: apiserv->t_async_read = NULL; - thread_add_read(master, ospf_apiserver_read, apiserv, fd, - &apiserv->t_async_read); + event_add_read(master, ospf_apiserver_read, apiserv, fd, + &apiserv->t_async_read); break; #endif /* USE_ASYNC_READ */ case OSPF_APISERVER_SYNC_WRITE: - thread_add_write(master, ospf_apiserver_sync_write, apiserv, fd, - &apiserv->t_sync_write); + event_add_write(master, ospf_apiserver_sync_write, apiserv, fd, + &apiserv->t_sync_write); break; case OSPF_APISERVER_ASYNC_WRITE: - thread_add_write(master, ospf_apiserver_async_write, apiserv, - fd, &apiserv->t_async_write); + event_add_write(master, ospf_apiserver_async_write, apiserv, fd, + &apiserv->t_async_write); break; } } diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 19f422d613..c9228c4eb9 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -297,9 +297,9 @@ void ospf_schedule_asbr_nssa_redist_update(struct ospf *ospf) if (IS_DEBUG_OSPF_EVENT) zlog_debug("Scheduling ASBR NSSA redistribution update"); - thread_add_timer(master, ospf_asbr_nssa_redist_update_timer, ospf, - OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY, - &ospf->t_asbr_nssa_redist_update); + event_add_timer(master, ospf_asbr_nssa_redist_update_timer, ospf, + OSPF_ASBR_NSSA_REDIST_UPDATE_DELAY, + &ospf->t_asbr_nssa_redist_update); } void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type, @@ -1093,8 +1093,8 @@ static void ospf_external_aggr_timer(struct ospf *ospf, __func__, ospf->aggr_delay_interval); ospf->aggr_action = operation; - thread_add_timer(master, ospf_asbr_external_aggr_process, ospf, - ospf->aggr_delay_interval, &ospf->t_external_aggr); + event_add_timer(master, ospf_asbr_external_aggr_process, ospf, + ospf->aggr_delay_interval, &ospf->t_external_aggr); } int ospf_asbr_external_aggregator_set(struct ospf *ospf, struct prefix_ipv4 *p, diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index 61f87bb2d0..9ad3d276d7 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -630,8 +630,8 @@ void ospf_ase_calculate_timer_add(struct ospf *ospf) if (ospf == NULL) return; - thread_add_timer(master, ospf_ase_calculate_timer, ospf, - OSPF_ASE_CALC_INTERVAL, &ospf->t_ase_calc); + event_add_timer(master, ospf_ase_calculate_timer, ospf, + OSPF_ASE_CALC_INTERVAL, &ospf->t_ase_calc); } void ospf_ase_register_external_lsa(struct ospf_lsa *lsa, struct ospf *top) diff --git a/ospfd/ospf_gr.c b/ospfd/ospf_gr.c index 8c1274739d..0870699014 100644 --- a/ospfd/ospf_gr.c +++ b/ospfd/ospf_gr.c @@ -648,9 +648,9 @@ void ospf_gr_nvm_read(struct ospf *ospf) zlog_debug( "GR: remaining time until grace period expires: %lu(s)", remaining_time); - thread_add_timer(master, ospf_gr_grace_period_expired, - ospf, remaining_time, - &ospf->gr_info.t_grace_period); + event_add_timer(master, ospf_gr_grace_period_expired, + ospf, remaining_time, + &ospf->gr_info.t_grace_period); } } diff --git a/ospfd/ospf_gr_helper.c b/ospfd/ospf_gr_helper.c index fa78c53b1a..13ae3d9df9 100644 --- a/ospfd/ospf_gr_helper.c +++ b/ospfd/ospf_gr_helper.c @@ -533,9 +533,9 @@ int ospf_process_grace_lsa(struct ospf *ospf, struct ospf_lsa *lsa, actual_grace_interval); /* Start the grace timer */ - thread_add_timer(master, ospf_handle_grace_timer_expiry, restarter, - actual_grace_interval, - &restarter->gr_helper_info.t_grace_timer); + event_add_timer(master, ospf_handle_grace_timer_expiry, restarter, + actual_grace_interval, + &restarter->gr_helper_info.t_grace_timer); return OSPF_GR_ACTIVE_HELPER; } diff --git a/ospfd/ospf_ism.h b/ospfd/ospf_ism.h index 4ae86a318a..d5261546e1 100644 --- a/ospfd/ospf_ism.h +++ b/ospfd/ospf_ism.h @@ -39,15 +39,15 @@ oi->on_write_q = 1; \ } \ if (!list_isempty((O)->oi_write_q)) \ - thread_add_write(master, ospf_write, (O), (O)->fd, \ - &(O)->t_write); \ + event_add_write(master, ospf_write, (O), (O)->fd, \ + &(O)->t_write); \ } while (0) /* Macro for OSPF ISM timer turn on. */ -#define OSPF_ISM_TIMER_ON(T, F, V) thread_add_timer(master, (F), oi, (V), &(T)) +#define OSPF_ISM_TIMER_ON(T, F, V) event_add_timer(master, (F), oi, (V), &(T)) #define OSPF_ISM_TIMER_MSEC_ON(T, F, V) \ - thread_add_timer_msec(master, (F), oi, (V), &(T)) + event_add_timer_msec(master, (F), oi, (V), &(T)) /* convenience macro to set hello timer correctly, according to * whether fast-hello is set or not @@ -65,7 +65,7 @@ /* Macro for OSPF schedule event. */ #define OSPF_ISM_EVENT_SCHEDULE(I, E) \ - thread_add_event(master, ospf_ism_event, (I), (E), NULL) + event_add_event(master, ospf_ism_event, (I), (E), NULL) /* Macro for OSPF execute event. */ #define OSPF_ISM_EVENT_EXECUTE(I, E) \ diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index 92e07dc5ee..c8ee9faf66 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -383,9 +383,8 @@ void ospf_ldp_sync_holddown_timer_add(struct interface *ifp) ols_debug("%s: start holddown timer for %s time %d", __func__, ifp->name, ldp_sync_info->holddown); - thread_add_timer(master, ospf_ldp_sync_holddown_timer, - ifp, ldp_sync_info->holddown, - &ldp_sync_info->t_holddown); + event_add_timer(master, ospf_ldp_sync_holddown_timer, ifp, + ldp_sync_info->holddown, &ldp_sync_info->t_holddown); } /* diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 92ad9951ab..aa113b087a 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -3870,7 +3870,7 @@ void ospf_schedule_lsa_flood_area(struct ospf_area *area, struct ospf_lsa *lsa) data->area = area; data->lsa = ospf_lsa_lock(lsa); /* Message / Flood area */ - thread_add_event(master, ospf_lsa_action, data, 0, NULL); + event_add_event(master, ospf_lsa_action, data, 0, NULL); } void ospf_schedule_lsa_flush_area(struct ospf_area *area, struct ospf_lsa *lsa) @@ -3882,7 +3882,7 @@ void ospf_schedule_lsa_flush_area(struct ospf_area *area, struct ospf_lsa *lsa) data->area = area; data->lsa = ospf_lsa_lock(lsa); /* Message / Flush area */ - thread_add_event(master, ospf_lsa_action, data, 0, NULL); + event_add_event(master, ospf_lsa_action, data, 0, NULL); } @@ -4091,8 +4091,8 @@ void ospf_lsa_refresh_walker(struct event *t) } ospf->t_lsa_refresher = NULL; - thread_add_timer(master, ospf_lsa_refresh_walker, ospf, - ospf->lsa_refresh_interval, &ospf->t_lsa_refresher); + event_add_timer(master, ospf_lsa_refresh_walker, ospf, + ospf->lsa_refresh_interval, &ospf->t_lsa_refresher); ospf->lsa_refresher_started = monotime(NULL); for (ALL_LIST_ELEMENTS(lsa_to_refresh, node, nnode, lsa)) { diff --git a/ospfd/ospf_nsm.h b/ospfd/ospf_nsm.h index c345be2869..140e8533fc 100644 --- a/ospfd/ospf_nsm.h +++ b/ospfd/ospf_nsm.h @@ -41,11 +41,11 @@ #define OSPF_NSM_EVENT_MAX 14 /* Macro for OSPF NSM timer turn on. */ -#define OSPF_NSM_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr, (V), &(T)) +#define OSPF_NSM_TIMER_ON(T, F, V) event_add_timer(master, (F), nbr, (V), &(T)) /* Macro for OSPF NSM schedule event. */ #define OSPF_NSM_EVENT_SCHEDULE(N, E) \ - thread_add_event(master, ospf_nsm_event, (N), (E), NULL) + event_add_event(master, ospf_nsm_event, (N), (E), NULL) /* Macro for OSPF NSM execute event. */ #define OSPF_NSM_EVENT_EXECUTE(N, E) \ diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c index 1fe44cd1a9..6cd26dd828 100644 --- a/ospfd/ospf_opaque.c +++ b/ospfd/ospf_opaque.c @@ -1332,8 +1332,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) "Schedule Type-9 Opaque-LSA origination in %d ms later.", delay); oi->t_opaque_lsa_self = NULL; - thread_add_timer_msec(master, ospf_opaque_type9_lsa_originate, - oi, delay, &oi->t_opaque_lsa_self); + event_add_timer_msec(master, ospf_opaque_type9_lsa_originate, + oi, delay, &oi->t_opaque_lsa_self); delay += top->min_ls_interval; } @@ -1350,8 +1350,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) "Schedule Type-10 Opaque-LSA origination in %d ms later.", delay); area->t_opaque_lsa_self = NULL; - thread_add_timer_msec(master, ospf_opaque_type10_lsa_originate, - area, delay, &area->t_opaque_lsa_self); + event_add_timer_msec(master, ospf_opaque_type10_lsa_originate, + area, delay, &area->t_opaque_lsa_self); delay += top->min_ls_interval; } @@ -1368,8 +1368,8 @@ void ospf_opaque_lsa_originate_schedule(struct ospf_interface *oi, int *delay0) "Schedule Type-11 Opaque-LSA origination in %d ms later.", delay); top->t_opaque_lsa_self = NULL; - thread_add_timer_msec(master, ospf_opaque_type11_lsa_originate, - top, delay, &top->t_opaque_lsa_self); + event_add_timer_msec(master, ospf_opaque_type11_lsa_originate, + top, delay, &top->t_opaque_lsa_self); delay += top->min_ls_interval; } @@ -1643,7 +1643,8 @@ struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa) * triggered by external interventions (vty session, signaling, etc). *------------------------------------------------------------------------*/ -#define OSPF_OPAQUE_TIMER_ON(T,F,L,V) thread_add_timer_msec (master, (F), (L), (V), &(T)) +#define OSPF_OPAQUE_TIMER_ON(T, F, L, V) \ + event_add_timer_msec(master, (F), (L), (V), &(T)) static struct ospf_lsa *pseudo_lsa(struct ospf_interface *oi, struct ospf_area *area, uint8_t lsa_type, diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 7c5fe441f1..d53f65e946 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -457,7 +457,7 @@ static void ospf_ls_req_timer(struct event *thread) void ospf_ls_req_event(struct ospf_neighbor *nbr) { THREAD_OFF(nbr->t_ls_req); - thread_add_event(master, ospf_ls_req_timer, nbr, 0, &nbr->t_ls_req); + event_add_event(master, ospf_ls_req_timer, nbr, 0, &nbr->t_ls_req); } /* Cyclic timer function. Fist registered in ospf_nbr_new () in @@ -847,8 +847,8 @@ static void ospf_write(struct event *thread) /* If packets still remain in queue, call write thread. */ if (!list_isempty(ospf->oi_write_q)) - thread_add_write(master, ospf_write, ospf, ospf->fd, - &ospf->t_write); + event_add_write(master, ospf_write, ospf, ospf->fd, + &ospf->t_write); } /* OSPF Hello message read -- RFC2328 Section 10.5. */ @@ -3213,7 +3213,7 @@ void ospf_read(struct event *thread) ospf = THREAD_ARG(thread); /* prepare for next packet. */ - thread_add_read(master, ospf_read, ospf, ospf->fd, &ospf->t_read); + event_add_read(master, ospf_read, ospf, ospf->fd, &ospf->t_read); while (count < ospf->write_oi_count) { count++; @@ -4140,8 +4140,8 @@ static void ospf_ls_upd_send_queue_event(struct event *thread) "%s: update lists not cleared, %d nodes to try again, raising new event", __func__, again); oi->t_ls_upd_event = NULL; - thread_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, - &oi->t_ls_upd_event); + event_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, + &oi->t_ls_upd_event); } if (IS_DEBUG_OSPF_EVENT) @@ -4212,8 +4212,8 @@ void ospf_ls_upd_send(struct ospf_neighbor *nbr, struct list *update, int flag, rn->p.u.prefix4, 1); } } else - thread_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, - &oi->t_ls_upd_event); + event_add_event(master, ospf_ls_upd_send_queue_event, oi, 0, + &oi->t_ls_upd_event); } static void ospf_ls_ack_send_list(struct ospf_interface *oi, struct list *ack, @@ -4276,8 +4276,8 @@ void ospf_ls_ack_send(struct ospf_neighbor *nbr, struct ospf_lsa *lsa) listnode_add(oi->ls_ack_direct.ls_ack, ospf_lsa_lock(lsa)); - thread_add_event(master, ospf_ls_ack_send_event, oi, 0, - &oi->t_ls_ack_direct); + event_add_event(master, ospf_ls_ack_send_event, oi, 0, + &oi->t_ls_ack_direct); } /* Send Link State Acknowledgment delayed. */ diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 314b89933e..39497291dc 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -2044,8 +2044,8 @@ void ospf_spf_calculate_schedule(struct ospf *ospf, ospf_spf_reason_t reason) zlog_debug("SPF: calculation timer delay = %ld msec", delay); ospf->t_spf_calc = NULL; - thread_add_timer_msec(master, ospf_spf_calculate_schedule_worker, ospf, - delay, &ospf->t_spf_calc); + event_add_timer_msec(master, ospf_spf_calculate_schedule_worker, ospf, + delay, &ospf->t_spf_calc); } /* Restart OSPF SPF algorithm*/ diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 34614c0fbc..efe4f4ecc3 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -496,8 +496,8 @@ static int ospf_sr_start(struct ospf *ospf) if (!ospf_zebra_label_manager_ready()) if (ospf_zebra_label_manager_connect() < 0) { /* Re-attempt to connect to Label Manager in 1 sec. */ - thread_add_timer(master, sr_start_label_manager, ospf, - 1, &OspfSR.t_start_lm); + event_add_timer(master, sr_start_label_manager, ospf, 1, + &OspfSR.t_start_lm); osr_debug(" |- Failed to start the Label Manager"); return -1; } diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index c101913bc4..4fddd1e81f 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -579,8 +579,8 @@ void ospf_external_del(struct ospf *ospf, uint8_t type, unsigned short instance) /* * Check if default needs to be flushed too. */ - thread_add_event(master, ospf_external_lsa_default_routemap_timer, ospf, - 0, &ospf->t_default_routemap_timer); + event_add_event(master, ospf_external_lsa_default_routemap_timer, ospf, + 0, &ospf->t_default_routemap_timer); } /* Update NHLFE for Prefix SID */ @@ -1124,9 +1124,9 @@ static bool ospf_external_lsa_default_routemap_apply(struct ospf *ospf, * there are any other external info which can still trigger * default route origination else flush it. */ - thread_add_event(master, - ospf_external_lsa_default_routemap_timer, ospf, - 0, &ospf->t_default_routemap_timer); + event_add_event(master, + ospf_external_lsa_default_routemap_timer, ospf, + 0, &ospf->t_default_routemap_timer); } return true; @@ -1641,9 +1641,8 @@ void ospf_distribute_list_update(struct ospf *ospf, int type, return; /* Set timer. If timer is already started, this call does nothing. */ - thread_add_timer_msec(master, ospf_distribute_list_update_timer, ospf, - ospf->min_ls_interval, - &ospf->t_distribute_update); + event_add_timer_msec(master, ospf_distribute_list_update_timer, ospf, + ospf->min_ls_interval, &ospf->t_distribute_update); } /* If access-list is updated, apply some check. */ diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index b167002b0b..a9e2aaabc3 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -385,8 +385,8 @@ struct ospf *ospf_new_alloc(unsigned short instance, const char *name) new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT; new->maxage_lsa = route_table_init(); new->t_maxage_walker = NULL; - thread_add_timer(master, ospf_lsa_maxage_walker, new, - OSPF_LSA_MAXAGE_CHECK_INTERVAL, &new->t_maxage_walker); + event_add_timer(master, ospf_lsa_maxage_walker, new, + OSPF_LSA_MAXAGE_CHECK_INTERVAL, &new->t_maxage_walker); /* Max paths initialization */ new->max_multipath = MULTIPATH_NUM; @@ -398,8 +398,8 @@ struct ospf *ospf_new_alloc(unsigned short instance, const char *name) new->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT; new->lsa_refresh_timer = OSPF_LS_REFRESH_TIME; new->t_lsa_refresher = NULL; - thread_add_timer(master, ospf_lsa_refresh_walker, new, - new->lsa_refresh_interval, &new->t_lsa_refresher); + event_add_timer(master, ospf_lsa_refresh_walker, new, + new->lsa_refresh_interval, &new->t_lsa_refresher); new->lsa_refresher_started = monotime(NULL); new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE + 1); @@ -441,7 +441,7 @@ static struct ospf *ospf_new(unsigned short instance, const char *name) return new; } - thread_add_read(master, ospf_read, new, new->fd, &new->t_read); + event_add_read(master, ospf_read, new, new->fd, &new->t_read); new->oi_running = 1; ospf_router_id_update(new); @@ -1860,8 +1860,8 @@ int ospf_timers_refresh_set(struct ospf *ospf, int interval) if (time_left > interval) { THREAD_OFF(ospf->t_lsa_refresher); - thread_add_timer(master, ospf_lsa_refresh_walker, ospf, - interval, &ospf->t_lsa_refresher); + event_add_timer(master, ospf_lsa_refresh_walker, ospf, interval, + &ospf->t_lsa_refresher); } ospf->lsa_refresh_interval = interval; @@ -1878,9 +1878,9 @@ int ospf_timers_refresh_unset(struct ospf *ospf) if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) { THREAD_OFF(ospf->t_lsa_refresher); ospf->t_lsa_refresher = NULL; - thread_add_timer(master, ospf_lsa_refresh_walker, ospf, - OSPF_LSA_REFRESH_INTERVAL_DEFAULT, - &ospf->t_lsa_refresher); + event_add_timer(master, ospf_lsa_refresh_walker, ospf, + OSPF_LSA_REFRESH_INTERVAL_DEFAULT, + &ospf->t_lsa_refresher); } ospf->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT; @@ -2247,8 +2247,8 @@ static int ospf_vrf_enable(struct vrf *vrf) ret = ospf_sock_init(ospf); if (ret < 0 || ospf->fd <= 0) return 0; - thread_add_read(master, ospf_read, ospf, ospf->fd, - &ospf->t_read); + event_add_read(master, ospf_read, ospf, ospf->fd, + &ospf->t_read); ospf->oi_running = 1; ospf_router_id_update(ospf); } diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index 79c11b820e..dcb5a30e67 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -653,9 +653,11 @@ struct ospf_nbr_nbma { #define LSA_OPTIONS_NSSA_GET(area) \ (((area)->external_routing == OSPF_AREA_NSSA) ? OSPF_OPTION_NP : 0) -#define OSPF_TIMER_ON(T,F,V) thread_add_timer (master,(F),ospf,(V),&(T)) -#define OSPF_AREA_TIMER_ON(T,F,V) thread_add_timer (master, (F), area, (V), &(T)) -#define OSPF_POLL_TIMER_ON(T,F,V) thread_add_timer (master, (F), nbr_nbma, (V), &(T)) +#define OSPF_TIMER_ON(T, F, V) event_add_timer(master, (F), ospf, (V), &(T)) +#define OSPF_AREA_TIMER_ON(T, F, V) \ + event_add_timer(master, (F), area, (V), &(T)) +#define OSPF_POLL_TIMER_ON(T, F, V) \ + event_add_timer(master, (F), nbr_nbma, (V), &(T)) /* Extern variables. */ extern struct ospf_master *om; diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index 92ab5a63bd..7df3143129 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -319,8 +319,8 @@ int pcep_ctrl_send_error(struct frr_pthread *fpt, int pcc_id, int pcep_ctrl_halt_cb(struct frr_pthread *fpt, void **res) { - thread_add_event(fpt->master, pcep_thread_finish_event_handler, - (void *)fpt, 0, NULL); + event_add_event(fpt->master, pcep_thread_finish_event_handler, + (void *)fpt, 0, NULL); pthread_join(fpt->thread, res); return 0; @@ -469,8 +469,8 @@ int pcep_thread_refine_path(struct ctrl_state *ctrl_state, int pcc_id, data->continue_lsp_update_handler = cb; data->payload = payload; - thread_add_event(ctrl_state->main, pcep_refine_path_event_cb, - (void *)data, 0, NULL); + event_add_event(ctrl_state->main, pcep_refine_path_event_cb, + (void *)data, 0, NULL); return 0; } @@ -535,8 +535,8 @@ int schedule_thread_timer_with_cb(struct ctrl_state *ctrl_state, int pcc_id, data->pcc_id = pcc_id; data->payload = payload; - thread_add_timer(ctrl_state->self, timer_cb, (void *)data, delay, - thread); + event_add_timer(ctrl_state->self, timer_cb, (void *)data, delay, + thread); return 0; } @@ -640,11 +640,11 @@ int schedule_thread_socket(struct ctrl_state *ctrl_state, int pcc_id, data->payload = payload; if (is_read) { - thread_add_read(ctrl_state->self, socket_cb, (void *)data, fd, - thread); + event_add_read(ctrl_state->self, socket_cb, (void *)data, fd, + thread); } else { - thread_add_write(ctrl_state->self, socket_cb, (void *)data, fd, - thread); + event_add_write(ctrl_state->self, socket_cb, (void *)data, fd, + thread); } return 0; @@ -702,7 +702,7 @@ int send_to_thread_with_cb(struct ctrl_state *ctrl_state, int pcc_id, data->pcc_id = pcc_id; data->payload = payload; - thread_add_event(ctrl_state->self, event_cb, (void *)data, 0, NULL); + event_add_event(ctrl_state->self, event_cb, (void *)data, 0, NULL); return 0; } @@ -964,8 +964,8 @@ int send_to_main(struct ctrl_state *ctrl_state, int pcc_id, data->pcc_id = pcc_id; data->payload = payload; - thread_add_event(ctrl_state->main, pcep_main_event_handler, - (void *)data, 0, NULL); + event_add_event(ctrl_state->main, pcep_main_event_handler, (void *)data, + 0, NULL); return 0; } diff --git a/pathd/path_ted.c b/pathd/path_ted.c index d39371041f..0a2a74cb42 100644 --- a/pathd/path_ted.c +++ b/pathd/path_ted.c @@ -583,9 +583,9 @@ enum zclient_send_status path_ted_link_state_sync(void) PATH_TED_DEBUG("%s: PATHD-TED: Opaque asked for TED sync ", __func__); } - thread_add_timer(ted_state_g.main, path_ted_timer_handler_sync, - &ted_state_g, ted_state_g.link_state_delay_interval, - &ted_state_g.t_link_state_sync); + event_add_timer(ted_state_g.main, path_ted_timer_handler_sync, + &ted_state_g, ted_state_g.link_state_delay_interval, + &ted_state_g.t_link_state_sync); return status; } @@ -619,10 +619,9 @@ int path_ted_segment_list_refresh(void) int status = 0; path_ted_timer_refresh_cancel(); - thread_add_timer(ted_state_g.main, path_ted_timer_handler_refresh, - &ted_state_g, - ted_state_g.segment_list_refresh_interval, - &ted_state_g.t_segment_list_refresh); + event_add_timer(ted_state_g.main, path_ted_timer_handler_refresh, + &ted_state_g, ted_state_g.segment_list_refresh_interval, + &ted_state_g.t_segment_list_refresh); return status; } diff --git a/pathd/pathd.c b/pathd/pathd.c index b11d90905a..0b7792a5cc 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -1293,8 +1293,8 @@ void trigger_pathd_candidate_created(struct srte_candidate *candidate) from changing the candidate by hand with the console */ if (candidate->hook_timer != NULL) return; - thread_add_timer(master, trigger_pathd_candidate_created_timer, - (void *)candidate, HOOK_DELAY, &candidate->hook_timer); + event_add_timer(master, trigger_pathd_candidate_created_timer, + (void *)candidate, HOOK_DELAY, &candidate->hook_timer); } void trigger_pathd_candidate_created_timer(struct event *thread) @@ -1313,8 +1313,8 @@ void trigger_pathd_candidate_updated(struct srte_candidate *candidate) from changing the candidate by hand with the console */ if (candidate->hook_timer != NULL) return; - thread_add_timer(master, trigger_pathd_candidate_updated_timer, - (void *)candidate, HOOK_DELAY, &candidate->hook_timer); + event_add_timer(master, trigger_pathd_candidate_updated_timer, + (void *)candidate, HOOK_DELAY, &candidate->hook_timer); } void trigger_pathd_candidate_updated_timer(struct event *thread) diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index b0bcfcf5f0..98b311f604 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -1048,8 +1048,8 @@ static void gm_t_expire(struct event *t) log_ifp("next general expiry in %" PRId64 "ms"), remain_ms / 1000); - thread_add_timer_tv(router->master, gm_t_expire, gm_ifp, - &remain, &gm_ifp->t_expire); + event_add_timer_tv(router->master, gm_t_expire, gm_ifp, + &remain, &gm_ifp->t_expire); return; } @@ -1119,8 +1119,8 @@ static void gm_handle_q_general(struct gm_if *gm_ifp, zlog_debug( log_ifp("starting general timer @ 0: %pTVMu"), &pend->expiry); - thread_add_timer_tv(router->master, gm_t_expire, gm_ifp, - &timers->expire_wait, &gm_ifp->t_expire); + event_add_timer_tv(router->master, gm_t_expire, gm_ifp, + &timers->expire_wait, &gm_ifp->t_expire); } else if (PIM_DEBUG_GM_TRACE) zlog_debug(log_ifp("appending general timer @ %u: %pTVMu"), gm_ifp->n_pending, &pend->expiry); @@ -1215,8 +1215,8 @@ static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg, THREAD_OFF(sg->t_sg_expire); } - thread_add_timer_tv(router->master, gm_t_sg_expire, sg, &expire_wait, - &sg->t_sg_expire); + event_add_timer_tv(router->master, gm_t_sg_expire, sg, &expire_wait, + &sg->t_sg_expire); } static void gm_handle_q_groupsrc(struct gm_if *gm_ifp, @@ -1329,8 +1329,8 @@ static void gm_handle_q_group(struct gm_if *gm_ifp, } monotime(&pend->query); - thread_add_timer_tv(router->master, gm_t_grp_expire, pend, - &timers->expire_wait, &pend->t_expire); + event_add_timer_tv(router->master, gm_t_grp_expire, pend, + &timers->expire_wait, &pend->t_expire); if (PIM_DEBUG_GM_TRACE) zlog_debug(log_ifp("*,%pPAs S,G timer started: %pTHD"), &grp, @@ -1470,9 +1470,8 @@ static void gm_handle_query(struct gm_if *gm_ifp, THREAD_OFF(gm_ifp->t_other_querier); other_ms = timers.qrv * timers.qqic_ms + timers.max_resp_ms / 2; - thread_add_timer_msec(router->master, gm_t_other_querier, - gm_ifp, other_ms, - &gm_ifp->t_other_querier); + event_add_timer_msec(router->master, gm_t_other_querier, gm_ifp, + other_ms, &gm_ifp->t_other_querier); } if (len == sizeof(struct mld_v1_pkt)) { @@ -1607,8 +1606,8 @@ static void gm_t_recv(struct event *t) ssize_t nread; size_t pktlen; - thread_add_read(router->master, gm_t_recv, pim, pim->gm_socket, - &pim->t_gm_recv); + event_add_read(router->master, gm_t_recv, pim, pim->gm_socket, + &pim->t_gm_recv); iov->iov_base = rxbuf; iov->iov_len = sizeof(rxbuf); @@ -1868,8 +1867,8 @@ static void gm_t_query(struct event *t) gm_ifp->n_startup--; } - thread_add_timer_msec(router->master, gm_t_query, gm_ifp, timer_ms, - &gm_ifp->t_query); + event_add_timer_msec(router->master, gm_t_query, gm_ifp, timer_ms, + &gm_ifp->t_query); gm_send_query(gm_ifp, PIMADDR_ANY, NULL, 0, false); } @@ -1910,9 +1909,9 @@ static void gm_trigger_specific(struct gm_sg *sg) sg->n_query--; if (sg->n_query) - thread_add_timer_msec(router->master, gm_t_sg_query, sg, - gm_ifp->cur_query_intv_trig, - &sg->t_sg_query); + event_add_timer_msec(router->master, gm_t_sg_query, sg, + gm_ifp->cur_query_intv_trig, + &sg->t_sg_query); if (!IPV6_ADDR_SAME(&gm_ifp->querier, &pim_ifp->ll_lowest)) return; @@ -1938,9 +1937,8 @@ static void gm_trigger_specific(struct gm_sg *sg) pend_gsq->iface = gm_ifp; gm_gsq_pends_add(gm_ifp->gsq_pends, pend_gsq); - thread_add_timer_tv(router->master, gm_t_gsq_pend, pend_gsq, - &gm_ifp->cfg_timing_fuzz, - &pend_gsq->t_send); + event_add_timer_tv(router->master, gm_t_gsq_pend, pend_gsq, + &gm_ifp->cfg_timing_fuzz, &pend_gsq->t_send); } assert(pend_gsq->n_src < array_size(pend_gsq->srcs)); @@ -2046,8 +2044,8 @@ static void gm_vrf_socket_incref(struct pim_instance *pim) vrf->name); } - thread_add_read(router->master, gm_t_recv, pim, pim->gm_socket, - &pim->t_gm_recv); + event_add_read(router->master, gm_t_recv, pim, pim->gm_socket, + &pim->t_gm_recv); } static void gm_vrf_socket_decref(struct pim_instance *pim) diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index 9dfb6174ce..6478d539ae 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -547,8 +547,8 @@ static void pim_assert_timer_set(struct pim_ifchannel *ch, int interval) __func__, ch->sg_str, interval, ch->interface->name); } - thread_add_timer(router->master, on_assert_timer, ch, interval, - &ch->t_ifassert_timer); + event_add_timer(router->master, on_assert_timer, ch, interval, + &ch->t_ifassert_timer); } static void pim_assert_timer_reset(struct pim_ifchannel *ch) diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index b9132f771e..ec2bfdcb29 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -204,8 +204,8 @@ static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout) zlog_debug( "%s : starting bs timer for scope %d with timeout %d secs", __func__, scope->sz_id, bs_timeout); - thread_add_timer(router->master, pim_on_bs_timer, scope, bs_timeout, - &scope->bs_timer); + event_add_timer(router->master, pim_on_bs_timer, scope, bs_timeout, + &scope->bs_timer); } static inline void pim_bs_timer_restart(struct bsm_scope *scope, int bs_timeout) @@ -338,8 +338,8 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time) __func__, &bsrp->bsgrp_node->group, &bsrp->rp_address, hold_time, bsrp->rp_holdtime); - thread_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time, - &bsrp->g2rp_timer); + event_add_timer(router->master, pim_on_g2rp_timer, bsrp, hold_time, + &bsrp->g2rp_timer); } static inline void pim_g2rp_timer_restart(struct bsm_rpinfo *bsrp, diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index bb457306f1..80fc2879c5 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -980,8 +980,8 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, } if (holdtime != 0xFFFF) { - thread_add_timer(router->master, on_ifjoin_expiry_timer, ch, - holdtime, &ch->t_ifjoin_expiry_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, ch, + holdtime, &ch->t_ifjoin_expiry_timer); } } @@ -1032,13 +1032,13 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, THREAD_OFF(ch->t_ifjoin_prune_pending_timer); THREAD_OFF(ch->t_ifjoin_expiry_timer); - thread_add_timer_msec( - router->master, on_ifjoin_prune_pending_timer, - ch, jp_override_interval_msec, - &ch->t_ifjoin_prune_pending_timer); - thread_add_timer(router->master, on_ifjoin_expiry_timer, - ch, holdtime, - &ch->t_ifjoin_expiry_timer); + event_add_timer_msec(router->master, + on_ifjoin_prune_pending_timer, ch, + jp_override_interval_msec, + &ch->t_ifjoin_prune_pending_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, + ch, holdtime, + &ch->t_ifjoin_expiry_timer); pim_upstream_update_join_desired(pim_ifp->pim, ch->upstream); } @@ -1069,10 +1069,10 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, be taken not to use "ch" afterwards since it would be deleted. */ THREAD_OFF(ch->t_ifjoin_prune_pending_timer); - thread_add_timer_msec(router->master, - on_ifjoin_prune_pending_timer, ch, - jp_override_interval_msec, - &ch->t_ifjoin_prune_pending_timer); + event_add_timer_msec(router->master, + on_ifjoin_prune_pending_timer, ch, + jp_override_interval_msec, + &ch->t_ifjoin_prune_pending_timer); break; case PIM_IFJOIN_PRUNE: if (source_flags & PIM_ENCODE_RPT_BIT) { @@ -1095,27 +1095,27 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, THREAD_OFF(ch->t_ifjoin_expiry_timer); } - thread_add_timer(router->master, on_ifjoin_expiry_timer, - ch, holdtime, - &ch->t_ifjoin_expiry_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, + ch, holdtime, + &ch->t_ifjoin_expiry_timer); } break; case PIM_IFJOIN_PRUNE_TMP: if (source_flags & PIM_ENCODE_RPT_BIT) { ch->ifjoin_state = PIM_IFJOIN_PRUNE; THREAD_OFF(ch->t_ifjoin_expiry_timer); - thread_add_timer(router->master, on_ifjoin_expiry_timer, - ch, holdtime, - &ch->t_ifjoin_expiry_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, + ch, holdtime, + &ch->t_ifjoin_expiry_timer); } break; case PIM_IFJOIN_PRUNE_PENDING_TMP: if (source_flags & PIM_ENCODE_RPT_BIT) { ch->ifjoin_state = PIM_IFJOIN_PRUNE_PENDING; THREAD_OFF(ch->t_ifjoin_expiry_timer); - thread_add_timer(router->master, on_ifjoin_expiry_timer, - ch, holdtime, - &ch->t_ifjoin_expiry_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, + ch, holdtime, + &ch->t_ifjoin_expiry_timer); } break; } diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 3c1b0959d8..a8c125df22 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -420,9 +420,9 @@ void pim_igmp_other_querier_timer_on(struct gm_sock *igmp) other_querier_present_interval_msec % 1000); } - thread_add_timer_msec(router->master, pim_igmp_other_querier_expire, - igmp, other_querier_present_interval_msec, - &igmp->t_other_querier_timer); + event_add_timer_msec(router->master, pim_igmp_other_querier_expire, + igmp, other_querier_present_interval_msec, + &igmp->t_other_querier_timer); } void pim_igmp_other_querier_timer_off(struct gm_sock *igmp) @@ -865,8 +865,8 @@ void pim_igmp_general_query_on(struct gm_sock *igmp) ifaddr_str, query_interval, startup_mode ? "startup" : "non-startup", igmp->fd); } - thread_add_timer(router->master, pim_igmp_general_query, igmp, - query_interval, &igmp->t_igmp_query_timer); + event_add_timer(router->master, pim_igmp_general_query, igmp, + query_interval, &igmp->t_igmp_query_timer); } void pim_igmp_general_query_off(struct gm_sock *igmp) @@ -1243,8 +1243,8 @@ static void igmp_read_on(struct gm_sock *igmp) zlog_debug("Scheduling READ event on IGMP socket fd=%d", igmp->fd); } - thread_add_read(router->master, pim_igmp_read, igmp, igmp->fd, - &igmp->t_igmp_read); + event_add_read(router->master, pim_igmp_read, igmp, igmp->fd, + &igmp->t_igmp_read); } struct gm_sock *pim_igmp_sock_add(struct list *igmp_sock_list, @@ -1375,8 +1375,8 @@ void igmp_group_timer_on(struct gm_group *group, long interval_msec, */ assert(group->group_filtermode_isexcl); - thread_add_timer_msec(router->master, igmp_group_timer, group, - interval_msec, &group->t_group_timer); + event_add_timer_msec(router->master, igmp_group_timer, group, + interval_msec, &group->t_group_timer); } struct gm_group *find_group_by_addr(struct gm_sock *igmp, diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index 3c7b1fc827..1906516a99 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -209,8 +209,8 @@ static void igmp_source_timer_on(struct gm_group *group, source_str, group->interface->name); } - thread_add_timer_msec(router->master, igmp_source_timer, source, - interval_msec, &source->t_source_timer); + event_add_timer_msec(router->master, igmp_source_timer, source, + interval_msec, &source->t_source_timer); /* RFC 3376: 6.3. IGMPv3 Source-Specific Forwarding Rules @@ -1281,9 +1281,8 @@ static void group_retransmit_timer_on(struct gm_group *group) group->interface->name); } - thread_add_timer_msec(router->master, igmp_group_retransmit, group, - lmqi_msec, - &group->t_group_query_retransmit_timer); + event_add_timer_msec(router->master, igmp_group_retransmit, group, + lmqi_msec, &group->t_group_query_retransmit_timer); } static long igmp_group_timer_remain_msec(struct gm_group *group) diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index be42cc996a..5d72eb6581 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -952,8 +952,8 @@ void pim_mlag_register(void) router->mlag_process_register = true; - thread_add_event(router->master, pim_mlag_register_handler, NULL, 0, - NULL); + event_add_event(router->master, pim_mlag_register_handler, NULL, 0, + NULL); } static void pim_mlag_deregister_handler(struct event *thread) @@ -980,8 +980,8 @@ void pim_mlag_deregister(void) router->mlag_process_register = false; - thread_add_event(router->master, pim_mlag_deregister_handler, NULL, 0, - NULL); + event_add_event(router->master, pim_mlag_deregister_handler, NULL, 0, + NULL); } void pim_if_configure_mlag_dualactive(struct pim_interface *pim_ifp) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 56d127eb4b..f3c6ef650c 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -809,8 +809,8 @@ done: static void mroute_read_on(struct pim_instance *pim) { - thread_add_read(router->master, mroute_read, pim, pim->mroute_socket, - &pim->thread); + event_add_read(router->master, mroute_read, pim, pim->mroute_socket, + &pim->thread); } static void mroute_read_off(struct pim_instance *pim) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index bb9096b453..57f2245f97 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -70,9 +70,9 @@ static void pim_msdp_sa_adv_timer_setup(struct pim_instance *pim, bool start) { THREAD_OFF(pim->msdp.sa_adv_timer); if (start) { - thread_add_timer(pim->msdp.master, pim_msdp_sa_adv_timer_cb, - pim, PIM_MSDP_SA_ADVERTISMENT_TIME, - &pim->msdp.sa_adv_timer); + event_add_timer(pim->msdp.master, pim_msdp_sa_adv_timer_cb, pim, + PIM_MSDP_SA_ADVERTISMENT_TIME, + &pim->msdp.sa_adv_timer); } } @@ -94,9 +94,9 @@ static void pim_msdp_sa_state_timer_setup(struct pim_msdp_sa *sa, bool start) { THREAD_OFF(sa->sa_state_timer); if (start) { - thread_add_timer(sa->pim->msdp.master, - pim_msdp_sa_state_timer_cb, sa, - PIM_MSDP_SA_HOLD_TIME, &sa->sa_state_timer); + event_add_timer(sa->pim->msdp.master, + pim_msdp_sa_state_timer_cb, sa, + PIM_MSDP_SA_HOLD_TIME, &sa->sa_state_timer); } } @@ -886,8 +886,8 @@ static void pim_msdp_peer_hold_timer_setup(struct pim_msdp_peer *mp, bool start) struct pim_instance *pim = mp->pim; THREAD_OFF(mp->hold_timer); if (start) { - thread_add_timer(pim->msdp.master, pim_msdp_peer_hold_timer_cb, - mp, pim->msdp.hold_time, &mp->hold_timer); + event_add_timer(pim->msdp.master, pim_msdp_peer_hold_timer_cb, + mp, pim->msdp.hold_time, &mp->hold_timer); } } @@ -911,9 +911,8 @@ static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start) { THREAD_OFF(mp->ka_timer); if (start) { - thread_add_timer(mp->pim->msdp.master, - pim_msdp_peer_ka_timer_cb, mp, - mp->pim->msdp.keep_alive, &mp->ka_timer); + event_add_timer(mp->pim->msdp.master, pim_msdp_peer_ka_timer_cb, + mp, mp->pim->msdp.keep_alive, &mp->ka_timer); } } @@ -975,9 +974,9 @@ static void pim_msdp_peer_cr_timer_setup(struct pim_msdp_peer *mp, bool start) { THREAD_OFF(mp->cr_timer); if (start) { - thread_add_timer(mp->pim->msdp.master, - pim_msdp_peer_cr_timer_cb, mp, - mp->pim->msdp.connection_retry, &mp->cr_timer); + event_add_timer(mp->pim->msdp.master, pim_msdp_peer_cr_timer_cb, + mp, mp->pim->msdp.connection_retry, + &mp->cr_timer); } } diff --git a/pimd/pim_msdp.h b/pimd/pim_msdp.h index a4f9de0ebb..cae7dd17b6 100644 --- a/pimd/pim_msdp.h +++ b/pimd/pim_msdp.h @@ -204,12 +204,12 @@ struct pim_msdp { }; #define PIM_MSDP_PEER_READ_ON(mp) \ - thread_add_read(mp->pim->msdp.master, pim_msdp_read, mp, mp->fd, \ - &mp->t_read) + event_add_read(mp->pim->msdp.master, pim_msdp_read, mp, mp->fd, \ + &mp->t_read) #define PIM_MSDP_PEER_WRITE_ON(mp) \ - thread_add_write(mp->pim->msdp.master, pim_msdp_write, mp, mp->fd, \ - &mp->t_write) + event_add_write(mp->pim->msdp.master, pim_msdp_write, mp, mp->fd, \ + &mp->t_write) #define PIM_MSDP_PEER_READ_OFF(mp) thread_cancel(&mp->t_read) #define PIM_MSDP_PEER_WRITE_OFF(mp) thread_cancel(&mp->t_write) diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index 97552e2b8f..ff70cb8ca7 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -68,8 +68,8 @@ static void pim_msdp_sock_accept(struct event *thread) return; } pim->msdp.listener.thread = NULL; - thread_add_read(router->master, pim_msdp_sock_accept, pim, accept_sock, - &pim->msdp.listener.thread); + event_add_read(router->master, pim_msdp_sock_accept, pim, accept_sock, + &pim->msdp.listener.thread); /* accept client connection. */ msdp_sock = sockunion_accept(accept_sock, &su); @@ -192,8 +192,8 @@ int pim_msdp_sock_listen(struct pim_instance *pim) /* add accept thread */ listener->fd = sock; memcpy(&listener->su, &sin, socklen); - thread_add_read(pim->msdp.master, pim_msdp_sock_accept, pim, sock, - &listener->thread); + event_add_read(pim->msdp.master, pim_msdp_sock_accept, pim, sock, + &listener->thread); pim->msdp.flags |= PIM_MSDPF_LISTENER; return 0; diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c index 19e3b78d65..dbe2cbaf93 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -234,8 +234,8 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) __func__, neigh->holdtime, &neigh->source_addr, neigh->interface->name); - thread_add_timer(router->master, on_neighbor_timer, neigh, - neigh->holdtime, &neigh->t_expire_timer); + event_add_timer(router->master, on_neighbor_timer, neigh, + neigh->holdtime, &neigh->t_expire_timer); } static void on_neighbor_jp_timer(struct event *t) @@ -253,15 +253,15 @@ static void on_neighbor_jp_timer(struct event *t) rpf.rpf_addr = neigh->source_addr; pim_joinprune_send(&rpf, neigh->upstream_jp_agg); - thread_add_timer(router->master, on_neighbor_jp_timer, neigh, - router->t_periodic, &neigh->jp_timer); + event_add_timer(router->master, on_neighbor_jp_timer, neigh, + router->t_periodic, &neigh->jp_timer); } static void pim_neighbor_start_jp_timer(struct pim_neighbor *neigh) { THREAD_OFF(neigh->jp_timer); - thread_add_timer(router->master, on_neighbor_jp_timer, neigh, - router->t_periodic, &neigh->jp_timer); + event_add_timer(router->master, on_neighbor_jp_timer, neigh, + router->t_periodic, &neigh->jp_timer); } static struct pim_neighbor * diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 2c31344739..bbe00aae6e 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -431,8 +431,8 @@ static void pim_sock_read_on(struct interface *ifp) zlog_debug("Scheduling READ event on PIM socket fd=%d", pim_ifp->pim_sock_fd); } - thread_add_read(router->master, pim_sock_read, ifp, - pim_ifp->pim_sock_fd, &pim_ifp->t_pim_sock_read); + event_add_read(router->master, pim_sock_read, ifp, pim_ifp->pim_sock_fd, + &pim_ifp->t_pim_sock_read); } static int pim_sock_open(struct interface *ifp) @@ -822,9 +822,8 @@ static void hello_resched(struct interface *ifp) pim_ifp->pim_hello_period, ifp->name); } THREAD_OFF(pim_ifp->t_pim_hello_timer); - thread_add_timer(router->master, on_pim_hello_send, ifp, - pim_ifp->pim_hello_period, - &pim_ifp->t_pim_hello_timer); + event_add_timer(router->master, on_pim_hello_send, ifp, + pim_ifp->pim_hello_period, &pim_ifp->t_pim_hello_timer); } /* @@ -935,8 +934,8 @@ void pim_hello_restart_triggered(struct interface *ifp) random_msec, ifp->name); } - thread_add_timer_msec(router->master, on_pim_hello_send, ifp, - random_msec, &pim_ifp->t_pim_hello_timer); + event_add_timer_msec(router->master, on_pim_hello_send, ifp, + random_msec, &pim_ifp->t_pim_hello_timer); } int pim_sock_add(struct interface *ifp) diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index 2947dd05f7..2073b4cb0d 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -300,8 +300,8 @@ static void ssmpingd_sock_read(struct event *t) static void ssmpingd_read_on(struct ssmpingd_sock *ss) { - thread_add_read(router->master, ssmpingd_sock_read, ss, ss->sock_fd, - &ss->t_sock_read); + event_add_read(router->master, ssmpingd_sock_read, ss, ss->sock_fd, + &ss->t_sock_read); } static struct ssmpingd_sock *ssmpingd_new(struct pim_instance *pim, diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 94d7b3172a..b08c363269 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -354,8 +354,8 @@ void join_timer_start(struct pim_upstream *up) pim_jp_agg_add_group(nbr->upstream_jp_agg, up, 1, nbr); else { THREAD_OFF(up->t_join_timer); - thread_add_timer(router->master, on_join_timer, up, - router->t_periodic, &up->t_join_timer); + event_add_timer(router->master, on_join_timer, up, + router->t_periodic, &up->t_join_timer); } pim_jp_agg_upstream_verification(up, true); } @@ -383,8 +383,8 @@ static void pim_upstream_join_timer_restart_msec(struct pim_upstream *up, } THREAD_OFF(up->t_join_timer); - thread_add_timer_msec(router->master, on_join_timer, up, interval_msec, - &up->t_join_timer); + event_add_timer_msec(router->master, on_join_timer, up, interval_msec, + &up->t_join_timer); } void pim_update_suppress_timers(uint32_t suppress_time) @@ -1483,8 +1483,8 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) up->sg_str); } THREAD_OFF(up->t_ka_timer); - thread_add_timer(router->master, pim_upstream_keep_alive_timer, up, - time, &up->t_ka_timer); + event_add_timer(router->master, pim_upstream_keep_alive_timer, up, time, + &up->t_ka_timer); /* any time keepalive is started against a SG we will have to * re-evaluate our active source database */ @@ -1506,8 +1506,8 @@ static void pim_upstream_msdp_reg_timer(struct event *t) void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up) { THREAD_OFF(up->t_msdp_reg_timer); - thread_add_timer(router->master, pim_upstream_msdp_reg_timer, up, - PIM_MSDP_REG_RXED_PERIOD, &up->t_msdp_reg_timer); + event_add_timer(router->master, pim_upstream_msdp_reg_timer, up, + PIM_MSDP_REG_RXED_PERIOD, &up->t_msdp_reg_timer); pim_msdp_sa_local_update(up); } @@ -1768,8 +1768,8 @@ void pim_upstream_start_register_stop_timer(struct pim_upstream *up, "%s: (S,G)=%s Starting upstream register stop timer %d", __func__, up->sg_str, time); } - thread_add_timer(router->master, pim_upstream_register_stop_timer, up, - time, &up->t_rs_timer); + event_add_timer(router->master, pim_upstream_register_stop_timer, up, + time, &up->t_rs_timer); } int pim_upstream_inherited_olist_decide(struct pim_instance *pim, diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 995c14edd1..56a88babda 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -180,8 +180,8 @@ static void pim_vxlan_work_timer_setup(bool start) { THREAD_OFF(vxlan_info.work_timer); if (start) - thread_add_timer(router->master, pim_vxlan_work_timer_cb, NULL, - PIM_VXLAN_WORK_TIME, &vxlan_info.work_timer); + event_add_timer(router->master, pim_vxlan_work_timer_cb, NULL, + PIM_VXLAN_WORK_TIME, &vxlan_info.work_timer); } /**************************** vxlan origination mroutes *********************** diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index e201d50682..502dd7c8e5 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -417,9 +417,9 @@ void sched_rpf_cache_refresh(struct pim_instance *pim) router->rpf_cache_refresh_delay_msec); } - thread_add_timer_msec(router->master, on_rpf_cache_refresh, pim, - router->rpf_cache_refresh_delay_msec, - &pim->rpf_cache_refresher); + event_add_timer_msec(router->master, on_rpf_cache_refresh, pim, + router->rpf_cache_refresh_delay_msec, + &pim->rpf_cache_refresher); } static void pim_zebra_connected(struct zclient *zclient) diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 56d5ae8c6f..fa5cbac47f 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -65,15 +65,15 @@ static void zclient_lookup_connect(struct event *t) return; } - thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, - &zlookup_read); + event_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, + &zlookup_read); } /* Schedule connection with delay. */ static void zclient_lookup_sched(struct zclient *zlookup, int delay) { - thread_add_timer(router->master, zclient_lookup_connect, zlookup, delay, - &zlookup->t_connect); + event_add_timer(router->master, zclient_lookup_connect, zlookup, delay, + &zlookup->t_connect); zlog_notice("%s: zclient lookup connection scheduled for %d seconds", __func__, delay); @@ -82,8 +82,8 @@ static void zclient_lookup_sched(struct zclient *zlookup, int delay) /* Schedule connection for now. */ static void zclient_lookup_sched_now(struct zclient *zlookup) { - thread_add_event(router->master, zclient_lookup_connect, zlookup, 0, - &zlookup->t_connect); + event_add_event(router->master, zclient_lookup_connect, zlookup, 0, + &zlookup->t_connect); zlog_notice("%s: zclient lookup immediate connection scheduled", __func__); @@ -378,8 +378,8 @@ void zclient_lookup_read_pipe(struct event *thread) } zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l); - thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, - &zlookup_read); + event_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, + &zlookup_read); } int zclient_lookup_nexthop(struct pim_instance *pim, diff --git a/pimd/pim_zpthread.c b/pimd/pim_zpthread.c index afa7896633..d6b2621ff4 100644 --- a/pimd/pim_zpthread.c +++ b/pimd/pim_zpthread.c @@ -209,8 +209,8 @@ int pim_mlag_signal_zpthread(void) if (PIM_DEBUG_MLAG) zlog_debug(":%s: Scheduling PIM MLAG write Thread", __func__); - thread_add_event(router->master, pim_mlag_zthread_handler, NULL, - 0, &router->zpthread_mlag_write); + event_add_event(router->master, pim_mlag_zthread_handler, NULL, + 0, &router->zpthread_mlag_write); } return (0); } diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index a32913766c..a085bc3f96 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -885,8 +885,8 @@ void rip_enable_apply(struct interface *ifp) zlog_debug("turn on %s", ifp->name); /* Add interface wake up thread. */ - thread_add_timer(master, rip_interface_wakeup, ifp, 1, - &ri->t_wakeup); + event_add_timer(master, rip_interface_wakeup, ifp, 1, + &ri->t_wakeup); rip_connect_set(ifp, 1); } else if (ri->running) { /* Might as well clean up the route table as well diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 88094e9836..99338f4e8a 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -78,8 +78,8 @@ static struct rip_peer *rip_peer_get(struct rip *rip, struct in_addr *addr) } /* Update timeout thread. */ - thread_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT, - &peer->t_timeout); + event_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT, + &peer->t_timeout); /* Last update time set. */ time(&peer->uptime); diff --git a/ripd/ripd.c b/ripd/ripd.c index 8cc339e7c6..70bcfef4e4 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -299,8 +299,8 @@ static void rip_timeout_update(struct rip *rip, struct rip_info *rinfo) { if (rinfo->metric != RIP_METRIC_INFINITY) { THREAD_OFF(rinfo->t_timeout); - thread_add_timer(master, rip_timeout, rinfo, rip->timeout_time, - &rinfo->t_timeout); + event_add_timer(master, rip_timeout, rinfo, rip->timeout_time, + &rinfo->t_timeout); } } @@ -2558,8 +2558,8 @@ static void rip_triggered_update(struct event *t) update is triggered when the timer expires. */ interval = (frr_weak_random() % 5) + 1; - thread_add_timer(master, rip_triggered_interval, rip, interval, - &rip->t_triggered_interval); + event_add_timer(master, rip_triggered_interval, rip, interval, + &rip->t_triggered_interval); } /* Withdraw redistributed route. */ @@ -2766,21 +2766,21 @@ void rip_event(struct rip *rip, enum rip_event event, int sock) switch (event) { case RIP_READ: - thread_add_read(master, rip_read, rip, sock, &rip->t_read); + event_add_read(master, rip_read, rip, sock, &rip->t_read); break; case RIP_UPDATE_EVENT: THREAD_OFF(rip->t_update); jitter = rip_update_jitter(rip->update_time); - thread_add_timer(master, rip_update, rip, - sock ? 2 : rip->update_time + jitter, - &rip->t_update); + event_add_timer(master, rip_update, rip, + sock ? 2 : rip->update_time + jitter, + &rip->t_update); break; case RIP_TRIGGERED_UPDATE: if (rip->t_triggered_interval) rip->trigger = 1; else - thread_add_event(master, rip_triggered_update, rip, 0, - &rip->t_triggered_update); + event_add_event(master, rip_triggered_update, rip, 0, + &rip->t_triggered_update); break; default: break; diff --git a/ripd/ripd.h b/ripd/ripd.h index b987ee1a42..4ae13e0d19 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -387,7 +387,7 @@ enum rip_event { }; /* Macro for timer turn on. */ -#define RIP_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T)) +#define RIP_TIMER_ON(T, F, V) event_add_timer(master, (F), rinfo, (V), &(T)) #define RIP_OFFSET_LIST_IN 0 #define RIP_OFFSET_LIST_OUT 1 diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 139afca7d2..e88936cdaa 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -698,8 +698,8 @@ void ripng_enable_apply(struct interface *ifp) zlog_info("RIPng INTERFACE ON %s", ifp->name); /* Add interface wake up thread. */ - thread_add_timer(master, ripng_interface_wakeup, ifp, 1, - &ri->t_wakeup); + event_add_timer(master, ripng_interface_wakeup, ifp, 1, + &ri->t_wakeup); ripng_connect_set(ifp, 1); } else { diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index dda10d1ce9..a40f4b1eb6 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -87,8 +87,8 @@ static struct ripng_peer *ripng_peer_get(struct ripng *ripng, } /* Update timeout thread. */ - thread_add_timer(master, ripng_peer_timeout, peer, - RIPNG_PEER_TIMER_DEFAULT, &peer->t_timeout); + event_add_timer(master, ripng_peer_timeout, peer, + RIPNG_PEER_TIMER_DEFAULT, &peer->t_timeout); /* Last update time set. */ time(&peer->uptime); diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 3bf0e3021e..00d0414b7e 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -597,8 +597,8 @@ static void ripng_timeout_update(struct ripng *ripng, struct ripng_info *rinfo) { if (rinfo->metric != RIPNG_METRIC_INFINITY) { THREAD_OFF(rinfo->t_timeout); - thread_add_timer(master, ripng_timeout, rinfo, - ripng->timeout_time, &rinfo->t_timeout); + event_add_timer(master, ripng_timeout, rinfo, + ripng->timeout_time, &rinfo->t_timeout); } } @@ -1493,8 +1493,8 @@ void ripng_triggered_update(struct event *t) update is triggered when the timer expires. */ interval = (frr_weak_random() % 5) + 1; - thread_add_timer(master, ripng_triggered_interval, ripng, interval, - &ripng->t_triggered_interval); + event_add_timer(master, ripng_triggered_interval, ripng, interval, + &ripng->t_triggered_interval); } /* Write routing table entry to the stream and return next index of @@ -1898,8 +1898,7 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) switch (event) { case RIPNG_READ: - thread_add_read(master, ripng_read, ripng, sock, - &ripng->t_read); + event_add_read(master, ripng_read, ripng, sock, &ripng->t_read); break; case RIPNG_UPDATE_EVENT: THREAD_OFF(ripng->t_update); @@ -1907,16 +1906,16 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock) /* Update timer jitter. */ jitter = ripng_update_jitter(ripng->update_time); - thread_add_timer(master, ripng_update, ripng, - sock ? 2 : ripng->update_time + jitter, - &ripng->t_update); + event_add_timer(master, ripng_update, ripng, + sock ? 2 : ripng->update_time + jitter, + &ripng->t_update); break; case RIPNG_TRIGGERED_UPDATE: if (ripng->t_triggered_interval) ripng->trigger = 1; else - thread_add_event(master, ripng_triggered_update, ripng, - 0, &ripng->t_triggered_update); + event_add_event(master, ripng_triggered_update, ripng, + 0, &ripng->t_triggered_update); break; case RIPNG_ZEBRA: case RIPNG_REQUEST_EVENT: diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index d5cdfe674a..a80517b436 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -295,7 +295,7 @@ enum ripng_event { }; /* RIPng timer on/off macro. */ -#define RIPNG_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T)) +#define RIPNG_TIMER_ON(T, F, V) event_add_timer(master, (F), rinfo, (V), &(T)) #define RIPNG_OFFSET_LIST_IN 0 #define RIPNG_OFFSET_LIST_OUT 1 diff --git a/sharpd/sharp_logpump.c b/sharpd/sharp_logpump.c index 175aca308a..a4a932e3cf 100644 --- a/sharpd/sharp_logpump.c +++ b/sharpd/sharp_logpump.c @@ -105,7 +105,7 @@ static void *logpump_run(void *arg) getrusage(RUSAGE_SELF, &lp_rusage); #endif - thread_add_timer_msec(master, logpump_done, NULL, 0, NULL); + event_add_timer_msec(master, logpump_done, NULL, 0, NULL); return NULL; } diff --git a/tests/helpers/c/main.c b/tests/helpers/c/main.c index ae089398e4..937a445209 100644 --- a/tests/helpers/c/main.c +++ b/tests/helpers/c/main.c @@ -38,12 +38,12 @@ static void test_timer(struct event *thread) int *count = THREAD_ARG(thread); printf("run %d of timer\n", (*count)++); - thread_add_timer(master, test_timer, count, 5, NULL); + event_add_timer(master, test_timer, count, 5, NULL); } static void test_timer_init(void) { - thread_add_timer(master, test_timer, &timer_count, 10, NULL); + event_add_timer(master, test_timer, &timer_count, 10, NULL); } static void test_vty_init(void) diff --git a/tests/lib/test_grpc.cpp b/tests/lib/test_grpc.cpp index b274c3d3a5..9a0e240632 100644 --- a/tests/lib/test_grpc.cpp +++ b/tests/lib/test_grpc.cpp @@ -479,7 +479,7 @@ void *grpc_client_test_start(void *arg) // Signal FRR event loop to stop test_debug("client: pthread: adding event to stop us"); - thread_add_event(master, grpc_thread_stop, NULL, 0, NULL); + event_add_event(master, grpc_thread_stop, NULL, 0, NULL); test_debug("client: pthread: DONE (returning)"); @@ -542,7 +542,7 @@ int main(int argc, char **argv) static_startup(); - thread_add_event(master, grpc_thread_start, NULL, 0, NULL); + event_add_event(master, grpc_thread_start, NULL, 0, NULL); /* Event Loop */ struct event thread; diff --git a/tests/lib/test_heavy_thread.c b/tests/lib/test_heavy_thread.c index 59da82b2f4..9084bf55eb 100644 --- a/tests/lib/test_heavy_thread.c +++ b/tests/lib/test_heavy_thread.c @@ -68,8 +68,8 @@ static void clear_something(struct event *thread) slow_func(ws->vty, ws->str, ws->i); ws->i++; if (thread_should_yield(thread)) { - thread_add_timer_msec(master, clear_something, ws, 0, - NULL); + event_add_timer_msec(master, clear_something, ws, 0, + NULL); return; } } @@ -102,7 +102,7 @@ DEFUN (clear_foo, ws->vty = vty; ws->i = ITERS_FIRST; - thread_add_timer_msec(master, clear_something, ws, 0, NULL); + event_add_timer_msec(master, clear_something, ws, 0, NULL); return CMD_SUCCESS; } diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index b2e3d8de69..b54dbe775d 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -119,8 +119,8 @@ int main(int argc, char **argv) /* Schedule timers to expire in 0..5 seconds */ interval_msec = prng_rand(prng) % 5000; arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1); - thread_add_timer_msec(master, timer_func, arg, interval_msec, - &timers[i]); + event_add_timer_msec(master, timer_func, arg, interval_msec, + &timers[i]); ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld", (long long)timers[i]->u.sands.tv_sec, (long long)timers[i]->u.sands.tv_usec); diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c index d4cd653802..ba2aacc8bd 100644 --- a/tests/lib/test_timer_performance.c +++ b/tests/lib/test_timer_performance.c @@ -41,7 +41,7 @@ int main(int argc, char **argv) /* create thread structures so they won't be allocated during the * time measurement */ for (i = 0; i < SCHEDULE_TIMERS; i++) { - thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]); + event_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]); } for (i = 0; i < SCHEDULE_TIMERS; i++) thread_cancel(&timers[i]); @@ -52,8 +52,8 @@ int main(int argc, char **argv) long interval_msec; interval_msec = prng_rand(prng) % (100 * SCHEDULE_TIMERS); - thread_add_timer_msec(master, dummy_func, NULL, interval_msec, - &timers[i]); + event_add_timer_msec(master, dummy_func, NULL, interval_msec, + &timers[i]); } monotime(&tv_lap); diff --git a/tests/lib/test_zmq.c b/tests/lib/test_zmq.c index 836819c546..58169a0778 100644 --- a/tests/lib/test_zmq.c +++ b/tests/lib/test_zmq.c @@ -212,8 +212,8 @@ static void serverpartfn(void *arg, void *zmqsock, zmq_msg_t *msg, printf("server recv: %s\n", buf); fflush(stdout); - frrzmq_thread_add_write_msg(master, serverwritefn, NULL, msg_id, - zmqsock, &cb); + frrzmq_event_add_write_msg(master, serverwritefn, NULL, msg_id, zmqsock, + &cb); } static void serverfn(void *arg, void *zmqsock) @@ -242,8 +242,8 @@ static void serverfn(void *arg, void *zmqsock) frrzmq_thread_cancel(&cb, &cb->read); frrzmq_thread_cancel(&cb, &cb->write); - frrzmq_thread_add_read_part(master, serverpartfn, NULL, NULL, zmqsock, - &cb); + frrzmq_event_add_read_part(master, serverpartfn, NULL, NULL, zmqsock, + &cb); } static void sigchld(void) @@ -276,7 +276,7 @@ static void run_server(int syncfd) exit(1); } - frrzmq_thread_add_read_msg(master, serverfn, NULL, NULL, zmqsock, &cb); + frrzmq_event_add_read_msg(master, serverfn, NULL, NULL, zmqsock, &cb); write(syncfd, &dummy, sizeof(dummy)); while (thread_fetch(master, &t)) diff --git a/tools/frr-llvm-cg.c b/tools/frr-llvm-cg.c index 51e8fb7b7e..634474fe49 100644 --- a/tools/frr-llvm-cg.c +++ b/tools/frr-llvm-cg.c @@ -271,11 +271,11 @@ static bool is_thread_sched(const char *name, size_t len) { #define thread_prefix "_" static const char *const names[] = { - thread_prefix "thread_add_read_write", - thread_prefix "thread_add_timer", - thread_prefix "thread_add_timer_msec", - thread_prefix "thread_add_timer_tv", - thread_prefix "thread_add_event", + thread_prefix "event_add_read_write", + thread_prefix "event_add_timer", + thread_prefix "event_add_timer_msec", + thread_prefix "event_add_timer_tv", + thread_prefix "event_add_event", thread_prefix "thread_execute", }; size_t i; diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index 19d53c1a19..0bccdce36a 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -901,10 +901,10 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, if (pkt->hdr.priority == 0) { vrrp_send_advertisement(r); THREAD_OFF(r->t_adver_timer); - thread_add_timer_msec( - master, vrrp_adver_timer_expire, r, - r->vr->advertisement_interval * CS2MS, - &r->t_adver_timer); + event_add_timer_msec(master, vrrp_adver_timer_expire, r, + r->vr->advertisement_interval * + CS2MS, + &r->t_adver_timer); } else if (pkt->hdr.priority > r->priority || ((pkt->hdr.priority == r->priority) && addrcmp > 0)) { @@ -920,10 +920,10 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, } vrrp_recalculate_timers(r); THREAD_OFF(r->t_master_down_timer); - thread_add_timer_msec(master, - vrrp_master_down_timer_expire, r, - r->master_down_interval * CS2MS, - &r->t_master_down_timer); + event_add_timer_msec(master, + vrrp_master_down_timer_expire, r, + r->master_down_interval * CS2MS, + &r->t_master_down_timer); vrrp_change_state(r, VRRP_STATE_BACKUP); } else { /* Discard advertisement */ @@ -937,7 +937,7 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, case VRRP_STATE_BACKUP: if (pkt->hdr.priority == 0) { THREAD_OFF(r->t_master_down_timer); - thread_add_timer_msec( + event_add_timer_msec( master, vrrp_master_down_timer_expire, r, r->skew_time * CS2MS, &r->t_master_down_timer); } else if (!r->vr->preempt_mode @@ -948,10 +948,10 @@ static int vrrp_recv_advertisement(struct vrrp_router *r, struct ipaddr *src, } vrrp_recalculate_timers(r); THREAD_OFF(r->t_master_down_timer); - thread_add_timer_msec(master, - vrrp_master_down_timer_expire, r, - r->master_down_interval * CS2MS, - &r->t_master_down_timer); + event_add_timer_msec(master, + vrrp_master_down_timer_expire, r, + r->master_down_interval * CS2MS, + &r->t_master_down_timer); } else if (r->vr->preempt_mode && pkt->hdr.priority < r->priority) { /* Discard advertisement */ @@ -1039,7 +1039,7 @@ done: memset(r->ibuf, 0x00, sizeof(r->ibuf)); if (resched) - thread_add_read(master, vrrp_read, r, r->sock_rx, &r->t_read); + event_add_read(master, vrrp_read, r, r->sock_rx, &r->t_read); } /* @@ -1487,9 +1487,9 @@ static void vrrp_adver_timer_expire(struct event *thread) vrrp_send_advertisement(r); /* Reset the Adver_Timer to Advertisement_Interval */ - thread_add_timer_msec(master, vrrp_adver_timer_expire, r, - r->vr->advertisement_interval * CS2MS, - &r->t_adver_timer); + event_add_timer_msec(master, vrrp_adver_timer_expire, r, + r->vr->advertisement_interval * CS2MS, + &r->t_adver_timer); } else { zlog_err(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM "Adver_Timer expired in state '%s'; this is a bug", @@ -1509,9 +1509,9 @@ static void vrrp_master_down_timer_expire(struct event *thread) "Master_Down_Timer expired", r->vr->vrid, family2str(r->family)); - thread_add_timer_msec(master, vrrp_adver_timer_expire, r, - r->vr->advertisement_interval * CS2MS, - &r->t_adver_timer); + event_add_timer_msec(master, vrrp_adver_timer_expire, r, + r->vr->advertisement_interval * CS2MS, + &r->t_adver_timer); vrrp_change_state(r, VRRP_STATE_MASTER); } @@ -1561,7 +1561,7 @@ static int vrrp_startup(struct vrrp_router *r) } /* Schedule listener */ - thread_add_read(master, vrrp_read, r, r->sock_rx, &r->t_read); + event_add_read(master, vrrp_read, r, r->sock_rx, &r->t_read); /* Configure effective priority */ assert(listhead(r->addrs)); @@ -1583,16 +1583,16 @@ static int vrrp_startup(struct vrrp_router *r) } if (r->priority == VRRP_PRIO_MASTER) { - thread_add_timer_msec(master, vrrp_adver_timer_expire, r, - r->vr->advertisement_interval * CS2MS, - &r->t_adver_timer); + event_add_timer_msec(master, vrrp_adver_timer_expire, r, + r->vr->advertisement_interval * CS2MS, + &r->t_adver_timer); vrrp_change_state(r, VRRP_STATE_MASTER); } else { r->master_adver_interval = r->vr->advertisement_interval; vrrp_recalculate_timers(r); - thread_add_timer_msec(master, vrrp_master_down_timer_expire, r, - r->master_down_interval * CS2MS, - &r->t_master_down_timer); + event_add_timer_msec(master, vrrp_master_down_timer_expire, r, + r->master_down_interval * CS2MS, + &r->t_master_down_timer); vrrp_change_state(r, VRRP_STATE_BACKUP); } diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index dd737dd0a5..8fb57872eb 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -3738,8 +3738,8 @@ static void vtysh_log_read(struct event *thread) const char *text; ssize_t ret; - thread_add_read(master, vtysh_log_read, vclient, vclient->log_fd, - &vclient->log_reader); + event_add_read(master, vtysh_log_read, vclient, vclient->log_fd, + &vclient->log_reader); ret = recv(vclient->log_fd, &buf, sizeof(buf), 0); @@ -3835,9 +3835,9 @@ DEFPY (vtysh_terminal_monitor, if (fd != -1) { set_nonblocking(fd); vclient->log_fd = fd; - thread_add_read(master, vtysh_log_read, vclient, - vclient->log_fd, - &vclient->log_reader); + event_add_read(master, vtysh_log_read, vclient, + vclient->log_fd, + &vclient->log_reader); } if (ret != CMD_SUCCESS) { vty_out(vty, "%% failed to enable logs on %s\n", diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 8019555493..a1463c1296 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -218,8 +218,8 @@ static struct event *vtysh_rl_read_thread; static void vtysh_rl_read(struct event *thread) { - thread_add_read(master, vtysh_rl_read, NULL, STDIN_FILENO, - &vtysh_rl_read_thread); + event_add_read(master, vtysh_rl_read, NULL, STDIN_FILENO, + &vtysh_rl_read_thread); rl_callback_read_char(); } @@ -231,8 +231,8 @@ static void vtysh_rl_run(void) master = thread_master_create(NULL); rl_callback_handler_install(vtysh_prompt(), vtysh_rl_callback); - thread_add_read(master, vtysh_rl_read, NULL, STDIN_FILENO, - &vtysh_rl_read_thread); + event_add_read(master, vtysh_rl_read, NULL, STDIN_FILENO, + &vtysh_rl_read_thread); while (!vtysh_loop_exited && thread_fetch(master, &thread)) thread_call(&thread); diff --git a/watchfrr/watchfrr.c b/watchfrr/watchfrr.c index 4ded379efb..b3852f86bc 100644 --- a/watchfrr/watchfrr.c +++ b/watchfrr/watchfrr.c @@ -358,8 +358,8 @@ static void restart_kill(struct event *t_kill) zlog_err( "%s %s child process appears to still be reading configuration, delaying for another %lu time", restart->what, restart->name, gs.restart_timeout); - thread_add_timer(master, restart_kill, restart, - gs.restart_timeout, &restart->t_kill); + event_add_timer(master, restart_kill, restart, + gs.restart_timeout, &restart->t_kill); return; } @@ -369,8 +369,8 @@ static void restart_kill(struct event *t_kill) (long)delay.tv_sec, (restart->kills ? SIGKILL : SIGTERM)); kill(-restart->pid, (restart->kills ? SIGKILL : SIGTERM)); restart->kills++; - thread_add_timer(master, restart_kill, restart, gs.restart_timeout, - &restart->t_kill); + event_add_timer(master, restart_kill, restart, gs.restart_timeout, + &restart->t_kill); } static struct restart_info *find_child(pid_t child) @@ -505,8 +505,8 @@ static int run_job(struct restart_info *restart, const char *cmdtype, snprintf(cmd, sizeof(cmd), command, restart->name); #pragma GCC diagnostic pop if ((restart->pid = run_background(cmd)) > 0) { - thread_add_timer(master, restart_kill, restart, - gs.restart_timeout, &restart->t_kill); + event_add_timer(master, restart_kill, restart, + gs.restart_timeout, &restart->t_kill); restart->what = cmdtype; gs.numpids++; } else @@ -529,29 +529,29 @@ static int run_job(struct restart_info *restart, const char *cmdtype, #define SET_READ_HANDLER(DMN) \ do { \ (DMN)->t_read = NULL; \ - thread_add_read(master, handle_read, (DMN), (DMN)->fd, \ - &(DMN)->t_read); \ + event_add_read(master, handle_read, (DMN), (DMN)->fd, \ + &(DMN)->t_read); \ } while (0); #define SET_WAKEUP_DOWN(DMN) \ do { \ (DMN)->t_wakeup = NULL; \ - thread_add_timer_msec(master, wakeup_down, (DMN), \ - FUZZY(gs.period), &(DMN)->t_wakeup); \ + event_add_timer_msec(master, wakeup_down, (DMN), \ + FUZZY(gs.period), &(DMN)->t_wakeup); \ } while (0); #define SET_WAKEUP_UNRESPONSIVE(DMN) \ do { \ (DMN)->t_wakeup = NULL; \ - thread_add_timer_msec(master, wakeup_unresponsive, (DMN), \ - FUZZY(gs.period), &(DMN)->t_wakeup); \ + event_add_timer_msec(master, wakeup_unresponsive, (DMN), \ + FUZZY(gs.period), &(DMN)->t_wakeup); \ } while (0); #define SET_WAKEUP_ECHO(DMN) \ do { \ (DMN)->t_wakeup = NULL; \ - thread_add_timer_msec(master, wakeup_send_echo, (DMN), \ - FUZZY(gs.period), &(DMN)->t_wakeup); \ + event_add_timer_msec(master, wakeup_send_echo, (DMN), \ + FUZZY(gs.period), &(DMN)->t_wakeup); \ } while (0); static void wakeup_down(struct event *t_wakeup) @@ -742,8 +742,8 @@ static void daemon_up(struct daemon *dmn, const char *why) THREAD_OFF(gs.t_operational); - thread_add_timer(master, daemon_restarting_operational, NULL, - gs.operational_timeout, &gs.t_operational); + event_add_timer(master, daemon_restarting_operational, NULL, + gs.operational_timeout, &gs.t_operational); } SET_WAKEUP_ECHO(dmn); @@ -848,10 +848,10 @@ static int try_connect(struct daemon *dmn) zlog_debug("%s: connection in progress", dmn->name); dmn->state = DAEMON_CONNECTING; dmn->fd = sock; - thread_add_write(master, check_connect, dmn, dmn->fd, - &dmn->t_write); - thread_add_timer(master, wakeup_connect_hanging, dmn, - gs.timeout, &dmn->t_wakeup); + event_add_write(master, check_connect, dmn, dmn->fd, + &dmn->t_write); + event_add_timer(master, wakeup_connect_hanging, dmn, gs.timeout, + &dmn->t_wakeup); SET_READ_HANDLER(dmn); return 0; } @@ -876,8 +876,8 @@ static void set_phase(enum restart_phase new_phase) gs.phase = new_phase; thread_cancel(&gs.t_phase_hanging); - thread_add_timer(master, phase_hanging, NULL, PHASE_TIMEOUT, - &gs.t_phase_hanging); + event_add_timer(master, phase_hanging, NULL, PHASE_TIMEOUT, + &gs.t_phase_hanging); } static void phase_check(void) @@ -1031,8 +1031,8 @@ static void wakeup_send_echo(struct event *t_wakeup) daemon_down(dmn, why); } else { gettimeofday(&dmn->echo_sent, NULL); - thread_add_timer(master, wakeup_no_answer, dmn, gs.timeout, - &dmn->t_wakeup); + event_add_timer(master, wakeup_no_answer, dmn, gs.timeout, + &dmn->t_wakeup); } } @@ -1282,8 +1282,8 @@ static void watchfrr_init(int argc, char **argv) struct daemon *dmn, **add = &gs.daemons; char alldaemons[512] = "", *p = alldaemons; - thread_add_timer_msec(master, startup_timeout, NULL, STARTUP_TIMEOUT, - &gs.t_startup_timeout); + event_add_timer_msec(master, startup_timeout, NULL, STARTUP_TIMEOUT, + &gs.t_startup_timeout); for (i = optind; i < argc; i++) { dmn = XCALLOC(MTYPE_WATCHFRR_DAEMON, sizeof(*dmn)); @@ -1293,8 +1293,8 @@ static void watchfrr_init(int argc, char **argv) gs.numdaemons++; gs.numdown++; dmn->fd = -1; - thread_add_timer_msec(master, wakeup_init, dmn, 0, - &dmn->t_wakeup); + event_add_timer_msec(master, wakeup_init, dmn, 0, + &dmn->t_wakeup); dmn->restart.interval = gs.min_restart_interval; *add = dmn; add = &dmn->next; diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 697c448b88..1cfcac8589 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -156,12 +156,12 @@ enum fpm_nl_events { }; #define FPM_RECONNECT(fnc) \ - thread_add_event((fnc)->fthread->master, fpm_process_event, (fnc), \ - FNE_INTERNAL_RECONNECT, &(fnc)->t_event) + event_add_event((fnc)->fthread->master, fpm_process_event, (fnc), \ + FNE_INTERNAL_RECONNECT, &(fnc)->t_event) #define WALK_FINISH(fnc, ev) \ - thread_add_event((fnc)->fthread->master, fpm_process_event, (fnc), \ - (ev), NULL) + event_add_event((fnc)->fthread->master, fpm_process_event, (fnc), \ + (ev), NULL) /* * Prototypes. @@ -231,8 +231,8 @@ DEFUN(fpm_set_address, fpm_set_address_cmd, memcpy(&sin6->sin6_addr, naddr, sizeof(sin6->sin6_addr)); ask_reconnect: - thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, - FNE_RECONNECT, &gfnc->t_event); + event_add_event(gfnc->fthread->master, fpm_process_event, gfnc, + FNE_RECONNECT, &gfnc->t_event); return CMD_SUCCESS; } @@ -246,8 +246,8 @@ DEFUN(no_fpm_set_address, no_fpm_set_address_cmd, "FPM remote listening server port\n" "Remote FPM server port\n") { - thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, - FNE_DISABLE, &gfnc->t_event); + event_add_event(gfnc->fthread->master, fpm_process_event, gfnc, + FNE_DISABLE, &gfnc->t_event); return CMD_SUCCESS; } @@ -260,8 +260,8 @@ DEFUN(fpm_use_nhg, fpm_use_nhg_cmd, if (gfnc->use_nhg) return CMD_SUCCESS; - thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, - FNE_TOGGLE_NHG, &gfnc->t_nhg); + event_add_event(gfnc->fthread->master, fpm_process_event, gfnc, + FNE_TOGGLE_NHG, &gfnc->t_nhg); return CMD_SUCCESS; } @@ -276,8 +276,8 @@ DEFUN(no_fpm_use_nhg, no_fpm_use_nhg_cmd, if (!gfnc->use_nhg) return CMD_SUCCESS; - thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, - FNE_TOGGLE_NHG, &gfnc->t_nhg); + event_add_event(gfnc->fthread->master, fpm_process_event, gfnc, + FNE_TOGGLE_NHG, &gfnc->t_nhg); return CMD_SUCCESS; } @@ -288,8 +288,8 @@ DEFUN(fpm_reset_counters, fpm_reset_counters_cmd, FPM_STR "FPM statistic counters\n") { - thread_add_event(gfnc->fthread->master, fpm_process_event, gfnc, - FNE_RESET_COUNTERS, &gfnc->t_event); + event_add_event(gfnc->fthread->master, fpm_process_event, gfnc, + FNE_RESET_COUNTERS, &gfnc->t_event); return CMD_SUCCESS; } @@ -444,8 +444,8 @@ static void fpm_reconnect(struct fpm_nl_ctx *fnc) if (fnc->disabled) return; - thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, - &fnc->t_connect); + event_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, + &fnc->t_connect); } static void fpm_read(struct event *t) @@ -482,8 +482,8 @@ static void fpm_read(struct event *t) } /* Schedule the next read */ - thread_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, - &fnc->t_read); + event_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, + &fnc->t_read); /* We've got an interruption. */ if (rv == -2) @@ -646,12 +646,12 @@ static void fpm_write(struct event *t) * Starting with LSPs walk all FPM objects, marking them * as unsent and then replaying them. */ - thread_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0, - &fnc->t_lspreset); + event_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0, + &fnc->t_lspreset); /* Permit receiving messages now. */ - thread_add_read(fnc->fthread->master, fpm_read, fnc, - fnc->socket, &fnc->t_read); + event_add_read(fnc->fthread->master, fpm_read, fnc, fnc->socket, + &fnc->t_read); } frr_mutex_lock_autounlock(&fnc->obuf_mutex); @@ -708,8 +708,8 @@ static void fpm_write(struct event *t) /* Stream is not empty yet, we must schedule more writes. */ if (STREAM_READABLE(fnc->obuf)) { stream_pulldown(fnc->obuf); - thread_add_write(fnc->fthread->master, fpm_write, fnc, - fnc->socket, &fnc->t_write); + event_add_write(fnc->fthread->master, fpm_write, fnc, + fnc->socket, &fnc->t_write); return; } } @@ -727,8 +727,8 @@ static void fpm_connect(struct event *t) if (sock == -1) { zlog_err("%s: fpm socket failed: %s", __func__, strerror(errno)); - thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, - &fnc->t_connect); + event_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, + &fnc->t_connect); return; } @@ -753,18 +753,18 @@ static void fpm_connect(struct event *t) close(sock); zlog_warn("%s: fpm connection failed: %s", __func__, strerror(errno)); - thread_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, - &fnc->t_connect); + event_add_timer(fnc->fthread->master, fpm_connect, fnc, 3, + &fnc->t_connect); return; } fnc->connecting = (errno == EINPROGRESS); fnc->socket = sock; if (!fnc->connecting) - thread_add_read(fnc->fthread->master, fpm_read, fnc, sock, - &fnc->t_read); - thread_add_write(fnc->fthread->master, fpm_write, fnc, sock, - &fnc->t_write); + event_add_read(fnc->fthread->master, fpm_read, fnc, sock, + &fnc->t_read); + event_add_write(fnc->fthread->master, fpm_write, fnc, sock, + &fnc->t_write); /* * Starting with LSPs walk all FPM objects, marking them @@ -773,8 +773,8 @@ static void fpm_connect(struct event *t) * If we are not connected, then delay the objects reset/send. */ if (!fnc->connecting) - thread_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0, - &fnc->t_lspreset); + event_add_timer(zrouter.master, fpm_lsp_reset, fnc, 0, + &fnc->t_lspreset); } /** @@ -983,8 +983,8 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx) memory_order_relaxed); /* Tell the thread to start writing. */ - thread_add_write(fnc->fthread->master, fpm_write, fnc, fnc->socket, - &fnc->t_write); + event_add_write(fnc->fthread->master, fpm_write, fnc, fnc->socket, + &fnc->t_write); return 0; } @@ -1038,12 +1038,12 @@ static void fpm_lsp_send(struct event *t) WALK_FINISH(fnc, FNE_LSP_FINISHED); /* Now move onto routes */ - thread_add_timer(zrouter.master, fpm_nhg_reset, fnc, 0, - &fnc->t_nhgreset); + event_add_timer(zrouter.master, fpm_nhg_reset, fnc, 0, + &fnc->t_nhgreset); } else { /* Didn't finish - reschedule LSP walk */ - thread_add_timer(zrouter.master, fpm_lsp_send, fnc, 0, - &fnc->t_lspwalk); + event_add_timer(zrouter.master, fpm_lsp_send, fnc, 0, + &fnc->t_lspwalk); } } @@ -1099,11 +1099,11 @@ static void fpm_nhg_send(struct event *t) /* We are done sending next hops, lets install the routes now. */ if (fna.complete) { WALK_FINISH(fnc, FNE_NHG_FINISHED); - thread_add_timer(zrouter.master, fpm_rib_reset, fnc, 0, - &fnc->t_ribreset); + event_add_timer(zrouter.master, fpm_rib_reset, fnc, 0, + &fnc->t_ribreset); } else /* Otherwise reschedule next hop group again. */ - thread_add_timer(zrouter.master, fpm_nhg_send, fnc, 0, - &fnc->t_nhgwalk); + event_add_timer(zrouter.master, fpm_nhg_send, fnc, 0, + &fnc->t_nhgwalk); } /** @@ -1141,8 +1141,8 @@ static void fpm_rib_send(struct event *t) /* Free the temporary allocated context. */ dplane_ctx_fini(&ctx); - thread_add_timer(zrouter.master, fpm_rib_send, - fnc, 1, &fnc->t_ribwalk); + event_add_timer(zrouter.master, fpm_rib_send, + fnc, 1, &fnc->t_ribwalk); return; } @@ -1158,8 +1158,8 @@ static void fpm_rib_send(struct event *t) WALK_FINISH(fnc, FNE_RIB_FINISHED); /* Schedule next event: RMAC reset. */ - thread_add_event(zrouter.master, fpm_rmac_reset, fnc, 0, - &fnc->t_rmacreset); + event_add_event(zrouter.master, fpm_rmac_reset, fnc, 0, + &fnc->t_rmacreset); } /* @@ -1199,8 +1199,8 @@ static void fpm_enqueue_rmac_table(struct hash_bucket *bucket, void *arg) zrmac->fwd_info.r_vtep_ip, sticky, 0 /*nhg*/, 0 /*update_flags*/); if (fpm_nl_enqueue(fra->fnc, fra->ctx) == -1) { - thread_add_timer(zrouter.master, fpm_rmac_send, - fra->fnc, 1, &fra->fnc->t_rmacwalk); + event_add_timer(zrouter.master, fpm_rmac_send, fra->fnc, 1, + &fra->fnc->t_rmacwalk); fra->complete = false; } } @@ -1247,7 +1247,7 @@ static void fpm_nhg_reset(struct event *t) hash_iterate(zrouter.nhgs_id, fpm_nhg_reset_cb, NULL); /* Schedule next step: send next hop groups. */ - thread_add_event(zrouter.master, fpm_nhg_send, fnc, 0, &fnc->t_nhgwalk); + event_add_event(zrouter.master, fpm_nhg_send, fnc, 0, &fnc->t_nhgwalk); } /* @@ -1268,7 +1268,7 @@ static void fpm_lsp_reset(struct event *t) hash_iterate(zvrf->lsp_table, fpm_lsp_reset_cb, NULL); /* Schedule next step: send LSPs */ - thread_add_event(zrouter.master, fpm_lsp_send, fnc, 0, &fnc->t_lspwalk); + event_add_event(zrouter.master, fpm_lsp_send, fnc, 0, &fnc->t_lspwalk); } /** @@ -1295,7 +1295,7 @@ static void fpm_rib_reset(struct event *t) } /* Schedule next step: send RIB routes. */ - thread_add_event(zrouter.master, fpm_rib_send, fnc, 0, &fnc->t_ribwalk); + event_add_event(zrouter.master, fpm_rib_send, fnc, 0, &fnc->t_ribwalk); } /* @@ -1322,8 +1322,8 @@ static void fpm_rmac_reset(struct event *t) hash_iterate(zrouter.l3vni_table, fpm_unset_l3vni_table, NULL); /* Schedule next event: send RMAC entries. */ - thread_add_event(zrouter.master, fpm_rmac_send, fnc, 0, - &fnc->t_rmacwalk); + event_add_event(zrouter.master, fpm_rmac_send, fnc, 0, + &fnc->t_rmacwalk); } static void fpm_process_queue(struct event *t) @@ -1371,8 +1371,8 @@ static void fpm_process_queue(struct event *t) /* Re-schedule if we ran out of buffer space */ if (no_bufs) - thread_add_timer(fnc->fthread->master, fpm_process_queue, - fnc, 0, &fnc->t_dequeue); + event_add_timer(fnc->fthread->master, fpm_process_queue, fnc, 0, + &fnc->t_dequeue); /* * Let the dataplane thread know if there are items in the @@ -1575,8 +1575,8 @@ static int fpm_nl_process(struct zebra_dplane_provider *prov) if (atomic_load_explicit(&fnc->counters.ctxqueue_len, memory_order_relaxed) > 0) - thread_add_timer(fnc->fthread->master, fpm_process_queue, - fnc, 0, &fnc->t_dequeue); + event_add_timer(fnc->fthread->master, fpm_process_queue, fnc, 0, + &fnc->t_dequeue); /* Ensure dataplane thread is rescheduled if we hit the work limit */ if (counter >= limit) diff --git a/zebra/interface.c b/zebra/interface.c index fdc538bf0f..8e4d15aa84 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -96,8 +96,8 @@ static void if_zebra_speed_update(struct event *thread) return; zif->speed_update_count++; - thread_add_timer(zrouter.master, if_zebra_speed_update, ifp, - SPEED_UPDATE_SLEEP_TIME, &zif->speed_update); + event_add_timer(zrouter.master, if_zebra_speed_update, ifp, + SPEED_UPDATE_SLEEP_TIME, &zif->speed_update); thread_ignore_late_timer(zif->speed_update); } } @@ -161,8 +161,8 @@ static int if_zebra_new_hook(struct interface *ifp) * down upon startup. */ zebra_if->speed_update_count = 0; - thread_add_timer(zrouter.master, if_zebra_speed_update, ifp, 15, - &zebra_if->speed_update); + event_add_timer(zrouter.master, if_zebra_speed_update, ifp, 15, + &zebra_if->speed_update); thread_ignore_late_timer(zebra_if->speed_update); return 0; @@ -1038,8 +1038,8 @@ void if_up(struct interface *ifp, bool install_connected) if (zif->flags & ZIF_FLAG_EVPN_MH_UPLINK) zebra_evpn_mh_uplink_oper_update(zif); - thread_add_timer(zrouter.master, if_zebra_speed_update, ifp, 0, - &zif->speed_update); + event_add_timer(zrouter.master, if_zebra_speed_update, ifp, 0, + &zif->speed_update); thread_ignore_late_timer(zif->speed_update); } diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 28d6b89ed4..ca46a4bf8a 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -272,8 +272,8 @@ static void irdp_if_start(struct interface *ifp, int multicast, timer); irdp->t_advertise = NULL; - thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer, - &irdp->t_advertise); + event_add_timer(zrouter.master, irdp_send_thread, ifp, timer, + &irdp->t_advertise); } static void irdp_if_stop(struct interface *ifp) diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 4d9aad5cee..2d90afaeda 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -97,7 +97,7 @@ int irdp_sock_init(void) return ret; }; - thread_add_read(zrouter.master, irdp_read_raw, NULL, sock, &t_irdp_raw); + event_add_read(zrouter.master, irdp_read_raw, NULL, sock, &t_irdp_raw); return sock; } @@ -229,8 +229,8 @@ void irdp_send_thread(struct event *t_advert) timer); irdp->t_advertise = NULL; - thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer, - &irdp->t_advertise); + event_add_timer(zrouter.master, irdp_send_thread, ifp, timer, + &irdp->t_advertise); } void irdp_advert_off(struct interface *ifp) @@ -285,8 +285,8 @@ void process_solicit(struct interface *ifp) timer = (frr_weak_random() % MAX_RESPONSE_DELAY) + 1; irdp->t_advertise = NULL; - thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer, - &irdp->t_advertise); + event_add_timer(zrouter.master, irdp_send_thread, ifp, timer, + &irdp->t_advertise); } static int irdp_finish(void) diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index aee59a78fc..e821d375ef 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -218,8 +218,8 @@ void irdp_read_raw(struct event *r) int ret, ifindex = 0; int irdp_sock = THREAD_FD(r); - thread_add_read(zrouter.master, irdp_read_raw, NULL, irdp_sock, - &t_irdp_raw); + event_add_read(zrouter.master, irdp_read_raw, NULL, irdp_sock, + &t_irdp_raw); ret = irdp_recvmsg(irdp_sock, (uint8_t *)buf, IRDP_RX_BUF, &ifindex); diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index a779533e34..4bdf268c41 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -493,8 +493,8 @@ static void kernel_read(struct event *thread) netlink_parse_info(netlink_information_fetch, &zns->netlink, &dp_info, 5, false); - thread_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock, - &zns->t_netlink); + event_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock, + &zns->t_netlink); } /* @@ -1939,8 +1939,8 @@ void kernel_init(struct zebra_ns *zns) zns->t_netlink = NULL; - thread_add_read(zrouter.master, kernel_read, zns, - zns->netlink.sock, &zns->t_netlink); + event_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock, + &zns->t_netlink); rt_netlink_init(); } diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 8f00297b66..6a32f523d7 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -1338,8 +1338,8 @@ static void kernel_read(struct event *thread) * shortage and is not harmful for consistency of * reading the routing socket. Ignore it. */ - thread_add_read(zrouter.master, kernel_read, NULL, sock, - NULL); + event_add_read(zrouter.master, kernel_read, NULL, sock, + NULL); return; #else flog_err(EC_ZEBRA_RECVMSG_OVERRUN, @@ -1362,7 +1362,7 @@ static void kernel_read(struct event *thread) if (nbytes == 0) return; - thread_add_read(zrouter.master, kernel_read, NULL, sock, NULL); + event_add_read(zrouter.master, kernel_read, NULL, sock, NULL); if (IS_ZEBRA_DEBUG_KERNEL) rtmsg_debug(&buf.r.rtm); @@ -1465,7 +1465,7 @@ static void routing_socket(struct zebra_ns *zns) } /* kernel_read needs rewrite. */ - thread_add_read(zrouter.master, kernel_read, NULL, routing_sock, NULL); + event_add_read(zrouter.master, kernel_read, NULL, routing_sock, NULL); } /* Exported interface function. This function simply calls diff --git a/zebra/main.c b/zebra/main.c index 25480f41d4..d3447a8cae 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -435,8 +435,8 @@ int main(int argc, char **argv) * we have to have route_read() called before. */ zrouter.startup_time = monotime(NULL); - thread_add_timer(zrouter.master, rib_sweep_route, NULL, - graceful_restart, &zrouter.sweeper); + event_add_timer(zrouter.master, rib_sweep_route, NULL, graceful_restart, + &zrouter.sweeper); /* Needed for BSD routing socket. */ pid = getpid(); diff --git a/zebra/rtadv.c b/zebra/rtadv.c index c1c4e1f2a6..4fece96f62 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -2800,26 +2800,26 @@ static void rtadv_event(struct zebra_vrf *zvrf, enum rtadv_event event, int val) switch (event) { case RTADV_START: - thread_add_read(zrouter.master, rtadv_read, zvrf, rtadv->sock, - &rtadv->ra_read); - thread_add_event(zrouter.master, rtadv_timer, zvrf, 0, - &rtadv->ra_timer); + event_add_read(zrouter.master, rtadv_read, zvrf, rtadv->sock, + &rtadv->ra_read); + event_add_event(zrouter.master, rtadv_timer, zvrf, 0, + &rtadv->ra_timer); break; case RTADV_STOP: THREAD_OFF(rtadv->ra_timer); THREAD_OFF(rtadv->ra_read); break; case RTADV_TIMER: - thread_add_timer(zrouter.master, rtadv_timer, zvrf, val, - &rtadv->ra_timer); + event_add_timer(zrouter.master, rtadv_timer, zvrf, val, + &rtadv->ra_timer); break; case RTADV_TIMER_MSEC: - thread_add_timer_msec(zrouter.master, rtadv_timer, zvrf, val, - &rtadv->ra_timer); + event_add_timer_msec(zrouter.master, rtadv_timer, zvrf, val, + &rtadv->ra_timer); break; case RTADV_READ: - thread_add_read(zrouter.master, rtadv_read, zvrf, rtadv->sock, - &rtadv->ra_read); + event_add_read(zrouter.master, rtadv_read, zvrf, rtadv->sock, + &rtadv->ra_read); break; default: break; diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 4b38a4b859..adfabd0b09 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -5780,8 +5780,8 @@ static void dplane_incoming_read(struct event *event) kernel_dplane_read(&zi->info); /* Re-start read task */ - thread_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, - zi->info.sock, &zi->t_read); + event_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, + zi->info.sock, &zi->t_read); } /* @@ -5793,8 +5793,8 @@ static void dplane_incoming_request(struct event *event) struct dplane_zns_info *zi = THREAD_ARG(event); /* Start read task */ - thread_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, - zi->info.sock, &zi->t_read); + event_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, + zi->info.sock, &zi->t_read); /* Send requests */ netlink_request_netconf(zi->info.sock); @@ -5812,9 +5812,8 @@ static void dplane_kernel_info_request(struct dplane_zns_info *zi) * pthread is running, we'll initiate this later on. */ if (zdplane_info.dg_master) - thread_add_event(zdplane_info.dg_master, - dplane_incoming_request, zi, 0, - &zi->t_request); + event_add_event(zdplane_info.dg_master, dplane_incoming_request, + zi, 0, &zi->t_request); } #endif /* HAVE_NETLINK */ @@ -5898,9 +5897,8 @@ int dplane_provider_work_ready(void) * available. */ if (zdplane_info.dg_run) { - thread_add_event(zdplane_info.dg_master, - dplane_thread_loop, NULL, 0, - &zdplane_info.dg_t_update); + event_add_event(zdplane_info.dg_master, dplane_thread_loop, + NULL, 0, &zdplane_info.dg_t_update); } return AOK; @@ -6618,10 +6616,9 @@ static void dplane_check_shutdown_status(struct event *event) if (dplane_work_pending()) { /* Reschedule dplane check on a short timer */ - thread_add_timer_msec(zdplane_info.dg_master, - dplane_check_shutdown_status, - NULL, 100, - &zdplane_info.dg_t_shutdown_check); + event_add_timer_msec(zdplane_info.dg_master, + dplane_check_shutdown_status, NULL, 100, + &zdplane_info.dg_t_shutdown_check); /* TODO - give up and stop waiting after a short time? */ @@ -6629,7 +6626,7 @@ static void dplane_check_shutdown_status(struct event *event) /* We appear to be done - schedule a final callback event * for the zebra main pthread. */ - thread_add_event(zrouter.master, zebra_finalize, NULL, 0, NULL); + event_add_event(zrouter.master, zebra_finalize, NULL, 0, NULL); } } @@ -6648,9 +6645,8 @@ void zebra_dplane_finish(void) if (IS_ZEBRA_DEBUG_DPLANE) zlog_debug("Zebra dataplane fini called"); - thread_add_event(zdplane_info.dg_master, - dplane_check_shutdown_status, NULL, 0, - &zdplane_info.dg_t_shutdown_check); + event_add_event(zdplane_info.dg_master, dplane_check_shutdown_status, + NULL, 0, &zdplane_info.dg_t_shutdown_check); } /* @@ -6929,14 +6925,14 @@ void zebra_dplane_start(void) zdplane_info.dg_run = true; /* Enqueue an initial event for the dataplane pthread */ - thread_add_event(zdplane_info.dg_master, dplane_thread_loop, NULL, 0, - &zdplane_info.dg_t_update); + event_add_event(zdplane_info.dg_master, dplane_thread_loop, NULL, 0, + &zdplane_info.dg_t_update); /* Enqueue requests and reads if necessary */ frr_each (zns_info_list, &zdplane_info.dg_zns_list, zi) { #if defined(HAVE_NETLINK) - thread_add_read(zdplane_info.dg_master, dplane_incoming_read, - zi, zi->info.sock, &zi->t_read); + event_add_read(zdplane_info.dg_master, dplane_incoming_read, zi, + zi->info.sock, &zi->t_read); dplane_kernel_info_request(zi); #endif } diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 2c55a54c70..c12bfe5bc0 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -588,10 +588,10 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, zvrf->dad_freeze_time); } - thread_add_timer(zrouter.master, - zebra_evpn_dad_mac_auto_recovery_exp, - mac, zvrf->dad_freeze_time, - &mac->dad_mac_auto_recovery_timer); + event_add_timer(zrouter.master, + zebra_evpn_dad_mac_auto_recovery_exp, + mac, zvrf->dad_freeze_time, + &mac->dad_mac_auto_recovery_timer); } /* In case of local update, do not inform to client (BGPd), @@ -1561,8 +1561,8 @@ static inline void zebra_evpn_mac_start_hold_timer(struct zebra_mac *mac) zebra_evpn_zebra_mac_flag_dump(mac, mac_buf, sizeof(mac_buf))); } - thread_add_timer(zrouter.master, zebra_evpn_mac_hold_exp_cb, mac, - zmh_info->mac_hold_time, &mac->hold_timer); + event_add_timer(zrouter.master, zebra_evpn_mac_hold_exp_cb, mac, + zmh_info->mac_hold_time, &mac->hold_timer); } void zebra_evpn_mac_stop_hold_timer(struct zebra_mac *mac) diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 85a96fe4f5..c5d5046dfc 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -2269,9 +2269,9 @@ static void zebra_evpn_es_local_info_set(struct zebra_evpn_es *es, /* Start the DF delay timer on the local ES */ if (!es->df_delay_timer) - thread_add_timer(zrouter.master, zebra_evpn_es_df_delay_exp_cb, - es, ZEBRA_EVPN_MH_DF_DELAY_TIME, - &es->df_delay_timer); + event_add_timer(zrouter.master, zebra_evpn_es_df_delay_exp_cb, + es, ZEBRA_EVPN_MH_DF_DELAY_TIME, + &es->df_delay_timer); /* See if the local VTEP can function as DF on the ES */ if (!zebra_evpn_es_run_df_election(es, __func__)) { @@ -3939,10 +3939,10 @@ static void zebra_evpn_mh_startup_delay_timer_start(const char *rc) zlog_debug( "startup-delay timer started for %d sec on %s", zmh_info->startup_delay_time, rc); - thread_add_timer(zrouter.master, - zebra_evpn_mh_startup_delay_exp_cb, NULL, - zmh_info->startup_delay_time, - &zmh_info->startup_delay_timer); + event_add_timer(zrouter.master, + zebra_evpn_mh_startup_delay_exp_cb, NULL, + zmh_info->startup_delay_time, + &zmh_info->startup_delay_timer); zebra_evpn_mh_update_protodown( ZEBRA_PROTODOWN_EVPN_STARTUP_DELAY, true /* set */); } else { diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index b27ddb5e61..11ceae4b5d 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -444,8 +444,8 @@ static inline void zebra_evpn_neigh_start_hold_timer(struct zebra_neigh *n) if (IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) zlog_debug("sync-neigh vni %u ip %pIA mac %pEA 0x%x hold start", n->zevpn->vni, &n->ip, &n->emac, n->flags); - thread_add_timer(zrouter.master, zebra_evpn_neigh_hold_exp_cb, n, - zmh_info->neigh_hold_time, &n->hold_timer); + event_add_timer(zrouter.master, zebra_evpn_neigh_hold_exp_cb, n, + zmh_info->neigh_hold_time, &n->hold_timer); } static void zebra_evpn_local_neigh_deref_mac(struct zebra_neigh *n, @@ -1231,10 +1231,10 @@ static void zebra_evpn_dup_addr_detect_for_neigh( __func__, &nbr->emac, &nbr->ip, nbr->flags, zvrf->dad_freeze_time); - thread_add_timer(zrouter.master, - zebra_evpn_dad_ip_auto_recovery_exp, - nbr, zvrf->dad_freeze_time, - &nbr->dad_ip_auto_recovery_timer); + event_add_timer(zrouter.master, + zebra_evpn_dad_ip_auto_recovery_exp, + nbr, zvrf->dad_freeze_time, + &nbr->dad_ip_auto_recovery_timer); } if (zvrf->dad_freeze) *is_dup_detect = true; diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 0795d12263..a97873c384 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -460,8 +460,8 @@ static inline void zfpm_read_on(void) assert(!zfpm_g->t_read); assert(zfpm_g->sock >= 0); - thread_add_read(zfpm_g->master, zfpm_read_cb, 0, zfpm_g->sock, - &zfpm_g->t_read); + event_add_read(zfpm_g->master, zfpm_read_cb, 0, zfpm_g->sock, + &zfpm_g->t_read); } /* @@ -472,8 +472,8 @@ static inline void zfpm_write_on(void) assert(!zfpm_g->t_write); assert(zfpm_g->sock >= 0); - thread_add_write(zfpm_g->master, zfpm_write_cb, 0, zfpm_g->sock, - &zfpm_g->t_write); + event_add_write(zfpm_g->master, zfpm_write_cb, 0, zfpm_g->sock, + &zfpm_g->t_write); } /* @@ -542,8 +542,8 @@ static void zfpm_conn_up_thread_cb(struct event *thread) zfpm_g->stats.t_conn_up_yields++; zfpm_rnodes_iter_pause(iter); - thread_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, - NULL, 0, &zfpm_g->t_conn_up); + event_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, + NULL, 0, &zfpm_g->t_conn_up); return; } @@ -575,8 +575,8 @@ static void zfpm_connection_up(const char *detail) zfpm_debug("Starting conn_up thread"); - thread_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, NULL, 0, - &zfpm_g->t_conn_up); + event_add_timer_msec(zfpm_g->master, zfpm_conn_up_thread_cb, NULL, 0, + &zfpm_g->t_conn_up); zfpm_g->stats.t_conn_up_starts++; } @@ -668,8 +668,8 @@ static void zfpm_conn_down_thread_cb(struct event *thread) zfpm_g->stats.t_conn_down_yields++; zfpm_rnodes_iter_pause(iter); zfpm_g->t_conn_down = NULL; - thread_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, - NULL, 0, &zfpm_g->t_conn_down); + event_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, + NULL, 0, &zfpm_g->t_conn_down); return; } @@ -713,8 +713,8 @@ static void zfpm_connection_down(const char *detail) assert(!zfpm_g->t_conn_down); zfpm_rnodes_iter_init(&zfpm_g->t_conn_down_state.iter); zfpm_g->t_conn_down = NULL; - thread_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, NULL, 0, - &zfpm_g->t_conn_down); + event_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, NULL, 0, + &zfpm_g->t_conn_down); zfpm_g->stats.t_conn_down_starts++; zfpm_set_state(ZFPM_STATE_IDLE, detail); @@ -1388,8 +1388,8 @@ static void zfpm_start_connect_timer(const char *reason) delay_secs = zfpm_calc_connect_delay(); zfpm_debug("scheduling connect in %ld seconds", delay_secs); - thread_add_timer(zfpm_g->master, zfpm_connect_cb, 0, delay_secs, - &zfpm_g->t_connect); + event_add_timer(zfpm_g->master, zfpm_connect_cb, 0, delay_secs, + &zfpm_g->t_connect); zfpm_set_state(ZFPM_STATE_ACTIVE, reason); } @@ -1707,8 +1707,8 @@ void zfpm_start_stats_timer(void) { assert(!zfpm_g->t_stats); - thread_add_timer(zfpm_g->master, zfpm_stats_timer_cb, 0, - ZFPM_STATS_IVL_SECS, &zfpm_g->t_stats); + event_add_timer(zfpm_g->master, zfpm_stats_timer_cb, 0, + ZFPM_STATS_IVL_SECS, &zfpm_g->t_stats); } /* diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index 8aee7f0d73..e055eae7e1 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -159,7 +159,7 @@ int32_t zebra_gr_client_disconnect(struct zserv *client) && (info->t_stale_removal == NULL)) { struct vrf *vrf = vrf_lookup_by_id(info->vrf_id); - thread_add_timer( + event_add_timer( zrouter.master, zebra_gr_route_stale_delete_timer_expiry, info, info->stale_removal_time, @@ -482,10 +482,10 @@ static void zebra_gr_route_stale_delete_timer_expiry(struct event *thread) __func__, zebra_route_string(client->proto), VRF_LOGNAME(vrf), info->vrf_id, cnt); - thread_add_timer(zrouter.master, - zebra_gr_route_stale_delete_timer_expiry, info, - ZEBRA_DEFAULT_STALE_UPDATE_DELAY, - &info->t_stale_removal); + event_add_timer(zrouter.master, + zebra_gr_route_stale_delete_timer_expiry, info, + ZEBRA_DEFAULT_STALE_UPDATE_DELAY, + &info->t_stale_removal); } else { /* No routes to delete for the VRF */ LOG_GR("%s: Client %s vrf %s(%u) all stale routes processed", diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index ad128f8af6..18bbd2fd47 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -114,8 +114,8 @@ void zebra_mlag_process_mlag_data(uint8_t *data, uint32_t len) * additional four bytes are for message type */ stream_putl_at(s, 0, msg_type); - thread_add_event(zrouter.master, zebra_mlag_post_data_from_main_thread, - s, 0, NULL); + event_add_event(zrouter.master, zebra_mlag_post_data_from_main_thread, + s, 0, NULL); } /**********************End of MLAG Interaction********************************/ @@ -173,9 +173,9 @@ static void zebra_mlag_client_msg_handler(struct event *event) * main thread. */ if (msg_type == MLAG_DEREGISTER) { - thread_add_event(zrouter.master, - zebra_mlag_terminate_pthread, - NULL, 0, NULL); + event_add_event(zrouter.master, + zebra_mlag_terminate_pthread, + NULL, 0, NULL); } } @@ -237,9 +237,9 @@ static int zebra_mlag_signal_write_thread(void) * during Zebra Init/after MLAG thread is destroyed. * so it is safe to use without any locking */ - thread_add_event(zrouter.mlag_info.th_master, - zebra_mlag_client_msg_handler, NULL, 0, - &zrouter.mlag_info.t_write); + event_add_event(zrouter.mlag_info.th_master, + zebra_mlag_client_msg_handler, NULL, 0, + &zrouter.mlag_info.t_write); return 0; } @@ -279,8 +279,8 @@ static void zebra_mlag_publish_process_state(struct zserv *client, s = stream_new(ZEBRA_HEADER_SIZE + ZEBRA_MLAG_METADATA_LEN); stream_putl(s, ZEBRA_MLAG_MSG_BCAST); zclient_create_header(s, msg_type, VRF_DEFAULT); - thread_add_event(zrouter.master, zebra_mlag_post_data_from_main_thread, - s, 0, NULL); + event_add_event(zrouter.master, zebra_mlag_post_data_from_main_thread, + s, 0, NULL); } /**************************End of Multi-entrant Apis**************************/ diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c index ba66dc464a..727f2a9ca8 100644 --- a/zebra/zebra_mlag_private.c +++ b/zebra/zebra_mlag_private.c @@ -55,8 +55,8 @@ static int zebra_mlag_private_write_data(uint8_t *data, uint32_t len) static void zebra_mlag_sched_read(void) { - thread_add_read(zmlag_master, zebra_mlag_read, NULL, mlag_socket, - &zrouter.mlag_info.t_read); + event_add_read(zmlag_master, zebra_mlag_read, NULL, mlag_socket, + &zrouter.mlag_info.t_read); } static void zebra_mlag_read(struct event *thread) @@ -173,8 +173,8 @@ static void zebra_mlag_connect(struct event *thread) svr.sun_path); close(mlag_socket); zrouter.mlag_info.timer_running = true; - thread_add_timer(zmlag_master, zebra_mlag_connect, NULL, 10, - &zrouter.mlag_info.t_read); + event_add_timer(zmlag_master, zebra_mlag_connect, NULL, 10, + &zrouter.mlag_info.t_read); return; } @@ -184,8 +184,8 @@ static void zebra_mlag_connect(struct event *thread) zlog_debug("%s: Connection with MLAG is established ", __func__); - thread_add_read(zmlag_master, zebra_mlag_read, NULL, mlag_socket, - &zrouter.mlag_info.t_read); + event_add_read(zmlag_master, zebra_mlag_read, NULL, mlag_socket, + &zrouter.mlag_info.t_read); /* * Connection is established with MLAGD, post to clients */ @@ -197,8 +197,8 @@ static void zebra_mlag_connect(struct event *thread) */ static int zebra_mlag_private_monitor_state(void) { - thread_add_event(zmlag_master, zebra_mlag_connect, NULL, 0, - &zrouter.mlag_info.t_read); + event_add_event(zmlag_master, zebra_mlag_connect, NULL, 0, + &zrouter.mlag_info.t_read); return 0; } @@ -225,8 +225,8 @@ static int zebra_mlag_private_open_channel(void) /* * Connect only if any clients are showing interest */ - thread_add_event(zmlag_master, zebra_mlag_connect, NULL, 0, - &zrouter.mlag_info.t_read); + event_add_event(zmlag_master, zebra_mlag_connect, NULL, 0, + &zrouter.mlag_info.t_read); } return 0; } diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 205c10ce25..9ceecb5e97 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -133,9 +133,9 @@ static int zebra_ns_continue_read(struct zebra_netns_info *zns_info, XFREE(MTYPE_NETNS_MISC, zns_info); return 0; } - thread_add_timer_msec(zrouter.master, zebra_ns_ready_read, - (void *)zns_info, ZEBRA_NS_POLLING_INTERVAL_MSEC, - NULL); + event_add_timer_msec(zrouter.master, zebra_ns_ready_read, + (void *)zns_info, ZEBRA_NS_POLLING_INTERVAL_MSEC, + NULL); return 0; } @@ -288,8 +288,8 @@ static void zebra_ns_notify_read(struct event *t) ssize_t len; char event_name[NAME_MAX + 1]; - thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, - &zebra_netns_notify_current); + event_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, + &zebra_netns_notify_current); len = read(fd_monitor, buf, sizeof(buf)); if (len < 0) { flog_err_sys(EC_ZEBRA_NS_NOTIFY_READ, @@ -361,8 +361,8 @@ static void zebra_ns_notify_read(struct event *t) sizeof(struct zebra_netns_info)); netnsinfo->retries = ZEBRA_NS_POLLING_MAX_RETRIES; netnsinfo->netnspath = netnspath; - thread_add_timer_msec(zrouter.master, zebra_ns_ready_read, - (void *)netnsinfo, 0, NULL); + event_add_timer_msec(zrouter.master, zebra_ns_ready_read, + (void *)netnsinfo, 0, NULL); } } @@ -427,8 +427,8 @@ void zebra_ns_notify_init(void) "NS notify watch: failed to add watch (%s)", safe_strerror(errno)); } - thread_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, - &zebra_netns_notify_current); + event_add_read(zrouter.master, zebra_ns_notify_read, NULL, fd_monitor, + &zebra_netns_notify_current); } void zebra_ns_notify_close(void) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index f42c7a42d2..7eed209a1d 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1707,8 +1707,8 @@ void zebra_nhg_decrement_ref(struct nhg_hash_entry *nhe) !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND)) { nhe->refcnt = 1; SET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND); - thread_add_timer(zrouter.master, zebra_nhg_timer, nhe, - zrouter.nhg_keep, &nhe->timer); + event_add_timer(zrouter.master, zebra_nhg_timer, nhe, + zrouter.nhg_keep, &nhe->timer); return; } diff --git a/zebra/zebra_opaque.c b/zebra/zebra_opaque.c index 491ea45d98..b5f52089db 100644 --- a/zebra/zebra_opaque.c +++ b/zebra/zebra_opaque.c @@ -148,8 +148,8 @@ void zebra_opaque_start(void) atomic_store_explicit(&zo_info.run, 1, memory_order_relaxed); /* Enqueue an initial event for the pthread */ - thread_add_event(zo_info.master, process_messages, NULL, 0, - &zo_info.t_msgs); + event_add_event(zo_info.master, process_messages, NULL, 0, + &zo_info.t_msgs); /* And start the pthread */ frr_pthread_run(zo_info.pthread, NULL); @@ -248,8 +248,8 @@ uint32_t zebra_opaque_enqueue_batch(struct stream_fifo *batch) if (IS_ZEBRA_DEBUG_RECV && IS_ZEBRA_DEBUG_DETAIL) zlog_debug("%s: received %u messages", __func__, counter); - thread_add_event(zo_info.master, process_messages, NULL, 0, - &zo_info.t_msgs); + event_add_event(zo_info.master, process_messages, NULL, 0, + &zo_info.t_msgs); } return counter; @@ -317,8 +317,8 @@ done: if (need_resched) { atomic_fetch_add_explicit(&zo_info.yields, 1, memory_order_relaxed); - thread_add_event(zo_info.master, process_messages, NULL, 0, - &zo_info.t_msgs); + event_add_event(zo_info.master, process_messages, NULL, 0, + &zo_info.t_msgs); } /* This will also free any leftover messages, in the shutdown case */ diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 301f1c3f74..e77dcedd9e 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -169,13 +169,13 @@ static void zebra_ptm_flush_messages(struct event *thread) ptm_cb.ptm_sock = -1; zebra_ptm_reset_status(0); ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return; case BUFFER_PENDING: ptm_cb.t_write = NULL; - thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, - ptm_cb.ptm_sock, &ptm_cb.t_write); + event_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, + ptm_cb.ptm_sock, &ptm_cb.t_write); break; case BUFFER_EMPTY: break; @@ -193,15 +193,15 @@ static int zebra_ptm_send_message(char *data, int size) ptm_cb.ptm_sock = -1; zebra_ptm_reset_status(0); ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return -1; case BUFFER_EMPTY: THREAD_OFF(ptm_cb.t_write); break; case BUFFER_PENDING: - thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, - ptm_cb.ptm_sock, &ptm_cb.t_write); + event_add_write(zrouter.master, zebra_ptm_flush_messages, NULL, + ptm_cb.ptm_sock, &ptm_cb.t_write); break; } @@ -220,8 +220,8 @@ void zebra_ptm_connect(struct event *t) if (ptm_cb.ptm_sock != -1) { if (init) { ptm_cb.t_read = NULL; - thread_add_read(zrouter.master, zebra_ptm_sock_read, - NULL, ptm_cb.ptm_sock, &ptm_cb.t_read); + event_add_read(zrouter.master, zebra_ptm_sock_read, + NULL, ptm_cb.ptm_sock, &ptm_cb.t_read); zebra_bfd_peer_replay_req(); } zebra_ptm_send_status_req(); @@ -232,8 +232,8 @@ void zebra_ptm_connect(struct event *t) ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_MAX; ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); } else if (ptm_cb.reconnect_time >= ZEBRA_PTM_RECONNECT_TIME_MAX) { ptm_cb.reconnect_time = ZEBRA_PTM_RECONNECT_TIME_INITIAL; } @@ -656,15 +656,14 @@ void zebra_ptm_sock_read(struct event *thread) ptm_cb.ptm_sock = -1; zebra_ptm_reset_status(0); ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, - &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return; } ptm_cb.t_read = NULL; - thread_add_read(zrouter.master, zebra_ptm_sock_read, NULL, - ptm_cb.ptm_sock, &ptm_cb.t_read); + event_add_read(zrouter.master, zebra_ptm_sock_read, NULL, + ptm_cb.ptm_sock, &ptm_cb.t_read); } /* BFD peer/dst register/update */ @@ -698,8 +697,8 @@ void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS) if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return; } @@ -857,8 +856,8 @@ void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS) if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return; } @@ -985,8 +984,8 @@ void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS) if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return; } @@ -1044,8 +1043,8 @@ int zebra_ptm_bfd_client_deregister(struct zserv *client) if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; - thread_add_timer(zrouter.master, zebra_ptm_connect, NULL, - ptm_cb.reconnect_time, &ptm_cb.t_timer); + event_add_timer(zrouter.master, zebra_ptm_connect, NULL, + ptm_cb.reconnect_time, &ptm_cb.t_timer); return 0; } diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 243ce30959..edcb97ddec 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -208,8 +208,8 @@ void zebra_pw_install_failure(struct zebra_pw *pw, int pwstatus) /* schedule to retry later */ THREAD_OFF(pw->install_retry_timer); - thread_add_timer(zrouter.master, zebra_pw_install_retry, pw, - PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer); + event_add_timer(zrouter.master, zebra_pw_install_retry, pw, + PW_INSTALL_RETRY_INTERVAL, &pw->install_retry_timer); zebra_pw_update_status(pw, pwstatus); } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 082afbe0f7..2864b92310 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4420,8 +4420,8 @@ void rib_update(enum rib_update_event event) ctx = rib_update_ctx_init(0, event); - thread_add_event(zrouter.master, rib_update_handler, ctx, 0, - &t_rib_update_threads[event]); + event_add_event(zrouter.master, rib_update_handler, ctx, 0, + &t_rib_update_threads[event]); if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("%s: Scheduled VRF (ALL), event %s", __func__, @@ -4793,8 +4793,8 @@ static int rib_dplane_results(struct dplane_ctx_list_head *ctxlist) } /* Ensure event is signalled to zebra main pthread */ - thread_add_event(zrouter.master, rib_process_dplane_results, NULL, 0, - &t_dplane); + event_add_event(zrouter.master, rib_process_dplane_results, NULL, 0, + &t_dplane); return 0; } diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 8558d0f963..b55d152ef5 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -1876,8 +1876,8 @@ static void zebra_route_map_mark_update(const char *rmap_name) if (zebra_rmap_update_timer) THREAD_OFF(zebra_t_rmap_update); - thread_add_timer(zrouter.master, zebra_route_map_update_timer, - NULL, zebra_rmap_update_timer, &zebra_t_rmap_update); + event_add_timer(zrouter.master, zebra_route_map_update_timer, NULL, + zebra_rmap_update_timer, &zebra_t_rmap_update); } static void zebra_route_map_add(const char *rmap_name) diff --git a/zebra/zserv.c b/zebra/zserv.c index ba05e860a9..c3ef1557b7 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -100,7 +100,7 @@ enum zserv_event { /* * Zebra server event driver for all client threads. * - * This is essentially a wrapper around thread_add_event() that centralizes + * This is essentially a wrapper around event_add_event() that centralizes * those scheduling calls into one place. * * All calls to this function schedule an event on the pthread running the @@ -118,7 +118,7 @@ static void zserv_client_event(struct zserv *client, /* * Zebra server event driver for the main thread. * - * This is essentially a wrapper around thread_add_event() that centralizes + * This is essentially a wrapper around event_add_event() that centralizes * those scheduling calls into one place. * * All calls to this function schedule an event on Zebra's main pthread. @@ -462,12 +462,12 @@ static void zserv_client_event(struct zserv *client, { switch (event) { case ZSERV_CLIENT_READ: - thread_add_read(client->pthread->master, zserv_read, client, - client->sock, &client->t_read); + event_add_read(client->pthread->master, zserv_read, client, + client->sock, &client->t_read); break; case ZSERV_CLIENT_WRITE: - thread_add_write(client->pthread->master, zserv_write, client, - client->sock, &client->t_write); + event_add_write(client->pthread->master, zserv_write, client, + client->sock, &client->t_write); break; } } @@ -831,9 +831,9 @@ void zserv_release_client(struct zserv *client) * main pthread. */ if (client->is_closed) - thread_add_event(zrouter.master, - zserv_handle_client_fail, - client, 0, &client->t_cleanup); + event_add_event(zrouter.master, + zserv_handle_client_fail, + client, 0, &client->t_cleanup); } } @@ -953,16 +953,15 @@ void zserv_event(struct zserv *client, enum zserv_event event) { switch (event) { case ZSERV_ACCEPT: - thread_add_read(zrouter.master, zserv_accept, NULL, zsock, - NULL); + event_add_read(zrouter.master, zserv_accept, NULL, zsock, NULL); break; case ZSERV_PROCESS_MESSAGES: - thread_add_event(zrouter.master, zserv_process_messages, client, - 0, &client->t_process); + event_add_event(zrouter.master, zserv_process_messages, client, + 0, &client->t_process); break; case ZSERV_HANDLE_CLIENT_FAIL: - thread_add_event(zrouter.master, zserv_handle_client_fail, - client, 0, &client->t_cleanup); + event_add_event(zrouter.master, zserv_handle_client_fail, + client, 0, &client->t_cleanup); } }