summaryrefslogtreecommitdiffstats
path: root/src/stateless/dp/trex_stateless_dp_core.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-11-11 15:37:46 +0200
committerHanoh Haim <hhaim@cisco.com>2015-11-11 15:37:46 +0200
commitcc352e04fd45913132f3e1ddc86d88571c926879 (patch)
tree7d295ea1a2d68ec7587781a7567d3e17997d4eba /src/stateless/dp/trex_stateless_dp_core.cpp
parentd04fb533c0843ebcd3eac5fbefa6f418582db7fc (diff)
add first stl test and cleanup valgrind
Diffstat (limited to 'src/stateless/dp/trex_stateless_dp_core.cpp')
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index b2bd0152..c9e47090 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -31,6 +31,18 @@ usec_to_sec(double usec) {
}
+
+void CGenNodeStateless::free_stl_node(){
+ /* if we have cache mbuf free it */
+ rte_mbuf_t * m=get_cache_mbuf();
+ if (m) {
+ rte_pktmbuf_free(m);
+ m_cache_mbuf=0;
+ }
+}
+
+
+
void
TrexStatelessDpCore::create(uint8_t thread_id, CFlowGenListPerThread *core) {
m_thread_id = thread_id;
@@ -79,16 +91,41 @@ TrexStatelessDpCore::start_scheduler() {
m_core->m_node_gen.close_file(m_core);
}
+
+void
+TrexStatelessDpCore::run_once(){
+
+ idle_state_loop();
+ start_scheduler();
+}
+
+
void
TrexStatelessDpCore::start() {
while (true) {
- idle_state_loop();
+ run_once();
+ }
+}
+
+void
+TrexStatelessDpCore::add_duration(uint8_t port_id,
+ double duration){
+ if (duration > 0.0) {
+
+ CGenNode *node = m_core->create_node() ;
+
+ node->m_type = CGenNode::EXIT_SCHED;
+
+ /* make sure it will be scheduled after the current node */
+ node->m_time = m_core->m_cur_time_sec + duration ;
+
+ m_core->m_node_gen.add_node(node);
- start_scheduler();
}
}
+
void
TrexStatelessDpCore::add_cont_stream(uint8_t port_id,
double isg_usec,
@@ -155,6 +192,9 @@ TrexStatelessDpCore::start_traffic(TrexStreamsCompiledObj *obj) {
single_stream.m_pkt,
single_stream.m_pkt_len);
}
+
+ /* TBD need to fix this */
+ add_duration(0,10.0);
}
void