summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bp_sim.cpp28
-rw-r--r--src/flow_stat.cpp10
2 files changed, 23 insertions, 15 deletions
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() {