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