summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-04-03 16:51:42 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-04-03 16:51:42 +0300
commitc70b71af56c49e320553d6f210ea3f912f69ec3c (patch)
tree66b6f849ac29fc39d8c36eedd0f4ae1e96415115 /src/stateless
parent82a3c6f217e2bf96d0e9a83239a23b1d950d9011 (diff)
Enabled flow stats for all interface types + needed corrections
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_stateless.h1
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp1
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp18
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.h7
4 files changed, 23 insertions, 4 deletions
diff --git a/src/stateless/cp/trex_stateless.h b/src/stateless/cp/trex_stateless.h
index 6e5e0c44..7db86174 100644
--- a/src/stateless/cp/trex_stateless.h
+++ b/src/stateless/cp/trex_stateless.h
@@ -197,6 +197,7 @@ protected:
* @return TrexStateless&
*/
TrexStateless * get_stateless_obj();
+CRxCoreStateless * get_rx_sl_core_obj();
#endif /* __TREX_STATELESS_H__ */
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index ba25f61d..f125a46a 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -399,6 +399,7 @@ TrexStatelessDpCore::idle_state_loop() {
int counter = 0;
while (m_state == STATE_IDLE) {
+ m_core->m_node_gen.m_v_if->flush_dp_rx_queue();
bool had_msg = periodic_check_for_cp_messages();
if (had_msg) {
counter = 0;
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index 42889f0a..26f537f8 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -2,6 +2,7 @@
#include "bp_sim.h"
#include "flow_stat_parser.h"
#include "latency.h"
+#include "pal/linux/sanb_atomic.h"
#include "trex_stateless_messaging.h"
#include "trex_stateless_rx_core.h"
@@ -55,11 +56,12 @@ void CRxCoreStateless::idle_state_loop() {
int counter = 0;
while (m_state == STATE_IDLE) {
- flush_rx();
bool had_msg = periodic_check_for_cp_messages();
if (had_msg) {
counter = 0;
continue;
+ } else {
+ flush_rx();
}
/* enter deep sleep only if enough time had passed */
@@ -73,8 +75,8 @@ void CRxCoreStateless::idle_state_loop() {
}
void CRxCoreStateless::start() {
- static int count = 0;
- static int i = 0;
+ int count = 0;
+ int i = 0;
bool do_try_rx_queue =CGlobalInfo::m_options.preview.get_vm_one_queue_enable() ? true : false;
while (true) {
@@ -92,7 +94,11 @@ void CRxCoreStateless::start() {
} else {
if (m_state == STATE_QUIT)
break;
+ count = 0;
+ i = 0;
+ set_working_msg_ack(false);
idle_state_loop();
+ set_working_msg_ack(true);
}
if (do_try_rx_queue) {
try_rx_queues();
@@ -236,6 +242,12 @@ int CRxCoreStateless::get_rx_stats(uint8_t port_id, rx_per_flow_t *rx_stats, int
return 0;
}
+void CRxCoreStateless::set_working_msg_ack(bool val) {
+ sanb_smp_memory_barrier();
+ m_ack_start_work_msg = val;
+ sanb_smp_memory_barrier();
+}
+
double CRxCoreStateless::get_cpu_util() {
m_cpu_cp_u.Update();
return m_cpu_cp_u.GetVal();
diff --git a/src/stateless/rx/trex_stateless_rx_core.h b/src/stateless/rx/trex_stateless_rx_core.h
index 81eca38a..b78256c2 100644
--- a/src/stateless/rx/trex_stateless_rx_core.h
+++ b/src/stateless/rx/trex_stateless_rx_core.h
@@ -54,6 +54,8 @@ class CRxCoreStateless {
void work() {m_state = STATE_WORKING;}
void idle() {m_state = STATE_IDLE;}
void quit() {m_state = STATE_QUIT;}
+ bool is_working() const {return (m_ack_start_work_msg == true);}
+ void set_working_msg_ack(bool val);
double get_cpu_util();
private:
@@ -72,10 +74,13 @@ class CRxCoreStateless {
uint32_t m_max_ports;
bool m_has_streams;
CLatencyManagerPerPort m_ports[TREX_MAX_PORTS];
- state_e m_state; /* state of all ports */
+ state_e m_state;
CNodeRing *m_ring_from_cp;
CNodeRing *m_ring_to_cp;
CCpuUtlDp m_cpu_dp_u;
CCpuUtlCp m_cpu_cp_u;
+ // Used for acking "work" (go out of idle) messages from cp
+ volatile bool m_ack_start_work_msg __rte_cache_aligned;
+
};
#endif