aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2017-09-19 21:45:10 -0400
committerDave Barach <openvpp@barachs.net>2017-09-20 11:50:49 +0000
commit609707ea530de6a0f9fa989b8269b973dd89174e (patch)
tree5d912ea898dc8d6c7383a62ef2a21e5669e7955c /src/vnet
parent1bfd37295f5cd332b7326923f1fbd5e0415829cd (diff)
Fix DHCP client so it works for worker threads
Fix dhcp_client_for_us() function to utilize rpc_call_main_thread to call vlib_process_signal_event() to ensure proper handling irrespective of it being called in main thread or worker thread. Added ASSERT to vlib_process_sinal.. path to make sure it is called in main thread. Change-Id: I4109cc049d8e4225d896ce492ce201011dc9c911 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/dhcp/client.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vnet/dhcp/client.c b/src/vnet/dhcp/client.c
index dd5e99f2b5f..5986438b85f 100644
--- a/src/vnet/dhcp/client.c
+++ b/src/vnet/dhcp/client.c
@@ -120,6 +120,17 @@ set_l2_rewrite (dhcp_client_main_t * dcm, dhcp_client_t * c)
0 /* broadcast */);
}
+void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
+
+static void
+dhcp_client_proc_callback (uword * client_index)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ ASSERT (vlib_get_thread_index () == 0);
+ vlib_process_signal_event (vm, dhcp_client_process_node.index,
+ EVENT_DHCP_CLIENT_WAKEUP, *client_index);
+}
+
/*
* dhcp_client_for_us - server-to-client callback.
* Called from proxy_node.c:dhcp_proxy_to_client_input().
@@ -251,8 +262,9 @@ int dhcp_client_for_us (u32 bi, vlib_buffer_t * b,
c->retry_count = 0;
c->next_transmit = 0; /* send right now... */
/* Poke the client process, which will send the request */
- vlib_process_signal_event (vm, dhcp_client_process_node.index,
- EVENT_DHCP_CLIENT_WAKEUP, c - dcm->clients);
+ uword client_id = c - dcm->clients;
+ vl_api_rpc_call_main_thread (dhcp_client_proc_callback,
+ (u8 *) &client_id, sizeof (uword));
break;
case DHCP_BOUND: