X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2Fapi%2Fcustom_dump.c;h=1e841effae9116b3bfae09175d0bc37de25d9ab7;hb=20e1f2acd5d05a0a238ab8b8a870273799423e83;hp=a7dca9891e152a024994838c500108fe7c7d36d6;hpb=82786c418ffec3eede70d747747a23153a27778d;p=vpp.git diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index a7dca9891e1..1e841effae9 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -21,11 +21,10 @@ #include #include #include -#include -#include +#include #include #include -#include +#include #include #include #include @@ -73,6 +72,18 @@ static void *vl_api_create_loopback_t_print FINISH; } +static void *vl_api_create_loopback_instance_t_print + (vl_api_create_loopback_instance_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: create_loopback "); + s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address); + s = format (s, "instance %d ", ntohl (mp->user_instance)); + + FINISH; +} + static void *vl_api_delete_loopback_t_print (vl_api_delete_loopback_t * mp, void *handle) { @@ -238,58 +249,6 @@ static void *vl_api_sw_interface_set_l2_bridge_t_print FINISH; } -#if DPDK > 0 -static void *vl_api_sw_interface_set_dpdk_hqos_pipe_t_print - (vl_api_sw_interface_set_dpdk_hqos_pipe_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_pipe "); - - s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index)); - - s = format (s, "subport %u pipe %u profile %u ", - ntohl (mp->subport), ntohl (mp->pipe), ntohl (mp->profile)); - - FINISH; -} - -static void *vl_api_sw_interface_set_dpdk_hqos_subport_t_print - (vl_api_sw_interface_set_dpdk_hqos_subport_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_subport "); - - s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index)); - - s = - format (s, - "subport %u rate %u bkt_size %u tc0 %u tc1 %u tc2 %u tc3 %u period %u", - ntohl (mp->subport), ntohl (mp->tb_rate), ntohl (mp->tb_size), - ntohl (mp->tc_rate[0]), ntohl (mp->tc_rate[1]), - ntohl (mp->tc_rate[2]), ntohl (mp->tc_rate[3]), - ntohl (mp->tc_period)); - - FINISH; -} - -static void *vl_api_sw_interface_set_dpdk_hqos_tctbl_t_print - (vl_api_sw_interface_set_dpdk_hqos_tctbl_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_tctbl "); - - s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index)); - - s = format (s, "entry %u tc %u queue %u", - ntohl (mp->entry), ntohl (mp->tc), ntohl (mp->queue)); - - FINISH; -} -#endif - static void *vl_api_bridge_domain_add_del_t_print (vl_api_bridge_domain_add_del_t * mp, void *handle) { @@ -634,7 +593,8 @@ static void *vl_api_ip_neighbor_add_del_t_print if (mp->is_static) s = format (s, "is_static "); - s = format (s, "vrf_id %d ", ntohl (mp->vrf_id)); + if (mp->is_no_adj_fib) + 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); @@ -772,37 +732,6 @@ static void *vl_api_dhcp_proxy_config_t_print { u8 *s; - s = format (0, "SCRIPT: dhcp_proxy_config "); - - s = format (s, "vrf_id %d ", ntohl (mp->vrf_id)); - - if (mp->is_ipv6) - { - s = format (s, "svr %U ", format_ip6_address, - (ip6_address_t *) mp->dhcp_server); - s = format (s, "src %U ", format_ip6_address, - (ip6_address_t *) mp->dhcp_src_address); - } - else - { - s = format (s, "svr %U ", format_ip4_address, - (ip4_address_t *) mp->dhcp_server); - s = format (s, "src %U ", format_ip4_address, - (ip4_address_t *) mp->dhcp_src_address); - } - if (mp->is_add == 0) - s = format (s, "del "); - - s = format (s, "insert-cid %d ", mp->insert_circuit_id); - - FINISH; -} - -static void *vl_api_dhcp_proxy_config_2_t_print - (vl_api_dhcp_proxy_config_2_t * mp, void *handle) -{ - u8 *s; - s = format (0, "SCRIPT: dhcp_proxy_config_2 "); s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id)); @@ -825,8 +754,6 @@ static void *vl_api_dhcp_proxy_config_2_t_print if (mp->is_add == 0) s = format (s, "del "); - s = format (s, "insert-cid %d ", mp->insert_circuit_id); - FINISH; } @@ -865,7 +792,7 @@ static void *vl_api_dhcp_client_config_t_print s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event); - s = format (s, "pid %d ", mp->pid); + s = format (s, "pid %d ", ntohl (mp->pid)); if (mp->is_add == 0) s = format (s, "del "); @@ -1036,143 +963,215 @@ static void *vl_api_l2_patch_add_del_t_print FINISH; } -static void *vl_api_sr_tunnel_add_del_t_print - (vl_api_sr_tunnel_add_del_t * mp, void *handle) +static void *vl_api_sr_localsid_add_del_t_print + (vl_api_sr_localsid_add_del_t * mp, void *handle) { + vnet_main_t *vnm = vnet_get_main (); u8 *s; - ip6_address_t *this_address; - int i; - u16 flags_host_byte_order; - u8 pl_flag; - - s = format (0, "SCRIPT: sr_tunnel_add_del "); - if (mp->name[0]) - s = format (s, "name %s ", mp->name); + s = format (0, "SCRIPT: sr_localsid_add_del "); - s = format (s, "src %U dst %U/%d ", format_ip6_address, - (ip6_address_t *) mp->src_address, - format_ip6_address, - (ip6_address_t *) mp->dst_address, mp->dst_mask_width); - - this_address = (ip6_address_t *) mp->segs_and_tags; - for (i = 0; i < mp->n_segments; i++) + switch (mp->behavior) { - s = format (s, "next %U ", format_ip6_address, this_address); - this_address++; - } - for (i = 0; i < mp->n_tags; i++) - { - s = format (s, "tag %U ", format_ip6_address, this_address); - this_address++; + case SR_BEHAVIOR_END: + s = format (s, "Address: %U\nBehavior: End", + format_ip6_address, (ip6_address_t *) mp->localsid_addr); + s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False")); + break; + case SR_BEHAVIOR_X: + s = + format (s, + "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)" + "\nIface: %U\nNext hop: %U", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, + format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index), + format_ip6_address, (ip6_address_t *) mp->nh_addr); + s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False")); + break; + case SR_BEHAVIOR_DX4: + s = + format (s, + "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)" + "\nIface: %U\nNext hop: %U", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, + format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index), + format_ip4_address, (ip4_address_t *) mp->nh_addr); + break; + case SR_BEHAVIOR_DX6: + s = + format (s, + "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)" + "\nIface: %UNext hop: %U", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, + format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index), + format_ip6_address, (ip6_address_t *) mp->nh_addr); + break; + case SR_BEHAVIOR_DX2: + s = + format (s, + "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)" + "\nIface: %U", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, + format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index)); + break; + case SR_BEHAVIOR_DT6: + s = + format (s, + "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)" + "\nTable: %u", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table)); + break; + case SR_BEHAVIOR_DT4: + s = + format (s, + "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)" + "\nTable: %u", format_ip6_address, + (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table)); + break; + default: + if (mp->behavior >= SR_BEHAVIOR_LAST) + { + s = format (s, "Address: %U\n Behavior: %u", + format_ip6_address, (ip6_address_t *) mp->localsid_addr, + mp->behavior); + } + else + //Should never get here... + s = format (s, "Internal error"); + break; } + FINISH; +} - flags_host_byte_order = clib_net_to_host_u16 (mp->flags_net_byte_order); +static void *vl_api_sr_steering_add_del_t_print + (vl_api_sr_steering_add_del_t * mp, void *handle) +{ + u8 *s; - if (flags_host_byte_order & IP6_SR_HEADER_FLAG_CLEANUP) - s = format (s, " clean "); + s = format (0, "SCRIPT: sr_steering_add_del "); - if (flags_host_byte_order & IP6_SR_HEADER_FLAG_PROTECTED) - s = format (s, "protected "); + s = format (s, (mp->is_del ? "Del: True" : "Del: False")); - for (i = 1; i <= 4; i++) + switch (mp->traffic_type) { - pl_flag = ip6_sr_policy_list_flags (flags_host_byte_order, i); - - switch (pl_flag) - { - case IP6_SR_HEADER_FLAG_PL_ELT_NOT_PRESENT: - continue; - - case IP6_SR_HEADER_FLAG_PL_ELT_INGRESS_PE: - s = format (s, "InPE %d ", i); - break; - - case IP6_SR_HEADER_FLAG_PL_ELT_EGRESS_PE: - s = format (s, "EgPE %d ", i); - break; - - case IP6_SR_HEADER_FLAG_PL_ELT_ORIG_SRC_ADDR: - s = format (s, "OrgSrc %d ", i); - break; - - default: - clib_warning ("BUG: pl elt %d value %d", i, pl_flag); - break; - } + case SR_STEER_L2: + s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index)); + break; + case SR_STEER_IPV4: + s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address, + (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width)); + break; + case SR_STEER_IPV6: + s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address, + (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width)); + break; + default: + s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type); + break; } + s = format (s, "BindingSID: %U", format_ip6_address, + (ip6_address_t *) mp->bsid_addr); - if (mp->policy_name[0]) - s = format (s, "policy_name %s ", mp->policy_name); + s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index)); - if (mp->is_add == 0) - s = format (s, "del "); + s = format (s, "FIB_table: %u", ntohl (mp->table_id)); FINISH; } -static void *vl_api_sr_policy_add_del_t_print - (vl_api_sr_policy_add_del_t * mp, void *handle) +static void *vl_api_sr_policy_add_t_print + (vl_api_sr_policy_add_t * mp, void *handle) { u8 *s; + + ip6_address_t *segments = 0, *seg; + ip6_address_t *this_address = (ip6_address_t *) mp->segments; + int i; + for (i = 0; i < mp->n_segments; i++) + { + vec_add2 (segments, seg, 1); + clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address)); + this_address++; + } - s = format (0, "SCRIPT: sr_policy_add_del "); + s = format (0, "SCRIPT: sr_policy_add "); - if (mp->name[0]) - s = format (s, "name %s ", mp->name); + s = format (s, "BSID: %U", format_ip6_address, + (ip6_address_t *) mp->bsid_addr); + s = + format (s, + (mp->is_encap ? "Behavior: Encapsulation" : + "Behavior: SRH insertion")); - if (mp->tunnel_names[0]) - { - // start deserializing tunnel_names - int num_tunnels = mp->tunnel_names[0]; //number of tunnels - u8 *deser_tun_names = mp->tunnel_names; - deser_tun_names += 1; //moving along + s = format (s, "FIB_table: %u", ntohl (mp->fib_table)); - u8 *tun_name = 0; - int tun_name_len = 0; + s = format (s, (mp->type ? "Type: Default" : "Type: Spray")); - for (i = 0; i < num_tunnels; i++) - { - tun_name_len = *deser_tun_names; - deser_tun_names += 1; - vec_resize (tun_name, tun_name_len); - memcpy (tun_name, deser_tun_names, tun_name_len); - s = format (s, "tunnel %s ", tun_name); - deser_tun_names += tun_name_len; - tun_name = 0; - } - } + s = format (s, "SID list weight: %u", ntohl (mp->weight)); - if (mp->is_add == 0) - s = format (s, "del "); + s = format (s, "{"); + vec_foreach (seg, segments) + { + s = format (s, "%U, ", format_ip6_address, seg); + } + s = format (s, "\b\b } "); FINISH; } -static void *vl_api_sr_multicast_map_add_del_t_print - (vl_api_sr_multicast_map_add_del_t * mp, void *handle) +static void *vl_api_sr_policy_mod_t_print + (vl_api_sr_policy_mod_t * mp, void *handle) { + u8 *s; + u32 weight; - u8 *s = 0; - /* int i; */ + ip6_address_t *segments = 0, *seg; + ip6_address_t *this_address = (ip6_address_t *) mp->segments; - s = format (0, "SCRIPT: sr_multicast_map_add_del "); + int i; + for (i = 0; i < mp->n_segments; i++) + { + vec_add2 (segments, seg, 1); + clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address)); + this_address++; + } - if (mp->multicast_address[0]) - s = format (s, "address %U ", format_ip6_address, &mp->multicast_address); + s = format (0, "SCRIPT: sr_policy_mod "); - if (mp->policy_name[0]) - s = format (s, "sr-policy %s ", &mp->policy_name); + s = format (s, "BSID: %U", format_ip6_address, + (ip6_address_t *) mp->bsid_addr); + s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index)); - if (mp->is_add == 0) - s = format (s, "del "); + s = format (s, "Operation: %u", mp->operation); + + s = format (s, "SID list index: %u", ntohl (mp->sl_index)); + + s = format (s, "SID list weight: %u", ntohl (mp->weight)); + + s = format (s, "{"); + vec_foreach (seg, segments) + { + s = format (s, "%U, ", format_ip6_address, seg); + } + s = format (s, "\b\b } "); FINISH; } +static void *vl_api_sr_policy_del_t_print + (vl_api_sr_policy_del_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: sr_policy_del "); + u8 bsid_addr[16]; + u32 sr_policy_index; + s = format (s, "To be delivered. Good luck."); + FINISH; +} static void *vl_api_classify_add_del_table_t_print (vl_api_classify_add_del_table_t * mp, void *handle) @@ -1385,10 +1384,8 @@ static void *vl_api_vxlan_add_del_tunnel_t_print u8 *s; s = format (0, "SCRIPT: vxlan_add_del_tunnel "); - ip46_address_t src, dst; - - ip46_from_addr_buf (mp->is_ipv6, mp->dst_address, &dst); - ip46_from_addr_buf (mp->is_ipv6, mp->src_address, &src); + ip46_address_t src = to_ip46 (mp->is_ipv6, mp->dst_address); + ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->src_address); u8 is_grp = ip46_address_is_multicast (&dst); char *dst_name = is_grp ? "group" : "dst"; @@ -1713,7 +1710,7 @@ static void *vl_api_want_ip4_arp_events_t_print u8 *s; s = format (0, "SCRIPT: want_ip4_arp_events "); - s = format (s, "pid %d address %U ", mp->pid, + s = format (s, "pid %d address %U ", ntohl (mp->pid), format_ip4_address, &mp->address); if (mp->enable_disable == 0) s = format (s, "del "); @@ -1727,7 +1724,7 @@ static void *vl_api_want_ip6_nd_events_t_print u8 *s; s = format (0, "SCRIPT: want_ip6_nd_events "); - s = format (s, "pid %d address %U ", mp->pid, + s = format (s, "pid %d address %U ", ntohl (mp->pid), format_ip6_address, mp->address); if (mp->enable_disable == 0) s = format (s, "del "); @@ -2909,6 +2906,7 @@ foreach_custom_print_no_arg_function #undef _ #define foreach_custom_print_function \ _(CREATE_LOOPBACK, create_loopback) \ +_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \ _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \ _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \ @@ -2939,9 +2937,11 @@ _(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) \ _(L2_PATCH_ADD_DEL, l2_patch_add_del) \ -_(SR_TUNNEL_ADD_DEL, sr_tunnel_add_del) \ -_(SR_POLICY_ADD_DEL, sr_policy_add_del) \ -_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \ +_(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \ +_(SR_STEERING_ADD_DEL, sr_steering_add_del) \ +_(SR_POLICY_ADD, sr_policy_add) \ +_(SR_POLICY_MOD, sr_policy_mod) \ +_(SR_POLICY_DEL, sr_policy_del) \ _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \ _(L2FIB_ADD_DEL, l2fib_add_del) \ _(L2_FLAGS, l2_flags) \ @@ -2954,7 +2954,6 @@ _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \ _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \ _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \ _(ADD_NODE_NEXT, add_node_next) \ -_(DHCP_PROXY_CONFIG_2, dhcp_proxy_config_2) \ _(DHCP_CLIENT_CONFIG, dhcp_client_config) \ _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \ _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \ @@ -3071,18 +3070,6 @@ vl_msg_api_custom_dump_configure (api_main_t * am) = (void *) vl_api_##f##_t_print; foreach_custom_print_function; #undef _ - -#if DPDK > 0 - /* - * manually add DPDK hqos print handlers - */ - am->msg_print_handlers[VL_API_SW_INTERFACE_SET_DPDK_HQOS_PIPE] = - (void *) vl_api_sw_interface_set_dpdk_hqos_pipe_t_print; - am->msg_print_handlers[VL_API_SW_INTERFACE_SET_DPDK_HQOS_SUBPORT] = - (void *) vl_api_sw_interface_set_dpdk_hqos_subport_t_print; - am->msg_print_handlers[VL_API_SW_INTERFACE_SET_DPDK_HQOS_TCTBL] = - (void *) vl_api_sw_interface_set_dpdk_hqos_tctbl_t_print; -#endif } /*