summaryrefslogtreecommitdiffstats
path: root/src/bp_sim.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-01 14:28:28 +0200
committerimarom <imarom@cisco.com>2015-11-01 14:28:28 +0200
commitee2c7f45e0bf973443b70eb8329811bcad44f83a (patch)
treec3f2cc1db1b090bedfd80979c931d50708053100 /src/bp_sim.cpp
parenta1971ec3a7f6cbe0aea1393a57aa17bf44deedac (diff)
stateless cores starts on IDLE - and starts the scheduler only when
traffic is being transmitted if the traffic stops completely on the core - back to IDLE state
Diffstat (limited to 'src/bp_sim.cpp')
-rwxr-xr-xsrc/bp_sim.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index 6e291367..92beab91 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -3420,7 +3420,8 @@ int CNodeGenerator::flush_file(dsec_t max_time,
if ( likely ( m_is_realtime ) ){
dsec_t dt ;
thread->m_cpu_dp_u.commit();
- bool once=false;
+
+ thread->check_msgs();
while ( true ) {
dt = now_sec() - n_time ;
@@ -3429,12 +3430,6 @@ int CNodeGenerator::flush_file(dsec_t max_time,
break;
}
- if (!once) {
- /* check the msg queue once */
- thread->check_msgs();
- once=true;
- }
-
rte_pause();
}
thread->m_cpu_dp_u.start_work();
@@ -3453,8 +3448,9 @@ int CNodeGenerator::flush_file(dsec_t max_time,
flush_time=now_sec();
}
}
+
#ifndef RTE_DPDK
- thread->check_msgs();
+ thread->check_msgs();
#endif
uint8_t type=node->m_type;
@@ -3530,16 +3526,16 @@ int CNodeGenerator::flush_file(dsec_t max_time,
}
void CNodeGenerator::handle_slow_messages(uint8_t type,
- CGenNode * node,
- CFlowGenListPerThread * thread,
+ CGenNode * node,
+ CFlowGenListPerThread * thread,
bool always){
if (unlikely (type == CGenNode::FLOW_DEFER_PORT_RELEASE) ) {
m_p_queue.pop();
thread->handler_defer_job(node);
thread->free_node(node);
- }else{
- if (type == CGenNode::FLOW_PKT_NAT) {
+
+ } else if (type == CGenNode::FLOW_PKT_NAT) {
/*repeat and NAT is not supported */
if ( node->is_nat_first_state() ){
node->set_nat_wait_state();
@@ -3573,27 +3569,28 @@ void CNodeGenerator::handle_slow_messages(uint8_t type,
m_p_queue.push(node);
}
- }else{
- if ( type == CGenNode::FLOW_SYNC ){
+ } else if ( type == CGenNode::FLOW_SYNC ) {
- m_p_queue.pop();
+ m_p_queue.pop();
- thread->check_msgs(); /* check messages */
- m_v_if->flush_tx_queue(); /* flush pkt each timeout */
-
- if ( always == false) {
- node->m_time += SYNC_TIME_OUT;
- m_p_queue.push(node);
- }else{
- thread->free_node(node);
- }
+ thread->check_msgs(); /* check messages */
+ m_v_if->flush_tx_queue(); /* flush pkt each timeout */
+ if (always == false) {
+ node->m_time += SYNC_TIME_OUT;
+ m_p_queue.push(node);
}else{
- printf(" ERROR type is not valid %d \n",type);
- assert(0);
+ thread->free_node(node);
}
+
+ /* must be the last section of processing */
+ } else if ( type == CGenNode::EXIT_SCHED ) {
+ remove_all(thread);
+
+ } else {
+ printf(" ERROR type is not valid %d \n",type);
+ assert(0);
}
- }
}