summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_stateless_port.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stateless/cp/trex_stateless_port.cpp')
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 7dc217a3..be1bea12 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -130,6 +130,9 @@ TrexStatelessPort::start_traffic(double mul, double duration) {
TrexStatelessCpToDpMsgBase *start_msg = new TrexStatelessDpStart(m_port_id, event_id, compiled_obj, duration);
+ m_last_all_streams_continues = compiled_obj->get_all_streams_continues();
+ m_last_duration =duration;
+
change_state(PORT_STATE_TX);
send_message_to_dp(start_msg);
@@ -174,7 +177,8 @@ TrexStatelessPort::start_traffic_max_pps(double max_pps, double duration) {
void
TrexStatelessPort::stop_traffic(void) {
- if (m_port_state != PORT_STATE_TX) {
+ if (!( (m_port_state == PORT_STATE_TX)
+ || (m_port_state ==PORT_STATE_PAUSE) )) {
return;
}
@@ -195,14 +199,18 @@ TrexStatelessPort::pause_traffic(void) {
verify_state(PORT_STATE_TX);
- #if 0
- /* generate a message to all the relevant DP cores to start transmitting */
- TrexStatelessCpToDpMsgBase *stop_msg = new TrexStatelessDpStop(m_port_id);
+ if (m_last_all_streams_continues == false) {
+ throw TrexRpcException(" pause is supported when all streams are in continues mode ");
+ }
+
+ if ( m_last_duration>0.0 ) {
+ throw TrexRpcException(" pause is supported when duration is not enable is start command ");
+ }
+
+ TrexStatelessCpToDpMsgBase *stop_msg = new TrexStatelessDpPause(m_port_id);
send_message_to_dp(stop_msg);
- m_port_state = PORT_STATE_UP_IDLE;
- #endif
change_state(PORT_STATE_PAUSE);
}
@@ -211,14 +219,11 @@ TrexStatelessPort::resume_traffic(void) {
verify_state(PORT_STATE_PAUSE);
- #if 0
/* generate a message to all the relevant DP cores to start transmitting */
- TrexStatelessCpToDpMsgBase *stop_msg = new TrexStatelessDpStop(m_port_id);
+ TrexStatelessCpToDpMsgBase *stop_msg = new TrexStatelessDpResume(m_port_id);
send_message_to_dp(stop_msg);
- m_port_state = PORT_STATE_UP_IDLE;
- #endif
change_state(PORT_STATE_TX);
}