diff options
Diffstat (limited to 'src/stateless/cp')
-rw-r--r-- | src/stateless/cp/trex_streams_compiler.cpp | 8 | ||||
-rw-r--r-- | src/stateless/cp/trex_streams_compiler.h | 14 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/stateless/cp/trex_streams_compiler.cpp b/src/stateless/cp/trex_streams_compiler.cpp index 97f7a250..45548a46 100644 --- a/src/stateless/cp/trex_streams_compiler.cpp +++ b/src/stateless/cp/trex_streams_compiler.cpp @@ -381,9 +381,13 @@ TrexStreamsCompiler::compile(uint8_t port_id, assert(core_mask.get_active_count() > 0); + /* create an indirect list which contains all + the active cores according to the mask + */ uint8_t indirect_core_count = core_mask.get_active_count(); std::vector<TrexStreamsCompiledObj *> indirect_objs(indirect_core_count); + /* zero all */ for (int i = 0; i < indirect_core_count; i++) { indirect_objs[i] = NULL; } @@ -416,6 +420,10 @@ TrexStreamsCompiler::compile(uint8_t port_id, uint8_t index = 0; for (uint8_t active_core_id : core_mask.get_active_cores()) { + + /* the indirect compile might have decided to compile on one core only + (or any other number which is lower than all the actives) + */ if (indirect_objs[index] == NULL) { break; } diff --git a/src/stateless/cp/trex_streams_compiler.h b/src/stateless/cp/trex_streams_compiler.h index b95bf176..555fbe2c 100644 --- a/src/stateless/cp/trex_streams_compiler.h +++ b/src/stateless/cp/trex_streams_compiler.h @@ -32,6 +32,9 @@ class TrexStreamsCompiler; class TrexStream; class GraphNodeMap; +/** + * a mask object passed to compilation + */ class TrexDPCoreMask { public: @@ -42,6 +45,7 @@ public: m_dp_core_count = dp_core_count; m_dp_core_mask = dp_core_mask; + /* create a vector of all the active cores */ for (int i = 0; i < m_dp_core_count; i++) { if (is_core_active(i)) { m_active_cores.push_back(i); @@ -54,6 +58,10 @@ public: return m_dp_core_count; } + uint8_t get_active_count() const { + return m_active_cores.size(); + } + bool is_core_active(uint8_t core_id) const { assert(core_id < m_dp_core_count); return ( (1 << core_id) & m_dp_core_mask ); @@ -63,10 +71,6 @@ public: return (!is_core_active(core_id)); } - uint8_t get_active_count() const { - return m_active_cores.size(); - } - const std::vector<uint8_t> & get_active_cores() const { return m_active_cores; } @@ -78,8 +82,8 @@ public: /* highest bit pushed to left and then -1 will give all the other bits on */ return ( (dp_core_mask & ( (1 << dp_core_count) - 1 ) ) != 0); } -private: +private: uint8_t m_dp_core_count; uint64_t m_dp_core_mask; |