summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-04 09:49:37 -0500
committerimarom <imarom@cisco.com>2016-01-04 10:02:59 -0500
commit857bdcf05a920b99e1cf180c700176b04801da00 (patch)
treea524225219e462c12817e3a710905cb6e27d9c9d /src/stateless
parente134270a3bcf3c9498a2926ffea1d7bb0d4960eb (diff)
some additions to the stateless simulation mode
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp7
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index c211b9f5..0a9a88ab 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -353,8 +353,11 @@ void
TrexStatelessDpCore::idle_state_loop() {
while (m_state == STATE_IDLE) {
- periodic_check_for_cp_messages();
- delay(200);
+ bool had_msg = periodic_check_for_cp_messages();
+ /* if no message - backoff for some time */
+ if (!had_msg) {
+ delay(200);
+ }
}
}
diff --git a/src/stateless/dp/trex_stateless_dp_core.h b/src/stateless/dp/trex_stateless_dp_core.h
index 7dc4a2b2..efdb364c 100644
--- a/src/stateless/dp/trex_stateless_dp_core.h
+++ b/src/stateless/dp/trex_stateless_dp_core.h
@@ -185,12 +185,12 @@ public:
*
* @author imarom (27-Oct-15)
*/
- void periodic_check_for_cp_messages() {
+ bool periodic_check_for_cp_messages() {
// doing this inline for performance reasons
/* fast path */
if ( likely ( m_ring_from_cp->isEmpty() ) ) {
- return;
+ return false;
}
while ( true ) {
@@ -204,6 +204,8 @@ public:
handle_cp_msg(msg);
}
+ return true;
+
}
/* quit the main loop, work in both stateless in stateful, don't free memory trigger from master */