Merge pull request #9728 from donaldsharp/null_thread

Null thread
This commit is contained in:
Russ White 2021-10-05 19:26:00 -04:00 committed by GitHub
commit 6018f0424e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 2 additions and 46 deletions

View File

@ -203,9 +203,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
/* Cancel GR scheduled */ /* Cancel GR scheduled */
thread_cancel(&(ei->t_distribute)); thread_cancel(&(ei->t_distribute));
/* schedule Graceful restart for interface in 10sec */ /* schedule Graceful restart for interface in 10sec */
e->t_distribute = NULL;
thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10, thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10,
&e->t_distribute); &ei->t_distribute);
} }
/* /*
@ -263,7 +262,6 @@ int eigrp_distribute_timer_process(struct thread *thread)
struct eigrp *eigrp; struct eigrp *eigrp;
eigrp = THREAD_ARG(thread); eigrp = THREAD_ARG(thread);
eigrp->t_distribute = NULL;
/* execute GR for whole process */ /* execute GR for whole process */
eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL); eigrp_update_send_process_GR(eigrp, EIGRP_GR_FILTER, NULL);

View File

@ -86,7 +86,6 @@ int eigrp_hello_timer(struct thread *thread)
struct eigrp_interface *ei; struct eigrp_interface *ei;
ei = THREAD_ARG(thread); ei = THREAD_ARG(thread);
ei->t_hello = NULL;
if (IS_DEBUG_EIGRP(0, TIMERS)) if (IS_DEBUG_EIGRP(0, TIMERS))
zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei), zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei),
@ -96,7 +95,6 @@ int eigrp_hello_timer(struct thread *thread)
eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL); eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL);
/* Hello timer set. */ /* Hello timer set. */
ei->t_hello = NULL;
thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello, thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello,
&ei->t_hello); &ei->t_hello);

View File

@ -265,7 +265,7 @@ int eigrp_if_up(struct eigrp_interface *ei)
/* Set multicast memberships appropriately for new state. */ /* Set multicast memberships appropriately for new state. */
eigrp_if_set_multicast(ei); eigrp_if_set_multicast(ei);
thread_add_event(master, eigrp_hello_timer, ei, (1), NULL); thread_add_event(master, eigrp_hello_timer, ei, (1), &ei->t_hello);
/*Prepare metrics*/ /*Prepare metrics*/
metric.bandwidth = eigrp_bandwidth_to_scaled(ei->params.bandwidth); metric.bandwidth = eigrp_bandwidth_to_scaled(ei->params.bandwidth);

View File

@ -340,8 +340,6 @@ int eigrp_write(struct thread *thread)
#endif /* WANT_EIGRP_WRITE_FRAGMENT */ #endif /* WANT_EIGRP_WRITE_FRAGMENT */
#define EIGRP_WRITE_IPHL_SHIFT 2 #define EIGRP_WRITE_IPHL_SHIFT 2
eigrp->t_write = NULL;
node = listhead(eigrp->oi_write_q); node = listhead(eigrp->oi_write_q);
assert(node); assert(node);
ei = listgetdata(node); ei = listgetdata(node);
@ -470,7 +468,6 @@ out:
/* If packets still remain in queue, call write thread. */ /* If packets still remain in queue, call write thread. */
if (!list_isempty(eigrp->oi_write_q)) { if (!list_isempty(eigrp->oi_write_q)) {
eigrp->t_write = NULL;
thread_add_write(master, eigrp_write, eigrp, eigrp->fd, thread_add_write(master, eigrp_write, eigrp, eigrp->fd,
&eigrp->t_write); &eigrp->t_write);
} }
@ -497,7 +494,6 @@ int eigrp_read(struct thread *thread)
eigrp = THREAD_ARG(thread); eigrp = THREAD_ARG(thread);
/* prepare for next packet. */ /* prepare for next packet. */
eigrp->t_read = NULL;
thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read);
stream_reset(eigrp->ibuf); stream_reset(eigrp->ibuf);
@ -1013,7 +1009,6 @@ int eigrp_unack_packet_retrans(struct thread *thread)
return eigrp_retrans_count_exceeded(ep, nbr); return eigrp_retrans_count_exceeded(ep, nbr);
/*Start retransmission timer*/ /*Start retransmission timer*/
ep->t_retrans_timer = NULL;
thread_add_timer(master, eigrp_unack_packet_retrans, nbr, thread_add_timer(master, eigrp_unack_packet_retrans, nbr,
EIGRP_PACKET_RETRANS_TIME, EIGRP_PACKET_RETRANS_TIME,
&ep->t_retrans_timer); &ep->t_retrans_timer);
@ -1049,7 +1044,6 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
return eigrp_retrans_count_exceeded(ep, nbr); return eigrp_retrans_count_exceeded(ep, nbr);
/*Start retransmission timer*/ /*Start retransmission timer*/
ep->t_retrans_timer = NULL;
thread_add_timer(master, eigrp_unack_multicast_packet_retrans, thread_add_timer(master, eigrp_unack_multicast_packet_retrans,
nbr, EIGRP_PACKET_RETRANS_TIME, nbr, EIGRP_PACKET_RETRANS_TIME,
&ep->t_retrans_timer); &ep->t_retrans_timer);

View File

@ -917,12 +917,10 @@ int eigrp_update_send_GR_thread(struct thread *thread)
/* get argument from thread */ /* get argument from thread */
nbr = THREAD_ARG(thread); nbr = THREAD_ARG(thread);
/* remove this thread pointer */ /* remove this thread pointer */
nbr->t_nbr_send_gr = NULL;
/* if there is packet waiting in queue, /* if there is packet waiting in queue,
* schedule this thread again with small delay */ * schedule this thread again with small delay */
if (nbr->retrans_queue->count > 0) { if (nbr->retrans_queue->count > 0) {
nbr->t_nbr_send_gr = NULL;
thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr,
10, &nbr->t_nbr_send_gr); 10, &nbr->t_nbr_send_gr);
return 0; return 0;
@ -934,7 +932,6 @@ int eigrp_update_send_GR_thread(struct thread *thread)
/* if it wasn't last chunk, schedule this thread again */ /* if it wasn't last chunk, schedule this thread again */
if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) { if (nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) {
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
nbr->t_nbr_send_gr = NULL;
} }
return 0; return 0;
@ -1003,7 +1000,6 @@ void eigrp_update_send_GR(struct eigrp_neighbor *nbr, enum GR_type gr_type,
nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST; nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST;
/* execute packet sending in thread */ /* execute packet sending in thread */
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0); thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
nbr->t_nbr_send_gr = NULL;
} }
/** /**

View File

@ -171,7 +171,6 @@ static struct eigrp *eigrp_new(uint16_t as, vrf_id_t vrf_id)
eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1); eigrp->ibuf = stream_new(EIGRP_PACKET_MAX_LEN + 1);
eigrp->t_read = NULL;
thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read); thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read);
eigrp->oi_write_q = list_new(); eigrp->oi_write_q = list_new();

View File

@ -805,7 +805,6 @@ static int rip_interface_wakeup(struct thread *t)
ifp = THREAD_ARG(t); ifp = THREAD_ARG(t);
ri = ifp->info; ri = ifp->info;
ri->t_wakeup = NULL;
/* Join to multicast group. */ /* Join to multicast group. */
if (rip_multicast_join(ifp, ri->rip->sock) < 0) { if (rip_multicast_join(ifp, ri->rip->sock) < 0) {

View File

@ -95,7 +95,6 @@ static struct rip_peer *rip_peer_get(struct rip *rip, struct in_addr *addr)
} }
/* Update timeout thread. */ /* Update timeout thread. */
peer->t_timeout = NULL;
thread_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT, thread_add_timer(master, rip_peer_timeout, peer, RIP_PEER_TIMER_DEFAULT,
&peer->t_timeout); &peer->t_timeout);

View File

@ -142,7 +142,6 @@ static int rip_garbage_collect(struct thread *t)
struct route_node *rp; struct route_node *rp;
rinfo = THREAD_ARG(t); rinfo = THREAD_ARG(t);
rinfo->t_garbage_collect = NULL;
/* Off timeout timer. */ /* Off timeout timer. */
RIP_TIMER_OFF(rinfo->t_timeout); RIP_TIMER_OFF(rinfo->t_timeout);
@ -1744,7 +1743,6 @@ static int rip_read(struct thread *t)
/* Fetch socket then register myself. */ /* Fetch socket then register myself. */
sock = THREAD_FD(t); sock = THREAD_FD(t);
rip->t_read = NULL;
/* Add myself to tne next event */ /* Add myself to tne next event */
rip_event(rip, RIP_READ, sock); rip_event(rip, RIP_READ, sock);
@ -2545,9 +2543,6 @@ static int rip_update(struct thread *t)
{ {
struct rip *rip = THREAD_ARG(t); struct rip *rip = THREAD_ARG(t);
/* Clear timer pointer. */
rip->t_update = NULL;
if (IS_RIP_DEBUG_EVENT) if (IS_RIP_DEBUG_EVENT)
zlog_debug("update timer fire!"); zlog_debug("update timer fire!");
@ -2588,8 +2583,6 @@ static int rip_triggered_interval(struct thread *t)
{ {
struct rip *rip = THREAD_ARG(t); struct rip *rip = THREAD_ARG(t);
rip->t_triggered_interval = NULL;
if (rip->trigger) { if (rip->trigger) {
rip->trigger = 0; rip->trigger = 0;
rip_triggered_update(t); rip_triggered_update(t);
@ -2603,9 +2596,6 @@ static int rip_triggered_update(struct thread *t)
struct rip *rip = THREAD_ARG(t); struct rip *rip = THREAD_ARG(t);
int interval; int interval;
/* Clear thred pointer. */
rip->t_triggered_update = NULL;
/* Cancel interval timer. */ /* Cancel interval timer. */
RIP_TIMER_OFF(rip->t_triggered_interval); RIP_TIMER_OFF(rip->t_triggered_interval);
rip->trigger = 0; rip->trigger = 0;
@ -2628,7 +2618,6 @@ static int rip_triggered_update(struct thread *t)
update is triggered when the timer expires. */ update is triggered when the timer expires. */
interval = (frr_weak_random() % 5) + 1; interval = (frr_weak_random() % 5) + 1;
rip->t_triggered_interval = NULL;
thread_add_timer(master, rip_triggered_interval, rip, interval, thread_add_timer(master, rip_triggered_interval, rip, interval,
&rip->t_triggered_interval); &rip->t_triggered_interval);
@ -2834,7 +2823,6 @@ void rip_event(struct rip *rip, enum rip_event event, int sock)
switch (event) { switch (event) {
case RIP_READ: case RIP_READ:
rip->t_read = NULL;
thread_add_read(master, rip_read, rip, sock, &rip->t_read); thread_add_read(master, rip_read, rip, sock, &rip->t_read);
break; break;
case RIP_UPDATE_EVENT: case RIP_UPDATE_EVENT:

View File

@ -618,7 +618,6 @@ static int ripng_interface_wakeup(struct thread *t)
ifp = THREAD_ARG(t); ifp = THREAD_ARG(t);
ri = ifp->info; ri = ifp->info;
ri->t_wakeup = NULL;
/* Join to multicast group. */ /* Join to multicast group. */
if (ripng_multicast_join(ifp, ri->ripng->sock) < 0) { if (ripng_multicast_join(ifp, ri->ripng->sock) < 0) {

View File

@ -429,7 +429,6 @@ static int ripng_garbage_collect(struct thread *t)
struct agg_node *rp; struct agg_node *rp;
rinfo = THREAD_ARG(t); rinfo = THREAD_ARG(t);
rinfo->t_garbage_collect = NULL;
/* Off timeout timer. */ /* Off timeout timer. */
RIPNG_TIMER_OFF(rinfo->t_timeout); RIPNG_TIMER_OFF(rinfo->t_timeout);
@ -1320,7 +1319,6 @@ static int ripng_read(struct thread *thread)
/* Fetch thread data and set read pointer to empty for event /* Fetch thread data and set read pointer to empty for event
managing. `sock' sould be same as ripng->sock. */ managing. `sock' sould be same as ripng->sock. */
sock = THREAD_FD(thread); sock = THREAD_FD(thread);
ripng->t_read = NULL;
/* Add myself to the next event. */ /* Add myself to the next event. */
ripng_event(ripng, RIPNG_READ, sock); ripng_event(ripng, RIPNG_READ, sock);
@ -1418,9 +1416,6 @@ static int ripng_update(struct thread *t)
struct interface *ifp; struct interface *ifp;
struct ripng_interface *ri; struct ripng_interface *ri;
/* Clear update timer thread. */
ripng->t_update = NULL;
/* Logging update event. */ /* Logging update event. */
if (IS_RIPNG_DEBUG_EVENT) if (IS_RIPNG_DEBUG_EVENT)
zlog_debug("RIPng update timer expired!"); zlog_debug("RIPng update timer expired!");
@ -1469,8 +1464,6 @@ static int ripng_triggered_interval(struct thread *t)
{ {
struct ripng *ripng = THREAD_ARG(t); struct ripng *ripng = THREAD_ARG(t);
ripng->t_triggered_interval = NULL;
if (ripng->trigger) { if (ripng->trigger) {
ripng->trigger = 0; ripng->trigger = 0;
ripng_triggered_update(t); ripng_triggered_update(t);
@ -1486,8 +1479,6 @@ int ripng_triggered_update(struct thread *t)
struct ripng_interface *ri; struct ripng_interface *ri;
int interval; int interval;
ripng->t_triggered_update = NULL;
/* Cancel interval timer. */ /* Cancel interval timer. */
thread_cancel(&ripng->t_triggered_interval); thread_cancel(&ripng->t_triggered_interval);
ripng->trigger = 0; ripng->trigger = 0;
@ -1525,7 +1516,6 @@ int ripng_triggered_update(struct thread *t)
update is triggered when the timer expires. */ update is triggered when the timer expires. */
interval = (frr_weak_random() % 5) + 1; interval = (frr_weak_random() % 5) + 1;
ripng->t_triggered_interval = NULL;
thread_add_timer(master, ripng_triggered_interval, ripng, interval, thread_add_timer(master, ripng_triggered_interval, ripng, interval,
&ripng->t_triggered_interval); &ripng->t_triggered_interval);
@ -1942,7 +1932,6 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock)
/* Update timer jitter. */ /* Update timer jitter. */
jitter = ripng_update_jitter(ripng->update_time); jitter = ripng_update_jitter(ripng->update_time);
ripng->t_update = NULL;
thread_add_timer(master, ripng_update, ripng, thread_add_timer(master, ripng_update, ripng,
sock ? 2 : ripng->update_time + jitter, sock ? 2 : ripng->update_time + jitter,
&ripng->t_update); &ripng->t_update);

View File

@ -137,10 +137,7 @@ struct ripng {
/* RIPng threads. */ /* RIPng threads. */
struct thread *t_read; struct thread *t_read;
struct thread *t_write;
struct thread *t_update; struct thread *t_update;
struct thread *t_garbage;
struct thread *t_zebra;
/* Triggered update hack. */ /* Triggered update hack. */
int trigger; int trigger;