Skip to content

Commit c4393c8

Browse files
author
Ismael
committed
Merge remote-tracking branch 'origin/fix_sched_ue_rem' into dev
2 parents eddeb3e + d6e48ca commit c4393c8

File tree

7 files changed

+57
-13
lines changed

7 files changed

+57
-13
lines changed

include/srsran/ran/csi_rs/csi_meas_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ struct csi_aperiodic_trigger_state {
281281
bool operator!=(const csi_aperiodic_trigger_state& rhs) const { return !(rhs == *this); }
282282
};
283283

284-
/// Used to configure the UE with a list of aperiodic trigger states. Each codepoint of the DCI field "CSI request" is
285-
/// associated with one trigger state.
284+
/// \brief Used to configure the UE with a list of aperiodic trigger states. Each codepoint of the DCI field
285+
/// "CSI request" is associated with one trigger state. List size ranges from 0 to MAX_NOF_CSI_APERIODIC_TRIGGERS.
286286
/// \remark TS 38.331, \c CSI-AperiodicTriggerStateList.
287-
using csi_aperiodic_trigger_state_list = static_vector<csi_aperiodic_trigger_state, MAX_NOF_CSI_APERIODIC_TRIGGERS>;
287+
using csi_aperiodic_trigger_state_list = std::vector<csi_aperiodic_trigger_state>;
288288

289289
/// See TS 38.331, \c CSI-SemiPersistentOnPUSCH-TriggerState.
290290
struct csi_semi_persistent_on_pusch_trigger_state {
@@ -322,7 +322,7 @@ struct csi_meas_config {
322322
std::vector<csi_report_config> csi_report_cfg_list;
323323
/// Size of CSI request field in DCI (bits). See TS 38.214, clause 5.2.1.5.1.
324324
std::optional<unsigned> report_trigger_size;
325-
std::optional<csi_aperiodic_trigger_state_list> aperiodic_trigger_state_list;
325+
csi_aperiodic_trigger_state_list aperiodic_trigger_state_list;
326326
std::optional<csi_semi_persistent_on_pusch_trigger_state_list> semi_persistent_on_pusch_trigger_state_list;
327327

328328
bool operator==(const csi_meas_config& rhs) const

lib/du/du_high/du_manager/converters/asn1_csi_meas_config_helpers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,15 +1273,15 @@ void srsran::srs_du::calculate_csi_meas_config_diff(asn1::rrc_nr::csi_meas_cfg_s
12731273
out.report_trigger_size = dest.report_trigger_size.value();
12741274
}
12751275

1276-
if ((dest.aperiodic_trigger_state_list.has_value() and not src.aperiodic_trigger_state_list.has_value()) or
1277-
(dest.aperiodic_trigger_state_list.has_value() and src.aperiodic_trigger_state_list.has_value() and
1276+
if ((not dest.aperiodic_trigger_state_list.empty() and src.aperiodic_trigger_state_list.empty()) or
1277+
(not dest.aperiodic_trigger_state_list.empty() and not src.aperiodic_trigger_state_list.empty() and
12781278
dest.aperiodic_trigger_state_list != src.aperiodic_trigger_state_list)) {
12791279
out.aperiodic_trigger_state_list_present = true;
12801280
auto& ap_trigger_state_list = out.aperiodic_trigger_state_list.set_setup();
1281-
for (const auto& trigger_state : dest.aperiodic_trigger_state_list.value()) {
1281+
for (const auto& trigger_state : dest.aperiodic_trigger_state_list) {
12821282
ap_trigger_state_list.push_back(make_asn1_aperiodic_trigger_state(trigger_state));
12831283
}
1284-
} else if (src.aperiodic_trigger_state_list.has_value() and not dest.aperiodic_trigger_state_list.has_value()) {
1284+
} else if (not src.aperiodic_trigger_state_list.empty() and dest.aperiodic_trigger_state_list.empty()) {
12851285
out.aperiodic_trigger_state_list_present = true;
12861286
out.aperiodic_trigger_state_list.set_release();
12871287
}

lib/scheduler/config/sched_config_manager.cpp

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ void ue_config_delete_event::reset()
5858
}
5959
}
6060

61+
// class: sched_config_manager
62+
6163
sched_config_manager::sched_config_manager(const scheduler_config& sched_cfg,
6264
scheduler_metrics_handler& metrics_handler_) :
6365
expert_params(sched_cfg.expert_params),
6466
metrics_handler(metrics_handler_),
6567
config_notifier(sched_cfg.config_notifier),
66-
logger(srslog::fetch_basic_logger("SCHED"))
68+
logger(srslog::fetch_basic_logger("SCHED")),
69+
ues_to_rem(MAX_NOF_DU_UES)
6770
{
6871
std::fill(ue_to_cell_group_index.begin(), ue_to_cell_group_index.end(), INVALID_DU_CELL_GROUP_INDEX);
6972
}
@@ -89,6 +92,9 @@ ue_config_update_event sched_config_manager::add_ue(const sched_ue_creation_requ
8992
{
9093
srsran_assert(cfg_req.ue_index < MAX_NOF_DU_UES, "Invalid ue_index={}", cfg_req.ue_index);
9194

95+
// See if there are any pending events to process out of the critical path.
96+
flush_ues_to_rem();
97+
9298
// Ensure PCell exists.
9399
if (not cfg_req.cfg.cells.has_value() or cfg_req.cfg.cells->empty()) {
94100
logger.warning("ue={} rnti={}: Discarding invalid UE creation request. Cause: PCell config not provided",
@@ -142,6 +148,9 @@ ue_config_update_event sched_config_manager::update_ue(const sched_ue_reconfigur
142148
{
143149
srsran_assert(cfg_req.ue_index < MAX_NOF_DU_UES, "Invalid ue_index={}", cfg_req.ue_index);
144150

151+
// See if there are any pending events to process out of the critical path.
152+
flush_ues_to_rem();
153+
145154
// Check if UE already exists.
146155
const du_cell_group_index_t group_idx = ue_to_cell_group_index[cfg_req.ue_index].load(std::memory_order_relaxed);
147156
if (group_idx == INVALID_DU_CELL_GROUP_INDEX) {
@@ -171,6 +180,9 @@ ue_config_delete_event sched_config_manager::remove_ue(du_ue_index_t ue_index)
171180
{
172181
srsran_assert(ue_index < MAX_NOF_DU_UES, "Invalid ue_index={}", ue_index);
173182

183+
// See if there are any pending events to process out of the critical path.
184+
flush_ues_to_rem();
185+
174186
// Check if UE already exists.
175187
const du_cell_group_index_t group_idx = ue_to_cell_group_index[ue_index].load(std::memory_order_relaxed);
176188
if (group_idx == INVALID_DU_CELL_GROUP_INDEX) {
@@ -203,7 +215,10 @@ void sched_config_manager::handle_ue_config_complete(du_ue_index_t ue_index, std
203215
}
204216

205217
// Stores new UE config and deletes old config.
206-
ue_cfg_list[ue_index] = std::move(next_cfg);
218+
ue_cfg_list[ue_index].swap(next_cfg);
219+
if (not ues_to_rem.try_push(std::move(next_cfg))) {
220+
logger.warning("Failed to offload UE config removal. Performance may be affected");
221+
}
207222

208223
// Notifies MAC that event is complete.
209224
config_notifier.on_ue_config_complete(ue_index, true);
@@ -224,7 +239,11 @@ void sched_config_manager::handle_ue_delete_complete(du_ue_index_t ue_index)
224239
du_cell_index_t pcell_idx = ue_cfg_list[ue_index]->pcell_common_cfg().cell_index;
225240

226241
// Deletes UE config.
242+
auto old_ue_cfg = std::move(ue_cfg_list[ue_index]);
227243
ue_cfg_list[ue_index].reset();
244+
if (not ues_to_rem.try_push(std::move(old_ue_cfg))) {
245+
logger.warning("Failed to offload UE config removal. Performance may be affected");
246+
}
228247

229248
// Remove UE from metrics.
230249
cell_metrics_handler& cell_metrics = metrics_handler.at(pcell_idx);
@@ -236,3 +255,12 @@ void sched_config_manager::handle_ue_delete_complete(du_ue_index_t ue_index)
236255
// Notifies MAC that event is complete.
237256
config_notifier.on_ue_delete_response(ue_index);
238257
}
258+
259+
void sched_config_manager::flush_ues_to_rem()
260+
{
261+
// Note: This should be called by a thread outside of the critical path.
262+
263+
// clear the UEs to rem.
264+
while (ues_to_rem.try_pop()) {
265+
}
266+
}

lib/scheduler/config/sched_config_manager.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#pragma once
1212

1313
#include "ue_configuration.h"
14+
#include "srsran/adt/concurrent_queue.h"
15+
#include "srsran/adt/mpmc_queue.h"
1416
#include "srsran/adt/noop_functor.h"
1517
#include "srsran/scheduler/config/scheduler_config.h"
1618
#include "srsran/srslog/logger.h"
@@ -127,6 +129,8 @@ class sched_config_manager
127129
friend class ue_config_update_event;
128130
friend class ue_config_delete_event;
129131

132+
void flush_ues_to_rem();
133+
130134
void handle_ue_config_complete(du_ue_index_t ue_index, std::unique_ptr<ue_configuration> next_cfg);
131135
void handle_ue_delete_complete(du_ue_index_t ue_index);
132136

@@ -140,8 +144,14 @@ class sched_config_manager
140144

141145
std::array<std::unique_ptr<ue_configuration>, MAX_NOF_DU_UES> ue_cfg_list;
142146

143-
/// Mapping of UEs to DU Cell Groups.
147+
// Mapping of UEs to DU Cell Groups.
144148
std::array<std::atomic<du_cell_group_index_t>, MAX_NOF_DU_UES> ue_to_cell_group_index;
149+
150+
// Cached UE configurations to be reused.
151+
concurrent_queue<std::unique_ptr<ue_configuration>,
152+
concurrent_queue_policy::lockfree_mpmc,
153+
concurrent_queue_wait_policy::non_blocking>
154+
ues_to_rem;
145155
};
146156

147157
} // namespace srsran

lib/scheduler/pdcch_scheduling/pdcch_slot_resource_allocator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
using namespace srsran;
1717

18+
pdcch_slot_allocator::pdcch_slot_allocator()
19+
{
20+
dfs_tree.reserve(MAX_DL_PDCCH_PDUS_PER_SLOT + MAX_UL_PDCCH_PDUS_PER_SLOT);
21+
saved_dfs_tree.reserve(MAX_DL_PDCCH_PDUS_PER_SLOT + MAX_UL_PDCCH_PDUS_PER_SLOT);
22+
}
23+
1824
pdcch_slot_allocator::~pdcch_slot_allocator() {}
1925

2026
void pdcch_slot_allocator::clear()

lib/scheduler/pdcch_scheduling/pdcch_slot_resource_allocator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class pdcch_slot_allocator
4242
unsigned record_index;
4343
};
4444

45+
pdcch_slot_allocator();
4546
~pdcch_slot_allocator();
4647

4748
/// Erase the current PDCCH allocations and stored context for this slot.

tests/unittests/du_manager/serving_cell_config_converter_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,11 +1125,10 @@ TEST(serving_cell_config_converter_test, test_custom_csi_meas_cfg_conversion)
11251125

11261126
dest_csi_meas_cfg.report_trigger_size = 2;
11271127

1128-
dest_csi_meas_cfg.aperiodic_trigger_state_list.emplace();
11291128
auto associated_report_cfg_info_list =
11301129
csi_associated_report_config_info{.report_cfg_id = static_cast<csi_report_config_id_t>(1),
11311130
.res_for_channel = csi_associated_report_config_info::csi_ssb_resource_set{1}};
1132-
dest_csi_meas_cfg.aperiodic_trigger_state_list.value().push_back(
1131+
dest_csi_meas_cfg.aperiodic_trigger_state_list.push_back(
11331132
csi_aperiodic_trigger_state{.associated_report_cfg_info_list = {associated_report_cfg_info_list}});
11341133

11351134
dest_csi_meas_cfg.semi_persistent_on_pusch_trigger_state_list.emplace();

0 commit comments

Comments
 (0)