diff mbox series

[v3,3/4] ethdev: add trace points for mtr

Message ID 20221006151844.23483-4-adwivedi@marvell.com (mailing list archive)
State New
Delegated to: Ferruh Yigit
Headers show
Series add trace points in ethdev library | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ankur Dwivedi Oct. 6, 2022, 3:18 p.m. UTC
Adds trace points for rte_mtr specific functions in ethdev lib.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 lib/ethdev/ethdev_trace_points.c |  57 ++++++++++
 lib/ethdev/rte_ethdev_trace.h    | 176 +++++++++++++++++++++++++++++++
 lib/ethdev/rte_mtr.c             |  27 +++++
 lib/ethdev/version.map           |  19 ++++
 4 files changed, 279 insertions(+)
diff mbox series

Patch

diff --git a/lib/ethdev/ethdev_trace_points.c b/lib/ethdev/ethdev_trace_points.c
index 165be941a1..4fe1b10979 100644
--- a/lib/ethdev/ethdev_trace_points.c
+++ b/lib/ethdev/ethdev_trace_points.c
@@ -581,3 +581,60 @@  RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_destroy,
 
 RTE_TRACE_POINT_REGISTER(rte_flow_trace_async_action_handle_update,
 	lib.ethdev.flow.async_action_handle_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_capabilities_get,
+	lib.ethdev.mtr.capabilities_get)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_create,
+	lib.ethdev.mtr.create)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_destroy,
+	lib.ethdev.mtr.destroy)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_disable,
+	lib.ethdev.mtr.meter_disable)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_dscp_table_update,
+	lib.ethdev.mtr.meter_dscp_table_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_enable,
+	lib.ethdev.mtr.meter_enable)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_add,
+	lib.ethdev.mtr.meter_profile_add)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_delete,
+	lib.ethdev.mtr.meter_profile_delete)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_profile_update,
+	lib.ethdev.mtr.meter_profile_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_stats_read,
+	lib.ethdev.mtr.stats_read)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_stats_update,
+	lib.ethdev.mtr.stats_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_add,
+	lib.ethdev.mtr.meter_policy_add)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_delete,
+	lib.ethdev.mtr.meter_policy_delete)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_update,
+	lib.ethdev.mtr.meter_policy_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_policy_validate,
+	lib.ethdev.mtr.meter_policy_validate)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_meter_vlan_table_update,
+	lib.ethdev.mtr.meter_vlan_table_update)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_get,
+	lib.ethdev.mtr.color_in_protocol_get)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_priority_get,
+	lib.ethdev.mtr.color_in_protocol_priority_get)
+
+RTE_TRACE_POINT_REGISTER(rte_mtr_trace_color_in_protocol_set,
+	lib.ethdev.mtr.color_in_protocol_set)
diff --git a/lib/ethdev/rte_ethdev_trace.h b/lib/ethdev/rte_ethdev_trace.h
index d47357babe..af245d5b09 100644
--- a/lib/ethdev/rte_ethdev_trace.h
+++ b/lib/ethdev/rte_ethdev_trace.h
@@ -18,6 +18,7 @@  extern "C" {
 #include <rte_trace_point.h>
 
 #include "rte_ethdev.h"
+#include "rte_mtr.h"
 
 RTE_TRACE_POINT(
 	rte_ethdev_trace_configure,
@@ -1716,6 +1717,181 @@  RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_mtr_trace_capabilities_get,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id,
+		struct rte_mtr_capabilities *cap),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_ptr(cap);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_create,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		struct rte_mtr_params *params, int shared),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_ptr(params);
+	rte_trace_point_emit_u32(params->meter_profile_id);
+	rte_trace_point_emit_int(params->use_prev_mtr_color);
+	rte_trace_point_emit_int(params->meter_enable);
+	rte_trace_point_emit_u64(params->stats_mask);
+	rte_trace_point_emit_u32(params->meter_policy_id);
+	rte_trace_point_emit_int(params->default_input_color);
+	rte_trace_point_emit_int(shared);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_destroy,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_disable,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_dscp_table_update,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		enum rte_color *dscp_table),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_ptr(dscp_table);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_enable,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_profile_add,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id,
+		uint32_t meter_profile_id,
+		struct rte_mtr_meter_profile *profile),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(meter_profile_id);
+	rte_trace_point_emit_int(profile->alg);
+	rte_trace_point_emit_int(profile->packet_mode);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_profile_delete,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id,
+		uint32_t meter_profile_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(meter_profile_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_profile_update,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		uint32_t meter_profile_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_u32(meter_profile_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_stats_read,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		struct rte_mtr_stats *stats, uint64_t *stats_mask,
+		int clear),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_ptr(stats);
+	rte_trace_point_emit_ptr(stats_mask);
+	rte_trace_point_emit_int(clear);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_stats_update,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		uint64_t stats_mask),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_u64(stats_mask);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_policy_add,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t policy_id,
+		const struct rte_flow_action *actions),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(policy_id);
+	rte_trace_point_emit_ptr(actions);
+	rte_trace_point_emit_int(actions->type);
+	rte_trace_point_emit_ptr(actions->conf);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_policy_delete,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t policy_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(policy_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_policy_update,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		uint32_t meter_policy_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_u32(meter_policy_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_policy_validate,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id,
+		const struct rte_flow_action *actions),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_ptr(actions);
+	rte_trace_point_emit_int(actions->type);
+	rte_trace_point_emit_ptr(actions->conf);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_meter_vlan_table_update,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		enum rte_color *vlan_table),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_ptr(vlan_table);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_color_in_protocol_get,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_color_in_protocol_priority_get,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		enum rte_mtr_color_in_protocol proto),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_int(proto);
+)
+
+RTE_TRACE_POINT(
+	rte_mtr_trace_color_in_protocol_set,
+	RTE_TRACE_POINT_ARGS(uint16_t port_id, uint32_t mtr_id,
+		enum rte_mtr_color_in_protocol proto, uint32_t priority),
+	rte_trace_point_emit_u16(port_id);
+	rte_trace_point_emit_u32(mtr_id);
+	rte_trace_point_emit_int(proto);
+	rte_trace_point_emit_u32(priority);
+)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/ethdev/rte_mtr.c b/lib/ethdev/rte_mtr.c
index 3954839531..a8a8985c24 100644
--- a/lib/ethdev/rte_mtr.c
+++ b/lib/ethdev/rte_mtr.c
@@ -6,6 +6,7 @@ 
 
 #include <rte_errno.h>
 #include "rte_ethdev.h"
+#include "rte_ethdev_trace.h"
 #include "rte_mtr_driver.h"
 #include "rte_mtr.h"
 
@@ -82,6 +83,7 @@  rte_mtr_capabilities_get(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_capabilities_get(port_id, cap);
 	return RTE_MTR_FUNC(port_id, capabilities_get)(dev,
 		cap, error);
 }
@@ -94,6 +96,7 @@  rte_mtr_meter_profile_add(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_profile_add(port_id, meter_profile_id, profile);
 	return RTE_MTR_FUNC(port_id, meter_profile_add)(dev,
 		meter_profile_id, profile, error);
 }
@@ -105,6 +108,7 @@  rte_mtr_meter_profile_delete(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_profile_delete(port_id, meter_profile_id);
 	return RTE_MTR_FUNC(port_id, meter_profile_delete)(dev,
 		meter_profile_id, error);
 }
@@ -127,6 +131,10 @@  rte_mtr_meter_policy_validate(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	int i;
+
+	for (i = 0; i < RTE_COLORS; i++)
+		rte_mtr_trace_meter_policy_validate(port_id, policy->actions[i]);
 	return RTE_MTR_FUNC(port_id, meter_policy_validate)(dev,
 		policy, error);
 }
@@ -139,6 +147,11 @@  rte_mtr_meter_policy_add(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	int i;
+
+	for (i = 0; i < RTE_COLORS; i++)
+		rte_mtr_trace_meter_policy_add(port_id, policy_id,
+					       policy->actions[i]);
 	return RTE_MTR_FUNC(port_id, meter_policy_add)(dev,
 		policy_id, policy, error);
 }
@@ -150,6 +163,7 @@  rte_mtr_meter_policy_delete(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_policy_delete(port_id, policy_id);
 	return RTE_MTR_FUNC(port_id, meter_policy_delete)(dev,
 		policy_id, error);
 }
@@ -174,6 +188,7 @@  rte_mtr_create(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_create(port_id, mtr_id, params, shared);
 	return RTE_MTR_FUNC(port_id, create)(dev,
 		mtr_id, params, shared, error);
 }
@@ -185,6 +200,7 @@  rte_mtr_destroy(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_destroy(port_id, mtr_id);
 	return RTE_MTR_FUNC(port_id, destroy)(dev,
 		mtr_id, error);
 }
@@ -196,6 +212,7 @@  rte_mtr_meter_enable(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_enable(port_id, mtr_id);
 	return RTE_MTR_FUNC(port_id, meter_enable)(dev,
 		mtr_id, error);
 }
@@ -207,6 +224,7 @@  rte_mtr_meter_disable(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_disable(port_id, mtr_id);
 	return RTE_MTR_FUNC(port_id, meter_disable)(dev,
 		mtr_id, error);
 }
@@ -219,6 +237,7 @@  rte_mtr_meter_profile_update(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_profile_update(port_id, mtr_id, meter_profile_id);
 	return RTE_MTR_FUNC(port_id, meter_profile_update)(dev,
 		mtr_id, meter_profile_id, error);
 }
@@ -231,6 +250,7 @@  rte_mtr_meter_policy_update(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_policy_update(port_id, mtr_id, meter_policy_id);
 	return RTE_MTR_FUNC(port_id, meter_policy_update)(dev,
 		mtr_id, meter_policy_id, error);
 }
@@ -243,6 +263,7 @@  rte_mtr_meter_dscp_table_update(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_dscp_table_update(port_id, mtr_id, dscp_table);
 	return RTE_MTR_FUNC(port_id, meter_dscp_table_update)(dev,
 		mtr_id, proto, dscp_table, error);
 }
@@ -255,6 +276,7 @@  rte_mtr_meter_vlan_table_update(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_meter_vlan_table_update(port_id, mtr_id, vlan_table);
 	return RTE_MTR_FUNC(port_id, meter_vlan_table_update)(dev,
 		mtr_id, proto, vlan_table, error);
 }
@@ -268,6 +290,7 @@  rte_mtr_color_in_protocol_set(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_color_in_protocol_set(port_id, mtr_id, proto, priority);
 	return RTE_MTR_FUNC(port_id, in_proto_set)(dev,
 		mtr_id, proto, priority, error);
 }
@@ -280,6 +303,7 @@  rte_mtr_color_in_protocol_get(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_color_in_protocol_get(port_id, mtr_id);
 	return RTE_MTR_FUNC(port_id, in_proto_get)(dev,
 		mtr_id, proto_mask, error);
 }
@@ -293,6 +317,7 @@  rte_mtr_color_in_protocol_priority_get(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_color_in_protocol_priority_get(port_id, mtr_id, proto);
 	return RTE_MTR_FUNC(port_id, in_proto_prio_get)(dev,
 		mtr_id, proto, priority, error);
 }
@@ -305,6 +330,7 @@  rte_mtr_stats_update(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_stats_update(port_id, mtr_id, stats_mask);
 	return RTE_MTR_FUNC(port_id, stats_update)(dev,
 		mtr_id, stats_mask, error);
 }
@@ -319,6 +345,7 @@  rte_mtr_stats_read(uint16_t port_id,
 	struct rte_mtr_error *error)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+	rte_mtr_trace_stats_read(port_id, mtr_id, stats, stats_mask, clear);
 	return RTE_MTR_FUNC(port_id, stats_read)(dev,
 		mtr_id, stats, stats_mask, clear, error);
 }
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 50897a6cee..e2c335ac25 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -502,4 +502,23 @@  INTERNAL {
 	__rte_flow_trace_tunnel_item_release;
 	__rte_flow_trace_tunnel_match;
 	__rte_flow_trace_validate;
+	__rte_mtr_trace_capabilities_get;
+	__rte_mtr_trace_color_in_protocol_get;
+	__rte_mtr_trace_color_in_protocol_priority_get;
+	__rte_mtr_trace_color_in_protocol_set;
+	__rte_mtr_trace_create;
+	__rte_mtr_trace_destroy;
+	__rte_mtr_trace_meter_disable;
+	__rte_mtr_trace_meter_dscp_table_update;
+	__rte_mtr_trace_meter_enable;
+	__rte_mtr_trace_meter_policy_add;
+	__rte_mtr_trace_meter_policy_delete;
+	__rte_mtr_trace_meter_policy_update;
+	__rte_mtr_trace_meter_policy_validate;
+	__rte_mtr_trace_meter_profile_add;
+	__rte_mtr_trace_meter_profile_delete;
+	__rte_mtr_trace_meter_profile_update;
+	__rte_mtr_trace_meter_vlan_table_update;
+	__rte_mtr_trace_stats_read;
+	__rte_mtr_trace_stats_update;
 };