summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp/trex_stateless_port.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-10-28 14:47:56 +0200
committerimarom <imarom@cisco.com>2015-10-28 14:47:56 +0200
commit788ba38b545be2f76f290f73b16cbfc37f4fa187 (patch)
tree514d237367def26a1e57f0cfddbfa228ca460ca8 /src/stateless/cp/trex_stateless_port.cpp
parentcb8bc9bda11c951b8b91a635d8d4d6df8d5a0ab8 (diff)
moved all stream compiling phase to a new file
trex_streams_compiler.cpp
Diffstat (limited to 'src/stateless/cp/trex_stateless_port.cpp')
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index d3828f53..3e6e256f 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -22,6 +22,7 @@ limitations under the License.
#include <trex_stateless.h>
#include <trex_stateless_port.h>
#include <trex_stateless_messaging.h>
+#include <trex_streams_compiler.h>
#include <string>
@@ -58,14 +59,26 @@ TrexStatelessPort::start_traffic(void) {
return (RC_ERR_BAD_STATE_FOR_OP);
}
- TrexStreamsCompiledObj *compiled_obj = new TrexStreamsCompiledObj();
+ if (get_stream_table()->size() == 0) {
+ return (RC_ERR_NO_STREAMS);
+ }
+
+ /* fetch all the streams from the table */
+ vector<TrexStream *> streams;
+ get_stream_table()->get_object_list(streams);
- /* compile the streams */
- bool rc = get_stream_table()->compile(*compiled_obj);
+ /* compiler it */
+ TrexStreamsCompiler compiler;
+ TrexStreamsCompiledObj *compiled_obj = new TrexStreamsCompiledObj();
+
+ bool rc = compiler.compile(streams, *compiled_obj);
if (!rc) {
return (RC_ERR_FAILED_TO_COMPILE_STREAMS);
}
+ /* move the state to transmiting */
+ m_port_state = PORT_STATE_TRANSMITTING;
+
/* generate a message to all the relevant DP cores to start transmitting */
TrexStatelessCpToDpMsgBase *start_msg = new TrexStatelessDpStart(compiled_obj);