aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnfvbench/cfg.default.yaml10
-rw-r--r--nfvbench/nfvbench.py8
-rwxr-xr-xnfvbench/traffic_client.py3
-rw-r--r--nfvbench/traffic_gen/trex_gen.py3
-rw-r--r--nfvbench/traffic_server.py23
-rw-r--r--test/test_nfvbench.py3
6 files changed, 37 insertions, 13 deletions
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml
index 01097a0..8e94eac 100755
--- a/nfvbench/cfg.default.yaml
+++ b/nfvbench/cfg.default.yaml
@@ -300,6 +300,16 @@ restart: false
# if empty defaults to the one specified in generator_profile.cores
cores:
+# Add cache size in packet generation for TRex field engine (FE).
+# More information for TRex performance:
+# https://trex-tgn.cisco.com/trex/doc/trex_stateless.html#_tutorial_field_engine_significantly_improve_performance
+# If cache_size = 0 (or empty): no cache will be used by TRex (default)
+# If cache_size < 0: cache_size will be set to flow count value
+cache_size:
+# The cache size is actually limited by the number of 64B mbufs configured in the trex platform configuration (see Trex manual 6.2.2. Memory section configuration)
+# Trex will use 1 x 64B mbuf per pre-built cached packet, assuming 1 pre-built cached packet per flow, it means for very large number of flows, the number of configured mbuf_64 will need to be set accordingly.
+mbuf_64:
+
# mbuffer ratio to use for TRex (see TRex documentation for more details)
mbuf_factor: 0.2
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index 4a2a285..050017e 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -87,7 +87,8 @@ class NFVBench(object):
try:
# recalc the running config based on the base config and options for this run
self._update_config(opts)
-
+ if self.config.cache_size < 0:
+ self.config.cache_size = self.config.flow_count
# check that an empty openrc file (no OpenStack) is only allowed
# with EXT chain
if not self.config.openrc_file and self.config.service_chain != ChainType.EXT:
@@ -433,6 +434,11 @@ def _parse_opts_from_cli():
metavar='<vlan>',
help='Port to port or port to switch to port L2 loopback with VLAN id')
+ parser.add_argument('--cache-size', dest='cache_size',
+ action='store',
+ default='0',
+ help='Specify the FE cache size (default: 0, flow-count if < 0)')
+
opts, unknown_opts = parser.parse_known_args()
return opts, unknown_opts
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index be50bd9..8992d51 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -341,6 +341,7 @@ class GeneratorConfig(object):
else:
self.cores = gen_config.get('cores', 1)
self.mbuf_factor = config.mbuf_factor
+ self.mbuf_64 = config.mbuf_64
self.hdrh = not config.disable_hdrh
if gen_config.intf_speed:
# interface speed is overriden from config
@@ -356,8 +357,6 @@ class GeneratorConfig(object):
self.interfaces = gen_config.interfaces
if self.interfaces[0].port != 0 or self.interfaces[1].port != 1:
raise TrafficClientException('Invalid port order/id in generator_profile.interfaces')
- if hasattr(gen_config, 'platform'):
- self.platform = gen_config.platform
self.service_chain = config.service_chain
self.service_chain_count = config.service_chain_count
self.flow_count = config.flow_count
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index a472774..0f51188 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -422,7 +422,8 @@ class TRex(AbstractTrafficGenerator):
l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP))
pad = max(0, frame_size - len(pkt_base)) * 'x'
- return STLPktBuilder(pkt=pkt_base / pad, vm=STLScVmRaw(vm_param))
+ return STLPktBuilder(pkt=pkt_base / pad,
+ vm=STLScVmRaw(vm_param, cache_size=int(self.config.cache_size)))
def generate_streams(self, port, chain_id, stream_cfg, l2frame, latency=True,
e2e=False):
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 4dc7dce..8d1cf0f 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -97,17 +97,24 @@ class TRexTrafficServer(TrafficServer):
prefix=generator_config.name,
limit_memory=generator_config.limit_memory,
ifs=ifs)
+ if hasattr(generator_config, 'mbuf_64') and generator_config.mbuf_64:
+ result += """
+ memory :
+ mbuf_64 : {mbuf_64}""".format(mbuf_64=generator_config.mbuf_64)
+
if self.__check_platform_config(generator_config):
try:
platform = """
platform :
master_thread_id : {master_thread_id}
latency_thread_id : {latency_thread_id}
- dual_if:""".format(master_thread_id=generator_config.platform.master_thread_id,
- latency_thread_id=generator_config.platform.latency_thread_id)
+ dual_if:""".format(master_thread_id=generator_config.gen_config.platform.
+ master_thread_id,
+ latency_thread_id=generator_config.gen_config.platform.
+ latency_thread_id)
result += platform
- for core in generator_config.platform.dual_if:
+ for core in generator_config.gen_config.platform.dual_if:
threads = ""
try:
threads = ",".join([repr(thread) for thread in core.threads])
@@ -122,11 +129,11 @@ class TRexTrafficServer(TrafficServer):
return result
def __check_platform_config(self, generator_config):
- return hasattr(generator_config, 'platform') \
- and hasattr(generator_config.platform, "master_thread_id") \
- and generator_config.platform.master_thread_id is not None \
- and hasattr(generator_config.platform, "latency_thread_id") \
- and generator_config.platform.latency_thread_id is not None
+ return hasattr(generator_config.gen_config, 'platform') \
+ and hasattr(generator_config.gen_config.platform, "master_thread_id") \
+ and generator_config.gen_config.platform.master_thread_id is not None \
+ and hasattr(generator_config.gen_config.platform, "latency_thread_id") \
+ and generator_config.gen_config.platform.latency_thread_id is not None
def check_config_updated(self, generator_config):
existing_config = self.__load_config(filename='/etc/trex_cfg.yaml')
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index 0c38fe9..e41ab33 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -330,7 +330,8 @@ def _get_dummy_tg_config(chain_type, rate, scc=1, fc=10, step_ip='0.0.0.1',
'l2_loopback': False,
'cores': None,
'mbuf_factor': None,
- 'disable_hdrh': None
+ 'disable_hdrh': None,
+ 'mbuf_64': None
})