* [PATCH 1/4] net/hns3: fix a typo
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
@ 2023-10-18 1:39 ` Jie Hai
2023-10-18 11:32 ` lihuisong (C)
2023-10-18 1:39 ` [PATCH 2/4] ethdev: add telemetry command for TM capabilities Jie Hai
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Jie Hai @ 2023-10-18 1:39 UTC (permalink / raw)
To: dev, Dongdong Liu, Yisen Zhuang, Lijun Ou, Chengwen Feng
Cc: haijie1, lihuisong
This patch fixes a typo.
Fixes: c09c7847d892 ("net/hns3: support traffic management")
Cc: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/hns3/hns3_tm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
index 67402a700f46..d9691640140b 100644
--- a/drivers/net/hns3/hns3_tm.c
+++ b/drivers/net/hns3/hns3_tm.c
@@ -739,7 +739,7 @@ hns3_tm_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
}
static void
-hns3_tm_nonleaf_level_capsbilities_get(struct rte_eth_dev *dev,
+hns3_tm_nonleaf_level_capabilities_get(struct rte_eth_dev *dev,
uint32_t level_id,
struct rte_tm_level_capabilities *cap)
{
@@ -818,7 +818,7 @@ hns3_tm_level_capabilities_get(struct rte_eth_dev *dev,
memset(cap, 0, sizeof(struct rte_tm_level_capabilities));
if (level_id != HNS3_TM_NODE_LEVEL_QUEUE)
- hns3_tm_nonleaf_level_capsbilities_get(dev, level_id, cap);
+ hns3_tm_nonleaf_level_capabilities_get(dev, level_id, cap);
else
hns3_tm_leaf_level_capabilities_get(dev, cap);
--
2.30.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] net/hns3: fix a typo
2023-10-18 1:39 ` [PATCH 1/4] net/hns3: fix a typo Jie Hai
@ 2023-10-18 11:32 ` lihuisong (C)
2023-10-27 6:20 ` Jie Hai
0 siblings, 1 reply; 10+ messages in thread
From: lihuisong (C) @ 2023-10-18 11:32 UTC (permalink / raw)
To: Jie Hai, dev, Dongdong Liu, Yisen Zhuang, Lijun Ou, Chengwen Feng
hns3 patch can be stripped from this series.
ltgm,
Acked-by: Huisong Li <lihuisong@huawei.com>
在 2023/10/18 9:39, Jie Hai 写道:
> This patch fixes a typo.
>
> Fixes: c09c7847d892 ("net/hns3: support traffic management")
> Cc: stable@dpdk.org
>
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> ---
> drivers/net/hns3/hns3_tm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
> index 67402a700f46..d9691640140b 100644
> --- a/drivers/net/hns3/hns3_tm.c
> +++ b/drivers/net/hns3/hns3_tm.c
> @@ -739,7 +739,7 @@ hns3_tm_node_type_get(struct rte_eth_dev *dev, uint32_t node_id,
> }
>
> static void
> -hns3_tm_nonleaf_level_capsbilities_get(struct rte_eth_dev *dev,
> +hns3_tm_nonleaf_level_capabilities_get(struct rte_eth_dev *dev,
> uint32_t level_id,
> struct rte_tm_level_capabilities *cap)
> {
> @@ -818,7 +818,7 @@ hns3_tm_level_capabilities_get(struct rte_eth_dev *dev,
> memset(cap, 0, sizeof(struct rte_tm_level_capabilities));
>
> if (level_id != HNS3_TM_NODE_LEVEL_QUEUE)
> - hns3_tm_nonleaf_level_capsbilities_get(dev, level_id, cap);
> + hns3_tm_nonleaf_level_capabilities_get(dev, level_id, cap);
> else
> hns3_tm_leaf_level_capabilities_get(dev, cap);
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] net/hns3: fix a typo
2023-10-18 11:32 ` lihuisong (C)
@ 2023-10-27 6:20 ` Jie Hai
0 siblings, 0 replies; 10+ messages in thread
From: Jie Hai @ 2023-10-27 6:20 UTC (permalink / raw)
To: lihuisong (C), dev, Dongdong Liu, Yisen Zhuang, Lijun Ou, Chengwen Feng
@all
The patch "[PATCH 1/4] net/hns3: fix a typo" has been moved to patchset
"[0/8] net/hns3: add some bugfix for hns3", see
https://patches.dpdk.org/project/dpdk/cover/20231027060947.3183983-1-haijie1@huawei.com/
On 2023/10/18 19:32, lihuisong (C) wrote:
> hns3 patch can be stripped from this series.
> ltgm,
> Acked-by: Huisong Li <lihuisong@huawei.com>
>
>
> 在 2023/10/18 9:39, Jie Hai 写道:
>> This patch fixes a typo.
>>
>> Fixes: c09c7847d892 ("net/hns3: support traffic management")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> ---
>> drivers/net/hns3/hns3_tm.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c
>> index 67402a700f46..d9691640140b 100644
>> --- a/drivers/net/hns3/hns3_tm.c
>> +++ b/drivers/net/hns3/hns3_tm.c
>> @@ -739,7 +739,7 @@ hns3_tm_node_type_get(struct rte_eth_dev *dev,
>> uint32_t node_id,
>> }
>> static void
>> -hns3_tm_nonleaf_level_capsbilities_get(struct rte_eth_dev *dev,
>> +hns3_tm_nonleaf_level_capabilities_get(struct rte_eth_dev *dev,
>> uint32_t level_id,
>> struct rte_tm_level_capabilities *cap)
>> {
>> @@ -818,7 +818,7 @@ hns3_tm_level_capabilities_get(struct rte_eth_dev
>> *dev,
>> memset(cap, 0, sizeof(struct rte_tm_level_capabilities));
>> if (level_id != HNS3_TM_NODE_LEVEL_QUEUE)
>> - hns3_tm_nonleaf_level_capsbilities_get(dev, level_id, cap);
>> + hns3_tm_nonleaf_level_capabilities_get(dev, level_id, cap);
>> else
>> hns3_tm_leaf_level_capabilities_get(dev, cap);
> .
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/4] ethdev: add telemetry command for TM capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
2023-10-18 1:39 ` [PATCH 1/4] net/hns3: fix a typo Jie Hai
@ 2023-10-18 1:39 ` Jie Hai
2023-10-18 1:39 ` [PATCH 3/4] ethdev: add telemetry command for TM level capabilities Jie Hai
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jie Hai @ 2023-10-18 1:39 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: haijie1, lihuisong
This patch adds a telemetry command for traffic management
capabilities. An example usage is shown below:
--> /ethdev/tm_capability,0
{
"/ethdev/tm_capability": {
"n_nodes_max": 265,
"n_levels_max": 3,
"non_leaf_nodes_identical": 1,
"leaf_nodes_identical": 1,
"shaper_n_max": 9,
"shaper_private_n_max": 9,
"shaper_private_dual_rate_n_max": 0,
"shaper_private_rate_min": 0,
"shaper_private_rate_max": 25000000000,
"shaper_private_packet_mode_supported": 0,
"shaper_private_byte_mode_supported": 0,
"shaper_shared_n_max": 0,
"shaper_shared_n_nodes_per_shaper_max": 0,
"shaper_shared_n_shapers_per_node_max": 0,
"shaper_share_dual_rate_n_max": 0,
"shaper_shared_rate_min": 0,
"shaper_shared_rate_max": 0,
"shaper_shared_packet_mode_supported": 0,
"shaper_shared_byte_mode_supported": 0,
"shaper_pkt_length_adjust_min": 20,
"shaper_pkt_length_adjust_max": 24,
"sched_n_children_max": 256,
"sched_sp_n_priorities_max": 1,
"sched_wfq_n_children_per_group_max": 0,
"sched_wfq_n_groups_max": 0,
"sched_wfq_weight_max": 1,
"sched_wfq_packet_mode_supported": 0,
"sched_wfq_byte_mode_supported": 0,
"cman_wred_packet_mode_supported": 0,
"cman_wred_byte_mode_supported": 0,
"cman_head_drop_supported": 0,
"cman_wred_context_n_max": 0,
"cman_wred_context_private_n_max": 0,
"cman_wred_context_shared_n_max": 0,
"cman_wred_context_shared_n_nodes_per_context_max": 0,
"cman_wred_context_shared_n_contexts_per_node_max": 0,
"dynamic_update": "0x0",
"stats_mask": "0x0"
}
}
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev_telemetry.c | 108 ++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c
index f246a03e2966..02d23486806e 100644
--- a/lib/ethdev/rte_ethdev_telemetry.c
+++ b/lib/ethdev/rte_ethdev_telemetry.c
@@ -11,6 +11,7 @@
#include "rte_ethdev.h"
#include "ethdev_driver.h"
#include "sff_telemetry.h"
+#include "rte_tm.h"
static const struct {
uint32_t capa;
@@ -1021,6 +1022,111 @@ eth_dev_handle_port_vlan(const char *cmd __rte_unused,
return eth_dev_add_vlan_id(port_id, d);
}
+static void
+eth_dev_add_tm_caps(struct rte_tel_data *d, struct rte_tm_capabilities *cap)
+{
+ rte_tel_data_add_dict_uint(d, "n_nodes_max", cap->n_nodes_max);
+ rte_tel_data_add_dict_uint(d, "n_levels_max", cap->n_levels_max);
+ rte_tel_data_add_dict_int(d, "non_leaf_nodes_identical",
+ cap->non_leaf_nodes_identical);
+ rte_tel_data_add_dict_int(d, "leaf_nodes_identical",
+ cap->leaf_nodes_identical);
+ rte_tel_data_add_dict_uint(d, "shaper_n_max", cap->shaper_n_max);
+ rte_tel_data_add_dict_uint(d, "shaper_private_n_max",
+ cap->shaper_private_n_max);
+ rte_tel_data_add_dict_int(d, "shaper_private_dual_rate_n_max",
+ cap->shaper_private_dual_rate_n_max);
+ rte_tel_data_add_dict_uint(d, "shaper_private_rate_min",
+ cap->shaper_private_rate_min);
+ rte_tel_data_add_dict_uint(d, "shaper_private_rate_max",
+ cap->shaper_private_rate_max);
+ rte_tel_data_add_dict_int(d, "shaper_private_packet_mode_supported",
+ cap->shaper_private_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "shaper_private_byte_mode_supported",
+ cap->shaper_private_byte_mode_supported);
+ rte_tel_data_add_dict_uint(d, "shaper_shared_n_max",
+ cap->shaper_shared_n_max);
+ rte_tel_data_add_dict_uint(d, "shaper_shared_n_nodes_per_shaper_max",
+ cap->shaper_shared_n_nodes_per_shaper_max);
+ rte_tel_data_add_dict_uint(d, "shaper_shared_n_shapers_per_node_max",
+ cap->shaper_shared_n_shapers_per_node_max);
+ rte_tel_data_add_dict_uint(d, "shaper_share_dual_rate_n_max",
+ cap->shaper_shared_dual_rate_n_max);
+ rte_tel_data_add_dict_uint(d, "shaper_shared_rate_min",
+ cap->shaper_shared_rate_min);
+ rte_tel_data_add_dict_uint(d, "shaper_shared_rate_max",
+ cap->shaper_shared_rate_max);
+ rte_tel_data_add_dict_int(d, "shaper_shared_packet_mode_supported",
+ cap->shaper_shared_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "shaper_shared_byte_mode_supported",
+ cap->shaper_shared_byte_mode_supported);
+ rte_tel_data_add_dict_int(d, "shaper_pkt_length_adjust_min",
+ cap->shaper_pkt_length_adjust_min);
+ rte_tel_data_add_dict_int(d, "shaper_pkt_length_adjust_max",
+ cap->shaper_pkt_length_adjust_max);
+ rte_tel_data_add_dict_uint(d, "sched_n_children_max",
+ cap->sched_n_children_max);
+ rte_tel_data_add_dict_uint(d, "sched_sp_n_priorities_max",
+ cap->sched_sp_n_priorities_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_n_children_per_group_max",
+ cap->sched_wfq_n_children_per_group_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_n_groups_max",
+ cap->sched_wfq_n_groups_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_weight_max",
+ cap->sched_wfq_weight_max);
+ rte_tel_data_add_dict_int(d, "sched_wfq_packet_mode_supported",
+ cap->sched_wfq_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "sched_wfq_byte_mode_supported",
+ cap->sched_wfq_byte_mode_supported);
+ rte_tel_data_add_dict_int(d, "cman_wred_packet_mode_supported",
+ cap->cman_wred_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "cman_wred_byte_mode_supported",
+ cap->cman_wred_byte_mode_supported);
+ rte_tel_data_add_dict_int(d, "cman_head_drop_supported",
+ cap->cman_head_drop_supported);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_n_max",
+ cap->cman_wred_context_n_max);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_private_n_max",
+ cap->cman_wred_context_private_n_max);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_shared_n_max",
+ cap->cman_wred_context_shared_n_max);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_shared_n_nodes_per_context_max",
+ cap->cman_wred_context_shared_n_nodes_per_context_max);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_shared_n_contexts_per_node_max",
+ cap->cman_wred_context_shared_n_contexts_per_node_max);
+ rte_tel_data_add_dict_uint_hex(d, "dynamic_update", cap->dynamic_update_mask, 0);
+ rte_tel_data_add_dict_uint_hex(d, "stats_mask", cap->stats_mask, 0);
+}
+
+static int
+eth_dev_handle_port_tm_caps(const char *cmd __rte_unused,
+ const char *params,
+ struct rte_tel_data *d)
+{
+ struct rte_tm_capabilities cap = {0};
+ struct rte_tm_error error = {0};
+ uint16_t port_id;
+ char *end_param;
+ int ret;
+
+ ret = eth_dev_parse_port_params(params, &port_id, &end_param, false);
+ if (ret != 0)
+ return ret;
+
+ ret = rte_tm_capabilities_get(port_id, &cap, &error);
+ if (ret != 0) {
+ RTE_ETHDEV_LOG(ERR, "error: %s, error type: %u\n",
+ error.message ? error.message : "no stated reason",
+ error.type);
+ return ret;
+ }
+
+ rte_tel_data_start_dict(d);
+ eth_dev_add_tm_caps(d, &cap);
+
+ return 0;
+}
+
RTE_INIT(ethdev_init_telemetry)
{
rte_telemetry_register_cmd("/ethdev/list", eth_dev_handle_port_list,
@@ -1056,4 +1162,6 @@ RTE_INIT(ethdev_init_telemetry)
"Returns FEC info for a port. Parameters: int port_id");
rte_telemetry_register_cmd("/ethdev/vlan", eth_dev_handle_port_vlan,
"Returns VLAN info for a port. Parameters: int port_id");
+ rte_telemetry_register_cmd("/ethdev/tm_capability", eth_dev_handle_port_tm_caps,
+ "Returns TM Capabilities info for a port. Parameters: int port_id");
}
--
2.30.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] ethdev: add telemetry command for TM level capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
2023-10-18 1:39 ` [PATCH 1/4] net/hns3: fix a typo Jie Hai
2023-10-18 1:39 ` [PATCH 2/4] ethdev: add telemetry command for TM capabilities Jie Hai
@ 2023-10-18 1:39 ` Jie Hai
2023-10-18 1:39 ` [PATCH 4/4] ethdev: add telemetry command for TM node capabilities Jie Hai
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jie Hai @ 2023-10-18 1:39 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: haijie1, lihuisong
This patch adds a telemetry command for traffic management level
capabilities, using (port_id,level_id) as parameters. An
example usage is shown below:
--> /ethdev/tm_level_capability,0,0
{
"/ethdev/tm_level_capability": {
"n_nodes_max": 1,
"n_nodes_nonleaf_max": 1,
"n_nodes_leaf_max": 0,
"non_leaf_nodes_identical": 1,
"leaf_nodes_identical": 1,
"nonleaf_cap": {
"shaper_private_supported": 1,
"shaper_private_dual_rate_supported": 0,
"shaper_private_rate_min": 0,
"shaper_private_rate_max": 25000000000,
"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,
"sched_n_children_max": 8,
"sched_sp_n_priorities_max": 1,
"sched_wfq_n_children_per_group_max": 0,
"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": "0x0"
},
"leaf_cap": {
"shaper_private_supported": 1,
"shaper_private_dual_rate_supported": 0,
"shaper_private_rate_min": 0,
"shaper_private_rate_max": 25000000000,
"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_wred_packet_mode_supported": 8,
"cman_wred_byte_mode_supported": 1,
"cman_head_drop_supported": 0,
"cman_wred_context_private_supported": 0,
"cman_wred_context_shared_n_max": 1,
"stats_mask": "0x0"
}
}
}
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev_telemetry.c | 168 ++++++++++++++++++++++++++++++
1 file changed, 168 insertions(+)
diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c
index 02d23486806e..4a56685be426 100644
--- a/lib/ethdev/rte_ethdev_telemetry.c
+++ b/lib/ethdev/rte_ethdev_telemetry.c
@@ -1127,6 +1127,172 @@ eth_dev_handle_port_tm_caps(const char *cmd __rte_unused,
return 0;
}
+static void
+eth_dev_add_tm_level_basic_caps(struct rte_tel_data *d,
+ struct rte_tm_level_capabilities *cap)
+{
+ rte_tel_data_add_dict_uint(d, "n_nodes_max", cap->n_nodes_max);
+ rte_tel_data_add_dict_uint(d, "n_nodes_nonleaf_max",
+ cap->n_nodes_nonleaf_max);
+ rte_tel_data_add_dict_uint(d, "n_nodes_leaf_max", cap->n_nodes_leaf_max);
+ rte_tel_data_add_dict_int(d, "non_leaf_nodes_identical",
+ cap->non_leaf_nodes_identical);
+ rte_tel_data_add_dict_int(d, "leaf_nodes_identical",
+ cap->leaf_nodes_identical);
+}
+
+static void
+eth_dev_add_tm_level_nonleaf_caps(struct rte_tel_data *nonleaf,
+ struct rte_tm_level_capabilities *cap)
+{
+ rte_tel_data_add_dict_int(nonleaf, "shaper_private_supported",
+ cap->nonleaf.shaper_private_supported);
+ rte_tel_data_add_dict_int(nonleaf, "shaper_private_dual_rate_supported",
+ cap->nonleaf.shaper_private_dual_rate_supported);
+ rte_tel_data_add_dict_uint(nonleaf, "shaper_private_rate_min",
+ cap->nonleaf.shaper_private_rate_min);
+ rte_tel_data_add_dict_uint(nonleaf, "shaper_private_rate_max",
+ cap->nonleaf.shaper_private_rate_max);
+ rte_tel_data_add_dict_int(nonleaf, "shaper_private_packet_mode_supported",
+ cap->nonleaf.shaper_private_packet_mode_supported);
+ rte_tel_data_add_dict_int(nonleaf, "shaper_private_byte_mode_supported",
+ cap->nonleaf.shaper_private_byte_mode_supported);
+ rte_tel_data_add_dict_uint(nonleaf, "shaper_shared_n_max",
+ cap->nonleaf.shaper_shared_n_max);
+ rte_tel_data_add_dict_int(nonleaf, "shaper_shared_packet_mode_supported",
+ cap->nonleaf.shaper_shared_packet_mode_supported);
+ rte_tel_data_add_dict_int(nonleaf, "shaper_shared_byte_mode_supported",
+ cap->nonleaf.shaper_shared_byte_mode_supported);
+ rte_tel_data_add_dict_uint(nonleaf, "sched_n_children_max",
+ cap->nonleaf.sched_n_children_max);
+ rte_tel_data_add_dict_uint(nonleaf, "sched_sp_n_priorities_max",
+ cap->nonleaf.sched_sp_n_priorities_max);
+ rte_tel_data_add_dict_uint(nonleaf, "sched_wfq_n_children_per_group_max",
+ cap->nonleaf.sched_wfq_n_children_per_group_max);
+ rte_tel_data_add_dict_uint(nonleaf, "sched_wfq_n_groups_max",
+ cap->nonleaf.sched_wfq_n_groups_max);
+ rte_tel_data_add_dict_uint(nonleaf, "sched_wfq_weight_max",
+ cap->nonleaf.sched_wfq_weight_max);
+ rte_tel_data_add_dict_int(nonleaf, "sched_wfq_packet_mode_supported",
+ cap->nonleaf.sched_wfq_packet_mode_supported);
+ rte_tel_data_add_dict_int(nonleaf, "sched_wfq_byte_mode_supported",
+ cap->nonleaf.sched_wfq_byte_mode_supported);
+ rte_tel_data_add_dict_uint_hex(nonleaf, "stats_mask",
+ cap->nonleaf.stats_mask, 0);
+}
+
+static void
+eth_dev_add_tm_level_leaf_caps(struct rte_tel_data *leaf,
+ struct rte_tm_level_capabilities *cap)
+{
+ rte_tel_data_add_dict_int(leaf, "shaper_private_supported",
+ cap->leaf.shaper_private_supported);
+ rte_tel_data_add_dict_int(leaf, "shaper_private_dual_rate_supported",
+ cap->leaf.shaper_private_dual_rate_supported);
+ rte_tel_data_add_dict_uint(leaf, "shaper_private_rate_min",
+ cap->leaf.shaper_private_rate_min);
+ rte_tel_data_add_dict_uint(leaf, "shaper_private_rate_max",
+ cap->leaf.shaper_private_rate_max);
+ rte_tel_data_add_dict_int(leaf, "shaper_private_packet_mode_supported",
+ cap->leaf.shaper_private_packet_mode_supported);
+ rte_tel_data_add_dict_int(leaf, "shaper_private_byte_mode_supported",
+ cap->leaf.shaper_private_byte_mode_supported);
+ rte_tel_data_add_dict_uint(leaf, "shaper_shared_n_max",
+ cap->leaf.shaper_shared_n_max);
+ rte_tel_data_add_dict_int(leaf, "shaper_shared_packet_mode_supported",
+ cap->leaf.shaper_shared_packet_mode_supported);
+ rte_tel_data_add_dict_int(leaf, "shaper_shared_byte_mode_supported",
+ cap->leaf.shaper_shared_byte_mode_supported);
+ rte_tel_data_add_dict_int(leaf, "cman_wred_packet_mode_supported",
+ cap->leaf.cman_wred_packet_mode_supported);
+ rte_tel_data_add_dict_int(leaf, "cman_wred_byte_mode_supported",
+ cap->leaf.cman_wred_byte_mode_supported);
+ rte_tel_data_add_dict_int(leaf, "cman_head_drop_supported",
+ cap->leaf.cman_head_drop_supported);
+ rte_tel_data_add_dict_int(leaf, "cman_wred_context_private_supported",
+ cap->leaf.cman_wred_context_private_supported);
+ rte_tel_data_add_dict_uint(leaf, "cman_wred_context_shared_n_max",
+ cap->leaf.cman_wred_context_shared_n_max);
+ rte_tel_data_add_dict_uint_hex(leaf, "stats_mask",
+ cap->leaf.stats_mask, 0);
+}
+
+static int
+eth_dev_parse_tm_params(char *params, uint32_t *result)
+{
+ const char *splited_param;
+ uint64_t ret;
+
+ splited_param = strtok(params, ",");
+ if (!splited_param || strlen(splited_param) == 0 || !isdigit(*splited_param))
+ return -EINVAL;
+
+ ret = strtoul(splited_param, ¶ms, 0);
+ if (*params != '\0')
+ RTE_ETHDEV_LOG(NOTICE,
+ "Extra parameters passed to ethdev telemetry command, ignoring\n");
+
+ if (ret >= UINT32_MAX)
+ return -EINVAL;
+
+ *result = ret;
+ return 0;
+}
+
+static int
+eth_dev_handle_port_tm_level_caps(const char *cmd __rte_unused,
+ const char *params,
+ struct rte_tel_data *d)
+{
+ struct rte_tm_level_capabilities cap = {0};
+ struct rte_tm_error error = {0};
+ struct rte_tel_data *nonleaf;
+ struct rte_tel_data *leaf;
+ uint32_t level_id;
+ uint16_t port_id;
+ char *end_param;
+ int ret;
+
+ ret = eth_dev_parse_port_params(params, &port_id, &end_param, true);
+ if (ret != 0)
+ return ret;
+
+ ret = eth_dev_parse_tm_params(end_param, &level_id);
+ if (ret != 0)
+ return ret;
+
+ ret = rte_tm_level_capabilities_get(port_id, level_id, &cap, &error);
+ if (ret != 0) {
+ RTE_ETHDEV_LOG(ERR, "error: %s, error type: %u\n",
+ error.message ? error.message : "no stated reason",
+ error.type);
+ return ret;
+ }
+
+ rte_tel_data_start_dict(d);
+ eth_dev_add_tm_level_basic_caps(d, &cap);
+
+ nonleaf = rte_tel_data_alloc();
+ if (nonleaf == NULL)
+ return -ENOMEM;
+
+ rte_tel_data_start_dict(nonleaf);
+ eth_dev_add_tm_level_nonleaf_caps(nonleaf, &cap);
+ rte_tel_data_add_dict_container(d, "nonleaf_cap", nonleaf, 0);
+
+ leaf = rte_tel_data_alloc();
+ if (leaf == NULL) {
+ rte_tel_data_free(nonleaf);
+ return -ENOMEM;
+ }
+
+ rte_tel_data_start_dict(leaf);
+ eth_dev_add_tm_level_leaf_caps(leaf, &cap);
+ rte_tel_data_add_dict_container(d, "leaf_cap", leaf, 0);
+
+ return 0;
+}
+
RTE_INIT(ethdev_init_telemetry)
{
rte_telemetry_register_cmd("/ethdev/list", eth_dev_handle_port_list,
@@ -1164,4 +1330,6 @@ RTE_INIT(ethdev_init_telemetry)
"Returns VLAN info for a port. Parameters: int port_id");
rte_telemetry_register_cmd("/ethdev/tm_capability", eth_dev_handle_port_tm_caps,
"Returns TM Capabilities info for a port. Parameters: int port_id");
+ rte_telemetry_register_cmd("/ethdev/tm_level_capability", eth_dev_handle_port_tm_level_caps,
+ "Returns TM Level Capabilities info for a port. Parameters: int port_id, int level_id (see tm_capability for the max)");
}
--
2.30.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] ethdev: add telemetry command for TM node capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
` (2 preceding siblings ...)
2023-10-18 1:39 ` [PATCH 3/4] ethdev: add telemetry command for TM level capabilities Jie Hai
@ 2023-10-18 1:39 ` Jie Hai
2023-10-18 10:50 ` [PATCH 0/4] add telemetry commands for TM capabilities fengchengwen
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Jie Hai @ 2023-10-18 1:39 UTC (permalink / raw)
To: dev, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko; +Cc: haijie1, lihuisong
This patch adds a telemetry command for traffic management node
capabilities, using (port_id, node_id) as parameters. An example
usage is shown below:
--> /ethdev/tm_node_capability,0,264
{
"/ethdev/tm_node_capability": {
"shaper_private_supported": 1,
"shaper_private_dual_rate_supported": 0,
"shaper_private_rate_min": 0,
"shaper_private_rate_max": 25000000000,
"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,
"stats_mask": "0x0",
"node_type": "nonleaf",
"children_max": 8,
"priorities_max": 1,
"sched_wfq_n_children_per_group_max": 0,
"sched_wfq_n_groups_max": 0,
"sched_wfq_weight_max": 1,
"sched_wfq_packet_mode_supported": 0,
"sched_wfq_byte_mode_supported": 0
}
}
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
lib/ethdev/rte_ethdev_telemetry.c | 104 ++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/lib/ethdev/rte_ethdev_telemetry.c b/lib/ethdev/rte_ethdev_telemetry.c
index 4a56685be426..b01028ce9b60 100644
--- a/lib/ethdev/rte_ethdev_telemetry.c
+++ b/lib/ethdev/rte_ethdev_telemetry.c
@@ -1293,6 +1293,108 @@ eth_dev_handle_port_tm_level_caps(const char *cmd __rte_unused,
return 0;
}
+static void
+eth_dev_add_tm_node_basic_caps(struct rte_tel_data *node_data,
+ struct rte_tm_node_capabilities *capnode)
+{
+ rte_tel_data_add_dict_int(node_data, "shaper_private_supported",
+ capnode->shaper_private_supported);
+ rte_tel_data_add_dict_int(node_data, "shaper_private_dual_rate_supported",
+ capnode->shaper_private_dual_rate_supported);
+ rte_tel_data_add_dict_uint(node_data, "shaper_private_rate_min",
+ capnode->shaper_private_rate_min);
+ rte_tel_data_add_dict_uint(node_data, "shaper_private_rate_max",
+ capnode->shaper_private_rate_max);
+ rte_tel_data_add_dict_int(node_data, "shaper_private_packet_mode_supported",
+ capnode->shaper_private_packet_mode_supported);
+ rte_tel_data_add_dict_int(node_data, "shaper_private_byte_mode_supported",
+ capnode->shaper_private_byte_mode_supported);
+ rte_tel_data_add_dict_uint(node_data, "shaper_shared_n_max",
+ capnode->shaper_shared_n_max);
+ rte_tel_data_add_dict_int(node_data, "shaper_shared_packet_mode_supported",
+ capnode->shaper_shared_packet_mode_supported);
+ rte_tel_data_add_dict_int(node_data, "shaper_shared_byte_mode_supported",
+ capnode->shaper_shared_byte_mode_supported);
+ rte_tel_data_add_dict_uint_hex(node_data, "stats_mask",
+ capnode->stats_mask, 0);
+}
+
+static void
+eth_dev_add_tm_type_node_caps(struct rte_tel_data *d, int is_leaf,
+ struct rte_tm_node_capabilities *cap)
+{
+ rte_tel_data_add_dict_string(d, "node_type",
+ is_leaf == 0 ? "nonleaf" : "leaf");
+ if (is_leaf == 0) {
+ rte_tel_data_add_dict_uint(d, "children_max",
+ cap->nonleaf.sched_n_children_max);
+ rte_tel_data_add_dict_uint(d, "priorities_max",
+ cap->nonleaf.sched_sp_n_priorities_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_n_children_per_group_max",
+ cap->nonleaf.sched_wfq_n_children_per_group_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_n_groups_max",
+ cap->nonleaf.sched_wfq_n_groups_max);
+ rte_tel_data_add_dict_uint(d, "sched_wfq_weight_max",
+ cap->nonleaf.sched_wfq_weight_max);
+ rte_tel_data_add_dict_int(d, "sched_wfq_packet_mode_supported",
+ cap->nonleaf.sched_wfq_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "sched_wfq_byte_mode_supported",
+ cap->nonleaf.sched_wfq_byte_mode_supported);
+ } else {
+ rte_tel_data_add_dict_int(d, "cman_wred_packet_mode_supported",
+ cap->leaf.cman_wred_packet_mode_supported);
+ rte_tel_data_add_dict_int(d, "cman_wred_byte_mode_supported",
+ cap->leaf.cman_wred_byte_mode_supported);
+ rte_tel_data_add_dict_int(d, "cman_head_drop_supported",
+ cap->leaf.cman_head_drop_supported);
+ rte_tel_data_add_dict_int(d, "cman_wred_context_private_supported",
+ cap->leaf.cman_wred_context_private_supported);
+ rte_tel_data_add_dict_uint(d, "cman_wred_context_shared_n_max",
+ cap->leaf.cman_wred_context_shared_n_max);
+ }
+}
+
+static int
+eth_dev_handle_port_tm_node_caps(const char *cmd __rte_unused,
+ const char *params,
+ struct rte_tel_data *d)
+{
+ struct rte_tm_node_capabilities cap = {0};
+ struct rte_tm_error error = {0};
+ uint32_t node_id;
+ uint16_t port_id;
+ char *end_param;
+ int is_leaf;
+ int ret;
+
+ ret = eth_dev_parse_port_params(params, &port_id, &end_param, true);
+ if (ret != 0)
+ return ret;
+
+ ret = eth_dev_parse_tm_params(end_param, &node_id);
+ if (ret != 0)
+ return ret;
+
+ ret = rte_tm_node_capabilities_get(port_id, node_id, &cap, &error);
+ if (ret != 0)
+ goto out;
+
+ ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
+ if (ret != 0)
+ goto out;
+
+ rte_tel_data_start_dict(d);
+ eth_dev_add_tm_node_basic_caps(d, &cap);
+ eth_dev_add_tm_type_node_caps(d, is_leaf, &cap);
+
+ return 0;
+out:
+ RTE_ETHDEV_LOG(WARNING, "error: %s, error type: %u\n",
+ error.message ? error.message : "no stated reason",
+ error.type);
+ return ret;
+}
+
RTE_INIT(ethdev_init_telemetry)
{
rte_telemetry_register_cmd("/ethdev/list", eth_dev_handle_port_list,
@@ -1332,4 +1434,6 @@ RTE_INIT(ethdev_init_telemetry)
"Returns TM Capabilities info for a port. Parameters: int port_id");
rte_telemetry_register_cmd("/ethdev/tm_level_capability", eth_dev_handle_port_tm_level_caps,
"Returns TM Level Capabilities info for a port. Parameters: int port_id, int level_id (see tm_capability for the max)");
+ rte_telemetry_register_cmd("/ethdev/tm_node_capability", eth_dev_handle_port_tm_node_caps,
+ "Returns TM Node Capabilities info for a port. Parameters: int port_id, int node_id (see tm_capability for the max)");
}
--
2.30.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] add telemetry commands for TM capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
` (3 preceding siblings ...)
2023-10-18 1:39 ` [PATCH 4/4] ethdev: add telemetry command for TM node capabilities Jie Hai
@ 2023-10-18 10:50 ` fengchengwen
2023-10-25 1:47 ` Jie Hai
2023-10-31 15:30 ` Ferruh Yigit
6 siblings, 0 replies; 10+ messages in thread
From: fengchengwen @ 2023-10-18 10:50 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong
Series-acked-by: Chengwen Feng <fengchengwen@huawei.com>
On 2023/10/18 9:39, Jie Hai wrote:
> This patch adds telemetry commands for TM capabilities and make some
> bufix for hns3 driver.
>
> Jie Hai (4):
> net/hns3: fix a typo
> ethdev: add telemetry command for TM capabilities
> ethdev: add telemetry command for TM level capabilities
> ethdev: add telemetry command for TM node capabilities
>
> drivers/net/hns3/hns3_tm.c | 4 +-
> lib/ethdev/rte_ethdev_telemetry.c | 380 ++++++++++++++++++++++++++++++
> 2 files changed, 382 insertions(+), 2 deletions(-)
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] add telemetry commands for TM capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
` (4 preceding siblings ...)
2023-10-18 10:50 ` [PATCH 0/4] add telemetry commands for TM capabilities fengchengwen
@ 2023-10-25 1:47 ` Jie Hai
2023-10-31 15:30 ` Ferruh Yigit
6 siblings, 0 replies; 10+ messages in thread
From: Jie Hai @ 2023-10-25 1:47 UTC (permalink / raw)
To: dev, Ferruh Yigit, Andrew Rybchenko, Thomas Monjalon; +Cc: lihuisong
Hi, all maintainers,
Kindly ping for review.
Thanks,
Jie Hai
On 2023/10/18 9:39, Jie Hai wrote:
> This patch adds telemetry commands for TM capabilities and make some
> bufix for hns3 driver.
>
> Jie Hai (4):
> net/hns3: fix a typo
> ethdev: add telemetry command for TM capabilities
> ethdev: add telemetry command for TM level capabilities
> ethdev: add telemetry command for TM node capabilities
>
> drivers/net/hns3/hns3_tm.c | 4 +-
> lib/ethdev/rte_ethdev_telemetry.c | 380 ++++++++++++++++++++++++++++++
> 2 files changed, 382 insertions(+), 2 deletions(-)
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] add telemetry commands for TM capabilities
2023-10-18 1:39 [PATCH 0/4] add telemetry commands for TM capabilities Jie Hai
` (5 preceding siblings ...)
2023-10-25 1:47 ` Jie Hai
@ 2023-10-31 15:30 ` Ferruh Yigit
6 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2023-10-31 15:30 UTC (permalink / raw)
To: Jie Hai, dev; +Cc: lihuisong
On 10/18/2023 2:39 AM, Jie Hai wrote:
> This patch adds telemetry commands for TM capabilities and make some
> bufix for hns3 driver.
>
> Jie Hai (4):
> net/hns3: fix a typo
> ethdev: add telemetry command for TM capabilities
> ethdev: add telemetry command for TM level capabilities
> ethdev: add telemetry command for TM node capabilities
>
>
Except 1/4,
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread