From b40a5a958e1e0a24bc9712ab67e1de5a6dcc68db Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Sun, 25 Oct 2020 20:54:47 +0000 Subject: [PATCH] use common function to fill rrc reconf message in handover --- lib/src/asn1/rrc_asn1_utils.cc | 7 +-- srsenb/hdr/stack/rrc/rrc_ue.h | 4 +- srsenb/hdr/stack/rrc/ue_rr_cfg.h | 22 ++++---- srsenb/src/stack/rrc/rrc_mobility.cc | 77 +++++----------------------- srsenb/src/stack/rrc/rrc_ue.cc | 50 ++++-------------- srsenb/src/stack/rrc/ue_rr_cfg.cc | 37 ++++++++----- 6 files changed, 62 insertions(+), 135 deletions(-) diff --git a/lib/src/asn1/rrc_asn1_utils.cc b/lib/src/asn1/rrc_asn1_utils.cc index 9d91df49f..56e3347ce 100644 --- a/lib/src/asn1/rrc_asn1_utils.cc +++ b/lib/src/asn1/rrc_asn1_utils.cc @@ -1132,10 +1132,10 @@ bool operator==(const pdcp_cfg_s& lhs, const pdcp_cfg_s& rhs) { if (lhs.discard_timer_present == rhs.discard_timer_present and lhs.discard_timer == rhs.discard_timer and lhs.ext == rhs.ext) { - return false; + return true; } // TODO: do remaining comparisons - return true; + return false; } bool operator==(const rlc_cfg_c& lhs, const rlc_cfg_c& rhs) @@ -1149,7 +1149,8 @@ bool operator==(const drb_to_add_mod_s& lhs, const drb_to_add_mod_s& rhs) if (lhs.drb_id != rhs.drb_id or lhs.ext != rhs.ext) { return false; } - if (lhs.eps_bearer_id_present != rhs.eps_bearer_id_present or (lhs.eps_bearer_id != rhs.eps_bearer_id)) { + if (lhs.eps_bearer_id_present != rhs.eps_bearer_id_present or + (lhs.eps_bearer_id_present and lhs.eps_bearer_id != rhs.eps_bearer_id)) { return false; } if (not(lhs.pdcp_cfg_present == rhs.pdcp_cfg_present and diff --git a/srsenb/hdr/stack/rrc/rrc_ue.h b/srsenb/hdr/stack/rrc/rrc_ue.h index f35ef014f..bbc84f208 100644 --- a/srsenb/hdr/stack/rrc/rrc_ue.h +++ b/srsenb/hdr/stack/rrc/rrc_ue.h @@ -53,14 +53,12 @@ public: void send_connection_reject(); void send_connection_release(); void send_connection_reest_rej(); - void send_connection_reconf(srslte::unique_byte_buffer_t sdu = {}); - void send_connection_reconf_new_bearer(); + void send_connection_reconf(srslte::unique_byte_buffer_t sdu = {}, bool phy_cfg_updated = true); void send_security_mode_command(); void send_ue_cap_enquiry(); void parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu); void handle_rrc_con_req(asn1::rrc::rrc_conn_request_s* msg); - void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_r8_ies_s* msg); void handle_rrc_con_setup_complete(asn1::rrc::rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu); void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_s* msg); void handle_rrc_con_reest_complete(asn1::rrc::rrc_conn_reest_complete_s* msg, srslte::unique_byte_buffer_t pdu); diff --git a/srsenb/hdr/stack/rrc/ue_rr_cfg.h b/srsenb/hdr/stack/rrc/ue_rr_cfg.h index f79c08272..f614efe05 100644 --- a/srsenb/hdr/stack/rrc/ue_rr_cfg.h +++ b/srsenb/hdr/stack/rrc/ue_rr_cfg.h @@ -37,14 +37,15 @@ void fill_rr_cfg_ded_setup(asn1::rrc::rr_cfg_ded_s& rr_cfg, const rrc_cfg_t& enb_cfg, const cell_ctxt_dedicated_list& ue_cell_list); -/// Fill RadioResourceConfigDedicated with RRCReconf data -void fill_rr_cfg_ded_reconf(asn1::rrc::rr_cfg_ded_s& rr_cfg, - const asn1::rrc::rr_cfg_ded_s& current_rr_cfg, - const rrc_cfg_t& enb_cfg, - const cell_ctxt_dedicated_list& ue_cell_list, - const bearer_cfg_handler& bearers, - const srslte::rrc_ue_capabilities_t& ue_caps, - bool phy_cfg_updated); +/// Apply Reconf updates and update current state +void apply_reconf_updates(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8, + asn1::rrc::rr_cfg_ded_s& current_rr_cfg, + asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, + const rrc_cfg_t& enb_cfg, + const cell_ctxt_dedicated_list& ue_cell_list, + bearer_cfg_handler& bearers, + const srslte::rrc_ue_capabilities_t& ue_caps, + bool phy_cfg_updated); void apply_rr_cfg_ded_diff(asn1::rrc::rr_cfg_ded_s& current_rr_cfg_ded, const asn1::rrc::rr_cfg_ded_s& pending_rr_cfg_ded); @@ -55,9 +56,8 @@ void fill_scells_reconf(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8, const cell_ctxt_dedicated_list& ue_cell_list, const srslte::rrc_ue_capabilities_t& ue_caps); -void apply_reconf_diff(asn1::rrc::rr_cfg_ded_s& current_rr_cfg_ded, - asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, - const asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8); +void apply_scells_to_add_diff(asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, + const asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8); } // namespace srsenb diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 61ada3010..534c42bdc 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -710,22 +710,15 @@ bool rrc::ue::rrc_mobility::start_ho_preparation(uint32_t target_eci, memcpy(&hoprep_r8.ue_radio_access_cap_info[0].ue_cap_rat_container[0], buffer->msg, bref.distance_bytes()); } /*** fill AS-Config ***/ - hoprep_r8.as_cfg_present = true; + hoprep_r8.as_cfg_present = true; + hoprep_r8.as_cfg.source_rr_cfg = rrc_ue->current_rr_cfg; + hoprep_r8.as_cfg.source_scell_cfg_list_r10.reset(new scell_to_add_mod_list_r10_l{rrc_ue->current_scells}); // NOTE: set source_meas_cnfg equal to the UE's current var_meas_cfg var_meas_cfg_t empty_meascfg{}, &target_var_meas = ue_var_meas; // // however, reset the MeasObjToAdd Cells, so that the UE does not measure again the target eNB // meas_obj_to_add_mod_s* obj = rrc_details::binary_find(target_var_meas.meas_objs(), measobj_id); // obj->meas_obj.meas_obj_eutra().cells_to_add_mod_list.resize(0); empty_meascfg.compute_diff_meas_cfg(target_var_meas, &hoprep_r8.as_cfg.source_meas_cfg); - // - fill source RR Config - fill_rr_cfg_ded_setup(hoprep_r8.as_cfg.source_rr_cfg, rrc_enb->cfg, rrc_ue->cell_ded_list); - fill_rr_cfg_ded_reconf(hoprep_r8.as_cfg.source_rr_cfg, - hoprep_r8.as_cfg.source_rr_cfg, - rrc_enb->cfg, - rrc_ue->cell_ded_list, - rrc_ue->bearer_list, - rrc_ue->ue_capabilities, - true); // Get security cfg hoprep_r8.as_cfg.source_security_algorithm_cfg = rrc_ue->ue_security_cfg.get_security_algorithm_cfg(); hoprep_r8.as_cfg.source_ue_id.from_number(rrc_ue->rnti); @@ -897,60 +890,17 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s intralte.key_change_ind = false; intralte.next_hop_chaining_count = rrc_ue->ue_security_cfg.get_ncc(); - recfg_r8.rr_cfg_ded_present = true; - 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(); - sr_setup.dsr_trans_max = rrc_enb->cfg.sr_cfg.dsr_max; - // TODO: For intra-freq handover, SR resources do not get updated. Update for inter-freq case - sr_setup.sr_cfg_idx = rrc_ue->cell_ded_list.get_sr_res()->sr_I; - sr_setup.sr_pucch_res_idx = rrc_ue->cell_ded_list.get_sr_res()->sr_N_pucch; - - // Set CQI in new CC - phy_cfg.cqi_report_cfg_present = true; - if (rrc_enb->cfg.cqi_cfg.mode == RRC_CFG_CQI_MODE_APERIODIC) { - phy_cfg.cqi_report_cfg.cqi_report_mode_aperiodic_present = true; - phy_cfg.cqi_report_cfg.cqi_report_mode_aperiodic = cqi_report_mode_aperiodic_e::rm30; - } else { - phy_cfg.cqi_report_cfg.cqi_report_periodic_present = true; - phy_cfg.cqi_report_cfg.cqi_report_periodic.set_setup(); - phy_cfg.cqi_report_cfg.cqi_report_periodic.setup().cqi_format_ind_periodic.set( - cqi_report_periodic_c::setup_s_::cqi_format_ind_periodic_c_::types::wideband_cqi); - phy_cfg.cqi_report_cfg.cqi_report_periodic.setup().simul_ack_nack_and_cqi = rrc_enb->cfg.cqi_cfg.simultaneousAckCQI; - rrc_ue->get_cqi(&phy_cfg.cqi_report_cfg.cqi_report_periodic.setup().cqi_pmi_cfg_idx, - &phy_cfg.cqi_report_cfg.cqi_report_periodic.setup().cqi_pucch_res_idx, - UE_PCELL_CC_IDX); - } - - // Antenna info - start at TM1 - recfg_r8.rr_cfg_ded.phys_cfg_ded.ant_info_present = true; - auto& ant_info = recfg_r8.rr_cfg_ded.phys_cfg_ded.ant_info.set_explicit_value(); - ant_info.tx_mode.value = ant_info_ded_s::tx_mode_e_::tm1; - ant_info.ue_tx_ant_sel.set(setup_e::release); - - // 256-QAM - if (rrc_ue->ue_capabilities.support_dl_256qam) { - phy_cfg.ext = true; - phy_cfg.cqi_report_cfg_pcell_v1250.set_present(true); - phy_cfg.cqi_report_cfg_pcell_v1250->alt_cqi_table_r12_present = true; - phy_cfg.cqi_report_cfg_pcell_v1250->alt_cqi_table_r12.value = - cqi_report_cfg_v1250_s::alt_cqi_table_r12_opts::all_sfs; - } - - rrc_ue->apply_setup_phy_common(target_cell.sib2.rr_cfg_common, false); - rrc_ue->apply_reconf_phy_config(recfg_r8, false); + apply_reconf_updates(recfg_r8, + rrc_ue->current_rr_cfg, + rrc_ue->current_scells, + rrc_enb->cfg, + rrc_ue->cell_ded_list, + rrc_ue->bearer_list, + rrc_ue->ue_capabilities, + true); // Add MeasConfig of target cell recfg_r8.meas_cfg_present = update_ue_var_meas_cfg(src_dl_earfcn, target_cell, &recfg_r8.meas_cfg); - - // Add SCells - fill_scells_reconf(recfg_r8, rrc_ue->current_scells, rrc_enb->cfg, rrc_ue->cell_ded_list, rrc_ue->ue_capabilities); } /** @@ -1150,8 +1100,6 @@ void rrc::ue::rrc_mobility::handle_ho_req(idle_st& s, const ho_req_rx_ev& ho_req } ho_cmd_pdu->N_bytes = bref2.distance_bytes(); - apply_reconf_diff(rrc_ue->current_rr_cfg, rrc_ue->current_scells, recfg_r8); - /* Configure remaining layers based on pending changes */ // Update RLC + PDCP SRBs (no DRBs until MME Status Transfer) rrc_ue->apply_pdcp_srb_updates(rrc_ue->current_rr_cfg); @@ -1340,6 +1288,7 @@ void rrc::ue::rrc_mobility::intraenb_ho_st::enter(rrc_mobility* f, const ho_meas // Apply changes to the MAC scheduler f->rrc_ue->mac_ctrl->handle_intraenb_ho_cmd(reconf_r8); + f->rrc_ue->apply_setup_phy_common(f->rrc_enb->cfg.sibs[1].sib2().rr_cfg_common, false); f->rrc_ue->apply_reconf_phy_config(reconf_r8, false); // Send DL-DCCH Message via current PCell @@ -1347,8 +1296,6 @@ void rrc::ue::rrc_mobility::intraenb_ho_st::enter(rrc_mobility* f, const ho_meas f->trigger(srslte::failure_ev{}); return; } - - apply_reconf_diff(f->rrc_ue->current_rr_cfg, f->rrc_ue->current_scells, reconf_r8); } void rrc::ue::rrc_mobility::handle_crnti_ce(intraenb_ho_st& s, const user_crnti_upd_ev& ev) diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 77e3cfc36..40645dff0 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -464,7 +464,7 @@ void rrc::ue::send_connection_reest_rej() /* * Connection Reconfiguration */ -void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) +void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu, bool phy_cfg_updated) { parent->rrc_log->debug("RRC state %d\n", state); @@ -476,16 +476,15 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) rrc_conn_recfg.rrc_transaction_id = (uint8_t)((transaction_id++) % 4); rrc_conn_recfg_r8_ies_s& recfg_r8 = rrc_conn_recfg.crit_exts.set_c1().set_rrc_conn_recfg_r8(); - // Fill RR Config Ded - recfg_r8.rr_cfg_ded_present = true; - fill_rr_cfg_ded_reconf( - recfg_r8.rr_cfg_ded, current_rr_cfg, parent->cfg, cell_ded_list, bearer_list, ue_capabilities, true); - - // Add SCells config - fill_scells_reconf(recfg_r8, current_scells, parent->cfg, cell_ded_list, ue_capabilities); - - // Add pending NAS info - bearer_list.fill_pending_nas_info(&recfg_r8); + // Fill RR Config Ded and SCells + apply_reconf_updates(recfg_r8, + current_rr_cfg, + current_scells, + parent->cfg, + cell_ded_list, + bearer_list, + ue_capabilities, + phy_cfg_updated); // Add measConfig if (mobility_handler != nullptr) { @@ -519,33 +518,6 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) send_dl_dcch(&dl_dcch_msg, std::move(pdu)); state = RRC_STATE_WAIT_FOR_CON_RECONF_COMPLETE; - - // Update UE current RadioResourceConfiguration - apply_reconf_diff(current_rr_cfg, current_scells, recfg_r8); -} - -void rrc::ue::send_connection_reconf_new_bearer() -{ - dl_dcch_msg_s dl_dcch_msg; - dl_dcch_msg.msg.set_c1().set_rrc_conn_recfg().crit_exts.set_c1().set_rrc_conn_recfg_r8(); - dl_dcch_msg.msg.c1().rrc_conn_recfg().rrc_transaction_id = (uint8_t)((transaction_id++) % 4); - rrc_conn_recfg_r8_ies_s* conn_reconf = &dl_dcch_msg.msg.c1().rrc_conn_recfg().crit_exts.c1().rrc_conn_recfg_r8(); - - fill_rr_cfg_ded_reconf( - conn_reconf->rr_cfg_ded, current_rr_cfg, parent->cfg, cell_ded_list, bearer_list, ue_capabilities, false); - - // Setup new bearer - apply_pdcp_srb_updates(conn_reconf->rr_cfg_ded); - apply_pdcp_drb_updates(conn_reconf->rr_cfg_ded); - apply_rlc_rb_updates(conn_reconf->rr_cfg_ded); - // Add pending NAS info - bearer_list.fill_pending_nas_info(conn_reconf); - - if (conn_reconf->rr_cfg_ded_present or conn_reconf->ded_info_nas_list_present) { - send_dl_dcch(&dl_dcch_msg); - } - - apply_reconf_diff(current_rr_cfg, current_scells, *conn_reconf); } void rrc::ue::handle_rrc_reconf_complete(rrc_conn_recfg_complete_s* msg, srslte::unique_byte_buffer_t pdu) @@ -846,7 +818,7 @@ bool rrc::ue::setup_erabs(const asn1::s1ap::erab_to_be_setup_list_bearer_su_req_ // Work in progress notify_s1ap_ue_erab_setup_response(e); - send_connection_reconf_new_bearer(); + send_connection_reconf(nullptr, false); return true; } diff --git a/srsenb/src/stack/rrc/ue_rr_cfg.cc b/srsenb/src/stack/rrc/ue_rr_cfg.cc index 21582c7b4..32b674b0a 100644 --- a/srsenb/src/stack/rrc/ue_rr_cfg.cc +++ b/srsenb/src/stack/rrc/ue_rr_cfg.cc @@ -282,7 +282,7 @@ void fill_phy_cfg_ded_reconf(phys_cfg_ded_s& phy_cfg, * radioResourceConfigDedicated **********************************/ -/// Function to fill rrc asn1 radioResourceConfigDedicated with values provided in eNB config +/// fill radioResourceConfigDedicated with values provided in eNB config void fill_rr_cfg_ded_enb_cfg(asn1::rrc::rr_cfg_ded_s& rr_cfg, const rrc_cfg_t& enb_cfg) { rr_cfg = {}; @@ -555,25 +555,34 @@ void fill_scells_reconf(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8, void apply_scells_to_add_diff(asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, const rrc_conn_recfg_r8_ies_s& recfg_r8) { - if (not recfg_r8.non_crit_ext_present or not recfg_r8.non_crit_ext.non_crit_ext_present or - not recfg_r8.non_crit_ext.non_crit_ext.non_crit_ext_present) { + if (recfg_r8.non_crit_ext_present or recfg_r8.non_crit_ext.non_crit_ext_present or + recfg_r8.non_crit_ext.non_crit_ext.non_crit_ext_present) { const rrc_conn_recfg_v1020_ies_s& recfg_v1020 = recfg_r8.non_crit_ext.non_crit_ext.non_crit_ext; - // srslte::apply_addmodremlist_diff( - // current_scells, recfg_v1020.scell_to_add_mod_list_r10, recfg_v1020.scell_to_release_list_r10, - // current_scells); - current_scells = recfg_v1020.scell_to_add_mod_list_r10; - // TODO: Support add/release of scells in a diff-basis + srslte::apply_addmodremlist_diff( + current_scells, recfg_v1020.scell_to_add_mod_list_r10, recfg_v1020.scell_to_release_list_r10, current_scells); } } -void apply_reconf_diff(rr_cfg_ded_s& current_rr_cfg_ded, - asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, - const rrc_conn_recfg_r8_ies_s& recfg_r8) +/// Apply Reconf updates and update current state +void apply_reconf_updates(asn1::rrc::rrc_conn_recfg_r8_ies_s& recfg_r8, + asn1::rrc::rr_cfg_ded_s& current_rr_cfg, + asn1::rrc::scell_to_add_mod_list_r10_l& current_scells, + const rrc_cfg_t& enb_cfg, + const cell_ctxt_dedicated_list& ue_cell_list, + bearer_cfg_handler& bearers, + const srslte::rrc_ue_capabilities_t& ue_caps, + bool phy_cfg_updated) { - if (recfg_r8.rr_cfg_ded_present) { - apply_rr_cfg_ded_diff(current_rr_cfg_ded, recfg_r8.rr_cfg_ded); - } + // Compute pending updates and fill reconf msg + recfg_r8.rr_cfg_ded_present = true; + fill_rr_cfg_ded_reconf(recfg_r8.rr_cfg_ded, current_rr_cfg, enb_cfg, ue_cell_list, bearers, ue_caps, phy_cfg_updated); + fill_scells_reconf(recfg_r8, current_scells, enb_cfg, ue_cell_list, ue_caps); + // Add pending NAS info + bearers.fill_pending_nas_info(&recfg_r8); + + // Update current rr_cfg_ded and scells state + apply_rr_cfg_ded_diff(current_rr_cfg, recfg_r8.rr_cfg_ded); apply_scells_to_add_diff(current_scells, recfg_r8); }