From 18a85adc499395edcbe11d38685740084aef6138 Mon Sep 17 00:00:00 2001 From: Carlo Galiotto Date: Tue, 23 Nov 2021 15:48:41 +0100 Subject: [PATCH] rrc-nr: trigger RRCReconfifguration from ... establish_EPS_bearer Signed-off-by: Carlo Galiotto --- srsgnb/hdr/stack/rrc/rrc_nr.h | 1 - srsgnb/hdr/stack/rrc/rrc_nr_ue.h | 2 +- srsgnb/src/stack/rrc/rrc_nr.cc | 14 ++++---------- srsgnb/src/stack/rrc/rrc_nr_ue.cc | 8 ++++---- srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc | 4 ++-- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/srsgnb/hdr/stack/rrc/rrc_nr.h b/srsgnb/hdr/stack/rrc/rrc_nr.h index 6891aa661..eac2f93f8 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr.h @@ -103,7 +103,6 @@ public: void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) final; int set_aggregate_max_bitrate(uint16_t rnti, const asn1::ngap_nr::ue_aggregate_maximum_bit_rate_s& rates) final; int allocate_lcid(uint16_t rnti) final; - int start_rrc_reconfiguration(uint16_t rnti); // logging typedef enum { Rx = 0, Tx } direction_t; diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h index 910bf5986..d48093894 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_ue.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_ue.h @@ -102,7 +102,7 @@ private: int update_rlc_bearers(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff); /// Update MAC based on ASN1 message - int update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff, bool is_config_complete); + int update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_config, bool is_config_complete); int pack_rrc_reconfiguration(asn1::dyn_octstring& packed_rrc_reconfig); int pack_secondary_cell_group_cfg(asn1::dyn_octstring& packed_secondary_cell_config); diff --git a/srsgnb/src/stack/rrc/rrc_nr.cc b/srsgnb/src/stack/rrc/rrc_nr.cc index f1b0b2614..fff08d71f 100644 --- a/srsgnb/src/stack/rrc/rrc_nr.cc +++ b/srsgnb/src/stack/rrc/rrc_nr.cc @@ -609,6 +609,9 @@ int rrc_nr::establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran: } users[rnti]->establish_eps_bearer(pdu_session_id, nas_pdu, lcid); + + // TODO: verify whether this is the best place where to call the RRCReconfig + users[rnti]->send_rrc_reconfiguration(); return SRSRAN_SUCCESS; } @@ -634,16 +637,7 @@ void rrc_nr::write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) } users[rnti]->send_dl_information_transfer(std::move(sdu)); } -int rrc_nr::start_rrc_reconfiguration(uint16_t rnti) -{ - auto user_it = users.find(rnti); - if (user_it == users.end()){ - logger.error("Starting RRCRecofiguration failed - rnti=0x%x not found", rnti); - return SRSRAN_ERROR; - } - user_it->second->send_rrc_reconfiguration(); - return SRSRAN_SUCCESS; -} + /******************************************************************************* Interface for EUTRA RRC *******************************************************************************/ diff --git a/srsgnb/src/stack/rrc/rrc_nr_ue.cc b/srsgnb/src/stack/rrc/rrc_nr_ue.cc index 9f06e2e54..cb47a84c8 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_ue.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_ue.cc @@ -1245,15 +1245,15 @@ int rrc_nr::ue::update_rlc_bearers(const asn1::rrc_nr::cell_group_cfg_s& cell_gr return SRSRAN_SUCCESS; } -int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_diff, bool is_config_complete) +int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_config, bool is_config_complete) { if (not is_config_complete) { // Release bearers - for (uint8_t lcid : cell_group_diff.rlc_bearer_to_release_list) { + for (uint8_t lcid : cell_group_config.rlc_bearer_to_release_list) { uecfg.ue_bearers[lcid].direction = mac_lc_ch_cfg_t::IDLE; } - for (const rlc_bearer_cfg_s& bearer : cell_group_diff.rlc_bearer_to_add_mod_list) { + for (const rlc_bearer_cfg_s& bearer : cell_group_config.rlc_bearer_to_add_mod_list) { uecfg.ue_bearers[bearer.lc_ch_id].direction = mac_lc_ch_cfg_t::BOTH; if (bearer.mac_lc_ch_cfg.ul_specific_params_present) { uecfg.ue_bearers[bearer.lc_ch_id].priority = bearer.mac_lc_ch_cfg.ul_specific_params.prio; @@ -1265,7 +1265,7 @@ int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_diff, bool is_conf } } } else { - auto& pdcch = cell_group_diff.sp_cell_cfg.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup(); + auto& pdcch = cell_group_config.sp_cell_cfg.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup(); for (auto& ss : pdcch.search_spaces_to_add_mod_list) { uecfg.phy_cfg.pdcch.search_space_present[ss.search_space_id] = true; uecfg.phy_cfg.pdcch.search_space[ss.search_space_id] = diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc index 459f39703..eed892370 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc @@ -256,10 +256,10 @@ void test_rrc_nr_reconfiguration(srsran::task_scheduler& task_sched, // create an unbounded_octstring object that contains a random NAS message (we simulate a NAS message) asn1::unbounded_octstring NAS_msg; NAS_msg.from_string("c574defc80ba722bffb8eacb6f8a163e3222cf1542ac529f6980bb15e0bf12d9f2b29f11fb458ec9"); - rrc_obj.establish_rrc_bearer(rnti, 1, NAS_msg, srsran::srb_to_lcid(srsran::nr_srb::srb1)); // STEP 2 - Trigger and send RRCReconfiguration command (gNB -> UE) - rrc_obj.start_rrc_reconfiguration(rnti); + rrc_obj.establish_rrc_bearer(rnti, 1, NAS_msg, srsran::srb_to_lcid(srsran::nr_srb::srb1)); + //rrc_obj.start_rrc_reconfiguration(rnti); // Test whether there exists the SRB1 initiated in the Connection Establishment // We test this as the SRB1 was set up in a different function