summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/common/pcap.cpp1
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_general.cpp6
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp25
3 files changed, 17 insertions, 15 deletions
diff --git a/src/common/pcap.cpp b/src/common/pcap.cpp
index f5eb3c41..b976aed7 100755
--- a/src/common/pcap.cpp
+++ b/src/common/pcap.cpp
@@ -223,6 +223,7 @@ bool LibPCapWriter::Create(char * name)
printf(" ERROR create file \n");
return(false);
}
+
/* prepare the write counter */
m_pkt_count = 0;
return init();
diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
index 849c9be3..cb7d5149 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
@@ -648,7 +648,11 @@ TrexRpcCmdGetPortStatus::_run(const Json::Value &params, Json::Value &result) {
get_stateless_obj()->get_platform_api()->getPortAttrObj(port_id)->to_json(result["result"]["attr"]);
/* RX info */
- result["result"]["rx_info"] = port->rx_features_to_json();
+ try {
+ result["result"]["rx_info"] = port->rx_features_to_json();
+ } catch (const TrexException &ex) {
+ generate_execute_err(result, ex.what());
+ }
return (TREX_RPC_CMD_OK);
}
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index b24fcb8f..f518fcd3 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -182,31 +182,28 @@ void CRxCoreStateless::port_manager_tick() {
}
void CRxCoreStateless::handle_work_stage(bool do_try_rx_queue) {
- int i = 0;
- int j = 0;
+
+ /* set the next sync time to */
+ dsec_t sync_time_sec = now_sec() + (1.0 / 1000);
while (m_state == STATE_WORKING) {
-
+
if (do_try_rx_queue) {
try_rx_queues();
}
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();
- }
+ dsec_t now = now_sec();
+
+ if ( (now - sync_time_sec) > 0 ) {
+ periodic_check_for_cp_messages();
+ port_manager_tick();
+ sync_time_sec = now + (1.0 / 1000);
}
rte_pause();
+
}
}