From 15484e9472b8190d303e15dd7d53e21babcde428 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 4 May 2021 21:50:13 +0100 Subject: [PATCH] rrc - make t304 configurable via rr.conf --- .../interfaces/enb_rrc_interface_types.h | 31 ++++++++++--------- srsenb/hdr/parser.h | 6 ++++ srsenb/rr.conf.example | 1 + srsenb/src/enb_cfg_parser.cc | 13 ++++++++ srsenb/src/stack/rrc/rrc_mobility.cc | 2 +- srsenb/src/stack/upper/gtpu.cc | 3 ++ srsenb/test/upper/gtpu_test.cc | 4 ++- 7 files changed, 43 insertions(+), 17 deletions(-) diff --git a/lib/include/srsran/interfaces/enb_rrc_interface_types.h b/lib/include/srsran/interfaces/enb_rrc_interface_types.h index 093bcb343..182e52824 100644 --- a/lib/include/srsran/interfaces/enb_rrc_interface_types.h +++ b/lib/include/srsran/interfaces/enb_rrc_interface_types.h @@ -47,21 +47,22 @@ struct rrc_meas_cfg_t { // Cell/Sector configuration struct cell_cfg_t { - uint32_t rf_port; - uint32_t cell_id; - uint16_t tac; - uint32_t pci; - uint16_t root_seq_idx; - uint32_t dl_earfcn; - double dl_freq_hz; - uint32_t ul_earfcn; - double ul_freq_hz; - int target_pucch_sinr_db; - int target_pusch_sinr_db; - uint32_t initial_dl_cqi; - bool enable_phr_handling; - std::vector scell_list; - rrc_meas_cfg_t meas_cfg; + uint32_t rf_port; + uint32_t cell_id; + uint16_t tac; + uint32_t pci; + uint16_t root_seq_idx; + uint32_t dl_earfcn; + double dl_freq_hz; + uint32_t ul_earfcn; + double ul_freq_hz; + int target_pucch_sinr_db; + int target_pusch_sinr_db; + uint32_t initial_dl_cqi; + bool enable_phr_handling; + asn1::rrc::mob_ctrl_info_s::t304_e_ t304; + std::vector scell_list; + rrc_meas_cfg_t meas_cfg; }; typedef std::vector cell_list_t; diff --git a/srsenb/hdr/parser.h b/srsenb/hdr/parser.h index cea034e04..fb71ca7a3 100644 --- a/srsenb/hdr/parser.h +++ b/srsenb/hdr/parser.h @@ -466,6 +466,12 @@ int opt_number_to_enum(EnumType& enum_val, bool& presence_flag, Setting& root, c return parse_opt_field(enum_val, root, name, number_to_enum, &presence_flag); } +template +int default_number_to_enum(EnumType& enum_val, Setting& root, const char* name, typename EnumType::options default_val) +{ + return parse_default_field(enum_val, root, name, EnumType(default_val), number_to_enum); +} + } // namespace asn1_parsers } // namespace srsenb diff --git a/srsenb/rr.conf.example b/srsenb/rr.conf.example index 1390f179f..37db345cd 100644 --- a/srsenb/rr.conf.example +++ b/srsenb/rr.conf.example @@ -65,6 +65,7 @@ cell_list = // target_pusch_sinr = -1; // target_pucch_sinr = -1; // allowed_meas_bw = 6; + // t304 = 2000; // in msec. possible values: 50, 100, 150, 200, 500, 1000, 2000 // CA cells scell_list = ( diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 4cdf72269..110bb564f 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -44,6 +44,17 @@ using namespace asn1::rrc; namespace srsenb { +template +bool contains_value(T value, const std::initializer_list& list) +{ + for (auto& v : list) { + if (v == value) { + return true; + } + } + return false; +} + bool sib_is_present(const sched_info_list_l& l, sib_type_e sib_num) { for (uint32_t i = 0; i < l.size(); i++) { @@ -754,6 +765,8 @@ static int parse_cell_list(all_args_t* args, rrc_cfg_t* rrc_cfg, Setting& root) HANDLEPARSERCODE(parse_default_field(cell_cfg.enable_phr_handling, cellroot, "enable_phr_handling", false)); parse_default_field(cell_cfg.meas_cfg.allowed_meas_bw, cellroot, "allowed_meas_bw", 6u); srsran_assert(srsran::is_lte_cell_nof_prb(cell_cfg.meas_cfg.allowed_meas_bw), "Invalid measurement Bandwidth"); + HANDLEPARSERCODE(asn1_parsers::default_number_to_enum( + cell_cfg.t304, cellroot, "t304", asn1::rrc::mob_ctrl_info_s::t304_opts::ms2000)); if (cellroot.exists("ho_active") and cellroot["ho_active"]) { HANDLEPARSERCODE(parse_meas_cell_list(&cell_cfg.meas_cfg, cellroot["meas_cell_list"])); diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 95bf9d8ee..16b9a4e77 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -491,7 +491,7 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s recfg_r8.mob_ctrl_info_present = true; auto& mob_info = recfg_r8.mob_ctrl_info; mob_info.target_pci = target_cell.cell_cfg.pci; - mob_info.t304.value = mob_ctrl_info_s::t304_opts::ms2000; // TODO: make it reconfigurable + mob_info.t304 = target_cell.cell_cfg.t304; mob_info.new_ue_id.from_number(rrc_ue->rnti); mob_info.rr_cfg_common.pusch_cfg_common = target_cell.sib2.rr_cfg_common.pusch_cfg_common; mob_info.rr_cfg_common.prach_cfg.root_seq_idx = target_cell.sib2.rr_cfg_common.prach_cfg.root_seq_idx; diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index 1a0d242d3..d873e5e86 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -247,6 +247,9 @@ void gtpu_tunnel_manager::set_tunnel_priority(uint32_t before_teid, uint32_t aft before_tun.rx_timer = task_sched.get_unique_timer(); before_tun.rx_timer.set(gtpu_args->indirect_tunnel_timeout_msec, [this, before_teid](uint32_t tid) { // Note: This will self-destruct the callback object + logger.info("Forwarding tunnel " TEID_IN_FMT "being closed after timeout=%d msec", + before_teid, + gtpu_args->indirect_tunnel_timeout_msec); remove_tunnel(before_teid); }); before_tun.rx_timer.run(); diff --git a/srsenb/test/upper/gtpu_test.cc b/srsenb/test/upper/gtpu_test.cc index 15eaf1827..ca2092a11 100644 --- a/srsenb/test/upper/gtpu_test.cc +++ b/srsenb/test/upper/gtpu_test.cc @@ -155,8 +155,10 @@ void test_gtpu_tunnel_manager() uint32_t sgw_addr = ntohl(sgw_sockaddr.sin_addr.s_addr); const uint32_t drb1_lcid = 3; srsran::task_scheduler task_sched; + gtpu_args_t gtpu_args = {}; gtpu_tunnel_manager tunnels(&task_sched, srslog::fetch_basic_logger("GTPU")); + tunnels.init(gtpu_args, nullptr); TESTASSERT(tunnels.find_tunnel(0) == nullptr); TESTASSERT(tunnels.find_rnti_lcid_tunnels(0x46, drb1_lcid).empty()); TESTASSERT(tunnels.find_rnti_tunnels(0x46) == nullptr); @@ -324,7 +326,7 @@ int test_gtpu_direct_tunneling(tunnel_test_event event) TESTASSERT(tenb_pdcp.last_sdu == nullptr); if (event == tunnel_test_event::wait_end_marker_timeout) { // TEST: EndMarker does not reach TeNB, but there is a timeout that will resume the new GTPU tunnel - for (size_t i = 0; i < 1000; ++i) { + for (size_t i = 0; i < gtpu_args.indirect_tunnel_timeout_msec + 1; ++i) { task_sched.tic(); } } else {