From d78cbdf9bbc234ea23ffdfc9fe057ecc27166a1d Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 29 Jul 2021 18:07:10 +0200 Subject: [PATCH] ue,proc_ra_nr: fix retransmission of PRACH after failed RAR rx if the backoff value is calculated to be zero, don't start a timer but tx new preamble directly --- srsue/src/stack/mac_nr/proc_ra_nr.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/srsue/src/stack/mac_nr/proc_ra_nr.cc b/srsue/src/stack/mac_nr/proc_ra_nr.cc index 6262064a3..694292982 100644 --- a/srsue/src/stack/mac_nr/proc_ra_nr.cc +++ b/srsue/src/stack/mac_nr/proc_ra_nr.cc @@ -291,15 +291,20 @@ void proc_ra_nr::ra_error() reset(); } } else { - // if the Random Access procedure is not completed + // try again, if RA failed if (preamble_backoff) { backoff_wait = rand() % preamble_backoff; } else { backoff_wait = 0; } - logger.warning("Backoff wait interval %d", backoff_wait); - backoff_timer.set(backoff_wait, [this](uint32_t tid) { timer_expired(tid); }); - backoff_timer.run(); + logger.debug("Backoff wait interval %d", backoff_wait); + + if (backoff_wait > 0) { + backoff_timer.set(backoff_wait, [this](uint32_t tid) { timer_expired(tid); }); + backoff_timer.run(); + } else { + timer_expired(backoff_timer.id()); + } } }