try:
with open(filepath, 'r') as f:
config = yaml.safe_load(f)
-
+
# Handle TRex configuration
trex_config['trex_name'] = config["trex"]["hostname"]
- trex_config['trex_password'] = config["trex"].get("password")
- #trex_config['trex_is_dual'] = config["trex"]["is_dual"]
trex_config['trex_cores'] = int(config["trex"]["cores"])
- #trex_config['trex_latency'] = int(config["trex"]["latency"])
-# trex_config['trex_version_path'] = config["trex"]["version_path"]
trex_config['modes'] = config['trex'].get('modes', [])
+ for key, val in config['trex'].items():
+ trex_config[key] = val
if 'loopback' not in trex_config['modes']:
trex_config['router_interface'] = config["router"]["ip_address"]
"""
# create response dictionary
- benchmark_config = {}
+ benchmark_config = {}
try:
- with open(filepath, 'r') as f:
+ with open(filepath) as f:
benchmark_config = yaml.safe_load(f)
except Exception as inst:
self.cap = cap
drv_name = port_info['driver']
+ self.drv_name = drv_name
if drv_name == 'net_ixgbe':
self.ipv6_support = False
else:
except STLError as e:
assert False , '{0}'.format(e)
+
+
+ # counters get stuck in i40e when they are getting to limit.
+ # this test checks our workaround to this issue
+ def test_x710_counters_wraparound(self):
+ if self.drv_name != 'net_i40e':
+ self.skip('Test is only for i40e.')
+
+ percent = min(20, self.speed * 0.8) # 8G at X710 and 20G at XL710
+ total_pkts = 300000000 # send 300 million packets to ensure getting to threshold of reset several times
+
+ s1 = STLStream(name = 'wrapping_stream',
+ packet = self.pkt,
+ flow_stats = STLFlowStats(pg_id = 5),
+ mode = STLTXSingleBurst(total_pkts = total_pkts,
+ percentage = percent))
+
+ # add both streams to ports
+ self.c.add_streams([s1], ports = [self.tx_port])
+
+ print("\ninjecting {0} packets on port {1}\n".format(total_pkts, self.tx_port))
+
+ exp = {'pg_id': 5, 'total_pkts': total_pkts, 'pkt_len': s1.get_pkt_len()}
+
+ self.__rx_iteration( [exp] )
+
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(){
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){
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);
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,
{ 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 },
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");
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;
// 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.
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;