summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/automation/regression/functional_tests/stl_basic_tests.py2
-rw-r--r--scripts/exp/flow_stats.pcapbin0 -> 100 bytes
-rw-r--r--scripts/exp/flow_stats_latency.pcapbin0 -> 136 bytes
-rwxr-xr-xsrc/bp_sim.cpp28
-rw-r--r--src/flow_stat.cpp10
5 files changed, 25 insertions, 15 deletions
diff --git a/scripts/automation/regression/functional_tests/stl_basic_tests.py b/scripts/automation/regression/functional_tests/stl_basic_tests.py
index 863307f1..a4e28ca9 100644
--- a/scripts/automation/regression/functional_tests/stl_basic_tests.py
+++ b/scripts/automation/regression/functional_tests/stl_basic_tests.py
@@ -201,6 +201,8 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
["multi_burst_2st_1000pkt.py","-m 1 -l 100",True],
["pcap.py", "-m 1", True],
["pcap_with_vm.py", "-m 1", True],
+ ["flow_stats.py", "-m 1 -l 1", True],
+ ["flow_stats_latency.py", "-m 1 -l 1", True],
# YAML test
["yaml/burst_1000_pkt.yaml","-m 1 -l 100",True],
diff --git a/scripts/exp/flow_stats.pcap b/scripts/exp/flow_stats.pcap
new file mode 100644
index 00000000..267eeaab
--- /dev/null
+++ b/scripts/exp/flow_stats.pcap
Binary files differ
diff --git a/scripts/exp/flow_stats_latency.pcap b/scripts/exp/flow_stats_latency.pcap
new file mode 100644
index 00000000..89d27701
--- /dev/null
+++ b/scripts/exp/flow_stats_latency.pcap
Binary files differ
diff --git a/src/bp_sim.cpp b/src/bp_sim.cpp
index f4eb6f7e..f9e96b6b 100755
--- a/src/bp_sim.cpp
+++ b/src/bp_sim.cpp
@@ -4991,29 +4991,27 @@ int CErfIFStl::send_sl_node(CGenNodeStateless *node_sl) {
bool is_const = false;
if (m) {
is_const = true;
+ rte_pktmbuf_refcnt_update(m,1);
}else{
m=node_sl->alloc_node_with_vm();
assert(m);
}
- if (node_sl->is_stat_needed()) {
+ if (node_sl->is_stat_needed() && (node_sl->get_stat_hw_id() >= MAX_FLOW_STATS) ) {
+ /* latency packet. flow stat without latency handled like normal packet in simulation */
uint16_t hw_id = node_sl->get_stat_hw_id();
- if (hw_id >= MAX_FLOW_STATS) {
- rte_mbuf_t *mi;
- struct flow_stat_payload_header *fsp_head;
- mi = node_sl->alloc_flow_stat_mbuf(m, fsp_head, is_const);
- fsp_head->seq = 0x12345678;
- fsp_head->hw_id = hw_id - MAX_FLOW_STATS;
- fsp_head->magic = FLOW_STAT_PAYLOAD_MAGIC;
- fsp_head->time_stamp = 0x8899aabbccddeeff;
- fill_raw_packet(m,(CGenNode *)node_sl,dir);
- rte_pktmbuf_free(mi);
- }
+ rte_mbuf_t *mi;
+ struct flow_stat_payload_header *fsp_head;
+ mi = node_sl->alloc_flow_stat_mbuf(m, fsp_head, is_const);
+ fsp_head->seq = 0x12345678;
+ fsp_head->hw_id = hw_id - MAX_FLOW_STATS;
+ fsp_head->magic = FLOW_STAT_PAYLOAD_MAGIC;
+ fsp_head->time_stamp = 0x8899aabbccddeeff;
+ fill_raw_packet(mi, (CGenNode *)node_sl, dir);
+ rte_pktmbuf_free(mi);
} else {
fill_raw_packet(m,(CGenNode *)node_sl,dir);
- if (! is_const) {
- rte_pktmbuf_free(m);
- }
+ rte_pktmbuf_free(m);
}
}
/* check that we have mbuf */
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp
index 366c3aa8..cb7a1bf9 100644
--- a/src/flow_stat.cpp
+++ b/src/flow_stat.cpp
@@ -472,6 +472,16 @@ CFlowStatRuleMgr::CFlowStatRuleMgr() {
CFlowStatRuleMgr::~CFlowStatRuleMgr() {
delete m_parser;
+#ifdef TREX_SIM
+ // In simulator, nobody handles the messages to RX, so need to free them to have clean valgrind run.
+ if (m_ring_to_rx) {
+ CGenNode *msg = NULL;
+ while (! m_ring_to_rx->isEmpty()) {
+ m_ring_to_rx->Dequeue(msg);
+ delete msg;
+ }
+ }
+#endif
}
void CFlowStatRuleMgr::create() {