mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 00:41:20 +00:00
eigrpd: spatch thread_add* calls and macros
As described in previous commits Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
d9090d56c0
commit
c94671b82f
@ -181,7 +181,9 @@ eigrp_distribute_update (struct distribute *dist)
|
||||
thread_cancel(e->t_distribute);
|
||||
}
|
||||
/* schedule Graceful restart for whole process in 10sec */
|
||||
e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_process, e,(10));
|
||||
e->t_distribute = NULL;
|
||||
thread_add_timer(master, eigrp_distribute_timer_process, e, (10),
|
||||
&e->t_distribute);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -305,7 +307,9 @@ eigrp_distribute_update (struct distribute *dist)
|
||||
thread_cancel(ei->t_distribute);
|
||||
}
|
||||
/* schedule Graceful restart for interface in 10sec */
|
||||
e->t_distribute = thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10);
|
||||
e->t_distribute = NULL;
|
||||
thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10,
|
||||
&e->t_distribute);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -101,8 +101,9 @@ eigrp_hello_timer (struct thread *thread)
|
||||
eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL);
|
||||
|
||||
/* Hello timer set. */
|
||||
ei->t_hello = thread_add_timer(master, eigrp_hello_timer, ei,
|
||||
EIGRP_IF_PARAM(ei, v_hello));
|
||||
ei->t_hello = NULL;
|
||||
thread_add_timer(master, eigrp_hello_timer, ei, EIGRP_IF_PARAM(ei, v_hello),
|
||||
&ei->t_hello);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -713,9 +714,8 @@ eigrp_hello_send_ack (struct eigrp_neighbor *nbr)
|
||||
listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
|
||||
nbr->ei->on_write_q = 1;
|
||||
}
|
||||
if (nbr->ei->eigrp->t_write == NULL)
|
||||
nbr->ei->eigrp->t_write =
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd,
|
||||
&nbr->ei->eigrp->t_write);
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,13 +766,12 @@ eigrp_hello_send (struct eigrp_interface *ei, u_char flags, struct in_addr *nbr_
|
||||
{
|
||||
if(flags & EIGRP_HELLO_GRACEFUL_SHUTDOWN)
|
||||
{
|
||||
ei->eigrp->t_write =
|
||||
thread_execute(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
|
||||
thread_execute(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
ei->eigrp->t_write =
|
||||
thread_add_write(master, eigrp_write, ei->eigrp, ei->eigrp->fd);
|
||||
thread_add_write(master, eigrp_write, ei->eigrp, ei->eigrp->fd,
|
||||
&ei->eigrp->t_write);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ eigrp_if_up (struct eigrp_interface *ei)
|
||||
/* Set multicast memberships appropriately for new state. */
|
||||
eigrp_if_set_multicast (ei);
|
||||
|
||||
thread_add_event (master, eigrp_hello_timer, ei, (1));
|
||||
thread_add_event(master, eigrp_hello_timer, ei, (1), NULL);
|
||||
|
||||
/*Prepare metrics*/
|
||||
metric.bandwith = eigrp_bandwidth_to_scaled (EIGRP_IF_PARAM (ei,bandwidth));
|
||||
|
@ -298,16 +298,16 @@ eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
|
||||
{
|
||||
/*Reset Hold Down Timer for neighbor*/
|
||||
THREAD_OFF(nbr->t_holddown);
|
||||
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
|
||||
nbr->v_holddown);
|
||||
thread_add_timer(master, holddown_timer_expired, nbr,
|
||||
nbr->v_holddown, &nbr->t_holddown);
|
||||
break;
|
||||
}
|
||||
case EIGRP_NEIGHBOR_UP:
|
||||
{
|
||||
/*Reset Hold Down Timer for neighbor*/
|
||||
THREAD_OFF(nbr->t_holddown);
|
||||
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
|
||||
nbr->v_holddown);
|
||||
thread_add_timer(master, holddown_timer_expired, nbr,
|
||||
nbr->v_holddown, &nbr->t_holddown);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -448,8 +448,10 @@ eigrp_write (struct thread *thread)
|
||||
}
|
||||
|
||||
/* If packets still remain in queue, call write thread. */
|
||||
if (!list_isempty(eigrp->oi_write_q))
|
||||
eigrp->t_write = thread_add_write(master, eigrp_write, eigrp, eigrp->fd);
|
||||
if (!list_isempty(eigrp->oi_write_q)) {
|
||||
eigrp->t_write = NULL;
|
||||
thread_add_write(master, eigrp_write, eigrp, eigrp->fd, &eigrp->t_write);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -474,7 +476,8 @@ eigrp_read (struct thread *thread)
|
||||
eigrp = THREAD_ARG(thread);
|
||||
|
||||
/* prepare for next packet. */
|
||||
eigrp->t_read = thread_add_read(master, eigrp_read, eigrp, eigrp->fd);
|
||||
eigrp->t_read = NULL;
|
||||
thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read);
|
||||
|
||||
stream_reset(eigrp->ibuf);
|
||||
if (!(ibuf = eigrp_recv_packet(eigrp->fd, &ifp, eigrp->ibuf)))
|
||||
@ -846,8 +849,8 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
|
||||
eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
|
||||
|
||||
/*Start retransmission timer*/
|
||||
THREAD_TIMER_ON(master, ep->t_retrans_timer, eigrp_unack_packet_retrans,
|
||||
nbr, EIGRP_PACKET_RETRANS_TIME);
|
||||
thread_add_timer(master, eigrp_unack_packet_retrans, nbr,
|
||||
EIGRP_PACKET_RETRANS_TIME, &ep->t_retrans_timer);
|
||||
|
||||
/*Increment sequence number counter*/
|
||||
nbr->ei->eigrp->sequence_number++;
|
||||
@ -858,9 +861,8 @@ eigrp_send_packet_reliably (struct eigrp_neighbor *nbr)
|
||||
listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
|
||||
nbr->ei->on_write_q = 1;
|
||||
}
|
||||
if (nbr->ei->eigrp->t_write == NULL)
|
||||
nbr->ei->eigrp->t_write =
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd,
|
||||
&nbr->ei->eigrp->t_write);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1048,8 +1050,9 @@ eigrp_unack_packet_retrans (struct thread *thread)
|
||||
return eigrp_retrans_count_exceeded(ep, nbr);
|
||||
|
||||
/*Start retransmission timer*/
|
||||
ep->t_retrans_timer =
|
||||
thread_add_timer(master, eigrp_unack_packet_retrans, nbr,EIGRP_PACKET_RETRANS_TIME);
|
||||
ep->t_retrans_timer = NULL;
|
||||
thread_add_timer(master, eigrp_unack_packet_retrans, nbr, EIGRP_PACKET_RETRANS_TIME,
|
||||
&ep->t_retrans_timer);
|
||||
|
||||
/* Hook thread to write packet. */
|
||||
if (nbr->ei->on_write_q == 0)
|
||||
@ -1057,9 +1060,8 @@ eigrp_unack_packet_retrans (struct thread *thread)
|
||||
listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
|
||||
nbr->ei->on_write_q = 1;
|
||||
}
|
||||
if (nbr->ei->eigrp->t_write == NULL)
|
||||
nbr->ei->eigrp->t_write =
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd,
|
||||
&nbr->ei->eigrp->t_write);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1086,8 +1088,9 @@ eigrp_unack_multicast_packet_retrans (struct thread *thread)
|
||||
return eigrp_retrans_count_exceeded(ep, nbr);
|
||||
|
||||
/*Start retransmission timer*/
|
||||
ep->t_retrans_timer =
|
||||
thread_add_timer(master, eigrp_unack_multicast_packet_retrans, nbr,EIGRP_PACKET_RETRANS_TIME);
|
||||
ep->t_retrans_timer = NULL;
|
||||
thread_add_timer(master, eigrp_unack_multicast_packet_retrans, nbr, EIGRP_PACKET_RETRANS_TIME,
|
||||
&ep->t_retrans_timer);
|
||||
|
||||
/* Hook thread to write packet. */
|
||||
if (nbr->ei->on_write_q == 0)
|
||||
@ -1095,9 +1098,8 @@ eigrp_unack_multicast_packet_retrans (struct thread *thread)
|
||||
listnode_add(nbr->ei->eigrp->oi_write_q, nbr->ei);
|
||||
nbr->ei->on_write_q = 1;
|
||||
}
|
||||
if (nbr->ei->eigrp->t_write == NULL)
|
||||
nbr->ei->eigrp->t_write =
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd);
|
||||
thread_add_write(master, eigrp_write, nbr->ei->eigrp, nbr->ei->eigrp->fd,
|
||||
&nbr->ei->eigrp->t_write);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1046,7 +1046,9 @@ eigrp_update_send_GR_thread(struct thread *thread)
|
||||
* schedule this thread again with small delay */
|
||||
if(nbr->retrans_queue->count > 0)
|
||||
{
|
||||
nbr->t_nbr_send_gr = thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10);
|
||||
nbr->t_nbr_send_gr = NULL;
|
||||
thread_add_timer_msec(master, eigrp_update_send_GR_thread, nbr, 10,
|
||||
&nbr->t_nbr_send_gr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1054,8 +1056,10 @@ eigrp_update_send_GR_thread(struct thread *thread)
|
||||
eigrp_update_send_GR_part(nbr);
|
||||
|
||||
/* if it wasn't last chunk, schedule this thread again */
|
||||
if(nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST)
|
||||
nbr->t_nbr_send_gr = thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
|
||||
if(nbr->nbr_gr_packet_type != EIGRP_PACKET_PART_LAST) {
|
||||
thread_execute(master, eigrp_update_send_GR_thread, nbr, 0);
|
||||
nbr->t_nbr_send_gr = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1115,7 +1119,8 @@ eigrp_update_send_GR (struct eigrp_neighbor *nbr, enum GR_type gr_type, struct v
|
||||
/* indicate, that this is first GR Update packet chunk */
|
||||
nbr->nbr_gr_packet_type = EIGRP_PACKET_PART_FIRST;
|
||||
/* execute packet sending in thread */
|
||||
nbr->t_nbr_send_gr = 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,7 +181,8 @@ eigrp_new (const char *AS)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
eigrp->t_read = thread_add_read(master, eigrp_read, eigrp, eigrp->fd);
|
||||
eigrp->t_read = NULL;
|
||||
thread_add_read(master, eigrp_read, eigrp, eigrp->fd, &eigrp->t_read);
|
||||
eigrp->oi_write_q = list_new();
|
||||
|
||||
eigrp->topology_table = eigrp_topology_new();
|
||||
|
Loading…
Reference in New Issue
Block a user