summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-03-09 11:25:05 +0200
committerIdo Barnea <ibarnea@cisco.com>2016-03-09 11:25:05 +0200
commit5f85bbd057dcf3298c8f1bab7b968952d6ec7693 (patch)
tree6194eacc127504a1b706888ee2637ab3319a3beb
parentcc8c0e225bc495f67a379a757cc01a3fe778620d (diff)
Flow stat fix for issue of counting more than 1 stream
-rw-r--r--src/dpdk22/drivers/net/i40e/i40e_ethdev.c2
-rw-r--r--src/flow_stat.cpp6
-rw-r--r--src/main_dpdk.cpp8
3 files changed, 10 insertions, 6 deletions
diff --git a/src/dpdk22/drivers/net/i40e/i40e_ethdev.c b/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
index 510a98cd..dff4ec3c 100644
--- a/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
+++ b/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
@@ -2101,6 +2101,8 @@ i40e_trex_get_speed(struct rte_eth_dev *dev)
//TREX_PATCH
// fill stats array with fdir rules match count statistics
+// Notice that we read statistics from start to start + len, but we fill the stats are
+// starting from 0 with len values
void
i40e_trex_fdir_stats_get(struct rte_eth_dev *dev, uint32_t *stats, uint32_t start, uint32_t len)
{
diff --git a/src/flow_stat.cpp b/src/flow_stat.cpp
index 266acb3f..57aa29c5 100644
--- a/src/flow_stat.cpp
+++ b/src/flow_stat.cpp
@@ -653,7 +653,8 @@ bool CFlowStatRuleMgr::dump_json(std::string & json, bool force_sync) {
p_user_id->set_need_to_send_rx(port);
}
} else {
- std::cerr << __METHOD_NAME__ << i << ":Could not count " << rx_stats[i] << " rx packets, because no mapping was found" << std::endl;
+ std::cerr << __METHOD_NAME__ << i << ":Could not count " << rx_stats[i] << " rx packets, on port "
+ << (uint16_t)port << ", because no mapping was found." << std::endl;
}
}
if (tx_stats[i].get_pkts() != 0) {
@@ -665,7 +666,8 @@ bool CFlowStatRuleMgr::dump_json(std::string & json, bool force_sync) {
p_user_id->set_need_to_send_tx(port);
}
} else {
- std::cerr << __METHOD_NAME__ << i << ":Could not count tx " << tx_pkts << " because no mapping was found" << std::endl;
+ std::cerr << __METHOD_NAME__ << i << ":Could not count " << tx_pkts << " tx packets on port "
+ << (uint16_t)port << ", because no mapping was found." << std::endl;
}
}
}
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 12670969..3f53f83c 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -4947,13 +4947,13 @@ int CTRexExtendedDriverBase40G::get_rx_stats(CPhyEthIF * _if, uint32_t *stats, u
rte_eth_fdir_stats_get(port_id, hw_stats, start, len);
for (int i = loop_start; i < loop_start + len; i++) {
- if (hw_stats[i] >= prev_stats[i]) {
- stats[i] = (uint64_t)(hw_stats[i] - prev_stats[i]);
+ if (hw_stats[i - min] >= prev_stats[i]) {
+ stats[i] = (uint64_t)(hw_stats[i - min] - prev_stats[i]);
} else {
// Wrap around
- stats[i] = (uint64_t)((hw_stats[i] + ((uint64_t)1 << 32)) - prev_stats[i]);
+ stats[i] = (uint64_t)((hw_stats[i - min] + ((uint64_t)1 << 32)) - prev_stats[i]);
}
- prev_stats[i] = hw_stats[i];
+ prev_stats[i] = hw_stats[i - min];
}
return 0;