diff options
author | Ido Barnea <ibarnea@cisco.com> | 2016-03-31 14:34:43 +0300 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-03-31 14:34:43 +0300 |
commit | 9f269a00c57683223a11bec20c7b8b69d068e8b7 (patch) | |
tree | 3345e95b5f4c09d2dccce809e372b0774ce40d8e /src/flow_stat.cpp | |
parent | 422c7c52632ebb6fbc5d5ff638b6ef0e1bc56f6b (diff) |
Fix issue of receiving rx packets from previous test iteration
Diffstat (limited to 'src/flow_stat.cpp')
-rw-r--r-- | src/flow_stat.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp index 49654970..20cab376 100644 --- a/src/flow_stat.cpp +++ b/src/flow_stat.cpp @@ -642,6 +642,12 @@ int CFlowStatRuleMgr::start_stream(TrexStream * stream) { m_user_id_map.start_stream(user_id, hw_id); m_hw_id_map.map(hw_id, user_id); add_hw_rule(hw_id, m_user_id_map.l4_proto(user_id)); + // clear hardware counters. Just in case we have garbage from previous iteration + rx_per_flow_t rx_counter; + tx_per_flow_t tx_counter; + for (uint8_t port = 0; port < m_num_ports; port++) { + m_api->get_flow_stats(port, &rx_counter, (void *)&tx_counter, hw_id, hw_id, true); + } } } @@ -683,8 +689,8 @@ int CFlowStatRuleMgr::stop_stream(TrexStream * stream) { throw TrexException("Called stop_stream, but no stream was added"); if (stream->m_rx_check.m_hw_id >= MAX_FLOW_STATS) { - printf("Trying to stop stream with high hw_id %d\n", stream->m_rx_check.m_hw_id); - throw TrexException("Trying to stop stream which is not started (maybe stop was called twice?)"); + // We allow stopping while already stopped. Will not hurt us. + return 0; } stream->m_rx_check.m_hw_id = HW_ID_FREE; |