From 43a267884118cc791cc606bc0eec90ef0d929795 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 23 Feb 2022 18:22:22 +0000 Subject: [PATCH] gnb,config: Added five_qi_cfg to rrc_nr_config_t. Starting to add five_qi_field to parse the rb.conf for 5g configuration. --- srsenb/rb.conf.example | 2 -- srsenb/src/enb_cfg_parser.cc | 34 ++++++++++++++++++++++------ srsenb/src/enb_cfg_parser.h | 21 +++++++++++++---- srsenb/src/main.cc | 2 +- srsgnb/hdr/stack/rrc/rrc_nr_config.h | 8 +++++++ 5 files changed, 53 insertions(+), 14 deletions(-) diff --git a/srsenb/rb.conf.example b/srsenb/rb.conf.example index de1cb8f33..686b18964 100644 --- a/srsenb/rb.conf.example +++ b/srsenb/rb.conf.example @@ -37,7 +37,6 @@ // } qci_config = ( - { qci=7; pdcp_config = { @@ -91,5 +90,4 @@ qci_config = ( dl_max_retx_thresh = 32; }; } - ); diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 15d9e9061..9ff7ae9dd 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -635,6 +635,22 @@ int field_qci::parse(libconfig::Setting& root) return 0; } +int field_five_qi::parse(libconfig::Setting& root) +{ + uint32_t nof_five_qi = (uint32_t)root.getLength(); + + for (uint32_t i = 0; i < nof_five_qi; i++) { + libconfig::Setting& q = root[i]; + + uint32_t five_qi = q["five_qi"]; + + rrc_nr_cfg_five_qi_t five_qi_cfg; + + cfg.insert(std::make_pair(five_qi, five_qi_cfg)); + } + + return 0; +} namespace rr_sections { int parse_rr(all_args_t* args_, rrc_cfg_t* rrc_cfg_, rrc_nr_cfg_t* rrc_nr_cfg_) @@ -1223,15 +1239,15 @@ int parse_cfg_files(all_args_t* args_, rrc_cfg_t* rrc_cfg_, rrc_nr_cfg_t* rrc_nr } try { - if (drb_sections::parse_drb(args_, rrc_cfg_) != SRSRAN_SUCCESS) { - fprintf(stderr, "Error parsing DRB configuration\n"); + if (rb_sections::parse_rb(args_, rrc_cfg_, rrc_nr_cfg_) != SRSRAN_SUCCESS) { + fprintf(stderr, "Error parsing RB configuration\n"); return SRSRAN_ERROR; } } catch (const SettingTypeException& stex) { - fprintf(stderr, "Error parsing DRB configuration: %s\n", stex.getPath()); + fprintf(stderr, "Error parsing RB configuration: %s\n", stex.getPath()); return SRSRAN_ERROR; } catch (const ConfigException& cex) { - fprintf(stderr, "Error parsing DRB configuration\n"); + fprintf(stderr, "Error parsing RB configuration\n"); return SRSRAN_ERROR; } @@ -2102,9 +2118,9 @@ int parse_sibs(all_args_t* args_, rrc_cfg_t* rrc_cfg_, srsenb::phy_cfg_t* phy_co } // namespace sib_sections -namespace drb_sections { +namespace rb_sections { -int parse_drb(all_args_t* args_, rrc_cfg_t* rrc_cfg_) +int parse_rb(all_args_t* args_, rrc_cfg_t* rrc_cfg_, rrc_nr_cfg_t* rrc_nr_cfg_) { parser::section srb1("srb1_config"); bool srb1_present = false; @@ -2125,11 +2141,15 @@ int parse_drb(all_args_t* args_, rrc_cfg_t* rrc_cfg_) parser::section qci("qci_config"); qci.add_field(new field_qci(rrc_cfg_->qci_cfg)); + parser::section five_qi("five_qi_config"); + five_qi.add_field(new field_five_qi(rrc_nr_cfg_->five_qi_cfg)); + // Run parser with two sections parser p(args_->enb_files.rb_config); p.add_section(&srb1); p.add_section(&srb2); p.add_section(&qci); + p.add_section(&five_qi); int ret = p.parse(); if (not srb1_present) { @@ -2142,6 +2162,6 @@ int parse_drb(all_args_t* args_, rrc_cfg_t* rrc_cfg_) return ret; } -} // namespace drb_sections +} // namespace rb_sections } // namespace srsenb diff --git a/srsenb/src/enb_cfg_parser.h b/srsenb/src/enb_cfg_parser.h index 569cdd4e2..4c52338c9 100644 --- a/srsenb/src/enb_cfg_parser.h +++ b/srsenb/src/enb_cfg_parser.h @@ -22,6 +22,7 @@ #include #include "srsenb/hdr/stack/rrc/rrc.h" +#include "srsgnb/hdr/stack/rrc/rrc_nr_config.h" #include "srsran/asn1/asn1_utils.h" namespace srsenb { @@ -58,11 +59,12 @@ int parse_sibs(all_args_t* args_, rrc_cfg_t* rrc_cfg_, srsenb::phy_cfg_t* phy_co } // namespace sib_sections -// drb.conf parsing -namespace drb_sections { +// rb.conf parsing +namespace rb_sections { -int parse_drb(all_args_t* args, rrc_cfg_t* rrc_cfg); -} // namespace drb_sections +int parse_rb(all_args_t* args, rrc_cfg_t* rrc_cfg, rrc_nr_cfg_t* rrc_nr_cfg); + +} // namespace rb_sections // rr.conf parsing namespace rr_sections { @@ -189,6 +191,17 @@ private: std::map& cfg; }; +class field_five_qi final : public parser::field_itf +{ +public: + explicit field_five_qi(std::map& cfg_) : cfg(cfg_) {} + const char* get_name() override { return "field_5qi"; } + + int parse(Setting& root) override; + +private: + std::map& cfg; +}; // ASN1 parsers class field_asn1 : public parser::field_itf diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 975abee54..33d739088 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -460,7 +460,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) } if (!config_exists(args->enb_files.rb_config, "rb.conf")) { - cout << "Failed to read DRB configuration file " << args->enb_files.rb_config << " - exiting" << endl; + cout << "Failed to read RB configuration file " << args->enb_files.rb_config << " - exiting" << endl; exit(1); } diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_config.h b/srsgnb/hdr/stack/rrc/rrc_nr_config.h index 555f58941..b4c7848f5 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_config.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_config.h @@ -45,6 +45,12 @@ struct rrc_cell_cfg_nr_t { typedef std::vector rrc_cell_list_nr_t; +struct rrc_nr_cfg_five_qi_t { + bool configured = false; + asn1::rrc_nr::pdcp_cfg_s pdcp_cfg; + asn1::rrc_nr::rlc_cfg_c rlc_cfg; +}; + struct rrc_nr_cfg_t { rrc_cell_list_nr_t cell_list; uint32_t inactivity_timeout_ms = 100000; @@ -53,6 +59,8 @@ struct rrc_nr_cfg_t { uint16_t mnc; bool is_standalone; + std::map five_qi_cfg; + std::array nea_preference_list; std::array nia_preference_list;