diff --git a/srsenb/hdr/stack/mac/scheduler_carrier.h b/srsenb/hdr/stack/mac/scheduler_carrier.h index 260b9bc40..dd88e67ba 100644 --- a/srsenb/hdr/stack/mac/scheduler_carrier.h +++ b/srsenb/hdr/stack/mac/scheduler_carrier.h @@ -132,7 +132,8 @@ private: std::map* ue_db = nullptr; std::deque pending_rars; - uint32_t rar_aggr_level = 2; + uint32_t rar_aggr_level = 2; + static const uint32_t PRACH_RAR_OFFSET = 3; // TS 36.321 Sec. 5.1.4 }; } // namespace srsenb diff --git a/srsenb/src/stack/mac/scheduler_carrier.cc b/srsenb/src/stack/mac/scheduler_carrier.cc index 63b46fb1e..e60ae75de 100644 --- a/srsenb/src/stack/mac/scheduler_carrier.cc +++ b/srsenb/src/stack/mac/scheduler_carrier.cc @@ -154,16 +154,20 @@ void ra_sched::dl_sched(sf_sched* tti_sched) uint32_t prach_tti = rar.prach_tti; // Discard all RARs out of the window. The first one inside the window is scheduled, if we can't we exit - if (not sched_utils::is_in_tti_interval(tti_tx_dl, prach_tti + 3, prach_tti + 3 + cc_cfg->cfg.prach_rar_window)) { - if (tti_tx_dl >= prach_tti + 3 + cc_cfg->cfg.prach_rar_window) { - log_h->console("SCHED: Could not transmit RAR within the window (RA TTI=%d, Window=%d, Now=%d)\n", - prach_tti, - cc_cfg->cfg.prach_rar_window, - tti_tx_dl); - log_h->error("SCHED: Could not transmit RAR within the window (RA TTI=%d, Window=%d, Now=%d)\n", - prach_tti, - cc_cfg->cfg.prach_rar_window, - tti_tx_dl); + if (not sched_utils::is_in_tti_interval( + tti_tx_dl, prach_tti + PRACH_RAR_OFFSET, prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window)) { + if (tti_tx_dl >= prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window) { + char error_msg[128]; + int len = snprintf(error_msg, + sizeof(error_msg), + "SCHED: Could not transmit RAR within the window (RA=%d, Window=[%d..%d], RAR=%d)\n", + prach_tti, + prach_tti + PRACH_RAR_OFFSET, + prach_tti + PRACH_RAR_OFFSET + cc_cfg->cfg.prach_rar_window, + tti_tx_dl); + error_msg[len] = '\0'; + log_h->console("%s", error_msg); + log_h->error("%s", error_msg); // Remove from pending queue and get next one if window has passed already pending_rars.pop_front(); continue;