From c46402c836e5635a5e3f58a1dcff372dc47d6397 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 6 Oct 2020 20:02:05 +0100 Subject: [PATCH] fix phy configuration during handover on srsenb. The function srsenb::rrc::ue::fill_scell_to_addmod_list assumes that the phy_cfg of the PCell is up-to-date, which was not the case. With this PR, the srsenb rrc updates the phy_cfg before the ho cmd is sent, but, in the case of intra-enb ho, the updates are not submitted to the phy before the reception of the crnti mac ce --- srsenb/hdr/stack/rrc/rrc_mobility.h | 7 +++---- srsenb/hdr/stack/rrc/rrc_ue.h | 2 +- srsenb/src/stack/rrc/mac_controller.cc | 5 +++++ srsenb/src/stack/rrc/rrc_mobility.cc | 13 +++++++++---- srsenb/src/stack/rrc/rrc_ue.cc | 8 ++++---- srsenb/test/upper/rrc_mobility_test.cc | 6 +++++- srsenb/test/upper/test_helpers.h | 7 ++++++- 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/srsenb/hdr/stack/rrc/rrc_mobility.h b/srsenb/hdr/stack/rrc/rrc_mobility.h index f9be09e94..e3f7ebdb0 100644 --- a/srsenb/hdr/stack/rrc/rrc_mobility.h +++ b/srsenb/hdr/stack/rrc/rrc_mobility.h @@ -143,10 +143,9 @@ private: // states struct idle_st {}; struct intraenb_ho_st { - const cell_info_common* target_cell = nullptr; - const cell_info_common* source_cell = nullptr; - uint16_t last_temp_crnti = SRSLTE_INVALID_RNTI; - asn1::rrc::rrc_conn_recfg_r8_ies_s pending_ho_cmd; + const cell_info_common* target_cell = nullptr; + const cell_info_common* source_cell = nullptr; + uint16_t last_temp_crnti = SRSLTE_INVALID_RNTI; void enter(rrc_mobility* f, const ho_meas_report_ev& meas_report); }; diff --git a/srsenb/hdr/stack/rrc/rrc_ue.h b/srsenb/hdr/stack/rrc/rrc_ue.h index 3bd406ec1..9aa75625a 100644 --- a/srsenb/hdr/stack/rrc/rrc_ue.h +++ b/srsenb/hdr/stack/rrc/rrc_ue.h @@ -172,7 +172,7 @@ private: * * @param reconfig_r8 ASN1 reconfiguration message */ - void apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& reconfig_r8); + void apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& reconfig_r8, bool update_phy); /** * Reconfigures PDCP bearers diff --git a/srsenb/src/stack/rrc/mac_controller.cc b/srsenb/src/stack/rrc/mac_controller.cc index 50090a48d..ddc4aa9c0 100644 --- a/srsenb/src/stack/rrc/mac_controller.cc +++ b/srsenb/src/stack/rrc/mac_controller.cc @@ -172,6 +172,11 @@ void rrc::ue::mac_controller::handle_con_reconf_complete() } } + // PUSCH UCI configuration + current_sched_ue_cfg.uci_offset.I_offset_cqi = rrc_cfg->pusch_cfg.beta_offset_cqi_idx; + current_sched_ue_cfg.uci_offset.I_offset_ack = rrc_cfg->pusch_cfg.beta_offset_ack_idx; + current_sched_ue_cfg.uci_offset.I_offset_ri = rrc_cfg->pusch_cfg.beta_offset_ri_idx; + // Setup all bearers apply_current_bearers_cfg(); diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 78aae8596..8486ca489 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -878,6 +878,9 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s recfg_r8.rr_cfg_ded.phys_cfg_ded_present = true; phys_cfg_ded_s& phy_cfg = recfg_r8.rr_cfg_ded.phys_cfg_ded; + phy_cfg.pusch_cfg_ded_present = true; + phy_cfg.pusch_cfg_ded = rrc_enb->cfg.pusch_cfg; + // Set SR in new CC phy_cfg.sched_request_cfg_present = true; auto& sr_setup = phy_cfg.sched_request_cfg.set_setup(); @@ -908,6 +911,9 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s ant_info.tx_mode.value = ant_info_ded_s::tx_mode_e_::tm1; ant_info.ue_tx_ant_sel.set(setup_e::release); + rrc_ue->apply_setup_phy_common(target_cell.sib2.rr_cfg_common, false); + rrc_ue->apply_reconf_phy_config(recfg_r8, false); + // Add MeasConfig of target cell auto target_earfcns = get_cfg_intraenb_measobj_earfcns(*rrc_enb->cell_common_list, target_cell.enb_cc_idx); recfg_r8.meas_cfg_present = update_ue_var_meas_cfg(src_dl_earfcn, target_earfcns, &recfg_r8.meas_cfg); @@ -1141,7 +1147,7 @@ void rrc::ue::rrc_mobility::handle_ho_req(idle_st& s, const ho_req_rx_ev& ho_req // Update MAC rrc_ue->mac_ctrl->handle_ho_prep(hoprep_r8, recfg_r8); // Apply PHY updates - rrc_ue->apply_reconf_phy_config(recfg_r8); + rrc_ue->apply_reconf_phy_config(recfg_r8, true); /* send S1AP HandoverRequestAcknowledge */ std::vector > admitted_erabs; @@ -1324,7 +1330,6 @@ void rrc::ue::rrc_mobility::intraenb_ho_st::enter(rrc_mobility* f, const ho_meas /* Prepare RRC Reconf Message with mobility info */ dl_dcch_msg_s dl_dcch_msg; f->fill_mobility_reconf_common(dl_dcch_msg, *target_cell, source_cell->cell_cfg.dl_earfcn); - pending_ho_cmd = dl_dcch_msg.msg.c1().rrc_conn_recfg().crit_exts.c1().rrc_conn_recfg_r8(); // Send DL-DCCH Message via current PCell if (not f->rrc_ue->send_dl_dcch(&dl_dcch_msg)) { @@ -1347,8 +1352,8 @@ void rrc::ue::rrc_mobility::handle_crnti_ce(intraenb_ho_st& s, const user_crnti_ // Change PCell in MAC/Scheduler rrc_ue->mac_ctrl->handle_crnti_ce(ev.temp_crnti); - rrc_ue->apply_setup_phy_common(s.target_cell->sib2.rr_cfg_common, false); - rrc_ue->apply_reconf_phy_config(s.pending_ho_cmd); + // finally apply new phy changes + rrc_enb->phy->set_config(rrc_ue->rnti, rrc_ue->phy_rrc_dedicated_list); rrc_ue->ue_security_cfg.regenerate_keys_handover(s.target_cell->cell_cfg.pci, s.target_cell->cell_cfg.dl_earfcn); rrc_ue->bearer_list.reest_bearers(); diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 45523aa7d..a6df2e993 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -537,7 +537,7 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) return; } - apply_reconf_phy_config(*conn_reconf); + apply_reconf_phy_config(*conn_reconf, true); // setup SRB2/DRBs in PDCP and RLC apply_pdcp_srb_updates(); @@ -622,7 +622,7 @@ void rrc::ue::send_connection_reconf_upd(srslte::unique_byte_buffer_t pdu) phy_cfg->cqi_report_cfg.cqi_report_mode_aperiodic = cqi_report_mode_aperiodic_e::rm30; } } - apply_reconf_phy_config(reconfig_r8); + apply_reconf_phy_config(reconfig_r8, true); phy_cfg->sched_request_cfg.setup().sr_cfg_idx = cell_ded_list.get_sr_res()->sr_I; phy_cfg->sched_request_cfg.setup().sr_pucch_res_idx = cell_ded_list.get_sr_res()->sr_N_pucch; @@ -1364,7 +1364,7 @@ void rrc::ue::apply_setup_phy_config_dedicated(const asn1::rrc::phys_cfg_ded_s& } } -void rrc::ue::apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& reconfig_r8) +void rrc::ue::apply_reconf_phy_config(const rrc_conn_recfg_r8_ies_s& reconfig_r8, bool update_phy) { // Return if no cell is supported if (phy_rrc_dedicated_list.empty()) { @@ -1397,7 +1397,7 @@ void rrc::ue::apply_reconf_phy_config(const asn1::rrc::rrc_conn_recfg_r8_ies_s& } // Send configuration to physical layer - if (parent->phy != nullptr) { + if (parent->phy != nullptr and update_phy) { parent->phy->set_config(rnti, phy_rrc_dedicated_list); } } diff --git a/srsenb/test/upper/rrc_mobility_test.cc b/srsenb/test/upper/rrc_mobility_test.cc index d7d583606..df10a8667 100644 --- a/srsenb/test/upper/rrc_mobility_test.cc +++ b/srsenb/test/upper/rrc_mobility_test.cc @@ -574,6 +574,7 @@ int test_intraenb_mobility(mobility_test_params test_params) TESTASSERT(tester.run_preamble() == SRSLTE_SUCCESS); tester.pdcp.last_sdu.sdu = nullptr; tester.rlc.test_reset_all(); + tester.phy.phy_cfg_set = false; /* Receive MeasReport from UE (correct if PCI=2) */ if (test_params.fail_at == mobility_test_params::test_event::wrong_measreport) { @@ -623,12 +624,15 @@ int test_intraenb_mobility(mobility_test_params test_params) const asn1::rrc::phys_cfg_ded_s& phy_cfg_ded = recfg_r8.rr_cfg_ded.phys_cfg_ded; TESTASSERT(phy_cfg_ded.sched_request_cfg_present); TESTASSERT(phy_cfg_ded.cqi_report_cfg_present); + // PHY should not be updated until the UE handovers to the new cell + TESTASSERT(not tester.phy.phy_cfg_set); - /* Test Case: The UE sends a C-RNTI CE. Bearers are reestablished */ + /* Test Case: The UE sends a C-RNTI CE. Bearers are reestablished, PHY is configured */ tester.pdcp.last_sdu.sdu = nullptr; tester.rrc.upd_user(tester.rnti + 1, tester.rnti); TESTASSERT(tester.rlc.ue_db[tester.rnti].reest_sdu_counter == 0); TESTASSERT(tester.pdcp.last_sdu.sdu == nullptr); + TESTASSERT(tester.phy.phy_cfg_set); TESTASSERT(tester.phy.last_cfg.size() == 1 and tester.mac.ue_db[tester.rnti].supported_cc_list.size() == 1); TESTASSERT(tester.phy.last_cfg[0].enb_cc_idx == tester.mac.ue_db[tester.rnti].supported_cc_list[0].enb_cc_idx); diff --git a/srsenb/test/upper/test_helpers.h b/srsenb/test/upper/test_helpers.h index 6e81adf12..a09174517 100644 --- a/srsenb/test/upper/test_helpers.h +++ b/srsenb/test/upper/test_helpers.h @@ -203,7 +203,12 @@ public: class phy_mobility_dummy : public phy_dummy { public: - void set_config(uint16_t rnti, const phy_rrc_cfg_list_t& dedicated_list) override { last_cfg = dedicated_list; } + void set_config(uint16_t rnti, const phy_rrc_cfg_list_t& dedicated_list) override + { + phy_cfg_set = true; + last_cfg = dedicated_list; + } + bool phy_cfg_set = false; phy_rrc_cfg_list_t last_cfg; };