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>
vlib_process_t *p = vec_elt (nm->processes, n->runtime_index);
uword *h, t;
vlib_process_t *p = vec_elt (nm->processes, n->runtime_index);
uword *h, t;
+ /* Must be in main thread */
+ ASSERT (vlib_get_thread_index () == 0);
+
h = hash_get (p->event_type_index_by_type_opaque, type_opaque);
if (!h)
{
h = hash_get (p->event_type_index_by_type_opaque, type_opaque);
if (!h)
{
+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().
/*
* dhcp_client_for_us - server-to-client callback.
* Called from proxy_node.c:dhcp_proxy_to_client_input().
c->retry_count = 0;
c->next_transmit = 0; /* send right now... */
/* Poke the client process, which will send the request */
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));