diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-07-17 23:09:51 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2020-10-23 18:16:52 +0200 |
commit | 5047884528ec263215504cb5df12ebd2422cc392 (patch) | |
tree | 952121f1a904ef9c86c1f7336a3aae757eeb3434 /isisd | |
parent | * : update signature of thread_cancel api (diff) | |
download | frr-5047884528ec263215504cb5df12ebd2422cc392.tar.xz frr-5047884528ec263215504cb5df12ebd2422cc392.zip |
*: unify thread/event cancel macros
Replace all lib/thread cancel macros, use thread_cancel()
everywhere. Only the THREAD_OFF macro and thread_cancel() api are
supported. Also adjust thread_cancel_async() to NULL caller's pointer (if
present).
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_adjacency.c | 2 | ||||
-rw-r--r-- | isisd/isis_circuit.c | 24 | ||||
-rw-r--r-- | isisd/isis_dr.c | 6 | ||||
-rw-r--r-- | isisd/isis_events.c | 10 | ||||
-rw-r--r-- | isisd/isis_ldp_sync.c | 18 | ||||
-rw-r--r-- | isisd/isis_lsp.c | 8 | ||||
-rw-r--r-- | isisd/isis_nb_config.c | 3 | ||||
-rw-r--r-- | isisd/isis_pdu.c | 4 | ||||
-rw-r--r-- | isisd/isis_sr.c | 2 | ||||
-rw-r--r-- | isisd/isisd.c | 14 |
10 files changed, 45 insertions, 46 deletions
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 59403b6c2..71d475816 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -147,7 +147,7 @@ void isis_delete_adj(void *arg) if (!adj) return; - THREAD_TIMER_OFF(adj->t_expire); + thread_cancel(&adj->t_expire); if (adj->adj_state != ISIS_ADJ_DOWN) adj->adj_state = ISIS_ADJ_DOWN; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 3eb3b900a..730d224cb 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -788,12 +788,12 @@ void isis_circuit_down(struct isis_circuit *circuit) memset(circuit->u.bc.l2_desig_is, 0, ISIS_SYS_ID_LEN + 1); memset(circuit->u.bc.snpa, 0, ETH_ALEN); - THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[0]); - THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[1]); - THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[0]); - THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[1]); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[0]); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]); + thread_cancel(&circuit->u.bc.t_send_lan_hello[0]); + thread_cancel(&circuit->u.bc.t_send_lan_hello[1]); + thread_cancel(&circuit->u.bc.t_run_dr[0]); + thread_cancel(&circuit->u.bc.t_run_dr[1]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[0]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[1]); circuit->lsp_regenerate_pending[0] = 0; circuit->lsp_regenerate_pending[1] = 0; @@ -803,15 +803,15 @@ void isis_circuit_down(struct isis_circuit *circuit) } else if (circuit->circ_type == CIRCUIT_T_P2P) { isis_delete_adj(circuit->u.p2p.neighbor); circuit->u.p2p.neighbor = NULL; - THREAD_TIMER_OFF(circuit->u.p2p.t_send_p2p_hello); + thread_cancel(&circuit->u.p2p.t_send_p2p_hello); } /* Cancel all active threads */ - THREAD_TIMER_OFF(circuit->t_send_csnp[0]); - THREAD_TIMER_OFF(circuit->t_send_csnp[1]); - THREAD_TIMER_OFF(circuit->t_send_psnp[0]); - THREAD_TIMER_OFF(circuit->t_send_psnp[1]); - THREAD_OFF(circuit->t_read); + thread_cancel(&circuit->t_send_csnp[0]); + thread_cancel(&circuit->t_send_csnp[1]); + thread_cancel(&circuit->t_send_psnp[0]); + thread_cancel(&circuit->t_send_psnp[1]); + thread_cancel(&circuit->t_read); if (circuit->tx_queue) { isis_tx_queue_free(circuit->tx_queue); diff --git a/isisd/isis_dr.c b/isisd/isis_dr.c index 3324d74e0..d03f857a0 100644 --- a/isisd/isis_dr.c +++ b/isisd/isis_dr.c @@ -221,8 +221,8 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) circuit->u.bc.is_dr[level - 1] = 0; circuit->u.bc.run_dr_elect[level - 1] = 0; - THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[level - 1]); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + thread_cancel(&circuit->u.bc.t_run_dr[level - 1]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); circuit->lsp_regenerate_pending[level - 1] = 0; memcpy(id, circuit->isis->sysid, ISIS_SYS_ID_LEN); @@ -246,7 +246,7 @@ int isis_dr_resign(struct isis_circuit *circuit, int level) &circuit->t_send_psnp[1]); } - THREAD_TIMER_OFF(circuit->t_send_csnp[level - 1]); + thread_cancel(&circuit->t_send_csnp[level - 1]); thread_add_timer(master, isis_run_dr, &circuit->level_arg[level - 1], diff --git a/isisd/isis_events.c b/isisd/isis_events.c index c4c95138c..0b987fc5c 100644 --- a/isisd/isis_events.c +++ b/isisd/isis_events.c @@ -109,13 +109,13 @@ static void circuit_resign_level(struct isis_circuit *circuit, int level) circuit->area->area_tag, circuit->circuit_id, circuit->interface->name, level); - THREAD_TIMER_OFF(circuit->t_send_csnp[idx]); - THREAD_TIMER_OFF(circuit->t_send_psnp[idx]); + thread_cancel(&circuit->t_send_csnp[idx]); + thread_cancel(&circuit->t_send_psnp[idx]); if (circuit->circ_type == CIRCUIT_T_BROADCAST) { - THREAD_TIMER_OFF(circuit->u.bc.t_send_lan_hello[idx]); - THREAD_TIMER_OFF(circuit->u.bc.t_run_dr[idx]); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[idx]); + thread_cancel(&circuit->u.bc.t_send_lan_hello[idx]); + thread_cancel(&circuit->u.bc.t_run_dr[idx]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[idx]); circuit->lsp_regenerate_pending[idx] = 0; circuit->u.bc.run_dr_elect[idx] = 0; circuit->u.bc.is_dr[idx] = 0; diff --git a/isisd/isis_ldp_sync.c b/isisd/isis_ldp_sync.c index 8360dfc59..988af64c4 100644 --- a/isisd/isis_ldp_sync.c +++ b/isisd/isis_ldp_sync.c @@ -135,8 +135,8 @@ int isis_ldp_sync_announce_update(struct ldp_igp_sync_announce announce) } } - THREAD_TIMER_OFF(isis->ldp_sync_cmd.t_hello); - isis->ldp_sync_cmd.t_hello = NULL; + THREAD_OFF(isis->ldp_sync_cmd.t_hello); + isis->ldp_sync_cmd.sequence = 0; isis_ldp_sync_hello_timer_add(); @@ -186,7 +186,7 @@ int isis_ldp_sync_hello_update(struct ldp_igp_sync_hello hello) } } } else { - THREAD_TIMER_OFF(isis->ldp_sync_cmd.t_hello); + THREAD_OFF(isis->ldp_sync_cmd.t_hello); isis_ldp_sync_hello_timer_add(); } isis->ldp_sync_cmd.sequence = hello.sequence; @@ -280,8 +280,9 @@ void isis_ldp_sync_if_complete(struct isis_circuit *circuit) if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED) { if (ldp_sync_info->state == LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP) ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_UP; - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); - ldp_sync_info->t_holddown = NULL; + + THREAD_OFF(ldp_sync_info->t_holddown); + isis_ldp_sync_set_if_metric(circuit, true); } } @@ -300,7 +301,7 @@ void isis_ldp_sync_ldp_fail(struct isis_circuit *circuit) if (ldp_sync_info && ldp_sync_info->enabled == LDP_IGP_SYNC_ENABLED && ldp_sync_info->state != LDP_IGP_SYNC_STATE_NOT_REQUIRED) { - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); + THREAD_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP; isis_ldp_sync_set_if_metric(circuit, true); } @@ -323,7 +324,7 @@ void isis_ldp_sync_if_remove(struct isis_circuit *circuit, bool remove) ils_debug("ldp_sync: remove if %s", circuit->interface ? circuit->interface->name : ""); - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); + THREAD_OFF(ldp_sync_info->t_holddown); ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; isis_ldp_sync_set_if_metric(circuit, true); if (remove) { @@ -662,8 +663,7 @@ void isis_ldp_sync_gbl_exit(bool remove) UNSET_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE); UNSET_FLAG(isis->ldp_sync_cmd.flags, LDP_SYNC_FLAG_HOLDDOWN); isis->ldp_sync_cmd.holddown = LDP_IGP_SYNC_HOLDDOWN_DEFAULT; - THREAD_TIMER_OFF(isis->ldp_sync_cmd.t_hello); - isis->ldp_sync_cmd.t_hello = NULL; + THREAD_OFF(isis->ldp_sync_cmd.t_hello); /* remove LDP-SYNC on all ISIS interfaces */ FOR_ALL_INTERFACES (vrf, ifp) { diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 2e38663d3..d8ad4cd51 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1241,7 +1241,7 @@ int lsp_generate(struct isis_area *area, int level) refresh_time = lsp_refresh_time(newlsp, rem_lifetime); - THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]); + thread_cancel(&area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; thread_add_timer(master, lsp_refresh, &area->lsp_refresh_arg[level - 1], refresh_time, @@ -1451,7 +1451,7 @@ int _lsp_regenerate_schedule(struct isis_area *area, int level, "ISIS (%s): Will schedule regen timer. Last run was: %lld, Now is: %lld", area->area_tag, (long long)lsp->last_generated, (long long)now); - THREAD_TIMER_OFF(area->t_lsp_refresh[lvl - 1]); + thread_cancel(&area->t_lsp_refresh[lvl - 1]); diff = now - lsp->last_generated; if (diff < area->lsp_gen_interval[lvl - 1] && !(area->bfd_signalled_down)) { @@ -1628,7 +1628,7 @@ int lsp_generate_pseudo(struct isis_circuit *circuit, int level) lsp_flood(lsp, NULL); refresh_time = lsp_refresh_time(lsp, rem_lifetime); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[level - 1]); circuit->lsp_regenerate_pending[level - 1] = 0; if (level == IS_LEVEL_1) thread_add_timer( @@ -1819,7 +1819,7 @@ int lsp_regenerate_schedule_pseudo(struct isis_circuit *circuit, int level) "ISIS (%s): Will schedule PSN regen timer. Last run was: %lld, Now is: %lld", area->area_tag, (long long)lsp->last_generated, (long long)now); - THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); + thread_cancel(&circuit->u.bc.t_refresh_pseudo_lsp[lvl - 1]); diff = now - lsp->last_generated; if (diff < circuit->area->lsp_gen_interval[lvl - 1]) { timeout = diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 2710c3c13..23a646663 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2844,8 +2844,7 @@ int lib_interface_isis_mpls_ldp_sync_modify(struct nb_cb_modify_args *args) SET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG); ldp_sync_info->enabled = LDP_IGP_SYNC_DEFAULT; ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; - THREAD_TIMER_OFF(ldp_sync_info->t_holddown); - ldp_sync_info->t_holddown = NULL; + THREAD_OFF(ldp_sync_info->t_holddown); isis_ldp_sync_set_if_metric(circuit, true); } break; diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 63be8841c..72de5d654 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -205,7 +205,7 @@ static int process_p2p_hello(struct iih_info *iih) adj); /* lets take care of the expiry */ - THREAD_TIMER_OFF(adj->t_expire); + thread_cancel(&adj->t_expire); thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, &adj->t_expire); @@ -497,7 +497,7 @@ static int process_lan_hello(struct iih_info *iih) adj); /* lets take care of the expiry */ - THREAD_TIMER_OFF(adj->t_expire); + thread_cancel(&adj->t_expire); thread_add_timer(master, isis_adj_expire, adj, (long)adj->hold_time, &adj->t_expire); diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 842103de1..3f62f4dca 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -2284,7 +2284,7 @@ void isis_sr_stop(struct isis_area *area) area->area_tag); /* Disable any re-attempt to connect to Label Manager */ - THREAD_TIMER_OFF(srdb->t_start_lm); + thread_cancel(&srdb->t_start_lm); /* Uninstall all local Adjacency-SIDs. */ for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra)) diff --git a/isisd/isisd.c b/isisd/isisd.c index 57d3e9c7c..075daaec9 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -442,8 +442,8 @@ void isis_area_destroy(struct isis_area *area) spftree_area_del(area); - THREAD_TIMER_OFF(area->spf_timer[0]); - THREAD_TIMER_OFF(area->spf_timer[1]); + thread_cancel(&area->spf_timer[0]); + thread_cancel(&area->spf_timer[1]); spf_backoff_free(area->spf_delay_ietf[0]); spf_backoff_free(area->spf_delay_ietf[1]); @@ -457,9 +457,9 @@ void isis_area_destroy(struct isis_area *area) } area->area_addrs = NULL; - THREAD_TIMER_OFF(area->t_tick); - THREAD_TIMER_OFF(area->t_lsp_refresh[0]); - THREAD_TIMER_OFF(area->t_lsp_refresh[1]); + thread_cancel(&area->t_tick); + thread_cancel(&area->t_lsp_refresh[0]); + thread_cancel(&area->t_lsp_refresh[1]); thread_cancel_event(master, area); @@ -2373,12 +2373,12 @@ static void area_resign_level(struct isis_area *area, int level) } } - THREAD_TIMER_OFF(area->spf_timer[level - 1]); + thread_cancel(&area->spf_timer[level - 1]); sched_debug( "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", area->area_tag, level); - THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]); + thread_cancel(&area->t_lsp_refresh[level - 1]); area->lsp_regenerate_pending[level - 1] = 0; } |