Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 3/6] controller: remove local default config
Date: Thu, 14 Feb 2019 11:47:23 +0900	[thread overview]
Message-ID: <20190214024726.40861-4-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20190214024726.40861-1-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Default config defined in `pri.py` is nouse because all of config is
defined in config file. This update is to remove file local default
config.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/controller/commands/pri.py | 35 ++++------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index 0e65883..d76da2e 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -25,16 +25,6 @@ class SppPrimary(object):
         self.spp_ctl_cli = spp_ctl_cli
 
         # Default args for `pri; launch`, used if given cli_config is invalid
-        # TODO(yasufum) remove local default and add checking config
-        self.launch_default = {
-                'mem': '-m 512',
-                'base_lcore': '1',
-                'vhost_cli': '',
-                'nof_lcores_nfv': '1',
-                'nof_lcores_vf': '3',
-                'nof_lcores_mirror': '2',
-                'nof_lcores_pcap': '2',
-                }
 
         # TODO(yasufum) replace placeholders __XXX__ to {keyword}.
         # Setup template of args for `pri; launch`
@@ -165,6 +155,7 @@ class SppPrimary(object):
                     rid=rports['id'], rx=rports['rx'], tx=rports['tx'],
                     rx_drop=rports['rx_drop'], tx_drop=rports['tx_drop']))
 
+    # TODO(yasufum) add checking for cli_config has keys
     def complete(self, text, line, begidx, endidx, cli_config):
         """Completion for primary process commands.
 
@@ -230,35 +221,23 @@ class SppPrimary(object):
                                 tmpkey = 'sec_nfv_nof_lcores'
                                 nof_workers = int(
                                         cli_config[tmpkey]['val'])
-                            else:
-                                nof_workers = int(
-                                        self.defaults['nof_lcores_nfv'])
 
                         elif ptype == 'vf':
                             if 'sec_vf_nof_lcores' in cli_config.keys():
                                 nof_workers = int(
                                         cli_config['sec_vf_nof_lcores']['val'])
-                            else:
-                                nof_workers = int(
-                                        elf.defaults['nof_lcores_vf'])
 
                         elif ptype == 'mirror':  # two worker cores
                             if 'sec_mirror_nof_lcores' in cli_config.keys():
                                 tmpkey = 'sec_mirror_nof_lcores'
                                 nof_workers = int(
                                         cli_config[tmpkey]['val'])
-                            else:
-                                nof_workers = int(
-                                        self.defaults['nof_lcore_mirror'])
 
                         elif ptype == 'pcap':  # at least two worker cores
                             if 'sec_pcap_nof_lcores' in cli_config.keys():
                                 tmpkey = 'sec_pcap_nof_lcores'
                                 nof_workers = int(
                                         cli_config[tmpkey]['val'])
-                            else:
-                                nof_workers = int(
-                                        elf.defaults['nof_lcore_pcap'])
 
                         last_core = lcore_base + nof_workers - 1
 
@@ -270,8 +249,7 @@ class SppPrimary(object):
                             rest_core = '{}-{}'.format(lcore_base, last_core)
 
                         temp = self._setup_launch_template(
-                                cli_config, self.launch_template,
-                                self.launch_default)
+                                cli_config, self.launch_template)
                         candidates = [temp.format(
                             wlcores=rest_core, opt_sid=opt_sid, sid=sid,
                             sec_addr=server_addr)]
@@ -290,19 +268,16 @@ class SppPrimary(object):
 
         return completions
 
-    def _setup_launch_template(self, cli_config, template, defaults):
+    # TODO(yasufum) add checking for cli_config has keys
+    def _setup_launch_template(self, cli_config, template):
         """Check given `cli_config` for params of launch."""
 
         if 'sec_mem' in cli_config.keys():
             sec_mem = cli_config['sec_mem']['val']
-        else:
-            sec_mem = defaults['mem']
         template = template.replace('__MEM__', sec_mem)
 
         if 'sec_base_lcore' in cli_config.keys():
             sec_base_lcore = cli_config['sec_base_lcore']['val']
-        else:
-            sec_base_lcore = defaults['base_lcore']
         template = template.replace('__BASE_LCORE__', str(sec_base_lcore))
 
         if 'sec_vhost_cli' in cli_config.keys():
@@ -310,8 +285,6 @@ class SppPrimary(object):
                 vhost_client = '--vhost-client'
             else:
                 vhost_client = ''
-        else:
-            vhost_client = defaults['vhost_cli']
         template = template.replace('__VHOST_CLI__', vhost_client)
 
         return template
-- 
2.17.1

  parent reply	other threads:[~2019-02-14  2:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  2:47 [spp] [PATCH 0/6] Update for spp_pcap ogawa.yasufumi
2019-02-14  2:47 ` [spp] [PATCH 1/6] spp_pcap: refactor app options ogawa.yasufumi
2019-02-14  2:47 ` [spp] [PATCH 2/6] spp-ctl: update spp_pcap opts for validation ogawa.yasufumi
2019-02-14  2:47 ` ogawa.yasufumi [this message]
2019-02-14  2:47 ` [spp] [PATCH 4/6] controller: add pcap support for pri completion ogawa.yasufumi
2019-02-14  2:47 ` [spp] [PATCH 5/6] spp_pcap: refactor name of funcs and vars ogawa.yasufumi
2019-02-14  2:47 ` [spp] [PATCH 6/6] makefile: update dist-clean task ogawa.yasufumi

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=20190214024726.40861-4-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --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).