diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc-server/commands/trex_rpc_cmd_stream.cpp | 1 | ||||
-rw-r--r-- | src/stateless/cp/trex_vm_splitter.cpp | 28 | ||||
-rw-r--r-- | src/stateless/dp/trex_stateless_dp_core.cpp | 3 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp index 2013c9e8..d69b7d7f 100644 --- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp +++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp @@ -60,7 +60,6 @@ TrexRpcCmdAddStream::_run(const Json::Value ¶ms, Json::Value &result) { stream->m_flags = parse_int(section, "flags", result); stream->m_action_count = parse_uint16(section, "action_count", result); stream->m_random_seed = parse_uint32(section, "random_seed", result,0); /* default is zero */ - stream->m_cache_size = parse_uint16(section, "cache", result,0); /* default is zero */ /* inter stream gap */ stream->m_isg_usec = parse_double(section, "isg", result); diff --git a/src/stateless/cp/trex_vm_splitter.cpp b/src/stateless/cp/trex_vm_splitter.cpp index 963b4525..5069c535 100644 --- a/src/stateless/cp/trex_vm_splitter.cpp +++ b/src/stateless/cp/trex_vm_splitter.cpp @@ -40,6 +40,34 @@ TrexVmSplitter::split(TrexStream *stream, std::vector<TrexStream *> core_streams m_core_streams = &core_streams; m_stream = stream; + uint16_t cache_size=m_stream->m_cache_size; + /* split the cache_size */ + if (cache_size>0) { + + /* TBD need to check if we need to it is not too big from pool */ + if (cache_size > 10000) { + throw TrexException("Cache is too big try to reduce it "); + } + + /* split like variable splitters with leftovers */ + uint16_t cache_per_core = cache_size/m_dp_core_count; + uint16_t leftover = cache_size % m_dp_core_count; + + if (cache_per_core<1) { + cache_per_core=1; + leftover=0; + } + + for (TrexStream *core_stream : *m_core_streams) { + core_stream->m_cache_size = cache_per_core; + if (leftover) { + core_stream->m_cache_size+=1; + leftover-=1; + } + } + } + + /* if we cannot split - compile the main and duplicate */ bool rc = split_internal(); if (!rc) { diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp index 4bfeef4b..7e9bec1d 100644 --- a/src/stateless/dp/trex_stateless_dp_core.cpp +++ b/src/stateless/dp/trex_stateless_dp_core.cpp @@ -678,10 +678,7 @@ void TrexStatelessDpCore::replay_vm_into_cache(TrexStream * stream, assert(cache_size>0); rte_mbuf_t * m=0; - /* TBD do we have enough from this type of object , need to ask ! */ - uint32_t buf_size = CGenNodeCacheMbuf::get_object_size(cache_size); - /* TBD replace with align, zero API */ CGenNodeCacheMbuf * p = (CGenNodeCacheMbuf *)malloc(buf_size); assert(p); memset(p,0,buf_size); |