aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2017-01-04 10:42:25 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-01-04 20:56:00 +0000
commitce1aae4e88d8ed2c73e8213115cf9f3a4e37370f (patch)
tree234bba753c10fc84db58387ce1cb73502d9a52c1
parenta90ba9d3d0daf583f225617e57252f172e99df21 (diff)
LISP: make data plane programming thread safe
Change-Id: I4b949e606fa3969d4c03dc6e753a2546be6329cf Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
-rw-r--r--src/vnet/lisp-cp/control.c31
1 files changed, 30 insertions, 1 deletions
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);
}
}
}