ip: fix fib and mfib locks
[vpp.git] / src / plugins / unittest / mfib_test.c
index 764e183..0faa20c 100644 (file)
@@ -75,7 +75,7 @@ static u8 * format_test_interface_name (u8 * s, va_list * args)
   return format (s, "test-eth%d", dev_instance);
 }
 
-static uword dummy_interface_tx (vlib_main_t * vm,
+static uword placeholder_interface_tx (vlib_main_t * vm,
                                  vlib_node_runtime_t * node,
                                  vlib_frame_t * frame)
 {
@@ -97,7 +97,7 @@ test_interface_admin_up_down (vnet_main_t * vnm,
 VNET_DEVICE_CLASS (test_interface_device_class,static) = {
   .name = "Test interface",
   .format_device_name = format_test_interface_name,
-  .tx_function = dummy_interface_tx,
+  .tx_function = placeholder_interface_tx,
   .admin_up_down_function = test_interface_admin_up_down,
 };
 
@@ -139,17 +139,9 @@ mfib_test_mk_intf (u32 ninterfaces)
                                             VNET_HW_INTERFACE_FLAG_LINK_UP);
         tm->hw[i] = vnet_get_hw_interface(vnet_get_main(),
                                           tm->hw_if_indicies[i]);
-        vec_validate (ip4_main.fib_index_by_sw_if_index,
-                      tm->hw[i]->sw_if_index);
-        vec_validate (ip6_main.fib_index_by_sw_if_index,
-                      tm->hw[i]->sw_if_index);
         ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
         ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
 
-        vec_validate (ip4_main.mfib_index_by_sw_if_index,
-                      tm->hw[i]->sw_if_index);
-        vec_validate (ip6_main.mfib_index_by_sw_if_index,
-                      tm->hw[i]->sw_if_index);
         ip4_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
         ip6_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0;
 
@@ -804,7 +796,7 @@ mfib_test_i (fib_protocol_t PROTO,
     MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index));
 
     /*
-     * remove 
+     * remove
      */
     /* mfib_table_entry_path_remove(fib_index, */
     /*                              pfx_s_g, */
@@ -824,7 +816,7 @@ mfib_test_i (fib_protocol_t PROTO,
     /* MFIB_TEST_NS(!mfib_test_entry_no_itf(mfei, tm->hw[3]->sw_if_index)); */
 
     /*
-     * remove the last path and the accpeting only interface, 
+     * remove the last path and the accepting only interface,
      * the entry still has flags so it remains
      */
     vec_reset_length(two_paths);
@@ -1201,9 +1193,7 @@ mfib_test_i (fib_protocol_t PROTO,
      * MPLS enable an interface so we get the MPLS table created
      */
     mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API, NULL);
-    mpls_sw_interface_enable_disable(&mpls_main,
-                                     tm->hw[0]->sw_if_index,
-                                     1, 0);
+    mpls_sw_interface_enable_disable (&mpls_main, tm->hw[0]->sw_if_index, 1);
 
     lfei = fib_table_entry_update_one_path(0, // default MPLS Table
                                            &pfx_3500,
@@ -1299,9 +1289,7 @@ mfib_test_i (fib_protocol_t PROTO,
     /*
      * MPLS disable the interface
      */
-    mpls_sw_interface_enable_disable(&mpls_main,
-                                     tm->hw[0]->sw_if_index,
-                                     0, 0);
+    mpls_sw_interface_enable_disable (&mpls_main, tm->hw[0]->sw_if_index, 0);
     mpls_table_delete(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
 
     /*