DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] add support for querying ethdev TM nodes
@ 2024-10-08 10:53 Bruce Richardson
  2024-10-08 10:53 ` [PATCH 1/3] ethdev: add traffic manager query function Bruce Richardson
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 10:53 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Add support for an ethdev TM query function to allow apps to get details
of the TM nodes they previously configured. This patchset includes:

* ethdev changes to add the API
* implementation of the function in "ice" pmd
* testpmd command to allow testing the function

Bruce Richardson (3):
  ethdev: add traffic manager query function
  net/ice: add traffic management node query function
  app/testpmd: add support for querying TM nodes

 app/test-pmd/cmdline.c           |  1 +
 app/test-pmd/cmdline_tm.c        | 90 ++++++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h        |  1 +
 drivers/net/ice/ice_tm.c         | 52 ++++++++++++++++++
 lib/ethdev/ethdev_trace.h        | 16 ++++++
 lib/ethdev/ethdev_trace_points.c |  3 ++
 lib/ethdev/rte_tm.c              | 25 +++++++++
 lib/ethdev/rte_tm.h              | 50 ++++++++++++++++++
 lib/ethdev/rte_tm_driver.h       | 12 +++++
 lib/ethdev/version.map           |  3 ++
 10 files changed, 253 insertions(+)

--
2.43.0


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

* [PATCH 1/3] ethdev: add traffic manager query function
  2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
@ 2024-10-08 10:53 ` Bruce Richardson
  2024-10-08 10:53 ` [PATCH 2/3] net/ice: add traffic management node " Bruce Richardson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 10:53 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Bruce Richardson, Thomas Monjalon,
	Andrew Rybchenko, Cristian Dumitrescu

Add function to allow querying a node in the scheduler tree.  Returns
the parameters as were given to the add function. Adding this function
allows apps to just query the hierarchy rather than having to maintain
their own copies of it internally.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/ethdev/ethdev_trace.h        | 16 ++++++++++
 lib/ethdev/ethdev_trace_points.c |  3 ++
 lib/ethdev/rte_tm.c              | 25 ++++++++++++++++
 lib/ethdev/rte_tm.h              | 50 ++++++++++++++++++++++++++++++++
 lib/ethdev/rte_tm_driver.h       | 12 ++++++++
 lib/ethdev/version.map           |  3 ++
 6 files changed, 109 insertions(+)

diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
index 3bec87bfdb..dee2819531 100644
--- a/lib/ethdev/ethdev_trace.h
+++ b/lib/ethdev/ethdev_trace.h
@@ -1903,6 +1903,22 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_tm_trace_node_query,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params, int ret),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(node_id);
+	rte_trace_point_emit_ptr(parent_node_id);
+	rte_trace_point_emit_ptr(priority);
+	rte_trace_point_emit_ptr(weight);
+	rte_trace_point_emit_ptr(level_id);
+	rte_trace_point_emit_ptr(params);
+	rte_trace_point_emit_int(ret);
+)
+
 RTE_TRACE_POINT(
 	rte_tm_trace_node_delete,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret),
diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c
index 99e04f5893..f5ed7ca637 100644
--- a/lib/ethdev/ethdev_trace_points.c
+++ b/lib/ethdev/ethdev_trace_points.c
@@ -694,6 +694,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei,
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add,
 	lib.ethdev.tm.node_add)
 
+RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query,
+	lib.ethdev.tm.node_query)
+
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get,
 	lib.ethdev.tm.node_capabilities_get)
 
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index 3eb98e618a..8000b66af9 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -301,6 +301,31 @@ int rte_tm_node_add(uint16_t port_id,
 	return ret;
 }
 
+int rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	int ret;
+
+	if (dev == NULL)
+		return -EINVAL;
+
+	ret = RTE_TM_FUNC(port_id, node_query)(dev,
+		node_id, parent_node_id, priority, weight, level_id,
+		params, error);
+
+	rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority,
+			      weight, level_id, params, ret);
+
+	return ret;
+}
+
 /* Delete node from traffic manager hierarchy */
 int rte_tm_node_delete(uint16_t port_id,
 	uint32_t node_id,
diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h
index e5da9b8323..852c3485a7 100644
--- a/lib/ethdev/rte_tm.h
+++ b/lib/ethdev/rte_tm.h
@@ -20,6 +20,7 @@
 
 #include <rte_common.h>
 #include <rte_meter.h>
+#include <rte_compat.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1599,6 +1600,55 @@ rte_tm_node_add(uint16_t port_id,
 	const struct rte_tm_node_params *params,
 	struct rte_tm_error *error);
 
+/**
+ * Return information about a traffic management node
+ *
+ * Return information about a hierarchy node, using the same format of parameters
+ * as was passed to the rte_rm_node_add() function.
+ * Each of the "out" parameters pointers (except error) may be passed as NULL if the
+ * information is not needed by the caller. For example, to one may check if a node id
+ * is in use by:
+ *
+ *  struct rte_tm_error error;
+ *  int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error);
+ *  if (ret == ENOENT) ...
+ *
+ * @param[in] port_id
+ *   The port identifier of the Ethernet device.
+ * @param[in] node_id
+ *   Node ID. Should be a valid node id.
+ * @param[out] parent_node_id
+ *   Parent node ID.
+ * @param[out] priority
+ *   Node priority. The highest node priority is zero. Used by the SP algorithm
+ *   running on the parent of the current node for scheduling this child node.
+ * @param[out] weight
+ *   Node weight. The node weight is relative to the weight sum of all siblings
+ *   that have the same priority. The lowest weight is one. Used by the WFQ
+ *   algorithm running on the parent of the current node for scheduling this
+ *   child node.
+ * @param[out] level_id
+ *   The node level in the scheduler hierarchy.
+ * @param[out] params
+ *   Node parameters, as would be used when creating the node.
+ * @param[out] error
+ *   Error details. Filled in only on error, when not NULL.
+ * @return
+ *   0 on success, non-zero error code otherwise.
+ *   -EINVAL - port or node id value is invalid
+ *   -ENOENT - no node exists with the provided id
+ */
+__rte_experimental
+int
+rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /**
  * Traffic manager node delete
  *
diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h
index 6c2618c0d8..fc67f1cb4b 100644
--- a/lib/ethdev/rte_tm_driver.h
+++ b/lib/ethdev/rte_tm_driver.h
@@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
 	uint32_t node_id,
 	struct rte_tm_error *error);
 
+/** @internal Traffic manager node query */
+typedef int (*rte_tm_node_query_t)(const struct rte_eth_dev *dev,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /** @internal Traffic manager hierarchy commit */
 typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
 	int clear_on_fail,
@@ -248,6 +258,8 @@ struct rte_tm_ops {
 	rte_tm_node_suspend_t node_suspend;
 	/** Traffic manager node resume */
 	rte_tm_node_resume_t node_resume;
+	/** Traffic manager node resume */
+	rte_tm_node_query_t node_query;
 	/** Traffic manager hierarchy commit */
 	rte_tm_hierarchy_commit_t hierarchy_commit;
 
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 1669055ca5..9b180a330d 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -325,6 +325,9 @@ EXPERIMENTAL {
 	rte_flow_template_table_resizable;
 	rte_flow_template_table_resize;
 	rte_flow_template_table_resize_complete;
+
+	# added in 24.11
+	rte_tm_node_query;
 };
 
 INTERNAL {
-- 
2.43.0


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

* [PATCH 2/3] net/ice: add traffic management node query function
  2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
  2024-10-08 10:53 ` [PATCH 1/3] ethdev: add traffic manager query function Bruce Richardson
@ 2024-10-08 10:53 ` Bruce Richardson
  2024-10-08 10:53 ` [PATCH 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 10:53 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Implement the new node querying function for the "ice" net driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ice/ice_tm.c | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 8a29a9e744..636ab77f26 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -17,6 +17,11 @@ static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t weight, uint32_t level_id,
 	      const struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
+static int ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error);
 static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
 static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
@@ -35,6 +40,7 @@ const struct rte_tm_ops ice_tm_ops = {
 	.node_add = ice_tm_node_add,
 	.node_delete = ice_tm_node_delete,
 	.node_type_get = ice_node_type_get,
+	.node_query = ice_node_query,
 	.hierarchy_commit = ice_hierarchy_commit,
 };
 
@@ -219,6 +225,52 @@ ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
 	return 0;
 }
 
+static int
+ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_tm_node *tm_node;
+
+	if (node_id == RTE_TM_NODE_ID_NULL) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "invalid node id";
+		return -EINVAL;
+	}
+
+	/* check if the node id exists */
+	tm_node = find_node(pf->tm_conf.root, node_id);
+	if (!tm_node) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "no such node";
+		return -EEXIST;
+	}
+
+	if (parent_node_id != NULL) {
+		if (tm_node->parent != NULL)
+			*parent_node_id = tm_node->parent->id;
+		else
+			*parent_node_id = RTE_TM_NODE_ID_NULL;
+	}
+
+	if (priority != NULL)
+		*priority = tm_node->priority;
+
+	if (weight != NULL)
+		*weight = tm_node->weight;
+
+	if (level_id != NULL)
+		*level_id = tm_node->level;
+
+	if (params != NULL)
+		*params = tm_node->params;
+
+	return 0;
+}
+
 static inline struct ice_tm_shaper_profile *
 ice_shaper_profile_search(struct rte_eth_dev *dev,
 			   uint32_t shaper_profile_id)
-- 
2.43.0


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

* [PATCH 3/3] app/testpmd: add support for querying TM nodes
  2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
  2024-10-08 10:53 ` [PATCH 1/3] ethdev: add traffic manager query function Bruce Richardson
  2024-10-08 10:53 ` [PATCH 2/3] net/ice: add traffic management node " Bruce Richardson
@ 2024-10-08 10:53 ` Bruce Richardson
  2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
  4 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 10:53 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson, Aman Singh, Cristian Dumitrescu

Support use of the rte_tm_node_query API to print out details about
previously added TM nodes in testpmd.

Example output, configuring three nodes, and then printing the details:

testpmd> add port tm nonleaf node 0 100 -1 0 1 0 -1 1 0 0
testpmd> add port tm nonleaf node 0 90 100 0 1 1 -1 1 0 0
testpmd> add port tm leaf node    0 0   90 0 1 2 -1 0 0xffffffff 0 0
testpmd>
testpmd> show port tm node 0 100
Port 0 TM Node 100
  Parent Node ID: <NULL>
  Level ID: 0
  Priority: 0
  Weight: 0
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 90
Port 0 TM Node 90
  Parent Node ID: 100
  Level ID: 1
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 0
Port 0 TM Node 0
  Parent Node ID: 90
  Level ID: 2
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Leaf Node Parameters
    CMAN Mode: Tail Drop
    WRED Profile ID: <none>
    Shared WRED Context Ids: <none>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c    |   1 +
 app/test-pmd/cmdline_tm.c | 131 ++++++++++++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h |   1 +
 3 files changed, 133 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b7759e38a8..2fbadf1a4d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -13327,6 +13327,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_set_port_ptypes,
 	(cmdline_parse_inst_t *)&cmd_show_port_tm_cap,
 	(cmdline_parse_inst_t *)&cmd_show_port_tm_level_cap,
+	(cmdline_parse_inst_t *)&cmd_show_port_tm_node,
 	(cmdline_parse_inst_t *)&cmd_show_port_tm_node_cap,
 	(cmdline_parse_inst_t *)&cmd_show_port_tm_node_type,
 	(cmdline_parse_inst_t *)&cmd_show_port_tm_node_stats,
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 6ce074f538..287ae7a489 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -2057,6 +2057,137 @@ cmdline_parse_inst_t cmd_add_port_tm_leaf_node = {
 	},
 };
 
+struct cmd_show_port_tm_node_result {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t tm;
+	cmdline_fixed_string_t node;
+	uint16_t port_id;
+	uint32_t node_id;
+};
+
+static cmdline_parse_token_string_t cmd_show_port_tm_node_show_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, show, "show");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_port_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, port, "port");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_tm_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, tm, "tm");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_node_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, node, "node");
+static cmdline_parse_token_num_t cmd_show_port_tm_node_port_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_show_port_tm_node_node_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, node_id, RTE_UINT32);
+
+static void
+cmd_show_port_tm_node_parsed(void *parsed_result, struct cmdline *cl, void *data __rte_unused)
+{
+	const struct cmd_show_port_tm_node_result *res = parsed_result;
+	const portid_t port_id = res->port_id;
+	const uint32_t node_id = res->node_id;
+	struct rte_tm_node_params params = {0};
+	struct rte_tm_error error = {0};
+	uint32_t parent_id, priority, weight, level_id;
+	int is_leaf;
+	int ret;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_tm_node_query(port_id, node_id,
+			&parent_id, &priority, &weight, &level_id, &params, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	cmdline_printf(cl, "Port %u TM Node %u\n", port_id, node_id);
+	if (parent_id == RTE_TM_NODE_ID_NULL)
+		cmdline_printf(cl, "  Parent Node ID: <NULL>\n");
+	else
+		cmdline_printf(cl, "  Parent Node ID: %d\n", parent_id);
+	cmdline_printf(cl, "  Level ID: %u\n", level_id);
+	cmdline_printf(cl, "  Priority: %u\n", priority);
+	cmdline_printf(cl, "  Weight: %u\n", weight);
+	if (params.shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE)
+		cmdline_printf(cl, "  Shaper Profile ID: <none>\n");
+	else
+		cmdline_printf(cl, "  Shaper Profile ID: %d\n", params.shaper_profile_id);
+	cmdline_printf(cl, "  Shared Shaper IDs: ");
+	if (params.n_shared_shapers == 0)
+		cmdline_printf(cl, "<none>\n");
+	else {
+		for (uint32_t i = 0; i < params.n_shared_shapers; i++)
+			cmdline_printf(cl, "%u ", params.shared_shaper_id[i]);
+		cmdline_printf(cl, "\n");
+	}
+	cmdline_printf(cl, "  Stats Mask: %"PRIu64"\n", params.stats_mask);
+	if (is_leaf) {
+		cmdline_printf(cl, "  Leaf Node Parameters\n");
+		switch (params.leaf.cman) {
+		case RTE_TM_CMAN_TAIL_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Tail Drop\n");
+			break;
+		case RTE_TM_CMAN_HEAD_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Head Drop\n");
+			break;
+		case RTE_TM_CMAN_WRED:
+			cmdline_printf(cl, "    CMAN Mode: WRED\n");
+			break;
+		}
+		if (params.leaf.wred.wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)
+			cmdline_printf(cl, "    WRED Profile ID: <none>\n");
+		else
+			cmdline_printf(cl, "    WRED Profile ID: %u\n",
+					params.leaf.wred.wred_profile_id);
+		cmdline_printf(cl, "    Shared WRED Context Ids: ");
+		if (params.leaf.wred.n_shared_wred_contexts == 0)
+			cmdline_printf(cl, "<none>\n");
+		else {
+			for (uint32_t i = 0; i < params.leaf.wred.n_shared_wred_contexts; i++)
+				cmdline_printf(cl, "%u ",
+						params.leaf.wred.shared_wred_context_id[i]);
+			cmdline_printf(cl, "\n");
+		}
+	} else {
+		cmdline_printf(cl, "  Nonleaf Node Parameters\n");
+		cmdline_printf(cl, "    Num Strict Priorities: %u\n",
+				params.nonleaf.n_sp_priorities);
+		cmdline_printf(cl, "    WFQ Weights Mode: ");
+		if (params.nonleaf.wfq_weight_mode == NULL)
+			cmdline_printf(cl, "WFQ\n");
+		else {
+			for (uint32_t i = 0; i < params.nonleaf.n_sp_priorities; i++)
+				cmdline_printf(cl, "%s(%d) ",
+					params.nonleaf.wfq_weight_mode[i] ? "Bytes" : "Packet",
+					params.nonleaf.wfq_weight_mode[i]);
+			cmdline_printf(cl, "\n");
+		}
+	}
+}
+
+
+cmdline_parse_inst_t cmd_show_port_tm_node = {
+	.f = cmd_show_port_tm_node_parsed,
+	.data = NULL,
+	.help_str = "",
+	.tokens = {
+		(void *)&cmd_show_port_tm_node_show_tok,
+		(void *)&cmd_show_port_tm_node_port_tok,
+		(void *)&cmd_show_port_tm_node_tm_tok,
+		(void *)&cmd_show_port_tm_node_node_tok,
+		(void *)&cmd_show_port_tm_node_port_id_tok,
+		(void *)&cmd_show_port_tm_node_node_id_tok,
+		NULL,
+	}
+};
+
 /* *** Delete Port TM Node *** */
 struct cmd_del_port_tm_node_result {
 	cmdline_fixed_string_t del;
diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h
index e59c15c3cc..4ae5fd072f 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -9,6 +9,7 @@
 extern cmdline_parse_inst_t cmd_show_port_tm_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_level_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_cap;
+extern cmdline_parse_inst_t cmd_show_port_tm_node;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_type;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_stats;
 extern cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile;
-- 
2.43.0


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

* [PATCH v2 0/3] add support for querying ethdev TM nodes
  2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
                   ` (2 preceding siblings ...)
  2024-10-08 10:53 ` [PATCH 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
@ 2024-10-08 14:43 ` Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
                     ` (2 more replies)
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
  4 siblings, 3 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 14:43 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Add support for an ethdev TM query function to allow apps to get details
of the TM nodes they previously configured. This patchset includes:

* ethdev changes to add the API
* implementation of the function in "ice" pmd
* testpmd command to allow testing the function

V2: rebase to the head of next-net tree

Bruce Richardson (3):
  ethdev: add traffic manager query function
  net/ice: add traffic management node query function
  app/testpmd: add support for querying TM nodes

 app/test-pmd/cmdline.c           |   1 +
 app/test-pmd/cmdline_tm.c        | 131 +++++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h        |   1 +
 drivers/net/ice/ice_tm.c         |  52 ++++++++++++
 lib/ethdev/ethdev_trace.h        |  16 ++++
 lib/ethdev/ethdev_trace_points.c |   3 +
 lib/ethdev/rte_tm.c              |  25 ++++++
 lib/ethdev/rte_tm.h              |  50 ++++++++++++
 lib/ethdev/rte_tm_driver.h       |  12 +++
 lib/ethdev/version.map           |   1 +
 10 files changed, 292 insertions(+)

--
2.43.0


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

* [PATCH v2 1/3] ethdev: add traffic manager query function
  2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
@ 2024-10-08 14:43   ` Bruce Richardson
  2024-10-09  0:57     ` fengchengwen
  2024-10-08 14:43   ` [PATCH v2 2/3] net/ice: add traffic management node " Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
  2 siblings, 1 reply; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 14:43 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Add function to allow querying a node in the scheduler tree.  Returns
the parameters as were given to the add function. Adding this function
allows apps to just query the hierarchy rather than having to maintain
their own copies of it internally.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/ethdev/ethdev_trace.h        | 16 ++++++++++
 lib/ethdev/ethdev_trace_points.c |  3 ++
 lib/ethdev/rte_tm.c              | 25 ++++++++++++++++
 lib/ethdev/rte_tm.h              | 50 ++++++++++++++++++++++++++++++++
 lib/ethdev/rte_tm_driver.h       | 12 ++++++++
 lib/ethdev/version.map           |  1 +
 6 files changed, 107 insertions(+)

diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
index 738d9829af..70fd6214fc 100644
--- a/lib/ethdev/ethdev_trace.h
+++ b/lib/ethdev/ethdev_trace.h
@@ -1905,6 +1905,22 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_tm_trace_node_query,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params, int ret),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(node_id);
+	rte_trace_point_emit_ptr(parent_node_id);
+	rte_trace_point_emit_ptr(priority);
+	rte_trace_point_emit_ptr(weight);
+	rte_trace_point_emit_ptr(level_id);
+	rte_trace_point_emit_ptr(params);
+	rte_trace_point_emit_int(ret);
+)
+
 RTE_TRACE_POINT(
 	rte_tm_trace_node_delete,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret),
diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c
index 902e4f7533..eee23613b8 100644
--- a/lib/ethdev/ethdev_trace_points.c
+++ b/lib/ethdev/ethdev_trace_points.c
@@ -706,6 +706,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei,
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add,
 	lib.ethdev.tm.node_add)
 
+RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query,
+	lib.ethdev.tm.node_query)
+
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get,
 	lib.ethdev.tm.node_capabilities_get)
 
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index d594fe0049..9ea140df09 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -301,6 +301,31 @@ int rte_tm_node_add(uint16_t port_id,
 	return ret;
 }
 
+int rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	int ret;
+
+	if (dev == NULL)
+		return -EINVAL;
+
+	ret = RTE_TM_FUNC(port_id, node_query)(dev,
+		node_id, parent_node_id, priority, weight, level_id,
+		params, error);
+
+	rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority,
+			      weight, level_id, params, ret);
+
+	return ret;
+}
+
 /* Delete node from traffic manager hierarchy */
 int rte_tm_node_delete(uint16_t port_id,
 	uint32_t node_id,
diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h
index 07028c9b36..395e9d6d7f 100644
--- a/lib/ethdev/rte_tm.h
+++ b/lib/ethdev/rte_tm.h
@@ -20,6 +20,7 @@
 
 #include <rte_common.h>
 #include <rte_meter.h>
+#include <rte_compat.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1599,6 +1600,55 @@ rte_tm_node_add(uint16_t port_id,
 	struct rte_tm_node_params *params,
 	struct rte_tm_error *error);
 
+/**
+ * Return information about a traffic management node
+ *
+ * Return information about a hierarchy node, using the same format of parameters
+ * as was passed to the rte_rm_node_add() function.
+ * Each of the "out" parameters pointers (except error) may be passed as NULL if the
+ * information is not needed by the caller. For example, to one may check if a node id
+ * is in use by:
+ *
+ *  struct rte_tm_error error;
+ *  int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error);
+ *  if (ret == ENOENT) ...
+ *
+ * @param[in] port_id
+ *   The port identifier of the Ethernet device.
+ * @param[in] node_id
+ *   Node ID. Should be a valid node id.
+ * @param[out] parent_node_id
+ *   Parent node ID.
+ * @param[out] priority
+ *   Node priority. The highest node priority is zero. Used by the SP algorithm
+ *   running on the parent of the current node for scheduling this child node.
+ * @param[out] weight
+ *   Node weight. The node weight is relative to the weight sum of all siblings
+ *   that have the same priority. The lowest weight is one. Used by the WFQ
+ *   algorithm running on the parent of the current node for scheduling this
+ *   child node.
+ * @param[out] level_id
+ *   The node level in the scheduler hierarchy.
+ * @param[out] params
+ *   Node parameters, as would be used when creating the node.
+ * @param[out] error
+ *   Error details. Filled in only on error, when not NULL.
+ * @return
+ *   0 on success, non-zero error code otherwise.
+ *   -EINVAL - port or node id value is invalid
+ *   -ENOENT - no node exists with the provided id
+ */
+__rte_experimental
+int
+rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /**
  * Traffic manager node delete
  *
diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h
index 45290fb3fd..1efb2caaec 100644
--- a/lib/ethdev/rte_tm_driver.h
+++ b/lib/ethdev/rte_tm_driver.h
@@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
 	uint32_t node_id,
 	struct rte_tm_error *error);
 
+/** @internal Traffic manager node query */
+typedef int (*rte_tm_node_query_t)(const struct rte_eth_dev *dev,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /** @internal Traffic manager hierarchy commit */
 typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
 	int clear_on_fail,
@@ -248,6 +258,8 @@ struct rte_tm_ops {
 	rte_tm_node_suspend_t node_suspend;
 	/** Traffic manager node resume */
 	rte_tm_node_resume_t node_resume;
+	/** Traffic manager node resume */
+	rte_tm_node_query_t node_query;
 	/** Traffic manager hierarchy commit */
 	rte_tm_hierarchy_commit_t hierarchy_commit;
 
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index f63dc32aa2..c1a386eddc 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -335,6 +335,7 @@ EXPERIMENTAL {
 	rte_eth_speed_lanes_get_capability;
 	rte_eth_speed_lanes_set;
 	rte_flow_async_create_by_index_with_pattern;
+	rte_tm_node_query;
 };
 
 INTERNAL {
-- 
2.43.0


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

* [PATCH v2 2/3] net/ice: add traffic management node query function
  2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
@ 2024-10-08 14:43   ` Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
  2 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 14:43 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Implement the new node querying function for the "ice" net driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ice/ice_tm.c | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 7239ab53f1..35bc26ad47 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -17,6 +17,11 @@ static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t weight, uint32_t level_id,
 	      struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
+static int ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error);
 static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
 static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
@@ -35,6 +40,7 @@ const struct rte_tm_ops ice_tm_ops = {
 	.node_add = ice_tm_node_add,
 	.node_delete = ice_tm_node_delete,
 	.node_type_get = ice_node_type_get,
+	.node_query = ice_node_query,
 	.hierarchy_commit = ice_hierarchy_commit,
 };
 
@@ -219,6 +225,52 @@ ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
 	return 0;
 }
 
+static int
+ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_tm_node *tm_node;
+
+	if (node_id == RTE_TM_NODE_ID_NULL) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "invalid node id";
+		return -EINVAL;
+	}
+
+	/* check if the node id exists */
+	tm_node = find_node(pf->tm_conf.root, node_id);
+	if (!tm_node) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "no such node";
+		return -EEXIST;
+	}
+
+	if (parent_node_id != NULL) {
+		if (tm_node->parent != NULL)
+			*parent_node_id = tm_node->parent->id;
+		else
+			*parent_node_id = RTE_TM_NODE_ID_NULL;
+	}
+
+	if (priority != NULL)
+		*priority = tm_node->priority;
+
+	if (weight != NULL)
+		*weight = tm_node->weight;
+
+	if (level_id != NULL)
+		*level_id = tm_node->level;
+
+	if (params != NULL)
+		*params = tm_node->params;
+
+	return 0;
+}
+
 static inline struct ice_tm_shaper_profile *
 ice_shaper_profile_search(struct rte_eth_dev *dev,
 			   uint32_t shaper_profile_id)
-- 
2.43.0


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

* [PATCH v2 3/3] app/testpmd: add support for querying TM nodes
  2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
  2024-10-08 14:43   ` [PATCH v2 2/3] net/ice: add traffic management node " Bruce Richardson
@ 2024-10-08 14:43   ` Bruce Richardson
  2024-10-09  1:02     ` fengchengwen
  2 siblings, 1 reply; 20+ messages in thread
From: Bruce Richardson @ 2024-10-08 14:43 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Support use of the rte_tm_node_query API to print out details about
previously added TM nodes in testpmd.

Example output, configuring three nodes, and then printing the details:

testpmd> add port tm nonleaf node 0 100 -1 0 1 0 -1 1 0 0
testpmd> add port tm nonleaf node 0 90 100 0 1 1 -1 1 0 0
testpmd> add port tm leaf node    0 0   90 0 1 2 -1 0 0xffffffff 0 0
testpmd>
testpmd> show port tm node 0 100
Port 0 TM Node 100
  Parent Node ID: <NULL>
  Level ID: 0
  Priority: 0
  Weight: 0
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 90
Port 0 TM Node 90
  Parent Node ID: 100
  Level ID: 1
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 0
Port 0 TM Node 0
  Parent Node ID: 90
  Level ID: 2
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Leaf Node Parameters
    CMAN Mode: Tail Drop
    WRED Profile ID: <none>
    Shared WRED Context Ids: <none>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/cmdline.c    |   1 +
 app/test-pmd/cmdline_tm.c | 131 ++++++++++++++++++++++++++++++++++++++
 app/test-pmd/cmdline_tm.h |   1 +
 3 files changed, 133 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 12d8c00293..6ec1d4e9b5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -13573,6 +13573,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	&cmd_set_port_ptypes,
 	&cmd_show_port_tm_cap,
 	&cmd_show_port_tm_level_cap,
+	&cmd_show_port_tm_node,
 	&cmd_show_port_tm_node_cap,
 	&cmd_show_port_tm_node_type,
 	&cmd_show_port_tm_node_stats,
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index aa917edb6c..7ade91549c 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -2111,6 +2111,137 @@ cmdline_parse_inst_t cmd_add_port_tm_leaf_node = {
 	},
 };
 
+struct cmd_show_port_tm_node_result {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t tm;
+	cmdline_fixed_string_t node;
+	uint16_t port_id;
+	uint32_t node_id;
+};
+
+static cmdline_parse_token_string_t cmd_show_port_tm_node_show_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, show, "show");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_port_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, port, "port");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_tm_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, tm, "tm");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_node_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, node, "node");
+static cmdline_parse_token_num_t cmd_show_port_tm_node_port_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_show_port_tm_node_node_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, node_id, RTE_UINT32);
+
+static void
+cmd_show_port_tm_node_parsed(void *parsed_result, struct cmdline *cl, void *data __rte_unused)
+{
+	const struct cmd_show_port_tm_node_result *res = parsed_result;
+	const portid_t port_id = res->port_id;
+	const uint32_t node_id = res->node_id;
+	struct rte_tm_node_params params = {0};
+	struct rte_tm_error error = {0};
+	uint32_t parent_id, priority, weight, level_id;
+	int is_leaf;
+	int ret;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_tm_node_query(port_id, node_id,
+			&parent_id, &priority, &weight, &level_id, &params, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	cmdline_printf(cl, "Port %u TM Node %u\n", port_id, node_id);
+	if (parent_id == RTE_TM_NODE_ID_NULL)
+		cmdline_printf(cl, "  Parent Node ID: <NULL>\n");
+	else
+		cmdline_printf(cl, "  Parent Node ID: %d\n", parent_id);
+	cmdline_printf(cl, "  Level ID: %u\n", level_id);
+	cmdline_printf(cl, "  Priority: %u\n", priority);
+	cmdline_printf(cl, "  Weight: %u\n", weight);
+	if (params.shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE)
+		cmdline_printf(cl, "  Shaper Profile ID: <none>\n");
+	else
+		cmdline_printf(cl, "  Shaper Profile ID: %d\n", params.shaper_profile_id);
+	cmdline_printf(cl, "  Shared Shaper IDs: ");
+	if (params.n_shared_shapers == 0)
+		cmdline_printf(cl, "<none>\n");
+	else {
+		for (uint32_t i = 0; i < params.n_shared_shapers; i++)
+			cmdline_printf(cl, "%u ", params.shared_shaper_id[i]);
+		cmdline_printf(cl, "\n");
+	}
+	cmdline_printf(cl, "  Stats Mask: %"PRIu64"\n", params.stats_mask);
+	if (is_leaf) {
+		cmdline_printf(cl, "  Leaf Node Parameters\n");
+		switch (params.leaf.cman) {
+		case RTE_TM_CMAN_TAIL_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Tail Drop\n");
+			break;
+		case RTE_TM_CMAN_HEAD_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Head Drop\n");
+			break;
+		case RTE_TM_CMAN_WRED:
+			cmdline_printf(cl, "    CMAN Mode: WRED\n");
+			break;
+		}
+		if (params.leaf.wred.wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)
+			cmdline_printf(cl, "    WRED Profile ID: <none>\n");
+		else
+			cmdline_printf(cl, "    WRED Profile ID: %u\n",
+					params.leaf.wred.wred_profile_id);
+		cmdline_printf(cl, "    Shared WRED Context Ids: ");
+		if (params.leaf.wred.n_shared_wred_contexts == 0)
+			cmdline_printf(cl, "<none>\n");
+		else {
+			for (uint32_t i = 0; i < params.leaf.wred.n_shared_wred_contexts; i++)
+				cmdline_printf(cl, "%u ",
+						params.leaf.wred.shared_wred_context_id[i]);
+			cmdline_printf(cl, "\n");
+		}
+	} else {
+		cmdline_printf(cl, "  Nonleaf Node Parameters\n");
+		cmdline_printf(cl, "    Num Strict Priorities: %u\n",
+				params.nonleaf.n_sp_priorities);
+		cmdline_printf(cl, "    WFQ Weights Mode: ");
+		if (params.nonleaf.wfq_weight_mode == NULL)
+			cmdline_printf(cl, "WFQ\n");
+		else {
+			for (uint32_t i = 0; i < params.nonleaf.n_sp_priorities; i++)
+				cmdline_printf(cl, "%s(%d) ",
+					params.nonleaf.wfq_weight_mode[i] ? "Bytes" : "Packet",
+					params.nonleaf.wfq_weight_mode[i]);
+			cmdline_printf(cl, "\n");
+		}
+	}
+}
+
+
+cmdline_parse_inst_t cmd_show_port_tm_node = {
+	.f = cmd_show_port_tm_node_parsed,
+	.data = NULL,
+	.help_str = "",
+	.tokens = {
+		(void *)&cmd_show_port_tm_node_show_tok,
+		(void *)&cmd_show_port_tm_node_port_tok,
+		(void *)&cmd_show_port_tm_node_tm_tok,
+		(void *)&cmd_show_port_tm_node_node_tok,
+		(void *)&cmd_show_port_tm_node_port_id_tok,
+		(void *)&cmd_show_port_tm_node_node_id_tok,
+		NULL,
+	}
+};
+
 /* *** Delete Port TM Node *** */
 struct cmd_del_port_tm_node_result {
 	cmdline_fixed_string_t del;
diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h
index e59c15c3cc..4ae5fd072f 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -9,6 +9,7 @@
 extern cmdline_parse_inst_t cmd_show_port_tm_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_level_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_cap;
+extern cmdline_parse_inst_t cmd_show_port_tm_node;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_type;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_stats;
 extern cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile;
-- 
2.43.0


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

* Re: [PATCH v2 1/3] ethdev: add traffic manager query function
  2024-10-08 14:43   ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
@ 2024-10-09  0:57     ` fengchengwen
  2024-10-09  8:07       ` Bruce Richardson
  0 siblings, 1 reply; 20+ messages in thread
From: fengchengwen @ 2024-10-09  0:57 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: ferruh.yigit

On 2024/10/8 22:43, Bruce Richardson wrote:
> Add function to allow querying a node in the scheduler tree.  Returns
> the parameters as were given to the add function. Adding this function
> allows apps to just query the hierarchy rather than having to maintain
> their own copies of it internally.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  lib/ethdev/ethdev_trace.h        | 16 ++++++++++
>  lib/ethdev/ethdev_trace_points.c |  3 ++
>  lib/ethdev/rte_tm.c              | 25 ++++++++++++++++
>  lib/ethdev/rte_tm.h              | 50 ++++++++++++++++++++++++++++++++
>  lib/ethdev/rte_tm_driver.h       | 12 ++++++++
>  lib/ethdev/version.map           |  1 +
>  6 files changed, 107 insertions(+)
> 
> diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
> index 738d9829af..70fd6214fc 100644
> --- a/lib/ethdev/ethdev_trace.h
> +++ b/lib/ethdev/ethdev_trace.h
> @@ -1905,6 +1905,22 @@ RTE_TRACE_POINT(
>  	rte_trace_point_emit_int(ret);
>  )
>  
> +RTE_TRACE_POINT(
> +	rte_tm_trace_node_query,
> +	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id,
> +		uint32_t *parent_node_id, uint32_t *priority,
> +		uint32_t *weight, uint32_t *level_id,
> +		struct rte_tm_node_params *params, int ret),
> +	rte_trace_point_emit_u16(port_id);
> +	rte_trace_point_emit_u32(node_id);
> +	rte_trace_point_emit_ptr(parent_node_id);
> +	rte_trace_point_emit_ptr(priority);
> +	rte_trace_point_emit_ptr(weight);
> +	rte_trace_point_emit_ptr(level_id);
> +	rte_trace_point_emit_ptr(params);
> +	rte_trace_point_emit_int(ret);
> +)
> +
>  RTE_TRACE_POINT(
>  	rte_tm_trace_node_delete,
>  	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret),
> diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c
> index 902e4f7533..eee23613b8 100644
> --- a/lib/ethdev/ethdev_trace_points.c
> +++ b/lib/ethdev/ethdev_trace_points.c
> @@ -706,6 +706,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei,
>  RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add,
>  	lib.ethdev.tm.node_add)
>  
> +RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query,
> +	lib.ethdev.tm.node_query)
> +
>  RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get,
>  	lib.ethdev.tm.node_capabilities_get)
>  
> diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
> index d594fe0049..9ea140df09 100644
> --- a/lib/ethdev/rte_tm.c
> +++ b/lib/ethdev/rte_tm.c
> @@ -301,6 +301,31 @@ int rte_tm_node_add(uint16_t port_id,
>  	return ret;
>  }
>  
> +int rte_tm_node_query(uint16_t port_id,
> +	uint32_t node_id,
> +	uint32_t *parent_node_id,
> +	uint32_t *priority,
> +	uint32_t *weight,
> +	uint32_t *level_id,
> +	struct rte_tm_node_params *params,
> +	struct rte_tm_error *error)
> +{
> +	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
> +	int ret;
> +
> +	if (dev == NULL)
> +		return -EINVAL;

The RTE_TM_FUNC will check it, so no need do above judgement.

> +
> +	ret = RTE_TM_FUNC(port_id, node_query)(dev,
> +		node_id, parent_node_id, priority, weight, level_id,
> +		params, error);
> +
> +	rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority,
> +			      weight, level_id, params, ret);
> +
> +	return ret;
> +}
> +
>  /* Delete node from traffic manager hierarchy */
>  int rte_tm_node_delete(uint16_t port_id,
>  	uint32_t node_id,
> diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h
> index 07028c9b36..395e9d6d7f 100644
> --- a/lib/ethdev/rte_tm.h
> +++ b/lib/ethdev/rte_tm.h
> @@ -20,6 +20,7 @@
>  
>  #include <rte_common.h>
>  #include <rte_meter.h>
> +#include <rte_compat.h>
>  
>  #ifdef __cplusplus
>  extern "C" {
> @@ -1599,6 +1600,55 @@ rte_tm_node_add(uint16_t port_id,
>  	struct rte_tm_node_params *params,
>  	struct rte_tm_error *error);
>  
> +/**
> + * Return information about a traffic management node
> + *
> + * Return information about a hierarchy node, using the same format of parameters
> + * as was passed to the rte_rm_node_add() function.
> + * Each of the "out" parameters pointers (except error) may be passed as NULL if the
> + * information is not needed by the caller. For example, to one may check if a node id
> + * is in use by:
> + *
> + *  struct rte_tm_error error;
> + *  int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error);
> + *  if (ret == ENOENT) ...
> + *
> + * @param[in] port_id
> + *   The port identifier of the Ethernet device.
> + * @param[in] node_id
> + *   Node ID. Should be a valid node id.
> + * @param[out] parent_node_id
> + *   Parent node ID.
> + * @param[out] priority
> + *   Node priority. The highest node priority is zero. Used by the SP algorithm
> + *   running on the parent of the current node for scheduling this child node.
> + * @param[out] weight
> + *   Node weight. The node weight is relative to the weight sum of all siblings
> + *   that have the same priority. The lowest weight is one. Used by the WFQ
> + *   algorithm running on the parent of the current node for scheduling this
> + *   child node.
> + * @param[out] level_id
> + *   The node level in the scheduler hierarchy.
> + * @param[out] params
> + *   Node parameters, as would be used when creating the node.
> + * @param[out] error
> + *   Error details. Filled in only on error, when not NULL.

This parameter should not be NULL, as said before:
 Each of the "out" parameters pointers (except error) may be passed as NULL if the

> + * @return
> + *   0 on success, non-zero error code otherwise.
> + *   -EINVAL - port or node id value is invalid
> + *   -ENOENT - no node exists with the provided id

id -> port
no node exists with the provided port

> + */
> +__rte_experimental
> +int
> +rte_tm_node_query(uint16_t port_id,
> +	uint32_t node_id,
> +	uint32_t *parent_node_id,
> +	uint32_t *priority,
> +	uint32_t *weight,
> +	uint32_t *level_id,
> +	struct rte_tm_node_params *params,
> +	struct rte_tm_error *error);
> +

Suggest this new function place after node_resume in header/impl.c(e.g. source or trace), keep them consisteny

>  /**
>   * Traffic manager node delete
>   *
> diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h
> index 45290fb3fd..1efb2caaec 100644
> --- a/lib/ethdev/rte_tm_driver.h
> +++ b/lib/ethdev/rte_tm_driver.h
> @@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
>  	uint32_t node_id,
>  	struct rte_tm_error *error);
>  
> +/** @internal Traffic manager node query */
> +typedef int (*rte_tm_node_query_t)(const struct rte_eth_dev *dev,
> +	uint32_t node_id,
> +	uint32_t *parent_node_id,
> +	uint32_t *priority,
> +	uint32_t *weight,
> +	uint32_t *level_id,
> +	struct rte_tm_node_params *params,
> +	struct rte_tm_error *error);
> +
>  /** @internal Traffic manager hierarchy commit */
>  typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
>  	int clear_on_fail,
> @@ -248,6 +258,8 @@ struct rte_tm_ops {
>  	rte_tm_node_suspend_t node_suspend;
>  	/** Traffic manager node resume */
>  	rte_tm_node_resume_t node_resume;
> +	/** Traffic manager node resume */

Should be node query

> +	rte_tm_node_query_t node_query;
>  	/** Traffic manager hierarchy commit */
>  	rte_tm_hierarchy_commit_t hierarchy_commit;
>  
> diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
> index f63dc32aa2..c1a386eddc 100644
> --- a/lib/ethdev/version.map
> +++ b/lib/ethdev/version.map
> @@ -335,6 +335,7 @@ EXPERIMENTAL {
>  	rte_eth_speed_lanes_get_capability;
>  	rte_eth_speed_lanes_set;
>  	rte_flow_async_create_by_index_with_pattern;
> +	rte_tm_node_query;
>  };
>  
>  INTERNAL {


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

* Re: [PATCH v2 3/3] app/testpmd: add support for querying TM nodes
  2024-10-08 14:43   ` [PATCH v2 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
@ 2024-10-09  1:02     ` fengchengwen
  2024-10-09 10:32       ` Bruce Richardson
  0 siblings, 1 reply; 20+ messages in thread
From: fengchengwen @ 2024-10-09  1:02 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: ferruh.yigit

Please update the testpmd doc, with that added,
Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2024/10/8 22:43, Bruce Richardson wrote:
> Support use of the rte_tm_node_query API to print out details about
> previously added TM nodes in testpmd.
> 
> Example output, configuring three nodes, and then printing the details:
> 
> testpmd> add port tm nonleaf node 0 100 -1 0 1 0 -1 1 0 0
> testpmd> add port tm nonleaf node 0 90 100 0 1 1 -1 1 0 0
> testpmd> add port tm leaf node    0 0   90 0 1 2 -1 0 0xffffffff 0 0
> testpmd>
> testpmd> show port tm node 0 100
> Port 0 TM Node 100
>   Parent Node ID: <NULL>
>   Level ID: 0
>   Priority: 0
>   Weight: 0
>   Shaper Profile ID: <none>
>   Shared Shaper IDs: <none>
>   Stats Mask: 0
>   Nonleaf Node Parameters
>     Num Strict Priorities: 1
>     WFQ Weights Mode: WFQ
> testpmd> show port tm node 0 90
> Port 0 TM Node 90
>   Parent Node ID: 100
>   Level ID: 1
>   Priority: 0
>   Weight: 1
>   Shaper Profile ID: <none>
>   Shared Shaper IDs: <none>
>   Stats Mask: 0
>   Nonleaf Node Parameters
>     Num Strict Priorities: 1
>     WFQ Weights Mode: WFQ
> testpmd> show port tm node 0 0
> Port 0 TM Node 0
>   Parent Node ID: 90
>   Level ID: 2
>   Priority: 0
>   Weight: 1
>   Shaper Profile ID: <none>
>   Shared Shaper IDs: <none>
>   Stats Mask: 0
>   Leaf Node Parameters
>     CMAN Mode: Tail Drop
>     WRED Profile ID: <none>
>     Shared WRED Context Ids: <none>
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  app/test-pmd/cmdline.c    |   1 +
>  app/test-pmd/cmdline_tm.c | 131 ++++++++++++++++++++++++++++++++++++++
>  app/test-pmd/cmdline_tm.h |   1 +
>  3 files changed, 133 insertions(+)
> 

...


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

* Re: [PATCH v2 1/3] ethdev: add traffic manager query function
  2024-10-09  0:57     ` fengchengwen
@ 2024-10-09  8:07       ` Bruce Richardson
  2024-10-09  9:38         ` fengchengwen
  0 siblings, 1 reply; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09  8:07 UTC (permalink / raw)
  To: fengchengwen; +Cc: dev, ferruh.yigit

On Wed, Oct 09, 2024 at 08:57:41AM +0800, fengchengwen wrote:
> On 2024/10/8 22:43, Bruce Richardson wrote:
> > Add function to allow querying a node in the scheduler tree.  Returns
> > the parameters as were given to the add function. Adding this function
> > allows apps to just query the hierarchy rather than having to maintain
> > their own copies of it internally.
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---

Hi,

thanks for the detailed review. Most comments are fine and will fix. One
reply below for just one of them though.

/Bruce

<snip>
> > + */
> > +__rte_experimental
> > +int
> > +rte_tm_node_query(uint16_t port_id,
> > +	uint32_t node_id,
> > +	uint32_t *parent_node_id,
> > +	uint32_t *priority,
> > +	uint32_t *weight,
> > +	uint32_t *level_id,
> > +	struct rte_tm_node_params *params,
> > +	struct rte_tm_error *error);
> > +
> 
> Suggest this new function place after node_resume in header/impl.c(e.g. source or trace), keep them consistency

Why do you think it should go after node resume? I deliberately placed it
after node_add function since the parameters are matching each other,
whatever parameters you provided on add, you get returned to you on query.


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

* Re: [PATCH v2 1/3] ethdev: add traffic manager query function
  2024-10-09  8:07       ` Bruce Richardson
@ 2024-10-09  9:38         ` fengchengwen
  0 siblings, 0 replies; 20+ messages in thread
From: fengchengwen @ 2024-10-09  9:38 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, ferruh.yigit



On 2024/10/9 16:07, Bruce Richardson wrote:
> On Wed, Oct 09, 2024 at 08:57:41AM +0800, fengchengwen wrote:
>> On 2024/10/8 22:43, Bruce Richardson wrote:
>>> Add function to allow querying a node in the scheduler tree.  Returns
>>> the parameters as were given to the add function. Adding this function
>>> allows apps to just query the hierarchy rather than having to maintain
>>> their own copies of it internally.
>>>
>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>> ---
> 
> Hi,
> 
> thanks for the detailed review. Most comments are fine and will fix. One
> reply below for just one of them though.
> 
> /Bruce
> 
> <snip>
>>> + */
>>> +__rte_experimental
>>> +int
>>> +rte_tm_node_query(uint16_t port_id,
>>> +	uint32_t node_id,
>>> +	uint32_t *parent_node_id,
>>> +	uint32_t *priority,
>>> +	uint32_t *weight,
>>> +	uint32_t *level_id,
>>> +	struct rte_tm_node_params *params,
>>> +	struct rte_tm_error *error);
>>> +
>>
>> Suggest this new function place after node_resume in header/impl.c(e.g. source or trace), keep them consistency
> 
> Why do you think it should go after node resume? I deliberately placed it
> after node_add function since the parameters are matching each other,
> whatever parameters you provided on add, you get returned to you on query.

To one object, we may have four basic operation: add/del/modify/query, I always keep this order in .c/.h file.
As for the tm node case, we could treat node_suspend/node_resume as the modify operation.

It is just a personal coding style. From my point of view, it's fine in that order.

> 
> 


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

* [PATCH v3 0/3] add support for querying ethdev TM nodes
  2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
                   ` (3 preceding siblings ...)
  2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
@ 2024-10-09 10:32 ` Bruce Richardson
  2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
                     ` (3 more replies)
  4 siblings, 4 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09 10:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Add support for an ethdev TM query function to allow apps to get details
of the TM nodes they previously configured. This patchset includes:

* ethdev changes to add the API
* implementation of the function in "ice" pmd
* testpmd command to allow testing the function

v3: updated comments and removed null check on patch 1.
    Added doc to patch 3.
V2: rebase to the head of next-net tree


Bruce Richardson (3):
  ethdev: add traffic manager query function
  net/ice: add traffic management node query function
  app/testpmd: add support for querying TM nodes

 app/test-pmd/cmdline.c                      |   1 +
 app/test-pmd/cmdline_tm.c                   | 131 ++++++++++++++++++++
 app/test-pmd/cmdline_tm.h                   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  27 ++++
 drivers/net/ice/ice_tm.c                    |  52 ++++++++
 lib/ethdev/ethdev_trace.h                   |  16 +++
 lib/ethdev/ethdev_trace_points.c            |   3 +
 lib/ethdev/rte_tm.c                         |  22 ++++
 lib/ethdev/rte_tm.h                         |  50 ++++++++
 lib/ethdev/rte_tm_driver.h                  |  12 ++
 lib/ethdev/version.map                      |   1 +
 11 files changed, 316 insertions(+)

--
2.43.0


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

* [PATCH v3 1/3] ethdev: add traffic manager query function
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
@ 2024-10-09 10:32   ` Bruce Richardson
  2024-10-10  2:05     ` Ferruh Yigit
  2024-10-12  0:28     ` Ferruh Yigit
  2024-10-09 10:32   ` [PATCH v3 2/3] net/ice: add traffic management node " Bruce Richardson
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09 10:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Add function to allow querying a node in the scheduler tree.  Returns
the parameters as were given to the add function. Adding this function
allows apps to just query the hierarchy rather than having to maintain
their own copies of it internally.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

---
v2: address feedback
* dropped unnecessary NULL check
* corrected comments
---
 lib/ethdev/ethdev_trace.h        | 16 ++++++++++
 lib/ethdev/ethdev_trace_points.c |  3 ++
 lib/ethdev/rte_tm.c              | 22 ++++++++++++++
 lib/ethdev/rte_tm.h              | 50 ++++++++++++++++++++++++++++++++
 lib/ethdev/rte_tm_driver.h       | 12 ++++++++
 lib/ethdev/version.map           |  1 +
 6 files changed, 104 insertions(+)

diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
index 738d9829af..70fd6214fc 100644
--- a/lib/ethdev/ethdev_trace.h
+++ b/lib/ethdev/ethdev_trace.h
@@ -1905,6 +1905,22 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_tm_trace_node_query,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params, int ret),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(node_id);
+	rte_trace_point_emit_ptr(parent_node_id);
+	rte_trace_point_emit_ptr(priority);
+	rte_trace_point_emit_ptr(weight);
+	rte_trace_point_emit_ptr(level_id);
+	rte_trace_point_emit_ptr(params);
+	rte_trace_point_emit_int(ret);
+)
+
 RTE_TRACE_POINT(
 	rte_tm_trace_node_delete,
 	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t node_id, int ret),
diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c
index 902e4f7533..eee23613b8 100644
--- a/lib/ethdev/ethdev_trace_points.c
+++ b/lib/ethdev/ethdev_trace_points.c
@@ -706,6 +706,9 @@ RTE_TRACE_POINT_REGISTER(rte_tm_trace_mark_vlan_dei,
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_add,
 	lib.ethdev.tm.node_add)
 
+RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_query,
+	lib.ethdev.tm.node_query)
+
 RTE_TRACE_POINT_REGISTER(rte_tm_trace_node_capabilities_get,
 	lib.ethdev.tm.node_capabilities_get)
 
diff --git a/lib/ethdev/rte_tm.c b/lib/ethdev/rte_tm.c
index d594fe0049..f3e466e690 100644
--- a/lib/ethdev/rte_tm.c
+++ b/lib/ethdev/rte_tm.c
@@ -301,6 +301,28 @@ int rte_tm_node_add(uint16_t port_id,
 	return ret;
 }
 
+int rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	int ret;
+
+	ret = RTE_TM_FUNC(port_id, node_query)(dev,
+		node_id, parent_node_id, priority, weight, level_id,
+		params, error);
+
+	rte_tm_trace_node_query(port_id, node_id, parent_node_id, priority,
+			      weight, level_id, params, ret);
+
+	return ret;
+}
+
 /* Delete node from traffic manager hierarchy */
 int rte_tm_node_delete(uint16_t port_id,
 	uint32_t node_id,
diff --git a/lib/ethdev/rte_tm.h b/lib/ethdev/rte_tm.h
index 07028c9b36..a2b123a19b 100644
--- a/lib/ethdev/rte_tm.h
+++ b/lib/ethdev/rte_tm.h
@@ -20,6 +20,7 @@
 
 #include <rte_common.h>
 #include <rte_meter.h>
+#include <rte_compat.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -1599,6 +1600,55 @@ rte_tm_node_add(uint16_t port_id,
 	struct rte_tm_node_params *params,
 	struct rte_tm_error *error);
 
+/**
+ * Return information about a traffic management node
+ *
+ * Return information about a hierarchy node, using the same format of parameters
+ * as was passed to the rte_rm_node_add() function.
+ * Each of the "out" parameters pointers (except error) may be passed as NULL if the
+ * information is not needed by the caller. For example, to one may check if a node id
+ * is in use by:
+ *
+ *  struct rte_tm_error error;
+ *  int ret = rte_tm_node_query(port, node_id, NULL, NULL, NULL, NULL, NULL, &error);
+ *  if (ret == ENOENT) ...
+ *
+ * @param[in] port_id
+ *   The port identifier of the Ethernet device.
+ * @param[in] node_id
+ *   Node ID. Should be a valid node id.
+ * @param[out] parent_node_id
+ *   Parent node ID.
+ * @param[out] priority
+ *   Node priority. The highest node priority is zero. Used by the SP algorithm
+ *   running on the parent of the current node for scheduling this child node.
+ * @param[out] weight
+ *   Node weight. The node weight is relative to the weight sum of all siblings
+ *   that have the same priority. The lowest weight is one. Used by the WFQ
+ *   algorithm running on the parent of the current node for scheduling this
+ *   child node.
+ * @param[out] level_id
+ *   The node level in the scheduler hierarchy.
+ * @param[out] params
+ *   Node parameters, as would be used when creating the node.
+ * @param[out] error
+ *   Error details. Filled in only on error. Must not be NULL.
+ * @return
+ *   0 on success, non-zero error code otherwise.
+ *   -EINVAL - port or node id value is invalid
+ *   -ENOENT - no node exists with the provided id on the provided port
+ */
+__rte_experimental
+int
+rte_tm_node_query(uint16_t port_id,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /**
  * Traffic manager node delete
  *
diff --git a/lib/ethdev/rte_tm_driver.h b/lib/ethdev/rte_tm_driver.h
index 45290fb3fd..62ceab2cbc 100644
--- a/lib/ethdev/rte_tm_driver.h
+++ b/lib/ethdev/rte_tm_driver.h
@@ -119,6 +119,16 @@ typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
 	uint32_t node_id,
 	struct rte_tm_error *error);
 
+/** @internal Traffic manager node query */
+typedef int (*rte_tm_node_query_t)(const struct rte_eth_dev *dev,
+	uint32_t node_id,
+	uint32_t *parent_node_id,
+	uint32_t *priority,
+	uint32_t *weight,
+	uint32_t *level_id,
+	struct rte_tm_node_params *params,
+	struct rte_tm_error *error);
+
 /** @internal Traffic manager hierarchy commit */
 typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
 	int clear_on_fail,
@@ -248,6 +258,8 @@ struct rte_tm_ops {
 	rte_tm_node_suspend_t node_suspend;
 	/** Traffic manager node resume */
 	rte_tm_node_resume_t node_resume;
+	/** Traffic manager node query */
+	rte_tm_node_query_t node_query;
 	/** Traffic manager hierarchy commit */
 	rte_tm_hierarchy_commit_t hierarchy_commit;
 
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index f63dc32aa2..c1a386eddc 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -335,6 +335,7 @@ EXPERIMENTAL {
 	rte_eth_speed_lanes_get_capability;
 	rte_eth_speed_lanes_set;
 	rte_flow_async_create_by_index_with_pattern;
+	rte_tm_node_query;
 };
 
 INTERNAL {
-- 
2.43.0


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

* [PATCH v3 2/3] net/ice: add traffic management node query function
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
  2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
@ 2024-10-09 10:32   ` Bruce Richardson
  2024-10-09 10:32   ` [PATCH v3 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
  2024-10-12  0:33   ` [PATCH v3 0/3] add support for querying ethdev " Ferruh Yigit
  3 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09 10:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson

Implement the new node querying function for the "ice" net driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/ice/ice_tm.c | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c
index 7239ab53f1..35bc26ad47 100644
--- a/drivers/net/ice/ice_tm.c
+++ b/drivers/net/ice/ice_tm.c
@@ -17,6 +17,11 @@ static int ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	      uint32_t weight, uint32_t level_id,
 	      struct rte_tm_node_params *params,
 	      struct rte_tm_error *error);
+static int ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error);
 static int ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 			    struct rte_tm_error *error);
 static int ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
@@ -35,6 +40,7 @@ const struct rte_tm_ops ice_tm_ops = {
 	.node_add = ice_tm_node_add,
 	.node_delete = ice_tm_node_delete,
 	.node_type_get = ice_node_type_get,
+	.node_query = ice_node_query,
 	.hierarchy_commit = ice_hierarchy_commit,
 };
 
@@ -219,6 +225,52 @@ ice_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
 	return 0;
 }
 
+static int
+ice_node_query(const struct rte_eth_dev *dev, uint32_t node_id,
+		uint32_t *parent_node_id, uint32_t *priority,
+		uint32_t *weight, uint32_t *level_id,
+		struct rte_tm_node_params *params,
+		struct rte_tm_error *error)
+{
+	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_tm_node *tm_node;
+
+	if (node_id == RTE_TM_NODE_ID_NULL) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "invalid node id";
+		return -EINVAL;
+	}
+
+	/* check if the node id exists */
+	tm_node = find_node(pf->tm_conf.root, node_id);
+	if (!tm_node) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "no such node";
+		return -EEXIST;
+	}
+
+	if (parent_node_id != NULL) {
+		if (tm_node->parent != NULL)
+			*parent_node_id = tm_node->parent->id;
+		else
+			*parent_node_id = RTE_TM_NODE_ID_NULL;
+	}
+
+	if (priority != NULL)
+		*priority = tm_node->priority;
+
+	if (weight != NULL)
+		*weight = tm_node->weight;
+
+	if (level_id != NULL)
+		*level_id = tm_node->level;
+
+	if (params != NULL)
+		*params = tm_node->params;
+
+	return 0;
+}
+
 static inline struct ice_tm_shaper_profile *
 ice_shaper_profile_search(struct rte_eth_dev *dev,
 			   uint32_t shaper_profile_id)
-- 
2.43.0


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

* [PATCH v3 3/3] app/testpmd: add support for querying TM nodes
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
  2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
  2024-10-09 10:32   ` [PATCH v3 2/3] net/ice: add traffic management node " Bruce Richardson
@ 2024-10-09 10:32   ` Bruce Richardson
  2024-10-12  0:33   ` [PATCH v3 0/3] add support for querying ethdev " Ferruh Yigit
  3 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09 10:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Bruce Richardson, Chengwen Feng

Support use of the rte_tm_node_query API to print out details about
previously added TM nodes in testpmd.

Example output, configuring three nodes, and then printing the details:

testpmd> add port tm nonleaf node 0 100 -1 0 1 0 -1 1 0 0
testpmd> add port tm nonleaf node 0 90 100 0 1 1 -1 1 0 0
testpmd> add port tm leaf node    0 0   90 0 1 2 -1 0 0xffffffff 0 0
testpmd>
testpmd> show port tm node 0 100
Port 0 TM Node 100
  Parent Node ID: <NULL>
  Level ID: 0
  Priority: 0
  Weight: 0
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 90
Port 0 TM Node 90
  Parent Node ID: 100
  Level ID: 1
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Nonleaf Node Parameters
    Num Strict Priorities: 1
    WFQ Weights Mode: WFQ
testpmd> show port tm node 0 0
Port 0 TM Node 0
  Parent Node ID: 90
  Level ID: 2
  Priority: 0
  Weight: 1
  Shaper Profile ID: <none>
  Shared Shaper IDs: <none>
  Stats Mask: 0
  Leaf Node Parameters
    CMAN Mode: Tail Drop
    WRED Profile ID: <none>
    Shared WRED Context Ids: <none>

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by:  Chengwen Feng <fengchengwen@huawei.com>
---
v2: added new command to testpmd documentation
---
 app/test-pmd/cmdline.c                      |   1 +
 app/test-pmd/cmdline_tm.c                   | 131 ++++++++++++++++++++
 app/test-pmd/cmdline_tm.h                   |   1 +
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  27 ++++
 4 files changed, 160 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 12d8c00293..6ec1d4e9b5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -13573,6 +13573,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	&cmd_set_port_ptypes,
 	&cmd_show_port_tm_cap,
 	&cmd_show_port_tm_level_cap,
+	&cmd_show_port_tm_node,
 	&cmd_show_port_tm_node_cap,
 	&cmd_show_port_tm_node_type,
 	&cmd_show_port_tm_node_stats,
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index aa917edb6c..7ade91549c 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -2111,6 +2111,137 @@ cmdline_parse_inst_t cmd_add_port_tm_leaf_node = {
 	},
 };
 
+struct cmd_show_port_tm_node_result {
+	cmdline_fixed_string_t show;
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t tm;
+	cmdline_fixed_string_t node;
+	uint16_t port_id;
+	uint32_t node_id;
+};
+
+static cmdline_parse_token_string_t cmd_show_port_tm_node_show_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, show, "show");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_port_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, port, "port");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_tm_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, tm, "tm");
+static cmdline_parse_token_string_t cmd_show_port_tm_node_node_tok =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_result, node, "node");
+static cmdline_parse_token_num_t cmd_show_port_tm_node_port_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_show_port_tm_node_node_id_tok =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_result, node_id, RTE_UINT32);
+
+static void
+cmd_show_port_tm_node_parsed(void *parsed_result, struct cmdline *cl, void *data __rte_unused)
+{
+	const struct cmd_show_port_tm_node_result *res = parsed_result;
+	const portid_t port_id = res->port_id;
+	const uint32_t node_id = res->node_id;
+	struct rte_tm_node_params params = {0};
+	struct rte_tm_error error = {0};
+	uint32_t parent_id, priority, weight, level_id;
+	int is_leaf;
+	int ret;
+
+	if (port_id_is_invalid(port_id, ENABLED_WARN))
+		return;
+
+	ret = rte_tm_node_query(port_id, node_id,
+			&parent_id, &priority, &weight, &level_id, &params, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
+	if (ret != 0) {
+		print_err_msg(&error);
+		return;
+	}
+
+	cmdline_printf(cl, "Port %u TM Node %u\n", port_id, node_id);
+	if (parent_id == RTE_TM_NODE_ID_NULL)
+		cmdline_printf(cl, "  Parent Node ID: <NULL>\n");
+	else
+		cmdline_printf(cl, "  Parent Node ID: %d\n", parent_id);
+	cmdline_printf(cl, "  Level ID: %u\n", level_id);
+	cmdline_printf(cl, "  Priority: %u\n", priority);
+	cmdline_printf(cl, "  Weight: %u\n", weight);
+	if (params.shaper_profile_id == RTE_TM_SHAPER_PROFILE_ID_NONE)
+		cmdline_printf(cl, "  Shaper Profile ID: <none>\n");
+	else
+		cmdline_printf(cl, "  Shaper Profile ID: %d\n", params.shaper_profile_id);
+	cmdline_printf(cl, "  Shared Shaper IDs: ");
+	if (params.n_shared_shapers == 0)
+		cmdline_printf(cl, "<none>\n");
+	else {
+		for (uint32_t i = 0; i < params.n_shared_shapers; i++)
+			cmdline_printf(cl, "%u ", params.shared_shaper_id[i]);
+		cmdline_printf(cl, "\n");
+	}
+	cmdline_printf(cl, "  Stats Mask: %"PRIu64"\n", params.stats_mask);
+	if (is_leaf) {
+		cmdline_printf(cl, "  Leaf Node Parameters\n");
+		switch (params.leaf.cman) {
+		case RTE_TM_CMAN_TAIL_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Tail Drop\n");
+			break;
+		case RTE_TM_CMAN_HEAD_DROP:
+			cmdline_printf(cl, "    CMAN Mode: Head Drop\n");
+			break;
+		case RTE_TM_CMAN_WRED:
+			cmdline_printf(cl, "    CMAN Mode: WRED\n");
+			break;
+		}
+		if (params.leaf.wred.wred_profile_id == RTE_TM_WRED_PROFILE_ID_NONE)
+			cmdline_printf(cl, "    WRED Profile ID: <none>\n");
+		else
+			cmdline_printf(cl, "    WRED Profile ID: %u\n",
+					params.leaf.wred.wred_profile_id);
+		cmdline_printf(cl, "    Shared WRED Context Ids: ");
+		if (params.leaf.wred.n_shared_wred_contexts == 0)
+			cmdline_printf(cl, "<none>\n");
+		else {
+			for (uint32_t i = 0; i < params.leaf.wred.n_shared_wred_contexts; i++)
+				cmdline_printf(cl, "%u ",
+						params.leaf.wred.shared_wred_context_id[i]);
+			cmdline_printf(cl, "\n");
+		}
+	} else {
+		cmdline_printf(cl, "  Nonleaf Node Parameters\n");
+		cmdline_printf(cl, "    Num Strict Priorities: %u\n",
+				params.nonleaf.n_sp_priorities);
+		cmdline_printf(cl, "    WFQ Weights Mode: ");
+		if (params.nonleaf.wfq_weight_mode == NULL)
+			cmdline_printf(cl, "WFQ\n");
+		else {
+			for (uint32_t i = 0; i < params.nonleaf.n_sp_priorities; i++)
+				cmdline_printf(cl, "%s(%d) ",
+					params.nonleaf.wfq_weight_mode[i] ? "Bytes" : "Packet",
+					params.nonleaf.wfq_weight_mode[i]);
+			cmdline_printf(cl, "\n");
+		}
+	}
+}
+
+
+cmdline_parse_inst_t cmd_show_port_tm_node = {
+	.f = cmd_show_port_tm_node_parsed,
+	.data = NULL,
+	.help_str = "",
+	.tokens = {
+		(void *)&cmd_show_port_tm_node_show_tok,
+		(void *)&cmd_show_port_tm_node_port_tok,
+		(void *)&cmd_show_port_tm_node_tm_tok,
+		(void *)&cmd_show_port_tm_node_node_tok,
+		(void *)&cmd_show_port_tm_node_port_id_tok,
+		(void *)&cmd_show_port_tm_node_node_id_tok,
+		NULL,
+	}
+};
+
 /* *** Delete Port TM Node *** */
 struct cmd_del_port_tm_node_result {
 	cmdline_fixed_string_t del;
diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h
index e59c15c3cc..4ae5fd072f 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -9,6 +9,7 @@
 extern cmdline_parse_inst_t cmd_show_port_tm_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_level_cap;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_cap;
+extern cmdline_parse_inst_t cmd_show_port_tm_node;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_type;
 extern cmdline_parse_inst_t cmd_show_port_tm_node_stats;
 extern cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile;
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f00ab07605..5825846bb8 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2790,6 +2790,33 @@ where:
 * ``n_shared_shapers``: Number of shared shapers.
 * ``shared_shaper_id``: Shared shaper id.
 
+Query port traffic management hierarchy node
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+An added traffic management hierarchy node, whether leaf of non-leaf,
+can be queried using::
+
+    testpmd> show port tm node (port_id) (node_id)
+
+where ``port_id`` and ``node_id`` are the numeric identifiers of the ethernet port
+and the previously added traffic management node, respectively.
+The output of this command are the parameters previously provided to the add call,
+printed with appropriate labels.
+For example::
+
+   testpmd> show port tm node 0 90
+   Port 0 TM Node 90
+     Parent Node ID: 100
+     Level ID: 1
+     Priority: 0
+     Weight: 1
+     Shaper Profile ID: <none>
+     Shared Shaper IDs: <none>
+     Stats Mask: 0
+     Nonleaf Node Parameters
+       Num Strict Priorities: 1
+       WFQ Weights Mode: WFQ
+
 Delete port traffic management hierarchy node
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.43.0


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

* Re: [PATCH v2 3/3] app/testpmd: add support for querying TM nodes
  2024-10-09  1:02     ` fengchengwen
@ 2024-10-09 10:32       ` Bruce Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Bruce Richardson @ 2024-10-09 10:32 UTC (permalink / raw)
  To: fengchengwen; +Cc: dev, ferruh.yigit

On Wed, Oct 09, 2024 at 09:02:01AM +0800, fengchengwen wrote:
> Please update the testpmd doc, with that added,
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> 

Thanks. Doc added to V3 patchset.

/Bruce


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

* Re: [PATCH v3 1/3] ethdev: add traffic manager query function
  2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
@ 2024-10-10  2:05     ` Ferruh Yigit
  2024-10-12  0:28     ` Ferruh Yigit
  1 sibling, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2024-10-10  2:05 UTC (permalink / raw)
  To: Bruce Richardson, Cristian Dumitrescu; +Cc: dev

On 10/9/2024 11:32 AM, Bruce Richardson wrote:
> Add function to allow querying a node in the scheduler tree.  Returns
> the parameters as were given to the add function. Adding this function
> allows apps to just query the hierarchy rather than having to maintain
> their own copies of it internally.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>

+Cristian, TM API maintainer.

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

* Re: [PATCH v3 1/3] ethdev: add traffic manager query function
  2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
  2024-10-10  2:05     ` Ferruh Yigit
@ 2024-10-12  0:28     ` Ferruh Yigit
  1 sibling, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2024-10-12  0:28 UTC (permalink / raw)
  To: Bruce Richardson, dev

On 10/9/2024 11:32 AM, Bruce Richardson wrote:
> Add function to allow querying a node in the scheduler tree.  Returns
> the parameters as were given to the add function. Adding this function
> allows apps to just query the hierarchy rather than having to maintain
> their own copies of it internally.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>

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

* Re: [PATCH v3 0/3] add support for querying ethdev TM nodes
  2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
                     ` (2 preceding siblings ...)
  2024-10-09 10:32   ` [PATCH v3 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
@ 2024-10-12  0:33   ` Ferruh Yigit
  3 siblings, 0 replies; 20+ messages in thread
From: Ferruh Yigit @ 2024-10-12  0:33 UTC (permalink / raw)
  To: Bruce Richardson, dev

On 10/9/2024 11:32 AM, Bruce Richardson wrote:
> Add support for an ethdev TM query function to allow apps to get details
> of the TM nodes they previously configured. This patchset includes:
> 
> * ethdev changes to add the API
> * implementation of the function in "ice" pmd
> * testpmd command to allow testing the function
> 
> v3: updated comments and removed null check on patch 1.
>     Added doc to patch 3.
> V2: rebase to the head of next-net tree
> 
> 
> Bruce Richardson (3):
>   ethdev: add traffic manager query function
>   net/ice: add traffic management node query function
>   app/testpmd: add support for querying TM nodes
>

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

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

end of thread, other threads:[~2024-10-12  0:33 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-08 10:53 [PATCH 0/3] add support for querying ethdev TM nodes Bruce Richardson
2024-10-08 10:53 ` [PATCH 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-08 10:53 ` [PATCH 2/3] net/ice: add traffic management node " Bruce Richardson
2024-10-08 10:53 ` [PATCH 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-08 14:43 ` [PATCH v2 0/3] add support for querying ethdev " Bruce Richardson
2024-10-08 14:43   ` [PATCH v2 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-09  0:57     ` fengchengwen
2024-10-09  8:07       ` Bruce Richardson
2024-10-09  9:38         ` fengchengwen
2024-10-08 14:43   ` [PATCH v2 2/3] net/ice: add traffic management node " Bruce Richardson
2024-10-08 14:43   ` [PATCH v2 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-09  1:02     ` fengchengwen
2024-10-09 10:32       ` Bruce Richardson
2024-10-09 10:32 ` [PATCH v3 0/3] add support for querying ethdev " Bruce Richardson
2024-10-09 10:32   ` [PATCH v3 1/3] ethdev: add traffic manager query function Bruce Richardson
2024-10-10  2:05     ` Ferruh Yigit
2024-10-12  0:28     ` Ferruh Yigit
2024-10-09 10:32   ` [PATCH v3 2/3] net/ice: add traffic management node " Bruce Richardson
2024-10-09 10:32   ` [PATCH v3 3/3] app/testpmd: add support for querying TM nodes Bruce Richardson
2024-10-12  0:33   ` [PATCH v3 0/3] add support for querying ethdev " Ferruh Yigit

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