devices: vhost API cleanup
[vpp.git] / src / vat / api_format.c
index 924d9c6..e4ef0b4 100644 (file)
@@ -1100,7 +1100,7 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
-  api_main_t *am = &api_main;
+  api_main_t *am = vlibapi_get_main ();
   void *oldheap;
   u8 *reply;
 
@@ -2710,7 +2710,7 @@ static void vl_api_get_node_graph_reply_t_handler
   (vl_api_get_node_graph_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  api_main_t *am = &api_main;
+  api_main_t *am = vlibapi_get_main ();
   i32 retval = ntohl (mp->retval);
   u8 *pvt_copy, *reply;
   void *oldheap;
@@ -2773,7 +2773,7 @@ static void vl_api_get_node_graph_reply_t_handler_json
   (vl_api_get_node_graph_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  api_main_t *am = &api_main;
+  api_main_t *am = vlibapi_get_main ();
   void *oldheap;
   vat_json_node_t node;
   u8 *reply;
@@ -7474,8 +7474,8 @@ api_tap_create_v2 (vat_main_t * vam)
   mp->id = ntohl (id);
   mp->host_namespace_set = host_ns != 0;
   mp->host_bridge_set = host_bridge != 0;
-  mp->host_ip4_addr_set = host_ip4_prefix_len != 0;
-  mp->host_ip6_addr_set = host_ip6_prefix_len != 0;
+  mp->host_ip4_prefix_set = host_ip4_prefix_len != 0;
+  mp->host_ip6_prefix_set = host_ip6_prefix_len != 0;
   mp->rx_ring_sz = ntohs (rx_ring_sz);
   mp->tx_ring_sz = ntohs (tx_ring_sz);
   mp->host_mtu_set = host_mtu_set;
@@ -7493,9 +7493,9 @@ api_tap_create_v2 (vat_main_t * vam)
   if (host_bridge)
     clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge));
   if (host_ip4_prefix_len)
-    clib_memcpy (mp->host_ip4_addr, &host_ip4_addr, 4);
+    clib_memcpy (mp->host_ip4_prefix.address, &host_ip4_addr, 4);
   if (host_ip6_prefix_len)
-    clib_memcpy (mp->host_ip6_addr, &host_ip6_addr, 16);
+    clib_memcpy (mp->host_ip6_prefix.address, &host_ip6_addr, 16);
   if (host_ip4_gw_set)
     clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
   if (host_ip6_gw_set)
@@ -11859,10 +11859,12 @@ static void vl_api_sw_interface_tap_v2_details_t_handler
 {
   vat_main_t *vam = &vat_main;
 
-  u8 *ip4 = format (0, "%U/%d", format_ip4_address, mp->host_ip4_addr,
-                   mp->host_ip4_prefix_len);
-  u8 *ip6 = format (0, "%U/%d", format_ip6_address, mp->host_ip6_addr,
-                   mp->host_ip6_prefix_len);
+  u8 *ip4 =
+    format (0, "%U/%d", format_ip4_address, mp->host_ip4_prefix.address,
+           mp->host_ip4_prefix.len);
+  u8 *ip6 =
+    format (0, "%U/%d", format_ip6_address, mp->host_ip6_prefix.address,
+           mp->host_ip6_prefix.len);
 
   print (vam->ofp,
         "\n%-16s %-12d %-5d %-12d %-12d %-14U %-30s %-20s %-20s %-30s 0x%-08x",
@@ -11903,12 +11905,12 @@ static void vl_api_sw_interface_tap_v2_details_t_handler_json
   vat_json_object_add_string_copy (node, "host_bridge", mp->host_bridge);
   vat_json_object_add_string_copy (node, "host_ip4_addr",
                                   format (0, "%U/%d", format_ip4_address,
-                                          mp->host_ip4_addr,
-                                          mp->host_ip4_prefix_len));
-  vat_json_object_add_string_copy (node, "host_ip6_addr",
+                                          mp->host_ip4_prefix.address,
+                                          mp->host_ip4_prefix.len));
+  vat_json_object_add_string_copy (node, "host_ip6_prefix",
                                   format (0, "%U/%d", format_ip6_address,
-                                          mp->host_ip6_addr,
-                                          mp->host_ip6_prefix_len));
+                                          mp->host_ip6_prefix.address,
+                                          mp->host_ip6_prefix.len));
 
 }
 
@@ -12651,7 +12653,7 @@ api_gre_tunnel_add_del (vat_main_t * vam)
   u8 is_add = 1;
   u8 src_set = 0;
   u8 dst_set = 0;
-  u32 outer_fib_id = 0;
+  u32 outer_table_id = 0;
   u32 session_id = 0;
   u32 instance = ~0;
   int ret;
@@ -12672,7 +12674,7 @@ api_gre_tunnel_add_del (vat_main_t * vam)
        {
          dst_set = 1;
        }
-      else if (unformat (line_input, "outer-fib-id %d", &outer_fib_id))
+      else if (unformat (line_input, "outer-table-id %d", &outer_table_id))
        ;
       else if (unformat (line_input, "teb"))
        t_type = GRE_API_TUNNEL_TYPE_TEB;
@@ -12702,7 +12704,7 @@ api_gre_tunnel_add_del (vat_main_t * vam)
   clib_memcpy (&mp->tunnel.dst, &dst, sizeof (mp->tunnel.dst));
 
   mp->tunnel.instance = htonl (instance);
-  mp->tunnel.outer_fib_id = htonl (outer_fib_id);
+  mp->tunnel.outer_table_id = htonl (outer_table_id);
   mp->is_add = is_add;
   mp->tunnel.session_id = htons ((u16) session_id);
   mp->tunnel.type = htonl (t_type);
@@ -12722,7 +12724,7 @@ static void vl_api_gre_tunnel_details_t_handler
         ntohl (mp->tunnel.instance),
         format_vl_api_address, &mp->tunnel.src,
         format_vl_api_address, &mp->tunnel.dst,
-        mp->tunnel.type, ntohl (mp->tunnel.outer_fib_id),
+        mp->tunnel.type, ntohl (mp->tunnel.outer_table_id),
         ntohl (mp->tunnel.session_id));
 }
 
@@ -12747,8 +12749,8 @@ static void vl_api_gre_tunnel_details_t_handler_json
   vat_json_object_add_address (node, "src", &mp->tunnel.src);
   vat_json_object_add_address (node, "dst", &mp->tunnel.dst);
   vat_json_object_add_uint (node, "tunnel_type", mp->tunnel.type);
-  vat_json_object_add_uint (node, "outer_fib_id",
-                           ntohl (mp->tunnel.outer_fib_id));
+  vat_json_object_add_uint (node, "outer_table_id",
+                           ntohl (mp->tunnel.outer_table_id));
   vat_json_object_add_uint (node, "session_id", mp->tunnel.session_id);
 }
 
@@ -13114,11 +13116,18 @@ static void vl_api_sw_interface_vhost_user_details_t_handler
   (vl_api_sw_interface_vhost_user_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
+  u64 features;
+
+  features =
+    clib_net_to_host_u32 (mp->features_first_32) | ((u64)
+                                                   clib_net_to_host_u32
+                                                   (mp->features_last_32) <<
+                                                   32);
 
   print (vam->ofp, "%-25s %3" PRIu32 " %6" PRIu32 " %8x %6d %7d %s",
         (char *) mp->interface_name,
         ntohl (mp->sw_if_index), ntohl (mp->virtio_net_hdr_sz),
-        clib_net_to_host_u64 (mp->features), mp->is_server,
+        features, mp->is_server,
         ntohl (mp->num_regions), (char *) mp->sock_filename);
   print (vam->ofp, "    Status: '%s'", strerror (ntohl (mp->sock_errno)));
 }
@@ -13142,8 +13151,10 @@ static void vl_api_sw_interface_vhost_user_details_t_handler_json
                                   mp->interface_name);
   vat_json_object_add_uint (node, "virtio_net_hdr_sz",
                            ntohl (mp->virtio_net_hdr_sz));
-  vat_json_object_add_uint (node, "features",
-                           clib_net_to_host_u64 (mp->features));
+  vat_json_object_add_uint (node, "features_first_32",
+                           clib_net_to_host_u32 (mp->features_first_32));
+  vat_json_object_add_uint (node, "features_last_32",
+                           clib_net_to_host_u32 (mp->features_last_32));
   vat_json_object_add_uint (node, "is_server", mp->is_server);
   vat_json_object_add_string_copy (node, "sock_filename", mp->sock_filename);
   vat_json_object_add_uint (node, "num_regions", ntohl (mp->num_regions));
@@ -21333,7 +21344,7 @@ value_sort_cmp (void *a1, void *a2)
 static int
 dump_msg_api_table (vat_main_t * vam)
 {
-  api_main_t *am = &api_main;
+  api_main_t *am = vlibapi_get_main ();
   name_sort_t *nses = 0, *ns;
   hash_pair_t *hp;
   int i;