From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 4/5] controller: add max_secondary to config
Date: Mon, 4 Feb 2019 12:12:00 +0900 [thread overview]
Message-ID: <1549249921-31638-5-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1549249921-31638-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
The number of secondary processes is limited with MAX_SECONDARY defined
in `spp_common.py`, and it is used to show candidates of secondary ID
while launching secondary process. This patch is to add `max_secondary`
to make MAX_SECONDARY configurable after launching SPP CLI.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/commands/pri.py | 14 ++++++++++++--
src/controller/shell.py | 26 ++++++++++++++++++--------
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index aa78cef..b455b2d 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -179,13 +179,23 @@ class SppPrimary(object):
candidates.append('{}'.format(pt))
elif len(tokens) == 4 and tokens[1] == 'launch':
+ if 'max_secondary' in cli_config.keys():
+ max_secondary = int(cli_config['max_secondary']['val'])
+ else:
+ max_secondary = spp_common.MAX_SECONDARY
+
if tokens[2] in spp_common.SEC_TYPES:
candidates = [
- str(i+1) for i in range(spp_common.MAX_SECONDARY)]
+ str(i+1) for i in range(max_secondary)]
elif len(tokens) == 5 and tokens[1] == 'launch':
+ if 'max_secondary' in cli_config.keys():
+ max_secondary = int(cli_config['max_secondary']['val'])
+ else:
+ max_secondary = spp_common.MAX_SECONDARY
+
if (tokens[2] in spp_common.SEC_TYPES) and \
- (int(tokens[3])-1 in range(spp_common.MAX_SECONDARY)):
+ (int(tokens[3])-1 in range(max_secondary)):
ptype = tokens[2]
sid = tokens[3]
diff --git a/src/controller/shell.py b/src/controller/shell.py
index e8b0a0e..7a192fb 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -24,19 +24,29 @@ class Shell(cmd.Cmd, object):
"""SPP command prompt."""
# Default config, but changed via `config` command
+ # TODO(yasufum) move defaults to config file and include from.
cli_config = {
- 'prompt': {
- 'val': 'spp > ', 'desc': 'Command prompt'},
- 'topo_size': {
- 'val': '60%', 'desc': 'Percentage or ratio of topo'},
+ 'max_secondary': {
+ 'val': spp_common.MAX_SECONDARY,
+ 'desc': 'The maximum number of secondary processes'},
'sec_mem': {
- 'val': '-m 512', 'desc': 'Mem size'},
+ 'val': '-m 512',
+ 'desc': 'Mem size'},
'sec_base_lcore': {
- 'val': '1', 'desc': 'Shared lcore among secondaryes'},
+ 'val': '1',
+ 'desc': 'Shared lcore among secondaryes'},
'sec_vf_nof_lcores': {
- 'val': '3', 'desc': 'Number of lcores for vf workers'},
+ 'val': '3',
+ 'desc': 'Number of lcores for vf workers'},
'sec_vhost_cli': {
- 'val': '', 'desc': 'Vhost client mode'},
+ 'val': '',
+ 'desc': 'Vhost client mode'},
+ 'prompt': {
+ 'val': 'spp > ',
+ 'desc': 'Command prompt'},
+ 'topo_size': {
+ 'val': '60%',
+ 'desc': 'Percentage or ratio of topo'},
}
hist_file = os.path.expanduser('~/.spp_history')
--
2.7.4
next prev parent reply other threads:[~2019-02-04 3:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 3:11 [spp] [PATCH 0/5] Add config command ogawa.yasufumi
2019-02-04 3:11 ` [spp] [PATCH 1/5] controller: add " ogawa.yasufumi
2019-02-04 3:11 ` [spp] [PATCH 2/5] controller: refactor pri launch command ogawa.yasufumi
2019-02-04 3:11 ` [spp] [PATCH 3/5] controller: remove nouse check_sec_cmds ogawa.yasufumi
2019-02-04 3:12 ` ogawa.yasufumi [this message]
2019-02-04 3:12 ` [spp] [PATCH 5/5] controller: change nof worker lcores configurable 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=1549249921-31638-5-git-send-email-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).