api: autogenerate api trace print/endian
[vpp.git] / src / vat / api_format.c
index 4161106..5823055 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>
@@ -85,6 +86,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);
 
@@ -2050,8 +2053,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
@@ -2071,8 +2074,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));
 }
@@ -7577,16 +7580,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]))
@@ -7621,7 +7617,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))
        ;
@@ -7743,8 +7739,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;