@@ -141,9 +141,21 @@ static unsigned compute_max_nof_rbs_per_ue_per_slot(const slice_ue_repository&
141141 return (std::min (bwp_crb_limits.length (), slice_max_rbs) / nof_ues_to_be_scheduled_per_slot);
142142}
143143
144- static bool can_allocate_dl_newtx (const slice_ue& ue_ref, ue_cell_index_t cell_index, srslog::basic_logger& logger)
144+ static bool can_allocate_dl_newtx (const ue_resource_grid_view& res_grid,
145+ const ue_cell& ue_cc,
146+ slot_point pdsch_slot,
147+ srslog::basic_logger& logger)
145148{
146- const ue_cell& ue_cc = ue_ref.get_cell (cell_index);
149+ srsran_assert (ue_cc.is_active () and not ue_cc.is_in_fallback_mode (),
150+ " policy scheduler called for UE={} in fallback" ,
151+ ue_cc.ue_index );
152+
153+ if (res_grid.has_ue_dl_pdcch (ue_cc.cell_index , ue_cc.rnti ()) or
154+ not ue_cc.is_pdcch_enabled (res_grid.get_pdcch_slot (ue_cc.cell_index )) or not ue_cc.is_pdsch_enabled (pdsch_slot)) {
155+ // UE is either already allocated for this slot (e.g. a reTx already took place) or it is not active.
156+ return false ;
157+ }
158+
147159 if (not ue_cc.harqs .has_empty_dl_harqs ()) {
148160 // No empty HARQs are available. Log this occurrence.
149161 if (ue_cc.harqs .find_pending_dl_retx ().has_value ()) {
@@ -166,9 +178,21 @@ static bool can_allocate_dl_newtx(const slice_ue& ue_ref, ue_cell_index_t cell_i
166178 return true ;
167179}
168180
169- static bool can_allocate_ul_newtx (const slice_ue& ue_ref, ue_cell_index_t cell_index, srslog::basic_logger& logger)
181+ static bool can_allocate_ul_newtx (const slice_ue& ue_ref,
182+ const ue_cell& ue_cc,
183+ slot_point pdcch_slot,
184+ slot_point pusch_slot,
185+ srslog::basic_logger& logger)
170186{
171- const ue_cell& ue_cc = ue_ref.get_cell (cell_index);
187+ srsran_assert (ue_cc.is_active () and not ue_cc.is_in_fallback_mode (),
188+ " policy scheduler called for UE={} in fallback" ,
189+ ue_cc.ue_index );
190+
191+ if (not ue_cc.is_pdcch_enabled (pdcch_slot) or not ue_cc.is_ul_enabled (pusch_slot)) {
192+ // Either the PDCCH slot or PUSCH slots are not available.
193+ return false ;
194+ }
195+
172196 if (not ue_cc.harqs .has_empty_ul_harqs ()) {
173197 // No empty HARQs are available. Log this occurrence.
174198 if (ue_cc.harqs .find_pending_ul_retx ().has_value ()) {
@@ -287,18 +311,8 @@ static dl_alloc_result alloc_dl_ue_newtx(const slice_ue& u,
287311 // Prioritize PCell over SCells.
288312 for (unsigned i = 0 ; i != u.nof_cells (); ++i) {
289313 const ue_cell& ue_cc = u.get_cell (to_ue_cell_index (i));
290- srsran_assert (ue_cc.is_active () and not ue_cc.is_in_fallback_mode (),
291- " policy scheduler called for UE={} in fallback" ,
292- ue_cc.ue_index );
293-
294- if (res_grid.has_ue_dl_pdcch (ue_cc.cell_index , u.crnti ()) or
295- not ue_cc.is_pdcch_enabled (res_grid.get_pdcch_slot (ue_cc.cell_index )) or
296- not ue_cc.is_pdsch_enabled (slice_candidate.get_slot_tx ())) {
297- // UE is either already allocated for this slot (e.g. a reTx already took place) or it is not active.
298- return {alloc_status::skip_ue};
299- }
300314
301- if (can_allocate_dl_newtx (u, to_ue_cell_index (i ), logger)) {
315+ if (can_allocate_dl_newtx (res_grid, ue_cc, slice_candidate. get_slot_tx ( ), logger)) {
302316 ue_pdsch_grant grant{&u, ue_cc.cell_index , INVALID_HARQ_ID, u.pending_dl_newtx_bytes (), max_pdsch_rbs};
303317 const dl_alloc_result result = pdsch_alloc.allocate_dl_grant (grant);
304318 // If the allocation failed due to invalid parameters, we continue iteration.
@@ -372,17 +386,9 @@ static ul_alloc_result alloc_ul_ue_newtx(const slice_ue& u,
372386 // Prioritize PCell over SCells.
373387 for (unsigned i = 0 ; i != u.nof_cells (); ++i) {
374388 const ue_cell& ue_cc = u.get_cell (to_ue_cell_index (i));
375- srsran_assert (ue_cc.is_active () and not ue_cc.is_in_fallback_mode (),
376- " policy scheduler called for UE={} in fallback" ,
377- ue_cc.ue_index );
378-
379- if (not ue_cc.is_pdcch_enabled (res_grid.get_pdcch_slot (ue_cc.cell_index )) or
380- not ue_cc.is_ul_enabled (slice_candidate.get_slot_tx ())) {
381- // Either the PDCCH slot or PUSCH slots are not available.
382- continue ;
383- }
384389
385- if (can_allocate_ul_newtx (u, to_ue_cell_index (i), logger)) {
390+ if (can_allocate_ul_newtx (
391+ u, ue_cc, res_grid.get_pdcch_slot (ue_cc.cell_index ), slice_candidate.get_slot_tx (), logger)) {
386392 ue_pusch_grant grant{&u, ue_cc.cell_index , INVALID_HARQ_ID, pending_newtx_bytes, max_grant_rbs};
387393 const ul_alloc_result result = pusch_alloc.allocate_ul_grant (grant);
388394 // If the allocation failed due to invalid parameters, we continue iteration.
0 commit comments