From ce1aae4e88d8ed2c73e8213115cf9f3a4e37370f Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Wed, 4 Jan 2017 10:42:25 +0100 Subject: LISP: make data plane programming thread safe Change-Id: I4b949e606fa3969d4c03dc6e753a2546be6329cf Signed-off-by: Filip Tehlar --- src/vnet/lisp-cp/control.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/vnet') diff --git a/src/vnet/lisp-cp/control.c b/src/vnet/lisp-cp/control.c index ad7a570192d..6a00cb9e44b 100644 --- a/src/vnet/lisp-cp/control.c +++ b/src/vnet/lisp-cp/control.c @@ -518,6 +518,35 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index) fe - lcm->fwd_entry_pool); } +typedef struct +{ + u32 si; + u32 di; +} fwd_entry_mt_arg_t; + +static void * +dp_add_fwd_entry_thread_fn (void *arg) +{ + fwd_entry_mt_arg_t *a = arg; + lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); + dp_add_fwd_entry (lcm, a->si, a->di); + return 0; +} + +static int +dp_add_fwd_entry_from_mt (u32 si, u32 di) +{ + fwd_entry_mt_arg_t a; + + memset (&a, 0, sizeof (a)); + a.si = si; + a.di = di; + + vl_api_rpc_call_main_thread (dp_add_fwd_entry_thread_fn, + (u8 *) & a, sizeof (a)); + return 0; +} + /** * Returns vector of adjacencies. * @@ -3950,7 +3979,7 @@ lisp_cp_lookup_inline (vlib_main_t * vm, &src); if (~0 != si) { - dp_add_fwd_entry (lcm, si, di); + dp_add_fwd_entry_from_mt (si, di); } } } -- cgit 1.2.3-korg