diff options
author | Jafar Al-Gharaibeh <jafar@atcorp.com> | 2023-03-24 19:48:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-24 19:48:53 +0100 |
commit | 06f54ff416e63149f5b2bd770204472f1ea31ee5 (patch) | |
tree | 661878796771e1b37f5388d8c0057b7e4c1e7c33 /pimd | |
parent | Merge pull request #13093 from manojvn/ospf_mem_leaks (diff) | |
parent | *: Fixup formatting issues due to reordering (diff) | |
download | frr-06f54ff416e63149f5b2bd770204472f1ea31ee5.tar.xz frr-06f54ff416e63149f5b2bd770204472f1ea31ee5.zip |
Merge pull request #12953 from donaldsharp/struct_event
Struct event
Diffstat (limited to 'pimd')
36 files changed, 384 insertions, 390 deletions
diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index fa699cca5..1d84a9941 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -19,7 +19,7 @@ #include "lib/jhash.h" #include "lib/prefix.h" #include "lib/checksum.h" -#include "lib/thread.h" +#include "lib/frrevent.h" #include "termtable.h" #include "pimd/pim6_mld.h" @@ -45,7 +45,7 @@ DEFINE_MTYPE_STATIC(PIMD, GM_SG, "MLD (S,G)"); DEFINE_MTYPE_STATIC(PIMD, GM_GRP_PENDING, "MLD group query state"); DEFINE_MTYPE_STATIC(PIMD, GM_GSQ_PENDING, "MLD group/source query aggregate"); -static void gm_t_query(struct thread *t); +static void gm_t_query(struct event *t); static void gm_trigger_specific(struct gm_sg *sg); static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg, struct timeval expire_wait); @@ -329,7 +329,7 @@ static void gm_expiry_calc(struct gm_query_timers *timers) static void gm_sg_free(struct gm_sg *sg) { /* t_sg_expiry is handled before this is reached */ - THREAD_OFF(sg->t_sg_query); + EVENT_OFF(sg->t_sg_query); gm_packet_sg_subs_fini(sg->subs_negative); gm_packet_sg_subs_fini(sg->subs_positive); XFREE(MTYPE_GM_SG, sg); @@ -404,7 +404,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired) gm_expiry_calc(&timers); gm_sg_timer_start(gm_ifp, sg, timers.expire_wait); - THREAD_OFF(sg->t_sg_query); + EVENT_OFF(sg->t_sg_query); sg->n_query = gm_ifp->cur_lmqc; sg->query_sbit = false; gm_trigger_specific(sg); @@ -443,7 +443,7 @@ static void gm_sg_update(struct gm_sg *sg, bool has_expired) * another path. */ if (has_expired) - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); assertf((!sg->t_sg_expire && !gm_packet_sg_subs_count(sg->subs_positive) && @@ -582,7 +582,7 @@ static void gm_sg_expiry_cancel(struct gm_sg *sg) { if (sg->t_sg_expire && PIM_DEBUG_GM_TRACE) zlog_debug(log_sg(sg, "alive, cancelling expiry timer")); - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); sg->query_sbit = true; } @@ -1029,9 +1029,9 @@ static void gm_handle_v1_leave(struct gm_if *gm_ifp, * its own path too and won't hit this. This is really only triggered when a * host straight up disappears. */ -static void gm_t_expire(struct thread *t) +static void gm_t_expire(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); struct gm_packet_state *pkt; zlog_info(log_ifp("general expiry timer")); @@ -1048,8 +1048,8 @@ static void gm_t_expire(struct thread *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; } @@ -1103,7 +1103,7 @@ static void gm_handle_q_general(struct gm_if *gm_ifp, gm_ifp->n_pending--; if (!gm_ifp->n_pending) - THREAD_OFF(gm_ifp->t_expire); + EVENT_OFF(gm_ifp->t_expire); } /* people might be messing with their configs or something */ @@ -1119,16 +1119,16 @@ 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); } -static void gm_t_sg_expire(struct thread *t) +static void gm_t_sg_expire(struct event *t) { - struct gm_sg *sg = THREAD_ARG(t); + struct gm_sg *sg = EVENT_ARG(t); struct gm_if *gm_ifp = sg->iface; struct gm_packet_sg *item; @@ -1208,15 +1208,15 @@ static void gm_sg_timer_start(struct gm_if *gm_ifp, struct gm_sg *sg, if (sg->t_sg_expire) { struct timeval remain; - remain = thread_timer_remain(sg->t_sg_expire); + remain = event_timer_remain(sg->t_sg_expire); if (timercmp(&remain, &expire_wait, <=)) return; - THREAD_OFF(sg->t_sg_expire); + EVENT_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, @@ -1232,7 +1232,7 @@ static void gm_handle_q_groupsrc(struct gm_if *gm_ifp, } } -static void gm_t_grp_expire(struct thread *t) +static void gm_t_grp_expire(struct event *t) { /* if we're here, that means when we received the group-specific query * there was one or more active S,G for this group. For *,G the timer @@ -1240,7 +1240,7 @@ static void gm_t_grp_expire(struct thread *t) * receive a report, so that work is left to gm_t_sg_expire and we * shouldn't worry about it here. */ - struct gm_grp_pending *pend = THREAD_ARG(t); + struct gm_grp_pending *pend = EVENT_ARG(t); struct gm_if *gm_ifp = pend->iface; struct gm_sg *sg, *sg_start, sg_ref = {}; @@ -1269,7 +1269,7 @@ static void gm_t_grp_expire(struct thread *t) * parallel. But if we received nothing for the *,G query, * the S,G query is kinda irrelevant. */ - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); frr_each_safe (gm_packet_sg_subs, sg->subs_positive, item) /* this will also drop the EXCLUDE S,G lists */ @@ -1316,11 +1316,11 @@ static void gm_handle_q_group(struct gm_if *gm_ifp, if (pend) { struct timeval remain; - remain = thread_timer_remain(pend->t_expire); + remain = event_timer_remain(pend->t_expire); if (timercmp(&remain, &timers->expire_wait, <=)) return; - THREAD_OFF(pend->t_expire); + EVENT_OFF(pend->t_expire); } else { pend = XCALLOC(MTYPE_GM_GRP_PENDING, sizeof(*pend)); pend->grp = grp; @@ -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, @@ -1341,7 +1341,7 @@ static void gm_bump_querier(struct gm_if *gm_ifp) { struct pim_interface *pim_ifp = gm_ifp->ifp->info; - THREAD_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_query); if (pim_addr_is_any(pim_ifp->ll_lowest)) return; @@ -1350,12 +1350,12 @@ static void gm_bump_querier(struct gm_if *gm_ifp) gm_ifp->n_startup = gm_ifp->cur_qrv; - thread_execute(router->master, gm_t_query, gm_ifp, 0); + event_execute(router->master, gm_t_query, gm_ifp, 0); } -static void gm_t_other_querier(struct thread *t) +static void gm_t_other_querier(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); struct pim_interface *pim_ifp = gm_ifp->ifp->info; zlog_info(log_ifp("other querier timer expired")); @@ -1363,7 +1363,7 @@ static void gm_t_other_querier(struct thread *t) gm_ifp->querier = pim_ifp->ll_lowest; gm_ifp->n_startup = gm_ifp->cur_qrv; - thread_execute(router->master, gm_t_query, gm_ifp, 0); + event_execute(router->master, gm_t_query, gm_ifp, 0); } static void gm_handle_query(struct gm_if *gm_ifp, @@ -1466,13 +1466,12 @@ static void gm_handle_query(struct gm_if *gm_ifp, if (IPV6_ADDR_CMP(&pkt_src->sin6_addr, &pim_ifp->ll_lowest) < 0) { unsigned int other_ms; - THREAD_OFF(gm_ifp->t_query); - THREAD_OFF(gm_ifp->t_other_querier); + EVENT_OFF(gm_ifp->t_query); + EVENT_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)) { @@ -1586,9 +1585,9 @@ static bool ip6_check_hopopts_ra(uint8_t *hopopts, size_t hopopt_len, return false; } -static void gm_t_recv(struct thread *t) +static void gm_t_recv(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); union { char buf[CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(256) /* hop options */ + @@ -1607,8 +1606,8 @@ static void gm_t_recv(struct thread *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); @@ -1858,9 +1857,9 @@ static void gm_send_query(struct gm_if *gm_ifp, pim_addr grp, } } -static void gm_t_query(struct thread *t) +static void gm_t_query(struct event *t) { - struct gm_if *gm_ifp = THREAD_ARG(t); + struct gm_if *gm_ifp = EVENT_ARG(t); unsigned int timer_ms = gm_ifp->cur_query_intv; if (gm_ifp->n_startup) { @@ -1868,15 +1867,15 @@ static void gm_t_query(struct thread *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); } -static void gm_t_sg_query(struct thread *t) +static void gm_t_sg_query(struct event *t) { - struct gm_sg *sg = THREAD_ARG(t); + struct gm_sg *sg = EVENT_ARG(t); gm_trigger_specific(sg); } @@ -1895,9 +1894,9 @@ static void gm_send_specific(struct gm_gsq_pending *pend_gsq) XFREE(MTYPE_GM_GSQ_PENDING, pend_gsq); } -static void gm_t_gsq_pend(struct thread *t) +static void gm_t_gsq_pend(struct event *t) { - struct gm_gsq_pending *pend_gsq = THREAD_ARG(t); + struct gm_gsq_pending *pend_gsq = EVENT_ARG(t); gm_send_specific(pend_gsq); } @@ -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)); @@ -1949,7 +1947,7 @@ static void gm_trigger_specific(struct gm_sg *sg) pend_gsq->n_src++; if (pend_gsq->n_src == array_size(pend_gsq->srcs)) { - THREAD_OFF(pend_gsq->t_send); + EVENT_OFF(pend_gsq->t_send); gm_send_specific(pend_gsq); pend_gsq = NULL; } @@ -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) @@ -2055,7 +2053,7 @@ static void gm_vrf_socket_decref(struct pim_instance *pim) if (--pim->gm_socket_if_count) return; - THREAD_OFF(pim->t_gm_recv); + EVENT_OFF(pim->t_gm_recv); close(pim->gm_socket); pim->gm_socket = -1; } @@ -2128,17 +2126,17 @@ void gm_group_delete(struct gm_if *gm_ifp) gm_packet_drop(pkt, false); while ((pend_grp = gm_grp_pends_pop(gm_ifp->grp_pends))) { - THREAD_OFF(pend_grp->t_expire); + EVENT_OFF(pend_grp->t_expire); XFREE(MTYPE_GM_GRP_PENDING, pend_grp); } while ((pend_gsq = gm_gsq_pends_pop(gm_ifp->gsq_pends))) { - THREAD_OFF(pend_gsq->t_send); + EVENT_OFF(pend_gsq->t_send); XFREE(MTYPE_GM_GSQ_PENDING, pend_gsq); } while ((sg = gm_sgs_pop(gm_ifp->sgs))) { - THREAD_OFF(sg->t_sg_expire); + EVENT_OFF(sg->t_sg_expire); assertf(!gm_packet_sg_subs_count(sg->subs_negative), "%pSG", &sg->sgaddr); assertf(!gm_packet_sg_subs_count(sg->subs_positive), "%pSG", @@ -2166,9 +2164,9 @@ void gm_ifp_teardown(struct interface *ifp) if (PIM_DEBUG_GM_EVENTS) zlog_debug(log_ifp("MLD stop")); - THREAD_OFF(gm_ifp->t_query); - THREAD_OFF(gm_ifp->t_other_querier); - THREAD_OFF(gm_ifp->t_expire); + EVENT_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_other_querier); + EVENT_OFF(gm_ifp->t_expire); frr_with_privs (&pimd_privs) { struct ipv6_mreq mreq; @@ -2211,7 +2209,7 @@ static void gm_update_ll(struct interface *ifp) gm_ifp->cur_ll_lowest = pim_ifp->ll_lowest; if (was_querier) gm_ifp->querier = pim_ifp->ll_lowest; - THREAD_OFF(gm_ifp->t_query); + EVENT_OFF(gm_ifp->t_query); if (pim_addr_is_any(gm_ifp->cur_ll_lowest)) { if (was_querier) @@ -2232,7 +2230,7 @@ static void gm_update_ll(struct interface *ifp) return; gm_ifp->n_startup = gm_ifp->cur_qrv; - thread_execute(router->master, gm_t_query, gm_ifp, 0); + event_execute(router->master, gm_t_query, gm_ifp, 0); } void gm_ifp_update(struct interface *ifp) diff --git a/pimd/pim6_mld.h b/pimd/pim6_mld.h index 2af1c77c2..d3f1d3925 100644 --- a/pimd/pim6_mld.h +++ b/pimd/pim6_mld.h @@ -10,7 +10,7 @@ #include "typesafe.h" #include "pim_addr.h" -struct thread; +struct event; struct pim_instance; struct gm_packet_sg; struct gm_if; @@ -65,14 +65,14 @@ struct gm_sg { * (implies we haven't received any report yet, since it's cancelled * by that) */ - struct thread *t_sg_expire; + struct event *t_sg_expire; /* last-member-left triggered queries (group/group-source specific) * * this timer will be running even if we aren't the elected querier, * in case the election result changes midway through. */ - struct thread *t_sg_query; + struct event *t_sg_query; /* we must keep sending (QRV) queries even if we get a positive * response, to make sure other routers are updated. query_sbit @@ -226,7 +226,7 @@ struct gm_grp_pending { pim_addr grp; struct timeval query; - struct thread *t_expire; + struct event *t_expire; }; /* guaranteed MTU for IPv6 is 1280 bytes. IPv6 header is 40 bytes, MLDv2 @@ -247,7 +247,7 @@ struct gm_gsq_pending { struct gm_gsq_pends_item itm; struct gm_if *iface; - struct thread *t_send; + struct event *t_send; pim_addr grp; bool s_bit; @@ -300,7 +300,7 @@ struct gm_if_stats { struct gm_if { struct interface *ifp; struct pim_instance *pim; - struct thread *t_query, *t_other_querier, *t_expire; + struct event *t_query, *t_other_querier, *t_expire; bool stopping; diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index e46fa2cfa..86d9a745e 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -493,12 +493,12 @@ static int pim_assert_cancel(struct pim_ifchannel *ch) return pim_assert_do(ch, metric); } -static void on_assert_timer(struct thread *t) +static void on_assert_timer(struct event *t) { struct pim_ifchannel *ch; struct interface *ifp; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); ifp = ch->interface; @@ -535,7 +535,7 @@ static void assert_timer_off(struct pim_ifchannel *ch) __func__, ch->sg_str, ch->interface->name); } } - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifassert_timer); } static void pim_assert_timer_set(struct pim_ifchannel *ch, int interval) @@ -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 c249f323d..b36e00631 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -54,7 +54,7 @@ void pim_bsm_write_config(struct vty *vty, struct interface *ifp) static void pim_bsm_rpinfo_free(struct bsm_rpinfo *bsrp_info) { - THREAD_OFF(bsrp_info->g2rp_timer); + EVENT_OFF(bsrp_info->g2rp_timer); XFREE(MTYPE_PIM_BSRP_INFO, bsrp_info); } @@ -140,15 +140,15 @@ static struct bsgrp_node *pim_bsm_new_bsgrp_node(struct route_table *rt, return bsgrp; } -static void pim_on_bs_timer(struct thread *t) +static void pim_on_bs_timer(struct event *t) { struct route_node *rn; struct bsm_scope *scope; struct bsgrp_node *bsgrp_node; struct bsm_rpinfo *bsrp; - scope = THREAD_ARG(t); - THREAD_OFF(scope->bs_timer); + scope = EVENT_ARG(t); + EVENT_OFF(scope->bs_timer); if (PIM_DEBUG_BSM) zlog_debug("%s: Bootstrap Timer expired for scope: %d", @@ -189,7 +189,7 @@ static void pim_bs_timer_stop(struct bsm_scope *scope) if (PIM_DEBUG_BSM) zlog_debug("%s : BS timer being stopped of sz: %d", __func__, scope->sz_id); - THREAD_OFF(scope->bs_timer); + EVENT_OFF(scope->bs_timer); } static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout) @@ -199,13 +199,13 @@ static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout) zlog_debug("%s : Invalid scope(NULL).", __func__); return; } - THREAD_OFF(scope->bs_timer); + EVENT_OFF(scope->bs_timer); if (PIM_DEBUG_BSM) 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) @@ -257,7 +257,7 @@ static bool is_hold_time_elapsed(void *data) return true; } -static void pim_on_g2rp_timer(struct thread *t) +static void pim_on_g2rp_timer(struct event *t) { struct bsm_rpinfo *bsrp; struct bsm_rpinfo *bsrp_node; @@ -268,8 +268,8 @@ static void pim_on_g2rp_timer(struct thread *t) uint16_t elapse; pim_addr bsrp_addr; - bsrp = THREAD_ARG(t); - THREAD_OFF(bsrp->g2rp_timer); + bsrp = EVENT_ARG(t); + EVENT_OFF(bsrp->g2rp_timer); bsgrp_node = bsrp->bsgrp_node; /* elapse time is the hold time of expired node */ @@ -331,15 +331,15 @@ static void pim_g2rp_timer_start(struct bsm_rpinfo *bsrp, int hold_time) zlog_debug("%s : Invalid brsp(NULL).", __func__); return; } - THREAD_OFF(bsrp->g2rp_timer); + EVENT_OFF(bsrp->g2rp_timer); if (PIM_DEBUG_BSM) zlog_debug( "%s : starting g2rp timer for grp: %pFX - rp: %pPAs with timeout %d secs(Actual Hold time : %d secs)", __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, @@ -358,7 +358,7 @@ static void pim_g2rp_timer_stop(struct bsm_rpinfo *bsrp) __func__, &bsrp->bsgrp_node->group, &bsrp->rp_address); - THREAD_OFF(bsrp->g2rp_timer); + EVENT_OFF(bsrp->g2rp_timer); } static bool is_hold_time_zero(void *data) diff --git a/pimd/pim_bsm.h b/pimd/pim_bsm.h index 5e40adb80..fb09e3b1c 100644 --- a/pimd/pim_bsm.h +++ b/pimd/pim_bsm.h @@ -59,7 +59,7 @@ struct bsm_scope { struct bsm_frags_head bsm_frags[1]; struct route_table *bsrp_table; /* group2rp mapping rcvd from BSR */ - struct thread *bs_timer; /* Boot strap timer */ + struct event *bs_timer; /* Boot strap timer */ }; /* BSM packet (= fragment) - this is stored as list in bsm_frags inside scope @@ -103,7 +103,7 @@ struct bsm_rpinfo { uint16_t rp_holdtime; /* RP holdtime - g2rp timer value */ pim_addr rp_address; /* RP Address */ struct bsgrp_node *bsgrp_node; /* Back ptr to bsgrp_node */ - struct thread *g2rp_timer; /* Run only for elected RP node */ + struct event *g2rp_timer; /* Run only for elected RP node */ }; extern int pim_bsm_rpinfo_cmp(const struct bsm_rpinfo *a, diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 83079020b..0aff56d55 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -104,10 +104,10 @@ struct pim_interface { struct gm_if *mld; int pim_sock_fd; /* PIM socket file descriptor */ - struct thread *t_pim_sock_read; /* thread for reading PIM socket */ + struct event *t_pim_sock_read; /* thread for reading PIM socket */ int64_t pim_sock_creation; /* timestamp of PIM socket creation */ - struct thread *t_pim_hello_timer; + struct event *t_pim_hello_timer; int pim_hello_period; int pim_default_holdtime; int pim_triggered_hello_delay; diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 136498beb..bc6b84ff2 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -7,7 +7,7 @@ #include <zebra.h> #include "linklist.h" -#include "thread.h" +#include "frrevent.h" #include "memory.h" #include "if.h" #include "vrf.h" @@ -193,9 +193,9 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) ch->upstream = NULL; - THREAD_OFF(ch->t_ifjoin_expiry_timer); - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifassert_timer); if (ch->parent) { listnode_delete(ch->parent->sources, ch); @@ -411,7 +411,7 @@ const char *pim_ifchannel_ifassert_name(enum pim_ifassert_state ifassert_state) */ void reset_ifassert_state(struct pim_ifchannel *ch) { - THREAD_OFF(ch->t_ifassert_timer); + EVENT_OFF(ch->t_ifassert_timer); pim_ifassert_winner_set(ch, PIM_IFASSERT_NOINFO, PIMADDR_ANY, router->infinite_assert_metric); @@ -628,11 +628,11 @@ static void ifjoin_to_noinfo(struct pim_ifchannel *ch) delete_on_noinfo(ch); } -static void on_ifjoin_expiry_timer(struct thread *t) +static void on_ifjoin_expiry_timer(struct event *t) { struct pim_ifchannel *ch; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: ifchannel %s expiry timer", __func__, @@ -642,14 +642,14 @@ static void on_ifjoin_expiry_timer(struct thread *t) /* ch may have been deleted */ } -static void on_ifjoin_prune_pending_timer(struct thread *t) +static void on_ifjoin_prune_pending_timer(struct event *t) { struct pim_ifchannel *ch; int send_prune_echo; /* boolean */ struct interface *ifp; struct pim_interface *pim_ifp; - ch = THREAD_ARG(t); + ch = EVENT_ARG(t); if (PIM_DEBUG_PIM_TRACE) zlog_debug("%s: IFCHANNEL%pSG %s Prune Pending Timer Popped", @@ -896,7 +896,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, previously received join message with holdtime=0xFFFF. */ if (ch->t_ifjoin_expiry_timer) { - unsigned long remain = thread_timer_remain_second( + unsigned long remain = event_timer_remain_second( ch->t_ifjoin_expiry_timer); if (remain > holdtime) { /* @@ -920,13 +920,13 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, return; } } - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); break; case PIM_IFJOIN_PRUNE: if (source_flags & PIM_ENCODE_RPT_BIT) { pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO); - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); delete_on_noinfo(ch); return; } else @@ -943,7 +943,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, * maximum of its current value and the HoldTime from the * triggering Join/Prune message. */ - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); /* Check if SGRpt join Received */ if ((source_flags & PIM_ENCODE_RPT_BIT) && @@ -955,7 +955,7 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, * I transitions to the NoInfo state.The ET and PPT are * cancelled. */ - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); pim_ifchannel_ifjoin_switch(__func__, ch, PIM_IFJOIN_NOINFO); return; @@ -964,13 +964,13 @@ void pim_ifchannel_join_add(struct interface *ifp, pim_addr neigh_addr, pim_ifchannel_ifjoin_handler(ch, pim_ifp); if (ch->t_ifjoin_expiry_timer) { - unsigned long remain = thread_timer_remain_second( + unsigned long remain = event_timer_remain_second( ch->t_ifjoin_expiry_timer); if (remain > holdtime) return; } - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_OFF(ch->t_ifjoin_expiry_timer); break; case PIM_IFJOIN_PRUNE_TMP: @@ -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); } } @@ -1030,15 +1030,15 @@ 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_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_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(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); } @@ -1068,15 +1068,15 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, /* If we called ifjoin_prune() directly instead, care should 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_OFF(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) { - THREAD_OFF(ch->t_ifjoin_prune_pending_timer); + EVENT_OFF(ch->t_ifjoin_prune_pending_timer); /* * While in Prune State, Receive SGRpt Prune. * RFC 7761 Sec 4.5.3: @@ -1087,35 +1087,35 @@ void pim_ifchannel_prune(struct interface *ifp, pim_addr upstream, * Join/Prune message. */ if (ch->t_ifjoin_expiry_timer) { - unsigned long rem = thread_timer_remain_second( + unsigned long rem = event_timer_remain_second( ch->t_ifjoin_expiry_timer); if (rem > holdtime) return; - THREAD_OFF(ch->t_ifjoin_expiry_timer); + EVENT_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_OFF(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_OFF(ch->t_ifjoin_expiry_timer); + event_add_timer(router->master, on_ifjoin_expiry_timer, + ch, holdtime, + &ch->t_ifjoin_expiry_timer); } break; } @@ -1466,8 +1466,8 @@ void pim_ifchannel_set_star_g_join_state(struct pim_ifchannel *ch, int eom, break; if (child->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING_TMP) - THREAD_OFF(child->t_ifjoin_prune_pending_timer); - THREAD_OFF(child->t_ifjoin_expiry_timer); + EVENT_OFF(child->t_ifjoin_prune_pending_timer); + EVENT_OFF(child->t_ifjoin_expiry_timer); PIM_IF_FLAG_UNSET_S_G_RPT(child->flags); child->ifjoin_state = PIM_IFJOIN_NOINFO; diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index 7ab491e99..4b0ff955f 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -86,13 +86,13 @@ struct pim_ifchannel { /* Per-interface (S,G) Join/Prune State (Section 4.1.4 of RFC4601) */ enum pim_ifjoin_state ifjoin_state; - struct thread *t_ifjoin_expiry_timer; - struct thread *t_ifjoin_prune_pending_timer; + struct event *t_ifjoin_expiry_timer; + struct event *t_ifjoin_prune_pending_timer; int64_t ifjoin_creation; /* Record uptime of ifjoin state */ /* Per-interface (S,G) Assert State (Section 4.6.1 of RFC4601) */ enum pim_ifassert_state ifassert_state; - struct thread *t_ifassert_timer; + struct event *t_ifassert_timer; pim_addr ifassert_winner; struct pim_assert_metric ifassert_winner_metric; int64_t ifassert_creation; /* Record uptime of ifassert state */ diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index bff0c0683..063ba6edd 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -29,7 +29,7 @@ #include "pim_tib.h" static void group_timer_off(struct gm_group *group); -static void pim_igmp_general_query(struct thread *t); +static void pim_igmp_general_query(struct event *t); void igmp_anysource_forward_start(struct pim_instance *pim, struct gm_group *group) @@ -325,11 +325,11 @@ struct gm_sock *pim_igmp_sock_lookup_ifaddr(struct list *igmp_sock_list, return NULL; } -static void pim_igmp_other_querier_expire(struct thread *t) +static void pim_igmp_other_querier_expire(struct event *t) { struct gm_sock *igmp; - igmp = THREAD_ARG(t); + igmp = EVENT_ARG(t); assert(!igmp->t_igmp_query_timer); @@ -377,7 +377,7 @@ void pim_igmp_other_querier_timer_on(struct gm_sock *igmp) "Querier %s resetting TIMER event for Other-Querier-Present", ifaddr_str); } - THREAD_OFF(igmp->t_other_querier_timer); + EVENT_OFF(igmp->t_other_querier_timer); } else { /* We are the current querier, then stop sending general queries: @@ -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) @@ -439,7 +439,7 @@ void pim_igmp_other_querier_timer_off(struct gm_sock *igmp) ifaddr_str, igmp->fd, igmp->interface->name); } } - THREAD_OFF(igmp->t_other_querier_timer); + EVENT_OFF(igmp->t_other_querier_timer); } int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len) @@ -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) @@ -883,11 +883,11 @@ void pim_igmp_general_query_off(struct gm_sock *igmp) ifaddr_str, igmp->fd, igmp->interface->name); } } - THREAD_OFF(igmp->t_igmp_query_timer); + EVENT_OFF(igmp->t_igmp_query_timer); } /* Issue IGMP general query */ -static void pim_igmp_general_query(struct thread *t) +static void pim_igmp_general_query(struct event *t) { struct gm_sock *igmp; struct in_addr dst_addr; @@ -895,7 +895,7 @@ static void pim_igmp_general_query(struct thread *t) struct pim_interface *pim_ifp; int query_buf_size; - igmp = THREAD_ARG(t); + igmp = EVENT_ARG(t); assert(igmp->interface); assert(igmp->interface->info); @@ -953,7 +953,7 @@ static void sock_close(struct gm_sock *igmp) igmp->interface->name); } } - THREAD_OFF(igmp->t_igmp_read); + EVENT_OFF(igmp->t_igmp_read); if (close(igmp->fd)) { flog_err( @@ -1045,7 +1045,7 @@ void igmp_group_delete(struct gm_group *group) igmp_source_delete(src); } - THREAD_OFF(group->t_group_query_retransmit_timer); + EVENT_OFF(group->t_group_query_retransmit_timer); group_timer_off(group); igmp_group_count_decr(pim_ifp); @@ -1208,10 +1208,10 @@ static struct gm_sock *igmp_sock_new(int fd, struct in_addr ifaddr, static void igmp_read_on(struct gm_sock *igmp); -static void pim_igmp_read(struct thread *t) +static void pim_igmp_read(struct event *t) { uint8_t buf[10000]; - struct gm_sock *igmp = (struct gm_sock *)THREAD_ARG(t); + struct gm_sock *igmp = (struct gm_sock *)EVENT_ARG(t); struct sockaddr_storage from; struct sockaddr_storage to; socklen_t fromlen = sizeof(from); @@ -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, @@ -1300,11 +1300,11 @@ struct gm_sock *pim_igmp_sock_add(struct list *igmp_sock_list, source records. Source records whose timers are zero (from the previous EXCLUDE mode) are deleted. */ -static void igmp_group_timer(struct thread *t) +static void igmp_group_timer(struct event *t) { struct gm_group *group; - group = THREAD_ARG(t); + group = EVENT_ARG(t); if (PIM_DEBUG_GM_TRACE) { char group_str[INET_ADDRSTRLEN]; @@ -1348,7 +1348,7 @@ static void group_timer_off(struct gm_group *group) zlog_debug("Cancelling TIMER event for group %s on %s", group_str, group->interface->name); } - THREAD_OFF(group->t_group_timer); + EVENT_OFF(group->t_group_timer); } void igmp_group_timer_on(struct gm_group *group, long interval_msec, @@ -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_igmp.h b/pimd/pim_igmp.h index e275b5b39..a1f19b3c6 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -64,10 +64,10 @@ struct gm_sock { pim_addr ifaddr; time_t sock_creation; - struct thread *t_igmp_read; /* read: IGMP sockets */ - struct thread - *t_igmp_query_timer; /* timer: issue IGMP general queries */ - struct thread *t_other_querier_timer; /* timer: other querier present */ + struct event *t_igmp_read; /* read: IGMP sockets */ + /* timer: issue IGMP general queries */ + struct event *t_igmp_query_timer; + struct event *t_other_querier_timer; /* timer: other querier present */ pim_addr querier_addr; /* IP address of the querier */ int querier_query_interval; /* QQI */ int querier_robustness_variable; /* QRV */ @@ -144,7 +144,7 @@ static inline void pim_igmp_other_querier_timer_off(struct gm_sock *igmp) struct gm_source { pim_addr source_addr; - struct thread *t_source_timer; + struct event *t_source_timer; struct gm_group *source_group; /* back pointer */ time_t source_creation; uint32_t source_flags; @@ -165,11 +165,11 @@ struct gm_group { represents the time for the *filter-mode* of the group to expire and switch to INCLUDE mode. */ - struct thread *t_group_timer; + struct event *t_group_timer; /* Shared between group-specific and group-and-source-specific retransmissions */ - struct thread *t_group_query_retransmit_timer; + struct event *t_group_query_retransmit_timer; /* Counter exclusive for group-specific retransmissions (not used by group-and-source-specific retransmissions, diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index f10bcaf04..15078dd1e 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -107,12 +107,12 @@ void igmp_group_reset_gmi(struct gm_group *group) igmp_group_timer_on(group, group_membership_interval_msec, ifp->name); } -static void igmp_source_timer(struct thread *t) +static void igmp_source_timer(struct event *t) { struct gm_source *source; struct gm_group *group; - source = THREAD_ARG(t); + source = EVENT_ARG(t); group = source->source_group; @@ -187,7 +187,7 @@ static void source_timer_off(struct gm_group *group, struct gm_source *source) group_str, source_str, group->interface->name); } - THREAD_OFF(source->t_source_timer); + EVENT_OFF(source->t_source_timer); } static void igmp_source_timer_on(struct gm_group *group, @@ -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 @@ -1200,13 +1200,13 @@ static int group_retransmit_sources(struct gm_group *group, return num_retransmit_sources_left; } -static void igmp_group_retransmit(struct thread *t) +static void igmp_group_retransmit(struct event *t) { struct gm_group *group; int num_retransmit_sources_left; int send_with_sflag_set; /* boolean */ - group = THREAD_ARG(t); + group = EVENT_ARG(t); if (PIM_DEBUG_GM_TRACE) { char group_str[INET_ADDRSTRLEN]; @@ -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_instance.h b/pimd/pim_instance.h index fa90e38a1..11577ae46 100644 --- a/pimd/pim_instance.h +++ b/pimd/pim_instance.h @@ -64,7 +64,7 @@ enum pim_mlag_flags { }; struct pim_router { - struct thread_master *master; + struct event_loop *master; uint32_t debugs; @@ -92,7 +92,7 @@ struct pim_router { /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/ struct stream_fifo *mlag_fifo; struct stream *mlag_stream; - struct thread *zpthread_mlag_write; + struct event *zpthread_mlag_write; struct in_addr anycast_vtep_ip; struct in_addr local_vtep_ip; struct pim_mlag_stats mlag_stats; @@ -120,7 +120,7 @@ struct pim_instance { int send_v6_secondary; - struct thread *thread; + struct event *thread; int mroute_socket; int reg_sock; /* Socket to send register msg */ int64_t mroute_socket_creation; @@ -157,7 +157,7 @@ struct pim_instance { unsigned int gm_socket_if_count; int gm_socket; - struct thread *t_gm_recv; + struct event *t_gm_recv; unsigned int gm_group_count; unsigned int gm_watermark_limit; @@ -176,7 +176,7 @@ struct pim_instance { uint64_t bsm_dropped; /* If we need to rescan all our upstreams */ - struct thread *rpf_cache_refresher; + struct event *rpf_cache_refresher; int64_t rpf_cache_refresh_requests; int64_t rpf_cache_refresh_events; int64_t rpf_cache_refresh_last; diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 20821d58b..671f7a37a 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -326,10 +326,9 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh, if (PIM_IF_FLAG_TEST_S_G_RPT(child->flags)) { if (child->ifjoin_state == PIM_IFJOIN_PRUNE_PENDING_TMP) - THREAD_OFF( + EVENT_OFF( child->t_ifjoin_prune_pending_timer); - THREAD_OFF( - child->t_ifjoin_expiry_timer); + EVENT_OFF(child->t_ifjoin_expiry_timer); PIM_IF_FLAG_UNSET_S_G_RPT(child->flags); child->ifjoin_state = PIM_IFJOIN_NOINFO; delete_on_noinfo(child); diff --git a/pimd/pim_main.c b/pimd/pim_main.c index ce4326c61..7db0a7676 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -11,7 +11,7 @@ #include "lib/version.h" #include <getopt.h> #include "command.h" -#include "thread.h" +#include "frrevent.h" #include <signal.h> #include "memory.h" diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index 61cf2860f..5d72eb658 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -921,7 +921,7 @@ int pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS) return 0; } -static void pim_mlag_register_handler(struct thread *thread) +static void pim_mlag_register_handler(struct event *thread) { uint32_t bit_mask = 0; @@ -952,11 +952,11 @@ 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 thread *thread) +static void pim_mlag_deregister_handler(struct event *thread) { if (!zclient) return; @@ -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 adf0540f6..4d5da3182 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -767,7 +767,7 @@ int pim_mroute_msg(struct pim_instance *pim, const char *buf, size_t buf_size, return 0; } -static void mroute_read(struct thread *t) +static void mroute_read(struct event *t) { struct pim_instance *pim; static long long count; @@ -775,7 +775,7 @@ static void mroute_read(struct thread *t) int cont = 1; int rd; ifindex_t ifindex; - pim = THREAD_ARG(t); + pim = EVENT_ARG(t); while (cont) { rd = pim_socket_recvfromto(pim->mroute_socket, (uint8_t *)buf, @@ -809,13 +809,13 @@ 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) { - THREAD_OFF(pim->thread); + EVENT_OFF(pim->thread); } int pim_mroute_socket_enable(struct pim_instance *pim) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 9d29a33a5..b1b6958fe 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -12,7 +12,7 @@ #include <lib/prefix.h> #include <lib/sockunion.h> #include <lib/stream.h> -#include <lib/thread.h> +#include <frrevent.h> #include <lib/vty.h> #include <lib/plist.h> #include <lib/lib_errors.h> @@ -54,9 +54,9 @@ static void pim_msdp_sa_timer_expiry_log(struct pim_msdp_sa *sa, } /* RFC-3618:Sec-5.1 - global active source advertisement timer */ -static void pim_msdp_sa_adv_timer_cb(struct thread *t) +static void pim_msdp_sa_adv_timer_cb(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { zlog_debug("MSDP SA advertisement timer expired"); @@ -68,20 +68,20 @@ static void pim_msdp_sa_adv_timer_cb(struct thread *t) static void pim_msdp_sa_adv_timer_setup(struct pim_instance *pim, bool start) { - THREAD_OFF(pim->msdp.sa_adv_timer); + EVENT_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); } } /* RFC-3618:Sec-5.3 - SA cache state timer */ -static void pim_msdp_sa_state_timer_cb(struct thread *t) +static void pim_msdp_sa_state_timer_cb(struct event *t) { struct pim_msdp_sa *sa; - sa = THREAD_ARG(t); + sa = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_sa_timer_expiry_log(sa, "state"); @@ -92,11 +92,11 @@ static void pim_msdp_sa_state_timer_cb(struct thread *t) static void pim_msdp_sa_state_timer_setup(struct pim_msdp_sa *sa, bool start) { - THREAD_OFF(sa->sa_state_timer); + EVENT_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); } } @@ -861,11 +861,11 @@ static void pim_msdp_peer_timer_expiry_log(struct pim_msdp_peer *mp, } /* RFC-3618:Sec-5.4 - peer hold timer */ -static void pim_msdp_peer_hold_timer_cb(struct thread *t) +static void pim_msdp_peer_hold_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "hold"); @@ -884,20 +884,20 @@ static void pim_msdp_peer_hold_timer_cb(struct thread *t) 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); + EVENT_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); } } /* RFC-3618:Sec-5.5 - peer keepalive timer */ -static void pim_msdp_peer_ka_timer_cb(struct thread *t) +static void pim_msdp_peer_ka_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "ka"); @@ -909,11 +909,10 @@ static void pim_msdp_peer_ka_timer_cb(struct thread *t) static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start) { - THREAD_OFF(mp->ka_timer); + EVENT_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); } } @@ -954,11 +953,11 @@ static void pim_msdp_peer_active_connect(struct pim_msdp_peer *mp) } /* RFC-3618:Sec-5.6 - connection retry on active peer */ -static void pim_msdp_peer_cr_timer_cb(struct thread *t) +static void pim_msdp_peer_cr_timer_cb(struct event *t) { struct pim_msdp_peer *mp; - mp = THREAD_ARG(t); + mp = EVENT_ARG(t); if (PIM_DEBUG_MSDP_EVENTS) { pim_msdp_peer_timer_expiry_log(mp, "connect-retry"); @@ -973,11 +972,11 @@ static void pim_msdp_peer_cr_timer_cb(struct thread *t) static void pim_msdp_peer_cr_timer_setup(struct pim_msdp_peer *mp, bool start) { - THREAD_OFF(mp->cr_timer); + EVENT_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); } } @@ -1334,7 +1333,7 @@ static void pim_msdp_enable(struct pim_instance *pim) } /* MSDP init */ -void pim_msdp_init(struct pim_instance *pim, struct thread_master *master) +void pim_msdp_init(struct pim_instance *pim, struct event_loop *master) { pim->msdp.master = master; char hash_name[64]; diff --git a/pimd/pim_msdp.h b/pimd/pim_msdp.h index f0a03f076..ddc015f9b 100644 --- a/pimd/pim_msdp.h +++ b/pimd/pim_msdp.h @@ -74,7 +74,7 @@ struct pim_msdp_sa { /* rfc-3618 is missing default value for SA-hold-down-Period. pulled * this number from industry-standards */ #define PIM_MSDP_SA_HOLD_TIME ((3*60)+30) - struct thread *sa_state_timer; // 5.6 + struct event *sa_state_timer; // 5.6 int64_t uptime; struct pim_upstream *up; @@ -109,18 +109,18 @@ struct pim_msdp_peer { /* protocol timers */ #define PIM_MSDP_PEER_HOLD_TIME 75 - struct thread *hold_timer; // 5.4 + struct event *hold_timer; // 5.4 #define PIM_MSDP_PEER_KA_TIME 60 - struct thread *ka_timer; // 5.5 + struct event *ka_timer; // 5.5 #define PIM_MSDP_PEER_CONNECT_RETRY_TIME 30 - struct thread *cr_timer; // 5.6 + struct event *cr_timer; // 5.6 /* packet thread and buffers */ uint32_t packet_size; struct stream *ibuf; struct stream_fifo *obuf; - struct thread *t_read; - struct thread *t_write; + struct event *t_read; + struct event *t_write; /* stats */ uint32_t conn_attempts; @@ -167,12 +167,12 @@ enum pim_msdp_flags { struct pim_msdp_listener { int fd; union sockunion su; - struct thread *thread; + struct event *thread; }; struct pim_msdp { enum pim_msdp_flags flags; - struct thread_master *master; + struct event_loop *master; struct pim_msdp_listener listener; uint32_t rejected_accepts; @@ -182,7 +182,7 @@ struct pim_msdp { /* MSDP active-source info */ #define PIM_MSDP_SA_ADVERTISMENT_TIME 60 - struct thread *sa_adv_timer; // 5.6 + struct event *sa_adv_timer; // 5.6 struct hash *sa_hash; struct list *sa_list; uint32_t local_cnt; @@ -204,20 +204,20 @@ 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) +#define PIM_MSDP_PEER_READ_OFF(mp) event_cancel(&mp->t_read) +#define PIM_MSDP_PEER_WRITE_OFF(mp) event_cancel(&mp->t_write) #if PIM_IPV != 6 // struct pim_msdp *msdp; struct pim_instance; -void pim_msdp_init(struct pim_instance *pim, struct thread_master *master); +void pim_msdp_init(struct pim_instance *pim, struct event_loop *master); void pim_msdp_exit(struct pim_instance *pim); char *pim_msdp_state_dump(enum pim_msdp_peer_state state, char *buf, int buf_size); @@ -227,7 +227,7 @@ void pim_msdp_peer_established(struct pim_msdp_peer *mp); void pim_msdp_peer_pkt_rxed(struct pim_msdp_peer *mp); void pim_msdp_peer_stop_tcp_conn(struct pim_msdp_peer *mp, bool chg_state); void pim_msdp_peer_reset_tcp_conn(struct pim_msdp_peer *mp, const char *rc_str); -void pim_msdp_write(struct thread *thread); +void pim_msdp_write(struct event *thread); int pim_msdp_config_write(struct pim_instance *pim, struct vty *vty, const char *spaces); bool pim_msdp_peer_config_write(struct vty *vty, struct pim_instance *pim, @@ -308,7 +308,7 @@ void pim_msdp_peer_change_source(struct pim_msdp_peer *mp, #else /* PIM_IPV == 6 */ static inline void pim_msdp_init(struct pim_instance *pim, - struct thread_master *master) + struct event_loop *master) { } diff --git a/pimd/pim_msdp_packet.c b/pimd/pim_msdp_packet.c index a6f318e61..a414736cc 100644 --- a/pimd/pim_msdp_packet.c +++ b/pimd/pim_msdp_packet.c @@ -8,7 +8,7 @@ #include <lib/log.h> #include <lib/network.h> #include <lib/stream.h> -#include <lib/thread.h> +#include "frrevent.h" #include <lib/vty.h> #include <lib/lib_errors.h> @@ -190,7 +190,7 @@ static void pim_msdp_write_proceed_actions(struct pim_msdp_peer *mp) } } -void pim_msdp_write(struct thread *thread) +void pim_msdp_write(struct event *thread) { struct pim_msdp_peer *mp; struct stream *s; @@ -200,7 +200,7 @@ void pim_msdp_write(struct thread *thread) int work_cnt = 0; int work_max_cnt = 100; - mp = THREAD_ARG(thread); + mp = EVENT_ARG(thread); mp->t_write = NULL; if (PIM_DEBUG_MSDP_INTERNAL) { @@ -686,13 +686,13 @@ static int pim_msdp_read_packet(struct pim_msdp_peer *mp) return 0; } -void pim_msdp_read(struct thread *thread) +void pim_msdp_read(struct event *thread) { struct pim_msdp_peer *mp; int rc; uint32_t len; - mp = THREAD_ARG(thread); + mp = EVENT_ARG(thread); mp->t_read = NULL; if (PIM_DEBUG_MSDP_INTERNAL) { diff --git a/pimd/pim_msdp_packet.h b/pimd/pim_msdp_packet.h index efb14cdf7..1584a2453 100644 --- a/pimd/pim_msdp_packet.h +++ b/pimd/pim_msdp_packet.h @@ -51,7 +51,7 @@ #define PIM_MSDP_PKT_TYPE_STRLEN 16 void pim_msdp_pkt_ka_tx(struct pim_msdp_peer *mp); -void pim_msdp_read(struct thread *thread); +void pim_msdp_read(struct event *thread); void pim_msdp_pkt_sa_tx(struct pim_instance *pim); void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa); void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp); diff --git a/pimd/pim_msdp_socket.c b/pimd/pim_msdp_socket.c index a6b5ee11b..fe8d5e934 100644 --- a/pimd/pim_msdp_socket.c +++ b/pimd/pim_msdp_socket.c @@ -9,7 +9,7 @@ #include <lib/log.h> #include <lib/network.h> #include <lib/sockunion.h> -#include <lib/thread.h> +#include "frrevent.h" #include <lib/vty.h> #include <lib/if.h> #include <lib/vrf.h> @@ -50,10 +50,10 @@ static void pim_msdp_update_sock_send_buffer_size(int fd) } /* passive peer socket accept */ -static void pim_msdp_sock_accept(struct thread *thread) +static void pim_msdp_sock_accept(struct event *thread) { union sockunion su; - struct pim_instance *pim = THREAD_ARG(thread); + struct pim_instance *pim = EVENT_ARG(thread); int accept_sock; int msdp_sock; struct pim_msdp_peer *mp; @@ -61,15 +61,15 @@ static void pim_msdp_sock_accept(struct thread *thread) sockunion_init(&su); /* re-register accept thread */ - accept_sock = THREAD_FD(thread); + accept_sock = EVENT_FD(thread); if (accept_sock < 0) { flog_err(EC_LIB_DEVELOPMENT, "accept_sock is negative value %d", accept_sock); 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 0b7ea0ad9..3d0ecb1bf 100644 --- a/pimd/pim_neighbor.c +++ b/pimd/pim_neighbor.c @@ -188,13 +188,13 @@ static void update_dr_priority(struct pim_neighbor *neigh, } } -static void on_neighbor_timer(struct thread *t) +static void on_neighbor_timer(struct event *t) { struct pim_neighbor *neigh; struct interface *ifp; char msg[100]; - neigh = THREAD_ARG(t); + neigh = EVENT_ARG(t); ifp = neigh->interface; @@ -220,7 +220,7 @@ void pim_neighbor_timer_reset(struct pim_neighbor *neigh, uint16_t holdtime) { neigh->holdtime = holdtime; - THREAD_OFF(neigh->t_expire_timer); + EVENT_OFF(neigh->t_expire_timer); /* 0xFFFF is request for no holdtime @@ -234,13 +234,13 @@ 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 thread *t) +static void on_neighbor_jp_timer(struct event *t) { - struct pim_neighbor *neigh = THREAD_ARG(t); + struct pim_neighbor *neigh = EVENT_ARG(t); struct pim_rpf rpf; if (PIM_DEBUG_PIM_TRACE) @@ -253,15 +253,15 @@ static void on_neighbor_jp_timer(struct thread *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_OFF(neigh->jp_timer); + event_add_timer(router->master, on_neighbor_jp_timer, neigh, + router->t_periodic, &neigh->jp_timer); } static struct pim_neighbor * @@ -375,7 +375,7 @@ void pim_neighbor_free(struct pim_neighbor *neigh) delete_prefix_list(neigh); list_delete(&neigh->upstream_jp_agg); - THREAD_OFF(neigh->jp_timer); + EVENT_OFF(neigh->jp_timer); bfd_sess_free(&neigh->bfd_session); @@ -579,7 +579,7 @@ void pim_neighbor_delete(struct interface *ifp, struct pim_neighbor *neigh, zlog_notice("PIM NEIGHBOR DOWN: neighbor %pPA on interface %s: %s", &neigh->source_addr, ifp->name, delete_message); - THREAD_OFF(neigh->t_expire_timer); + EVENT_OFF(neigh->t_expire_timer); pim_if_assert_on_neighbor_down(ifp, neigh->source_addr); diff --git a/pimd/pim_neighbor.h b/pimd/pim_neighbor.h index f7375745a..69e9976de 100644 --- a/pimd/pim_neighbor.h +++ b/pimd/pim_neighbor.h @@ -27,10 +27,10 @@ struct pim_neighbor { uint32_t dr_priority; uint32_t generation_id; struct list *prefix_list; /* list of struct prefix */ - struct thread *t_expire_timer; + struct event *t_expire_timer; struct interface *interface; - struct thread *jp_timer; + struct event *jp_timer; struct list *upstream_jp_agg; struct bfd_session_params *bfd_session; }; diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 1248db3de..4a272a480 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -7,7 +7,7 @@ #include <zebra.h> #include "log.h" -#include "thread.h" +#include "frrevent.h" #include "memory.h" #include "if.h" #include "network.h" @@ -31,7 +31,7 @@ #include "pim_bsm.h" #include <lib/lib_errors.h> -static void on_pim_hello_send(struct thread *t); +static void on_pim_hello_send(struct event *t); static const char *pim_pim_msgtype2str(enum pim_msg_type type) { @@ -70,7 +70,7 @@ static void sock_close(struct interface *ifp) pim_ifp->pim_sock_fd, ifp->name); } } - THREAD_OFF(pim_ifp->t_pim_sock_read); + EVENT_OFF(pim_ifp->t_pim_sock_read); if (PIM_DEBUG_PIM_TRACE) { if (pim_ifp->t_pim_hello_timer) { @@ -79,7 +79,7 @@ static void sock_close(struct interface *ifp) ifp->name); } } - THREAD_OFF(pim_ifp->t_pim_hello_timer); + EVENT_OFF(pim_ifp->t_pim_hello_timer); if (PIM_DEBUG_PIM_TRACE) { zlog_debug("Deleting PIM socket fd=%d on interface %s", @@ -334,7 +334,7 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len, static void pim_sock_read_on(struct interface *ifp); -static void pim_sock_read(struct thread *t) +static void pim_sock_read(struct event *t) { struct interface *ifp, *orig_ifp; struct pim_interface *pim_ifp; @@ -350,8 +350,8 @@ static void pim_sock_read(struct thread *t) static long long count = 0; int cont = 1; - orig_ifp = ifp = THREAD_ARG(t); - fd = THREAD_FD(t); + orig_ifp = ifp = EVENT_ARG(t); + fd = EVENT_FD(t); pim_ifp = ifp->info; @@ -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) @@ -821,21 +821,20 @@ static void hello_resched(struct interface *ifp) zlog_debug("Rescheduling %d sec hello on interface %s", 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_OFF(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); } /* Periodic hello timer */ -static void on_pim_hello_send(struct thread *t) +static void on_pim_hello_send(struct event *t) { struct pim_interface *pim_ifp; struct interface *ifp; - ifp = THREAD_ARG(t); + ifp = EVENT_ARG(t); pim_ifp = ifp->info; /* @@ -924,7 +923,7 @@ void pim_hello_restart_triggered(struct interface *ifp) return; } - THREAD_OFF(pim_ifp->t_pim_hello_timer); + EVENT_OFF(pim_ifp->t_pim_hello_timer); } random_msec = triggered_hello_delay_msec; @@ -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_register.c b/pimd/pim_register.c index 5144fe67b..b5d9df6f2 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -9,7 +9,7 @@ #include "log.h" #include "if.h" -#include "thread.h" +#include "frrevent.h" #include "prefix.h" #include "vty.h" #include "plist.h" @@ -32,7 +32,7 @@ #include "pim_vxlan.h" #include "pim_addr.h" -struct thread *send_test_packet_timer = NULL; +struct event *send_test_packet_timer = NULL; void pim_register_join(struct pim_upstream *up) { @@ -743,7 +743,7 @@ void pim_reg_del_on_couldreg_fail(struct interface *ifp) && (up->reg_state != PIM_REG_NOINFO)) { pim_channel_del_oif(up->channel_oil, pim->regiface, PIM_OIF_FLAG_PROTO_PIM, __func__); - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); up->reg_state = PIM_REG_NOINFO; } } diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c index 2fc30b491..dadf29f53 100644 --- a/pimd/pim_ssmpingd.c +++ b/pimd/pim_ssmpingd.c @@ -196,7 +196,7 @@ static void ssmpingd_delete(struct ssmpingd_sock *ss) { assert(ss); - THREAD_OFF(ss->t_sock_read); + EVENT_OFF(ss->t_sock_read); if (close(ss->sock_fd)) { zlog_warn( @@ -286,11 +286,11 @@ static int ssmpingd_read_msg(struct ssmpingd_sock *ss) return 0; } -static void ssmpingd_sock_read(struct thread *t) +static void ssmpingd_sock_read(struct event *t) { struct ssmpingd_sock *ss; - ss = THREAD_ARG(t); + ss = EVENT_ARG(t); ssmpingd_read_msg(ss); @@ -300,8 +300,8 @@ static void ssmpingd_sock_read(struct thread *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_ssmpingd.h b/pimd/pim_ssmpingd.h index fe1583979..71286e496 100644 --- a/pimd/pim_ssmpingd.h +++ b/pimd/pim_ssmpingd.h @@ -17,7 +17,7 @@ struct ssmpingd_sock { struct pim_instance *pim; int sock_fd; /* socket */ - struct thread *t_sock_read; /* thread for reading socket */ + struct event *t_sock_read; /* thread for reading socket */ pim_addr source_addr; /* source address */ int64_t creation; /* timestamp of socket creation */ int64_t requests; /* counter */ diff --git a/pimd/pim_time.c b/pimd/pim_time.c index c9555f531..205945e5a 100644 --- a/pimd/pim_time.c +++ b/pimd/pim_time.c @@ -11,7 +11,7 @@ #include <time.h> #include "log.h" -#include "thread.h" +#include "frrevent.h" #include "lib_errors.h" #include "pim_time.h" @@ -121,21 +121,21 @@ static int pim_time_hhmmss(char *buf, int buf_size, long sec) return wr != 8; } -void pim_time_timer_to_mmss(char *buf, int buf_size, struct thread *t_timer) +void pim_time_timer_to_mmss(char *buf, int buf_size, struct event *t_timer) { if (t_timer) { pim_time_mmss(buf, buf_size, - thread_timer_remain_second(t_timer)); + event_timer_remain_second(t_timer)); } else { snprintf(buf, buf_size, "--:--"); } } -void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct thread *t_timer) +void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer) { if (t_timer) { pim_time_hhmmss(buf, buf_size, - thread_timer_remain_second(t_timer)); + event_timer_remain_second(t_timer)); } else { snprintf(buf, buf_size, "--:--:--"); } @@ -156,9 +156,9 @@ void pim_time_uptime_begin(char *buf, int buf_size, int64_t now, int64_t begin) snprintf(buf, buf_size, "--:--:--"); } -long pim_time_timer_remain_msec(struct thread *t_timer) +long pim_time_timer_remain_msec(struct event *t_timer) { /* no timer thread running means timer has expired: return 0 */ - return t_timer ? thread_timer_remain_msec(t_timer) : 0; + return t_timer ? event_timer_remain_msec(t_timer) : 0; } diff --git a/pimd/pim_time.h b/pimd/pim_time.h index fd1e79e2b..6c0e07396 100644 --- a/pimd/pim_time.h +++ b/pimd/pim_time.h @@ -10,16 +10,16 @@ #include <stdint.h> #include <zebra.h> -#include "thread.h" +#include "frrevent.h" int64_t pim_time_monotonic_sec(void); int64_t pim_time_monotonic_dsec(void); int64_t pim_time_monotonic_usec(void); int pim_time_mmss(char *buf, int buf_size, long sec); -void pim_time_timer_to_mmss(char *buf, int buf_size, struct thread *t); -void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct thread *t); +void pim_time_timer_to_mmss(char *buf, int buf_size, struct event *t); +void pim_time_timer_to_hhmmss(char *buf, int buf_size, struct event *t); void pim_time_uptime(char *buf, int buf_size, int64_t uptime_sec); void pim_time_uptime_begin(char *buf, int buf_size, int64_t now, int64_t begin); -long pim_time_timer_remain_msec(struct thread *t_timer); +long pim_time_timer_remain_msec(struct event *t_timer); #endif /* PIM_TIME_H */ diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b0f115859..8fa7b7cf9 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -9,7 +9,7 @@ #include "log.h" #include "zclient.h" #include "memory.h" -#include "thread.h" +#include "frrevent.h" #include "linklist.h" #include "vty.h" #include "plist.h" @@ -166,10 +166,10 @@ static void upstream_channel_oil_detach(struct pim_upstream *up) static void pim_upstream_timers_stop(struct pim_upstream *up) { - THREAD_OFF(up->t_ka_timer); - THREAD_OFF(up->t_rs_timer); - THREAD_OFF(up->t_msdp_reg_timer); - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_ka_timer); + EVENT_OFF(up->t_rs_timer); + EVENT_OFF(up->t_msdp_reg_timer); + EVENT_OFF(up->t_join_timer); } struct pim_upstream *pim_upstream_del(struct pim_instance *pim, @@ -289,11 +289,11 @@ void pim_upstream_send_join(struct pim_upstream *up) pim_jp_agg_single_upstream_send(&up->rpf, up, 1 /* join */); } -static void on_join_timer(struct thread *t) +static void on_join_timer(struct event *t) { struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); if (!up->rpf.source_nexthop.interface) { if (PIM_DEBUG_PIM_TRACE) @@ -323,7 +323,7 @@ static void join_timer_stop(struct pim_upstream *up) { struct pim_neighbor *nbr = NULL; - THREAD_OFF(up->t_join_timer); + EVENT_OFF(up->t_join_timer); if (up->rpf.source_nexthop.interface) nbr = pim_neighbor_find(up->rpf.source_nexthop.interface, @@ -353,9 +353,9 @@ void join_timer_start(struct pim_upstream *up) if (nbr) 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_OFF(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); } @@ -370,7 +370,7 @@ void join_timer_start(struct pim_upstream *up) void pim_upstream_join_timer_restart(struct pim_upstream *up, struct pim_rpf *old) { - // THREAD_OFF(up->t_join_timer); + // EVENT_OFF(up->t_join_timer); join_timer_start(up); } @@ -382,9 +382,9 @@ static void pim_upstream_join_timer_restart_msec(struct pim_upstream *up, __func__, interval_msec, up->sg_str); } - THREAD_OFF(up->t_join_timer); - thread_add_timer_msec(router->master, on_join_timer, up, interval_msec, - &up->t_join_timer); + EVENT_OFF(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) @@ -1361,7 +1361,7 @@ static void pim_upstream_fhr_kat_expiry(struct pim_instance *pim, up->sg_str); /* stop reg-stop timer */ - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); /* remove regiface from the OIL if it is there*/ pim_channel_del_oif(up->channel_oil, pim->regiface, PIM_OIF_FLAG_PROTO_PIM, __func__); @@ -1461,11 +1461,11 @@ struct pim_upstream *pim_upstream_keep_alive_timer_proc( return up; } -static void pim_upstream_keep_alive_timer(struct thread *t) +static void pim_upstream_keep_alive_timer(struct event *t) { struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); /* pull the stats and re-check */ if (pim_upstream_sg_running_proc(up)) @@ -1482,9 +1482,9 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) zlog_debug("kat start on %s with no stream reference", 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_OFF(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 */ @@ -1494,9 +1494,9 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up, uint32_t time) } /* MSDP on RP needs to know if a source is registerable to this RP */ -static void pim_upstream_msdp_reg_timer(struct thread *t) +static void pim_upstream_msdp_reg_timer(struct event *t) { - struct pim_upstream *up = THREAD_ARG(t); + struct pim_upstream *up = EVENT_ARG(t); struct pim_instance *pim = up->channel_oil->pim; /* source is no longer active - pull the SA from MSDP's cache */ @@ -1505,9 +1505,9 @@ static void pim_upstream_msdp_reg_timer(struct thread *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_OFF(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); } @@ -1680,12 +1680,12 @@ const char *pim_reg_state2str(enum pim_reg_state reg_state, char *state_str, return state_str; } -static void pim_upstream_register_stop_timer(struct thread *t) +static void pim_upstream_register_stop_timer(struct event *t) { struct pim_interface *pim_ifp; struct pim_instance *pim; struct pim_upstream *up; - up = THREAD_ARG(t); + up = EVENT_ARG(t); pim = up->channel_oil->pim; if (PIM_DEBUG_PIM_TRACE) { @@ -1749,7 +1749,7 @@ void pim_upstream_start_register_stop_timer(struct pim_upstream *up, { uint32_t time; - THREAD_OFF(up->t_rs_timer); + EVENT_OFF(up->t_rs_timer); if (!null_register) { uint32_t lower = (0.5 * router->register_suppress_time); @@ -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_upstream.h b/pimd/pim_upstream.h index 890ba7d16..4e0926e29 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -237,19 +237,19 @@ struct pim_upstream { struct pim_up_mlag mlag; - struct thread *t_join_timer; + struct event *t_join_timer; /* * RST(S,G) */ - struct thread *t_rs_timer; + struct event *t_rs_timer; #define PIM_REGISTER_SUPPRESSION_PERIOD (60) #define PIM_REGISTER_PROBE_PERIOD (5) /* * KAT(S,G) */ - struct thread *t_ka_timer; + struct event *t_ka_timer; #define PIM_KEEPALIVE_PERIOD (210) #define PIM_RP_KEEPALIVE_PERIOD \ (3 * router->register_suppress_time + router->register_probe_time) @@ -257,7 +257,7 @@ struct pim_upstream { /* on the RP we restart a timer to indicate if registers are being rxed * for * SG. This is needed by MSDP to determine its local SA cache */ - struct thread *t_msdp_reg_timer; + struct event *t_msdp_reg_timer; #define PIM_MSDP_REG_RXED_PERIOD (3 * (1.5 * router->register_suppress_time)) int64_t state_transition; /* Record current state uptime */ diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 91ec9d69a..8df3c90f0 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -169,7 +169,7 @@ void pim_vxlan_update_sg_reg_state(struct pim_instance *pim, pim_vxlan_del_work(vxlan_sg); } -static void pim_vxlan_work_timer_cb(struct thread *t) +static void pim_vxlan_work_timer_cb(struct event *t) { pim_vxlan_do_reg_work(); pim_vxlan_work_timer_setup(true /* start */); @@ -178,10 +178,10 @@ static void pim_vxlan_work_timer_cb(struct thread *t) /* global 1second timer used for periodic processing */ static void pim_vxlan_work_timer_setup(bool start) { - THREAD_OFF(vxlan_info.work_timer); + EVENT_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 *********************** @@ -225,7 +225,7 @@ static void pim_vxlan_orig_mr_up_del(struct pim_vxlan_sg *vxlan_sg) * if there are no other references. */ if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) { - THREAD_OFF(up->t_ka_timer); + EVENT_OFF(up->t_ka_timer); up = pim_upstream_keep_alive_timer_proc(up); } else { /* this is really unexpected as we force vxlan diff --git a/pimd/pim_vxlan.h b/pimd/pim_vxlan.h index 6e1e066f0..9a135ca6b 100644 --- a/pimd/pim_vxlan.h +++ b/pimd/pim_vxlan.h @@ -75,7 +75,7 @@ enum pim_vxlan_flags { struct pim_vxlan { enum pim_vxlan_flags flags; - struct thread *work_timer; + struct event *work_timer; struct list *work_list; struct listnode *next_work; int max_work_cnt; diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index f4e303286..97b68c0a3 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -397,9 +397,9 @@ void pim_scan_oil(struct pim_instance *pim) pim_upstream_mroute_iif_update(c_oil, __func__); } -static void on_rpf_cache_refresh(struct thread *t) +static void on_rpf_cache_refresh(struct event *t) { - struct pim_instance *pim = THREAD_ARG(t); + struct pim_instance *pim = EVENT_ARG(t); /* update kernel multicast forwarding cache (MFC) */ pim_scan_oil(pim); @@ -429,9 +429,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 08807d0dc..05a72269d 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -11,7 +11,7 @@ #include "zclient.h" #include "stream.h" #include "network.h" -#include "thread.h" +#include "frrevent.h" #include "prefix.h" #include "vty.h" #include "lib_errors.h" @@ -27,17 +27,17 @@ #include "pim_addr.h" static struct zclient *zlookup = NULL; -struct thread *zlookup_read; +struct event *zlookup_read; static void zclient_lookup_sched(struct zclient *zlookup, int delay); -static void zclient_lookup_read_pipe(struct thread *thread); +static void zclient_lookup_read_pipe(struct event *thread); /* Connect to zebra for nexthop lookup. */ -static void zclient_lookup_connect(struct thread *t) +static void zclient_lookup_connect(struct event *t) { struct zclient *zlookup; - zlookup = THREAD_ARG(t); + zlookup = EVENT_ARG(t); if (zlookup->sock >= 0) { return; @@ -65,15 +65,15 @@ static void zclient_lookup_connect(struct thread *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__); @@ -114,7 +114,7 @@ static void zclient_lookup_failed(struct zclient *zlookup) void zclient_lookup_free(void) { - THREAD_OFF(zlookup_read); + EVENT_OFF(zlookup_read); zclient_stop(zlookup); zclient_free(zlookup); zlookup = NULL; @@ -364,9 +364,9 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, return zclient_read_nexthop(pim, zlookup, nexthop_tab, tab_size, addr); } -void zclient_lookup_read_pipe(struct thread *thread) +void zclient_lookup_read_pipe(struct event *thread) { - struct zclient *zlookup = THREAD_ARG(thread); + struct zclient *zlookup = EVENT_ARG(thread); struct pim_instance *pim = pim_get_pim_instance(VRF_DEFAULT); struct pim_zlookup_nexthop nexthop_tab[10]; pim_addr l = PIMADDR_ANY; @@ -378,8 +378,8 @@ void zclient_lookup_read_pipe(struct thread *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 bc515f27e..d6b2621ff 100644 --- a/pimd/pim_zpthread.c +++ b/pimd/pim_zpthread.c @@ -133,7 +133,7 @@ static void pim_mlag_zebra_check_for_buffer_flush(uint32_t curr_msg_type, * Thsi thread reads the clients data from the Gloabl queue and encodes with * protobuf and pass on to the MLAG socket. */ -static void pim_mlag_zthread_handler(struct thread *event) +static void pim_mlag_zthread_handler(struct event *event) { struct stream *read_s; uint32_t wr_count = 0; @@ -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); } |