* [PATCH v2 1/3] bbdev: add trace point
2025-01-23 22:55 [PATCH v2 0/3] bbdev: trace point and logging Nicolas Chautru
@ 2025-01-23 22:55 ` Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 2/3] baseband/acc: " Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 3/3] baseband/acc: add internal logging Nicolas Chautru
2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Chautru @ 2025-01-23 22:55 UTC (permalink / raw)
To: dev, maxime.coquelin; +Cc: hemant.agrawal, hernan.vargas, Nicolas Chautru
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 | 17 +++++++++
lib/bbdev/rte_bbdev.h | 50 +++++++++++++++++++++---
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..d7901cd29d 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -20,6 +20,7 @@
#include "rte_bbdev_op.h"
#include "rte_bbdev.h"
#include "rte_bbdev_pmd.h"
+#include "bbdev_trace.h"
#define DEV_NAME "BBDEV"
@@ -321,6 +322,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 +439,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 +564,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 +597,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 +622,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 +669,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 +701,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..710280f0df 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -32,6 +32,8 @@
extern "C" {
#endif
+#include "rte_bbdev_trace_fp.h"
+
#ifndef RTE_BBDEV_MAX_DEVS
#define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */
#endif
@@ -569,6 +571,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 +603,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 +635,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 +667,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 +699,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 +731,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 +764,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 +800,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 +835,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 +869,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 +903,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 +937,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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] baseband/acc: add trace point
2025-01-23 22:55 [PATCH v2 0/3] bbdev: trace point and logging Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 1/3] bbdev: add trace point Nicolas Chautru
@ 2025-01-23 22:55 ` Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 3/3] baseband/acc: add internal logging Nicolas Chautru
2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Chautru @ 2025-01-23 22:55 UTC (permalink / raw)
To: dev, maxime.coquelin; +Cc: hemant.agrawal, hernan.vargas, Nicolas Chautru
Improvement of logging to notably use trace point
for driver specific error logging and tracepoint.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
drivers/baseband/acc/acc_common.c | 8 ++++
drivers/baseband/acc/acc_common.h | 55 ++++++++++++++++++++++++++
drivers/baseband/acc/rte_vrb_pmd.c | 63 +++++++++++++++++-------------
drivers/baseband/acc/vrb_trace.h | 35 +++++++++++++++++
4 files changed, 133 insertions(+), 28 deletions(-)
create mode 100644 drivers/baseband/acc/vrb_trace.h
diff --git a/drivers/baseband/acc/acc_common.c b/drivers/baseband/acc/acc_common.c
index f8d2b19570..25ddef8a6c 100644
--- a/drivers/baseband/acc/acc_common.c
+++ b/drivers/baseband/acc/acc_common.c
@@ -3,5 +3,13 @@
*/
#include <rte_log.h>
+#include <rte_trace_point_register.h>
+#include "vrb_trace.h"
RTE_LOG_REGISTER_SUFFIX(acc_common_logtype, common, INFO);
+
+RTE_TRACE_POINT_REGISTER(rte_bbdev_vrb_trace_error,
+ bbdev.vrb.device.error);
+
+RTE_TRACE_POINT_REGISTER(rte_bbdev_vrb_trace_queue_error,
+ bbdev.vrb.queue.error);
diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index a49b154a0c..4880444450 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -7,6 +7,7 @@
#include <bus_pci_driver.h>
#include "rte_acc_common_cfg.h"
+#include "vrb_trace.h"
/* Values used in filling in descriptors */
#define ACC_DMA_DESC_TYPE 2
@@ -653,6 +654,56 @@ struct __rte_cache_aligned acc_queue {
struct acc_device *d;
};
+/* These strings for rte_trace must be limited to RTE_TRACE_EMIT_STRING_LEN_MAX. */
+static const char * const acc_error_string[] = {
+ "Warn: HARQ offset unexpected.",
+ "HARQ in/output is not defined.",
+ "Mismatch related to Mbuf data.",
+ "Soft output is not defined.",
+ "Device incompatible cap.",
+ "HARQ cannot be appended.",
+ "Undefined error message.",
+};
+
+/* Matching indexes for acc_error_string. */
+enum acc_error_enum {
+ ACC_ERR_HARQ_UNEXPECTED,
+ ACC_ERR_REJ_HARQ,
+ ACC_ERR_REJ_MBUF,
+ ACC_ERR_REJ_SOFT,
+ ACC_ERR_REJ_CAP,
+ ACC_ERR_REJ_HARQ_OUT,
+ ACC_ERR_MAX
+};
+
+/**
+ * @brief Report error both through RTE logging and into trace point.
+ *
+ * This function is used to log an error for a specific ACC queue and operation.
+ *
+ * @param q Pointer to the ACC queue.
+ * @param op Pointer to the operation.
+ * @param fmt Format string for the error message.
+ * @param ... Additional arguments for the format string.
+ */
+__rte_format_printf(4, 5)
+static inline void
+acc_error_log(struct acc_queue *q, void *op, uint8_t acc_error_idx, const char *fmt, ...)
+{
+ va_list args;
+ RTE_SET_USED(op);
+ va_start(args, fmt);
+ rte_vlog(RTE_LOG_ERR, acc_common_logtype, fmt, args);
+
+ if (acc_error_idx > ACC_ERR_MAX)
+ acc_error_idx = ACC_ERR_MAX;
+
+ rte_bbdev_vrb_trace_error(0, rte_bbdev_op_type_str(q->op_type),
+ acc_error_string[acc_error_idx]);
+
+ va_end(args);
+}
+
/* Write to MMIO register address */
static inline void
mmio_write(void *addr, uint32_t value)
@@ -1511,6 +1562,10 @@ acc_enqueue_status(struct rte_bbdev_queue_data *q_data,
{
q_data->enqueue_status = status;
q_data->queue_stats.enqueue_status_count[status]++;
+ struct acc_queue *q = q_data->queue_private;
+
+ rte_bbdev_vrb_trace_queue_error(q->qgrp_id, q->aq_id,
+ rte_bbdev_enqueue_status_str(status));
rte_acc_log(WARNING, "Enqueue Status: %s %#"PRIx64"",
rte_bbdev_enqueue_status_str(status),
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index eb9892ff31..27620ccc10 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -1816,7 +1816,7 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
uint32_t *in_offset, uint32_t *h_out_offset,
uint32_t *s_out_offset, uint32_t *h_out_length,
uint32_t *s_out_length, uint32_t *mbuf_total_left,
- uint32_t *seg_total_left, uint8_t r)
+ uint32_t *seg_total_left, uint8_t r, struct acc_queue *q)
{
int next_triplet = 1; /* FCW already done. */
uint16_t k;
@@ -1860,8 +1860,8 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
kw = RTE_ALIGN_CEIL(k + 4, 32) * 3;
if (unlikely((*mbuf_total_left == 0) || (*mbuf_total_left < kw))) {
- rte_bbdev_log(ERR,
- "Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u\n",
*mbuf_total_left, kw);
return -1;
}
@@ -1871,8 +1871,8 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
check_bit(op->turbo_dec.op_flags,
RTE_BBDEV_TURBO_DEC_SCATTER_GATHER));
if (unlikely(next_triplet < 0)) {
- rte_bbdev_log(ERR,
- "Mismatch between data to process and mbuf data length in bbdev_op: %p",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between data to process and mbuf data length in bbdev_op: %p\n",
op);
return -1;
}
@@ -1884,8 +1884,8 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
desc, h_output, *h_out_offset,
*h_out_length, next_triplet, ACC_DMA_BLKID_OUT_HARD);
if (unlikely(next_triplet < 0)) {
- rte_bbdev_log(ERR,
- "Mismatch between data to process and mbuf data length in bbdev_op: %p",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between data to process and mbuf data length in bbdev_op: %p\n",
op);
return -1;
}
@@ -1896,7 +1896,8 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
/* Soft output. */
if (check_bit(op->turbo_dec.op_flags, RTE_BBDEV_TURBO_SOFT_OUTPUT)) {
if (op->turbo_dec.soft_output.data == 0) {
- rte_bbdev_log(ERR, "Soft output is not defined");
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_SOFT,
+ "Soft output is not defined\n");
return -1;
}
if (check_bit(op->turbo_dec.op_flags,
@@ -1909,8 +1910,8 @@ vrb_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
*s_out_offset, *s_out_length, next_triplet,
ACC_DMA_BLKID_OUT_SOFT);
if (unlikely(next_triplet < 0)) {
- rte_bbdev_log(ERR,
- "Mismatch between data to process and mbuf data length in bbdev_op: %p",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between data to process and mbuf data length in bbdev_op: %p\n",
op);
return -1;
}
@@ -1933,7 +1934,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
struct rte_mbuf **input, struct rte_mbuf *h_output,
uint32_t *in_offset, uint32_t *h_out_offset,
uint32_t *h_out_length, uint32_t *mbuf_total_left,
- uint32_t *seg_total_left, struct acc_fcw_ld *fcw, uint16_t device_variant)
+ uint32_t *seg_total_left, struct acc_fcw_ld *fcw, uint16_t device_variant,
+ struct acc_queue *q)
{
struct rte_bbdev_op_ldpc_dec *dec = &op->ldpc_dec;
int next_triplet = 1; /* FCW already done. */
@@ -1944,8 +1946,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
if (device_variant == VRB1_VARIANT) {
if (check_bit(op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_HARQ_4BIT_COMPRESSION) ||
check_bit(op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_SOFT_OUT_ENABLE)) {
- rte_bbdev_log(ERR,
- "VRB1 does not support the requested capabilities %x",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_CAP,
+ "VRB1 does not support the requested capabilities %x\n",
op->ldpc_dec.op_flags);
return -1;
}
@@ -1965,8 +1967,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
output_length = K - dec->n_filler - crc24_overlap;
if (unlikely((*mbuf_total_left == 0) || (*mbuf_total_left < input_length))) {
- rte_bbdev_log(ERR,
- "Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between mbuf length and included CB sizes: mbuf len %u, cb len %u\n",
*mbuf_total_left, input_length);
return -1;
}
@@ -1978,15 +1980,16 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
RTE_BBDEV_LDPC_DEC_SCATTER_GATHER));
if (unlikely(next_triplet < 0)) {
- rte_bbdev_log(ERR,
- "Mismatch between data to process and mbuf data length in bbdev_op: %p",
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_MBUF,
+ "Mismatch between data to process and mbuf data length in bbdev_op: %p\n",
op);
return -1;
}
if (check_bit(op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_HQ_COMBINE_IN_ENABLE)) {
if (op->ldpc_dec.harq_combined_input.data == 0) {
- rte_bbdev_log(ERR, "HARQ input is not defined");
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_HARQ,
+ "HARQ input is not defined\n");
return -1;
}
h_p_size = fcw->hcin_size0 + fcw->hcin_size1;
@@ -1995,7 +1998,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
else if (fcw->hcin_decomp_mode == 4)
h_p_size = h_p_size / 2;
if (op->ldpc_dec.harq_combined_input.data == 0) {
- rte_bbdev_log(ERR, "HARQ input is not defined");
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_HARQ,
+ "HARQ input is not defined\n");
return -1;
}
acc_dma_fill_blk_type(
@@ -2018,7 +2022,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
if (check_bit(op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_SOFT_OUT_ENABLE)) {
if (op->ldpc_dec.soft_output.data == 0) {
- rte_bbdev_log(ERR, "Soft output is not defined");
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_SOFT,
+ "Soft output is not defined\n");
return -1;
}
dec->soft_output.length = fcw->rm_e;
@@ -2029,7 +2034,8 @@ vrb_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
if (check_bit(op->ldpc_dec.op_flags, RTE_BBDEV_LDPC_HQ_COMBINE_OUT_ENABLE)) {
if (op->ldpc_dec.harq_combined_output.data == 0) {
- rte_bbdev_log(ERR, "HARQ output is not defined");
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_HARQ,
+ "HARQ output is not defined\n");
return -1;
}
@@ -2534,7 +2540,7 @@ enqueue_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
ret = vrb_dma_desc_td_fill(op, &desc->req, &input, h_output,
s_output, &in_offset, &h_out_offset, &s_out_offset,
&h_out_length, &s_out_length, &mbuf_total_left,
- &seg_total_left, 0);
+ &seg_total_left, 0, q);
if (unlikely(ret < 0))
return ret;
@@ -2612,7 +2618,7 @@ vrb_enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
ret = vrb_dma_desc_ld_fill(op, &desc->req, &input, h_output,
&in_offset, &h_out_offset,
&h_out_length, &mbuf_total_left,
- &seg_total_left, fcw, q->d->device_variant);
+ &seg_total_left, fcw, q->d->device_variant, q);
if (unlikely(ret < 0))
return ret;
}
@@ -2627,9 +2633,10 @@ vrb_enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
hq_output = op->ldpc_dec.harq_combined_output.data;
hq_len = op->ldpc_dec.harq_combined_output.length;
if (unlikely(!mbuf_append(hq_output_head, hq_output, hq_len))) {
- rte_bbdev_log(ERR, "HARQ output mbuf issue %d %d",
- hq_output->buf_len,
- hq_len);
+ acc_error_log(q, (void *)op, ACC_ERR_REJ_HARQ_OUT,
+ "HARQ output mbuf cannot be appended Buffer %d Current data %d New data %d\n",
+ hq_output->buf_len, hq_output->data_len, hq_len);
+
return -1;
}
}
@@ -2706,7 +2713,7 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
h_output, &in_offset, &h_out_offset,
&h_out_length,
&mbuf_total_left, &seg_total_left,
- &desc->req.fcw_ld, q->d->device_variant);
+ &desc->req.fcw_ld, q->d->device_variant, q);
if (unlikely(ret < 0))
return ret;
@@ -2792,7 +2799,7 @@ enqueue_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op,
ret = vrb_dma_desc_td_fill(op, &desc->req, &input,
h_output, s_output, &in_offset, &h_out_offset,
&s_out_offset, &h_out_length, &s_out_length,
- &mbuf_total_left, &seg_total_left, r);
+ &mbuf_total_left, &seg_total_left, r, q);
if (unlikely(ret < 0))
return ret;
diff --git a/drivers/baseband/acc/vrb_trace.h b/drivers/baseband/acc/vrb_trace.h
new file mode 100644
index 0000000000..0bbfdc47d1
--- /dev/null
+++ b/drivers/baseband/acc/vrb_trace.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2025 Intel Corporation
+ */
+
+#ifndef VRB_TRACE_H_
+#define VRB_TRACE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_trace_point.h>
+
+RTE_TRACE_POINT_FP(
+ rte_bbdev_vrb_trace_error,
+ RTE_TRACE_POINT_ARGS(uint8_t dev_id, const char *op_string, const char *err_string),
+ rte_trace_point_emit_u8(dev_id);
+ rte_trace_point_emit_string(op_string);
+ rte_trace_point_emit_string(err_string);
+)
+
+RTE_TRACE_POINT_FP(
+ rte_bbdev_vrb_trace_queue_error,
+ RTE_TRACE_POINT_ARGS(uint8_t qg_id, uint8_t aq_id, const char *str),
+ rte_trace_point_emit_u8(qg_id);
+ rte_trace_point_emit_u8(aq_id);
+ rte_trace_point_emit_string(str);
+)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VRB_TRACE_H_ */
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] baseband/acc: add internal logging
2025-01-23 22:55 [PATCH v2 0/3] bbdev: trace point and logging Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 1/3] bbdev: add trace point Nicolas Chautru
2025-01-23 22:55 ` [PATCH v2 2/3] baseband/acc: " Nicolas Chautru
@ 2025-01-23 22:55 ` Nicolas Chautru
2025-01-23 23:24 ` Stephen Hemminger
2 siblings, 1 reply; 5+ messages in thread
From: Nicolas Chautru @ 2025-01-23 22:55 UTC (permalink / raw)
To: dev, maxime.coquelin; +Cc: hemant.agrawal, hernan.vargas, Nicolas Chautru
Adds internal buffer for more flexible logging.
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
drivers/baseband/acc/acc_common.h | 22 +++++++++++++++++++---
drivers/baseband/acc/rte_vrb_pmd.c | 18 +++++++++++++++++-
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index 4880444450..06255ff5f1 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -152,6 +152,8 @@
#define ACC_MAX_FFT_WIN 16
#define ACC_MAX_RING_BUFFER 64
#define VRB2_MAX_Q_PER_OP 256
+#define ACC_MAX_LOGLEN 256
+#define ACC_MAX_BUFFERLEN 256
extern int acc_common_logtype;
#define RTE_LOGTYPE_ACC_COMMON acc_common_logtype
@@ -652,6 +654,9 @@ struct __rte_cache_aligned acc_queue {
rte_iova_t fcw_ring_addr_iova;
int8_t *derm_buffer; /* interim buffer for de-rm in SDK */
struct acc_device *d;
+ char error_bufs[ACC_MAX_BUFFERLEN][ACC_MAX_LOGLEN]; /**< Buffer for error log. */
+ uint16_t error_head; /**< Head - Buffer for error log. */
+ uint16_t error_wrap; /**< Wrap Counter - Buffer for error log. */
};
/* These strings for rte_trace must be limited to RTE_TRACE_EMIT_STRING_LEN_MAX. */
@@ -690,11 +695,21 @@ __rte_format_printf(4, 5)
static inline void
acc_error_log(struct acc_queue *q, void *op, uint8_t acc_error_idx, const char *fmt, ...)
{
- va_list args;
- RTE_SET_USED(op);
+ va_list args, args2;
+ static char str[1024];
+
va_start(args, fmt);
+ va_copy(args2, args);
rte_vlog(RTE_LOG_ERR, acc_common_logtype, fmt, args);
-
+ vsnprintf(q->error_bufs[q->error_head], ACC_MAX_LOGLEN, fmt, args2);
+ q->error_head++;
+ snprintf(q->error_bufs[q->error_head], ACC_MAX_LOGLEN,
+ "%s", rte_bbdev_ops_param_string(op, q->op_type, str, sizeof(str)));
+ q->error_head++;
+ if (q->error_head == ACC_MAX_LOGLEN) {
+ q->error_head = 0;
+ q->error_wrap++;
+ }
if (acc_error_idx > ACC_ERR_MAX)
acc_error_idx = ACC_ERR_MAX;
@@ -702,6 +717,7 @@ acc_error_log(struct acc_queue *q, void *op, uint8_t acc_error_idx, const char *
acc_error_string[acc_error_idx]);
va_end(args);
+ va_end(args2);
}
/* Write to MMIO register address */
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index 27620ccc10..d81c5d460c 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -1135,6 +1135,10 @@ vrb_queue_setup(struct rte_bbdev *dev, uint16_t queue_id,
q->mmio_reg_enqueue = RTE_PTR_ADD(d->mmio_base,
d->queue_offset(d->pf_device, q->vf_id, q->qgrp_id, q->aq_id));
+ /** initialize the error buffer. */
+ q->error_head = 0;
+ q->error_wrap = 0;
+
rte_bbdev_log_debug(
"Setup dev%u q%u: qgrp_id=%u, vf_id=%u, aq_id=%u, aq_depth=%u, mmio_reg_enqueue=%p base %p",
dev->data->dev_id, queue_id, q->qgrp_id, q->vf_id,
@@ -1516,7 +1520,7 @@ vrb_queue_ops_dump(struct rte_bbdev *dev, uint16_t queue_id, FILE *f)
{
struct acc_queue *q = dev->data->queues[queue_id].queue_private;
struct rte_bbdev_dec_op *op;
- uint16_t i, int_nb;
+ uint16_t start_err, end_err, i, int_nb;
volatile union acc_info_ring_data *ring_data;
uint16_t info_ring_head = q->d->info_ring_head;
static char str[1024];
@@ -1533,6 +1537,18 @@ vrb_queue_ops_dump(struct rte_bbdev *dev, uint16_t queue_id, FILE *f)
q->aq_enqueued, q->aq_dequeued, q->aq_depth,
acc_ring_avail_enq(q), acc_ring_avail_deq(q));
+ /** Print information captured in the error buffer. */
+ if (q->error_wrap == 0) {
+ start_err = 0;
+ end_err = q->error_head;
+ } else {
+ start_err = q->error_head;
+ end_err = q->error_head + ACC_MAX_BUFFERLEN;
+ }
+ fprintf(f, "Error Buffer - Head %d Wrap %d\n", q->error_head, q->error_wrap);
+ for (i = start_err; i < end_err; ++i)
+ fprintf(f, " %d\t%s", i, q->error_bufs[i % ACC_MAX_BUFFERLEN]);
+
/** Print information captured in the info ring. */
if (q->d->info_ring != NULL) {
fprintf(f, "Info Ring Buffer - Head %d\n", q->d->info_ring_head);
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread