# Release Notes {#release_notes} * @subpage release_notes_2106 * @subpage release_notes_2101 * @subpage release_notes_2009 * @subpage release_notes_20051 * @subpage release_notes_2005 * @subpage release_notes_2001 * @subpage release_notes_19083 * @subpage release_notes_19082 * @subpage release_notes_19081 * @subpage release_notes_1908 * @subpage release_notes_19043 * @subpage release_notes_19042 * @subpage release_notes_19041 * @subpage release_notes_1904 * @subpage release_notes_19013 * @subpage release_notes_19012 * @subpage release_notes_19011 * @subpage release_notes_1901 * @subpage release_notes_1810 * @subpage release_notes_1807 * @subpage release_notes_1804 * @subpage release_notes_18012 * @subpage release_notes_18011 * @subpage release_notes_1801 * @subpage release_notes_1710 * @subpage release_notes_1707 * @subpage release_notes_1704 * @subpage release_notes_17011 * @subpage release_notes_1701 * @subpage release_notes_1609 * @subpage release_notes_1606 @page release_notes_2106 Release notes for VPP 21.06 TBD @page release_notes_2101 Release notes for VPP 21.01 ## Release Highlights The FD.io VPP 20.09 release comprises more than 562 commits since the previous release, including 274 fixes. Notable changes in this release were the Virtio driver adding packet buffering on the transmit path to handle slow back-ends which often have jitter and delays in free'ing buffers, and also adding support for Virtio 1.1 packed rings. FD.io VPP IPSEC added support for multi-point on IPSec interfaces, brings the meshed benefits of IP to IPSec tunnels. The FD.io VPP Cloud NAT (CNAT), added support source NAT ICMP and DHCP. The FD.io VPP FIB added support for source address selection (SAS) and flow hashing on the inner packets. Finally the FD.io VPP Perfmon plugin has been substantially rewritten, to support measuring bundles of counters, and reporting statistics per graph node. Reflecting the API change policy introduced in the 20.09, please review the following sections below: - Newly deprecated API messages: please note that if you are using a deprecated message, they will soon be removed in a subsequent release. Collaborate with the feature maintainer on the best approach to mitigate. - In-progress API messages: They are work-in-progress, and are *not* subject to the policy, and may change or even be removed at any time. Please collaborate with the feature maintainer on plans to productize the message before using in any product. In-progress APIs must eventually become stable or be removed. ## Features - Binary API Libraries - Vat2 and JSON autogeneration for API messages ([df87f8092](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=df87f8092)) - Plugins - AF\_XDP driver - Add option to claim all available RX queues ([d4e109138](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=d4e109138)) - CNat - Disable default scanner process ([d63f73b83](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=d63f73b83)) - IP ICMP error support ([ece39214b](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=ece39214b)) - Add support for SNat ICMP ([613b2c3c7](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=613b2c3c7)) - Introduce parametric source policy ([ce25b60de](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=ce25b60de)) - Add DHCP support ([af897c5e3](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=af897c5e3)) - Crypto - ipsecmb - Bump to intel-ipsec-mb version 0.55 ([b5df85e24](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=b5df85e24)) - DPDK - Call the meson-based build instead of Makefiles ([4c4633cad](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=4c4633cad)) - Telemetry thread is off by default. ([83f37fc3b](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=83f37fc3b)) - Bump to DPDK 20.11 ([f0419a0c8](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=f0419a0c8)) - Internet Key Exchange (IKEv2) Protocol - Support IPv6 traffic selectors & overlay ([84962d19b](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=84962d19b)) - CLI for disabling dead peer detection ([af4a414eb](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=af4a414eb)) - Add option to disable NAT traversal ([d7fc12f07](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=d7fc12f07)) - RDMA (ibverb) driver - Add RSS support for IPv6 and TCP ([91603958d](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=91603958d)) - VRRP - Asynchronous events on VR state change ([78f487e11](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=78f487e11)) - Wireguard - Return public key in API ([de22111b5](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=de22111b5)) - Flowprobe - Add show commands for params and list of interfaces for recording ([d1146f6dd](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=d1146f6dd)) - Python binding for the VPP API - add support for enumflag part 1 of 2 ([3825d93af](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=3825d93af)) - SVM Library - Support for multi-segment enqueues ([c95cfa218](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=c95cfa218)) - Statistics Segment - Counters data model ([148c7b768](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=148c7b768)) - VNET - FIB - Source Address Selection ([e2fe09742](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=e2fe09742)) - Adjacency flag for midchain to perfom flow hash (on inner packet) ([5c544c8c3](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=5c544c8c3)) - Feature Arcs - Add packet trace API ([c0b195450](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=c0b195450)) - IPSec - Support for multipoint on IPSec interfaces ([6ba4e41d3](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=6ba4e41d3)) - Tunnel SA DSCP behaviour ([041add7d1](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=041add7d1)) - Native Virtio Drivers - Add packet buffering on transmit path ([e347acbc3](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=e347acbc3)) - Virtio: implement packed queues from virtio 1.1 ([b977d3f7c](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=b977d3f7c)) - Segment Routing (IPv6 and MPLS) - Show IPv6 address used as SRv6 Encaps source ([448bc81d3](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=448bc81d3)) - Show the hop-limit value used for SRv6 encapsulation ([80f0b88fc](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=80f0b88fc)) - Session Layer - Add Unix socket API for app attachment ([61ae056bd](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=61ae056bd)) - Per worker state for ct sessions ([2d0e3de14](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=2d0e3de14)) - TAP Drivers - Allow change of carrier state on host ([bd50ed18d](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=bd50ed18d)) - Add function to set speed ([a6c34a19d](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=a6c34a19d)) - VPP Comms Library - Add support for app socket API ([935ce75cb](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=935ce75cb)) - Provide apps access to fifo chunks ([d68faf855](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=d68faf855)) - VPP Executable - Use VPP heap for libc ([ec4749a20](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=ec4749a20)) - Vector Library - Buffer Management - Add page-size config ([61559029d](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=61559029d)) ## Known issues For the full list of issues please refer to fd.io [JIRA](https://jira.fd.io). ## Fixed issues For the full list of fixed issues please refer to: - fd.io [JIRA](https://jira.fd.io) - git [commit log](https://git.fd.io/vpp/log/?h=master) ## API changes Description of results: * _Definition changed_: indicates that the API file was modified between releases. * _Only in image_: indicates the API is new for this release. * _Only in file_: indicates the API has been removed in this release. Message Name | Result -------------------------------------------------------------|------------------ classify_pcap_get_tables | only in image classify_pcap_get_tables_reply | only in image classify_pcap_lookup_table | only in image classify_pcap_lookup_table_reply | only in image classify_pcap_set_table | only in image classify_pcap_set_table_reply | only in image classify_trace_get_tables | only in image classify_trace_get_tables_reply | only in image classify_trace_lookup_table | only in image classify_trace_lookup_table_reply | only in image classify_trace_set_table | only in image classify_trace_set_table_reply | only in image cnat_get_snat_addresses | only in image cnat_get_snat_addresses_reply | only in image cnat_session_details | definition changed cnat_set_snat_addresses | definition changed cnat_translation_details | definition changed cnat_translation_update | definition changed det44_plugin_enable_disable | definition changed graph_node_details | only in image graph_node_get | only in image graph_node_get_reply | only in image ikev2_profile_details | definition changed ikev2_profile_disable_natt | only in image ikev2_profile_disable_natt_reply | only in image ikev2_profile_set_ts | definition changed ikev2_sa_details | definition changed ikev2_set_responder | definition changed ikev2_traffic_selector_details | definition changed ip_mroute_add_del | definition changed ip_mroute_details | definition changed ip_neighbor_event_v2 | only in image ipsec_sa_v2_details | only in image ipsec_sa_v2_dump | only in image ipsec_sad_entry_add_del_v2 | only in image ipsec_sad_entry_add_del_v2_reply | only in image nat44_plugin_enable_disable | only in image nat44_plugin_enable_disable_reply | only in image nat44_show_running_config | only in image nat44_show_running_config_reply | only in image nat64_get_timeouts | only in image nat64_get_timeouts_reply | only in image nat64_plugin_enable_disable | only in image nat64_plugin_enable_disable_reply | only in image nat64_set_timeouts | only in image nat64_set_timeouts_reply | only in image pppoe_add_del_cp | only in image pppoe_add_del_cp_reply | only in image rdma_create_v2 | only in image rdma_create_v2_reply | only in image sw_vmxnet3_interface_details | only in image sw_vmxnet3_interface_dump | only in image trace_capture_packets | only in image trace_capture_packets_reply | only in image trace_clear_capture | only in image trace_clear_capture_reply | only in image trace_details | definition changed trace_set_filters | only in image trace_set_filters_reply | only in image vrrp_vr_event | only in image want_ip_neighbor_events_v2 | only in image want_ip_neighbor_events_v2_reply | only in image want_vrrp_vr_events | only in image want_vrrp_vr_events_reply | only in image wireguard_interface_create | definition changed wireguard_interface_details | definition changed Found 66 api message signature differences ### Newly deprecated API messages These messages are still there in the API, but can and probably will disappear in the next release. - geneve_add_del_tunnel - ip_neighbor_event - nat44_forwarding_enable_disable - nat44_forwarding_enable_disable_reply - nat44_forwarding_is_enabled - nat44_forwarding_is_enabled_reply - nat44_session_cleanup - nat44_session_cleanup_reply - nat_control_ping - nat_control_ping_reply - nat_get_timeouts - nat_get_timeouts_reply - nat_ipfix_enable_disable - nat_ipfix_enable_disable_reply - nat_set_log_level - nat_set_log_level_reply - nat_set_timeouts - nat_set_timeouts_reply - nat_show_config - nat_show_config_2 - nat_show_config_2_reply - nat_show_config_reply - rdma_create - vmxnet3_dump - want_ip_neighbor_events - want_ip_neighbor_events_reply ### In-progress API messages These messages are provided for testing and experimentation only. They are *not* subject to any compatibility process, and therefore can arbitrarily change or disappear at *any* moment. Also they may have less than satisfactory testing, making them unsuitable for other use than the technology preview. If you are intending to use these messages in production projects, please collaborate with the feature maintainer on their productization. - abf_itf_attach_add_del - abf_itf_attach_add_del_reply - abf_itf_attach_details - abf_itf_attach_dump - abf_plugin_get_version - abf_plugin_get_version_reply - abf_policy_add_del - abf_policy_add_del_reply - abf_policy_details - abf_policy_dump - adl_allowlist_enable_disable - adl_allowlist_enable_disable_reply - adl_interface_enable_disable - adl_interface_enable_disable_reply - af_xdp_create - af_xdp_create_reply - af_xdp_delete - af_xdp_delete_reply - cnat_add_del_snat_prefix - cnat_add_del_snat_prefix_reply - cnat_get_snat_addresses - cnat_get_snat_addresses_reply - cnat_session_details - cnat_session_dump - cnat_session_purge - cnat_session_purge_reply - cnat_set_snat_addresses - cnat_set_snat_addresses_reply - cnat_translation_del - cnat_translation_del_reply - cnat_translation_details - cnat_translation_dump - cnat_translation_update - cnat_translation_update_reply - crypto_sw_scheduler_set_worker - crypto_sw_scheduler_set_worker_reply - det44_get_timeouts_reply - det44_interface_add_del_feature - det44_interface_add_del_feature_reply - det44_interface_details - det44_interface_dump - det44_plugin_enable_disable - det44_plugin_enable_disable_reply - det44_set_timeouts - det44_set_timeouts_reply - flow_add - flow_add_reply - flow_del - flow_del_reply - flow_disable - flow_disable_reply - flow_enable - flow_enable_reply - gbp_bridge_domain_add - gbp_bridge_domain_add_reply - gbp_bridge_domain_del - gbp_bridge_domain_del_reply - gbp_bridge_domain_details - gbp_bridge_domain_dump - gbp_bridge_domain_dump_reply - gbp_contract_add_del - gbp_contract_add_del_reply - gbp_contract_details - gbp_contract_dump - gbp_endpoint_add - gbp_endpoint_add_reply - gbp_endpoint_del - gbp_endpoint_del_reply - gbp_endpoint_details - gbp_endpoint_dump - gbp_endpoint_group_add - gbp_endpoint_group_add_reply - gbp_endpoint_group_del - gbp_endpoint_group_del_reply - gbp_endpoint_group_details - gbp_endpoint_group_dump - gbp_ext_itf_add_del - gbp_ext_itf_add_del_reply - gbp_ext_itf_details - gbp_ext_itf_dump - gbp_recirc_add_del - gbp_recirc_add_del_reply - gbp_recirc_details - gbp_recirc_dump - gbp_route_domain_add - gbp_route_domain_add_reply - gbp_route_domain_del - gbp_route_domain_del_reply - gbp_route_domain_details - gbp_route_domain_dump - gbp_route_domain_dump_reply - gbp_subnet_add_del - gbp_subnet_add_del_reply - gbp_subnet_details - gbp_subnet_dump - gbp_vxlan_tunnel_add - gbp_vxlan_tunnel_add_reply - gbp_vxlan_tunnel_del - gbp_vxlan_tunnel_del_reply - gbp_vxlan_tunnel_details - gbp_vxlan_tunnel_dump - ikev2_child_sa_details - ikev2_child_sa_dump - ikev2_initiate_del_child_sa - ikev2_initiate_del_child_sa_reply - ikev2_initiate_del_ike_sa - ikev2_initiate_del_ike_sa_reply - ikev2_initiate_rekey_child_sa - ikev2_initiate_rekey_child_sa_reply - ikev2_initiate_sa_init - ikev2_initiate_sa_init_reply - ikev2_nonce_get - ikev2_nonce_get_reply - ikev2_profile_add_del - ikev2_profile_add_del_reply - ikev2_profile_details - ikev2_profile_disable_natt - ikev2_profile_disable_natt_reply - ikev2_profile_dump - ikev2_profile_set_auth - ikev2_profile_set_auth_reply - ikev2_profile_set_id - ikev2_profile_set_id_reply - ikev2_profile_set_ipsec_udp_port - ikev2_profile_set_ipsec_udp_port_reply - ikev2_profile_set_liveness - ikev2_profile_set_liveness_reply - ikev2_profile_set_ts - ikev2_profile_set_ts_reply - ikev2_profile_set_udp_encap - ikev2_profile_set_udp_encap_reply - ikev2_sa_details - ikev2_sa_dump - ikev2_set_esp_transforms - ikev2_set_esp_transforms_reply - ikev2_set_ike_transforms - ikev2_set_ike_transforms_reply - ikev2_set_local_key - ikev2_set_local_key_reply - ikev2_set_responder - ikev2_set_responder_reply - ikev2_set_sa_lifetime - ikev2_set_sa_lifetime_reply - ikev2_set_tunnel_interface - ikev2_set_tunnel_interface_reply - ikev2_traffic_selector_details - ikev2_traffic_selector_dump - l2_emulation - l2_emulation_reply - mdata_enable_disable - mdata_enable_disable_reply - nat44_add_del_static_mapping_v2 - nat44_add_del_static_mapping_v2_reply - nat44_show_running_config - nat44_show_running_config_reply - nat64_plugin_enable_disable - nat64_plugin_enable_disable_reply - oddbuf_enable_disable - oddbuf_enable_disable_reply - pg_interface_enable_disable_coalesce - pg_interface_enable_disable_coalesce_reply - sample_macswap_enable_disable - sample_macswap_enable_disable_reply - sr_policies_with_sl_index_details - sr_policies_with_sl_index_dump - sw_interface_set_vxlan_gbp_bypass - sw_interface_set_vxlan_gbp_bypass_reply - test_enum - test_enum_reply - test_prefix - test_prefix_reply - trace_capture_packets - trace_capture_packets_reply - trace_clear_capture - trace_clear_capture_reply - trace_details - trace_dump - trace_dump_reply - trace_set_filters - trace_set_filters_reply - vxlan_gbp_tunnel_add_del - vxlan_gbp_tunnel_add_del_reply - vxlan_gbp_tunnel_details - vxlan_gbp_tunnel_dump - wireguard_interface_create - wireguard_interface_create_reply - wireguard_interface_delete - wireguard_interface_delete_reply - wireguard_interface_details - wireguard_interface_dump - wireguard_peer_add - wireguard_peer_add_reply - wireguard_peer_remove - wireguard_peer_remove_reply - wireguard_peers_details - wireguard_peers_dump ### Patches that changed API definitions | @c src/vpp/api/vpe_types.api || | ------- | ------- | | [dc01471be](https://gerrit.fd.io/r/gitweb?p=vpp.git;a=commit;h=dc01471be) | api: add missing version info | | @c
/*
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* srp_interface.c: srp interfaces
*
* Copyright (c) 2008 Eliot Dresselhaus
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <vnet/vnet.h>
#include <vnet/pg/pg.h>
#include <vnet/srp/srp.h>
static u8*
srp_build_rewrite (vnet_main_t * vnm,
u32 sw_if_index,
vnet_link_t link_type,
const void * dst_address)
{
vnet_hw_interface_t * hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
srp_main_t * sm = &srp_main;
srp_and_ethernet_header_t * h;
u8* rewrite = NULL;
u16 type;
uword n_bytes = sizeof (h[0]);
switch (link_type) {
#define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break
_ (IP4, IP4);
_ (IP6, IP6);
_ (MPLS, MPLS_UNICAST);
_ (ARP, ARP);
#undef _
default:
return (NULL);
}
vec_validate(rewrite, n_bytes-1);
h = (srp_and_ethernet_header_t *)rewrite;
clib_memcpy (h->ethernet.src_address, hw->hw_address, sizeof (h->ethernet.src_address));
if (dst_address)
clib_memcpy (h->ethernet.dst_address, dst_address, sizeof (h->ethernet.dst_address));
else
memset (h->ethernet.dst_address, ~0, sizeof (h->ethernet.dst_address)); /* broadcast */
h->ethernet.type = clib_host_to_net_u16 (type);
h->srp.as_u16 = 0;
h->srp.mode = SRP_MODE_data;
h->srp.ttl = sm->default_data_ttl;
srp_header_compute_parity (&h->srp);
return (rewrite);
}
static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redistribute);
void serialize_srp_main (serialize_main_t * m, va_list * va)
{
srp_main_t * sm = &srp_main;
srp_interface_t * si;
serialize_integer (m, pool_elts (sm->interface_pool), sizeof (u32));
pool_foreach (si, sm->interface_pool, ({
serialize_integer (m, si->rings[SRP_RING_OUTER].hw_if_index, sizeof (u32));
serialize_integer (m, si->rings[SRP_RING_INNER].hw_if_index, sizeof (u32));
}));
}
void unserialize_srp_main (serialize_main_t * m, va_list * va)
{
u32 i, n_ifs, hw_if_indices[SRP_N_RING];
unserialize_integer (m, &n_ifs, sizeof (u32));
for (i = 0; i < n_ifs; i++)
{
unserialize_integer (m, &hw_if_indices[SRP_RING_OUTER], sizeof (u32));
unserialize_integer (m, &hw_if_indices[SRP_RING_INNER], sizeof (u32));
srp_register_interface_helper (hw_if_indices, /* redistribute */ 0);
}
}
static void serialize_srp_register_interface_msg (serialize_main_t * m, va_list * va)
{
u32 * hw_if_indices = va_arg (*va, u32 *);
serialize_integer (m, hw_if_indices[SRP_SIDE_A], sizeof (hw_if_indices[SRP_SIDE_A]));
serialize_integer (m, hw_if_indices[SRP_SIDE_B], sizeof (hw_if_indices[SRP_SIDE_B]));
}
static void unserialize_srp_register_interface_msg (serialize_main_t * m, va_list * va)
{
CLIB_UNUSED (mc_main_t * mcm) = va_arg (*va, mc_main_t *);
u32 hw_if_indices[SRP_N_SIDE];
srp_main_t * sm = &srp_main;
uword * p;
unserialize_integer (m, &hw_if_indices[SRP_SIDE_A], sizeof (hw_if_indices[SRP_SIDE_A]));
unserialize_integer (m, &hw_if_indices[SRP_SIDE_B], sizeof (hw_if_indices[SRP_SIDE_B]));
p = hash_get (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index,
hw_if_indices[0]);
if (p)
{
vlib_one_time_waiting_process_t * wp = pool_elt_at_index (sm->srp_register_interface_waiting_process_pool, p[0]);
vlib_signal_one_time_waiting_process (mcm->vlib_main, wp);
pool_put (sm->srp_register_interface_waiting_process_pool, wp);
hash_unset (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index,
hw_if_indices[0]);
}
else
srp_register_interface_helper (hw_if_indices, /* redistribute */ 0);
}
MC_SERIALIZE_MSG (srp_register_interface_msg, static) = {
.name = "vnet_srp_register_interface",
.serialize = serialize_srp_register_interface_msg,
.unserialize = unserialize_srp_register_interface_msg,
};
static void srp_register_interface_helper (u32 * hw_if_indices_by_side, u32 redistribute)
{
vnet_main_t * vnm = vnet_get_main();
srp_main_t * sm = &srp_main;
vlib_main_t * vm = sm->vlib_main;
srp_interface_t * si;
vnet_hw_interface_t * hws[SRP_N_RING];
uword s, * p;
if (vm->mc_main && redistribute)
{
vlib_one_time_waiting_process_t * wp;
mc_serialize (vm->mc_main, &srp_register_interface_msg, hw_if_indices_by_side);
pool_get (sm->srp_register_interface_waiting_process_pool, wp);
hash_set (sm->srp_register_interface_waiting_process_pool_index_by_hw_if_index,
hw_if_indices_by_side[0],
wp - sm->srp_register_interface_waiting_process_pool);
vlib_current_process_wait_for_one_time_event (vm, wp);
}
/* Check if interface has already been registered. */
p = hash_get (sm->interface_index_by_hw_if_index, hw_if_indices_by_side[0]);
if (p)
{
si = pool_elt_at_index (sm->interface_pool, p[0]);
}
else
{
pool_get (sm->interface_pool, si);
memset (si, 0, sizeof (si[0]));
}
for (s = 0; s < SRP_N_SIDE; s++)
{
hws[s] = vnet_get_hw_interface (vnm, hw_if_indices_by_side[s]);
si->rings[s].ring = s;
si->rings[s].hw_if_index = hw_if_indices_by_side[s];
si->rings[s].sw_if_index = hws[s]->sw_if_index;
hash_set (sm->interface_index_by_hw_if_index, hw_if_indices_by_side[s], si - sm->interface_pool);
}
/* Inherit MAC address from outer ring. */
clib_memcpy (si->my_address, hws[SRP_RING_OUTER]->hw_address,
vec_len (hws[SRP_RING_OUTER]->hw_address));
/* Default time to wait to restore signal. */
si->config.wait_to_restore_idle_delay = 60;
si->config.ips_tx_interval = 1;
}
void srp_register_interface (u32 * hw_if_indices_by_side)
{
srp_register_interface_helper (hw_if_indices_by_side, /* redistribute */ 1);
}
void srp_interface_set_hw_wrap_function (u32 hw_if_index, srp_hw_wrap_function_t * f)
{
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
si->hw_wrap_function = f;
}
void srp_interface_set_hw_enable_function (u32 hw_if_index, srp_hw_enable_function_t * f)
{
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
si->hw_enable_function = f;
}
void srp_interface_enable_ips (u32 hw_if_index)
{
srp_main_t * sm = &srp_main;
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
si->ips_process_enable = 1;
vlib_node_set_state (sm->vlib_main, srp_ips_process_node.index, VLIB_NODE_STATE_POLLING);
}
static uword
srp_is_valid_class_for_interface (vnet_main_t * vnm, u32 hw_if_index, u32 hw_class_index)
{
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
if (! si)
return 0;
/* Both sides must be admin down. */
if (vnet_sw_interface_is_admin_up (vnm, si->rings[SRP_RING_OUTER].sw_if_index))
return 0;
if (vnet_sw_interface_is_admin_up (vnm, si->rings[SRP_RING_INNER].sw_if_index))
return 0;
return 1;
}
static void
srp_interface_hw_class_change (vnet_main_t * vnm, u32 hw_if_index,
u32 old_hw_class_index, u32 new_hw_class_index)
{
srp_main_t * sm = &srp_main;
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
vnet_hw_interface_t * hi;
vnet_device_class_t * dc;
u32 r, to_srp;
if (!si) {
clib_warning ("srp interface no set si = 0");
return;
}
to_srp = new_hw_class_index == srp_hw_interface_class.index;
/* Changing class on either outer or inner rings implies changing the class
of the other. */
for (r = 0; r < SRP_N_RING; r++)
{
srp_interface_ring_t * ir = &si->rings[r];
hi = vnet_get_hw_interface (vnm, ir->hw_if_index);
dc = vnet_get_device_class (vnm, hi->dev_class_index);
/* hw_if_index itself will be handled by caller. */
if (ir->hw_if_index != hw_if_index)
{
vnet_hw_interface_init_for_class (vnm, ir->hw_if_index,
new_hw_class_index,
to_srp ? si - sm->interface_pool : ~0);
if (dc->hw_class_change)
dc->hw_class_change (vnm, ir->hw_if_index, new_hw_class_index);
}
else
hi->hw_instance = to_srp ? si - sm->interface_pool : ~0;
}
if (si->hw_enable_function)
si->hw_enable_function (si, /* enable */ to_srp);
}
VNET_HW_INTERFACE_CLASS (srp_hw_interface_class) = {
.name = "SRP",
.format_address = format_ethernet_address,
.format_header = format_srp_header_with_length,
.format_device = format_srp_device,
.unformat_hw_address = unformat_ethernet_address,
.unformat_header = unformat_srp_header,
.build_rewrite = srp_build_rewrite,
.update_adjacency = ethernet_update_adjacency,
.is_valid_class_for_interface = srp_is_valid_class_for_interface,
.hw_class_change = srp_interface_hw_class_change,
};
static void serialize_srp_interface_config_msg (serialize_main_t * m, va_list * va)
{
srp_interface_t * si = va_arg (*va, srp_interface_t *);
srp_main_t * sm = &srp_main;
ASSERT (! pool_is_free (sm->interface_pool, si));
serialize_integer (m, si - sm->interface_pool, sizeof (u32));
serialize (m, serialize_f64, si->config.wait_to_restore_idle_delay);
serialize (m, serialize_f64, si->config.ips_tx_interval);
}
static void unserialize_srp_interface_config_msg (serialize_main_t * m, va_list * va)
{
CLIB_UNUSED (mc_main_t * mcm) = va_arg (*va, mc_main_t *);
srp_main_t * sm = &srp_main;
srp_interface_t * si;
u32 si_index;
unserialize_integer (m, &si_index, sizeof (u32));
si = pool_elt_at_index (sm->interface_pool, si_index);
unserialize (m, unserialize_f64, &si->config.wait_to_restore_idle_delay);
unserialize (m, unserialize_f64, &si->config.ips_tx_interval);
}
MC_SERIALIZE_MSG (srp_interface_config_msg, static) = {
.name = "vnet_srp_interface_config",
.serialize = serialize_srp_interface_config_msg,
.unserialize = unserialize_srp_interface_config_msg,
};
void srp_interface_get_interface_config (u32 hw_if_index, srp_interface_config_t * c)
{
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
ASSERT (si != 0);
c[0] = si->config;
}
void srp_interface_set_interface_config (u32 hw_if_index, srp_interface_config_t * c)
{
srp_main_t * sm = &srp_main;
vlib_main_t * vm = sm->vlib_main;
srp_interface_t * si = srp_get_interface_from_vnet_hw_interface (hw_if_index);
ASSERT (si != 0);
if (memcmp (&si->config, &c[0], sizeof (c[0])))
{
si->config = c[0];
if (vm->mc_main)
mc_serialize (vm->mc_main, &srp_interface_config_msg, si);
}
}
#if DEBUG > 0
#define VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT VNET_INTERFACE_TX_N_NEXT
/* Echo packets back to srp input. */
static uword
simulated_srp_interface_tx (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
u32 n_left_from, n_left_to_next, n_copy, * from, * to_next;
u32 next_index = VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT;
u32 i;
vlib_buffer_t * b;
n_left_from = frame->n_vectors;
from = vlib_frame_args (frame);
while (n_left_from > 0)
{
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
n_copy = clib_min (n_left_from, n_left_to_next);
clib_memcpy (to_next, from, n_copy * sizeof (from[0]));
n_left_to_next -= n_copy;
n_left_from -= n_copy;
for (i = 0; i < n_copy; i++)
{
b = vlib_get_buffer (vm, from[i]);
/* TX interface will be fake eth; copy to RX for benefit of srp-input. */
b->sw_if_index[VLIB_RX] = b->sw_if_index[VLIB_TX];
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
return n_left_from;
}
static u8 * format_simulated_srp_name (u8 * s, va_list * args)
{
u32 dev_instance = va_arg (*args, u32);
return format (s, "fake-srp%d", dev_instance);
}
VNET_DEVICE_CLASS (srp_simulated_device_class,static) = {
.name = "Simulated srp",
.format_device_name = format_simulated_srp_name,
.tx_function = simulated_srp_interface_tx,
};
static clib_error_t *
create_simulated_srp_interfaces (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
vnet_main_t * vnm = vnet_get_main();
u8 address[6];
u32 hw_if_index;
vnet_hw_interface_t * hi;
static u32 instance;
if (! unformat_user (input, unformat_ethernet_address, &address))
{
memset (address, 0, sizeof (address));
address[0] = 0xde;
address[1] = 0xad;
address[5] = instance;
}
hw_if_index = vnet_register_interface (vnm,
srp_simulated_device_class.index,
instance++,
srp_hw_interface_class.index, 0);
hi = vnet_get_hw_interface (vnm, hw_if_index);
srp_setup_node (vm, hi->output_node_index);
hi->min_packet_bytes = 40 + 16;
/* Standard default ethernet MTU. */
hi->max_l3_packet_bytes[VLIB_RX] = hi->max_l3_packet_bytes[VLIB_TX] = 1500;
vec_free (hi->hw_address);
vec_add (hi->hw_address, address, sizeof (address));
{
uword slot;
slot = vlib_node_add_named_next_with_slot
(vm, hi->tx_node_index,
"srp-input",
VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
ASSERT (slot == VNET_SIMULATED_SRP_TX_NEXT_SRP_INPUT);
}
return /* no error */ 0;
}
static VLIB_CLI_COMMAND (create_simulated_srp_interface_command) = {
.path = "srp create-interfaces",
.short_help = "Create simulated srp interface",
.function = create_simulated_srp_interfaces,
};
#endif