Skip to content

Commit 375e2fc

Browse files
frankistcodebot
authored andcommitted
cu-cp: implementation of class for handing paging messages
1 parent 5121495 commit 375e2fc

File tree

8 files changed

+144
-10
lines changed

8 files changed

+144
-10
lines changed

lib/cu_cp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ set(SOURCES
4747
ue_manager/cu_cp_ue_impl.cpp
4848
ue_manager/ue_manager_impl.cpp
4949
ue_manager/ue_task_scheduler_impl.cpp
50+
paging/paging_message_handler.cpp
5051
)
5152

5253
add_library(srsran_cu_cp STATIC ${SOURCES})

lib/cu_cp/adapters/ngap_adapters.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "../cu_cp_impl_interface.h"
1414
#include "../du_processor/du_processor.h"
15+
#include "../paging/paging_message_handler.h"
1516
#include "../ue_manager/cu_cp_ue_impl_interface.h"
1617
#include "srsran/cu_cp/ue_task_scheduler.h"
1718
#include "srsran/ngap/ngap.h"
@@ -26,16 +27,16 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
2627
public:
2728
explicit ngap_cu_cp_adapter() = default;
2829

29-
void connect_cu_cp(du_repository_ngap_handler& du_repository_handler_, cu_cp_ngap_handler& cu_cp_handler_)
30+
void connect_cu_cp(cu_cp_ngap_handler& cu_cp_handler_, paging_message_handler& paging_handler_)
3031
{
31-
du_repository_handler = &du_repository_handler_;
32-
cu_cp_handler = &cu_cp_handler_;
32+
cu_cp_handler = &cu_cp_handler_;
33+
paging_handler = &paging_handler_;
3334
}
3435

3536
void on_paging_message(cu_cp_paging_message& msg) override
3637
{
37-
srsran_assert(du_repository_handler != nullptr, "CU-CP Paging handler must not be nullptr");
38-
du_repository_handler->handle_paging_message(msg);
38+
srsran_assert(paging_handler != nullptr, "CU-CP Paging handler must not be nullptr");
39+
paging_handler->handle_paging_message(msg);
3940
}
4041

4142
async_task<ngap_handover_resource_allocation_response>
@@ -117,8 +118,8 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
117118
}
118119

119120
private:
120-
du_repository_ngap_handler* du_repository_handler = nullptr;
121-
cu_cp_ngap_handler* cu_cp_handler = nullptr;
121+
cu_cp_ngap_handler* cu_cp_handler = nullptr;
122+
paging_message_handler* paging_handler = nullptr;
122123
};
123124

124125
/// Adapter between NGAP and CU-CP UE

lib/cu_cp/cu_cp_impl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ cu_cp_impl::cu_cp_impl(const cu_cp_configuration& config_) :
6565
conn_notifier,
6666
srslog::fetch_basic_logger("CU-CP")}),
6767
cu_up_db(cu_up_repository_config{cfg, e1ap_ev_notifier, srslog::fetch_basic_logger("CU-CP")}),
68+
paging_handler(du_db),
6869
metrics_hdlr(
6970
std::make_unique<metrics_handler_impl>(*cfg.services.cu_cp_executor, *cfg.services.timers, ue_mng, du_db))
7071
{
7172
assert_cu_cp_configuration_valid(cfg);
7273

7374
// connect event notifiers to layers
74-
ngap_cu_cp_ev_notifier.connect_cu_cp(du_db, *this);
75+
ngap_cu_cp_ev_notifier.connect_cu_cp(*this, paging_handler);
7576
mobility_manager_ev_notifier.connect_cu_cp(get_cu_cp_mobility_manager_handler());
7677
e1ap_ev_notifier.connect_cu_cp(get_cu_cp_e1ap_handler());
7778
rrc_du_cu_cp_notifier.connect_cu_cp(get_cu_cp_measurement_config_handler());

lib/cu_cp/cu_cp_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "cu_cp_impl_interface.h"
2323
#include "cu_up_processor/cu_up_processor_repository.h"
2424
#include "du_processor/du_processor_repository.h"
25+
#include "paging/paging_message_handler.h"
2526
#include "routine_managers/cu_cp_routine_manager.h"
2627
#include "ue_manager/ue_manager_impl.h"
2728
#include "srsran/cu_cp/cu_cp_configuration.h"
@@ -192,6 +193,9 @@ class cu_cp_impl final : public cu_cp,
192193
// CU-UP connections being managed by the CU-CP.
193194
cu_up_processor_repository cu_up_db;
194195

196+
// Handler of paging messages.
197+
paging_message_handler paging_handler;
198+
195199
// Handler of the CU-CP connections to other remote nodes (e.g. AMF, CU-UPs, DUs).
196200
std::unique_ptr<cu_cp_controller> controller;
197201

lib/cu_cp/du_processor/du_processor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#pragma once
1212

13+
#include "du_configuration_handler.h"
1314
#include "du_metrics_handler.h"
1415
#include "srsran/adt/static_vector.h"
1516
#include "srsran/f1ap/cu_cp/f1ap_cu.h"
@@ -68,6 +69,9 @@ class du_processor_cell_info_interface
6869

6970
/// \brief Checks whether a cell with the specified NR cell global id is served by the DU.
7071
virtual bool has_cell(nr_cell_global_id_t cgi) = 0;
72+
73+
/// \brief Get DU configuration context.
74+
virtual const du_configuration_context& get_context() const = 0;
7175
};
7276

7377
/// Interface to notify RRC DU about UE management procedures.

lib/cu_cp/du_processor/du_processor_impl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ class du_processor_impl : public du_processor,
5757
void handle_paging_message(cu_cp_paging_message& msg) override;
5858

5959
// du_processor_cell_info_interface
60-
bool has_cell(pci_t pci) override;
61-
bool has_cell(nr_cell_global_id_t cgi) override;
60+
bool has_cell(pci_t pci) override;
61+
bool has_cell(nr_cell_global_id_t cgi) override;
62+
const du_configuration_context& get_context() const override { return cfg.du_cfg_hdlr->get_context(); }
6263

6364
metrics_report::du_info handle_du_metrics_report_request() const override;
6465

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#include "paging_message_handler.h"
12+
#include "../du_processor/du_processor_repository.h"
13+
#include "srsran/cu_cp/cu_cp_types.h"
14+
15+
using namespace srsran;
16+
using namespace srs_cu_cp;
17+
18+
paging_message_handler::paging_message_handler(du_processor_repository& dus_) :
19+
dus(dus_), logger(srslog::fetch_basic_logger("CU-CP"))
20+
{
21+
}
22+
23+
void paging_message_handler::handle_paging_message(const cu_cp_paging_message& msg)
24+
{
25+
// Forward paging message to all DU processors
26+
bool paging_sent = false;
27+
for (unsigned i = 0; i != dus.get_nof_dus(); ++i) {
28+
paging_sent |= handle_du_paging_message(uint_to_du_index(i), msg);
29+
}
30+
31+
if (not paging_sent) {
32+
logger.warning("No DU processor was able to handle the paging message");
33+
}
34+
}
35+
36+
bool paging_message_handler::handle_du_paging_message(du_index_t du_index, const cu_cp_paging_message& msg_before)
37+
{
38+
du_processor& du = dus.get_du_processor(du_index);
39+
const du_configuration_context& du_cfg = du.get_context();
40+
41+
// Recommended cells will be added to the original paging message.
42+
cu_cp_paging_message msg_expanded{msg_before};
43+
if (not msg_expanded.assist_data_for_paging.has_value()) {
44+
msg_expanded.assist_data_for_paging.emplace();
45+
}
46+
if (not msg_expanded.assist_data_for_paging.value().assist_data_for_recommended_cells.has_value()) {
47+
msg_expanded.assist_data_for_paging.value().assist_data_for_recommended_cells.emplace();
48+
}
49+
auto& recommended_cells = msg_expanded.assist_data_for_paging.value()
50+
.assist_data_for_recommended_cells.value()
51+
.recommended_cells_for_paging.recommended_cell_list;
52+
53+
for (const auto& tai_list_item : msg_expanded.tai_list_for_paging) {
54+
for (const du_cell_configuration& cell : du_cfg.served_cells) {
55+
if (cell.tac != tai_list_item.tai.tac) {
56+
// Only add cells with matching TAC.
57+
continue;
58+
}
59+
60+
// Check if cell already exists in the list of recommended.
61+
for (auto& recommended_cell : recommended_cells) {
62+
if (recommended_cell.ngran_cgi == cell.cgi) {
63+
// NR CGI for TAC is already present. Continue with next cell.
64+
continue;
65+
break;
66+
}
67+
}
68+
69+
// Setup recommended cell item to add in case it doesn't exist
70+
cu_cp_recommended_cell_item cell_item;
71+
cell_item.ngran_cgi = cell.cgi;
72+
recommended_cells.push_back(cell_item);
73+
}
74+
}
75+
76+
if (recommended_cells.empty()) {
77+
logger.info("du={}: No cells with matching TAC available at this DU", du_index);
78+
return false;
79+
}
80+
81+
// Forward message to F1AP of the respective DU.
82+
du.get_f1ap_handler().get_f1ap_paging_manager().handle_paging(msg_expanded);
83+
84+
return true;
85+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "srsran/cu_cp/cu_cp_types.h"
14+
15+
namespace srsran {
16+
namespace srs_cu_cp {
17+
18+
class du_processor_repository;
19+
struct cu_cp_paging_message;
20+
21+
/// Class responsible for handling incoming paging messages and forwarding them to the appropriate DUs.
22+
class paging_message_handler
23+
{
24+
public:
25+
paging_message_handler(du_processor_repository& dus_);
26+
27+
void handle_paging_message(const cu_cp_paging_message& msg);
28+
29+
private:
30+
bool handle_du_paging_message(du_index_t du_index, const cu_cp_paging_message& msg);
31+
32+
du_processor_repository& dus;
33+
srslog::basic_logger& logger;
34+
};
35+
36+
} // namespace srs_cu_cp
37+
} // namespace srsran

0 commit comments

Comments
 (0)