Skip to content

Commit afc429a

Browse files
committed
du: move du srs res mng unittest to separate file
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent cb18636 commit afc429a

File tree

6 files changed

+634
-14
lines changed

6 files changed

+634
-14
lines changed

lib/du/du_high/du_manager/ran_resource_management/du_ran_resource_manager_impl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ du_ue_ran_resource_updater_impl::update(du_cell_index_t pc
3838

3939
///////////////////////////
4040

41-
static void initialize_serv_cell_cfg(serving_cell_config& serv_cell_cfg)
41+
// Helper that resets the PUCCH and SRS configurations in the serving cell configuration.
42+
static void reset_serv_cell_cfg(serving_cell_config& serv_cell_cfg)
4243
{
4344
srsran_assert(serv_cell_cfg.ul_config.has_value() and
4445
serv_cell_cfg.ul_config.value().init_ul_bwp.pucch_cfg.has_value() and
@@ -63,7 +64,7 @@ du_ran_resource_manager_impl::du_ran_resource_manager_impl(span<const du_cell_co
6364
test_cfg(test_cfg_),
6465
pucch_res_mng(cell_cfg_list, scheduler_cfg.ue.max_pucchs_per_slot),
6566
bearer_res_mng(srb_config, qos_config, logger),
66-
srs_res_mng(std::make_unique<du_srs_policy_max_ul_th>(cell_cfg_list))
67+
srs_res_mng(std::make_unique<du_srs_policy_max_ul_rate>(cell_cfg_list))
6768
{
6869
}
6970

@@ -180,7 +181,7 @@ error_type<std::string> du_ran_resource_manager_impl::allocate_cell_resources(du
180181

181182
// Start with removing PUCCH and SRS configurations. This step simplifies the handling of the allocation failure
182183
// path.
183-
initialize_serv_cell_cfg(ue_res.cell_group.cells[0].serv_cell_cfg);
184+
reset_serv_cell_cfg(ue_res.cell_group.cells[0].serv_cell_cfg);
184185

185186
if (not srs_res_mng->alloc_resources(ue_res.cell_group)) {
186187
// Deallocate dedicated Search Spaces.

lib/du/du_high/du_manager/ran_resource_management/du_srs_resource_manager.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ static srs_config build_default_srs_cfg(const du_cell_config& default_cell_cfg)
114114
return srs_cfg;
115115
}
116116

117-
du_srs_policy_max_ul_th::cell_context::cell_context(const du_cell_config& cfg) :
117+
du_srs_policy_max_ul_rate::cell_context::cell_context(const du_cell_config& cfg) :
118118
cell_cfg(cfg), default_srs_cfg(build_default_srs_cfg(cfg)){};
119119

120-
du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell_cfg_list_) :
120+
du_srs_policy_max_ul_rate::du_srs_policy_max_ul_rate(span<const du_cell_config> cell_cfg_list_) :
121121
cells(cell_cfg_list_.begin(), cell_cfg_list_.end())
122122
{
123123
for (auto& cell : cells) {
@@ -140,14 +140,14 @@ du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell
140140
const auto srs_period_slots = static_cast<unsigned>(cell.cell_cfg.srs_cfg.srs_period.value());
141141
// Reserve the size of the vector and set the SRS counter of each offset to 0.
142142
cell.slot_resource_cnt.assign(srs_period_slots, 0U);
143-
cell.srs_res_offset_free_list.reserve(du_srs_policy_max_ul_th::cell_context::max_nof_srs_res);
143+
cell.srs_res_offset_free_list.reserve(du_srs_policy_max_ul_rate::cell_context::max_nof_srs_res);
144144
cell.nof_res_per_symb_interval = static_cast<unsigned>(cell.cell_cfg.srs_cfg.tx_comb) *
145145
static_cast<unsigned>(cell.cell_cfg.srs_cfg.cyclic_shift_reuse_factor) *
146146
static_cast<unsigned>(cell.cell_cfg.srs_cfg.sequence_id_reuse_factor);
147147

148148
for (unsigned offset = 0; offset != srs_period_slots; ++offset) {
149149
// We don't generate more than the maximum number of SRS resources per cell.
150-
if (cell.srs_res_offset_free_list.size() >= du_srs_policy_max_ul_th::cell_context::max_nof_srs_res) {
150+
if (cell.srs_res_offset_free_list.size() >= du_srs_policy_max_ul_rate::cell_context::max_nof_srs_res) {
151151
break;
152152
}
153153

@@ -195,7 +195,7 @@ du_srs_policy_max_ul_th::du_srs_policy_max_ul_th(span<const du_cell_config> cell
195195
}
196196
}
197197

198-
bool du_srs_policy_max_ul_th::alloc_resources(cell_group_config& cell_grp_cfg)
198+
bool du_srs_policy_max_ul_rate::alloc_resources(cell_group_config& cell_grp_cfg)
199199
{
200200
// TODO: Adapt this to the case of UEs with multiple cells configs.
201201
srsran_assert(
@@ -288,7 +288,7 @@ bool du_srs_policy_max_ul_th::alloc_resources(cell_group_config& cell_grp_cfg)
288288
}
289289

290290
std::vector<std::pair<unsigned, unsigned>>::const_iterator
291-
du_srs_policy_max_ul_th::cell_context::find_optimal_ue_srs_resource()
291+
du_srs_policy_max_ul_rate::cell_context::find_optimal_ue_srs_resource()
292292
{
293293
// The weights assigned here can be set to arbitrarily value, as long as:
294294
// - symbol_weight_base is greater than 0;
@@ -336,7 +336,7 @@ du_srs_policy_max_ul_th::cell_context::find_optimal_ue_srs_resource()
336336
return optimal_res_it;
337337
}
338338

339-
void du_srs_policy_max_ul_th::dealloc_resources(cell_group_config& cell_grp_cfg)
339+
void du_srs_policy_max_ul_rate::dealloc_resources(cell_group_config& cell_grp_cfg)
340340
{
341341
if (not cells[0].cell_cfg.srs_cfg.srs_period.has_value() or
342342
not cell_grp_cfg.cells[0].serv_cell_cfg.ul_config->init_ul_bwp.srs_cfg.has_value()) {

lib/du/du_high/du_manager/ran_resource_management/du_srs_resource_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class du_srs_resource_manager
4040
/// objective to minimize the number of slots and symbols that contain the SRS resources, to reduce as much as possible
4141
/// the slots and symbols resources taken from the PUSCH. The drawback of this policy is that it can increase the
4242
/// inter-slot SRS interference among different UEs.
43-
class du_srs_policy_max_ul_th : public du_srs_resource_manager
43+
class du_srs_policy_max_ul_rate : public du_srs_resource_manager
4444
{
4545
public:
46-
explicit du_srs_policy_max_ul_th(span<const du_cell_config> cell_cfg_list_);
46+
explicit du_srs_policy_max_ul_rate(span<const du_cell_config> cell_cfg_list_);
4747

4848
/// The SRS resources are allocate according to the following policy:
4949
/// - Give priority to resources that are placed on partially-UL slots, first.

tests/unittests/du_manager/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,9 @@ gtest_discover_tests(pucch_resource_generator_test)
7777
add_executable(srs_resource_generator_test srs_resource_generator_test.cpp)
7878
target_include_directories(srs_resource_generator_test PRIVATE ${CMAKE_SOURCE_DIR})
7979
target_link_libraries(srs_resource_generator_test du_manager_test_helpers gtest gtest_main)
80-
gtest_discover_tests(srs_resource_generator_test)
80+
gtest_discover_tests(srs_resource_generator_test)
81+
82+
add_executable(du_srs_resource_manager_test du_srs_resource_manager_test.cpp)
83+
target_include_directories(du_srs_resource_manager_test PRIVATE ${CMAKE_SOURCE_DIR})
84+
target_link_libraries(du_srs_resource_manager_test du_manager_test_helpers gtest gtest_main)
85+
gtest_discover_tests(du_srs_resource_manager_test)

tests/unittests/du_manager/du_ran_resource_manager_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ class du_srs_resource_manager_tester : public ::testing::TestWithParam<srs_param
10581058
std::vector<du_cell_config> cell_cfg_list;
10591059
// This is a reference to the first element of cell_cfg_list's SRS config.
10601060
const srs_builder_params& srs_params;
1061-
du_srs_policy_max_ul_th du_srs_res_mng;
1061+
du_srs_policy_max_ul_rate du_srs_res_mng;
10621062
slotted_array<cell_group_config, MAX_NOF_DU_UES> ues;
10631063
};
10641064

0 commit comments

Comments
 (0)