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/stateless/rx/trex_stateless_rx_core.cpp | |
parent | 422c7c52632ebb6fbc5d5ff638b6ef0e1bc56f6b (diff) |
Fix issue of receiving rx packets from previous test iteration
Diffstat (limited to 'src/stateless/rx/trex_stateless_rx_core.cpp')
-rw-r--r-- | src/stateless/rx/trex_stateless_rx_core.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp index 929ad7fa..42889f0a 100644 --- a/src/stateless/rx/trex_stateless_rx_core.cpp +++ b/src/stateless/rx/trex_stateless_rx_core.cpp @@ -55,6 +55,7 @@ void CRxCoreStateless::idle_state_loop() { int counter = 0; while (m_state == STATE_IDLE) { + flush_rx(); bool had_msg = periodic_check_for_cp_messages(); if (had_msg) { counter = 0; @@ -162,6 +163,30 @@ void CRxCoreStateless::try_rx_queues() { } } +// exactly the same as try_rx, without the handle_rx_pkt +// purpose is to flush rx queues when core is in idle state +void CRxCoreStateless::flush_rx() { + rte_mbuf_t * rx_pkts[64]; + int i, total_pkts = 0; + for (i = 0; i < m_max_ports; i++) { + CLatencyManagerPerPort * lp = &m_ports[i]; + rte_mbuf_t * m; + m_cpu_dp_u.start_work(); + /* try to read 64 packets clean up the queue */ + uint16_t cnt_p = lp->m_io->rx_burst(rx_pkts, 64); + total_pkts += cnt_p; + if (cnt_p) { + int j; + for (j = 0; j < cnt_p; j++) { + m = rx_pkts[j]; + rte_pktmbuf_free(m); + } + /* commit only if there was work to do ! */ + m_cpu_dp_u.commit(); + }/* if work */ + }// all ports +} + int CRxCoreStateless::try_rx() { rte_mbuf_t * rx_pkts[64]; int i, total_pkts = 0; |