From d95c31d2de333cde17c6143c34ba3aa7f6b3bf34 Mon Sep 17 00:00:00 2001 From: Carlo Galiotto Date: Thu, 28 Oct 2021 16:24:31 +0200 Subject: [PATCH] rlc,rrc,nr: fix rlc bearer string diplayed in logs Signed-off-by: Carlo Galiotto --- lib/include/srsran/asn1/rrc_nr_utils.h | 2 +- .../srsran/interfaces/rlc_interface_types.h | 1 + lib/include/srsran/rlc/rlc_um_nr.h | 3 +++ lib/src/asn1/rrc_nr_utils.cc | 4 ++-- lib/src/rlc/rlc_um_nr.cc | 24 ++++++++++++++++--- srsenb/src/stack/rrc/rrc_nr.cc | 7 ++++-- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index 3cf8385e2..a817f8d4d 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -134,7 +134,7 @@ bool make_mac_dl_harq_cfg_nr_t(const asn1::rrc_nr::pdsch_ser /*************************** * RLC Config **************************/ -int make_rlc_config_t(const asn1::rrc_nr::rlc_cfg_c& asn1_type, rlc_config_t* rlc_config_out); +int make_rlc_config_t(const asn1::rrc_nr::rlc_cfg_c& asn1_type, rlc_config_t* rlc_config_out, uint8_t bearer_id = 0); /*************************** * PDCP Config diff --git a/lib/include/srsran/interfaces/rlc_interface_types.h b/lib/include/srsran/interfaces/rlc_interface_types.h index e19766e0c..fdad4e3ce 100644 --- a/lib/include/srsran/interfaces/rlc_interface_types.h +++ b/lib/include/srsran/interfaces/rlc_interface_types.h @@ -111,6 +111,7 @@ struct rlc_um_nr_config_t { rlc_um_nr_sn_size_t sn_field_length; // Number of bits used for sequence number int32_t t_reassembly_ms; // Timer used by rx to detect PDU loss (ms) + uint8_t bearer_id; // This is not in the 3GPP TS 38.322 }; #define RLC_TX_QUEUE_LEN (256) diff --git a/lib/include/srsran/rlc/rlc_um_nr.h b/lib/include/srsran/rlc/rlc_um_nr.h index 8a057871a..b3f3bece3 100644 --- a/lib/include/srsran/rlc/rlc_um_nr.h +++ b/lib/include/srsran/rlc/rlc_um_nr.h @@ -41,6 +41,9 @@ public: ~rlc_um_nr(); bool configure(const rlc_config_t& cnfg); + // logging helpers + std::string get_rb_name() const; + private: // Transmitter sub-class for NR class rlc_um_nr_tx : public rlc_um_base_tx diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 7321f0490..9229864d1 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -101,7 +101,7 @@ rach_nr_cfg_t make_mac_rach_cfg(const rach_cfg_common_s& asn1_type) return rach_nr_cfg; }; -int make_rlc_config_t(const rlc_cfg_c& asn1_type, rlc_config_t* cfg_out) +int make_rlc_config_t(const rlc_cfg_c& asn1_type, rlc_config_t* cfg_out, uint8_t bearer_id) { rlc_config_t rlc_cfg = rlc_config_t::default_rlc_um_nr_config(); rlc_cfg.rat = srsran_rat_t::nr; @@ -112,7 +112,7 @@ int make_rlc_config_t(const rlc_cfg_c& asn1_type, rlc_config_t* cfg_out) case rlc_cfg_c::types_opts::um_bi_dir: rlc_cfg.rlc_mode = rlc_mode_t::um; rlc_cfg.um_nr.t_reassembly_ms = asn1_type.um_bi_dir().dl_um_rlc.t_reassembly.to_number(); - + rlc_cfg.um_nr.bearer_id = bearer_id; if (asn1_type.um_bi_dir().dl_um_rlc.sn_field_len_present && asn1_type.um_bi_dir().ul_um_rlc.sn_field_len_present && asn1_type.um_bi_dir().dl_um_rlc.sn_field_len != asn1_type.um_bi_dir().ul_um_rlc.sn_field_len) { diff --git a/lib/src/rlc/rlc_um_nr.cc b/lib/src/rlc/rlc_um_nr.cc index 2ad4e50da..1b10d70bc 100644 --- a/lib/src/rlc/rlc_um_nr.cc +++ b/lib/src/rlc/rlc_um_nr.cc @@ -33,12 +33,12 @@ rlc_um_nr::~rlc_um_nr() bool rlc_um_nr::configure(const rlc_config_t& cnfg_) { - // determine bearer name and configure Rx/Tx objects - rb_name = get_rb_name(rrc, lcid, cnfg_.um.is_mrb); - // store config cfg = cnfg_; + // determine bearer name and configure Rx/Tx objects + rb_name = get_rb_name(); + rx.reset(new rlc_um_nr_rx(this)); if (not rx->configure(cfg, rb_name)) { return false; @@ -61,6 +61,22 @@ bool rlc_um_nr::configure(const rlc_config_t& cnfg_) return true; } + +/**************************************************************************** + * Logging helpers + ***************************************************************************/ +std::string rlc_um_nr::get_rb_name() const +{ + fmt::memory_buffer fmtbuf; + // currently we only support DRB 1 (hardcoded) + if (cfg.um_nr.bearer_id == 1) { + fmt::format_to(fmtbuf, "DRB{}", cfg.um_nr.bearer_id); + } else { + fmt::format_to(fmtbuf, "DRB N/A"); + } + return fmt::to_string(fmtbuf); +} + /**************************************************************************** * Tx Subclass implementation ***************************************************************************/ @@ -253,6 +269,8 @@ bool rlc_um_nr::rlc_um_nr_rx::configure(const rlc_config_t& cnfg_, std::string r [this](uint32_t tid) { timer_expired(tid); }); } + rb_name = rb_name_; + return true; } diff --git a/srsenb/src/stack/rrc/rrc_nr.cc b/srsenb/src/stack/rrc/rrc_nr.cc index b4fc56957..3fbfe91f6 100644 --- a/srsenb/src/stack/rrc/rrc_nr.cc +++ b/srsenb/src/stack/rrc/rrc_nr.cc @@ -644,7 +644,7 @@ void rrc_nr::ue::activity_timer_expired(const activity_timeout_type_t type) break; case MSG3_RX_TIMEOUT: { // MSG3 timeout, no need to notify NGAP or LTE stack. Just remove UE - state = rrc_nr_state_t::RRC_IDLE; + state = rrc_nr_state_t::RRC_IDLE; uint32_t rnti_to_rem = rnti; parent->task_sched.defer_task([this, rnti_to_rem]() { parent->rem_user(rnti_to_rem); }); break; @@ -1402,7 +1402,10 @@ int rrc_nr::ue::add_drb() // add RLC bearer srsran::rlc_config_t rlc_cfg; - if (srsran::make_rlc_config_t(cell_group_cfg.rlc_bearer_to_add_mod_list[0].rlc_cfg, &rlc_cfg) != SRSRAN_SUCCESS) { + /// NOTE, we need to pass the radio-bearer to the rlc_config + if (srsran::make_rlc_config_t(cell_group_cfg.rlc_bearer_to_add_mod_list[0].rlc_cfg, + &rlc_cfg, + rlc_bearer.served_radio_bearer.drb_id()) != SRSRAN_SUCCESS) { parent->logger.error("Failed to build RLC config"); return SRSRAN_ERROR; }