diff options
author | John Lo <loj@cisco.com> | 2017-09-23 08:59:58 -0400 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-09-25 16:07:37 +0000 |
commit | 7e9743aef924093c9c25bdf445637434c190d31a (patch) | |
tree | 74367e3929a946465d9644ede6a21bd32ee197e5 /src/vlibmemory | |
parent | 905c14af2b1464840cea201daed005cb30513683 (diff) |
Fix sending GARP/NA on Bonded Interface Active/Backup Link Up/Down
For bonded interface in Active/Backup mode (mode 1), we need to
send a GARP/NA packet, if IP address is present, on slave link
state change to up or down to help with route convergence. The
callback from DPDK happens in a separate thread so we need to make
sure RPC call is used to signal the send_garp_na process in the
main thread. Also need to fix DPDK polling so the slave links are
not polled.
Change-Id: If5fd8ea2d28c54dd28726ac403ad366386ce9651
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r-- | src/vlibmemory/memory_vlib.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/vlibmemory/memory_vlib.c b/src/vlibmemory/memory_vlib.c index b6b87529375..77959e6d366 100644 --- a/src/vlibmemory/memory_vlib.c +++ b/src/vlibmemory/memory_vlib.c @@ -1452,8 +1452,9 @@ vl_api_rpc_call_reply_t_handler (vl_api_rpc_call_reply_t * mp) clib_warning ("unimplemented"); } -void -vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length) +always_inline void +vl_api_rpc_call_main_thread_inline (void *fp, u8 * data, u32 data_length, + u8 force_rpc) { vl_api_rpc_call_t *mp; api_main_t *am = &api_main; @@ -1461,7 +1462,7 @@ vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length) unix_shared_memory_queue_t *q; /* Main thread: call the function directly */ - if (vlib_get_thread_index () == 0) + if ((force_rpc == 0) && (vlib_get_thread_index () == 0)) { vlib_main_t *vm = vlib_get_main (); void (*call_fp) (void *); @@ -1507,6 +1508,29 @@ vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length) pthread_mutex_unlock (&q->mutex); } +/* + * Check if called from worker threads. + * If so, make rpc call of fp through shmem. + * Otherwise, call fp directly + */ +void +vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length) +{ + vl_api_rpc_call_main_thread_inline (fp, data, data_length, /*force_rpc */ + 0); +} + +/* + * Always make rpc call of fp through shmem, useful for calling from threads + * not setup as worker threads, such as DPDK callback thread + */ +void +vl_api_force_rpc_call_main_thread (void *fp, u8 * data, u32 data_length) +{ + vl_api_rpc_call_main_thread_inline (fp, data, data_length, /*force_rpc */ + 1); +} + static void vl_api_trace_plugin_msg_ids_t_handler (vl_api_trace_plugin_msg_ids_t * mp) { |