diff --git a/include/srsran/du/du_high/du_manager/du_manager.h b/include/srsran/du/du_high/du_manager/du_manager.h index 85e10c85f6..360d9de2e9 100644 --- a/include/srsran/du/du_high/du_manager/du_manager.h +++ b/include/srsran/du/du_high/du_manager/du_manager.h @@ -1,14 +1,10 @@ #pragma once -#include "srsran/adt/byte_buffer.h" #include "srsran/du/du_high/du_manager/du_configurator.h" #include "srsran/f1ap/du/f1ap_du.h" #include "srsran/ran/du_types.h" -#include "srsran/ran/logical_channel/lcid.h" -#include "srsran/ran/rnti.h" #include "srsran/support/async/async_task.h" -#include namespace srsran { diff --git a/include/srsran/mac/mac_ue_configurator.h b/include/srsran/mac/mac_ue_configurator.h index 4683775a17..bbda542254 100644 --- a/include/srsran/mac/mac_ue_configurator.h +++ b/include/srsran/mac/mac_ue_configurator.h @@ -66,7 +66,7 @@ struct mac_ue_create_request { physical_cell_group_config phy_cell_group_cfg; bool initial_fallback = true; const byte_buffer* ul_ccch_msg = nullptr; - slot_point ul_ccch_slot_rx; + std::optional ul_ccch_slot_rx; // Scheduler-only params. sched_ue_config_request sched_cfg; diff --git a/include/srsran/scheduler/scheduler_configurator.h b/include/srsran/scheduler/scheduler_configurator.h index b15c18c50e..c74da852ef 100644 --- a/include/srsran/scheduler/scheduler_configurator.h +++ b/include/srsran/scheduler/scheduler_configurator.h @@ -154,7 +154,7 @@ struct sched_ue_creation_request_message { /// Whether the UE starts in fallback mode, i.e. without using its dedicated configuration. bool starts_in_fallback; /// Slot at which UL-CCCH message was received, in case of RA-based UE creation. Invalid, otherwise. - slot_point ul_ccch_slot_rx; + std::optional ul_ccch_slot_rx; /// Configuration to be applied to the new UE. sched_ue_config_request cfg; /// Time Alignment Group configuration. diff --git a/lib/du/du_high/du_manager/procedures/ue_creation_procedure.h b/lib/du/du_high/du_manager/procedures/ue_creation_procedure.h index a2d38581c2..1267d9f087 100644 --- a/lib/du/du_high/du_manager/procedures/ue_creation_procedure.h +++ b/lib/du/du_high/du_manager/procedures/ue_creation_procedure.h @@ -29,9 +29,9 @@ struct du_ue_creation_request { rnti_t tc_rnti; /// \brief UL-CCCH message received from the UE in Msg3. Empty if the UE is created by upper layers. byte_buffer ul_ccch_msg; - /// \brief Slot at which the UL-CCCH message was received in the PUSCH. Invalid slot if the UE is created by upper - /// layers. - slot_point slot_rx; + /// \brief If present, it represents the slot at which the UL-CCCH message was received in the PUSCH. Absent, when + /// the UE is created by command from upper layers. + std::optional slot_rx; }; /// \brief Handles the creation of a UE and respective bearers in the DU UE manager, MAC, F1. diff --git a/lib/scheduler/ue_context/ue.cpp b/lib/scheduler/ue_context/ue.cpp index f53b33225f..380500d244 100644 --- a/lib/scheduler/ue_context/ue.cpp +++ b/lib/scheduler/ue_context/ue.cpp @@ -28,7 +28,8 @@ ue::ue(const ue_creation_command& cmd) : cell_cfg_common.ul_cfg_common.init_ul_bwp.rach_cfg_common->ra_con_res_timer, cmd.cfg.drx_cfg(), ul_lc_ch_mgr, - cmd.ul_ccch_slot_rx) + cmd.ul_ccch_slot_rx, + logger) { // Apply configuration. handle_reconfiguration_request(ue_reconf_command{cmd.cfg}); diff --git a/lib/scheduler/ue_context/ue.h b/lib/scheduler/ue_context/ue.h index 83053e4244..d87d3f6c3b 100644 --- a/lib/scheduler/ue_context/ue.h +++ b/lib/scheduler/ue_context/ue.h @@ -22,10 +22,10 @@ namespace srsran { /// Parameters used to create a UE. struct ue_creation_command { - const ue_configuration& cfg; - bool starts_in_fallback; - cell_harq_manager& pcell_harq_pool; - slot_point ul_ccch_slot_rx; + const ue_configuration& cfg; + bool starts_in_fallback; + cell_harq_manager& pcell_harq_pool; + std::optional ul_ccch_slot_rx; }; /// Parameters used to reconfigure a UE. diff --git a/lib/scheduler/ue_context/ue_drx_controller.cpp b/lib/scheduler/ue_context/ue_drx_controller.cpp index df81ae01ad..0b75d03e07 100644 --- a/lib/scheduler/ue_context/ue_drx_controller.cpp +++ b/lib/scheduler/ue_context/ue_drx_controller.cpp @@ -17,12 +17,14 @@ ue_drx_controller::ue_drx_controller(subcarrier_spacing scs_commo std::chrono::milliseconds conres_timer_, const std::optional& drx_cfg_, const ul_logical_channel_manager& ul_lc_mng_, - slot_point ul_ccch_slot_rx_) : + std::optional ul_ccch_slot_rx_, + srslog::basic_logger& logger_) : scs_common(scs_common_), conres_timer(conres_timer_), drx_cfg(drx_cfg_), ul_lc_mng(ul_lc_mng_), - ul_ccch_slot_rx(ul_ccch_slot_rx_) + ul_ccch_slot_rx(ul_ccch_slot_rx_), + logger(logger_) { if (drx_cfg.has_value()) { const unsigned nof_slots_per_sf = get_nof_slots_per_subframe(scs_common); @@ -96,10 +98,14 @@ void ue_drx_controller::on_con_res_start() if (not drx_cfg.has_value()) { return; } + if (not ul_ccch_slot_rx.has_value() or not ul_ccch_slot_rx.value().valid()) { + logger.error("Setting conRes timer but slot of UL-CCCH was not registered"); + return; + } const unsigned conres_slots = conres_timer.count() * get_nof_slots_per_subframe(scs_common); - slot_point new_time_end = ul_ccch_slot_rx + conres_slots; + slot_point new_time_end = ul_ccch_slot_rx.value() + conres_slots; if (not active_time_end.valid() or active_time_end < new_time_end) { // "the Active Time includes the time while [...] ra-ContentionResolutionTimer [...] is running." diff --git a/lib/scheduler/ue_context/ue_drx_controller.h b/lib/scheduler/ue_context/ue_drx_controller.h index f32b8b4615..cb6311278e 100644 --- a/lib/scheduler/ue_context/ue_drx_controller.h +++ b/lib/scheduler/ue_context/ue_drx_controller.h @@ -12,6 +12,7 @@ #include "srsran/ran/drx_config.h" #include "srsran/ran/slot_point.h" +#include "srsran/srslog/logger.h" #include namespace srsran { @@ -24,11 +25,12 @@ class ul_logical_channel_manager; class ue_drx_controller { public: - ue_drx_controller(const subcarrier_spacing scs_common, + ue_drx_controller(subcarrier_spacing scs_common, std::chrono::milliseconds conres_timer, const std::optional& drx_cfg, const ul_logical_channel_manager& ul_lc_mng, - slot_point ul_ccch_slot_rx); + std::optional ul_ccch_slot_rx, + srslog::basic_logger& logger); /// Update DRX controller state. void slot_indication(slot_point dl_slot); @@ -50,7 +52,8 @@ class ue_drx_controller std::chrono::milliseconds conres_timer; const std::optional& drx_cfg; const ul_logical_channel_manager& ul_lc_mng; - slot_point ul_ccch_slot_rx; + std::optional ul_ccch_slot_rx; + srslog::basic_logger& logger; // Converted config parameters from milliseconds to slots. unsigned active_window_period; diff --git a/tests/unittests/scheduler/ue_context/ue_drx_controller_test.cpp b/tests/unittests/scheduler/ue_context/ue_drx_controller_test.cpp index 7b09bf7e50..d59e6b7703 100644 --- a/tests/unittests/scheduler/ue_context/ue_drx_controller_test.cpp +++ b/tests/unittests/scheduler/ue_context/ue_drx_controller_test.cpp @@ -34,7 +34,8 @@ class base_ue_drx_controller_test std::optional drx_cfg; ul_logical_channel_manager ul_lc_ch_mng; slot_point ul_ccch_slot{to_numerology_value(scs), 0}; - ue_drx_controller drx{scs, conres_timer, drx_cfg, ul_lc_ch_mng, ul_ccch_slot}; + srslog::basic_logger& logger = srslog::fetch_basic_logger("SCHED"); + ue_drx_controller drx{scs, conres_timer, drx_cfg, ul_lc_ch_mng, ul_ccch_slot, logger}; slot_point next_slot{to_numerology_value(scs), test_rgen::uniform_int(0, 10240) * get_nof_slots_per_subframe(scs) - 1}; diff --git a/tests/unittests/scheduler/ue_scheduling/ue_cell_test.cpp b/tests/unittests/scheduler/ue_scheduling/ue_cell_test.cpp index a3fefbe6e3..80d0219bac 100644 --- a/tests/unittests/scheduler/ue_scheduling/ue_cell_test.cpp +++ b/tests/unittests/scheduler/ue_scheduling/ue_cell_test.cpp @@ -82,11 +82,13 @@ class ue_cell_tester : public ::testing::Test ue_cell_configuration ue_cc_cfg; cell_harq_manager cell_harqs{1, MAX_NOF_HARQS}; ul_logical_channel_manager ul_lc_ch_mng; + srslog::basic_logger& logger = srslog::fetch_basic_logger("SCHED"); ue_drx_controller drx_controller{cell_cfg.dl_cfg_common.init_dl_bwp.generic_params.scs, cell_cfg.ul_cfg_common.init_ul_bwp.rach_cfg_common->ra_con_res_timer, std::nullopt, ul_lc_ch_mng, - {}}; + {}, + logger}; }; TEST_F(ue_cell_tester, when_dl_nof_prb_allocated_increases_estimated_dl_rate_increases)