plugins: odp: Fix minor bugs 70/10370/2
authorMichal Mazur <[email protected]>
Wed, 31 Jan 2018 21:01:33 +0000 (22:01 +0100)
committerMichal Mazur <[email protected]>
Thu, 1 Feb 2018 14:42:54 +0000 (15:42 +0100)
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 <[email protected]>
src/plugins/odp/buffer.c
src/plugins/odp/odp_packet.c

index 63d7691..ae6679a 100644 (file)
@@ -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)
index c53dcd5..840a7e9 100755 (executable)
@@ -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;