summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierrick Louin <pierrick.louin@orange.com>2021-03-06 01:23:56 +0000
committerfmenguy <francoisregis.menguy@orange.com>2021-04-27 16:54:00 +0200
commite4f42c701172b6b27dea2126e095e2526bcdb365 (patch)
treec48b40f8d95dce6cc3dfca07d229e7fc3f192fad
parentfc792bba0bfaaaeca8a9a1b6ca47c9cd9303d41f (diff)
NFVBENCH-190: Add a 'i40e_mixed' option, trex accepts other i40e driven ports to run in kernel mode on the same board
Change-Id: I33b1d848f409e0431bd4e247456b1d697d8b9d04 Signed-off-by: Pierrick Louin <pierrick.louin@orange.com>
-rw-r--r--docker/Dockerfile2
-rw-r--r--nfvbench/cfg.default.yaml13
-rw-r--r--nfvbench/nfvbench.py9
-rw-r--r--nfvbench/traffic_server.py32
4 files changed, 53 insertions, 3 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 8676bbd..10b7c41 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,7 +1,7 @@
# docker file for creating a container that has nfvbench installed and ready to use
FROM ubuntu:20.04
-ENV TREX_VER "v2.88"
+ENV TREX_VER "v2.89"
ENV VM_IMAGE_VER "0.12"
ENV PYTHONIOENCODING "utf8"
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml
index 28f84f4..8e822e5 100644
--- a/nfvbench/cfg.default.yaml
+++ b/nfvbench/cfg.default.yaml
@@ -367,6 +367,19 @@ cache_size: 0
# 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)
# Note that the resulting value is finally capped to 10000, whatever the requested size is (by design limitation).
+# Specification of the TRex behaviour dealing with the i40e network card driver issue: Trex-528
+# see https://trex-tgn.cisco.com/youtrack/issue/trex-528
+# This issue states that if other ports, in the same card,
+# are in kernel mode, they could impair traffic counting.
+# Can be overridden by --i40e-mixed
+# Values can be:
+# ignore - don't consider the case (default)
+# exit - should the case arise, exit (TRex default behaviour)
+# unbind - unbind kernel bound ports (the former NFVbench behaviour)
+# The 'ignore' option might be OK as soon as the issue has been fixed in the driver.
+# The 'unbind' option should not be used! who knows the current use of other ports?
+i40e_mixed:
+
# 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:
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index bd86810..598247a 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -530,6 +530,13 @@ def _parse_opts_from_cli():
'tagged with given VLAN id(s) or not (given \'no-tag\') '
'\'true\': use current vlans; \'false\': disable this mode.')
+ parser.add_argument('--i40e-mixed', dest='i40e_mixed',
+ action='store',
+ default=None,
+ metavar='<ignore,check,unbind>',
+ help='TRex behavior when dealing with a i40e network card driver'
+ ' [ https://trex-tgn.cisco.com/youtrack/issue/trex-528 ]')
+
parser.add_argument('--user-info', dest='user_info',
action='append',
metavar='<data>',
@@ -875,6 +882,8 @@ def main():
config.service_chain_count = len(vlans[0])
opts.l2_loopback = None
+ if config.i40e_mixed is None:
+ config.i40e_mixed = 'ignore'
if config.use_sriov_middle_net is None:
config.use_sriov_middle_net = False
if opts.use_sriov_middle_net is not None:
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 52ec2f1..629cb3d 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -34,12 +34,27 @@ class TRexTrafficServer(TrafficServer):
assert len(contents) == 1
self.trex_dir = os.path.join(trex_base_dir, contents[0])
+ def __apply_trex_patches(self):
+ parent_dir = os.path.dirname(os.path.realpath(__file__))
+ patches_dir = os.path.join(parent_dir, "trex_patches")
+ patches = os.listdir(patches_dir)
+ for patch in patches:
+ patch = os.path.join(patches_dir, patch)
+ command = (
+ "patch --directory=" + self.trex_dir + " --strip=0"
+ " --forward --no-backup-if-mismatch --reject-file=-"
+ " --force --input=" + patch + " >&-")
+ os.system(command)
+
def run_server(self, generator_config, filename='/etc/trex_cfg.yaml'):
"""Run TRex server for specified traffic profile.
:param traffic_profile: traffic profile object based on config file
:param filename: path where to save TRex config file
"""
+ # in order to allow for customized behaviors, let's apply some patches
+ # this scheme keeps acceptable since we have only simple modifications
+ self.__apply_trex_patches()
cfg = self.__save_config(generator_config, filename)
cores = generator_config.cores
vtep_vlan = generator_config.gen_config.get('vtep_vlan')
@@ -53,10 +68,21 @@ class TRexTrafficServer(TrafficServer):
# --unbind-unused-ports: for NIC that have more than 2 ports such as Intel X710
# this will instruct trex to unbind all ports that are unused instead of
# erroring out with an exception (i40e only)
+ # Try: --ignore-528-issue -> neither unbind nor exit with error,
+ # just proceed cause it might work!
+ # Note that force unbinding is probably a bad choice:
+ # we can't assume for sure that other ports are "unused".
+ # The default TRex behaviour - exit - is indeed a safer option;
+ # a message informs about the ports that should be unbound.
+ i40e_opt = ("--ignore-528-issue" if
+ generator_config.config.i40e_mixed == 'ignore' else
+ "--unbind-unused-ports" if
+ generator_config.config.i40e_mixed == 'unbind' else "")
cmd = ['nohup', '/bin/bash', '-c',
'./t-rex-64 -i -c {} --iom 0 --no-scapy-server '
- '--unbind-unused-ports --close-at-end {} {} '
+ '--close-at-end {} {} {} '
'{} {} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
+ i40e_opt,
vlan_opt,
hdrh_opt,
mbuf_opt, cfg)]
@@ -91,7 +117,7 @@ class TRexTrafficServer(TrafficServer):
# parameter, specified as one of the starting command line
# arguments, has been modified since the last launch.
# Hence we add some extra fields to the config file
- # (nb_cores, use_vlan, mbuf_factor, hdrh)
+ # (nb_cores, use_vlan, mbuf_factor, i40e_mixed, hdrh)
# which will serve as a memory between runs -
# while being actually ignored by the T-Rex server.
@@ -108,6 +134,7 @@ class TRexTrafficServer(TrafficServer):
hdrh : {hdrh}
nb_cores : {nb_cores}
use_vlan : {use_vlan}
+ i40e_mixed : {i40e_mixed}
interfaces : [{ifs}]""".format(
zmq_pub_port=generator_config.zmq_pub_port,
zmq_rpc_port=generator_config.zmq_rpc_port,
@@ -119,6 +146,7 @@ class TRexTrafficServer(TrafficServer):
nb_cores=generator_config.cores,
use_vlan=generator_config.gen_config.get('vtep_vlan') or
generator_config.vlan_tagging,
+ i40e_mixed=generator_config.config.i40e_mixed,
ifs=ifs)
if hasattr(generator_config, 'mbuf_64') and generator_config.mbuf_64: