[spp] [PATCH 04/29] tools/sppc: update l2fwd app for name option

Yasufumi Ogawa yasufum.o at gmail.com
Tue Feb 25 11:34:21 CET 2020


As `--name` option is added, update l2fwd app for the option. If a name
is given, it is used also for file prefix of DPDK.

Signed-off-by: Yasufumi Ogawa <yasufum.o at gmail.com>
---
 tools/sppc/app/l2fwd.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/sppc/app/l2fwd.py b/tools/sppc/app/l2fwd.py
index 1ddb6a9..d6156a8 100755
--- a/tools/sppc/app/l2fwd.py
+++ b/tools/sppc/app/l2fwd.py
@@ -46,7 +46,7 @@ def main():
     if args.port_mask is None:
         common.error_exit('--port-mask')
 
-    # Setup for vhost devices with given device IDs.
+    # Setup devices with given device UIDs.
     dev_uids = None
     sock_files = None
     if args.dev_uids is not None:
@@ -69,25 +69,28 @@ def main():
         exit()
 
     # Setup l2fwd command run on container.
-    cmd_path = '{}/examples/l2fwd/{}/l2fwd'.format(
+    cmd_path = '{0:s}/examples/l2fwd/{1:s}/l2fwd'.format(
         env.RTE_SDK, env.RTE_TARGET)
 
     l2fwd_cmd = [cmd_path, '\\']
 
-    file_prefix = app_helper.gen_sppc_file_prefix('l2fwd')
-
+    # Setup EAL options.
+    if args.name is not None:
+        file_prefix = app_helper.gen_sppc_file_prefix(args.name)
+    else:
+        file_prefix = app_helper.gen_sppc_file_prefix('l2fwd')
     eal_opts = app_helper.setup_eal_opts(args, file_prefix)
 
+    # Setup l2fwd options.
     l2fwd_opts = ['-p', args.port_mask, '\\']
 
     # Check given number of ports is enough for portmask.
     if (args.port_mask is None) or (args.dev_uids is None):
         pass
     elif app_helper.is_sufficient_ports(args) is not True:
-        print("Error: Not enough ports, {} devs for '{}(=0b{})'.".format(
-            len(args.dev_uids.split(',')),
-            args.port_mask,
-            format(int(args.port_mask, 16), 'b')))
+        print("Error: Not enough ports, {0:d} devs for '{1:s}(=0b{2:s})'.".
+              format(len(args.dev_uids.split(',')), args.port_mask,
+                     format(int(args.port_mask, 16), 'b')))
         exit()
 
     cmds = docker_cmd + docker_opts + l2fwd_cmd + eal_opts + l2fwd_opts
-- 
2.17.1



More information about the spp mailing list