@@ -99,7 +99,7 @@ uci_allocator_impl::slot_alloc_list::ue_uci* uci_allocator_impl::get_uci_alloc(s
9999{
100100 auto & ucis = uci_alloc_grid[uci_slot.to_uint ()].ucis ;
101101 auto * it = std::find_if (ucis.begin (), ucis.end (), [rnti](const auto & uci) { return uci.rnti == rnti; });
102- return it != ucis.end () ? &* it : nullptr ;
102+ return it != ucis.end () ? it : nullptr ;
103103}
104104
105105unsigned uci_allocator_impl::get_min_pdsch_to_ack_slot_distance (slot_point pdsch_slot,
@@ -108,7 +108,7 @@ unsigned uci_allocator_impl::get_min_pdsch_to_ack_slot_distance(slot_point pdsch
108108 unsigned max_k1)
109109{
110110 srsran_assert (min_k1 <= max_k1, " Minimum k1 value must be greater than maximum k1 value" );
111- for (int sl_inc = max_k1; sl_inc >= ( int ) min_k1; --sl_inc) {
111+ for (int sl_inc = max_k1; sl_inc >= static_cast < int >( min_k1) ; --sl_inc) {
112112 const slot_point uci_slot = pdsch_slot + sl_inc;
113113 if (get_uci_alloc (uci_slot, rnti) != nullptr ) {
114114 return sl_inc;
@@ -127,15 +127,9 @@ uci_allocator_impl::alloc_uci_harq_ue_helper(cell_resource_allocator& res_al
127127{
128128 cell_slot_resource_allocator& slot_alloc = res_alloc[k0 + k1 + res_alloc.cfg .ntn_cs_koffset ];
129129
130- // Get existing PUSCH grant, if any, for a given UE's RNTI.
131- auto & puschs = slot_alloc.result .ul .puschs ;
132- ul_sched_info* existing_pusch = std::find_if (
133- puschs.begin (), puschs.end (), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg .rnti == crnti; });
134-
135- const bool has_pusch_grants = existing_pusch != slot_alloc.result .ul .puschs .end ();
136-
137- // [Implementation-defined] Skip allocation of UCI if any existing PUSCH grants.
138- if (has_pusch_grants) {
130+ // [Implementation-defined] Skip allocation of UCI if any existing PUSCH grants; this to avoid that the fallback
131+ // scheduler calling this function allocates a PUCCH that can potentially collide with an existing PUSCH.
132+ if (not slot_alloc.result .ul .puschs .empty ()) {
139133 return {};
140134 }
141135
@@ -158,9 +152,8 @@ uci_allocator_impl::alloc_uci_harq_ue_helper(cell_resource_allocator& res_al
158152 else {
159153 pucch_res_indicator = pucch_alloc.alloc_ded_pucch_harq_ack_ue (res_alloc, crnti, ue_cell_cfg, k0, k1);
160154 }
161- return pucch_res_indicator.has_value ()
162- ? std::optional<uci_allocation>{uci_allocation{.pucch_res_indicator = pucch_res_indicator}}
163- : std::nullopt ;
155+ return pucch_res_indicator.has_value () ? std::optional{uci_allocation{.pucch_res_indicator = pucch_res_indicator}}
156+ : std::nullopt ;
164157}
165158
166159// ////////// Public functions ////////////
@@ -188,7 +181,7 @@ std::optional<uci_allocation> uci_allocator_impl::alloc_uci_harq_ue(cell_resourc
188181 // [Implementation-defined] We restrict the number of HARQ bits per PUCCH that are expected to carry CSI reporting to
189182 // 2 , until the PUCCH allocator supports more than this.
190183 // TODO: remove this, as with the new refactor we are not constrained by this anymore.
191- static const uint8_t max_harq_bits_per_uci = 2U ;
184+ static constexpr uint8_t max_harq_bits_per_uci = 2U ;
192185
193186 const slot_point pdsch_slot = res_alloc[k0].slot ;
194187 const cell_configuration& cell_cfg = ue_cell_cfg.cell_cfg_common ;
@@ -254,7 +247,7 @@ std::optional<uci_allocation> uci_allocator_impl::alloc_uci_harq_ue(cell_resourc
254247 continue ;
255248 }
256249
257- // Step 2: Try to allocate UCI HARQ ACK for UE, either on PUSCH or PUCCH .
250+ // Step 2: Try to allocate UCI HARQ ACK for UE.
258251 std::optional<uci_allocation> uci_output =
259252 alloc_uci_harq_ue_helper (res_alloc, crnti, ue_cell_cfg, k0, k1_candidate, fallback_dci_info);
260253
@@ -313,7 +306,7 @@ void uci_allocator_impl::uci_allocate_sr_opportunity(cell_slot_resource_allocato
313306 // Retrieve the scheduling results for slot = k0 + k1;
314307 auto & puschs = slot_alloc.result .ul .puschs ;
315308 ul_sched_info* existing_pusch = std::find_if (
316- puschs.begin (), puschs.end (), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg .rnti == crnti; });
309+ puschs.begin (), puschs.end (), [crnti](const ul_sched_info& pusch) { return pusch.pusch_cfg .rnti == crnti; });
317310
318311 const bool has_pusch_grants =
319312 not slot_alloc.result .ul .puschs .empty () and existing_pusch != slot_alloc.result .ul .puschs .end ();
@@ -333,7 +326,7 @@ void uci_allocator_impl::uci_allocate_csi_opportunity(cell_slot_resource_allocat
333326{
334327 auto & puschs = slot_alloc.result .ul .puschs ;
335328 ul_sched_info* existing_pusch = std::find_if (
336- puschs.begin (), puschs.end (), [crnti](ul_sched_info& pusch) { return pusch.pusch_cfg .rnti == crnti; });
329+ puschs.begin (), puschs.end (), [crnti](const ul_sched_info& pusch) { return pusch.pusch_cfg .rnti == crnti; });
337330
338331 const bool has_pusch_grants =
339332 not slot_alloc.result .ul .puschs .empty () and existing_pusch != slot_alloc.result .ul .puschs .end ();
0 commit comments