From 5f6eaa9b9668f3f09fbf6b1dc4e0645e07f641c9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 11 Dec 2022 10:51:58 -0500 Subject: [PATCH] *: Convert a bunch of thread_XX to event_XX Convert these functions: thread_getrusage thread_cmd_init thread_consumed_time thread_timer_to_hhmmss thread_is_scheduled thread_ignore_late_timer Signed-off-by: Donald Sharp --- bgpd/bgp_conditional_adv.c | 2 +- bgpd/bgp_vty.c | 8 +++--- isisd/isis_lsp.c | 2 +- isisd/isis_main.c | 2 +- lib/command.c | 2 +- lib/event.c | 14 +++++------ lib/event.h | 18 +++++++------- lib/vty.c | 2 +- lib/workqueue.c | 8 +++--- ospf6d/ospf6_asbr.c | 4 +-- ospf6d/ospf6_interface.c | 28 ++++++++++----------- ospf6d/ospf6_neighbor.c | 50 ++++++++++++++++++-------------------- ospf6d/ospf6_nssa.c | 2 +- ospf6d/ospf6_spf.c | 2 +- ospf6d/ospf6_top.c | 5 ++-- zebra/interface.c | 6 ++--- zebra/zebra_evpn_mac.c | 12 ++++----- zebra/zebra_evpn_mh.c | 20 +++++++-------- zebra/zebra_evpn_neigh.c | 12 ++++----- zebra/zebra_nhg.c | 2 +- zebra/zebra_rib.c | 2 +- zebra/zebra_vty.c | 16 ++++++------ 22 files changed, 107 insertions(+), 112 deletions(-) diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c index 32ff4bf2e..0510ded2e 100644 --- a/bgpd/bgp_conditional_adv.c +++ b/bgpd/bgp_conditional_adv.c @@ -328,7 +328,7 @@ 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)) + if (!event_is_scheduled(bgp->t_condition_check)) event_add_timer(bm->master, bgp_conditional_adv_timer, bgp, 0, &bgp->t_condition_check); } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index bc0681df7..c412e2442 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -13460,7 +13460,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, json_neigh, "bgpTimerConfiguredConditionalAdvertisementsSec", bgp->condition_check_period); - if (thread_is_scheduled(bgp->t_condition_check)) + if (event_is_scheduled(bgp->t_condition_check)) json_object_int_add( json_neigh, "bgpTimerUntilConditionalAdvertisementsSec", @@ -13541,7 +13541,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json, vty_out(vty, " Configured conditional advertisements interval is %d seconds\n", bgp->condition_check_period); - if (thread_is_scheduled(bgp->t_condition_check)) + if (event_is_scheduled(bgp->t_condition_check)) vty_out(vty, " Time until conditional advertisements begin is %lu seconds\n", event_timer_remain_second( @@ -18768,7 +18768,7 @@ static struct event *t_bgp_cfg; bool bgp_config_inprocess(void) { - return thread_is_scheduled(t_bgp_cfg); + return event_is_scheduled(t_bgp_cfg); } static void bgp_config_finish(struct event *t) @@ -18797,7 +18797,7 @@ static void bgp_config_end(void) { #define BGP_POST_CONFIG_DELAY_SECONDS 1 uint32_t bgp_post_config_delay = - thread_is_scheduled(bm->t_rmap_update) + event_is_scheduled(bm->t_rmap_update) ? event_timer_remain_second(bm->t_rmap_update) : BGP_POST_CONFIG_DELAY_SECONDS; diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 114a499dd..1635d66c3 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1372,7 +1372,7 @@ int lsp_generate(struct isis_area *area, int level) return ISIS_ERROR; /* Check if config is still being processed */ - if (thread_is_scheduled(t_isis_cfg)) + if (event_is_scheduled(t_isis_cfg)) return ISIS_OK; memset(&lspid, 0, ISIS_SYS_ID_LEN + 2); diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 363543f5d..04056636a 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -195,7 +195,7 @@ static void isis_config_end(void) /* If ISIS config processing thread isn't running, then * we can return and rely it's properly handled. */ - if (!thread_is_scheduled(t_isis_cfg)) + if (!event_is_scheduled(t_isis_cfg)) return; THREAD_OFF(t_isis_cfg); diff --git a/lib/command.c b/lib/command.c index e2de6f322..be766f7cd 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2542,7 +2542,7 @@ void cmd_init(int terminal) install_default(CONFIG_NODE); - thread_cmd_init(); + event_cmd_init(); workqueue_cmd_init(); hash_cmd_init(); } diff --git a/lib/event.c b/lib/event.c index 59f8928d1..f5f9c9540 100644 --- a/lib/event.c +++ b/lib/event.c @@ -516,7 +516,7 @@ DEFPY_NOSH (show_thread_timers, return CMD_SUCCESS; } -void thread_cmd_init(void) +void event_cmd_init(void) { install_element(VIEW_NODE, &show_thread_cpu_cmd); install_element(VIEW_NODE, &show_thread_poll_cmd); @@ -737,7 +737,7 @@ unsigned long event_timer_remain_msec(struct event *thread) { int64_t remain; - if (!thread_is_scheduled(thread)) + if (!event_is_scheduled(thread)) return 0; frr_with_mutex (&thread->mtx) { @@ -780,7 +780,7 @@ static int time_hhmmss(char *buf, int buf_size, long sec) return wr != 8; } -char *thread_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer) +char *event_timer_to_hhmmss(char *buf, int buf_size, struct event *t_timer) { if (t_timer) { time_hhmmss(buf, buf_size, event_timer_remain_second(t_timer)); @@ -1865,8 +1865,8 @@ static unsigned long timeval_elapsed(struct timeval a, struct timeval b) + (a.tv_usec - b.tv_usec)); } -unsigned long thread_consumed_time(RUSAGE_T *now, RUSAGE_T *start, - unsigned long *cputime) +unsigned long event_consumed_time(RUSAGE_T *now, RUSAGE_T *start, + unsigned long *cputime) { #ifdef HAVE_CLOCK_THREAD_CPUTIME_ID @@ -1927,7 +1927,7 @@ void event_set_yield_time(struct event *thread, unsigned long yield_time) } } -void thread_getrusage(RUSAGE_T *r) +void event_getrusage(RUSAGE_T *r) { monotime(&r->real); if (!cputime_enabled) { @@ -1993,7 +1993,7 @@ void event_call(struct event *thread) unsigned long walltime, cputime; unsigned long exp; - walltime = thread_consumed_time(&after, &before, &cputime); + walltime = event_consumed_time(&after, &before, &cputime); /* update walltime */ atomic_fetch_add_explicit(&thread->hist->real.total, walltime, diff --git a/lib/event.h b/lib/event.h index 03d7d6d19..dcc7cee5e 100644 --- a/lib/event.h +++ b/lib/event.h @@ -35,7 +35,7 @@ struct rusage_t { }; #define RUSAGE_T struct rusage_t -#define GETRUSAGE(X) thread_getrusage(X) +#define GETRUSAGE(X) event_getrusage(X) PREDECL_LIST(thread_list); PREDECL_HEAP(thread_timer_list); @@ -259,19 +259,19 @@ extern int event_should_yield(struct event *event); extern void event_set_yield_time(struct event *event, unsigned long); /* Internal libfrr exports */ -extern void thread_getrusage(RUSAGE_T *); -extern void thread_cmd_init(void); +extern void event_getrusage(RUSAGE_T *); +extern void event_cmd_init(void); /* Returns elapsed real (wall clock) time. */ -extern unsigned long thread_consumed_time(RUSAGE_T *after, RUSAGE_T *before, - unsigned long *cpu_time_elapsed); +extern unsigned long event_consumed_time(RUSAGE_T *after, RUSAGE_T *before, + unsigned long *cpu_time_elapsed); /* only for use in logging functions! */ extern pthread_key_t thread_current; -extern char *thread_timer_to_hhmmss(char *buf, int buf_size, - struct event *t_timer); +extern char *event_timer_to_hhmmss(char *buf, int buf_size, + struct event *t_timer); -static inline bool thread_is_scheduled(struct event *thread) +static inline bool event_is_scheduled(struct event *thread) { if (thread) return true; @@ -282,7 +282,7 @@ static inline bool thread_is_scheduled(struct event *thread) /* Debug signal mask */ void debug_signals(const sigset_t *sigs); -static inline void thread_ignore_late_timer(struct event *event) +static inline void event_ignore_late_timer(struct event *event) { event->ignore_timer_late = true; } diff --git a/lib/vty.c b/lib/vty.c index 8324878c2..464bd11ea 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -545,7 +545,7 @@ static int vty_command(struct vty *vty, char *buf) GETRUSAGE(&after); - walltime = thread_consumed_time(&after, &before, &cputime); + walltime = event_consumed_time(&after, &before, &cputime); if (cputime_enabled_here && cputime_enabled && cputime_threshold && cputime > cputime_threshold) diff --git a/lib/workqueue.c b/lib/workqueue.c index 766066344..cba611cd1 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -106,27 +106,27 @@ void work_queue_free_and_null(struct work_queue **wqp) bool work_queue_is_scheduled(struct work_queue *wq) { - return thread_is_scheduled(wq->thread); + return event_is_scheduled(wq->thread); } static int work_queue_schedule(struct work_queue *wq, unsigned int delay) { /* if appropriate, schedule work queue thread */ if (CHECK_FLAG(wq->flags, WQ_UNPLUGGED) && - !thread_is_scheduled(wq->thread) && !work_queue_empty(wq)) { + !event_is_scheduled(wq->thread) && !work_queue_empty(wq)) { /* Schedule timer if there's a delay, otherwise just schedule * as an 'event' */ if (delay > 0) { event_add_timer_msec(wq->master, work_queue_run, wq, delay, &wq->thread); - thread_ignore_late_timer(wq->thread); + event_ignore_late_timer(wq->thread); } else event_add_event(wq->master, work_queue_run, wq, 0, &wq->thread); /* set thread yield time, if needed */ - if (thread_is_scheduled(wq->thread) && + if (event_is_scheduled(wq->thread) && wq->spec.yield != EVENT_YIELD_TIME_SLOT) event_set_yield_time(wq->thread, wq->spec.yield); return 1; diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index bb47b6675..81b393f20 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1104,7 +1104,7 @@ void ospf6_asbr_distribute_list_update(struct ospf6 *ospf6, { SET_FLAG(red->flag, OSPF6_IS_RMAP_CHANGED); - if (thread_is_scheduled(ospf6->t_distribute_update)) + if (event_is_scheduled(ospf6->t_distribute_update)) return; if (IS_OSPF6_DEBUG_ASBR) @@ -3363,7 +3363,7 @@ ospf6_start_asbr_summary_delay_timer(struct ospf6 *ospf6, { aggr->action = operation; - if (thread_is_scheduled(ospf6->t_external_aggr)) { + if (event_is_scheduled(ospf6->t_external_aggr)) { if (ospf6->aggr_action == OSPF6_ROUTE_AGGR_ADD) { if (IS_OSPF6_DEBUG_AGGR) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 2c8d168e0..f195b1710 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1140,7 +1140,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, if (use_json) { timerclear(&res); - if (thread_is_scheduled(oi->thread_send_lsupdate)) + if (event_is_scheduled(oi->thread_send_lsupdate)) timersub(&oi->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); @@ -1150,9 +1150,8 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, duration); json_object_string_add( json_obj, "lsUpdateSendThread", - (thread_is_scheduled(oi->thread_send_lsupdate) - ? "on" - : "off")); + (event_is_scheduled(oi->thread_send_lsupdate) ? "on" + : "off")); json_arr = json_object_new_array(); for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) @@ -1162,7 +1161,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, json_arr); timerclear(&res); - if (thread_is_scheduled(oi->thread_send_lsack)) + if (event_is_scheduled(oi->thread_send_lsack)) timersub(&oi->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); @@ -1172,8 +1171,8 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, duration); json_object_string_add( json_obj, "lsAckSendThread", - (thread_is_scheduled(oi->thread_send_lsack) ? "on" - : "off")); + (event_is_scheduled(oi->thread_send_lsack) ? "on" + : "off")); json_arr = json_object_new_array(); for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) @@ -1183,28 +1182,27 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, } else { timerclear(&res); - if (thread_is_scheduled(oi->thread_send_lsupdate)) + if (event_is_scheduled(oi->thread_send_lsupdate)) timersub(&oi->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", oi->lsupdate_list->count, duration, - (thread_is_scheduled(oi->thread_send_lsupdate) - ? "on" - : "off")); + (event_is_scheduled(oi->thread_send_lsupdate) ? "on" + : "off")); for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (thread_is_scheduled(oi->thread_send_lsack)) + if (event_is_scheduled(oi->thread_send_lsack)) timersub(&oi->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n", oi->lsack_list->count, duration, - (thread_is_scheduled(oi->thread_send_lsack) ? "on" - : "off")); + (event_is_scheduled(oi->thread_send_lsack) ? "on" + : "off")); for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); } @@ -2107,7 +2105,7 @@ DEFUN (ipv6_ospf6_hellointerval, /* * If the thread is scheduled, send the new hello now. */ - if (thread_is_scheduled(oi->thread_send_hello)) { + if (event_is_scheduled(oi->thread_send_hello)) { THREAD_OFF(oi->thread_send_hello); event_add_timer(master, ospf6_hello_send, oi, 0, diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index aaa23659e..5af69738c 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -815,7 +815,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, timerclear(&res); - if (thread_is_scheduled(on->thread_send_dbdesc)) + if (event_is_scheduled(on->thread_send_dbdesc)) timersub(&on->thread_send_dbdesc->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); json_object_int_add(json_neighbor, "pendingLsaDbDescCount", @@ -824,8 +824,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty, duration); json_object_string_add( json_neighbor, "dbDescSendThread", - (thread_is_scheduled(on->thread_send_dbdesc) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_dbdesc) ? "on" + : "off")); json_array = json_object_new_array(); for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) json_object_array_add( @@ -834,7 +834,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, json_array); timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsreq)) + if (event_is_scheduled(on->thread_send_lsreq)) timersub(&on->thread_send_lsreq->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); json_object_int_add(json_neighbor, "pendingLsaLsReqCount", @@ -843,8 +843,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty, duration); json_object_string_add( json_neighbor, "lsReqSendThread", - (thread_is_scheduled(on->thread_send_lsreq) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsreq) ? "on" + : "off")); json_array = json_object_new_array(); for (ALL_LSDB(on->request_list, lsa, lsanext)) json_object_array_add( @@ -854,7 +854,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsupdate)) + if (event_is_scheduled(on->thread_send_lsupdate)) timersub(&on->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); @@ -864,9 +864,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty, duration); json_object_string_add( json_neighbor, "lsUpdateSendThread", - (thread_is_scheduled(on->thread_send_lsupdate) - ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsupdate) ? "on" + : "off")); json_array = json_object_new_array(); for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) json_object_array_add( @@ -875,7 +874,7 @@ static void ospf6_neighbor_show_detail(struct vty *vty, json_array); timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsack)) + if (event_is_scheduled(on->thread_send_lsack)) timersub(&on->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); json_object_int_add(json_neighbor, "pendingLsaLsAckCount", @@ -884,8 +883,8 @@ static void ospf6_neighbor_show_detail(struct vty *vty, duration); json_object_string_add( json_neighbor, "lsAckSendThread", - (thread_is_scheduled(on->thread_send_lsack) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsack) ? "on" + : "off")); json_array = json_object_new_array(); for (ALL_LSDB(on->lsack_list, lsa, lsanext)) json_object_array_add( @@ -973,52 +972,51 @@ static void ospf6_neighbor_show_detail(struct vty *vty, vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (thread_is_scheduled(on->thread_send_dbdesc)) + if (event_is_scheduled(on->thread_send_dbdesc)) timersub(&on->thread_send_dbdesc->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for DbDesc in Time %s [thread %s]\n", on->dbdesc_list->count, duration, - (thread_is_scheduled(on->thread_send_dbdesc) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_dbdesc) ? "on" + : "off")); for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsreq)) + if (event_is_scheduled(on->thread_send_lsreq)) timersub(&on->thread_send_lsreq->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSReq in Time %s [thread %s]\n", on->request_list->count, duration, - (thread_is_scheduled(on->thread_send_lsreq) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsreq) ? "on" + : "off")); for (ALL_LSDB(on->request_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsupdate)) + if (event_is_scheduled(on->thread_send_lsupdate)) timersub(&on->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", on->lsupdate_list->count, duration, - (thread_is_scheduled(on->thread_send_lsupdate) - ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsupdate) ? "on" + : "off")); for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (thread_is_scheduled(on->thread_send_lsack)) + if (event_is_scheduled(on->thread_send_lsack)) timersub(&on->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n", on->lsack_list->count, duration, - (thread_is_scheduled(on->thread_send_lsack) ? "on" - : "off")); + (event_is_scheduled(on->thread_send_lsack) ? "on" + : "off")); for (ALL_LSDB(on->lsack_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 87754a59a..15fcab13f 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -992,7 +992,7 @@ static void ospf6_abr_task_timer(struct event *thread) void ospf6_schedule_abr_task(struct ospf6 *ospf6) { - if (thread_is_scheduled(ospf6->t_abr_task)) { + if (event_is_scheduled(ospf6->t_abr_task)) { if (IS_OSPF6_DEBUG_ABR) zlog_debug("ABR task already scheduled"); return; diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 051fd83f6..b8d5bfef6 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -687,7 +687,7 @@ void ospf6_spf_schedule(struct ospf6 *ospf6, unsigned int reason) } /* SPF calculation timer is already scheduled. */ - if (thread_is_scheduled(ospf6->t_spf_calc)) { + if (event_is_scheduled(ospf6->t_spf_calc)) { if (IS_OSPF6_DEBUG_SPF(PROCESS) || IS_OSPF6_DEBUG_SPF(TIME)) zlog_debug( "SPF: calculation timer is already scheduled: %p", diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index db45198ac..58124cabd 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -1359,7 +1359,7 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json, } else json_object_boolean_false_add(json, "spfHasRun"); - if (thread_is_scheduled(o->t_spf_calc)) { + if (event_is_scheduled(o->t_spf_calc)) { long time_store; json_object_boolean_true_add(json, "spfTimerActive"); @@ -1452,8 +1452,7 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json, threadtimer_string(now, o->t_spf_calc, buf, sizeof(buf)); vty_out(vty, " SPF timer %s%s\n", - (thread_is_scheduled(o->t_spf_calc) ? "due in " - : "is "), + (event_is_scheduled(o->t_spf_calc) ? "due in " : "is "), buf); if (CHECK_FLAG(o->flag, OSPF6_STUB_ROUTER)) diff --git a/zebra/interface.c b/zebra/interface.c index 8e4d15aa8..9f05a8d11 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -98,7 +98,7 @@ static void if_zebra_speed_update(struct event *thread) zif->speed_update_count++; event_add_timer(zrouter.master, if_zebra_speed_update, ifp, SPEED_UPDATE_SLEEP_TIME, &zif->speed_update); - thread_ignore_late_timer(zif->speed_update); + event_ignore_late_timer(zif->speed_update); } } @@ -163,7 +163,7 @@ static int if_zebra_new_hook(struct interface *ifp) zebra_if->speed_update_count = 0; event_add_timer(zrouter.master, if_zebra_speed_update, ifp, 15, &zebra_if->speed_update); - thread_ignore_late_timer(zebra_if->speed_update); + event_ignore_late_timer(zebra_if->speed_update); return 0; } @@ -1040,7 +1040,7 @@ void if_up(struct interface *ifp, bool install_connected) event_add_timer(zrouter.master, if_zebra_speed_update, ifp, 0, &zif->speed_update); - thread_ignore_late_timer(zif->speed_update); + event_ignore_late_timer(zif->speed_update); } /* Interface goes down. We have to manage different behavior of based diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index c12bfe5bc..36470af6e 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -692,9 +692,9 @@ void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json) if (mac->hold_timer) json_object_string_add( json_mac, "peerActiveHold", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - mac->hold_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + mac->hold_timer)); if (mac->es) json_object_string_add(json_mac, "esi", mac->es->esi_str); @@ -784,9 +784,9 @@ void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json) vty_out(vty, " peer-active"); if (mac->hold_timer) vty_out(vty, " (ht: %s)", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - mac->hold_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + mac->hold_timer)); vty_out(vty, "\n"); vty_out(vty, " Local Seq: %u Remote Seq: %u\n", mac->loc_seq, mac->rem_seq); diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index c5d5046df..0e3e3d01f 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -3181,9 +3181,9 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty, if (es->df_delay_timer) json_object_string_add( json, "dfDelayTimer", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - es->df_delay_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + es->df_delay_timer)); json_object_int_add(json, "nexthopGroup", es->nhg_id); if (listcount(es->es_vtep_list)) { json_vteps = json_object_new_array(); @@ -3226,9 +3226,9 @@ static void zebra_evpn_es_show_entry_detail(struct vty *vty, : "df"); if (es->df_delay_timer) vty_out(vty, " DF delay: %s\n", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - es->df_delay_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + es->df_delay_timer)); vty_out(vty, " DF preference: %u\n", es->df_pref); vty_out(vty, " Nexthop group: %u\n", es->nhg_id); vty_out(vty, " VTEPs:\n"); @@ -3529,8 +3529,8 @@ void zebra_evpn_mh_json(json_object *json) json_object_int_add(json, "startupDelay", zmh_info->startup_delay_time); json_object_string_add( json, "startupDelayTimer", - thread_timer_to_hhmmss(thread_buf, sizeof(thread_buf), - zmh_info->startup_delay_timer)); + event_timer_to_hhmmss(thread_buf, sizeof(thread_buf), + zmh_info->startup_delay_timer)); json_object_int_add(json, "uplinkConfigCount", zmh_info->uplink_cfg_cnt); json_object_int_add(json, "uplinkActiveCount", @@ -3562,8 +3562,8 @@ void zebra_evpn_mh_print(struct vty *vty) zmh_info->mac_hold_time, zmh_info->neigh_hold_time); vty_out(vty, " startup-delay: %ds, start-delay-timer: %s\n", zmh_info->startup_delay_time, - thread_timer_to_hhmmss(thread_buf, sizeof(thread_buf), - zmh_info->startup_delay_timer)); + event_timer_to_hhmmss(thread_buf, sizeof(thread_buf), + zmh_info->startup_delay_timer)); vty_out(vty, " uplink-cfg-cnt: %u, uplink-active-cnt: %u\n", zmh_info->uplink_cfg_cnt, zmh_info->uplink_oper_up_cnt); if (zmh_info->protodown_rc) diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index 11ceae4b5..393ff3baf 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -1746,9 +1746,9 @@ void zebra_evpn_print_neigh(struct zebra_neigh *n, void *ctxt, } if (n->hold_timer) { vty_out(vty, " (ht: %s)", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - n->hold_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + n->hold_timer)); sync_info = true; } if (!sync_info) @@ -1769,9 +1769,9 @@ void zebra_evpn_print_neigh(struct zebra_neigh *n, void *ctxt, if (n->hold_timer) json_object_string_add( json, "peerActiveHold", - thread_timer_to_hhmmss(thread_buf, - sizeof(thread_buf), - n->hold_timer)); + event_timer_to_hhmmss(thread_buf, + sizeof(thread_buf), + n->hold_timer)); } if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)) { if (n->mac->es) { diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 7eed209a1..23156d8bf 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1727,7 +1727,7 @@ void zebra_nhg_increment_ref(struct nhg_hash_entry *nhe) nhe->refcnt++; - if (thread_is_scheduled(nhe->timer)) { + if (event_is_scheduled(nhe->timer)) { THREAD_OFF(nhe->timer); nhe->refcnt--; UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_KEEP_AROUND); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 2864b9231..17e71db49 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4415,7 +4415,7 @@ void rib_update(enum rib_update_event event) { struct rib_update_ctx *ctx; - if (thread_is_scheduled(t_rib_update_threads[event])) + if (event_is_scheduled(t_rib_update_threads[event])) return; ctx = rib_update_ctx_init(0, event); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 6d6143002..56e722642 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1179,12 +1179,12 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe, json_object_string_add(json, "type", zebra_route_string(nhe->type)); json_object_int_add(json, "refCount", nhe->refcnt); - if (thread_is_scheduled(nhe->timer)) + if (event_is_scheduled(nhe->timer)) json_object_string_add( json, "timeToDeletion", - thread_timer_to_hhmmss(time_left, - sizeof(time_left), - nhe->timer)); + event_timer_to_hhmmss(time_left, + sizeof(time_left), + nhe->timer)); json_object_string_add(json, "uptime", up_str); json_object_string_add(json, "vrf", vrf_id_to_name(nhe->vrf_id)); @@ -1193,11 +1193,11 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe, vty_out(vty, "ID: %u (%s)\n", nhe->id, zebra_route_string(nhe->type)); vty_out(vty, " RefCnt: %u", nhe->refcnt); - if (thread_is_scheduled(nhe->timer)) + if (event_is_scheduled(nhe->timer)) vty_out(vty, " Time to Deletion: %s", - thread_timer_to_hhmmss(time_left, - sizeof(time_left), - nhe->timer)); + event_timer_to_hhmmss(time_left, + sizeof(time_left), + nhe->timer)); vty_out(vty, "\n"); vty_out(vty, " Uptime: %s\n", up_str); -- 2.39.2