dpdk: remove support for dpdk 16.04
[vpp.git] / vpp / vpp-api / api.c
index 33f8770..9af8dbc 100644 (file)
 #include <vnet/dpo/receive_dpo.h>
 #include <vnet/dpo/lookup_dpo.h>
 #include <vnet/dpo/classify_dpo.h>
+#include <vnet/dpo/ip_null_dpo.h>
 
 #define f64_endian(a)
 #define f64_print(a,b)
@@ -1032,6 +1033,8 @@ static int
 add_del_route_t_handler (u8 is_multipath,
                         u8 is_add,
                         u8 is_drop,
+                        u8 is_unreach,
+                        u8 is_prohibit,
                         u8 is_local,
                         u8 is_classify,
                         u32 classify_table_index,
@@ -1046,7 +1049,6 @@ add_del_route_t_handler (u8 is_multipath,
                         u32 next_hop_weight, u32 next_hop_out_label)
 {
   vnet_classify_main_t *cm = &vnet_classify_main;
-  fib_protocol_t proto = prefix->fp_proto;
   stats_main_t *sm = &stats_main;
 
   if (is_multipath)
@@ -1091,22 +1093,29 @@ add_del_route_t_handler (u8 is_multipath,
 
   dslock (sm, 1 /* release hint */ , 2 /* tag */ );
 
-  if (is_drop || is_local || is_classify)
+  if (is_drop || is_local || is_classify || is_unreach || is_prohibit)
     {
       /*
        * special route types that link directly to the adj
        */
       if (is_add)
        {
-         dpo_id_t dpo = DPO_NULL;
+         dpo_id_t dpo = DPO_INVALID;
          dpo_proto_t dproto;
 
          dproto = fib_proto_to_dpo (prefix->fp_proto);
 
          if (is_drop)
-           dpo_copy (&dpo, drop_dpo_get (dproto));
+           ip_null_dpo_add_and_lock (dproto, IP_NULL_ACTION_NONE, &dpo);
          else if (is_local)
            receive_dpo_add_or_lock (dproto, ~0, NULL, &dpo);
+         else if (is_unreach)
+           ip_null_dpo_add_and_lock (dproto,
+                                     IP_NULL_ACTION_SEND_ICMP_UNREACH, &dpo);
+         else if (is_prohibit)
+           ip_null_dpo_add_and_lock (dproto,
+                                     IP_NULL_ACTION_SEND_ICMP_PROHIBIT,
+                                     &dpo);
          else if (is_classify)
            {
              if (pool_is_free_index (cm->tables,
@@ -1116,7 +1125,7 @@ add_del_route_t_handler (u8 is_multipath,
                  return VNET_API_ERROR_NO_SUCH_TABLE;
                }
 
-             dpo_set (&dpo, DPO_CLASSIFY, proto,
+             dpo_set (&dpo, DPO_CLASSIFY, dproto,
                       classify_dpo_create (prefix->fp_proto,
                                            ntohl (classify_table_index)));
            }
@@ -1126,10 +1135,10 @@ add_del_route_t_handler (u8 is_multipath,
              return VNET_API_ERROR_NO_SUCH_TABLE;
            }
 
-         fib_table_entry_special_dpo_add (fib_index,
-                                          prefix,
-                                          FIB_SOURCE_API,
-                                          FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
+         fib_table_entry_special_dpo_update (fib_index,
+                                             prefix,
+                                             FIB_SOURCE_API,
+                                             FIB_ENTRY_FLAG_EXCLUSIVE, &dpo);
          dpo_reset (&dpo);
        }
       else
@@ -1256,7 +1265,17 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
   memset (&nh, 0, sizeof (nh));
   memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4));
 
-  return (add_del_route_t_handler (mp->is_multipath, mp->is_add, mp->is_drop, mp->is_local, mp->is_classify, mp->classify_table_index, mp->is_resolve_host, mp->is_resolve_attached, fib_index, &pfx, 1,       // is_ip4
+  return (add_del_route_t_handler (mp->is_multipath,
+                                  mp->is_add,
+                                  mp->is_drop,
+                                  mp->is_unreach,
+                                  mp->is_prohibit,
+                                  mp->is_local,
+                                  mp->is_classify,
+                                  mp->classify_table_index,
+                                  mp->is_resolve_host,
+                                  mp->is_resolve_attached,
+                                  fib_index, &pfx, 1,
                                   &nh,
                                   ntohl (mp->next_hop_sw_if_index),
                                   next_hop_fib_index,
@@ -1291,7 +1310,17 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
   memset (&nh, 0, sizeof (nh));
   memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6));
 
-  return (add_del_route_t_handler (mp->is_multipath, mp->is_add, mp->is_drop, mp->is_local, mp->is_classify, mp->classify_table_index, mp->is_resolve_host, mp->is_resolve_attached, fib_index, &pfx, 0,       // is_ip4
+  return (add_del_route_t_handler (mp->is_multipath,
+                                  mp->is_add,
+                                  mp->is_drop,
+                                  mp->is_unreach,
+                                  mp->is_prohibit,
+                                  mp->is_local,
+                                  mp->is_classify,
+                                  mp->classify_table_index,
+                                  mp->is_resolve_host,
+                                  mp->is_resolve_attached,
+                                  fib_index, &pfx, 0,
                                   &nh, ntohl (mp->next_hop_sw_if_index),
                                   next_hop_fib_index,
                                   mp->next_hop_weight,
@@ -1348,6 +1377,8 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
     memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
 
   return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0,      // mp->is_drop,
+                                  0,   // mp->is_unreach,
+                                  0,   // mp->is_prohibit,
                                   0,   // mp->is_local,
                                   mp->mr_is_classify,
                                   mp->mr_classify_table_index,
@@ -4169,15 +4200,10 @@ vl_api_create_vhost_user_if_t_handler (vl_api_create_vhost_user_if_t * mp)
   vnet_main_t *vnm = vnet_get_main ();
   vlib_main_t *vm = vlib_get_main ();
 
-#if DPDK > 0 && DPDK_VHOST_USER
-  rv = dpdk_vhost_user_create_if (
-#else
-  rv = vhost_user_create_if (
-#endif
-                             vnm, vm, (char *) mp->sock_filename,
-                             mp->is_server, &sw_if_index, (u64) ~ 0,
-                             mp->renumber, ntohl (mp->custom_dev_instance),
-                             (mp->use_custom_mac) ? mp->mac_address : NULL);
+  rv = vhost_user_create_if (vnm, vm, (char *) mp->sock_filename,
+                            mp->is_server, &sw_if_index, (u64) ~ 0,
+                            mp->renumber, ntohl (mp->custom_dev_instance),
+                            (mp->use_custom_mac) ? mp->mac_address : NULL);
 
   /* *INDENT-OFF* */
   REPLY_MACRO2(VL_API_CREATE_VHOST_USER_IF_REPLY,
@@ -4197,14 +4223,9 @@ vl_api_modify_vhost_user_if_t_handler (vl_api_modify_vhost_user_if_t * mp)
   vnet_main_t *vnm = vnet_get_main ();
   vlib_main_t *vm = vlib_get_main ();
 
-#if DPDK > 0 && DPDK_VHOST_USER
-  rv = dpdk_vhost_user_modify_if (
-#else
-  rv = vhost_user_modify_if (
-#endif
-                             vnm, vm, (char *) mp->sock_filename,
-                             mp->is_server, sw_if_index, (u64) ~ 0,
-                             mp->renumber, ntohl (mp->custom_dev_instance));
+  rv = vhost_user_modify_if (vnm, vm, (char *) mp->sock_filename,
+                            mp->is_server, sw_if_index, (u64) ~ 0,
+                            mp->renumber, ntohl (mp->custom_dev_instance));
   REPLY_MACRO (VL_API_MODIFY_VHOST_USER_IF_REPLY);
 }
 
@@ -4219,11 +4240,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
   vnet_main_t *vnm = vnet_get_main ();
   vlib_main_t *vm = vlib_get_main ();
 
-#if DPDK > 0 && DPDK_VHOST_USER
-  rv = dpdk_vhost_user_delete_if (vnm, vm, sw_if_index);
-#else
   rv = vhost_user_delete_if (vnm, vm, sw_if_index);
-#endif
 
   REPLY_MACRO (VL_API_DELETE_VHOST_USER_IF_REPLY);
   if (!rv)
@@ -4287,11 +4304,7 @@ static void
   if (q == 0)
     return;
 
-#if DPDK > 0 && DPDK_VHOST_USER
-  rv = dpdk_vhost_user_dump_ifs (vnm, vm, &ifaces);
-#else
   rv = vhost_user_dump_ifs (vnm, vm, &ifaces);
-#endif
   if (rv)
     return;