From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bcmv-tmail01.ecl.ntt.co.jp (bcmv-tmail01.ecl.ntt.co.jp [124.146.185.148]) by dpdk.org (Postfix) with ESMTP id C15C55681 for ; Mon, 4 Feb 2019 04:14:12 +0100 (CET) Received: from bcmv-ns01.ecl.ntt.co.jp (bcmv-ns01.ecl.ntt.co.jp [129.60.83.123]) by bcmv-tmail01.ecl.ntt.co.jp (8.14.4/8.14.4) with ESMTP id x143EBmx006215; Mon, 4 Feb 2019 12:14:11 +0900 Received: from bcmv-ns01.ecl.ntt.co.jp (localhost [127.0.0.1]) by bcmv-ns01.ecl.ntt.co.jp (Postfix) with ESMTP id DAD8C1AD; Mon, 4 Feb 2019 12:14:10 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by bcmv-ns01.ecl.ntt.co.jp (Postfix) with ESMTP id CDA811B0; Mon, 4 Feb 2019 12:14:10 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Mon, 4 Feb 2019 12:12:01 +0900 Message-Id: <1549249921-31638-6-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549249921-31638-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1549249921-31638-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 5/5] controller: change nof worker lcores configurable X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Feb 2019 03:14:13 -0000 From: Yasufumi Ogawa 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 --- 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