> From: Chengwen Feng [mailto:fengcheng...@huawei.com]
> Sent: Wednesday, 12 April 2023 04.48
> 
> Add tracepoints at important APIs for tracing support.
> 
> Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
> ---

[...]

> diff --git a/lib/dmadev/rte_dmadev_trace.h b/lib/dmadev/rte_dmadev_trace.h
> new file mode 100644
> index 0000000000..0dae78ca15
> --- /dev/null
> +++ b/lib/dmadev/rte_dmadev_trace.h
> @@ -0,0 +1,133 @@
> +/* 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_get,

This should be a fast path trace point.
For reference, ethdev considers rte_eth_stats_get() a fast path function.

> +     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);
> +)
> +
> +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,

This should be a fast path trace point.
For reference, ethdev considers rte_eth_link_get() a fast path function.

> +     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);
> +)
> +
> +#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..4ee1b3f74a 100644
> --- a/lib/dmadev/version.map
> +++ b/lib/dmadev/version.map
> @@ -1,6 +1,16 @@
>  EXPERIMENTAL {
>       global:
> 
> +     # 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;
> +

Intuitively, I would suppose that the 23.07 functions should be listed after 
the 21.11 functions, not before.

> +     # added in 21.11

Good catch.

>       rte_dma_close;
>       rte_dma_configure;
>       rte_dma_count_avail;
> --
> 2.17.1

Reply via email to