X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2Fapi%2Fcustom_dump.c;h=ab98954abbcab0cd7b84ae63a8c603fcb917ae38;hb=3b0d7e42f;hp=baa675c908d9cb866fdff7f5073bc5d56b89f3a1;hpb=f94c63ea392a79b509a7b8263f5a9372a58786f9;p=vpp.git diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index baa675c908d..ab98954abbc 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -43,9 +45,11 @@ #include #include +#include #include #include +#include #include @@ -506,92 +510,31 @@ static void *vl_api_bd_ip_mac_add_del_t_print s = format (0, "SCRIPT: bd_ip_mac_add_del "); s = format (s, "bd_id %d ", ntohl (mp->bd_id)); - if (mp->is_ipv6) - s = format (s, "%U ", format_ip6_address, - (ip6_address_t *) mp->ip_address); - else - s = format (s, "%U ", format_ip4_address, - (ip4_address_t *) mp->ip_address); - - s = format (s, "%U ", format_ethernet_address, mp->mac_address); + s = format (s, "%U ", format_vl_api_address, &mp->ip); + s = format (s, "%U ", format_vl_api_mac_address, &mp->mac); if (mp->is_add == 0) s = format (s, "del "); FINISH; } -static void *vl_api_bd_ip_mac_dump_t_print - (vl_api_bd_ip_mac_dump_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: bd_ip_mac_dump "); - - FINISH; -} - -static void *vl_api_tap_connect_t_print - (vl_api_tap_connect_t * mp, void *handle) +static void *vl_api_bd_ip_mac_flush_t_print + (vl_api_bd_ip_mac_flush_t * mp, void *handle) { u8 *s; - u8 null_mac[6]; - memset (null_mac, 0, sizeof (null_mac)); - - s = format (0, "SCRIPT: tap_connect "); - s = format (s, "tapname %s ", mp->tap_name); - if (mp->use_random_mac) - s = format (s, "random-mac "); - if (mp->tag[0]) - s = format (s, "tag %s ", mp->tag); - if (memcmp (mp->mac_address, null_mac, 6)) - s = format (s, "mac %U ", format_ethernet_address, mp->mac_address); - if (mp->ip4_address_set) - s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address, - mp->ip4_mask_width); - if (mp->ip6_address_set) - s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address, - mp->ip6_mask_width); - FINISH; -} - -static void *vl_api_tap_modify_t_print - (vl_api_tap_modify_t * mp, void *handle) -{ - u8 *s; - u8 null_mac[6]; - - memset (null_mac, 0, sizeof (null_mac)); - - s = format (0, "SCRIPT: tap_modify "); - s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); - s = format (s, "tapname %s ", mp->tap_name); - if (mp->use_random_mac) - s = format (s, "random-mac "); - - if (memcmp (mp->mac_address, null_mac, 6)) - s = format (s, "mac %U ", format_ethernet_address, mp->mac_address); - - FINISH; -} - -static void *vl_api_tap_delete_t_print - (vl_api_tap_delete_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: tap_delete "); - s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + s = format (0, "SCRIPT: bd_ip_mac_flush "); + s = format (s, "bd_id %d ", ntohl (mp->bd_id)); FINISH; } -static void *vl_api_sw_interface_tap_dump_t_print - (vl_api_sw_interface_tap_dump_t * mp, void *handle) +static void *vl_api_bd_ip_mac_dump_t_print + (vl_api_bd_ip_mac_dump_t * mp, void *handle) { u8 *s; - s = format (0, "SCRIPT: sw_interface_tap_dump "); + s = format (0, "SCRIPT: bd_ip_mac_dump "); FINISH; } @@ -602,7 +545,7 @@ static void *vl_api_tap_create_v2_t_print u8 *s; u8 null_mac[6]; - memset (null_mac, 0, sizeof (null_mac)); + clib_memset (null_mac, 0, sizeof (null_mac)); s = format (0, "SCRIPT: tap_create_v2 "); s = format (s, "id %u ", ntohl (mp->id)); @@ -656,22 +599,67 @@ static void *vl_api_sw_interface_tap_v2_dump_t_print FINISH; } +static void *vl_api_virtio_pci_create_t_print + (vl_api_virtio_pci_create_t * mp, void *handle) +{ + u8 *s; + u8 null_mac[6]; + + clib_memset (null_mac, 0, sizeof (null_mac)); + + s = format (0, "SCRIPT: virtio_pci_create "); + s = format (s, "pci_addr %U ", format_vlib_pci_addr, ntohl (mp->pci_addr)); + if (memcmp (mp->mac_address, null_mac, 6)) + s = format (s, "mac-address %U ", + format_ethernet_address, mp->mac_address); + if (mp->tx_ring_sz) + s = format (s, "tx-ring-size %u ", ntohs (mp->tx_ring_sz)); + if (mp->rx_ring_sz) + s = format (s, "rx-ring-size %u ", ntohs (mp->rx_ring_sz)); + if (mp->features) + s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features)); + FINISH; +} + +static void *vl_api_virtio_pci_delete_t_print + (vl_api_virtio_pci_delete_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: virtio_pci_delete "); + s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + + FINISH; +} + +static void *vl_api_sw_interface_virtio_pci_dump_t_print + (vl_api_sw_interface_virtio_pci_dump_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: sw_interface_virtio_pci_dump "); + + FINISH; +} + static void *vl_api_bond_create_t_print (vl_api_bond_create_t * mp, void *handle) { u8 *s; u8 null_mac[6]; - memset (null_mac, 0, sizeof (null_mac)); + clib_memset (null_mac, 0, sizeof (null_mac)); s = format (0, "SCRIPT: bond_create "); if (memcmp (mp->mac_address, null_mac, 6)) s = format (s, "mac-address %U ", format_ethernet_address, mp->mac_address); if (mp->mode) - s = format (s, "mode %U", format_bond_mode, mp->mode); + s = format (s, "mode %U ", format_bond_mode, mp->mode); if (mp->lb) - s = format (s, "lb %U", format_bond_load_balance, mp->lb); + s = format (s, "lb %U ", format_bond_load_balance, mp->lb); + if (mp->id != ~0) + s = format (s, "id %u ", ntohl (mp->id)); FINISH; } @@ -911,11 +899,10 @@ static void *vl_api_proxy_arp_add_del_t_print s = format (0, "SCRIPT: proxy_arp_add_del "); s = format (s, "%U - %U ", - format_ip4_address, mp->proxy.low_address, - format_ip4_address, mp->proxy.hi_address); + format_vl_api_ip4_address, mp->proxy.low, + format_vl_api_ip4_address, mp->proxy.hi); - if (mp->proxy.vrf_id) - s = format (s, "vrf %d ", ntohl (mp->proxy.vrf_id)); + s = format (s, "table %d ", ntohl (mp->proxy.table_id)); if (mp->is_add == 0) s = format (s, "del "); @@ -944,19 +931,34 @@ static void *vl_api_mpls_tunnel_add_del_t_print s = format (0, "SCRIPT: mpls_tunnel_add_del "); - if (mp->mt_next_hop_sw_if_index) - s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index)); + if (mp->mt_is_add == 0) + s = format (s, "del sw_if_index %d ", ntohl (mp->mt_sw_if_index)); - if (mp->mt_next_hop_proto_is_ip4) - s = format (s, "%U ", format_ip4_address, mp->mt_next_hop); + mpls_label_t label = ntohl (mp->mt_next_hop_via_label); + if (label != MPLS_LABEL_INVALID) + s = format (s, "via-label %d ", label); + else if (mp->mt_next_hop_proto_is_ip4) + s = format (s, "via %U ", format_ip4_address, mp->mt_next_hop); else - s = format (s, "%U ", format_ip6_address, mp->mt_next_hop); + s = format (s, "via %U ", format_ip6_address, mp->mt_next_hop); + + if (mp->mt_next_hop_sw_if_index != ~0) + s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index)); + else if (mp->mt_next_hop_table_id) + s = format (s, "next-hop-table %d ", ntohl (mp->mt_next_hop_table_id)); if (mp->mt_l2_only) s = format (s, "l2-only "); - if (mp->mt_is_add == 0) - s = format (s, "del "); + if (mp->mt_next_hop_n_out_labels) + { + u8 i; + for (i = 0; i < mp->mt_next_hop_n_out_labels; i++) + { + s = format (s, "out-label %d ", + ntohl (mp->mt_next_hop_out_label_stack[i].label)); + } + } FINISH; } @@ -1019,31 +1021,21 @@ static void *vl_api_ip_neighbor_add_del_t_print (vl_api_ip_neighbor_add_del_t * mp, void *handle) { u8 *s; - u8 null_mac[6]; - - memset (null_mac, 0, sizeof (null_mac)); s = format (0, "SCRIPT: ip_neighbor_add_del "); - s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + s = format (s, "sw_if_index %d ", ntohl (mp->neighbor.sw_if_index)); - if (mp->is_static) + if (IP_API_NEIGHBOR_FLAG_STATIC & ntohl (mp->neighbor.flags)) s = format (s, "is_static "); - if (mp->is_no_adj_fib) + if (IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY & ntohl (mp->neighbor.flags)) s = format (s, "is_no_fib_entry "); - if (memcmp (mp->mac_address, null_mac, 6)) - s = format (s, "mac %U ", format_ethernet_address, mp->mac_address); + s = format (s, "mac %U ", format_vl_api_mac_address, + &mp->neighbor.mac_address); - if (mp->is_ipv6) - s = - format (s, "dst %U ", format_ip6_address, - (ip6_address_t *) mp->dst_address); - else - s = - format (s, "dst %U ", format_ip4_address, - (ip4_address_t *) mp->dst_address); + s = format (s, "dst %U ", format_vl_api_address, &mp->neighbor.ip_address); if (mp->is_add == 0) s = format (s, "del "); @@ -1051,6 +1043,7 @@ static void *vl_api_ip_neighbor_add_del_t_print FINISH; } + static void *vl_api_create_vlan_subif_t_print (vl_api_create_vlan_subif_t * mp, void *handle) { @@ -1259,20 +1252,6 @@ static void *vl_api_set_ip_flow_hash_t_print FINISH; } -static void *vl_api_sw_interface_ip6_set_link_local_address_t_print - (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address "); - - s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); - - s = format (s, "%U ", format_ip6_address, mp->address); - - FINISH; -} - static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle) { @@ -1282,8 +1261,7 @@ static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); - s = format (s, "%U/%d ", format_ip6_address, mp->address, - mp->address_length); + s = format (s, "%U ", format_vl_api_prefix, &mp->prefix); s = format (s, "val_life %d ", ntohl (mp->val_lifetime)); @@ -1908,16 +1886,13 @@ static void *vl_api_gre_add_del_tunnel_t_print (vl_api_gre_add_del_tunnel_t * mp, void *handle) { u8 *s; + ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address); + ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address); s = format (0, "SCRIPT: gre_add_del_tunnel "); - s = format (s, "dst %U ", format_ip46_address, - (ip46_address_t *) & (mp->dst_address), - mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4); - - s = format (s, "src %U ", format_ip46_address, - (ip46_address_t *) & (mp->src_address), - mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4); + s = format (s, "dst %U ", format_ip46_address, &dst, IP46_TYPE_ANY); + s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY); s = format (s, "instance %d ", ntohl (mp->instance)); @@ -2113,10 +2088,10 @@ static void *vl_api_cli_inband_t_print { u8 *s; u8 *cmd = 0; - u32 length = ntohl (mp->length); + u32 length = vl_api_string_len (&mp->cmd); vec_validate (cmd, length); - clib_memcpy (cmd, mp->cmd, length); + clib_memcpy (cmd, vl_api_from_api_string (&mp->cmd), length); s = format (0, "SCRIPT: exec %v ", cmd); @@ -2154,6 +2129,16 @@ static void *vl_api_show_version_t_print FINISH; } +static void *vl_api_show_threads_t_print + (vl_api_show_threads_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: show_threads "); + + FINISH; +} + static void *vl_api_vxlan_gpe_add_del_tunnel_t_print (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle) { @@ -2223,10 +2208,7 @@ static void *vl_api_ip_probe_neighbor_t_print s = format (0, "SCRIPT: ip_probe_neighbor "); s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); - if (mp->is_ipv6) - s = format (s, "address %U ", format_ip6_address, &mp->dst_address); - else - s = format (s, "address %U ", format_ip4_address, &mp->dst_address); + s = format (s, "address %U ", format_vl_api_address, &mp->dst); FINISH; } @@ -2269,7 +2251,7 @@ static void *vl_api_want_ip4_arp_events_t_print s = format (0, "SCRIPT: want_ip4_arp_events "); s = format (s, "pid %d address %U ", ntohl (mp->pid), - format_ip4_address, &mp->address); + format_ip4_address, mp->ip); if (mp->enable_disable == 0) s = format (s, "del "); @@ -2283,7 +2265,7 @@ static void *vl_api_want_ip6_nd_events_t_print s = format (0, "SCRIPT: want_ip6_nd_events "); s = format (s, "pid %d address %U ", ntohl (mp->pid), - format_ip6_address, mp->address); + format_vl_api_ip6_address, mp->ip); if (mp->enable_disable == 0) s = format (s, "del "); @@ -2873,12 +2855,7 @@ static void *vl_api_ip_source_and_port_range_check_add_del_t_print int i; s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del "); - if (mp->is_ipv6) - s = format (s, "%U/%d ", format_ip6_address, mp->address, - mp->mask_length); - else - s = format (s, "%U/%d ", format_ip4_address, mp->address, - mp->mask_length); + s = format (s, "%U ", format_vl_api_prefix, &mp->prefix); for (i = 0; i < mp->number_of_ranges; i++) { @@ -3357,19 +3334,19 @@ static void *vl_api_flow_classify_set_interface_t_print } static void * -vl_api_punt_t_print (vl_api_punt_t * mp, void *handle) +vl_api_set_punt_t_print (vl_api_set_punt_t * mp, void *handle) { u8 *s; s = format (0, "SCRIPT: punt "); - if (mp->ipv != (u8) ~ 0) - s = format (s, "ip %d ", mp->ipv); + if (mp->punt.ipv != (u8) ~ 0) + s = format (s, "ip %d ", mp->punt.ipv); - s = format (s, "protocol %d ", mp->l4_protocol); + s = format (s, "protocol %d ", mp->punt.l4_protocol); - if (mp->l4_port != (u16) ~ 0) - s = format (s, "port %d ", ntohs (mp->l4_port)); + if (mp->punt.l4_port != (u16) ~ 0) + s = format (s, "port %d ", ntohs (mp->punt.l4_port)); if (!mp->is_add) s = format (s, "del "); @@ -3576,7 +3553,7 @@ static void *vl_api_sw_interface_set_lldp_t_print u8 *s; u8 null_data[256]; - memset (null_data, 0, sizeof (null_data)); + clib_memset (null_data, 0, sizeof (null_data)); s = format (0, "SCRIPT: sw_interface_set_lldp "); s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); @@ -3668,14 +3645,9 @@ static void *vl_api_ip_container_proxy_add_del_t_print { u8 *s; s = format (0, "SCRIPT: ip_container_proxy_add_del "); - if (mp->is_ip4) - s = format (s, "is_add %d address %U/%d sw_if_index %d", - mp->is_add, format_ip4_address, - (ip4_address_t *) mp->ip, mp->plen, mp->sw_if_index); - else - s = format (s, "is_add %d address %U/%d sw_if_index %d", - mp->is_add, format_ip6_address, - (ip6_address_t *) mp->ip, mp->plen, mp->sw_if_index); + s = format (s, "is_add %d prefix %U sw_if_index %d", + mp->is_add, format_vl_api_prefix, mp->sw_if_index); + FINISH; } @@ -3686,9 +3658,8 @@ static void *vl_api_qos_record_enable_disable_t_print s = format (0, "SCRIPT: qos_record_enable_disable "); s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); - s = - format (s, "input_source %U ", format_qos_source, - ntohl (mp->input_source)); + s = format (s, "input_source %U ", format_qos_source, + ntohl (mp->input_source)); if (!mp->enable) s = format (s, "disable "); @@ -3725,10 +3696,6 @@ _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \ _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \ _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \ _(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass) \ -_(TAP_CONNECT, tap_connect) \ -_(TAP_MODIFY, tap_modify) \ -_(TAP_DELETE, tap_delete) \ -_(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \ _(BOND_CREATE, bond_create) \ _(BOND_DELETE, bond_delete) \ _(BOND_ENSLAVE, bond_enslave) \ @@ -3754,8 +3721,6 @@ _(RESET_FIB, reset_fib) \ _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \ _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \ _(SET_IP_FLOW_HASH, set_ip_flow_hash) \ -_(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \ - sw_interface_ip6_set_link_local_address) \ _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \ _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \ _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \ @@ -3823,6 +3788,7 @@ _(IP_ADDRESS_DUMP, ip_address_dump) \ _(IP_DUMP, ip_dump) \ _(DELETE_LOOPBACK, delete_loopback) \ _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \ +_(BD_IP_MAC_FLUSH, bd_ip_mac_flush) \ _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \ _(AF_PACKET_CREATE, af_packet_create) \ @@ -3887,7 +3853,7 @@ _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \ _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \ _(DELETE_SUBIF, delete_subif) \ _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \ -_(PUNT, punt) \ +_(SET_PUNT, set_punt) \ _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \ _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \ _(GET_FIRST_MSG_ID, get_first_msg_id) \