rlc_stress_test: fix SDU generation

the PDCP SN was used to fill the SDU with data. But since
the max value isn't devisable by 256 it didn't always increment
correctly. Use a normal byte now that wraps correctly.
This commit is contained in:
Andre Puschmann 2021-03-05 17:27:32 +01:00
parent 62b2327178
commit fa23be4d6d
1 changed files with 6 additions and 5 deletions

View File

@ -318,8 +318,7 @@ public:
stress_test_args_t args_, stress_test_args_t args_,
uint32_t lcid_, uint32_t lcid_,
uint32_t seed_) : uint32_t seed_) :
log("TEST"), logger(srslog::fetch_basic_logger(name_.c_str(), false)),
logger(srslog::fetch_basic_logger("TEST", false)),
rlc_pdcp(rlc_pdcp_), rlc_pdcp(rlc_pdcp_),
name(name_), name(name_),
args(args_), args(args_),
@ -389,6 +388,7 @@ private:
{ {
uint32_t pdcp_sn = 0; uint32_t pdcp_sn = 0;
uint32_t sdu_size = 0; uint32_t sdu_size = 0;
uint8_t payload = 0x0; // increment for each SDU
while (run_enable) { while (run_enable) {
// SDU queue is full, don't assign PDCP SN // SDU queue is full, don't assign PDCP SN
if (rlc_pdcp->sdu_queue_is_full(lcid)) { if (rlc_pdcp->sdu_queue_is_full(lcid)) {
@ -412,11 +412,10 @@ private:
} }
for (uint32_t i = 0; i < sdu_size; i++) { for (uint32_t i = 0; i < sdu_size; i++) {
pdu->msg[i] = pdcp_sn & 0xFF; pdu->msg[i] = payload;
} }
pdu->N_bytes = sdu_size; pdu->N_bytes = sdu_size;
payload++;
logger.info(pdu->msg, pdu->N_bytes, "Generated SDU with %d B", pdu->N_bytes);
rlc_pdcp->write_sdu(lcid, std::move(pdu)); rlc_pdcp->write_sdu(lcid, std::move(pdu));
pdcp_sn = (pdcp_sn + 1) % max_pdcp_sn; pdcp_sn = (pdcp_sn + 1) % max_pdcp_sn;
@ -518,6 +517,8 @@ void stress_test(stress_test_args_t args)
rlc2.add_bearer(lcid, cnfg_); rlc2.add_bearer(lcid, cnfg_);
} }
printf("Starting test ..\n");
tester1.start(7); tester1.start(7);
if (!args.single_tx) { if (!args.single_tx) {
tester2.start(7); tester2.start(7);