diff options
author | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-03-13 11:01:55 +0200 |
---|---|---|
committer | Yaroslav Brustinov <ybrustin@cisco.com> | 2017-03-13 11:01:55 +0200 |
commit | dbff547f4d9360d3c48c7b269255234cd31271df (patch) | |
tree | 1bbee86b5a4d9d54fa20140f96ea62b7474f8db2 /src | |
parent | c8d1f318e2d322626e401c9599ba75006d2e8e6c (diff) |
i40e fix of workaround of stuck counters + regression test
Change-Id: I251cb8d346461ccfa4eee8abfda113410160a602
Signed-off-by: Yaroslav Brustinov <ybrustin@cisco.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/bp_sim.h | 10 | ||||
-rw-r--r-- | src/dpdk/drivers/net/i40e/i40e_fdir.c | 7 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 18 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h index 7346615a..24681d4b 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -775,6 +775,9 @@ public: out_file = ""; prefix = ""; set_tw_bucket_time_in_usec(20.0); + // we read every 0.5 second. We want to catch the counter when it approach the maximum (where it will stuck, + // and we will start losing packets). + x710_fdir_reset_threshold = 0xffffffff - 1000000000/8/64*40; } CParserOption(){ @@ -819,6 +822,7 @@ public: CMacAddrCfg m_mac_addr[TREX_MAX_PORTS]; double m_tw_bucket_time_sec; double m_tw_bucket_time_sec_level1; + uint32_t x710_fdir_reset_threshold; public: uint8_t * get_src_mac_addr(int if_index){ @@ -857,6 +861,12 @@ public: void set_rx_enabled() { m_rx_thread_enabled = true; } + uint32_t get_x710_fdir_reset_threshold() { + return (x710_fdir_reset_threshold); + } + void set_x710_fdir_reset_threshold(uint32_t val) { + x710_fdir_reset_threshold = val; + } inline double get_tw_bucket_time_in_sec(void){ return (m_tw_bucket_time_sec); diff --git a/src/dpdk/drivers/net/i40e/i40e_fdir.c b/src/dpdk/drivers/net/i40e/i40e_fdir.c index eddb2b9f..ceac810f 100644 --- a/src/dpdk/drivers/net/i40e/i40e_fdir.c +++ b/src/dpdk/drivers/net/i40e/i40e_fdir.c @@ -1145,11 +1145,18 @@ i40e_add_del_fdir_filter(struct rte_eth_dev *dev, memset(&check_filter, 0, sizeof(check_filter)); i40e_fdir_filter_convert(filter, &check_filter); node = i40e_sw_fdir_filter_lookup(fdir_info, &check_filter.fdir.input); + +#ifndef TREX_PATCH +/* +We use same rule at different filters, for example to overcome "stuck counters" issue: +https://trex-tgn.cisco.com/youtrack/issue/trex-199 + */ if (add && node) { PMD_DRV_LOG(ERR, "Conflict with existing flow director rules!"); return -EINVAL; } +#endif if (!add && !node) { PMD_DRV_LOG(ERR, diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 0da245ba..1f9dadcd 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -708,6 +708,7 @@ enum { OPT_HELP, OPT_L_PKT_MODE, OPT_NO_FLOW_CONTROL, OPT_NO_HW_FLOW_STAT, + OPT_X710_RESET_THRESHOLD, OPT_VLAN, OPT_RX_CHECK_HOPS, OPT_CLIENT_CFG_FILE, @@ -770,6 +771,7 @@ static CSimpleOpt::SOption parser_options[] = { OPT_L_PKT_MODE, "--l-pkt-mode", SO_REQ_SEP }, { OPT_NO_FLOW_CONTROL, "--no-flow-control-change", SO_NONE }, { OPT_NO_HW_FLOW_STAT, "--no-hw-flow-stat", SO_NONE }, + { OPT_X710_RESET_THRESHOLD, "--x710-reset-threshold", SO_REQ_SEP }, { OPT_VLAN, "--vlan", SO_NONE }, { OPT_CLIENT_CFG_FILE, "--client_cfg", SO_REQ_SEP }, { OPT_CLIENT_CFG_FILE, "--client-cfg", SO_REQ_SEP }, @@ -831,7 +833,7 @@ static int usage(){ printf(" 1 In case of TCP flow, use TCP ACK in first SYN to pass NAT translation information. Initial SYN packet must be first packet in the TCP flow \n"); printf(" In case of UDP stream, NAT translation information will pass in IP ID field of first packet in flow. This means that this field is changed by TRex\n"); printf(" 2 Add special IP option to pass NAT translation information to first packet of each flow. Will not work on certain firewalls if they drop packets with IP options \n"); - printf(" 3 Like 1, but without support for sequence number randomization in server->clien direction. Performance (flow/second) better than 1 \n"); + printf(" 3 Like 1, but without support for sequence number randomization in server->client direction. Performance (flow/second) better than 1 \n"); printf(" --learn-verify : Test the NAT translation mechanism. Should be used when there is no NAT in the setup \n"); printf(" --limit-ports : Limit number of ports used. Must be even number (TRex always uses port pairs) \n"); printf(" --lm : Hex mask of cores that should send traffic \n"); @@ -1014,6 +1016,9 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t case OPT_NO_FLOW_CONTROL: po->preview.set_disable_flow_control_setting(true); break; + case OPT_X710_RESET_THRESHOLD: + po->set_x710_fdir_reset_threshold(atoi(args.OptionArg())); + break; case OPT_VLAN: opt_vlan_was_set = true; break; @@ -6740,9 +6745,6 @@ void CTRexExtendedDriverBase40G::reset_rx_stats(CPhyEthIF * _if, uint32_t *stats // instead of adding this to rte_ethdev.h extern "C" int rte_eth_fdir_stats_get(uint8_t port_id, uint32_t *stats, uint32_t start, uint32_t len); -// we read every 0.5 second. We want to catch the counter when it approach the maximum (where it will stuck, -// and we will start losing packets). -const uint32_t X710_FDIR_RESET_THRESHOLD = 0xffffffff - 1000000000/8/64*40; // get rx stats on _if, between min and max // prev_pkts should be the previous values read from the hardware. @@ -6759,21 +6761,19 @@ int CTRexExtendedDriverBase40G::get_rx_stats(CPhyEthIF * _if, uint32_t *pkts, ui rte_eth_fdir_stats_get(port_id, hw_stats, start, len); for (int i = loop_start; i < loop_start + len; i++) { - if (unlikely(hw_stats[i - min] > X710_FDIR_RESET_THRESHOLD)) { - // When x710 fdir counters reach max of 32 bits (4G), the get stuck. To handle this, we temporarily + if (unlikely(hw_stats[i - min] > CGlobalInfo::m_options.get_x710_fdir_reset_threshold())) { + // When x710 fdir counters reach max of 32 bits (4G), they get stuck. To handle this, we temporarily // move to temp counter, reset the counter in danger, and go back to using it. // see trex-199 for more details - uint32_t counter, temp_count; + uint32_t counter, temp_count=0; uint32_t hw_id = start - min + i; add_del_rules( RTE_ETH_FILTER_ADD, port_id, fdir_hw_id_rule_params[hw_id].rule_type, 0 , IP_ID_RESERVE_BASE + i, fdir_hw_id_rule_params[hw_id].l4_proto, MAIN_DPDK_DROP_Q , FDIR_TEMP_HW_ID); - delay(100); rte_eth_fdir_stats_reset(port_id, &counter, hw_id, 1); add_del_rules( RTE_ETH_FILTER_ADD, port_id, fdir_hw_id_rule_params[hw_id].rule_type, 0 , IP_ID_RESERVE_BASE + i, fdir_hw_id_rule_params[hw_id].l4_proto, MAIN_DPDK_DROP_Q, hw_id); - delay(100); rte_eth_fdir_stats_reset(port_id, &temp_count, FDIR_TEMP_HW_ID, 1); pkts[i] = counter + temp_count - prev_pkts[i]; prev_pkts[i] = 0; |