Skip to content

Commit

Permalink
sched: make UL-CCCH slot_rx an optional
Browse files Browse the repository at this point in the history
  • Loading branch information
frankist authored and codebot committed Nov 11, 2024
1 parent dab768b commit 5f0a538
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 22 deletions.
4 changes: 0 additions & 4 deletions include/srsran/du/du_high/du_manager/du_manager.h
Original file line number Diff line number Diff line change
@@ -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 <string>

namespace srsran {

Expand Down
2 changes: 1 addition & 1 deletion include/srsran/mac/mac_ue_configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<slot_point> ul_ccch_slot_rx;

// Scheduler-only params.
sched_ue_config_request sched_cfg;
Expand Down
2 changes: 1 addition & 1 deletion include/srsran/scheduler/scheduler_configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<slot_point> ul_ccch_slot_rx;
/// Configuration to be applied to the new UE.
sched_ue_config_request cfg;
/// Time Alignment Group configuration.
Expand Down
6 changes: 3 additions & 3 deletions lib/du/du_high/du_manager/procedures/ue_creation_procedure.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_point> slot_rx;
};

/// \brief Handles the creation of a UE and respective bearers in the DU UE manager, MAC, F1.
Expand Down
3 changes: 2 additions & 1 deletion lib/scheduler/ue_context/ue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
8 changes: 4 additions & 4 deletions lib/scheduler/ue_context/ue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<slot_point> ul_ccch_slot_rx;
};

/// Parameters used to reconfigure a UE.
Expand Down
12 changes: 9 additions & 3 deletions lib/scheduler/ue_context/ue_drx_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ ue_drx_controller::ue_drx_controller(subcarrier_spacing scs_commo
std::chrono::milliseconds conres_timer_,
const std::optional<drx_config>& drx_cfg_,
const ul_logical_channel_manager& ul_lc_mng_,
slot_point ul_ccch_slot_rx_) :
std::optional<slot_point> 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);
Expand Down Expand Up @@ -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."
Expand Down
9 changes: 6 additions & 3 deletions lib/scheduler/ue_context/ue_drx_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "srsran/ran/drx_config.h"
#include "srsran/ran/slot_point.h"
#include "srsran/srslog/logger.h"
#include <optional>

namespace srsran {
Expand All @@ -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_config>& drx_cfg,
const ul_logical_channel_manager& ul_lc_mng,
slot_point ul_ccch_slot_rx);
std::optional<slot_point> ul_ccch_slot_rx,
srslog::basic_logger& logger);

/// Update DRX controller state.
void slot_indication(slot_point dl_slot);
Expand All @@ -50,7 +52,8 @@ class ue_drx_controller
std::chrono::milliseconds conres_timer;
const std::optional<drx_config>& drx_cfg;
const ul_logical_channel_manager& ul_lc_mng;
slot_point ul_ccch_slot_rx;
std::optional<slot_point> ul_ccch_slot_rx;
srslog::basic_logger& logger;

// Converted config parameters from milliseconds to slots.
unsigned active_window_period;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class base_ue_drx_controller_test
std::optional<drx_config> 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<unsigned>(0, 10240) * get_nof_slots_per_subframe(scs) - 1};
Expand Down
4 changes: 3 additions & 1 deletion tests/unittests/scheduler/ue_scheduling/ue_cell_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f0a538

Please sign in to comment.