summaryrefslogtreecommitdiffstats
path: root/src/stateless/rx/trex_stateless_rx_core.cpp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-11-28 11:25:32 +0200
committerimarom <imarom@cisco.com>2016-11-28 11:25:32 +0200
commit537f5831c4400dea7fa15032c4cd6bd2fae86bb1 (patch)
tree10d3b4e158c0a0c3b6019b78a99660c0fbb18d97 /src/stateless/rx/trex_stateless_rx_core.cpp
parentd0c838e0abd0b39df54547623b2fa87fcc8aa807 (diff)
RX features - self code review
Signed-off-by: imarom <imarom@cisco.com>
Diffstat (limited to 'src/stateless/rx/trex_stateless_rx_core.cpp')
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index 2a678365..a1ff9c6a 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -82,7 +82,7 @@ void CRxCoreStateless::create(const CRxSlCfg &cfg) {
m_cpu_cp_u.Create(&m_cpu_dp_u);
- /* init per port manager */
+ /* create per port manager */
for (int i = 0; i < m_max_ports; i++) {
m_rx_port_mngr[i].create(cfg.m_ports[i],
m_rfc2544,
@@ -171,9 +171,20 @@ void CRxCoreStateless::idle_state_loop() {
}
}
+/**
+ * for each port give a tick (for flushing if needed)
+ *
+ */
+void CRxCoreStateless::port_manager_tick() {
+ for (int i = 0; i < m_max_ports; i++) {
+ m_rx_port_mngr[i].tick();
+ }
+}
+
void CRxCoreStateless::handle_work_stage(bool do_try_rx_queue) {
int i = 0;
-
+ int j = 0;
+
while (m_state == STATE_WORKING) {
if (do_try_rx_queue) {
@@ -182,12 +193,19 @@ void CRxCoreStateless::handle_work_stage(bool do_try_rx_queue) {
process_all_pending_pkts();
+ /* TODO: with scheduler, this should be solved better */
i++;
if (i == 100000) { // approx 10msec
i = 0;
periodic_check_for_cp_messages(); // m_state might change in here
+
+ j++;
+ if (j == 100) { // approx 1 sec
+ j = 0;
+ port_manager_tick();
+ }
}
-
+
rte_pause();
}
}
@@ -356,13 +374,13 @@ double CRxCoreStateless::get_cpu_util() {
void
-CRxCoreStateless::start_capture(uint8_t port_id, const std::string &pcap_filename, uint64_t limit, uint64_t *shared_counter) {
- m_rx_port_mngr[port_id].start_capture(pcap_filename, limit, shared_counter);
+CRxCoreStateless::start_recorder(uint8_t port_id, const std::string &pcap_filename, uint64_t limit, uint64_t *shared_counter) {
+ m_rx_port_mngr[port_id].start_recorder(pcap_filename, limit, shared_counter);
}
void
-CRxCoreStateless::stop_capture(uint8_t port_id) {
- m_rx_port_mngr[port_id].stop_capture();
+CRxCoreStateless::stop_recorder(uint8_t port_id) {
+ m_rx_port_mngr[port_id].stop_recorder();
}
void