Flow stat fix for issue of counting more than 1 stream
authorIdo Barnea <[email protected]>
Wed, 9 Mar 2016 09:25:05 +0000 (11:25 +0200)
committerIdo Barnea <[email protected]>
Wed, 9 Mar 2016 09:25:05 +0000 (11:25 +0200)
src/dpdk22/drivers/net/i40e/i40e_ethdev.c
src/flow_stat.cpp
src/main_dpdk.cpp

index 510a98c..dff4ec3 100644 (file)
@@ -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)
 {
index 266acb3..57aa29c 100644 (file)
@@ -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;
                 }
             }
         }
index 1267096..3f53f83 100644 (file)
@@ -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;