DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicolas Chautru <nicolas.chautru@intel.com>
To: dev@dpdk.org, maxime.coquelin@redhat.com
Cc: hemant.agrawal@nxp.com, hernan.vargas@intel.com,
	Nicolas Chautru <nicolas.chautru@intel.com>
Subject: [PATCH v1 1/3] bbdev: add trace point
Date: Thu, 23 Jan 2025 12:28:05 -0800	[thread overview]
Message-ID: <20250123202807.2089618-2-nicolas.chautru@intel.com> (raw)
In-Reply-To: <20250123202807.2089618-1-nicolas.chautru@intel.com>

Adds trace points for rte_bbdev.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 lib/bbdev/bbdev_trace.h        | 69 ++++++++++++++++++++++++++++++++++
 lib/bbdev/bbdev_trace_points.c | 27 +++++++++++++
 lib/bbdev/meson.build          |  6 ++-
 lib/bbdev/rte_bbdev.c          | 16 ++++++++
 lib/bbdev/rte_bbdev.h          | 51 ++++++++++++++++++++++---
 lib/bbdev/rte_bbdev_trace_fp.h | 41 ++++++++++++++++++++
 lib/bbdev/version.map          |  4 ++
 7 files changed, 206 insertions(+), 8 deletions(-)
 create mode 100644 lib/bbdev/bbdev_trace.h
 create mode 100644 lib/bbdev/bbdev_trace_points.c
 create mode 100644 lib/bbdev/rte_bbdev_trace_fp.h

diff --git a/lib/bbdev/bbdev_trace.h b/lib/bbdev/bbdev_trace.h
new file mode 100644
index 0000000000..7256d6b703
--- /dev/null
+++ b/lib/bbdev/bbdev_trace.h
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2025 Intel Corporation
+ */
+
+#ifndef BBDEV_TRACE_H
+#define BBDEV_TRACE_H
+
+/**
+ * @file
+ *
+ * API for bbdev trace support
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_trace_point.h>
+
+#include "rte_bbdev.h"
+
+RTE_TRACE_POINT(
+	rte_bbdev_trace_setup_queues,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t num_queues, int socket_id),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(num_queues);
+	rte_trace_point_emit_int(socket_id);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_queue_configure,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t queue_id, const char *op_str, uint8_t pri),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(queue_id);
+	rte_trace_point_emit_string(op_str);
+	rte_trace_point_emit_u8(pri);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_start,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id),
+	rte_trace_point_emit_u8(dev_id);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_stop,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id),
+	rte_trace_point_emit_u8(dev_id);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_close,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id),
+	rte_trace_point_emit_u8(dev_id);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_queue_start,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t queue_id),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(queue_id);
+)
+RTE_TRACE_POINT(
+	rte_bbdev_trace_queue_stop,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t queue_id),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(queue_id);
+)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BBDEV_TRACE_H */
diff --git a/lib/bbdev/bbdev_trace_points.c b/lib/bbdev/bbdev_trace_points.c
new file mode 100644
index 0000000000..6f90e2aa65
--- /dev/null
+++ b/lib/bbdev/bbdev_trace_points.c
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2025 Intel Corporation
+ */
+
+#include <rte_trace_point_register.h>
+
+#include "bbdev_trace.h"
+
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_setup_queues,
+	lib.bbdev.queue.setup)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_queue_configure,
+	lib.bbdev.queue.configure)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_start,
+	lib.bbdev.start)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_stop,
+	lib.bbdev.stop)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_close,
+	lib.bbdev.close)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_queue_start,
+	lib.bbdev.queue.start)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_queue_stop,
+	lib.bbdev.queue.stop)
+
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_enqueue,
+	lib.bbdev.enq)
+RTE_TRACE_POINT_REGISTER(rte_bbdev_trace_dequeue,
+	lib.bbdev.deq)
diff --git a/lib/bbdev/meson.build b/lib/bbdev/meson.build
index 07685e7578..d8b95a400e 100644
--- a/lib/bbdev/meson.build
+++ b/lib/bbdev/meson.build
@@ -7,8 +7,10 @@ if is_windows
     subdir_done()
 endif
 
-sources = files('rte_bbdev.c')
+sources = files('rte_bbdev.c',
+        'bbdev_trace_points.c')
 headers = files('rte_bbdev.h',
         'rte_bbdev_pmd.h',
-        'rte_bbdev_op.h')
+        'rte_bbdev_op.h',
+        'rte_bbdev_trace_fp.h')
 deps += ['mbuf']
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index bd32da79b0..eda74591bf 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -321,6 +321,8 @@ rte_bbdev_setup_queues(uint16_t dev_id, uint16_t num_queues, int socket_id)
 
 	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
 
+	rte_bbdev_trace_setup_queues(dev_id, num_queues, socket_id);
+
 	if (dev->data->started) {
 		rte_bbdev_log(ERR,
 				"Device %u cannot be configured when started",
@@ -436,6 +438,10 @@ int
 rte_bbdev_queue_configure(uint16_t dev_id, uint16_t queue_id,
 		const struct rte_bbdev_queue_conf *conf)
 {
+
+	rte_bbdev_trace_queue_configure(dev_id, queue_id, rte_bbdev_op_type_str(conf->op_type),
+			conf->priority);
+
 	int ret = 0;
 	struct rte_bbdev_driver_info dev_info;
 	struct rte_bbdev *dev = get_dev(dev_id);
@@ -557,6 +563,8 @@ rte_bbdev_start(uint16_t dev_id)
 
 	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
 
+	rte_bbdev_trace_start(dev_id);
+
 	if (dev->data->started) {
 		rte_bbdev_log_debug("Device %u is already started", dev_id);
 		return 0;
@@ -588,6 +596,8 @@ rte_bbdev_stop(uint16_t dev_id)
 
 	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
 
+	rte_bbdev_trace_stop(dev_id);
+
 	if (!dev->data->started) {
 		rte_bbdev_log_debug("Device %u is already stopped", dev_id);
 		return 0;
@@ -611,6 +621,8 @@ rte_bbdev_close(uint16_t dev_id)
 
 	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
 
+	rte_bbdev_trace_close(dev_id);
+
 	if (dev->data->started) {
 		ret = rte_bbdev_stop(dev_id);
 		if (ret < 0) {
@@ -656,6 +668,8 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id)
 
 	VALID_QUEUE_OR_RET_ERR(queue_id, dev);
 
+	rte_bbdev_trace_queue_start(dev_id, queue_id);
+
 	if (dev->data->queues[queue_id].started) {
 		rte_bbdev_log_debug("Queue %u of device %u already started",
 				queue_id, dev_id);
@@ -686,6 +700,8 @@ rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)
 
 	VALID_QUEUE_OR_RET_ERR(queue_id, dev);
 
+	rte_bbdev_trace_queue_stop(dev_id, queue_id);
+
 	if (!dev->data->queues[queue_id].started) {
 		rte_bbdev_log_debug("Queue %u of device %u already stopped",
 				queue_id, dev_id);
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 6d5cdc7b8c..ef964a8937 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -32,6 +32,9 @@
 extern "C" {
 #endif
 
+#include "rte_bbdev_trace_fp.h"
+#include "bbdev_trace.h"
+
 #ifndef RTE_BBDEV_MAX_DEVS
 #define RTE_BBDEV_MAX_DEVS 128  /**< Max number of devices */
 #endif
@@ -569,6 +572,8 @@ rte_bbdev_enqueue_enc_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_DEC));
 	return dev->enqueue_enc_ops(q_data, ops, num_ops);
 }
 
@@ -599,6 +604,8 @@ rte_bbdev_enqueue_dec_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_ENC));
 	return dev->enqueue_dec_ops(q_data, ops, num_ops);
 }
 
@@ -629,6 +636,8 @@ rte_bbdev_enqueue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_ENC));
 	return dev->enqueue_ldpc_enc_ops(q_data, ops, num_ops);
 }
 
@@ -659,6 +668,8 @@ rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_DEC));
 	return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops);
 }
 
@@ -689,6 +700,8 @@ rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_FFT));
 	return dev->enqueue_fft_ops(q_data, ops, num_ops);
 }
 
@@ -719,6 +732,8 @@ rte_bbdev_enqueue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
+	rte_bbdev_trace_enqueue(dev_id, queue_id, (void **)ops, num_ops,
+			rte_bbdev_op_type_str(RTE_BBDEV_OP_MLDTS));
 	return dev->enqueue_mldts_ops(q_data, ops, num_ops);
 }
 
@@ -750,7 +765,11 @@ rte_bbdev_dequeue_enc_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_enc_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_enc_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_ENC));
+	return num_ops_dequeued;
 }
 
 /**
@@ -782,7 +801,11 @@ rte_bbdev_dequeue_dec_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_dec_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_dec_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_TURBO_DEC));
+	return num_ops_dequeued;
 }
 
 
@@ -813,7 +836,11 @@ rte_bbdev_dequeue_ldpc_enc_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_ldpc_enc_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_ENC));
+	return num_ops_dequeued;
 }
 
 /**
@@ -843,7 +870,11 @@ rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_LDPC_DEC));
+	return num_ops_dequeued;
 }
 
 /**
@@ -873,7 +904,11 @@ rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_fft_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_fft_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_FFT));
+	return num_ops_dequeued;
 }
 
 /**
@@ -903,7 +938,11 @@ rte_bbdev_dequeue_mldts_ops(uint16_t dev_id, uint16_t queue_id,
 {
 	struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
 	struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id];
-	return dev->dequeue_mldts_ops(q_data, ops, num_ops);
+	uint16_t num_ops_dequeued = dev->dequeue_mldts_ops(q_data, ops, num_ops);
+	if (num_ops_dequeued > 0)
+		rte_bbdev_trace_dequeue(dev_id, queue_id, (void **)ops, num_ops,
+				num_ops_dequeued, rte_bbdev_op_type_str(RTE_BBDEV_OP_MLDTS));
+	return num_ops_dequeued;
 }
 
 /** Definitions of device event types */
diff --git a/lib/bbdev/rte_bbdev_trace_fp.h b/lib/bbdev/rte_bbdev_trace_fp.h
new file mode 100644
index 0000000000..d8b2217d17
--- /dev/null
+++ b/lib/bbdev/rte_bbdev_trace_fp.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2025 Intel Corporation
+ */
+
+#ifndef _RTE_BBDEV_TRACE_FP_H_
+#define _RTE_BBDEV_TRACE_FP_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_trace_point.h>
+
+RTE_TRACE_POINT_FP(
+	rte_bbdev_trace_enqueue,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t qp_id, void **ops,
+		uint16_t nb_ops, const char *op_string),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(qp_id);
+	rte_trace_point_emit_ptr(ops);
+	rte_trace_point_emit_u16(nb_ops);
+	rte_trace_point_emit_string(op_string);
+)
+
+RTE_TRACE_POINT_FP(
+	rte_bbdev_trace_dequeue,
+	RTE_TRACE_POINT_ARGS(uint8_t dev_id, uint16_t qp_id, void **ops,
+		uint16_t nb_ops, uint16_t nb_ops_deq, const char *op_string),
+	rte_trace_point_emit_u8(dev_id);
+	rte_trace_point_emit_u16(qp_id);
+	rte_trace_point_emit_ptr(ops);
+	rte_trace_point_emit_u16(nb_ops);
+	rte_trace_point_emit_u16(nb_ops_deq);
+	rte_trace_point_emit_string(op_string);
+)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_BBDEV_TRACE_FP_H_ */
diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map
index 1e11485b17..b9b4f31e33 100644
--- a/lib/bbdev/version.map
+++ b/lib/bbdev/version.map
@@ -40,4 +40,8 @@ EXPERIMENTAL {
 	# added in 24.11
 	rte_bbdev_queue_ops_dump;
 	rte_bbdev_ops_param_string;
+
+	# added in 25.03
+	__rte_bbdev_trace_dequeue;
+	__rte_bbdev_trace_enqueue;
 };
-- 
2.34.1


  reply	other threads:[~2025-01-23 20:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 20:28 [PATCH v1 0/3] bbdev: trace point and logging Nicolas Chautru
2025-01-23 20:28 ` Nicolas Chautru [this message]
2025-01-23 20:28 ` [PATCH v1 2/3] baseband/acc: add trace point Nicolas Chautru
2025-01-23 20:28 ` [PATCH v1 3/3] baseband/acc: add internal logging Nicolas Chautru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250123202807.2089618-2-nicolas.chautru@intel.com \
    --to=nicolas.chautru@intel.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=hernan.vargas@intel.com \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).