From 8ea0aeb8506b4da6b574700519ff4ca77b833c62 Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Tue, 8 Mar 2016 11:39:58 +0200 Subject: fix to rx stats crash when adding 2 streams and stopping --- src/main_dpdk.cpp | 55 +++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'src/main_dpdk.cpp') diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 5f47f4bb..0d40215a 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -18,7 +18,13 @@ See the License for the specific language governing permissions and limitations under the License. */ +#include +#include #include +#include +#include +#include +#include #include #include #include @@ -45,38 +51,27 @@ #include #include #include "bp_sim.h" -#include "latency.h" #include "os_time.h" -#include -#include -#include - -#include -#include -#include -#include - -#include <../linux_dpdk/version.h> - +#include "common/arg/SimpleGlob.h" +#include "common/arg/SimpleOpt.h" +#include "common/basic_utils.h" +#include "stateless/cp/trex_stateless.h" +#include "stateless/dp/trex_stream_node.h" +#include "stateless/messaging/trex_stateless_messaging.h" +#include "publisher/trex_publisher.h" +#include "../linux_dpdk/version.h" extern "C" { -#include +#include "dpdk22/drivers/net/ixgbe/base/ixgbe_type.h" } -#include -#include -#include -#include -#include -#include -#include +#include "dpdk22/drivers/net/e1000/base/e1000_regs.h" #include "global_io_mode.h" #include "utl_term_io.h" #include "msg_manager.h" #include "platform_cfg.h" #include "latency.h" -#include "main_dpdk.h" #include "debug.h" - -#include +#include "internal_api/trex_platform_api.h" +#include "main_dpdk.h" #define RX_CHECK_MIX_SAMPLE_RATE 8 #define RX_CHECK_MIX_SAMPLE_RATE_1G 2 @@ -3918,9 +3913,9 @@ int CPhyEthIF::reset_hw_flow_stats() { // get/reset flow director counters // return 0 if OK. -1 if operation not supported. -// stats - If not NULL, returning counter numbers in it. -// index - If non negative, get only counter with this index -// reset - If true, reset counter value after reading +// rx_stats, tx_stats - arrays of len max - min + 1. Returning rx, tx updated values. +// min, max - minimum, maximum counters range to get +// reset - If true, need to reset counter value after reading int CPhyEthIF::get_flow_stats(uint64_t *rx_stats, tx_per_flow_t *tx_stats, int min, int max, bool reset) { uint32_t diff_stats[MAX_FLOW_STATS]; @@ -3932,20 +3927,20 @@ int CPhyEthIF::get_flow_stats(uint64_t *rx_stats, tx_per_flow_t *tx_stats, int m if ( reset ) { // return value so far, and reset if (rx_stats != NULL) { - rx_stats[i] = m_stats.m_rx_per_flow[i] + diff_stats[i]; + rx_stats[i - min] = m_stats.m_rx_per_flow[i] + diff_stats[i]; } if (tx_stats != NULL) { - tx_stats[i] = g_trex.get_flow_tx_stats(m_port_id, i); + tx_stats[i - min] = g_trex.get_flow_tx_stats(m_port_id, i); } m_stats.m_rx_per_flow[i] = 0; g_trex.clear_flow_tx_stats(m_port_id, i); } else { m_stats.m_rx_per_flow[i] += diff_stats[i]; if (rx_stats != NULL) { - rx_stats[i] = m_stats.m_rx_per_flow[i]; + rx_stats[i - min] = m_stats.m_rx_per_flow[i]; } if (tx_stats != NULL) { - tx_stats[i] = g_trex.get_flow_tx_stats(m_port_id, i); + tx_stats[i - min] = g_trex.get_flow_tx_stats(m_port_id, i); } } } -- cgit 1.2.3-korg