summaryrefslogtreecommitdiffstats
path: root/src/stateless/messaging
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2015-11-18 16:23:55 +0200
committerHanoh Haim <hhaim@cisco.com>2015-11-18 16:23:55 +0200
commit0e8c9ae666d61897cb405c469a71be09d54a649b (patch)
treea35686155fa9f5834acd85ae6f1f4beeeab59b12 /src/stateless/messaging
parentaa9bf54e6f892168482ed647a0e67ab10b1cf34a (diff)
add support for a program of streams. refactor the dp code
Diffstat (limited to 'src/stateless/messaging')
-rw-r--r--src/stateless/messaging/trex_stateless_messaging.cpp21
-rw-r--r--src/stateless/messaging/trex_stateless_messaging.h30
2 files changed, 49 insertions, 2 deletions
diff --git a/src/stateless/messaging/trex_stateless_messaging.cpp b/src/stateless/messaging/trex_stateless_messaging.cpp
index 2e3acffd..856fd9e3 100644
--- a/src/stateless/messaging/trex_stateless_messaging.cpp
+++ b/src/stateless/messaging/trex_stateless_messaging.cpp
@@ -1,5 +1,6 @@
/*
Itay Marom
+ Hanoch Haim
Cisco Systems, Inc.
*/
@@ -88,7 +89,6 @@ TrexStatelessDpQuit::clone(){
}
-
bool TrexStatelessDpQuit::handle(TrexStatelessDpCore *dp_core){
/* quit */
@@ -96,3 +96,22 @@ bool TrexStatelessDpQuit::handle(TrexStatelessDpCore *dp_core){
return (true);
}
+
+bool TrexStatelessDpCanQuit::handle(TrexStatelessDpCore *dp_core){
+
+ if ( dp_core->are_all_ports_idle() ){
+ /* if all ports are idle quit now */
+ set_quit(true);
+ }
+ return (true);
+}
+
+TrexStatelessCpToDpMsgBase *
+TrexStatelessDpCanQuit::clone(){
+
+ TrexStatelessCpToDpMsgBase *new_msg = new TrexStatelessDpCanQuit();
+
+ return new_msg;
+}
+
+
diff --git a/src/stateless/messaging/trex_stateless_messaging.h b/src/stateless/messaging/trex_stateless_messaging.h
index 6473a6a4..7dc307c7 100644
--- a/src/stateless/messaging/trex_stateless_messaging.h
+++ b/src/stateless/messaging/trex_stateless_messaging.h
@@ -36,6 +36,7 @@ class TrexStatelessCpToDpMsgBase {
public:
TrexStatelessCpToDpMsgBase() {
+ m_quit_scheduler=false;
}
virtual ~TrexStatelessCpToDpMsgBase() {
@@ -54,9 +55,19 @@ public:
*/
virtual TrexStatelessCpToDpMsgBase * clone() = 0;
+ /* do we want to quit scheduler, can be set by handle function */
+ void set_quit(bool enable){
+ m_quit_scheduler=enable;
+ }
+
+ bool is_quit(){
+ return ( m_quit_scheduler);
+ }
+
/* no copy constructor */
TrexStatelessCpToDpMsgBase(TrexStatelessCpToDpMsgBase &) = delete;
-
+private:
+ bool m_quit_scheduler;
};
/**
@@ -116,5 +127,22 @@ public:
virtual TrexStatelessCpToDpMsgBase * clone();
};
+/**
+ * a message to check if both port are idel and exit
+ *
+ * @author hhaim
+ */
+class TrexStatelessDpCanQuit : public TrexStatelessCpToDpMsgBase {
+public:
+
+ TrexStatelessDpCanQuit() {
+ }
+
+ virtual bool handle(TrexStatelessDpCore *dp_core);
+
+ virtual TrexStatelessCpToDpMsgBase * clone();
+};
+
+
#endif /* __TREX_STATELESS_MESSAGING_H__ */