From 3978adceba8ce3861097747868da22bce379edd2 Mon Sep 17 00:00:00 2001 From: imarom Date: Thu, 29 Oct 2015 14:24:29 +0200 Subject: some bug fixes: 1. added a active bit to all the active nodes - when a stop arrives it invalidates them for next time 2. some small flag issues in the stateless port --- src/stateless/cp/trex_stateless_port.cpp | 16 ++++++++++------ src/stateless/cp/trex_stateless_port.h | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/stateless/cp') diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp index 3e6e256f..375d1f63 100644 --- a/src/stateless/cp/trex_stateless_port.cpp +++ b/src/stateless/cp/trex_stateless_port.cpp @@ -76,9 +76,6 @@ TrexStatelessPort::start_traffic(void) { return (RC_ERR_FAILED_TO_COMPILE_STREAMS); } - /* move the state to transmiting */ - m_port_state = PORT_STATE_TRANSMITTING; - /* generate a message to all the relevant DP cores to start transmitting */ TrexStatelessCpToDpMsgBase *start_msg = new TrexStatelessDpStart(compiled_obj); @@ -87,15 +84,18 @@ TrexStatelessPort::start_traffic(void) { ring->Enqueue((CGenNode *)start_msg); + /* move the state to transmiting */ + m_port_state = PORT_STATE_TRANSMITTING; + return (RC_OK); } -void +TrexStatelessPort::rc_e TrexStatelessPort::stop_traffic(void) { /* real code goes here */ - if (m_port_state == PORT_STATE_TRANSMITTING) { - m_port_state = PORT_STATE_UP_IDLE; + if (m_port_state != PORT_STATE_TRANSMITTING) { + return (RC_ERR_BAD_STATE_FOR_OP); } /* generate a message to all the relevant DP cores to start transmitting */ @@ -105,6 +105,10 @@ TrexStatelessPort::stop_traffic(void) { CNodeRing *ring = CMsgIns::Ins()->getCpDp()->getRingCpToDp(0); ring->Enqueue((CGenNode *)stop_msg); + + m_port_state = PORT_STATE_UP_IDLE; + + return (RC_OK); } /** diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h index 474fccf7..4851a4b5 100644 --- a/src/stateless/cp/trex_stateless_port.h +++ b/src/stateless/cp/trex_stateless_port.h @@ -62,7 +62,7 @@ public: * stop traffic * */ - void stop_traffic(void); + rc_e stop_traffic(void); /** * access the stream table -- cgit 1.2.3-korg