diff options
Diffstat (limited to 'src/main_dpdk.cpp')
-rwxr-xr-x | src/main_dpdk.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index c4ecb97d..692e1c0e 100755 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -58,6 +58,7 @@ limitations under the License. #include <stateless/cp/trex_stateless.h> #include <stateless/dp/trex_stream_node.h> +#include <stateless/messaging/trex_stateless_messaging.h> #include <../linux_dpdk/version.h> @@ -2821,8 +2822,15 @@ public: int reset_counters(); +public: +private: + /* try to stop all datapath cores */ + void try_stop_all_dp(); + /* send message to all dp cores */ + int send_message_all_dp(TrexStatelessCpToDpMsgBase *msg); public: + int start_send_master(); int start_master_stateless(); @@ -3248,6 +3256,40 @@ bool CGlobalTRex::is_all_links_are_up(bool dump){ } +void CGlobalTRex::try_stop_all_dp(){ + + TrexStatelessDpQuit * msg= new TrexStatelessDpQuit(); + send_message_all_dp(msg); + delete msg; + bool all_core_finished = false; + int i; + for (i=0; i<20; i++) { + if ( is_all_cores_finished() ){ + all_core_finished =true; + break; + } + delay(100); + } + if ( all_core_finished ){ + printf(" All cores stopped !! \n"); + }else{ + printf(" ERROR one of the DP core is stucked !\n"); + } +} + + +int CGlobalTRex::send_message_all_dp(TrexStatelessCpToDpMsgBase *msg){ + + int max_threads=(int)CMsgIns::Ins()->getCpDp()->get_num_threads(); + int i; + + for (i=0; i<max_threads; i++) { + CNodeRing *ring = CMsgIns::Ins()->getCpDp()->getRingCpToDp((uint8_t)i); + ring->Enqueue((CGenNode*)msg->clone()); + } + return (0); +} + int CGlobalTRex::ixgbe_rx_queue_flush(){ int i; @@ -4088,6 +4130,11 @@ int CGlobalTRex::run_in_master(){ } } + if (!is_all_cores_finished()) { + /* probably CLTR-C */ + try_stop_all_dp(); + } + m_mg.stop(); delay(1000); if ( was_stopped ){ |