X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2Fapi%2Fapi.c;h=f06894e8783c53d142ee2cb594b2f1f7ee403ad5;hb=c83c3b7f117b981b677f646a0e30f44ec70de239;hp=a8f471e864e7a38b0e31755c4c22b0d0cb508b38;hpb=a1a093d4e46e38503332a97ad216f80053a15f2b;p=vpp.git diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index a8f471e864e..f06894e8783 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -61,8 +61,6 @@ #include #include #include -#include -#include #include #include #include @@ -109,7 +107,6 @@ _(OAM_ADD_DEL, oam_add_del) \ _(IS_ADDRESS_REACHABLE, is_address_reachable) \ _(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_L2_XCONNECT, sw_interface_set_l2_xconnect) \ _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \ _(CREATE_VLAN_SUBIF, create_vlan_subif) \ @@ -119,6 +116,7 @@ _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \ _(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats) \ _(RESET_FIB, reset_fib) \ _(CREATE_LOOPBACK, create_loopback) \ +_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ _(CONTROL_PING, control_ping) \ _(CLI_REQUEST, cli_request) \ _(CLI_INBAND, cli_inband) \ @@ -373,29 +371,6 @@ vl_api_sw_interface_set_vpath_t_handler (vl_api_sw_interface_set_vpath_t * mp) REPLY_MACRO (VL_API_SW_INTERFACE_SET_VPATH_REPLY); } -static void - vl_api_sw_interface_set_vxlan_bypass_t_handler - (vl_api_sw_interface_set_vxlan_bypass_t * mp) -{ - vl_api_sw_interface_set_vxlan_bypass_reply_t *rmp; - int rv = 0; - u32 sw_if_index = ntohl (mp->sw_if_index); - - VALIDATE_SW_IF_INDEX (mp); - - if (mp->is_ipv6) - { - /* not yet implemented */ - } - else - vnet_feature_enable_disable ("ip4-unicast", "ip4-vxlan-bypass", - sw_if_index, mp->enable, 0, 0); - - BAD_SW_IF_INDEX_LABEL; - - REPLY_MACRO (VL_API_SW_INTERFACE_SET_VXLAN_BYPASS_REPLY); -} - static void vl_api_sw_interface_set_l2_xconnect_t_handler (vl_api_sw_interface_set_l2_xconnect_t * mp) @@ -492,7 +467,7 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) { vl_api_create_vlan_subif_reply_t *rmp; vnet_main_t *vnm = vnet_get_main (); - u32 hw_if_index, sw_if_index = (u32) ~ 0; + u32 sw_if_index = (u32) ~ 0; vnet_hw_interface_t *hi; int rv = 0; u32 id; @@ -506,8 +481,13 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) VALIDATE_SW_IF_INDEX (mp); - hw_if_index = ntohl (mp->sw_if_index); - hi = vnet_get_hw_interface (vnm, hw_if_index); + hi = vnet_get_sup_hw_interface (vnm, ntohl (mp->sw_if_index)); + + if (hi->bond_info == VNET_HW_INTERFACE_BOND_INFO_SLAVE) + { + rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED; + goto out; + } id = ntohl (mp->vlan_id); if (id == 0 || id > 4095) @@ -1047,7 +1027,7 @@ vl_api_create_loopback_t_handler (vl_api_create_loopback_t * mp) u32 sw_if_index; int rv; - rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address); + rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address, 0, 0); /* *INDENT-OFF* */ REPLY_MACRO2(VL_API_CREATE_LOOPBACK_REPLY, @@ -1057,6 +1037,26 @@ vl_api_create_loopback_t_handler (vl_api_create_loopback_t * mp) /* *INDENT-ON* */ } +static void vl_api_create_loopback_instance_t_handler + (vl_api_create_loopback_instance_t * mp) +{ + vl_api_create_loopback_instance_reply_t *rmp; + u32 sw_if_index; + u8 is_specified = mp->is_specified; + u32 user_instance = ntohl (mp->user_instance); + int rv; + + rv = vnet_create_loopback_interface (&sw_if_index, mp->mac_address, + is_specified, user_instance); + + /* *INDENT-OFF* */ + REPLY_MACRO2(VL_API_CREATE_LOOPBACK_INSTANCE_REPLY, + ({ + rmp->sw_if_index = ntohl (sw_if_index); + })); + /* *INDENT-ON* */ +} + static void vl_api_delete_loopback_t_handler (vl_api_delete_loopback_t * mp) { @@ -1432,39 +1432,6 @@ out: /* *INDENT-ON* */ } -static void send_vxlan_tunnel_details - (vxlan_tunnel_t * t, unix_shared_memory_queue_t * q, u32 context) -{ - vl_api_vxlan_tunnel_details_t *rmp; - ip4_main_t *im4 = &ip4_main; - ip6_main_t *im6 = &ip6_main; - u8 is_ipv6 = !ip46_address_is_ip4 (&t->dst); - - rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_VXLAN_TUNNEL_DETAILS); - if (is_ipv6) - { - memcpy (rmp->src_address, t->src.ip6.as_u8, 16); - memcpy (rmp->dst_address, t->dst.ip6.as_u8, 16); - rmp->encap_vrf_id = htonl (im6->fibs[t->encap_fib_index].ft_table_id); - } - else - { - memcpy (rmp->src_address, t->src.ip4.as_u8, 4); - memcpy (rmp->dst_address, t->dst.ip4.as_u8, 4); - rmp->encap_vrf_id = htonl (im4->fibs[t->encap_fib_index].ft_table_id); - } - rmp->mcast_sw_if_index = htonl (t->mcast_sw_if_index); - rmp->vni = htonl (t->vni); - rmp->decap_next_index = htonl (t->decap_next_index); - rmp->sw_if_index = htonl (t->sw_if_index); - rmp->is_ipv6 = is_ipv6; - rmp->context = context; - - vl_msg_api_send_shmem (q, (u8 *) & rmp); -} - static void vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t * mp) { @@ -1488,40 +1455,6 @@ vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t * mp) REPLY_MACRO (VL_API_L2_PATCH_ADD_DEL_REPLY); } -static void send_vxlan_gpe_tunnel_details - (vxlan_gpe_tunnel_t * t, unix_shared_memory_queue_t * q, u32 context) -{ - vl_api_vxlan_gpe_tunnel_details_t *rmp; - ip4_main_t *im4 = &ip4_main; - ip6_main_t *im6 = &ip6_main; - u8 is_ipv6 = !(t->flags & VXLAN_GPE_TUNNEL_IS_IPV4); - - rmp = vl_msg_api_alloc (sizeof (*rmp)); - memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_VXLAN_GPE_TUNNEL_DETAILS); - if (is_ipv6) - { - memcpy (rmp->local, &(t->local.ip6), 16); - memcpy (rmp->remote, &(t->remote.ip6), 16); - rmp->encap_vrf_id = htonl (im6->fibs[t->encap_fib_index].ft_table_id); - rmp->decap_vrf_id = htonl (im6->fibs[t->decap_fib_index].ft_table_id); - } - else - { - memcpy (rmp->local, &(t->local.ip4), 4); - memcpy (rmp->remote, &(t->remote.ip4), 4); - rmp->encap_vrf_id = htonl (im4->fibs[t->encap_fib_index].ft_table_id); - rmp->decap_vrf_id = htonl (im4->fibs[t->decap_fib_index].ft_table_id); - } - rmp->vni = htonl (t->vni); - rmp->protocol = t->protocol; - rmp->sw_if_index = htonl (t->sw_if_index); - rmp->is_ipv6 = is_ipv6; - rmp->context = context; - - vl_msg_api_send_shmem (q, (u8 *) & rmp); -} - static void vl_api_interface_name_renumber_t_handler (vl_api_interface_name_renumber_t * mp) @@ -2178,7 +2111,6 @@ vpe_api_hookup (vlib_main_t * vm) am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_TABLE].size += 5 * sizeof (u32x4); am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_SESSION].size += 5 * sizeof (u32x4); - am->api_trace_cfg[VL_API_VXLAN_ADD_DEL_TUNNEL].size += 16 * sizeof (u32); /* * Thread-safe API messages