@@ -1068,9 +1068,6 @@ pucch_harq_ack_grant pucch_allocator_impl::update_format2_grant(pucch_info&
10681068 sr_nof_bits sr_bits_increment,
10691069 unsigned csi_part1_bits_increment)
10701070{
1071- // TODO replace this with value from config.
1072- const unsigned PUCCH_FORMAT2_RES_SET_IDX = 1 ;
1073-
10741071 // Retrieving the PUCCH resource configuration depends on whether existing grant is for CSI.
10751072 // If so: (i) the resource indicator is meaningless; (ii) the PUCCH resource configuration is the CSI specific one.
10761073 // If not: (i) the resource indicator is needed; (ii) the PUCCH resource configuration is retrieved from the resource
@@ -1082,29 +1079,23 @@ pucch_harq_ack_grant pucch_allocator_impl::update_format2_grant(pucch_info&
10821079 srsran_sanity_check (not (current_csi_part1_bits > 0 and current_harq_ack_bits == 0 and harq_ack_bits_increment > 0 ),
10831080 " PUCCH resource CSI cannot be converted into HARQ-ACK through this function." );
10841081
1085- const int res_indicator = current_csi_part1_bits > 0 and current_harq_ack_bits == 0
1086- ? 0
1087- : resource_manager. fetch_f2_pucch_res_indic (
1088- sl_tx,
1089- existing_f2_grant. crnti ,
1090- ue_cell_cfg. cfg_dedicated (). ul_config . value (). init_ul_bwp . pucch_cfg . value ());
1091- srsran_sanity_check (res_indicator >= 0 ,
1092- " The resource indicator for the allocated PUCCH Format 2 grant is expected to be non-negative " );
1082+ const bool use_pucch_f2_csi_res = current_csi_part1_bits > 0 and current_harq_ack_bits == 0 ;
1083+
1084+ const pucch_harq_resource_alloc_record pucch_f2_harq_info =
1085+ use_pucch_f2_csi_res ? pucch_harq_resource_alloc_record{. pucch_res = nullptr }
1086+ : resource_manager. fetch_specific_f2_harq_resource (
1087+ sl_tx,
1088+ existing_f2_grant. crnti ,
1089+ ue_cell_cfg. cfg_dedicated (). ul_config . value (). init_ul_bwp . pucch_cfg . value () );
10931090
10941091 const pucch_resource* res_cfg =
1095- current_csi_part1_bits > 0 and current_harq_ack_bits == 0
1096- ? resource_manager.fetch_csi_pucch_res_config (sl_tx, existing_f2_grant.crnti , ue_cell_cfg)
1097- : &ue_cell_cfg.cfg_dedicated ()
1098- .ul_config .value ()
1099- .init_ul_bwp .pucch_cfg .value ()
1100- .pucch_res_list [ue_cell_cfg.cfg_dedicated ()
1101- .ul_config .value ()
1102- .init_ul_bwp .pucch_cfg .value ()
1103- .pucch_res_set [PUCCH_FORMAT2_RES_SET_IDX]
1104- .pucch_res_id_list [static_cast <unsigned >(res_indicator)]];
1105-
1106- srsran_sanity_check (res_cfg != nullptr ,
1107- " PUCCH resource previously allocated for UCI not found in the PUCCH resource manager." );
1092+ use_pucch_f2_csi_res ? resource_manager.fetch_csi_pucch_res_config (sl_tx, existing_f2_grant.crnti , ue_cell_cfg)
1093+ : pucch_f2_harq_info.pucch_res ;
1094+
1095+ if (res_cfg == nullptr ) {
1096+ srsran_assertion_failure (" PUCCH resource previously allocated for UCI not found in the PUCCH resource manager." );
1097+ return pucch_harq_ack_grant{.pucch_res_indicator = 0 , .pucch_pdu = nullptr };
1098+ }
11081099
11091100 // Check if the number of PRBs is sufficient for the number of bits to be acked.
11101101 const float max_pucch_code_rate = to_max_code_rate_float (ue_cell_cfg.cfg_dedicated ()
@@ -1142,6 +1133,7 @@ pucch_harq_ack_grant pucch_allocator_impl::update_format2_grant(pucch_info&
11421133 }
11431134
11441135 logger.debug (" ue={:#x}'s UCI mltplxd on existing PUCCH F2 for slot={}" , existing_f2_grant.crnti , sl_tx);
1136+ const unsigned res_indicator = use_pucch_f2_csi_res ? 0U : pucch_f2_harq_info.pucch_res_indicator ;
11451137 return pucch_harq_ack_grant{.pucch_res_indicator = static_cast <unsigned >(res_indicator),
11461138 .pucch_pdu = &existing_f2_grant};
11471139}
0 commit comments