From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 39EB4DE0 for ; Mon, 19 Feb 2018 08:46:31 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id 70so5760826lfw.2 for ; Sun, 18 Feb 2018 23:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rFz8IbwnRYVdc5AXSASr27pjgXqKSE5BxZlyNd1Kyt8=; b=WdqZCnPu5xEV3rpKg/X3uudmW/EVYmTNj0wyObfzhjporYgyIhgspV/jpp3jHsyyoH QeNdxF590TezYEfihqHcNSklYJgY0N/zBjBKz7++wTKQq8olsx1n7HITGKBSkhppJ4Ir H670jNSXwIiX+OufnLj7Avyb9II7LefuJfK2asEqjfYrWsGzXl9OsKr+bLuucrakeaD9 a5U1UTIAfgY66WfsB0ro/BkwuNInQFQONt3kyk4rI26zP/dbZtccHud8fSVCOOtk0hJE Uku+M5LXloOEgeW+YIKJQRuNFA4Crh1yc79OEvWHpofoyhy0UIyvLlFJCERkEiPOgaFj nvag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rFz8IbwnRYVdc5AXSASr27pjgXqKSE5BxZlyNd1Kyt8=; b=PfJvm872qrt9+Pdh8GxeJ9EtoEihdlPfVBSDO/jP4ad1J03Z65pDWx41/NrfD6/xz3 3DenBuDWcQmEi7jMQGsoArDfrcd2LrKZNskjixMRGs+fJzhaFTPbCxjofr++Ij4Zh0iY /EFpKgi676rOLfj/rvpa1DnYpZgzr7ui8wZMvu+bKgQhb0mcgjIQ/NNDOW8v3vYYq0Tb WbL3dNAeL6SY6pQ/CiNQwHh5cCarzy/SgcLr/sMmlfGb77Nh36RUBwMyC1CdZpfJZmhs QcHfvIFAuueaEKUkK3RS33JyJixWP/GwRKcQni+feTjU5kebn1SXtQ/i7PDsJD4neNYq HsGg== X-Gm-Message-State: APf1xPDSjop0+xvEAciGNKole6jtjj2XmKRCUTChV60UXxkW+5aVCEai My1Cu2KZAuQXW+LjmIsikbtCOsz7w0s= X-Google-Smtp-Source: AH8x227HlAdU/nguUfxe0RovYxUBGNHyhvhMjrnlZ5+KXVd6aFeRwlN5B/9v4VGc9fMdU5+33dOmng== X-Received: by 10.46.33.156 with SMTP id h28mr1819049lji.126.1519026390458; Sun, 18 Feb 2018 23:46:30 -0800 (PST) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id y3sm2284259ljy.28.2018.02.18.23.46.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Feb 2018 23:46:29 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, jasvinder.singh@intel.com, Tomasz Duszynski Date: Mon, 19 Feb 2018 08:46:18 +0100 Message-Id: <1519026379-7924-2-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519026379-7924-1-git-send-email-tdu@semihalf.com> References: <1517477799-18946-1-git-send-email-tdu@semihalf.com> <1519026379-7924-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add command to suspend a TM node X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 07:46:31 -0000 Traffic manager provides an API for suspending an arbitrary node in a hierarchy. This commit adds support for calling this API from testpmd. Signed-off-by: Tomasz Duszynski Reviewed-by: Jasvinder Singh --- app/test-pmd/cmdline.c | 4 ++ app/test-pmd/cmdline_tm.c | 64 +++++++++++++++++++++++++++++ app/test-pmd/cmdline_tm.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ 4 files changed, 74 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1dc1de..8e17f20 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -771,6 +771,9 @@ static void cmd_help_long_parsed(void *parsed_result, " (priority) (weight)\n" " Set port tm node parent.\n\n" + "suspend port tm node (port_id) (node_id)" + " Suspend tm node.\n\n" + "port tm hierarchy commit (port_id) (clean_on_fail)\n" " Commit tm hierarchy.\n\n" @@ -16271,6 +16274,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_add_port_tm_leaf_node, (cmdline_parse_inst_t *)&cmd_del_port_tm_node, (cmdline_parse_inst_t *)&cmd_set_port_tm_node_parent, + (cmdline_parse_inst_t *)&cmd_suspend_port_tm_node, (cmdline_parse_inst_t *)&cmd_port_tm_hierarchy_commit, NULL, }; diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index 35cad54..daa912a 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -1958,6 +1958,70 @@ cmdline_parse_inst_t cmd_set_port_tm_node_parent = { }, }; +/* *** Suspend Port TM Node *** */ +struct cmd_suspend_port_tm_node_result { + cmdline_fixed_string_t suspend; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t node; + uint16_t port_id; + uint32_t node_id; +}; + +cmdline_parse_token_string_t cmd_suspend_port_tm_node_suspend = + TOKEN_STRING_INITIALIZER( + struct cmd_suspend_port_tm_node_result, suspend, "suspend"); +cmdline_parse_token_string_t cmd_suspend_port_tm_node_port = + TOKEN_STRING_INITIALIZER( + struct cmd_suspend_port_tm_node_result, port, "port"); +cmdline_parse_token_string_t cmd_suspend_port_tm_node_tm = + TOKEN_STRING_INITIALIZER( + struct cmd_suspend_port_tm_node_result, tm, "tm"); +cmdline_parse_token_string_t cmd_suspend_port_tm_node_node = + TOKEN_STRING_INITIALIZER( + struct cmd_suspend_port_tm_node_result, node, "node"); +cmdline_parse_token_num_t cmd_suspend_port_tm_node_port_id = + TOKEN_NUM_INITIALIZER( + struct cmd_suspend_port_tm_node_result, port_id, UINT16); +cmdline_parse_token_num_t cmd_suspend_port_tm_node_node_id = + TOKEN_NUM_INITIALIZER( + struct cmd_suspend_port_tm_node_result, node_id, UINT32); + +static void cmd_suspend_port_tm_node_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_suspend_port_tm_node_result *res = parsed_result; + struct rte_tm_error error; + uint32_t node_id = res->node_id; + portid_t port_id = res->port_id; + int ret; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + ret = rte_tm_node_suspend(port_id, node_id, &error); + if (ret != 0) { + print_err_msg(&error); + return; + } +} + +cmdline_parse_inst_t cmd_suspend_port_tm_node = { + .f = cmd_suspend_port_tm_node_parsed, + .data = NULL, + .help_str = "Suspend port tm node", + .tokens = { + (void *)&cmd_suspend_port_tm_node_suspend, + (void *)&cmd_suspend_port_tm_node_port, + (void *)&cmd_suspend_port_tm_node_tm, + (void *)&cmd_suspend_port_tm_node_node, + (void *)&cmd_suspend_port_tm_node_port_id, + (void *)&cmd_suspend_port_tm_node_node_id, + NULL, + }, +}; + /* *** Port TM Hierarchy Commit *** */ struct cmd_port_tm_hierarchy_commit_result { cmdline_fixed_string_t port; diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h index ba30360..c4d5e8c 100644 --- a/app/test-pmd/cmdline_tm.h +++ b/app/test-pmd/cmdline_tm.h @@ -22,6 +22,7 @@ extern cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node; extern cmdline_parse_inst_t cmd_add_port_tm_leaf_node; extern cmdline_parse_inst_t cmd_del_port_tm_node; extern cmdline_parse_inst_t cmd_set_port_tm_node_parent; +extern cmdline_parse_inst_t cmd_suspend_port_tm_node; extern cmdline_parse_inst_t cmd_port_tm_hierarchy_commit; #endif /* _CMDLINE_TM_H_ */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index a766ac7..38682ea 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2483,6 +2483,11 @@ success depends on the port support for this operation, as advertised through the port capability set. This function is valid for all nodes of the traffic management hierarchy except root node. +Suspend port traffic management hierarchy node +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + testpmd> suspend port tm node (port_id) (node_id) + Commit port traffic management hierarchy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.7.4