diff options
author | Ido Barnea <ibarnea@cisco.com> | 2016-03-17 16:10:11 +0200 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2016-03-22 17:40:03 +0200 |
commit | 1e93f5b1fc20d7e8fd4b01b4e3c0715095b42e14 (patch) | |
tree | 46e5048b48b012ca66c6557b72a37a38e8393e6c /src/stateless/messaging | |
parent | dd0507516960de491a3c697680d970f31661714b (diff) |
Added CP to RX messages
Diffstat (limited to 'src/stateless/messaging')
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.cpp | 42 | ||||
-rw-r--r-- | src/stateless/messaging/trex_stateless_messaging.h | 76 |
2 files changed, 82 insertions, 36 deletions
diff --git a/src/stateless/messaging/trex_stateless_messaging.cpp b/src/stateless/messaging/trex_stateless_messaging.cpp index 333aec88..3468d622 100644 --- a/src/stateless/messaging/trex_stateless_messaging.cpp +++ b/src/stateless/messaging/trex_stateless_messaging.cpp @@ -5,7 +5,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,17 +19,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include <trex_stateless_messaging.h> -#include <trex_stateless_dp_core.h> -#include <trex_streams_compiler.h> -#include <trex_stateless.h> -#include <bp_sim.h> - #include <string.h> +#include "trex_stateless_messaging.h" +#include "trex_stateless_dp_core.h" +#include "trex_stateless_rx_core.h" +#include "trex_streams_compiler.h" +#include "trex_stateless.h" +#include "bp_sim.h" + /************************* start traffic message - ************************/ + ************************/ TrexStatelessDpStart::TrexStatelessDpStart(uint8_t port_id, int event_id, TrexStreamsCompiledObj *obj, double duration) { m_port_id = port_id; m_event_id = event_id; @@ -40,7 +41,7 @@ TrexStatelessDpStart::TrexStatelessDpStart(uint8_t port_id, int event_id, TrexSt /** * clone for DP start message - * + * */ TrexStatelessCpToDpMsgBase * TrexStatelessDpStart::clone() { @@ -69,7 +70,7 @@ TrexStatelessDpStart::handle(TrexStatelessDpCore *dp_core) { /************************* stop traffic message - ************************/ + ************************/ bool TrexStatelessDpStop::handle(TrexStatelessDpCore *dp_core) { @@ -114,7 +115,7 @@ bool TrexStatelessDpResume::handle(TrexStatelessDpCore *dp_core){ /** * clone for DP stop message - * + * */ TrexStatelessCpToDpMsgBase * TrexStatelessDpStop::clone() { @@ -130,7 +131,7 @@ TrexStatelessDpStop::clone() { -TrexStatelessCpToDpMsgBase * +TrexStatelessCpToDpMsgBase * TrexStatelessDpQuit::clone(){ TrexStatelessCpToDpMsgBase *new_msg = new TrexStatelessDpQuit(); @@ -140,7 +141,7 @@ TrexStatelessDpQuit::clone(){ bool TrexStatelessDpQuit::handle(TrexStatelessDpCore *dp_core){ - + /* quit */ dp_core->quit_main_loop(); return (true); @@ -155,7 +156,7 @@ bool TrexStatelessDpCanQuit::handle(TrexStatelessDpCore *dp_core){ return (true); } -TrexStatelessCpToDpMsgBase * +TrexStatelessCpToDpMsgBase * TrexStatelessDpCanQuit::clone(){ TrexStatelessCpToDpMsgBase *new_msg = new TrexStatelessDpCanQuit(); @@ -165,7 +166,7 @@ TrexStatelessDpCanQuit::clone(){ /************************* update traffic message - ************************/ + ************************/ bool TrexStatelessDpUpdate::handle(TrexStatelessDpCore *dp_core) { dp_core->update_traffic(m_port_id, m_factor); @@ -207,3 +208,14 @@ TrexDpPortEventMsg::handle() { return (true); } +/************************* messages from CP to RX **********************/ +bool TrexRxStartMsg::handle (CRxCoreStateless *rx_core) { + rx_core->work(); + return true; +} + +/************************* messages from CP to RX **********************/ +bool TrexRxStopMsg::handle (CRxCoreStateless *rx_core) { + rx_core->idle(); + return true; +} diff --git a/src/stateless/messaging/trex_stateless_messaging.h b/src/stateless/messaging/trex_stateless_messaging.h index dda086b7..b7e8fd3f 100644 --- a/src/stateless/messaging/trex_stateless_messaging.h +++ b/src/stateless/messaging/trex_stateless_messaging.h @@ -5,7 +5,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,16 +22,17 @@ limitations under the License. #ifndef __TREX_STATELESS_MESSAGING_H__ #define __TREX_STATELESS_MESSAGING_H__ -#include <msg_manager.h> -#include <trex_dp_port_events.h> +#include "msg_manager.h" +#include "trex_dp_port_events.h" class TrexStatelessDpCore; +class CRxCoreStateless; class TrexStreamsCompiledObj; class CFlowGenListPerThread; /** * defines the base class for CP to DP messages - * + * * @author imarom (27-Oct-15) */ class TrexStatelessCpToDpMsgBase { @@ -49,7 +50,7 @@ public: /** * clone the current message - * + * */ virtual TrexStatelessCpToDpMsgBase * clone() = 0; @@ -76,7 +77,7 @@ protected: /** * a message to start traffic - * + * * @author imarom (27-Oct-15) */ class TrexStatelessDpStart : public TrexStatelessCpToDpMsgBase { @@ -137,7 +138,7 @@ private: /** * a message to stop traffic - * + * * @author imarom (27-Oct-15) */ class TrexStatelessDpStop : public TrexStatelessCpToDpMsgBase { @@ -191,9 +192,9 @@ private: }; /** - * a message to Quit the datapath traffic. support only stateless for now - * - * @author hhaim + * a message to Quit the datapath traffic. support only stateless for now + * + * @author hhaim */ class TrexStatelessDpQuit : public TrexStatelessCpToDpMsgBase { public: @@ -209,9 +210,9 @@ public: }; /** - * a message to check if both port are idel and exit - * - * @author hhaim + * a message to check if both port are idel and exit + * + * @author hhaim */ class TrexStatelessDpCanQuit : public TrexStatelessCpToDpMsgBase { public: @@ -247,7 +248,7 @@ private: /** * barrier message for DP core - * + * */ class TrexStatelessDpBarrier : public TrexStatelessCpToDpMsgBase { public: @@ -270,7 +271,7 @@ private: /** * defines the base class for CP to DP messages - * + * * @author imarom (27-Oct-15) */ class TrexStatelessDpToCpMsgBase { @@ -284,7 +285,7 @@ public: /** * virtual function to handle a message - * + * */ virtual bool handle() = 0; @@ -295,9 +296,9 @@ public: /** - * a message indicating an event has happened on a port at the - * DP - * + * a message indicating an event has happened on a port at the + * DP + * */ class TrexDpPortEventMsg : public TrexStatelessDpToCpMsgBase { public: @@ -326,8 +327,41 @@ private: int m_thread_id; uint8_t m_port_id; int m_event_id; - + }; -#endif /* __TREX_STATELESS_MESSAGING_H__ */ +/************************* messages from CP to RX **********************/ + +/** + * defines the base class for CP to RX messages + * + */ +class TrexStatelessCpToRxMsgBase { +public: + TrexStatelessCpToRxMsgBase() { + } + + virtual ~TrexStatelessCpToRxMsgBase() { + } + + /** + * virtual function to handle a message + * + */ + virtual bool handle (CRxCoreStateless *rx_core) = 0; + + /* no copy constructor */ + TrexStatelessCpToRxMsgBase(TrexStatelessCpToRxMsgBase &) = delete; + +}; + +class TrexRxStartMsg : public TrexStatelessCpToRxMsgBase { + bool handle (CRxCoreStateless *rx_core); +}; + +class TrexRxStopMsg : public TrexStatelessCpToRxMsgBase { + bool handle (CRxCoreStateless *rx_core); +}; + +#endif /* __TREX_STATELESS_MESSAGING_H__ */ |