DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
@ 2020-03-30 16:00 Nithin Dabilpuram
  2020-03-30 16:00 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command Nithin Dabilpuram
                   ` (6 more replies)
  0 siblings, 7 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-03-30 16:00 UTC (permalink / raw)
  To: Cristian Dumitrescu, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

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 <ndabilpuram@marvell.com>
---
 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;
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
@ 2020-03-30 16:00 ` Nithin Dabilpuram
  2020-04-07  7:30 ` [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-03-30 16:00 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

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 <ndabilpuram@marvell.com>
---
 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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
  2020-03-30 16:00 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command Nithin Dabilpuram
@ 2020-04-07  7:30 ` Nithin Dabilpuram
  2020-04-07 16:31 ` Dumitrescu, Cristian
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-07  7:30 UTC (permalink / raw)
  To: Cristian Dumitrescu, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas

Ping.

On Mon, Mar 30, 2020 at 09:30:18PM +0530, Nithin Dabilpuram wrote:
> 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 <ndabilpuram@marvell.com>
> ---
>  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;
>  
> -- 
> 2.8.4
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
  2020-03-30 16:00 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command Nithin Dabilpuram
  2020-04-07  7:30 ` [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
@ 2020-04-07 16:31 ` Dumitrescu, Cristian
  2020-04-07 17:21   ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-07 16:31 UTC (permalink / raw)
  To: Nithin Dabilpuram, Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko
  Cc: dev, jerinj, kkanas

Hi Nithin,

> -----Original Message-----
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Sent: Monday, March 30, 2020 5:00 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
> 
> 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 <ndabilpuram@marvell.com>
> ---
>  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;
> +

This is incorrect, as the WFQ support, including the weight aspect of WFQ, is already part of the existing set of capabilities: see sched_wfq_weight_max and the other sched_wfq_* capability fields.

> +	/** 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;
> +

If I understand your intention correctly, you are trying to introduce packet mode (in addition to the existing byte mode) for (1) scheduler WFQ weights and for (2) shaper rates. Basically, the ability to express WFQ weights in bytes as well as packets, and the ability to express shaper rates in bytes and well as packets. Is this correct?

Assuming yes, we probably need to do it in a slightly different way:
1/ Similar to the WRED packet mode that was introduced by Nikhil Rao's patches a while ago (in addition to WRED's byte mode), see WRED capability and configuration.
2/ Decouple between scheduler and shaper. So we should add sched_* fields and shaper_* fields, but never sched_shaper_*, as it creates a functional dependency that does not exist.

In line with methodology already used for WRED, I suggest:
a) Scheduler WFQ capabilities (TM/level/node): sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported
b) Shaper capabilities (TM/level/node): shaper_rate_packet_mode_supported, shaper_rate_byte_mode_supported.
c) Shaper profile (struct rte_tm_shaper_params): add an integer packet_mode flag with 0 = byte-mode (default) and 1 = packet mode for the values in struct rte_tm_token_bucket.

It is important to note that the API must allow a combination of packet mode and byte mode (for different nodes, not for the same), but an implementation can support either a single mode or both (should be enforced by the driver).

>  	/** 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

See above the comments on TM capabilities.

> @@ -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. */

See above the comments on the TM capabilities.

> @@ -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;
>  };
> 

Comments are not correct, as API should allow a combination of both the packet mode and the byte mode (for different nodes, not for the same node), so both capabilities shaper_rate_packet_mode and shaper_rate_byte_mode can be set. Hence, the comments should not specify a capability, but the fact that these values can specify either byte or packets, depending on a flag elsewhere.

> @@ -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.
>  			 */

This comment is incorrect, as sched should not be combined with shaper. The user should select between packet mode and byte mode for the WFQ weight independently of the mode for the shaper rate, although an implementation (driver) should enforce the correct values.

>  			int *wfq_weight_mode;
> 
> --
> 2.8.4


Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
  2020-04-07 16:31 ` Dumitrescu, Cristian
@ 2020-04-07 17:21   ` Nithin Dabilpuram
  2020-04-10 11:45     ` Dumitrescu, Cristian
  0 siblings, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-07 17:21 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko, dev, jerinj, kkanas

Hi Cristian,

Thanks for your comments. I have some queries below.
On Tue, Apr 07, 2020 at 04:31:47PM +0000, Dumitrescu, Cristian wrote:
> External Email
> 
> ----------------------------------------------------------------------
> Hi Nithin,
> 
> > -----Original Message-----
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > Sent: Monday, March 30, 2020 5:00 PM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <arybchenko@solarflare.com>
> > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > Dabilpuram <ndabilpuram@marvell.com>
> > Subject: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
> > 
> > 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 <ndabilpuram@marvell.com>
> > ---
> >  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;
> > +
> 
> This is incorrect, as the WFQ support, including the weight aspect of WFQ, is already part of the existing set of capabilities: see sched_wfq_weight_max and the other sched_wfq_* capability fields

This is a missing capability for an existing functionality.
"struct rte_tm_node_params:nonleaf.wfq_weight_mode" field could be used to toggle between
packet-mode or byte-mode for WFQ weights. 

The field if NULL also says that mode defaults to byte-mode.

> 
> > +	/** 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;
> > +
> 
> If I understand your intention correctly, you are trying to introduce packet mode (in addition to the existing byte mode) for (1) scheduler WFQ weights and for (2) shaper rates. Basically, the ability to express WFQ weights in bytes as well as packets, and the ability to express shaper rates in bytes and well as packets. Is this correct?

Isn't packet mode for (1) already supported via
"struct rte_tm_node_params:nonleaf.wfq_weight_mode" and
rte_tm_node_wfq_weight_mode_update() ?

I'm trying to add support for packet-mode for (2).

> 
> Assuming yes, we probably need to do it in a slightly different way:
> 1/ Similar to the WRED packet mode that was introduced by Nikhil Rao's patches a while ago (in addition to WRED's byte mode), see WRED capability and configuration.
> 2/ Decouple between scheduler and shaper. So we should add sched_* fields and shaper_* fields, but never sched_shaper_*, as it creates a functional dependency that does not exist.
> 
> In line with methodology already used for WRED, I suggest:
> a) Scheduler WFQ capabilities (TM/level/node): sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported

I'll add "sched_wfq_packet_mode_supported" field.

Since currently when "struct rte_tm_node_params:nonleaf.wfq_weight_mode" is NULL,
mode defaults to byte mode, is it needed to have "sched_wfq_byte_mode_supported" ?
Or I should also update the text in "struct rte_tm_node_params" ?


> b) Shaper capabilities (TM/level/node): shaper_rate_packet_mode_supported, shaper_rate_byte_mode_supported.
Ack.
> c) Shaper profile (struct rte_tm_shaper_params): add an integer packet_mode flag with 0 = byte-mode (default) and 1 = packet mode for the values in struct rte_tm_token_bucket.

Ok. I'll add a field "packet-mode" in rte_tm_shaper_params and enforce restrictions in PMD.
> 
> It is important to note that the API must allow a combination of packet mode and byte mode (for different nodes, not for the same), but an implementation can support either a single mode or both (should be enforced by the driver).
> 
> >  	/** 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
> 
> See above the comments on TM capabilities.
> 
> > @@ -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. */
> 
> See above the comments on the TM capabilities.
> 
> > @@ -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;
> >  };
> > 
> 
> Comments are not correct, as API should allow a combination of both the packet mode and the byte mode (for different nodes, not for the same node), so both capabilities shaper_rate_packet_mode and shaper_rate_byte_mode can be set. Hence, the comments should not specify a capability, but the fact that these values can specify either byte or packets, depending on a flag elsewhere.

Ok. As per your above comment I'll add field "packet-mode" in "struct rte_tm_shaper_params" and update this comment accordingly.
> 
> > @@ -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.
> >  			 */
> 
> This comment is incorrect, as sched should not be combined with shaper. The user should select between packet mode and byte mode for the WFQ weight independently of the mode for the shaper rate, although an implementation (driver) should enforce the correct values.
> 
> >  			int *wfq_weight_mode;
> > 
> > --
> > 2.8.4
> 
> 
> Regards,
> Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
  2020-04-07 17:21   ` [dpdk-dev] [EXT] " Nithin Dabilpuram
@ 2020-04-10 11:45     ` Dumitrescu, Cristian
  2020-04-10 11:56       ` Nithin Dabilpuram
  0 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-10 11:45 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko, dev, jerinj, kkanas



> -----Original Message-----
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Sent: Tuesday, April 7, 2020 6:21 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Andrew Rybchenko
> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> kkanas@marvell.com
> Subject: Re: [EXT] RE: [PATCH 1/2] ethdev: add tm cap for private shaper
> packet mode
> 
> Hi Cristian,
> 
> Thanks for your comments. I have some queries below.
> On Tue, Apr 07, 2020 at 04:31:47PM +0000, Dumitrescu, Cristian wrote:
> > External Email
> >
> > ----------------------------------------------------------------------
> > Hi Nithin,
> >
> > > -----Original Message-----
> > > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > Sent: Monday, March 30, 2020 5:00 PM
> > > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas
> Monjalon
> > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Andrew
> > > Rybchenko <arybchenko@solarflare.com>
> > > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > > Dabilpuram <ndabilpuram@marvell.com>
> > > Subject: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
> > >
> > > 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 <ndabilpuram@marvell.com>
> > > ---
> > >  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;
> > > +
> >
> > This is incorrect, as the WFQ support, including the weight aspect of WFQ, is
> already part of the existing set of capabilities: see sched_wfq_weight_max
> and the other sched_wfq_* capability fields
> 
> This is a missing capability for an existing functionality.
> "struct rte_tm_node_params:nonleaf.wfq_weight_mode" field could be
> used to toggle between
> packet-mode or byte-mode for WFQ weights.
> 
> The field if NULL also says that mode defaults to byte-mode.
> 

This capability field should be split into sched_wfq_weight_byte_mode_supported and sched_wfq_weight_packet_mode_supported.

I agree that both of these modes are already supported by the API, but not explicitly mentioned in capability structure, so I think it makes sense to add them to capabilities too. We should have the same look & feel for all the features that accept byte mode and packet mode, i.e. WFQ weight, shaper rate, WRED thresholds. Makes sense?

> >
> > > +	/** 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;
> > > +
> >
> > If I understand your intention correctly, you are trying to introduce packet
> mode (in addition to the existing byte mode) for (1) scheduler WFQ weights
> and for (2) shaper rates. Basically, the ability to express WFQ weights in bytes
> as well as packets, and the ability to express shaper rates in bytes and well as
> packets. Is this correct?
> 
> Isn't packet mode for (1) already supported via
> "struct rte_tm_node_params:nonleaf.wfq_weight_mode" and
> rte_tm_node_wfq_weight_mode_update() ?
> 
> I'm trying to add support for packet-mode for (2).
> 

See previous note.

> >
> > Assuming yes, we probably need to do it in a slightly different way:
> > 1/ Similar to the WRED packet mode that was introduced by Nikhil Rao's
> patches a while ago (in addition to WRED's byte mode), see WRED capability
> and configuration.
> > 2/ Decouple between scheduler and shaper. So we should add sched_*
> fields and shaper_* fields, but never sched_shaper_*, as it creates a
> functional dependency that does not exist.
> >
> > In line with methodology already used for WRED, I suggest:
> > a) Scheduler WFQ capabilities (TM/level/node):
> sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported
> 
> I'll add "sched_wfq_packet_mode_supported" field.
> 
> Since currently when "struct
> rte_tm_node_params:nonleaf.wfq_weight_mode" is NULL,
> mode defaults to byte mode, is it needed to have
> "sched_wfq_byte_mode_supported" ?
> Or I should also update the text in "struct rte_tm_node_params" ?
> 

See previous comment. Yes, it makes sense to add both sched_wfq_weight_byte_mode_supported and sched_wfq_weight_packet_mode_supported to capabilities structure, even though they refer to features already supported by the API. We should have the same look 7 feel for all features that support byte mode and packet mode.

> 
> > b) Shaper capabilities (TM/level/node):
> shaper_rate_packet_mode_supported,
> shaper_rate_byte_mode_supported.
> Ack.

OK, great.

> > c) Shaper profile (struct rte_tm_shaper_params): add an integer
> packet_mode flag with 0 = byte-mode (default) and 1 = packet mode for the
> values in struct rte_tm_token_bucket.
> 
> Ok. I'll add a field "packet-mode" in rte_tm_shaper_params and enforce
> restrictions in PMD.

OK, great.

> >
> > It is important to note that the API must allow a combination of packet
> mode and byte mode (for different nodes, not for the same), but an
> implementation can support either a single mode or both (should be
> enforced by the driver).
> >
> > >  	/** 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
> >
> > See above the comments on TM capabilities.
> >
> > > @@ -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. */
> >
> > See above the comments on the TM capabilities.
> >
> > > @@ -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;
> > >  };
> > >
> >
> > Comments are not correct, as API should allow a combination of both the
> packet mode and the byte mode (for different nodes, not for the same
> node), so both capabilities shaper_rate_packet_mode and
> shaper_rate_byte_mode can be set. Hence, the comments should not
> specify a capability, but the fact that these values can specify either byte or
> packets, depending on a flag elsewhere.
> 
> Ok. As per your above comment I'll add field "packet-mode" in "struct
> rte_tm_shaper_params" and update this comment accordingly.

OK, great.

> >
> > > @@ -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.
> > >  			 */
> >
> > This comment is incorrect, as sched should not be combined with shaper.
> The user should select between packet mode and byte mode for the WFQ
> weight independently of the mode for the shaper rate, although an
> implementation (driver) should enforce the correct values.
> >
> > >  			int *wfq_weight_mode;
> > >
> > > --
> > > 2.8.4
> >
> >
> > Regards,
> > Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
  2020-04-10 11:45     ` Dumitrescu, Cristian
@ 2020-04-10 11:56       ` Nithin Dabilpuram
  0 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-10 11:56 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko, dev, jerinj, kkanas

Thanks Cristian. Agree with your comments, Will send a v2 addressing them.
On Fri, Apr 10, 2020 at 11:45:06AM +0000, Dumitrescu, Cristian wrote:
> 
> 
> > -----Original Message-----
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > Sent: Tuesday, April 7, 2020 6:21 PM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > Cc: Thomas Monjalon <thomas@monjalon.net>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Andrew Rybchenko
> > <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> > kkanas@marvell.com
> > Subject: Re: [EXT] RE: [PATCH 1/2] ethdev: add tm cap for private shaper
> > packet mode
> > 
> > Hi Cristian,
> > 
> > Thanks for your comments. I have some queries below.
> > On Tue, Apr 07, 2020 at 04:31:47PM +0000, Dumitrescu, Cristian wrote:
> > > External Email
> > >
> > > ----------------------------------------------------------------------
> > > Hi Nithin,
> > >
> > > > -----Original Message-----
> > > > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > > Sent: Monday, March 30, 2020 5:00 PM
> > > > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas
> > Monjalon
> > > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > Andrew
> > > > Rybchenko <arybchenko@solarflare.com>
> > > > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > > > Dabilpuram <ndabilpuram@marvell.com>
> > > > Subject: [PATCH 1/2] ethdev: add tm cap for private shaper packet mode
> > > >
> > > > 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 <ndabilpuram@marvell.com>
> > > > ---
> > > >  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;
> > > > +
> > >
> > > This is incorrect, as the WFQ support, including the weight aspect of WFQ, is
> > already part of the existing set of capabilities: see sched_wfq_weight_max
> > and the other sched_wfq_* capability fields
> > 
> > This is a missing capability for an existing functionality.
> > "struct rte_tm_node_params:nonleaf.wfq_weight_mode" field could be
> > used to toggle between
> > packet-mode or byte-mode for WFQ weights.
> > 
> > The field if NULL also says that mode defaults to byte-mode.
> > 
> 
> This capability field should be split into sched_wfq_weight_byte_mode_supported and sched_wfq_weight_packet_mode_supported.
> 
> I agree that both of these modes are already supported by the API, but not explicitly mentioned in capability structure, so I think it makes sense to add them to capabilities too. We should have the same look & feel for all the features that accept byte mode and packet mode, i.e. WFQ weight, shaper rate, WRED thresholds. Makes sense?
> 
> > >
> > > > +	/** 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;
> > > > +
> > >
> > > If I understand your intention correctly, you are trying to introduce packet
> > mode (in addition to the existing byte mode) for (1) scheduler WFQ weights
> > and for (2) shaper rates. Basically, the ability to express WFQ weights in bytes
> > as well as packets, and the ability to express shaper rates in bytes and well as
> > packets. Is this correct?
> > 
> > Isn't packet mode for (1) already supported via
> > "struct rte_tm_node_params:nonleaf.wfq_weight_mode" and
> > rte_tm_node_wfq_weight_mode_update() ?
> > 
> > I'm trying to add support for packet-mode for (2).
> > 
> 
> See previous note.
> 
> > >
> > > Assuming yes, we probably need to do it in a slightly different way:
> > > 1/ Similar to the WRED packet mode that was introduced by Nikhil Rao's
> > patches a while ago (in addition to WRED's byte mode), see WRED capability
> > and configuration.
> > > 2/ Decouple between scheduler and shaper. So we should add sched_*
> > fields and shaper_* fields, but never sched_shaper_*, as it creates a
> > functional dependency that does not exist.
> > >
> > > In line with methodology already used for WRED, I suggest:
> > > a) Scheduler WFQ capabilities (TM/level/node):
> > sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported
> > 
> > I'll add "sched_wfq_packet_mode_supported" field.
> > 
> > Since currently when "struct
> > rte_tm_node_params:nonleaf.wfq_weight_mode" is NULL,
> > mode defaults to byte mode, is it needed to have
> > "sched_wfq_byte_mode_supported" ?
> > Or I should also update the text in "struct rte_tm_node_params" ?
> > 
> 
> See previous comment. Yes, it makes sense to add both sched_wfq_weight_byte_mode_supported and sched_wfq_weight_packet_mode_supported to capabilities structure, even though they refer to features already supported by the API. We should have the same look 7 feel for all features that support byte mode and packet mode.
> 
> > 
> > > b) Shaper capabilities (TM/level/node):
> > shaper_rate_packet_mode_supported,
> > shaper_rate_byte_mode_supported.
> > Ack.
> 
> OK, great.
> 
> > > c) Shaper profile (struct rte_tm_shaper_params): add an integer
> > packet_mode flag with 0 = byte-mode (default) and 1 = packet mode for the
> > values in struct rte_tm_token_bucket.
> > 
> > Ok. I'll add a field "packet-mode" in rte_tm_shaper_params and enforce
> > restrictions in PMD.
> 
> OK, great.
> 
> > >
> > > It is important to note that the API must allow a combination of packet
> > mode and byte mode (for different nodes, not for the same), but an
> > implementation can support either a single mode or both (should be
> > enforced by the driver).
> > >
> > > >  	/** 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
> > >
> > > See above the comments on TM capabilities.
> > >
> > > > @@ -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. */
> > >
> > > See above the comments on the TM capabilities.
> > >
> > > > @@ -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;
> > > >  };
> > > >
> > >
> > > Comments are not correct, as API should allow a combination of both the
> > packet mode and the byte mode (for different nodes, not for the same
> > node), so both capabilities shaper_rate_packet_mode and
> > shaper_rate_byte_mode can be set. Hence, the comments should not
> > specify a capability, but the fact that these values can specify either byte or
> > packets, depending on a flag elsewhere.
> > 
> > Ok. As per your above comment I'll add field "packet-mode" in "struct
> > rte_tm_shaper_params" and update this comment accordingly.
> 
> OK, great.
> 
> > >
> > > > @@ -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.
> > > >  			 */
> > >
> > > This comment is incorrect, as sched should not be combined with shaper.
> > The user should select between packet mode and byte mode for the WFQ
> > weight independently of the mode for the shaper rate, although an
> > implementation (driver) should enforce the correct values.
> > >
> > > >  			int *wfq_weight_mode;
> > > >
> > > > --
> > > > 2.8.4
> > >
> > >
> > > Regards,
> > > Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
                   ` (2 preceding siblings ...)
  2020-04-07 16:31 ` Dumitrescu, Cristian
@ 2020-04-11 11:44 ` Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
                     ` (4 more replies)
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
                   ` (2 subsequent siblings)
  6 siblings, 5 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-11 11:44 UTC (permalink / raw)
  To: Cristian Dumitrescu, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Some NIC hardware support shaper to work in packet mode i.e
shaping or ratelimiting traffic is in packets per second (PPS) as
opposed to default bytes per second (BPS). Hence this patch
adds support to configure shared or private shaper in packet mode,
provide rate in PPS and add related tm capabilities in port/level/node
capability structures.

This patch also updates tm port/level/node capability structures with
exiting features of scheduler wfq packet mode, scheduler wfq byte mode
and private/shared shaper byte mode.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v1..v2:
- Add seperate capability for shaper and scheduler pktmode and bytemode.
- Add packet_mode field in struct rte_tm_shaper_params to indicate
packet mode shaper profile.

 lib/librte_ethdev/rte_tm.h | 156 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 154 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
index f9c0cf3..38fff4c 100644
--- a/lib/librte_ethdev/rte_tm.h
+++ b/lib/librte_ethdev/rte_tm.h
@@ -250,6 +250,23 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates that there is atleast one node that can be configured
+	 * with packet mode in it's private shaper. When shaper is configured
+	 * in packet mode, committed/peak rate provided is interpreted
+	 * in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates that there is atleast one node that can be configured
+	 * with byte mode in it's private shaper. When shaper is configured
+	 * in byte mode, committed/peak rate provided is interpreted in
+	 * bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
+
 	/** Maximum number of shared shapers. The value of zero indicates that
 	 * shared shapers are not supported.
 	 */
@@ -284,6 +301,21 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_shared_rate_max;
 
+	/** Shaper shared packet mode supported. When non-zero, this parameter
+	 * indicates a shared shaper can be configured with packet mode.
+	 * When shared shaper is configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero, this parameter
+	 * indicates that a shared shaper can be configured with byte mode.
+	 * When shared shaper is configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_shared_byte_mode_supported;
+
+
 	/** Minimum value allowed for packet length adjustment for any private
 	 * or shared shaper.
 	 */
@@ -339,6 +371,22 @@ struct rte_tm_capabilities {
 	 */
 	uint32_t sched_wfq_weight_max;
 
+	/** WFQ packet mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports packet mode
+	 * for WFQ among its children. WFQ weights will be applied against
+	 * packet count for scheduling children when a non-leaf node
+	 * is configured appropriately.
+	 */
+	int sched_wfq_packet_mode_supported;
+
+	/** WFQ byte mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports byte mode
+	 * for WFQ among its children. WFQ weights will be applied against
+	 * bytes for scheduling children when a non-leaf node is configured
+	 * appropriately.
+	 */
+	int sched_wfq_byte_mode_supported;
+
 	/** 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
@@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is atleast one
+			 * non-leaf node at this level that can be configured
+			 * with packet mode in its private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is atleast one
+			 * non-leaf node at this level that can be configured
+			 * with byte mode in its private shaper. When private
+			 * shaper is configured in byte mode, committed/peak
+			 * rate provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any non-leaf
 			 * node on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -554,6 +620,25 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t sched_wfq_weight_max;
 
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports packet
+			 * mode for WFQ among its children. WFQ weights will
+			 * be applied against packet count for scheduling
+			 * children when a non-leaf node is configured
+			 * appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports byte
+			 * mode for WFQ among its children. WFQ weights will
+			 * be applied against bytes for scheduling children
+			 * when a non-leaf node is configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 			/** 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
@@ -596,6 +681,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is atleast one leaf
+			 * node at this level that can be configured with
+			 * packet mode in its private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is atleast one leaf
+			 * node at this level that can be configured with
+			 * byte mode in its private shaper. When private shaper
+			 * is configured in byte mode, committed/peak rate
+			 * provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any leaf node
 			 * on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -686,6 +789,20 @@ struct rte_tm_node_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * packet mode. When configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * byte mode. When configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
 	/** Maximum number of shared shapers the current node can be part of.
 	 * The value of zero indicates that shared shapers are not supported by
 	 * the current node.
@@ -735,6 +852,23 @@ struct rte_tm_node_capabilities {
 			 * WFQ weight, so WFQ is reduced to FQ.
 			 */
 			uint32_t sched_wfq_weight_max;
+
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that current node supports packet
+			 * mode for WFQ among its children. WFQ weights will be
+			 * applied against packet count for scheduling children
+			 * when configured appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that current node supports byte
+			 * mode for WFQ among its children. WFQ weights will be
+			 * applied against  bytes for scheduling children when
+			 * configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 		} nonleaf;
 
 		/** Items valid only for leaf nodes. */
@@ -836,10 +970,10 @@ struct rte_tm_wred_params {
  * Token bucket
  */
 struct rte_tm_token_bucket {
-	/** Token bucket rate (bytes per second) */
+	/** Token bucket rate (bytes per second or packets per second) */
 	uint64_t rate;
 
-	/** Token bucket size (bytes), a.k.a. max burst size */
+	/** Token bucket size (bytes or packets), a.k.a. max burst size */
 	uint64_t size;
 };
 
@@ -860,6 +994,11 @@ struct rte_tm_token_bucket {
  * Dual rate shapers use both the committed and the peak token buckets. The
  * rate of the peak bucket has to be bigger than zero, as well as greater than
  * or equal to the rate of the committed bucket.
+ *
+ * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
  */
 struct rte_tm_shaper_params {
 	/** Committed token bucket */
@@ -874,6 +1013,17 @@ struct rte_tm_shaper_params {
 	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
 	 */
 	int32_t pkt_length_adjust;
+
+	/** When zero, the private or shared shaper that is associated to this
+	 * profile works in byte mode and hence *rate* and *size* fields in
+	 * both token bucket configurations are specified in bytes per second
+	 * and bytes respectively.
+	 * When non-zero, that private or shared shaper works in packet mode and
+	 * hence *rate* and *size* fields in both token bucket configurations
+	 * are specified in packets per second and packets respectively. In
+	 * packet mode, *pkt_length_adjust* is ignored.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -925,6 +1075,8 @@ struct rte_tm_node_params {
 			 * 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.
+			 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported
+			 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported
 			 */
 			int *wfq_weight_mode;
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] drivers/net: update tm capability for existing pmds
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
@ 2020-04-11 11:44   ` Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-11 11:44 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang, Rosen Xu, Wenzhuo Lu, Konstantin Ananyev,
	Tomasz Duszynski, Liron Himi, Jasvinder Singh,
	Cristian Dumitrescu
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Since existing PMD's support shaper byte mode and scheduler
wfq byte mode, update the same in their port/level/node capabilities
that are added.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v1..v2:
- Newly included patch to change exiting pmd's with tm support of byte mode 
to show the same in port/level/node cap.

 drivers/net/i40e/i40e_tm.c               | 16 ++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c           | 26 ++++++++++++++++++
 drivers/net/ixgbe/ixgbe_tm.c             | 16 ++++++++++++
 drivers/net/mvpp2/mrvl_tm.c              | 14 ++++++++++
 drivers/net/softnic/rte_eth_softnic_tm.c | 45 ++++++++++++++++++++++++++++++++
 5 files changed, 117 insertions(+)

diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c
index c76760c..ab272e9 100644
--- a/drivers/net/i40e/i40e_tm.c
+++ b/drivers/net/i40e/i40e_tm.c
@@ -160,12 +160,16 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->func_caps.num_tx_qp;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -179,6 +183,8 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	 * So, all the nodes should have the same weight.
 	 */
 	cap->sched_wfq_weight_max = 1;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	cap->cman_head_drop_supported = 0;
 	cap->dynamic_update_mask = 0;
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD;
@@ -754,6 +760,8 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 40Gbps -> 5GBps */
 		cap->nonleaf.shaper_private_rate_max = 5000000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
 		if (level_id == I40E_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
@@ -765,6 +773,8 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -776,6 +786,8 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->leaf.shaper_private_rate_max = 5000000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
@@ -817,6 +829,8 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 
 	if (node_type == I40E_TM_NODE_TYPE_QUEUE) {
@@ -834,6 +848,8 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 5a16c5f..35c90b8 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -440,6 +440,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_private_dual_rate_n_max = 0;
 	cap->shaper_private_rate_min = 1;
 	cap->shaper_private_rate_max = 1 + IPN3KE_TM_VT_NODE_NUM;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
@@ -447,6 +449,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
 	cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
@@ -456,6 +460,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->sched_wfq_n_children_per_group_max = UINT32_MAX;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = UINT32_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->cman_wred_packet_mode_supported = 0;
 	cap->cman_wred_byte_mode_supported = 0;
@@ -517,6 +523,8 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
@@ -524,6 +532,8 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -539,6 +549,8 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
@@ -546,6 +558,8 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -561,6 +575,8 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_dual_rate_supported = 0;
 		cap->leaf.shaper_private_rate_min = 0;
 		cap->leaf.shaper_private_rate_max = 0;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.shaper_shared_n_max = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
@@ -632,6 +648,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
@@ -640,6 +658,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -649,6 +669,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
@@ -657,6 +679,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -666,6 +690,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 0;
 		cap->shaper_private_rate_max = 0;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 0;
 		cap->shaper_shared_n_max = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index 73845a7..c067109 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -168,12 +168,16 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->mac.max_tx_queues;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -182,6 +186,8 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->sched_sp_n_priorities_max = 1;
 	cap->sched_wfq_n_children_per_group_max = 0;
 	cap->sched_wfq_n_groups_max = 0;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	/**
 	 * SW only supports fair round robin now.
 	 * So, all the nodes should have the same weight.
@@ -875,6 +881,8 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 10Gbps -> 1.25GBps */
 		cap->nonleaf.shaper_private_rate_max = 1250000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
 		if (level_id == IXGBE_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
@@ -886,6 +894,8 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -897,6 +907,8 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->leaf.shaper_private_rate_max = 1250000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
@@ -938,6 +950,8 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 
 	if (node_type == IXGBE_TM_NODE_TYPE_QUEUE) {
@@ -955,6 +969,8 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c
index 3de8997..e98f576 100644
--- a/drivers/net/mvpp2/mrvl_tm.c
+++ b/drivers/net/mvpp2/mrvl_tm.c
@@ -193,12 +193,16 @@ mrvl_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_n_max = cap->shaper_n_max;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->sched_n_children_max = dev->data->nb_tx_queues;
 	cap->sched_sp_n_priorities_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_children_per_group_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask = RTE_TM_UPDATE_NODE_SUSPEND_RESUME |
 				   RTE_TM_UPDATE_NODE_STATS;
@@ -244,6 +248,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_supported = 1;
 		cap->nonleaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->nonleaf.shaper_private_rate_max = priv->rate_max;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -251,6 +257,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->nonleaf.stats_mask = RTE_TM_STATS_N_PKTS |
 					  RTE_TM_STATS_N_BYTES;
 	} else { /* level_id == MRVL_NODE_QUEUE */
@@ -261,6 +269,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_supported = 1;
 		cap->leaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->leaf.shaper_private_rate_max = priv->rate_max;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.stats_mask = RTE_TM_STATS_N_PKTS;
 	}
 
@@ -300,6 +310,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 	cap->shaper_private_supported = 1;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	if (node->type == MRVL_NODE_PORT) {
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
@@ -308,6 +320,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->stats_mask = RTE_TM_STATS_N_PKTS | RTE_TM_STATS_N_BYTES;
 	} else {
 		cap->stats_mask = RTE_TM_STATS_N_PKTS;
diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
index 80a470c..ac14fe1 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -447,6 +447,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_private_dual_rate_n_max = 0,
 	.shaper_private_rate_min = 1,
 	.shaper_private_rate_max = UINT32_MAX,
+	.shaper_private_packet_mode_supported = 0,
+	.shaper_private_byte_mode_supported = 1,
 
 	.shaper_shared_n_max = UINT32_MAX,
 	.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,
@@ -454,6 +456,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_shared_dual_rate_n_max = 0,
 	.shaper_shared_rate_min = 1,
 	.shaper_shared_rate_max = UINT32_MAX,
+	.shaper_shared_packet_mode_supported = 0,
+	.shaper_shared_byte_mode_supported = 1,
 
 	.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
 	.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
@@ -463,6 +467,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.sched_wfq_n_children_per_group_max = UINT32_MAX,
 	.sched_wfq_n_groups_max = 1,
 	.sched_wfq_weight_max = UINT32_MAX,
+	.sched_wfq_packet_mode_supported = 0,
+	.sched_wfq_byte_mode_supported = 1,
 
 	.cman_wred_packet_mode_supported = WRED_SUPPORTED,
 	.cman_wred_byte_mode_supported = 0,
@@ -548,6 +554,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
 
 			.sched_n_children_max = UINT32_MAX,
@@ -555,6 +563,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -572,6 +582,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
 
 			.sched_n_children_max = UINT32_MAX,
@@ -580,9 +592,14 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_groups_max = 1,
 #ifdef RTE_SCHED_SUBPORT_TC_OV
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 #else
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 #endif
+
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
 	},
@@ -599,6 +616,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
 
 			.sched_n_children_max =
@@ -608,6 +627,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -625,6 +646,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 1,
 
 			.sched_n_children_max =
@@ -634,6 +657,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -651,6 +676,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 0,
 			.shaper_private_rate_max = 0,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 0,
 			.shaper_shared_n_max = 0,
 
 			.cman_head_drop_supported = 0,
@@ -736,6 +763,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
 
 		{.nonleaf = {
@@ -744,6 +773,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -754,6 +785,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
 
 		{.nonleaf = {
@@ -762,6 +795,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -772,6 +807,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
 
 		{.nonleaf = {
@@ -782,6 +819,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -792,6 +831,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 1,
 
 		{.nonleaf = {
@@ -802,6 +843,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -812,6 +855,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 0,
 		.shaper_private_rate_max = 0,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 0,
 		.shaper_shared_n_max = 0,
 
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
@ 2020-04-11 11:44   ` Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-11 11:44 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

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".

Also add support to shaper profile add command to take
packet mode parameter used to setup shaper in packet mode.
This adds an extra argument "packet_mode" to shaper profile add command
"add port tm node shaper profile" as last argument.

This patch also dumps new tm port/level/node capabilities
sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported,
shaper_private_packet_mode_supported, shaper_private_byte_mode_supported,
shaper_shared_packet_mode_supported, shaper_shared_byte_mode_supported.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v1..v2:
- Update tm capability show cmd to dump lastest pktmode/bytemode fields of v2.
- Update existing shaper profile add command to take last argument as pkt_mode
and update struct rte_tm_shaper_params:packet_mode with the same.
- Update documentation with latest command changes.

 app/test-pmd/cmdline.c                      |   9 +-
 app/test-pmd/cmdline_tm.c                   | 206 ++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h                   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 +++++-
 4 files changed, 250 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 863b567..af90242 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1189,7 +1189,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"add port tm node shaper profile (port_id) (shaper_profile_id)"
 			" (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
-			" (packet_length_adjust)\n"
+			" (packet_length_adjust) (packet_mode)\n"
 			"       Add port tm node private shaper profile.\n\n"
 
 			"del port tm node shaper profile (port_id) (shaper_profile_id)\n"
@@ -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)"
@@ -19636,6 +19642,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..c9a2813 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -257,6 +257,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		cap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		cap.shaper_shared_n_max);
 	printf("cap.shaper_shared_n_nodes_per_shaper_max %" PRIu32 "\n",
@@ -269,6 +273,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_shared_rate_min);
 	printf("cap.shaper_shared_rate_max %" PRIu64 "\n",
 		cap.shaper_shared_rate_max);
+	printf("cap.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_packet_mode_supported);
+	printf("cap.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_byte_mode_supported);
 	printf("cap.shaper_pkt_length_adjust_min %" PRId32 "\n",
 		cap.shaper_pkt_length_adjust_min);
 	printf("cap.shaper_pkt_length_adjust_max %" PRId32 "\n",
@@ -283,6 +291,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_packet_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_packet_mode_supported);
+	printf("cap.sched_wfq_byte_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_byte_mode_supported);
 	printf("cap.cman_head_drop_supported %" PRId32 "\n",
 		cap.cman_head_drop_supported);
 	printf("cap.cman_wred_context_n_max %" PRIu32 "\n",
@@ -401,6 +413,11 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.nonleaf.shaper_private_rate_min);
 		printf("cap.nonleaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.nonleaf.shaper_private_rate_max);
+		printf("cap.nonleaf.shaper_private_packet_mode_supported %"
+		       PRId32 "\n",
+			lcap.nonleaf.shaper_private_packet_mode_supported);
+		printf("cap.nonleaf.shaper_private_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.shaper_private_byte_mode_supported);
 		printf("cap.nonleaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.nonleaf.shaper_shared_n_max);
 		printf("cap.nonleaf.sched_n_children_max %" PRIu32 "\n",
@@ -413,6 +430,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_packet_mode_supported %" PRId32 "\n",
+			lcap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.sched_wfq_byte_mode_supported);
 		printf("cap.nonleaf.stats_mask %" PRIx64 "\n",
 			lcap.nonleaf.stats_mask);
 	} else {
@@ -424,6 +445,10 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.leaf.shaper_private_rate_min);
 		printf("cap.leaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.leaf.shaper_private_rate_max);
+		printf("cap.leaf.shaper_private_packet_mode_supported %" PRId32
+		       "\n", lcap.leaf.shaper_private_packet_mode_supported);
+		printf("cap.leaf.shaper_private_byte_mode_supported %" PRId32 "\n",
+			lcap.leaf.shaper_private_byte_mode_supported);
 		printf("cap.leaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.leaf.shaper_shared_n_max);
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
@@ -524,6 +549,10 @@ static void cmd_show_port_tm_node_cap_parsed(void *parsed_result,
 		ncap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		ncap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		ncap.shaper_shared_n_max);
 	if (!is_leaf) {
@@ -537,6 +566,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_packet_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_byte_mode_supported);
 	} else {
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
 			ncap.leaf.cman_head_drop_supported);
@@ -776,6 +809,7 @@ struct cmd_add_port_tm_node_shaper_profile_result {
 	uint64_t peak_tb_rate;
 	uint64_t peak_tb_size;
 	uint32_t pktlen_adjust;
+	int pkt_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_tm_node_shaper_profile_add =
@@ -829,6 +863,10 @@ cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_pktlen_adjust =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_tm_node_shaper_profile_result,
 			pktlen_adjust, UINT32);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_tm_node_shaper_profile_result,
+			pkt_mode, UINT32);
 
 static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	__attribute__((unused)) struct cmdline *cl,
@@ -853,6 +891,7 @@ static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	sp.peak.rate = res->peak_tb_rate;
 	sp.peak.size = res->peak_tb_size;
 	sp.pkt_length_adjust = pkt_len_adjust;
+	sp.packet_mode = res->pkt_mode;
 
 	ret = rte_tm_shaper_profile_add(port_id, shaper_id, &sp, &error);
 	if (ret != 0) {
@@ -879,6 +918,7 @@ cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile = {
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_rate,
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_size,
 		(void *)&cmd_add_port_tm_node_shaper_profile_pktlen_adjust,
+		(void *)&cmd_add_port_tm_node_shaper_profile_packet_mode,
 		NULL,
 	},
 };
@@ -1671,6 +1711,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 dcee5de..a058f75 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2840,19 +2840,22 @@ Add the port traffic management private shaper profile::
 
    testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
    (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
-   (packet_length_adjust)
+   (packet_length_adjust) (packet_mode)
 
 where:
 
 * ``shaper_profile id``: Shaper profile ID for the new profile.
-* ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
-* ``cmit_tb_size``: Committed token bucket size (bytes).
-* ``peak_tb_rate``: Peak token bucket rate (bytes per second).
-* ``peak_tb_size``: Peak token bucket size (bytes).
+* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
+* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
+* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
+* ``peak_tb_size``: Peak token bucket size (bytes or packets).
 * ``packet_length_adjust``: The value (bytes) to be added to the length of
   each packet for the purpose of shaping. This parameter value can be used to
   correct the packet length with the framing overhead bytes that are consumed
   on the wire.
+* ``packet_mode``: Shaper configured in packet mode. This parameter value if
+  zero, configures shaper in byte mode and if non-zero configures it in packet
+  mode.
 
 Delete port traffic management private shaper profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2977,6 +2980,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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] net/octeontx2: support tm length adjust and pkt mode
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
@ 2020-04-11 11:44   ` Nithin Dabilpuram
  2020-04-16 13:48   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in " Ferruh Yigit
  2020-04-21  9:30   ` [dpdk-dev] " Dumitrescu, Cristian
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-11 11:44 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K; +Cc: dev, kkanas

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

This patch adds support to packet length adjust TM feature
for private shaper. It also adds support to packet mode
feature that applies both to private shaper and node DWRR
scheduling of SP children.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v1..v2:
- Newly included patch.

 drivers/net/octeontx2/otx2_tm.c | 140 +++++++++++++++++++++++++++++++++-------
 drivers/net/octeontx2/otx2_tm.h |   5 ++
 2 files changed, 122 insertions(+), 23 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_tm.c b/drivers/net/octeontx2/otx2_tm.c
index f94618d..fa7d21b 100644
--- a/drivers/net/octeontx2/otx2_tm.c
+++ b/drivers/net/octeontx2/otx2_tm.c
@@ -336,18 +336,25 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 {
 	struct shaper_params cir, pir;
 	uint32_t schq = tm_node->hw_id;
+	uint64_t adjust = 0;
 	uint8_t k = 0;
 
 	memset(&cir, 0, sizeof(cir));
 	memset(&pir, 0, sizeof(pir));
 	shaper_config_to_nix(profile, &cir, &pir);
 
-	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, "
-		    "pir %" PRIu64 "(%" PRIu64 "B),"
-		     " cir %" PRIu64 "(%" PRIu64 "B) (%p)",
-		     nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
-		     tm_node->id, pir.rate, pir.burst,
-		     cir.rate, cir.burst, tm_node);
+	/* Packet length adjust */
+	if (tm_node->pkt_mode)
+		adjust = 1;
+	else if (profile)
+		adjust = profile->params.pkt_length_adjust & 0x1FF;
+
+	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, pir %" PRIu64
+		    "(%" PRIu64 "B), cir %" PRIu64 "(%" PRIu64 "B)"
+		    "adjust 0x%" PRIx64 "(pktmode %u) (%p)",
+		    nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
+		    tm_node->id, pir.rate, pir.burst, cir.rate, cir.burst,
+		    adjust, tm_node->pkt_mode, tm_node);
 
 	switch (tm_node->hw_lvl) {
 	case NIX_TXSCH_LVL_SMQ:
@@ -364,7 +371,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED ALG */
 		reg[k] = NIX_AF_MDQX_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL4:
@@ -381,7 +390,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL4X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL3:
@@ -398,7 +409,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL3X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -416,7 +429,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL2X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -426,6 +441,12 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 		regval[k] = (cir.rate && cir.burst) ?
 				(shaper2regval(&cir) | 1) : 0;
 		k++;
+
+		/* Configure length disable and adjust */
+		reg[k] = NIX_AF_TL1X_SHAPE(schq);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->pkt_mode << 24);
+		k++;
 		break;
 	}
 
@@ -773,6 +794,15 @@ nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id,
 	tm_node->flags = 0;
 	if (user)
 		tm_node->flags = NIX_TM_NODE_USER;
+
+	/* Packet mode */
+	if (!nix_tm_is_leaf(dev, lvl) &&
+	    ((profile && profile->params.packet_mode) ||
+	     (params->nonleaf.wfq_weight_mode &&
+	      params->nonleaf.n_sp_priorities &&
+	      !params->nonleaf.wfq_weight_mode[0])))
+		tm_node->pkt_mode = 1;
+
 	rte_memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params));
 
 	if (profile)
@@ -1873,8 +1903,10 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->shaper_private_dual_rate_n_max = max_nr_nodes;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
-	cap->shaper_pkt_length_adjust_min = 0;
-	cap->shaper_pkt_length_adjust_max = 0;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
+	cap->shaper_pkt_length_adjust_min = NIX_LENGTH_ADJUST_MIN;
+	cap->shaper_pkt_length_adjust_max = NIX_LENGTH_ADJUST_MAX;
 
 	/* Schedule Capabilities */
 	cap->sched_n_children_max = rsp->schq[NIX_TXSCH_LVL_MDQ];
@@ -1882,6 +1914,8 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->sched_wfq_n_children_per_group_max = cap->sched_n_children_max;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->sched_wfq_packet_mode_supported = 1;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask =
 		RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL |
@@ -1944,12 +1978,16 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_tm_have_tl1_access(dev) ? false : true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = rsp->schq[hw_lvl - 1];
 		cap->nonleaf.sched_sp_n_priorities_max =
 					nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 		if (nix_tm_have_tl1_access(dev))
 			cap->nonleaf.stats_mask =
@@ -1966,6 +2004,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 		cap->nonleaf.shaper_private_dual_rate_supported = true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		/* MDQ doesn't support Strict Priority */
 		if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -1977,6 +2017,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 	} else {
 		/* unsupported level */
 		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
@@ -2029,6 +2071,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		(hw_lvl == NIX_TXSCH_LVL_TL1) ? false : true;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	/* Non Leaf Scheduler */
 	if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -2041,6 +2085,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		cap->nonleaf.sched_n_children_max;
 	cap->nonleaf.sched_wfq_n_groups_max = 1;
 	cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+	cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 	if (hw_lvl == NIX_TXSCH_LVL_TL1)
 		cap->stats_mask = RTE_TM_STATS_N_PKTS_RED_DROPPED |
@@ -2096,6 +2142,13 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (params->pkt_length_adjust < NIX_LENGTH_ADJUST_MIN ||
+	    params->pkt_length_adjust > NIX_LENGTH_ADJUST_MAX) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN;
+		error->message = "length adjust invalid";
+		return -EINVAL;
+	}
+
 	profile = rte_zmalloc("otx2_nix_tm_shaper_profile",
 			      sizeof(struct otx2_nix_tm_shaper_profile), 0);
 	if (!profile)
@@ -2108,13 +2161,14 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 
 	otx2_tm_dbg("Added TM shaper profile %u, "
 		    " pir %" PRIu64 " , pbs %" PRIu64 ", cir %" PRIu64
-		    ", cbs %" PRIu64 " , adj %u",
+		    ", cbs %" PRIu64 " , adj %u, pkt mode %d",
 		    profile_id,
 		    params->peak.rate * 8,
 		    params->peak.size,
 		    params->committed.rate * 8,
 		    params->committed.size,
-		    params->pkt_length_adjust);
+		    params->pkt_length_adjust,
+		    params->packet_mode);
 
 	/* Translate rate as bits per second */
 	profile->params.peak.rate = profile->params.peak.rate * 8;
@@ -2170,9 +2224,11 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		     struct rte_tm_error *error)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_nix_tm_shaper_profile *profile = NULL;
 	struct otx2_nix_tm_node *parent_node;
-	int rc, clear_on_fail = 0;
-	uint32_t exp_next_lvl;
+	int rc, pkt_mode, clear_on_fail = 0;
+	uint32_t exp_next_lvl, i;
+	uint32_t profile_id;
 	uint16_t hw_lvl;
 
 	/* we don't support dynamic updates */
@@ -2234,13 +2290,45 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		return -EINVAL;
 	}
 
-	/* Check if shaper profile exists for non leaf node */
-	if (!nix_tm_is_leaf(dev, lvl) &&
-	    params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE &&
-	    !nix_tm_shaper_profile_search(dev, params->shaper_profile_id)) {
-		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
-		error->message = "invalid shaper profile";
-		return -EINVAL;
+	if (!nix_tm_is_leaf(dev, lvl)) {
+		/* Check if shaper profile exists for non leaf node */
+		profile_id = params->shaper_profile_id;
+		profile = nix_tm_shaper_profile_search(dev, profile_id);
+		if (profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE && !profile) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+			error->message = "invalid shaper profile";
+			return -EINVAL;
+		}
+
+		/* Minimum static priority count is 1 */
+		if (!params->nonleaf.n_sp_priorities ||
+		    params->nonleaf.n_sp_priorities > TXSCH_TLX_SP_PRIO_MAX) {
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES;
+			error->message = "invalid sp priorities";
+			return -EINVAL;
+		}
+
+		pkt_mode = 0;
+		/* Validate weight mode */
+		for (i = 0; i < params->nonleaf.n_sp_priorities &&
+		     params->nonleaf.wfq_weight_mode; i++) {
+			pkt_mode = !params->nonleaf.wfq_weight_mode[i];
+			if (pkt_mode == !params->nonleaf.wfq_weight_mode[0])
+				continue;
+
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE;
+			error->message = "unsupported weight mode";
+			return -EINVAL;
+		}
+
+		if (profile && params->nonleaf.n_sp_priorities &&
+		    pkt_mode != profile->params.packet_mode) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
+			error->message = "shaper wfq packet mode mismatch";
+			return -EINVAL;
+		}
 	}
 
 	/* Check if there is second DWRR already in siblings or holes in prio */
@@ -2482,6 +2570,12 @@ otx2_nix_tm_node_shaper_update(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (profile && profile->params.packet_mode != tm_node->pkt_mode) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+		error->message = "shaper profile pkt mode mismatch";
+		return -EINVAL;
+	}
+
 	tm_node->params.shaper_profile_id = profile_id;
 
 	/* Nothing to do if not yet committed */
diff --git a/drivers/net/octeontx2/otx2_tm.h b/drivers/net/octeontx2/otx2_tm.h
index 9675182..cdca987 100644
--- a/drivers/net/octeontx2/otx2_tm.h
+++ b/drivers/net/octeontx2/otx2_tm.h
@@ -48,6 +48,7 @@ struct otx2_nix_tm_node {
 #define NIX_TM_NODE_USER	BIT_ULL(2)
 	/* Shaper algorithm for RED state @NIX_REDALG_E */
 	uint32_t red_algo:2;
+	uint32_t pkt_mode:1;
 
 	struct otx2_nix_tm_node *parent;
 	struct rte_tm_node_params params;
@@ -114,6 +115,10 @@ TAILQ_HEAD(otx2_nix_tm_shaper_profile_list, otx2_nix_tm_shaper_profile);
 #define MAX_SHAPER_RATE \
 	SHAPER_RATE(MAX_RATE_EXPONENT, MAX_RATE_MANTISSA, 0)
 
+/* Min is limited so that NIX_AF_SMQX_CFG[MINLEN]+ADJUST is not -ve */
+#define NIX_LENGTH_ADJUST_MIN ((int)-NIX_MIN_HW_FRS + 1)
+#define NIX_LENGTH_ADJUST_MAX 255
+
 /** TM Shaper - low level operations */
 
 /** NIX burst limits */
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
                     ` (2 preceding siblings ...)
  2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
@ 2020-04-16 13:48   ` Ferruh Yigit
  2020-04-21  5:11     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  2020-04-21  9:30   ` [dpdk-dev] " Dumitrescu, Cristian
  4 siblings, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-16 13:48 UTC (permalink / raw)
  To: Nithin Dabilpuram, Cristian Dumitrescu, Thomas Monjalon,
	Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

On 4/11/2020 12:44 PM, Nithin Dabilpuram wrote:
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Some NIC hardware support shaper to work in packet mode i.e
> shaping or ratelimiting traffic is in packets per second (PPS) as
> opposed to default bytes per second (BPS). Hence this patch
> adds support to configure shared or private shaper in packet mode,
> provide rate in PPS and add related tm capabilities in port/level/node
> capability structures.
> 
> This patch also updates tm port/level/node capability structures with
> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> and private/shared shaper byte mode.
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> 
> v1..v2:
> - Add seperate capability for shaper and scheduler pktmode and bytemode.
> - Add packet_mode field in struct rte_tm_shaper_params to indicate
> packet mode shaper profile.
> 

Hi Cristian,

Can you please review this series?

Thanks,
ferruh

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-16 13:48   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in " Ferruh Yigit
@ 2020-04-21  5:11     ` Nithin Dabilpuram
  0 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-21  5:11 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Nithin Dabilpuram, Cristian Dumitrescu, Thomas Monjalon,
	Andrew Rybchenko, dev, jerinj, kkanas

Ping.

On Thu, Apr 16, 2020 at 02:48:49PM +0100, Ferruh Yigit wrote:
> External Email
> 
> ----------------------------------------------------------------------
> On 4/11/2020 12:44 PM, Nithin Dabilpuram wrote:
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > 
> > Some NIC hardware support shaper to work in packet mode i.e
> > shaping or ratelimiting traffic is in packets per second (PPS) as
> > opposed to default bytes per second (BPS). Hence this patch
> > adds support to configure shared or private shaper in packet mode,
> > provide rate in PPS and add related tm capabilities in port/level/node
> > capability structures.
> > 
> > This patch also updates tm port/level/node capability structures with
> > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > and private/shared shaper byte mode.
> > 
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > ---
> > 
> > v1..v2:
> > - Add seperate capability for shaper and scheduler pktmode and bytemode.
> > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > packet mode shaper profile.
> > 
> 
> Hi Cristian,
> 
> Can you please review this series?
> 
> Thanks,
> ferruh

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
                     ` (3 preceding siblings ...)
  2020-04-16 13:48   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in " Ferruh Yigit
@ 2020-04-21  9:30   ` Dumitrescu, Cristian
  2020-04-21  9:58     ` Nithin Dabilpuram
  4 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-21  9:30 UTC (permalink / raw)
  To: Nithin Dabilpuram, Thomas Monjalon, Yigit, Ferruh, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

Hi Nithin,

> -----Original Message-----
> From: Nithin Dabilpuram <nithind1988@gmail.com>
> Sent: Saturday, April 11, 2020 12:44 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt
> mode
> 
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Some NIC hardware support shaper to work in packet mode i.e
> shaping or ratelimiting traffic is in packets per second (PPS) as
> opposed to default bytes per second (BPS). Hence this patch
> adds support to configure shared or private shaper in packet mode,
> provide rate in PPS and add related tm capabilities in port/level/node
> capability structures.
> 
> This patch also updates tm port/level/node capability structures with
> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> and private/shared shaper byte mode.
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> 
> v1..v2:
> - Add seperate capability for shaper and scheduler pktmode and bytemode.
> - Add packet_mode field in struct rte_tm_shaper_params to indicate
> packet mode shaper profile.
> 
>  lib/librte_ethdev/rte_tm.h | 156
> ++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 154 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> index f9c0cf3..38fff4c 100644
> --- a/lib/librte_ethdev/rte_tm.h
> +++ b/lib/librte_ethdev/rte_tm.h
> @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
>  	 */
>  	uint64_t shaper_private_rate_max;
> 
> +	/** Shaper private packet mode supported. When non-zero, this
> parameter
> +	 * indicates that there is atleast one node that can be configured

Typo (please fix all occurrences): atleast -> at least

> +	 * with packet mode in it's private shaper. When shaper is configured

Typo (please fix all occurrences): it's -> its

> +	 * in packet mode, committed/peak rate provided is interpreted
> +	 * in packets per second.
> +	 */
> +	int shaper_private_packet_mode_supported;
> +
> +	/** Shaper private byte mode supported. When non-zero, this
> parameter
> +	 * indicates that there is atleast one node that can be configured
> +	 * with byte mode in it's private shaper. When shaper is configured
> +	 * in byte mode, committed/peak rate provided is interpreted in
> +	 * bytes per second.
> +	 */
> +	int shaper_private_byte_mode_supported;
> +
> +
>  	/** Maximum number of shared shapers. The value of zero indicates
> that
>  	 * shared shapers are not supported.
>  	 */
> @@ -284,6 +301,21 @@ struct rte_tm_capabilities {
>  	 */
>  	uint64_t shaper_shared_rate_max;
> 
> +	/** Shaper shared packet mode supported. When non-zero, this
> parameter
> +	 * indicates a shared shaper can be configured with packet mode.
> +	 * When shared shaper is configured in packet mode,
> committed/peak rate
> +	 * provided is interpreted in packets per second.
> +	 */
> +	int shaper_shared_packet_mode_supported;
> +
> +	/** Shaper shared byte mode supported. When non-zero, this
> parameter
> +	 * indicates that a shared shaper can be configured with byte mode.
> +	 * When shared shaper is configured in byte mode, committed/peak
> rate
> +	 * provided is interpreted in bytes per second.
> +	 */
> +	int shaper_shared_byte_mode_supported;
> +
> +
>  	/** Minimum value allowed for packet length adjustment for any
> private
>  	 * or shared shaper.
>  	 */
> @@ -339,6 +371,22 @@ struct rte_tm_capabilities {
>  	 */
>  	uint32_t sched_wfq_weight_max;
> 
> +	/** WFQ packet mode supported. When non-zero, this parameter
> indicates
> +	 * that there is at least one non-leaf node that supports packet mode
> +	 * for WFQ among its children. WFQ weights will be applied against
> +	 * packet count for scheduling children when a non-leaf node
> +	 * is configured appropriately.
> +	 */
> +	int sched_wfq_packet_mode_supported;
> +
> +	/** WFQ byte mode supported. When non-zero, this parameter
> indicates
> +	 * that there is at least one non-leaf node that supports byte mode
> +	 * for WFQ among its children. WFQ weights will be applied against
> +	 * bytes for scheduling children when a non-leaf node is configured
> +	 * appropriately.
> +	 */
> +	int sched_wfq_byte_mode_supported;
> +
>  	/** 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
> @@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint64_t shaper_private_rate_max;
> 
> +			/** Shaper private packet mode supported. When
> non-zero,
> +			 * this parameter indicates there is atleast one
> +			 * non-leaf node at this level that can be configured
> +			 * with packet mode in its private shaper. When
> private
> +			 * shaper is configured in packet mode,
> committed/peak
> +			 * rate provided is interpreted in packets per second.
> +			 */
> +			int shaper_private_packet_mode_supported;
> +
> +			/** Shaper private byte mode supported. When
> non-zero,
> +			 * this parameter indicates there is atleast one
> +			 * non-leaf node at this level that can be configured
> +			 * with byte mode in its private shaper. When private
> +			 * shaper is configured in byte mode,
> committed/peak
> +			 * rate provided is interpreted in bytes per second.
> +			 */
> +			int shaper_private_byte_mode_supported;
> +
>  			/** Maximum number of shared shapers that any
> non-leaf
>  			 * node on this level can be part of. The value of zero
>  			 * indicates that shared shapers are not supported by
> @@ -554,6 +620,25 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint32_t sched_wfq_weight_max;
> 
> +			/** WFQ packet mode supported. When non-zero,
> this
> +			 * parameter indicates that there is at least one
> +			 * non-leaf node at this level that supports packet
> +			 * mode for WFQ among its children. WFQ weights
> will
> +			 * be applied against packet count for scheduling
> +			 * children when a non-leaf node is configured
> +			 * appropriately.
> +			 */
> +			int sched_wfq_packet_mode_supported;
> +
> +			/** WFQ byte mode supported. When non-zero, this
> +			 * parameter indicates that there is at least one
> +			 * non-leaf node at this level that supports byte
> +			 * mode for WFQ among its children. WFQ weights
> will
> +			 * be applied against bytes for scheduling children
> +			 * when a non-leaf node is configured appropriately.
> +			 */
> +			int sched_wfq_byte_mode_supported;
> +
>  			/** 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
> @@ -596,6 +681,24 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint64_t shaper_private_rate_max;
> 
> +			/** Shaper private packet mode supported. When
> non-zero,
> +			 * this parameter indicates there is atleast one leaf
> +			 * node at this level that can be configured with
> +			 * packet mode in its private shaper. When private
> +			 * shaper is configured in packet mode,
> committed/peak
> +			 * rate provided is interpreted in packets per second.
> +			 */
> +			int shaper_private_packet_mode_supported;
> +
> +			/** Shaper private byte mode supported. When
> non-zero,
> +			 * this parameter indicates there is atleast one leaf
> +			 * node at this level that can be configured with
> +			 * byte mode in its private shaper. When private
> shaper
> +			 * is configured in byte mode, committed/peak rate
> +			 * provided is interpreted in bytes per second.
> +			 */
> +			int shaper_private_byte_mode_supported;
> +
>  			/** Maximum number of shared shapers that any
> leaf node
>  			 * on this level can be part of. The value of zero
>  			 * indicates that shared shapers are not supported by

You are missing the shaper_shared_(packet, byte)_mode supported for non-leaf and leaf nodes in struct rte_tm_level_capabilities.

The description of this nodes should be aligned with the description of e.g. shaper_shared_n_max field: basically, we want to say that, when true, the flag signifies there is at least on non-leaf/leaf node on this level that can be part of a shared shaper that works in packet/byte mode. Makes sense?

> @@ -686,6 +789,20 @@ struct rte_tm_node_capabilities {
>  	 */
>  	uint64_t shaper_private_rate_max;
> 
> +	/** Shaper private packet mode supported. When non-zero, this
> parameter
> +	 * indicates private shaper of current node can be configured with
> +	 * packet mode. When configured in packet mode, committed/peak
> rate
> +	 * provided is interpreted in packets per second.
> +	 */
> +	int shaper_private_packet_mode_supported;
> +
> +	/** Shaper private byte mode supported. When non-zero, this
> parameter
> +	 * indicates private shaper of current node can be configured with
> +	 * byte mode. When configured in byte mode, committed/peak rate
> +	 * provided is interpreted in bytes per second.
> +	 */
> +	int shaper_private_byte_mode_supported;
> +
>  	/** Maximum number of shared shapers the current node can be
> part of.
>  	 * The value of zero indicates that shared shapers are not supported
> by
>  	 * the current node.

You are missing the shaper_shared_(packet, byte)_mode supported (applicable for both non-leaf and leaf nodes, so it should occur only once in the common part of the struct) in struct rte_tm_node_capabilities. See the above comment on the applicable description style.

> @@ -735,6 +852,23 @@ struct rte_tm_node_capabilities {
>  			 * WFQ weight, so WFQ is reduced to FQ.
>  			 */
>  			uint32_t sched_wfq_weight_max;
> +
> +			/** WFQ packet mode supported. When non-zero,
> this
> +			 * parameter indicates that current node supports
> packet
> +			 * mode for WFQ among its children. WFQ weights
> will be
> +			 * applied against packet count for scheduling
> children
> +			 * when configured appropriately.
> +			 */
> +			int sched_wfq_packet_mode_supported;
> +
> +			/** WFQ byte mode supported. When non-zero, this
> +			 * parameter indicates that current node supports
> byte
> +			 * mode for WFQ among its children. WFQ weights
> will be
> +			 * applied against  bytes for scheduling children when
> +			 * configured appropriately.
> +			 */
> +			int sched_wfq_byte_mode_supported;
> +
>  		} nonleaf;
> 
>  		/** Items valid only for leaf nodes. */
> @@ -836,10 +970,10 @@ struct rte_tm_wred_params {
>   * Token bucket
>   */
>  struct rte_tm_token_bucket {
> -	/** Token bucket rate (bytes per second) */
> +	/** Token bucket rate (bytes per second or packets per second) */
>  	uint64_t rate;
> 
> -	/** Token bucket size (bytes), a.k.a. max burst size */
> +	/** Token bucket size (bytes or packets), a.k.a. max burst size */
>  	uint64_t size;
>  };
> 
> @@ -860,6 +994,11 @@ struct rte_tm_token_bucket {
>   * Dual rate shapers use both the committed and the peak token buckets.
> The
>   * rate of the peak bucket has to be bigger than zero, as well as greater than
>   * or equal to the rate of the committed bucket.
> + *
> + * @see struct
> rte_tm_capabilities::shaper_private_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> + * @see struct
> rte_tm_capabilities::shaper_shared_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
>   */
>  struct rte_tm_shaper_params {
>  	/** Committed token bucket */
> @@ -874,6 +1013,17 @@ struct rte_tm_shaper_params {
>  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
>  	 */
>  	int32_t pkt_length_adjust;
> +
> +	/** When zero, the private or shared shaper that is associated to this
> +	 * profile works in byte mode and hence *rate* and *size* fields in
> +	 * both token bucket configurations are specified in bytes per second
> +	 * and bytes respectively.
> +	 * When non-zero, that private or shared shaper works in packet
> mode and
> +	 * hence *rate* and *size* fields in both token bucket configurations
> +	 * are specified in packets per second and packets respectively. In
> +	 * packet mode, *pkt_length_adjust* is ignored.
> +	 */

Please move the last statement ("In packet mode, *pkt_length_adjust* is ignored.") to the description of the pkt_length_adjust field.

> +	int packet_mode;
>  };
> 
>  /**
> @@ -925,6 +1075,8 @@ struct rte_tm_node_params {
>  			 * 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.
> +			 * @see struct
> rte_tm_node_capabilities::sched_wfq_packet_mode_supported
> +			 * @see struct
> rte_tm_node_capabilities::sched_wfq_byte_mode_supported
>  			 */
>  			int *wfq_weight_mode;
> 
> --
> 2.8.4

Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-21  9:30   ` [dpdk-dev] " Dumitrescu, Cristian
@ 2020-04-21  9:58     ` Nithin Dabilpuram
  2020-04-21 10:23       ` Dumitrescu, Cristian
  0 siblings, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-21  9:58 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Nithin Dabilpuram, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, dev, jerinj, kkanas

Hi Cristian,

On Tue, Apr 21, 2020 at 09:30:55AM +0000, Dumitrescu, Cristian wrote:
> Hi Nithin,
> 
> > -----Original Message-----
> > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > Sent: Saturday, April 11, 2020 12:44 PM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <arybchenko@solarflare.com>
> > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > Dabilpuram <ndabilpuram@marvell.com>
> > Subject: [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt
> > mode
> > 
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > 
> > Some NIC hardware support shaper to work in packet mode i.e
> > shaping or ratelimiting traffic is in packets per second (PPS) as
> > opposed to default bytes per second (BPS). Hence this patch
> > adds support to configure shared or private shaper in packet mode,
> > provide rate in PPS and add related tm capabilities in port/level/node
> > capability structures.
> > 
> > This patch also updates tm port/level/node capability structures with
> > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > and private/shared shaper byte mode.
> > 
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > ---
> > 
> > v1..v2:
> > - Add seperate capability for shaper and scheduler pktmode and bytemode.
> > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > packet mode shaper profile.
> > 
> >  lib/librte_ethdev/rte_tm.h | 156
> > ++++++++++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 154 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> > index f9c0cf3..38fff4c 100644
> > --- a/lib/librte_ethdev/rte_tm.h
> > +++ b/lib/librte_ethdev/rte_tm.h
> > @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
> >  	 */
> >  	uint64_t shaper_private_rate_max;
> > 
> > +	/** Shaper private packet mode supported. When non-zero, this
> > parameter
> > +	 * indicates that there is atleast one node that can be configured
> 
> Typo (please fix all occurrences): atleast -> at least
Ack.
> 
> > +	 * with packet mode in it's private shaper. When shaper is configured
> 
> Typo (please fix all occurrences): it's -> its
Ack.
> 
> > +	 * in packet mode, committed/peak rate provided is interpreted
> > +	 * in packets per second.
> > +	 */
> > +	int shaper_private_packet_mode_supported;
> > +
> > +	/** Shaper private byte mode supported. When non-zero, this
> > parameter
> > +	 * indicates that there is atleast one node that can be configured
> > +	 * with byte mode in it's private shaper. When shaper is configured
> > +	 * in byte mode, committed/peak rate provided is interpreted in
> > +	 * bytes per second.
> > +	 */
> > +	int shaper_private_byte_mode_supported;
> > +
> > +
> >  	/** Maximum number of shared shapers. The value of zero indicates
> > that
> >  	 * shared shapers are not supported.
> >  	 */
> > @@ -284,6 +301,21 @@ struct rte_tm_capabilities {
> >  	 */
> >  	uint64_t shaper_shared_rate_max;
> > 
> > +	/** Shaper shared packet mode supported. When non-zero, this
> > parameter
> > +	 * indicates a shared shaper can be configured with packet mode.
> > +	 * When shared shaper is configured in packet mode,
> > committed/peak rate
> > +	 * provided is interpreted in packets per second.
> > +	 */
> > +	int shaper_shared_packet_mode_supported;
> > +
> > +	/** Shaper shared byte mode supported. When non-zero, this
> > parameter
> > +	 * indicates that a shared shaper can be configured with byte mode.
> > +	 * When shared shaper is configured in byte mode, committed/peak
> > rate
> > +	 * provided is interpreted in bytes per second.
> > +	 */
> > +	int shaper_shared_byte_mode_supported;
> > +
> > +
> >  	/** Minimum value allowed for packet length adjustment for any
> > private
> >  	 * or shared shaper.
> >  	 */
> > @@ -339,6 +371,22 @@ struct rte_tm_capabilities {
> >  	 */
> >  	uint32_t sched_wfq_weight_max;
> > 
> > +	/** WFQ packet mode supported. When non-zero, this parameter
> > indicates
> > +	 * that there is at least one non-leaf node that supports packet mode
> > +	 * for WFQ among its children. WFQ weights will be applied against
> > +	 * packet count for scheduling children when a non-leaf node
> > +	 * is configured appropriately.
> > +	 */
> > +	int sched_wfq_packet_mode_supported;
> > +
> > +	/** WFQ byte mode supported. When non-zero, this parameter
> > indicates
> > +	 * that there is at least one non-leaf node that supports byte mode
> > +	 * for WFQ among its children. WFQ weights will be applied against
> > +	 * bytes for scheduling children when a non-leaf node is configured
> > +	 * appropriately.
> > +	 */
> > +	int sched_wfq_byte_mode_supported;
> > +
> >  	/** 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
> > @@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
> >  			 */
> >  			uint64_t shaper_private_rate_max;
> > 
> > +			/** Shaper private packet mode supported. When
> > non-zero,
> > +			 * this parameter indicates there is atleast one
> > +			 * non-leaf node at this level that can be configured
> > +			 * with packet mode in its private shaper. When
> > private
> > +			 * shaper is configured in packet mode,
> > committed/peak
> > +			 * rate provided is interpreted in packets per second.
> > +			 */
> > +			int shaper_private_packet_mode_supported;
> > +
> > +			/** Shaper private byte mode supported. When
> > non-zero,
> > +			 * this parameter indicates there is atleast one
> > +			 * non-leaf node at this level that can be configured
> > +			 * with byte mode in its private shaper. When private
> > +			 * shaper is configured in byte mode,
> > committed/peak
> > +			 * rate provided is interpreted in bytes per second.
> > +			 */
> > +			int shaper_private_byte_mode_supported;
> > +
> >  			/** Maximum number of shared shapers that any
> > non-leaf
> >  			 * node on this level can be part of. The value of zero
> >  			 * indicates that shared shapers are not supported by
> > @@ -554,6 +620,25 @@ struct rte_tm_level_capabilities {
> >  			 */
> >  			uint32_t sched_wfq_weight_max;
> > 
> > +			/** WFQ packet mode supported. When non-zero,
> > this
> > +			 * parameter indicates that there is at least one
> > +			 * non-leaf node at this level that supports packet
> > +			 * mode for WFQ among its children. WFQ weights
> > will
> > +			 * be applied against packet count for scheduling
> > +			 * children when a non-leaf node is configured
> > +			 * appropriately.
> > +			 */
> > +			int sched_wfq_packet_mode_supported;
> > +
> > +			/** WFQ byte mode supported. When non-zero, this
> > +			 * parameter indicates that there is at least one
> > +			 * non-leaf node at this level that supports byte
> > +			 * mode for WFQ among its children. WFQ weights
> > will
> > +			 * be applied against bytes for scheduling children
> > +			 * when a non-leaf node is configured appropriately.
> > +			 */
> > +			int sched_wfq_byte_mode_supported;
> > +
> >  			/** 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
> > @@ -596,6 +681,24 @@ struct rte_tm_level_capabilities {
> >  			 */
> >  			uint64_t shaper_private_rate_max;
> > 
> > +			/** Shaper private packet mode supported. When
> > non-zero,
> > +			 * this parameter indicates there is atleast one leaf
> > +			 * node at this level that can be configured with
> > +			 * packet mode in its private shaper. When private
> > +			 * shaper is configured in packet mode,
> > committed/peak
> > +			 * rate provided is interpreted in packets per second.
> > +			 */
> > +			int shaper_private_packet_mode_supported;
> > +
> > +			/** Shaper private byte mode supported. When
> > non-zero,
> > +			 * this parameter indicates there is atleast one leaf
> > +			 * node at this level that can be configured with
> > +			 * byte mode in its private shaper. When private
> > shaper
> > +			 * is configured in byte mode, committed/peak rate
> > +			 * provided is interpreted in bytes per second.
> > +			 */
> > +			int shaper_private_byte_mode_supported;
> > +
> >  			/** Maximum number of shared shapers that any
> > leaf node
> >  			 * on this level can be part of. The value of zero
> >  			 * indicates that shared shapers are not supported by
> 
> You are missing the shaper_shared_(packet, byte)_mode supported for non-leaf and leaf nodes in struct rte_tm_level_capabilities.
> 
> The description of this nodes should be aligned with the description of e.g. shaper_shared_n_max field: basically, we want to say that, when true, the flag signifies there is at least on non-leaf/leaf node on this level that can be part of a shared shaper that works in packet/byte mode. Makes sense?

I intentionally didn't add shaper_shared_(packet, byte)_mode in node and level
capabilities and added it in only global cap assuming existing semantics are 
enforcing that. 

Currently, except for 'shaper_shared_n_max', all the other existing shared shaper capabilities like 
shaper_shared_dual_rate_n_max, shaper_shared_rate_min, etc are only provided in global cap.

I felt the semantics are as such because, shared shaper doesn't really belong to any node
or level and any node from any level can attach to a particular shared shaper. Isn't it so
?



> 
> > @@ -686,6 +789,20 @@ struct rte_tm_node_capabilities {
> >  	 */
> >  	uint64_t shaper_private_rate_max;
> > 
> > +	/** Shaper private packet mode supported. When non-zero, this
> > parameter
> > +	 * indicates private shaper of current node can be configured with
> > +	 * packet mode. When configured in packet mode, committed/peak
> > rate
> > +	 * provided is interpreted in packets per second.
> > +	 */
> > +	int shaper_private_packet_mode_supported;
> > +
> > +	/** Shaper private byte mode supported. When non-zero, this
> > parameter
> > +	 * indicates private shaper of current node can be configured with
> > +	 * byte mode. When configured in byte mode, committed/peak rate
> > +	 * provided is interpreted in bytes per second.
> > +	 */
> > +	int shaper_private_byte_mode_supported;
> > +
> >  	/** Maximum number of shared shapers the current node can be
> > part of.
> >  	 * The value of zero indicates that shared shapers are not supported
> > by
> >  	 * the current node.
> 
> You are missing the shaper_shared_(packet, byte)_mode supported (applicable for both non-leaf and leaf nodes, so it should occur only once in the common part of the struct) in struct rte_tm_node_capabilities. See the above comment on the applicable description style.

Please see above.
>
> > @@ -735,6 +852,23 @@ struct rte_tm_node_capabilities {
> >  			 * WFQ weight, so WFQ is reduced to FQ.
> >  			 */
> >  			uint32_t sched_wfq_weight_max;
> > +
> > +			/** WFQ packet mode supported. When non-zero,
> > this
> > +			 * parameter indicates that current node supports
> > packet
> > +			 * mode for WFQ among its children. WFQ weights
> > will be
> > +			 * applied against packet count for scheduling
> > children
> > +			 * when configured appropriately.
> > +			 */
> > +			int sched_wfq_packet_mode_supported;
> > +
> > +			/** WFQ byte mode supported. When non-zero, this
> > +			 * parameter indicates that current node supports
> > byte
> > +			 * mode for WFQ among its children. WFQ weights
> > will be
> > +			 * applied against  bytes for scheduling children when
> > +			 * configured appropriately.
> > +			 */
> > +			int sched_wfq_byte_mode_supported;
> > +
> >  		} nonleaf;
> > 
> >  		/** Items valid only for leaf nodes. */
> > @@ -836,10 +970,10 @@ struct rte_tm_wred_params {
> >   * Token bucket
> >   */
> >  struct rte_tm_token_bucket {
> > -	/** Token bucket rate (bytes per second) */
> > +	/** Token bucket rate (bytes per second or packets per second) */
> >  	uint64_t rate;
> > 
> > -	/** Token bucket size (bytes), a.k.a. max burst size */
> > +	/** Token bucket size (bytes or packets), a.k.a. max burst size */
> >  	uint64_t size;
> >  };
> > 
> > @@ -860,6 +994,11 @@ struct rte_tm_token_bucket {
> >   * Dual rate shapers use both the committed and the peak token buckets.
> > The
> >   * rate of the peak bucket has to be bigger than zero, as well as greater than
> >   * or equal to the rate of the committed bucket.
> > + *
> > + * @see struct
> > rte_tm_capabilities::shaper_private_packet_mode_supported
> > + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> > + * @see struct
> > rte_tm_capabilities::shaper_shared_packet_mode_supported
> > + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
> >   */
> >  struct rte_tm_shaper_params {
> >  	/** Committed token bucket */
> > @@ -874,6 +1013,17 @@ struct rte_tm_shaper_params {
> >  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
> >  	 */
> >  	int32_t pkt_length_adjust;
> > +
> > +	/** When zero, the private or shared shaper that is associated to this
> > +	 * profile works in byte mode and hence *rate* and *size* fields in
> > +	 * both token bucket configurations are specified in bytes per second
> > +	 * and bytes respectively.
> > +	 * When non-zero, that private or shared shaper works in packet
> > mode and
> > +	 * hence *rate* and *size* fields in both token bucket configurations
> > +	 * are specified in packets per second and packets respectively. In
> > +	 * packet mode, *pkt_length_adjust* is ignored.
> > +	 */
> 
> Please move the last statement ("In packet mode, *pkt_length_adjust* is ignored.") to the description of the pkt_length_adjust field.
Ack.
> 
> > +	int packet_mode;
> >  };
> > 
> >  /**
> > @@ -925,6 +1075,8 @@ struct rte_tm_node_params {
> >  			 * 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.
> > +			 * @see struct
> > rte_tm_node_capabilities::sched_wfq_packet_mode_supported
> > +			 * @see struct
> > rte_tm_node_capabilities::sched_wfq_byte_mode_supported
> >  			 */
> >  			int *wfq_weight_mode;
> > 
> > --
> > 2.8.4
> 
> Regards,
> Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-21  9:58     ` Nithin Dabilpuram
@ 2020-04-21 10:23       ` Dumitrescu, Cristian
  2020-04-21 11:55         ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  0 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-21 10:23 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Nithin Dabilpuram, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, dev, jerinj, kkanas

Hi Nithin,

<snip>...

> > You are missing the shaper_shared_(packet, byte)_mode supported for
> non-leaf and leaf nodes in struct rte_tm_level_capabilities.
> >
> > The description of this nodes should be aligned with the description of e.g.
> shaper_shared_n_max field: basically, we want to say that, when true, the
> flag signifies there is at least on non-leaf/leaf node on this level that can be
> part of a shared shaper that works in packet/byte mode. Makes sense?
> 
> I intentionally didn't add shaper_shared_(packet, byte)_mode in node and
> level
> capabilities and added it in only global cap assuming existing semantics are
> enforcing that.
> 
> Currently, except for 'shaper_shared_n_max', all the other existing shared
> shaper capabilities like
> shaper_shared_dual_rate_n_max, shaper_shared_rate_min, etc are only
> provided in global cap.
> 
> I felt the semantics are as such because, shared shaper doesn't really belong
> to any node
> or level and any node from any level can attach to a particular shared shaper.
> Isn't it so
> ?

That's exactly why we need to formulate node/level capability from node's perspective, and not from the shared shaper's perspective, as a shared shaper is by definition related to a set of nodes, not just one node.

The fact that a given node can be part of a shared shaper that works in packet or byte mode, etc is a node capability in itself, right? So the node's capability called "shaper_shared_(packet, byte)_mode" being supported by the node means that this specific node can be part of a shared shaper that has those properties. To me, this is a valuable thing to capture in node/level capabilities.

We already have other node level capabilities for shared shaper, and we apply the same rationale there.

What do you think?

Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-21 10:23       ` Dumitrescu, Cristian
@ 2020-04-21 11:55         ` Nithin Dabilpuram
  0 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-21 11:55 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Nithin Dabilpuram, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, dev, jerinj, kkanas

On Tue, Apr 21, 2020 at 10:23:11AM +0000, Dumitrescu, Cristian wrote:
> External Email
> 
> ----------------------------------------------------------------------
> Hi Nithin,
> 
> <snip>...
> 
> > > You are missing the shaper_shared_(packet, byte)_mode supported for
> > non-leaf and leaf nodes in struct rte_tm_level_capabilities.
> > >
> > > The description of this nodes should be aligned with the description of e.g.
> > shaper_shared_n_max field: basically, we want to say that, when true, the
> > flag signifies there is at least on non-leaf/leaf node on this level that can be
> > part of a shared shaper that works in packet/byte mode. Makes sense?
> > 
> > I intentionally didn't add shaper_shared_(packet, byte)_mode in node and
> > level
> > capabilities and added it in only global cap assuming existing semantics are
> > enforcing that.
> > 
> > Currently, except for 'shaper_shared_n_max', all the other existing shared
> > shaper capabilities like
> > shaper_shared_dual_rate_n_max, shaper_shared_rate_min, etc are only
> > provided in global cap.
> > 
> > I felt the semantics are as such because, shared shaper doesn't really belong
> > to any node
> > or level and any node from any level can attach to a particular shared shaper.
> > Isn't it so
> > ?
> 
> That's exactly why we need to formulate node/level capability from node's perspective, and not from the shared shaper's perspective, as a shared shaper is by definition related to a set of nodes, not just one node.
> 
> The fact that a given node can be part of a shared shaper that works in packet or byte mode, etc is a node capability in itself, right? So the node's capability called "shaper_shared_(packet, byte)_mode" being supported by the node means that this specific node can be part of a shared shaper that has those properties. To me, this is a valuable thing to capture in node/level capabilities.
> 
> We already have other node level capabilities for shared shaper, and we apply the same rationale there.
> 
> What do you think?
Ok. I'll add them from the node's perspective. 
Thanks.

> 
> Regards,
> Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
                   ` (3 preceding siblings ...)
  2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
@ 2020-04-22  7:59 ` Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
                     ` (4 more replies)
  2020-04-22  8:05 ` [dpdk-dev] [PATCH v3 1/4] " Nithin Dabilpuram
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
  6 siblings, 5 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  7:59 UTC (permalink / raw)
  To: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Some NIC hardware support shaper to work in packet mode i.e
shaping or ratelimiting traffic is in packets per second (PPS) as
opposed to default bytes per second (BPS). Hence this patch
adds support to configure shared or private shaper in packet mode,
provide rate in PPS and add related tm capabilities in port/level/node
capability structures.

This patch also updates tm port/level/node capability structures with
exiting features of scheduler wfq packet mode, scheduler wfq byte mode
and private/shared shaper byte mode.

SoftNIC PMD is also updated with new capabilities.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v2..v3:
- Fix typo's
- Add shaper_shared_(packet, byte)_mode_supported in level and node cap
- Fix comment in pkt_length_adjust.
- Move rte_eth_softnic_tm.c capability update to patch 1/4 to 
  avoid compilations issues in node and level cap array in softnicpmd.
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around scalar initializer
   {.nonleaf = {
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in record or union initializer
   {.nonleaf = {

v1..v2:
- Add seperate capability for shaper and scheduler pktmode and bytemode.
- Add packet_mode field in struct rte_tm_shaper_params to indicate
packet mode shaper profile.


 drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
 lib/librte_ethdev/rte_tm.h               | 196 ++++++++++++++++++++++++++++++-
 2 files changed, 259 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
index 80a470c..344819f 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -447,6 +447,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_private_dual_rate_n_max = 0,
 	.shaper_private_rate_min = 1,
 	.shaper_private_rate_max = UINT32_MAX,
+	.shaper_private_packet_mode_supported = 0,
+	.shaper_private_byte_mode_supported = 1,
 
 	.shaper_shared_n_max = UINT32_MAX,
 	.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,
@@ -454,6 +456,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_shared_dual_rate_n_max = 0,
 	.shaper_shared_rate_min = 1,
 	.shaper_shared_rate_max = UINT32_MAX,
+	.shaper_shared_packet_mode_supported = 0,
+	.shaper_shared_byte_mode_supported = 1,
 
 	.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
 	.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
@@ -463,6 +467,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.sched_wfq_n_children_per_group_max = UINT32_MAX,
 	.sched_wfq_n_groups_max = 1,
 	.sched_wfq_weight_max = UINT32_MAX,
+	.sched_wfq_packet_mode_supported = 0,
+	.sched_wfq_byte_mode_supported = 1,
 
 	.cman_wred_packet_mode_supported = WRED_SUPPORTED,
 	.cman_wred_byte_mode_supported = 0,
@@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
@@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_groups_max = 1,
 #ifdef RTE_SCHED_SUBPORT_TC_OV
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 #else
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 #endif
+
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
 	},
@@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max =
 				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
@@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 1,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 1,
 
 			.sched_n_children_max =
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
@@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 0,
 			.shaper_private_rate_max = 0,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 0,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.cman_head_drop_supported = 0,
 			.cman_wred_packet_mode_supported = WRED_SUPPORTED,
@@ -736,7 +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -744,6 +785,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -762,6 +809,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 1,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 1,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 0,
 		.shaper_private_rate_max = 0,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 0,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 
 		{.leaf = {
diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
index f9c0cf3..b3865af 100644
--- a/lib/librte_ethdev/rte_tm.h
+++ b/lib/librte_ethdev/rte_tm.h
@@ -250,6 +250,23 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with packet mode in it's private shaper. When shaper is configured
+	 * in packet mode, committed/peak rate provided is interpreted
+	 * in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with byte mode in it's private shaper. When shaper is configured
+	 * in byte mode, committed/peak rate provided is interpreted in
+	 * bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
+
 	/** Maximum number of shared shapers. The value of zero indicates that
 	 * shared shapers are not supported.
 	 */
@@ -284,6 +301,21 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_shared_rate_max;
 
+	/** Shaper shared packet mode supported. When non-zero, this parameter
+	 * indicates a shared shaper can be configured with packet mode.
+	 * When shared shaper is configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero, this parameter
+	 * indicates that a shared shaper can be configured with byte mode.
+	 * When shared shaper is configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_shared_byte_mode_supported;
+
+
 	/** Minimum value allowed for packet length adjustment for any private
 	 * or shared shaper.
 	 */
@@ -339,6 +371,22 @@ struct rte_tm_capabilities {
 	 */
 	uint32_t sched_wfq_weight_max;
 
+	/** WFQ packet mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports packet mode
+	 * for WFQ among it's children. WFQ weights will be applied against
+	 * packet count for scheduling children when a non-leaf node
+	 * is configured appropriately.
+	 */
+	int sched_wfq_packet_mode_supported;
+
+	/** WFQ byte mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports byte mode
+	 * for WFQ among it's children. WFQ weights will be applied against
+	 * bytes for scheduling children when a non-leaf node is configured
+	 * appropriately.
+	 */
+	int sched_wfq_byte_mode_supported;
+
 	/** 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
@@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with packet mode in it's private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with byte mode in it's private shaper. When private
+			 * shaper is configured in byte mode, committed/peak
+			 * rate provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any non-leaf
 			 * node on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -495,6 +561,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** Maximum number of children nodes. This parameter
 			 * indicates that there is at least one non-leaf node on
 			 * this level that can be configured with this many
@@ -554,6 +634,25 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t sched_wfq_weight_max;
 
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports packet
+			 * mode for WFQ among it's children. WFQ weights will
+			 * be applied against packet count for scheduling
+			 * children when a non-leaf node is configured
+			 * appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports byte
+			 * mode for WFQ among it's children. WFQ weights will
+			 * be applied against bytes for scheduling children
+			 * when a non-leaf node is configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 			/** 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
@@ -596,6 +695,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * packet mode in it's private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * byte mode in it's private shaper. When private shaper
+			 * is configured in byte mode, committed/peak rate
+			 * provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any leaf node
 			 * on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -606,6 +723,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** WRED packet mode support. When non-zero, this
 			 * parameter indicates that there is at least one leaf
 			 * node on this level that supports the WRED packet
@@ -686,12 +817,38 @@ struct rte_tm_node_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * packet mode. When configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * byte mode. When configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
 	/** Maximum number of shared shapers the current node can be part of.
 	 * The value of zero indicates that shared shapers are not supported by
 	 * the current node.
 	 */
 	uint32_t shaper_shared_n_max;
 
+	/** Shaper shared packet mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in packet mode.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in byte mode.
+	 */
+	int shaper_shared_byte_mode_supported;
+
 	RTE_STD_C11
 	union {
 		/** Items valid only for non-leaf nodes. */
@@ -735,6 +892,23 @@ struct rte_tm_node_capabilities {
 			 * WFQ weight, so WFQ is reduced to FQ.
 			 */
 			uint32_t sched_wfq_weight_max;
+
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that current node supports packet
+			 * mode for WFQ among it's children. WFQ weights will be
+			 * applied against packet count for scheduling children
+			 * when configured appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that current node supports byte
+			 * mode for WFQ among it's children. WFQ weights will be
+			 * applied against  bytes for scheduling children when
+			 * configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 		} nonleaf;
 
 		/** Items valid only for leaf nodes. */
@@ -836,10 +1010,10 @@ struct rte_tm_wred_params {
  * Token bucket
  */
 struct rte_tm_token_bucket {
-	/** Token bucket rate (bytes per second) */
+	/** Token bucket rate (bytes per second or packets per second) */
 	uint64_t rate;
 
-	/** Token bucket size (bytes), a.k.a. max burst size */
+	/** Token bucket size (bytes or packets), a.k.a. max burst size */
 	uint64_t size;
 };
 
@@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
  * Dual rate shapers use both the committed and the peak token buckets. The
  * rate of the peak bucket has to be bigger than zero, as well as greater than
  * or equal to the rate of the committed bucket.
+ *
+ * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
  */
 struct rte_tm_shaper_params {
 	/** Committed token bucket */
@@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
 	 * purpose of shaping. Can be used to correct the packet length with
 	 * the framing overhead bytes that are also consumed on the wire (e.g.
 	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
+	 * This field is ignored when the profile enables packet mode.
 	 */
 	int32_t pkt_length_adjust;
+
+	/** When zero, the private or shared shaper that is associated to this
+	 * profile works in byte mode and hence *rate* and *size* fields in
+	 * both token bucket configurations are specified in bytes per second
+	 * and bytes respectively.
+	 * When non-zero, that private or shared shaper works in packet mode and
+	 * hence *rate* and *size* fields in both token bucket configurations
+	 * are specified in packets per second and packets respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -925,6 +1115,8 @@ struct rte_tm_node_params {
 			 * 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.
+			 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported
+			 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported
 			 */
 			int *wfq_weight_mode;
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] drivers/net: update tm capability for existing pmds
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
@ 2020-04-22  7:59   ` Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  7:59 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang, Rosen Xu, Wenzhuo Lu, Konstantin Ananyev,
	Liron Himi
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Since existing PMD's support shaper byte mode and scheduler
wfq byte mode, update the same in their port/level/node capabilities
that are added. SoftNIC PMD is already upto date with new capabilities.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v2..v3:
- Update node/level cap with shaper_shared_(packet, byte)_mode_supported.

v2:
- Newly included patch to change exiting pmd's with tm support of byte mode 
to show the same in port/level/node cap.
 drivers/net/i40e/i40e_tm.c     | 22 ++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_tm.c   | 22 ++++++++++++++++++++++
 drivers/net/mvpp2/mrvl_tm.c    | 14 ++++++++++++++
 4 files changed, 96 insertions(+)

diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c
index c76760c..5d722f9 100644
--- a/drivers/net/i40e/i40e_tm.c
+++ b/drivers/net/i40e/i40e_tm.c
@@ -160,12 +160,16 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->func_caps.num_tx_qp;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -179,6 +183,8 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	 * So, all the nodes should have the same weight.
 	 */
 	cap->sched_wfq_weight_max = 1;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	cap->cman_head_drop_supported = 0;
 	cap->dynamic_update_mask = 0;
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD;
@@ -754,7 +760,11 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 40Gbps -> 5GBps */
 		cap->nonleaf.shaper_private_rate_max = 5000000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 		if (level_id == I40E_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
 				I40E_MAX_TRAFFIC_CLASS;
@@ -765,6 +775,8 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -776,7 +788,11 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->leaf.shaper_private_rate_max = 5000000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
+	cap->leaf.shaper_shared_packet_mode_supported = 0;
+	cap->leaf.shaper_shared_byte_mode_supported = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
 	cap->leaf.cman_wred_context_shared_n_max = 0;
@@ -817,7 +833,11 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	if (node_type == I40E_TM_NODE_TYPE_QUEUE) {
 		cap->leaf.cman_head_drop_supported = false;
@@ -834,6 +854,8 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 5a16c5f..17ac026 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -440,6 +440,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_private_dual_rate_n_max = 0;
 	cap->shaper_private_rate_min = 1;
 	cap->shaper_private_rate_max = 1 + IPN3KE_TM_VT_NODE_NUM;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
@@ -447,6 +449,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
 	cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
@@ -456,6 +460,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->sched_wfq_n_children_per_group_max = UINT32_MAX;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = UINT32_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->cman_wred_packet_mode_supported = 0;
 	cap->cman_wred_byte_mode_supported = 0;
@@ -517,13 +523,19 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -539,13 +551,19 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -561,7 +579,11 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_dual_rate_supported = 0;
 		cap->leaf.shaper_private_rate_min = 0;
 		cap->leaf.shaper_private_rate_max = 0;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.shaper_shared_n_max = 0;
+		cap->leaf.shaper_shared_packet_mode_supported = 0;
+		cap->leaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
 		cap->leaf.cman_wred_packet_mode_supported = WRED_SUPPORTED;
@@ -632,7 +654,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -640,6 +666,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -649,7 +677,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -657,6 +689,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -666,7 +700,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 0;
 		cap->shaper_private_rate_max = 0;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 0;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
 		cap->leaf.cman_wred_packet_mode_supported = WRED_SUPPORTED;
diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index 73845a7..a8407e7 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -168,12 +168,16 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->mac.max_tx_queues;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -182,6 +186,8 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->sched_sp_n_priorities_max = 1;
 	cap->sched_wfq_n_children_per_group_max = 0;
 	cap->sched_wfq_n_groups_max = 0;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	/**
 	 * SW only supports fair round robin now.
 	 * So, all the nodes should have the same weight.
@@ -875,7 +881,11 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 10Gbps -> 1.25GBps */
 		cap->nonleaf.shaper_private_rate_max = 1250000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 		if (level_id == IXGBE_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
 				IXGBE_DCB_MAX_TRAFFIC_CLASS;
@@ -886,6 +896,8 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -897,7 +909,11 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->leaf.shaper_private_rate_max = 1250000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
+	cap->leaf.shaper_shared_packet_mode_supported = 0;
+	cap->leaf.shaper_shared_byte_mode_supported = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
 	cap->leaf.cman_wred_context_shared_n_max = 0;
@@ -938,7 +954,11 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	if (node_type == IXGBE_TM_NODE_TYPE_QUEUE) {
 		cap->leaf.cman_head_drop_supported = false;
@@ -955,6 +975,8 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c
index 3de8997..e98f576 100644
--- a/drivers/net/mvpp2/mrvl_tm.c
+++ b/drivers/net/mvpp2/mrvl_tm.c
@@ -193,12 +193,16 @@ mrvl_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_n_max = cap->shaper_n_max;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->sched_n_children_max = dev->data->nb_tx_queues;
 	cap->sched_sp_n_priorities_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_children_per_group_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask = RTE_TM_UPDATE_NODE_SUSPEND_RESUME |
 				   RTE_TM_UPDATE_NODE_STATS;
@@ -244,6 +248,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_supported = 1;
 		cap->nonleaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->nonleaf.shaper_private_rate_max = priv->rate_max;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -251,6 +257,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->nonleaf.stats_mask = RTE_TM_STATS_N_PKTS |
 					  RTE_TM_STATS_N_BYTES;
 	} else { /* level_id == MRVL_NODE_QUEUE */
@@ -261,6 +269,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_supported = 1;
 		cap->leaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->leaf.shaper_private_rate_max = priv->rate_max;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.stats_mask = RTE_TM_STATS_N_PKTS;
 	}
 
@@ -300,6 +310,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 	cap->shaper_private_supported = 1;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	if (node->type == MRVL_NODE_PORT) {
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
@@ -308,6 +320,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->stats_mask = RTE_TM_STATS_N_PKTS | RTE_TM_STATS_N_BYTES;
 	} else {
 		cap->stats_mask = RTE_TM_STATS_N_PKTS;
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
@ 2020-04-22  7:59   ` Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  7:59 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

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".

Also add support to shaper profile add command to take
packet mode parameter used to setup shaper in packet mode.
This adds an extra argument "packet_mode" to shaper profile add command
"add port tm node shaper profile" as last argument.

This patch also dumps new tm port/level/node capabilities
sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported,
shaper_private_packet_mode_supported, shaper_private_byte_mode_supported,
shaper_shared_packet_mode_supported, shaper_shared_byte_mode_supported.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v2..v3:
- Update cmdline dump of node/level cap.

v1..v2:
- Update tm capability show cmd to dump lastest pktmode/bytemode fields of v2.
- Update existing shaper profile add command to take last argument as pkt_mode
and update struct rte_tm_shaper_params:packet_mode with the same.
- Update documentation with latest command changes.

 app/test-pmd/cmdline.c                      |   9 +-
 app/test-pmd/cmdline_tm.c                   | 220 ++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h                   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 ++++-
 4 files changed, 264 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 22fb23a..880ec61 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1189,7 +1189,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"add port tm node shaper profile (port_id) (shaper_profile_id)"
 			" (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
-			" (packet_length_adjust)\n"
+			" (packet_length_adjust) (packet_mode)\n"
 			"       Add port tm node private shaper profile.\n\n"
 
 			"del port tm node shaper profile (port_id) (shaper_profile_id)\n"
@@ -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)"
@@ -19655,6 +19661,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 6951beb..1f35fa7 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -257,6 +257,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		cap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		cap.shaper_shared_n_max);
 	printf("cap.shaper_shared_n_nodes_per_shaper_max %" PRIu32 "\n",
@@ -269,6 +273,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_shared_rate_min);
 	printf("cap.shaper_shared_rate_max %" PRIu64 "\n",
 		cap.shaper_shared_rate_max);
+	printf("cap.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_packet_mode_supported);
+	printf("cap.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_byte_mode_supported);
 	printf("cap.shaper_pkt_length_adjust_min %" PRId32 "\n",
 		cap.shaper_pkt_length_adjust_min);
 	printf("cap.shaper_pkt_length_adjust_max %" PRId32 "\n",
@@ -283,6 +291,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_packet_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_packet_mode_supported);
+	printf("cap.sched_wfq_byte_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_byte_mode_supported);
 	printf("cap.cman_head_drop_supported %" PRId32 "\n",
 		cap.cman_head_drop_supported);
 	printf("cap.cman_wred_context_n_max %" PRIu32 "\n",
@@ -401,8 +413,19 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.nonleaf.shaper_private_rate_min);
 		printf("cap.nonleaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.nonleaf.shaper_private_rate_max);
+		printf("cap.nonleaf.shaper_private_packet_mode_supported %"
+		       PRId32 "\n",
+			lcap.nonleaf.shaper_private_packet_mode_supported);
+		printf("cap.nonleaf.shaper_private_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.shaper_private_byte_mode_supported);
 		printf("cap.nonleaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.nonleaf.shaper_shared_n_max);
+		printf("cap.nonleaf.shaper_shared_packet_mode_supported %"
+		       PRId32 "\n",
+		       lcap.nonleaf.shaper_shared_packet_mode_supported);
+		printf("cap.nonleaf.shaper_shared_byte_mode_supported %"
+		       PRId32 "\n",
+		       lcap.nonleaf.shaper_shared_byte_mode_supported);
 		printf("cap.nonleaf.sched_n_children_max %" PRIu32 "\n",
 			lcap.nonleaf.sched_n_children_max);
 		printf("cap.nonleaf.sched_sp_n_priorities_max %" PRIu32 "\n",
@@ -413,6 +436,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_packet_mode_supported %" PRId32 "\n",
+			lcap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.sched_wfq_byte_mode_supported);
 		printf("cap.nonleaf.stats_mask %" PRIx64 "\n",
 			lcap.nonleaf.stats_mask);
 	} else {
@@ -424,8 +451,16 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.leaf.shaper_private_rate_min);
 		printf("cap.leaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.leaf.shaper_private_rate_max);
+		printf("cap.leaf.shaper_private_packet_mode_supported %" PRId32
+		       "\n", lcap.leaf.shaper_private_packet_mode_supported);
+		printf("cap.leaf.shaper_private_byte_mode_supported %" PRId32 "\n",
+			lcap.leaf.shaper_private_byte_mode_supported);
 		printf("cap.leaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.leaf.shaper_shared_n_max);
+		printf("cap.leaf.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		       lcap.leaf.shaper_shared_packet_mode_supported);
+		printf("cap.leaf.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		       lcap.leaf.shaper_shared_byte_mode_supported);
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
 			lcap.leaf.cman_head_drop_supported);
 		printf("cap.leaf.cman_wred_context_private_supported %"	PRId32
@@ -524,8 +559,16 @@ static void cmd_show_port_tm_node_cap_parsed(void *parsed_result,
 		ncap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		ncap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		ncap.shaper_shared_n_max);
+	printf("cap.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		ncap.shaper_shared_packet_mode_supported);
+	printf("cap.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		ncap.shaper_shared_byte_mode_supported);
 	if (!is_leaf) {
 		printf("cap.nonleaf.sched_n_children_max %" PRIu32 "\n",
 			ncap.nonleaf.sched_n_children_max);
@@ -537,6 +580,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_packet_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_byte_mode_supported);
 	} else {
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
 			ncap.leaf.cman_head_drop_supported);
@@ -776,6 +823,7 @@ struct cmd_add_port_tm_node_shaper_profile_result {
 	uint64_t peak_tb_rate;
 	uint64_t peak_tb_size;
 	uint32_t pktlen_adjust;
+	int pkt_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_tm_node_shaper_profile_add =
@@ -829,6 +877,10 @@ cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_pktlen_adjust =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_tm_node_shaper_profile_result,
 			pktlen_adjust, UINT32);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_tm_node_shaper_profile_result,
+			pkt_mode, UINT32);
 
 static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -853,6 +905,7 @@ static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	sp.peak.rate = res->peak_tb_rate;
 	sp.peak.size = res->peak_tb_size;
 	sp.pkt_length_adjust = pkt_len_adjust;
+	sp.packet_mode = res->pkt_mode;
 
 	ret = rte_tm_shaper_profile_add(port_id, shaper_id, &sp, &error);
 	if (ret != 0) {
@@ -879,6 +932,7 @@ cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile = {
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_rate,
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_size,
 		(void *)&cmd_add_port_tm_node_shaper_profile_pktlen_adjust,
+		(void *)&cmd_add_port_tm_node_shaper_profile_packet_mode,
 		NULL,
 	},
 };
@@ -1671,6 +1725,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 a360ecc..7513a97 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2842,19 +2842,22 @@ Add the port traffic management private shaper profile::
 
    testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
    (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
-   (packet_length_adjust)
+   (packet_length_adjust) (packet_mode)
 
 where:
 
 * ``shaper_profile id``: Shaper profile ID for the new profile.
-* ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
-* ``cmit_tb_size``: Committed token bucket size (bytes).
-* ``peak_tb_rate``: Peak token bucket rate (bytes per second).
-* ``peak_tb_size``: Peak token bucket size (bytes).
+* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
+* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
+* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
+* ``peak_tb_size``: Peak token bucket size (bytes or packets).
 * ``packet_length_adjust``: The value (bytes) to be added to the length of
   each packet for the purpose of shaping. This parameter value can be used to
   correct the packet length with the framing overhead bytes that are consumed
   on the wire.
+* ``packet_mode``: Shaper configured in packet mode. This parameter value if
+  zero, configures shaper in byte mode and if non-zero configures it in packet
+  mode.
 
 Delete port traffic management private shaper profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2979,6 +2982,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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] net/octeontx2: support tm length adjust and pkt mode
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
@ 2020-04-22  7:59   ` Nithin Dabilpuram
  2020-04-22  8:09   ` [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in " Nithin Dabilpuram
  2020-04-22 10:10   ` [dpdk-dev] " Dumitrescu, Cristian
  4 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  7:59 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K; +Cc: dev, kkanas

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

This patch adds support to packet length adjust TM feature
for private shaper. It also adds support to packet mode
feature that applies both to private shaper and node DWRR
scheduling of SP children.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v2..v3:
- No change.

v1..v2:
- Newly included patch.

 drivers/net/octeontx2/otx2_tm.c | 140 +++++++++++++++++++++++++++++++++-------
 drivers/net/octeontx2/otx2_tm.h |   5 ++
 2 files changed, 122 insertions(+), 23 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_tm.c b/drivers/net/octeontx2/otx2_tm.c
index f94618d..fa7d21b 100644
--- a/drivers/net/octeontx2/otx2_tm.c
+++ b/drivers/net/octeontx2/otx2_tm.c
@@ -336,18 +336,25 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 {
 	struct shaper_params cir, pir;
 	uint32_t schq = tm_node->hw_id;
+	uint64_t adjust = 0;
 	uint8_t k = 0;
 
 	memset(&cir, 0, sizeof(cir));
 	memset(&pir, 0, sizeof(pir));
 	shaper_config_to_nix(profile, &cir, &pir);
 
-	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, "
-		    "pir %" PRIu64 "(%" PRIu64 "B),"
-		     " cir %" PRIu64 "(%" PRIu64 "B) (%p)",
-		     nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
-		     tm_node->id, pir.rate, pir.burst,
-		     cir.rate, cir.burst, tm_node);
+	/* Packet length adjust */
+	if (tm_node->pkt_mode)
+		adjust = 1;
+	else if (profile)
+		adjust = profile->params.pkt_length_adjust & 0x1FF;
+
+	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, pir %" PRIu64
+		    "(%" PRIu64 "B), cir %" PRIu64 "(%" PRIu64 "B)"
+		    "adjust 0x%" PRIx64 "(pktmode %u) (%p)",
+		    nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
+		    tm_node->id, pir.rate, pir.burst, cir.rate, cir.burst,
+		    adjust, tm_node->pkt_mode, tm_node);
 
 	switch (tm_node->hw_lvl) {
 	case NIX_TXSCH_LVL_SMQ:
@@ -364,7 +371,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED ALG */
 		reg[k] = NIX_AF_MDQX_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL4:
@@ -381,7 +390,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL4X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL3:
@@ -398,7 +409,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL3X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -416,7 +429,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL2X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -426,6 +441,12 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 		regval[k] = (cir.rate && cir.burst) ?
 				(shaper2regval(&cir) | 1) : 0;
 		k++;
+
+		/* Configure length disable and adjust */
+		reg[k] = NIX_AF_TL1X_SHAPE(schq);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->pkt_mode << 24);
+		k++;
 		break;
 	}
 
@@ -773,6 +794,15 @@ nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id,
 	tm_node->flags = 0;
 	if (user)
 		tm_node->flags = NIX_TM_NODE_USER;
+
+	/* Packet mode */
+	if (!nix_tm_is_leaf(dev, lvl) &&
+	    ((profile && profile->params.packet_mode) ||
+	     (params->nonleaf.wfq_weight_mode &&
+	      params->nonleaf.n_sp_priorities &&
+	      !params->nonleaf.wfq_weight_mode[0])))
+		tm_node->pkt_mode = 1;
+
 	rte_memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params));
 
 	if (profile)
@@ -1873,8 +1903,10 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->shaper_private_dual_rate_n_max = max_nr_nodes;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
-	cap->shaper_pkt_length_adjust_min = 0;
-	cap->shaper_pkt_length_adjust_max = 0;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
+	cap->shaper_pkt_length_adjust_min = NIX_LENGTH_ADJUST_MIN;
+	cap->shaper_pkt_length_adjust_max = NIX_LENGTH_ADJUST_MAX;
 
 	/* Schedule Capabilities */
 	cap->sched_n_children_max = rsp->schq[NIX_TXSCH_LVL_MDQ];
@@ -1882,6 +1914,8 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->sched_wfq_n_children_per_group_max = cap->sched_n_children_max;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->sched_wfq_packet_mode_supported = 1;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask =
 		RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL |
@@ -1944,12 +1978,16 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_tm_have_tl1_access(dev) ? false : true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = rsp->schq[hw_lvl - 1];
 		cap->nonleaf.sched_sp_n_priorities_max =
 					nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 		if (nix_tm_have_tl1_access(dev))
 			cap->nonleaf.stats_mask =
@@ -1966,6 +2004,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 		cap->nonleaf.shaper_private_dual_rate_supported = true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		/* MDQ doesn't support Strict Priority */
 		if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -1977,6 +2017,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 	} else {
 		/* unsupported level */
 		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
@@ -2029,6 +2071,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		(hw_lvl == NIX_TXSCH_LVL_TL1) ? false : true;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	/* Non Leaf Scheduler */
 	if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -2041,6 +2085,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		cap->nonleaf.sched_n_children_max;
 	cap->nonleaf.sched_wfq_n_groups_max = 1;
 	cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+	cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 	if (hw_lvl == NIX_TXSCH_LVL_TL1)
 		cap->stats_mask = RTE_TM_STATS_N_PKTS_RED_DROPPED |
@@ -2096,6 +2142,13 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (params->pkt_length_adjust < NIX_LENGTH_ADJUST_MIN ||
+	    params->pkt_length_adjust > NIX_LENGTH_ADJUST_MAX) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN;
+		error->message = "length adjust invalid";
+		return -EINVAL;
+	}
+
 	profile = rte_zmalloc("otx2_nix_tm_shaper_profile",
 			      sizeof(struct otx2_nix_tm_shaper_profile), 0);
 	if (!profile)
@@ -2108,13 +2161,14 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 
 	otx2_tm_dbg("Added TM shaper profile %u, "
 		    " pir %" PRIu64 " , pbs %" PRIu64 ", cir %" PRIu64
-		    ", cbs %" PRIu64 " , adj %u",
+		    ", cbs %" PRIu64 " , adj %u, pkt mode %d",
 		    profile_id,
 		    params->peak.rate * 8,
 		    params->peak.size,
 		    params->committed.rate * 8,
 		    params->committed.size,
-		    params->pkt_length_adjust);
+		    params->pkt_length_adjust,
+		    params->packet_mode);
 
 	/* Translate rate as bits per second */
 	profile->params.peak.rate = profile->params.peak.rate * 8;
@@ -2170,9 +2224,11 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		     struct rte_tm_error *error)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_nix_tm_shaper_profile *profile = NULL;
 	struct otx2_nix_tm_node *parent_node;
-	int rc, clear_on_fail = 0;
-	uint32_t exp_next_lvl;
+	int rc, pkt_mode, clear_on_fail = 0;
+	uint32_t exp_next_lvl, i;
+	uint32_t profile_id;
 	uint16_t hw_lvl;
 
 	/* we don't support dynamic updates */
@@ -2234,13 +2290,45 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		return -EINVAL;
 	}
 
-	/* Check if shaper profile exists for non leaf node */
-	if (!nix_tm_is_leaf(dev, lvl) &&
-	    params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE &&
-	    !nix_tm_shaper_profile_search(dev, params->shaper_profile_id)) {
-		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
-		error->message = "invalid shaper profile";
-		return -EINVAL;
+	if (!nix_tm_is_leaf(dev, lvl)) {
+		/* Check if shaper profile exists for non leaf node */
+		profile_id = params->shaper_profile_id;
+		profile = nix_tm_shaper_profile_search(dev, profile_id);
+		if (profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE && !profile) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+			error->message = "invalid shaper profile";
+			return -EINVAL;
+		}
+
+		/* Minimum static priority count is 1 */
+		if (!params->nonleaf.n_sp_priorities ||
+		    params->nonleaf.n_sp_priorities > TXSCH_TLX_SP_PRIO_MAX) {
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES;
+			error->message = "invalid sp priorities";
+			return -EINVAL;
+		}
+
+		pkt_mode = 0;
+		/* Validate weight mode */
+		for (i = 0; i < params->nonleaf.n_sp_priorities &&
+		     params->nonleaf.wfq_weight_mode; i++) {
+			pkt_mode = !params->nonleaf.wfq_weight_mode[i];
+			if (pkt_mode == !params->nonleaf.wfq_weight_mode[0])
+				continue;
+
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE;
+			error->message = "unsupported weight mode";
+			return -EINVAL;
+		}
+
+		if (profile && params->nonleaf.n_sp_priorities &&
+		    pkt_mode != profile->params.packet_mode) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
+			error->message = "shaper wfq packet mode mismatch";
+			return -EINVAL;
+		}
 	}
 
 	/* Check if there is second DWRR already in siblings or holes in prio */
@@ -2482,6 +2570,12 @@ otx2_nix_tm_node_shaper_update(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (profile && profile->params.packet_mode != tm_node->pkt_mode) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+		error->message = "shaper profile pkt mode mismatch";
+		return -EINVAL;
+	}
+
 	tm_node->params.shaper_profile_id = profile_id;
 
 	/* Nothing to do if not yet committed */
diff --git a/drivers/net/octeontx2/otx2_tm.h b/drivers/net/octeontx2/otx2_tm.h
index 9675182..cdca987 100644
--- a/drivers/net/octeontx2/otx2_tm.h
+++ b/drivers/net/octeontx2/otx2_tm.h
@@ -48,6 +48,7 @@ struct otx2_nix_tm_node {
 #define NIX_TM_NODE_USER	BIT_ULL(2)
 	/* Shaper algorithm for RED state @NIX_REDALG_E */
 	uint32_t red_algo:2;
+	uint32_t pkt_mode:1;
 
 	struct otx2_nix_tm_node *parent;
 	struct rte_tm_node_params params;
@@ -114,6 +115,10 @@ TAILQ_HEAD(otx2_nix_tm_shaper_profile_list, otx2_nix_tm_shaper_profile);
 #define MAX_SHAPER_RATE \
 	SHAPER_RATE(MAX_RATE_EXPONENT, MAX_RATE_MANTISSA, 0)
 
+/* Min is limited so that NIX_AF_SMQX_CFG[MINLEN]+ADJUST is not -ve */
+#define NIX_LENGTH_ADJUST_MIN ((int)-NIX_MIN_HW_FRS + 1)
+#define NIX_LENGTH_ADJUST_MAX 255
+
 /** TM Shaper - low level operations */
 
 /** NIX burst limits */
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
                   ` (4 preceding siblings ...)
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
@ 2020-04-22  8:05 ` Nithin Dabilpuram
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
  6 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  8:05 UTC (permalink / raw)
  To: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Some NIC hardware support shaper to work in packet mode i.e
shaping or ratelimiting traffic is in packets per second (PPS) as
opposed to default bytes per second (BPS). Hence this patch
adds support to configure shared or private shaper in packet mode,
provide rate in PPS and add related tm capabilities in port/level/node
capability structures.

This patch also updates tm port/level/node capability structures with
exiting features of scheduler wfq packet mode, scheduler wfq byte mode
and private/shared shaper byte mode.

SoftNIC PMD is also updated with new capabilities.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v2..v3:
- Fix typo's
- Add shaper_shared_(packet, byte)_mode_supported in level and node cap
- Fix comment in pkt_length_adjust.
- Move rte_eth_softnic_tm.c capability update to patch 1/4 to 
  avoid compilations issues in node and level cap array in softnicpmd.
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around scalar initializer
   {.nonleaf = {
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in record or union initializer
   {.nonleaf = {

v1..v2:
- Add seperate capability for shaper and scheduler pktmode and bytemode.
- Add packet_mode field in struct rte_tm_shaper_params to indicate
packet mode shaper profile.


 drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
 lib/librte_ethdev/rte_tm.h               | 196 ++++++++++++++++++++++++++++++-
 2 files changed, 259 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
index 80a470c..344819f 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -447,6 +447,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_private_dual_rate_n_max = 0,
 	.shaper_private_rate_min = 1,
 	.shaper_private_rate_max = UINT32_MAX,
+	.shaper_private_packet_mode_supported = 0,
+	.shaper_private_byte_mode_supported = 1,
 
 	.shaper_shared_n_max = UINT32_MAX,
 	.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,
@@ -454,6 +456,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_shared_dual_rate_n_max = 0,
 	.shaper_shared_rate_min = 1,
 	.shaper_shared_rate_max = UINT32_MAX,
+	.shaper_shared_packet_mode_supported = 0,
+	.shaper_shared_byte_mode_supported = 1,
 
 	.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
 	.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
@@ -463,6 +467,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.sched_wfq_n_children_per_group_max = UINT32_MAX,
 	.sched_wfq_n_groups_max = 1,
 	.sched_wfq_weight_max = UINT32_MAX,
+	.sched_wfq_packet_mode_supported = 0,
+	.sched_wfq_byte_mode_supported = 1,
 
 	.cman_wred_packet_mode_supported = WRED_SUPPORTED,
 	.cman_wred_byte_mode_supported = 0,
@@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
@@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_groups_max = 1,
 #ifdef RTE_SCHED_SUBPORT_TC_OV
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 #else
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 #endif
+
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
 	},
@@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max =
 				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
@@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 1,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 1,
 
 			.sched_n_children_max =
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
@@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 0,
 			.shaper_private_rate_max = 0,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 0,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.cman_head_drop_supported = 0,
 			.cman_wred_packet_mode_supported = WRED_SUPPORTED,
@@ -736,7 +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -744,6 +785,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -762,6 +809,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 1,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 1,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 0,
 		.shaper_private_rate_max = 0,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 0,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 
 		{.leaf = {
diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
index f9c0cf3..b3865af 100644
--- a/lib/librte_ethdev/rte_tm.h
+++ b/lib/librte_ethdev/rte_tm.h
@@ -250,6 +250,23 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with packet mode in it's private shaper. When shaper is configured
+	 * in packet mode, committed/peak rate provided is interpreted
+	 * in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with byte mode in it's private shaper. When shaper is configured
+	 * in byte mode, committed/peak rate provided is interpreted in
+	 * bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
+
 	/** Maximum number of shared shapers. The value of zero indicates that
 	 * shared shapers are not supported.
 	 */
@@ -284,6 +301,21 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_shared_rate_max;
 
+	/** Shaper shared packet mode supported. When non-zero, this parameter
+	 * indicates a shared shaper can be configured with packet mode.
+	 * When shared shaper is configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero, this parameter
+	 * indicates that a shared shaper can be configured with byte mode.
+	 * When shared shaper is configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_shared_byte_mode_supported;
+
+
 	/** Minimum value allowed for packet length adjustment for any private
 	 * or shared shaper.
 	 */
@@ -339,6 +371,22 @@ struct rte_tm_capabilities {
 	 */
 	uint32_t sched_wfq_weight_max;
 
+	/** WFQ packet mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports packet mode
+	 * for WFQ among it's children. WFQ weights will be applied against
+	 * packet count for scheduling children when a non-leaf node
+	 * is configured appropriately.
+	 */
+	int sched_wfq_packet_mode_supported;
+
+	/** WFQ byte mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports byte mode
+	 * for WFQ among it's children. WFQ weights will be applied against
+	 * bytes for scheduling children when a non-leaf node is configured
+	 * appropriately.
+	 */
+	int sched_wfq_byte_mode_supported;
+
 	/** 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
@@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with packet mode in it's private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with byte mode in it's private shaper. When private
+			 * shaper is configured in byte mode, committed/peak
+			 * rate provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any non-leaf
 			 * node on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -495,6 +561,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** Maximum number of children nodes. This parameter
 			 * indicates that there is at least one non-leaf node on
 			 * this level that can be configured with this many
@@ -554,6 +634,25 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t sched_wfq_weight_max;
 
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports packet
+			 * mode for WFQ among it's children. WFQ weights will
+			 * be applied against packet count for scheduling
+			 * children when a non-leaf node is configured
+			 * appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports byte
+			 * mode for WFQ among it's children. WFQ weights will
+			 * be applied against bytes for scheduling children
+			 * when a non-leaf node is configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 			/** 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
@@ -596,6 +695,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * packet mode in it's private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * byte mode in it's private shaper. When private shaper
+			 * is configured in byte mode, committed/peak rate
+			 * provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any leaf node
 			 * on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -606,6 +723,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** WRED packet mode support. When non-zero, this
 			 * parameter indicates that there is at least one leaf
 			 * node on this level that supports the WRED packet
@@ -686,12 +817,38 @@ struct rte_tm_node_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * packet mode. When configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * byte mode. When configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
 	/** Maximum number of shared shapers the current node can be part of.
 	 * The value of zero indicates that shared shapers are not supported by
 	 * the current node.
 	 */
 	uint32_t shaper_shared_n_max;
 
+	/** Shaper shared packet mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in packet mode.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in byte mode.
+	 */
+	int shaper_shared_byte_mode_supported;
+
 	RTE_STD_C11
 	union {
 		/** Items valid only for non-leaf nodes. */
@@ -735,6 +892,23 @@ struct rte_tm_node_capabilities {
 			 * WFQ weight, so WFQ is reduced to FQ.
 			 */
 			uint32_t sched_wfq_weight_max;
+
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that current node supports packet
+			 * mode for WFQ among it's children. WFQ weights will be
+			 * applied against packet count for scheduling children
+			 * when configured appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that current node supports byte
+			 * mode for WFQ among it's children. WFQ weights will be
+			 * applied against  bytes for scheduling children when
+			 * configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 		} nonleaf;
 
 		/** Items valid only for leaf nodes. */
@@ -836,10 +1010,10 @@ struct rte_tm_wred_params {
  * Token bucket
  */
 struct rte_tm_token_bucket {
-	/** Token bucket rate (bytes per second) */
+	/** Token bucket rate (bytes per second or packets per second) */
 	uint64_t rate;
 
-	/** Token bucket size (bytes), a.k.a. max burst size */
+	/** Token bucket size (bytes or packets), a.k.a. max burst size */
 	uint64_t size;
 };
 
@@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
  * Dual rate shapers use both the committed and the peak token buckets. The
  * rate of the peak bucket has to be bigger than zero, as well as greater than
  * or equal to the rate of the committed bucket.
+ *
+ * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
  */
 struct rte_tm_shaper_params {
 	/** Committed token bucket */
@@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
 	 * purpose of shaping. Can be used to correct the packet length with
 	 * the framing overhead bytes that are also consumed on the wire (e.g.
 	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
+	 * This field is ignored when the profile enables packet mode.
 	 */
 	int32_t pkt_length_adjust;
+
+	/** When zero, the private or shared shaper that is associated to this
+	 * profile works in byte mode and hence *rate* and *size* fields in
+	 * both token bucket configurations are specified in bytes per second
+	 * and bytes respectively.
+	 * When non-zero, that private or shared shaper works in packet mode and
+	 * hence *rate* and *size* fields in both token bucket configurations
+	 * are specified in packets per second and packets respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -925,6 +1115,8 @@ struct rte_tm_node_params {
 			 * 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.
+			 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported
+			 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported
 			 */
 			int *wfq_weight_mode;
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
                     ` (2 preceding siblings ...)
  2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
@ 2020-04-22  8:09   ` Nithin Dabilpuram
  2020-04-22 12:18     ` Singh, Jasvinder
  2020-04-22 10:10   ` [dpdk-dev] " Dumitrescu, Cristian
  4 siblings, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22  8:09 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko, dev, jerinj, kkanas

Please ignore this patch. Had issue with subject line.
Consider patch "[v3,1/4] ethdev: add tm support for shaper config in pkt mode "
instead.

On Wed, Apr 22, 2020 at 01:29:44PM +0530, Nithin Dabilpuram wrote:
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Some NIC hardware support shaper to work in packet mode i.e
> shaping or ratelimiting traffic is in packets per second (PPS) as
> opposed to default bytes per second (BPS). Hence this patch
> adds support to configure shared or private shaper in packet mode,
> provide rate in PPS and add related tm capabilities in port/level/node
> capability structures.
> 
> This patch also updates tm port/level/node capability structures with
> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> and private/shared shaper byte mode.
> 
> SoftNIC PMD is also updated with new capabilities.
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> 
> v2..v3:
> - Fix typo's
> - Add shaper_shared_(packet, byte)_mode_supported in level and node cap
> - Fix comment in pkt_length_adjust.
> - Move rte_eth_softnic_tm.c capability update to patch 1/4 to 
>   avoid compilations issues in node and level cap array in softnicpmd.
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around scalar initializer
>    {.nonleaf = {
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in record or union initializer
>    {.nonleaf = {
> 
> v1..v2:
> - Add seperate capability for shaper and scheduler pktmode and bytemode.
> - Add packet_mode field in struct rte_tm_shaper_params to indicate
> packet mode shaper profile.
> 
> 
>  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
>  lib/librte_ethdev/rte_tm.h               | 196 ++++++++++++++++++++++++++++++-
>  2 files changed, 259 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
> index 80a470c..344819f 100644
> --- a/drivers/net/softnic/rte_eth_softnic_tm.c
> +++ b/drivers/net/softnic/rte_eth_softnic_tm.c
> @@ -447,6 +447,8 @@ static const struct rte_tm_capabilities tm_cap = {
>  	.shaper_private_dual_rate_n_max = 0,
>  	.shaper_private_rate_min = 1,
>  	.shaper_private_rate_max = UINT32_MAX,
> +	.shaper_private_packet_mode_supported = 0,
> +	.shaper_private_byte_mode_supported = 1,
>  
>  	.shaper_shared_n_max = UINT32_MAX,
>  	.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,
> @@ -454,6 +456,8 @@ static const struct rte_tm_capabilities tm_cap = {
>  	.shaper_shared_dual_rate_n_max = 0,
>  	.shaper_shared_rate_min = 1,
>  	.shaper_shared_rate_max = UINT32_MAX,
> +	.shaper_shared_packet_mode_supported = 0,
> +	.shaper_shared_byte_mode_supported = 1,
>  
>  	.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
>  	.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
> @@ -463,6 +467,8 @@ static const struct rte_tm_capabilities tm_cap = {
>  	.sched_wfq_n_children_per_group_max = UINT32_MAX,
>  	.sched_wfq_n_groups_max = 1,
>  	.sched_wfq_weight_max = UINT32_MAX,
> +	.sched_wfq_packet_mode_supported = 0,
> +	.sched_wfq_byte_mode_supported = 1,
>  
>  	.cman_wred_packet_mode_supported = WRED_SUPPORTED,
>  	.cman_wred_byte_mode_supported = 0,
> @@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.shaper_private_dual_rate_supported = 0,
>  			.shaper_private_rate_min = 1,
>  			.shaper_private_rate_max = UINT32_MAX,
> +			.shaper_private_packet_mode_supported = 0,
> +			.shaper_private_byte_mode_supported = 1,
>  			.shaper_shared_n_max = 0,
> +			.shaper_shared_packet_mode_supported = 0,
> +			.shaper_shared_byte_mode_supported = 0,
>  
>  			.sched_n_children_max = UINT32_MAX,
>  			.sched_sp_n_priorities_max = 1,
>  			.sched_wfq_n_children_per_group_max = UINT32_MAX,
>  			.sched_wfq_n_groups_max = 1,
>  			.sched_wfq_weight_max = 1,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  
>  			.stats_mask = STATS_MASK_DEFAULT,
>  		} },
> @@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.shaper_private_dual_rate_supported = 0,
>  			.shaper_private_rate_min = 1,
>  			.shaper_private_rate_max = UINT32_MAX,
> +			.shaper_private_packet_mode_supported = 0,
> +			.shaper_private_byte_mode_supported = 1,
>  			.shaper_shared_n_max = 0,
> +			.shaper_shared_packet_mode_supported = 0,
> +			.shaper_shared_byte_mode_supported = 0,
>  
>  			.sched_n_children_max = UINT32_MAX,
>  			.sched_sp_n_priorities_max = 1,
> @@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.sched_wfq_n_groups_max = 1,
>  #ifdef RTE_SCHED_SUBPORT_TC_OV
>  			.sched_wfq_weight_max = UINT32_MAX,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 1,
>  #else
>  			.sched_wfq_weight_max = 1,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  #endif
> +
>  			.stats_mask = STATS_MASK_DEFAULT,
>  		} },
>  	},
> @@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.shaper_private_dual_rate_supported = 0,
>  			.shaper_private_rate_min = 1,
>  			.shaper_private_rate_max = UINT32_MAX,
> +			.shaper_private_packet_mode_supported = 0,
> +			.shaper_private_byte_mode_supported = 1,
>  			.shaper_shared_n_max = 0,
> +			.shaper_shared_packet_mode_supported = 0,
> +			.shaper_shared_byte_mode_supported = 0,
>  
>  			.sched_n_children_max =
>  				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
> @@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.sched_wfq_n_children_per_group_max = 1,
>  			.sched_wfq_n_groups_max = 0,
>  			.sched_wfq_weight_max = 1,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  
>  			.stats_mask = STATS_MASK_DEFAULT,
>  		} },
> @@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.shaper_private_dual_rate_supported = 0,
>  			.shaper_private_rate_min = 1,
>  			.shaper_private_rate_max = UINT32_MAX,
> +			.shaper_private_packet_mode_supported = 0,
> +			.shaper_private_byte_mode_supported = 1,
>  			.shaper_shared_n_max = 1,
> +			.shaper_shared_packet_mode_supported = 0,
> +			.shaper_shared_byte_mode_supported = 1,
>  
>  			.sched_n_children_max =
>  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> @@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  				RTE_SCHED_BE_QUEUES_PER_PIPE,
>  			.sched_wfq_n_groups_max = 1,
>  			.sched_wfq_weight_max = UINT32_MAX,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 1,
>  
>  			.stats_mask = STATS_MASK_DEFAULT,
>  		} },
> @@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
>  			.shaper_private_dual_rate_supported = 0,
>  			.shaper_private_rate_min = 0,
>  			.shaper_private_rate_max = 0,
> +			.shaper_private_packet_mode_supported = 0,
> +			.shaper_private_byte_mode_supported = 0,
>  			.shaper_shared_n_max = 0,
> +			.shaper_shared_packet_mode_supported = 0,
> +			.shaper_shared_byte_mode_supported = 0,
>  
>  			.cman_head_drop_supported = 0,
>  			.cman_wred_packet_mode_supported = WRED_SUPPORTED,
> @@ -736,7 +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  		.shaper_private_dual_rate_supported = 0,
>  		.shaper_private_rate_min = 1,
>  		.shaper_private_rate_max = UINT32_MAX,
> +		.shaper_private_packet_mode_supported = 0,
> +		.shaper_private_byte_mode_supported = 1,
>  		.shaper_shared_n_max = 0,
> +		.shaper_shared_packet_mode_supported = 0,
> +		.shaper_shared_byte_mode_supported = 0,
>  
>  		{.nonleaf = {
>  			.sched_n_children_max = UINT32_MAX,
> @@ -744,6 +785,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  			.sched_wfq_n_children_per_group_max = UINT32_MAX,
>  			.sched_wfq_n_groups_max = 1,
>  			.sched_wfq_weight_max = 1,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  		} },
>  
>  		.stats_mask = STATS_MASK_DEFAULT,
> @@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  		.shaper_private_dual_rate_supported = 0,
>  		.shaper_private_rate_min = 1,
>  		.shaper_private_rate_max = UINT32_MAX,
> +		.shaper_private_packet_mode_supported = 0,
> +		.shaper_private_byte_mode_supported = 1,
>  		.shaper_shared_n_max = 0,
> +		.shaper_shared_packet_mode_supported = 0,
> +		.shaper_shared_byte_mode_supported = 0,
>  
>  		{.nonleaf = {
>  			.sched_n_children_max = UINT32_MAX,
> @@ -762,6 +809,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  			.sched_wfq_n_children_per_group_max = UINT32_MAX,
>  			.sched_wfq_n_groups_max = 1,
>  			.sched_wfq_weight_max = UINT32_MAX,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  		} },
>  
>  		.stats_mask = STATS_MASK_DEFAULT,
> @@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  		.shaper_private_dual_rate_supported = 0,
>  		.shaper_private_rate_min = 1,
>  		.shaper_private_rate_max = UINT32_MAX,
> +		.shaper_private_packet_mode_supported = 0,
> +		.shaper_private_byte_mode_supported = 1,
>  		.shaper_shared_n_max = 0,
> +		.shaper_shared_packet_mode_supported = 0,
> +		.shaper_shared_byte_mode_supported = 0,
>  
>  		{.nonleaf = {
>  			.sched_n_children_max =
> @@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  			.sched_wfq_n_children_per_group_max = 1,
>  			.sched_wfq_n_groups_max = 0,
>  			.sched_wfq_weight_max = 1,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 0,
>  		} },
>  
>  		.stats_mask = STATS_MASK_DEFAULT,
> @@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  		.shaper_private_dual_rate_supported = 0,
>  		.shaper_private_rate_min = 1,
>  		.shaper_private_rate_max = UINT32_MAX,
> +		.shaper_private_packet_mode_supported = 0,
> +		.shaper_private_byte_mode_supported = 1,
>  		.shaper_shared_n_max = 1,
> +		.shaper_shared_packet_mode_supported = 0,
> +		.shaper_shared_byte_mode_supported = 1,
>  
>  		{.nonleaf = {
>  			.sched_n_children_max =
> @@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  				RTE_SCHED_BE_QUEUES_PER_PIPE,
>  			.sched_wfq_n_groups_max = 1,
>  			.sched_wfq_weight_max = UINT32_MAX,
> +			.sched_wfq_packet_mode_supported = 0,
> +			.sched_wfq_byte_mode_supported = 1,
>  		} },
>  
>  		.stats_mask = STATS_MASK_DEFAULT,
> @@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
>  		.shaper_private_dual_rate_supported = 0,
>  		.shaper_private_rate_min = 0,
>  		.shaper_private_rate_max = 0,
> +		.shaper_private_packet_mode_supported = 0,
> +		.shaper_private_byte_mode_supported = 0,
>  		.shaper_shared_n_max = 0,
> +		.shaper_shared_packet_mode_supported = 0,
> +		.shaper_shared_byte_mode_supported = 0,
>  
>  
>  		{.leaf = {
> diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> index f9c0cf3..b3865af 100644
> --- a/lib/librte_ethdev/rte_tm.h
> +++ b/lib/librte_ethdev/rte_tm.h
> @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
>  	 */
>  	uint64_t shaper_private_rate_max;
>  
> +	/** Shaper private packet mode supported. When non-zero, this parameter
> +	 * indicates that there is at least one node that can be configured
> +	 * with packet mode in it's private shaper. When shaper is configured
> +	 * in packet mode, committed/peak rate provided is interpreted
> +	 * in packets per second.
> +	 */
> +	int shaper_private_packet_mode_supported;
> +
> +	/** Shaper private byte mode supported. When non-zero, this parameter
> +	 * indicates that there is at least one node that can be configured
> +	 * with byte mode in it's private shaper. When shaper is configured
> +	 * in byte mode, committed/peak rate provided is interpreted in
> +	 * bytes per second.
> +	 */
> +	int shaper_private_byte_mode_supported;
> +
> +
>  	/** Maximum number of shared shapers. The value of zero indicates that
>  	 * shared shapers are not supported.
>  	 */
> @@ -284,6 +301,21 @@ struct rte_tm_capabilities {
>  	 */
>  	uint64_t shaper_shared_rate_max;
>  
> +	/** Shaper shared packet mode supported. When non-zero, this parameter
> +	 * indicates a shared shaper can be configured with packet mode.
> +	 * When shared shaper is configured in packet mode, committed/peak rate
> +	 * provided is interpreted in packets per second.
> +	 */
> +	int shaper_shared_packet_mode_supported;
> +
> +	/** Shaper shared byte mode supported. When non-zero, this parameter
> +	 * indicates that a shared shaper can be configured with byte mode.
> +	 * When shared shaper is configured in byte mode, committed/peak rate
> +	 * provided is interpreted in bytes per second.
> +	 */
> +	int shaper_shared_byte_mode_supported;
> +
> +
>  	/** Minimum value allowed for packet length adjustment for any private
>  	 * or shared shaper.
>  	 */
> @@ -339,6 +371,22 @@ struct rte_tm_capabilities {
>  	 */
>  	uint32_t sched_wfq_weight_max;
>  
> +	/** WFQ packet mode supported. When non-zero, this parameter indicates
> +	 * that there is at least one non-leaf node that supports packet mode
> +	 * for WFQ among it's children. WFQ weights will be applied against
> +	 * packet count for scheduling children when a non-leaf node
> +	 * is configured appropriately.
> +	 */
> +	int sched_wfq_packet_mode_supported;
> +
> +	/** WFQ byte mode supported. When non-zero, this parameter indicates
> +	 * that there is at least one non-leaf node that supports byte mode
> +	 * for WFQ among it's children. WFQ weights will be applied against
> +	 * bytes for scheduling children when a non-leaf node is configured
> +	 * appropriately.
> +	 */
> +	int sched_wfq_byte_mode_supported;
> +
>  	/** 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
> @@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint64_t shaper_private_rate_max;
>  
> +			/** Shaper private packet mode supported. When non-zero,
> +			 * this parameter indicates there is at least one
> +			 * non-leaf node at this level that can be configured
> +			 * with packet mode in it's private shaper. When private
> +			 * shaper is configured in packet mode, committed/peak
> +			 * rate provided is interpreted in packets per second.
> +			 */
> +			int shaper_private_packet_mode_supported;
> +
> +			/** Shaper private byte mode supported. When non-zero,
> +			 * this parameter indicates there is at least one
> +			 * non-leaf node at this level that can be configured
> +			 * with byte mode in it's private shaper. When private
> +			 * shaper is configured in byte mode, committed/peak
> +			 * rate provided is interpreted in bytes per second.
> +			 */
> +			int shaper_private_byte_mode_supported;
> +
>  			/** Maximum number of shared shapers that any non-leaf
>  			 * node on this level can be part of. The value of zero
>  			 * indicates that shared shapers are not supported by
> @@ -495,6 +561,20 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint32_t shaper_shared_n_max;
>  
> +			/** Shaper shared packet mode supported. When non-zero,
> +			 * this parameter indicates that there is at least one
> +			 * non-leaf node on this level that can be part of
> +			 * shared shapers which work in packet mode.
> +			 */
> +			int shaper_shared_packet_mode_supported;
> +
> +			/** Shaper shared byte mode supported. When non-zero,
> +			 * this parameter indicates that there is at least one
> +			 * non-leaf node on this level that can be part of
> +			 * shared shapers which work in byte mode.
> +			 */
> +			int shaper_shared_byte_mode_supported;
> +
>  			/** Maximum number of children nodes. This parameter
>  			 * indicates that there is at least one non-leaf node on
>  			 * this level that can be configured with this many
> @@ -554,6 +634,25 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint32_t sched_wfq_weight_max;
>  
> +			/** WFQ packet mode supported. When non-zero, this
> +			 * parameter indicates that there is at least one
> +			 * non-leaf node at this level that supports packet
> +			 * mode for WFQ among it's children. WFQ weights will
> +			 * be applied against packet count for scheduling
> +			 * children when a non-leaf node is configured
> +			 * appropriately.
> +			 */
> +			int sched_wfq_packet_mode_supported;
> +
> +			/** WFQ byte mode supported. When non-zero, this
> +			 * parameter indicates that there is at least one
> +			 * non-leaf node at this level that supports byte
> +			 * mode for WFQ among it's children. WFQ weights will
> +			 * be applied against bytes for scheduling children
> +			 * when a non-leaf node is configured appropriately.
> +			 */
> +			int sched_wfq_byte_mode_supported;
> +
>  			/** 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
> @@ -596,6 +695,24 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint64_t shaper_private_rate_max;
>  
> +			/** Shaper private packet mode supported. When non-zero,
> +			 * this parameter indicates there is at least one leaf
> +			 * node at this level that can be configured with
> +			 * packet mode in it's private shaper. When private
> +			 * shaper is configured in packet mode, committed/peak
> +			 * rate provided is interpreted in packets per second.
> +			 */
> +			int shaper_private_packet_mode_supported;
> +
> +			/** Shaper private byte mode supported. When non-zero,
> +			 * this parameter indicates there is at least one leaf
> +			 * node at this level that can be configured with
> +			 * byte mode in it's private shaper. When private shaper
> +			 * is configured in byte mode, committed/peak rate
> +			 * provided is interpreted in bytes per second.
> +			 */
> +			int shaper_private_byte_mode_supported;
> +
>  			/** Maximum number of shared shapers that any leaf node
>  			 * on this level can be part of. The value of zero
>  			 * indicates that shared shapers are not supported by
> @@ -606,6 +723,20 @@ struct rte_tm_level_capabilities {
>  			 */
>  			uint32_t shaper_shared_n_max;
>  
> +			/** Shaper shared packet mode supported. When non-zero,
> +			 * this parameter indicates that there is at least one
> +			 * leaf node on this level that can be part of
> +			 * shared shapers which work in packet mode.
> +			 */
> +			int shaper_shared_packet_mode_supported;
> +
> +			/** Shaper shared byte mode supported. When non-zero,
> +			 * this parameter indicates that there is at least one
> +			 * leaf node on this level that can be part of
> +			 * shared shapers which work in byte mode.
> +			 */
> +			int shaper_shared_byte_mode_supported;
> +
>  			/** WRED packet mode support. When non-zero, this
>  			 * parameter indicates that there is at least one leaf
>  			 * node on this level that supports the WRED packet
> @@ -686,12 +817,38 @@ struct rte_tm_node_capabilities {
>  	 */
>  	uint64_t shaper_private_rate_max;
>  
> +	/** Shaper private packet mode supported. When non-zero, this parameter
> +	 * indicates private shaper of current node can be configured with
> +	 * packet mode. When configured in packet mode, committed/peak rate
> +	 * provided is interpreted in packets per second.
> +	 */
> +	int shaper_private_packet_mode_supported;
> +
> +	/** Shaper private byte mode supported. When non-zero, this parameter
> +	 * indicates private shaper of current node can be configured with
> +	 * byte mode. When configured in byte mode, committed/peak rate
> +	 * provided is interpreted in bytes per second.
> +	 */
> +	int shaper_private_byte_mode_supported;
> +
>  	/** Maximum number of shared shapers the current node can be part of.
>  	 * The value of zero indicates that shared shapers are not supported by
>  	 * the current node.
>  	 */
>  	uint32_t shaper_shared_n_max;
>  
> +	/** Shaper shared packet mode supported. When non-zero,
> +	 * this parameter indicates that current node can be part of
> +	 * shared shapers which work in packet mode.
> +	 */
> +	int shaper_shared_packet_mode_supported;
> +
> +	/** Shaper shared byte mode supported. When non-zero,
> +	 * this parameter indicates that current node can be part of
> +	 * shared shapers which work in byte mode.
> +	 */
> +	int shaper_shared_byte_mode_supported;
> +
>  	RTE_STD_C11
>  	union {
>  		/** Items valid only for non-leaf nodes. */
> @@ -735,6 +892,23 @@ struct rte_tm_node_capabilities {
>  			 * WFQ weight, so WFQ is reduced to FQ.
>  			 */
>  			uint32_t sched_wfq_weight_max;
> +
> +			/** WFQ packet mode supported. When non-zero, this
> +			 * parameter indicates that current node supports packet
> +			 * mode for WFQ among it's children. WFQ weights will be
> +			 * applied against packet count for scheduling children
> +			 * when configured appropriately.
> +			 */
> +			int sched_wfq_packet_mode_supported;
> +
> +			/** WFQ byte mode supported. When non-zero, this
> +			 * parameter indicates that current node supports byte
> +			 * mode for WFQ among it's children. WFQ weights will be
> +			 * applied against  bytes for scheduling children when
> +			 * configured appropriately.
> +			 */
> +			int sched_wfq_byte_mode_supported;
> +
>  		} nonleaf;
>  
>  		/** Items valid only for leaf nodes. */
> @@ -836,10 +1010,10 @@ struct rte_tm_wred_params {
>   * Token bucket
>   */
>  struct rte_tm_token_bucket {
> -	/** Token bucket rate (bytes per second) */
> +	/** Token bucket rate (bytes per second or packets per second) */
>  	uint64_t rate;
>  
> -	/** Token bucket size (bytes), a.k.a. max burst size */
> +	/** Token bucket size (bytes or packets), a.k.a. max burst size */
>  	uint64_t size;
>  };
>  
> @@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
>   * Dual rate shapers use both the committed and the peak token buckets. The
>   * rate of the peak bucket has to be bigger than zero, as well as greater than
>   * or equal to the rate of the committed bucket.
> + *
> + * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> + * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
>   */
>  struct rte_tm_shaper_params {
>  	/** Committed token bucket */
> @@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
>  	 * purpose of shaping. Can be used to correct the packet length with
>  	 * the framing overhead bytes that are also consumed on the wire (e.g.
>  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
> +	 * This field is ignored when the profile enables packet mode.
>  	 */
>  	int32_t pkt_length_adjust;
> +
> +	/** When zero, the private or shared shaper that is associated to this
> +	 * profile works in byte mode and hence *rate* and *size* fields in
> +	 * both token bucket configurations are specified in bytes per second
> +	 * and bytes respectively.
> +	 * When non-zero, that private or shared shaper works in packet mode and
> +	 * hence *rate* and *size* fields in both token bucket configurations
> +	 * are specified in packets per second and packets respectively.
> +	 */
> +	int packet_mode;
>  };
>  
>  /**
> @@ -925,6 +1115,8 @@ struct rte_tm_node_params {
>  			 * 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.
> +			 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported
> +			 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported
>  			 */
>  			int *wfq_weight_mode;
>  
> -- 
> 2.8.4
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
                     ` (3 preceding siblings ...)
  2020-04-22  8:09   ` [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in " Nithin Dabilpuram
@ 2020-04-22 10:10   ` Dumitrescu, Cristian
  2020-04-22 11:31     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  4 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-22 10:10 UTC (permalink / raw)
  To: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

Hi Nithin,

> -----Original Message-----
> From: Nithin Dabilpuram <nithind1988@gmail.com>
> Sent: Wednesday, April 22, 2020 9:00 AM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
> 
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Some NIC hardware support shaper to work in packet mode i.e
> shaping or ratelimiting traffic is in packets per second (PPS) as
> opposed to default bytes per second (BPS). Hence this patch
> adds support to configure shared or private shaper in packet mode,
> provide rate in PPS and add related tm capabilities in port/level/node
> capability structures.
> 
> This patch also updates tm port/level/node capability structures with
> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> and private/shared shaper byte mode.
> 
> SoftNIC PMD is also updated with new capabilities.
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> 
> v2..v3:
> - Fix typo's
> - Add shaper_shared_(packet, byte)_mode_supported in level and node cap
> - Fix comment in pkt_length_adjust.
> - Move rte_eth_softnic_tm.c capability update to patch 1/4 to
>   avoid compilations issues in node and level cap array in softnicpmd.
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around
> scalar initializer
>    {.nonleaf = {
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization
> for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
>   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in
> record or union initializer
>    {.nonleaf = {
> 
> v1..v2:
> - Add seperate capability for shaper and scheduler pktmode and bytemode.
> - Add packet_mode field in struct rte_tm_shaper_params to indicate
> packet mode shaper profile.
> 
> 
>  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
>  lib/librte_ethdev/rte_tm.h               | 196
> ++++++++++++++++++++++++++++++-
>  2 files changed, 259 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c
> b/drivers/net/softnic/rte_eth_softnic_tm.c
> index 80a470c..344819f 100644
> --- a/drivers/net/softnic/rte_eth_softnic_tm.c
> +++ b/drivers/net/softnic/rte_eth_softnic_tm.c

<snip>...

The softnic changes logically belong to a separate patch. I understand you are getting some build warnings, but it does not make sense to me. Are you sure there is no other way to avoid them?

You are not checking that packet_mode is set to 0. Please add a check in function shaper_profile_check() (file rte_eth_softnic_tm.c) to verify that packet_mode is always set to 0.

Jasvinder, any other changes we need in Soft NIC?

> diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> index f9c0cf3..b3865af 100644
> --- a/lib/librte_ethdev/rte_tm.h
> +++ b/lib/librte_ethdev/rte_tm.h

I am now fine with your additions to this file, with some minor exceptions listed below. Thank you!

> @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
>  	 */
>  	uint64_t shaper_private_rate_max;
> 
> +	/** Shaper private packet mode supported. When non-zero, this
> parameter
> +	 * indicates that there is at least one node that can be configured
> +	 * with packet mode in it's private shaper. When shaper is configured

Recurring typo: it's -> its

Please search for all occurrences of "it's", all should be replaced with either "its" or "it is", we should have absolutely no occurrence of "it's".

<snip>...

> 
> @@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
>   * Dual rate shapers use both the committed and the peak token buckets.
> The
>   * rate of the peak bucket has to be bigger than zero, as well as greater than
>   * or equal to the rate of the committed bucket.
> + *
> + * @see struct
> rte_tm_capabilities::shaper_private_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> + * @see struct
> rte_tm_capabilities::shaper_shared_packet_mode_supported
> + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
>   */
>  struct rte_tm_shaper_params {
>  	/** Committed token bucket */
> @@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
>  	 * purpose of shaping. Can be used to correct the packet length with
>  	 * the framing overhead bytes that are also consumed on the wire
> (e.g.
>  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
> +	 * This field is ignored when the profile enables packet mode.
>  	 */
>  	int32_t pkt_length_adjust;
> +
> +	/** When zero, the private or shared shaper that is associated to this
> +	 * profile works in byte mode and hence *rate* and *size* fields in
> +	 * both token bucket configurations are specified in bytes per second
> +	 * and bytes respectively.
> +	 * When non-zero, that private or shared shaper works in packet
> mode and
> +	 * hence *rate* and *size* fields in both token bucket configurations
> +	 * are specified in packets per second and packets respectively.
> +	 */
> +	int packet_mode;
>  };

I would like to simplify this comment a bit. The reference to a shaper being associated with a profile might be confusing, as some people might incorrectly read there is a 1:1 association between shaper and profile, etc; this is described in mode details in the comment at the top of this structure. I would avoid any mentions of objects outside of the current structure.

I would phrase it like: "When zero, the byte mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in bytes per second and bytes, respectively. When non-zero, the packet mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in packets per second and packets, respectively. ". Is this OK with you?

Please also add the links to the relevant capabilities: @see struct rte_tm_node_capabilities::XYZ.


Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 10:10   ` [dpdk-dev] " Dumitrescu, Cristian
@ 2020-04-22 11:31     ` Nithin Dabilpuram
  2020-04-22 11:49       ` Nithin Dabilpuram
  2020-04-22 12:01       ` Dumitrescu, Cristian
  0 siblings, 2 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 11:31 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, dev, jerinj, kkanas

On Wed, Apr 22, 2020 at 10:10:47AM +0000, Dumitrescu, Cristian wrote:
> External Email
> 
> ----------------------------------------------------------------------
> Hi Nithin,
> 
> > -----Original Message-----
> > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > Sent: Wednesday, April 22, 2020 9:00 AM
> > To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <arybchenko@solarflare.com>
> > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > Dabilpuram <ndabilpuram@marvell.com>
> > Subject: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
> > 
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > 
> > Some NIC hardware support shaper to work in packet mode i.e
> > shaping or ratelimiting traffic is in packets per second (PPS) as
> > opposed to default bytes per second (BPS). Hence this patch
> > adds support to configure shared or private shaper in packet mode,
> > provide rate in PPS and add related tm capabilities in port/level/node
> > capability structures.
> > 
> > This patch also updates tm port/level/node capability structures with
> > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > and private/shared shaper byte mode.
> > 
> > SoftNIC PMD is also updated with new capabilities.
> > 
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > ---
> > 
> > v2..v3:
> > - Fix typo's
> > - Add shaper_shared_(packet, byte)_mode_supported in level and node cap
> > - Fix comment in pkt_length_adjust.
> > - Move rte_eth_softnic_tm.c capability update to patch 1/4 to
> >   avoid compilations issues in node and level cap array in softnicpmd.
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around
> > scalar initializer
> >    {.nonleaf = {
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization
> > for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in
> > record or union initializer
> >    {.nonleaf = {
> > 
> > v1..v2:
> > - Add seperate capability for shaper and scheduler pktmode and bytemode.
> > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > packet mode shaper profile.
> > 
> > 
> >  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
> >  lib/librte_ethdev/rte_tm.h               | 196
> > ++++++++++++++++++++++++++++++-
> >  2 files changed, 259 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c
> > b/drivers/net/softnic/rte_eth_softnic_tm.c
> > index 80a470c..344819f 100644
> > --- a/drivers/net/softnic/rte_eth_softnic_tm.c
> > +++ b/drivers/net/softnic/rte_eth_softnic_tm.c
> 
> <snip>...
> 
> The softnic changes logically belong to a separate patch. I understand you are getting some build warnings, but it does not make sense to me. Are you sure there is no other way to avoid them?
I see error only because of v3 changes in node cap. There seems to be some gcc
issue with order of initializations only when next field is union. I tried both
gcc 4.8.5 and 7.3.1

struct test {                                            
        int a;                                           
        char b;                                          
        int c;                                           
        union {                                          
                int d;                                   
        };                                               

};                                                       

struct test ds1 = {                                      
        .a = 10,                                         
        .b = 20,                                         
        {                                                
                .d = 40,                                 
        }                                                
};                                                       

int main(void)                                           
{                                                        
        printf("ds1.a %d\n", ds1.a);                     
}                                                        
[root@hyd1588t430 dpdk]# make a                          
cc     a.c   -o a                                        
a.c:20:2: warning: braces around scalar initializer [enabled by default] 
  {                                                      
  ^
a.c:20:2: warning: (near initialization for ‘ds1.c’) [enabled by default]
a.c:21:3: error: field name not in record or union initializer           
   .d = 40,                                              
   ^
a.c:21:3: error: (near initialization for ‘ds1.c’)       
make: *** [a] Error 1                                    

I don't see any issue if 'd' is not inside a union.

Similar issue is reported in kernel and similar fix was applied of initializing all the fields.
https://patchwork.kernel.org/patch/3033041/

> 
> You are not checking that packet_mode is set to 0. Please add a check in function shaper_profile_check() (file rte_eth_softnic_tm.c) to verify that packet_mode is always set to 0.
Ack.
> 
> Jasvinder, any other changes we need in Soft NIC?
> 
> > diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> > index f9c0cf3..b3865af 100644
> > --- a/lib/librte_ethdev/rte_tm.h
> > +++ b/lib/librte_ethdev/rte_tm.h
> 
> I am now fine with your additions to this file, with some minor exceptions listed below. Thank you!
> 
> > @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
> >  	 */
> >  	uint64_t shaper_private_rate_max;
> > 
> > +	/** Shaper private packet mode supported. When non-zero, this
> > parameter
> > +	 * indicates that there is at least one node that can be configured
> > +	 * with packet mode in it's private shaper. When shaper is configured
> 
> Recurring typo: it's -> its
> 
> Please search for all occurrences of "it's", all should be replaced with either "its" or "it is", we should have absolutely no occurrence of "it's".
Ack. My bad, I misunderstood earlier comment. Will fix in v4.
> 
> <snip>...
> 
> > 
> > @@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
> >   * Dual rate shapers use both the committed and the peak token buckets.
> > The
> >   * rate of the peak bucket has to be bigger than zero, as well as greater than
> >   * or equal to the rate of the committed bucket.
> > + *
> > + * @see struct
> > rte_tm_capabilities::shaper_private_packet_mode_supported
> > + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> > + * @see struct
> > rte_tm_capabilities::shaper_shared_packet_mode_supported
> > + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
> >   */
> >  struct rte_tm_shaper_params {
> >  	/** Committed token bucket */
> > @@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
> >  	 * purpose of shaping. Can be used to correct the packet length with
> >  	 * the framing overhead bytes that are also consumed on the wire
> > (e.g.
> >  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
> > +	 * This field is ignored when the profile enables packet mode.
> >  	 */
> >  	int32_t pkt_length_adjust;
> > +
> > +	/** When zero, the private or shared shaper that is associated to this
> > +	 * profile works in byte mode and hence *rate* and *size* fields in
> > +	 * both token bucket configurations are specified in bytes per second
> > +	 * and bytes respectively.
> > +	 * When non-zero, that private or shared shaper works in packet
> > mode and
> > +	 * hence *rate* and *size* fields in both token bucket configurations
> > +	 * are specified in packets per second and packets respectively.
> > +	 */
> > +	int packet_mode;
> >  };
> 
> I would like to simplify this comment a bit. The reference to a shaper being associated with a profile might be confusing, as some people might incorrectly read there is a 1:1 association between shaper and profile, etc; this is described in mode details in the comment at the top of this structure. I would avoid any mentions of objects outside of the current structure.
> 
> I would phrase it like: "When zero, the byte mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in bytes per second and bytes, respectively. When non-zero, the packet mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in packets per second and packets, respectively. ". Is this OK with you?
Ack.
> 
> Please also add the links to the relevant capabilities: @see struct rte_tm_node_capabilities::XYZ.
Ack.
> 
> 
> Regards,
> Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 11:31     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
@ 2020-04-22 11:49       ` Nithin Dabilpuram
  2020-04-22 11:59         ` Dumitrescu, Cristian
  2020-04-22 12:01       ` Dumitrescu, Cristian
  1 sibling, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 11:49 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, dev, jerinj, kkanas

> Please also add the links to the relevant capabilities: @see struct
> rte_tm_node_capabilities::XYZ.

This is already added for packet_mode field in descrption of struct
rte_tm_shaper_params similar to struct rte_tm_wred_params.
Do you see anything missing ?

On Wed, Apr 22, 2020 at 05:01:46PM +0530, Nithin Dabilpuram wrote:
> On Wed, Apr 22, 2020 at 10:10:47AM +0000, Dumitrescu, Cristian wrote:
> > External Email
> > 
> > ----------------------------------------------------------------------
> > Hi Nithin,
> > 
> > > -----Original Message-----
> > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > Sent: Wednesday, April 22, 2020 9:00 AM
> > > To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> > > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > > Rybchenko <arybchenko@solarflare.com>
> > > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > > Dabilpuram <ndabilpuram@marvell.com>
> > > Subject: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
> > > 
> > > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > 
> > > Some NIC hardware support shaper to work in packet mode i.e
> > > shaping or ratelimiting traffic is in packets per second (PPS) as
> > > opposed to default bytes per second (BPS). Hence this patch
> > > adds support to configure shared or private shaper in packet mode,
> > > provide rate in PPS and add related tm capabilities in port/level/node
> > > capability structures.
> > > 
> > > This patch also updates tm port/level/node capability structures with
> > > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > > and private/shared shaper byte mode.
> > > 
> > > SoftNIC PMD is also updated with new capabilities.
> > > 
> > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > ---
> > > 
> > > v2..v3:
> > > - Fix typo's
> > > - Add shaper_shared_(packet, byte)_mode_supported in level and node cap
> > > - Fix comment in pkt_length_adjust.
> > > - Move rte_eth_softnic_tm.c capability update to patch 1/4 to
> > >   avoid compilations issues in node and level cap array in softnicpmd.
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around
> > > scalar initializer
> > >    {.nonleaf = {
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization
> > > for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in
> > > record or union initializer
> > >    {.nonleaf = {
> > > 
> > > v1..v2:
> > > - Add seperate capability for shaper and scheduler pktmode and bytemode.
> > > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > > packet mode shaper profile.
> > > 
> > > 
> > >  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
> > >  lib/librte_ethdev/rte_tm.h               | 196
> > > ++++++++++++++++++++++++++++++-
> > >  2 files changed, 259 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c
> > > b/drivers/net/softnic/rte_eth_softnic_tm.c
> > > index 80a470c..344819f 100644
> > > --- a/drivers/net/softnic/rte_eth_softnic_tm.c
> > > +++ b/drivers/net/softnic/rte_eth_softnic_tm.c
> > 
> > <snip>...
> > 
> > The softnic changes logically belong to a separate patch. I understand you are getting some build warnings, but it does not make sense to me. Are you sure there is no other way to avoid them?
> I see error only because of v3 changes in node cap. There seems to be some gcc
> issue with order of initializations only when next field is union. I tried both
> gcc 4.8.5 and 7.3.1
> 
> struct test {                                            
>         int a;                                           
>         char b;                                          
>         int c;                                           
>         union {                                          
>                 int d;                                   
>         };                                               
> 
> };                                                       
> 
> struct test ds1 = {                                      
>         .a = 10,                                         
>         .b = 20,                                         
>         {                                                
>                 .d = 40,                                 
>         }                                                
> };                                                       
> 
> int main(void)                                           
> {                                                        
>         printf("ds1.a %d\n", ds1.a);                     
> }                                                        
> [root@hyd1588t430 dpdk]# make a                          
> cc     a.c   -o a                                        
> a.c:20:2: warning: braces around scalar initializer [enabled by default] 
>   {                                                      
>   ^
> a.c:20:2: warning: (near initialization for ‘ds1.c’) [enabled by default]
> a.c:21:3: error: field name not in record or union initializer           
>    .d = 40,                                              
>    ^
> a.c:21:3: error: (near initialization for ‘ds1.c’)       
> make: *** [a] Error 1                                    
> 
> I don't see any issue if 'd' is not inside a union.
> 
> Similar issue is reported in kernel and similar fix was applied of initializing all the fields.
> https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_3033041_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=Ygf72TMZqO2D2qgWdhga8M61LRznr54ORYKCZ5iQG7w&s=n6pWrzBSgTCaznkjfH4UXjJS_CvBpX2_uY-CJ-LZcd4&e= 
> 
> > 
> > You are not checking that packet_mode is set to 0. Please add a check in function shaper_profile_check() (file rte_eth_softnic_tm.c) to verify that packet_mode is always set to 0.
> Ack.
> > 
> > Jasvinder, any other changes we need in Soft NIC?
> > 
> > > diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
> > > index f9c0cf3..b3865af 100644
> > > --- a/lib/librte_ethdev/rte_tm.h
> > > +++ b/lib/librte_ethdev/rte_tm.h
> > 
> > I am now fine with your additions to this file, with some minor exceptions listed below. Thank you!
> > 
> > > @@ -250,6 +250,23 @@ struct rte_tm_capabilities {
> > >  	 */
> > >  	uint64_t shaper_private_rate_max;
> > > 
> > > +	/** Shaper private packet mode supported. When non-zero, this
> > > parameter
> > > +	 * indicates that there is at least one node that can be configured
> > > +	 * with packet mode in it's private shaper. When shaper is configured
> > 
> > Recurring typo: it's -> its
> > 
> > Please search for all occurrences of "it's", all should be replaced with either "its" or "it is", we should have absolutely no occurrence of "it's".
> Ack. My bad, I misunderstood earlier comment. Will fix in v4.
> > 
> > <snip>...
> > 
> > > 
> > > @@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
> > >   * Dual rate shapers use both the committed and the peak token buckets.
> > > The
> > >   * rate of the peak bucket has to be bigger than zero, as well as greater than
> > >   * or equal to the rate of the committed bucket.
> > > + *
> > > + * @see struct
> > > rte_tm_capabilities::shaper_private_packet_mode_supported
> > > + * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
> > > + * @see struct
> > > rte_tm_capabilities::shaper_shared_packet_mode_supported
> > > + * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
> > >   */
> > >  struct rte_tm_shaper_params {
> > >  	/** Committed token bucket */
> > > @@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
> > >  	 * purpose of shaping. Can be used to correct the packet length with
> > >  	 * the framing overhead bytes that are also consumed on the wire
> > > (e.g.
> > >  	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
> > > +	 * This field is ignored when the profile enables packet mode.
> > >  	 */
> > >  	int32_t pkt_length_adjust;
> > > +
> > > +	/** When zero, the private or shared shaper that is associated to this
> > > +	 * profile works in byte mode and hence *rate* and *size* fields in
> > > +	 * both token bucket configurations are specified in bytes per second
> > > +	 * and bytes respectively.
> > > +	 * When non-zero, that private or shared shaper works in packet
> > > mode and
> > > +	 * hence *rate* and *size* fields in both token bucket configurations
> > > +	 * are specified in packets per second and packets respectively.
> > > +	 */
> > > +	int packet_mode;
> > >  };
> > 
> > I would like to simplify this comment a bit. The reference to a shaper being associated with a profile might be confusing, as some people might incorrectly read there is a 1:1 association between shaper and profile, etc; this is described in mode details in the comment at the top of this structure. I would avoid any mentions of objects outside of the current structure.
> > 
> > I would phrase it like: "When zero, the byte mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in bytes per second and bytes, respectively. When non-zero, the packet mode is enabled for the current profile, so the *rate* and *size* fields in both the committed and peak token buckets are specified in packets per second and packets, respectively. ". Is this OK with you?
> Ack.
> > 
> > Please also add the links to the relevant capabilities: @see struct rte_tm_node_capabilities::XYZ.
> Ack.
> > 
> > 
> > Regards,
> > Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 11:49       ` Nithin Dabilpuram
@ 2020-04-22 11:59         ` Dumitrescu, Cristian
  0 siblings, 0 replies; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-22 11:59 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, dev, jerinj, kkanas



> -----Original Message-----
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Sent: Wednesday, April 22, 2020 12:49 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: Nithin Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew Rybchenko
> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> kkanas@marvell.com
> Subject: Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for
> shaper config in pkt mode
> 
> > Please also add the links to the relevant capabilities: @see struct
> > rte_tm_node_capabilities::XYZ.
> 
> This is already added for packet_mode field in descrption of struct
> rte_tm_shaper_params similar to struct rte_tm_wred_params.
> Do you see anything missing ?
> 

You're right, sorry.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 11:31     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  2020-04-22 11:49       ` Nithin Dabilpuram
@ 2020-04-22 12:01       ` Dumitrescu, Cristian
  1 sibling, 0 replies; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-22 12:01 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, dev, jerinj, kkanas


> > The softnic changes logically belong to a separate patch. I understand you
> are getting some build warnings, but it does not make sense to me. Are you
> sure there is no other way to avoid them?
> I see error only because of v3 changes in node cap. There seems to be some
> gcc
> issue with order of initializations only when next field is union. I tried both
> gcc 4.8.5 and 7.3.1
> 
> struct test {
>         int a;
>         char b;
>         int c;
>         union {
>                 int d;
>         };
> 
> };
> 
> struct test ds1 = {
>         .a = 10,
>         .b = 20,
>         {
>                 .d = 40,
>         }
> };
> 
> int main(void)
> {
>         printf("ds1.a %d\n", ds1.a);
> }
> [root@hyd1588t430 dpdk]# make a
> cc     a.c   -o a
> a.c:20:2: warning: braces around scalar initializer [enabled by default]
>   {
>   ^
> a.c:20:2: warning: (near initialization for ‘ds1.c’) [enabled by default]
> a.c:21:3: error: field name not in record or union initializer
>    .d = 40,
>    ^
> a.c:21:3: error: (near initialization for ‘ds1.c’)
> make: *** [a] Error 1
> 
> I don't see any issue if 'd' is not inside a union.
> 
> Similar issue is reported in kernel and similar fix was applied of initializing all
> the fields.
> https://patchwork.kernel.org/patch/3033041/
> 
>

Sure, I can live with softnic changes in the same patch if no other option is identified.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22  8:09   ` [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in " Nithin Dabilpuram
@ 2020-04-22 12:18     ` Singh, Jasvinder
  2020-04-22 17:21       ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  0 siblings, 1 reply; 60+ messages in thread
From: Singh, Jasvinder @ 2020-04-22 12:18 UTC (permalink / raw)
  To: Nithin Dabilpuram, Nithin Dabilpuram
  Cc: Dumitrescu, Cristian, Thomas Monjalon, Yigit, Ferruh,
	Andrew Rybchenko, dev, jerinj, kkanas



> -----Original Message-----
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> Sent: Wednesday, April 22, 2020 9:09 AM
> To: Nithin Dabilpuram <nithind1988@gmail.com>
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>; dev@dpdk.org;
> jerinj@marvell.com; kkanas@marvell.com
> Subject: Re: [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config
> in pkt mode
> 
> Please ignore this patch. Had issue with subject line.
> Consider patch "[v3,1/4] ethdev: add tm support for shaper config in pkt
> mode "
> instead.
> 
> On Wed, Apr 22, 2020 at 01:29:44PM +0530, Nithin Dabilpuram wrote:
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >
> > Some NIC hardware support shaper to work in packet mode i.e shaping or
> > ratelimiting traffic is in packets per second (PPS) as opposed to
> > default bytes per second (BPS). Hence this patch adds support to
> > configure shared or private shaper in packet mode, provide rate in PPS
> > and add related tm capabilities in port/level/node capability
> > structures.
> >
> > This patch also updates tm port/level/node capability structures with
> > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > and private/shared shaper byte mode.
> >
> > SoftNIC PMD is also updated with new capabilities.
> >
> > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > ---
> >
> > v2..v3:
> > - Fix typo's
> > - Add shaper_shared_(packet, byte)_mode_supported in level and node
> > cap
> > - Fix comment in pkt_length_adjust.
> > - Move rte_eth_softnic_tm.c capability update to patch 1/4 to
> >   avoid compilations issues in node and level cap array in softnicpmd.
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around
> scalar initializer
> >    {.nonleaf = {
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization
> for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
> >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in
> record or union initializer
> >    {.nonleaf = {
> >
> > v1..v2:
> > - Add seperate capability for shaper and scheduler pktmode and
> bytemode.
> > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > packet mode shaper profile.
> >
> >
> >  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
<snip>

> > @@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.shaper_private_dual_rate_supported = 0,
> >  			.shaper_private_rate_min = 1,
> >  			.shaper_private_rate_max = UINT32_MAX,
> > +			.shaper_private_packet_mode_supported = 0,
> > +			.shaper_private_byte_mode_supported = 1,
> >  			.shaper_shared_n_max = 0,
> > +			.shaper_shared_packet_mode_supported = 0,
> > +			.shaper_shared_byte_mode_supported = 0,
> >
> >  			.sched_n_children_max = UINT32_MAX,
> >  			.sched_sp_n_priorities_max = 1,
> >  			.sched_wfq_n_children_per_group_max =
> UINT32_MAX,
> >  			.sched_wfq_n_groups_max = 1,
> >  			.sched_wfq_weight_max = 1,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,

[Jasvinder] -  byte mode needs to be set here.



> >  			.stats_mask = STATS_MASK_DEFAULT,
> >  		} },
> > @@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.shaper_private_dual_rate_supported = 0,
> >  			.shaper_private_rate_min = 1,
> >  			.shaper_private_rate_max = UINT32_MAX,
> > +			.shaper_private_packet_mode_supported = 0,
> > +			.shaper_private_byte_mode_supported = 1,
> >  			.shaper_shared_n_max = 0,
> > +			.shaper_shared_packet_mode_supported = 0,
> > +			.shaper_shared_byte_mode_supported = 0,
> >
> >  			.sched_n_children_max = UINT32_MAX,
> >  			.sched_sp_n_priorities_max = 1,
> > @@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.sched_wfq_n_groups_max = 1,
> >  #ifdef RTE_SCHED_SUBPORT_TC_OV
> >  			.sched_wfq_weight_max = UINT32_MAX,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 1,
> >  #else
> >  			.sched_wfq_weight_max = 1,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,

[jasvinder] - byte mode should be set here as well. 


> >  #endif
> > +
> >  			.stats_mask = STATS_MASK_DEFAULT,
> >  		} },
> >  	},
> > @@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.shaper_private_dual_rate_supported = 0,
> >  			.shaper_private_rate_min = 1,
> >  			.shaper_private_rate_max = UINT32_MAX,
> > +			.shaper_private_packet_mode_supported = 0,
> > +			.shaper_private_byte_mode_supported = 1,
> >  			.shaper_shared_n_max = 0,
> > +			.shaper_shared_packet_mode_supported = 0,
> > +			.shaper_shared_byte_mode_supported = 0,
> >
> >  			.sched_n_children_max =
> >  				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
> > @@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.sched_wfq_n_children_per_group_max = 1,
> >  			.sched_wfq_n_groups_max = 0,
> >  			.sched_wfq_weight_max = 1,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,
> >
> >  			.stats_mask = STATS_MASK_DEFAULT,
> >  		} },
> > @@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.shaper_private_dual_rate_supported = 0,
> >  			.shaper_private_rate_min = 1,
> >  			.shaper_private_rate_max = UINT32_MAX,
> > +			.shaper_private_packet_mode_supported = 0,
> > +			.shaper_private_byte_mode_supported = 1,
> >  			.shaper_shared_n_max = 1,
> > +			.shaper_shared_packet_mode_supported = 0,
> > +			.shaper_shared_byte_mode_supported = 1,
> >
> >  			.sched_n_children_max =
> >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> > @@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> >  			.sched_wfq_n_groups_max = 1,
> >  			.sched_wfq_weight_max = UINT32_MAX,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 1,
> >
> >  			.stats_mask = STATS_MASK_DEFAULT,
> >  		} },
> > @@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities
> tm_level_cap[] = {
> >  			.shaper_private_dual_rate_supported = 0,
> >  			.shaper_private_rate_min = 0,
> >  			.shaper_private_rate_max = 0,
> > +			.shaper_private_packet_mode_supported = 0,
> > +			.shaper_private_byte_mode_supported = 0,
> >  			.shaper_shared_n_max = 0,
> > +			.shaper_shared_packet_mode_supported = 0,
> > +			.shaper_shared_byte_mode_supported = 0,
> >
> >  			.cman_head_drop_supported = 0,
> >  			.cman_wred_packet_mode_supported =
> WRED_SUPPORTED, @@ -736,7
> > +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] =
> {
> >  		.shaper_private_dual_rate_supported = 0,
> >  		.shaper_private_rate_min = 1,
> >  		.shaper_private_rate_max = UINT32_MAX,
> > +		.shaper_private_packet_mode_supported = 0,
> > +		.shaper_private_byte_mode_supported = 1,
> >  		.shaper_shared_n_max = 0,
> > +		.shaper_shared_packet_mode_supported = 0,
> > +		.shaper_shared_byte_mode_supported = 0,
> >
> >  		{.nonleaf = {
> >  			.sched_n_children_max = UINT32_MAX, @@ -744,6
> +785,8 @@ static
> > const struct rte_tm_node_capabilities tm_node_cap[] = {
> >  			.sched_wfq_n_children_per_group_max =
> UINT32_MAX,
> >  			.sched_wfq_n_groups_max = 1,
> >  			.sched_wfq_weight_max = 1,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,
> >  		} },

[Jasvinder] - byte mode to be set.


> >  		.stats_mask = STATS_MASK_DEFAULT,
> > @@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  		.shaper_private_dual_rate_supported = 0,
> >  		.shaper_private_rate_min = 1,
> >  		.shaper_private_rate_max = UINT32_MAX,
> > +		.shaper_private_packet_mode_supported = 0,
> > +		.shaper_private_byte_mode_supported = 1,
> >  		.shaper_shared_n_max = 0,
> > +		.shaper_shared_packet_mode_supported = 0,
> > +		.shaper_shared_byte_mode_supported = 0,
> >
> >  		{.nonleaf = {
> >  			.sched_n_children_max = UINT32_MAX, @@ -762,6
> +809,8 @@ static
> > const struct rte_tm_node_capabilities tm_node_cap[] = {
> >  			.sched_wfq_n_children_per_group_max =
> UINT32_MAX,
> >  			.sched_wfq_n_groups_max = 1,
> >  			.sched_wfq_weight_max = UINT32_MAX,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,
> >  		} },

[Jasvinder] - byte mode to be set here.



> >  		.stats_mask = STATS_MASK_DEFAULT,
> > @@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  		.shaper_private_dual_rate_supported = 0,
> >  		.shaper_private_rate_min = 1,
> >  		.shaper_private_rate_max = UINT32_MAX,
> > +		.shaper_private_packet_mode_supported = 0,
> > +		.shaper_private_byte_mode_supported = 1,
> >  		.shaper_shared_n_max = 0,
> > +		.shaper_shared_packet_mode_supported = 0,
> > +		.shaper_shared_byte_mode_supported = 0,
> >
> >  		{.nonleaf = {
> >  			.sched_n_children_max =
> > @@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  			.sched_wfq_n_children_per_group_max = 1,
> >  			.sched_wfq_n_groups_max = 0,
> >  			.sched_wfq_weight_max = 1,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 0,
> >  		} },
> >
> >  		.stats_mask = STATS_MASK_DEFAULT,
> > @@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  		.shaper_private_dual_rate_supported = 0,
> >  		.shaper_private_rate_min = 1,
> >  		.shaper_private_rate_max = UINT32_MAX,
> > +		.shaper_private_packet_mode_supported = 0,
> > +		.shaper_private_byte_mode_supported = 1,
> >  		.shaper_shared_n_max = 1,
> > +		.shaper_shared_packet_mode_supported = 0,
> > +		.shaper_shared_byte_mode_supported = 1,
> >
> >  		{.nonleaf = {
> >  			.sched_n_children_max =
> > @@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> >  			.sched_wfq_n_groups_max = 1,
> >  			.sched_wfq_weight_max = UINT32_MAX,
> > +			.sched_wfq_packet_mode_supported = 0,
> > +			.sched_wfq_byte_mode_supported = 1,
> >  		} },
> >
> >  		.stats_mask = STATS_MASK_DEFAULT,
> > @@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities
> tm_node_cap[] = {
> >  		.shaper_private_dual_rate_supported = 0,
> >  		.shaper_private_rate_min = 0,
> >  		.shaper_private_rate_max = 0,
> > +		.shaper_private_packet_mode_supported = 0,
> > +		.shaper_private_byte_mode_supported = 0,
> >  		.shaper_shared_n_max = 0,
> > +		.shaper_shared_packet_mode_supported = 0,
> > +		.shaper_shared_byte_mode_supported = 0,
> >
> >
> >  		{.leaf = {




^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
                   ` (5 preceding siblings ...)
  2020-04-22  8:05 ` [dpdk-dev] [PATCH v3 1/4] " Nithin Dabilpuram
@ 2020-04-22 17:21 ` Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
                     ` (3 more replies)
  6 siblings, 4 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 17:21 UTC (permalink / raw)
  To: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Some NIC hardware support shaper to work in packet mode i.e
shaping or ratelimiting traffic is in packets per second (PPS) as
opposed to default bytes per second (BPS). Hence this patch
adds support to configure shared or private shaper in packet mode,
provide rate in PPS and add related tm capabilities in port/level/node
capability structures.

This patch also updates tm port/level/node capability structures with
exiting features of scheduler wfq packet mode, scheduler wfq byte mode
and private/shared shaper byte mode.

SoftNIC PMD is also updated with new capabilities.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v3..v4:
- Update text under packet_mode as per Cristian.
- Update rte_eth_softnic_tm.c based on Jasvinder's comments.
- Add error enum RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE 
- Fix shaper_profile_check() with packet mode check
- Fix typo's 

v2..v3:
- Fix typo's
- Add shaper_shared_(packet, byte)_mode_supported in level and node cap
- Fix comment in pkt_length_adjust.
- Move rte_eth_softnic_tm.c capability update to patch 1/4 to 
  avoid compilations issues in node and level cap array in softnicpmd.
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around scalar initializer
   {.nonleaf = {
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
  ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in record or union initializer
   {.nonleaf = {

v1..v2:
- Add seperate capability for shaper and scheduler pktmode and bytemode.
- Add packet_mode field in struct rte_tm_shaper_params to indicate
packet mode shaper profile.


 drivers/net/softnic/rte_eth_softnic_tm.c |  72 +++++++++++
 lib/librte_ethdev/rte_tm.h               | 197 ++++++++++++++++++++++++++++++-
 2 files changed, 267 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c
index 80a470c..d309763 100644
--- a/drivers/net/softnic/rte_eth_softnic_tm.c
+++ b/drivers/net/softnic/rte_eth_softnic_tm.c
@@ -447,6 +447,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_private_dual_rate_n_max = 0,
 	.shaper_private_rate_min = 1,
 	.shaper_private_rate_max = UINT32_MAX,
+	.shaper_private_packet_mode_supported = 0,
+	.shaper_private_byte_mode_supported = 1,
 
 	.shaper_shared_n_max = UINT32_MAX,
 	.shaper_shared_n_nodes_per_shaper_max = UINT32_MAX,
@@ -454,6 +456,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.shaper_shared_dual_rate_n_max = 0,
 	.shaper_shared_rate_min = 1,
 	.shaper_shared_rate_max = UINT32_MAX,
+	.shaper_shared_packet_mode_supported = 0,
+	.shaper_shared_byte_mode_supported = 1,
 
 	.shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
 	.shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS,
@@ -463,6 +467,8 @@ static const struct rte_tm_capabilities tm_cap = {
 	.sched_wfq_n_children_per_group_max = UINT32_MAX,
 	.sched_wfq_n_groups_max = 1,
 	.sched_wfq_weight_max = UINT32_MAX,
+	.sched_wfq_packet_mode_supported = 0,
+	.sched_wfq_byte_mode_supported = 1,
 
 	.cman_wred_packet_mode_supported = WRED_SUPPORTED,
 	.cman_wred_byte_mode_supported = 0,
@@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max = UINT32_MAX,
 			.sched_sp_n_priorities_max = 1,
@@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_groups_max = 1,
 #ifdef RTE_SCHED_SUBPORT_TC_OV
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 #else
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 #endif
+
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
 	},
@@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.sched_n_children_max =
 				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
@@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 1,
 			.shaper_private_rate_max = UINT32_MAX,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 1,
 			.shaper_shared_n_max = 1,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 1,
 
 			.sched_n_children_max =
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
@@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 
 			.stats_mask = STATS_MASK_DEFAULT,
 		} },
@@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities tm_level_cap[] = {
 			.shaper_private_dual_rate_supported = 0,
 			.shaper_private_rate_min = 0,
 			.shaper_private_rate_max = 0,
+			.shaper_private_packet_mode_supported = 0,
+			.shaper_private_byte_mode_supported = 0,
 			.shaper_shared_n_max = 0,
+			.shaper_shared_packet_mode_supported = 0,
+			.shaper_shared_byte_mode_supported = 0,
 
 			.cman_head_drop_supported = 0,
 			.cman_wred_packet_mode_supported = WRED_SUPPORTED,
@@ -736,7 +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -744,6 +785,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max = UINT32_MAX,
@@ -762,6 +809,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = UINT32_MAX,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 			.sched_wfq_n_children_per_group_max = 1,
 			.sched_wfq_n_groups_max = 0,
 			.sched_wfq_weight_max = 1,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 0,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 1,
 		.shaper_private_rate_max = UINT32_MAX,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 1,
 		.shaper_shared_n_max = 1,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 1,
 
 		{.nonleaf = {
 			.sched_n_children_max =
@@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 				RTE_SCHED_BE_QUEUES_PER_PIPE,
 			.sched_wfq_n_groups_max = 1,
 			.sched_wfq_weight_max = UINT32_MAX,
+			.sched_wfq_packet_mode_supported = 0,
+			.sched_wfq_byte_mode_supported = 1,
 		} },
 
 		.stats_mask = STATS_MASK_DEFAULT,
@@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] = {
 		.shaper_private_dual_rate_supported = 0,
 		.shaper_private_rate_min = 0,
 		.shaper_private_rate_max = 0,
+		.shaper_private_packet_mode_supported = 0,
+		.shaper_private_byte_mode_supported = 0,
 		.shaper_shared_n_max = 0,
+		.shaper_shared_packet_mode_supported = 0,
+		.shaper_shared_byte_mode_supported = 0,
 
 
 		{.leaf = {
@@ -947,6 +1012,13 @@ shaper_profile_check(struct rte_eth_dev *dev,
 			NULL,
 			rte_strerror(EINVAL));
 
+	/* Packet mode is not supported. */
+	if (profile->packet_mode != 0)
+		return -rte_tm_error_set(error,
+			EINVAL,
+			RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE,
+			NULL,
+			rte_strerror(EINVAL));
 	return 0;
 }
 
diff --git a/lib/librte_ethdev/rte_tm.h b/lib/librte_ethdev/rte_tm.h
index f9c0cf3..110c263 100644
--- a/lib/librte_ethdev/rte_tm.h
+++ b/lib/librte_ethdev/rte_tm.h
@@ -250,6 +250,23 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with packet mode in its private shaper. When shaper is configured
+	 * in packet mode, committed/peak rate provided is interpreted
+	 * in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates that there is at least one node that can be configured
+	 * with byte mode in its private shaper. When shaper is configured
+	 * in byte mode, committed/peak rate provided is interpreted in
+	 * bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
+
 	/** Maximum number of shared shapers. The value of zero indicates that
 	 * shared shapers are not supported.
 	 */
@@ -284,6 +301,21 @@ struct rte_tm_capabilities {
 	 */
 	uint64_t shaper_shared_rate_max;
 
+	/** Shaper shared packet mode supported. When non-zero, this parameter
+	 * indicates a shared shaper can be configured with packet mode.
+	 * When shared shaper is configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero, this parameter
+	 * indicates that a shared shaper can be configured with byte mode.
+	 * When shared shaper is configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_shared_byte_mode_supported;
+
+
 	/** Minimum value allowed for packet length adjustment for any private
 	 * or shared shaper.
 	 */
@@ -339,6 +371,22 @@ struct rte_tm_capabilities {
 	 */
 	uint32_t sched_wfq_weight_max;
 
+	/** WFQ packet mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports packet mode
+	 * for WFQ among its children. WFQ weights will be applied against
+	 * packet count for scheduling children when a non-leaf node
+	 * is configured appropriately.
+	 */
+	int sched_wfq_packet_mode_supported;
+
+	/** WFQ byte mode supported. When non-zero, this parameter indicates
+	 * that there is at least one non-leaf node that supports byte mode
+	 * for WFQ among its children. WFQ weights will be applied against
+	 * bytes for scheduling children when a non-leaf node is configured
+	 * appropriately.
+	 */
+	int sched_wfq_byte_mode_supported;
+
 	/** 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
@@ -485,6 +533,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with packet mode in its private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one
+			 * non-leaf node at this level that can be configured
+			 * with byte mode in its private shaper. When private
+			 * shaper is configured in byte mode, committed/peak
+			 * rate provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any non-leaf
 			 * node on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -495,6 +561,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * non-leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** Maximum number of children nodes. This parameter
 			 * indicates that there is at least one non-leaf node on
 			 * this level that can be configured with this many
@@ -554,6 +634,25 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t sched_wfq_weight_max;
 
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports packet
+			 * mode for WFQ among its children. WFQ weights will
+			 * be applied against packet count for scheduling
+			 * children when a non-leaf node is configured
+			 * appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that there is at least one
+			 * non-leaf node at this level that supports byte
+			 * mode for WFQ among its children. WFQ weights will
+			 * be applied against bytes for scheduling children
+			 * when a non-leaf node is configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 			/** 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
@@ -596,6 +695,24 @@ struct rte_tm_level_capabilities {
 			 */
 			uint64_t shaper_private_rate_max;
 
+			/** Shaper private packet mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * packet mode in its private shaper. When private
+			 * shaper is configured in packet mode, committed/peak
+			 * rate provided is interpreted in packets per second.
+			 */
+			int shaper_private_packet_mode_supported;
+
+			/** Shaper private byte mode supported. When non-zero,
+			 * this parameter indicates there is at least one leaf
+			 * node at this level that can be configured with
+			 * byte mode in its private shaper. When private shaper
+			 * is configured in byte mode, committed/peak rate
+			 * provided is interpreted in bytes per second.
+			 */
+			int shaper_private_byte_mode_supported;
+
 			/** Maximum number of shared shapers that any leaf node
 			 * on this level can be part of. The value of zero
 			 * indicates that shared shapers are not supported by
@@ -606,6 +723,20 @@ struct rte_tm_level_capabilities {
 			 */
 			uint32_t shaper_shared_n_max;
 
+			/** Shaper shared packet mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in packet mode.
+			 */
+			int shaper_shared_packet_mode_supported;
+
+			/** Shaper shared byte mode supported. When non-zero,
+			 * this parameter indicates that there is at least one
+			 * leaf node on this level that can be part of
+			 * shared shapers which work in byte mode.
+			 */
+			int shaper_shared_byte_mode_supported;
+
 			/** WRED packet mode support. When non-zero, this
 			 * parameter indicates that there is at least one leaf
 			 * node on this level that supports the WRED packet
@@ -686,12 +817,38 @@ struct rte_tm_node_capabilities {
 	 */
 	uint64_t shaper_private_rate_max;
 
+	/** Shaper private packet mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * packet mode. When configured in packet mode, committed/peak rate
+	 * provided is interpreted in packets per second.
+	 */
+	int shaper_private_packet_mode_supported;
+
+	/** Shaper private byte mode supported. When non-zero, this parameter
+	 * indicates private shaper of current node can be configured with
+	 * byte mode. When configured in byte mode, committed/peak rate
+	 * provided is interpreted in bytes per second.
+	 */
+	int shaper_private_byte_mode_supported;
+
 	/** Maximum number of shared shapers the current node can be part of.
 	 * The value of zero indicates that shared shapers are not supported by
 	 * the current node.
 	 */
 	uint32_t shaper_shared_n_max;
 
+	/** Shaper shared packet mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in packet mode.
+	 */
+	int shaper_shared_packet_mode_supported;
+
+	/** Shaper shared byte mode supported. When non-zero,
+	 * this parameter indicates that current node can be part of
+	 * shared shapers which work in byte mode.
+	 */
+	int shaper_shared_byte_mode_supported;
+
 	RTE_STD_C11
 	union {
 		/** Items valid only for non-leaf nodes. */
@@ -735,6 +892,23 @@ struct rte_tm_node_capabilities {
 			 * WFQ weight, so WFQ is reduced to FQ.
 			 */
 			uint32_t sched_wfq_weight_max;
+
+			/** WFQ packet mode supported. When non-zero, this
+			 * parameter indicates that current node supports packet
+			 * mode for WFQ among its children. WFQ weights will be
+			 * applied against packet count for scheduling children
+			 * when configured appropriately.
+			 */
+			int sched_wfq_packet_mode_supported;
+
+			/** WFQ byte mode supported. When non-zero, this
+			 * parameter indicates that current node supports byte
+			 * mode for WFQ among its children. WFQ weights will be
+			 * applied against  bytes for scheduling children when
+			 * configured appropriately.
+			 */
+			int sched_wfq_byte_mode_supported;
+
 		} nonleaf;
 
 		/** Items valid only for leaf nodes. */
@@ -836,10 +1010,10 @@ struct rte_tm_wred_params {
  * Token bucket
  */
 struct rte_tm_token_bucket {
-	/** Token bucket rate (bytes per second) */
+	/** Token bucket rate (bytes per second or packets per second) */
 	uint64_t rate;
 
-	/** Token bucket size (bytes), a.k.a. max burst size */
+	/** Token bucket size (bytes or packets), a.k.a. max burst size */
 	uint64_t size;
 };
 
@@ -860,6 +1034,11 @@ struct rte_tm_token_bucket {
  * Dual rate shapers use both the committed and the peak token buckets. The
  * rate of the peak bucket has to be bigger than zero, as well as greater than
  * or equal to the rate of the committed bucket.
+ *
+ * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported
+ * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported
  */
 struct rte_tm_shaper_params {
 	/** Committed token bucket */
@@ -872,8 +1051,19 @@ struct rte_tm_shaper_params {
 	 * purpose of shaping. Can be used to correct the packet length with
 	 * the framing overhead bytes that are also consumed on the wire (e.g.
 	 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS).
+	 * This field is ignored when the profile enables packet mode.
 	 */
 	int32_t pkt_length_adjust;
+
+	/** When zero, the byte mode is enabled for the current profile, so the
+	 * *rate* and *size* fields in both the committed and peak token buckets
+	 * are specified in bytes per second and bytes, respectively.
+	 * When non-zero, the packet mode is enabled for the current profile,
+	 * so the *rate* and *size* fields in both the committed and peak token
+	 * buckets are specified in packets per second and packets,
+	 * respectively.
+	 */
+	int packet_mode;
 };
 
 /**
@@ -925,6 +1115,8 @@ struct rte_tm_node_params {
 			 * 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.
+			 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported
+			 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported
 			 */
 			int *wfq_weight_mode;
 
@@ -997,6 +1189,7 @@ enum rte_tm_error_type {
 	RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE,
 	RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE,
 	RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN,
+	RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE,
 	RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID,
 	RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID,
 	RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID,
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v4 2/4] drivers/net: update tm capability for existing pmds
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
@ 2020-04-22 17:21   ` Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 17:21 UTC (permalink / raw)
  To: Beilei Xing, Qi Zhang, Rosen Xu, Wenzhuo Lu, Konstantin Ananyev,
	Liron Himi
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Since existing PMD's support shaper byte mode and scheduler
wfq byte mode, update the same in their port/level/node capabilities
that are added. SoftNIC PMD is already upto date with new capabilities.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
v3..v4:
- No change

v2..v3:
- Update node/level cap with shaper_shared_(packet, byte)_mode_supported.

v2:
- Newly included patch to change exiting pmd's with tm support of byte mode 
to show the same in port/level/node cap.
 drivers/net/i40e/i40e_tm.c     | 22 ++++++++++++++++++++++
 drivers/net/ipn3ke/ipn3ke_tm.c | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/ixgbe_tm.c   | 22 ++++++++++++++++++++++
 drivers/net/mvpp2/mrvl_tm.c    | 14 ++++++++++++++
 4 files changed, 96 insertions(+)

diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c
index c76760c..5d722f9 100644
--- a/drivers/net/i40e/i40e_tm.c
+++ b/drivers/net/i40e/i40e_tm.c
@@ -160,12 +160,16 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->func_caps.num_tx_qp;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -179,6 +183,8 @@ i40e_tm_capabilities_get(struct rte_eth_dev *dev,
 	 * So, all the nodes should have the same weight.
 	 */
 	cap->sched_wfq_weight_max = 1;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	cap->cman_head_drop_supported = 0;
 	cap->dynamic_update_mask = 0;
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD;
@@ -754,7 +760,11 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 40Gbps -> 5GBps */
 		cap->nonleaf.shaper_private_rate_max = 5000000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 		if (level_id == I40E_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
 				I40E_MAX_TRAFFIC_CLASS;
@@ -765,6 +775,8 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -776,7 +788,11 @@ i40e_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->leaf.shaper_private_rate_max = 5000000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
+	cap->leaf.shaper_shared_packet_mode_supported = 0;
+	cap->leaf.shaper_shared_byte_mode_supported = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
 	cap->leaf.cman_wred_context_shared_n_max = 0;
@@ -817,7 +833,11 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 40Gbps -> 5GBps */
 	cap->shaper_private_rate_max = 5000000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	if (node_type == I40E_TM_NODE_TYPE_QUEUE) {
 		cap->leaf.cman_head_drop_supported = false;
@@ -834,6 +854,8 @@ i40e_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c
index 5a16c5f..17ac026 100644
--- a/drivers/net/ipn3ke/ipn3ke_tm.c
+++ b/drivers/net/ipn3ke/ipn3ke_tm.c
@@ -440,6 +440,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_private_dual_rate_n_max = 0;
 	cap->shaper_private_rate_min = 1;
 	cap->shaper_private_rate_max = 1 + IPN3KE_TM_VT_NODE_NUM;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
@@ -447,6 +449,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
 	cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
@@ -456,6 +460,8 @@ ipn3ke_tm_capabilities_get(__rte_unused struct rte_eth_dev *dev,
 	cap->sched_wfq_n_children_per_group_max = UINT32_MAX;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = UINT32_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->cman_wred_packet_mode_supported = 0;
 	cap->cman_wred_byte_mode_supported = 0;
@@ -517,13 +523,19 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -539,13 +551,19 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_dual_rate_supported = 0;
 		cap->nonleaf.shaper_private_rate_min = 1;
 		cap->nonleaf.shaper_private_rate_max = UINT32_MAX;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 0;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->nonleaf.stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -561,7 +579,11 @@ ipn3ke_tm_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_dual_rate_supported = 0;
 		cap->leaf.shaper_private_rate_min = 0;
 		cap->leaf.shaper_private_rate_max = 0;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.shaper_shared_n_max = 0;
+		cap->leaf.shaper_shared_packet_mode_supported = 0;
+		cap->leaf.shaper_shared_byte_mode_supported = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
 		cap->leaf.cman_wred_packet_mode_supported = WRED_SUPPORTED;
@@ -632,7 +654,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -640,6 +666,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_VT_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -649,7 +677,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 1;
 		cap->shaper_private_rate_max = UINT32_MAX;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 1;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->nonleaf.sched_n_children_max = IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -657,6 +689,8 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 			IPN3KE_TM_COS_NODE_NUM;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 
 		cap->stats_mask = STATS_MASK_DEFAULT;
 		break;
@@ -666,7 +700,11 @@ ipn3ke_tm_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->shaper_private_dual_rate_supported = 0;
 		cap->shaper_private_rate_min = 0;
 		cap->shaper_private_rate_max = 0;
+		cap->shaper_private_packet_mode_supported = 0;
+		cap->shaper_private_byte_mode_supported = 0;
 		cap->shaper_shared_n_max = 0;
+		cap->shaper_shared_packet_mode_supported = 0;
+		cap->shaper_shared_byte_mode_supported = 0;
 
 		cap->leaf.cman_head_drop_supported = 0;
 		cap->leaf.cman_wred_packet_mode_supported = WRED_SUPPORTED;
diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c
index 73845a7..a8407e7 100644
--- a/drivers/net/ixgbe/ixgbe_tm.c
+++ b/drivers/net/ixgbe/ixgbe_tm.c
@@ -168,12 +168,16 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
 	cap->shaper_shared_n_nodes_per_shaper_max = 0;
 	cap->shaper_shared_n_shapers_per_node_max = 0;
 	cap->shaper_shared_dual_rate_n_max = 0;
 	cap->shaper_shared_rate_min = 0;
 	cap->shaper_shared_rate_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 	cap->sched_n_children_max = hw->mac.max_tx_queues;
 	/**
 	 * HW supports SP. But no plan to support it now.
@@ -182,6 +186,8 @@ ixgbe_tm_capabilities_get(struct rte_eth_dev *dev,
 	cap->sched_sp_n_priorities_max = 1;
 	cap->sched_wfq_n_children_per_group_max = 0;
 	cap->sched_wfq_n_groups_max = 0;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 0;
 	/**
 	 * SW only supports fair round robin now.
 	 * So, all the nodes should have the same weight.
@@ -875,7 +881,11 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_rate_min = 0;
 		/* 10Gbps -> 1.25GBps */
 		cap->nonleaf.shaper_private_rate_max = 1250000000ull;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 		cap->nonleaf.shaper_shared_n_max = 0;
+		cap->nonleaf.shaper_shared_packet_mode_supported = 0;
+		cap->nonleaf.shaper_shared_byte_mode_supported = 0;
 		if (level_id == IXGBE_TM_NODE_TYPE_PORT)
 			cap->nonleaf.sched_n_children_max =
 				IXGBE_DCB_MAX_TRAFFIC_CLASS;
@@ -886,6 +896,8 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 		cap->nonleaf.stats_mask = 0;
 
 		return 0;
@@ -897,7 +909,11 @@ ixgbe_level_capabilities_get(struct rte_eth_dev *dev,
 	cap->leaf.shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->leaf.shaper_private_rate_max = 1250000000ull;
+	cap->leaf.shaper_private_packet_mode_supported = 0;
+	cap->leaf.shaper_private_byte_mode_supported = 1;
 	cap->leaf.shaper_shared_n_max = 0;
+	cap->leaf.shaper_shared_packet_mode_supported = 0;
+	cap->leaf.shaper_shared_byte_mode_supported = 0;
 	cap->leaf.cman_head_drop_supported = false;
 	cap->leaf.cman_wred_context_private_supported = true;
 	cap->leaf.cman_wred_context_shared_n_max = 0;
@@ -938,7 +954,11 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_rate_min = 0;
 	/* 10Gbps -> 1.25GBps */
 	cap->shaper_private_rate_max = 1250000000ull;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 	cap->shaper_shared_n_max = 0;
+	cap->shaper_shared_packet_mode_supported = 0;
+	cap->shaper_shared_byte_mode_supported = 0;
 
 	if (node_type == IXGBE_TM_NODE_TYPE_QUEUE) {
 		cap->leaf.cman_head_drop_supported = false;
@@ -955,6 +975,8 @@ ixgbe_node_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.sched_wfq_n_children_per_group_max = 0;
 		cap->nonleaf.sched_wfq_n_groups_max = 0;
 		cap->nonleaf.sched_wfq_weight_max = 1;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 0;
 	}
 
 	cap->stats_mask = 0;
diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c
index 3de8997..e98f576 100644
--- a/drivers/net/mvpp2/mrvl_tm.c
+++ b/drivers/net/mvpp2/mrvl_tm.c
@@ -193,12 +193,16 @@ mrvl_capabilities_get(struct rte_eth_dev *dev,
 	cap->shaper_private_n_max = cap->shaper_n_max;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	cap->sched_n_children_max = dev->data->nb_tx_queues;
 	cap->sched_sp_n_priorities_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_children_per_group_max = dev->data->nb_tx_queues;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+	cap->sched_wfq_packet_mode_supported = 0;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask = RTE_TM_UPDATE_NODE_SUSPEND_RESUME |
 				   RTE_TM_UPDATE_NODE_STATS;
@@ -244,6 +248,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->nonleaf.shaper_private_supported = 1;
 		cap->nonleaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->nonleaf.shaper_private_rate_max = priv->rate_max;
+		cap->nonleaf.shaper_private_packet_mode_supported = 0;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
 		cap->nonleaf.sched_sp_n_priorities_max = 1;
@@ -251,6 +257,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->nonleaf.stats_mask = RTE_TM_STATS_N_PKTS |
 					  RTE_TM_STATS_N_BYTES;
 	} else { /* level_id == MRVL_NODE_QUEUE */
@@ -261,6 +269,8 @@ mrvl_level_capabilities_get(struct rte_eth_dev *dev,
 		cap->leaf.shaper_private_supported = 1;
 		cap->leaf.shaper_private_rate_min = MRVL_RATE_MIN;
 		cap->leaf.shaper_private_rate_max = priv->rate_max;
+		cap->leaf.shaper_private_packet_mode_supported = 0;
+		cap->leaf.shaper_private_byte_mode_supported = 1;
 		cap->leaf.stats_mask = RTE_TM_STATS_N_PKTS;
 	}
 
@@ -300,6 +310,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 	cap->shaper_private_supported = 1;
 	cap->shaper_private_rate_min = MRVL_RATE_MIN;
 	cap->shaper_private_rate_max = priv->rate_max;
+	cap->shaper_private_packet_mode_supported = 0;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	if (node->type == MRVL_NODE_PORT) {
 		cap->nonleaf.sched_n_children_max = dev->data->nb_tx_queues;
@@ -308,6 +320,8 @@ mrvl_node_capabilities_get(struct rte_eth_dev *dev, uint32_t node_id,
 			dev->data->nb_tx_queues;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MRVL_WEIGHT_MAX;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 0;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 		cap->stats_mask = RTE_TM_STATS_N_PKTS | RTE_TM_STATS_N_BYTES;
 	} else {
 		cap->stats_mask = RTE_TM_STATS_N_PKTS;
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v4 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
@ 2020-04-22 17:21   ` Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
  2020-04-24 10:28   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in " Dumitrescu, Cristian
  3 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 17:21 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, John McNamara,
	Marko Kovacevic
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

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".

Also add support to shaper profile add command to take
packet mode parameter used to setup shaper in packet mode.
This adds an extra argument "packet_mode" to shaper profile add command
"add port tm node shaper profile" as last argument.

This patch also dumps new tm port/level/node capabilities
sched_wfq_packet_mode_supported, sched_wfq_byte_mode_supported,
shaper_private_packet_mode_supported, shaper_private_byte_mode_supported,
shaper_shared_packet_mode_supported, shaper_shared_byte_mode_supported.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v3..v4:
- Add packet mode error string.

v2..v3:
- Update cmdline dump of node/level cap.

v1..v2:
- Update tm capability show cmd to dump lastest pktmode/bytemode fields of v2.
- Update existing shaper profile add command to take last argument as pkt_mode
and update struct rte_tm_shaper_params:packet_mode with the same.
- Update documentation with latest command changes.

 app/test-pmd/cmdline.c                      |   9 +-
 app/test-pmd/cmdline_tm.c                   | 222 ++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h                   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  40 ++++-
 4 files changed, 266 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 22fb23a..880ec61 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1189,7 +1189,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 
 			"add port tm node shaper profile (port_id) (shaper_profile_id)"
 			" (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
-			" (packet_length_adjust)\n"
+			" (packet_length_adjust) (packet_mode)\n"
 			"       Add port tm node private shaper profile.\n\n"
 
 			"del port tm node shaper profile (port_id) (shaper_profile_id)\n"
@@ -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)"
@@ -19655,6 +19661,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 6951beb..52bdbd6 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -54,6 +54,8 @@ print_err_msg(struct rte_tm_error *error)
 			= "peak size field (shaper profile)",
 		[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN]
 			= "packet adjust length field (shaper profile)",
+		[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE]
+			= "packet mode field (shaper profile)",
 		[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID] = "shaper profile id",
 		[RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID] = "shared shaper id",
 		[RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID] = "parent node id",
@@ -257,6 +259,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		cap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		cap.shaper_shared_n_max);
 	printf("cap.shaper_shared_n_nodes_per_shaper_max %" PRIu32 "\n",
@@ -269,6 +275,10 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
 		cap.shaper_shared_rate_min);
 	printf("cap.shaper_shared_rate_max %" PRIu64 "\n",
 		cap.shaper_shared_rate_max);
+	printf("cap.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_packet_mode_supported);
+	printf("cap.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		cap.shaper_shared_byte_mode_supported);
 	printf("cap.shaper_pkt_length_adjust_min %" PRId32 "\n",
 		cap.shaper_pkt_length_adjust_min);
 	printf("cap.shaper_pkt_length_adjust_max %" PRId32 "\n",
@@ -283,6 +293,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_packet_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_packet_mode_supported);
+	printf("cap.sched_wfq_byte_mode_supported %" PRId32 "\n",
+		cap.sched_wfq_byte_mode_supported);
 	printf("cap.cman_head_drop_supported %" PRId32 "\n",
 		cap.cman_head_drop_supported);
 	printf("cap.cman_wred_context_n_max %" PRIu32 "\n",
@@ -401,8 +415,19 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.nonleaf.shaper_private_rate_min);
 		printf("cap.nonleaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.nonleaf.shaper_private_rate_max);
+		printf("cap.nonleaf.shaper_private_packet_mode_supported %"
+		       PRId32 "\n",
+			lcap.nonleaf.shaper_private_packet_mode_supported);
+		printf("cap.nonleaf.shaper_private_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.shaper_private_byte_mode_supported);
 		printf("cap.nonleaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.nonleaf.shaper_shared_n_max);
+		printf("cap.nonleaf.shaper_shared_packet_mode_supported %"
+		       PRId32 "\n",
+		       lcap.nonleaf.shaper_shared_packet_mode_supported);
+		printf("cap.nonleaf.shaper_shared_byte_mode_supported %"
+		       PRId32 "\n",
+		       lcap.nonleaf.shaper_shared_byte_mode_supported);
 		printf("cap.nonleaf.sched_n_children_max %" PRIu32 "\n",
 			lcap.nonleaf.sched_n_children_max);
 		printf("cap.nonleaf.sched_sp_n_priorities_max %" PRIu32 "\n",
@@ -413,6 +438,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_packet_mode_supported %" PRId32 "\n",
+			lcap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32
+		       "\n", lcap.nonleaf.sched_wfq_byte_mode_supported);
 		printf("cap.nonleaf.stats_mask %" PRIx64 "\n",
 			lcap.nonleaf.stats_mask);
 	} else {
@@ -424,8 +453,16 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
 			lcap.leaf.shaper_private_rate_min);
 		printf("cap.leaf.shaper_private_rate_max %" PRIu64 "\n",
 			lcap.leaf.shaper_private_rate_max);
+		printf("cap.leaf.shaper_private_packet_mode_supported %" PRId32
+		       "\n", lcap.leaf.shaper_private_packet_mode_supported);
+		printf("cap.leaf.shaper_private_byte_mode_supported %" PRId32 "\n",
+			lcap.leaf.shaper_private_byte_mode_supported);
 		printf("cap.leaf.shaper_shared_n_max %" PRIu32 "\n",
 			lcap.leaf.shaper_shared_n_max);
+		printf("cap.leaf.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		       lcap.leaf.shaper_shared_packet_mode_supported);
+		printf("cap.leaf.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		       lcap.leaf.shaper_shared_byte_mode_supported);
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
 			lcap.leaf.cman_head_drop_supported);
 		printf("cap.leaf.cman_wred_context_private_supported %"	PRId32
@@ -524,8 +561,16 @@ static void cmd_show_port_tm_node_cap_parsed(void *parsed_result,
 		ncap.shaper_private_rate_min);
 	printf("cap.shaper_private_rate_max %" PRIu64 "\n",
 		ncap.shaper_private_rate_max);
+	printf("cap.shaper_private_packet_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_packet_mode_supported);
+	printf("cap.shaper_private_byte_mode_supported %" PRId32 "\n",
+		ncap.shaper_private_byte_mode_supported);
 	printf("cap.shaper_shared_n_max %" PRIu32 "\n",
 		ncap.shaper_shared_n_max);
+	printf("cap.shaper_shared_packet_mode_supported %" PRId32 "\n",
+		ncap.shaper_shared_packet_mode_supported);
+	printf("cap.shaper_shared_byte_mode_supported %" PRId32 "\n",
+		ncap.shaper_shared_byte_mode_supported);
 	if (!is_leaf) {
 		printf("cap.nonleaf.sched_n_children_max %" PRIu32 "\n",
 			ncap.nonleaf.sched_n_children_max);
@@ -537,6 +582,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_packet_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_packet_mode_supported);
+		printf("cap.nonleaf.sched_wfq_byte_mode_supported %" PRId32 "\n",
+			ncap.nonleaf.sched_wfq_byte_mode_supported);
 	} else {
 		printf("cap.leaf.cman_head_drop_supported %" PRId32 "\n",
 			ncap.leaf.cman_head_drop_supported);
@@ -776,6 +825,7 @@ struct cmd_add_port_tm_node_shaper_profile_result {
 	uint64_t peak_tb_rate;
 	uint64_t peak_tb_size;
 	uint32_t pktlen_adjust;
+	int pkt_mode;
 };
 
 cmdline_parse_token_string_t cmd_add_port_tm_node_shaper_profile_add =
@@ -829,6 +879,10 @@ cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_pktlen_adjust =
 	TOKEN_NUM_INITIALIZER(
 		struct cmd_add_port_tm_node_shaper_profile_result,
 			pktlen_adjust, UINT32);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_packet_mode =
+	TOKEN_NUM_INITIALIZER(
+		struct cmd_add_port_tm_node_shaper_profile_result,
+			pkt_mode, UINT32);
 
 static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	__rte_unused struct cmdline *cl,
@@ -853,6 +907,7 @@ static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	sp.peak.rate = res->peak_tb_rate;
 	sp.peak.size = res->peak_tb_size;
 	sp.pkt_length_adjust = pkt_len_adjust;
+	sp.packet_mode = res->pkt_mode;
 
 	ret = rte_tm_shaper_profile_add(port_id, shaper_id, &sp, &error);
 	if (ret != 0) {
@@ -879,6 +934,7 @@ cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile = {
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_rate,
 		(void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_size,
 		(void *)&cmd_add_port_tm_node_shaper_profile_pktlen_adjust,
+		(void *)&cmd_add_port_tm_node_shaper_profile_packet_mode,
 		NULL,
 	},
 };
@@ -1671,6 +1727,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 a360ecc..7513a97 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2842,19 +2842,22 @@ Add the port traffic management private shaper profile::
 
    testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
    (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
-   (packet_length_adjust)
+   (packet_length_adjust) (packet_mode)
 
 where:
 
 * ``shaper_profile id``: Shaper profile ID for the new profile.
-* ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
-* ``cmit_tb_size``: Committed token bucket size (bytes).
-* ``peak_tb_rate``: Peak token bucket rate (bytes per second).
-* ``peak_tb_size``: Peak token bucket size (bytes).
+* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
+* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
+* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
+* ``peak_tb_size``: Peak token bucket size (bytes or packets).
 * ``packet_length_adjust``: The value (bytes) to be added to the length of
   each packet for the purpose of shaping. This parameter value can be used to
   correct the packet length with the framing overhead bytes that are consumed
   on the wire.
+* ``packet_mode``: Shaper configured in packet mode. This parameter value if
+  zero, configures shaper in byte mode and if non-zero configures it in packet
+  mode.
 
 Delete port traffic management private shaper profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2979,6 +2982,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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [dpdk-dev] [PATCH v4 4/4] net/octeontx2: support tm length adjust and pkt mode
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
@ 2020-04-22 17:21   ` Nithin Dabilpuram
  2020-04-24 10:28   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in " Dumitrescu, Cristian
  3 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 17:21 UTC (permalink / raw)
  To: Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K; +Cc: dev, kkanas

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

This patch adds support to packet length adjust TM feature
for private shaper. It also adds support to packet mode
feature that applies both to private shaper and node DWRR
scheduling of SP children.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---

v3..v4:
- No change.

v2..v3:
- No change.

v1..v2:
- Newly included patch.

 drivers/net/octeontx2/otx2_tm.c | 140 +++++++++++++++++++++++++++++++++-------
 drivers/net/octeontx2/otx2_tm.h |   5 ++
 2 files changed, 122 insertions(+), 23 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_tm.c b/drivers/net/octeontx2/otx2_tm.c
index f94618d..fa7d21b 100644
--- a/drivers/net/octeontx2/otx2_tm.c
+++ b/drivers/net/octeontx2/otx2_tm.c
@@ -336,18 +336,25 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 {
 	struct shaper_params cir, pir;
 	uint32_t schq = tm_node->hw_id;
+	uint64_t adjust = 0;
 	uint8_t k = 0;
 
 	memset(&cir, 0, sizeof(cir));
 	memset(&pir, 0, sizeof(pir));
 	shaper_config_to_nix(profile, &cir, &pir);
 
-	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, "
-		    "pir %" PRIu64 "(%" PRIu64 "B),"
-		     " cir %" PRIu64 "(%" PRIu64 "B) (%p)",
-		     nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
-		     tm_node->id, pir.rate, pir.burst,
-		     cir.rate, cir.burst, tm_node);
+	/* Packet length adjust */
+	if (tm_node->pkt_mode)
+		adjust = 1;
+	else if (profile)
+		adjust = profile->params.pkt_length_adjust & 0x1FF;
+
+	otx2_tm_dbg("Shaper config node %s(%u) lvl %u id %u, pir %" PRIu64
+		    "(%" PRIu64 "B), cir %" PRIu64 "(%" PRIu64 "B)"
+		    "adjust 0x%" PRIx64 "(pktmode %u) (%p)",
+		    nix_hwlvl2str(tm_node->hw_lvl), schq, tm_node->lvl,
+		    tm_node->id, pir.rate, pir.burst, cir.rate, cir.burst,
+		    adjust, tm_node->pkt_mode, tm_node);
 
 	switch (tm_node->hw_lvl) {
 	case NIX_TXSCH_LVL_SMQ:
@@ -364,7 +371,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED ALG */
 		reg[k] = NIX_AF_MDQX_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL4:
@@ -381,7 +390,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL4X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 		break;
 	case NIX_TXSCH_LVL_TL3:
@@ -398,7 +409,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL3X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -416,7 +429,9 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 
 		/* Configure RED algo */
 		reg[k] = NIX_AF_TL2X_SHAPE(schq);
-		regval[k] = ((uint64_t)tm_node->red_algo << 9);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->red_algo << 9 |
+			     (uint64_t)tm_node->pkt_mode << 24);
 		k++;
 
 		break;
@@ -426,6 +441,12 @@ prepare_tm_shaper_reg(struct otx2_nix_tm_node *tm_node,
 		regval[k] = (cir.rate && cir.burst) ?
 				(shaper2regval(&cir) | 1) : 0;
 		k++;
+
+		/* Configure length disable and adjust */
+		reg[k] = NIX_AF_TL1X_SHAPE(schq);
+		regval[k] = (adjust |
+			     (uint64_t)tm_node->pkt_mode << 24);
+		k++;
 		break;
 	}
 
@@ -773,6 +794,15 @@ nix_tm_node_add_to_list(struct otx2_eth_dev *dev, uint32_t node_id,
 	tm_node->flags = 0;
 	if (user)
 		tm_node->flags = NIX_TM_NODE_USER;
+
+	/* Packet mode */
+	if (!nix_tm_is_leaf(dev, lvl) &&
+	    ((profile && profile->params.packet_mode) ||
+	     (params->nonleaf.wfq_weight_mode &&
+	      params->nonleaf.n_sp_priorities &&
+	      !params->nonleaf.wfq_weight_mode[0])))
+		tm_node->pkt_mode = 1;
+
 	rte_memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params));
 
 	if (profile)
@@ -1873,8 +1903,10 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->shaper_private_dual_rate_n_max = max_nr_nodes;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
-	cap->shaper_pkt_length_adjust_min = 0;
-	cap->shaper_pkt_length_adjust_max = 0;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
+	cap->shaper_pkt_length_adjust_min = NIX_LENGTH_ADJUST_MIN;
+	cap->shaper_pkt_length_adjust_max = NIX_LENGTH_ADJUST_MAX;
 
 	/* Schedule Capabilities */
 	cap->sched_n_children_max = rsp->schq[NIX_TXSCH_LVL_MDQ];
@@ -1882,6 +1914,8 @@ otx2_nix_tm_capa_get(struct rte_eth_dev *eth_dev,
 	cap->sched_wfq_n_children_per_group_max = cap->sched_n_children_max;
 	cap->sched_wfq_n_groups_max = 1;
 	cap->sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->sched_wfq_packet_mode_supported = 1;
+	cap->sched_wfq_byte_mode_supported = 1;
 
 	cap->dynamic_update_mask =
 		RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL |
@@ -1944,12 +1978,16 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_tm_have_tl1_access(dev) ? false : true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		cap->nonleaf.sched_n_children_max = rsp->schq[hw_lvl - 1];
 		cap->nonleaf.sched_sp_n_priorities_max =
 					nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 		if (nix_tm_have_tl1_access(dev))
 			cap->nonleaf.stats_mask =
@@ -1966,6 +2004,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 		cap->nonleaf.shaper_private_dual_rate_supported = true;
 		cap->nonleaf.shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 		cap->nonleaf.shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+		cap->nonleaf.shaper_private_packet_mode_supported = 1;
+		cap->nonleaf.shaper_private_byte_mode_supported = 1;
 
 		/* MDQ doesn't support Strict Priority */
 		if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -1977,6 +2017,8 @@ otx2_nix_tm_level_capa_get(struct rte_eth_dev *eth_dev, uint32_t lvl,
 			nix_max_prio(dev, hw_lvl) + 1;
 		cap->nonleaf.sched_wfq_n_groups_max = 1;
 		cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+		cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+		cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 	} else {
 		/* unsupported level */
 		error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED;
@@ -2029,6 +2071,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		(hw_lvl == NIX_TXSCH_LVL_TL1) ? false : true;
 	cap->shaper_private_rate_min = MIN_SHAPER_RATE / 8;
 	cap->shaper_private_rate_max = MAX_SHAPER_RATE / 8;
+	cap->shaper_private_packet_mode_supported = 1;
+	cap->shaper_private_byte_mode_supported = 1;
 
 	/* Non Leaf Scheduler */
 	if (hw_lvl == NIX_TXSCH_LVL_MDQ)
@@ -2041,6 +2085,8 @@ otx2_nix_tm_node_capa_get(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		cap->nonleaf.sched_n_children_max;
 	cap->nonleaf.sched_wfq_n_groups_max = 1;
 	cap->nonleaf.sched_wfq_weight_max = MAX_SCHED_WEIGHT;
+	cap->nonleaf.sched_wfq_packet_mode_supported = 1;
+	cap->nonleaf.sched_wfq_byte_mode_supported = 1;
 
 	if (hw_lvl == NIX_TXSCH_LVL_TL1)
 		cap->stats_mask = RTE_TM_STATS_N_PKTS_RED_DROPPED |
@@ -2096,6 +2142,13 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (params->pkt_length_adjust < NIX_LENGTH_ADJUST_MIN ||
+	    params->pkt_length_adjust > NIX_LENGTH_ADJUST_MAX) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN;
+		error->message = "length adjust invalid";
+		return -EINVAL;
+	}
+
 	profile = rte_zmalloc("otx2_nix_tm_shaper_profile",
 			      sizeof(struct otx2_nix_tm_shaper_profile), 0);
 	if (!profile)
@@ -2108,13 +2161,14 @@ otx2_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev,
 
 	otx2_tm_dbg("Added TM shaper profile %u, "
 		    " pir %" PRIu64 " , pbs %" PRIu64 ", cir %" PRIu64
-		    ", cbs %" PRIu64 " , adj %u",
+		    ", cbs %" PRIu64 " , adj %u, pkt mode %d",
 		    profile_id,
 		    params->peak.rate * 8,
 		    params->peak.size,
 		    params->committed.rate * 8,
 		    params->committed.size,
-		    params->pkt_length_adjust);
+		    params->pkt_length_adjust,
+		    params->packet_mode);
 
 	/* Translate rate as bits per second */
 	profile->params.peak.rate = profile->params.peak.rate * 8;
@@ -2170,9 +2224,11 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		     struct rte_tm_error *error)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+	struct otx2_nix_tm_shaper_profile *profile = NULL;
 	struct otx2_nix_tm_node *parent_node;
-	int rc, clear_on_fail = 0;
-	uint32_t exp_next_lvl;
+	int rc, pkt_mode, clear_on_fail = 0;
+	uint32_t exp_next_lvl, i;
+	uint32_t profile_id;
 	uint16_t hw_lvl;
 
 	/* we don't support dynamic updates */
@@ -2234,13 +2290,45 @@ otx2_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 		return -EINVAL;
 	}
 
-	/* Check if shaper profile exists for non leaf node */
-	if (!nix_tm_is_leaf(dev, lvl) &&
-	    params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE &&
-	    !nix_tm_shaper_profile_search(dev, params->shaper_profile_id)) {
-		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
-		error->message = "invalid shaper profile";
-		return -EINVAL;
+	if (!nix_tm_is_leaf(dev, lvl)) {
+		/* Check if shaper profile exists for non leaf node */
+		profile_id = params->shaper_profile_id;
+		profile = nix_tm_shaper_profile_search(dev, profile_id);
+		if (profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE && !profile) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+			error->message = "invalid shaper profile";
+			return -EINVAL;
+		}
+
+		/* Minimum static priority count is 1 */
+		if (!params->nonleaf.n_sp_priorities ||
+		    params->nonleaf.n_sp_priorities > TXSCH_TLX_SP_PRIO_MAX) {
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES;
+			error->message = "invalid sp priorities";
+			return -EINVAL;
+		}
+
+		pkt_mode = 0;
+		/* Validate weight mode */
+		for (i = 0; i < params->nonleaf.n_sp_priorities &&
+		     params->nonleaf.wfq_weight_mode; i++) {
+			pkt_mode = !params->nonleaf.wfq_weight_mode[i];
+			if (pkt_mode == !params->nonleaf.wfq_weight_mode[0])
+				continue;
+
+			error->type =
+				RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE;
+			error->message = "unsupported weight mode";
+			return -EINVAL;
+		}
+
+		if (profile && params->nonleaf.n_sp_priorities &&
+		    pkt_mode != profile->params.packet_mode) {
+			error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE;
+			error->message = "shaper wfq packet mode mismatch";
+			return -EINVAL;
+		}
 	}
 
 	/* Check if there is second DWRR already in siblings or holes in prio */
@@ -2482,6 +2570,12 @@ otx2_nix_tm_node_shaper_update(struct rte_eth_dev *eth_dev,
 		}
 	}
 
+	if (profile && profile->params.packet_mode != tm_node->pkt_mode) {
+		error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID;
+		error->message = "shaper profile pkt mode mismatch";
+		return -EINVAL;
+	}
+
 	tm_node->params.shaper_profile_id = profile_id;
 
 	/* Nothing to do if not yet committed */
diff --git a/drivers/net/octeontx2/otx2_tm.h b/drivers/net/octeontx2/otx2_tm.h
index 9675182..cdca987 100644
--- a/drivers/net/octeontx2/otx2_tm.h
+++ b/drivers/net/octeontx2/otx2_tm.h
@@ -48,6 +48,7 @@ struct otx2_nix_tm_node {
 #define NIX_TM_NODE_USER	BIT_ULL(2)
 	/* Shaper algorithm for RED state @NIX_REDALG_E */
 	uint32_t red_algo:2;
+	uint32_t pkt_mode:1;
 
 	struct otx2_nix_tm_node *parent;
 	struct rte_tm_node_params params;
@@ -114,6 +115,10 @@ TAILQ_HEAD(otx2_nix_tm_shaper_profile_list, otx2_nix_tm_shaper_profile);
 #define MAX_SHAPER_RATE \
 	SHAPER_RATE(MAX_RATE_EXPONENT, MAX_RATE_MANTISSA, 0)
 
+/* Min is limited so that NIX_AF_SMQX_CFG[MINLEN]+ADJUST is not -ve */
+#define NIX_LENGTH_ADJUST_MIN ((int)-NIX_MIN_HW_FRS + 1)
+#define NIX_LENGTH_ADJUST_MAX 255
+
 /** TM Shaper - low level operations */
 
 /** NIX burst limits */
-- 
2.8.4


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] RE: [PATCH v3] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 12:18     ` Singh, Jasvinder
@ 2020-04-22 17:21       ` Nithin Dabilpuram
  0 siblings, 0 replies; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-22 17:21 UTC (permalink / raw)
  To: Singh, Jasvinder
  Cc: Nithin Dabilpuram, Dumitrescu, Cristian, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko, dev, jerinj, kkanas

Fixed in v4.
On Wed, Apr 22, 2020 at 12:18:14PM +0000, Singh, Jasvinder wrote:
> External Email
> 
> ----------------------------------------------------------------------
> 
> 
> > -----Original Message-----
> > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > Sent: Wednesday, April 22, 2020 9:09 AM
> > To: Nithin Dabilpuram <nithind1988@gmail.com>
> > Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > Rybchenko <arybchenko@solarflare.com>; dev@dpdk.org;
> > jerinj@marvell.com; kkanas@marvell.com
> > Subject: Re: [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config
> > in pkt mode
> > 
> > Please ignore this patch. Had issue with subject line.
> > Consider patch "[v3,1/4] ethdev: add tm support for shaper config in pkt
> > mode "
> > instead.
> > 
> > On Wed, Apr 22, 2020 at 01:29:44PM +0530, Nithin Dabilpuram wrote:
> > > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > >
> > > Some NIC hardware support shaper to work in packet mode i.e shaping or
> > > ratelimiting traffic is in packets per second (PPS) as opposed to
> > > default bytes per second (BPS). Hence this patch adds support to
> > > configure shared or private shaper in packet mode, provide rate in PPS
> > > and add related tm capabilities in port/level/node capability
> > > structures.
> > >
> > > This patch also updates tm port/level/node capability structures with
> > > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > > and private/shared shaper byte mode.
> > >
> > > SoftNIC PMD is also updated with new capabilities.
> > >
> > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > ---
> > >
> > > v2..v3:
> > > - Fix typo's
> > > - Add shaper_shared_(packet, byte)_mode_supported in level and node
> > > cap
> > > - Fix comment in pkt_length_adjust.
> > > - Move rte_eth_softnic_tm.c capability update to patch 1/4 to
> > >   avoid compilations issues in node and level cap array in softnicpmd.
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: warning: braces around
> > scalar initializer
> > >    {.nonleaf = {
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:3: note: (near initialization
> > for ‘tm_node_cap[0].shaper_shared_byte_mode_supported’)
> > >   ../drivers/net/softnic/rte_eth_softnic_tm.c:782:4: error: field name not in
> > record or union initializer
> > >    {.nonleaf = {
> > >
> > > v1..v2:
> > > - Add seperate capability for shaper and scheduler pktmode and
> > bytemode.
> > > - Add packet_mode field in struct rte_tm_shaper_params to indicate
> > > packet mode shaper profile.
> > >
> > >
> > >  drivers/net/softnic/rte_eth_softnic_tm.c |  65 ++++++++++
> <snip>
> 
> > > @@ -548,13 +554,19 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.shaper_private_dual_rate_supported = 0,
> > >  			.shaper_private_rate_min = 1,
> > >  			.shaper_private_rate_max = UINT32_MAX,
> > > +			.shaper_private_packet_mode_supported = 0,
> > > +			.shaper_private_byte_mode_supported = 1,
> > >  			.shaper_shared_n_max = 0,
> > > +			.shaper_shared_packet_mode_supported = 0,
> > > +			.shaper_shared_byte_mode_supported = 0,
> > >
> > >  			.sched_n_children_max = UINT32_MAX,
> > >  			.sched_sp_n_priorities_max = 1,
> > >  			.sched_wfq_n_children_per_group_max =
> > UINT32_MAX,
> > >  			.sched_wfq_n_groups_max = 1,
> > >  			.sched_wfq_weight_max = 1,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> 
> [Jasvinder] -  byte mode needs to be set here.
> 
> 
> 
> > >  			.stats_mask = STATS_MASK_DEFAULT,
> > >  		} },
> > > @@ -572,7 +584,11 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.shaper_private_dual_rate_supported = 0,
> > >  			.shaper_private_rate_min = 1,
> > >  			.shaper_private_rate_max = UINT32_MAX,
> > > +			.shaper_private_packet_mode_supported = 0,
> > > +			.shaper_private_byte_mode_supported = 1,
> > >  			.shaper_shared_n_max = 0,
> > > +			.shaper_shared_packet_mode_supported = 0,
> > > +			.shaper_shared_byte_mode_supported = 0,
> > >
> > >  			.sched_n_children_max = UINT32_MAX,
> > >  			.sched_sp_n_priorities_max = 1,
> > > @@ -580,9 +596,14 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.sched_wfq_n_groups_max = 1,
> > >  #ifdef RTE_SCHED_SUBPORT_TC_OV
> > >  			.sched_wfq_weight_max = UINT32_MAX,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 1,
> > >  #else
> > >  			.sched_wfq_weight_max = 1,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> 
> [jasvinder] - byte mode should be set here as well. 
> 
> 
> > >  #endif
> > > +
> > >  			.stats_mask = STATS_MASK_DEFAULT,
> > >  		} },
> > >  	},
> > > @@ -599,7 +620,11 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.shaper_private_dual_rate_supported = 0,
> > >  			.shaper_private_rate_min = 1,
> > >  			.shaper_private_rate_max = UINT32_MAX,
> > > +			.shaper_private_packet_mode_supported = 0,
> > > +			.shaper_private_byte_mode_supported = 1,
> > >  			.shaper_shared_n_max = 0,
> > > +			.shaper_shared_packet_mode_supported = 0,
> > > +			.shaper_shared_byte_mode_supported = 0,
> > >
> > >  			.sched_n_children_max =
> > >  				RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE,
> > > @@ -608,6 +633,8 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.sched_wfq_n_children_per_group_max = 1,
> > >  			.sched_wfq_n_groups_max = 0,
> > >  			.sched_wfq_weight_max = 1,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> > >
> > >  			.stats_mask = STATS_MASK_DEFAULT,
> > >  		} },
> > > @@ -625,7 +652,11 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.shaper_private_dual_rate_supported = 0,
> > >  			.shaper_private_rate_min = 1,
> > >  			.shaper_private_rate_max = UINT32_MAX,
> > > +			.shaper_private_packet_mode_supported = 0,
> > > +			.shaper_private_byte_mode_supported = 1,
> > >  			.shaper_shared_n_max = 1,
> > > +			.shaper_shared_packet_mode_supported = 0,
> > > +			.shaper_shared_byte_mode_supported = 1,
> > >
> > >  			.sched_n_children_max =
> > >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> > > @@ -634,6 +665,8 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> > >  			.sched_wfq_n_groups_max = 1,
> > >  			.sched_wfq_weight_max = UINT32_MAX,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 1,
> > >
> > >  			.stats_mask = STATS_MASK_DEFAULT,
> > >  		} },
> > > @@ -651,7 +684,11 @@ static const struct rte_tm_level_capabilities
> > tm_level_cap[] = {
> > >  			.shaper_private_dual_rate_supported = 0,
> > >  			.shaper_private_rate_min = 0,
> > >  			.shaper_private_rate_max = 0,
> > > +			.shaper_private_packet_mode_supported = 0,
> > > +			.shaper_private_byte_mode_supported = 0,
> > >  			.shaper_shared_n_max = 0,
> > > +			.shaper_shared_packet_mode_supported = 0,
> > > +			.shaper_shared_byte_mode_supported = 0,
> > >
> > >  			.cman_head_drop_supported = 0,
> > >  			.cman_wred_packet_mode_supported =
> > WRED_SUPPORTED, @@ -736,7
> > > +773,11 @@ static const struct rte_tm_node_capabilities tm_node_cap[] =
> > {
> > >  		.shaper_private_dual_rate_supported = 0,
> > >  		.shaper_private_rate_min = 1,
> > >  		.shaper_private_rate_max = UINT32_MAX,
> > > +		.shaper_private_packet_mode_supported = 0,
> > > +		.shaper_private_byte_mode_supported = 1,
> > >  		.shaper_shared_n_max = 0,
> > > +		.shaper_shared_packet_mode_supported = 0,
> > > +		.shaper_shared_byte_mode_supported = 0,
> > >
> > >  		{.nonleaf = {
> > >  			.sched_n_children_max = UINT32_MAX, @@ -744,6
> > +785,8 @@ static
> > > const struct rte_tm_node_capabilities tm_node_cap[] = {
> > >  			.sched_wfq_n_children_per_group_max =
> > UINT32_MAX,
> > >  			.sched_wfq_n_groups_max = 1,
> > >  			.sched_wfq_weight_max = 1,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> > >  		} },
> 
> [Jasvinder] - byte mode to be set.
> 
> 
> > >  		.stats_mask = STATS_MASK_DEFAULT,
> > > @@ -754,7 +797,11 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  		.shaper_private_dual_rate_supported = 0,
> > >  		.shaper_private_rate_min = 1,
> > >  		.shaper_private_rate_max = UINT32_MAX,
> > > +		.shaper_private_packet_mode_supported = 0,
> > > +		.shaper_private_byte_mode_supported = 1,
> > >  		.shaper_shared_n_max = 0,
> > > +		.shaper_shared_packet_mode_supported = 0,
> > > +		.shaper_shared_byte_mode_supported = 0,
> > >
> > >  		{.nonleaf = {
> > >  			.sched_n_children_max = UINT32_MAX, @@ -762,6
> > +809,8 @@ static
> > > const struct rte_tm_node_capabilities tm_node_cap[] = {
> > >  			.sched_wfq_n_children_per_group_max =
> > UINT32_MAX,
> > >  			.sched_wfq_n_groups_max = 1,
> > >  			.sched_wfq_weight_max = UINT32_MAX,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> > >  		} },
> 
> [Jasvinder] - byte mode to be set here.
> 
> 
> 
> > >  		.stats_mask = STATS_MASK_DEFAULT,
> > > @@ -772,7 +821,11 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  		.shaper_private_dual_rate_supported = 0,
> > >  		.shaper_private_rate_min = 1,
> > >  		.shaper_private_rate_max = UINT32_MAX,
> > > +		.shaper_private_packet_mode_supported = 0,
> > > +		.shaper_private_byte_mode_supported = 1,
> > >  		.shaper_shared_n_max = 0,
> > > +		.shaper_shared_packet_mode_supported = 0,
> > > +		.shaper_shared_byte_mode_supported = 0,
> > >
> > >  		{.nonleaf = {
> > >  			.sched_n_children_max =
> > > @@ -782,6 +835,8 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  			.sched_wfq_n_children_per_group_max = 1,
> > >  			.sched_wfq_n_groups_max = 0,
> > >  			.sched_wfq_weight_max = 1,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 0,
> > >  		} },
> > >
> > >  		.stats_mask = STATS_MASK_DEFAULT,
> > > @@ -792,7 +847,11 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  		.shaper_private_dual_rate_supported = 0,
> > >  		.shaper_private_rate_min = 1,
> > >  		.shaper_private_rate_max = UINT32_MAX,
> > > +		.shaper_private_packet_mode_supported = 0,
> > > +		.shaper_private_byte_mode_supported = 1,
> > >  		.shaper_shared_n_max = 1,
> > > +		.shaper_shared_packet_mode_supported = 0,
> > > +		.shaper_shared_byte_mode_supported = 1,
> > >
> > >  		{.nonleaf = {
> > >  			.sched_n_children_max =
> > > @@ -802,6 +861,8 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  				RTE_SCHED_BE_QUEUES_PER_PIPE,
> > >  			.sched_wfq_n_groups_max = 1,
> > >  			.sched_wfq_weight_max = UINT32_MAX,
> > > +			.sched_wfq_packet_mode_supported = 0,
> > > +			.sched_wfq_byte_mode_supported = 1,
> > >  		} },
> > >
> > >  		.stats_mask = STATS_MASK_DEFAULT,
> > > @@ -812,7 +873,11 @@ static const struct rte_tm_node_capabilities
> > tm_node_cap[] = {
> > >  		.shaper_private_dual_rate_supported = 0,
> > >  		.shaper_private_rate_min = 0,
> > >  		.shaper_private_rate_max = 0,
> > > +		.shaper_private_packet_mode_supported = 0,
> > > +		.shaper_private_byte_mode_supported = 0,
> > >  		.shaper_shared_n_max = 0,
> > > +		.shaper_shared_packet_mode_supported = 0,
> > > +		.shaper_shared_byte_mode_supported = 0,
> > >
> > >
> > >  		{.leaf = {
> 
> 
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
                     ` (2 preceding siblings ...)
  2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
@ 2020-04-24 10:28   ` Dumitrescu, Cristian
  2020-04-25 20:09     ` Ferruh Yigit
  3 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-24 10:28 UTC (permalink / raw)
  To: Nithin Dabilpuram, Singh, Jasvinder, Thomas Monjalon, Yigit,
	Ferruh, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram



> -----Original Message-----
> From: Nithin Dabilpuram <nithind1988@gmail.com>
> Sent: Wednesday, April 22, 2020 6:21 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> mode
> 
> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> 
> Some NIC hardware support shaper to work in packet mode i.e
> shaping or ratelimiting traffic is in packets per second (PPS) as
> opposed to default bytes per second (BPS). Hence this patch
> adds support to configure shared or private shaper in packet mode,
> provide rate in PPS and add related tm capabilities in port/level/node
> capability structures.
> 
> This patch also updates tm port/level/node capability structures with
> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> and private/shared shaper byte mode.
> 
> SoftNIC PMD is also updated with new capabilities.
> 
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> ---
> v3..v4:
> - Update text under packet_mode as per Cristian.
> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> - Add error enum RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> - Fix shaper_profile_check() with packet mode check
> - Fix typo's
> 

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-24 10:28   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in " Dumitrescu, Cristian
@ 2020-04-25 20:09     ` Ferruh Yigit
  2020-04-27  9:19       ` Dumitrescu, Cristian
  0 siblings, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-25 20:09 UTC (permalink / raw)
  To: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram

On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> 
> 
>> -----Original Message-----
>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>> Sent: Wednesday, April 22, 2020 6:21 PM
>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>> Rybchenko <arybchenko@solarflare.com>
>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>> Dabilpuram <ndabilpuram@marvell.com>
>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>> mode
>>
>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>
>> Some NIC hardware support shaper to work in packet mode i.e
>> shaping or ratelimiting traffic is in packets per second (PPS) as
>> opposed to default bytes per second (BPS). Hence this patch
>> adds support to configure shared or private shaper in packet mode,
>> provide rate in PPS and add related tm capabilities in port/level/node
>> capability structures.
>>
>> This patch also updates tm port/level/node capability structures with
>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>> and private/shared shaper byte mode.
>>
>> SoftNIC PMD is also updated with new capabilities.
>>
>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>> ---
>> v3..v4:
>> - Update text under packet_mode as per Cristian.
>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>> - Add error enum RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>> - Fix shaper_profile_check() with packet mode check
>> - Fix typo's
>>
> 
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> 

Hi Nithin,

It looks like patch is causing ABI break, I am getting following warning [1],
can you please check?

[1]
https://pastebin.com/XYNFg14u

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-25 20:09     ` Ferruh Yigit
@ 2020-04-27  9:19       ` Dumitrescu, Cristian
  2020-04-27 16:12         ` Ferruh Yigit
  0 siblings, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-27  9:19 UTC (permalink / raw)
  To: Yigit, Ferruh, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram



> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Saturday, April 25, 2020 9:09 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> mode
> 
> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >
> >
> >> -----Original Message-----
> >> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >> Sent: Wednesday, April 22, 2020 6:21 PM
> >> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> >> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> >> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> >> Rybchenko <arybchenko@solarflare.com>
> >> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >> Dabilpuram <ndabilpuram@marvell.com>
> >> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >> mode
> >>
> >> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>
> >> Some NIC hardware support shaper to work in packet mode i.e
> >> shaping or ratelimiting traffic is in packets per second (PPS) as
> >> opposed to default bytes per second (BPS). Hence this patch
> >> adds support to configure shared or private shaper in packet mode,
> >> provide rate in PPS and add related tm capabilities in port/level/node
> >> capability structures.
> >>
> >> This patch also updates tm port/level/node capability structures with
> >> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> >> and private/shared shaper byte mode.
> >>
> >> SoftNIC PMD is also updated with new capabilities.
> >>
> >> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >> ---
> >> v3..v4:
> >> - Update text under packet_mode as per Cristian.
> >> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> >> - Add error enum
> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> >> - Fix shaper_profile_check() with packet mode check
> >> - Fix typo's
> >>
> >
> > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> >
> 
> Hi Nithin,
> 
> It looks like patch is causing ABI break, I am getting following warning [1],
> can you please check?
> 
> [1]
> https://pastebin.com/XYNFg14u


Hi Ferruh,

The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.

It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.

Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27  9:19       ` Dumitrescu, Cristian
@ 2020-04-27 16:12         ` Ferruh Yigit
  2020-04-27 16:28           ` Dumitrescu, Cristian
  2020-04-27 16:29           ` Jerin Jacob
  0 siblings, 2 replies; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-27 16:12 UTC (permalink / raw)
  To: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram, Kinsella, Ray,
	Neil Horman, Luca Boccassi, Kevin Traynor, David Marchand,
	Bruce Richardson

On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> 
> 
>> -----Original Message-----
>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Sent: Saturday, April 25, 2020 9:09 PM
>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>> <arybchenko@solarflare.com>
>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>> Dabilpuram <ndabilpuram@marvell.com>
>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>> mode
>>
>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>> Sent: Wednesday, April 22, 2020 6:21 PM
>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>>>> Rybchenko <arybchenko@solarflare.com>
>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>> mode
>>>>
>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>
>>>> Some NIC hardware support shaper to work in packet mode i.e
>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
>>>> opposed to default bytes per second (BPS). Hence this patch
>>>> adds support to configure shared or private shaper in packet mode,
>>>> provide rate in PPS and add related tm capabilities in port/level/node
>>>> capability structures.
>>>>
>>>> This patch also updates tm port/level/node capability structures with
>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>> and private/shared shaper byte mode.
>>>>
>>>> SoftNIC PMD is also updated with new capabilities.
>>>>
>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>> ---
>>>> v3..v4:
>>>> - Update text under packet_mode as per Cristian.
>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>>>> - Add error enum
>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>>>> - Fix shaper_profile_check() with packet mode check
>>>> - Fix typo's
>>>>
>>>
>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>>
>>
>> Hi Nithin,
>>
>> It looks like patch is causing ABI break, I am getting following warning [1],
>> can you please check?
>>
>> [1]
>> https://pastebin.com/XYNFg14u
> 
> 
> Hi Ferruh,
> 
> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> 
> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> 

:(

Is it time to mature them?

As you said they are not marked as experimental both in header file (function
declarations) and .map file.

The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
so marking them as experimental now will break the ABI. Not sure what to do,
cc'ed a few ABI related names for comment.

For me, we need to proceed as the experimental tag removed and APIs become
mature starting from v19.11, since this is what happened in practice, and remove
a few existing being experimental references in the doxygen comments.

Ray, Neil, David, Luca, Kevin, what do you think?

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:12         ` Ferruh Yigit
@ 2020-04-27 16:28           ` Dumitrescu, Cristian
  2020-04-28 15:30             ` Thomas Monjalon
  2020-04-27 16:29           ` Jerin Jacob
  1 sibling, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-27 16:28 UTC (permalink / raw)
  To: Yigit, Ferruh, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko
  Cc: dev, jerinj, kkanas, Nithin Dabilpuram, Kinsella, Ray,
	Neil Horman, Luca Boccassi, Kevin Traynor, David Marchand,
	Richardson, Bruce



> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Monday, April 27, 2020 5:13 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> <arybchenko@solarflare.com>
> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> Dabilpuram <ndabilpuram@marvell.com>; Kinsella, Ray
> <ray.kinsella@intel.com>; Neil Horman <nhorman@tuxdriver.com>; Luca
> Boccassi <bluca@debian.org>; Kevin Traynor <ktraynor@redhat.com>; David
> Marchand <david.marchand@redhat.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> mode
> 
> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >> Sent: Saturday, April 25, 2020 9:09 PM
> >> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin
> Dabilpuram
> >> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> >> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> >> <arybchenko@solarflare.com>
> >> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >> Dabilpuram <ndabilpuram@marvell.com>
> >> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in
> pkt
> >> mode
> >>
> >> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>> Sent: Wednesday, April 22, 2020 6:21 PM
> >>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> >>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> >>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> Andrew
> >>>> Rybchenko <arybchenko@solarflare.com>
> >>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>> mode
> >>>>
> >>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>
> >>>> Some NIC hardware support shaper to work in packet mode i.e
> >>>> shaping or ratelimiting traffic is in packets per second (PPS) as
> >>>> opposed to default bytes per second (BPS). Hence this patch
> >>>> adds support to configure shared or private shaper in packet mode,
> >>>> provide rate in PPS and add related tm capabilities in port/level/node
> >>>> capability structures.
> >>>>
> >>>> This patch also updates tm port/level/node capability structures with
> >>>> exiting features of scheduler wfq packet mode, scheduler wfq byte
> mode
> >>>> and private/shared shaper byte mode.
> >>>>
> >>>> SoftNIC PMD is also updated with new capabilities.
> >>>>
> >>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>> ---
> >>>> v3..v4:
> >>>> - Update text under packet_mode as per Cristian.
> >>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> >>>> - Add error enum
> >> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> >>>> - Fix shaper_profile_check() with packet mode check
> >>>> - Fix typo's
> >>>>
> >>>
> >>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> >>>
> >>
> >> Hi Nithin,
> >>
> >> It looks like patch is causing ABI break, I am getting following warning [1],
> >> can you please check?
> >>
> >> [1]
> >> https://pastebin.com/XYNFg14u
> >
> >
> > Hi Ferruh,
> >
> > The RTE_TM API is marked as experimental, but it looks that this was not
> correctly marked when __rte_experimental ABI checker was introduced.
> >
> > It is marked as experimental at the top of the rte_tm.h, similarly to other
> APIs introduced around same time, but it was not correctly picked up by the
> ABI check procedure when later introduced, so __rte_experimental was not
> added to every function.
> >
> 
> :(
> 
> Is it time to mature them?
> 
> As you said they are not marked as experimental both in header file
> (function
> declarations) and .map file.
> 
> The problem is, they are not marked as experimental in DPDK_20.0 ABI
> (v19.11),
> so marking them as experimental now will break the ABI. Not sure what to
> do,
> cc'ed a few ABI related names for comment.
> 
> For me, we need to proceed as the experimental tag removed and APIs
> become
> mature starting from v19.11, since this is what happened in practice, and
> remove
> a few existing being experimental references in the doxygen comments.
> 
> Ray, Neil, David, Luca, Kevin, what do you think?

Hi Ferruh,

IMO your proposed approach is fixing the wrong problem and is probably not the right way of doing things.

This API is correctly marked as experimental in the header file rte_tm.h and in the MAINTAINERS file, therefore it should remain experimental, as more changes are expected from the people like Nithin and others currently upstreaming drivers for it.

For some reason, the __rte_experimental tags were not added to this file when the ABI checker was introduced, and this is the real problem that should be fixed.

Regards,
Cristian

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:12         ` Ferruh Yigit
  2020-04-27 16:28           ` Dumitrescu, Cristian
@ 2020-04-27 16:29           ` Jerin Jacob
  2020-04-27 16:49             ` Ferruh Yigit
  1 sibling, 1 reply; 60+ messages in thread
From: Jerin Jacob @ 2020-04-27 16:29 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Luca Boccassi,
	Kevin Traynor, David Marchand, Bruce Richardson

On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >> Sent: Saturday, April 25, 2020 9:09 PM
> >> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> >> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> >> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> >> <arybchenko@solarflare.com>
> >> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >> Dabilpuram <ndabilpuram@marvell.com>
> >> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >> mode
> >>
> >> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>> Sent: Wednesday, April 22, 2020 6:21 PM
> >>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> >>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> >>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> >>>> Rybchenko <arybchenko@solarflare.com>
> >>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>> mode
> >>>>
> >>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>
> >>>> Some NIC hardware support shaper to work in packet mode i.e
> >>>> shaping or ratelimiting traffic is in packets per second (PPS) as
> >>>> opposed to default bytes per second (BPS). Hence this patch
> >>>> adds support to configure shared or private shaper in packet mode,
> >>>> provide rate in PPS and add related tm capabilities in port/level/node
> >>>> capability structures.
> >>>>
> >>>> This patch also updates tm port/level/node capability structures with
> >>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> >>>> and private/shared shaper byte mode.
> >>>>
> >>>> SoftNIC PMD is also updated with new capabilities.
> >>>>
> >>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>> ---
> >>>> v3..v4:
> >>>> - Update text under packet_mode as per Cristian.
> >>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> >>>> - Add error enum
> >> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> >>>> - Fix shaper_profile_check() with packet mode check
> >>>> - Fix typo's
> >>>>
> >>>
> >>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> >>>
> >>
> >> Hi Nithin,
> >>
> >> It looks like patch is causing ABI break, I am getting following warning [1],
> >> can you please check?
> >>
> >> [1]
> >> https://pastebin.com/XYNFg14u
> >
> >
> > Hi Ferruh,
> >
> > The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> >
> > It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> >
>
> :(
>
> Is it time to mature them?
>
> As you said they are not marked as experimental both in header file (function
> declarations) and .map file.
>
> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> so marking them as experimental now will break the ABI. Not sure what to do,
> cc'ed a few ABI related names for comment.
>
> For me, we need to proceed as the experimental tag removed and APIs become
> mature starting from v19.11, since this is what happened in practice, and remove
> a few existing being experimental references in the doxygen comments.

I think, accidentally we can not make a library as NON-experimental.
TM never went through experimental to mature transition(see git log
lib/librte_ethdev/rte_tm.h)
It was a bug to not mark as experimental in each function in the ABI process.
Some of the features like packet marking are not even implemented by any HW.
I think, we can make API stable only all the features are implemented
by one or two HW.

>
> Ray, Neil, David, Luca, Kevin, what do you think?

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:29           ` Jerin Jacob
@ 2020-04-27 16:49             ` Ferruh Yigit
  2020-04-27 16:59               ` Jerin Jacob
  0 siblings, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-27 16:49 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Luca Boccassi,
	Kevin Traynor, David Marchand, Bruce Richardson

On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>> Sent: Saturday, April 25, 2020 9:09 PM
>>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
>>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
>>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>>>> <arybchenko@solarflare.com>
>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>> mode
>>>>
>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
>>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>>>>>> Rybchenko <arybchenko@solarflare.com>
>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>> mode
>>>>>>
>>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>
>>>>>> Some NIC hardware support shaper to work in packet mode i.e
>>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
>>>>>> opposed to default bytes per second (BPS). Hence this patch
>>>>>> adds support to configure shared or private shaper in packet mode,
>>>>>> provide rate in PPS and add related tm capabilities in port/level/node
>>>>>> capability structures.
>>>>>>
>>>>>> This patch also updates tm port/level/node capability structures with
>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>>>> and private/shared shaper byte mode.
>>>>>>
>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>>>
>>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>> ---
>>>>>> v3..v4:
>>>>>> - Update text under packet_mode as per Cristian.
>>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>>>>>> - Add error enum
>>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>>>>>> - Fix shaper_profile_check() with packet mode check
>>>>>> - Fix typo's
>>>>>>
>>>>>
>>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>>>>
>>>>
>>>> Hi Nithin,
>>>>
>>>> It looks like patch is causing ABI break, I am getting following warning [1],
>>>> can you please check?
>>>>
>>>> [1]
>>>> https://pastebin.com/XYNFg14u
>>>
>>>
>>> Hi Ferruh,
>>>
>>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
>>>
>>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
>>>
>>
>> :(
>>
>> Is it time to mature them?
>>
>> As you said they are not marked as experimental both in header file (function
>> declarations) and .map file.
>>
>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
>> so marking them as experimental now will break the ABI. Not sure what to do,
>> cc'ed a few ABI related names for comment.
>>
>> For me, we need to proceed as the experimental tag removed and APIs become
>> mature starting from v19.11, since this is what happened in practice, and remove
>> a few existing being experimental references in the doxygen comments.
> 
> I think, accidentally we can not make a library as NON-experimental.
> TM never went through experimental to mature transition(see git log
> lib/librte_ethdev/rte_tm.h)
> It was a bug to not mark as experimental in each function in the ABI process.
> Some of the features like packet marking are not even implemented by any HW.
> I think, we can make API stable only all the features are implemented
> by one or two HW.

Fair enough, specially if the API is not ready yet.

But they were part of stable ABI, and marking them as experimental now will
break the old applications using these APIs.

> 
>>
>> Ray, Neil, David, Luca, Kevin, what do you think?


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:49             ` Ferruh Yigit
@ 2020-04-27 16:59               ` Jerin Jacob
  2020-04-28 11:51                 ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  2020-04-28 14:06                 ` [dpdk-dev] " Ferruh Yigit
  0 siblings, 2 replies; 60+ messages in thread
From: Jerin Jacob @ 2020-04-27 16:59 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Luca Boccassi,
	Kevin Traynor, David Marchand, Bruce Richardson

On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >>
> >> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >>>
> >>>
> >>>> -----Original Message-----
> >>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >>>> Sent: Saturday, April 25, 2020 9:09 PM
> >>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> >>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> >>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> >>>> <arybchenko@solarflare.com>
> >>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>> mode
> >>>>
> >>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
> >>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> >>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> >>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> >>>>>> Rybchenko <arybchenko@solarflare.com>
> >>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>>>> mode
> >>>>>>
> >>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>>>
> >>>>>> Some NIC hardware support shaper to work in packet mode i.e
> >>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
> >>>>>> opposed to default bytes per second (BPS). Hence this patch
> >>>>>> adds support to configure shared or private shaper in packet mode,
> >>>>>> provide rate in PPS and add related tm capabilities in port/level/node
> >>>>>> capability structures.
> >>>>>>
> >>>>>> This patch also updates tm port/level/node capability structures with
> >>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> >>>>>> and private/shared shaper byte mode.
> >>>>>>
> >>>>>> SoftNIC PMD is also updated with new capabilities.
> >>>>>>
> >>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>>> ---
> >>>>>> v3..v4:
> >>>>>> - Update text under packet_mode as per Cristian.
> >>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> >>>>>> - Add error enum
> >>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> >>>>>> - Fix shaper_profile_check() with packet mode check
> >>>>>> - Fix typo's
> >>>>>>
> >>>>>
> >>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> >>>>>
> >>>>
> >>>> Hi Nithin,
> >>>>
> >>>> It looks like patch is causing ABI break, I am getting following warning [1],
> >>>> can you please check?
> >>>>
> >>>> [1]
> >>>> https://pastebin.com/XYNFg14u
> >>>
> >>>
> >>> Hi Ferruh,
> >>>
> >>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> >>>
> >>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> >>>
> >>
> >> :(
> >>
> >> Is it time to mature them?
> >>
> >> As you said they are not marked as experimental both in header file (function
> >> declarations) and .map file.
> >>
> >> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> >> so marking them as experimental now will break the ABI. Not sure what to do,
> >> cc'ed a few ABI related names for comment.
> >>
> >> For me, we need to proceed as the experimental tag removed and APIs become
> >> mature starting from v19.11, since this is what happened in practice, and remove
> >> a few existing being experimental references in the doxygen comments.
> >
> > I think, accidentally we can not make a library as NON-experimental.
> > TM never went through experimental to mature transition(see git log
> > lib/librte_ethdev/rte_tm.h)
> > It was a bug to not mark as experimental in each function in the ABI process.
> > Some of the features like packet marking are not even implemented by any HW.
> > I think, we can make API stable only all the features are implemented
> > by one or two HW.
>
> Fair enough, specially if the API is not ready yet.
>
> But they were part of stable ABI, and marking them as experimental now will
> break the old applications using these APIs.

it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
Anyway, we need to break the ABI to make it work on various HW.
I am not sure what to do?
IMO, We need to send a patch as Fixes: for the bug of not adding
__rte_experimental in each function.

Traffic Management API - EXPERIMENTAL
M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
T: git://dpdk.org/next/dpdk-next-qos
F: lib/librte_ethdev/rte_tm*
>
> >
> >>
> >> Ray, Neil, David, Luca, Kevin, what do you think?
>

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:59               ` Jerin Jacob
@ 2020-04-28 11:51                 ` Nithin Dabilpuram
  2020-04-28 13:56                   ` Ferruh Yigit
  2020-04-28 14:06                 ` [dpdk-dev] " Ferruh Yigit
  1 sibling, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-04-28 11:51 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Ferruh Yigit, Dumitrescu, Cristian, Nithin Dabilpuram, Singh,
	Jasvinder, Thomas Monjalon, Andrew Rybchenko, dev, jerinj,
	kkanas, Kinsella, Ray, Neil Horman, Luca Boccassi, Kevin Traynor,
	David Marchand, Bruce Richardson

On Mon, Apr 27, 2020 at 10:29:48PM +0530, Jerin Jacob wrote:
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >
> > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > >>
> > >> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > >>>
> > >>>
> > >>>> -----Original Message-----
> > >>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > >>>> Sent: Saturday, April 25, 2020 9:09 PM
> > >>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> > >>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> > >>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> > >>>> <arybchenko@solarflare.com>
> > >>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > >>>> Dabilpuram <ndabilpuram@marvell.com>
> > >>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> > >>>> mode
> > >>>>
> > >>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > >>>>>
> > >>>>>
> > >>>>>> -----Original Message-----
> > >>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> > >>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
> > >>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> > >>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > >>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > >>>>>> Rybchenko <arybchenko@solarflare.com>
> > >>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > >>>>>> Dabilpuram <ndabilpuram@marvell.com>
> > >>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> > >>>>>> mode
> > >>>>>>
> > >>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > >>>>>>
> > >>>>>> Some NIC hardware support shaper to work in packet mode i.e
> > >>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
> > >>>>>> opposed to default bytes per second (BPS). Hence this patch
> > >>>>>> adds support to configure shared or private shaper in packet mode,
> > >>>>>> provide rate in PPS and add related tm capabilities in port/level/node
> > >>>>>> capability structures.
> > >>>>>>
> > >>>>>> This patch also updates tm port/level/node capability structures with
> > >>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > >>>>>> and private/shared shaper byte mode.
> > >>>>>>
> > >>>>>> SoftNIC PMD is also updated with new capabilities.
> > >>>>>>
> > >>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > >>>>>> ---
> > >>>>>> v3..v4:
> > >>>>>> - Update text under packet_mode as per Cristian.
> > >>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> > >>>>>> - Add error enum
> > >>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> > >>>>>> - Fix shaper_profile_check() with packet mode check
> > >>>>>> - Fix typo's
> > >>>>>>
> > >>>>>
> > >>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > >>>>>
> > >>>>
> > >>>> Hi Nithin,
> > >>>>
> > >>>> It looks like patch is causing ABI break, I am getting following warning [1],
> > >>>> can you please check?
> > >>>>
> > >>>> [1]
> > >>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=xJB0Qb2Q-1bl0hEDeknUjJqrCDc3z-h0F0e7kj8KvvI&s=R6xtRQRRIIzAilc5z52oYjyHNlvvJB_9SUsKBkpPC6g&e= 
> > >>>
> > >>>
> > >>> Hi Ferruh,
> > >>>
> > >>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> > >>>
> > >>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> > >>>
> > >>
> > >> :(
> > >>
> > >> Is it time to mature them?
> > >>
> > >> As you said they are not marked as experimental both in header file (function
> > >> declarations) and .map file.
> > >>
> > >> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> > >> so marking them as experimental now will break the ABI. Not sure what to do,
> > >> cc'ed a few ABI related names for comment.
> > >>
> > >> For me, we need to proceed as the experimental tag removed and APIs become
> > >> mature starting from v19.11, since this is what happened in practice, and remove
> > >> a few existing being experimental references in the doxygen comments.
> > >
> > > I think, accidentally we can not make a library as NON-experimental.
> > > TM never went through experimental to mature transition(see git log
> > > lib/librte_ethdev/rte_tm.h)
> > > It was a bug to not mark as experimental in each function in the ABI process.
> > > Some of the features like packet marking are not even implemented by any HW.
> > > I think, we can make API stable only all the features are implemented
> > > by one or two HW.
> >
> > Fair enough, specially if the API is not ready yet.
> >
> > But they were part of stable ABI, and marking them as experimental now will
> > break the old applications using these APIs.
> 
> it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
> Anyway, we need to break the ABI to make it work on various HW.
> I am not sure what to do?
> IMO, We need to send a patch as Fixes: for the bug of not adding
> __rte_experimental in each function.
> 
> Traffic Management API - EXPERIMENTAL
> M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> T: git://dpdk.org/next/dpdk-next-qos
> F: lib/librte_ethdev/rte_tm*

Ray, Neil, David, Luca, Kevin, Ferruh

Any thoughts on this proposal ?

If it is fine, I can send a "Fixes:" patch to update experimental attribute in rte_tm.h
for all functions so that 20.05 is having the right marking.

> >
> > >
> > >>
> > >> Ray, Neil, David, Luca, Kevin, what do you think?
> >

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 11:51                 ` [dpdk-dev] [EXT] " Nithin Dabilpuram
@ 2020-04-28 13:56                   ` Ferruh Yigit
  0 siblings, 0 replies; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-28 13:56 UTC (permalink / raw)
  To: Nithin Dabilpuram, Jerin Jacob
  Cc: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko, dev, jerinj, kkanas, Kinsella,
	Ray, Neil Horman, Luca Boccassi, Kevin Traynor, David Marchand,
	Bruce Richardson

On 4/28/2020 12:51 PM, Nithin Dabilpuram wrote:
> On Mon, Apr 27, 2020 at 10:29:48PM +0530, Jerin Jacob wrote:
>> External Email
>>
>> ----------------------------------------------------------------------
>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>
>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>>
>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>> Sent: Saturday, April 25, 2020 9:09 PM
>>>>>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
>>>>>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
>>>>>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>>>>>>> <arybchenko@solarflare.com>
>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>>> mode
>>>>>>>
>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
>>>>>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>>>>>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>>>>>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>>>>>>>>> Rybchenko <arybchenko@solarflare.com>
>>>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>>>>> mode
>>>>>>>>>
>>>>>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>>
>>>>>>>>> Some NIC hardware support shaper to work in packet mode i.e
>>>>>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
>>>>>>>>> opposed to default bytes per second (BPS). Hence this patch
>>>>>>>>> adds support to configure shared or private shaper in packet mode,
>>>>>>>>> provide rate in PPS and add related tm capabilities in port/level/node
>>>>>>>>> capability structures.
>>>>>>>>>
>>>>>>>>> This patch also updates tm port/level/node capability structures with
>>>>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>
>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>> ---
>>>>>>>>> v3..v4:
>>>>>>>>> - Update text under packet_mode as per Cristian.
>>>>>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>>>>>>>>> - Add error enum
>>>>>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>>>>>>>>> - Fix shaper_profile_check() with packet mode check
>>>>>>>>> - Fix typo's
>>>>>>>>>
>>>>>>>>
>>>>>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>>>>>>>
>>>>>>>
>>>>>>> Hi Nithin,
>>>>>>>
>>>>>>> It looks like patch is causing ABI break, I am getting following warning [1],
>>>>>>> can you please check?
>>>>>>>
>>>>>>> [1]
>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=xJB0Qb2Q-1bl0hEDeknUjJqrCDc3z-h0F0e7kj8KvvI&s=R6xtRQRRIIzAilc5z52oYjyHNlvvJB_9SUsKBkpPC6g&e= 
>>>>>>
>>>>>>
>>>>>> Hi Ferruh,
>>>>>>
>>>>>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
>>>>>>
>>>>>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
>>>>>>
>>>>>
>>>>> :(
>>>>>
>>>>> Is it time to mature them?
>>>>>
>>>>> As you said they are not marked as experimental both in header file (function
>>>>> declarations) and .map file.
>>>>>
>>>>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
>>>>> so marking them as experimental now will break the ABI. Not sure what to do,
>>>>> cc'ed a few ABI related names for comment.
>>>>>
>>>>> For me, we need to proceed as the experimental tag removed and APIs become
>>>>> mature starting from v19.11, since this is what happened in practice, and remove
>>>>> a few existing being experimental references in the doxygen comments.
>>>>
>>>> I think, accidentally we can not make a library as NON-experimental.
>>>> TM never went through experimental to mature transition(see git log
>>>> lib/librte_ethdev/rte_tm.h)
>>>> It was a bug to not mark as experimental in each function in the ABI process.
>>>> Some of the features like packet marking are not even implemented by any HW.
>>>> I think, we can make API stable only all the features are implemented
>>>> by one or two HW.
>>>
>>> Fair enough, specially if the API is not ready yet.
>>>
>>> But they were part of stable ABI, and marking them as experimental now will
>>> break the old applications using these APIs.
>>
>> it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
>> Anyway, we need to break the ABI to make it work on various HW.
>> I am not sure what to do?
>> IMO, We need to send a patch as Fixes: for the bug of not adding
>> __rte_experimental in each function.
>>
>> Traffic Management API - EXPERIMENTAL
>> M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>> T: git://dpdk.org/next/dpdk-next-qos
>> F: lib/librte_ethdev/rte_tm*
> 
> Ray, Neil, David, Luca, Kevin, Ferruh
> 
> Any thoughts on this proposal ?
> 
> If it is fine, I can send a "Fixes:" patch to update experimental attribute in rte_tm.h
> for all functions so that 20.05 is having the right marking.

Hi Nithin,

Please send the fix patch, we may continue to discuss in that patch but it would
be good to have it ready.

> 
>>>
>>>>
>>>>>
>>>>> Ray, Neil, David, Luca, Kevin, what do you think?
>>>


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:59               ` Jerin Jacob
  2020-04-28 11:51                 ` [dpdk-dev] [EXT] " Nithin Dabilpuram
@ 2020-04-28 14:06                 ` Ferruh Yigit
  2020-04-28 14:45                   ` Bruce Richardson
  1 sibling, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-04-28 14:06 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: Dumitrescu, Cristian, Nithin Dabilpuram, Singh, Jasvinder,
	Thomas Monjalon, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Luca Boccassi,
	Kevin Traynor, David Marchand, Bruce Richardson

On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>
>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>> Sent: Saturday, April 25, 2020 9:09 PM
>>>>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
>>>>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
>>>>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>>>>>> <arybchenko@solarflare.com>
>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>> mode
>>>>>>
>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
>>>>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>>>>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>>>>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>>>>>>>> Rybchenko <arybchenko@solarflare.com>
>>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>>>> mode
>>>>>>>>
>>>>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>
>>>>>>>> Some NIC hardware support shaper to work in packet mode i.e
>>>>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
>>>>>>>> opposed to default bytes per second (BPS). Hence this patch
>>>>>>>> adds support to configure shared or private shaper in packet mode,
>>>>>>>> provide rate in PPS and add related tm capabilities in port/level/node
>>>>>>>> capability structures.
>>>>>>>>
>>>>>>>> This patch also updates tm port/level/node capability structures with
>>>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>
>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>>>>>
>>>>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>> ---
>>>>>>>> v3..v4:
>>>>>>>> - Update text under packet_mode as per Cristian.
>>>>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>>>>>>>> - Add error enum
>>>>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>>>>>>>> - Fix shaper_profile_check() with packet mode check
>>>>>>>> - Fix typo's
>>>>>>>>
>>>>>>>
>>>>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>>>>>>
>>>>>>
>>>>>> Hi Nithin,
>>>>>>
>>>>>> It looks like patch is causing ABI break, I am getting following warning [1],
>>>>>> can you please check?
>>>>>>
>>>>>> [1]
>>>>>> https://pastebin.com/XYNFg14u
>>>>>
>>>>>
>>>>> Hi Ferruh,
>>>>>
>>>>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
>>>>>
>>>>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
>>>>>
>>>>
>>>> :(
>>>>
>>>> Is it time to mature them?
>>>>
>>>> As you said they are not marked as experimental both in header file (function
>>>> declarations) and .map file.
>>>>
>>>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
>>>> so marking them as experimental now will break the ABI. Not sure what to do,
>>>> cc'ed a few ABI related names for comment.
>>>>
>>>> For me, we need to proceed as the experimental tag removed and APIs become
>>>> mature starting from v19.11, since this is what happened in practice, and remove
>>>> a few existing being experimental references in the doxygen comments.
>>>
>>> I think, accidentally we can not make a library as NON-experimental.
>>> TM never went through experimental to mature transition(see git log
>>> lib/librte_ethdev/rte_tm.h)
>>> It was a bug to not mark as experimental in each function in the ABI process.
>>> Some of the features like packet marking are not even implemented by any HW.
>>> I think, we can make API stable only all the features are implemented
>>> by one or two HW.
>>
>> Fair enough, specially if the API is not ready yet.
>>
>> But they were part of stable ABI, and marking them as experimental now will
>> break the old applications using these APIs.
> 
> it is still marked as EXPERIMENTAL everywhere and API is not ready yet.

Existing experimental marks are text only for human parsing.

The compiler attribute and build time checks are missing, and the symbol in the
binary doesn't have experimental tag. Our scripts and automated checks won't
detect it as experimental.

My point is just having experimental comment in header file is not enough to
qualify the APIs as experimental.

> Anyway, we need to break the ABI to make it work on various HW.
> I am not sure what to do?
> IMO, We need to send a patch as Fixes: for the bug of not adding
> __rte_experimental in each function.

Yes, this is where we are, both you and Cristian suggest API is not ready and
should be experimental, but they were part of stable ABI, making them
experimental will break the ABI.
It looks like there is no good option but we should select one of the bad ones.

> 
> Traffic Management API - EXPERIMENTAL
> M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> T: git://dpdk.org/next/dpdk-next-qos
> F: lib/librte_ethdev/rte_tm*
>>
>>>
>>>>
>>>> Ray, Neil, David, Luca, Kevin, what do you think?
>>


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 14:06                 ` [dpdk-dev] " Ferruh Yigit
@ 2020-04-28 14:45                   ` Bruce Richardson
  2020-04-28 15:04                     ` Luca Boccassi
  2020-04-28 15:42                     ` Ray Kinsella
  0 siblings, 2 replies; 60+ messages in thread
From: Bruce Richardson @ 2020-04-28 14:45 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Jerin Jacob, Dumitrescu, Cristian, Nithin Dabilpuram, Singh,
	Jasvinder, Thomas Monjalon, Andrew Rybchenko, dev, jerinj,
	kkanas, Nithin Dabilpuram, Kinsella, Ray, Neil Horman,
	Luca Boccassi, Kevin Traynor, David Marchand

On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >>
> >> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> >>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >>>>
> >>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >>>>>
> >>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >>>>>> Sent: Saturday, April 25, 2020 9:09 PM
> >>>>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> >>>>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> >>>>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> >>>>>> <arybchenko@solarflare.com>
> >>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>>>> mode
> >>>>>>
> >>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>> -----Original Message-----
> >>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
> >>>>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> >>>>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
> >>>>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> >>>>>>>> Rybchenko <arybchenko@solarflare.com>
> >>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> >>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
> >>>>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> >>>>>>>> mode
> >>>>>>>>
> >>>>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>>>>>
> >>>>>>>> Some NIC hardware support shaper to work in packet mode i.e
> >>>>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
> >>>>>>>> opposed to default bytes per second (BPS). Hence this patch
> >>>>>>>> adds support to configure shared or private shaper in packet mode,
> >>>>>>>> provide rate in PPS and add related tm capabilities in port/level/node
> >>>>>>>> capability structures.
> >>>>>>>>
> >>>>>>>> This patch also updates tm port/level/node capability structures with
> >>>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> >>>>>>>> and private/shared shaper byte mode.
> >>>>>>>>
> >>>>>>>> SoftNIC PMD is also updated with new capabilities.
> >>>>>>>>
> >>>>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> >>>>>>>> ---
> >>>>>>>> v3..v4:
> >>>>>>>> - Update text under packet_mode as per Cristian.
> >>>>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> >>>>>>>> - Add error enum
> >>>>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> >>>>>>>> - Fix shaper_profile_check() with packet mode check
> >>>>>>>> - Fix typo's
> >>>>>>>>
> >>>>>>>
> >>>>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> >>>>>>>
> >>>>>>
> >>>>>> Hi Nithin,
> >>>>>>
> >>>>>> It looks like patch is causing ABI break, I am getting following warning [1],
> >>>>>> can you please check?
> >>>>>>
> >>>>>> [1]
> >>>>>> https://pastebin.com/XYNFg14u
> >>>>>
> >>>>>
> >>>>> Hi Ferruh,
> >>>>>
> >>>>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> >>>>>
> >>>>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> >>>>>
> >>>>
> >>>> :(
> >>>>
> >>>> Is it time to mature them?
> >>>>
> >>>> As you said they are not marked as experimental both in header file (function
> >>>> declarations) and .map file.
> >>>>
> >>>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> >>>> so marking them as experimental now will break the ABI. Not sure what to do,
> >>>> cc'ed a few ABI related names for comment.
> >>>>
> >>>> For me, we need to proceed as the experimental tag removed and APIs become
> >>>> mature starting from v19.11, since this is what happened in practice, and remove
> >>>> a few existing being experimental references in the doxygen comments.
> >>>
> >>> I think, accidentally we can not make a library as NON-experimental.
> >>> TM never went through experimental to mature transition(see git log
> >>> lib/librte_ethdev/rte_tm.h)
> >>> It was a bug to not mark as experimental in each function in the ABI process.
> >>> Some of the features like packet marking are not even implemented by any HW.
> >>> I think, we can make API stable only all the features are implemented
> >>> by one or two HW.
> >>
> >> Fair enough, specially if the API is not ready yet.
> >>
> >> But they were part of stable ABI, and marking them as experimental now will
> >> break the old applications using these APIs.
> > 
> > it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
> 
> Existing experimental marks are text only for human parsing.
> 
> The compiler attribute and build time checks are missing, and the symbol in the
> binary doesn't have experimental tag. Our scripts and automated checks won't
> detect it as experimental.
> 
> My point is just having experimental comment in header file is not enough to
> qualify the APIs as experimental.
> 
> > Anyway, we need to break the ABI to make it work on various HW.
> > I am not sure what to do?
> > IMO, We need to send a patch as Fixes: for the bug of not adding
> > __rte_experimental in each function.
> 
> Yes, this is where we are, both you and Cristian suggest API is not ready and
> should be experimental, but they were part of stable ABI, making them
> experimental will break the ABI.
> It looks like there is no good option but we should select one of the bad ones.
> 
> > 
> > Traffic Management API - EXPERIMENTAL
> > M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > T: git://dpdk.org/next/dpdk-next-qos
> > F: lib/librte_ethdev/rte_tm*
> >>
> >>>
> >>>>
> >>>> Ray, Neil, David, Luca, Kevin, what do you think?
> >>
While I'm not called any of those names, allow me to give my 2c.

Since these are marked in binaries as part of the stable ABI, I think we
need to honour that for the next two releases 20.05 and 20.08 [which means
that we need to put in versioned functions for any changes, not that we
can't change anything]

For 20.11, I think these should then have one of two options taken:
* have these "fixed" and ready to be marked as stable, and officially part
  of v21 ABI or
* mark them as experimental properly, and look to have them as part of the
  v22 or subsequent ABI

Given the comments here, I would tend towards the latter of the above two
options, but that's really a decision for the maintainers.

Remember, this is not the first bug we have encountered where we messed up
some ABI versions in the 19.11 release, and, like the previous one with the
screwed up version number, I think we need to honour the ABI committments
made, especially since in this case it's only for a few more months till
20.11 development starts.

/Bruce

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 14:45                   ` Bruce Richardson
@ 2020-04-28 15:04                     ` Luca Boccassi
  2020-04-28 15:54                       ` Thomas Monjalon
  2020-04-28 15:42                     ` Ray Kinsella
  1 sibling, 1 reply; 60+ messages in thread
From: Luca Boccassi @ 2020-04-28 15:04 UTC (permalink / raw)
  To: Bruce Richardson, Ferruh Yigit
  Cc: Jerin Jacob, Dumitrescu, Cristian, Nithin Dabilpuram, Singh,
	Jasvinder, Thomas Monjalon, Andrew Rybchenko, dev, jerinj,
	kkanas, Nithin Dabilpuram, Kinsella, Ray, Neil Horman,
	Kevin Traynor, David Marchand

On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> > On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > > > > > > Sent: Saturday, April 25, 2020 9:09 PM
> > > > > > > > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
> > > > > > > > <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> > > > > > > > Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
> > > > > > > > <arybchenko@solarflare.com>
> > > > > > > > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > > > > > > > Dabilpuram <ndabilpuram@marvell.com>
> > > > > > > > Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> > > > > > > > mode
> > > > > > > > 
> > > > > > > > On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > 
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > > > > > > > > Sent: Wednesday, April 22, 2020 6:21 PM
> > > > > > > > > > To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> > > > > > > > > > <cristian.dumitrescu@intel.com>; Thomas Monjalon
> > > > > > > > > > <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
> > > > > > > > > > Rybchenko <arybchenko@solarflare.com>
> > > > > > > > > > Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
> > > > > > > > > > Dabilpuram <ndabilpuram@marvell.com>
> > > > > > > > > > Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> > > > > > > > > > mode
> > > > > > > > > > 
> > > > > > > > > > From: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > > > > > > > > 
> > > > > > > > > > Some NIC hardware support shaper to work in packet mode i.e
> > > > > > > > > > shaping or ratelimiting traffic is in packets per second (PPS) as
> > > > > > > > > > opposed to default bytes per second (BPS). Hence this patch
> > > > > > > > > > adds support to configure shared or private shaper in packet mode,
> > > > > > > > > > provide rate in PPS and add related tm capabilities in port/level/node
> > > > > > > > > > capability structures.
> > > > > > > > > > 
> > > > > > > > > > This patch also updates tm port/level/node capability structures with
> > > > > > > > > > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > > > > > > > > > and private/shared shaper byte mode.
> > > > > > > > > > 
> > > > > > > > > > SoftNIC PMD is also updated with new capabilities.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
> > > > > > > > > > ---
> > > > > > > > > > v3..v4:
> > > > > > > > > > - Update text under packet_mode as per Cristian.
> > > > > > > > > > - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
> > > > > > > > > > - Add error enum
> > > > > > > > RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
> > > > > > > > > > - Fix shaper_profile_check() with packet mode check
> > > > > > > > > > - Fix typo's
> > > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > > > > > > > > 
> > > > > > > > 
> > > > > > > > Hi Nithin,
> > > > > > > > 
> > > > > > > > It looks like patch is causing ABI break, I am getting following warning [1],
> > > > > > > > can you please check?
> > > > > > > > 
> > > > > > > > [1]
> > > > > > > > https://pastebin.com/XYNFg14u
> > > > > > > 
> > > > > > > Hi Ferruh,
> > > > > > > 
> > > > > > > The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
> > > > > > > 
> > > > > > > It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
> > > > > > > 
> > > > > > 
> > > > > > :(
> > > > > > 
> > > > > > Is it time to mature them?
> > > > > > 
> > > > > > As you said they are not marked as experimental both in header file (function
> > > > > > declarations) and .map file.
> > > > > > 
> > > > > > The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> > > > > > so marking them as experimental now will break the ABI. Not sure what to do,
> > > > > > cc'ed a few ABI related names for comment.
> > > > > > 
> > > > > > For me, we need to proceed as the experimental tag removed and APIs become
> > > > > > mature starting from v19.11, since this is what happened in practice, and remove
> > > > > > a few existing being experimental references in the doxygen comments.
> > > > > 
> > > > > I think, accidentally we can not make a library as NON-experimental.
> > > > > TM never went through experimental to mature transition(see git log
> > > > > lib/librte_ethdev/rte_tm.h)
> > > > > It was a bug to not mark as experimental in each function in the ABI process.
> > > > > Some of the features like packet marking are not even implemented by any HW.
> > > > > I think, we can make API stable only all the features are implemented
> > > > > by one or two HW.
> > > > 
> > > > Fair enough, specially if the API is not ready yet.
> > > > 
> > > > But they were part of stable ABI, and marking them as experimental now will
> > > > break the old applications using these APIs.
> > > 
> > > it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
> > 
> > Existing experimental marks are text only for human parsing.
> > 
> > The compiler attribute and build time checks are missing, and the symbol in the
> > binary doesn't have experimental tag. Our scripts and automated checks won't
> > detect it as experimental.
> > 
> > My point is just having experimental comment in header file is not enough to
> > qualify the APIs as experimental.
> > 
> > > Anyway, we need to break the ABI to make it work on various HW.
> > > I am not sure what to do?
> > > IMO, We need to send a patch as Fixes: for the bug of not adding
> > > __rte_experimental in each function.
> > 
> > Yes, this is where we are, both you and Cristian suggest API is not ready and
> > should be experimental, but they were part of stable ABI, making them
> > experimental will break the ABI.
> > It looks like there is no good option but we should select one of the bad ones.
> > 
> > > Traffic Management API - EXPERIMENTAL
> > > M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > > T: git://dpdk.org/next/dpdk-next-qos
> > > F: lib/librte_ethdev/rte_tm*
> > > > > > Ray, Neil, David, Luca, Kevin, what do you think?
> While I'm not called any of those names, allow me to give my 2c.
> 
> Since these are marked in binaries as part of the stable ABI, I think we
> need to honour that for the next two releases 20.05 and 20.08 [which means
> that we need to put in versioned functions for any changes, not that we
> can't change anything]
> 
> For 20.11, I think these should then have one of two options taken:
> * have these "fixed" and ready to be marked as stable, and officially part
>   of v21 ABI or
> * mark them as experimental properly, and look to have them as part of the
>   v22 or subsequent ABI
> 
> Given the comments here, I would tend towards the latter of the above two
> options, but that's really a decision for the maintainers.
> 
> Remember, this is not the first bug we have encountered where we messed up
> some ABI versions in the 19.11 release, and, like the previous one with the
> screwed up version number, I think we need to honour the ABI committments
> made, especially since in this case it's only for a few more months till
> 20.11 development starts.
> 
> /Bruce

+1

If they are not ready now, they haven't been ready for the past 6
months either, so staying not ready for 6 more is the lesser evil.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-27 16:28           ` Dumitrescu, Cristian
@ 2020-04-28 15:30             ` Thomas Monjalon
  2020-04-28 17:35               ` Dumitrescu, Cristian
  0 siblings, 1 reply; 60+ messages in thread
From: Thomas Monjalon @ 2020-04-28 15:30 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Yigit, Ferruh, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, jerinj, kkanas, Nithin Dabilpuram,
	Kinsella, Ray, Neil Horman, Luca Boccassi, Kevin Traynor,
	David Marchand, Richardson, Bruce

27/04/2020 18:28, Dumitrescu, Cristian:
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > >> Hi Nithin,
> > >>
> > >> It looks like patch is causing ABI break, I am getting following warning [1],
> > >> can you please check?
> > >>
> > >> [1]
> > >> https://pastebin.com/XYNFg14u
> > >
> > >
> > > Hi Ferruh,
> > >
> > > The RTE_TM API is marked as experimental, but it looks that this was not
> > correctly marked when __rte_experimental ABI checker was introduced.
> > >
> > > It is marked as experimental at the top of the rte_tm.h, similarly to other
> > APIs introduced around same time, but it was not correctly picked up by the
> > ABI check procedure when later introduced, so __rte_experimental was not
> > added to every function.
> > >
> > 
> > :(
> > 
> > Is it time to mature them?
> > 
> > As you said they are not marked as experimental both in header file
> > (function
> > declarations) and .map file.
> > 
> > The problem is, they are not marked as experimental in DPDK_20.0 ABI
> > (v19.11),
> > so marking them as experimental now will break the ABI. Not sure what to
> > do,
> > cc'ed a few ABI related names for comment.
> > 
> > For me, we need to proceed as the experimental tag removed and APIs
> > become
> > mature starting from v19.11, since this is what happened in practice, and
> > remove
> > a few existing being experimental references in the doxygen comments.
> > 
> > Ray, Neil, David, Luca, Kevin, what do you think?
> 
> Hi Ferruh,
> 
> IMO your proposed approach is fixing the wrong problem and is
> probably not the right way of doing things.
> 
> This API is correctly marked as experimental in the header
> file rte_tm.h and in the MAINTAINERS file,

in rte_tm.h:
	* @warning
	* @b EXPERIMENTAL: this API may change without prior notice

in MAINTAINERS:
	Traffic Management API - EXPERIMENTAL
	M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
	T: git://dpdk.org/next/dpdk-next-qos
	F: lib/librte_ethdev/rte_tm*


> therefore it should remain experimental,

in rte_ethdev_version.map:
	before 19.11: DPDK_17.08 {
	since 19.11: DPDK_20.0 {

When adding rte_tm in 17.08:
http://git.dpdk.org/dpdk/diff/lib/librte_ether/rte_ether_version.map?id=5d109deffa

In 17.08, early July 2017, the first EXPERIMENTAL section was declared in EAL:
http://git.dpdk.org/dpdk/diff/lib/librte_eal/linuxapp/eal/rte_eal_version.map?id=a3ee360f444

When adding rte_mtr in 17.11, all functions are made experimental:
http://git.dpdk.org/dpdk/diff/lib/librte_ether/rte_ethdev_version.map?id=6613ffe1

In 18.02, the tag __rte_experimental was introduced:
	http://git.dpdk.org/dpdk/commit/?id=7d540a3e735
and functions are marked (including rte_mtr but not rte_tm):
	http://git.dpdk.org/dpdk/commit/?id=77b7b81e32e


> as more changes are expected from the people like Nithin and others
> currently upstreaming drivers for it.

They are doing changes in the API introduced 3 years ago.


> For some reason, the __rte_experimental tags were not added to
> this file when the ABI checker was introduced,
> and this is the real problem that should be fixed.

The mistake was done 2 years ago.
As maintainer of rte_tm code, you are expected to notice the issue.
As maintainer of rte_mtr code, you were expected to review the change
on the mtr functions being marked as experimental.
I am sorry that it took 2 years to discover the gap.

We can fix the ABI in the ABI-breakage window: in 20.11.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 14:45                   ` Bruce Richardson
  2020-04-28 15:04                     ` Luca Boccassi
@ 2020-04-28 15:42                     ` Ray Kinsella
  1 sibling, 0 replies; 60+ messages in thread
From: Ray Kinsella @ 2020-04-28 15:42 UTC (permalink / raw)
  To: Bruce Richardson, Ferruh Yigit
  Cc: Jerin Jacob, Dumitrescu, Cristian, Nithin Dabilpuram, Singh,
	Jasvinder, Thomas Monjalon, Andrew Rybchenko, dev, jerinj,
	kkanas, Nithin Dabilpuram, Kinsella, Ray, Neil Horman,
	Luca Boccassi, Kevin Traynor, David Marchand



On 28/04/2020 15:45, Bruce Richardson wrote:
> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>
>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>>>
>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>>> Sent: Saturday, April 25, 2020 9:09 PM
>>>>>>>> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Nithin Dabilpuram
>>>>>>>> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
>>>>>>>> Thomas Monjalon <thomas@monjalon.net>; Andrew Rybchenko
>>>>>>>> <arybchenko@solarflare.com>
>>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>>>> mode
>>>>>>>>
>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>>> Sent: Wednesday, April 22, 2020 6:21 PM
>>>>>>>>>> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
>>>>>>>>>> <cristian.dumitrescu@intel.com>; Thomas Monjalon
>>>>>>>>>> <thomas@monjalon.net>; Yigit, Ferruh <ferruh.yigit@intel.com>; Andrew
>>>>>>>>>> Rybchenko <arybchenko@solarflare.com>
>>>>>>>>>> Cc: dev@dpdk.org; jerinj@marvell.com; kkanas@marvell.com; Nithin
>>>>>>>>>> Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>>> Subject: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
>>>>>>>>>> mode
>>>>>>>>>>
>>>>>>>>>> From: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>>>
>>>>>>>>>> Some NIC hardware support shaper to work in packet mode i.e
>>>>>>>>>> shaping or ratelimiting traffic is in packets per second (PPS) as
>>>>>>>>>> opposed to default bytes per second (BPS). Hence this patch
>>>>>>>>>> adds support to configure shared or private shaper in packet mode,
>>>>>>>>>> provide rate in PPS and add related tm capabilities in port/level/node
>>>>>>>>>> capability structures.
>>>>>>>>>>
>>>>>>>>>> This patch also updates tm port/level/node capability structures with
>>>>>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>>
>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
>>>>>>>>>> ---
>>>>>>>>>> v3..v4:
>>>>>>>>>> - Update text under packet_mode as per Cristian.
>>>>>>>>>> - Update rte_eth_softnic_tm.c based on Jasvinder's comments.
>>>>>>>>>> - Add error enum
>>>>>>>> RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE
>>>>>>>>>> - Fix shaper_profile_check() with packet mode check
>>>>>>>>>> - Fix typo's
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>>>>>>>>
>>>>>>>>
>>>>>>>> Hi Nithin,
>>>>>>>>
>>>>>>>> It looks like patch is causing ABI break, I am getting following warning [1],
>>>>>>>> can you please check?
>>>>>>>>
>>>>>>>> [1]
>>>>>>>> https://pastebin.com/XYNFg14u
>>>>>>>
>>>>>>>
>>>>>>> Hi Ferruh,
>>>>>>>
>>>>>>> The RTE_TM API is marked as experimental, but it looks that this was not correctly marked when __rte_experimental ABI checker was introduced.
>>>>>>>
>>>>>>> It is marked as experimental at the top of the rte_tm.h, similarly to other APIs introduced around same time, but it was not correctly picked up by the ABI check procedure when later introduced, so __rte_experimental was not added to every function.
>>>>>>>
>>>>>>
>>>>>> :(
>>>>>>
>>>>>> Is it time to mature them?
>>>>>>
>>>>>> As you said they are not marked as experimental both in header file (function
>>>>>> declarations) and .map file.
>>>>>>
>>>>>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
>>>>>> so marking them as experimental now will break the ABI. Not sure what to do,
>>>>>> cc'ed a few ABI related names for comment.
>>>>>>
>>>>>> For me, we need to proceed as the experimental tag removed and APIs become
>>>>>> mature starting from v19.11, since this is what happened in practice, and remove
>>>>>> a few existing being experimental references in the doxygen comments.
>>>>>
>>>>> I think, accidentally we can not make a library as NON-experimental.
>>>>> TM never went through experimental to mature transition(see git log
>>>>> lib/librte_ethdev/rte_tm.h)
>>>>> It was a bug to not mark as experimental in each function in the ABI process.
>>>>> Some of the features like packet marking are not even implemented by any HW.
>>>>> I think, we can make API stable only all the features are implemented
>>>>> by one or two HW.
>>>>
>>>> Fair enough, specially if the API is not ready yet.
>>>>
>>>> But they were part of stable ABI, and marking them as experimental now will
>>>> break the old applications using these APIs.
>>>
>>> it is still marked as EXPERIMENTAL everywhere and API is not ready yet.
>>
>> Existing experimental marks are text only for human parsing.
>>
>> The compiler attribute and build time checks are missing, and the symbol in the
>> binary doesn't have experimental tag. Our scripts and automated checks won't
>> detect it as experimental.
>>
>> My point is just having experimental comment in header file is not enough to
>> qualify the APIs as experimental.
>>
>>> Anyway, we need to break the ABI to make it work on various HW.
>>> I am not sure what to do?
>>> IMO, We need to send a patch as Fixes: for the bug of not adding
>>> __rte_experimental in each function.
>>
>> Yes, this is where we are, both you and Cristian suggest API is not ready and
>> should be experimental, but they were part of stable ABI, making them
>> experimental will break the ABI.
>> It looks like there is no good option but we should select one of the bad ones.
>>
>>>
>>> Traffic Management API - EXPERIMENTAL
>>> M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>>> T: git://dpdk.org/next/dpdk-next-qos
>>> F: lib/librte_ethdev/rte_tm*
>>>>
>>>>>
>>>>>>
>>>>>> Ray, Neil, David, Luca, Kevin, what do you think?
>>>>
> While I'm not called any of those names, allow me to give my 2c.
> 
> Since these are marked in binaries as part of the stable ABI, I think we
> need to honour that for the next two releases 20.05 and 20.08 [which means
> that we need to put in versioned functions for any changes, not that we
> can't change anything]
> 
> For 20.11, I think these should then have one of two options taken:
> * have these "fixed" and ready to be marked as stable, and officially part
>   of v21 ABI or
> * mark them as experimental properly, and look to have them as part of the
>   v22 or subsequent ABI
> 
> Given the comments here, I would tend towards the latter of the above two
> options, but that's really a decision for the maintainers.
> 
> Remember, this is not the first bug we have encountered where we messed up
> some ABI versions in the 19.11 release, and, like the previous one with the
> screwed up version number, I think we need to honour the ABI committments
> made, especially since in this case it's only for a few more months till
> 20.11 development starts.
> 
> /Bruce
> 


So the rte_tm API has been "EXPERIMENTAL" for quiet a long time, as far back as v17.11.
To the extent it predates the experimental infrastructure the community developed 
since then. TM added in 17.08, EXPERIMENTAL appears to have been added in 17.11.

That said, some form of stable TM API should have emerged by this point. 
So I am not sure that EXPERIMENTAL status was 100% warranted. 

As Bruce points out.
It is simpler to wait for the next ABI breakage window in August. 
And mark them EXPERIMENTAL at that point. 

Thanks,

Ray K



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 15:04                     ` Luca Boccassi
@ 2020-04-28 15:54                       ` Thomas Monjalon
  2020-04-29  8:45                         ` Dumitrescu, Cristian
  2020-05-01 13:18                         ` [dpdk-dev] " Jerin Jacob
  0 siblings, 2 replies; 60+ messages in thread
From: Thomas Monjalon @ 2020-04-28 15:54 UTC (permalink / raw)
  To: Jerin Jacob, Dumitrescu, Cristian
  Cc: Bruce Richardson, Ferruh Yigit, Luca Boccassi, Nithin Dabilpuram,
	Singh, Jasvinder, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Kevin Traynor,
	David Marchand

28/04/2020 17:04, Luca Boccassi:
> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> > On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> > > On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > > > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > > > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > > > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > > > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > > > > > > > On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > > > > > > > > > This patch also updates tm port/level/node capability structures with
> > > > > > > > > > > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > > > > > > > > > > and private/shared shaper byte mode.
> > > > > > > > > > > 
> > > > > > > > > > > SoftNIC PMD is also updated with new capabilities.
[...]
> > > > > > > > > Hi Nithin,
> > > > > > > > > 
> > > > > > > > > It looks like patch is causing ABI break, I am getting following warning [1],
> > > > > > > > > can you please check?
> > > > > > > > > 
> > > > > > > > > [1]
> > > > > > > > > https://pastebin.com/XYNFg14u
> > > > > > > > 
> > > > > > > > Hi Ferruh,
> > > > > > > > 
> > > > > > > > The RTE_TM API is marked as experimental,
> > > > > > > > but it looks that this was not correctly marked
> > > > > > > > when __rte_experimental ABI checker was introduced.
> > > > > > > > 
> > > > > > > > It is marked as experimental at the top of the rte_tm.h,
> > > > > > > > similarly to other APIs introduced around same time,
> > > > > > > > but it was not correctly picked up by the ABI check procedure
> > > > > > > > when later introduced, so __rte_experimental was not added to every function.
> > > > > > > > 
> > > > > > > 
> > > > > > > :(
> > > > > > > 
> > > > > > > Is it time to mature them?
> > > > > > > 
> > > > > > > As you said they are not marked as experimental both in header file (function
> > > > > > > declarations) and .map file.
> > > > > > > 
> > > > > > > The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> > > > > > > so marking them as experimental now will break the ABI. Not sure what to do,
> > > > > > > cc'ed a few ABI related names for comment.
> > > > > > > 
> > > > > > > For me, we need to proceed as the experimental tag removed and APIs become
> > > > > > > mature starting from v19.11, since this is what happened in practice, and remove
> > > > > > > a few existing being experimental references in the doxygen comments.
> > > > > > 
> > > > > > I think, accidentally we can not make a library as NON-experimental.
> > > > > > TM never went through experimental to mature transition(see git log
> > > > > > lib/librte_ethdev/rte_tm.h)
> > > > > > It was a bug to not mark as experimental in each function in the ABI process.
> > > > > > Some of the features like packet marking are not even implemented by any HW.
> > > > > > I think, we can make API stable only all the features are implemented
> > > > > > by one or two HW.

Yes this is what was decided one or two years ago I think.
But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.



> > > > > Fair enough, specially if the API is not ready yet.
> > > > > 
> > > > > But they were part of stable ABI, and marking them as experimental now will
> > > > > break the old applications using these APIs.
> > > > 
> > > > it is still marked as EXPERIMENTAL everywhere and API is not ready yet.

rte_tm is implemented in 6 PMDs.


> > > Existing experimental marks are text only for human parsing.
> > > 
> > > The compiler attribute and build time checks are missing, and the symbol in the
> > > binary doesn't have experimental tag. Our scripts and automated checks won't
> > > detect it as experimental.
> > > 
> > > My point is just having experimental comment in header file is not enough to
> > > qualify the APIs as experimental.
> > > 
> > > > Anyway, we need to break the ABI to make it work on various HW.

Yes this is why I was asking in 19.11 to check our API,
in order to avoid such situation.


> > > > I am not sure what to do?

Either manage ABI versioning, or wait 20.11.


> > > > IMO, We need to send a patch as Fixes: for the bug of not adding
> > > > __rte_experimental in each function.

No, this is wrong.


> > > Yes, this is where we are, both you and Cristian suggest API is not ready and
> > > should be experimental, but they were part of stable ABI, making them
> > > experimental will break the ABI.
> > > It looks like there is no good option but we should select one of the bad ones.
> > > 
> > > > Traffic Management API - EXPERIMENTAL
> > > > M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > > > T: git://dpdk.org/next/dpdk-next-qos
> > > > F: lib/librte_ethdev/rte_tm*
> > > > > > > Ray, Neil, David, Luca, Kevin, what do you think?
> > While I'm not called any of those names, allow me to give my 2c.
> > 
> > Since these are marked in binaries as part of the stable ABI, I think we
> > need to honour that for the next two releases 20.05 and 20.08 [which means
> > that we need to put in versioned functions for any changes, not that we
> > can't change anything]
> > 
> > For 20.11, I think these should then have one of two options taken:
> > * have these "fixed" and ready to be marked as stable, and officially part
> >   of v21 ABI or
> > * mark them as experimental properly, and look to have them as part of the
> >   v22 or subsequent ABI
> > 
> > Given the comments here, I would tend towards the latter of the above two
> > options, but that's really a decision for the maintainers.
> > 
> > Remember, this is not the first bug we have encountered where we messed up
> > some ABI versions in the 19.11 release, and, like the previous one with the
> > screwed up version number, I think we need to honour the ABI committments
> > made, especially since in this case it's only for a few more months till
> > 20.11 development starts.
> > 
> > /Bruce
> 
> +1
> 
> If they are not ready now, they haven't been ready for the past 6
> months either, so staying not ready for 6 more is the lesser evil.

This API is almost 3 years old (release 17.08).
That's good to improve it but we must respect the ABI contract that
we all agreed.


Summary:
17.08: rte_tm is introduced.
17.11: rte_mtr is introduced as experimental, but rte_tm remains stable.
18.02: __rte_experimental tag is introduced (including for rte_mtr),
but rte_tm remains untouched as it is in stable ABI.
19.11: stable ABI is frozen until 20.11
20.05: rte_tm improvement is blocked because of ABI breakage.


It should remind everybody of reviewing the new API and policies,
and maintaining the existing code appropriately.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 15:30             ` Thomas Monjalon
@ 2020-04-28 17:35               ` Dumitrescu, Cristian
  0 siblings, 0 replies; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-28 17:35 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Yigit, Ferruh, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, jerinj, kkanas, Nithin Dabilpuram,
	Kinsella, Ray, Neil Horman, Luca Boccassi, Kevin Traynor,
	David Marchand, Richardson, Bruce



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 28, 2020 4:30 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Nithin Dabilpuram
> <nithind1988@gmail.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Andrew Rybchenko <arybchenko@solarflare.com>; dev@dpdk.org;
> jerinj@marvell.com; kkanas@marvell.com; Nithin Dabilpuram
> <ndabilpuram@marvell.com>; Kinsella, Ray <ray.kinsella@intel.com>; Neil
> Horman <nhorman@tuxdriver.com>; Luca Boccassi <bluca@debian.org>;
> Kevin Traynor <ktraynor@redhat.com>; David Marchand
> <david.marchand@redhat.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt
> mode
> 
> 27/04/2020 18:28, Dumitrescu, Cristian:
> > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > >> Hi Nithin,
> > > >>
> > > >> It looks like patch is causing ABI break, I am getting following warning
> [1],
> > > >> can you please check?
> > > >>
> > > >> [1]
> > > >> https://pastebin.com/XYNFg14u
> > > >
> > > >
> > > > Hi Ferruh,
> > > >
> > > > The RTE_TM API is marked as experimental, but it looks that this was
> not
> > > correctly marked when __rte_experimental ABI checker was introduced.
> > > >
> > > > It is marked as experimental at the top of the rte_tm.h, similarly to
> other
> > > APIs introduced around same time, but it was not correctly picked up by
> the
> > > ABI check procedure when later introduced, so __rte_experimental was
> not
> > > added to every function.
> > > >
> > >
> > > :(
> > >
> > > Is it time to mature them?
> > >
> > > As you said they are not marked as experimental both in header file
> > > (function
> > > declarations) and .map file.
> > >
> > > The problem is, they are not marked as experimental in DPDK_20.0 ABI
> > > (v19.11),
> > > so marking them as experimental now will break the ABI. Not sure what
> to
> > > do,
> > > cc'ed a few ABI related names for comment.
> > >
> > > For me, we need to proceed as the experimental tag removed and APIs
> > > become
> > > mature starting from v19.11, since this is what happened in practice, and
> > > remove
> > > a few existing being experimental references in the doxygen comments.
> > >
> > > Ray, Neil, David, Luca, Kevin, what do you think?
> >
> > Hi Ferruh,
> >
> > IMO your proposed approach is fixing the wrong problem and is
> > probably not the right way of doing things.
> >
> > This API is correctly marked as experimental in the header
> > file rte_tm.h and in the MAINTAINERS file,
> 
> in rte_tm.h:
> 	* @warning
> 	* @b EXPERIMENTAL: this API may change without prior notice
> 
> in MAINTAINERS:
> 	Traffic Management API - EXPERIMENTAL
> 	M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> 	T: git://dpdk.org/next/dpdk-next-qos
> 	F: lib/librte_ethdev/rte_tm*
> 
> 
> > therefore it should remain experimental,
> 
> in rte_ethdev_version.map:
> 	before 19.11: DPDK_17.08 {
> 	since 19.11: DPDK_20.0 {
> 
> When adding rte_tm in 17.08:
> http://git.dpdk.org/dpdk/diff/lib/librte_ether/rte_ether_version.map?id=5
> d109deffa
> 
> In 17.08, early July 2017, the first EXPERIMENTAL section was declared in EAL:
> http://git.dpdk.org/dpdk/diff/lib/librte_eal/linuxapp/eal/rte_eal_version.m
> ap?id=a3ee360f444
> 
> When adding rte_mtr in 17.11, all functions are made experimental:
> http://git.dpdk.org/dpdk/diff/lib/librte_ether/rte_ethdev_version.map?id=
> 6613ffe1
> 
> In 18.02, the tag __rte_experimental was introduced:
> 	http://git.dpdk.org/dpdk/commit/?id=7d540a3e735
> and functions are marked (including rte_mtr but not rte_tm):
> 	http://git.dpdk.org/dpdk/commit/?id=77b7b81e32e
> 
> 

Thanks, Thomas, for taking the time to put all the historic events in their proper sequence.

> > as more changes are expected from the people like Nithin and others
> > currently upstreaming drivers for it.
> 
> They are doing changes in the API introduced 3 years ago.
> 
> 
> > For some reason, the __rte_experimental tags were not added to
> > this file when the ABI checker was introduced,
> > and this is the real problem that should be fixed.
> 
> The mistake was done 2 years ago.
> As maintainer of rte_tm code, you are expected to notice the issue.

Apologies for not noticing this gap at the time. As Thomas shows above, the __rte_experimental tags were introduced several DPDK releases after the rte_tm API.

> As maintainer of rte_mtr code, you were expected to review the change
> on the mtr functions being marked as experimental.

I did.

> I am sorry that it took 2 years to discover the gap.
> 
> We can fix the ABI in the ABI-breakage window: in 20.11.
> 



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 15:54                       ` Thomas Monjalon
@ 2020-04-29  8:45                         ` Dumitrescu, Cristian
  2020-04-29  9:03                           ` Bruce Richardson
  2020-05-01 13:18                         ` [dpdk-dev] " Jerin Jacob
  1 sibling, 1 reply; 60+ messages in thread
From: Dumitrescu, Cristian @ 2020-04-29  8:45 UTC (permalink / raw)
  To: Thomas Monjalon, Jerin Jacob
  Cc: Richardson, Bruce, Yigit, Ferruh, Luca Boccassi,
	Nithin Dabilpuram, Singh, Jasvinder, Andrew Rybchenko, dev,
	jerinj, kkanas, Nithin Dabilpuram, Kinsella, Ray, Neil Horman,
	Kevin Traynor, David Marchand



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 28, 2020 4:54 PM
> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Andrew Rybchenko
> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
> Marchand <david.marchand@redhat.com>
> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
> config in pkt mode
> 
> 28/04/2020 17:04, Luca Boccassi:
> > On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> > > On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> > > > On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > > > > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
> <ferruh.yigit@intel.com> wrote:
> > > > > > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > > > > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
> <ferruh.yigit@intel.com> wrote:
> > > > > > > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > > > > > > > > On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > > > > > > > > > > This patch also updates tm port/level/node capability
> structures with
> > > > > > > > > > > > exiting features of scheduler wfq packet mode,
> scheduler wfq byte mode
> > > > > > > > > > > > and private/shared shaper byte mode.
> > > > > > > > > > > >
> > > > > > > > > > > > SoftNIC PMD is also updated with new capabilities.
> [...]
> > > > > > > > > > Hi Nithin,
> > > > > > > > > >
> > > > > > > > > > It looks like patch is causing ABI break, I am getting following
> warning [1],
> > > > > > > > > > can you please check?
> > > > > > > > > >
> > > > > > > > > > [1]
> > > > > > > > > > https://pastebin.com/XYNFg14u
> > > > > > > > >
> > > > > > > > > Hi Ferruh,
> > > > > > > > >
> > > > > > > > > The RTE_TM API is marked as experimental,
> > > > > > > > > but it looks that this was not correctly marked
> > > > > > > > > when __rte_experimental ABI checker was introduced.
> > > > > > > > >
> > > > > > > > > It is marked as experimental at the top of the rte_tm.h,
> > > > > > > > > similarly to other APIs introduced around same time,
> > > > > > > > > but it was not correctly picked up by the ABI check procedure
> > > > > > > > > when later introduced, so __rte_experimental was not added
> to every function.
> > > > > > > > >
> > > > > > > >
> > > > > > > > :(
> > > > > > > >
> > > > > > > > Is it time to mature them?
> > > > > > > >
> > > > > > > > As you said they are not marked as experimental both in header
> file (function
> > > > > > > > declarations) and .map file.
> > > > > > > >
> > > > > > > > The problem is, they are not marked as experimental in
> DPDK_20.0 ABI (v19.11),
> > > > > > > > so marking them as experimental now will break the ABI. Not
> sure what to do,
> > > > > > > > cc'ed a few ABI related names for comment.
> > > > > > > >
> > > > > > > > For me, we need to proceed as the experimental tag removed
> and APIs become
> > > > > > > > mature starting from v19.11, since this is what happened in
> practice, and remove
> > > > > > > > a few existing being experimental references in the doxygen
> comments.
> > > > > > >
> > > > > > > I think, accidentally we can not make a library as NON-
> experimental.
> > > > > > > TM never went through experimental to mature transition(see git
> log
> > > > > > > lib/librte_ethdev/rte_tm.h)
> > > > > > > It was a bug to not mark as experimental in each function in the
> ABI process.
> > > > > > > Some of the features like packet marking are not even
> implemented by any HW.
> > > > > > > I think, we can make API stable only all the features are
> implemented
> > > > > > > by one or two HW.
> 
> Yes this is what was decided one or two years ago I think.
> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
> 
> 
> 
> > > > > > Fair enough, specially if the API is not ready yet.
> > > > > >
> > > > > > But they were part of stable ABI, and marking them as experimental
> now will
> > > > > > break the old applications using these APIs.
> > > > >
> > > > > it is still marked as EXPERIMENTAL everywhere and API is not ready
> yet.
> 
> rte_tm is implemented in 6 PMDs.
> 
> 
> > > > Existing experimental marks are text only for human parsing.
> > > >
> > > > The compiler attribute and build time checks are missing, and the
> symbol in the
> > > > binary doesn't have experimental tag. Our scripts and automated
> checks won't
> > > > detect it as experimental.
> > > >
> > > > My point is just having experimental comment in header file is not
> enough to
> > > > qualify the APIs as experimental.
> > > >
> > > > > Anyway, we need to break the ABI to make it work on various HW.
> 
> Yes this is why I was asking in 19.11 to check our API,
> in order to avoid such situation.
> 
> 
> > > > > I am not sure what to do?
> 
> Either manage ABI versioning, or wait 20.11.
> 
> 
> > > > > IMO, We need to send a patch as Fixes: for the bug of not adding
> > > > > __rte_experimental in each function.
> 
> No, this is wrong.
> 

Why exactly is this wrong? This is the gap that caused the current discussion, right?

> 
> > > > Yes, this is where we are, both you and Cristian suggest API is not ready
> and
> > > > should be experimental, but they were part of stable ABI, making them
> > > > experimental will break the ABI.
> > > > It looks like there is no good option but we should select one of the bad
> ones.
> > > >
> > > > > Traffic Management API - EXPERIMENTAL
> > > > > M: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> > > > > T: git://dpdk.org/next/dpdk-next-qos
> > > > > F: lib/librte_ethdev/rte_tm*
> > > > > > > > Ray, Neil, David, Luca, Kevin, what do you think?
> > > While I'm not called any of those names, allow me to give my 2c.
> > >
> > > Since these are marked in binaries as part of the stable ABI, I think we
> > > need to honour that for the next two releases 20.05 and 20.08 [which
> means
> > > that we need to put in versioned functions for any changes, not that we
> > > can't change anything]
> > >
> > > For 20.11, I think these should then have one of two options taken:
> > > * have these "fixed" and ready to be marked as stable, and officially part
> > >   of v21 ABI or
> > > * mark them as experimental properly, and look to have them as part of
> the
> > >   v22 or subsequent ABI
> > >
> > > Given the comments here, I would tend towards the latter of the above
> two
> > > options, but that's really a decision for the maintainers.
> > >
> > > Remember, this is not the first bug we have encountered where we
> messed up
> > > some ABI versions in the 19.11 release, and, like the previous one with
> the
> > > screwed up version number, I think we need to honour the ABI
> committments
> > > made, especially since in this case it's only for a few more months till
> > > 20.11 development starts.
> > >
> > > /Bruce
> >
> > +1
> >
> > If they are not ready now, they haven't been ready for the past 6
> > months either, so staying not ready for 6 more is the lesser evil.
> 
> This API is almost 3 years old (release 17.08).
> That's good to improve it but we must respect the ABI contract that
> we all agreed.
> 
> 
> Summary:
> 17.08: rte_tm is introduced.
> 17.11: rte_mtr is introduced as experimental, but rte_tm remains stable.
> 18.02: __rte_experimental tag is introduced (including for rte_mtr),
> but rte_tm remains untouched as it is in stable ABI.
> 19.11: stable ABI is frozen until 20.11
> 20.05: rte_tm improvement is blocked because of ABI breakage.
> 
> 
> It should remind everybody of reviewing the new API and policies,
> and maintaining the existing code appropriately.
> 


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-29  8:45                         ` Dumitrescu, Cristian
@ 2020-04-29  9:03                           ` Bruce Richardson
  2020-05-01 10:27                             ` Ferruh Yigit
  0 siblings, 1 reply; 60+ messages in thread
From: Bruce Richardson @ 2020-04-29  9:03 UTC (permalink / raw)
  To: Dumitrescu, Cristian
  Cc: Thomas Monjalon, Jerin Jacob, Yigit, Ferruh, Luca Boccassi,
	Nithin Dabilpuram, Singh, Jasvinder, Andrew Rybchenko, dev,
	jerinj, kkanas, Nithin Dabilpuram, Kinsella, Ray, Neil Horman,
	Kevin Traynor, David Marchand

On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
> 
> 
> > -----Original Message-----
> > From: Thomas Monjalon <thomas@monjalon.net>
> > Sent: Tuesday, April 28, 2020 4:54 PM
> > To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
> > <cristian.dumitrescu@intel.com>
> > Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
> > Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
> > <jasvinder.singh@intel.com>; Andrew Rybchenko
> > <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> > kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
> > Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
> > <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
> > Marchand <david.marchand@redhat.com>
> > Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
> > config in pkt mode
> >
> > 28/04/2020 17:04, Luca Boccassi:
> > > On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> > > > On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> > > > > On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > > > > > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
> > <ferruh.yigit@intel.com> wrote:
> > > > > > > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > > > > > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
> > <ferruh.yigit@intel.com> wrote:
> > > > > > > > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > > > > > > > > > On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > > > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > > > > > > > > > > > This patch also updates tm port/level/node capability
> > structures with
> > > > > > > > > > > > > exiting features of scheduler wfq packet mode,
> > scheduler wfq byte mode
> > > > > > > > > > > > > and private/shared shaper byte mode.
> > > > > > > > > > > > >
> > > > > > > > > > > > > SoftNIC PMD is also updated with new capabilities.
> > [...]
> > > > > > > > > > > Hi Nithin,
> > > > > > > > > > >
> > > > > > > > > > > It looks like patch is causing ABI break, I am getting following
> > warning [1],
> > > > > > > > > > > can you please check?
> > > > > > > > > > >
> > > > > > > > > > > [1]
> > > > > > > > > > > https://pastebin.com/XYNFg14u
> > > > > > > > > >
> > > > > > > > > > Hi Ferruh,
> > > > > > > > > >
> > > > > > > > > > The RTE_TM API is marked as experimental,
> > > > > > > > > > but it looks that this was not correctly marked
> > > > > > > > > > when __rte_experimental ABI checker was introduced.
> > > > > > > > > >
> > > > > > > > > > It is marked as experimental at the top of the rte_tm.h,
> > > > > > > > > > similarly to other APIs introduced around same time,
> > > > > > > > > > but it was not correctly picked up by the ABI check procedure
> > > > > > > > > > when later introduced, so __rte_experimental was not added
> > to every function.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > :(
> > > > > > > > >
> > > > > > > > > Is it time to mature them?
> > > > > > > > >
> > > > > > > > > As you said they are not marked as experimental both in header
> > file (function
> > > > > > > > > declarations) and .map file.
> > > > > > > > >
> > > > > > > > > The problem is, they are not marked as experimental in
> > DPDK_20.0 ABI (v19.11),
> > > > > > > > > so marking them as experimental now will break the ABI. Not
> > sure what to do,
> > > > > > > > > cc'ed a few ABI related names for comment.
> > > > > > > > >
> > > > > > > > > For me, we need to proceed as the experimental tag removed
> > and APIs become
> > > > > > > > > mature starting from v19.11, since this is what happened in
> > practice, and remove
> > > > > > > > > a few existing being experimental references in the doxygen
> > comments.
> > > > > > > >
> > > > > > > > I think, accidentally we can not make a library as NON-
> > experimental.
> > > > > > > > TM never went through experimental to mature transition(see git
> > log
> > > > > > > > lib/librte_ethdev/rte_tm.h)
> > > > > > > > It was a bug to not mark as experimental in each function in the
> > ABI process.
> > > > > > > > Some of the features like packet marking are not even
> > implemented by any HW.
> > > > > > > > I think, we can make API stable only all the features are
> > implemented
> > > > > > > > by one or two HW.
> >
> > Yes this is what was decided one or two years ago I think.
> > But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
> >
> >
> >
> > > > > > > Fair enough, specially if the API is not ready yet.
> > > > > > >
> > > > > > > But they were part of stable ABI, and marking them as experimental
> > now will
> > > > > > > break the old applications using these APIs.
> > > > > >
> > > > > > it is still marked as EXPERIMENTAL everywhere and API is not ready
> > yet.
> >
> > rte_tm is implemented in 6 PMDs.
> >
> >
> > > > > Existing experimental marks are text only for human parsing.
> > > > >
> > > > > The compiler attribute and build time checks are missing, and the
> > symbol in the
> > > > > binary doesn't have experimental tag. Our scripts and automated
> > checks won't
> > > > > detect it as experimental.
> > > > >
> > > > > My point is just having experimental comment in header file is not
> > enough to
> > > > > qualify the APIs as experimental.
> > > > >
> > > > > > Anyway, we need to break the ABI to make it work on various HW.
> >
> > Yes this is why I was asking in 19.11 to check our API,
> > in order to avoid such situation.
> >
> >
> > > > > > I am not sure what to do?
> >
> > Either manage ABI versioning, or wait 20.11.
> >
> >
> > > > > > IMO, We need to send a patch as Fixes: for the bug of not adding
> > > > > > __rte_experimental in each function.
> >
> > No, this is wrong.
> >
> 
> Why exactly is this wrong? This is the gap that caused the current discussion, right?
> 
It's wrong for this release, since we can't change things from stable back
to experimental. Any such patch will have to wait for 20.11, as agreed in
the discussion.

/Bruce

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-29  9:03                           ` Bruce Richardson
@ 2020-05-01 10:27                             ` Ferruh Yigit
  2020-05-01 13:16                               ` [dpdk-dev] [EXT] " Nithin Dabilpuram
  0 siblings, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-05-01 10:27 UTC (permalink / raw)
  To: Bruce Richardson, Dumitrescu, Cristian
  Cc: Thomas Monjalon, Jerin Jacob, Luca Boccassi, Nithin Dabilpuram,
	Singh, Jasvinder, Andrew Rybchenko, dev, jerinj, kkanas,
	Nithin Dabilpuram, Kinsella, Ray, Neil Horman, Kevin Traynor,
	David Marchand

On 4/29/2020 10:03 AM, Bruce Richardson wrote:
> On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
>>
>>
>>> -----Original Message-----
>>> From: Thomas Monjalon <thomas@monjalon.net>
>>> Sent: Tuesday, April 28, 2020 4:54 PM
>>> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
>>> <cristian.dumitrescu@intel.com>
>>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
>>> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
>>> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
>>> <jasvinder.singh@intel.com>; Andrew Rybchenko
>>> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
>>> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
>>> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
>>> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
>>> Marchand <david.marchand@redhat.com>
>>> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
>>> config in pkt mode
>>>
>>> 28/04/2020 17:04, Luca Boccassi:
>>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
>>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
>>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
>>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>>>>>>> This patch also updates tm port/level/node capability
>>> structures with
>>>>>>>>>>>>>> exiting features of scheduler wfq packet mode,
>>> scheduler wfq byte mode
>>>>>>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>> [...]
>>>>>>>>>>>> Hi Nithin,
>>>>>>>>>>>>
>>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following
>>> warning [1],
>>>>>>>>>>>> can you please check?
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>> https://pastebin.com/XYNFg14u
>>>>>>>>>>>
>>>>>>>>>>> Hi Ferruh,
>>>>>>>>>>>
>>>>>>>>>>> The RTE_TM API is marked as experimental,
>>>>>>>>>>> but it looks that this was not correctly marked
>>>>>>>>>>> when __rte_experimental ABI checker was introduced.
>>>>>>>>>>>
>>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
>>>>>>>>>>> similarly to other APIs introduced around same time,
>>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
>>>>>>>>>>> when later introduced, so __rte_experimental was not added
>>> to every function.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> :(
>>>>>>>>>>
>>>>>>>>>> Is it time to mature them?
>>>>>>>>>>
>>>>>>>>>> As you said they are not marked as experimental both in header
>>> file (function
>>>>>>>>>> declarations) and .map file.
>>>>>>>>>>
>>>>>>>>>> The problem is, they are not marked as experimental in
>>> DPDK_20.0 ABI (v19.11),
>>>>>>>>>> so marking them as experimental now will break the ABI. Not
>>> sure what to do,
>>>>>>>>>> cc'ed a few ABI related names for comment.
>>>>>>>>>>
>>>>>>>>>> For me, we need to proceed as the experimental tag removed
>>> and APIs become
>>>>>>>>>> mature starting from v19.11, since this is what happened in
>>> practice, and remove
>>>>>>>>>> a few existing being experimental references in the doxygen
>>> comments.
>>>>>>>>>
>>>>>>>>> I think, accidentally we can not make a library as NON-
>>> experimental.
>>>>>>>>> TM never went through experimental to mature transition(see git
>>> log
>>>>>>>>> lib/librte_ethdev/rte_tm.h)
>>>>>>>>> It was a bug to not mark as experimental in each function in the
>>> ABI process.
>>>>>>>>> Some of the features like packet marking are not even
>>> implemented by any HW.
>>>>>>>>> I think, we can make API stable only all the features are
>>> implemented
>>>>>>>>> by one or two HW.
>>>
>>> Yes this is what was decided one or two years ago I think.
>>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
>>>
>>>
>>>
>>>>>>>> Fair enough, specially if the API is not ready yet.
>>>>>>>>
>>>>>>>> But they were part of stable ABI, and marking them as experimental
>>> now will
>>>>>>>> break the old applications using these APIs.
>>>>>>>
>>>>>>> it is still marked as EXPERIMENTAL everywhere and API is not ready
>>> yet.
>>>
>>> rte_tm is implemented in 6 PMDs.
>>>
>>>
>>>>>> Existing experimental marks are text only for human parsing.
>>>>>>
>>>>>> The compiler attribute and build time checks are missing, and the
>>> symbol in the
>>>>>> binary doesn't have experimental tag. Our scripts and automated
>>> checks won't
>>>>>> detect it as experimental.
>>>>>>
>>>>>> My point is just having experimental comment in header file is not
>>> enough to
>>>>>> qualify the APIs as experimental.
>>>>>>
>>>>>>> Anyway, we need to break the ABI to make it work on various HW.
>>>
>>> Yes this is why I was asking in 19.11 to check our API,
>>> in order to avoid such situation.
>>>
>>>
>>>>>>> I am not sure what to do?
>>>
>>> Either manage ABI versioning, or wait 20.11.
>>>
>>>
>>>>>>> IMO, We need to send a patch as Fixes: for the bug of not adding
>>>>>>> __rte_experimental in each function.
>>>
>>> No, this is wrong.
>>>
>>
>> Why exactly is this wrong? This is the gap that caused the current discussion, right?
>>
> It's wrong for this release, since we can't change things from stable back
> to experimental. Any such patch will have to wait for 20.11, as agreed in
> the discussion.
> 

Deferring the patchet for this release.

Reminder that if the option "to mark rte_tm_* as experimental in v20.11"
selected, requires deprecation notice before v20.11.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-05-01 10:27                             ` Ferruh Yigit
@ 2020-05-01 13:16                               ` Nithin Dabilpuram
  2020-08-25 16:59                                 ` Ferruh Yigit
  0 siblings, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-05-01 13:16 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Bruce Richardson, Dumitrescu, Cristian, Thomas Monjalon,
	Jerin Jacob, Luca Boccassi, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, jerinj, kkanas, Kinsella, Ray,
	Neil Horman, Kevin Traynor, David Marchand

On Fri, May 01, 2020 at 11:27:02AM +0100, Ferruh Yigit wrote:
> External Email
> 
> ----------------------------------------------------------------------
> On 4/29/2020 10:03 AM, Bruce Richardson wrote:
> > On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
> >>
> >>
> >>> -----Original Message-----
> >>> From: Thomas Monjalon <thomas@monjalon.net>
> >>> Sent: Tuesday, April 28, 2020 4:54 PM
> >>> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
> >>> <cristian.dumitrescu@intel.com>
> >>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
> >>> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
> >>> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
> >>> <jasvinder.singh@intel.com>; Andrew Rybchenko
> >>> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> >>> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
> >>> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
> >>> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
> >>> Marchand <david.marchand@redhat.com>
> >>> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
> >>> config in pkt mode
> >>>
> >>> 28/04/2020 17:04, Luca Boccassi:
> >>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> >>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> >>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> >>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
> >>> <ferruh.yigit@intel.com> wrote:
> >>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> >>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
> >>> <ferruh.yigit@intel.com> wrote:
> >>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>>>>>>>>>>>> This patch also updates tm port/level/node capability
> >>> structures with
> >>>>>>>>>>>>>> exiting features of scheduler wfq packet mode,
> >>> scheduler wfq byte mode
> >>>>>>>>>>>>>> and private/shared shaper byte mode.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
> >>> [...]
> >>>>>>>>>>>> Hi Nithin,
> >>>>>>>>>>>>
> >>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following
> >>> warning [1],
> >>>>>>>>>>>> can you please check?
> >>>>>>>>>>>>
> >>>>>>>>>>>> [1]
> >>>>>>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=ej5sP3-cEhEoCTZOia-QivXqgljtzBcMLtZGs-5c-Uc&s=B8z_5mQ2xO3C1izjmRe2zBApMrCUcW6KcAN-adglhJQ&e= 
> >>>>>>>>>>>
> >>>>>>>>>>> Hi Ferruh,
> >>>>>>>>>>>
> >>>>>>>>>>> The RTE_TM API is marked as experimental,
> >>>>>>>>>>> but it looks that this was not correctly marked
> >>>>>>>>>>> when __rte_experimental ABI checker was introduced.
> >>>>>>>>>>>
> >>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
> >>>>>>>>>>> similarly to other APIs introduced around same time,
> >>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
> >>>>>>>>>>> when later introduced, so __rte_experimental was not added
> >>> to every function.
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> :(
> >>>>>>>>>>
> >>>>>>>>>> Is it time to mature them?
> >>>>>>>>>>
> >>>>>>>>>> As you said they are not marked as experimental both in header
> >>> file (function
> >>>>>>>>>> declarations) and .map file.
> >>>>>>>>>>
> >>>>>>>>>> The problem is, they are not marked as experimental in
> >>> DPDK_20.0 ABI (v19.11),
> >>>>>>>>>> so marking them as experimental now will break the ABI. Not
> >>> sure what to do,
> >>>>>>>>>> cc'ed a few ABI related names for comment.
> >>>>>>>>>>
> >>>>>>>>>> For me, we need to proceed as the experimental tag removed
> >>> and APIs become
> >>>>>>>>>> mature starting from v19.11, since this is what happened in
> >>> practice, and remove
> >>>>>>>>>> a few existing being experimental references in the doxygen
> >>> comments.
> >>>>>>>>>
> >>>>>>>>> I think, accidentally we can not make a library as NON-
> >>> experimental.
> >>>>>>>>> TM never went through experimental to mature transition(see git
> >>> log
> >>>>>>>>> lib/librte_ethdev/rte_tm.h)
> >>>>>>>>> It was a bug to not mark as experimental in each function in the
> >>> ABI process.
> >>>>>>>>> Some of the features like packet marking are not even
> >>> implemented by any HW.
> >>>>>>>>> I think, we can make API stable only all the features are
> >>> implemented
> >>>>>>>>> by one or two HW.
> >>>
> >>> Yes this is what was decided one or two years ago I think.
> >>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
> >>>
> >>>
> >>>
> >>>>>>>> Fair enough, specially if the API is not ready yet.
> >>>>>>>>
> >>>>>>>> But they were part of stable ABI, and marking them as experimental
> >>> now will
> >>>>>>>> break the old applications using these APIs.
> >>>>>>>
> >>>>>>> it is still marked as EXPERIMENTAL everywhere and API is not ready
> >>> yet.
> >>>
> >>> rte_tm is implemented in 6 PMDs.
> >>>
> >>>
> >>>>>> Existing experimental marks are text only for human parsing.
> >>>>>>
> >>>>>> The compiler attribute and build time checks are missing, and the
> >>> symbol in the
> >>>>>> binary doesn't have experimental tag. Our scripts and automated
> >>> checks won't
> >>>>>> detect it as experimental.
> >>>>>>
> >>>>>> My point is just having experimental comment in header file is not
> >>> enough to
> >>>>>> qualify the APIs as experimental.
> >>>>>>
> >>>>>>> Anyway, we need to break the ABI to make it work on various HW.
> >>>
> >>> Yes this is why I was asking in 19.11 to check our API,
> >>> in order to avoid such situation.
> >>>
> >>>
> >>>>>>> I am not sure what to do?
> >>>
> >>> Either manage ABI versioning, or wait 20.11.
> >>>
> >>>
> >>>>>>> IMO, We need to send a patch as Fixes: for the bug of not adding
> >>>>>>> __rte_experimental in each function.
> >>>
> >>> No, this is wrong.
> >>>
> >>
> >> Why exactly is this wrong? This is the gap that caused the current discussion, right?
> >>
> > It's wrong for this release, since we can't change things from stable back
> > to experimental. Any such patch will have to wait for 20.11, as agreed in
> > the discussion.
> > 
> 
> Deferring the patchet for this release.
> 
> Reminder that if the option "to mark rte_tm_* as experimental in v20.11"
> selected, requires deprecation notice before v20.11.

Thanks Ferruh for reminder. I'll send a deprecation notice patch for the same.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-04-28 15:54                       ` Thomas Monjalon
  2020-04-29  8:45                         ` Dumitrescu, Cristian
@ 2020-05-01 13:18                         ` Jerin Jacob
  2020-05-05  8:01                           ` Ray Kinsella
  1 sibling, 1 reply; 60+ messages in thread
From: Jerin Jacob @ 2020-05-01 13:18 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Dumitrescu, Cristian, Bruce Richardson, Ferruh Yigit,
	Luca Boccassi, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, jerinj, kkanas, Nithin Dabilpuram,
	Kinsella, Ray, Neil Horman, Kevin Traynor, David Marchand

On Tue, Apr 28, 2020 at 9:24 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 28/04/2020 17:04, Luca Boccassi:
> > On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> > > On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> > > > On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> > > > > On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > > > On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> > > > > > > On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > > > > > > On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > From: Yigit, Ferruh <ferruh.yigit@intel.com>
> > > > > > > > > > On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> > > > > > > > > > > From: Nithin Dabilpuram <nithind1988@gmail.com>
> > > > > > > > > > > > This patch also updates tm port/level/node capability structures with
> > > > > > > > > > > > exiting features of scheduler wfq packet mode, scheduler wfq byte mode
> > > > > > > > > > > > and private/shared shaper byte mode.
> > > > > > > > > > > >
> > > > > > > > > > > > SoftNIC PMD is also updated with new capabilities.
> [...]
> > > > > > > > > > Hi Nithin,
> > > > > > > > > >
> > > > > > > > > > It looks like patch is causing ABI break, I am getting following warning [1],
> > > > > > > > > > can you please check?
> > > > > > > > > >
> > > > > > > > > > [1]
> > > > > > > > > > https://pastebin.com/XYNFg14u
> > > > > > > > >
> > > > > > > > > Hi Ferruh,
> > > > > > > > >
> > > > > > > > > The RTE_TM API is marked as experimental,
> > > > > > > > > but it looks that this was not correctly marked
> > > > > > > > > when __rte_experimental ABI checker was introduced.
> > > > > > > > >
> > > > > > > > > It is marked as experimental at the top of the rte_tm.h,
> > > > > > > > > similarly to other APIs introduced around same time,
> > > > > > > > > but it was not correctly picked up by the ABI check procedure
> > > > > > > > > when later introduced, so __rte_experimental was not added to every function.
> > > > > > > > >
> > > > > > > >
> > > > > > > > :(
> > > > > > > >
> > > > > > > > Is it time to mature them?
> > > > > > > >
> > > > > > > > As you said they are not marked as experimental both in header file (function
> > > > > > > > declarations) and .map file.
> > > > > > > >
> > > > > > > > The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
> > > > > > > > so marking them as experimental now will break the ABI. Not sure what to do,
> > > > > > > > cc'ed a few ABI related names for comment.
> > > > > > > >
> > > > > > > > For me, we need to proceed as the experimental tag removed and APIs become
> > > > > > > > mature starting from v19.11, since this is what happened in practice, and remove
> > > > > > > > a few existing being experimental references in the doxygen comments.
> > > > > > >
> > > > > > > I think, accidentally we can not make a library as NON-experimental.
> > > > > > > TM never went through experimental to mature transition(see git log
> > > > > > > lib/librte_ethdev/rte_tm.h)
> > > > > > > It was a bug to not mark as experimental in each function in the ABI process.
> > > > > > > Some of the features like packet marking are not even implemented by any HW.
> > > > > > > I think, we can make API stable only all the features are implemented
> > > > > > > by one or two HW.
>
> Yes this is what was decided one or two years ago I think.
> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.

None of the 6 PMDS covers all the features.

>
> > > > Existing experimental marks are text only for human parsing.
> > > >
> > > > The compiler attribute and build time checks are missing, and the symbol in the
> > > > binary doesn't have experimental tag. Our scripts and automated checks won't
> > > > detect it as experimental.
> > > >
> > > > My point is just having experimental comment in header file is not enough to
> > > > qualify the APIs as experimental.
> > > >
> > > > > Anyway, we need to break the ABI to make it work on various HW.
>
> Yes this is why I was asking in 19.11 to check our API,
> in order to avoid such situation.
>
>
> > > > > I am not sure what to do?
>
> Either manage ABI versioning, or wait 20.11.

ABI change are in structures. So the function versioning does not
help. So we will wait for 20.11 then :-(

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-05-01 13:18                         ` [dpdk-dev] " Jerin Jacob
@ 2020-05-05  8:01                           ` Ray Kinsella
  0 siblings, 0 replies; 60+ messages in thread
From: Ray Kinsella @ 2020-05-05  8:01 UTC (permalink / raw)
  To: Jerin Jacob, Thomas Monjalon
  Cc: Dumitrescu, Cristian, Bruce Richardson, Ferruh Yigit,
	Luca Boccassi, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, jerinj, kkanas, Nithin Dabilpuram,
	Kinsella, Ray, Neil Horman, Kevin Traynor, David Marchand



On 01/05/2020 14:18, Jerin Jacob wrote:
> On Tue, Apr 28, 2020 at 9:24 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>>
>> 28/04/2020 17:04, Luca Boccassi:
>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>>>>>> This patch also updates tm port/level/node capability structures with
>>>>>>>>>>>>> exiting features of scheduler wfq packet mode, scheduler wfq byte mode
>>>>>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>>>>>
>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>> [...]
>>>>>>>>>>> Hi Nithin,
>>>>>>>>>>>
>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following warning [1],
>>>>>>>>>>> can you please check?
>>>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>> https://pastebin.com/XYNFg14u
>>>>>>>>>>
>>>>>>>>>> Hi Ferruh,
>>>>>>>>>>
>>>>>>>>>> The RTE_TM API is marked as experimental,
>>>>>>>>>> but it looks that this was not correctly marked
>>>>>>>>>> when __rte_experimental ABI checker was introduced.
>>>>>>>>>>
>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
>>>>>>>>>> similarly to other APIs introduced around same time,
>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
>>>>>>>>>> when later introduced, so __rte_experimental was not added to every function.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> :(
>>>>>>>>>
>>>>>>>>> Is it time to mature them?
>>>>>>>>>
>>>>>>>>> As you said they are not marked as experimental both in header file (function
>>>>>>>>> declarations) and .map file.
>>>>>>>>>
>>>>>>>>> The problem is, they are not marked as experimental in DPDK_20.0 ABI (v19.11),
>>>>>>>>> so marking them as experimental now will break the ABI. Not sure what to do,
>>>>>>>>> cc'ed a few ABI related names for comment.
>>>>>>>>>
>>>>>>>>> For me, we need to proceed as the experimental tag removed and APIs become
>>>>>>>>> mature starting from v19.11, since this is what happened in practice, and remove
>>>>>>>>> a few existing being experimental references in the doxygen comments.
>>>>>>>>
>>>>>>>> I think, accidentally we can not make a library as NON-experimental.
>>>>>>>> TM never went through experimental to mature transition(see git log
>>>>>>>> lib/librte_ethdev/rte_tm.h)
>>>>>>>> It was a bug to not mark as experimental in each function in the ABI process.
>>>>>>>> Some of the features like packet marking are not even implemented by any HW.
>>>>>>>> I think, we can make API stable only all the features are implemented
>>>>>>>> by one or two HW.
>>
>> Yes this is what was decided one or two years ago I think.
>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
> 
> None of the 6 PMDS covers all the features.
> 
>>
>>>>> Existing experimental marks are text only for human parsing.
>>>>>
>>>>> The compiler attribute and build time checks are missing, and the symbol in the
>>>>> binary doesn't have experimental tag. Our scripts and automated checks won't
>>>>> detect it as experimental.
>>>>>
>>>>> My point is just having experimental comment in header file is not enough to
>>>>> qualify the APIs as experimental.
>>>>>
>>>>>> Anyway, we need to break the ABI to make it work on various HW.
>>
>> Yes this is why I was asking in 19.11 to check our API,
>> in order to avoid such situation.
>>
>>
>>>>>> I am not sure what to do?
>>
>> Either manage ABI versioning, or wait 20.11.
> 
> ABI change are in structures. So the function versioning does not
> help. So we will wait for 20.11 then :-(
> 

yes - I spent some time looking at this also, and came to same conclusion.

Ray K

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-05-01 13:16                               ` [dpdk-dev] [EXT] " Nithin Dabilpuram
@ 2020-08-25 16:59                                 ` Ferruh Yigit
  2020-09-07 11:12                                   ` Nithin Dabilpuram
  0 siblings, 1 reply; 60+ messages in thread
From: Ferruh Yigit @ 2020-08-25 16:59 UTC (permalink / raw)
  To: Nithin Dabilpuram, Dumitrescu, Cristian, jerinj
  Cc: Bruce Richardson, Thomas Monjalon, Jerin Jacob, Luca Boccassi,
	Nithin Dabilpuram, Singh, Jasvinder, Andrew Rybchenko, dev,
	kkanas, Kinsella, Ray, Neil Horman, Kevin Traynor,
	David Marchand

On 5/1/2020 2:16 PM, Nithin Dabilpuram wrote:
> On Fri, May 01, 2020 at 11:27:02AM +0100, Ferruh Yigit wrote:
>> External Email
>>
>> ----------------------------------------------------------------------
>> On 4/29/2020 10:03 AM, Bruce Richardson wrote:
>>> On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Thomas Monjalon <thomas@monjalon.net>
>>>>> Sent: Tuesday, April 28, 2020 4:54 PM
>>>>> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
>>>>> <cristian.dumitrescu@intel.com>
>>>>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
>>>>> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
>>>>> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
>>>>> <jasvinder.singh@intel.com>; Andrew Rybchenko
>>>>> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
>>>>> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
>>>>> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
>>>>> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
>>>>> Marchand <david.marchand@redhat.com>
>>>>> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
>>>>> config in pkt mode
>>>>>
>>>>> 28/04/2020 17:04, Luca Boccassi:
>>>>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
>>>>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
>>>>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
>>>>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
>>>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
>>>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>>>>>>>>> This patch also updates tm port/level/node capability
>>>>> structures with
>>>>>>>>>>>>>>>> exiting features of scheduler wfq packet mode,
>>>>> scheduler wfq byte mode
>>>>>>>>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>> [...]
>>>>>>>>>>>>>> Hi Nithin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following
>>>>> warning [1],
>>>>>>>>>>>>>> can you please check?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=ej5sP3-cEhEoCTZOia-QivXqgljtzBcMLtZGs-5c-Uc&s=B8z_5mQ2xO3C1izjmRe2zBApMrCUcW6KcAN-adglhJQ&e= 
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Ferruh,
>>>>>>>>>>>>>
>>>>>>>>>>>>> The RTE_TM API is marked as experimental,
>>>>>>>>>>>>> but it looks that this was not correctly marked
>>>>>>>>>>>>> when __rte_experimental ABI checker was introduced.
>>>>>>>>>>>>>
>>>>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
>>>>>>>>>>>>> similarly to other APIs introduced around same time,
>>>>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
>>>>>>>>>>>>> when later introduced, so __rte_experimental was not added
>>>>> to every function.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> :(
>>>>>>>>>>>>
>>>>>>>>>>>> Is it time to mature them?
>>>>>>>>>>>>
>>>>>>>>>>>> As you said they are not marked as experimental both in header
>>>>> file (function
>>>>>>>>>>>> declarations) and .map file.
>>>>>>>>>>>>
>>>>>>>>>>>> The problem is, they are not marked as experimental in
>>>>> DPDK_20.0 ABI (v19.11),
>>>>>>>>>>>> so marking them as experimental now will break the ABI. Not
>>>>> sure what to do,
>>>>>>>>>>>> cc'ed a few ABI related names for comment.
>>>>>>>>>>>>
>>>>>>>>>>>> For me, we need to proceed as the experimental tag removed
>>>>> and APIs become
>>>>>>>>>>>> mature starting from v19.11, since this is what happened in
>>>>> practice, and remove
>>>>>>>>>>>> a few existing being experimental references in the doxygen
>>>>> comments.
>>>>>>>>>>>
>>>>>>>>>>> I think, accidentally we can not make a library as NON-
>>>>> experimental.
>>>>>>>>>>> TM never went through experimental to mature transition(see git
>>>>> log
>>>>>>>>>>> lib/librte_ethdev/rte_tm.h)
>>>>>>>>>>> It was a bug to not mark as experimental in each function in the
>>>>> ABI process.
>>>>>>>>>>> Some of the features like packet marking are not even
>>>>> implemented by any HW.
>>>>>>>>>>> I think, we can make API stable only all the features are
>>>>> implemented
>>>>>>>>>>> by one or two HW.
>>>>>
>>>>> Yes this is what was decided one or two years ago I think.
>>>>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
>>>>>
>>>>>
>>>>>
>>>>>>>>>> Fair enough, specially if the API is not ready yet.
>>>>>>>>>>
>>>>>>>>>> But they were part of stable ABI, and marking them as experimental
>>>>> now will
>>>>>>>>>> break the old applications using these APIs.
>>>>>>>>>
>>>>>>>>> it is still marked as EXPERIMENTAL everywhere and API is not ready
>>>>> yet.
>>>>>
>>>>> rte_tm is implemented in 6 PMDs.
>>>>>
>>>>>
>>>>>>>> Existing experimental marks are text only for human parsing.
>>>>>>>>
>>>>>>>> The compiler attribute and build time checks are missing, and the
>>>>> symbol in the
>>>>>>>> binary doesn't have experimental tag. Our scripts and automated
>>>>> checks won't
>>>>>>>> detect it as experimental.
>>>>>>>>
>>>>>>>> My point is just having experimental comment in header file is not
>>>>> enough to
>>>>>>>> qualify the APIs as experimental.
>>>>>>>>
>>>>>>>>> Anyway, we need to break the ABI to make it work on various HW.
>>>>>
>>>>> Yes this is why I was asking in 19.11 to check our API,
>>>>> in order to avoid such situation.
>>>>>
>>>>>
>>>>>>>>> I am not sure what to do?
>>>>>
>>>>> Either manage ABI versioning, or wait 20.11.
>>>>>
>>>>>
>>>>>>>>> IMO, We need to send a patch as Fixes: for the bug of not adding
>>>>>>>>> __rte_experimental in each function.
>>>>>
>>>>> No, this is wrong.
>>>>>
>>>>
>>>> Why exactly is this wrong? This is the gap that caused the current discussion, right?
>>>>
>>> It's wrong for this release, since we can't change things from stable back
>>> to experimental. Any such patch will have to wait for 20.11, as agreed in
>>> the discussion.
>>>
>>
>> Deferring the patchet for this release.
>>
>> Reminder that if the option "to mark rte_tm_* as experimental in v20.11"
>> selected, requires deprecation notice before v20.11.
> 
> Thanks Ferruh for reminder. I'll send a deprecation notice patch for the same.
> 

Hi Nithin Kumar, Cristian, Jerin,

Who is working on updating APIs as experimental? We need that patch to proceed
with this one.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-08-25 16:59                                 ` Ferruh Yigit
@ 2020-09-07 11:12                                   ` Nithin Dabilpuram
  2020-09-14 13:01                                     ` Ferruh Yigit
  0 siblings, 1 reply; 60+ messages in thread
From: Nithin Dabilpuram @ 2020-09-07 11:12 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Dumitrescu, Cristian, jerinj, Bruce Richardson, Thomas Monjalon,
	Jerin Jacob, Luca Boccassi, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, kkanas, Kinsella, Ray, Neil Horman,
	Kevin Traynor, David Marchand

On Tue, Aug 25, 2020 at 05:59:10PM +0100, Ferruh Yigit wrote:
> On 5/1/2020 2:16 PM, Nithin Dabilpuram wrote:
> > On Fri, May 01, 2020 at 11:27:02AM +0100, Ferruh Yigit wrote:
> >> External Email
> >>
> >> ----------------------------------------------------------------------
> >> On 4/29/2020 10:03 AM, Bruce Richardson wrote:
> >>> On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
> >>>>
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: Thomas Monjalon <thomas@monjalon.net>
> >>>>> Sent: Tuesday, April 28, 2020 4:54 PM
> >>>>> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
> >>>>> <cristian.dumitrescu@intel.com>
> >>>>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
> >>>>> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
> >>>>> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
> >>>>> <jasvinder.singh@intel.com>; Andrew Rybchenko
> >>>>> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
> >>>>> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
> >>>>> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
> >>>>> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
> >>>>> Marchand <david.marchand@redhat.com>
> >>>>> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
> >>>>> config in pkt mode
> >>>>>
> >>>>> 28/04/2020 17:04, Luca Boccassi:
> >>>>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
> >>>>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
> >>>>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
> >>>>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
> >>>>> <ferruh.yigit@intel.com> wrote:
> >>>>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
> >>>>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
> >>>>> <ferruh.yigit@intel.com> wrote:
> >>>>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
> >>>>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> >>>>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
> >>>>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
> >>>>>>>>>>>>>>>> This patch also updates tm port/level/node capability
> >>>>> structures with
> >>>>>>>>>>>>>>>> exiting features of scheduler wfq packet mode,
> >>>>> scheduler wfq byte mode
> >>>>>>>>>>>>>>>> and private/shared shaper byte mode.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
> >>>>> [...]
> >>>>>>>>>>>>>> Hi Nithin,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following
> >>>>> warning [1],
> >>>>>>>>>>>>>> can you please check?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=ej5sP3-cEhEoCTZOia-QivXqgljtzBcMLtZGs-5c-Uc&s=B8z_5mQ2xO3C1izjmRe2zBApMrCUcW6KcAN-adglhJQ&e= 
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Hi Ferruh,
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> The RTE_TM API is marked as experimental,
> >>>>>>>>>>>>> but it looks that this was not correctly marked
> >>>>>>>>>>>>> when __rte_experimental ABI checker was introduced.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
> >>>>>>>>>>>>> similarly to other APIs introduced around same time,
> >>>>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
> >>>>>>>>>>>>> when later introduced, so __rte_experimental was not added
> >>>>> to every function.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>> :(
> >>>>>>>>>>>>
> >>>>>>>>>>>> Is it time to mature them?
> >>>>>>>>>>>>
> >>>>>>>>>>>> As you said they are not marked as experimental both in header
> >>>>> file (function
> >>>>>>>>>>>> declarations) and .map file.
> >>>>>>>>>>>>
> >>>>>>>>>>>> The problem is, they are not marked as experimental in
> >>>>> DPDK_20.0 ABI (v19.11),
> >>>>>>>>>>>> so marking them as experimental now will break the ABI. Not
> >>>>> sure what to do,
> >>>>>>>>>>>> cc'ed a few ABI related names for comment.
> >>>>>>>>>>>>
> >>>>>>>>>>>> For me, we need to proceed as the experimental tag removed
> >>>>> and APIs become
> >>>>>>>>>>>> mature starting from v19.11, since this is what happened in
> >>>>> practice, and remove
> >>>>>>>>>>>> a few existing being experimental references in the doxygen
> >>>>> comments.
> >>>>>>>>>>>
> >>>>>>>>>>> I think, accidentally we can not make a library as NON-
> >>>>> experimental.
> >>>>>>>>>>> TM never went through experimental to mature transition(see git
> >>>>> log
> >>>>>>>>>>> lib/librte_ethdev/rte_tm.h)
> >>>>>>>>>>> It was a bug to not mark as experimental in each function in the
> >>>>> ABI process.
> >>>>>>>>>>> Some of the features like packet marking are not even
> >>>>> implemented by any HW.
> >>>>>>>>>>> I think, we can make API stable only all the features are
> >>>>> implemented
> >>>>>>>>>>> by one or two HW.
> >>>>>
> >>>>> Yes this is what was decided one or two years ago I think.
> >>>>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>>> Fair enough, specially if the API is not ready yet.
> >>>>>>>>>>
> >>>>>>>>>> But they were part of stable ABI, and marking them as experimental
> >>>>> now will
> >>>>>>>>>> break the old applications using these APIs.
> >>>>>>>>>
> >>>>>>>>> it is still marked as EXPERIMENTAL everywhere and API is not ready
> >>>>> yet.
> >>>>>
> >>>>> rte_tm is implemented in 6 PMDs.
> >>>>>
> >>>>>
> >>>>>>>> Existing experimental marks are text only for human parsing.
> >>>>>>>>
> >>>>>>>> The compiler attribute and build time checks are missing, and the
> >>>>> symbol in the
> >>>>>>>> binary doesn't have experimental tag. Our scripts and automated
> >>>>> checks won't
> >>>>>>>> detect it as experimental.
> >>>>>>>>
> >>>>>>>> My point is just having experimental comment in header file is not
> >>>>> enough to
> >>>>>>>> qualify the APIs as experimental.
> >>>>>>>>
> >>>>>>>>> Anyway, we need to break the ABI to make it work on various HW.
> >>>>>
> >>>>> Yes this is why I was asking in 19.11 to check our API,
> >>>>> in order to avoid such situation.
> >>>>>
> >>>>>
> >>>>>>>>> I am not sure what to do?
> >>>>>
> >>>>> Either manage ABI versioning, or wait 20.11.
> >>>>>
> >>>>>
> >>>>>>>>> IMO, We need to send a patch as Fixes: for the bug of not adding
> >>>>>>>>> __rte_experimental in each function.
> >>>>>
> >>>>> No, this is wrong.
> >>>>>
> >>>>
> >>>> Why exactly is this wrong? This is the gap that caused the current discussion, right?
> >>>>
> >>> It's wrong for this release, since we can't change things from stable back
> >>> to experimental. Any such patch will have to wait for 20.11, as agreed in
> >>> the discussion.
> >>>
> >>
> >> Deferring the patchet for this release.
> >>
> >> Reminder that if the option "to mark rte_tm_* as experimental in v20.11"
> >> selected, requires deprecation notice before v20.11.
> > 
> > Thanks Ferruh for reminder. I'll send a deprecation notice patch for the same.
> > 
> 
> Hi Nithin Kumar, Cristian, Jerin,
> 
> Who is working on updating APIs as experimental? We need that patch to proceed
> with this one.

Hi Ferruh,

I'll send out a patch marking all TM API's experimental.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/4] ethdev: add tm support for shaper config in pkt mode
  2020-09-07 11:12                                   ` Nithin Dabilpuram
@ 2020-09-14 13:01                                     ` Ferruh Yigit
  0 siblings, 0 replies; 60+ messages in thread
From: Ferruh Yigit @ 2020-09-14 13:01 UTC (permalink / raw)
  To: Nithin Dabilpuram
  Cc: Dumitrescu, Cristian, jerinj, Bruce Richardson, Thomas Monjalon,
	Jerin Jacob, Luca Boccassi, Nithin Dabilpuram, Singh, Jasvinder,
	Andrew Rybchenko, dev, kkanas, Kinsella, Ray, Neil Horman,
	Kevin Traynor, David Marchand

On 9/7/2020 12:12 PM, Nithin Dabilpuram wrote:
> On Tue, Aug 25, 2020 at 05:59:10PM +0100, Ferruh Yigit wrote:
>> On 5/1/2020 2:16 PM, Nithin Dabilpuram wrote:
>>> On Fri, May 01, 2020 at 11:27:02AM +0100, Ferruh Yigit wrote:
>>>> External Email
>>>>
>>>> ----------------------------------------------------------------------
>>>> On 4/29/2020 10:03 AM, Bruce Richardson wrote:
>>>>> On Wed, Apr 29, 2020 at 09:45:44AM +0100, Dumitrescu, Cristian wrote:
>>>>>>
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Thomas Monjalon <thomas@monjalon.net>
>>>>>>> Sent: Tuesday, April 28, 2020 4:54 PM
>>>>>>> To: Jerin Jacob <jerinjacobk@gmail.com>; Dumitrescu, Cristian
>>>>>>> <cristian.dumitrescu@intel.com>
>>>>>>> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Yigit, Ferruh
>>>>>>> <ferruh.yigit@intel.com>; Luca Boccassi <bluca@debian.org>; Nithin
>>>>>>> Dabilpuram <nithind1988@gmail.com>; Singh, Jasvinder
>>>>>>> <jasvinder.singh@intel.com>; Andrew Rybchenko
>>>>>>> <arybchenko@solarflare.com>; dev@dpdk.org; jerinj@marvell.com;
>>>>>>> kkanas@marvell.com; Nithin Dabilpuram <ndabilpuram@marvell.com>;
>>>>>>> Kinsella, Ray <ray.kinsella@intel.com>; Neil Horman
>>>>>>> <nhorman@tuxdriver.com>; Kevin Traynor <ktraynor@redhat.com>; David
>>>>>>> Marchand <david.marchand@redhat.com>
>>>>>>> Subject: Re: [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper
>>>>>>> config in pkt mode
>>>>>>>
>>>>>>> 28/04/2020 17:04, Luca Boccassi:
>>>>>>>> On Tue, 2020-04-28 at 15:45 +0100, Bruce Richardson wrote:
>>>>>>>>> On Tue, Apr 28, 2020 at 03:06:20PM +0100, Ferruh Yigit wrote:
>>>>>>>>>> On 4/27/2020 5:59 PM, Jerin Jacob wrote:
>>>>>>>>>>> On Mon, Apr 27, 2020 at 10:19 PM Ferruh Yigit
>>>>>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>>>>>> On 4/27/2020 5:29 PM, Jerin Jacob wrote:
>>>>>>>>>>>>> On Mon, Apr 27, 2020 at 9:42 PM Ferruh Yigit
>>>>>>> <ferruh.yigit@intel.com> wrote:
>>>>>>>>>>>>>> On 4/27/2020 10:19 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>>>>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>>>>>>>>>>>>>>>> On 4/24/2020 11:28 AM, Dumitrescu, Cristian wrote:
>>>>>>>>>>>>>>>>> From: Nithin Dabilpuram <nithind1988@gmail.com>
>>>>>>>>>>>>>>>>>> This patch also updates tm port/level/node capability
>>>>>>> structures with
>>>>>>>>>>>>>>>>>> exiting features of scheduler wfq packet mode,
>>>>>>> scheduler wfq byte mode
>>>>>>>>>>>>>>>>>> and private/shared shaper byte mode.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> SoftNIC PMD is also updated with new capabilities.
>>>>>>> [...]
>>>>>>>>>>>>>>>> Hi Nithin,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> It looks like patch is causing ABI break, I am getting following
>>>>>>> warning [1],
>>>>>>>>>>>>>>>> can you please check?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_XYNFg14u&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=FZ_tPCbgFOh18zwRPO9H0yDx8VW38vuapifdDfc8SFQ&m=ej5sP3-cEhEoCTZOia-QivXqgljtzBcMLtZGs-5c-Uc&s=B8z_5mQ2xO3C1izjmRe2zBApMrCUcW6KcAN-adglhJQ&e= 
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi Ferruh,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The RTE_TM API is marked as experimental,
>>>>>>>>>>>>>>> but it looks that this was not correctly marked
>>>>>>>>>>>>>>> when __rte_experimental ABI checker was introduced.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> It is marked as experimental at the top of the rte_tm.h,
>>>>>>>>>>>>>>> similarly to other APIs introduced around same time,
>>>>>>>>>>>>>>> but it was not correctly picked up by the ABI check procedure
>>>>>>>>>>>>>>> when later introduced, so __rte_experimental was not added
>>>>>>> to every function.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> :(
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Is it time to mature them?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> As you said they are not marked as experimental both in header
>>>>>>> file (function
>>>>>>>>>>>>>> declarations) and .map file.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The problem is, they are not marked as experimental in
>>>>>>> DPDK_20.0 ABI (v19.11),
>>>>>>>>>>>>>> so marking them as experimental now will break the ABI. Not
>>>>>>> sure what to do,
>>>>>>>>>>>>>> cc'ed a few ABI related names for comment.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> For me, we need to proceed as the experimental tag removed
>>>>>>> and APIs become
>>>>>>>>>>>>>> mature starting from v19.11, since this is what happened in
>>>>>>> practice, and remove
>>>>>>>>>>>>>> a few existing being experimental references in the doxygen
>>>>>>> comments.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think, accidentally we can not make a library as NON-
>>>>>>> experimental.
>>>>>>>>>>>>> TM never went through experimental to mature transition(see git
>>>>>>> log
>>>>>>>>>>>>> lib/librte_ethdev/rte_tm.h)
>>>>>>>>>>>>> It was a bug to not mark as experimental in each function in the
>>>>>>> ABI process.
>>>>>>>>>>>>> Some of the features like packet marking are not even
>>>>>>> implemented by any HW.
>>>>>>>>>>>>> I think, we can make API stable only all the features are
>>>>>>> implemented
>>>>>>>>>>>>> by one or two HW.
>>>>>>>
>>>>>>> Yes this is what was decided one or two years ago I think.
>>>>>>> But rte_tm API was introduced 3 years ago and is implemented by 6 PMDs.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>>>>> Fair enough, specially if the API is not ready yet.
>>>>>>>>>>>>
>>>>>>>>>>>> But they were part of stable ABI, and marking them as experimental
>>>>>>> now will
>>>>>>>>>>>> break the old applications using these APIs.
>>>>>>>>>>>
>>>>>>>>>>> it is still marked as EXPERIMENTAL everywhere and API is not ready
>>>>>>> yet.
>>>>>>>
>>>>>>> rte_tm is implemented in 6 PMDs.
>>>>>>>
>>>>>>>
>>>>>>>>>> Existing experimental marks are text only for human parsing.
>>>>>>>>>>
>>>>>>>>>> The compiler attribute and build time checks are missing, and the
>>>>>>> symbol in the
>>>>>>>>>> binary doesn't have experimental tag. Our scripts and automated
>>>>>>> checks won't
>>>>>>>>>> detect it as experimental.
>>>>>>>>>>
>>>>>>>>>> My point is just having experimental comment in header file is not
>>>>>>> enough to
>>>>>>>>>> qualify the APIs as experimental.
>>>>>>>>>>
>>>>>>>>>>> Anyway, we need to break the ABI to make it work on various HW.
>>>>>>>
>>>>>>> Yes this is why I was asking in 19.11 to check our API,
>>>>>>> in order to avoid such situation.
>>>>>>>
>>>>>>>
>>>>>>>>>>> I am not sure what to do?
>>>>>>>
>>>>>>> Either manage ABI versioning, or wait 20.11.
>>>>>>>
>>>>>>>
>>>>>>>>>>> IMO, We need to send a patch as Fixes: for the bug of not adding
>>>>>>>>>>> __rte_experimental in each function.
>>>>>>>
>>>>>>> No, this is wrong.
>>>>>>>
>>>>>>
>>>>>> Why exactly is this wrong? This is the gap that caused the current discussion, right?
>>>>>>
>>>>> It's wrong for this release, since we can't change things from stable back
>>>>> to experimental. Any such patch will have to wait for 20.11, as agreed in
>>>>> the discussion.
>>>>>
>>>>
>>>> Deferring the patchet for this release.
>>>>
>>>> Reminder that if the option "to mark rte_tm_* as experimental in v20.11"
>>>> selected, requires deprecation notice before v20.11.
>>>
>>> Thanks Ferruh for reminder. I'll send a deprecation notice patch for the same.
>>>
>>
>> Hi Nithin Kumar, Cristian, Jerin,
>>
>> Who is working on updating APIs as experimental? We need that patch to proceed
>> with this one.
> 
> Hi Ferruh,
> 
> I'll send out a patch marking all TM API's experimental.
> 

The experimental API change is done & applied,
hence for this series:

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2020-09-14 13:02 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 16:00 [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
2020-03-30 16:00 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add tm non leaf node pktmode command Nithin Dabilpuram
2020-04-07  7:30 ` [dpdk-dev] [PATCH 1/2] ethdev: add tm cap for private shaper packet mode Nithin Dabilpuram
2020-04-07 16:31 ` Dumitrescu, Cristian
2020-04-07 17:21   ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-10 11:45     ` Dumitrescu, Cristian
2020-04-10 11:56       ` Nithin Dabilpuram
2020-04-11 11:44 ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in pkt mode Nithin Dabilpuram
2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
2020-04-11 11:44   ` [dpdk-dev] [PATCH v2 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
2020-04-16 13:48   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add tm support for shaper config in " Ferruh Yigit
2020-04-21  5:11     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-21  9:30   ` [dpdk-dev] " Dumitrescu, Cristian
2020-04-21  9:58     ` Nithin Dabilpuram
2020-04-21 10:23       ` Dumitrescu, Cristian
2020-04-21 11:55         ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-22  7:59 ` [dpdk-dev] [PATCH v3] " Nithin Dabilpuram
2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
2020-04-22  7:59   ` [dpdk-dev] [PATCH v3 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
2020-04-22  8:09   ` [dpdk-dev] [PATCH v3] ethdev: add tm support for shaper config in " Nithin Dabilpuram
2020-04-22 12:18     ` Singh, Jasvinder
2020-04-22 17:21       ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-22 10:10   ` [dpdk-dev] " Dumitrescu, Cristian
2020-04-22 11:31     ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-22 11:49       ` Nithin Dabilpuram
2020-04-22 11:59         ` Dumitrescu, Cristian
2020-04-22 12:01       ` Dumitrescu, Cristian
2020-04-22  8:05 ` [dpdk-dev] [PATCH v3 1/4] " Nithin Dabilpuram
2020-04-22 17:21 ` [dpdk-dev] [PATCH v4 " Nithin Dabilpuram
2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 2/4] drivers/net: update tm capability for existing pmds Nithin Dabilpuram
2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: add tm cmd for non leaf and shaper pktmode Nithin Dabilpuram
2020-04-22 17:21   ` [dpdk-dev] [PATCH v4 4/4] net/octeontx2: support tm length adjust and pkt mode Nithin Dabilpuram
2020-04-24 10:28   ` [dpdk-dev] [PATCH v4 1/4] ethdev: add tm support for shaper config in " Dumitrescu, Cristian
2020-04-25 20:09     ` Ferruh Yigit
2020-04-27  9:19       ` Dumitrescu, Cristian
2020-04-27 16:12         ` Ferruh Yigit
2020-04-27 16:28           ` Dumitrescu, Cristian
2020-04-28 15:30             ` Thomas Monjalon
2020-04-28 17:35               ` Dumitrescu, Cristian
2020-04-27 16:29           ` Jerin Jacob
2020-04-27 16:49             ` Ferruh Yigit
2020-04-27 16:59               ` Jerin Jacob
2020-04-28 11:51                 ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-04-28 13:56                   ` Ferruh Yigit
2020-04-28 14:06                 ` [dpdk-dev] " Ferruh Yigit
2020-04-28 14:45                   ` Bruce Richardson
2020-04-28 15:04                     ` Luca Boccassi
2020-04-28 15:54                       ` Thomas Monjalon
2020-04-29  8:45                         ` Dumitrescu, Cristian
2020-04-29  9:03                           ` Bruce Richardson
2020-05-01 10:27                             ` Ferruh Yigit
2020-05-01 13:16                               ` [dpdk-dev] [EXT] " Nithin Dabilpuram
2020-08-25 16:59                                 ` Ferruh Yigit
2020-09-07 11:12                                   ` Nithin Dabilpuram
2020-09-14 13:01                                     ` Ferruh Yigit
2020-05-01 13:18                         ` [dpdk-dev] " Jerin Jacob
2020-05-05  8:01                           ` Ray Kinsella
2020-04-28 15:42                     ` Ray Kinsella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).