* [PATCH v2] dmadev: add tracepoints
@ 2023-04-14 9:09 Chengwen Feng
2023-04-14 12:46 ` Morten Brørup
0 siblings, 1 reply; 3+ messages in thread
From: Chengwen Feng @ 2023-04-14 9:09 UTC (permalink / raw)
To: thomas, mb, Kevin Laatz, Bruce Richardson; +Cc: dev
Add tracepoints at important APIs for tracing support.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
v2: Address Morten's comment:
Make stats_get as fast-path trace-points.
Place fast-path trace-point functions behind in version.map.
---
lib/dmadev/meson.build | 2 +-
lib/dmadev/rte_dmadev.c | 39 ++++++--
lib/dmadev/rte_dmadev.h | 56 ++++++++---
lib/dmadev/rte_dmadev_trace.h | 136 +++++++++++++++++++++++++++
lib/dmadev/rte_dmadev_trace_fp.h | 113 ++++++++++++++++++++++
lib/dmadev/rte_dmadev_trace_points.c | 59 ++++++++++++
lib/dmadev/version.map | 10 ++
7 files changed, 394 insertions(+), 21 deletions(-)
create mode 100644 lib/dmadev/rte_dmadev_trace.h
create mode 100644 lib/dmadev/rte_dmadev_trace_fp.h
create mode 100644 lib/dmadev/rte_dmadev_trace_points.c
diff --git a/lib/dmadev/meson.build b/lib/dmadev/meson.build
index 2f17587b75..e0d90aea67 100644
--- a/lib/dmadev/meson.build
+++ b/lib/dmadev/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2021 HiSilicon Limited.
-sources = files('rte_dmadev.c')
+sources = files('rte_dmadev.c', 'rte_dmadev_trace_points.c')
headers = files('rte_dmadev.h')
indirect_headers += files('rte_dmadev_core.h')
driver_sdk_headers += files('rte_dmadev_pmd.h')
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 8c095e1f35..25fa78de8f 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -17,6 +17,7 @@
#include "rte_dmadev.h"
#include "rte_dmadev_pmd.h"
+#include "rte_dmadev_trace.h"
static int16_t dma_devices_max;
@@ -434,6 +435,8 @@ rte_dma_info_get(int16_t dev_id, struct rte_dma_info *dev_info)
dev_info->numa_node = dev->device->numa_node;
dev_info->nb_vchans = dev->data->dev_conf.nb_vchans;
+ rte_dma_trace_info_get(dev_id, dev_info);
+
return 0;
}
@@ -483,6 +486,8 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
memcpy(&dev->data->dev_conf, dev_conf,
sizeof(struct rte_dma_conf));
+ rte_dma_trace_configure(dev_id, dev_conf, ret);
+
return ret;
}
@@ -509,6 +514,7 @@ rte_dma_start(int16_t dev_id)
goto mark_started;
ret = (*dev->dev_ops->dev_start)(dev);
+ rte_dma_trace_start(dev_id, ret);
if (ret != 0)
return ret;
@@ -535,6 +541,7 @@ rte_dma_stop(int16_t dev_id)
goto mark_stopped;
ret = (*dev->dev_ops->dev_stop)(dev);
+ rte_dma_trace_stop(dev_id, ret);
if (ret != 0)
return ret;
@@ -565,6 +572,8 @@ rte_dma_close(int16_t dev_id)
if (ret == 0)
dma_release(dev);
+ rte_dma_trace_close(dev_id, ret);
+
return ret;
}
@@ -655,14 +664,18 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
if (*dev->dev_ops->vchan_setup == NULL)
return -ENOTSUP;
- return (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
+ ret = (*dev->dev_ops->vchan_setup)(dev, vchan, conf,
sizeof(struct rte_dma_vchan_conf));
+ rte_dma_trace_vchan_setup(dev_id, vchan, conf, ret);
+
+ return ret;
}
int
rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
{
const struct rte_dma_dev *dev = &rte_dma_devices[dev_id];
+ int ret;
if (!rte_dma_is_valid(dev_id) || stats == NULL)
return -EINVAL;
@@ -677,14 +690,18 @@ rte_dma_stats_get(int16_t dev_id, uint16_t vchan, struct rte_dma_stats *stats)
if (*dev->dev_ops->stats_get == NULL)
return -ENOTSUP;
memset(stats, 0, sizeof(struct rte_dma_stats));
- return (*dev->dev_ops->stats_get)(dev, vchan, stats,
- sizeof(struct rte_dma_stats));
+ ret = (*dev->dev_ops->stats_get)(dev, vchan, stats,
+ sizeof(struct rte_dma_stats));
+ rte_dma_trace_stats_get(dev_id, vchan, stats, ret);
+
+ return ret;
}
int
rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
{
struct rte_dma_dev *dev = &rte_dma_devices[dev_id];
+ int ret;
if (!rte_dma_is_valid(dev_id))
return -EINVAL;
@@ -698,13 +715,17 @@ rte_dma_stats_reset(int16_t dev_id, uint16_t vchan)
if (*dev->dev_ops->stats_reset == NULL)
return -ENOTSUP;
- return (*dev->dev_ops->stats_reset)(dev, vchan);
+ ret = (*dev->dev_ops->stats_reset)(dev, vchan);
+ rte_dma_trace_stats_reset(dev_id, vchan, ret);
+
+ return ret;
}
int
rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *status)
{
struct rte_dma_dev *dev = &rte_dma_devices[dev_id];
+ int ret;
if (!rte_dma_is_valid(dev_id))
return -EINVAL;
@@ -716,7 +737,10 @@ rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *
if (*dev->dev_ops->vchan_status == NULL)
return -ENOTSUP;
- return (*dev->dev_ops->vchan_status)(dev, vchan, status);
+ ret = (*dev->dev_ops->vchan_status)(dev, vchan, status);
+ rte_dma_trace_vchan_status(dev_id, vchan, status, ret);
+
+ return ret;
}
static const char *
@@ -792,9 +816,10 @@ rte_dma_dump(int16_t dev_id, FILE *f)
dev->data->dev_conf.enable_silent ? "on" : "off");
if (dev->dev_ops->dev_dump != NULL)
- return (*dev->dev_ops->dev_dump)(dev, f);
+ ret = (*dev->dev_ops->dev_dump)(dev, f);
+ rte_dma_trace_dump(dev_id, f, ret);
- return 0;
+ return ret;
}
static int
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index e61d71959e..e792b90ef8 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -796,6 +796,7 @@ struct rte_dma_sge {
};
#include "rte_dmadev_core.h"
+#include "rte_dmadev_trace_fp.h"
/**@{@name DMA operation flag
* @see rte_dma_copy()
@@ -856,6 +857,7 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
uint32_t length, uint64_t flags)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+ int ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id) || length == 0)
@@ -864,7 +866,10 @@ rte_dma_copy(int16_t dev_id, uint16_t vchan, rte_iova_t src, rte_iova_t dst,
return -ENOTSUP;
#endif
- return (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
+ ret = (*obj->copy)(obj->dev_private, vchan, src, dst, length, flags);
+ rte_dma_trace_copy(dev_id, vchan, src, dst, length, flags, ret);
+
+ return ret;
}
/**
@@ -907,6 +912,7 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
uint64_t flags)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+ int ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id) || src == NULL || dst == NULL ||
@@ -916,8 +922,12 @@ rte_dma_copy_sg(int16_t dev_id, uint16_t vchan, struct rte_dma_sge *src,
return -ENOTSUP;
#endif
- return (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
- nb_dst, flags);
+ ret = (*obj->copy_sg)(obj->dev_private, vchan, src, dst, nb_src,
+ nb_dst, flags);
+ rte_dma_trace_copy_sg(dev_id, vchan, src, dst, nb_src, nb_dst, flags,
+ ret);
+
+ return ret;
}
/**
@@ -955,6 +965,7 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
rte_iova_t dst, uint32_t length, uint64_t flags)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+ int ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id) || length == 0)
@@ -963,8 +974,11 @@ rte_dma_fill(int16_t dev_id, uint16_t vchan, uint64_t pattern,
return -ENOTSUP;
#endif
- return (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
- flags);
+ ret = (*obj->fill)(obj->dev_private, vchan, pattern, dst, length,
+ flags);
+ rte_dma_trace_fill(dev_id, vchan, pattern, dst, length, flags, ret);
+
+ return ret;
}
/**
@@ -989,6 +1003,7 @@ static inline int
rte_dma_submit(int16_t dev_id, uint16_t vchan)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+ int ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id))
@@ -997,7 +1012,10 @@ rte_dma_submit(int16_t dev_id, uint16_t vchan)
return -ENOTSUP;
#endif
- return (*obj->submit)(obj->dev_private, vchan);
+ ret = (*obj->submit)(obj->dev_private, vchan);
+ rte_dma_trace_submit(dev_id, vchan, ret);
+
+ return ret;
}
/**
@@ -1031,7 +1049,7 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
uint16_t *last_idx, bool *has_error)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
- uint16_t idx;
+ uint16_t idx, ret;
bool err;
#ifdef RTE_DMADEV_DEBUG
@@ -1055,8 +1073,12 @@ rte_dma_completed(int16_t dev_id, uint16_t vchan, const uint16_t nb_cpls,
has_error = &err;
*has_error = false;
- return (*obj->completed)(obj->dev_private, vchan, nb_cpls, last_idx,
- has_error);
+ ret = (*obj->completed)(obj->dev_private, vchan, nb_cpls, last_idx,
+ has_error);
+ rte_dma_trace_completed(dev_id, vchan, nb_cpls, last_idx, has_error,
+ ret);
+
+ return ret;
}
/**
@@ -1095,7 +1117,7 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
enum rte_dma_status_code *status)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
- uint16_t idx;
+ uint16_t idx, ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id) || nb_cpls == 0 || status == NULL)
@@ -1107,8 +1129,12 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
if (last_idx == NULL)
last_idx = &idx;
- return (*obj->completed_status)(obj->dev_private, vchan, nb_cpls,
- last_idx, status);
+ ret = (*obj->completed_status)(obj->dev_private, vchan, nb_cpls,
+ last_idx, status);
+ rte_dma_trace_completed_status(dev_id, vchan, nb_cpls, last_idx, status,
+ ret);
+
+ return ret;
}
/**
@@ -1131,6 +1157,7 @@ static inline uint16_t
rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
{
struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+ uint16_t ret;
#ifdef RTE_DMADEV_DEBUG
if (!rte_dma_is_valid(dev_id))
@@ -1138,7 +1165,10 @@ rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
if (*obj->burst_capacity == NULL)
return 0;
#endif
- return (*obj->burst_capacity)(obj->dev_private, vchan);
+ ret = (*obj->burst_capacity)(obj->dev_private, vchan);
+ rte_dma_trace_burst_capacity(dev_id, vchan, ret);
+
+ return ret;
}
#ifdef __cplusplus
diff --git a/lib/dmadev/rte_dmadev_trace.h b/lib/dmadev/rte_dmadev_trace.h
new file mode 100644
index 0000000000..00293a4e38
--- /dev/null
+++ b/lib/dmadev/rte_dmadev_trace.h
@@ -0,0 +1,136 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 HiSilicon Limited
+ */
+
+#ifndef RTE_DMADEV_TRACE_H
+#define RTE_DMADEV_TRACE_H
+
+/**
+ * @file
+ *
+ * API for dmadev trace support.
+ */
+
+#include <rte_trace_point.h>
+
+#include "rte_dmadev.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+RTE_TRACE_POINT(
+ rte_dma_trace_info_get,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, struct rte_dma_info *dev_info),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_string(dev_info->dev_name);
+ rte_trace_point_emit_u64(dev_info->dev_capa);
+ rte_trace_point_emit_u16(dev_info->max_vchans);
+ rte_trace_point_emit_u16(dev_info->max_desc);
+ rte_trace_point_emit_u16(dev_info->min_desc);
+ rte_trace_point_emit_u16(dev_info->max_sges);
+ rte_trace_point_emit_i16(dev_info->numa_node);
+ rte_trace_point_emit_u16(dev_info->nb_vchans);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_configure,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, const struct rte_dma_conf *dev_conf,
+ int ret),
+ int enable_silent = (int)dev_conf->enable_silent;
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(dev_conf->nb_vchans);
+ rte_trace_point_emit_int(enable_silent);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_start,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_stop,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_close,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_vchan_setup,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ const struct rte_dma_vchan_conf *conf, int ret),
+ int src_port_type = conf->src_port.port_type;
+ int dst_port_type = conf->dst_port.port_type;
+ int direction = conf->direction;
+ uint64_t src_pcie_cfg;
+ uint64_t dst_pcie_cfg;
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_int(direction);
+ rte_trace_point_emit_u16(conf->nb_desc);
+ rte_trace_point_emit_int(src_port_type);
+ memcpy(&src_pcie_cfg, &conf->src_port.pcie, sizeof(uint64_t));
+ rte_trace_point_emit_u64(src_pcie_cfg);
+ memcpy(&dst_pcie_cfg, &conf->dst_port.pcie, sizeof(uint64_t));
+ rte_trace_point_emit_int(dst_port_type);
+ rte_trace_point_emit_u64(dst_pcie_cfg);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_stats_reset,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_vchan_status,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ enum rte_dma_vchan_status *status, int ret),
+ int vchan_status = *status;
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_int(vchan_status);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT(
+ rte_dma_trace_dump,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, FILE *f, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_ptr(f);
+ rte_trace_point_emit_int(ret);
+)
+
+/* Fast path trace points */
+
+/* Called in loop in examples/dma */
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_stats_get,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ struct rte_dma_stats *stats, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u64(stats->submitted);
+ rte_trace_point_emit_u64(stats->completed);
+ rte_trace_point_emit_u64(stats->errors);
+ rte_trace_point_emit_int(ret);
+)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_DMADEV_TRACE_H */
diff --git a/lib/dmadev/rte_dmadev_trace_fp.h b/lib/dmadev/rte_dmadev_trace_fp.h
new file mode 100644
index 0000000000..f5ebad1bc4
--- /dev/null
+++ b/lib/dmadev/rte_dmadev_trace_fp.h
@@ -0,0 +1,113 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 HiSilicon Limited
+ */
+
+#ifndef RTE_DMADEV_TRACE_FP_H
+#define RTE_DMADEV_TRACE_FP_H
+
+/**
+ * @file
+ *
+ * API for dmadev fastpath trace support
+ */
+
+#include <rte_trace_point.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_copy,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, rte_iova_t src,
+ rte_iova_t dst, uint32_t length, uint64_t flags,
+ int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u64(src);
+ rte_trace_point_emit_u64(dst);
+ rte_trace_point_emit_u32(length);
+ rte_trace_point_emit_u64(flags);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_copy_sg,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ struct rte_dma_sge *src, struct rte_dma_sge *dst,
+ uint16_t nb_src, uint16_t nb_dst, uint64_t flags,
+ int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_ptr(src);
+ rte_trace_point_emit_ptr(dst);
+ rte_trace_point_emit_u16(nb_src);
+ rte_trace_point_emit_u16(nb_dst);
+ rte_trace_point_emit_u64(flags);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_fill,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, uint64_t pattern,
+ rte_iova_t dst, uint32_t length, uint64_t flags,
+ int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u64(pattern);
+ rte_trace_point_emit_u64(dst);
+ rte_trace_point_emit_u32(length);
+ rte_trace_point_emit_u64(flags);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_submit,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, int ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_int(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_completed,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ const uint16_t nb_cpls, uint16_t *last_idx,
+ bool *has_error, uint16_t ret),
+ int has_error_val = *has_error;
+ int last_idx_val = *last_idx;
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u16(nb_cpls);
+ rte_trace_point_emit_int(last_idx_val);
+ rte_trace_point_emit_int(has_error_val);
+ rte_trace_point_emit_u16(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_completed_status,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
+ const uint16_t nb_cpls, uint16_t *last_idx,
+ enum rte_dma_status_code *status, uint16_t ret),
+ int last_idx_val = *last_idx;
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u16(nb_cpls);
+ rte_trace_point_emit_int(last_idx_val);
+ rte_trace_point_emit_ptr(status);
+ rte_trace_point_emit_u16(ret);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_dma_trace_burst_capacity,
+ RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan, uint16_t ret),
+ rte_trace_point_emit_i16(dev_id);
+ rte_trace_point_emit_u16(vchan);
+ rte_trace_point_emit_u16(ret);
+)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RTE_DMADEV_TRACE_FP_H */
diff --git a/lib/dmadev/rte_dmadev_trace_points.c b/lib/dmadev/rte_dmadev_trace_points.c
new file mode 100644
index 0000000000..ddf60922bf
--- /dev/null
+++ b/lib/dmadev/rte_dmadev_trace_points.c
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2023 HiSilicon Limited
+ */
+
+#include <rte_trace_point_register.h>
+
+#include "rte_dmadev_trace.h"
+#include "rte_dmadev_trace_fp.h"
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_info_get,
+ lib.dmadev.info_get)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_configure,
+ lib.dmadev.configure)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_start,
+ lib.dmadev.start)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_stop,
+ lib.dmadev.stop)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_close,
+ lib.dmadev.close)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_vchan_setup,
+ lib.dmadev.vchan_setup)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_stats_get,
+ lib.dmadev.stats_get)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_stats_reset,
+ lib.dmadev.stats_reset)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_vchan_status,
+ lib.dmadev.vchan_status)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_dump,
+ lib.dmadev.dump)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_copy,
+ lib.dmadev.copy)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_copy_sg,
+ lib.dmadev.copy_sg)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_fill,
+ lib.dmadev.fill)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_submit,
+ lib.dmadev.submit)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_completed,
+ lib.dmadev.completed)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_completed_status,
+ lib.dmadev.completed_status)
+
+RTE_TRACE_POINT_REGISTER(rte_dma_trace_burst_capacity,
+ lib.dmadev.burst_capacity)
diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map
index 7031d6b335..04db94bce5 100644
--- a/lib/dmadev/version.map
+++ b/lib/dmadev/version.map
@@ -1,6 +1,7 @@
EXPERIMENTAL {
global:
+ # added in 21.11
rte_dma_close;
rte_dma_configure;
rte_dma_count_avail;
@@ -17,6 +18,15 @@ EXPERIMENTAL {
rte_dma_vchan_setup;
rte_dma_vchan_status;
+ # added in 23.07
+ __rte_dma_trace_burst_capacity;
+ __rte_dma_trace_completed;
+ __rte_dma_trace_completed_status;
+ __rte_dma_trace_copy;
+ __rte_dma_trace_copy_sg;
+ __rte_dma_trace_fill;
+ __rte_dma_trace_submit;
+
local: *;
};
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH v2] dmadev: add tracepoints
2023-04-14 9:09 [PATCH v2] dmadev: add tracepoints Chengwen Feng
@ 2023-04-14 12:46 ` Morten Brørup
2023-04-15 0:47 ` fengchengwen
0 siblings, 1 reply; 3+ messages in thread
From: Morten Brørup @ 2023-04-14 12:46 UTC (permalink / raw)
To: Chengwen Feng, thomas, Kevin Laatz, Bruce Richardson; +Cc: dev
> From: Chengwen Feng [mailto:fengchengwen@huawei.com]
> Sent: Friday, 14 April 2023 11.09
>
> Add tracepoints at important APIs for tracing support.
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>
> ---
> v2: Address Morten's comment:
> Make stats_get as fast-path trace-points.
> Place fast-path trace-point functions behind in version.map.
...
> +RTE_TRACE_POINT(
> + rte_dma_trace_vchan_status,
rte_dma_trace_vchan_status should also be a FP trace point.
> + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
> + enum rte_dma_vchan_status *status, int ret),
> + int vchan_status = *status;
> + rte_trace_point_emit_i16(dev_id);
> + rte_trace_point_emit_u16(vchan);
> + rte_trace_point_emit_int(vchan_status);
> + rte_trace_point_emit_int(ret);
> +)
> +
> +RTE_TRACE_POINT(
> + rte_dma_trace_dump,
> + RTE_TRACE_POINT_ARGS(int16_t dev_id, FILE *f, int ret),
> + rte_trace_point_emit_i16(dev_id);
> + rte_trace_point_emit_ptr(f);
> + rte_trace_point_emit_int(ret);
> +)
> +
> +/* Fast path trace points */
Don't add the fast path trace points here. Add them to the rte_dmadev_trace_fp.h file.
> +
> +/* Called in loop in examples/dma */
> +RTE_TRACE_POINT_FP(
> + rte_dma_trace_stats_get,
> + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
> + struct rte_dma_stats *stats, int ret),
> + rte_trace_point_emit_i16(dev_id);
> + rte_trace_point_emit_u16(vchan);
> + rte_trace_point_emit_u64(stats->submitted);
> + rte_trace_point_emit_u64(stats->completed);
> + rte_trace_point_emit_u64(stats->errors);
> + rte_trace_point_emit_int(ret);
> +)
With those two fixes, you may add:
Acked-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] dmadev: add tracepoints
2023-04-14 12:46 ` Morten Brørup
@ 2023-04-15 0:47 ` fengchengwen
0 siblings, 0 replies; 3+ messages in thread
From: fengchengwen @ 2023-04-15 0:47 UTC (permalink / raw)
To: Morten Brørup, thomas, Kevin Laatz, Bruce Richardson; +Cc: dev
Hi Morten,
Both fix in v3, thanks.
On 2023/4/14 20:46, Morten Brørup wrote:
>> From: Chengwen Feng [mailto:fengchengwen@huawei.com]
>> Sent: Friday, 14 April 2023 11.09
>>
>> Add tracepoints at important APIs for tracing support.
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>
>> ---
>> v2: Address Morten's comment:
>> Make stats_get as fast-path trace-points.
>> Place fast-path trace-point functions behind in version.map.
>
> ...
>
>> +RTE_TRACE_POINT(
>> + rte_dma_trace_vchan_status,
>
> rte_dma_trace_vchan_status should also be a FP trace point.
>
>> + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
>> + enum rte_dma_vchan_status *status, int ret),
>> + int vchan_status = *status;
>> + rte_trace_point_emit_i16(dev_id);
>> + rte_trace_point_emit_u16(vchan);
>> + rte_trace_point_emit_int(vchan_status);
>> + rte_trace_point_emit_int(ret);
>> +)
>> +
>> +RTE_TRACE_POINT(
>> + rte_dma_trace_dump,
>> + RTE_TRACE_POINT_ARGS(int16_t dev_id, FILE *f, int ret),
>> + rte_trace_point_emit_i16(dev_id);
>> + rte_trace_point_emit_ptr(f);
>> + rte_trace_point_emit_int(ret);
>> +)
>> +
>> +/* Fast path trace points */
>
> Don't add the fast path trace points here. Add them to the rte_dmadev_trace_fp.h file.
>
>> +
>> +/* Called in loop in examples/dma */
>> +RTE_TRACE_POINT_FP(
>> + rte_dma_trace_stats_get,
>> + RTE_TRACE_POINT_ARGS(int16_t dev_id, uint16_t vchan,
>> + struct rte_dma_stats *stats, int ret),
>> + rte_trace_point_emit_i16(dev_id);
>> + rte_trace_point_emit_u16(vchan);
>> + rte_trace_point_emit_u64(stats->submitted);
>> + rte_trace_point_emit_u64(stats->completed);
>> + rte_trace_point_emit_u64(stats->errors);
>> + rte_trace_point_emit_int(ret);
>> +)
>
> With those two fixes, you may add:
>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-15 0:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 9:09 [PATCH v2] dmadev: add tracepoints Chengwen Feng
2023-04-14 12:46 ` Morten Brørup
2023-04-15 0:47 ` fengchengwen
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).