Skip to content

Commit e48e270

Browse files
committed
sched: fix fallback scheduler not looking at whole spectrum when allocating PDSCH
1 parent a23817f commit e48e270

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lib/scheduler/support/rb_helper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ inline crb_interval vrb_to_crb_ul_non_interleaved(vrb_interval vrbs, unsigned bw
5151
return crb_interval{vrbs.start() + bwp_crb_start, vrbs.stop() + bwp_crb_start};
5252
}
5353

54+
namespace detail {
55+
5456
/// \brief Finds the next contiguous range of RBs whose respective bit in provided RB bitmap is set to zero.
5557
///
5658
/// \param used_rb_bitmap Bitmap of RBs, where 1's represent used RBs and 0's empty RBs.
5759
/// \param search_limits Minimum and maximum RB indices where the search is carried out.
5860
/// \return An interval of contiguous RBs where the respective bits are set to zero. If no interval was found, an empty
5961
/// interval is returned.
62+
/// Note: This function should not be used directly. Use \c find_empty_interval_of_length instead.
6063
template <typename Tag>
6164
interval<unsigned, false, Tag> find_next_empty_interval(const bounded_bitset<MAX_NOF_PRBS, false, Tag>& used_rb_bitmap,
6265
interval<unsigned, false, Tag> search_limits = {0,
@@ -74,6 +77,8 @@ interval<unsigned, false, Tag> find_next_empty_interval(const bounded_bitset<MAX
7477
return {};
7578
}
7679

80+
} // namespace detail
81+
7782
/// \brief Finds a range of contiguous RBs, whose value in the provided RB bitmap is set to zero. The returned range
7883
/// length should be at most "nof_rbs" RBs. If no range with length "nof_rbs" is found, the longest valid range of
7984
/// RBs set to zero in "used_rb_bitmap" is returned.
@@ -94,7 +99,7 @@ find_empty_interval_of_length(const bounded_bitset<MAX_NOF_PRBS, false, Tag>& us
9499

95100
interval<unsigned, false, Tag> max_interv;
96101
do {
97-
interval<unsigned, false, Tag> interv = find_next_empty_interval(used_rb_bitmap, search_limits);
102+
interval<unsigned, false, Tag> interv = detail::find_next_empty_interval(used_rb_bitmap, search_limits);
98103
if (interv.empty()) {
99104
break;
100105
}

lib/scheduler/ue_scheduling/ue_fallback_scheduler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "../support/prbs_calculator.h"
2020
#include "../support/pusch/pusch_td_resource_indices.h"
2121
#include "../uci_scheduling/uci_allocator.h"
22+
#include "srsran/ran/resource_block.h"
2223
#include "srsran/ran/sch/tbs_calculator.h"
2324
#include "srsran/ran/transform_precoding/transform_precoding_helpers.h"
2425
#include "srsran/srslog/srslog.h"
@@ -552,7 +553,8 @@ ue_fallback_scheduler::alloc_grant(ue& u,
552553
crb_bitmap used_crbs =
553554
pdsch_alloc.dl_res_grid.used_crbs(initial_active_dl_bwp.scs, cset0_crbs_lim, pdsch_cfg.symbols);
554555

555-
crb_interval unused_crbs = rb_helper::find_next_empty_interval(used_crbs, cset0_crbs_lim);
556+
// Find the biggest CRB interval available.
557+
crb_interval unused_crbs = rb_helper::find_empty_interval_of_length(used_crbs, MAX_NOF_PRBS, cset0_crbs_lim);
556558
if (unused_crbs.empty()) {
557559
logger.debug("rnti={}: Postponed PDU scheduling for slot={}. Cause: No space in PDSCH.", u.crnti, pdsch_alloc.slot);
558560
// If there is no free PRBs left on this slot for this UE, then this slot should be avoided by the other UEs too.
@@ -575,7 +577,6 @@ ue_fallback_scheduler::alloc_grant(ue& u,
575577
return {};
576578
}
577579
ue_grant_crbs = {unused_crbs.start(), unused_crbs.start() + prbs_tbs.nof_prbs};
578-
579580
} else {
580581
const unsigned only_conres_bytes = u.pending_conres_ce_bytes();
581582
const unsigned only_srb0_bytes = u.pending_dl_newtx_bytes(LCID_SRB0);
@@ -584,8 +585,7 @@ ue_fallback_scheduler::alloc_grant(ue& u,
584585
srsran_assert(pending_bytes > 0, "Unexpected number of pending bytes");
585586
// There must be space for ConRes CE, if it is pending. If only SRB0 is pending (no ConRes), there must be space
586587
// for it, as the SRB0 cannot be segmented.
587-
const unsigned min_pending_bytes =
588-
only_conres_bytes > 0 ? only_conres_bytes : (only_srb0_bytes > 0 ? only_srb0_bytes : 0);
588+
const unsigned min_pending_bytes = only_conres_bytes > 0 ? only_conres_bytes : only_srb0_bytes;
589589

590590
std::optional<sch_mcs_index> fixed_mcs;
591591
if (only_srb1_bytes > 0) {
@@ -1076,7 +1076,7 @@ ue_fallback_scheduler::schedule_ul_srb(ue&
10761076
const bool is_retx = h_ul_retx.has_value();
10771077

10781078
// Search for empty HARQ.
1079-
if (not h_ul_retx.has_value() and not ue_pcell.harqs.has_empty_ul_harqs()) {
1079+
if (not is_retx and not ue_pcell.harqs.has_empty_ul_harqs()) {
10801080
logger.debug(
10811081
"ue={} rnti={} PUSCH allocation skipped. Cause: no HARQ available", fmt::underlying(u.ue_index), u.crnti);
10821082
return ul_srb_sched_outcome::next_ue;

0 commit comments

Comments
 (0)