aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorPablo Camarillo <pcamaril@cisco.com>2017-11-16 16:02:50 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-11-27 19:00:17 +0000
commit1a5e301fcdcd109d14112aafc5f5ee48d1462458 (patch)
tree76e88e7c4f142356fd20a0e71fa7d74e743a046c /src/vnet
parent7af4a57e7824c850f28a3cc5b4451a9e9baad068 (diff)
SRv6 improvements to binary API
Change-Id: I260f5fe43074c0be973309f0a0895f50f0ca7c2b Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/srv6/sr.api42
-rwxr-xr-xsrc/vnet/srv6/sr.h2
-rw-r--r--src/vnet/srv6/sr_api.c56
-rwxr-xr-xsrc/vnet/srv6/sr_policy_rewrite.c6
4 files changed, 84 insertions, 22 deletions
diff --git a/src/vnet/srv6/sr.api b/src/vnet/srv6/sr.api
index 2c72cc55ed2..f2f6e78807d 100644
--- a/src/vnet/srv6/sr.api
+++ b/src/vnet/srv6/sr.api
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-vl_api_version 1.0.0
+vl_api_version 1.0.1
/** \brief IPv6 SR LocalSID add/del request
@param client_index - opaque cookie to identify the sender
@@ -106,6 +106,19 @@ autoreply define sr_policy_del
u32 sr_policy_index;
};
+/** \brief IPv6 SR Set SRv6 encapsulation source
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param bsid is the bindingSID of the SR Policy
+ @param index is the index of the SR policy
+*/
+autoreply define sr_set_encap_source
+{
+ u32 client_index;
+ u32 context;
+ u8 encaps_source[16];
+};
+
/** \brief IPv6 SR steering add/del
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -136,33 +149,22 @@ autoreply define sr_steering_add_del
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
*/
-/**define sr_localsids_dump
+define sr_localsids_dump
{
u32 client_index;
u32 context;
-};*/
+};
-/** \brief Details about a single SR LocalSID
- @param context - returned sender context, to match reply w/ request
- @param localsid_addr IPv6 address of the localsid
- @param behavior Type of behavior (function) for this localsid
- @param end_psp Boolean of whether decapsulation is allowed in this function
- @param sw_if_index Only for L2/L3 xconnect. OIF. In VRF variant the fib_table.
- @param vlan_index Only for L2 xconnect. Outgoing VLAN tag.
- @param fib_table FIB table in which we should install the localsid entry
- @param nh_addr Next Hop IPv4/IPv6 address. Only for L2/L3 xconnect.
-*/
-/**manual_endian define sr_localsid_details
+define sr_localsids_details
{
u32 context;
- u8 localsid_addr[16];
- u8 behavior;
+ u8 address[16];
u8 end_psp;
- u32 sw_if_index;
- u32 vlan_index;
+ u16 behavior;
u32 fib_table;
- u8 nh_addr[16];
-};*/
+ u8 xconnect_next_hop[16];
+ u32 xconnect_iface_or_vrf_table;
+};
/*
* fd.io coding-style-patch-verification: OFF
diff --git a/src/vnet/srv6/sr.h b/src/vnet/srv6/sr.h
index d0f42869d21..1a30cf3e3e0 100755
--- a/src/vnet/srv6/sr.h
+++ b/src/vnet/srv6/sr.h
@@ -276,6 +276,8 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
u32 table_id, ip46_address_t * prefix, u32 mask_width,
u32 sw_if_index, u8 traffic_type);
+extern void sr_set_source (ip6_address_t * address);
+
/**
* @brief SR rewrite string computation for SRH insertion (inline)
*
diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c
index 623f672a204..789bb27386c 100644
--- a/src/vnet/srv6/sr_api.c
+++ b/src/vnet/srv6/sr_api.c
@@ -46,8 +46,9 @@
#define foreach_vpe_api_msg \
_(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
_(SR_POLICY_DEL, sr_policy_del) \
-_(SR_STEERING_ADD_DEL, sr_steering_add_del)
-//_(SR_LOCALSIDS, sr_localsids_dump)
+_(SR_STEERING_ADD_DEL, sr_steering_add_del) \
+_(SR_SET_ENCAP_SOURCE, sr_set_encap_source) \
+_(SR_LOCALSIDS_DUMP, sr_localsids_dump)
//_(SR_LOCALSID_BEHAVIORS, sr_localsid_behaviors_dump)
static void vl_api_sr_localsid_add_del_t_handler
@@ -152,6 +153,16 @@ vl_api_sr_policy_del_t_handler (vl_api_sr_policy_del_t * mp)
REPLY_MACRO (VL_API_SR_POLICY_DEL_REPLY);
}
+static void
+vl_api_sr_set_encap_source_t_handler (vl_api_sr_set_encap_source_t * mp)
+{
+ vl_api_sr_set_encap_source_reply_t *rmp;
+ int rv = 0;
+ sr_set_source ((ip6_address_t *) & mp->encaps_source);
+
+ REPLY_MACRO (VL_API_SR_POLICY_DEL_REPLY);
+}
+
static void vl_api_sr_steering_add_del_t_handler
(vl_api_sr_steering_add_del_t * mp)
{
@@ -179,6 +190,47 @@ static void vl_api_sr_steering_add_del_t_handler
REPLY_MACRO (VL_API_SR_STEERING_ADD_DEL_REPLY);
}
+static void send_sr_localsid_details
+ (ip6_sr_localsid_t * t, unix_shared_memory_queue_t * q, u32 context)
+{
+ vl_api_sr_localsids_details_t *rmp;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs (VL_API_SR_LOCALSIDS_DETAILS);
+ memcpy (rmp->address, &t->localsid, sizeof (ip6_address_t));
+ rmp->end_psp = t->end_psp;
+ rmp->behavior = htons (t->behavior);
+ rmp->fib_table = htonl (t->fib_table);
+ memcpy (rmp->xconnect_next_hop, &t->next_hop, sizeof (ip6_address_t));
+ rmp->xconnect_iface_or_vrf_table = htonl (t->sw_if_index);
+ rmp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void vl_api_sr_localsids_dump_t_handler
+ (vl_api_sr_localsids_dump_t * mp)
+{
+ unix_shared_memory_queue_t *q;
+ ip6_sr_main_t *sm = &sr_main;
+ ip6_sr_localsid_t *t;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0)
+ {
+ return;
+ }
+
+ /* *INDENT-OFF* */
+ pool_foreach (t, sm->localsids,
+ ({
+ send_sr_localsid_details(t, q, mp->context);
+ }));
+ /* *INDENT-ON* */
+}
+
+
/*
* sr_api_hookup
* Add vpe's API message handlers to the table.
diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c
index 514dd6584d0..b42942c3cd5 100755
--- a/src/vnet/srv6/sr_policy_rewrite.c
+++ b/src/vnet/srv6/sr_policy_rewrite.c
@@ -112,6 +112,12 @@ static ip6_address_t sr_pr_encaps_src;
/* Note: This is temporal. We don't know whether to follow this path or
take the ip address of a loopback interface or even the OIF */
+void
+sr_set_source (ip6_address_t * address)
+{
+ clib_memcpy (&sr_pr_encaps_src, address, sizeof (sr_pr_encaps_src));
+}
+
static clib_error_t *
set_sr_src_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Copyright (c) 2019 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.

*** Settings ***
| Resource | resources/libraries/robot/performance/performance_setup.robot
| Resource | resources/libraries/robot/crypto/ipsec.robot
| ...
| Force Tags | 3_NODE_SINGLE_LINK_TOPO | PERFTEST | HW_ENV | NDRPDR | TNL_100
| ... | IP4FWD | IPSEC | IPSECSW | IPSECINT | NIC_Intel-X710 | SCALE
| ... | AES_256_GCM | AES
| ...
| Suite Setup | Run Keywords
| ... | Set up IPSec performance test suite | L3 | ${nic_name} | SW_cryptodev
| ... | AND | Set up performance test suite with crypto ipsecmb
| Suite Teardown | Tear down 3-node performance topology
| ...
| Test Setup | Set up performance test
| Test Teardown | Tear down performance test
| ...
| Test Template | Local Template
| ...
| Documentation | *RFC2544: Pkt throughput IPv4 IPsec tunnel mode.*
| ...
| ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology
| ... | with single links between nodes.
| ... | *[Enc] Packet Encapsulations:* Eth-IPv4 on TG-DUTn,
| ... | Eth-IPv4-IPSec on DUT1-DUT2
| ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with multiple\
| ... | IPsec tunnels between them. DUTs get IPv4 traffic from TG, encrypt it\
| ... | and send to another DUT, where packets are decrypted and sent back to TG
| ... | *[Ver] TG verification:* TG finds and reports throughput NDR (Non Drop\
| ... | Rate) with zero packet loss tolerance and throughput PDR (Partial Drop\
| ... | Rate) with non-zero packet loss tolerance (LT) expressed in percentage\
| ... | of packets transmitted. NDR and PDR are discovered for different\
| ... | Ethernet L2 frame sizes using MLRsearch library.\
| ... | Test packets are generated by TG on
| ... | links to DUTs. TG traffic profile contains two L3 flow-groups
| ... | (flow-group per direction, number of flows per flow-group equals to
| ... | number of IPSec tunnels) with all packets
| ... | containing Ethernet header, IPv4 header with IP protocol=61 and
| ... | static payload. MAC addresses are matching MAC addresses of the TG
| ... | node interfaces. Incrementing of IP.dst (IPv4 destination address) field
| ... | is applied to both streams.
| ... | *[Ref] Applicable standard specifications:* RFC4303 and RFC2544.

*** Variables ***
| ${nic_name}= | Intel-X710
| ${overhead}= | ${54}
| ${tg_if1_ip4}= | 192.168.10.2
| ${dut1_if1_ip4}= | 192.168.10.1
| ${dut1_if2_ip4}= | 100.0.0.1
| ${dut2_if1_ip4}= | 100.0.0.2
| ${dut2_if2_ip4}= | 192.168.20.1
| ${tg_if2_ip4}= | 192.168.20.2
| ${raddr_ip4}= | 20.0.0.0
| ${laddr_ip4}= | 10.0.0.0
| ${addr_range}= | ${24}
| ${n_tunnels}= | ${100}
# Traffic profile:
| ${traffic_profile}= | trex-sl-3n-ethip4-ip4dst${n_tunnels}

*** Keywords ***
| Local Template
| | [Documentation]
| | ... | [Cfg] DUT runs IPSec tunneling AES_256_GCM config.
| | ... | Each DUT uses ${phy_cores} physical core(s) for worker threads.
| | ... | [Ver] Measure NDR and PDR values using MLRsearch algorithm.\
| | ...
| | ... | *Arguments:*
| | ... | - frame_size - Framesize in Bytes in integer or string (IMIX_v4_1).
| | ... | Type: integer, string
| | ... | - phy_cores - Number of physical cores. Type: integer
| | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer
| | ...
| | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None}
| | ...
| | Set Test Variable | \${frame_size}
| | ...
| | # These are enums (not strings) so they cannot be in Variables table.
| | ${encr_alg}= | Crypto Alg AES GCM 256
| | ${auth_alg}= | Integ Alg AES GCM 256
| | ...
| | Given Add worker threads and rxqueues to all DUTs | ${phy_cores} | ${rxq}
| | And Add PCI devices to all DUTs
| | And Set Max Rate And Jumbo And Handle Multi Seg
| | And Apply startup configuration on all VPP DUTs
| | And Initialize IPSec in 3-node circular topology
| | And VPP IPsec Create Tunnel Interfaces
| | ... | ${nodes} | ${dut1_if2_ip4} | ${dut2_if1_ip4} | ${dut1_if2}
| | ... | ${dut2_if1} | ${n_tunnels} | ${encr_alg} | ${auth_alg}
| | ... | ${laddr_ip4} | ${raddr_ip4} | ${addr_range}
| | Then Find NDR and PDR intervals using optimized search

*** Test Cases ***
| tc01-64B-1c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 64B | 1C
| | frame_size=${64} | phy_cores=${1}

| tc02-64B-2c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 64B | 2C
| | frame_size=${64} | phy_cores=${2}

| tc03-64B-4c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 64B | 4C
| | frame_size=${64} | phy_cores=${4}

| tc04-1518B-1c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 1518B | 1C
| | frame_size=${1518} | phy_cores=${1}

| tc05-1518B-2c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 1518B | 2C
| | frame_size=${1518} | phy_cores=${2}

| tc06-1518B-4c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 1518B | 4C
| | frame_size=${1518} | phy_cores=${4}

| tc07-9000B-1c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 9000B | 1C
| | frame_size=${9000} | phy_cores=${1}

| tc08-9000B-2c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 9000B | 2C
| | frame_size=${9000} | phy_cores=${2}

| tc09-9000B-4c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | 9000B | 4C
| | frame_size=${9000} | phy_cores=${4}

| tc10-IMIX-1c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | IMIX | 1C
| | frame_size=IMIX_v4_1 | phy_cores=${1}

| tc11-IMIX-2c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | IMIX | 2C
| | frame_size=IMIX_v4_1 | phy_cores=${2}

| tc12-IMIX-4c-ethip4ipsec100tnlsw-ip4base-int-aes256gcm-ndrpdr
| | [Tags] | IMIX | 4C
| | frame_size=IMIX_v4_1 | phy_cores=${4}