From 130c8f744801d71982e30993b884c76d9d97d309 Mon Sep 17 00:00:00 2001 From: Michal Mazur Date: Wed, 31 Jan 2018 22:01:33 +0100 Subject: plugins: odp: Fix minor bugs 1) Remove function vlib_buffer_set_known_state because it is not multi-thread safe. 2) Stop all worker threads before deleting interfaces. 3) Fix style of odp_packet_exit function. 4) Fix infinite loop in odp_config. Change-Id: I4463b4e416e440ac326ddaac8e46a95d17b202d2 Signed-off-by: Michal Mazur --- src/plugins/odp/buffer.c | 3 --- src/plugins/odp/odp_packet.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/odp/buffer.c b/src/plugins/odp/buffer.c index 63d76918..ae6679ae 100644 --- a/src/plugins/odp/buffer.c +++ b/src/plugins/odp/buffer.c @@ -150,9 +150,6 @@ fill_free_list (vlib_main_t * vm, vec_add1_aligned (fl->buffers, bi, CLIB_CACHE_LINE_BYTES); - if (CLIB_DEBUG > 0) - vlib_buffer_set_known_state (vm, bi, VLIB_BUFFER_KNOWN_FREE); - /* Initialize all new buffers. */ vlib_buffer_init_for_free_list (b, fl); if (fl->buffer_init_function) diff --git a/src/plugins/odp/odp_packet.c b/src/plugins/odp/odp_packet.c index c53dcd52..840a7e91 100755 --- a/src/plugins/odp/odp_packet.c +++ b/src/plugins/odp/odp_packet.c @@ -394,6 +394,8 @@ odp_config (vlib_main_t * vm, unformat_input_t * input) char *param = NULL; unformat_input_t sub_input; + unformat_skip_white_space (input); + while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "rx-sched-wait %u", &rx_sched_wait)) @@ -558,18 +560,22 @@ odp_packet_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (odp_packet_init); static clib_error_t * -odp_packet_exit (vlib_main_t *vm) +odp_packet_exit (vlib_main_t * vm) { odp_packet_main_t *om = odp_packet_main; odp_packet_if_t *port; + vlib_worker_thread_barrier_sync (vm); + + /* *INDENT-OFF* */ pool_foreach (port, om->interfaces, ({ odp_packet_delete_if (vm, port->host_if_name); })); + /* *INDENT-ON* */ odp_pool_destroy (om->pool); - odp_shm_free (odp_shm_lookup("odp_packet_main")); + odp_shm_free (odp_shm_lookup ("odp_packet_main")); odp_packet_main = 0x0; return 0; -- cgit 1.2.3-korg