bonding: add weight support for active-backup mode
[vpp.git] / src / vpp / api / custom_dump.c
index 11ff41a..8ef78cb 100644 (file)
@@ -112,7 +112,7 @@ static void *vl_api_sw_interface_set_flags_t_print
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (mp->admin_up_down)
+  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
     s = format (s, "admin-up ");
   else
     s = format (s, "admin-down ");
@@ -160,12 +160,12 @@ static void *vl_api_sw_interface_event_t_print
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (mp->admin_up_down)
+  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
     s = format (s, "admin-up ");
   else
     s = format (s, "admin-down ");
 
-  if (mp->link_up_down)
+  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_LINK_UP)
     s = format (s, "link-up");
   else
     s = format (s, "link-down");
@@ -180,17 +180,18 @@ static void *vl_api_sw_interface_add_del_address_t_print
   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
 {
   u8 *s;
+  ip46_address_t address;
 
   s = format (0, "SCRIPT: sw_interface_add_del_address ");
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (mp->is_ipv6)
+  if (ip_address_decode (&mp->prefix.address, &address) == IP46_TYPE_IP6)
     s = format (s, "%U/%d ", format_ip6_address,
-               (ip6_address_t *) mp->address, mp->address_length);
+               (ip6_address_t *) & address.ip6, mp->prefix.len);
   else
     s = format (s, "%U/%d ", format_ip4_address,
-               (ip4_address_t *) mp->address, mp->address_length);
+               (ip4_address_t *) & address.ip4, mp->prefix.len);
 
   if (mp->is_add == 0)
     s = format (s, "del ");
@@ -689,8 +690,8 @@ static void *vl_api_bond_enslave_t_print
   u8 *s;
 
   s = format (0, "SCRIPT: bond_enslave ");
-  s = format (s, "bond_sw_if_index %u ", mp->bond_sw_if_index);
-  s = format (s, "sw_if_index %u ", mp->sw_if_index);
+  s = format (s, "bond_sw_if_index %u ", ntohl (mp->bond_sw_if_index));
+  s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
   if (mp->is_passive)
     s = format (s, "passive ");
   if (mp->is_long_timeout)
@@ -699,6 +700,18 @@ static void *vl_api_bond_enslave_t_print
   FINISH;
 }
 
+static void *vl_api_sw_interface_set_bond_weight_t_print
+  (vl_api_sw_interface_set_bond_weight_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: sw_interface_set_bond_weight ");
+  s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
+  s = format (s, "weight %u ", ntohl (mp->weight));
+
+  FINISH;
+}
+
 static void *vl_api_bond_detach_slave_t_print
   (vl_api_bond_detach_slave_t * mp, void *handle)
 {
@@ -970,15 +983,15 @@ static void *vl_api_create_vlan_subif_t_print
   FINISH;
 }
 
-#define foreach_create_subif_bit                \
-_(no_tags)                                      \
-_(one_tag)                                      \
-_(two_tags)                                     \
-_(dot1ad)                                       \
-_(exact_match)                                  \
-_(default_sub)                                  \
-_(outer_vlan_id_any)                            \
-_(inner_vlan_id_any)
+#define foreach_create_subif_flag              \
+_(0, "no_tags")                                        \
+_(1, "one_tag")                                        \
+_(2, "two_tags")                               \
+_(3, "dot1ad")                                 \
+_(4, "exact_match")                            \
+_(5, "default_sub")                            \
+_(6, "outer_vlan_id_any")                      \
+_(7, "inner_vlan_id_any")
 
 static void *vl_api_create_subif_t_print
   (vl_api_create_subif_t * mp, void *handle)
@@ -997,8 +1010,8 @@ static void *vl_api_create_subif_t_print
   if (mp->inner_vlan_id)
     s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
 
-#define _(a) if (mp->a) s = format (s, "%s ", #a);
-  foreach_create_subif_bit;
+#define _(a,b) if (mp->sub_if_flags & (1 << a)) s = format (s, "%s ", b);
+  foreach_create_subif_flag;
 #undef _
 
   FINISH;
@@ -1920,6 +1933,8 @@ static void *vl_api_create_vhost_user_if_t_print
     s = format (s, "disable_indirect_desc ");
   if (mp->tag[0])
     s = format (s, "tag %s", mp->tag);
+  if (mp->enable_gso)
+    s = format (s, "gso");
 
   FINISH;
 }
@@ -1937,6 +1952,8 @@ static void *vl_api_modify_vhost_user_if_t_print
     s = format (s, "server ");
   if (mp->renumber)
     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
+  if (mp->enable_gso)
+    s = format (s, "gso");
 
   FINISH;
 }
@@ -2761,6 +2778,8 @@ static void *vl_api_pg_create_interface_t_print
 
   s = format (0, "SCRIPT: pg_create_interface ");
   s = format (0, "if_id %d", ntohl (mp->interface_id));
+  s = format (0, "gso-enabled %u", mp->gso_enabled);
+  s = format (0, "gso-size %u", ntohl (mp->gso_size));
 
   FINISH;
 }
@@ -3631,29 +3650,6 @@ static void *vl_api_app_namespace_add_del_t_print
   FINISH;
 }
 
-static void *vl_api_lldp_config_t_print
-  (vl_api_lldp_config_t * mp, void *handle)
-{
-  u8 *s;
-
-  s = format (0, "SCRIPT: lldp_config ");
-  s = format (s, "system_name %s ", mp->system_name);
-  s = format (s, "tx_hold %d ", ntohl (mp->tx_hold));
-  s = format (s, "tx_interval %d ", ntohl (mp->tx_interval));
-  FINISH;
-}
-
-static void *vl_api_dns_enable_disable_t_print
-  (vl_api_dns_enable_disable_t * mp, void *handle)
-{
-  u8 *s;
-
-  s = format (0, "SCRIPT: dns_enable_disable ");
-  s = format (s, "%s ", mp->enable ? "enable" : "disable");
-
-  FINISH;
-}
-
 static void *vl_api_sw_interface_set_lldp_t_print
   (vl_api_sw_interface_set_lldp_t * mp, void *handle)
 {
@@ -3683,45 +3679,15 @@ static void *vl_api_sw_interface_set_lldp_t_print
   FINISH;
 }
 
-static void *vl_api_dns_name_server_add_del_t_print
-  (vl_api_dns_name_server_add_del_t * mp, void *handle)
-{
-  u8 *s;
-
-  s = format (0, "SCRIPT: dns_name_server_add_del ");
-  if (mp->is_ip6)
-    s = format (s, "%U ", format_ip6_address,
-               (ip6_address_t *) mp->server_address);
-  else
-    s = format (s, "%U ", format_ip4_address,
-               (ip4_address_t *) mp->server_address);
-
-  if (mp->is_add == 0)
-    s = format (s, "del ");
-
-  FINISH;
-}
-
-static void *vl_api_dns_resolve_name_t_print
-  (vl_api_dns_resolve_name_t * mp, void *handle)
-{
-  u8 *s;
-
-  s = format (0, "SCRIPT: dns_resolve_name ");
-  s = format (s, "%s ", mp->name);
-  FINISH;
-}
-
-static void *vl_api_dns_resolve_ip_t_print
-  (vl_api_dns_resolve_ip_t * mp, void *handle)
+static void *vl_api_lldp_config_t_print
+  (vl_api_lldp_config_t * mp, void *handle)
 {
   u8 *s;
 
-  s = format (0, "SCRIPT: dns_resolve_ip ");
-  if (mp->is_ip6)
-    s = format (s, "%U ", format_ip6_address, mp->address);
-  else
-    s = format (s, "%U ", format_ip4_address, mp->address);
+  s = format (0, "SCRIPT: lldp_config ");
+  s = format (s, "system_name %s ", mp->system_name);
+  s = format (s, "tx_hold %d ", ntohl (mp->tx_hold));
+  s = format (s, "tx_interval %d ", ntohl (mp->tx_interval));
   FINISH;
 }
 
@@ -3820,6 +3786,7 @@ _(BOND_CREATE, bond_create)                                             \
 _(BOND_DELETE, bond_delete)                                             \
 _(BOND_ENSLAVE, bond_enslave)                                           \
 _(BOND_DETACH_SLAVE, bond_detach_slave)                                 \
+_(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight)           \
 _(SW_INTERFACE_SLAVE_DUMP, sw_interface_slave_dump)                     \
 _(SW_INTERFACE_BOND_DUMP, sw_interface_bond_dump)                       \
 _(SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump)       \
@@ -3999,10 +3966,6 @@ _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses)              \
 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del)                         \
 _(LLDP_CONFIG, lldp_config)                                             \
 _(SW_INTERFACE_SET_LLDP, sw_interface_set_lldp)                                \
-_(DNS_ENABLE_DISABLE, dns_enable_disable)                               \
-_(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del)                     \
-_(DNS_RESOLVE_NAME, dns_resolve_name)                                  \
-_(DNS_RESOLVE_IP, dns_resolve_ip)                                      \
 _(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)                   \
 _(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable)                        \