summaryrefslogtreecommitdiffstats
path: root/src/stateless/cp
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-04-10 11:01:24 +0300
committerimarom <imarom@cisco.com>2016-04-10 12:37:22 +0300
commit9823cf0a2acfa3eed27613bf357d82c241889cba (patch)
treebb8d08ce562617c8584b5a0c914746bca1894718 /src/stateless/cp
parent8ac45c1c3b2d10d4679fd2c662b6a78c2c2c27a5 (diff)
multicore tests new goldens (because of phase)
Diffstat (limited to 'src/stateless/cp')
-rw-r--r--src/stateless/cp/trex_stream.h4
-rw-r--r--src/stateless/cp/trex_streams_compiler.cpp32
2 files changed, 12 insertions, 24 deletions
diff --git a/src/stateless/cp/trex_stream.h b/src/stateless/cp/trex_stream.h
index 1914026b..eba5fed0 100644
--- a/src/stateless/cp/trex_stream.h
+++ b/src/stateless/cp/trex_stream.h
@@ -360,10 +360,6 @@ public:
m_null_stream = enable;
}
- bool get_null_stream() {
- return m_null_stream;
- }
-
uint8_t get_type(void) const {
return ( m_type );
}
diff --git a/src/stateless/cp/trex_streams_compiler.cpp b/src/stateless/cp/trex_streams_compiler.cpp
index c4ae0bed..520868c4 100644
--- a/src/stateless/cp/trex_streams_compiler.cpp
+++ b/src/stateless/cp/trex_streams_compiler.cpp
@@ -481,7 +481,7 @@ TrexStreamsCompiler::compile_on_single_core(uint8_t
continue;
}
- /* compile a single stream to all cores */
+ /* compile the stream for only one core */
compile_stream(stream, factor, 1, objs, nodes);
}
}
@@ -585,10 +585,10 @@ TrexStreamsCompiler::compile_stream_on_all_cores(TrexStream *stream,
std::vector<TrexStream *> core_streams(dp_core_count);
int per_core_burst_total_pkts = (stream->m_burst_total_pkts / dp_core_count);
- int burst_remainder = (stream->m_burst_total_pkts % dp_core_count);
- bool has_remainder = (burst_remainder > 0);
+ const int burst_remainder = (stream->m_burst_total_pkts % dp_core_count);
int remainder_left = burst_remainder;
+ /* this is the stream base IPG (pre split) */
double base_ipg_sec = factor * stream->get_ipg_sec();
@@ -599,7 +599,7 @@ TrexStreamsCompiler::compile_stream_on_all_cores(TrexStream *stream,
/* fix stream ID */
dp_stream->fix_dp_stream_id(new_id, new_next_id);
- /* some phase */
+ /* some phase is added to avoid all the cores TXing at once */
dp_stream->m_mc_phase_pre_sec = base_ipg_sec * i;
@@ -610,22 +610,17 @@ TrexStreamsCompiler::compile_stream_on_all_cores(TrexStream *stream,
dp_stream->update_rate_factor(factor / dp_core_count);
- /* allocate the rest of the packets */
- if (has_remainder) {
- if (remainder_left > 0) {
- dp_stream->m_burst_total_pkts++;
- remainder_left--;
- dp_stream->m_mc_phase_post_sec = base_ipg_sec * remainder_left;
- } else {
- /* a delay slot if no packets left */
- dp_stream->m_mc_phase_post_sec = base_ipg_sec * (dp_core_count - 1 - i + burst_remainder);
- }
-
+ if (remainder_left > 0) {
+ dp_stream->m_burst_total_pkts++;
+ remainder_left--;
+ /* this core needs to wait to the rest of the cores that will participate in the last round */
+ dp_stream->m_mc_phase_post_sec = base_ipg_sec * remainder_left;
} else {
- /* if no remainder (or continous) simply add a reverse phase */
- dp_stream->m_mc_phase_post_sec = base_ipg_sec * (dp_core_count - 1 - i);
+ /* this core did not participate in the last round so it will wait its current round's left + burst_remainder */
+ dp_stream->m_mc_phase_post_sec = base_ipg_sec * (dp_core_count - 1 - i + burst_remainder);
}
+
core_streams[i] = dp_stream;
}
@@ -663,9 +658,6 @@ TrexStreamsCompiler::compile_stream_on_single_core(TrexStream *stream,
dp_stream->m_vm_dp = stream->m_vm_dp->clone();
}
- //dp_stream->m_pkt.binary[14 + 20] = 0;
- //dp_stream->m_pkt.binary[14 + 21] = 0;
-
/* update core 0 with the real stream */
objs[0]->add_compiled_stream(dp_stream);