From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 589F7A046B for ; Mon, 24 Jun 2019 09:11:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 523921BEF6; Mon, 24 Jun 2019 09:11:32 +0200 (CEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by dpdk.org (Postfix) with ESMTP id 201161BCAC for ; Mon, 24 Jun 2019 09:11:31 +0200 (CEST) Received: by mail-pf1-f177.google.com with SMTP id m30so6957136pff.8 for ; Mon, 24 Jun 2019 00:11:31 -0700 (PDT) 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=XbEFLvRXpExgKOHiwUUI3mQzanBKxUZXfUxPSX+zRx8=; b=V0tWerWKYyVD9mJMHAv2nRLk9xxZDxhNkKWE3yjzzSt9kzkioJ12hrVw05N+Myi7FT jXgWPTyesFNuEAMoi+QREpxz1vW5cW6r93X1EO4ctDr+LKCZJh1zXL6ACBlYVSDWPLzi bAuuzusR4DuKtu7dpwvVQdgY7VhP7op6C7oiwPH3H8JIe2QB9qAHc/+Jv12OeAk7lbgb WioUcoV0mzXvQsDBmJyCeScfw36XQCgFYZpusDuKMu4nyNJe3qRjBNdkjNAinjOziiwq J3zeYVG0CwwYUKsxyOpouQZkWbBysgGDfqR5S1d3TYusHD/9pUkl6Wth8Tgg8OThYs4p xOFw== 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=XbEFLvRXpExgKOHiwUUI3mQzanBKxUZXfUxPSX+zRx8=; b=Ud39ICa4/pxSklmoR0BAR1aMUPB3efvGNryhFtV8WGeWO823hpn0rM8QmGakOeqlb7 TKwJsOi9ig8ymxrp8Hk+aV0lBVDC7dmlWAuoy4xifPjv77DcPrQ5E5NGWp3wSZWKWHLb yvLMO+gv4wnYNM+HQLdLv7ZLWDwxBn0qbtuezDvM7O+Kth+ok8g5rMdulDqL1Hh5v5WS n/3mcRFYHN7jReFm5DTN5NuHXb7HrgsMGxuahH8q9JE3Vut4VzJ4r47WM4LsavqrHhon 9m33pmufv1qJ93zxMdLAx3fiBSx5MPZo5YMhwYXUocHIuWlQEMk5jeox36Eq3AwhYQhT LHoQ== X-Gm-Message-State: APjAAAW7m87jnGBTmPWrtxwVzbX95TUpQSOHVt+DgsE+gGvPCFfWDCXQ P+KX0Qqw4fPcQ13EmVRKRb60rw69 X-Google-Smtp-Source: APXvYqyHbwR6z4Ar7VqOWttWhXu5A1Ympgoi6la2JSQs47i1EKnkodlUpsgh8EmgcjGJOk7gioisVw== X-Received: by 2002:a63:a046:: with SMTP id u6mr15682935pgn.122.1561360290232; Mon, 24 Jun 2019 00:11:30 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y17sm6357948pfe.148.2019.06.24.00.11.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 00:11:29 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 24 Jun 2019 16:11:15 +0900 Message-Id: <20190624071124.23451-2-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624071124.23451-1-yasufum.o@gmail.com> References: <20190624071124.23451-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 01/10] controller: move vf help msg to SppVf.help 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 SPP CLI is implemented with python's cmd library and help message is defined as a comment of `do_*` method. However, total number of lines tends to be a large number if the number of command is increased. To avoid such a situation, this update is to move comment of `do_vf` to `SppVf.help` to reduce the number of lines. Signed-off-by: Yasufumi Ogawa --- src/controller/commands/vf.py | 54 +++++++++++++++++++++++++++++++++++ src/controller/shell.py | 46 ++++------------------------- 2 files changed, 59 insertions(+), 41 deletions(-) diff --git a/src/controller/commands/vf.py b/src/controller/commands/vf.py index b673f0f..c6192e0 100644 --- a/src/controller/commands/vf.py +++ b/src/controller/commands/vf.py @@ -501,3 +501,57 @@ class SppVf(object): if 'RES_UID'.startswith(sub_tokens[5]): res.append('RES_UID') return res + + @classmethod + def help(cls): + msg = """Send a command to spp_vf. + + SPP VF is a secondary process for pseudo SR-IOV features. This + command has four sub commands. + * status + * component + * port + * classifier_table + + Each of sub commands other than 'status' takes several parameters + for detailed operations. Notice that 'start' for launching a worker + is replaced with 'stop' for terminating. 'add' is also replaced with + 'del' for deleting. + + Examples: + + # (1) show status of worker threads and resources + spp > vf 1; status + + # (2) launch or terminate a worker thread with arbitrary name + # NAME: arbitrary name used as identifier + # CORE_ID: one of unused cores referred from status + # ROLE: role of workers, 'forward', 'merge' or 'classifier_mac' + spp > vf 1; component start NAME CORE_ID ROLE + spp > vf 1; component stop NAME CORE_ID ROLE + + # (3) add or delete a port to worker of NAME + # RES_UID: resource UID such as 'ring:0' or 'vhost:1' + # DIR: 'rx' or 'tx' + spp > vf 1; port add RES_UID DIR NAME + spp > vf 1; port del RES_UID DIR NAME + + # (4) add or delete a port with vlan ID to worker of NAME + # VID: vlan ID + # PCP: priority code point defined in IEEE 802.1p + spp > vf 1; port add RES_UID DIR NAME add_vlantag VID PCP + spp > vf 1; port del RES_UID DIR NAME add_vlantag VID PCP + + # (5) add a port of deleting vlan tag + spp > vf 1; port add RES_UID DIR NAME del_vlantag + + # (6) add or delete an entry of MAC address and resource to classify + spp > vf 1; classifier_table add mac MAC_ADDR RES_UID + spp > vf 1; classifier_table del mac MAC_ADDR RES_UID + + # (7) add or delete an entry of MAC address and resource with vlan ID + spp > vf 1; classifier_table add vlan VID MAC_ADDR RES_UID + spp > vf 1; classifier_table del vlan VID MAC_ADDR RES_UID + """ + + print(msg) diff --git a/src/controller/shell.py b/src/controller/shell.py index 057f70a..75dabaa 100644 --- a/src/controller/shell.py +++ b/src/controller/shell.py @@ -406,52 +406,12 @@ class Shell(cmd.Cmd, object): def do_vf(self, cmd): """Send a command to spp_vf. - SPP VF is a secondary process for pseudo SR-IOV features. This + spp_vf is a secondary process for pseudo SR-IOV features. This command has four sub commands. * status * component * port * classifier_table - - Each of sub commands other than 'status' takes several parameters - for detailed operations. Notice that 'start' for launching a worker - is replaced with 'stop' for terminating. 'add' is also replaced with - 'del' for deleting. - - Examples: - - # (1) show status of worker threads and resources - spp > vf 1; status - - # (2) launch or terminate a worker thread with arbitrary name - # NAME: arbitrary name used as identifier - # CORE_ID: one of unused cores referred from status - # ROLE: role of workers, 'forward', 'merge' or 'classifier_mac' - spp > vf 1; component start NAME CORE_ID ROLE - spp > vf 1; component stop NAME CORE_ID ROLE - - # (3) add or delete a port to worker of NAME - # RES_UID: resource UID such as 'ring:0' or 'vhost:1' - # DIR: 'rx' or 'tx' - spp > vf 1; port add RES_UID DIR NAME - spp > vf 1; port del RES_UID DIR NAME - - # (4) add or delete a port with vlan ID to worker of NAME - # VID: vlan ID - # PCP: priority code point defined in IEEE 802.1p - spp > vf 1; port add RES_UID DIR NAME add_vlantag VID PCP - spp > vf 1; port del RES_UID DIR NAME add_vlantag VID PCP - - # (5) add a port of deleting vlan tag - spp > vf 1; port add RES_UID DIR NAME del_vlantag - - # (6) add or delete an entry of MAC address and resource to classify - spp > vf 1; classifier_table add mac MAC_ADDR RES_UID - spp > vf 1; classifier_table del mac MAC_ADDR RES_UID - - # (7) add or delete an entry of MAC address and resource with vlan ID - spp > vf 1; classifier_table add vlan VID MAC_ADDR RES_UID - spp > vf 1; classifier_table del vlan VID MAC_ADDR RES_UID """ # remove unwanted spaces to avoid invalid command error @@ -466,6 +426,10 @@ class Shell(cmd.Cmd, object): else: print('Invalid command: %s' % tmparg) + def help_vf(self): + """Print help message of spp_vf.""" + vf.SppVf.help() + def complete_vf(self, text, line, begidx, endidx): """Completion for vf command.""" -- 2.17.1