summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-06-01 15:52:00 +0300
committerimarom <imarom@cisco.com>2016-06-02 13:45:12 +0300
commit3c4a29e15f3663f6413fbee2562d7d0aa4e2f80d (patch)
treec9742549ad7a8013f43077dceb5fa9eacf0aaadf /src/stateless
parentb639fb458fb2388164adaf45c4e947a2af2ca0e1 (diff)
watchdog phase 2
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_stateless.cpp2
-rw-r--r--src/stateless/cp/trex_stateless.h3
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp1
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp17
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.h7
5 files changed, 25 insertions, 5 deletions
diff --git a/src/stateless/cp/trex_stateless.cpp b/src/stateless/cp/trex_stateless.cpp
index 5bbe9faf..698ede90 100644
--- a/src/stateless/cp/trex_stateless.cpp
+++ b/src/stateless/cp/trex_stateless.cpp
@@ -40,7 +40,7 @@ TrexStateless::TrexStateless(const TrexStatelessCfg &cfg) {
/* create RPC servers */
/* set both servers to mutex each other */
- m_rpc_server = new TrexRpcServer(cfg.m_rpc_req_resp_cfg, cfg.m_global_lock);
+ m_rpc_server = new TrexRpcServer(cfg.m_rpc_req_resp_cfg);
m_rpc_server->set_verbose(cfg.m_rpc_server_verbose);
/* configure ports */
diff --git a/src/stateless/cp/trex_stateless.h b/src/stateless/cp/trex_stateless.h
index 033326ca..83ab6976 100644
--- a/src/stateless/cp/trex_stateless.h
+++ b/src/stateless/cp/trex_stateless.h
@@ -41,6 +41,7 @@ limitations under the License.
#include "trex_api_class.h"
class TrexStatelessPort;
+class TrexWatchDog;
/**
* unified stats
@@ -87,7 +88,6 @@ public:
m_rpc_server_verbose = false;
m_platform_api = NULL;
m_publisher = NULL;
- m_global_lock = NULL;
}
const TrexRpcServerConfig *m_rpc_req_resp_cfg;
@@ -95,7 +95,6 @@ public:
bool m_rpc_server_verbose;
uint8_t m_port_count;
TrexPublisher *m_publisher;
- std::mutex *m_global_lock;
};
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 21334363..fe78c5b2 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -656,6 +656,7 @@ TrexStatelessDpCore::idle_state_loop() {
int counter = 0;
while (m_state == STATE_IDLE) {
+ m_core->tickle();
m_core->m_node_gen.m_v_if->flush_dp_rx_queue();
bool had_msg = periodic_check_for_cp_messages();
if (had_msg) {
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index f9150ff7..95fcc1b0 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -76,6 +76,9 @@ void CRxCoreStateless::create(const CRxSlCfg &cfg) {
m_ring_to_cp = cp_rx->getRingDpToCp(0);
m_state = STATE_IDLE;
+ m_watchdog_handle = -1;
+ m_watchdog = NULL;
+
for (int i = 0; i < m_max_ports; i++) {
CLatencyManagerPerPortStl * lp = &m_ports[i];
lp->m_io = cfg.m_ports[i];
@@ -93,7 +96,15 @@ void CRxCoreStateless::handle_cp_msg(TrexStatelessCpToRxMsgBase *msg) {
delete msg;
}
+void CRxCoreStateless::tickle() {
+ m_watchdog->tickle(m_watchdog_handle);
+}
+
bool CRxCoreStateless::periodic_check_for_cp_messages() {
+
+ /* tickle the watchdog */
+ tickle();
+
/* fast path */
if ( likely ( m_ring_from_cp->isEmpty() ) ) {
return false;
@@ -140,11 +151,15 @@ void CRxCoreStateless::idle_state_loop() {
}
}
-void CRxCoreStateless::start() {
+void CRxCoreStateless::start(TrexWatchDog &watchdog) {
int count = 0;
int i = 0;
bool do_try_rx_queue =CGlobalInfo::m_options.preview.get_vm_one_queue_enable() ? true : false;
+ /* register a watchdog handle on current core */
+ m_watchdog = &watchdog;
+ m_watchdog_handle = watchdog.register_monitor("STL RX CORE", 1);
+
while (true) {
if (m_state == STATE_WORKING) {
i++;
diff --git a/src/stateless/rx/trex_stateless_rx_core.h b/src/stateless/rx/trex_stateless_rx_core.h
index d18356b6..1528a7e1 100644
--- a/src/stateless/rx/trex_stateless_rx_core.h
+++ b/src/stateless/rx/trex_stateless_rx_core.h
@@ -147,7 +147,7 @@ class CRxCoreStateless {
};
public:
- void start();
+ void start(TrexWatchDog &watchdog);
void create(const CRxSlCfg &cfg);
void reset_rx_stats(uint8_t port_id);
int get_rx_stats(uint8_t port_id, rx_per_flow_t *rx_stats, int min, int max, bool reset
@@ -165,6 +165,7 @@ class CRxCoreStateless {
private:
void handle_cp_msg(TrexStatelessCpToRxMsgBase *msg);
bool periodic_check_for_cp_messages();
+ void tickle();
void idle_state_loop();
void handle_rx_pkt(CLatencyManagerPerPortStl * lp, rte_mbuf_t * m);
void handle_rx_queue_msgs(uint8_t thread_id, CNodeRing * r);
@@ -176,6 +177,10 @@ class CRxCoreStateless {
uint16_t get_hw_id(uint16_t id);
private:
+
+ TrexWatchDog *m_watchdog;
+ int m_watchdog_handle;
+
uint32_t m_max_ports;
bool m_has_streams;
CLatencyManagerPerPortStl m_ports[TREX_MAX_PORTS];