[v2,04/10] test/bbdev: handle exception for LLR generation

Message ID 20231027225728.563914-5-nicolas.chautru@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series test-bbdev changes for 23.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas Oct. 27, 2023, 10:57 p.m. UTC
  From: Hernan Vargas <hernan.vargas@intel.com>

Add range limit to prevent LLR generation greater than the data buffer
size.

Fixes: 7831a9684356 ("test/bbdev: support BLER for 4G")
Cc: stable@dpdk.org

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

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index d4c001de00..54cb2090f9 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -1838,6 +1838,12 @@  generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
 	range = ref_op->turbo_dec.input.length;
 	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
 
+	if (range > inputs[0].data->data_len) {
+		printf("Warning: Limiting LLR generation to first segment (%d from %d)\n",
+				inputs[0].data->data_len, range);
+		range = inputs[0].data->data_len;
+	}
+
 	for (i = 0; i < n; ++i) {
 		m = inputs[i].data;
 		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);