Soft Patch Panel
 help / color / mirror / Atom feed
From: Yasufumi Ogawa <yasufum.o@gmail.com>
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 14/29] tools/sppc: update dev options of spp_primary
Date: Tue, 25 Feb 2020 19:34:31 +0900	[thread overview]
Message-ID: <20200225103446.8243-15-yasufum.o@gmail.com> (raw)
In-Reply-To: <20200225103446.8243-1-yasufum.o@gmail.com>

Update options for vdevs of spp_primary container app.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 tools/sppc/app/spp-primary.py | 84 ++++++++++++-----------------------
 1 file changed, 28 insertions(+), 56 deletions(-)

diff --git a/tools/sppc/app/spp-primary.py b/tools/sppc/app/spp-primary.py
index 7ebee68..3e5b2ba 100755
--- a/tools/sppc/app/spp-primary.py
+++ b/tools/sppc/app/spp-primary.py
@@ -18,8 +18,17 @@ def parse_args():
         description="Launcher for spp-primary application container")
 
     parser = app_helper.add_eal_args(parser)
+    parser = app_helper.add_sppc_args(parser)
 
     # Application specific arguments
+    parser.add_argument(
+        '-d', '--dev-uids',
+        type=str,
+        help='Virtual devices of SPP in resource UID format')
+    parser.add_argument(
+        '-v', '--volume',
+        nargs='*', type=str,
+        help='Bind mount a volume (for docker)')
     parser.add_argument(
         '-n', '--nof-ring',
         type=int,
@@ -29,14 +38,6 @@ def parse_args():
         '-p', '--port-mask',
         type=str,
         help='Port mask')
-    parser.add_argument(
-        '-dv', '--dev-vhost-ids',
-        type=str,
-        help='vhost device IDs')
-    parser.add_argument(
-        '-dt', '--dev-tap-ids',
-        type=str,
-        help='TAP device IDs')
     parser.add_argument(
         '-ip', '--ctl-ip',
         type=str,
@@ -47,14 +48,14 @@ def parse_args():
         default=5555,
         help="Port for primary of spp-ctl")
 
-    parser = app_helper.add_sppc_args(parser)
-
     return parser.parse_args()
 
 
 def main():
     args = parse_args()
 
+    app_name = 'spp_primary'
+
     # Setup docker command.
     docker_cmd = ['sudo', 'docker', 'run', '\\']
     docker_opts = []
@@ -74,60 +75,31 @@ def main():
         docker_opts += ['-it', '\\']
 
     docker_opts += [
-        '--privileged', '\\',  # should be privileged
+        '--privileged', '\\',  # must be privileged
         '-v', '/dev/hugepages:/dev/hugepages', '\\',
-        '-v', '/var/run/:/var/run/', '\\']
+        '-v', '/var/run/:/var/run/', '\\',
+        '-v', '/tmp:/tmp', '\\']
 
-    if args.dev_vhost_ids is not None:
-        docker_opts += ['-v', '/tmp:/tmp', '\\']
+    # Setup devices with given device UIDs.
+    dev_uids_list = None
+    sock_files = []
+    if args.dev_uids is not None:
+        if app_helper.is_valid_dev_uids(args.dev_uids) is False:
+            print('Invalid option: {}'.format(args.dev_uids))
+            exit()
 
-    # Setup for TAP devices with given device IDs.
-    if args.dev_tap_ids is not None:
-        dev_tap_ids = app_helper.dev_ids_to_list(args.dev_tap_ids)
-    else:
-        dev_tap_ids = []
-
-    # Setup for vhost devices with given device IDs.
-    if args.dev_vhost_ids is not None:
-        dev_vhost_ids = app_helper.dev_ids_to_list(args.dev_vhost_ids)
-        socks = []
-        for dev_id in dev_vhost_ids:
-            socks.append({
-                'host': '/tmp/sock{}'.format(dev_id),
-                'guest': '/tmp/sock{}'.format(dev_id)})
-    else:
-        dev_vhost_ids = []
+        dev_uids_list = args.dev_uids.split(',')
+        sock_files = app_helper.sock_files(dev_uids_list, is_spp_pri=True)
 
     docker_opts += [
         container_image, '\\']
 
     # Setup spp primary command.
-    spp_cmd = ['spp_primary', '\\']
-
-    # Do not use 'app_helper.setup_eal_opts()' because spp_primary does
-    # not use virtio vdev but TAP or vhost, which should be added manually.
-    core_opt = app_helper.get_core_opt(args)
-    mem_opt = app_helper.get_mem_opt(args)
-    eal_opts = [
-        core_opt['attr'], core_opt['val'], '\\',
-        '-n', str(args.nof_memchan), '\\',
-        mem_opt['attr'], mem_opt['val'], '\\',
-        '--huge-dir', '/dev/hugepages', '\\',
-        '--proc-type', 'primary', '\\']
-
-    # Add TAP vdevs
-    for i in range(len(dev_tap_ids)):
-        eal_opts += [
-            '--vdev', 'net_tap{},iface=foo{}'.format(
-                dev_tap_ids[i], dev_tap_ids[i]), '\\']
-
-    # Add vhost vdevs
-    for i in range(len(dev_vhost_ids)):
-        eal_opts += [
-            '--vdev', 'eth_vhost{},iface={}'.format(
-                dev_vhost_ids[i], socks[i]['guest']), '\\']
-
-    eal_opts += ['--', '\\']
+    spp_cmd = [app_name, '\\']
+
+    eal_opts = app_helper.setup_eal_opts(args, common.SPPC_FILE_PREFIX,
+                                         proc_type='primary',
+                                         is_spp_pri=True)
 
     spp_opts = []
     # Check for other mandatory opitons.
-- 
2.17.1


  parent reply	other threads:[~2020-02-25 10:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 10:34 [spp] [PATCH 00/29] Update SPP Container tools Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 01/29] tools/sppc: update options for assigning devices Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 02/29] tools/sppc: update dev options of l2fwd Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 03/29] tools/sppc: add container name option Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 04/29] tools/sppc: update l2fwd app for " Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 05/29] tools/sppc: update dev options of l3fwd Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 06/29] tools/sppc: update dev options of l3fwd-acl Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 07/29] tools/sppc: update dev options of testpmd Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 08/29] tools/sppc: update dev options of pktgen Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 09/29] tools/sppc: update dev options of load-balancer Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 10/29] tools/sppc: version checker for container DPDK ver Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 11/29] tools/sppc: check DPDK ver in load-balancer Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 12/29] tools/sppc: setup spp_pri opts in app_helper Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 13/29] tools/sppc: define file prefix for SPP Yasufumi Ogawa
2020-02-25 10:34 ` Yasufumi Ogawa [this message]
2020-02-25 10:34 ` [spp] [PATCH 15/29] tools/sppc: setup with docker opts in SPP pri Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 16/29] tools/sppc: update calling setup_docker_opts() Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 17/29] tools/sppc: update dev options of helloworld Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 18/29] tools/sppc: update dev options of suricata Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 19/29] tools/sppc: update dev options of spp_nfv Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 20/29] tools/sppc: change to gen EAL opts with app name Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 21/29] tools/sppc: remove nouse variable Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 22/29] bin: remove sock files created by docker Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 23/29] tools/sppc: skip checking rule file if dry run Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 24/29] docs: revise examples in sppc Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 25/29] docs: update versions in " Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 26/29] docs: update old example in spp_primary container Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 27/29] tools/sppc: python3 support for sppc build tool Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 28/29] docs: update app container help msg Yasufumi Ogawa
2020-02-25 10:34 ` [spp] [PATCH 29/29] docs: update howto define app container guide Yasufumi Ogawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200225103446.8243-15-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).