diff options
author | Hanoh Haim <hhaim@cisco.com> | 2017-01-23 14:57:29 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2017-01-23 14:57:41 +0200 |
commit | 030c124495335da372a5bb4f537365cce3def3af (patch) | |
tree | 134b3c6fef900ba84a16d41612c6788cb8e64198 | |
parent | aee39c9dd61944b3be3c20b4e3f9ec4d57602d01 (diff) |
fix trex-333
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
-rwxr-xr-x | scripts/automation/regression/stateful_tests/trex_imix_test.py | 7 | ||||
-rw-r--r-- | scripts/automation/regression/stateless_tests/stl_rx_test.py | 34 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 111 |
3 files changed, 135 insertions, 17 deletions
diff --git a/scripts/automation/regression/stateful_tests/trex_imix_test.py b/scripts/automation/regression/stateful_tests/trex_imix_test.py index dc7eea0b..4cb01db3 100755 --- a/scripts/automation/regression/stateful_tests/trex_imix_test.py +++ b/scripts/automation/regression/stateful_tests/trex_imix_test.py @@ -121,11 +121,6 @@ class CTRexIMIX_Test(CTRexGeneral_Test): mult = self.get_benchmark_param('multiplier') core = self.get_benchmark_param('cores') - - # in case of VMXNET3 the number of bytes reported is 60 bytes for 64B - if self.is_VM: - self.trex.result_obj.set_warmup (0.89) - # trex_res = self.trex.run(multiplier = mult, cores = core, duration = 30, l = 1000, p = True) ret = self.trex.start_trex( c = core, @@ -146,8 +141,6 @@ class CTRexIMIX_Test(CTRexGeneral_Test): self.check_general_scenario_results(trex_res) self.check_CPU_benchmark(trex_res) - if self.is_VM: - self.trex.result_obj.set_warmup_default() # the name intentionally not matches nose default pattern, including the test should be specified explicitly diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py index 8812ac48..a3efa01d 100644 --- a/scripts/automation/regression/stateless_tests/stl_rx_test.py +++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py @@ -526,19 +526,37 @@ class STLRX_Test(CStlGeneral_Test): except STLError as e: assert False , '{0}'.format(e) + def _run_fcs_stream (self,is_vm): + """ this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes""" + res=True + try: + all_ports=list(CTRexScenario.stl_ports_map['map'].keys()); + for port in all_ports: + for l in [True,False]: + print(" test port {0} latency : {1} ".format(port,l)) + self.send_1_burst(port,l,100) + except Exception as e: + if is_vm : + res=False + else: + raise e + return(res); + + def test_fcs_stream(self): """ this test send 1 64 byte packet with latency and check that all counters are reported as 64 bytes""" - if self.is_virt_nics: - self.skip('Skip this for virtual NICs') - - all_ports=list(CTRexScenario.stl_ports_map['map'].keys()); - for port in all_ports: - for l in [True,False]: - print(" test port {0} latency : {1} ".format(port,l)) - self.send_1_burst(port,l,100) + is_vm=self.is_virt_nics # in case of VM and vSwitch there are drop of packets in some cases, let retry number of times + # in this case we just want to check functionality that packet of 64 is reported as 64 in all levels + retry=1 + if is_vm: + retry=4 + for i in range(0,retry): + if self._run_fcs_stream (is_vm): + break; + print("==> retry %d .." %(i)); # this test adds more and more latency streams and re-test with incremental diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index f58e403f..452baef2 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -288,6 +288,27 @@ public: virtual int set_rcv_all(CPhyEthIF * _if, bool set_on) {return 0;} }; + +class CTRexExtendedDriverBaseVmxnet3 : public CTRexExtendedDriverBase1GVm { +public: + static CTRexExtendedDriverBase * create(){ + return ( new CTRexExtendedDriverBaseVmxnet3() ); + } + + virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats); +}; + +class CTRexExtendedDriverBaseVirtio : public CTRexExtendedDriverBase1GVm { +public: + static CTRexExtendedDriverBase * create(){ + return ( new CTRexExtendedDriverBaseVmxnet3() ); + } + + virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats); +}; + + + class CTRexExtendedDriverVf : public CTRexExtendedDriverBase1GVm { public: @@ -320,6 +341,9 @@ public: } // e1000 driver handing us packets with ethernet CRC, so we need to chop them virtual uint8_t get_num_crc_fix_bytes() {return 4;} + + virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats); + }; class CTRexExtendedDriverBase10G : public CTRexExtendedDriverBase { @@ -594,8 +618,8 @@ private: /* virtual devices */ register_driver(std::string("rte_em_pmd"),CTRexExtendedDriverBaseE1000::create); - register_driver(std::string("rte_vmxnet3_pmd"),CTRexExtendedDriverBase1GVm::create); - register_driver(std::string("rte_virtio_pmd"),CTRexExtendedDriverBase1GVm::create); + register_driver(std::string("rte_vmxnet3_pmd"),CTRexExtendedDriverBaseVmxnet3::create); + register_driver(std::string("rte_virtio_pmd"),CTRexExtendedDriverBaseVirtio::create); register_driver(std::string("rte_ixgbevf_pmd"),CTRexExtendedDriverVf::create); register_driver(std::string("rte_i40evf_pmd"),CTRexExtendedDriverVf::create); @@ -7193,6 +7217,89 @@ int CTRexExtendedDriverBase1GVm::stop_queue(CPhyEthIF * _if, uint16_t q_num) { return (0); } +void CTRexExtendedDriverBaseE1000::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){ + struct rte_eth_stats stats1; + struct rte_eth_stats *prev_stats = &stats->m_prev_stats; + rte_eth_stats_get(_if->get_port_id(), &stats1); + + stats->ipackets += stats1.ipackets - prev_stats->ipackets; + stats->ibytes += stats1.ibytes - prev_stats->ibytes ; + stats->opackets += stats1.opackets - prev_stats->opackets; + stats->obytes += stats1.obytes - prev_stats->obytes + (stats1.opackets - prev_stats->opackets) * 4; + stats->f_ipackets += 0; + stats->f_ibytes += 0; + stats->ierrors += stats1.imissed + stats1.ierrors + stats1.rx_nombuf + - prev_stats->imissed - prev_stats->ierrors - prev_stats->rx_nombuf; + stats->oerrors += stats1.oerrors - prev_stats->oerrors; + stats->imcasts += 0; + stats->rx_nombuf += stats1.rx_nombuf - prev_stats->rx_nombuf; + + prev_stats->ipackets = stats1.ipackets; + prev_stats->ibytes = stats1.ibytes; + prev_stats->opackets = stats1.opackets; + prev_stats->obytes = stats1.obytes; + prev_stats->imissed = stats1.imissed; + prev_stats->oerrors = stats1.oerrors; + prev_stats->ierrors = stats1.ierrors; + prev_stats->rx_nombuf = stats1.rx_nombuf; +} + + +void CTRexExtendedDriverBaseVirtio::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){ + struct rte_eth_stats stats1; + struct rte_eth_stats *prev_stats = &stats->m_prev_stats; + rte_eth_stats_get(_if->get_port_id(), &stats1); + + stats->ipackets += stats1.ipackets - prev_stats->ipackets; + stats->ibytes += stats1.ibytes - prev_stats->ibytes +(stats1.ipackets - prev_stats->ipackets) * 4; + stats->opackets += stats1.opackets - prev_stats->opackets; + stats->obytes += stats1.obytes - prev_stats->obytes + (stats1.opackets - prev_stats->opackets) * 4; + stats->f_ipackets += 0; + stats->f_ibytes += 0; + stats->ierrors += stats1.imissed + stats1.ierrors + stats1.rx_nombuf + - prev_stats->imissed - prev_stats->ierrors - prev_stats->rx_nombuf; + stats->oerrors += stats1.oerrors - prev_stats->oerrors; + stats->imcasts += 0; + stats->rx_nombuf += stats1.rx_nombuf - prev_stats->rx_nombuf; + + prev_stats->ipackets = stats1.ipackets; + prev_stats->ibytes = stats1.ibytes; + prev_stats->opackets = stats1.opackets; + prev_stats->obytes = stats1.obytes; + prev_stats->imissed = stats1.imissed; + prev_stats->oerrors = stats1.oerrors; + prev_stats->ierrors = stats1.ierrors; + prev_stats->rx_nombuf = stats1.rx_nombuf; +} + +void CTRexExtendedDriverBaseVmxnet3::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){ + struct rte_eth_stats stats1; + struct rte_eth_stats *prev_stats = &stats->m_prev_stats; + rte_eth_stats_get(_if->get_port_id(), &stats1); + + stats->ipackets += stats1.ipackets - prev_stats->ipackets; + stats->ibytes += stats1.ibytes - prev_stats->ibytes +(stats1.ipackets - prev_stats->ipackets) * 4; + stats->opackets += stats1.opackets - prev_stats->opackets; + stats->obytes += stats1.obytes - prev_stats->obytes + (stats1.opackets - prev_stats->opackets) * 4; + stats->f_ipackets += 0; + stats->f_ibytes += 0; + stats->ierrors += stats1.imissed + stats1.ierrors + stats1.rx_nombuf + - prev_stats->imissed - prev_stats->ierrors - prev_stats->rx_nombuf; + stats->oerrors += stats1.oerrors - prev_stats->oerrors; + stats->imcasts += 0; + stats->rx_nombuf += stats1.rx_nombuf - prev_stats->rx_nombuf; + + prev_stats->ipackets = stats1.ipackets; + prev_stats->ibytes = stats1.ibytes; + prev_stats->opackets = stats1.opackets; + prev_stats->obytes = stats1.obytes; + prev_stats->imissed = stats1.imissed; + prev_stats->oerrors = stats1.oerrors; + prev_stats->ierrors = stats1.ierrors; + prev_stats->rx_nombuf = stats1.rx_nombuf; +} + + void CTRexExtendedDriverBase1GVm::get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats){ struct rte_eth_stats stats1; struct rte_eth_stats *prev_stats = &stats->m_prev_stats; |