From 9c2099f680aa34fe1bfea5baf324e34398dc97d0 Mon Sep 17 00:00:00 2001 From: Carlo Galiotto Date: Fri, 29 Oct 2021 10:47:34 +0200 Subject: [PATCH] rrc,rlc,nr: fix RB label in RLC-NR for UE logs + .. add rb_type in rlc_um_config Signed-off-by: Carlo Galiotto --- lib/include/srsran/asn1/rrc_nr_utils.h | 5 ++++- lib/include/srsran/interfaces/rlc_interface_types.h | 3 +++ lib/src/asn1/rrc_nr_utils.cc | 3 ++- lib/src/rlc/rlc_um_nr.cc | 3 +-- lib/test/asn1/rrc_nr_utils_test.cc | 3 ++- srsenb/src/stack/rrc/rrc_nr.cc | 5 +++-- srsue/src/stack/rrc/rrc_nr.cc | 6 +++++- 7 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index a817f8d4d..0b447713a 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -134,7 +134,10 @@ 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, uint8_t bearer_id = 0); +int make_rlc_config_t(const asn1::rrc_nr::rlc_cfg_c& asn1_type, + uint8_t bearer_id, + rlc_rb_type_t rb_type, + rlc_config_t* rlc_config_out); /*************************** * PDCP Config diff --git a/lib/include/srsran/interfaces/rlc_interface_types.h b/lib/include/srsran/interfaces/rlc_interface_types.h index fdad4e3ce..b4dbc1df3 100644 --- a/lib/include/srsran/interfaces/rlc_interface_types.h +++ b/lib/include/srsran/interfaces/rlc_interface_types.h @@ -70,6 +70,8 @@ inline uint16_t to_number(const rlc_am_nr_sn_size_t& sn_size) return enum_to_number(options, (uint32_t)rlc_mode_t::nulltype, (uint32_t)sn_size); } +typedef enum { RLC_RB_IS_SRB, RLC_RB_IS_DRB } rlc_rb_type_t; + struct rlc_am_config_t { /**************************************************************************** * Configurable parameters @@ -112,6 +114,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 + rlc_rb_type_t rb_type; // This is not in the 3GPP TS 38.322 }; #define RLC_TX_QUEUE_LEN (256) diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 9229864d1..67866ae50 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, uint8_t bearer_id) +int make_rlc_config_t(const rlc_cfg_c& asn1_type, uint8_t bearer_id, rlc_rb_type_t rb_type, rlc_config_t* cfg_out) { rlc_config_t rlc_cfg = rlc_config_t::default_rlc_um_nr_config(); rlc_cfg.rat = srsran_rat_t::nr; @@ -113,6 +113,7 @@ int make_rlc_config_t(const rlc_cfg_c& asn1_type, rlc_config_t* cfg_out, uint8_t 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; + rlc_cfg.um_nr.rb_type = rb_type; 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 1b10d70bc..b548b6cbc 100644 --- a/lib/src/rlc/rlc_um_nr.cc +++ b/lib/src/rlc/rlc_um_nr.cc @@ -61,7 +61,6 @@ bool rlc_um_nr::configure(const rlc_config_t& cnfg_) return true; } - /**************************************************************************** * Logging helpers ***************************************************************************/ @@ -70,7 +69,7 @@ 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); + fmt::format_to(fmtbuf, "{}{}", cfg.um_nr.rb_type == RLC_RB_IS_SRB ? "SRB" : "DRB", cfg.um_nr.bearer_id); } else { fmt::format_to(fmtbuf, "DRB N/A"); } diff --git a/lib/test/asn1/rrc_nr_utils_test.cc b/lib/test/asn1/rrc_nr_utils_test.cc index 8f5eb999b..88c505fa7 100644 --- a/lib/test/asn1/rrc_nr_utils_test.cc +++ b/lib/test/asn1/rrc_nr_utils_test.cc @@ -35,7 +35,8 @@ int test_rlc_config() srslog::fetch_basic_logger("RRC").info("RLC NR Config: \n %s", jw.to_string().c_str()); rlc_config_t rlc_cfg; - TESTASSERT(make_rlc_config_t(rlc_cfg_asn1, &rlc_cfg) == SRSRAN_SUCCESS); + // We hard-code the bearer_id=1 and rb_type=DRB + TESTASSERT(make_rlc_config_t(rlc_cfg_asn1, /* bearer_id */ 1, /*rb_type*/ RLC_RB_IS_DRB, &rlc_cfg) == SRSRAN_SUCCESS); TESTASSERT(rlc_cfg.rat == srsran_rat_t::nr); TESTASSERT(rlc_cfg.um_nr.sn_field_length == rlc_um_nr_sn_size_t::size12bits); return SRSRAN_SUCCESS; diff --git a/srsenb/src/stack/rrc/rrc_nr.cc b/srsenb/src/stack/rrc/rrc_nr.cc index 3fbfe91f6..2600fbb2c 100644 --- a/srsenb/src/stack/rrc/rrc_nr.cc +++ b/srsenb/src/stack/rrc/rrc_nr.cc @@ -1404,8 +1404,9 @@ int rrc_nr::ue::add_drb() srsran::rlc_config_t rlc_cfg; /// 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) { + rlc_bearer.served_radio_bearer.drb_id(), + srsran::RLC_RB_IS_DRB, + &rlc_cfg) != SRSRAN_SUCCESS) { parent->logger.error("Failed to build RLC config"); return SRSRAN_ERROR; } diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 70820e048..4dddf5956 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -457,12 +457,15 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg) uint32_t drb_id = 0; uint32_t srb_id = 0; rlc_config_t rlc_cfg; + // We change this to RLC_RB_IS_DRB if below we detect it's a DRB + rlc_rb_type_t rb_type = RLC_RB_IS_SRB; lc_ch_id = rlc_bearer_cfg.lc_ch_id; if (rlc_bearer_cfg.served_radio_bearer_present == true) { if (rlc_bearer_cfg.served_radio_bearer.type() == rlc_bearer_cfg_s::served_radio_bearer_c_::types::drb_id) { drb_id = rlc_bearer_cfg.served_radio_bearer.drb_id(); add_lcid_drb(lc_ch_id, drb_id); + rb_type = RLC_RB_IS_DRB; } } else { logger.error("In RLC bearer cfg does not contain served radio bearer"); @@ -470,7 +473,8 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg) } if (rlc_bearer_cfg.rlc_cfg_present == true) { - if (srsran::make_rlc_config_t(rlc_bearer_cfg.rlc_cfg, &rlc_cfg) != SRSRAN_SUCCESS) { + uint8_t bearer_id = static_cast(rb_type == RLC_RB_IS_SRB ? srb_id : drb_id); + if (srsran::make_rlc_config_t(rlc_bearer_cfg.rlc_cfg, bearer_id, rb_type, &rlc_cfg) != SRSRAN_SUCCESS) { logger.error("Failed to build RLC config"); return false; }