From 72cf3a1cecc350826c926741a88a738ea95fe048 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 27 May 2021 22:01:56 +0100 Subject: [PATCH] Added RLC SRB1 and SRB2 configuration ability. The configuration was added to drb.conf --- srsenb/drb.conf.example | 33 ++++++++++++++ srsenb/hdr/stack/rrc/rrc_config.h | 2 + srsenb/src/enb_cfg_parser.cc | 76 ++++++++++++++++++++++++++++++- srsenb/src/enb_cfg_parser.h | 12 +++++ srsenb/src/stack/rrc/rrc.cc | 10 ++++ srsenb/src/stack/rrc/rrc_ue.cc | 8 +++- 6 files changed, 139 insertions(+), 2 deletions(-) diff --git a/srsenb/drb.conf.example b/srsenb/drb.conf.example index 55a1a1491..6c1220ed6 100644 --- a/srsenb/drb.conf.example +++ b/srsenb/drb.conf.example @@ -1,5 +1,38 @@ // All times are in ms. Use -1 for infinity, where available +srb1_config = ( +{ + rlc_config = { + ul_am = { + t_poll_retx = 45; + poll_pdu = -1; + poll_byte = -1; + max_retx_thresh = 4; + }; + dl_am = { + t_reordering = 35; + t_status_prohibit = 0; + }; + }; +} +) + +srb2_config = ( +{ + rlc_config = { + ul_am = { + t_poll_retx = 45; + poll_pdu = -1; + poll_byte = -1; + max_retx_thresh = 4; + }; + dl_am = { + t_reordering = 35; + t_status_prohibit = 0; + }; + }; +} +) qci_config = ( diff --git a/srsenb/hdr/stack/rrc/rrc_config.h b/srsenb/hdr/stack/rrc/rrc_config.h index fb5e7ca5a..ce30a8e6e 100644 --- a/srsenb/hdr/stack/rrc/rrc_config.h +++ b/srsenb/hdr/stack/rrc/rrc_config.h @@ -62,6 +62,8 @@ struct rrc_cfg_t { uint32_t max_mac_dl_kos; uint32_t max_mac_ul_kos; uint32_t rlf_release_timer_ms; + asn1::rrc::rlc_cfg_c srb1_cfg; + asn1::rrc::rlc_cfg_c srb2_cfg; }; constexpr uint32_t UE_PCELL_CC_IDX = 0; diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 49dda24e2..adec87116 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -397,6 +397,69 @@ int phr_cnfg_parser::parse(libconfig::Setting& root) return 0; } +int field_srb::parse(libconfig::Setting& root) +{ + libconfig::Setting& q = root[0]; + + // Parse RLC AM section + rlc_cfg_c* rlc_cfg = &cfg; + if (q["rlc_config"].exists("ul_am") && q["rlc_config"].exists("dl_am")) { + rlc_cfg->set_am(); + } + + // RLC-UM Should not exist section + if (q["rlc_config"].exists("ul_um") || q["rlc_config"].exists("dl_um")) { + ERROR("Error SRBs must be AM."); + return -1; + } + + // Parse RLC-AM section + if (q["rlc_config"].exists("ul_am")) { + ul_am_rlc_s* am_rlc = &rlc_cfg->am().ul_am_rlc; + + field_asn1_enum_number t_poll_retx("t_poll_retx", &am_rlc->t_poll_retx); + if (t_poll_retx.parse(q["rlc_config"]["ul_am"])) { + ERROR("Error can't find t_poll_retx in section ul_am"); + return -1; + } + + field_asn1_enum_number poll_pdu("poll_pdu", &am_rlc->poll_pdu); + if (poll_pdu.parse(q["rlc_config"]["ul_am"])) { + ERROR("Error can't find poll_pdu in section ul_am"); + return -1; + } + + field_asn1_enum_number poll_byte("poll_byte", &am_rlc->poll_byte); + if (poll_byte.parse(q["rlc_config"]["ul_am"])) { + ERROR("Error can't find poll_byte in section ul_am"); + return -1; + } + + field_asn1_enum_number max_retx_thresh("max_retx_thresh", &am_rlc->max_retx_thres); + if (max_retx_thresh.parse(q["rlc_config"]["ul_am"])) { + ERROR("Error can't find max_retx_thresh in section ul_am"); + return -1; + } + } + + if (q["rlc_config"].exists("dl_am")) { + dl_am_rlc_s* am_rlc = &rlc_cfg->am().dl_am_rlc; + + field_asn1_enum_number t_reordering("t_reordering", &am_rlc->t_reordering); + if (t_reordering.parse(q["rlc_config"]["dl_am"])) { + ERROR("Error can't find t_reordering in section dl_am"); + return -1; + } + + field_asn1_enum_number t_status_prohibit("t_status_prohibit", &am_rlc->t_status_prohibit); + if (t_status_prohibit.parse(q["rlc_config"]["dl_am"])) { + ERROR("Error can't find t_status_prohibit in section dl_am"); + return -1; + } + } + return 0; +} + int field_qci::parse(libconfig::Setting& root) { auto nof_qci = (uint32_t)root.getLength(); @@ -1664,9 +1727,20 @@ namespace drb_sections { int parse_drb(all_args_t* args_, rrc_cfg_t* rrc_cfg_) { + parser::section srb1("srb1_config"); + srb1.add_field(new field_srb(rrc_cfg_->srb1_cfg)); + parser::section srb2("srb2_config"); + srb1.add_field(new field_srb(rrc_cfg_->srb2_cfg)); parser::section qci("qci_config"); qci.add_field(new field_qci(rrc_cfg_->qci_cfg)); - return parser::parse_section(args_->enb_files.drb_config, &qci); + + // Run parser with two sections + parser p(args_->enb_files.drb_config); + p.add_section(&srb1); + p.add_section(&srb2); + p.add_section(&qci); + + return p.parse(); } } // namespace drb_sections diff --git a/srsenb/src/enb_cfg_parser.h b/srsenb/src/enb_cfg_parser.h index 007015e68..98f0265cb 100644 --- a/srsenb/src/enb_cfg_parser.h +++ b/srsenb/src/enb_cfg_parser.h @@ -146,6 +146,18 @@ private: uint32_t default_offset; }; +class field_srb final : public parser::field_itf +{ +public: + explicit field_srb(asn1::rrc::rlc_cfg_c& cfg_) : cfg(cfg_) {} + const char* get_name() override { return "field_srb"; } + + int parse(Setting& root) override; + +private: + asn1::rrc::rlc_cfg_c& cfg; +}; + class field_qci final : public parser::field_itf { public: diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index cd157ae3f..013941252 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -103,6 +103,16 @@ int32_t rrc::init(const rrc_cfg_t& cfg_, running = true; + if (logger.debug.enabled()) { + asn1::json_writer js{}; + cfg.srb1_cfg.to_json(js); + logger.debug("SRB1 configuration: %s", js.to_string().c_str()); + } + if (logger.debug.enabled()) { + asn1::json_writer js{}; + cfg.srb2_cfg.to_json(js); + logger.debug("SRB2 configuration: %s", js.to_string().c_str()); + } return SRSRAN_SUCCESS; } diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index a634bf5a6..9bd7eaac6 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -1411,7 +1411,13 @@ void rrc::ue::apply_pdcp_drb_updates(const rr_cfg_ded_s& pending_rr_cfg) void rrc::ue::apply_rlc_rb_updates(const rr_cfg_ded_s& pending_rr_cfg) { for (const srb_to_add_mod_s& srb : pending_rr_cfg.srb_to_add_mod_list) { - parent->rlc->add_bearer(rnti, srb.srb_id, srsran::rlc_config_t::srb_config(srb.srb_id)); + if (srb.srb_id == 1) { + parent->rlc->add_bearer(rnti, srb.srb_id, srsran::make_rlc_config_t(parent->cfg.srb1_cfg)); + } else if (srb.srb_id == 2) { + parent->rlc->add_bearer(rnti, srb.srb_id, srsran::make_rlc_config_t(parent->cfg.srb2_cfg)); + } else { + parent->rlc->add_bearer(rnti, srb.srb_id, srsran::rlc_config_t::srb_config(srb.srb_id)); + } } if (pending_rr_cfg.drb_to_release_list.size() > 0) { for (uint8_t drb_id : pending_rr_cfg.drb_to_release_list) {