diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-11-22 13:02:08 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-11-22 13:02:08 +0200 |
commit | 3408c03067a85789b2128352fdc2343ab707ae32 (patch) | |
tree | 1d9d1f116ce698240c4e77d2a4ea898b4c568953 /src/stateless/messaging | |
parent | 36dc8ea51adffce882e542123111baad7a1a7ea7 (diff) |
fix stop on duration per port
Diffstat (limited to 'src/stateless/messaging')
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.cpp | 25 | ||||
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.h | 41 |
2 files changed, 60 insertions, 6 deletions
diff --git a/src/stateless/messaging/trex_stateless_messaging.cpp b/src/stateless/messaging/trex_stateless_messaging.cpp index c861d0fa..bbd4b68c 100644 --- a/src/stateless/messaging/trex_stateless_messaging.cpp +++ b/src/stateless/messaging/trex_stateless_messaging.cpp @@ -23,6 +23,7 @@ limitations under the License. #include <trex_stateless_dp_core.h> #include <trex_streams_compiler.h> #include <trex_stateless.h> +#include <bp_sim.h> #include <string.h> @@ -60,11 +61,8 @@ TrexStatelessDpStart::~TrexStatelessDpStart() { bool TrexStatelessDpStart::handle(TrexStatelessDpCore *dp_core) { - /* mark the event id for DP response */ - dp_core->get_port_db(m_port_id)->set_event_id(m_event_id); - /* staet traffic */ - dp_core->start_traffic(m_obj, m_duration); + dp_core->start_traffic(m_obj, m_duration,m_event_id); return true; } @@ -75,17 +73,32 @@ TrexStatelessDpStart::handle(TrexStatelessDpCore *dp_core) { bool TrexStatelessDpStop::handle(TrexStatelessDpCore *dp_core) { - dp_core->stop_traffic(m_port_id); + + dp_core->stop_traffic(m_port_id,m_stop_only_for_event_id,m_event_id); return true; } + +void TrexStatelessDpStop::on_node_remove(){ + if ( m_core ) { + assert(m_core->m_non_active_nodes>0); + m_core->m_non_active_nodes--; + } +} + + /** * clone for DP stop message * */ TrexStatelessCpToDpMsgBase * TrexStatelessDpStop::clone() { - TrexStatelessCpToDpMsgBase *new_msg = new TrexStatelessDpStop(m_port_id); + TrexStatelessDpStop *new_msg = new TrexStatelessDpStop(m_port_id); + + new_msg->set_event_id(m_event_id); + new_msg->set_wait_for_event_id(m_stop_only_for_event_id); + /* set back pointer to master */ + new_msg->set_core_ptr(m_core); return new_msg; } diff --git a/src/stateless/messaging/trex_stateless_messaging.h b/src/stateless/messaging/trex_stateless_messaging.h index 2fb5a024..afa5953a 100644 --- a/src/stateless/messaging/trex_stateless_messaging.h +++ b/src/stateless/messaging/trex_stateless_messaging.h @@ -27,6 +27,7 @@ limitations under the License. class TrexStatelessDpCore; class TrexStreamsCompiledObj; +class CFlowGenListPerThread; /** * defines the base class for CP to DP messages @@ -61,6 +62,10 @@ public: return ( m_quit_scheduler); } + /* this node is called from scheduler in case the node is free */ + virtual void on_node_remove(){ + } + /* no copy constructor */ TrexStatelessCpToDpMsgBase(TrexStatelessCpToDpMsgBase &) = delete; @@ -103,14 +108,50 @@ class TrexStatelessDpStop : public TrexStatelessCpToDpMsgBase { public: TrexStatelessDpStop(uint8_t port_id) : m_port_id(port_id) { + m_stop_only_for_event_id=false; + m_event_id=0; + m_core = NULL; } virtual TrexStatelessCpToDpMsgBase * clone(); + virtual bool handle(TrexStatelessDpCore *dp_core); + void set_core_ptr(CFlowGenListPerThread * core){ + m_core = core; + } + + CFlowGenListPerThread * get_core_ptr(){ + return ( m_core); + } + + + void set_event_id(int event_id){ + m_event_id = event_id; + } + + void set_wait_for_event_id(bool wait){ + m_stop_only_for_event_id = wait; + } + + virtual void on_node_remove(); + + + bool get_is_stop_by_event_id(){ + return (m_stop_only_for_event_id); + } + + int get_event_id(){ + return (m_event_id); + } + private: uint8_t m_port_id; + bool m_stop_only_for_event_id; + int m_event_id; + CFlowGenListPerThread * m_core ; + }; /** |