ipsec: api cleanup
[vpp.git] / src / vnet / interface.c
index 1d59a96..44ea52a 100644 (file)
@@ -43,6 +43,7 @@
 #include <vnet/adj/adj_mcast.h>
 #include <vnet/ip/ip.h>
 #include <vnet/interface/rx_queue_funcs.h>
+#include <vnet/interface/tx_queue_funcs.h>
 
 /* *INDENT-OFF* */
 VLIB_REGISTER_LOG_CLASS (if_default_log, static) = {
@@ -958,7 +959,7 @@ vnet_register_interface (vnet_main_t * vnm,
       r.type = VLIB_NODE_TYPE_INTERNAL;
       r.runtime_data = &rt;
       r.runtime_data_bytes = sizeof (rt);
-      r.scalar_size = 0;
+      r.scalar_size = sizeof (vnet_hw_if_tx_frame_t);
       r.vector_size = sizeof (u32);
 
       r.flags = VLIB_NODE_FLAG_IS_OUTPUT;
@@ -992,7 +993,6 @@ vnet_register_interface (vnet_main_t * vnm,
        static char *e[] = {
          "interface is down",
          "interface is deleted",
-         "no buffers to segment GSO",
        };
 
        r.n_errors = ARRAY_LEN (e);
@@ -1062,8 +1062,9 @@ vnet_delete_hw_interface (vnet_main_t * vnm, u32 hw_if_index)
   /* Call delete callbacks. */
   call_hw_interface_add_del_callbacks (vnm, hw_if_index, /* is_create */ 0);
 
-  /* delete rx queues */
+  /* delete rx & tx queues */
   vnet_hw_if_unregister_all_rx_queues (vnm, hw_if_index);
+  vnet_hw_if_unregister_all_tx_queues (vnm, hw_if_index);
   vnet_hw_if_update_runtime_data (vnm, hw_if_index);
 
   /* Delete any sub-interfaces. */
@@ -1407,6 +1408,8 @@ vnet_interface_init (vlib_main_t * vm)
 
   im->rxq_index_by_hw_if_index_and_queue_id =
     hash_create_mem (0, sizeof (u64), sizeof (u32));
+  im->txq_index_by_hw_if_index_and_queue_id =
+    hash_create_mem (0, sizeof (u64), sizeof (u32));
   im->sw_if_index_by_sup_and_sub = hash_create_mem (0, sizeof (u64),
                                                    sizeof (uword));
   {
@@ -1636,13 +1639,20 @@ vnet_sw_interface_update_unnumbered (u32 unnumbered_sw_if_index,
     }
   else
     {
-      si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED);
-      si->unnumbered_sw_if_index = (u32) ~ 0;
+      /*
+       * Unless the interface is actually unnumbered, don't
+       * smash e.g. if_address_pool_index_by_sw_if_index
+       */
+      if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED)
+       {
+         si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED);
+         si->unnumbered_sw_if_index = (u32) ~0;
 
-      ip4_main.lookup_main.if_address_pool_index_by_sw_if_index
-       [unnumbered_sw_if_index] = ~0;
-      ip6_main.lookup_main.if_address_pool_index_by_sw_if_index
-       [unnumbered_sw_if_index] = ~0;
+         ip4_main.lookup_main
+           .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
+         ip6_main.lookup_main
+           .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
+       }
     }
 
   if (was_unnum != (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED))