From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F0468A04F7 for ; Fri, 20 Dec 2019 08:41:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4D862C60; Fri, 20 Dec 2019 08:41:14 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 64BB32BF9 for ; Fri, 20 Dec 2019 08:41:13 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id q10so4738821pfs.6 for ; Thu, 19 Dec 2019 23:41:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=0qULs5cRUJO5L2RwHACMU47TPPyx9T1nJyOwMqxj65Y=; b=Te3ebbjG9iyobBi+MlUbo1KJa1vpeI0uaLo/4BgK9Pz5XvSHoVHfh3GRLpRO3vcq/C yaPOAJ8+Xno7jpumZqg9a/PabeGuWk514aj4+NMReD/Daumcbo4RH2MwHjpVhrHy8sxS BCvjGApO2znC2wrvp8GoN7cT6X7DJxMbMDztg6bwiB09WFA6y4UDbLKTl0zjipEunEYY ZIDvGbA0jnwU4pyvUeXzkL0ZBuv+H6RoNwpxcY/VRDnWnxcDsgNvqRzzT38JEv2s2TTS bGSFif8zgAi+jEas54m1BKcROEn5gfVdgCLpjG58xGUfZqx9slawAv+9GLIDuYb3Nqsz qfVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=0qULs5cRUJO5L2RwHACMU47TPPyx9T1nJyOwMqxj65Y=; b=l7sxz/Ia6sftDxXkzcpEKYB+YHlxs8LSPn4fGVEi7jHo1aLgMb/FnABYBDnd2OkpI6 lKzhsmo8MYfTsmRvNaRCpbrz0EfnHkefww+U6Mth06a9b8GSecFyxbvc+QjAlvgvTP96 Aer0UH1xEOPyktTUFEbWpdl+LIZL0nydkt+qm14+SIZ2jom/90vW0xVZUHWdvaMbbDWX U0T8px75BaXZZ16QIAIORtMPu+P45s1tozczk9tkyESef3fXRfBf7tP5HH2WdGVjfR1G +xiXIoOZhvFWhKbhue3RvfQ0FSBe0zfm2pHhqZ92ujsax9k6lbDA5I9T281o6DN0o6zm qz1w== X-Gm-Message-State: APjAAAV4a7d/eJ7uWxYdLciv/iUAfEZ4M1TOqUwcVwm+YV1cyCBQ5hUt StlCbF8+ZjwW+O6idzc9VRRsJX70 X-Google-Smtp-Source: APXvYqy1KwbgdGZ6WkMBX+x/AUSGIFl/KiBUkFpIyoQ99VflbdXlCpK2kAOBikEFc4zufgLu9mbNDQ== X-Received: by 2002:a62:446:: with SMTP id 67mr13855046pfe.109.1576827672479; Thu, 19 Dec 2019 23:41:12 -0800 (PST) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id i3sm9641378pfo.72.2019.12.19.23.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 23:41:12 -0800 (PST) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Fri, 20 Dec 2019 16:40:59 +0900 Message-Id: <20191220074103.14065-3-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220074103.14065-1-yasufum.o@gmail.com> References: <20191220074103.14065-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 2/6] cli: add file prefix opt for launch cmd 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: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa `--file-prefix` is an EAL option for running several DPDK applications by naming shared data file other than default one. However, it should be the same name among processes if it is implemented as a multi-process app. This update is to add `--file-prefix` in completed launch command. SPP CLI expects that the prefix is defined as an environment variable `SPP_FILE_PREFIX`. It completes `--file-prefix` with the variable, or does not complete this option itself if the variable is not defined. Signed-off-by: Yasufumi Ogawa --- src/cli/commands/pri.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/cli/commands/pri.py b/src/cli/commands/pri.py index bee0d81..9212897 100644 --- a/src/cli/commands/pri.py +++ b/src/cli/commands/pri.py @@ -4,6 +4,7 @@ from .. import spp_common from ..shell_lib import common from ..spp_common import logger +import os import time @@ -21,6 +22,8 @@ class SppPrimary(object): PRI_CMDS = ['status', 'add', 'del', 'forward', 'stop', 'patch', 'launch', 'clear'] + ENV_FILE_PREF = 'SPP_FILE_PREFIX' + def __init__(self, spp_ctl_cli): self.spp_ctl_cli = spp_ctl_cli @@ -29,9 +32,14 @@ class SppPrimary(object): # Default args for `pri; launch`, used if given cli_config is invalid + # used for secondary's --file-prefix option if defined + file_prefix = os.getenv(self.ENV_FILE_PREF) + # Setup template of args for `pri; launch` temp = "-l {m_lcore},{s_lcores} " temp = temp + "{mem} " + if file_prefix: + temp = temp + "--file-prefix {} ".format(file_prefix) temp = temp + "-- " temp = temp + "{opt_sid} {sid} " # '-n 1' or '--client-id 1' temp = temp + "-s {sec_addr} " # '-s 192.168.1.100:6666' @@ -166,7 +174,7 @@ class SppPrimary(object): print(' - slave: {}'.format(json_obj['lcores'][1])) else: lcores = ', '.join([str(i) - for i in json_obj['lcores'][1:]]) + for i in json_obj['lcores'][1:]]) print(' - slaves: [{}]'.format(lcores)) sep = ' ' @@ -197,8 +205,10 @@ class SppPrimary(object): temp = '{s6}{portid:2} {rx:10} {tx:10} {tx_d:10} {eth}' for pports in json_obj['phy_ports']: print(temp.format(s6=sep*6, - portid=pports['id'], rx=pports['rx'], tx=pports['tx'], - tx_d=pports['tx_drop'], eth=pports['eth'])) + portid=pports['id'], rx=pports['rx'], + tx=pports['tx'], + tx_d=pports['tx_drop'], + eth=pports['eth'])) if 'ring_ports' in json_obj: print(' - ring ports:') @@ -207,7 +217,7 @@ class SppPrimary(object): temp = '{s6}{rid:2} {rx:10} {tx:10} {rx_d:10} {tx_d:10}' for rports in json_obj['ring_ports']: print(temp.format(s6=sep*6, - rid=rports['id'], rx=rports['rx'], tx=rports['tx'], + rid=rports['id'], rx=rports['rx'], tx=rports['tx'], rx_d=rports['rx_drop'], tx_d=rports['tx_drop'])) except KeyError as e: @@ -461,7 +471,8 @@ class SppPrimary(object): if has_invalid_param is False: candidates = [self.launch_template.format( m_lcore=master_lcore, s_lcores=slave_lcores, - mem=sec_mem, opt_sid=opt_sid, sid=sid, + mem=sec_mem, + opt_sid=opt_sid, sid=sid, sec_addr=server_addr, vhost_cli=vhost_client)] else: -- 2.17.1