Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sched_test_improv' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismael committed Nov 21, 2024
2 parents b6ff4eb + a713130 commit 64d2b71
Show file tree
Hide file tree
Showing 8 changed files with 391 additions and 222 deletions.
11 changes: 11 additions & 0 deletions lib/scheduler/logging/scheduler_result_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ void scheduler_result_logger::log_debug(const sched_result& result, std::chrono:
srs.sequence_id);
}

if (log_broadcast) {
for (const prach_occasion_info& prach : result.ul.prachs) {
fmt::format_to(fmtbuf,
"\n- PRACH: pci={} format={} nof_occasions={} nof_preambles={}",
prach.pci,
to_string(prach.format),
prach.nof_prach_occasions,
prach.nof_preamble_indexes);
}
}

if (fmtbuf.size() > 0) {
const unsigned nof_pdschs = result.dl.paging_grants.size() + result.dl.rar_grants.size() +
result.dl.ue_grants.size() + result.dl.bc.sibs.size();
Expand Down
56 changes: 31 additions & 25 deletions lib/scheduler/policy/scheduler_time_rr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,21 @@ static unsigned compute_max_nof_rbs_per_ue_per_slot(const slice_ue_repository&
return (std::min(bwp_crb_limits.length(), slice_max_rbs) / nof_ues_to_be_scheduled_per_slot);
}

static bool can_allocate_dl_newtx(const slice_ue& ue_ref, ue_cell_index_t cell_index, srslog::basic_logger& logger)
static bool can_allocate_dl_newtx(const ue_resource_grid_view& res_grid,
const ue_cell& ue_cc,
slot_point pdsch_slot,
srslog::basic_logger& logger)
{
const ue_cell& ue_cc = ue_ref.get_cell(cell_index);
srsran_assert(ue_cc.is_active() and not ue_cc.is_in_fallback_mode(),
"policy scheduler called for UE={} in fallback",
ue_cc.ue_index);

if (res_grid.has_ue_dl_pdcch(ue_cc.cell_index, ue_cc.rnti()) or
not ue_cc.is_pdcch_enabled(res_grid.get_pdcch_slot(ue_cc.cell_index)) or not ue_cc.is_pdsch_enabled(pdsch_slot)) {
// UE is either already allocated for this slot (e.g. a reTx already took place) or it is not active.
return false;
}

if (not ue_cc.harqs.has_empty_dl_harqs()) {
// No empty HARQs are available. Log this occurrence.
if (ue_cc.harqs.find_pending_dl_retx().has_value()) {
Expand All @@ -166,9 +178,21 @@ static bool can_allocate_dl_newtx(const slice_ue& ue_ref, ue_cell_index_t cell_i
return true;
}

static bool can_allocate_ul_newtx(const slice_ue& ue_ref, ue_cell_index_t cell_index, srslog::basic_logger& logger)
static bool can_allocate_ul_newtx(const slice_ue& ue_ref,
const ue_cell& ue_cc,
slot_point pdcch_slot,
slot_point pusch_slot,
srslog::basic_logger& logger)
{
const ue_cell& ue_cc = ue_ref.get_cell(cell_index);
srsran_assert(ue_cc.is_active() and not ue_cc.is_in_fallback_mode(),
"policy scheduler called for UE={} in fallback",
ue_cc.ue_index);

if (not ue_cc.is_pdcch_enabled(pdcch_slot) or not ue_cc.is_ul_enabled(pusch_slot)) {
// Either the PDCCH slot or PUSCH slots are not available.
return false;
}

if (not ue_cc.harqs.has_empty_ul_harqs()) {
// No empty HARQs are available. Log this occurrence.
if (ue_cc.harqs.find_pending_ul_retx().has_value()) {
Expand Down Expand Up @@ -287,18 +311,8 @@ static dl_alloc_result alloc_dl_ue_newtx(const slice_ue& u,
// Prioritize PCell over SCells.
for (unsigned i = 0; i != u.nof_cells(); ++i) {
const ue_cell& ue_cc = u.get_cell(to_ue_cell_index(i));
srsran_assert(ue_cc.is_active() and not ue_cc.is_in_fallback_mode(),
"policy scheduler called for UE={} in fallback",
ue_cc.ue_index);

if (res_grid.has_ue_dl_pdcch(ue_cc.cell_index, u.crnti()) or
not ue_cc.is_pdcch_enabled(res_grid.get_pdcch_slot(ue_cc.cell_index)) or
not ue_cc.is_pdsch_enabled(slice_candidate.get_slot_tx())) {
// UE is either already allocated for this slot (e.g. a reTx already took place) or it is not active.
return {alloc_status::skip_ue};
}

if (can_allocate_dl_newtx(u, to_ue_cell_index(i), logger)) {
if (can_allocate_dl_newtx(res_grid, ue_cc, slice_candidate.get_slot_tx(), logger)) {
ue_pdsch_grant grant{&u, ue_cc.cell_index, INVALID_HARQ_ID, u.pending_dl_newtx_bytes(), max_pdsch_rbs};
const dl_alloc_result result = pdsch_alloc.allocate_dl_grant(grant);
// If the allocation failed due to invalid parameters, we continue iteration.
Expand Down Expand Up @@ -372,17 +386,9 @@ static ul_alloc_result alloc_ul_ue_newtx(const slice_ue& u,
// Prioritize PCell over SCells.
for (unsigned i = 0; i != u.nof_cells(); ++i) {
const ue_cell& ue_cc = u.get_cell(to_ue_cell_index(i));
srsran_assert(ue_cc.is_active() and not ue_cc.is_in_fallback_mode(),
"policy scheduler called for UE={} in fallback",
ue_cc.ue_index);

if (not ue_cc.is_pdcch_enabled(res_grid.get_pdcch_slot(ue_cc.cell_index)) or
not ue_cc.is_ul_enabled(slice_candidate.get_slot_tx())) {
// Either the PDCCH slot or PUSCH slots are not available.
continue;
}

if (can_allocate_ul_newtx(u, to_ue_cell_index(i), logger)) {
if (can_allocate_ul_newtx(
u, ue_cc, res_grid.get_pdcch_slot(ue_cc.cell_index), slice_candidate.get_slot_tx(), logger)) {
ue_pusch_grant grant{&u, ue_cc.cell_index, INVALID_HARQ_ID, pending_newtx_bytes, max_grant_rbs};
const ul_alloc_result result = pusch_alloc.allocate_ul_grant(grant);
// If the allocation failed due to invalid parameters, we continue iteration.
Expand Down
1 change: 0 additions & 1 deletion lib/scheduler/policy/ue_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "../ue_context/ue.h"
#include "../ue_scheduling/ue_repository.h"
#include "../ue_scheduling/ue_scheduler.h"
#include "srsran/ran/slot_point.h"

namespace srsran {

Expand Down
3 changes: 2 additions & 1 deletion lib/scheduler/ue_context/ue_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ class ue_cell

const ue_link_adaptation_controller& link_adaptation_controller() const { return ue_mcs_calculator; }

ul_power_controller& get_ul_power_controller() { return ul_pwr_controller; }
ul_power_controller& get_ul_power_controller() { return ul_pwr_controller; }
const ul_power_controller& get_ul_power_controller() const { return ul_pwr_controller; }

/// \brief Returns an estimated DL rate in bytes per slot based on the given input parameters.
double get_estimated_dl_rate(const pdsch_config_params& pdsch_cfg, sch_mcs_index mcs, unsigned nof_prbs) const;
Expand Down
Loading

0 comments on commit 64d2b71

Please sign in to comment.