Add support for DPDK 18.05
[vpp.git] / src / vnet / interface_api.c
index b22cadd..9a1838f 100644 (file)
@@ -68,7 +68,8 @@ _(DELETE_SUBIF, delete_subif)                                   \
 _(CREATE_LOOPBACK, create_loopback)                            \
 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance)          \
 _(DELETE_LOOPBACK, delete_loopback)                             \
-_(INTERFACE_NAME_RENUMBER, interface_name_renumber)
+_(INTERFACE_NAME_RENUMBER, interface_name_renumber)             \
+_(COLLECT_DETAILED_INTERFACE_STATS, collect_detailed_interface_stats)
 
 static void
 vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
@@ -380,31 +381,16 @@ ip_table_bind (fib_protocol_t fproto,
       msrc = MFIB_SOURCE_CLI;
     }
 
-  /*
-   * This is temporary whilst I do the song and dance with the CSIT version
-   */
-  if (0 != table_id)
-    {
-      fib_index = fib_table_find_or_create_and_lock (fproto, table_id, src);
-      mfib_index =
-       mfib_table_find_or_create_and_lock (fproto, table_id, msrc);
-    }
-  else
-    {
-      fib_index = 0;
-      mfib_index = 0;
-    }
-
   /*
    * This if table does not exist = error is what we want in the end.
    */
-  /* fib_index = fib_table_find (fproto, table_id); */
-  /* mfib_index = mfib_table_find (fproto, table_id); */
+  fib_index = fib_table_find (fproto, table_id);
+  mfib_index = mfib_table_find (fproto, table_id);
 
-  /* if (~0 == fib_index || ~0 == mfib_index) */
-  /*   { */
-  /*     return (VNET_API_ERROR_NO_SUCH_FIB); */
-  /*   } */
+  if (~0 == fib_index || ~0 == mfib_index)
+    {
+      return (VNET_API_ERROR_NO_SUCH_FIB);
+    }
 
   if (FIB_PROTOCOL_IP6 == fproto)
     {
@@ -512,15 +498,6 @@ ip_table_bind (fib_protocol_t fproto,
       ip4_main.mfib_index_by_sw_if_index[sw_if_index] = mfib_index;
     }
 
-  /*
-   * Temporary. undo the locks from the find and create at the staart
-   */
-  if (0 != table_id)
-    {
-      fib_table_unlock (fib_index, fproto, src);
-      mfib_table_unlock (mfib_index, fproto, msrc);
-    }
-
   return (0);
 }
 
@@ -1169,6 +1146,20 @@ vl_api_delete_loopback_t_handler (vl_api_delete_loopback_t * mp)
   REPLY_MACRO (VL_API_DELETE_LOOPBACK_REPLY);
 }
 
+static void
+  vl_api_collect_detailed_interface_stats_t_handler
+  (vl_api_collect_detailed_interface_stats_t * mp)
+{
+  vl_api_collect_detailed_interface_stats_reply_t *rmp;
+  int rv = 0;
+
+  rv =
+    vnet_sw_interface_stats_collect_enable_disable (ntohl (mp->sw_if_index),
+                                                   mp->enable_disable);
+
+  REPLY_MACRO (VL_API_COLLECT_DETAILED_INTERFACE_STATS_REPLY);
+}
+
 /*
  * vpe_api_hookup
  * Add vpe's API message handlers to the table.