fib: Table Replace
[vpp.git] / src / vat / api_format.c
index 4603937..924d9c6 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <vat/vat.h>
+#include <vlib/pci/pci.h>
 #include <vpp/api/types.h>
 #include <vppinfra/socket.h>
 #include <vlibapi/api.h>
@@ -50,7 +51,6 @@
 #include <vnet/policer/policer.h>
 #include <vnet/policer/police.h>
 #include <vnet/mfib/mfib_types.h>
-#include <vnet/dhcp/dhcp_proxy.h>
 #include <vnet/bonding/node.h>
 #include <vnet/qos/qos_types.h>
 #include <vnet/ethernet/ethernet_types_api.h>
@@ -85,6 +85,8 @@
 #define __plugin_msg_base 0
 #include <vlibapi/vat_helper_macros.h>
 
+#include <vnet/format_fns.h>
+
 void vl_api_set_elog_main (elog_main_t * m);
 int vl_api_set_elog_trace_api_messages (int enable);
 
@@ -1027,6 +1029,8 @@ static void vl_api_sw_interface_details_t_handler_json
                             sizeof (mp->l2_address));
   vat_json_object_add_string_copy (node, "interface_name",
                                   mp->interface_name);
+  vat_json_object_add_string_copy (node, "interface_dev_type",
+                                  mp->interface_dev_type);
   vat_json_object_add_uint (node, "flags", mp->flags);
   vat_json_object_add_uint (node, "link_duplex", mp->link_duplex);
   vat_json_object_add_uint (node, "link_speed", mp->link_speed);
@@ -1999,6 +2003,49 @@ static void vl_api_bond_detach_slave_reply_t_handler_json
   vam->result_ready = 1;
 }
 
+static int
+api_sw_interface_set_bond_weight (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_sw_interface_set_bond_weight_t *mp;
+  u32 sw_if_index = ~0;
+  u32 weight = 0;
+  u8 weight_enter = 0;
+  int ret;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       ;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       ;
+      else if (unformat (i, "weight %u", &weight))
+       weight_enter = 1;
+      else
+       break;
+    }
+
+  if (sw_if_index == ~0)
+    {
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
+    }
+  if (weight_enter == 0)
+    {
+      errmsg ("missing valid weight");
+      return -99;
+    }
+
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_BOND_WEIGHT, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->weight = ntohl (weight);
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
 static void vl_api_sw_interface_bond_details_t_handler
   (vl_api_sw_interface_bond_details_t * mp)
 {
@@ -2007,8 +2054,8 @@ static void vl_api_sw_interface_bond_details_t_handler
   print (vam->ofp,
         "%-16s %-12d %-12U %-13U %-14u %-14u",
         mp->interface_name, ntohl (mp->sw_if_index),
-        format_bond_mode, mp->mode, format_bond_load_balance, mp->lb,
-        ntohl (mp->active_slaves), ntohl (mp->slaves));
+        format_bond_mode, ntohl (mp->mode), format_bond_load_balance,
+        ntohl (mp->lb), ntohl (mp->active_slaves), ntohl (mp->slaves));
 }
 
 static void vl_api_sw_interface_bond_details_t_handler_json
@@ -2028,8 +2075,8 @@ static void vl_api_sw_interface_bond_details_t_handler_json
   vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
   vat_json_object_add_string_copy (node, "interface_name",
                                   mp->interface_name);
-  vat_json_object_add_uint (node, "mode", mp->mode);
-  vat_json_object_add_uint (node, "load_balance", mp->lb);
+  vat_json_object_add_uint (node, "mode", ntohl (mp->mode));
+  vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb));
   vat_json_object_add_uint (node, "active_slaves", ntohl (mp->active_slaves));
   vat_json_object_add_uint (node, "slaves", ntohl (mp->slaves));
 }
@@ -2064,8 +2111,9 @@ static void vl_api_sw_interface_slave_details_t_handler
   vat_main_t *vam = &vat_main;
 
   print (vam->ofp,
-        "%-25s %-12d %-12d %d", mp->interface_name,
-        ntohl (mp->sw_if_index), mp->is_passive, mp->is_long_timeout);
+        "%-25s %-12d %-7d %-12d %-10d %-10d", mp->interface_name,
+        ntohl (mp->sw_if_index), mp->is_passive, mp->is_long_timeout,
+        ntohl (mp->weight), mp->is_local_numa);
 }
 
 static void vl_api_sw_interface_slave_details_t_handler_json
@@ -2087,6 +2135,8 @@ static void vl_api_sw_interface_slave_details_t_handler_json
                                   mp->interface_name);
   vat_json_object_add_uint (node, "passive", mp->is_passive);
   vat_json_object_add_uint (node, "long_timeout", mp->is_long_timeout);
+  vat_json_object_add_uint (node, "weight", ntohl (mp->weight));
+  vat_json_object_add_uint (node, "is_local_numa", mp->is_local_numa);
 }
 
 static int
@@ -2117,8 +2167,9 @@ api_sw_interface_slave_dump (vat_main_t * vam)
     }
 
   print (vam->ofp,
-        "\n%-25s %-12s %-12s %s",
-        "slave interface name", "sw_if_index", "passive", "long_timeout");
+        "\n%-25s %-12s %-7s %-12s %-10s %-10s",
+        "slave interface name", "sw_if_index", "passive", "long_timeout",
+        "weight", "local numa");
 
   /* Get list of bond interfaces */
   M (SW_INTERFACE_SLAVE_DUMP, mp);
@@ -2616,34 +2667,6 @@ vl_api_ip_details_t_handler_json (vl_api_ip_details_t * mp)
                           clib_net_to_host_u32 (mp->sw_if_index));
 }
 
-static void
-vl_api_dhcp_compl_event_t_handler (vl_api_dhcp_compl_event_t * mp)
-{
-  u8 *s, i;
-
-  s = format (0, "DHCP compl event: pid %d %s hostname %s host_addr %U "
-             "host_mac %U router_addr %U",
-             ntohl (mp->pid), mp->lease.is_ipv6 ? "ipv6" : "ipv4",
-             mp->lease.hostname,
-             format_ip4_address, mp->lease.host_address,
-             format_ethernet_address, mp->lease.host_mac,
-             format_ip4_address, mp->lease.router_address);
-
-  for (i = 0; i < mp->lease.count; i++)
-    s =
-      format (s, " domain_server_addr %U", format_ip4_address,
-             mp->lease.domain_server[i].address);
-
-  errmsg ((char *) s);
-  vec_free (s);
-}
-
-static void vl_api_dhcp_compl_event_t_handler_json
-  (vl_api_dhcp_compl_event_t * mp)
-{
-  /* JSON output not supported */
-}
-
 static void vl_api_get_first_msg_id_reply_t_handler
   (vl_api_get_first_msg_id_reply_t * mp)
 {
@@ -5040,6 +5063,7 @@ _(sw_interface_set_vxlan_bypass_reply)                  \
 _(sw_interface_set_geneve_bypass_reply)                 \
 _(sw_interface_set_vxlan_gpe_bypass_reply)              \
 _(sw_interface_set_l2_bridge_reply)                     \
+_(sw_interface_set_bond_weight_reply)                   \
 _(bridge_domain_add_del_reply)                          \
 _(sw_interface_set_l2_xconnect_reply)                   \
 _(l2fib_add_del_reply)                                  \
@@ -5047,6 +5071,9 @@ _(l2fib_flush_int_reply)                                \
 _(l2fib_flush_bd_reply)                                 \
 _(ip_route_add_del_reply)                               \
 _(ip_table_add_del_reply)                               \
+_(ip_table_replace_begin_reply)                         \
+_(ip_table_flush_reply)                                 \
+_(ip_table_replace_end_reply)                           \
 _(ip_mroute_add_del_reply)                              \
 _(mpls_route_add_del_reply)                             \
 _(mpls_table_add_del_reply)                             \
@@ -5057,10 +5084,6 @@ _(proxy_arp_add_del_reply)                              \
 _(proxy_arp_intfc_enable_disable_reply)                 \
 _(sw_interface_set_unnumbered_reply)                    \
 _(ip_neighbor_add_del_reply)                            \
-_(reset_fib_reply)                                      \
-_(dhcp_proxy_config_reply)                              \
-_(dhcp_proxy_set_vss_reply)                             \
-_(dhcp_client_config_reply)                             \
 _(set_ip_flow_hash_reply)                               \
 _(sw_interface_ip6_enable_disable_reply)                \
 _(ip6nd_proxy_add_del_reply)                            \
@@ -5153,7 +5176,9 @@ _(delete_subif_reply)                                   \
 _(l2_interface_pbb_tag_rewrite_reply)                   \
 _(set_punt_reply)                                       \
 _(feature_enable_disable_reply)                                \
+_(feature_gso_enable_disable_reply)                    \
 _(sw_interface_tag_add_del_reply)                      \
+_(sw_interface_add_del_mac_address_reply)              \
 _(hw_interface_set_mtu_reply)                           \
 _(p2p_ethernet_add_reply)                               \
 _(p2p_ethernet_del_reply)                               \
@@ -5242,10 +5267,14 @@ _(BOND_CREATE_REPLY, bond_create_reply)                                 \
 _(BOND_DELETE_REPLY, bond_delete_reply)                                        \
 _(BOND_ENSLAVE_REPLY, bond_enslave_reply)                              \
 _(BOND_DETACH_SLAVE_REPLY, bond_detach_slave_reply)                    \
+_(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \
 _(SW_INTERFACE_BOND_DETAILS, sw_interface_bond_details)                 \
 _(SW_INTERFACE_SLAVE_DETAILS, sw_interface_slave_details)               \
 _(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply)                      \
 _(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply)                      \
+_(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply)           \
+_(IP_TABLE_FLUSH_REPLY, ip_table_flush_reply)                           \
+_(IP_TABLE_REPLACE_END_REPLY, ip_table_replace_end_reply)               \
 _(IP_MROUTE_ADD_DEL_REPLY, ip_mroute_add_del_reply)                    \
 _(MPLS_TABLE_ADD_DEL_REPLY, mpls_table_add_del_reply)                  \
 _(MPLS_ROUTE_ADD_DEL_REPLY, mpls_route_add_del_reply)                  \
@@ -5261,11 +5290,6 @@ _(SW_INTERFACE_SET_UNNUMBERED_REPLY,                                    \
 _(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply)                 \
 _(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply)                     \
 _(CREATE_SUBIF_REPLY, create_subif_reply)                              \
-_(RESET_FIB_REPLY, reset_fib_reply)                                     \
-_(DHCP_PROXY_CONFIG_REPLY, dhcp_proxy_config_reply)                     \
-_(DHCP_PROXY_SET_VSS_REPLY, dhcp_proxy_set_vss_reply)                   \
-_(DHCP_PROXY_DETAILS, dhcp_proxy_details)                               \
-_(DHCP_CLIENT_CONFIG_REPLY, dhcp_client_config_reply)                   \
 _(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply)                       \
 _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY,                                \
   sw_interface_ip6_enable_disable_reply)                                \
@@ -5341,7 +5365,6 @@ _(DELETE_LOOPBACK_REPLY, delete_loopback_reply)                         \
 _(BD_IP_MAC_ADD_DEL_REPLY, bd_ip_mac_add_del_reply)                     \
 _(BD_IP_MAC_FLUSH_REPLY, bd_ip_mac_flush_reply)                         \
 _(BD_IP_MAC_DETAILS, bd_ip_mac_details)                                 \
-_(DHCP_COMPL_EVENT, dhcp_compl_event)                                   \
 _(WANT_INTERFACE_EVENTS_REPLY, want_interface_events_reply)             \
 _(GET_FIRST_MSG_ID_REPLY, get_first_msg_id_reply)                      \
 _(COP_INTERFACE_ENABLE_DISABLE_REPLY, cop_interface_enable_disable_reply) \
@@ -5465,7 +5488,9 @@ _(SET_PUNT_REPLY, set_punt_reply)                                       \
 _(IP_TABLE_DETAILS, ip_table_details)                                   \
 _(IP_ROUTE_DETAILS, ip_route_details)                                   \
 _(FEATURE_ENABLE_DISABLE_REPLY, feature_enable_disable_reply)           \
+_(FEATURE_GSO_ENABLE_DISABLE_REPLY, feature_gso_enable_disable_reply)   \
 _(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply)      \
+_(SW_INTERFACE_ADD_DEL_MAC_ADDRESS_REPLY, sw_interface_add_del_mac_address_reply) \
 _(L2_XCONNECT_DETAILS, l2_xconnect_details)                             \
 _(HW_INTERFACE_SET_MTU_REPLY, hw_interface_set_mtu_reply)               \
 _(IP_NEIGHBOR_DETAILS, ip_neighbor_details)                             \
@@ -7528,16 +7553,9 @@ api_tap_delete_v2 (vat_main_t * vam)
 }
 
 uword
-unformat_pci_addr (unformat_input_t * input, va_list * args)
+unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
 {
-  struct pci_addr_t
-  {
-    u16 domain;
-    u8 bus;
-    u8 slot:5;
-    u8 function:3;
-  } *addr;
-  addr = va_arg (*args, struct pci_addr_t *);
+  vlib_pci_addr_t *addr = va_arg (*args, vlib_pci_addr_t *);
   u32 x[4];
 
   if (!unformat (input, "%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
@@ -7572,7 +7590,7 @@ api_virtio_pci_create (vat_main_t * vam)
        {
          random_mac = 0;
        }
-      else if (unformat (i, "pci-addr %U", unformat_pci_addr, &pci_addr))
+      else if (unformat (i, "pci-addr %U", unformat_vlib_pci_addr, &pci_addr))
        ;
       else if (unformat (i, "features 0x%llx", &features))
        ;
@@ -7694,8 +7712,8 @@ api_bond_create (vat_main_t * vam)
 
   mp->use_custom_mac = custom_mac;
 
-  mp->mode = mode;
-  mp->lb = lb;
+  mp->mode = htonl (mode);
+  mp->lb = htonl (lb);
   mp->id = htonl (id);
   mp->numa_only = numa_only;
 
@@ -9196,19 +9214,18 @@ api_create_subif (vat_main_t * vam)
 }
 
 static int
-api_reset_fib (vat_main_t * vam)
+api_ip_table_replace_begin (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_reset_fib_t *mp;
-  u32 vrf_id = 0;
+  vl_api_ip_table_replace_begin_t *mp;
+  u32 table_id = 0;
   u8 is_ipv6 = 0;
-  u8 vrf_id_set = 0;
 
   int ret;
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "vrf %d", &vrf_id))
-       vrf_id_set = 1;
+      if (unformat (i, "table %d", &table_id))
+       ;
       else if (unformat (i, "ipv6"))
        is_ipv6 = 1;
       else
@@ -9218,16 +9235,10 @@ api_reset_fib (vat_main_t * vam)
        }
     }
 
-  if (vrf_id_set == 0)
-    {
-      errmsg ("missing vrf id");
-      return -99;
-    }
-
-  M (RESET_FIB, mp);
+  M (IP_TABLE_REPLACE_BEGIN, mp);
 
-  mp->vrf_id = ntohl (vrf_id);
-  mp->is_ipv6 = is_ipv6;
+  mp->table.table_id = ntohl (table_id);
+  mp->table.is_ip6 = is_ipv6;
 
   S (mp);
   W (ret);
@@ -9235,210 +9246,19 @@ api_reset_fib (vat_main_t * vam)
 }
 
 static int
-api_dhcp_proxy_config (vat_main_t * vam)
+api_ip_table_flush (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_dhcp_proxy_config_t *mp;
-  u32 rx_vrf_id = 0;
-  u32 server_vrf_id = 0;
-  u8 is_add = 1;
-  u8 v4_address_set = 0;
-  u8 v6_address_set = 0;
-  ip4_address_t v4address;
-  ip6_address_t v6address;
-  u8 v4_src_address_set = 0;
-  u8 v6_src_address_set = 0;
-  ip4_address_t v4srcaddress;
-  ip6_address_t v6srcaddress;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_add = 0;
-      else if (unformat (i, "rx_vrf_id %d", &rx_vrf_id))
-       ;
-      else if (unformat (i, "server_vrf_id %d", &server_vrf_id))
-       ;
-      else if (unformat (i, "svr %U", unformat_ip4_address, &v4address))
-       v4_address_set = 1;
-      else if (unformat (i, "svr %U", unformat_ip6_address, &v6address))
-       v6_address_set = 1;
-      else if (unformat (i, "src %U", unformat_ip4_address, &v4srcaddress))
-       v4_src_address_set = 1;
-      else if (unformat (i, "src %U", unformat_ip6_address, &v6srcaddress))
-       v6_src_address_set = 1;
-      else
-       break;
-    }
-
-  if (v4_address_set && v6_address_set)
-    {
-      errmsg ("both v4 and v6 server addresses set");
-      return -99;
-    }
-  if (!v4_address_set && !v6_address_set)
-    {
-      errmsg ("no server addresses set");
-      return -99;
-    }
-
-  if (v4_src_address_set && v6_src_address_set)
-    {
-      errmsg ("both v4 and v6  src addresses set");
-      return -99;
-    }
-  if (!v4_src_address_set && !v6_src_address_set)
-    {
-      errmsg ("no src addresses set");
-      return -99;
-    }
-
-  if (!(v4_src_address_set && v4_address_set) &&
-      !(v6_src_address_set && v6_address_set))
-    {
-      errmsg ("no matching server and src addresses set");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (DHCP_PROXY_CONFIG, mp);
-
-  mp->is_add = is_add;
-  mp->rx_vrf_id = ntohl (rx_vrf_id);
-  mp->server_vrf_id = ntohl (server_vrf_id);
-  if (v6_address_set)
-    {
-      mp->is_ipv6 = 1;
-      clib_memcpy (mp->dhcp_server, &v6address, sizeof (v6address));
-      clib_memcpy (mp->dhcp_src_address, &v6srcaddress, sizeof (v6address));
-    }
-  else
-    {
-      clib_memcpy (mp->dhcp_server, &v4address, sizeof (v4address));
-      clib_memcpy (mp->dhcp_src_address, &v4srcaddress, sizeof (v4address));
-    }
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply, return good/bad news  */
-  W (ret);
-  return ret;
-}
-
-#define vl_api_dhcp_proxy_details_t_endian vl_noop_handler
-#define vl_api_dhcp_proxy_details_t_print vl_noop_handler
-
-static void
-vl_api_dhcp_proxy_details_t_handler (vl_api_dhcp_proxy_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  u32 i, count = mp->count;
-  vl_api_dhcp_server_t *s;
-
-  if (mp->is_ipv6)
-    print (vam->ofp,
-          "RX Table-ID %d, Source Address %U, VSS Type %d, "
-          "VSS ASCII VPN-ID '%s', VSS RFC2685 VPN-ID (oui:id) %d:%d",
-          ntohl (mp->rx_vrf_id),
-          format_ip6_address, mp->dhcp_src_address,
-          mp->vss_type, mp->vss_vpn_ascii_id,
-          ntohl (mp->vss_oui), ntohl (mp->vss_fib_id));
-  else
-    print (vam->ofp,
-          "RX Table-ID %d, Source Address %U, VSS Type %d, "
-          "VSS ASCII VPN-ID '%s', VSS RFC2685 VPN-ID (oui:id) %d:%d",
-          ntohl (mp->rx_vrf_id),
-          format_ip4_address, mp->dhcp_src_address,
-          mp->vss_type, mp->vss_vpn_ascii_id,
-          ntohl (mp->vss_oui), ntohl (mp->vss_fib_id));
-
-  for (i = 0; i < count; i++)
-    {
-      s = &mp->servers[i];
-
-      if (mp->is_ipv6)
-       print (vam->ofp,
-              " Server Table-ID %d, Server Address %U",
-              ntohl (s->server_vrf_id), format_ip6_address, s->dhcp_server);
-      else
-       print (vam->ofp,
-              " Server Table-ID %d, Server Address %U",
-              ntohl (s->server_vrf_id), format_ip4_address, s->dhcp_server);
-    }
-}
-
-static void vl_api_dhcp_proxy_details_t_handler_json
-  (vl_api_dhcp_proxy_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
-  u32 i, count = mp->count;
-  struct in_addr ip4;
-  struct in6_addr ip6;
-  vl_api_dhcp_server_t *s;
-
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
-    {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  node = vat_json_array_add (&vam->json_tree);
-
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "rx-table-id", ntohl (mp->rx_vrf_id));
-  vat_json_object_add_bytes (node, "vss-type", &mp->vss_type,
-                            sizeof (mp->vss_type));
-  vat_json_object_add_string_copy (node, "vss-vpn-ascii-id",
-                                  mp->vss_vpn_ascii_id);
-  vat_json_object_add_uint (node, "vss-fib-id", ntohl (mp->vss_fib_id));
-  vat_json_object_add_uint (node, "vss-oui", ntohl (mp->vss_oui));
-
-  if (mp->is_ipv6)
-    {
-      clib_memcpy (&ip6, &mp->dhcp_src_address, sizeof (ip6));
-      vat_json_object_add_ip6 (node, "src_address", ip6);
-    }
-  else
-    {
-      clib_memcpy (&ip4, &mp->dhcp_src_address, sizeof (ip4));
-      vat_json_object_add_ip4 (node, "src_address", ip4);
-    }
-
-  for (i = 0; i < count; i++)
-    {
-      s = &mp->servers[i];
-
-      vat_json_object_add_uint (node, "server-table-id",
-                               ntohl (s->server_vrf_id));
-
-      if (mp->is_ipv6)
-       {
-         clib_memcpy (&ip4, &s->dhcp_server, sizeof (ip4));
-         vat_json_object_add_ip4 (node, "src_address", ip4);
-       }
-      else
-       {
-         clib_memcpy (&ip6, &s->dhcp_server, sizeof (ip6));
-         vat_json_object_add_ip6 (node, "server_address", ip6);
-       }
-    }
-}
-
-static int
-api_dhcp_proxy_dump (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_control_ping_t *mp_ping;
-  vl_api_dhcp_proxy_dump_t *mp;
+  vl_api_ip_table_flush_t *mp;
+  u32 table_id = 0;
   u8 is_ipv6 = 0;
-  int ret;
 
+  int ret;
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "ipv6"))
+      if (unformat (i, "table %d", &table_id))
+       ;
+      else if (unformat (i, "ipv6"))
        is_ipv6 = 1;
       else
        {
@@ -9447,141 +9267,44 @@ api_dhcp_proxy_dump (vat_main_t * vam)
        }
     }
 
-  M (DHCP_PROXY_DUMP, mp);
-
-  mp->is_ip6 = is_ipv6;
-  S (mp);
+  M (IP_TABLE_FLUSH, mp);
 
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
+  mp->table.table_id = ntohl (table_id);
+  mp->table.is_ip6 = is_ipv6;
 
+  S (mp);
   W (ret);
   return ret;
 }
 
 static int
-api_dhcp_proxy_set_vss (vat_main_t * vam)
+api_ip_table_replace_end (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_dhcp_proxy_set_vss_t *mp;
+  vl_api_ip_table_replace_end_t *mp;
+  u32 table_id = 0;
   u8 is_ipv6 = 0;
-  u8 is_add = 1;
-  u32 tbl_id = ~0;
-  u8 vss_type = VSS_TYPE_DEFAULT;
-  u8 *vpn_ascii_id = 0;
-  u32 oui = 0;
-  u32 fib_id = 0;
-  int ret;
 
+  int ret;
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "tbl_id %d", &tbl_id))
+      if (unformat (i, "table %d", &table_id))
        ;
-      else if (unformat (i, "vpn_ascii_id %s", &vpn_ascii_id))
-       vss_type = VSS_TYPE_ASCII;
-      else if (unformat (i, "fib_id %d", &fib_id))
-       vss_type = VSS_TYPE_VPN_ID;
-      else if (unformat (i, "oui %d", &oui))
-       vss_type = VSS_TYPE_VPN_ID;
       else if (unformat (i, "ipv6"))
        is_ipv6 = 1;
-      else if (unformat (i, "del"))
-       is_add = 0;
       else
-       break;
-    }
-
-  if (tbl_id == ~0)
-    {
-      errmsg ("missing tbl_id ");
-      vec_free (vpn_ascii_id);
-      return -99;
-    }
-
-  if ((vpn_ascii_id) && (vec_len (vpn_ascii_id) > 128))
-    {
-      errmsg ("vpn_ascii_id cannot be longer than 128 ");
-      vec_free (vpn_ascii_id);
-      return -99;
-    }
-
-  M (DHCP_PROXY_SET_VSS, mp);
-  mp->tbl_id = ntohl (tbl_id);
-  mp->vss_type = vss_type;
-  if (vpn_ascii_id)
-    {
-      clib_memcpy (mp->vpn_ascii_id, vpn_ascii_id, vec_len (vpn_ascii_id));
-      mp->vpn_ascii_id[vec_len (vpn_ascii_id)] = 0;
-    }
-  mp->vpn_index = ntohl (fib_id);
-  mp->oui = ntohl (oui);
-  mp->is_ipv6 = is_ipv6;
-  mp->is_add = is_add;
-
-  S (mp);
-  W (ret);
-
-  vec_free (vpn_ascii_id);
-  return ret;
-}
-
-static int
-api_dhcp_client_config (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_dhcp_client_config_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u8 is_add = 1;
-  u8 *hostname = 0;
-  u8 disable_event = 0;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_add = 0;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "hostname %s", &hostname))
-       ;
-      else if (unformat (i, "disable_event"))
-       disable_event = 1;
-      else
-       break;
-    }
-
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-
-  if (vec_len (hostname) > 63)
-    {
-      errmsg ("hostname too long");
+       {
+         clib_warning ("parse error '%U'", format_unformat_error, i);
+         return -99;
+       }
     }
-  vec_add1 (hostname, 0);
 
-  /* Construct the API message */
-  M (DHCP_CLIENT_CONFIG, mp);
+  M (IP_TABLE_REPLACE_END, mp);
 
-  mp->is_add = is_add;
-  mp->client.sw_if_index = htonl (sw_if_index);
-  clib_memcpy (mp->client.hostname, hostname, vec_len (hostname));
-  vec_free (hostname);
-  mp->client.want_dhcp_event = disable_event ? 0 : 1;
-  mp->client.pid = htonl (getpid ());
+  mp->table.table_id = ntohl (table_id);
+  mp->table.is_ip6 = is_ipv6;
 
-  /* send it... */
   S (mp);
-
-  /* Wait for a reply, return good/bad news  */
   W (ret);
   return ret;
 }
@@ -10134,6 +9857,7 @@ api_sr_localsid_add_del (vat_main_t * vam)
   M (SR_LOCALSID_ADD_DEL, mp);
 
   clib_memcpy (mp->localsid.addr, &localsid, sizeof (mp->localsid));
+
   if (nexthop_set)
     {
       clib_memcpy (mp->nh_addr6, &nh_addr6, sizeof (mp->nh_addr6));
@@ -11619,10 +11343,11 @@ api_set_ipfix_exporter (vat_main_t * vam)
 
   M (SET_IPFIX_EXPORTER, mp);
 
-  memcpy (mp->collector_address, collector_address.data,
+  memcpy (mp->collector_address.un.ip4, collector_address.data,
          sizeof (collector_address.data));
   mp->collector_port = htons ((u16) collector_port);
-  memcpy (mp->src_address, src_address.data, sizeof (src_address.data));
+  memcpy (mp->src_address.un.ip4, src_address.data,
+         sizeof (src_address.data));
   mp->vrf_id = htonl (vrf_id);
   mp->path_mtu = htonl (path_mtu);
   mp->template_interval = htonl (template_interval);
@@ -11912,17 +11637,17 @@ api_l2tpv3_create_tunnel (vat_main_t * vam)
 
   M (L2TPV3_CREATE_TUNNEL, mp);
 
-  clib_memcpy (mp->client_address, client_address.as_u8,
-              sizeof (mp->client_address));
+  clib_memcpy (mp->client_address.un.ip6, client_address.as_u8,
+              sizeof (ip6_address_t));
 
-  clib_memcpy (mp->our_address, our_address.as_u8, sizeof (mp->our_address));
+  clib_memcpy (mp->our_address.un.ip6, our_address.as_u8,
+              sizeof (ip6_address_t));
 
   mp->local_session_id = ntohl (local_session_id);
   mp->remote_session_id = ntohl (remote_session_id);
   mp->local_cookie = clib_host_to_net_u64 (local_cookie);
   mp->remote_cookie = clib_host_to_net_u64 (remote_cookie);
   mp->l2_sublayer_present = l2_sublayer_present;
-  mp->is_ipv6 = 1;
 
   S (mp);
   W (ret);
@@ -12087,9 +11812,9 @@ static void vl_api_sw_if_l2tpv3_tunnel_details_t_handler_json
 
   vat_json_init_object (node);
 
-  clib_memcpy (&addr, mp->our_address, sizeof (addr));
+  clib_memcpy (&addr, mp->our_address.un.ip6, sizeof (addr));
   vat_json_object_add_ip6 (node, "our_address", addr);
-  clib_memcpy (&addr, mp->client_address, sizeof (addr));
+  clib_memcpy (&addr, mp->client_address.un.ip6, sizeof (addr));
   vat_json_object_add_ip6 (node, "client_address", addr);
 
   vat_json_node_t *lc = vat_json_object_add (node, "local_cookie");
@@ -12779,20 +12504,19 @@ api_geneve_add_del_tunnel (vat_main_t * vam)
 
   if (ipv6_set)
     {
-      clib_memcpy (mp->local_address, &src.ip6, sizeof (src.ip6));
-      clib_memcpy (mp->remote_address, &dst.ip6, sizeof (dst.ip6));
+      clib_memcpy (&mp->local_address.un.ip6, &src.ip6, sizeof (src.ip6));
+      clib_memcpy (&mp->remote_address.un.ip6, &dst.ip6, sizeof (dst.ip6));
     }
   else
     {
-      clib_memcpy (mp->local_address, &src.ip4, sizeof (src.ip4));
-      clib_memcpy (mp->remote_address, &dst.ip4, sizeof (dst.ip4));
+      clib_memcpy (&mp->local_address.un.ip4, &src.ip4, sizeof (src.ip4));
+      clib_memcpy (&mp->remote_address.un.ip4, &dst.ip4, sizeof (dst.ip4));
     }
   mp->encap_vrf_id = ntohl (encap_vrf_id);
   mp->decap_next_index = ntohl (decap_next_index);
   mp->mcast_sw_if_index = ntohl (mcast_sw_if_index);
   mp->vni = ntohl (vni);
   mp->is_add = is_add;
-  mp->is_ipv6 = ipv6_set;
 
   S (mp);
   W (ret);
@@ -12803,8 +12527,19 @@ static void vl_api_geneve_tunnel_details_t_handler
   (vl_api_geneve_tunnel_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  ip46_address_t src = to_ip46 (mp->is_ipv6, mp->dst_address);
-  ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->src_address);
+  ip46_address_t src = {.as_u64[0] = 0,.as_u64[1] = 0 };
+  ip46_address_t dst = {.as_u64[0] = 0,.as_u64[1] = 0 };
+
+  if (mp->src_address.af == ADDRESS_IP6)
+    {
+      clib_memcpy (&src.ip6, &mp->src_address.un.ip6, sizeof (ip6_address_t));
+      clib_memcpy (&dst.ip6, &mp->dst_address.un.ip6, sizeof (ip6_address_t));
+    }
+  else
+    {
+      clib_memcpy (&src.ip4, &mp->src_address.un.ip4, sizeof (ip4_address_t));
+      clib_memcpy (&dst.ip4, &mp->dst_address.un.ip4, sizeof (ip4_address_t));
+    }
 
   print (vam->ofp, "%11d%24U%24U%14d%18d%13d%19d",
         ntohl (mp->sw_if_index),
@@ -12820,6 +12555,7 @@ static void vl_api_geneve_tunnel_details_t_handler_json
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
+  bool is_ipv6;
 
   if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
@@ -12830,29 +12566,29 @@ static void vl_api_geneve_tunnel_details_t_handler_json
 
   vat_json_init_object (node);
   vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  if (mp->is_ipv6)
+  is_ipv6 = mp->src_address.af == ADDRESS_IP6;
+  if (is_ipv6)
     {
       struct in6_addr ip6;
 
-      clib_memcpy (&ip6, mp->src_address, sizeof (ip6));
+      clib_memcpy (&ip6, &mp->src_address.un.ip6, sizeof (ip6));
       vat_json_object_add_ip6 (node, "src_address", ip6);
-      clib_memcpy (&ip6, mp->dst_address, sizeof (ip6));
+      clib_memcpy (&ip6, &mp->dst_address.un.ip6, sizeof (ip6));
       vat_json_object_add_ip6 (node, "dst_address", ip6);
     }
   else
     {
       struct in_addr ip4;
 
-      clib_memcpy (&ip4, mp->src_address, sizeof (ip4));
+      clib_memcpy (&ip4, &mp->src_address.un.ip4, sizeof (ip4));
       vat_json_object_add_ip4 (node, "src_address", ip4);
-      clib_memcpy (&ip4, mp->dst_address, sizeof (ip4));
+      clib_memcpy (&ip4, &mp->dst_address.un.ip4, sizeof (ip4));
       vat_json_object_add_ip4 (node, "dst_address", ip4);
     }
   vat_json_object_add_uint (node, "encap_vrf_id", ntohl (mp->encap_vrf_id));
   vat_json_object_add_uint (node, "decap_next_index",
                            ntohl (mp->decap_next_index));
   vat_json_object_add_uint (node, "vni", ntohl (mp->vni));
-  vat_json_object_add_uint (node, "is_ipv6", mp->is_ipv6 ? 1 : 0);
   vat_json_object_add_uint (node, "mcast_sw_if_index",
                            ntohl (mp->mcast_sw_if_index));
 }
@@ -16604,13 +16340,13 @@ api_one_use_petr (vat_main_t * vam)
        if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (&ip)))
        {
          is_add = 1;
-         ip_addr_version (&ip) = IP4;
+         ip_addr_version (&ip) = AF_IP4;
        }
       else
        if (unformat (input, "%U", unformat_ip6_address, &ip_addr_v6 (&ip)))
        {
          is_add = 1;
-         ip_addr_version (&ip) = IP6;
+         ip_addr_version (&ip) = AF_IP6;
        }
       else
        {
@@ -16624,7 +16360,7 @@ api_one_use_petr (vat_main_t * vam)
   mp->is_add = is_add;
   if (is_add)
     {
-      mp->is_ip4 = ip_addr_version (&ip) == IP4 ? 1 : 0;
+      mp->is_ip4 = ip_addr_version (&ip) == AF_IP4 ? 1 : 0;
       if (mp->is_ip4)
        clib_memcpy (mp->address, &ip, 4);
       else
@@ -20294,6 +20030,45 @@ api_feature_enable_disable (vat_main_t * vam)
   return ret;
 }
 
+static int
+api_feature_gso_enable_disable (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_feature_gso_enable_disable_t *mp;
+  u32 sw_if_index = ~0;
+  u8 enable = 1;
+  int ret;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       ;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       ;
+      else if (unformat (i, "enable"))
+       enable = 1;
+      else if (unformat (i, "disable"))
+       enable = 0;
+      else
+       break;
+    }
+
+  if (sw_if_index == ~0)
+    {
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
+    }
+
+  /* Construct the API message */
+  M (FEATURE_GSO_ENABLE_DISABLE, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->enable_disable = enable;
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
 static int
 api_sw_interface_tag_add_del (vat_main_t * vam)
 {
@@ -20343,6 +20118,54 @@ api_sw_interface_tag_add_del (vat_main_t * vam)
   return ret;
 }
 
+static int
+api_sw_interface_add_del_mac_address (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_mac_address_t mac = { 0 };
+  vl_api_sw_interface_add_del_mac_address_t *mp;
+  u32 sw_if_index = ~0;
+  u8 is_add = 1;
+  u8 mac_set = 0;
+  int ret;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       ;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       ;
+      else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac))
+       mac_set++;
+      else if (unformat (i, "del"))
+       is_add = 0;
+      else
+       break;
+    }
+
+  if (sw_if_index == ~0)
+    {
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
+    }
+
+  if (!mac_set)
+    {
+      errmsg ("missing MAC address");
+      return -99;
+    }
+
+  /* Construct the API message */
+  M (SW_INTERFACE_ADD_DEL_MAC_ADDRESS, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->is_add = is_add;
+  clib_memcpy (&mp->addr, &mac, sizeof (mac));
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
 static void vl_api_l2_xconnect_details_t_handler
   (vl_api_l2_xconnect_details_t * mp)
 {
@@ -21724,13 +21547,14 @@ _(sw_interface_virtio_pci_dump, "")                                     \
 _(bond_create,                                                          \
   "[hw-addr <mac-addr>] {round-robin | active-backup | "                \
   "broadcast | {lacp | xor} [load-balance { l2 | l23 | l34 }]} "        \
-  "[id <if-id>]")                                                       \
+  "[id <if-id>]")                                                      \
 _(bond_delete,                                                          \
   "<vpp-if-name> | sw_if_index <id>")                                   \
 _(bond_enslave,                                                         \
-  "sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]") \
+  "sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]")  \
 _(bond_detach_slave,                                                    \
   "sw_if_index <n>")                                                   \
+ _(sw_interface_set_bond_weight, "<intfc> | sw_if_index <nn> weight <value>") \
 _(sw_interface_bond_dump, "")                                           \
 _(sw_interface_slave_dump,                                              \
   "<vpp-if-name> | sw_if_index <id>")                                   \
@@ -21783,15 +21607,9 @@ _(create_subif, "<intfc> | sw_if_index <id> sub_id <n>\n"               \
   "[outer_vlan_id <n>][inner_vlan_id <n>]\n"                            \
   "[no_tags][one_tag][two_tags][dot1ad][exact_match][default_sub]\n"    \
   "[outer_vlan_id_any][inner_vlan_id_any]")                             \
-_(reset_fib, "vrf <n> [ipv6]")                                          \
-_(dhcp_proxy_config,                                                    \
-  "svr <v46-address> src <v46-address>\n"                               \
-   "rx_vrf_id <nn> server_vrf_id <nn>  [del]")                          \
-_(dhcp_proxy_set_vss,                                                   \
-  "tbl_id <n> [fib_id <n> oui <n> | vpn_ascii_id <text>] [ipv6] [del]") \
-_(dhcp_proxy_dump, "ip6")                                               \
-_(dhcp_client_config,                                                   \
-  "<intfc> | sw_if_index <id> [hostname <name>] [disable_event] [del]") \
+_(ip_table_replace_begin, "table <n> [ipv6]")                           \
+_(ip_table_flush, "table <n> [ipv6]")                                   \
+_(ip_table_replace_end, "table <n> [ipv6]")                             \
 _(set_ip_flow_hash,                                                     \
   "vrf <n> [src] [dst] [sport] [dport] [proto] [reverse] [ipv6]")       \
 _(sw_interface_ip6_enable_disable,                                      \
@@ -22102,8 +21920,12 @@ _(ip_mtable_dump, "")                                                   \
 _(ip_mroute_dump, "table-id [ip4|ip6]")                                 \
 _(feature_enable_disable, "arc_name <arc_name> "                        \
   "feature_name <feature_name> <intfc> | sw_if_index <nn> [disable]")  \
+_(feature_gso_enable_disable, "<intfc> | sw_if_index <nn> "             \
+  "[enable | disable] ")                                                \
 _(sw_interface_tag_add_del, "<intfc> | sw_if_index <nn> tag <text>"    \
 "[disable]")                                                           \
+_(sw_interface_add_del_mac_address, "<intfc> | sw_if_index <nn> "      \
+  "mac <mac-address> [del]")                                            \
 _(l2_xconnect_dump, "")                                                \
 _(hw_interface_set_mtu, "<intfc> | hw_if_index <nn> mtu <nn>")        \
 _(ip_neighbor_dump, "[ip6] <intfc> | sw_if_index <nn>")                 \