From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 5/5] controller: change nof worker lcores configurable
Date: Mon, 4 Feb 2019 12:12:01 +0900 [thread overview]
Message-ID: <1549249921-31638-6-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>
This update is to change the number of worker lcores of each of
secondary processes configurable.
It is decides with secondary ID and config value referred from `config`
command.
- sec_vf_nof_lcores
- sec_mirror_nof_lcores
- sec_pcap_nof_lcores
If secondary ID is `3` and `sec_vf_nof_lcores` is 3, woker lcores is
suggested as `3-5`, started from `3` and use three cores.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/commands/pri.py | 53 +++++++++++++++++++++++++++++++++---------
src/controller/shell.py | 13 +++++++++--
2 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py
index b455b2d..d780f35 100644
--- a/src/controller/commands/pri.py
+++ b/src/controller/commands/pri.py
@@ -28,7 +28,11 @@ class SppPrimary(object):
self.launch_default = {
'mem': '-m 512',
'base_lcore': '1',
- 'vhost_cli': ''
+ 'vhost_cli': '',
+ 'nof_lcores_nfv': '1',
+ 'nof_lcores_vf': '3',
+ 'nof_lcores_mirror': '2',
+ 'nof_lcores_pcap': '2',
}
# Setup template of args for `pri; launch`
@@ -204,19 +208,46 @@ class SppPrimary(object):
else:
opt_sid = '--client-id'
+ # Need to replace port from `7777` of spp-ctl to `6666`
+ # of secondary process.
server_addr = common.current_server_addr()
server_addr = server_addr.replace('7777', '6666')
- # Define rest of cores dynamically.
- # TODO(yasufum) decide rest of cores considering used cores
- if ptype == 'nfv': # one core is enough
- rest_core = sid
- elif ptype == 'vf': # at least three cores
- rest_core = '{}-{}'.format(int(sid), int(sid)+2)
- elif ptype == 'mirror': # two cores
- rest_core = sid
- elif ptype == 'pcap': # at least two cores
- rest_core = '{}-{}'.format(int(sid), int(sid)+1)
+ # Lcore ID of worker lcore starts from sec ID in default.
+ lcore_base = int(sid)
+
+ # Define rest of worker lcores from config dynamically.
+ if ptype == 'nfv': # one worker lcore is enough
+ if 'sec_nfv_nof_lcores' in cli_config.keys():
+ nof_workers = int(cli_config['sec_nfv_nof_lcores']['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(self.defaults['nof_lcores_vf'])
+
+ elif ptype == 'mirror': # two worker cores
+ if 'sec_mirror_nof_lcores' in cli_config.keys():
+ nof_workers = int(cli_config['sec_mirror_nof_lcores']['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():
+ nof_workers = int(cli_config['sec_pcap_nof_lcores']['val'])
+ else:
+ nof_workers = int(self.defaults['nof_lcore_pcap'])
+
+ last_core = lcore_base + nof_workers - 1
+
+ # Decide lcore option based on configured number of lcores.
+ if last_core == lcore_base:
+ rest_core = '{}'.format(last_core)
+ else:
+ rest_core = '{}-{}'.format(lcore_base, last_core)
temp = self._setup_launch_template(
cli_config, self.launch_template,
diff --git a/src/controller/shell.py b/src/controller/shell.py
index 7a192fb..985e141 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -35,12 +35,21 @@ class Shell(cmd.Cmd, object):
'sec_base_lcore': {
'val': '1',
'desc': 'Shared lcore among secondaryes'},
+ 'sec_nfv_nof_lcores': {
+ 'val': '1',
+ 'desc': 'Default num of lcores for workers of spp_nfv'},
'sec_vf_nof_lcores': {
'val': '3',
- 'desc': 'Number of lcores for vf workers'},
+ 'desc': 'Default num of lcores for workers of spp_vf'},
+ 'sec_mirror_nof_lcores': {
+ 'val': '2',
+ 'desc': 'Default num of lcores for workers of spp_mirror'},
+ 'sec_pcap_nof_lcores': {
+ 'val': '2',
+ 'desc': 'Default num of lcores for workers of spp_pcap'},
'sec_vhost_cli': {
'val': '',
- 'desc': 'Vhost client mode'},
+ 'desc': 'Vhost client mode, activated if set any of values'},
'prompt': {
'val': 'spp > ',
'desc': 'Command prompt'},
--
2.7.4
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 ` [spp] [PATCH 4/5] controller: add max_secondary to config ogawa.yasufumi
2019-02-04 3:12 ` ogawa.yasufumi [this message]
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-6-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).