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 08/29] tools/sppc: update dev options of pktgen
Date: Tue, 25 Feb 2020 19:34:25 +0900
Message-ID: <20200225103446.8243-9-yasufum.o@gmail.com> (raw)
In-Reply-To: <20200225103446.8243-1-yasufum.o@gmail.com>

Update options for vdevs of pktgen container app.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 tools/sppc/app/pktgen.py | 35 +++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/tools/sppc/app/pktgen.py b/tools/sppc/app/pktgen.py
index 319557c..a7112e6 100755
--- a/tools/sppc/app/pktgen.py
+++ b/tools/sppc/app/pktgen.py
@@ -75,9 +75,16 @@ def main():
             common.IMG_BASE_NAMES['pktgen'],
             args.dist_name, args.dist_ver)
 
-    # Setup for vhost devices with given device IDs.
-    dev_ids_list = app_helper.dev_ids_to_list(args.dev_ids)
-    sock_files = app_helper.sock_files(dev_ids_list)
+    # Setup devices with given device UIDs.
+    dev_uids = None
+    sock_files = None
+    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()
+
+        dev_uids_list = args.dev_uids.split(',')
+        sock_files = app_helper.sock_files(dev_uids_list)
 
     # Setup docker command.
     if args.workdir is not None:
@@ -91,7 +98,11 @@ def main():
     # Setup pktgen command
     pktgen_cmd = ['pktgen', '\\']
 
-    file_prefix = 'spp-pktgen-container%d' % dev_ids_list[0]
+    # 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('pktgen')
     eal_opts = app_helper.setup_eal_opts(args, file_prefix)
 
     # Setup matrix for assignment of cores and ports.
@@ -107,31 +118,31 @@ def main():
 
         slave_core_list = core_list[1:]
         nof_slave_cores = len(slave_core_list)
-        nof_ports = len(dev_ids_list)
+        nof_ports = len(dev_uids_list)
         nof_cores_each_port = nof_slave_cores / nof_ports
         if nof_cores_each_port < 1:
-            print("Error: Too few cores for given port(s)!")
-            print("%d cores required for %d port(s)" % (
+            print('Error: Too few cores for given port(s)!')
+            print('{0:d} cores required for {1:d} port(s)'.format(
                 (nof_slave_cores + 1), nof_ports))
             exit()
 
         matrix_list = []
         if nof_cores_each_port == 1:
             for i in range(0, nof_ports):
-                matrix_list.append('%d.%d' % (slave_core_list[i], i))
+                matrix_list.append('{0:d}.{1:d}'.format(slave_core_list[i], i))
         elif nof_cores_each_port == 2:
             for i in range(0, nof_ports):
-                matrix_list.append('[%d:%d].%d' % (
+                matrix_list.append('[{0:d}:{1:d}].{2:d}'.format(
                     slave_core_list[2*i], slave_core_list[2*i + 1], i))
         elif nof_cores_each_port == 3:  # Two cores for rx, one for tx
             for i in range(0, nof_ports):
-                matrix_list.append('[%d-%d:%d].%d' % (
+                matrix_list.append('[{0:d}-{1:d}:{2:d}].{3:d}'.format(
                     slave_core_list[3*i],
                     slave_core_list[3*i + 1],
                     slave_core_list[3*i + 2], i))
         elif nof_cores_each_port == 4:
             for i in range(0, nof_ports):
-                matrix_list.append('[%d-%d:%d-%d].%d' % (
+                matrix_list.append('[{0:d}-{1:d}:{2:d}-{3:d}].{4:d}'.format(
                     slave_core_list[4*i],
                     slave_core_list[4*i + 1],
                     slave_core_list[4*i + 2],
@@ -139,7 +150,7 @@ def main():
         # Do not support more than five because it is rare case and
         # calculation is complex.
         else:
-            print("Error: Too many cores for calculation for ports!")
+            print('Error: Too many cores for calculation for ports!')
             print("Consider to use '--matrix' for assigning directly")
             exit()
         matrix = ','.join(matrix_list)
-- 
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 ` Yasufumi Ogawa [this message]
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 ` [spp] [PATCH 14/29] tools/sppc: update dev options of spp_primary Yasufumi Ogawa
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-9-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

Soft Patch Panel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ https://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git