@@ -57,7 +57,8 @@ static std::optional<unsigned> compute_srs_bw_param(unsigned nof_ul_rbs)
5757// are placed at the center of the band.
5858static unsigned compute_freq_shift (unsigned c_srs, unsigned nof_ul_rbs)
5959{
60- // As per Section 6.4.1.4.3, the parameter \f$C_{SRS}\f$ = 0 provides the bandwidth of the SRS resources.
60+ // As per Section 6.4.1.4.3, the parameter \f$m_{SRS}\f$ = 0 is an index that, along with \f$C_{SRS}\f$, maps to the
61+ // bandwidth of the SRS resources.
6162 constexpr uint8_t b_srs_0 = 0 ;
6263 std::optional<srsran::srs_configuration> srs_params = srs_configuration_get (c_srs, b_srs_0);
6364 srsran_sanity_check (srs_params.has_value () and nof_ul_rbs >= srs_params.value ().m_srs ,
@@ -137,20 +138,22 @@ du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell
137138 cell.cell_srs_res_list = generate_cell_srs_list (cell.cell_cfg );
138139
139140 const auto srs_period_slots = static_cast <unsigned >(cell.cell_cfg .srs_cfg .srs_period .value ());
140- cell.slot_resource_cnt .reserve (srs_period_slots);
141+ // Reserve the size of the vector and set the SRS counter of each offset to 0.
142+ cell.slot_resource_cnt .assign (srs_period_slots, 0U );
141143 cell.srs_res_offset_free_list .reserve (du_srs_policy_max_ul_th::cell_context::max_nof_srs_res);
144+ cell.nof_res_per_symb_interval = static_cast <unsigned >(cell.cell_cfg .srs_cfg .tx_comb ) *
145+ static_cast <unsigned >(cell.cell_cfg .srs_cfg .cyclic_shift_reuse_factor ) *
146+ static_cast <unsigned >(cell.cell_cfg .srs_cfg .sequence_id_reuse_factor );
142147
143148 for (unsigned offset = 0 ; offset != srs_period_slots; ++offset) {
144149 // We don't generate more than the maximum number of SRS resources per cell.
145150 if (cell.srs_res_offset_free_list .size () >= du_srs_policy_max_ul_th::cell_context::max_nof_srs_res) {
146151 break ;
147152 }
148153
149- unsigned offset_res_cnt = 0U ;
150154 // Verify whether the offset maps to a partially- or fully-UL slot.
151155 if (cell_cfg_list_[0 ].tdd_ul_dl_cfg_common .has_value () and
152156 not is_ul_slot (offset, cell_cfg_list_[0 ].tdd_ul_dl_cfg_common .value ())) {
153- cell.slot_resource_cnt .emplace_back (0U , offset_res_cnt);
154157 continue ;
155158 }
156159
@@ -164,6 +167,8 @@ du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell
164167 if (is_partually_ul_slot (offset, cell_cfg_list_[0 ].tdd_ul_dl_cfg_common .value ())) {
165168 const unsigned slot_index =
166169 offset % (NOF_SUBFRAMES_PER_FRAME * get_nof_slots_per_subframe (tdd_cfg.ref_scs ));
170+ // As per Section 6.4.1.4.1, TS 38.211, the SRS resources can only be placed in the last 6 symbols of the
171+ // slot.
167172 static constexpr unsigned max_srs_symbols = 6U ;
168173 const unsigned nof_ul_symbols_for_srs =
169174 std::min (srsran::get_active_tdd_ul_symbols (tdd_cfg, slot_index, cyclic_prefix::NORMAL).length (),
@@ -185,9 +190,7 @@ du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell
185190 }
186191 }
187192 cell.srs_res_offset_free_list .emplace_back (res.cell_res_id , offset);
188- ++offset_res_cnt;
189193 }
190- cell.slot_resource_cnt .emplace_back (0U , offset_res_cnt);
191194 }
192195 }
193196}
@@ -208,8 +211,8 @@ bool du_srs_policy_max_ul_th::alloc_resources(cell_group_config& cell_grp_cfg)
208211 return true ;
209212 }
210213
211- // The UE SRS configuration is taken from a base configuration, saved in the GNB. The details that are
212- // UE specific will be added later on in this function.
214+ // The UE SRS configuration is taken from a base configuration, saved in the GNB. The UE specific parameters will be
215+ // added later on in this function.
213216 cell_grp_cfg.cells [0 ].serv_cell_cfg .ul_config ->init_ul_bwp .srs_cfg .emplace (
214217 cells[cell_grp_cfg.cells [0 ].serv_cell_cfg .cell_index ].default_srs_cfg );
215218 srs_config& ue_srs_cfg = cell_grp_cfg.cells [0 ].serv_cell_cfg .ul_config ->init_ul_bwp .srs_cfg .value ();
@@ -222,7 +225,7 @@ bool du_srs_policy_max_ul_th::alloc_resources(cell_group_config& cell_grp_cfg)
222225 return false ;
223226 }
224227
225- // Find the best resource ID and offset for this UE.
228+ // Find the best resource ID and offset for this UE, according to the class policy .
226229 auto srs_res_id_offset = cells[0 ].find_optimal_ue_srs_resource ();
227230
228231 if (srs_res_id_offset == free_srs_list.end ()) {
@@ -278,22 +281,23 @@ bool du_srs_policy_max_ul_th::alloc_resources(cell_group_config& cell_grp_cfg)
278281 // Remove the allocated SRS resource from the free list.
279282 free_srs_list.erase (srs_res_id_offset);
280283
281- // Update the used_not_full slot vector .
282- ++cells[0 ].slot_resource_cnt [srs_offset]. first ;
284+ // Update the SRS resource per slot counter .
285+ ++cells[0 ].slot_resource_cnt [srs_offset];
283286
284287 return true ;
285288}
286289
287290std::vector<std::pair<unsigned , unsigned >>::const_iterator
288291du_srs_policy_max_ul_th::cell_context::find_optimal_ue_srs_resource ()
289292{
290- // The weights assigned here can be set to any value, as long as:
293+ // The weights assigned here can be set to arbitrarily value, as long as:
291294 // - symbol_weight_base is greater than 0;
292- // - reuse_slot_discount less than symbol_weight_base;
293- // - max_weight is > symbol_weight_base * (srs_builder_params::max_nof_symbols /
294- // srs_builder_params::nof_symbols).
295+ // - reuse_slot_discount is less than symbol_weight_base;
296+ // - max_weight > symbol_weight_base * (srs_builder_params::max_nof_symbols / srs_builder_params::nof_symbols).
295297 static constexpr unsigned max_weight = 100U ;
296298 static constexpr unsigned symbol_weight_base = 10U ;
299+ // We give a discount to the symbol weight if the offset is already used but not full.
300+ static const unsigned partial_symb_interval_discount = symbol_weight_base / 2U ;
297301
298302 const auto weight_function = [&](const pair_res_id_offset& srs_res) {
299303 if (cell_cfg.tdd_ul_dl_cfg_common .has_value () and
@@ -308,15 +312,16 @@ du_srs_policy_max_ul_th::cell_context::find_optimal_ue_srs_resource()
308312 return max_weight;
309313 }
310314
311- // Give priority to the last symbols within a slot. This reduces the space used for the SRS in a slot.
315+ // Give priority to the last symbol intervals within a slot. This reduces the space used for the SRS in a slot.
312316 const unsigned symb_weight =
313317 symbol_weight_base *
314318 ((NOF_OFDM_SYM_PER_SLOT_NORMAL_CP - srs_res_cfg_it->symbols .start ()) / srs_res_cfg_it->symbols .length ());
315319
316320 // We consider a discount if the offset is already used but not full; this way, we give an incentive
317321 // to the SRS resources not to be allocated on a new slot, to avoid taking PUSCH symbols on a new
318322 // slot.
319- const unsigned reuse_slot_discount = offset_used_not_full (srs_res.second ) ? symbol_weight_base / 2U : 0U ;
323+ const unsigned reuse_slot_discount =
324+ offset_interval_used_not_full (srs_res.second ) ? partial_symb_interval_discount : 0U ;
320325
321326 return symb_weight - reuse_slot_discount;
322327 };
@@ -346,11 +351,11 @@ void du_srs_policy_max_ul_th::dealloc_resources(cell_group_config& cell_grp_cfg)
346351 free_srs_list.emplace_back (srs_res.id .cell_res_id , offset_to_deallocate);
347352
348353 // Update the used_not_full slot vector.
349- srsran_assert (cells[0 ].slot_resource_cnt [offset_to_deallocate]. first != 0 , " The offset is expected to be non-zero" );
350- --cells[0 ].slot_resource_cnt [offset_to_deallocate]. first ;
354+ srsran_assert (cells[0 ].slot_resource_cnt [offset_to_deallocate] != 0 , " The offset is expected to be non-zero" );
355+ --cells[0 ].slot_resource_cnt [offset_to_deallocate];
351356 }
352357
353358 // Reset the SRS configuration in this UE. This makes sure the DU will exit this function immediately when it gets
354- // call again for the same UE (upon destructor's call).
359+ // called again for the same UE (upon destructor's call).
355360 cell_grp_cfg.cells [0 ].serv_cell_cfg .ul_config ->init_ul_bwp .srs_cfg .reset ();
356361}
0 commit comments