@@ -99,7 +99,6 @@ pucch_allocator_impl::pucch_allocator_impl(const cell_configuration& cell_cfg_,
9999 cell_cfg(cell_cfg_),
100100 max_pucch_grants_per_slot(max_pucchs_per_slot),
101101 max_ul_grants_per_slot(max_ul_grants_per_slot_),
102- garbage_collector(resource_manager),
103102 logger(srslog::fetch_basic_logger(" SCHED" ))
104103{
105104}
@@ -137,7 +136,7 @@ std::optional<unsigned> pucch_allocator_impl::alloc_common_pucch_harq_ack_ue(cel
137136 grants_ue_it != pucch_grants_slot.end () and grants_ue_it->pucch_grants .harq_resource .has_value ();
138137 const bool has_existing_common_grants = grants_ue_it != pucch_grants_slot.end () and grants_ue_it->has_common_pucch ;
139138 if (has_existing_ded_harq_grants or has_existing_common_grants) {
140- logger.debug (" tc-rnti={}: PUCCH common not allocated for slot={}. Cause: a PUCCH grant with HARQ-ACK bits "
139+ logger.debug (" tc-rnti={}: PUCCH common not allocated for slot={}. Cause: A PUCCH grant with HARQ-ACK bits "
141140 " already exists in the same slot" ,
142141 tcrnti,
143142 pucch_slot_alloc.slot );
@@ -264,7 +263,7 @@ std::optional<unsigned> pucch_allocator_impl::alloc_ded_pucch_harq_ack_ue(cell_r
264263 // Get the slot allocation grid considering the PDSCH delay (k0) and the PUCCH delay wrt PDSCH (k1).
265264 cell_slot_resource_allocator& pucch_slot_alloc = res_alloc[k0 + k1 + res_alloc.cfg .ntn_cs_koffset ];
266265
267- garbage_collector. reset ();
266+ resource_manager. reset_last_ue_allocation ();
268267
269268 slot_point sl_ack = pucch_slot_alloc.slot ;
270269
@@ -281,7 +280,7 @@ std::optional<unsigned> pucch_allocator_impl::alloc_ded_pucch_harq_ack_ue(cell_r
281280 std::optional<unsigned > pucch_res_ind =
282281 multiplex_and_allocate_pucch (pucch_slot_alloc, new_bits, *existing_grant_it, ue_cell_cfg);
283282 if (not pucch_res_ind) {
284- garbage_collector. release_resource (sl_ack, crnti, ue_cell_cfg);
283+ resource_manager. cancel_last_ue_allocations (sl_ack, crnti, ue_cell_cfg);
285284 }
286285 return pucch_res_ind;
287286 } else {
@@ -369,7 +368,7 @@ void pucch_allocator_impl::pucch_allocate_csi_opportunity(cell_slot_resource_all
369368{
370369 const slot_point sl_tx = pucch_slot_alloc.slot ;
371370
372- garbage_collector. reset ();
371+ resource_manager. reset_last_ue_allocation ();
373372
374373 // [Implementation-defined] We only allow a max number of PUCCH + PUSCH grants per slot.
375374 if (pucch_slot_alloc.result .ul .pucchs .size () >=
@@ -405,7 +404,7 @@ void pucch_allocator_impl::pucch_allocate_csi_opportunity(cell_slot_resource_all
405404 bits_for_uci.csi_part1_nof_bits = csi_part1_nof_bits;
406405 auto alloc_outcome = multiplex_and_allocate_pucch (pucch_slot_alloc, bits_for_uci, *existing_grant_it, ue_cell_cfg);
407406 if (not alloc_outcome.has_value ()) {
408- garbage_collector. release_resource (sl_tx, crnti, ue_cell_cfg);
407+ resource_manager. cancel_last_ue_allocations (sl_tx, crnti, ue_cell_cfg);
409408 }
410409}
411410
@@ -740,35 +739,6 @@ void existing_pucch_pdus_handler::update_harq_pdu_bits(unsigned harq_ack_bits
740739 }
741740}
742741
743- void pucch_allocator_impl::res_manager_garbage_collector::reset ()
744- {
745- harq_set_0 = false ;
746- harq_set_1 = false ;
747- csi = false ;
748- sr = false ;
749- }
750-
751- void pucch_allocator_impl::res_manager_garbage_collector::release_resource (slot_point slot_tx,
752- rnti_t crnti,
753- const ue_cell_configuration& ue_cell_cfg)
754- {
755- if (harq_set_0) {
756- res_manager.release_harq_f1_resource (
757- slot_tx, crnti, ue_cell_cfg.cfg_dedicated ().ul_config .value ().init_ul_bwp .pucch_cfg .value ());
758- }
759- if (harq_set_1) {
760- res_manager.release_harq_f2_resource (
761- slot_tx, crnti, ue_cell_cfg.cfg_dedicated ().ul_config .value ().init_ul_bwp .pucch_cfg .value ());
762- }
763- if (sr) {
764- res_manager.release_sr_resource (
765- slot_tx, crnti, ue_cell_cfg.cfg_dedicated ().ul_config .value ().init_ul_bwp .pucch_cfg .value ());
766- }
767- if (csi) {
768- res_manager.release_csi_resource (slot_tx, crnti, ue_cell_cfg);
769- }
770- }
771-
772742// //////////// Private functions //////////////
773743
774744// The function returns an available common PUCCH resource (i.e., not used by other UEs); it returns a null optional
@@ -1018,7 +988,7 @@ pucch_allocator_impl::find_common_and_ded_harq_res_available(cell_slot_resource_
1018988 // As per Section 9.2.1, TS 38.213, this is the max value of \f$\Delta_{PRI}\f$, which is a 3-bit unsigned.
1019989 const unsigned max_d_pri = 7 ;
1020990 for (unsigned d_pri = 0 ; d_pri != max_d_pri + 1 ; ++d_pri) {
1021- garbage_collector. reset ();
991+ resource_manager. reset_last_ue_allocation ();
1022992
1023993 // r_PUCCH, as per Section 9.2.1, TS 38.213.
1024994 const unsigned r_pucch = get_pucch_default_resource_index (start_cce_idx, nof_coreset_cces, d_pri);
@@ -1038,7 +1008,7 @@ pucch_allocator_impl::find_common_and_ded_harq_res_available(cell_slot_resource_
10381008 if (ded_resource == nullptr ) {
10391009 continue ;
10401010 }
1041- garbage_collector. harq_set_0 = true ;
1011+ resource_manager. set_new_resource_allocation (rnti, pucch_resource_usage::HARQ_F1) ;
10421012
10431013 // Add a current grant entry with the PUCCH resource indicator found above; this will force the function that
10441014 // multiplexes the resources to use the specific resource with the given PUCCH resource indicator (it could be
@@ -1060,7 +1030,7 @@ pucch_allocator_impl::find_common_and_ded_harq_res_available(cell_slot_resource_
10601030 pucch_res_ind = multiplex_and_allocate_pucch (pucch_alloc, bits_for_uci, existing_grants, ue_cell_cfg, true );
10611031
10621032 if (not pucch_res_ind.has_value ()) {
1063- garbage_collector. release_resource (pucch_alloc.slot , rnti, ue_cell_cfg);
1033+ resource_manager. cancel_last_ue_allocations (pucch_alloc.slot , rnti, ue_cell_cfg);
10641034 continue ;
10651035 }
10661036
@@ -1307,7 +1277,8 @@ void pucch_allocator_impl::remove_unsed_pucch_res(slot_point s
13071277
13081278 // This is a special case, in which the PUCCH from resource set 0 is first reserved, but later it is converted into a
13091279 // PUCCH from resource set 1 due to the multiplexing process.
1310- if (garbage_collector.harq_set_1 and garbage_collector.harq_set_0 ) {
1280+ if (resource_manager.is_resource_allocated (existing_pucchs.rnti , pucch_resource_usage::HARQ_F2) and
1281+ resource_manager.is_resource_allocated (existing_pucchs.rnti , pucch_resource_usage::HARQ_F1)) {
13111282 resource_manager.release_harq_f1_resource (
13121283 sl_tx, existing_pucchs.rnti , ue_cell_cfg.cfg_dedicated ().ul_config .value ().init_ul_bwp .pucch_cfg .value ());
13131284 }
@@ -1345,9 +1316,9 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
13451316 : resource_manager.reserve_next_f2_harq_res_available (sl_tx, ue_current_grants.rnti , pucch_cfg);
13461317 // Save the resources that have been generated; if at some point the allocation fails, we need to release them.
13471318 if (pucch_set_idx == pucch_res_set_idx::set_0) {
1348- garbage_collector. harq_set_0 = true ;
1319+ resource_manager. set_new_resource_allocation (ue_current_grants. rnti , pucch_resource_usage::HARQ_F1) ;
13491320 } else {
1350- garbage_collector. harq_set_1 = true ;
1321+ resource_manager. set_new_resource_allocation (ue_current_grants. rnti , pucch_resource_usage::HARQ_F2) ;
13511322 }
13521323 if (harq_resource.pucch_res == nullptr ) {
13531324 return std::nullopt ;
@@ -1377,7 +1348,7 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
13771348 const pucch_resource* sr_resource =
13781349 resource_manager.reserve_sr_res_available (sl_tx, ue_current_grants.rnti , pucch_cfg);
13791350 // Save the resources that have been generated; if at some point the allocation fails, we need to release them.
1380- garbage_collector. sr = true ;
1351+ resource_manager. set_new_resource_allocation (ue_current_grants. rnti , pucch_resource_usage::SR) ;
13811352 if (sr_resource == nullptr ) {
13821353 return std::nullopt ;
13831354 }
@@ -1404,7 +1375,7 @@ pucch_allocator_impl::get_pucch_res_pre_multiplexing(slot_point
14041375 const pucch_resource* csi_resource =
14051376 resource_manager.reserve_csi_resource (sl_tx, ue_current_grants.rnti , ue_cell_cfg);
14061377 // Save the resources that have been generated; if at some point the allocation fails, we need to release them.
1407- garbage_collector. csi = true ;
1378+ resource_manager. set_new_resource_allocation (ue_current_grants. rnti , pucch_resource_usage::CSI) ;
14081379 if (csi_resource == nullptr ) {
14091380 return std::nullopt ;
14101381 }
@@ -1477,7 +1448,7 @@ pucch_allocator_impl::merge_pucch_resources(span<const pucch_allocator_impl::puc
14771448 else if (preserve_res_indicator) {
14781449 const pucch_resource* pucch_res = resource_manager.reserve_f2_res_by_res_indicator (
14791450 slot_harq, crnti, r_harq.harq_id .pucch_res_ind , pucch_cfg);
1480- garbage_collector. harq_set_1 = true ;
1451+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::HARQ_F2) ;
14811452 if (pucch_res != nullptr ) {
14821453 return std::nullopt ;
14831454 }
@@ -1490,7 +1461,7 @@ pucch_allocator_impl::merge_pucch_resources(span<const pucch_allocator_impl::puc
14901461 else {
14911462 pucch_harq_resource_alloc_record res_alloc =
14921463 resource_manager.reserve_next_f2_harq_res_available (slot_harq, crnti, pucch_cfg);
1493- garbage_collector. harq_set_1 = true ;
1464+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::HARQ_F2) ;
14941465 if (res_alloc.pucch_res != nullptr ) {
14951466 return std::nullopt ;
14961467 }
@@ -1551,7 +1522,7 @@ pucch_allocator_impl::merge_pucch_resources(span<const pucch_allocator_impl::puc
15511522 else if (preserve_res_indicator) {
15521523 const pucch_resource* pucch_res =
15531524 resource_manager.reserve_f2_res_by_res_indicator (slot_harq, crnti, r_harq.harq_id .pucch_res_ind , pucch_cfg);
1554- garbage_collector. harq_set_1 = true ;
1525+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::HARQ_F2) ;
15551526 if (pucch_res == nullptr ) {
15561527 return std::nullopt ;
15571528 }
@@ -1564,7 +1535,7 @@ pucch_allocator_impl::merge_pucch_resources(span<const pucch_allocator_impl::puc
15641535 else {
15651536 pucch_harq_resource_alloc_record res_alloc =
15661537 resource_manager.reserve_next_f2_harq_res_available (slot_harq, crnti, pucch_cfg);
1567- garbage_collector. harq_set_1 = true ;
1538+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::HARQ_F2) ;
15681539 if (res_alloc.pucch_res == nullptr ) {
15691540 return std::nullopt ;
15701541 }
@@ -1624,7 +1595,7 @@ pucch_allocator_impl::merge_pucch_resources(span<const pucch_allocator_impl::puc
16241595 } else {
16251596 pucch_harq_resource_alloc_record res_alloc =
16261597 resource_manager.reserve_next_f2_harq_res_available (slot_harq, crnti, pucch_cfg);
1627- garbage_collector. harq_set_1 = true ;
1598+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::HARQ_F2) ;
16281599 if (res_alloc.pucch_res == nullptr ) {
16291600 return std::nullopt ;
16301601 }
@@ -1730,7 +1701,7 @@ pucch_allocator_impl::multiplex_resources(slot_point sl_tx,
17301701 resource_set_q.front ().bits .sr_bits != sr_nof_bits::no_sr) {
17311702 const pucch_resource* sr_res = resource_manager.reserve_sr_res_available (
17321703 sl_tx, crnti, ue_cell_cfg.cfg_dedicated ().ul_config .value ().init_ul_bwp .pucch_cfg .value ());
1733- garbage_collector. sr = true ;
1704+ resource_manager. set_new_resource_allocation (crnti, pucch_resource_usage::SR) ;
17341705 if (sr_res == nullptr ) {
17351706 logger.error (" This is not expected" );
17361707 }
0 commit comments