summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-03-03 13:46:30 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-03-03 13:46:30 +0200
commit378ed0a10ff8e3c32301072b539d7ab926133bad (patch)
treef3474b1beb5702e6b92b99f7fad705e133c18a69 /src
parente33e37ef326a7b240e152ee8e7a1ec8ac6cd749d (diff)
per flow stat bug fix (counting everything twice)
Diffstat (limited to 'src')
-rw-r--r--src/flow_stat.cpp5
-rw-r--r--src/flow_stat.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp
index 659de09b..cb5c7e08 100644
--- a/src/flow_stat.cpp
+++ b/src/flow_stat.cpp
@@ -576,7 +576,7 @@ int CFlowStatRuleMgr::stop_stream(const TrexStream * stream) {
// last stream associated with the entry stopped transmittig.
// remove user_id <--> hw_id mapping
uint8_t proto = m_user_id_map.l4_proto(stream->m_rx_check.m_user_id);
- uint16_t hw_id = m_user_id_map.unmap(stream->m_rx_check.m_user_id);
+ uint16_t hw_id = m_user_id_map.get_hw_id(stream->m_rx_check.m_user_id);
if (hw_id >= MAX_FLOW_STATS) {
fprintf(stderr, "Error: %s got wrong hw_id %d from unmap\n", __func__, hw_id);
return -1;
@@ -592,6 +592,7 @@ int CFlowStatRuleMgr::stop_stream(const TrexStream * stream) {
p_user_id->set_rx_counter(port, rx_counter);
p_user_id->set_tx_counter(port, tx_counter);
}
+ m_user_id_map.unmap(stream->m_rx_check.m_user_id);
m_hw_id_map.unmap(hw_id);
}
}
@@ -606,7 +607,7 @@ bool CFlowStatRuleMgr::dump_json(std::string & json) {
Json::Value root;
bool ret = false;
- if (! m_api ) {
+ if (m_user_id_map.is_empty()) {
return false;
}
root["name"] = "rx-stats";
diff --git a/src/flow_stat.h b/src/flow_stat.h
index 4ea59a2c..eed3b797 100644
--- a/src/flow_stat.h
+++ b/src/flow_stat.h
@@ -138,6 +138,7 @@ class CFlowStatUserIdMap {
public:
CFlowStatUserIdMap();
friend std::ostream& operator<<(std::ostream& os, const CFlowStatUserIdMap& cf);
+ bool is_empty() {return (m_map.empty() == true);};
uint16_t get_hw_id(uint32_t user_id);
class CFlowStatUserIdInfo * find_user_id(uint32_t user_id);
class CFlowStatUserIdInfo * add_user_id(uint32_t user_id, uint8_t proto);