summaryrefslogtreecommitdiffstats
path: root/src/plugins/flowprobe
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2017-08-09 10:42:06 +0200
committerOle Trøan <otroan@employees.org>2017-08-29 12:27:44 +0000
commit50b60ebcc306b162a5d7b0916830638a2e99d378 (patch)
tree04a5549f516399993ebccd6b4cd398aeabd9188f /src/plugins/flowprobe
parent4ba75f54461c31fbb32b8ef9c05fe38da74cb295 (diff)
Flowprobe: Fix flow start time and hash computation
Upon hash collision, the flow start time was not reset. The hash computation techniques (crc32 or xxhash) also both had bugs which are now fixed. Change-Id: I94d72997f34018d1699324264f7dded2a5cbd776 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src/plugins/flowprobe')
-rw-r--r--src/plugins/flowprobe/flowprobe.h34
-rw-r--r--src/plugins/flowprobe/node.c12
2 files changed, 21 insertions, 25 deletions
diff --git a/src/plugins/flowprobe/flowprobe.h b/src/plugins/flowprobe/flowprobe.h
index 760e924185c..02ee053c911 100644
--- a/src/plugins/flowprobe/flowprobe.h
+++ b/src/plugins/flowprobe/flowprobe.h
@@ -72,30 +72,22 @@ typedef struct
u16 *next_record_offset_per_worker;
} flowprobe_protocol_context_t;
-#define FLOWPROBE_KEY_IN_U32 22
/* *INDENT-OFF* */
-typedef CLIB_PACKED (union
-{
- struct {
- u32 rx_sw_if_index;
- u32 tx_sw_if_index;
- u8 src_mac[6];
- u8 dst_mac[6];
- u16 ethertype;
- ip46_address_t src_address;
- ip46_address_t dst_address;
- u8 protocol;
- u16 src_port;
- u16 dst_port;
- flowprobe_variant_t which;
- };
- u32 as_u32[FLOWPROBE_KEY_IN_U32];
-}) flowprobe_key_t;
+typedef struct __attribute__ ((aligned (8))) {
+ u32 rx_sw_if_index;
+ u32 tx_sw_if_index;
+ u8 src_mac[6];
+ u8 dst_mac[6];
+ u16 ethertype;
+ ip46_address_t src_address;
+ ip46_address_t dst_address;
+ u8 protocol;
+ u16 src_port;
+ u16 dst_port;
+ flowprobe_variant_t which;
+} flowprobe_key_t;
/* *INDENT-ON* */
-STATIC_ASSERT (sizeof (flowprobe_key_t) == FLOWPROBE_KEY_IN_U32 *
- sizeof (u32), "flowprobe_key_t padding is wrong");
-
typedef struct
{
u32 sec;
diff --git a/src/plugins/flowprobe/node.c b/src/plugins/flowprobe/node.c
index c4610a77fa4..2f7d002561a 100644
--- a/src/plugins/flowprobe/node.c
+++ b/src/plugins/flowprobe/node.c
@@ -289,10 +289,13 @@ flowprobe_hash (flowprobe_key_t * k)
u32 h = 0;
#ifdef clib_crc32c_uses_intrinsics
- h = clib_crc32c ((u8 *) k->as_u32, FLOWPROBE_KEY_IN_U32);
+ h = clib_crc32c ((u8 *) k, sizeof (*k));
#else
- u64 tmp =
- k->as_u32[0] ^ k->as_u32[1] ^ k->as_u32[2] ^ k->as_u32[3] ^ k->as_u32[4];
+ int i;
+ u64 tmp = 0;
+ for (i = 0; i < sizeof (*k) / 8; i++)
+ tmp ^= ((u64 *) k)[i];
+
h = clib_xxhash (tmp);
#endif
@@ -370,7 +373,7 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node,
ethernet_header_t *eth = vlib_buffer_get_current (b);
u16 ethertype = clib_net_to_host_u16 (eth->type);
/* *INDENT-OFF* */
- flowprobe_key_t k = { {0} };
+ flowprobe_key_t k = {};
/* *INDENT-ON* */
ip4_header_t *ip4 = 0;
ip6_header_t *ip6 = 0;
@@ -472,6 +475,7 @@ add_to_flow_record_state (vlib_main_t * vm, vlib_node_runtime_t * node,
if (e->packetcount)
flowprobe_export_entry (vm, e);
e->key = k;
+ e->flow_start = timestamp;
vlib_node_increment_counter (vm, node->node_index,
FLOWPROBE_ERROR_COLLISION, 1);
}
'#n108'>108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
# Copyright (c) 2017 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
| ...
| Force Tags | 3_NODE_SINGLE_LINK_TOPO | PERFTEST | HW_ENV | NDRPDRDISC
| ... | NIC_Intel-X520-DA2 | ETH | L2BDMACLRN | FEATURE | MACIP | ACL_STATELESS
| ... | IACL | ACL10 | 100k_FLOWS
| ...
| Suite Setup | Run Keywords
| ... | Set up 3-node performance topology with DUT's NIC model | L2
| ... | Intel-X520-DA2
| ... | AND | Set up performance test suite with ACL
| Suite Teardown | Tear down 3-node performance topology
| ...
| Test Setup | Set up performance test
| ...
| Test Teardown | Tear down performance test with MACIP ACL
| ... | ${min_rate}pps | ${framesize} | ${traffic_profile}
| ...
| Test Template | Local template
| ...
| Documentation | *RFC2544: Packet throughput L2BD test cases with ACL*
| ...
| ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
| ... | with single links between nodes.
| ... | *[Enc] Packet Encapsulations:* Eth-IPv4 for L2 switching of IPv4.
| ... | *[Cfg] DUT configuration:* DUT1 is configured with L2 bridge domain\
| ... | and MAC learning enabled. DUT2 is configured with L2 cross-connects.\
| ... | Required MACIP ACL rules are applied to input paths of both DUT1\
| ... | interfaces. DUT1 and DUT2 are tested with 2p10GE NIC X520 Niantic by\
| ... | Intel.
| ... | *[Ver] TG verification:* TG finds and reports throughput NDR (Non Drop\
| ... | Rate) with zero packet loss tolerance or 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 either binary search or linear search\
| ... | algorithms with configured starting rate and final step that determines\
| ... | throughput measurement resolution. Test packets are generated by TG on\
| ... | links to DUTs. TG traffic profile contains two L3 flow-groups\
| ... | (flow-group per direction, ${flows_per_dir} flows per flow-group) 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.
| ... | *[Ref] Applicable standard specifications:* RFC2544.

*** Variables ***
# X520-DA2 bandwidth limit
| ${s_limit}= | ${10000000000}

# ACL test setup
| ${acl_action}= | permit
| ${no_hit_aces_number}= | 10
| ${flows_per_dir}= | 100k

# starting points for non-hitting ACLs
| ${src_ip_start}= | 30.30.30.1
| ${ip_step}= | ${1}
| ${src_mac_start}= | 01:02:03:04:05:06
| ${src_mac_step}= | ${1000}
| ${src_mac_mask}= | 00:00:00:00:00:00
| ${tg_stream1_mac}= | ca:fe:00:00:00:00
| ${tg_stream2_mac}= | fa:ce:00:00:00:00
| ${tg_mac_mask}= | ff:ff:ff:fe:00:00
| ${tg_stream1_subnet}= | 10.0.0.0/15
| ${tg_stream2_subnet}= | 20.0.0.0/15

# traffic profile
| ${traffic_profile}= | trex-sl-3n-ethip4-macsrc100kip4src100k

*** Keywords ***
| Local template
| | [Arguments] | ${phy_core} | ${framesize} | ${search_type}
| | ... | ${min_rate}=${50000} | ${rxq}=${None}
| | ...
| | Set Test Variable | ${framesize}
| | Set Test Variable | ${min_rate}
| | ${max_rate}= | Calculate pps | ${s_limit} | ${framesize}
| | ${binary_min}= | Set Variable | ${min_rate}
| | ${binary_max}= | Set Variable | ${max_rate}
| | ${threshold}= | Set Variable | ${min_rate}
| | ...
| | Given Add worker threads and rxqueues to all DUTs | ${phy_cores} | ${rxq}
| | And Add PCI devices to all DUTs
| | ${get_framesize}= | Get Frame Size | ${framesize}
| | And Run Keyword If | ${get_framesize} < ${1522} | Add no multi seg to all DUTs
| | And Apply startup configuration on all VPP DUTs
| | When Initialize L2 bridge domain with MACIP ACLs on DUT1 in 3-node circular topology
| | Then Run Keyword If | '${search_type}' == 'NDR'
| | ... | Find NDR using binary search and pps
| | ... | ${framesize} | ${binary_min} | ${binary_max} | ${traffic_profile}
| | ... | ${min_rate} | ${max_rate} | ${threshold}
| | ... | ELSE IF | '${search_type}' == 'PDR'
| | ... | Find PDR using binary search and pps
| | ... | ${framesize} | ${binary_min} | ${binary_max} | ${traffic_profile}
| | ... | ${min_rate} | ${max_rate} | ${threshold}
| | ... | ${perf_pdr_loss_acceptance} | ${perf_pdr_loss_acceptance_type}

*** Test Cases ***
| tc01-64B-1t1c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-ndrdisc
| | [Tags] | 64B | 1C | NDRDISC
| | phy_cores=${1} | framesize=${64}  | search_type=NDR

| tc02-64B-1t1c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-pdrdisc
| | [Tags] | 64B | 1C | PDRDISC | SKIP_PATCH
| | phy_cores=${1} | framesize=${64}  | search_type=PDR

| tc03-64B-2t2c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-ndrdisc
| | [Tags] | 64B | 2C | NDRDISC
| | phy_cores=${2} | framesize=${64}  | search_type=NDR

| tc04-64B-2t2c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-pdrdisc
| | [Tags] | 64B | 2C | PDRDISC | SKIP_PATCH
| | phy_cores=${2} | framesize=${64}  | search_type=PDR

| tc05-64B-4t4c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-ndrdisc
| | [Tags] | 64B | 4C | NDRDISC
| | phy_cores=${4} | framesize=${64}  | search_type=NDR

| tc06-64B-4t4c-eth-l2bdbasemaclrn-macip-iacl10sl-100kflows-pdrdisc
| | [Tags] | 64B | 4C | PDRDISC | SKIP_PATCH
| | phy_cores=${4} | framesize=${64}  | search_type=PDR