summaryrefslogtreecommitdiffstats
path: root/src/plugins/lacp/lacp.c
diff options
context:
space:
mode:
authorElias Rudberg <elias.rudberg@bahnhof.net>2020-05-07 14:29:21 +0200
committerElias Rudberg <elias.rudberg@bahnhof.net>2020-05-07 14:29:21 +0200
commit92e1b83a39458f98ff649883334b153f03af603b (patch)
treefe7a6accac254a3151081b5fccc27c7933d9e273 /src/plugins/lacp/lacp.c
parenta1e03d4da71a2452c1e5da399d96c51f1b487cad (diff)
lacp: fix regarding vm arg for vlib_time_now calls
Use thread-specific vlib_main_t *vm pointers to avoid problems with different threads accessing the same vlib_main_t data structure. This avoids assertion failure when vlib_time_now() is called with a vm corresponding to a different thread. Type: fix Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net> Change-Id: I359596ecff86e03d57aa8d2330f77bf9a913485f
Diffstat (limited to 'src/plugins/lacp/lacp.c')
-rw-r--r--src/plugins/lacp/lacp.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/lacp/lacp.c b/src/plugins/lacp/lacp.c
index e789de52911..01d8e7b25e0 100644
--- a/src/plugins/lacp/lacp.c
+++ b/src/plugins/lacp/lacp.c
@@ -42,7 +42,7 @@ lacp_fill_pdu (lacp_pdu_t * lacpdu, slave_if_t * sif)
* send a lacp pkt on an ethernet interface
*/
static void
-lacp_send_ethernet_lacp_pdu (slave_if_t * sif)
+lacp_send_ethernet_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
{
lacp_main_t *lm = &lacp_main;
u32 *to_next;
@@ -51,7 +51,6 @@ lacp_send_ethernet_lacp_pdu (slave_if_t * sif)
u32 bi0;
vlib_buffer_t *b0;
vlib_frame_t *f;
- vlib_main_t *vm = lm->vlib_main;
vnet_main_t *vnm = lm->vnet_main;
/*
@@ -90,7 +89,7 @@ lacp_send_ethernet_lacp_pdu (slave_if_t * sif)
vlib_put_frame_to_node (vm, hw->output_node_index, f);
- sif->last_lacpdu_sent_time = vlib_time_now (lm->vlib_main);
+ sif->last_lacpdu_sent_time = vlib_time_now (vm);
sif->pdu_sent++;
}
@@ -127,7 +126,7 @@ lacp_send_lacp_pdu (vlib_main_t * vm, slave_if_t * sif)
switch (sif->packet_template_index)
{
case LACP_PACKET_TEMPLATE_ETHERNET:
- lacp_send_ethernet_lacp_pdu (sif);
+ lacp_send_ethernet_lacp_pdu (vm, sif);
break;
default:
@@ -139,7 +138,6 @@ void
lacp_periodic (vlib_main_t * vm)
{
bond_main_t *bm = &bond_main;
- lacp_main_t *lm = &lacp_main;
slave_if_t *sif;
bond_if_t *bif;
u8 actor_state, partner_state;
@@ -153,20 +151,20 @@ lacp_periodic (vlib_main_t * vm)
actor_state = sif->actor.state;
partner_state = sif->partner.state;
if (lacp_timer_is_running (sif->current_while_timer) &&
- lacp_timer_is_expired (lm->vlib_main, sif->current_while_timer))
+ lacp_timer_is_expired (vm, sif->current_while_timer))
{
lacp_machine_dispatch (&lacp_rx_machine, vm, sif,
LACP_RX_EVENT_TIMER_EXPIRED, &sif->rx_state);
}
if (lacp_timer_is_running (sif->periodic_timer) &&
- lacp_timer_is_expired (lm->vlib_main, sif->periodic_timer))
+ lacp_timer_is_expired (vm, sif->periodic_timer))
{
lacp_machine_dispatch (&lacp_ptx_machine, vm, sif,
LACP_PTX_EVENT_TIMER_EXPIRED, &sif->ptx_state);
}
if (lacp_timer_is_running (sif->wait_while_timer) &&
- lacp_timer_is_expired (lm->vlib_main, sif->wait_while_timer))
+ lacp_timer_is_expired (vm, sif->wait_while_timer))
{
sif->ready_n = 1;
lacp_stop_timer (&sif->wait_while_timer);