summaryrefslogtreecommitdiffstats
path: root/src/stateless
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-05-05 11:52:11 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-05-18 19:20:22 +0300
commit89d643b96d9a86345ef1de8e80c801d1863002e8 (patch)
treec777a0303eda44c4dd016ffc3c5dbe7050453e10 /src/stateless
parenta53f6be0617721b535086298095ad49057a7be69 (diff)
Regression tests working. Still missing python API to parse latency json
Diffstat (limited to 'src/stateless')
-rw-r--r--src/stateless/cp/trex_stream.cpp1
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp3
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.cpp42
-rw-r--r--src/stateless/rx/trex_stateless_rx_core.h2
4 files changed, 31 insertions, 17 deletions
diff --git a/src/stateless/cp/trex_stream.cpp b/src/stateless/cp/trex_stream.cpp
index 9021ebf4..6959476c 100644
--- a/src/stateless/cp/trex_stream.cpp
+++ b/src/stateless/cp/trex_stream.cpp
@@ -144,7 +144,6 @@ TrexStream::TrexStream(uint8_t type,
m_expected_pkt_len = 0;
m_rx_check.m_enabled = false;
- m_rx_check.m_rule_type = TrexPlatformApi::IF_STAT_PAYLOAD; // default for now. Should come from user???
m_burst_total_pkts=0;
m_num_bursts=1;
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index 9c05c16b..8bb89ee9 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -212,8 +212,7 @@ std::string CGenNodeStateless::get_stream_state_str(stream_state_t stream_state)
}
rte_mbuf_t * CGenNodeStateless::alloc_flow_stat_mbuf(rte_mbuf_t *m) {
- //?????????
- // temp implementation. Just copy the entire mbuf
+ //????????? temp implementation. Just copy the entire mbuf
rte_mbuf_t *m_new = CGlobalInfo::pktmbuf_alloc( get_socket_id(), m->data_len );
/* TBD remove this, should handle cases of error */
assert(m_new);
diff --git a/src/stateless/rx/trex_stateless_rx_core.cpp b/src/stateless/rx/trex_stateless_rx_core.cpp
index 1a5d9a7e..d624f455 100644
--- a/src/stateless/rx/trex_stateless_rx_core.cpp
+++ b/src/stateless/rx/trex_stateless_rx_core.cpp
@@ -30,7 +30,9 @@ void CRxCoreStateless::create(const CRxSlCfg &cfg) {
m_cpu_cp_u.Create(&m_cpu_dp_u);
for (int i = 0; i < MAX_FLOW_STATS_PAYLOAD; i++) {
- m_per_flow_seq[i] = 0;
+ // This is the seq num value we expect next packet to have.
+ // Init value should match m_seq_num in CVirtualIFPerSideStats
+ m_per_flow_seq[i] = UINT32_MAX - 1; // catch wrap around issues early
m_per_flow_hist[i].Reset();
m_per_flow_jitter[i].reset();
m_per_flow_seq_error[i] = 0;
@@ -133,7 +135,7 @@ void CRxCoreStateless::handle_rx_pkt(CLatencyManagerPerPortStl *lp, rte_mbuf_t *
if (is_flow_stat_id(ip_id)) {
uint16_t hw_id;
if (is_flow_stat_payload_id(ip_id)) {
- uint32_t seq; //??? handle seq wrap around
+ uint32_t seq;
uint8_t *p = rte_pktmbuf_mtod(m, uint8_t*);
struct flow_stat_payload_header *fsp_head = (struct flow_stat_payload_header *)
(p + m->pkt_len - sizeof(struct flow_stat_payload_header));
@@ -142,20 +144,34 @@ void CRxCoreStateless::handle_rx_pkt(CLatencyManagerPerPortStl *lp, rte_mbuf_t *
seq = fsp_head->seq;
if (unlikely(seq != m_per_flow_seq[hw_id])) {
if (seq < m_per_flow_seq[hw_id]) {
- if (seq == (m_per_flow_seq[hw_id] - 1)) {
- m_per_flow_dup[hw_id] += 1;
- printf("dup packets seq:%d %ld\n", seq, m_per_flow_seq[hw_id]);
+ if (m_per_flow_seq[hw_id] - seq > 100000) {
+ // packet loss while we had wrap around
+ m_per_flow_seq_error[hw_id] += seq - m_per_flow_seq[hw_id];
+ m_per_flow_seq[hw_id] = seq + 1;
} else {
- m_per_flow_out_of_order[hw_id] += 1;
- // We thought it was lost, but it was just out of order
- m_per_flow_seq_error[hw_id] -= 1;
- printf("ooo packets seq:%d %ld\n", seq, m_per_flow_seq[hw_id]);
+ if (seq == (m_per_flow_seq[hw_id] - 1)) {
+ m_per_flow_dup[hw_id] += 1;
+ } else {
+ m_per_flow_out_of_order[hw_id] += 1;
+ // We thought it was lost, but it was just out of order
+ m_per_flow_seq_error[hw_id] -= 1;
+ }
}
} else {
- // seq > m_per_flow_seq[hw_id]
- printf("lost packets seq:%d %ld\n", seq, m_per_flow_seq[hw_id]);
- m_per_flow_seq_error[hw_id] += seq - m_per_flow_seq[hw_id];
- m_per_flow_seq[hw_id] = seq + 1;
+ if (unlikely (m_per_flow_seq[hw_id] - seq > 100000)) {
+ // packet reorder while we had wrap around
+ if (seq == (m_per_flow_seq[hw_id] - 1)) {
+ m_per_flow_dup[hw_id] += 1;
+ } else {
+ m_per_flow_out_of_order[hw_id] += 1;
+ // We thought it was lost, but it was just out of order
+ m_per_flow_seq_error[hw_id] -= 1;
+ }
+ } else {
+ // seq > m_per_flow_seq[hw_id]. Assuming lost packets
+ m_per_flow_seq_error[hw_id] += seq - m_per_flow_seq[hw_id];
+ m_per_flow_seq[hw_id] = seq + 1;
+ }
}
} else {
m_per_flow_seq[hw_id] = seq + 1;
diff --git a/src/stateless/rx/trex_stateless_rx_core.h b/src/stateless/rx/trex_stateless_rx_core.h
index d946f920..2ebd209a 100644
--- a/src/stateless/rx/trex_stateless_rx_core.h
+++ b/src/stateless/rx/trex_stateless_rx_core.h
@@ -101,7 +101,7 @@ class CRxCoreStateless {
CCpuUtlCp m_cpu_cp_u;
// Used for acking "work" (go out of idle) messages from cp
volatile bool m_ack_start_work_msg __rte_cache_aligned;
- uint64_t m_per_flow_seq[MAX_FLOW_STATS_PAYLOAD]; // expected next seq num
+ uint32_t m_per_flow_seq[MAX_FLOW_STATS_PAYLOAD]; // expected next seq num
CTimeHistogram m_per_flow_hist[MAX_FLOW_STATS_PAYLOAD]; /* latency info */
CJitter m_per_flow_jitter[MAX_FLOW_STATS_PAYLOAD];
uint64_t m_per_flow_seq_error[MAX_FLOW_STATS_PAYLOAD]; // How many packet seq num gaps we saw (packets lost or out of order)