Skip to content

Commit 78f2dc3

Browse files
robertfalkenbergcodebot
authored andcommitted
f1u: separate loggers for CU-UP and DU
1 parent 6b8a5e7 commit 78f2dc3

File tree

9 files changed

+46
-37
lines changed

9 files changed

+46
-37
lines changed

apps/gnb/gnb.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,11 @@ int main(int argc, char** argv)
582582
cu_f1ap_logger.set_level(srslog::str_to_basic_level(gnb_cfg.log_cfg.f1ap_level));
583583
cu_f1ap_logger.set_hex_dump_max_size(gnb_cfg.log_cfg.hex_max_size);
584584

585-
auto& f1u_logger = srslog::fetch_basic_logger("F1-U", false);
586-
f1u_logger.set_level(srslog::str_to_basic_level(gnb_cfg.log_cfg.f1u_level));
587-
f1u_logger.set_hex_dump_max_size(gnb_cfg.log_cfg.hex_max_size);
585+
for (const auto& id : {"CU-F1-U", "DU-F1-U"}) {
586+
auto& f1u_logger = srslog::fetch_basic_logger(id, false);
587+
f1u_logger.set_level(srslog::str_to_basic_level(gnb_cfg.log_cfg.f1u_level));
588+
f1u_logger.set_hex_dump_max_size(gnb_cfg.log_cfg.hex_max_size);
589+
}
588590

589591
auto& sec_logger = srslog::fetch_basic_logger("SEC", false);
590592
sec_logger.set_level(srslog::str_to_basic_level(gnb_cfg.log_cfg.sec_level));

include/srsran/f1u/local_connector/f1u_local_bearer_adapter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class f1u_dl_local_adapter : public srs_cu_up::f1u_tx_pdu_notifier
2626
void on_new_pdu(nru_dl_message msg) override
2727
{
2828
if (handler == nullptr) {
29-
srslog::fetch_basic_logger("F1-U").warning("Cannot handle NR-U DL message: DU handler not attached.");
29+
srslog::fetch_basic_logger("DU-F1-U").warning("Cannot handle NR-U DL message: DU handler not attached.");
3030
return;
3131
}
3232
handler->handle_pdu(std::move(msg));
@@ -56,7 +56,7 @@ class f1u_ul_local_adapter : public srs_du::f1u_tx_pdu_notifier
5656
void on_new_pdu(nru_ul_message msg) override
5757
{
5858
if (handler == nullptr) {
59-
srslog::fetch_basic_logger("F1-U").info("Cannot handle NR-U UL message: CU handler not attached.");
59+
srslog::fetch_basic_logger("DU-F1-U").info("Cannot handle NR-U UL message: CU handler not attached.");
6060
return;
6161
}
6262
handler->handle_pdu(std::move(msg));

include/srsran/f1u/local_connector/f1u_local_connector.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ struct f1u_du_bearer {
4747
class f1u_local_connector final : public srs_du::f1u_du_gateway, public f1u_cu_up_gateway
4848
{
4949
public:
50-
f1u_local_connector() : logger(srslog::fetch_basic_logger("F1-U")) {}
50+
f1u_local_connector() :
51+
logger_cu(srslog::fetch_basic_logger("CU-F1-U")), logger_du(srslog::fetch_basic_logger("DU-F1-U"))
52+
{
53+
}
5154

5255
srs_du::f1u_du_gateway* get_f1u_du_gateway() { return this; }
5356
f1u_cu_up_gateway* get_f1u_cu_up_gateway() { return this; }
@@ -70,7 +73,8 @@ class f1u_local_connector final : public srs_du::f1u_du_gateway, public f1u_cu_u
7073
void remove_du_bearer(uint32_t dl_teid) override;
7174

7275
private:
73-
srslog::basic_logger& logger;
76+
srslog::basic_logger& logger_cu;
77+
srslog::basic_logger& logger_du;
7478
std::unordered_map<uint32_t, f1u_cu_bearer> cu_map; // Key is UL-TEID (i.e., the CU's local TEID)
7579
std::unordered_map<uint32_t, f1u_du_bearer> du_map; // Key is DL-TEID (i.e., the DU's local TEID)
7680
std::mutex map_mutex; // shared mutex for access to cu_map and du_map

lib/f1u/cu_up/f1u_bearer_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ f1u_bearer_impl::f1u_bearer_impl(uint32_t ue_index,
2222
timer_factory timers,
2323
f1u_bearer_disconnector& disconnector_,
2424
uint32_t ul_teid_) :
25-
logger("F1-U", {ue_index, drb_id_}),
25+
logger("CU-F1-U", {ue_index, drb_id_}),
2626
tx_pdu_notifier(tx_pdu_notifier_),
2727
rx_delivery_notifier(rx_delivery_notifier_),
2828
rx_sdu_notifier(rx_sdu_notifier_),

lib/f1u/du/f1u_bearer_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ f1u_bearer_impl::f1u_bearer_impl(uint32_t ue_index,
2020
f1u_rx_sdu_notifier& rx_sdu_notifier_,
2121
f1u_tx_pdu_notifier& tx_pdu_notifier_,
2222
timer_factory timers) :
23-
logger("F1-U", {ue_index, drb_id_}),
23+
logger("DU-F1-U", {ue_index, drb_id_}),
2424
cfg(config),
2525
rx_sdu_notifier(rx_sdu_notifier_),
2626
tx_pdu_notifier(tx_pdu_notifier_),

lib/f1u/local_connector/f1u_local_connector.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ f1u_local_connector::create_cu_bearer(uint32_t ue_in
2424
srs_cu_up::f1u_rx_sdu_notifier& rx_sdu_notifier,
2525
timer_factory timers)
2626
{
27-
logger.info("Creating CU F1-U bearer. UL-TEID={}", ul_teid);
27+
logger_cu.info("Creating CU F1-U bearer. UL-TEID={}", ul_teid);
2828
std::unique_lock<std::mutex> lock(map_mutex);
2929
srsran_assert(
3030
cu_map.find(ul_teid) == cu_map.end(), "Cannot create CU F1-U bearer with already existing UL-TEID={}", ul_teid);
@@ -40,16 +40,16 @@ void f1u_local_connector::attach_dl_teid(uint32_t ul_teid, uint32_t dl_teid)
4040
{
4141
std::unique_lock<std::mutex> lock(map_mutex);
4242
if (cu_map.find(ul_teid) == cu_map.end()) {
43-
logger.warning("Could not find UL-TEID at CU to connect. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
43+
logger_cu.warning("Could not find UL-TEID at CU to connect. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
4444
return;
4545
}
46-
logger.debug("Connecting CU F1-U bearer. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
46+
logger_cu.debug("Connecting CU F1-U bearer. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
4747

4848
if (du_map.find(dl_teid) == du_map.end()) {
49-
logger.warning("Could not find DL-TEID at DU to connect. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
49+
logger_cu.warning("Could not find DL-TEID at DU to connect. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
5050
return;
5151
}
52-
logger.debug("Connecting DU F1-U bearer. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
52+
logger_cu.debug("Connecting DU F1-U bearer. UL-TEID={}, DL-TEID={}", ul_teid, dl_teid);
5353

5454
auto& du_tun = du_map.at(dl_teid);
5555
auto& cu_tun = cu_map.at(ul_teid);
@@ -63,30 +63,30 @@ void f1u_local_connector::disconnect_cu_bearer(uint32_t ul_teid)
6363
// Find bearer from ul_teid
6464
auto bearer_it = cu_map.find(ul_teid);
6565
if (bearer_it == cu_map.end()) {
66-
logger.warning("Could not find UL-TEID={} at CU to remove.", ul_teid);
66+
logger_cu.warning("Could not find UL-TEID={} at CU to remove.", ul_teid);
6767
return;
6868
}
6969

7070
// Disconnect UL path of DU first if we have a dl_teid for lookup
7171
if (bearer_it->second.dl_teid.has_value()) {
7272
auto du_bearer_it = du_map.find(bearer_it->second.dl_teid.value());
7373
if (du_bearer_it != du_map.end()) {
74-
logger.debug("Disconnecting DU F1-U bearer with DL-TEID={} from CU handler. UL-TEID={}",
75-
bearer_it->second.dl_teid,
76-
ul_teid);
74+
logger_cu.debug("Disconnecting DU F1-U bearer with DL-TEID={} from CU handler. UL-TEID={}",
75+
bearer_it->second.dl_teid,
76+
ul_teid);
7777
du_bearer_it->second.du_tx->detach_cu_handler();
7878
} else {
7979
// Bearer could already been removed from DU.
80-
logger.info("Could not find DL-TEID={} at DU to disconnect DU F1-U bearer from CU handler. UL-TEID={}",
81-
bearer_it->second.dl_teid,
82-
ul_teid);
80+
logger_cu.info("Could not find DL-TEID={} at DU to disconnect DU F1-U bearer from CU handler. UL-TEID={}",
81+
bearer_it->second.dl_teid,
82+
ul_teid);
8383
}
8484
} else {
85-
logger.warning("No DL-TEID provided to disconnect DU F1-U bearer from CU handler. UL-TEID={}", ul_teid);
85+
logger_cu.warning("No DL-TEID provided to disconnect DU F1-U bearer from CU handler. UL-TEID={}", ul_teid);
8686
}
8787

8888
// Remove DL path
89-
logger.debug("Removing CU F1-U bearer with UL-TEID={}.", ul_teid);
89+
logger_cu.debug("Removing CU F1-U bearer with UL-TEID={}.", ul_teid);
9090
cu_map.erase(bearer_it);
9191
}
9292

@@ -100,12 +100,12 @@ srs_du::f1u_bearer* f1u_local_connector::create_du_bearer(uint32_t
100100
{
101101
std::unique_lock<std::mutex> lock(map_mutex);
102102
if (cu_map.find(ul_teid) == cu_map.end()) {
103-
logger.warning(
103+
logger_du.warning(
104104
"Could not find CU F1-U bearer, when creating DU F1-U bearer. DL-TEID={}, UL-TEID={}", dl_teid, ul_teid);
105105
return nullptr;
106106
}
107107

108-
logger.debug("Creating DU F1-U bearer. DL-TEID={}, UL-TEID={}", dl_teid, ul_teid);
108+
logger_du.debug("Creating DU F1-U bearer. DL-TEID={}, UL-TEID={}", dl_teid, ul_teid);
109109
std::unique_ptr<f1u_ul_local_adapter> du_tx = std::make_unique<f1u_ul_local_adapter>();
110110

111111
srs_du::f1u_bearer_creation_message f1u_msg = {};
@@ -133,9 +133,9 @@ void f1u_local_connector::remove_du_bearer(uint32_t dl_teid)
133133
std::unique_lock<std::mutex> lock(map_mutex);
134134
auto bearer_it = du_map.find(dl_teid);
135135
if (bearer_it == du_map.end()) {
136-
logger.warning("Could not find DL-TEID at DU to remove. DL-TEID={}", dl_teid);
136+
logger_du.warning("Could not find DL-TEID at DU to remove. DL-TEID={}", dl_teid);
137137
return;
138138
}
139-
logger.debug("Removing DU F1-U bearer. DL-TEID={}", dl_teid);
139+
logger_du.debug("Removing DU F1-U bearer. DL-TEID={}", dl_teid);
140140
du_map.erase(bearer_it);
141141
}

tests/unittests/f1u/common/f1u_connector_test.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct dummy_f1u_cu_up_rx_sdu_notifier final : public srs_cu_up::f1u_rx_sdu_noti
2323
last_sdu = std::move(sdu);
2424
}
2525
byte_buffer_slice_chain last_sdu;
26-
srslog::basic_logger& logger = srslog::fetch_basic_logger("F1-U", false);
26+
srslog::basic_logger& logger = srslog::fetch_basic_logger("CU-F1-U", false);
2727
};
2828

2929
struct dummy_f1u_cu_up_rx_delivery_notifier final : public srs_cu_up::f1u_rx_delivery_notifier {
@@ -35,7 +35,7 @@ struct dummy_f1u_cu_up_rx_delivery_notifier final : public srs_cu_up::f1u_rx_del
3535
{
3636
logger.info("CU-UP PDCP PDU delivered up to highest_pdcp_sn={}", highest_pdcp_sn);
3737
}
38-
srslog::basic_logger& logger = srslog::fetch_basic_logger("F1-U", false);
38+
srslog::basic_logger& logger = srslog::fetch_basic_logger("CU-F1-U", false);
3939
};
4040

4141
// dummy DU RX bearer interface
@@ -49,7 +49,7 @@ struct dummy_f1u_du_rx_sdu_notifier final : public srs_du::f1u_rx_sdu_notifier {
4949
byte_buffer last_sdu;
5050

5151
private:
52-
srslog::basic_logger& logger = srslog::fetch_basic_logger("F1-U", false);
52+
srslog::basic_logger& logger = srslog::fetch_basic_logger("CU-F1-U", false);
5353
};
5454

5555
/// Fixture class for F1-U connector tests.
@@ -64,8 +64,10 @@ class f1u_connector_test : public ::testing::Test
6464
logger.set_level(srslog::basic_levels::debug);
6565

6666
// init logger
67-
f1u_logger.set_level(srslog::basic_levels::debug);
68-
f1u_logger.set_hex_dump_max_size(100);
67+
f1u_logger_cu.set_level(srslog::basic_levels::debug);
68+
f1u_logger_du.set_level(srslog::basic_levels::debug);
69+
f1u_logger_cu.set_hex_dump_max_size(100);
70+
f1u_logger_du.set_hex_dump_max_size(100);
6971

7072
logger.info("Creating F1-U connector");
7173

@@ -91,7 +93,8 @@ class f1u_connector_test : public ::testing::Test
9193
srs_du::f1u_config config;
9294
std::unique_ptr<f1u_local_connector> f1u_conn;
9395
srslog::basic_logger& logger = srslog::fetch_basic_logger("TEST", false);
94-
srslog::basic_logger& f1u_logger = srslog::fetch_basic_logger("F1-U", false);
96+
srslog::basic_logger& f1u_logger_cu = srslog::fetch_basic_logger("CU-F1-U", false);
97+
srslog::basic_logger& f1u_logger_du = srslog::fetch_basic_logger("DU-F1-U", false);
9598
};
9699

97100
/// Test the instantiation of a new entity

tests/unittests/f1u/cu_up/f1u_cu_up_bearer_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class f1u_cu_up_test : public ::testing::Test, public f1u_trx_test
7474
logger.set_level(srslog::basic_levels::debug);
7575

7676
// init F1-U logger
77-
srslog::fetch_basic_logger("F1-U", false).set_level(srslog::basic_levels::debug);
78-
srslog::fetch_basic_logger("F1-U", false).set_hex_dump_max_size(100);
77+
srslog::fetch_basic_logger("CU-F1-U", false).set_level(srslog::basic_levels::debug);
78+
srslog::fetch_basic_logger("CU-F1-U", false).set_hex_dump_max_size(100);
7979

8080
// create tester and testee
8181
logger.info("Creating F1-U bearer");

tests/unittests/f1u/du/f1u_du_bearer_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class f1u_du_test : public ::testing::Test, public f1u_trx_test
5757
logger.set_level(srslog::basic_levels::debug);
5858

5959
// init F1-U logger
60-
srslog::fetch_basic_logger("F1-U", false).set_level(srslog::basic_levels::debug);
61-
srslog::fetch_basic_logger("F1-U", false).set_hex_dump_max_size(100);
60+
srslog::fetch_basic_logger("DU-F1-U", false).set_level(srslog::basic_levels::debug);
61+
srslog::fetch_basic_logger("DU-F1-U", false).set_hex_dump_max_size(100);
6262

6363
// create tester and testee
6464
logger.info("Creating F1-U bearer");

0 commit comments

Comments
 (0)