vam->result_ready = 1;
}
-static void vl_api_af_packet_create_reply_t_handler
- (vl_api_af_packet_create_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- vam->retval = retval;
- vam->regenerate_interface_table = 1;
- vam->sw_if_index = ntohl (mp->sw_if_index);
- vam->result_ready = 1;
-}
-
-static void vl_api_af_packet_create_reply_t_handler_json
- (vl_api_af_packet_create_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static void vl_api_create_vlan_subif_reply_t_handler
(vl_api_create_vlan_subif_reply_t * mp)
{
vam->result_ready = 1;
}
-static void
-vl_api_tap_create_v2_reply_t_handler (vl_api_tap_create_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->sw_if_index = ntohl (mp->sw_if_index);
- vam->result_ready = 1;
- }
-
-}
-
-static void vl_api_tap_create_v2_reply_t_handler_json
- (vl_api_tap_create_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-
-}
-
-static void
-vl_api_tap_delete_v2_reply_t_handler (vl_api_tap_delete_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->result_ready = 1;
- }
-}
-
-static void vl_api_tap_delete_v2_reply_t_handler_json
- (vl_api_tap_delete_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static void
vl_api_virtio_pci_create_reply_t_handler (vl_api_virtio_pci_create_reply_t *
mp)
vam->result_ready = 1;
}
-static void vl_api_create_vhost_user_if_reply_t_handler
- (vl_api_create_vhost_user_if_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->sw_if_index = ntohl (mp->sw_if_index);
- vam->result_ready = 1;
- }
- vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_reply_t_handler_json
- (vl_api_create_vhost_user_if_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void vl_api_create_vhost_user_if_v2_reply_t_handler
- (vl_api_create_vhost_user_if_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->sw_if_index = ntohl (mp->sw_if_index);
- vam->result_ready = 1;
- }
- vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_v2_reply_t_handler_json
- (vl_api_create_vhost_user_if_v2_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static void vl_api_ip_address_details_t_handler
(vl_api_ip_address_details_t * mp)
{
_(set_ip_flow_hash_reply) \
_(sw_interface_ip6_enable_disable_reply) \
_(l2_patch_add_del_reply) \
-_(sr_mpls_policy_add_reply) \
-_(sr_mpls_policy_mod_reply) \
-_(sr_mpls_policy_del_reply) \
-_(sr_policy_add_reply) \
-_(sr_policy_mod_reply) \
-_(sr_policy_del_reply) \
-_(sr_localsid_add_del_reply) \
-_(sr_steering_add_del_reply) \
_(l2_fib_clear_table_reply) \
_(l2_interface_efp_filter_reply) \
_(l2_interface_vlan_tag_rewrite_reply) \
-_(modify_vhost_user_if_reply) \
-_(modify_vhost_user_if_v2_reply) \
-_(delete_vhost_user_if_reply) \
_(want_l2_macs_events_reply) \
_(delete_loopback_reply) \
_(bd_ip_mac_add_del_reply) \
_(sw_interface_clear_stats_reply) \
_(ioam_enable_reply) \
_(ioam_disable_reply) \
-_(af_packet_delete_reply) \
-_(sw_interface_span_enable_disable_reply) \
_(ip_source_and_port_range_check_add_del_reply) \
_(ip_source_and_port_range_check_interface_add_del_reply)\
_(delete_subif_reply) \
_(l2_interface_pbb_tag_rewrite_reply) \
-_(set_punt_reply) \
_(sw_interface_tag_add_del_reply) \
_(sw_interface_add_del_mac_address_reply) \
_(hw_interface_set_mtu_reply) \
-_(tcp_configure_src_addresses_reply) \
_(session_rule_add_del_reply) \
_(ip_container_proxy_add_del_reply) \
-_(qos_record_enable_disable_reply) \
#define _(n) \
static void vl_api_##n##_t_handler \
_(L2FIB_FLUSH_BD_REPLY, l2fib_flush_bd_reply) \
_(L2_FLAGS_REPLY, l2_flags_reply) \
_(BRIDGE_FLAGS_REPLY, bridge_flags_reply) \
-_(TAP_CREATE_V2_REPLY, tap_create_v2_reply) \
-_(TAP_DELETE_V2_REPLY, tap_delete_v2_reply) \
-_(SW_INTERFACE_TAP_V2_DETAILS, sw_interface_tap_v2_details) \
_(VIRTIO_PCI_CREATE_REPLY, virtio_pci_create_reply) \
_(VIRTIO_PCI_CREATE_V2_REPLY, virtio_pci_create_v2_reply) \
_(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply) \
_(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, \
sw_interface_ip6_enable_disable_reply) \
_(L2_PATCH_ADD_DEL_REPLY, l2_patch_add_del_reply) \
-_(SR_MPLS_POLICY_ADD_REPLY, sr_mpls_policy_add_reply) \
-_(SR_MPLS_POLICY_MOD_REPLY, sr_mpls_policy_mod_reply) \
-_(SR_MPLS_POLICY_DEL_REPLY, sr_mpls_policy_del_reply) \
-_(SR_POLICY_ADD_REPLY, sr_policy_add_reply) \
-_(SR_POLICY_MOD_REPLY, sr_policy_mod_reply) \
-_(SR_POLICY_DEL_REPLY, sr_policy_del_reply) \
-_(SR_LOCALSID_ADD_DEL_REPLY, sr_localsid_add_del_reply) \
-_(SR_STEERING_ADD_DEL_REPLY, sr_steering_add_del_reply) \
_(GET_NODE_INDEX_REPLY, get_node_index_reply) \
_(ADD_NODE_NEXT_REPLY, add_node_next_reply) \
_(L2_FIB_CLEAR_TABLE_REPLY, l2_fib_clear_table_reply) \
_(L2_INTERFACE_EFP_FILTER_REPLY, l2_interface_efp_filter_reply) \
_(L2_INTERFACE_VLAN_TAG_REWRITE_REPLY, l2_interface_vlan_tag_rewrite_reply) \
-_(SW_INTERFACE_VHOST_USER_DETAILS, sw_interface_vhost_user_details) \
-_(CREATE_VHOST_USER_IF_REPLY, create_vhost_user_if_reply) \
-_(MODIFY_VHOST_USER_IF_REPLY, modify_vhost_user_if_reply) \
-_(CREATE_VHOST_USER_IF_V2_REPLY, create_vhost_user_if_v2_reply) \
-_(MODIFY_VHOST_USER_IF_V2_REPLY, modify_vhost_user_if_v2_reply) \
-_(DELETE_VHOST_USER_IF_REPLY, delete_vhost_user_if_reply) \
_(SHOW_VERSION_REPLY, show_version_reply) \
_(SHOW_THREADS_REPLY, show_threads_reply) \
_(L2_FIB_TABLE_DETAILS, l2_fib_table_details) \
_(SW_INTERFACE_CLEAR_STATS_REPLY, sw_interface_clear_stats_reply) \
_(IOAM_ENABLE_REPLY, ioam_enable_reply) \
_(IOAM_DISABLE_REPLY, ioam_disable_reply) \
-_(AF_PACKET_CREATE_REPLY, af_packet_create_reply) \
-_(AF_PACKET_DELETE_REPLY, af_packet_delete_reply) \
-_(AF_PACKET_DETAILS, af_packet_details) \
_(MPLS_TUNNEL_DETAILS, mpls_tunnel_details) \
_(MPLS_TABLE_DETAILS, mpls_table_details) \
_(MPLS_ROUTE_DETAILS, mpls_route_details) \
-_(SW_INTERFACE_SPAN_ENABLE_DISABLE_REPLY, sw_interface_span_enable_disable_reply) \
-_(SW_INTERFACE_SPAN_DETAILS, sw_interface_span_details) \
_(GET_NEXT_INDEX_REPLY, get_next_index_reply) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY, \
ip_source_and_port_range_check_add_del_reply) \
ip_source_and_port_range_check_interface_add_del_reply) \
_(DELETE_SUBIF_REPLY, delete_subif_reply) \
_(L2_INTERFACE_PBB_TAG_REWRITE_REPLY, l2_interface_pbb_tag_rewrite_reply) \
-_(SET_PUNT_REPLY, set_punt_reply) \
_(IP_TABLE_DETAILS, ip_table_details) \
_(IP_ROUTE_DETAILS, ip_route_details) \
_(SW_INTERFACE_TAG_ADD_DEL_REPLY, sw_interface_tag_add_del_reply) \
_(L2_XCONNECT_DETAILS, l2_xconnect_details) \
_(HW_INTERFACE_SET_MTU_REPLY, hw_interface_set_mtu_reply) \
_(SW_INTERFACE_GET_TABLE_REPLY, sw_interface_get_table_reply) \
-_(TCP_CONFIGURE_SRC_ADDRESSES_REPLY, tcp_configure_src_addresses_reply) \
_(APP_NAMESPACE_ADD_DEL_REPLY, app_namespace_add_del_reply) \
_(SESSION_RULE_ADD_DEL_REPLY, session_rule_add_del_reply) \
_(SESSION_RULES_DETAILS, session_rules_details) \
_(IP_CONTAINER_PROXY_ADD_DEL_REPLY, ip_container_proxy_add_del_reply) \
-_(QOS_RECORD_ENABLE_DISABLE_REPLY, qos_record_enable_disable_reply) \
#define foreach_standalone_reply_msg \
_(SW_INTERFACE_EVENT, sw_interface_event)
return ret;
}
+uword
+unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
+{
+ 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]))
+ return 0;
+
+ addr->domain = x[0];
+ addr->bus = x[1];
+ addr->slot = x[2];
+ addr->function = x[3];
+
+ return 1;
+}
+
static int
-api_tap_create_v2 (vat_main_t * vam)
+api_virtio_pci_create_v2 (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_tap_create_v2_t *mp;
+ vl_api_virtio_pci_create_v2_t *mp;
u8 mac_address[6];
u8 random_mac = 1;
- u32 id = ~0;
- u32 num_rx_queues = 0;
- u8 *host_if_name = 0;
- u8 host_if_name_set = 0;
- u8 *host_ns = 0;
- u8 host_ns_set = 0;
- u8 host_mac_addr[6];
- u8 host_mac_addr_set = 0;
- u8 *host_bridge = 0;
- u8 host_bridge_set = 0;
- u8 host_ip4_prefix_set = 0;
- u8 host_ip6_prefix_set = 0;
- ip4_address_t host_ip4_addr;
- ip4_address_t host_ip4_gw;
- u8 host_ip4_gw_set = 0;
- u32 host_ip4_prefix_len = 0;
- ip6_address_t host_ip6_addr;
- ip6_address_t host_ip6_gw;
- u8 host_ip6_gw_set = 0;
- u32 host_ip6_prefix_len = 0;
- u32 host_mtu_size = 0;
- u8 host_mtu_set = 0;
- u32 tap_flags = 0;
+ u32 pci_addr = 0;
+ u64 features = (u64) ~ (0ULL);
+ u32 virtio_flags = 0;
int ret;
- u32 rx_ring_sz = 0, tx_ring_sz = 0;
clib_memset (mac_address, 0, sizeof (mac_address));
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "id %u", &id))
- ;
- else
- if (unformat
- (i, "hw-addr %U", unformat_ethernet_address, mac_address))
- random_mac = 0;
- else if (unformat (i, "host-if-name %s", &host_if_name))
- host_if_name_set = 1;
- else if (unformat (i, "num-rx-queues %u", &num_rx_queues))
- ;
- else if (unformat (i, "host-ns %s", &host_ns))
- host_ns_set = 1;
- else if (unformat (i, "host-mac-addr %U", unformat_ethernet_address,
- host_mac_addr))
- host_mac_addr_set = 1;
- else if (unformat (i, "host-bridge %s", &host_bridge))
- host_bridge_set = 1;
- else if (unformat (i, "host-ip4-addr %U/%u", unformat_ip4_address,
- &host_ip4_addr, &host_ip4_prefix_len))
- host_ip4_prefix_set = 1;
- else if (unformat (i, "host-ip6-addr %U/%u", unformat_ip6_address,
- &host_ip6_addr, &host_ip6_prefix_len))
- host_ip6_prefix_set = 1;
- else if (unformat (i, "host-ip4-gw %U", unformat_ip4_address,
- &host_ip4_gw))
- host_ip4_gw_set = 1;
- else if (unformat (i, "host-ip6-gw %U", unformat_ip6_address,
- &host_ip6_gw))
- host_ip6_gw_set = 1;
- else if (unformat (i, "rx-ring-size %u", &rx_ring_sz))
+ if (unformat (i, "hw-addr %U", unformat_ethernet_address, mac_address))
+ {
+ random_mac = 0;
+ }
+ else if (unformat (i, "pci-addr %U", unformat_vlib_pci_addr, &pci_addr))
;
- else if (unformat (i, "tx-ring-size %u", &tx_ring_sz))
+ else if (unformat (i, "features 0x%llx", &features))
;
- else if (unformat (i, "host-mtu-size %u", &host_mtu_size))
- host_mtu_set = 1;
- else if (unformat (i, "no-gso"))
- tap_flags &= ~TAP_API_FLAG_GSO;
- else if (unformat (i, "gso"))
- tap_flags |= TAP_API_FLAG_GSO;
- else if (unformat (i, "csum-offload"))
- tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD;
- else if (unformat (i, "persist"))
- tap_flags |= TAP_API_FLAG_PERSIST;
- else if (unformat (i, "attach"))
- tap_flags |= TAP_API_FLAG_ATTACH;
- else if (unformat (i, "tun"))
- tap_flags |= TAP_API_FLAG_TUN;
+ else if (unformat (i, "gso-enabled"))
+ virtio_flags |= VIRTIO_API_FLAG_GSO;
+ else if (unformat (i, "csum-offload-enabled"))
+ virtio_flags |= VIRTIO_API_FLAG_CSUM_OFFLOAD;
else if (unformat (i, "gro-coalesce"))
- tap_flags |= TAP_API_FLAG_GRO_COALESCE;
+ virtio_flags |= VIRTIO_API_FLAG_GRO_COALESCE;
else if (unformat (i, "packed"))
- tap_flags |= TAP_API_FLAG_PACKED;
+ virtio_flags |= VIRTIO_API_FLAG_PACKED;
else if (unformat (i, "in-order"))
- tap_flags |= TAP_API_FLAG_IN_ORDER;
+ virtio_flags |= VIRTIO_API_FLAG_IN_ORDER;
+ else if (unformat (i, "buffering"))
+ virtio_flags |= VIRTIO_API_FLAG_BUFFERING;
else
break;
}
- if (vec_len (host_if_name) > 63)
- {
- errmsg ("tap name too long. ");
- return -99;
- }
- if (vec_len (host_ns) > 63)
- {
- errmsg ("host name space too long. ");
- return -99;
- }
- if (vec_len (host_bridge) > 63)
- {
- errmsg ("host bridge name too long. ");
- return -99;
- }
- if (host_ip4_prefix_len > 32)
- {
- errmsg ("host ip4 prefix length not valid. ");
- return -99;
- }
- if (host_ip6_prefix_len > 128)
- {
- errmsg ("host ip6 prefix length not valid. ");
- return -99;
- }
- if (!is_pow2 (rx_ring_sz))
- {
- errmsg ("rx ring size must be power of 2. ");
- return -99;
- }
- if (rx_ring_sz > 32768)
- {
- errmsg ("rx ring size must be 32768 or lower. ");
- return -99;
- }
- if (!is_pow2 (tx_ring_sz))
- {
- errmsg ("tx ring size must be power of 2. ");
- return -99;
- }
- if (tx_ring_sz > 32768)
- {
- errmsg ("tx ring size must be 32768 or lower. ");
- return -99;
- }
- if (host_mtu_set && (host_mtu_size < 64 || host_mtu_size > 65355))
+ if (pci_addr == 0)
{
- errmsg ("host MTU size must be in between 64 and 65355. ");
+ errmsg ("pci address must be non zero. ");
return -99;
}
/* Construct the API message */
- M (TAP_CREATE_V2, mp);
+ M (VIRTIO_PCI_CREATE_V2, mp);
- mp->id = ntohl (id);
mp->use_random_mac = random_mac;
- mp->num_rx_queues = (u8) num_rx_queues;
- mp->tx_ring_sz = ntohs (tx_ring_sz);
- mp->rx_ring_sz = ntohs (rx_ring_sz);
- mp->host_mtu_set = host_mtu_set;
- mp->host_mtu_size = ntohl (host_mtu_size);
- mp->host_mac_addr_set = host_mac_addr_set;
- mp->host_ip4_prefix_set = host_ip4_prefix_set;
- mp->host_ip6_prefix_set = host_ip6_prefix_set;
- mp->host_ip4_gw_set = host_ip4_gw_set;
- mp->host_ip6_gw_set = host_ip6_gw_set;
- mp->tap_flags = ntohl (tap_flags);
- mp->host_namespace_set = host_ns_set;
- mp->host_if_name_set = host_if_name_set;
- mp->host_bridge_set = host_bridge_set;
+
+ mp->pci_addr.domain = htons (((vlib_pci_addr_t) pci_addr).domain);
+ mp->pci_addr.bus = ((vlib_pci_addr_t) pci_addr).bus;
+ mp->pci_addr.slot = ((vlib_pci_addr_t) pci_addr).slot;
+ mp->pci_addr.function = ((vlib_pci_addr_t) pci_addr).function;
+
+ mp->features = clib_host_to_net_u64 (features);
+ mp->virtio_flags = clib_host_to_net_u32 (virtio_flags);
if (random_mac == 0)
clib_memcpy (mp->mac_address, mac_address, 6);
- if (host_mac_addr_set)
- clib_memcpy (mp->host_mac_addr, host_mac_addr, 6);
- if (host_if_name_set)
- clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
- if (host_ns_set)
- clib_memcpy (mp->host_namespace, host_ns, vec_len (host_ns));
- if (host_bridge_set)
- clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge));
- if (host_ip4_prefix_set)
- {
- clib_memcpy (mp->host_ip4_prefix.address, &host_ip4_addr, 4);
- mp->host_ip4_prefix.len = (u8) host_ip4_prefix_len;
- }
- if (host_ip6_prefix_set)
- {
- clib_memcpy (mp->host_ip6_prefix.address, &host_ip6_addr, 16);
- mp->host_ip6_prefix.len = (u8) host_ip6_prefix_len;
- }
- if (host_ip4_gw_set)
- clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
- if (host_ip6_gw_set)
- clib_memcpy (mp->host_ip6_gw, &host_ip6_gw, 16);
-
- vec_free (host_ns);
- vec_free (host_if_name);
- vec_free (host_bridge);
/* send it... */
S (mp);
}
static int
-api_tap_delete_v2 (vat_main_t * vam)
+api_virtio_pci_delete (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_tap_delete_v2_t *mp;
+ vl_api_virtio_pci_delete_t *mp;
u32 sw_if_index = ~0;
u8 sw_if_index_set = 0;
int ret;
}
/* Construct the API message */
- M (TAP_DELETE_V2, mp);
+ M (VIRTIO_PCI_DELETE, mp);
- mp->sw_if_index = ntohl (sw_if_index);
+ mp->sw_if_index = htonl (sw_if_index);
/* send it... */
S (mp);
return ret;
}
-uword
-unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
+static int
+api_ip_table_add_del (vat_main_t * vam)
{
- 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]))
- return 0;
-
- addr->domain = x[0];
- addr->bus = x[1];
- addr->slot = x[2];
- addr->function = x[3];
-
- return 1;
-}
-
-static int
-api_virtio_pci_create_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_virtio_pci_create_v2_t *mp;
- u8 mac_address[6];
- u8 random_mac = 1;
- u32 pci_addr = 0;
- u64 features = (u64) ~ (0ULL);
- u32 virtio_flags = 0;
- int ret;
-
- clib_memset (mac_address, 0, sizeof (mac_address));
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "hw-addr %U", unformat_ethernet_address, mac_address))
- {
- random_mac = 0;
- }
- else if (unformat (i, "pci-addr %U", unformat_vlib_pci_addr, &pci_addr))
- ;
- else if (unformat (i, "features 0x%llx", &features))
- ;
- else if (unformat (i, "gso-enabled"))
- virtio_flags |= VIRTIO_API_FLAG_GSO;
- else if (unformat (i, "csum-offload-enabled"))
- virtio_flags |= VIRTIO_API_FLAG_CSUM_OFFLOAD;
- else if (unformat (i, "gro-coalesce"))
- virtio_flags |= VIRTIO_API_FLAG_GRO_COALESCE;
- else if (unformat (i, "packed"))
- virtio_flags |= VIRTIO_API_FLAG_PACKED;
- else if (unformat (i, "in-order"))
- virtio_flags |= VIRTIO_API_FLAG_IN_ORDER;
- else if (unformat (i, "buffering"))
- virtio_flags |= VIRTIO_API_FLAG_BUFFERING;
- else
- break;
- }
-
- if (pci_addr == 0)
- {
- errmsg ("pci address must be non zero. ");
- return -99;
- }
-
- /* Construct the API message */
- M (VIRTIO_PCI_CREATE_V2, mp);
-
- mp->use_random_mac = random_mac;
-
- mp->pci_addr.domain = htons (((vlib_pci_addr_t) pci_addr).domain);
- mp->pci_addr.bus = ((vlib_pci_addr_t) pci_addr).bus;
- mp->pci_addr.slot = ((vlib_pci_addr_t) pci_addr).slot;
- mp->pci_addr.function = ((vlib_pci_addr_t) pci_addr).function;
-
- mp->features = clib_host_to_net_u64 (features);
- mp->virtio_flags = clib_host_to_net_u32 (virtio_flags);
-
- if (random_mac == 0)
- clib_memcpy (mp->mac_address, mac_address, 6);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_virtio_pci_delete (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_virtio_pci_delete_t *mp;
- u32 sw_if_index = ~0;
- u8 sw_if_index_set = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing vpp interface name. ");
- return -99;
- }
-
- /* Construct the API message */
- M (VIRTIO_PCI_DELETE, mp);
-
- mp->sw_if_index = htonl (sw_if_index);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_ip_table_add_del (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_ip_table_add_del_t *mp;
- u32 table_id = ~0;
- u8 is_ipv6 = 0;
- u8 is_add = 1;
- int ret = 0;
+ unformat_input_t *i = vam->input;
+ vl_api_ip_table_add_del_t *mp;
+ u32 table_id = ~0;
+ u8 is_ipv6 = 0;
+ u8 is_add = 1;
+ int ret = 0;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
return (0);
}
-static int
-api_sr_mpls_policy_add (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sr_mpls_policy_add_t *mp;
- u32 bsid = 0;
- u32 weight = 1;
- u8 type = 0;
- u8 n_segments = 0;
- u32 sid;
- u32 *segments = NULL;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "bsid %d", &bsid))
- ;
- else if (unformat (i, "weight %d", &weight))
- ;
- else if (unformat (i, "spray"))
- type = 1;
- else if (unformat (i, "next %d", &sid))
- {
- n_segments += 1;
- vec_add1 (segments, htonl (sid));
- }
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (bsid == 0)
- {
- errmsg ("bsid not set");
- return -99;
- }
-
- if (n_segments == 0)
- {
- errmsg ("no sid in segment stack");
- return -99;
- }
-
- /* Construct the API message */
- M2 (SR_MPLS_POLICY_ADD, mp, sizeof (u32) * n_segments);
-
- mp->bsid = htonl (bsid);
- mp->weight = htonl (weight);
- mp->is_spray = type;
- mp->n_segments = n_segments;
- memcpy (mp->segments, segments, sizeof (u32) * n_segments);
- vec_free (segments);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_sr_mpls_policy_del (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sr_mpls_policy_del_t *mp;
- u32 bsid = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "bsid %d", &bsid))
- ;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (bsid == 0)
- {
- errmsg ("bsid not set");
- return -99;
- }
-
- /* Construct the API message */
- M (SR_MPLS_POLICY_DEL, mp);
-
- mp->bsid = htonl (bsid);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
static int
api_mpls_tunnel_add_del (vat_main_t * vam)
{
u32 fib_table;
u8 nh_addr[16];
-static int
-api_sr_localsid_add_del (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sr_localsid_add_del_t *mp;
-
- u8 is_del;
- ip6_address_t localsid;
- u8 end_psp = 0;
- u8 behavior = ~0;
- u32 sw_if_index;
- u32 fib_table = ~(u32) 0;
- ip46_address_t nh_addr;
- clib_memset (&nh_addr, 0, sizeof (ip46_address_t));
-
- bool nexthop_set = 0;
-
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "del"))
- is_del = 1;
- else if (unformat (i, "address %U", unformat_ip6_address, &localsid));
- else if (unformat (i, "next-hop %U", unformat_ip46_address, &nh_addr))
- nexthop_set = 1;
- else if (unformat (i, "behavior %u", &behavior));
- else if (unformat (i, "sw_if_index %u", &sw_if_index));
- else if (unformat (i, "fib-table %u", &fib_table));
- else if (unformat (i, "end.psp %u", &behavior));
- else
- break;
- }
-
- M (SR_LOCALSID_ADD_DEL, mp);
-
- clib_memcpy (mp->localsid, &localsid, sizeof (mp->localsid));
-
- if (nexthop_set)
- {
- clib_memcpy (&mp->nh_addr.un, &nh_addr, sizeof (mp->nh_addr.un));
- }
- mp->behavior = behavior;
- mp->sw_if_index = ntohl (sw_if_index);
- mp->fib_table = ntohl (fib_table);
- mp->end_psp = end_psp;
- mp->is_del = is_del;
-
- S (mp);
- W (ret);
- return ret;
-}
-
static int
api_ioam_enable (vat_main_t * vam)
{
return ret;
}
-static void vl_api_sw_interface_tap_v2_details_t_handler
- (vl_api_sw_interface_tap_v2_details_t * mp)
+static void vl_api_sw_interface_virtio_pci_details_t_handler
+ (vl_api_sw_interface_virtio_pci_details_t * mp)
{
vat_main_t *vam = &vat_main;
- 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);
+ typedef union
+ {
+ struct
+ {
+ u16 domain;
+ u8 bus;
+ u8 slot:5;
+ u8 function:3;
+ };
+ u32 as_u32;
+ } pci_addr_t;
+ pci_addr_t addr;
+
+ addr.domain = ntohs (mp->pci_addr.domain);
+ addr.bus = mp->pci_addr.bus;
+ addr.slot = mp->pci_addr.slot;
+ addr.function = mp->pci_addr.function;
+
+ u8 *pci_addr = format (0, "%04x:%02x:%02x.%x", addr.domain, addr.bus,
+ addr.slot, addr.function);
print (vam->ofp,
- "\n%-16s %-12d %-5d %-12d %-12d %-14U %-30s %-20s %-20s %-30s 0x%-08x",
- mp->dev_name, ntohl (mp->sw_if_index), ntohl (mp->id),
+ "\n%-12s %-12d %-12d %-12d %-17U 0x%-08llx",
+ pci_addr, ntohl (mp->sw_if_index),
ntohs (mp->rx_ring_sz), ntohs (mp->tx_ring_sz),
- format_ethernet_address, mp->host_mac_addr, mp->host_namespace,
- mp->host_bridge, ip4, ip6, ntohl (mp->tap_flags));
-
- vec_free (ip4);
- vec_free (ip6);
+ format_ethernet_address, mp->mac_addr,
+ clib_net_to_host_u64 (mp->features));
+ vec_free (pci_addr);
}
-static void vl_api_sw_interface_tap_v2_details_t_handler_json
- (vl_api_sw_interface_tap_v2_details_t * mp)
+static void vl_api_sw_interface_virtio_pci_details_t_handler_json
+ (vl_api_sw_interface_virtio_pci_details_t * mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "id", ntohl (mp->id));
- vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
- vat_json_object_add_uint (node, "tap_flags", ntohl (mp->tap_flags));
- vat_json_object_add_string_copy (node, "dev_name", mp->dev_name);
- vat_json_object_add_uint (node, "rx_ring_sz", ntohs (mp->rx_ring_sz));
- vat_json_object_add_uint (node, "tx_ring_sz", ntohs (mp->tx_ring_sz));
- vat_json_object_add_string_copy (node, "host_mac_addr",
- format (0, "%U", format_ethernet_address,
- &mp->host_mac_addr));
- vat_json_object_add_string_copy (node, "host_namespace",
- mp->host_namespace);
- 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_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_prefix.address,
- mp->host_ip6_prefix.len));
-
-}
-
-static int
-api_sw_interface_tap_v2_dump (vat_main_t * vam)
-{
- vl_api_sw_interface_tap_v2_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- print (vam->ofp,
- "\n%-16s %-12s %-5s %-12s %-12s %-14s %-30s %-20s %-20s %-30s",
- "dev_name", "sw_if_index", "id", "rx_ring_sz", "tx_ring_sz",
- "host_mac_addr", "host_namespace", "host_bridge", "host_ip4_addr",
- "host_ip6_addr");
-
- /* Get list of tap interfaces */
- M (SW_INTERFACE_TAP_V2_DUMP, mp);
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- W (ret);
- return ret;
-}
-
-static void vl_api_sw_interface_virtio_pci_details_t_handler
- (vl_api_sw_interface_virtio_pci_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- typedef union
- {
- struct
- {
- u16 domain;
- u8 bus;
- u8 slot:5;
- u8 function:3;
- };
- u32 as_u32;
- } pci_addr_t;
- pci_addr_t addr;
-
- addr.domain = ntohs (mp->pci_addr.domain);
- addr.bus = mp->pci_addr.bus;
- addr.slot = mp->pci_addr.slot;
- addr.function = mp->pci_addr.function;
-
- u8 *pci_addr = format (0, "%04x:%02x:%02x.%x", addr.domain, addr.bus,
- addr.slot, addr.function);
-
- print (vam->ofp,
- "\n%-12s %-12d %-12d %-12d %-17U 0x%-08llx",
- pci_addr, ntohl (mp->sw_if_index),
- ntohs (mp->rx_ring_sz), ntohs (mp->tx_ring_sz),
- format_ethernet_address, mp->mac_addr,
- clib_net_to_host_u64 (mp->features));
- vec_free (pci_addr);
-}
-
-static void vl_api_sw_interface_virtio_pci_details_t_handler_json
- (vl_api_sw_interface_virtio_pci_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- vlib_pci_addr_t pci_addr;
+ vlib_pci_addr_t pci_addr;
if (VAT_JSON_ARRAY != vam->json_tree.type)
{
}
static int
-api_create_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_create_vhost_user_if_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 hwaddr[6];
- u8 use_custom_mac = 0;
- u8 disable_mrg_rxbuf = 0;
- u8 disable_indirect_desc = 0;
- u8 *tag = 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- int ret;
-
- /* Shut up coverity */
- clib_memset (hwaddr, 0, sizeof (hwaddr));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr))
- use_custom_mac = 1;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "disable_mrg_rxbuf"))
- disable_mrg_rxbuf = 1;
- else if (unformat (i, "disable_indirect_desc"))
- disable_indirect_desc = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "tag %s", &tag))
- ;
- else
- break;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (CREATE_VHOST_USER_IF, mp);
-
- mp->is_server = is_server;
- mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
- mp->disable_indirect_desc = disable_indirect_desc;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- mp->use_custom_mac = use_custom_mac;
- clib_memcpy (mp->mac_address, hwaddr, 6);
- if (tag)
- strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
- vec_free (tag);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_modify_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_modify_vhost_user_if_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 sw_if_index_set = 0;
- u32 sw_if_index = (u32) ~ 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing sw_if_index or interface name");
- return -99;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (MODIFY_VHOST_USER_IF, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->is_server = is_server;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_create_vhost_user_if_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_create_vhost_user_if_v2_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 hwaddr[6];
- u8 use_custom_mac = 0;
- u8 disable_mrg_rxbuf = 0;
- u8 disable_indirect_desc = 0;
- u8 *tag = 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- u8 enable_event_idx = 0;
- int ret;
-
- /* Shut up coverity */
- clib_memset (hwaddr, 0, sizeof (hwaddr));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr))
- use_custom_mac = 1;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "disable_mrg_rxbuf"))
- disable_mrg_rxbuf = 1;
- else if (unformat (i, "disable_indirect_desc"))
- disable_indirect_desc = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "event-idx"))
- enable_event_idx = 1;
- else if (unformat (i, "tag %s", &tag))
- ;
- else
- break;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (CREATE_VHOST_USER_IF_V2, mp);
-
- mp->is_server = is_server;
- mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
- mp->disable_indirect_desc = disable_indirect_desc;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->enable_event_idx = enable_event_idx;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- mp->use_custom_mac = use_custom_mac;
- clib_memcpy (mp->mac_address, hwaddr, 6);
- if (tag)
- strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
- vec_free (tag);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_modify_vhost_user_if_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_modify_vhost_user_if_v2_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 sw_if_index_set = 0;
- u32 sw_if_index = (u32) ~ 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- u8 enable_event_idx = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "event-idx"))
- enable_event_idx = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing sw_if_index or interface name");
- return -99;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (MODIFY_VHOST_USER_IF_V2, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->is_server = is_server;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->enable_event_idx = enable_event_idx;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_delete_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_delete_vhost_user_if_t *mp;
- u32 sw_if_index = ~0;
- u8 sw_if_index_set = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing sw_if_index or interface name");
- return -99;
- }
-
-
- M (DELETE_VHOST_USER_IF, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-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 " %16llx %6d %7d %s",
- (char *) mp->interface_name, ntohl (mp->sw_if_index),
- ntohl (mp->virtio_net_hdr_sz), features, mp->is_server,
- ntohl (mp->num_regions), (char *) mp->sock_filename);
- print (vam->ofp, " Status: '%s'", strerror (ntohl (mp->sock_errno)));
-}
-
-static void vl_api_sw_interface_vhost_user_details_t_handler_json
- (vl_api_sw_interface_vhost_user_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- 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, "virtio_net_hdr_sz",
- ntohl (mp->virtio_net_hdr_sz));
- 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));
- vat_json_object_add_uint (node, "sock_errno", ntohl (mp->sock_errno));
-}
-
-static int
-api_sw_interface_vhost_user_dump (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sw_interface_vhost_user_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
- u32 sw_if_index = ~0;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- ;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- ;
- else
- break;
- }
-
- print (vam->ofp, "Interface name idx hdr_sz features "
- "server regions filename");
-
- /* Get list of vhost-user interfaces */
- M (SW_INTERFACE_VHOST_USER_DUMP, mp);
- mp->sw_if_index = ntohl (sw_if_index);
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- W (ret);
- return ret;
-}
-
-static int
-api_show_version (vat_main_t * vam)
+api_show_version (vat_main_t *vam)
{
vl_api_show_version_t *mp;
int ret;
return ret;
}
-static void vl_api_l2_fib_table_details_t_handler
- (vl_api_l2_fib_table_details_t * mp)
+static void
+vl_api_l2_fib_table_details_t_handler (vl_api_l2_fib_table_details_t *mp)
{
vat_main_t *vam = &vat_main;
- print (vam->ofp, "%3" PRIu32 " %U %3" PRIu32
- " %d %d %d",
+ print (vam->ofp,
+ "%3" PRIu32 " %U %3" PRIu32 " %d %d %d",
ntohl (mp->bd_id), format_ethernet_address, mp->mac,
- ntohl (mp->sw_if_index), mp->static_mac, mp->filter_mac,
- mp->bvi_mac);
+ ntohl (mp->sw_if_index), mp->static_mac, mp->filter_mac, mp->bvi_mac);
}
-static void vl_api_l2_fib_table_details_t_handler_json
- (vl_api_l2_fib_table_details_t * mp)
+static void
+vl_api_l2_fib_table_details_t_handler_json (vl_api_l2_fib_table_details_t *mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
}
static int
-api_l2_fib_table_dump (vat_main_t * vam)
+api_l2_fib_table_dump (vat_main_t *vam)
{
unformat_input_t *i = vam->input;
vl_api_l2_fib_table_dump_t *mp;
return ret;
}
-
static int
-api_interface_name_renumber (vat_main_t * vam)
+api_interface_name_renumber (vat_main_t *vam)
{
unformat_input_t *line_input = vam->input;
vl_api_interface_name_renumber_t *mp;
}
static int
-api_want_l2_macs_events (vat_main_t * vam)
+api_want_l2_macs_events (vat_main_t *vam)
{
unformat_input_t *line_input = vam->input;
vl_api_want_l2_macs_events_t *mp;
}
static int
-api_ip_address_dump (vat_main_t * vam)
+api_ip_address_dump (vat_main_t *vam)
{
unformat_input_t *i = vam->input;
vl_api_ip_address_dump_t *mp;
{
if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;
- else
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+ else if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
else if (unformat (i, "ipv4"))
ipv4_set = 1;
is_ipv6 = ipv6_set;
vam->is_ipv6 = is_ipv6;
- /* free old data */
- for (i = 0; i < vec_len (vam->ip_details_by_sw_if_index[is_ipv6]); i++)
- {
- vec_free (vam->ip_details_by_sw_if_index[is_ipv6][i].addr);
- }
- vec_free (vam->ip_details_by_sw_if_index[is_ipv6]);
-
- M (IP_DUMP, mp);
- mp->is_ipv6 = ipv6_set;
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- W (ret);
- return ret;
-}
-
-static int
-api_get_first_msg_id (vat_main_t * vam)
-{
- vl_api_get_first_msg_id_t *mp;
- unformat_input_t *i = vam->input;
- u8 *name;
- u8 name_set = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "client %s", &name))
- name_set = 1;
- else
- break;
- }
-
- if (name_set == 0)
- {
- errmsg ("missing client name");
- return -99;
- }
- vec_add1 (name, 0);
-
- if (vec_len (name) > 63)
- {
- errmsg ("client name too long");
- return -99;
- }
-
- M (GET_FIRST_MSG_ID, mp);
- clib_memcpy (mp->name, name, vec_len (name));
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_get_node_graph (vat_main_t * vam)
-{
- vl_api_get_node_graph_t *mp;
- int ret;
-
- M (GET_NODE_GRAPH, mp);
-
- /* send it... */
- S (mp);
- /* Wait for the reply */
- W (ret);
- return ret;
-}
-
-static int
-api_af_packet_create (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_af_packet_create_t *mp;
- u8 *host_if_name = 0;
- u8 hw_addr[6];
- u8 random_hw_addr = 1;
- int ret;
-
- clib_memset (hw_addr, 0, sizeof (hw_addr));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "name %s", &host_if_name))
- vec_add1 (host_if_name, 0);
- else if (unformat (i, "hw_addr %U", unformat_ethernet_address, hw_addr))
- random_hw_addr = 0;
- else
- break;
- }
-
- if (!vec_len (host_if_name))
- {
- errmsg ("host-interface name must be specified");
- return -99;
- }
-
- if (vec_len (host_if_name) > 64)
+ /* free old data */
+ for (i = 0; i < vec_len (vam->ip_details_by_sw_if_index[is_ipv6]); i++)
{
- errmsg ("host-interface name too long");
- return -99;
+ vec_free (vam->ip_details_by_sw_if_index[is_ipv6][i].addr);
}
+ vec_free (vam->ip_details_by_sw_if_index[is_ipv6]);
- M (AF_PACKET_CREATE, mp);
-
- clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
- clib_memcpy (mp->hw_addr, hw_addr, 6);
- mp->use_random_hw_addr = random_hw_addr;
- vec_free (host_if_name);
-
+ M (IP_DUMP, mp);
+ mp->is_ipv6 = ipv6_set;
S (mp);
- /* *INDENT-OFF* */
- W2 (ret,
- ({
- if (ret == 0)
- fprintf (vam->ofp ? vam->ofp : stderr,
- " new sw_if_index = %d\n", vam->sw_if_index);
- }));
- /* *INDENT-ON* */
+ /* Use a control ping for synchronization */
+ MPING (CONTROL_PING, mp_ping);
+ S (mp_ping);
+
+ W (ret);
return ret;
}
static int
-api_af_packet_delete (vat_main_t * vam)
+api_get_first_msg_id (vat_main_t * vam)
{
+ vl_api_get_first_msg_id_t *mp;
unformat_input_t *i = vam->input;
- vl_api_af_packet_delete_t *mp;
- u8 *host_if_name = 0;
+ u8 *name;
+ u8 name_set = 0;
int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "name %s", &host_if_name))
- vec_add1 (host_if_name, 0);
+ if (unformat (i, "client %s", &name))
+ name_set = 1;
else
break;
}
- if (!vec_len (host_if_name))
+ if (name_set == 0)
{
- errmsg ("host-interface name must be specified");
+ errmsg ("missing client name");
return -99;
}
+ vec_add1 (name, 0);
- if (vec_len (host_if_name) > 64)
+ if (vec_len (name) > 63)
{
- errmsg ("host-interface name too long");
+ errmsg ("client name too long");
return -99;
}
- M (AF_PACKET_DELETE, mp);
-
- clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
- vec_free (host_if_name);
-
+ M (GET_FIRST_MSG_ID, mp);
+ clib_memcpy (mp->name, name, vec_len (name));
S (mp);
W (ret);
return ret;
}
-static void vl_api_af_packet_details_t_handler
- (vl_api_af_packet_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- print (vam->ofp, "%-16s %d",
- mp->host_if_name, clib_net_to_host_u32 (mp->sw_if_index));
-}
-
-static void vl_api_af_packet_details_t_handler_json
- (vl_api_af_packet_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
- vat_json_object_add_string_copy (node, "dev_name", mp->host_if_name);
-}
-
static int
-api_af_packet_dump (vat_main_t * vam)
+api_get_node_graph (vat_main_t * vam)
{
- vl_api_af_packet_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
+ vl_api_get_node_graph_t *mp;
int ret;
- print (vam->ofp, "\n%-16s %s", "dev_name", "sw_if_index");
- /* Get list of tap interfaces */
- M (AF_PACKET_DUMP, mp);
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
+ M (GET_NODE_GRAPH, mp);
+ /* send it... */
+ S (mp);
+ /* Wait for the reply */
W (ret);
return ret;
}
return ret;
}
-static int
-api_sw_interface_span_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sw_interface_span_enable_disable_t *mp;
- u32 src_sw_if_index = ~0;
- u32 dst_sw_if_index = ~0;
- u8 state = 3;
- int ret;
- u8 is_l2 = 0;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat
- (i, "src %U", api_unformat_sw_if_index, vam, &src_sw_if_index))
- ;
- else if (unformat (i, "src_sw_if_index %d", &src_sw_if_index))
- ;
- else
- if (unformat
- (i, "dst %U", api_unformat_sw_if_index, vam, &dst_sw_if_index))
- ;
- else if (unformat (i, "dst_sw_if_index %d", &dst_sw_if_index))
- ;
- else if (unformat (i, "disable"))
- state = 0;
- else if (unformat (i, "rx"))
- state = 1;
- else if (unformat (i, "tx"))
- state = 2;
- else if (unformat (i, "both"))
- state = 3;
- else if (unformat (i, "l2"))
- is_l2 = 1;
- else
- break;
- }
-
- M (SW_INTERFACE_SPAN_ENABLE_DISABLE, mp);
-
- mp->sw_if_index_from = htonl (src_sw_if_index);
- mp->sw_if_index_to = htonl (dst_sw_if_index);
- mp->state = state;
- mp->is_l2 = is_l2;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static void
-vl_api_sw_interface_span_details_t_handler (vl_api_sw_interface_span_details_t
- * mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *sw_if_from_name = 0;
- u8 *sw_if_to_name = 0;
- u32 sw_if_index_from = ntohl (mp->sw_if_index_from);
- u32 sw_if_index_to = ntohl (mp->sw_if_index_to);
- char *states[] = { "none", "rx", "tx", "both" };
- hash_pair_t *p;
-
- /* *INDENT-OFF* */
- hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
- ({
- if ((u32) p->value[0] == sw_if_index_from)
- {
- sw_if_from_name = (u8 *)(p->key);
- if (sw_if_to_name)
- break;
- }
- if ((u32) p->value[0] == sw_if_index_to)
- {
- sw_if_to_name = (u8 *)(p->key);
- if (sw_if_from_name)
- break;
- }
- }));
- /* *INDENT-ON* */
- print (vam->ofp, "%20s => %20s (%s) %s",
- sw_if_from_name, sw_if_to_name, states[mp->state],
- mp->is_l2 ? "l2" : "device");
-}
-
-static void
- vl_api_sw_interface_span_details_t_handler_json
- (vl_api_sw_interface_span_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- u8 *sw_if_from_name = 0;
- u8 *sw_if_to_name = 0;
- u32 sw_if_index_from = ntohl (mp->sw_if_index_from);
- u32 sw_if_index_to = ntohl (mp->sw_if_index_to);
- hash_pair_t *p;
-
- /* *INDENT-OFF* */
- hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
- ({
- if ((u32) p->value[0] == sw_if_index_from)
- {
- sw_if_from_name = (u8 *)(p->key);
- if (sw_if_to_name)
- break;
- }
- if ((u32) p->value[0] == sw_if_index_to)
- {
- sw_if_to_name = (u8 *)(p->key);
- if (sw_if_from_name)
- break;
- }
- }));
- /* *INDENT-ON* */
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "src-if-index", sw_if_index_from);
- vat_json_object_add_string_copy (node, "src-if-name", sw_if_from_name);
- vat_json_object_add_uint (node, "dst-if-index", sw_if_index_to);
- if (0 != sw_if_to_name)
- {
- vat_json_object_add_string_copy (node, "dst-if-name", sw_if_to_name);
- }
- vat_json_object_add_uint (node, "state", mp->state);
- vat_json_object_add_uint (node, "is-l2", mp->is_l2);
-}
-
-static int
-api_sw_interface_span_dump (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_sw_interface_span_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- u8 is_l2 = 0;
- int ret;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "l2"))
- is_l2 = 1;
- else
- break;
- }
-
- M (SW_INTERFACE_SPAN_DUMP, mp);
- mp->is_l2 = is_l2;
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- W (ret);
- return ret;
-}
-
int
api_ip_source_and_port_range_check_add_del (vat_main_t * vam)
{
return ret;
}
-static int
-api_set_punt (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_address_family_t af;
- vl_api_set_punt_t *mp;
- u32 protocol = ~0;
- u32 port = ~0;
- int is_add = 1;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", unformat_vl_api_address_family, &af))
- ;
- else if (unformat (i, "protocol %d", &protocol))
- ;
- else if (unformat (i, "port %d", &port))
- ;
- else if (unformat (i, "del"))
- is_add = 0;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- M (SET_PUNT, mp);
-
- mp->is_add = (u8) is_add;
- mp->punt.type = PUNT_API_TYPE_L4;
- mp->punt.punt.l4.af = af;
- mp->punt.punt.l4.protocol = (u8) protocol;
- mp->punt.punt.l4.port = htons ((u16) port);
-
- S (mp);
- W (ret);
- return ret;
-}
-
static int
api_delete_subif (vat_main_t * vam)
{
return ret;
}
-static int
-api_tcp_configure_src_addresses (vat_main_t * vam)
-{
- vl_api_tcp_configure_src_addresses_t *mp;
- unformat_input_t *i = vam->input;
- vl_api_address_t first, last;
- u8 range_set = 0;
- u32 vrf_id = 0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U - %U",
- unformat_vl_api_address, &first,
- unformat_vl_api_address, &last))
- {
- if (range_set)
- {
- errmsg ("one range per message (range already set)");
- return -99;
- }
- range_set = 1;
- }
- else if (unformat (i, "vrf %d", &vrf_id))
- ;
- else
- break;
- }
-
- if (range_set == 0)
- {
- errmsg ("address range not set");
- return -99;
- }
-
- M (TCP_CONFIGURE_SRC_ADDRESSES, mp);
-
- mp->vrf_id = ntohl (vrf_id);
- clib_memcpy (&mp->first_address, &first, sizeof (first));
- clib_memcpy (&mp->last_address, &last, sizeof (last));
-
- S (mp);
- W (ret);
- return ret;
-}
-
static void vl_api_app_namespace_add_del_reply_t_handler
(vl_api_app_namespace_add_del_reply_t * mp)
{
return ret;
}
-static int
-api_qos_record_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_qos_record_enable_disable_t *mp;
- u32 sw_if_index, qs = 0xff;
- u8 sw_if_index_set = 0;
- u8 enable = 1;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "%U", unformat_qos_source, &qs))
- ;
- else if (unformat (i, "disable"))
- enable = 0;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing interface name or sw_if_index");
- return -99;
- }
- if (qs == 0xff)
- {
- errmsg ("input location must be specified");
- return -99;
- }
-
- M (QOS_RECORD_ENABLE_DISABLE, mp);
-
- mp->record.sw_if_index = ntohl (sw_if_index);
- mp->record.input_source = qs;
- mp->enable = enable;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-
static int
q_or_quit (vat_main_t * vam)
{
"sw_if <intfc> | sw_if_index <id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
_(bridge_flags, \
"bd_id <bridge-domain-id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
-_(tap_create_v2, \
- "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun] [packed] [in-order]") \
-_(tap_delete_v2, \
- "<vpp-if-name> | sw_if_index <id>") \
-_(sw_interface_tap_v2_dump, "") \
_(virtio_pci_create_v2, \
"pci-addr <pci-address> [use_random_mac | hw-addr <mac-addr>] [features <hex-value>] [gso-enabled [gro-coalesce] | csum-offload-enabled] [packed] [in-order] [buffering]") \
_(virtio_pci_delete, \
"[add | del <intfc | sw_if_index <id>>] via <addr | via-label <n>>\n" \
"[<intfc> | sw_if_index <id> | next-hop-table <id>]\n" \
"[l2-only] [out-label <n>]") \
-_(sr_mpls_policy_add, \
- "bsid <id> [weight <n>] [spray] next <sid> [next <sid>]") \
-_(sr_mpls_policy_del, \
- "bsid <id>") \
_(sw_interface_set_unnumbered, \
"<intfc> | sw_if_index <id> unnum_if_index <id> [del]") \
_(create_vlan_subif, "<intfc> | sw_if_index <id> vlan <n>") \
_(l2_patch_add_del, \
"rx <intfc> | rx_sw_if_index <id> tx <intfc> | tx_sw_if_index <id>\n" \
"enable | disable") \
-_(sr_localsid_add_del, \
- "(del) address <addr> next_hop <addr> behavior <beh>\n" \
- "fib-table <num> (end.psp) sw_if_index <num>") \
_(get_node_index, "node <node-name") \
_(add_node_next, "node <node-name> next <next-node-name>") \
_(l2_fib_clear_table, "") \
"<intfc> | sw_if_index <nn> \n" \
"[disable][push-[1|2]][pop-[1|2]][translate-1-[1|2]] \n" \
"[translate-2-[1|2]] [push_dot1q 0] tag1 <nn> tag2 <nn>") \
-_(create_vhost_user_if, \
- "socket <filename> [server] [renumber <dev_instance>] " \
- "[disable_mrg_rxbuf] [disable_indirect_desc] [gso] " \
- "[mac <mac_address>] [packed]") \
-_(modify_vhost_user_if, \
- "<intfc> | sw_if_index <nn> socket <filename>\n" \
- "[server] [renumber <dev_instance>] [gso] [packed]") \
-_(create_vhost_user_if_v2, \
- "socket <filename> [server] [renumber <dev_instance>] " \
- "[disable_mrg_rxbuf] [disable_indirect_desc] [gso] " \
- "[mac <mac_address>] [packed] [event-idx]") \
-_(modify_vhost_user_if_v2, \
- "<intfc> | sw_if_index <nn> socket <filename>\n" \
- "[server] [renumber <dev_instance>] [gso] [packed] [event-idx]")\
-_(delete_vhost_user_if, "<intfc> | sw_if_index <nn>") \
-_(sw_interface_vhost_user_dump, "<intfc> | sw_if_index <nn>") \
_(show_version, "") \
_(show_threads, "") \
_(l2_fib_table_dump, "bd_id <bridge-domain-id>") \
_(sw_interface_clear_stats,"<intfc> | sw_if_index <nn>") \
_(ioam_enable, "[trace] [pow] [ppc <encap|decap>]") \
_(ioam_disable, "") \
-_(af_packet_create, "name <host interface name> [hw_addr <mac>]") \
-_(af_packet_delete, "name <host interface name>") \
-_(af_packet_dump, "") \
_(mpls_tunnel_dump, "tunnel_index <tunnel-id>") \
_(mpls_table_dump, "") \
_(mpls_route_dump, "table-id <ID>") \
-_(sw_interface_span_enable_disable, "[l2] [src <intfc> | src_sw_if_index <id>] [disable | [[dst <intfc> | dst_sw_if_index <id>] [both|rx|tx]]]") \
-_(sw_interface_span_dump, "[l2]") \
_(get_next_index, "node-name <node-name> next-node-name <node-name>") \
_(ip_source_and_port_range_check_add_del, \
"<ip-addr>/<mask> range <nn>-<nn> vrf <id>") \
"<intfc> | sw_if_index <nn> \n" \
"[disable | push | pop | translate_pbb_stag <outer_tag>] \n" \
"dmac <mac> smac <mac> sid <nn> [vlanid <nn>]") \
-_(set_punt, "protocol <l4-protocol> [ip <ver>] [port <l4-port>] [del]") \
_(ip_table_dump, "") \
_(ip_route_dump, "table-id [ip4|ip6]") \
_(ip_mtable_dump, "") \
_(l2_xconnect_dump, "") \
_(hw_interface_set_mtu, "<intfc> | hw_if_index <nn> mtu <nn>") \
_(sw_interface_get_table, "<intfc> | sw_if_index <id> [ipv6]") \
-_(tcp_configure_src_addresses, "<ip4|6>first-<ip4|6>last [vrf <id>]") \
_(sock_init_shm, "size <nnn>") \
_(app_namespace_add_del, "[add] id <ns-id> secret <nn> sw_if_index <nn>")\
_(session_rule_add_del, "[add|del] proto <tcp/udp> <lcl-ip>/<plen> " \
"<lcl-port> <rmt-ip>/<plen> <rmt-port> action <nn>") \
_(session_rules_dump, "") \
_(ip_container_proxy_add_del, "[add|del] <address> <sw_if_index>") \
-_(qos_record_enable_disable, "<record-source> <intfc> | sw_if_index <id> [disable]")
/* List of command functions, CLI names map directly to functions */
#define foreach_cli_function \