Skip to contentSkip to conversation

bbdev: dump debug information

PATCH Superseded Nicolas Chautru 3 participants 12 messages Sep 13, 2024 – Oct 2, 2024

lore
Share & tools
lore
#0 lore raw

v3 cover bbdev: dump debug information

v3: updated based on Maxime comments related to passing string through function prototype. Thanks

v2: updated with comments from Hemant and rebased.

v1: Hi Maxime.

Adding new support to support troubleshooting. This provides to the application an API to dump into file information to help troubleshoot issue on a queue. Some of it is tracked at bbdev level and some extra information can be tracked as an option at PMD level. This is for 24.11.
In practive logging is not enabled at run time, but information can be dump into file when an issue happens and requires extra information. This collates now multiple source of errors detected notably at driver level made more explicit.

Thanks,
Nic

Nicolas Chautru (2):
bbdev: add new function to dump debug information baseband/acc: improvement to logging mechanism

 drivers/baseband/acc/acc_common.h  |  38 +++++
 drivers/baseband/acc/rte_vrb_pmd.c | 129 +++++++++++++----
 lib/bbdev/rte_bbdev.c              | 213 +++++++++++++++++++++++++++++
 lib/bbdev/rte_bbdev.h              |  47 +++++++
 lib/bbdev/rte_bbdev_pmd.h          |   9 ++
 lib/bbdev/version.map              |   4 +
 6 files changed, 413 insertions(+), 27 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 bbdev: add new function to dump debug information

This provides a new API to dump more debug information related to the status on a given bbdev queue. Some of this information is visible at bbdev level. This also provides a new option dev op, to print more information at the lower PMD level.
This helps user to troubleshoot issues related to previous operations provided into a queue causing possible hard-to-debug negative scenarios.

---
 lib/bbdev/rte_bbdev.c     | 213 ++++++++++++++++++++++++++++++++++++++
 lib/bbdev/rte_bbdev.h     |  47 +++++++++
 lib/bbdev/rte_bbdev_pmd.h |   9 ++
 lib/bbdev/version.map     |   4 +
 4 files changed, 273 insertions(+)
lib/bbdev/rte_bbdev.c +213 -0
index 13bde3c25b..bd32da79b0 100644
@@ -1190,3 +1190,216 @@ rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
 	rte_bbdev_log(ERR, "Invalid enqueue status");
 	return NULL;
 }
+
+
+int
+rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_id, FILE *f)
+{
+	struct rte_bbdev_queue_data *q_data;
+	struct rte_bbdev_stats *stats;
+	uint16_t i;
+	struct rte_bbdev *dev = get_dev(dev_id);
+
+	VALID_DEV_OR_RET_ERR(dev, dev_id);
+	VALID_QUEUE_OR_RET_ERR(queue_id, dev);
+	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
+	VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_ops_dump, dev_id);
+
+	q_data = &dev->data->queues[queue_id];
+
+	if (f == NULL)
+		return -EINVAL;
+
+	fprintf(f, "Dump of operations on %s queue %d\n",
+			dev->data->name, queue_id);
+	fprintf(f, "  Last Enqueue Status %s\n",
+			rte_bbdev_enqueue_status_str(q_data->enqueue_status));
+	for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
+		if (q_data->queue_stats.enqueue_status_count[i] > 0)
+			fprintf(f, "  Enqueue Status Counters %s %" PRIu64 "\n",
+					rte_bbdev_enqueue_status_str(i),
+					q_data->queue_stats.enqueue_status_count[i]);
+	stats = &dev->data->queues[queue_id].queue_stats;
+
+	fprintf(f, "  Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
+			stats->enqueued_count, stats->enqueue_warn_count,
+			stats->enqueue_err_count);
+	fprintf(f, "  Dequeue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
+			stats->dequeued_count, stats->dequeue_warn_count,
+			stats->dequeue_err_count);
+
+	return dev->dev_ops->queue_ops_dump(dev, queue_id, f);
+}
+
+char *
+rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len)
+{
+	static char partial[1024];
+	struct rte_bbdev_dec_op *op_dec;
+	struct rte_bbdev_enc_op *op_enc;
+	struct rte_bbdev_fft_op *op_fft;
+	struct rte_bbdev_mldts_op *op_mldts;
+
+	rte_iova_t add0 = 0, add1 = 0, add2 = 0, add3 = 0, add4 = 0;
+
+	if (op == NULL) {
+		snprintf(str, len, "Invalid Operation pointer\n");
+		return str;
+	}
+
+	if (op_type == RTE_BBDEV_OP_LDPC_DEC) {
+		op_dec = op;
+		if (op_dec->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
+					op_dec->ldpc_dec.tb_params.c,
+					op_dec->ldpc_dec.tb_params.cab,
+					op_dec->ldpc_dec.tb_params.ea,
+					op_dec->ldpc_dec.tb_params.eb,
+					op_dec->ldpc_dec.tb_params.r);
+		else
+			snprintf(partial, sizeof(partial), "E %d", op_dec->ldpc_dec.cb_params.e);
+		if (op_dec->ldpc_dec.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.input.data, 0);
+		if (op_dec->ldpc_dec.hard_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.hard_output.data, 0);
+		if (op_dec->ldpc_dec.soft_output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.soft_output.data, 0);
+		if (op_dec->ldpc_dec.harq_combined_input.data != NULL)
+			add3 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_input.data,
+					0);
+		if (op_dec->ldpc_dec.harq_combined_output.data != NULL)
+			add4 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_output.data,
+					0);
+		snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d qm %d F %d Rv %d It %d It %d "
+			"HARQin %d in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " hi %" PRIx64 " "
+			"ho %" PRIx64 " %s\n",
+			op_dec->ldpc_dec.op_flags, op_dec->status,
+			op_dec->ldpc_dec.basegraph, op_dec->ldpc_dec.z_c,
+			op_dec->ldpc_dec.n_cb, op_dec->ldpc_dec.q_m,
+			op_dec->ldpc_dec.n_filler, op_dec->ldpc_dec.rv_index,
+			op_dec->ldpc_dec.iter_max, op_dec->ldpc_dec.iter_count,
+			op_dec->ldpc_dec.harq_combined_input.length,
+			add0, add1, add2, add3, add4, partial);
+	} else if (op_type == RTE_BBDEV_OP_TURBO_DEC) {
+		op_dec = op;
+		if (op_dec->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d K %d",
+					op_dec->turbo_dec.tb_params.c,
+					op_dec->turbo_dec.tb_params.cab,
+					op_dec->turbo_dec.tb_params.ea,
+					op_dec->turbo_dec.tb_params.eb,
+					op_dec->turbo_dec.tb_params.r,
+					op_dec->turbo_dec.tb_params.k_neg);
+		else
+			snprintf(partial, sizeof(partial), "E %d K %d",
+					op_dec->turbo_dec.cb_params.e,
+					op_dec->turbo_dec.cb_params.k);
+		if (op_dec->turbo_dec.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.input.data, 0);
+		if (op_dec->turbo_dec.hard_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.hard_output.data, 0);
+		if (op_dec->turbo_dec.soft_output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.soft_output.data, 0);
+		snprintf(str, len, "op %x st %x CBM %d Iter %d map %d Rv %d ext %d "
+				"in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " %s\n",
+				op_dec->turbo_dec.op_flags, op_dec->status,
+				op_dec->turbo_dec.code_block_mode,
+				op_dec->turbo_dec.iter_max, op_dec->turbo_dec.num_maps,
+				op_dec->turbo_dec.rv_index, op_dec->turbo_dec.ext_scale,
+				add0, add1, add2, partial);
+	} else if (op_type == RTE_BBDEV_OP_LDPC_ENC) {
+		op_enc = op;
+		if (op_enc->ldpc_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
+					op_enc->ldpc_enc.tb_params.c,
+					op_enc->ldpc_enc.tb_params.cab,
+					op_enc->ldpc_enc.tb_params.ea,
+					op_enc->ldpc_enc.tb_params.eb,
+					op_enc->ldpc_enc.tb_params.r);
+		else
+			snprintf(partial, sizeof(partial), "E %d",
+					op_enc->ldpc_enc.cb_params.e);
+		if (op_enc->ldpc_enc.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.input.data, 0);
+		if (op_enc->ldpc_enc.output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.output.data, 0);
+		snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d q_m %d F %d Rv %d "
+				"in %" PRIx64 " out %" PRIx64 " %s\n",
+				op_enc->ldpc_enc.op_flags, op_enc->status,
+				op_enc->ldpc_enc.basegraph, op_enc->ldpc_enc.z_c,
+				op_enc->ldpc_enc.n_cb, op_enc->ldpc_enc.q_m,
+				op_enc->ldpc_enc.n_filler, op_enc->ldpc_enc.rv_index,
+				add0, add1, partial);
+	} else if (op_type == RTE_BBDEV_OP_TURBO_ENC) {
+		op_enc = op;
+		if (op_enc->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial),
+					"C %d Cab %d Ea %d Eb %d r %d K %d Ncb %d",
+					op_enc->turbo_enc.tb_params.c,
+					op_enc->turbo_enc.tb_params.cab,
+					op_enc->turbo_enc.tb_params.ea,
+					op_enc->turbo_enc.tb_params.eb,
+					op_enc->turbo_enc.tb_params.r,
+					op_enc->turbo_enc.tb_params.k_neg,
+					op_enc->turbo_enc.tb_params.ncb_neg);
+		else
+			snprintf(partial, sizeof(partial), "E %d K %d",
+					op_enc->turbo_enc.cb_params.e,
+					op_enc->turbo_enc.cb_params.k);
+		if (op_enc->turbo_enc.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.input.data, 0);
+		if (op_enc->turbo_enc.output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.output.data, 0);
+		snprintf(str, len, "op %x st %x CBM %d Rv %d In %" PRIx64 " Out %" PRIx64 " %s\n",
+				op_enc->turbo_enc.op_flags, op_enc->status,
+				op_enc->turbo_enc.code_block_mode, op_enc->turbo_enc.rv_index,
+				add0, add1, partial);
+	} else if (op_type == RTE_BBDEV_OP_FFT) {
+		op_fft = op;
+		if (op_fft->fft.base_input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_fft->fft.base_input.data, 0);
+		if (op_fft->fft.base_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_fft->fft.base_output.data, 0);
+		if (op_fft->fft.dewindowing_input.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_fft->fft.dewindowing_input.data, 0);
+		if (op_fft->fft.power_meas_output.data != NULL)
+			add3 = rte_pktmbuf_iova_offset(op_fft->fft.power_meas_output.data, 0);
+		snprintf(str, len, "op %x st %x in %d inl %d out %d outl %d cs %x ants %d "
+				"idft %d dft %d cst %d ish %d dsh %d ncs %d pwsh %d fp16 %d fr %d "
+				"outde %d in %" PRIx64 " out %" PRIx64 " dw %" PRIx64 " "
+				"pm %" PRIx64 "\n",
+				op_fft->fft.op_flags, op_fft->status,
+				op_fft->fft.input_sequence_size, op_fft->fft.input_leading_padding,
+				op_fft->fft.output_sequence_size,
+				op_fft->fft.output_leading_depadding,
+				op_fft->fft.cs_bitmap, op_fft->fft.num_antennas_log2,
+				op_fft->fft.idft_log2, op_fft->fft.dft_log2,
+				op_fft->fft.cs_time_adjustment,
+				op_fft->fft.idft_shift, op_fft->fft.dft_shift,
+				op_fft->fft.ncs_reciprocal, op_fft->fft.power_shift,
+				op_fft->fft.fp16_exp_adjust, op_fft->fft.freq_resample_mode,
+				op_fft->fft.output_depadded_size, add0, add1, add2, add3);
+	} else if (op_type == RTE_BBDEV_OP_MLDTS) {
+		op_mldts = op;
+		if (op_mldts->mldts.qhy_input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_mldts->mldts.qhy_input.data, 0);
+		if (op_mldts->mldts.r_input.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_mldts->mldts.r_input.data, 0);
+		if (op_mldts->mldts.output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_mldts->mldts.output.data, 0);
+		snprintf(str, len,
+				"op %x st %x rbs %d lay %d rrep %d crep%d qm %d %d %d %d "
+				"qhy %" PRIx64 " r %" PRIx64 " out %" PRIx64 "\n",
+				op_mldts->mldts.op_flags, op_mldts->status,
+				op_mldts->mldts.num_rbs, op_mldts->mldts.num_layers,
+				op_mldts->mldts.r_rep, op_mldts->mldts.c_rep,
+				op_mldts->mldts.q_m[0], op_mldts->mldts.q_m[1],
+				op_mldts->mldts.q_m[2], op_mldts->mldts.q_m[3],
+				add0, add1, add2);
+
+	} else {
+		snprintf(str, len, "Invalid Operation type %d\n", op_type);
+	}
+
+	return str;
+}
lib/bbdev/rte_bbdev.h +47 -0

53 lines not on this page · raw message

lib/bbdev/rte_bbdev_pmd.h +9 -0
index 442b23943d..c21a7f0c1e 100644
@@ -133,6 +133,13 @@ typedef int (*rte_bbdev_queue_intr_enable_t)(struct rte_bbdev *dev,
 typedef int (*rte_bbdev_queue_intr_disable_t)(struct rte_bbdev *dev,
 				    uint16_t queue_id);
 
+/*
+ * @internal
+ * Function to dump previous operations on a queue of a device.
+ */
+typedef int (*rte_bbdev_queue_ops_dump_t)(struct rte_bbdev *dev,
+		uint16_t queue_id, FILE *file);
+
 /**
  * Operations implemented by drivers. Fields marked as "Required" must be
  * provided by a driver for a device to have basic functionality. "Optional"
@@ -170,6 +177,8 @@ struct rte_bbdev_ops {
 	rte_bbdev_queue_intr_enable_t queue_intr_enable;
 	/** Disable queue interrupt. Optional */
 	rte_bbdev_queue_intr_disable_t queue_intr_disable;
+	/** Dump operations on the queue. Optional */
+	rte_bbdev_queue_ops_dump_t queue_ops_dump;
 };
 
 /**
lib/bbdev/version.map +4 -0
index e0d82ff752..db6dfdf3c6 100644
@@ -54,4 +54,8 @@ EXPERIMENTAL {
 	rte_bbdev_enqueue_mldts_ops;
 	rte_bbdev_mldts_op_alloc_bulk;
 	rte_bbdev_mldts_op_free_bulk;
+
+	# added in 24.11
+	rte_bbdev_queue_ops_dump;
+	rte_bbdev_ops_param_string;
 };
Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 2/2 baseband/acc: improvement to logging mechanism

In reply to Nicolas Chautru

Support the new dev op to dump operations information related to a given queue and information on previous errors detected by the driver and tracked internally in PMD.

---
 drivers/baseband/acc/acc_common.h  |  38 +++++++++
 drivers/baseband/acc/rte_vrb_pmd.c | 129 +++++++++++++++++++++++------
 2 files changed, 140 insertions(+), 27 deletions(-)
drivers/baseband/acc/acc_common.h +38 -0
index e249f37e38..b9c9b4d4c7 100644
@@ -149,6 +149,8 @@
 #define VRB2_VF_ID_SHIFT     6
 
 #define ACC_MAX_FFT_WIN      16
+#define ACC_MAX_LOGLEN    256
+#define ACC_MAX_BUFFERLEN 256
 
 extern int acc_common_logtype;
 
@@ -646,8 +648,44 @@ 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. */
 };
 
+/**
+ * @brief Report error both through RTE logging and into internal driver memory.
+ *
+ * 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(3, 4)
+static inline void
+acc_error_log(struct acc_queue *q, void *op, const char *fmt, ...)
+{
+	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++;
+	}
+	va_end(args);
+	va_end(args2);
+}
+
 /* Write to MMIO register address */
 static inline void
 mmio_write(void *addr, uint32_t value)
drivers/baseband/acc/rte_vrb_pmd.c +102 -27

261 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw
In reply to Nicolas Chautru

Hi Nicolas,

    I have ack your patches.

 One suggestion, if you can use "--in-reply-to=" in you patch series, it will be helpful. This will link your new series with old series.

Regards

Hemant

Quoted 32 lines · Nicolas Chautru

v3: updated based on Maxime comments related to passing string through function prototype. Thanks

v2: updated with comments from Hemant and rebased.

v1: Hi Maxime.

Adding new support to support troubleshooting. This provides to the application an API to dump into file information to help troubleshoot issue on a queue. Some of it is tracked at bbdev level and some extra information can be tracked as an option at PMD level. This is for 24.11.
In practive logging is not enabled at run time, but information can be dump into file when an issue happens and requires extra information. This collates now multiple source of errors detected notably at driver level made more explicit.

Thanks,
Nic

Nicolas Chautru (2):
bbdev: add new function to dump debug information baseband/acc: improvement to logging mechanism

  drivers/baseband/acc/acc_common.h  |  38 +++++
  drivers/baseband/acc/rte_vrb_pmd.c | 129 +++++++++++++----
  lib/bbdev/rte_bbdev.c              | 213 +++++++++++++++++++++++++++++
  lib/bbdev/rte_bbdev.h              |  47 +++++++
  lib/bbdev/rte_bbdev_pmd.h          |   9 ++
  lib/bbdev/version.map              |   4 +
  6 files changed, 413 insertions(+), 27 deletions(-)
#6 lore raw

v4 cover bbdev: dump debug information

In reply to Nicolas Chautru

v4: updated to remove device error logging part which may use different mechanism in the future, possibly rte trace point.

v3: updated based on Maxime comments related to passing string through function prototype. Thanks

v2: updated with comments from Hemant and rebased.

v1: Hi Maxime.

Adding new support to support troubleshooting. This provides to the application an API to dump into file information to help troubleshoot issue on a queue. Some of it is tracked at bbdev level and some extra information can be tracked as an option at PMD level. This is for 24.11.
In practive logging is not enabled at run time, but information can be dump into file when an issue happens and requires extra information. This collates now multiple source of errors detected notably at driver level made more explicit.

Thanks,
Nic

Nicolas Chautru (2):
bbdev: add new function to dump debug information baseband/acc: improvement to logging mechanism

 drivers/baseband/acc/rte_vrb_pmd.c |  59 +++++++-
 lib/bbdev/rte_bbdev.c              | 213 +++++++++++++++++++++++++++++
 lib/bbdev/rte_bbdev.h              |  47 +++++++
 lib/bbdev/rte_bbdev_pmd.h          |   9 ++
 lib/bbdev/version.map              |   4 +
 5 files changed, 331 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#7 lore raw

PATCH v4 1/2 bbdev: add new function to dump debug information

This provides a new API to dump more debug information related to the status on a given bbdev queue. Some of this information is visible at bbdev level. This also provides a new option dev op, to print more information at the lower PMD level.
This helps user to troubleshoot issues related to previous operations provided into a queue causing possible hard-to-debug negative scenarios.

---
 lib/bbdev/rte_bbdev.c     | 213 ++++++++++++++++++++++++++++++++++++++
 lib/bbdev/rte_bbdev.h     |  47 +++++++++
 lib/bbdev/rte_bbdev_pmd.h |   9 ++
 lib/bbdev/version.map     |   4 +
 4 files changed, 273 insertions(+)
lib/bbdev/rte_bbdev.c +213 -0
index 13bde3c25b..bd32da79b0 100644
@@ -1190,3 +1190,216 @@ rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
 	rte_bbdev_log(ERR, "Invalid enqueue status");
 	return NULL;
 }
+
+
+int
+rte_bbdev_queue_ops_dump(uint16_t dev_id, uint16_t queue_id, FILE *f)
+{
+	struct rte_bbdev_queue_data *q_data;
+	struct rte_bbdev_stats *stats;
+	uint16_t i;
+	struct rte_bbdev *dev = get_dev(dev_id);
+
+	VALID_DEV_OR_RET_ERR(dev, dev_id);
+	VALID_QUEUE_OR_RET_ERR(queue_id, dev);
+	VALID_DEV_OPS_OR_RET_ERR(dev, dev_id);
+	VALID_FUNC_OR_RET_ERR(dev->dev_ops->queue_ops_dump, dev_id);
+
+	q_data = &dev->data->queues[queue_id];
+
+	if (f == NULL)
+		return -EINVAL;
+
+	fprintf(f, "Dump of operations on %s queue %d\n",
+			dev->data->name, queue_id);
+	fprintf(f, "  Last Enqueue Status %s\n",
+			rte_bbdev_enqueue_status_str(q_data->enqueue_status));
+	for (i = 0; i < RTE_BBDEV_ENQ_STATUS_SIZE_MAX; i++)
+		if (q_data->queue_stats.enqueue_status_count[i] > 0)
+			fprintf(f, "  Enqueue Status Counters %s %" PRIu64 "\n",
+					rte_bbdev_enqueue_status_str(i),
+					q_data->queue_stats.enqueue_status_count[i]);
+	stats = &dev->data->queues[queue_id].queue_stats;
+
+	fprintf(f, "  Enqueue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
+			stats->enqueued_count, stats->enqueue_warn_count,
+			stats->enqueue_err_count);
+	fprintf(f, "  Dequeue Count %" PRIu64 " Warning %" PRIu64 " Error %" PRIu64 "\n",
+			stats->dequeued_count, stats->dequeue_warn_count,
+			stats->dequeue_err_count);
+
+	return dev->dev_ops->queue_ops_dump(dev, queue_id, f);
+}
+
+char *
+rte_bbdev_ops_param_string(void *op, enum rte_bbdev_op_type op_type, char *str, uint32_t len)
+{
+	static char partial[1024];
+	struct rte_bbdev_dec_op *op_dec;
+	struct rte_bbdev_enc_op *op_enc;
+	struct rte_bbdev_fft_op *op_fft;
+	struct rte_bbdev_mldts_op *op_mldts;
+
+	rte_iova_t add0 = 0, add1 = 0, add2 = 0, add3 = 0, add4 = 0;
+
+	if (op == NULL) {
+		snprintf(str, len, "Invalid Operation pointer\n");
+		return str;
+	}
+
+	if (op_type == RTE_BBDEV_OP_LDPC_DEC) {
+		op_dec = op;
+		if (op_dec->ldpc_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
+					op_dec->ldpc_dec.tb_params.c,
+					op_dec->ldpc_dec.tb_params.cab,
+					op_dec->ldpc_dec.tb_params.ea,
+					op_dec->ldpc_dec.tb_params.eb,
+					op_dec->ldpc_dec.tb_params.r);
+		else
+			snprintf(partial, sizeof(partial), "E %d", op_dec->ldpc_dec.cb_params.e);
+		if (op_dec->ldpc_dec.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.input.data, 0);
+		if (op_dec->ldpc_dec.hard_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.hard_output.data, 0);
+		if (op_dec->ldpc_dec.soft_output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.soft_output.data, 0);
+		if (op_dec->ldpc_dec.harq_combined_input.data != NULL)
+			add3 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_input.data,
+					0);
+		if (op_dec->ldpc_dec.harq_combined_output.data != NULL)
+			add4 = rte_pktmbuf_iova_offset(op_dec->ldpc_dec.harq_combined_output.data,
+					0);
+		snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d qm %d F %d Rv %d It %d It %d "
+			"HARQin %d in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " hi %" PRIx64 " "
+			"ho %" PRIx64 " %s\n",
+			op_dec->ldpc_dec.op_flags, op_dec->status,
+			op_dec->ldpc_dec.basegraph, op_dec->ldpc_dec.z_c,
+			op_dec->ldpc_dec.n_cb, op_dec->ldpc_dec.q_m,
+			op_dec->ldpc_dec.n_filler, op_dec->ldpc_dec.rv_index,
+			op_dec->ldpc_dec.iter_max, op_dec->ldpc_dec.iter_count,
+			op_dec->ldpc_dec.harq_combined_input.length,
+			add0, add1, add2, add3, add4, partial);
+	} else if (op_type == RTE_BBDEV_OP_TURBO_DEC) {
+		op_dec = op;
+		if (op_dec->turbo_dec.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d K %d",
+					op_dec->turbo_dec.tb_params.c,
+					op_dec->turbo_dec.tb_params.cab,
+					op_dec->turbo_dec.tb_params.ea,
+					op_dec->turbo_dec.tb_params.eb,
+					op_dec->turbo_dec.tb_params.r,
+					op_dec->turbo_dec.tb_params.k_neg);
+		else
+			snprintf(partial, sizeof(partial), "E %d K %d",
+					op_dec->turbo_dec.cb_params.e,
+					op_dec->turbo_dec.cb_params.k);
+		if (op_dec->turbo_dec.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.input.data, 0);
+		if (op_dec->turbo_dec.hard_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.hard_output.data, 0);
+		if (op_dec->turbo_dec.soft_output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_dec->turbo_dec.soft_output.data, 0);
+		snprintf(str, len, "op %x st %x CBM %d Iter %d map %d Rv %d ext %d "
+				"in %" PRIx64 " ho %" PRIx64 " so %" PRIx64 " %s\n",
+				op_dec->turbo_dec.op_flags, op_dec->status,
+				op_dec->turbo_dec.code_block_mode,
+				op_dec->turbo_dec.iter_max, op_dec->turbo_dec.num_maps,
+				op_dec->turbo_dec.rv_index, op_dec->turbo_dec.ext_scale,
+				add0, add1, add2, partial);
+	} else if (op_type == RTE_BBDEV_OP_LDPC_ENC) {
+		op_enc = op;
+		if (op_enc->ldpc_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial), "C %d Cab %d Ea %d Eb %d r %d",
+					op_enc->ldpc_enc.tb_params.c,
+					op_enc->ldpc_enc.tb_params.cab,
+					op_enc->ldpc_enc.tb_params.ea,
+					op_enc->ldpc_enc.tb_params.eb,
+					op_enc->ldpc_enc.tb_params.r);
+		else
+			snprintf(partial, sizeof(partial), "E %d",
+					op_enc->ldpc_enc.cb_params.e);
+		if (op_enc->ldpc_enc.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.input.data, 0);
+		if (op_enc->ldpc_enc.output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_enc->ldpc_enc.output.data, 0);
+		snprintf(str, len, "op %x st %x BG %d Zc %d Ncb %d q_m %d F %d Rv %d "
+				"in %" PRIx64 " out %" PRIx64 " %s\n",
+				op_enc->ldpc_enc.op_flags, op_enc->status,
+				op_enc->ldpc_enc.basegraph, op_enc->ldpc_enc.z_c,
+				op_enc->ldpc_enc.n_cb, op_enc->ldpc_enc.q_m,
+				op_enc->ldpc_enc.n_filler, op_enc->ldpc_enc.rv_index,
+				add0, add1, partial);
+	} else if (op_type == RTE_BBDEV_OP_TURBO_ENC) {
+		op_enc = op;
+		if (op_enc->turbo_enc.code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
+			snprintf(partial, sizeof(partial),
+					"C %d Cab %d Ea %d Eb %d r %d K %d Ncb %d",
+					op_enc->turbo_enc.tb_params.c,
+					op_enc->turbo_enc.tb_params.cab,
+					op_enc->turbo_enc.tb_params.ea,
+					op_enc->turbo_enc.tb_params.eb,
+					op_enc->turbo_enc.tb_params.r,
+					op_enc->turbo_enc.tb_params.k_neg,
+					op_enc->turbo_enc.tb_params.ncb_neg);
+		else
+			snprintf(partial, sizeof(partial), "E %d K %d",
+					op_enc->turbo_enc.cb_params.e,
+					op_enc->turbo_enc.cb_params.k);
+		if (op_enc->turbo_enc.input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.input.data, 0);
+		if (op_enc->turbo_enc.output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_enc->turbo_enc.output.data, 0);
+		snprintf(str, len, "op %x st %x CBM %d Rv %d In %" PRIx64 " Out %" PRIx64 " %s\n",
+				op_enc->turbo_enc.op_flags, op_enc->status,
+				op_enc->turbo_enc.code_block_mode, op_enc->turbo_enc.rv_index,
+				add0, add1, partial);
+	} else if (op_type == RTE_BBDEV_OP_FFT) {
+		op_fft = op;
+		if (op_fft->fft.base_input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_fft->fft.base_input.data, 0);
+		if (op_fft->fft.base_output.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_fft->fft.base_output.data, 0);
+		if (op_fft->fft.dewindowing_input.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_fft->fft.dewindowing_input.data, 0);
+		if (op_fft->fft.power_meas_output.data != NULL)
+			add3 = rte_pktmbuf_iova_offset(op_fft->fft.power_meas_output.data, 0);
+		snprintf(str, len, "op %x st %x in %d inl %d out %d outl %d cs %x ants %d "
+				"idft %d dft %d cst %d ish %d dsh %d ncs %d pwsh %d fp16 %d fr %d "
+				"outde %d in %" PRIx64 " out %" PRIx64 " dw %" PRIx64 " "
+				"pm %" PRIx64 "\n",
+				op_fft->fft.op_flags, op_fft->status,
+				op_fft->fft.input_sequence_size, op_fft->fft.input_leading_padding,
+				op_fft->fft.output_sequence_size,
+				op_fft->fft.output_leading_depadding,
+				op_fft->fft.cs_bitmap, op_fft->fft.num_antennas_log2,
+				op_fft->fft.idft_log2, op_fft->fft.dft_log2,
+				op_fft->fft.cs_time_adjustment,
+				op_fft->fft.idft_shift, op_fft->fft.dft_shift,
+				op_fft->fft.ncs_reciprocal, op_fft->fft.power_shift,
+				op_fft->fft.fp16_exp_adjust, op_fft->fft.freq_resample_mode,
+				op_fft->fft.output_depadded_size, add0, add1, add2, add3);
+	} else if (op_type == RTE_BBDEV_OP_MLDTS) {
+		op_mldts = op;
+		if (op_mldts->mldts.qhy_input.data != NULL)
+			add0 = rte_pktmbuf_iova_offset(op_mldts->mldts.qhy_input.data, 0);
+		if (op_mldts->mldts.r_input.data != NULL)
+			add1 = rte_pktmbuf_iova_offset(op_mldts->mldts.r_input.data, 0);
+		if (op_mldts->mldts.output.data != NULL)
+			add2 = rte_pktmbuf_iova_offset(op_mldts->mldts.output.data, 0);
+		snprintf(str, len,
+				"op %x st %x rbs %d lay %d rrep %d crep%d qm %d %d %d %d "
+				"qhy %" PRIx64 " r %" PRIx64 " out %" PRIx64 "\n",
+				op_mldts->mldts.op_flags, op_mldts->status,
+				op_mldts->mldts.num_rbs, op_mldts->mldts.num_layers,
+				op_mldts->mldts.r_rep, op_mldts->mldts.c_rep,
+				op_mldts->mldts.q_m[0], op_mldts->mldts.q_m[1],
+				op_mldts->mldts.q_m[2], op_mldts->mldts.q_m[3],
+				add0, add1, add2);
+
+	} else {
+		snprintf(str, len, "Invalid Operation type %d\n", op_type);
+	}
+
+	return str;
+}
lib/bbdev/rte_bbdev.h +47 -0

53 lines not on this page · raw message

lib/bbdev/rte_bbdev_pmd.h +9 -0
index 442b23943d..c21a7f0c1e 100644
@@ -133,6 +133,13 @@ typedef int (*rte_bbdev_queue_intr_enable_t)(struct rte_bbdev *dev,
 typedef int (*rte_bbdev_queue_intr_disable_t)(struct rte_bbdev *dev,
 				    uint16_t queue_id);
 
+/*
+ * @internal
+ * Function to dump previous operations on a queue of a device.
+ */
+typedef int (*rte_bbdev_queue_ops_dump_t)(struct rte_bbdev *dev,
+		uint16_t queue_id, FILE *file);
+
 /**
  * Operations implemented by drivers. Fields marked as "Required" must be
  * provided by a driver for a device to have basic functionality. "Optional"
@@ -170,6 +177,8 @@ struct rte_bbdev_ops {
 	rte_bbdev_queue_intr_enable_t queue_intr_enable;
 	/** Disable queue interrupt. Optional */
 	rte_bbdev_queue_intr_disable_t queue_intr_disable;
+	/** Dump operations on the queue. Optional */
+	rte_bbdev_queue_ops_dump_t queue_ops_dump;
 };
 
 /**
lib/bbdev/version.map +4 -0
index e0d82ff752..db6dfdf3c6 100644
@@ -54,4 +54,8 @@ EXPERIMENTAL {
 	rte_bbdev_enqueue_mldts_ops;
 	rte_bbdev_mldts_op_alloc_bulk;
 	rte_bbdev_mldts_op_free_bulk;
+
+	# added in 24.11
+	rte_bbdev_queue_ops_dump;
+	rte_bbdev_ops_param_string;
 };
Signature · 1 line
2.34.1
Reviewed-by on v4 1/2
#8 lore raw

Re: [PATCH v4 1/2] bbdev: add new function to dump debug information

Quoted 9 lines · Nicolas Chautru

This provides a new API to dump more debug information related to the status on a given bbdev queue. Some of this information is visible at bbdev level. This also provides a new option dev op, to print more information at the lower PMD level.
This helps user to troubleshoot issues related to previous operations provided into a queue causing possible hard-to-debug negative scenarios.

Quoted 9 lines
---
  lib/bbdev/rte_bbdev.c     | 213 ++++++++++++++++++++++++++++++++++++++
  lib/bbdev/rte_bbdev.h     |  47 +++++++++
  lib/bbdev/rte_bbdev_pmd.h |   9 ++
  lib/bbdev/version.map     |   4 +
  4 files changed, 273 insertions(+)

Thanks,
Maxime

#9 lore raw

PATCH v4 2/2 baseband/acc: improvement to logging mechanism

In reply to Nicolas Chautru

Support the new dev op to dump operations information related to a given queue tracked internally in PMD.

---
 drivers/baseband/acc/rte_vrb_pmd.c | 59 +++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)
drivers/baseband/acc/rte_vrb_pmd.c +58 -1
index 585dc49bd6..52e76ec6c1 100644
@@ -1434,6 +1434,62 @@ vrb_queue_intr_disable(struct rte_bbdev *dev, uint16_t queue_id)
 	return 0;
 }
 
+static int
+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;
+	volatile union acc_info_ring_data *ring_data;
+	uint16_t info_ring_head = q->d->info_ring_head;
+	static char str[1024];
+
+	if (f == NULL) {
+		rte_bbdev_log(ERR, "Invalid File input");
+		return -EINVAL;
+	}
+
+	/** Print generic information on queue status. */
+	fprintf(f, "Dump of operations %s on Queue %d by %s\n",
+			rte_bbdev_op_type_str(q->op_type), queue_id, dev->device->driver->name);
+	fprintf(f, "    AQ Enqueued %d Dequeued %d Depth %d - Available Enq %d Deq %d\n",
+			q->aq_enqueued, q->aq_dequeued, q->aq_depth,
+			acc_ring_avail_enq(q), acc_ring_avail_deq(q));
+
+	/** 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);
+		ring_data = q->d->info_ring + (q->d->info_ring_head & ACC_INFO_RING_MASK);
+		while (ring_data->valid) {
+			int_nb = int_from_ring(*ring_data, q->d->device_variant);
+			if ((int_nb < ACC_PF_INT_DMA_DL_DESC_IRQ) || (
+					int_nb > ACC_PF_INT_DMA_MLD_DESC_IRQ)) {
+				fprintf(f, "  InfoRing: ITR:%d Info:0x%x",
+						int_nb, ring_data->detailed_info);
+				/* Initialize Info Ring entry and move forward. */
+				ring_data->valid = 0;
+			}
+			info_ring_head++;
+			ring_data = q->d->info_ring + (info_ring_head & ACC_INFO_RING_MASK);
+		}
+	}
+
+	fprintf(f, "Ring Content - Head %d Tail %d Depth %d\n",
+			q->sw_ring_head, q->sw_ring_tail, q->sw_ring_depth);
+	/** Print information about each operation in the software ring. */
+	for (i = 0; i < q->sw_ring_depth; ++i) {
+		op = (q->ring_addr + i)->req.op_addr;
+		if (op != NULL)
+			fprintf(f, "  %d\tn %d %s", i, (q->ring_addr + i)->req.numCBs,
+					rte_bbdev_ops_param_string(op, q->op_type,
+							str, sizeof(str)));
+	}
+
+	fprintf(f, "== End of File ==\n");
+
+	return 0;
+}
+
 static const struct rte_bbdev_ops vrb_bbdev_ops = {
 	.setup_queues = vrb_setup_queues,
 	.intr_enable = vrb_intr_enable,
@@ -1443,7 +1499,8 @@ static const struct rte_bbdev_ops vrb_bbdev_ops = {
 	.queue_release = vrb_queue_release,
 	.queue_stop = vrb_queue_stop,
 	.queue_intr_enable = vrb_queue_intr_enable,
-	.queue_intr_disable = vrb_queue_intr_disable
+	.queue_intr_disable = vrb_queue_intr_disable,
+	.queue_ops_dump = vrb_queue_ops_dump
 };
 
 /* PCI PF address map. */
Signature · 1 line
2.34.1
Reviewed-by on v4 2/2
#10 lore raw

Re: [PATCH v4 2/2] baseband/acc: improvement to logging mechanism

Quoted 9 lines · Nicolas Chautru

Support the new dev op to dump operations information related to a given queue tracked internally in PMD.

---
  drivers/baseband/acc/rte_vrb_pmd.c | 59 +++++++++++++++++++++++++++++-
  1 file changed, 58 insertions(+), 1 deletion(-)

Thanks for removing the error logging bits, it looks good to me.

Maxime

#11 lore raw
In reply to Nicolas Chautru
Quoted 27 lines · Nicolas Chautru

v4: updated to remove device error logging part which may use different mechanism in the future, possibly rte trace point.

v3: updated based on Maxime comments related to passing string through function prototype. Thanks

v2: updated with comments from Hemant and rebased.

v1: Hi Maxime.

Adding new support to support troubleshooting. This provides to the application an API to dump into file information to help troubleshoot issue on a queue. Some of it is tracked at bbdev level and some extra information can be tracked as an option at PMD level. This is for 24.11.
In practive logging is not enabled at run time, but information can be dump into file when an issue happens and requires extra information. This collates now multiple source of errors detected notably at driver level made more explicit.

Thanks,
Nic

Nicolas Chautru (2):
bbdev: add new function to dump debug information baseband/acc: improvement to logging mechanism

Quoted 7 lines
  drivers/baseband/acc/rte_vrb_pmd.c |  59 +++++++-
  lib/bbdev/rte_bbdev.c              | 213 +++++++++++++++++++++++++++++
  lib/bbdev/rte_bbdev.h              |  47 +++++++
  lib/bbdev/rte_bbdev_pmd.h          |   9 ++
  lib/bbdev/version.map              |   4 +
  5 files changed, 331 insertions(+), 1 deletion(-)

Applied to next-baseband/for-main.

Thanks,
Maxime