From 401171466415243380cf65dc3ce95698ab2aa9f4 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 26 Feb 2021 14:20:10 +0000 Subject: [PATCH] Fix errors in RLC stress tests due to PDCP SN wrap-around --- lib/test/upper/rlc_stress_test.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test/upper/rlc_stress_test.cc b/lib/test/upper/rlc_stress_test.cc index 6f229c054..e26b3c985 100644 --- a/lib/test/upper/rlc_stress_test.cc +++ b/lib/test/upper/rlc_stress_test.cc @@ -361,11 +361,17 @@ public: int get_nof_rx_pdus() { return rx_pdus; } private: - void run_thread() + const static size_t max_pdcp_sn = 262143u; // 18bit SN + void run_thread() { uint32_t pdcp_sn = 0; byte_buffer_pool* pool = byte_buffer_pool::get_instance(); while (run_enable) { + // SDU queue is full, don't assign PDCP SN + if (rlc->sdu_queue_is_full(lcid)) { + continue; + } + unique_byte_buffer_t pdu = srslte::make_byte_buffer(); if (pdu == NULL) { printf("Error: Could not allocate PDU in rlc_tester::run_thread\n\n\n"); @@ -377,9 +383,9 @@ private: for (uint32_t i = 0; i < args.sdu_size; i++) { pdu->msg[i] = pdcp_sn & 0xFF; } - pdcp_sn++; pdu->N_bytes = args.sdu_size; rlc->write_sdu(lcid, std::move(pdu)); + pdcp_sn = (pdcp_sn + 1) % max_pdcp_sn; if (args.sdu_gen_delay_usec > 0) { usleep(args.sdu_gen_delay_usec); }