From patchwork Mon Mar 30 16:00:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 67441 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05E3CA057B; Mon, 30 Mar 2020 18:00:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 744FE1BFD4; Mon, 30 Mar 2020 18:00:32 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id E7A942B8B for ; Mon, 30 Mar 2020 18:00:30 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02UFuqvK016073; Mon, 30 Mar 2020 09:00:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=rIblLsFu3DhvTdo9rYzAXGVkq6K1XhX9ACBMeCR9+zw=; b=Gw6SDkZ+oDP5Z4WC5Gb8wkof060JRsfv8xmYCmvuKlz6PEX4/EBv8gyyzmHjoke1xwlp 4E97sNuDHKJ6Hff0u4v+0OcfH61odLz1+M7u7yGMnaVfSSd77trmMpHotLM5wfe4Pc0v t5jAgvTg6L/GLHrO/kYePCIThtOkJInGAGYX5whIg75CPotxCn2EqXVBJX3alqWwD30G BiWx1s7G+X0Tadk4Zxg22XfrbWwgEaXMjllGEb8U3izqMh2RdfrZzUYHzAwu525jTtjd nzy93GqgsfWJ3yUyR5sOVQXuP8I4IHoQnngIPVpVTsW1OKq4cD8Qu5C2pp4zBd4pg4Iz nw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3023xny1sq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2020 09:00:29 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 30 Mar 2020 09:00:28 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 30 Mar 2020 09:00:28 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 2E2993F7043; Mon, 30 Mar 2020 09:00:25 -0700 (PDT) From: Nithin Dabilpuram To: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" CC: , , , "Nithin Dabilpuram" Date: Mon, 30 Mar 2020 21:30:18 +0530 Message-ID: <20200330160019.29674-1-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-03-30_07:2020-03-30, 2020-03-30 signatures=0 Subject: [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some NIC hardware have private shaper attached to every node and has a limitation where packet mode is applied both to the scheduling of a node's children using WFQ and shaping of traffic out of the private shaper. This cannot be expressed using existing capabilities or configurations. So this patch adds a tm capability that if set by a PMD implies that packet mode when configured is even applied to private shaper connected to that node. This also implies the limitation that all the SP children of that node should have same mode at any point of time i.e either packet mode or byte mode and same applies to private shaper in that NIC PMD. This patch also adds missing capability that tells whether PMD supports wfq weight mode or not. Signed-off-by: Nithin Dabilpuram --- lib/librte_ethdev/rte_tm.h | 62 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h index f9c0cf3..50bcea6 100644 --- a/lib/librte_ethdev/rte_tm.h +++ b/lib/librte_ethdev/rte_tm.h @@ -339,6 +339,20 @@ struct rte_tm_capabilities { */ uint32_t sched_wfq_weight_max; + /** WFQ weight mode supported. Non-zero value indicates wfq weight mode + * is supported and a SP child (even a wfq group) can be configured to + * use packet-mode or byte-mode for weight calculations. + */ + int sched_wfq_weight_mode_supported; + + /** Private shaper and scheduler weight mode. + * When non-zero value indicates that all SP children should have + * same weight mode and the same mode applies to private + * shaper as well. This is only valid if + * *sched_wfq_weight_mode_supported* is set. + */ + int sched_shaper_private_weight_mode; + /** WRED packet mode support. When non-zero, this parameter indicates * that there is at least one leaf node that supports the WRED packet * mode, which might not be true for all the leaf nodes. In packet @@ -554,6 +568,21 @@ struct rte_tm_level_capabilities { */ uint32_t sched_wfq_weight_max; + /** WFQ weight mode supported. Non-zero value indicates + * wfq weight mode is supported and a SP child + * (even a wfq group) can be configured to use + * packet-mode or byte-mode for weight calculations. + */ + int sched_wfq_weight_mode_supported; + + /** Private shaper and scheduler weight mode. + * When non-zero value indicates that all SP children + * should have same weight mode and the same mode + * applies to private shaper as well. This is only + * valid if *sched_wfq_weight_mode_supported* is set. + */ + int sched_shaper_private_weight_mode; + /** Mask of statistics counter types supported by the * non-leaf nodes on this level. Every supported * statistics counter type is supported by at least one @@ -735,6 +764,21 @@ struct rte_tm_node_capabilities { * WFQ weight, so WFQ is reduced to FQ. */ uint32_t sched_wfq_weight_max; + + /** WFQ weight mode supported. Non-zero value indicates + * wfq weight mode is supported and a SP child + * (even a wfq group) can be configured to use + * packet-mode or byte-mode for weight calculations. + */ + int sched_wfq_weight_mode_supported; + + /** Private shaper and scheduler weight mode. + * When non-zero value indicates that all SP children + * should have same weight mode and the same mode + * applies to private shaper as well. This is only + * valid if *sched_wfq_weight_mode_supported* is set. + */ + int sched_shaper_private_weight_mode; } nonleaf; /** Items valid only for leaf nodes. */ @@ -836,10 +880,19 @@ struct rte_tm_wred_params { * Token bucket */ struct rte_tm_token_bucket { - /** Token bucket rate (bytes per second) */ + /** Token bucket rate. This is in "bytes per second" by default. + * For private shaper attached to node that is set in packet mode + * and tm capability *sched_shaper_private_weight_mode* is set, + * this is interpreted as "packets per second". + */ uint64_t rate; - /** Token bucket size (bytes), a.k.a. max burst size */ + /** Token bucket size, a.k.a. max burst size. + * This is in "bytes" by default. + * For private shaper attached to node that is set in packet mode + * and tm capability *sched_shaper_private_weight_mode* is set, + * this is interpreted as "packets". + */ uint64_t size; }; @@ -924,7 +977,10 @@ struct rte_tm_node_params { * indicates that WFQ is to be used for all priorities. * When non-NULL, it points to a pre-allocated array of * *n_sp_priorities* values, with non-zero value for - * byte-mode and zero for packet-mode. + * byte-mode and zero for packet-mode. The same mode is + * used for private shaper connected to this node if + * tm capability *sched_shaper_private_weight_mode* is + * true. */ int *wfq_weight_mode; From patchwork Mon Mar 30 16:00:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 67442 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7ACFBA057B; Mon, 30 Mar 2020 18:00:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F02F1C032; Mon, 30 Mar 2020 18:00:35 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id BB5181C031 for ; Mon, 30 Mar 2020 18:00:34 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02UG07mM006199; Mon, 30 Mar 2020 09:00:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=JXUXwnmp2CmXZSid0kTAILkqlAGPWntyHj8wyxpcSJ8=; b=C09AGrA5SOqN4CvamkPCZWHwRPFT+P+Ylr83W/pinzSkoA6Y4JycXqRKT6+YqQkNDJcx Wrnp6FCVOPDxmnaKVgO4lslFMkWns7feRHBpRlSalMiXnm5rYJeP1bKFSv4Nk8Qh2BcL tqcE95AO1TIktSJ0XhCOjqNnYW0y/z5nKI0mcQkm+KCKA4kEhJ0juB41mZ6eyEITHBw0 XCfBv744y4tnlGNZaDlZNYqD+qNllPBacqwR/jqEre9UPG5P3wkkflUqprcNK/sXfxS/ Mqrz0pmXUm6TIWQbC7XWl6qBYuCecjVHR8E6CYegH8f8B21WnDoruQZqNRrjP+5bQQ1O rw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 30263kems4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 30 Mar 2020 09:00:34 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 30 Mar 2020 09:00:31 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 30 Mar 2020 09:00:31 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 54D0C3F7040; Mon, 30 Mar 2020 09:00:29 -0700 (PDT) From: Nithin Dabilpuram To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic CC: , , , "Nithin Dabilpuram" Date: Mon, 30 Mar 2020 21:30:19 +0530 Message-ID: <20200330160019.29674-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20200330160019.29674-1-ndabilpuram@marvell.com> References: <20200330160019.29674-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-03-30_07:2020-03-30, 2020-03-30 signatures=0 Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add TM command to enable packet mode for all SP children in non leaf node. This is a new command as "add tm nonleaf node pktmode". This patch also dumps new tm capabilities "sched_wfq_weight_mode_supported" and "sched_shaper_private_weight_mode". Signed-off-by: Nithin Dabilpuram --- app/test-pmd/cmdline.c | 7 ++ app/test-pmd/cmdline_tm.c | 178 ++++++++++++++++++++++++++++ app/test-pmd/cmdline_tm.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 27 +++++ 4 files changed, 213 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a037a55..eba79f1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1221,6 +1221,12 @@ static void cmd_help_long_parsed(void *parsed_result, " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" " Add port tm nonleaf node.\n\n" + "add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id)" + " (priority) (weight) (level_id) (shaper_profile_id)" + " (n_sp_priorities) (stats_mask) (n_shared_shapers)" + " [(shared_shaper_id_0) (shared_shaper_id_1)...]\n" + " Add port tm nonleaf node with pkt mode enabled.\n\n" + "add port tm leaf node (port_id) (node_id) (parent_node_id)" " (priority) (weight) (level_id) (shaper_profile_id)" " (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers)" @@ -19583,6 +19589,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_del_port_tm_node_wred_profile, (cmdline_parse_inst_t *)&cmd_set_port_tm_node_shaper_profile, (cmdline_parse_inst_t *)&cmd_add_port_tm_nonleaf_node, + (cmdline_parse_inst_t *)&cmd_add_port_tm_nonleaf_node_pmode, (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, diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index d62a4f5..269a4b1 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -283,6 +283,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result, cap.sched_wfq_n_groups_max); printf("cap.sched_wfq_weight_max %" PRIu32 "\n", cap.sched_wfq_weight_max); + printf("cap.sched_wfq_weight_mode_supported %" PRId32 "\n", + cap.sched_wfq_weight_mode_supported); + printf("cap.sched_shaper_private_weight_mode %" PRId32 "\n", + cap.sched_shaper_private_weight_mode); printf("cap.cman_head_drop_supported %" PRId32 "\n", cap.cman_head_drop_supported); printf("cap.cman_wred_context_n_max %" PRIu32 "\n", @@ -413,6 +417,10 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result, lcap.nonleaf.sched_wfq_n_groups_max); printf("cap.nonleaf.sched_wfq_weight_max %" PRIu32 "\n", lcap.nonleaf.sched_wfq_weight_max); + printf("cap.nonleaf.sched_wfq_weight_mode_supported %" PRId32 "\n", + lcap.nonleaf.sched_wfq_weight_mode_supported); + printf("cap.nonleaf.sched_shaper_private_weight_mode %" PRId32 "\n", + lcap.nonleaf.sched_shaper_private_weight_mode); printf("cap.nonleaf.stats_mask %" PRIx64 "\n", lcap.nonleaf.stats_mask); } else { @@ -537,6 +545,10 @@ static void cmd_show_port_tm_node_cap_parsed(void *parsed_result, ncap.nonleaf.sched_wfq_n_groups_max); printf("cap.nonleaf.sched_wfq_weight_max %" PRIu32 "\n", ncap.nonleaf.sched_wfq_weight_max); + printf("cap.nonleaf.sched_wfq_weight_mode_supported %" PRId32 "\n", + ncap.nonleaf.sched_wfq_weight_mode_supported); + printf("cap.nonleaf.sched_shaper_private_weight_mode %" PRId32 "\n", + ncap.nonleaf.sched_shaper_private_weight_mode); } else { printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n", ncap.leaf.cman_head_drop_supported); @@ -1671,6 +1683,172 @@ cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node = { }, }; +/* *** Add Port TM nonleaf node pkt mode *** */ +struct cmd_add_port_tm_nonleaf_node_pmode_result { + cmdline_fixed_string_t add; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t nonleaf; + cmdline_fixed_string_t node; + uint16_t port_id; + uint32_t node_id; + int32_t parent_node_id; + uint32_t priority; + uint32_t weight; + uint32_t level_id; + int32_t shaper_profile_id; + uint32_t n_sp_priorities; + uint64_t stats_mask; + cmdline_multi_string_t multi_shared_shaper_id; +}; + +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_add = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, add, "add"); +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_port = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, port, "port"); +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_tm = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, tm, "tm"); +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_nonleaf = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, nonleaf, "nonleaf"); +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_node = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, node, "node"); +cmdline_parse_token_string_t cmd_add_port_tm_nonleaf_node_pmode_pktmode = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, node, "pktmode"); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_port_id = + TOKEN_NUM_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, + port_id, UINT16); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_node_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + node_id, UINT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_parent_node_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + parent_node_id, INT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_priority = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + priority, UINT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_weight = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + weight, UINT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_level_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + level_id, UINT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_shaper_profile_id = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + shaper_profile_id, INT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_n_sp_priorities = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + n_sp_priorities, UINT32); +cmdline_parse_token_num_t cmd_add_port_tm_nonleaf_node_pmode_stats_mask = + TOKEN_NUM_INITIALIZER(struct cmd_add_port_tm_nonleaf_node_pmode_result, + stats_mask, UINT64); +cmdline_parse_token_string_t + cmd_add_port_tm_nonleaf_node_pmode_multi_shrd_shpr_id = + TOKEN_STRING_INITIALIZER( + struct cmd_add_port_tm_nonleaf_node_pmode_result, + multi_shared_shaper_id, TOKEN_STRING_MULTI); + +static void cmd_add_port_tm_nonleaf_node_pmode_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_add_port_tm_nonleaf_node_pmode_result *res = parsed_result; + uint32_t parent_node_id, n_shared_shapers = 0; + char *s_str = res->multi_shared_shaper_id; + portid_t port_id = res->port_id; + struct rte_tm_node_params np; + int *wfq_weight_mode = NULL; + uint32_t *shared_shaper_id; + struct rte_tm_error error; + int ret; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + memset(&np, 0, sizeof(struct rte_tm_node_params)); + memset(&error, 0, sizeof(struct rte_tm_error)); + + /* Node parameters */ + if (res->parent_node_id < 0) + parent_node_id = UINT32_MAX; + else + parent_node_id = res->parent_node_id; + + shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS * + sizeof(uint32_t)); + if (shared_shaper_id == NULL) { + printf(" Memory not allocated for shared shapers (error)\n"); + return; + } + + /* Parse multi shared shaper id string */ + ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id); + if (ret) { + printf(" Shared shapers params string parse error\n"); + free(shared_shaper_id); + return; + } + + if (res->shaper_profile_id < 0) + np.shaper_profile_id = UINT32_MAX; + else + np.shaper_profile_id = res->shaper_profile_id; + + np.n_shared_shapers = n_shared_shapers; + if (np.n_shared_shapers) { + np.shared_shaper_id = &shared_shaper_id[0]; + } else { + free(shared_shaper_id); + shared_shaper_id = NULL; + } + + if (res->n_sp_priorities) + wfq_weight_mode = calloc(res->n_sp_priorities, sizeof(int)); + np.nonleaf.n_sp_priorities = res->n_sp_priorities; + np.stats_mask = res->stats_mask; + np.nonleaf.wfq_weight_mode = wfq_weight_mode; + + ret = rte_tm_node_add(port_id, res->node_id, parent_node_id, + res->priority, res->weight, res->level_id, + &np, &error); + if (ret != 0) { + print_err_msg(&error); + free(shared_shaper_id); + free(wfq_weight_mode); + return; + } +} + +cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node_pmode = { + .f = cmd_add_port_tm_nonleaf_node_pmode_parsed, + .data = NULL, + .help_str = "Add port tm nonleaf node pktmode", + .tokens = { + (void *)&cmd_add_port_tm_nonleaf_node_pmode_add, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_port, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_tm, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_nonleaf, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_node, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_pktmode, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_port_id, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_node_id, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_parent_node_id, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_priority, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_weight, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_level_id, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_shaper_profile_id, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_n_sp_priorities, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_stats_mask, + (void *)&cmd_add_port_tm_nonleaf_node_pmode_multi_shrd_shpr_id, + NULL, + }, +}; /* *** Add Port TM leaf node *** */ struct cmd_add_port_tm_leaf_node_result { cmdline_fixed_string_t add; diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h index 950cb75..e59c15c 100644 --- a/app/test-pmd/cmdline_tm.h +++ b/app/test-pmd/cmdline_tm.h @@ -19,6 +19,7 @@ extern cmdline_parse_inst_t cmd_add_port_tm_node_wred_profile; extern cmdline_parse_inst_t cmd_del_port_tm_node_wred_profile; extern cmdline_parse_inst_t cmd_set_port_tm_node_shaper_profile; extern cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node; +extern cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node_pmode; 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; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 5bb12a5..9072ed6 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2971,6 +2971,33 @@ where: * ``n_shared_shapers``: Number of shared shapers. * ``shared_shaper_id``: Shared shaper id. +Add port traffic management hierarchy nonleaf node with packet mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add nonleaf node with packet mode to port traffic management hierarchy:: + + testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \ + (priority) (weight) (level_id) (shaper_profile_id) \ + (n_sp_priorities) (stats_mask) (n_shared_shapers) \ + [(shared_shaper_0) (shared_shaper_1) ...] \ + +where: + +* ``parent_node_id``: Node ID of the parent. +* ``priority``: Node priority (highest node priority is zero). This is used by + the SP algorithm running on the parent node for scheduling this node. +* ``weight``: Node weight (lowest weight is one). The node weight is relative + to the weight sum of all siblings that have the same priority. It is used by + the WFQ algorithm running on the parent node for scheduling this node. +* ``level_id``: Hierarchy level of the node. +* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by + the node. +* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on + all of them. +* ``stats_mask``: Mask of statistics counter types to be enabled for this node. +* ``n_shared_shapers``: Number of shared shapers. +* ``shared_shaper_id``: Shared shaper id. + Add port traffic management hierarchy leaf node ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~