summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_exception.h1
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp3
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp2
-rw-r--r--src/stateless/dp/trex_stream_node.h8
-rw-r--r--src/stateless/rx/trex_stateless_rx_port_mngr.cpp16
-rw-r--r--src/stateless/rx/trex_stateless_rx_port_mngr.h10
6 files changed, 28 insertions, 12 deletions
diff --git a/src/stateless/cp/trex_exception.h b/src/stateless/cp/trex_exception.h
index ffc2f734..f4d7195a 100644
--- a/src/stateless/cp/trex_exception.h
+++ b/src/stateless/cp/trex_exception.h
@@ -51,7 +51,6 @@ class TrexException : public std::runtime_error
T_FLOW_STAT_NO_STREAMS_EXIST,
T_FLOW_STAT_ALREADY_STARTED,
T_FLOW_STAT_ALREADY_EXIST,
- T_FLOW_STAT_FAILED_CHANGE_IP_ID,
T_FLOW_STAT_NO_FREE_HW_ID,
T_FLOW_STAT_RX_CORE_START_FAIL,
T_FLOW_STAT_BAD_HW_ID,
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 423cd443..8aa45753 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -174,7 +174,8 @@ TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api
api->get_interface_info(port_id, m_api_info);
/* get RX caps */
- api->get_interface_stat_info(port_id, m_rx_count_num, m_rx_caps);
+ uint16_t ip_id_base;
+ api->get_interface_stat_info(port_id, m_rx_count_num, m_rx_caps, ip_id_base);
/* get the DP cores belonging to this port */
api->port_id_to_cores(m_port_id, core_pair_list);
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index b6aa15be..dd5282b8 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -998,7 +998,7 @@ TrexStatelessDpCore::add_stream(TrexStatelessDpPerPort * lp_port,
if (stream->m_rx_check.m_enabled) {
node->set_stat_needed();
- uint8_t hw_id = stream->m_rx_check.m_hw_id;
+ uint16_t hw_id = stream->m_rx_check.m_hw_id;
assert (hw_id < MAX_FLOW_STATS + MAX_FLOW_STATS_PAYLOAD);
node->set_stat_hw_id(hw_id);
// no support for cache with flow stat payload rules
diff --git a/src/stateless/dp/trex_stream_node.h b/src/stateless/dp/trex_stream_node.h
index b74e0f62..9accc3f2 100644
--- a/src/stateless/dp/trex_stream_node.h
+++ b/src/stateless/dp/trex_stream_node.h
@@ -100,10 +100,10 @@ private:
double m_next_time_offset; /* in sec */
uint16_t m_action_counter;
- uint8_t m_stat_hw_id; // hw id used to count rx and tx stats
- uint8_t m_null_stream;
+ uint16_t m_stat_hw_id; // hw id used to count rx and tx stats
uint16_t m_cache_array_cnt;
- uint16_t m_pad12;
+ uint8_t m_null_stream;
+ uint8_t m_pad12;
stream_state_t m_state;
uint8_t m_port_id;
@@ -301,7 +301,7 @@ public:
m_stat_hw_id = hw_id;
}
- socket_id_t get_stat_hw_id() {
+ uint16_t get_stat_hw_id() {
return ( m_stat_hw_id );
}
diff --git a/src/stateless/rx/trex_stateless_rx_port_mngr.cpp b/src/stateless/rx/trex_stateless_rx_port_mngr.cpp
index 0beeae69..17aecb03 100644
--- a/src/stateless/rx/trex_stateless_rx_port_mngr.cpp
+++ b/src/stateless/rx/trex_stateless_rx_port_mngr.cpp
@@ -24,6 +24,7 @@
#include "common/Network/Packet/Arp.h"
#include "pkt_gen.h"
#include "trex_stateless_capture.h"
+#include "stateless/cp/trex_stateless.h"
/**************************************
* latency RX feature
@@ -36,6 +37,8 @@ RXLatency::RXLatency() {
for (int i = 0; i < MAX_FLOW_STATS; i++) {
m_rx_pg_stat[i].clear();
+ }
+ for (int i = 0; i < MAX_FLOW_STATS_PAYLOAD; i++) {
m_rx_pg_stat_payload[i].clear();
}
}
@@ -50,6 +53,15 @@ RXLatency::create(CRFC2544Info *rfc2544, CRxCoreErrCntrs *err_cntrs) {
} else {
m_rcv_all = false;
}
+
+ uint16_t num_counters, cap, ip_id_base;
+ TrexStateless *tstateless = get_stateless_obj();
+ assert(tstateless);
+
+ const TrexPlatformApi *api = tstateless->get_platform_api();
+ assert(api);
+ api->get_interface_stat_info(0, num_counters, cap, ip_id_base);
+ m_ip_id_base = ip_id_base;
}
void
@@ -58,7 +70,7 @@ RXLatency::handle_pkt(const rte_mbuf_t *m) {
int ret = parser.parse(rte_pktmbuf_mtod(m, uint8_t *), m->pkt_len);
if (m_rcv_all || (ret == 0)) {
- uint32_t ip_id;
+ uint32_t ip_id = 0;
int ret2 = parser.get_ip_id(ip_id);
if (m_rcv_all || ( ret2 == 0)) {
if (m_rcv_all || is_flow_stat_id(ip_id)) {
@@ -157,7 +169,7 @@ RXLatency::handle_pkt(const rte_mbuf_t *m) {
curr_rfc2544->add_sample(ctime);
}
} else {
- hw_id = get_hw_id(ip_id);
+ hw_id = get_hw_id((uint16_t)ip_id);
if (hw_id < MAX_FLOW_STATS) {
m_rx_pg_stat[hw_id].add_pkts(1);
m_rx_pg_stat[hw_id].add_bytes(m->pkt_len + 4); // +4 for ethernet CRC
diff --git a/src/stateless/rx/trex_stateless_rx_port_mngr.h b/src/stateless/rx/trex_stateless_rx_port_mngr.h
index ea360490..b6d929ed 100644
--- a/src/stateless/rx/trex_stateless_rx_port_mngr.h
+++ b/src/stateless/rx/trex_stateless_rx_port_mngr.h
@@ -55,9 +55,12 @@ public:
void reset_stats();
private:
+ // below functions for both IP v4 and v6, so they need uint32_t id
bool is_flow_stat_id(uint32_t id) {
- if ((id & 0x000fff00) == IP_ID_RESERVE_BASE) return true;
- return false;
+ if ((uint16_t) id >= m_ip_id_base)
+ return true;
+ else
+ return false;
}
bool is_flow_stat_payload_id(uint32_t id) {
@@ -66,7 +69,7 @@ private:
}
uint16_t get_hw_id(uint16_t id) {
- return (0x00ff & id);
+ return (~m_ip_id_base & (uint16_t )id);
}
public:
@@ -77,6 +80,7 @@ public:
bool m_rcv_all;
CRFC2544Info *m_rfc2544;
CRxCoreErrCntrs *m_err_cntrs;
+ uint16_t m_ip_id_base;
};