diff options
author | 2016-07-05 15:58:05 +0300 | |
---|---|---|
committer | 2016-07-05 15:58:05 +0300 | |
commit | c9a62eba0b701bec78e672f15ff0fc587b8c0792 (patch) | |
tree | 78b3a432c9e6a4b2eaa36670f3f4e5c3a2503c35 | |
parent | 087464fbd4011b1a357f0567e9793dde641e9120 (diff) |
add TRex -w argument (wait between nics init and sending traffic)
-rwxr-xr-x | src/bp_sim.h | 2 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 25 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/bp_sim.h b/src/bp_sim.h index 23e9f8d5..d2812688 100755 --- a/src/bp_sim.h +++ b/src/bp_sim.h @@ -768,6 +768,7 @@ public: m_latency_rate =0; m_latency_mask =0xffffffff; m_latency_prev=0; + m_wait_before_traffic=1; m_zmq_port=4500; m_telnet_port =4501; m_platform_factor=1.0; @@ -797,6 +798,7 @@ public: uint32_t m_latency_rate; /* pkt/sec for each thread/port zero disable */ uint32_t m_latency_mask; uint32_t m_latency_prev; + uint32_t m_wait_before_traffic; uint16_t m_rx_check_sample; /* the sample rate of flows */ uint16_t m_rx_check_hops; uint16_t m_zmq_port; diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index c36c3eae..eeacdbff 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -140,8 +140,8 @@ public: virtual int configure_drop_queue(CPhyEthIF * _if); virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats)=0; virtual void clear_extended_stats(CPhyEthIF * _if)=0; - virtual int wait_for_stable_link()=0; - virtual void wait_after_link_up(){}; + virtual int wait_for_stable_link(); + virtual void wait_after_link_up(); virtual bool flow_control_disable_supported(){return true;} virtual bool hw_rx_stat_supported(){return false;} virtual int get_rx_stats(CPhyEthIF * _if, uint32_t *pkts, uint32_t *prev_pkts, uint32_t *bytes, uint32_t *prev_bytes @@ -537,6 +537,7 @@ enum { OPT_HELP, OPT_ONLY_LATENCY, OPT_1G_MODE, OPT_LATENCY_PREVIEW , + OPT_WAIT_BEFORE_TRAFFIC, OPT_PCAP, OPT_RX_CHECK, OPT_IO_MODE, @@ -598,6 +599,7 @@ static CSimpleOpt::SOption parser_options[] = { OPT_1G_MODE, "-1g", SO_NONE }, { OPT_LATENCY_PREVIEW , "-k", SO_REQ_SEP }, + { OPT_WAIT_BEFORE_TRAFFIC , "-w", SO_REQ_SEP }, { OPT_PCAP, "--pcap", SO_NONE }, { OPT_RX_CHECK, "--rx-check", SO_REQ_SEP }, { OPT_IO_MODE, "--iom", SO_REQ_SEP }, @@ -675,6 +677,8 @@ static int usage(){ printf(" \n"); printf(" -k [sec] : run latency test before starting the test. it will wait for x sec sending packet and x sec after that \n"); printf(" \n"); + printf(" -w [sec] : wait between init of interfaces and sending traffic,\n"); + printf(" \n"); printf(" --cfg [platform_yaml] : load and configure platform using this file see example in cfg/cfg_examplexx.yaml file \n"); printf(" this file is used to configure/mask interfaces cores affinity and mac addr \n"); @@ -941,6 +945,10 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t sscanf(args.OptionArg(),"%d", &po->m_latency_prev); break; + case OPT_WAIT_BEFORE_TRAFFIC : + sscanf(args.OptionArg(),"%d", &po->m_wait_before_traffic); + break; + case OPT_PCAP: po->preview.set_pcap_mode_enable(true); break; @@ -4865,6 +4873,15 @@ int CTRexExtendedDriverBase::configure_drop_queue(CPhyEthIF * _if) { return (rte_eth_dev_rx_queue_stop(port_id, 0)); } +int CTRexExtendedDriverBase::wait_for_stable_link() { + wait_x_sec(CGlobalInfo::m_options.m_wait_before_traffic); + return 0; +} + +void CTRexExtendedDriverBase::wait_after_link_up() { + wait_x_sec(CGlobalInfo::m_options.m_wait_before_traffic); +} + CFlowStatParser *CTRexExtendedDriverBase::get_flow_stat_parser() { CFlowStatParser *parser = new CFlowStatParser(); assert (parser); @@ -4886,11 +4903,11 @@ void wait_x_sec(int sec) { // in 1G we need to wait if links became ready to soon void CTRexExtendedDriverBase1G::wait_after_link_up(){ - wait_x_sec(7); + wait_x_sec(6 + CGlobalInfo::m_options.m_wait_before_traffic); } int CTRexExtendedDriverBase1G::wait_for_stable_link(){ - wait_x_sec(10); + wait_x_sec(9 + CGlobalInfo::m_options.m_wait_before_traffic); return(0); } |