*: Convert thread_execute to event_execute

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-12-11 08:06:25 -05:00
parent ba7d2705d6
commit 8c1186d38e
22 changed files with 65 additions and 65 deletions

View File

@ -13441,7 +13441,7 @@ static int bgp_table_stats_single(struct vty *vty, struct bgp *bgp, afi_t afi,
memset(&ts, 0, sizeof(ts));
ts.table = bgp->rib[afi][safi];
thread_execute(bm->master, bgp_table_stats_walker, &ts, 0);
event_execute(bm->master, bgp_table_stats_walker, &ts, 0);
for (i = 0; i < BGP_STATS_MAX; i++) {
if ((!json && !table_stats_strs[i][TABLE_STATS_IDX_VTY])
@ -13798,7 +13798,7 @@ static int bgp_peer_counts(struct vty *vty, struct peer *peer, afi_t afi,
* stats for the thread-walk (i.e. ensure this can't be blamed on
* on just vty_read()).
*/
thread_execute(bm->master, bgp_peer_count_walker, &pcounts, 0);
event_execute(bm->master, bgp_peer_count_walker, &pcounts, 0);
if (use_json) {
json_object_string_add(json, "prefixCountsFor", peer->host);

View File

@ -7519,8 +7519,8 @@ DEFUN (bgp_set_route_map_delay_timer,
*/
if (!rmap_delay_timer && bm->t_rmap_update) {
THREAD_OFF(bm->t_rmap_update);
thread_execute(bm->master, bgp_route_map_update_timer,
NULL, 0);
event_execute(bm->master, bgp_route_map_update_timer,
NULL, 0);
}
return CMD_SUCCESS;
} else {

View File

@ -182,7 +182,7 @@ The controller is defined and implemented in `path_pcep_controller.[hc]`.
Part of the controller code runs in FRR main thread and part runs in its own
FRR pthread started to isolate the main thread from the PCCs' event loop.
To communicate between the threads it uses FRR events, timers and
`thread_execute` calls.
`event_execute` calls.
PCC

View File

@ -771,8 +771,8 @@ void eigrp_hello_send(struct eigrp_interface *ei, uint8_t flags,
if (ei->eigrp->t_write == NULL) {
if (flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN) {
thread_execute(master, eigrp_write, ei->eigrp,
ei->eigrp->fd);
event_execute(master, eigrp_write, ei->eigrp,
ei->eigrp->fd);
} else {
event_add_write(master, eigrp_write, ei->eigrp,
ei->eigrp->fd,

View File

@ -916,7 +916,7 @@ void eigrp_update_send_GR_thread(struct event *thread)
/* if it wasn't last chunk, schedule this thread again */
if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) {
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
event_execute(master, eigrp_update_send_GR_thread, nbr, 0);
}
}
@ -982,7 +982,7 @@ void eigrp_update_send_GR(struct eigrp_neighbor *nbr, enum GR_type gr_type,
/* indicate, that this is first GR Update packet chunk */
nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST;
/* execute packet sending in thread */
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
event_execute(master, eigrp_update_send_GR_thread, nbr, 0);
}
/**

View File

@ -541,7 +541,7 @@ static void _bfd_sess_remove(struct bfd_session_params *bsp)
/* Send request to remove any session. */
bsp->lastev = BSE_UNINSTALL;
thread_execute(bsglobal.tm, _bfd_sess_send, bsp, 0);
event_execute(bsglobal.tm, _bfd_sess_send, bsp, 0);
}
void bfd_sess_free(struct bfd_session_params **bsp)
@ -894,7 +894,7 @@ int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS)
/* Ask for installation. */
bsp->lastev = BSE_INSTALL;
thread_execute(bsglobal.tm, _bfd_sess_send, bsp, 0);
event_execute(bsglobal.tm, _bfd_sess_send, bsp, 0);
}
return 0;

View File

@ -2058,9 +2058,9 @@ void event_call(struct event *thread)
}
/* Execute thread */
void _thread_execute(const struct xref_threadsched *xref,
struct thread_master *m, void (*func)(struct event *),
void *arg, int val)
void _event_execute(const struct xref_threadsched *xref,
struct thread_master *m, void (*func)(struct event *),
void *arg, int val)
{
struct event *thread;

View File

@ -195,7 +195,7 @@ struct cpu_thread_history {
_xref_t_a(timer_tv, TIMER, m, f, a, v, t)
#define event_add_event(m, f, a, v, t) _xref_t_a(event, EVENT, m, f, a, v, t)
#define thread_execute(m, f, a, v) \
#define event_execute(m, f, a, v) \
({ \
static const struct xref_threadsched _xref __attribute__( \
(used)) = { \
@ -205,7 +205,7 @@ struct cpu_thread_history {
.event_type = EVENT_EXECUTE, \
}; \
XREF_LINK(_xref.xref); \
_thread_execute(&_xref, m, f, a, v); \
_event_execute(&_xref, m, f, a, v); \
}) /* end */
/* Prototypes. */
@ -239,9 +239,9 @@ extern void _event_add_event(const struct xref_threadsched *xref,
void (*fn)(struct event *), void *arg, int val,
struct event **tref);
extern void _thread_execute(const struct xref_threadsched *xref,
struct thread_master *master,
void (*fn)(struct event *), void *arg, int val);
extern void _event_execute(const struct xref_threadsched *xref,
struct thread_master *master,
void (*fn)(struct event *), void *arg, int val);
extern void event_cancel(struct event **event);
extern void event_cancel_async(struct thread_master *, struct event **, void *);

View File

@ -57,7 +57,7 @@ static void wheel_timer_thread(struct event *t)
wheel = THREAD_ARG(t);
thread_execute(wheel->master, wheel_timer_thread_helper, wheel, 0);
event_execute(wheel->master, wheel_timer_thread_helper, wheel, 0);
}
struct timer_wheel *wheel_init(struct thread_master *master, int period,

View File

@ -307,7 +307,7 @@ void ospf6_interface_disable(struct ospf6_interface *oi)
{
SET_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE);
thread_execute(master, interface_down, oi, 0);
event_execute(master, interface_down, oi, 0);
ospf6_lsdb_remove_all(oi->lsdb);
ospf6_lsdb_remove_all(oi->lsdb_self);
@ -382,9 +382,9 @@ void ospf6_interface_state_update(struct interface *ifp)
if (if_is_operative(ifp)
&& (ospf6_interface_get_linklocal_address(oi->interface)
|| if_is_loopback(oi->interface)))
thread_execute(master, interface_up, oi, 0);
event_execute(master, interface_up, oi, 0);
else
thread_execute(master, interface_down, oi, 0);
event_execute(master, interface_down, oi, 0);
return;
}
@ -2520,8 +2520,8 @@ DEFUN (ipv6_ospf6_network,
}
/* Reset the interface */
thread_execute(master, interface_down, oi, 0);
thread_execute(master, interface_up, oi, 0);
event_execute(master, interface_down, oi, 0);
event_execute(master, interface_up, oi, 0);
return CMD_SUCCESS;
}
@ -2556,8 +2556,8 @@ DEFUN (no_ipv6_ospf6_network,
oi->type = type;
/* Reset the interface */
thread_execute(master, interface_down, oi, 0);
thread_execute(master, interface_up, oi, 0);
event_execute(master, interface_down, oi, 0);
event_execute(master, interface_up, oi, 0);
return CMD_SUCCESS;
}
@ -2773,8 +2773,8 @@ void ospf6_interface_clear(struct interface *ifp)
zlog_debug("Interface %s: clear by reset", ifp->name);
/* Reset the interface */
thread_execute(master, interface_down, oi, 0);
thread_execute(master, interface_up, oi, 0);
event_execute(master, interface_down, oi, 0);
event_execute(master, interface_up, oi, 0);
}
/* Clear interface */

View File

@ -180,35 +180,35 @@ struct ospf6_intra_prefix_lsa {
#define OSPF6_ROUTER_LSA_EXECUTE(oa) \
do { \
if (CHECK_FLAG((oa)->flag, OSPF6_AREA_ENABLE)) \
thread_execute(master, ospf6_router_lsa_originate, oa, \
0); \
event_execute(master, ospf6_router_lsa_originate, oa, \
0); \
} while (0)
#define OSPF6_NETWORK_LSA_EXECUTE(oi) \
do { \
THREAD_OFF((oi)->thread_network_lsa); \
thread_execute(master, ospf6_network_lsa_originate, oi, 0); \
event_execute(master, ospf6_network_lsa_originate, oi, 0); \
} while (0)
#define OSPF6_LINK_LSA_EXECUTE(oi) \
do { \
if (!CHECK_FLAG((oi)->flag, OSPF6_INTERFACE_DISABLE)) \
thread_execute(master, ospf6_link_lsa_originate, oi, \
0); \
event_execute(master, ospf6_link_lsa_originate, oi, \
0); \
} while (0)
#define OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(oi) \
do { \
THREAD_OFF((oi)->thread_intra_prefix_lsa); \
thread_execute(master, \
ospf6_intra_prefix_lsa_originate_transit, oi, \
0); \
event_execute(master, \
ospf6_intra_prefix_lsa_originate_transit, oi, \
0); \
} while (0)
#define OSPF6_AS_EXTERN_LSA_EXECUTE(oi) \
do { \
THREAD_OFF((oi)->thread_as_extern_lsa); \
thread_execute(master, ospf6_orig_as_external_lsa, oi, 0); \
event_execute(master, ospf6_orig_as_external_lsa, oi, 0); \
} while (0)
/* Function Prototypes */

View File

@ -333,7 +333,7 @@ void ospf6_lsa_premature_aging(struct ospf6_lsa *lsa)
ospf6_flood_clear(lsa);
lsa->header->age = htons(OSPF_LSA_MAXAGE);
thread_execute(master, ospf6_lsa_expire, lsa, 0);
event_execute(master, ospf6_lsa_expire, lsa, 0);
}
/* check which is more recent. if a is more recent, return -1;

View File

@ -396,7 +396,7 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
ospf6_lsa_checksum(lsa->header);
THREAD_OFF(lsa->refresh);
thread_execute(master, ospf6_lsa_refresh, lsa, 0);
event_execute(master, ospf6_lsa_refresh, lsa, 0);
} else {
zlog_debug("calling ospf6_lsdb_remove %s", lsa->name);
ospf6_lsdb_remove(lsa, lsdb);

View File

@ -535,9 +535,9 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
oi->hello_in++;
/* Execute neighbor events */
thread_execute(master, hello_received, on, 0);
event_execute(master, hello_received, on, 0);
if (twoway)
thread_execute(master, twoway_received, on, 0);
event_execute(master, twoway_received, on, 0);
else {
if (OSPF6_GR_IS_ACTIVE_HELPER(on)) {
if (IS_DEBUG_OSPF6_GR)
@ -553,7 +553,7 @@ static void ospf6_hello_recv(struct in6_addr *src, struct in6_addr *dst,
* receives one_way hellow when it acts as HELPER for
* that specific neighbor.
*/
thread_execute(master, oneway_received, on, 0);
event_execute(master, oneway_received, on, 0);
}
}
@ -624,7 +624,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
return;
case OSPF6_NEIGHBOR_INIT:
thread_execute(master, twoway_received, on, 0);
event_execute(master, twoway_received, on, 0);
if (on->state != OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug(
@ -640,7 +640,7 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
&& !CHECK_FLAG(dbdesc->bits, OSPF6_DBDESC_IBIT)
&& ntohl(dbdesc->seqnum) == on->dbdesc_seqnum) {
/* execute NegotiationDone */
thread_execute(master, negotiation_done, on, 0);
event_execute(master, negotiation_done, on, 0);
/* Record neighbor options */
memcpy(on->options, dbdesc->options,
@ -828,7 +828,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
return;
case OSPF6_NEIGHBOR_INIT:
thread_execute(master, twoway_received, on, 0);
event_execute(master, twoway_received, on, 0);
if (on->state != OSPF6_NEIGHBOR_EXSTART) {
if (IS_OSPF6_DEBUG_MESSAGE(oh->type, RECV_HDR))
zlog_debug(
@ -855,7 +855,7 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
on->dbdesc_seqnum = ntohl(dbdesc->seqnum);
/* schedule NegotiationDone */
thread_execute(master, negotiation_done, on, 0);
event_execute(master, negotiation_done, on, 0);
/* Record neighbor options */
memcpy(on->options, dbdesc->options,
@ -2421,7 +2421,7 @@ void ospf6_dbdesc_send_newone(struct event *thread)
event_add_event(master, exchange_done, on, 0,
&on->thread_exchange_done);
thread_execute(master, ospf6_dbdesc_send, on, 0);
event_execute(master, ospf6_dbdesc_send, on, 0);
}
static uint16_t ospf6_make_lsreq(struct ospf6_neighbor *on, struct stream *s)
@ -2592,7 +2592,7 @@ static void ospf6_send_lsupdate(struct ospf6_neighbor *on,
listnode_add(oi->area->ospf6->oi_write_q, oi);
oi->on_write_q = 1;
}
thread_execute(master, ospf6_write, oi->area->ospf6, 0);
event_execute(master, ospf6_write, oi->area->ospf6, 0);
} else
OSPF6_MESSAGE_WRITE_ON(oi);
}

View File

@ -1436,7 +1436,7 @@ DEFPY (no_area_nssa_range,
SET_FLAG(range->flag, OSPF6_ROUTE_REMOVE);
/* Redo summaries if required */
thread_execute(master, ospf6_abr_task_timer, ospf6, 0);
event_execute(master, ospf6_abr_task_timer, ospf6, 0);
}
ospf6_route_remove(range, oa->nssa_range_table);

View File

@ -69,7 +69,7 @@
/* Macro for OSPF execute event. */
#define OSPF_ISM_EVENT_EXECUTE(I, E) \
thread_execute(master, ospf_ism_event, (I), (E))
event_execute(master, ospf_ism_event, (I), (E))
/* Prototypes. */
extern void ospf_ism_event(struct event *thread);

View File

@ -3653,7 +3653,7 @@ void ospf_flush_self_originated_lsas_now(struct ospf *ospf)
*/
if (ospf->t_maxage != NULL) {
THREAD_OFF(ospf->t_maxage);
thread_execute(master, ospf_maxage_lsa_remover, ospf, 0);
event_execute(master, ospf_maxage_lsa_remover, ospf, 0);
}
return;

View File

@ -49,7 +49,7 @@
/* Macro for OSPF NSM execute event. */
#define OSPF_NSM_EVENT_EXECUTE(N, E) \
thread_execute(master, ospf_nsm_event, (N), (E))
event_execute(master, ospf_nsm_event, (N), (E))
/* Prototypes. */
extern void ospf_nsm_event(struct event *);

View File

@ -1350,7 +1350,7 @@ 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 event *t)
@ -1363,7 +1363,7 @@ static void gm_t_other_querier(struct event *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,
@ -2230,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)

View File

@ -61,7 +61,7 @@ int main(void)
zlog_aux_init("NONE: ", LOG_DEBUG);
thread_execute(master, threadfunc, 0, 0);
event_execute(master, threadfunc, 0, 0);
exit(0);
}

View File

@ -276,7 +276,7 @@ static bool is_thread_sched(const char *name, size_t len)
thread_prefix "event_add_timer_msec",
thread_prefix "event_add_timer_tv",
thread_prefix "event_add_event",
thread_prefix "thread_execute",
thread_prefix "event_execute",
};
size_t i;

View File

@ -83,10 +83,10 @@ void zebra_gr_stale_client_cleanup(struct list *client_list)
THREAD_OFF(info->t_stale_removal);
info->t_stale_removal = NULL;
/* Process the stale routes */
thread_execute(
zrouter.master,
zebra_gr_route_stale_delete_timer_expiry,
info, 1);
event_execute(
zrouter.master,
zebra_gr_route_stale_delete_timer_expiry,
info, 1);
}
}
}
@ -693,8 +693,8 @@ static void zebra_gr_process_client_stale_routes(struct zserv *client,
__func__, zebra_route_string(client->proto),
VRF_LOGNAME(vrf), info->vrf_id);
THREAD_OFF(info->t_stale_removal);
thread_execute(zrouter.master,
zebra_gr_route_stale_delete_timer_expiry, info,
0);
event_execute(zrouter.master,
zebra_gr_route_stale_delete_timer_expiry, info,
0);
}
}