Skip to content

Commit 3a782e0

Browse files
frankistcodebot
authored andcommitted
cu-cp: rename cu-cp ue manager allocate_new_ue_index and add_ue methods for clarity
1 parent 0b6627b commit 3a782e0

File tree

12 files changed

+84
-77
lines changed

12 files changed

+84
-77
lines changed

include/srsran/cu_cp/ue_manager.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class common_ue_manager
106106
/// \param[in] c_rnti The RNTI of the UE.
107107
virtual ue_index_t get_ue_index(pci_t pci, rnti_t c_rnti) = 0;
108108

109+
/// \brief Allocate and return the UE index of a new UE.
110+
virtual ue_index_t add_ue(du_index_t du_index) = 0;
111+
109112
/// \brief Remove the UE context with the given UE index.
110113
/// \param[in] ue_index Index of the UE to be removed.
111114
virtual void remove_ue(ue_index_t ue_index) = 0;
@@ -121,9 +124,6 @@ class du_processor_ue_manager : public common_ue_manager
121124
public:
122125
virtual ~du_processor_ue_manager() = default;
123126

124-
/// \brief Allocate and return the UE index of a new UE.
125-
virtual ue_index_t allocate_new_ue_index(du_index_t du_index) = 0;
126-
127127
/// \brief Find the UE with the given UE index. Note that this will not check if a DU context exists.
128128
/// \param[in] ue_index Index of the UE to be found.
129129
/// \return Pointer to the UE if found, nullptr otherwise.
@@ -136,7 +136,7 @@ class du_processor_ue_manager : public common_ue_manager
136136
/// \param[in] pci PCI of the cell that the UE is connected to.
137137
/// \param[in] rnti RNTI of the UE to be added.
138138
/// \return Pointer to the newly added DU UE if successful, nullptr otherwise.
139-
virtual du_ue* add_ue(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti) = 0;
139+
virtual du_ue* set_ue_du_context(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti) = 0;
140140

141141
/// \brief Find the DU UE with the given UE index.
142142
/// \param[in] ue_index Index of the UE to be found.
@@ -177,10 +177,10 @@ class ngap_ue_manager : public common_ue_manager
177177
/// \param[in] rrc_ue_ctrl_notifier RRC UE control notifier for the UE.
178178
/// \param[in] du_processor_ctrl_notifier DU processor control notifier for the UE.
179179
/// \return Pointer to the NGAP UE if found, nullptr otherwise.
180-
virtual ngap_ue* add_ue(ue_index_t ue_index,
181-
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier,
182-
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier,
183-
ngap_du_processor_control_notifier& du_processor_ctrl_notifier) = 0;
180+
virtual ngap_ue* set_ue_ng_context(ue_index_t ue_index,
181+
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier,
182+
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier,
183+
ngap_du_processor_control_notifier& du_processor_ctrl_notifier) = 0;
184184

185185
/// \brief Find the NGAP UE with the given UE index.
186186
/// \param[in] ue_index Index of the UE to be found.

lib/cu_cp/cu_cp_impl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,10 @@ bool cu_cp_impl::handle_new_ngap_ue(ue_index_t ue_index)
340340
return false;
341341
}
342342

343-
return ue_mng.add_ue(ue_index,
344-
ue_mng.get_ngap_rrc_ue_adapter(ue_index),
345-
ue_mng.get_ngap_rrc_ue_adapter(ue_index),
346-
ngap_du_processor_ctrl_notifiers.at(get_du_index_from_ue_index(ue_index)));
343+
return ue_mng.set_ue_ng_context(ue_index,
344+
ue_mng.get_ngap_rrc_ue_adapter(ue_index),
345+
ue_mng.get_ngap_rrc_ue_adapter(ue_index),
346+
ngap_du_processor_ctrl_notifiers.at(get_du_index_from_ue_index(ue_index)));
347347
}
348348

349349
void cu_cp_impl::on_statistics_report_timer_expired()

lib/cu_cp/du_processor/du_processor_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ du_setup_result du_processor_impl::handle_du_setup_request(const du_setup_reques
174174

175175
ue_index_t du_processor_impl::allocate_new_ue_index()
176176
{
177-
return ue_manager.allocate_new_ue_index(context.du_index);
177+
return ue_manager.add_ue(context.du_index);
178178
}
179179

180180
du_cell_index_t du_processor_impl::find_cell(uint64_t packed_nr_cell_id)
@@ -270,7 +270,7 @@ cu_cp_ue_creation_response du_processor_impl::handle_ue_creation_request(const c
270270
}
271271

272272
// Create new UE context
273-
du_ue* ue = ue_manager.add_ue(ue_index, context.id, pci, msg.c_rnti);
273+
du_ue* ue = ue_manager.set_ue_du_context(ue_index, context.id, pci, msg.c_rnti);
274274
if (ue == nullptr) {
275275
logger.warning("ue={}: Could not create UE context", ue_index);
276276
return {};

lib/cu_cp/routines/mobility/inter_du_handover_routine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void inter_du_handover_routine::operator()(coro_context<async_task<cu_cp_inter_d
8686

8787
{
8888
// Allocate UE index at target DU
89-
target_ue_context_setup_request.ue_index = ue_manager.allocate_new_ue_index(command.target_du_index);
89+
target_ue_context_setup_request.ue_index = ue_manager.add_ue(command.target_du_index);
9090
if (target_ue_context_setup_request.ue_index == ue_index_t::invalid) {
9191
logger.warning("ue={}: \"{}\" failed to allocate UE index at target DU", command.source_ue_index, name());
9292
CORO_EARLY_RETURN(response_msg);

lib/cu_cp/ue_manager/ue_manager_impl.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,17 @@ void ue_manager::remove_ue(ue_index_t ue_index)
7575

7676
// du_processor_ue_manager
7777

78-
ue_index_t ue_manager::allocate_new_ue_index(du_index_t du_index)
78+
ue_index_t ue_manager::add_ue(du_index_t du_index)
7979
{
8080
if (ues.size() == ue_config.max_nof_supported_ues) {
81+
logger.warning("CU-CP UE creation Failed. Cause: Maximum number of UEs {} supported by the CU-CP has been reached",
82+
ue_config.max_nof_supported_ues);
8183
return ue_index_t::invalid;
8284
}
8385

8486
ue_index_t new_ue_index = get_next_ue_index(du_index);
8587
if (new_ue_index == ue_index_t::invalid) {
86-
logger.warning("No free UE index available");
88+
logger.warning("CU-CP UE creation Failed. Cause: No free UE index available");
8789
return ue_index_t::invalid;
8890
}
8991

@@ -95,7 +97,7 @@ ue_index_t ue_manager::allocate_new_ue_index(du_index_t du_index)
9597
std::forward_as_tuple(new_ue_index),
9698
std::forward_as_tuple(new_ue_index, up_config, std::move(ue_sched)));
9799

98-
logger.debug("ue={}: Allocated new UE index", new_ue_index);
100+
logger.info("ue={}: Created new CU-CP UE", new_ue_index);
99101

100102
return new_ue_index;
101103
}
@@ -108,7 +110,7 @@ du_ue* ue_manager::find_ue(ue_index_t ue_index)
108110
return nullptr;
109111
}
110112

111-
du_ue* ue_manager::add_ue(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti)
113+
du_ue* ue_manager::set_ue_du_context(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti)
112114
{
113115
srsran_assert(ue_index != ue_index_t::invalid, "Invalid ue_index={}", ue_index);
114116
srsran_assert(pci != INVALID_PCI, "Invalid pci={}", pci);
@@ -147,10 +149,10 @@ du_ue* ue_manager::find_du_ue(ue_index_t ue_index)
147149

148150
// ngap_ue_manager
149151

150-
ngap_ue* ue_manager::add_ue(ue_index_t ue_index,
151-
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier_,
152-
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier_,
153-
ngap_du_processor_control_notifier& du_processor_ctrl_notifier_)
152+
ngap_ue* ue_manager::set_ue_ng_context(ue_index_t ue_index,
153+
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier_,
154+
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier_,
155+
ngap_du_processor_control_notifier& du_processor_ctrl_notifier_)
154156
{
155157
srsran_assert(ue_index != ue_index_t::invalid, "Invalid ue_index={}", ue_index);
156158

lib/cu_cp/ue_manager/ue_manager_impl.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,17 @@ class ue_manager : public du_processor_ue_manager, public ngap_ue_manager, publi
251251

252252
// du_processor_ue_manager
253253

254-
/// \brief Allocate and return the UE index of a new UE.
255-
ue_index_t allocate_new_ue_index(du_index_t du_index) override;
254+
/// \brief Allocate resources for the UE in the CU-CP.
255+
///
256+
/// \return ue_index of the created UE or ue_index_t::invalid in case of failure.
257+
ue_index_t add_ue(du_index_t du_index) override;
256258

257259
/// \brief Find the UE with the given UE index. Note that this will not check if a DU context exists.
258260
/// \param[in] ue_index Index of the UE to be found.
259261
/// \return Pointer to the UE if found, nullptr otherwise.
260262
du_ue* find_ue(ue_index_t ue_index) override;
261263

262-
du_ue* add_ue(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti) override;
264+
du_ue* set_ue_du_context(ue_index_t ue_index, gnb_du_id_t du_id, pci_t pci, rnti_t rnti) override;
263265

264266
/// \brief Find the UE with the given UE index, thats DU context is set up.
265267
/// \param[in] ue_index Index of the UE to be found.
@@ -290,10 +292,10 @@ class ue_manager : public du_processor_ue_manager, public ngap_ue_manager, publi
290292
/// \param[in] rrc_ue_ctrl_notifier RRC UE control notifier for the UE.
291293
/// \param[in] du_processor_ctrl_notifier DU processor control notifier for the UE.
292294
/// \return Pointer to the NGAP UE if found, nullptr otherwise.
293-
ngap_ue* add_ue(ue_index_t ue_index,
294-
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier_,
295-
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier_,
296-
ngap_du_processor_control_notifier& du_processor_ctrl_notifier_) override;
295+
ngap_ue* set_ue_ng_context(ue_index_t ue_index,
296+
ngap_rrc_ue_pdu_notifier& rrc_ue_pdu_notifier_,
297+
ngap_rrc_ue_control_notifier& rrc_ue_ctrl_notifier_,
298+
ngap_du_processor_control_notifier& du_processor_ctrl_notifier_) override;
297299

298300
/// \brief Find the NGAP UE with the given UE index.
299301
/// \param[in] ue_index Index of the UE to be found.

tests/unittests/cu_cp/du_processor/ue_context_release_routine_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class ue_context_release_test : public du_processor_routine_manager_test
3232

3333
ue_index_t add_ue(pci_t pci, rnti_t c_rnti)
3434
{
35-
ue_index_t ue_index = ue_mng.allocate_new_ue_index(du_index_t::min);
36-
du_ue* ue = ue_mng.add_ue(ue_index, int_to_gnb_du_id(0), pci, c_rnti);
35+
ue_index_t ue_index = ue_mng.add_ue(du_index_t::min);
36+
du_ue* ue = ue_mng.set_ue_du_context(ue_index, int_to_gnb_du_id(0), pci, c_rnti);
3737
// Set parameters from creation message
3838
ue->set_pcell_index(du_cell_index_t::min);
3939
ue->set_rrc_ue_notifier(rrc_ue_ctrl_notifier);

tests/unittests/cu_cp/mobility/handover_reconfiguration_routine_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class handover_reconfiguration_routine_test : public mobility_test
2525

2626
void create_ues(bool procedure_outcome, unsigned transaction_id_)
2727
{
28-
ue_index_t source_ue_index = get_ue_manager()->allocate_new_ue_index(source_du_index);
29-
source_ue = get_ue_manager()->add_ue(source_ue_index, int_to_gnb_du_id(0), source_pci, source_rnti);
28+
ue_index_t source_ue_index = get_ue_manager()->add_ue(source_du_index);
29+
source_ue = get_ue_manager()->set_ue_du_context(source_ue_index, int_to_gnb_du_id(0), source_pci, source_rnti);
3030
ASSERT_NE(source_ue, nullptr);
3131
source_rrc_ue_notifier.set_transaction_id(transaction_id_);
3232
source_ue->set_rrc_ue_notifier(source_rrc_ue_notifier);
3333

34-
ue_index_t target_ue_index = get_ue_manager()->allocate_new_ue_index(target_du_index);
35-
target_ue = get_ue_manager()->add_ue(target_ue_index, int_to_gnb_du_id(0), target_pci, target_rnti);
34+
ue_index_t target_ue_index = get_ue_manager()->add_ue(target_du_index);
35+
target_ue = get_ue_manager()->set_ue_du_context(target_ue_index, int_to_gnb_du_id(0), target_pci, target_rnti);
3636
ASSERT_NE(target_ue, nullptr);
3737
target_rrc_ue_notifier.set_rrc_reconfiguration_outcome(procedure_outcome);
3838
target_ue->set_rrc_ue_notifier(target_rrc_ue_notifier);

0 commit comments

Comments
 (0)