summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-19 12:49:10 +0200
committerimarom <imarom@cisco.com>2015-11-19 12:49:10 +0200
commit76248b13906f575f709ed2270d63ec41131f4bdf (patch)
tree6b5313815b6181aed313ea6fc58b6ec311d554ea /src/bp_sim.cpp
parenta7317d45787669af71ca8c65fd1e51f8a47d2c1e (diff)
parent91a4e6cc117076d3f5d34437581f7ffe91e6892b (diff)
Merge branch 'master' of csi-sceasr-b45:/auto/proj-pcube-b/apps/PL-b/tools/repo//trex-core
Conflicts: src/stateless/cp/trex_streams_compiler.h src/stateless/dp/trex_stateless_dp_core.cpp src/stateless/dp/trex_stateless_dp_core.h src/stateless/messaging/trex_stateless_messaging.cpp src/stateless/messaging/trex_stateless_messaging.h
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index c456e9a3..d35ae68a 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -26,6 +26,7 @@ limitations under the License.
#include <common/basic_utils.h>
#include <trex_stream_node.h>
+#include <trex_stateless_messaging.h>
#undef VALG
@@ -218,7 +219,7 @@ bool CPlatformSocketInfoConfig::init(){
m_max_threads_per_dual_if = num_threads;
}else{
if (lp->m_threads.size() != num_threads) {
- printf("ERROR number of threads per dual ports should be the same for all dual ports\n");
+ printf("ERROR, the number of threads per dual ports should be the same for all dual ports\n");
exit(1);
}
}
@@ -230,7 +231,7 @@ bool CPlatformSocketInfoConfig::init(){
uint8_t phy_thread = lp->m_threads[j];
if (phy_thread>MAX_THREADS_SUPPORTED) {
- printf("ERROR physical thread id is %d higher than max %d \n",phy_thread,MAX_THREADS_SUPPORTED);
+ printf("ERROR, physical thread id is %d higher than max %d \n",phy_thread,MAX_THREADS_SUPPORTED);
exit(1);
}
@@ -478,8 +479,8 @@ void CPlatformSocketInfo::dump(FILE *fd){
void CRteMemPool::dump_in_case_of_error(FILE *fd){
- fprintf(fd," ERROR ERROR there is no enough memory in socket %d \n",m_pool_id);
- fprintf(fd," Try to enlarge the memory values in the configuration file /etc/trex_cfg.yaml \n");
+ fprintf(fd," ERROR,there is no enough memory in socket %d \n",m_pool_id);
+ fprintf(fd," Try to enlarge the memory values in the configuration file -/etc/trex_cfg.yaml ,see manual for more detail \n");
dump(fd);
}
@@ -3129,6 +3130,13 @@ void CNodeGenerator::remove_all(CFlowGenListPerThread * thread){
while (!m_p_queue.empty()) {
node = m_p_queue.top();
m_p_queue.pop();
+ /* sanity check */
+ if (node->m_type == CGenNode::STATELESS_PKT) {
+ CGenNodeStateless * p=(CGenNodeStateless *)node;
+ /* need to be changed in Pause support */
+ assert(p->is_mask_for_free());
+ }
+
thread->free_node( node);
}
}
@@ -3144,6 +3152,7 @@ int CNodeGenerator::open_file(std::string file_name,
return (0);
}
+
int CNodeGenerator::close_file(CFlowGenListPerThread * thread){
remove_all(thread);
BP_ASSERT(m_v_if);
@@ -3153,7 +3162,7 @@ int CNodeGenerator::close_file(CFlowGenListPerThread * thread){
int CNodeGenerator::update_stl_stats(CGenNodeStateless *node_sl){
if ( m_preview_mode.getVMode() >2 ){
- fprintf(stdout," %llu ,", (unsigned long long)m_cnt);
+ fprintf(stdout," %4lu ,", (ulong)m_cnt);
node_sl->Dump(stdout);
m_cnt++;
}
@@ -3516,7 +3525,7 @@ int CNodeGenerator::flush_file(dsec_t max_time,
#endif
/* if the stream has been deactivated - end */
- if (unlikely(!node_sl->is_active())) {
+ if ( unlikely( node_sl->is_mask_for_free() ) ) {
thread->free_node(node);
} else {
node_sl->handle(thread);
@@ -3663,8 +3672,19 @@ CNodeGenerator::handle_slow_messages(uint8_t type,
exit_scheduler = true;
} else {
- printf(" ERROR type is not valid %d \n",type);
- assert(0);
+ if ( type == CGenNode::COMMAND) {
+ m_p_queue.pop();
+ CGenNodeCommand *node_cmd = (CGenNodeCommand *)node;
+ {
+ TrexStatelessCpToDpMsgBase * cmd=node_cmd->m_cmd;
+ cmd->handle(&thread->m_stateless_dp_info);
+ exit_scheduler = cmd->is_quit();
+ thread->free_node((CGenNode *)node_cmd);/* free the node */
+ }
+ }else{
+ printf(" ERROR type is not valid %d \n",type);
+ assert(0);
+ }
}
return exit_scheduler;
@@ -3956,7 +3976,7 @@ void CFlowGenListPerThread::start_stateless_simulation_file(std::string erf_file
}
void CFlowGenListPerThread::stop_stateless_simulation_file(){
- m_node_gen.close_file(this);
+ m_node_gen.m_v_if->close_file();
}
void CFlowGenListPerThread::start_stateless_daemon_simulation(){
@@ -3966,6 +3986,15 @@ void CFlowGenListPerThread::start_stateless_daemon_simulation(){
}
+
+/* return true if we need to shedule next_stream, */
+
+bool CFlowGenListPerThread::set_stateless_next_node( CGenNodeStateless * cur_node,
+ CGenNodeStateless * next_node){
+ return ( m_stateless_dp_info.set_stateless_next_node(cur_node,next_node) );
+}
+
+
void CFlowGenListPerThread::start_stateless_daemon(){
m_cur_time_sec = 0;
m_stateless_dp_info.start();
@@ -6888,6 +6917,11 @@ void CGenNodeBase::free_base(){
p->free_stl_node();
return;
}
+ if ( m_type == COMMAND ) {
+ CGenNodeCommand* p=(CGenNodeCommand*)this;
+ p->free_command();
+ }
+
}