DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hernan Vargas <hernan.vargas@intel.com>
To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com,
	maxime.coquelin@redhat.com
Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com,
	Hernan Vargas <hernan.vargas@intel.com>
Subject: [PATCH v1 8/9] test/bbdev: update fft measurement output
Date: Mon, 22 Apr 2024 12:07:59 -0700	[thread overview]
Message-ID: <20240422190800.123027-9-hernan.vargas@intel.com> (raw)
In-Reply-To: <20240422190800.123027-1-hernan.vargas@intel.com>

Update check for FFT measurement output to better account for tolerance.

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c | 52 +++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 57b21730cab2..639e67a937b2 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2637,6 +2637,56 @@ validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig
 	return TEST_SUCCESS;
 }
 
+static inline int
+validate_op_fft_meas_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op,
+		bool skip_validate_output)
+{
+	struct rte_mbuf *m = op->data;
+	uint8_t i, nb_dst_segments = orig_op->nb_segments;
+	double thres_hold = 1.0;
+	uint32_t j, data_len_iq, error_num;
+	int32_t *ref_out, *op_out;
+	double estSNR, refSNR, delt, abs_delt;
+
+	TEST_ASSERT(nb_dst_segments == m->nb_segs,
+			"Number of segments differ in original (%u) and filled (%u) op fft",
+			nb_dst_segments, m->nb_segs);
+
+	/* Due to size limitation of mbuf, FFT doesn't use real mbuf. */
+	for (i = 0; i < nb_dst_segments; ++i) {
+		uint16_t offset = (i == 0) ? op->offset : 0;
+		uint32_t data_len = op->length;
+
+		TEST_ASSERT(orig_op->segments[i].length == data_len,
+				"Length of segment differ in original (%u) and filled (%u) op fft",
+				orig_op->segments[i].length, data_len);
+
+		/* Divided by 4 to get the number of 32 bits data. */
+		data_len_iq = data_len >> 2;
+		ref_out = (int32_t *)(orig_op->segments[i].addr);
+		op_out = rte_pktmbuf_mtod_offset(m, int32_t *, offset);
+		error_num = 0;
+		for (j = 0; j < data_len_iq; j++) {
+			estSNR = 10*log10(op_out[j]);
+			refSNR = 10*log10(ref_out[j]);
+			delt = refSNR - estSNR;
+			abs_delt = delt > 0 ? delt : -delt;
+			error_num += (abs_delt > thres_hold ? 1 : 0);
+		}
+		if ((error_num > 0) && !skip_validate_output) {
+			rte_memdump(stdout, "Buffer A", ref_out, data_len);
+			rte_memdump(stdout, "Buffer B", op_out, data_len);
+			TEST_ASSERT(error_num == 0,
+				"FFT Output are not matched total (%u) errors (%u)",
+				data_len_iq, error_num);
+		}
+
+		m = m->next;
+	}
+
+	return TEST_SUCCESS;
+}
+
 static inline int
 validate_op_mldts_chain(struct rte_bbdev_op_data *op,
 		struct op_data_entries *orig_op)
@@ -2712,7 +2762,7 @@ validate_fft_op(struct rte_bbdev_fft_op **ops, const uint16_t n,
 				&ops[i]->fft.base_output, fft_data_orig, skip_validate_output),
 				"FFT Output buffers (op=%u) are not matched", i);
 		if (check_bit(ops[i]->fft.op_flags, RTE_BBDEV_FFT_POWER_MEAS))
-			TEST_ASSERT_SUCCESS(validate_op_fft_chain(
+			TEST_ASSERT_SUCCESS(validate_op_fft_meas_chain(
 				&ops[i]->fft.power_meas_output, fft_pwr_orig, skip_validate_output),
 				"FFT Power Output buffers (op=%u) are not matched", i);
 	}
-- 
2.37.1


  parent reply	other threads:[~2024-04-22 19:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 19:07 [PATCH v1 0/9] test-bbdev fixes and improvements for 24.07 Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 1/9] test/bbdev: fix TB logic Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 2/9] test/bbdev: fix MLD output size computation Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 3/9] test/bbdev: fix interrupt tests Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 4/9] test/bbdev: change iter-max argument Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 5/9] test/bbdev: improve timeout message format Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 6/9] test/bbdev: add soft output parsing capability Hernan Vargas
2024-04-22 19:07 ` [PATCH v1 7/9] test/bbdev: check assumptions on fft window Hernan Vargas
2024-04-22 19:07 ` Hernan Vargas [this message]
2024-04-22 19:08 ` [PATCH v1 9/9] test/bbdev: remove unnecessary line Hernan Vargas

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=20240422190800.123027-9-hernan.vargas@intel.com \
    --to=hernan.vargas@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nicolas.chautru@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=trix@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).