summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stateless/cp')
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp25
-rw-r--r--src/stateless/cp/trex_stateless_port.h5
-rw-r--r--src/stateless/cp/trex_streams_compiler.cpp7
-rw-r--r--src/stateless/cp/trex_streams_compiler.h5
4 files changed, 31 insertions, 11 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);
}
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 9b74741c..6adb5fef 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -209,6 +209,8 @@ public:
return m_dp_events;
}
+
+
private:
@@ -262,6 +264,9 @@ private:
/* holds the DP cores associated with this port */
std::vector<int> m_cores_id_list;
+ bool m_last_all_streams_continues;
+ double m_last_duration;
+
TrexDpPortEvents m_dp_events;
};
diff --git a/src/stateless/cp/trex_streams_compiler.cpp b/src/stateless/cp/trex_streams_compiler.cpp
index f97b15b9..b28989be 100644
--- a/src/stateless/cp/trex_streams_compiler.cpp
+++ b/src/stateless/cp/trex_streams_compiler.cpp
@@ -143,6 +143,7 @@ private:
* stream compiled object
*************************************/
TrexStreamsCompiledObj::TrexStreamsCompiledObj(uint8_t port_id, double mul) : m_port_id(port_id), m_mul(mul) {
+ m_all_continues=false;
}
TrexStreamsCompiledObj::~TrexStreamsCompiledObj() {
@@ -408,6 +409,7 @@ TrexStreamsCompiler::compile(const std::vector<TrexStream *> &streams,
}
+ bool all_continues=true;
/* for now we do something trivial, */
for (auto stream : streams) {
@@ -415,6 +417,9 @@ TrexStreamsCompiler::compile(const std::vector<TrexStream *> &streams,
if (!stream->m_enabled) {
continue;
}
+ if (stream->get_type() != TrexStream::stCONTINUOUS ) {
+ all_continues=false;
+ }
int new_id= nodes.get(stream->m_stream_id)->m_compressed_stream_id;
assert(new_id>=0);
@@ -431,7 +436,7 @@ TrexStreamsCompiler::compile(const std::vector<TrexStream *> &streams,
);
}
-
+ obj.m_all_continues =all_continues;
return true;
}
diff --git a/src/stateless/cp/trex_streams_compiler.h b/src/stateless/cp/trex_streams_compiler.h
index 9f0c1f8e..70a31c5e 100644
--- a/src/stateless/cp/trex_streams_compiler.h
+++ b/src/stateless/cp/trex_streams_compiler.h
@@ -66,6 +66,10 @@ public:
return (m_mul);
}
+ bool get_all_streams_continues(){
+ return (m_all_continues);
+ }
+
void Dump(FILE *fd);
private:
@@ -75,6 +79,7 @@ private:
std::vector<obj_st> m_objs;
+ bool m_all_continues;
uint8_t m_port_id;
double m_mul;
};