From 086ac79830dbd86831424492e870fba97aea6179 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 8 Oct 2024 18:58:59 +0200 Subject: [PATCH] improvements in handling reconfigurationWithSync --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 27 ++++++------ openair2/RRC/NR_UE/rrc_UE.c | 61 +++++++++++++-------------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 80e2255aa5..7d8cd856c4 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -1734,35 +1734,32 @@ void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, int cc_idP, - const NR_ReconfigurationWithSync_t *reconfigurationWithSync) + const NR_ReconfigurationWithSync_t *reconfWithSync) { - mac->crnti = reconfigurationWithSync->newUE_Identity; + reset_mac_inst(mac); + mac->crnti = reconfWithSync->newUE_Identity; LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti); RA_config_t *ra = &mac->ra; - if (reconfigurationWithSync->rach_ConfigDedicated) { - AssertFatal( - reconfigurationWithSync->rach_ConfigDedicated->present == NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink, - "RACH on supplementaryUplink not supported\n"); - UPDATE_IE(ra->rach_ConfigDedicated, reconfigurationWithSync->rach_ConfigDedicated->choice.uplink, NR_RACH_ConfigDedicated_t); + if (reconfWithSync->rach_ConfigDedicated) { + AssertFatal(reconfWithSync->rach_ConfigDedicated->present == NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink, + "RACH on supplementaryUplink not supported\n"); + UPDATE_IE(ra->rach_ConfigDedicated, reconfWithSync->rach_ConfigDedicated->choice.uplink, NR_RACH_ConfigDedicated_t); } - if (reconfigurationWithSync->spCellConfigCommon) { - NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon; + if (reconfWithSync->spCellConfigCommon) { + NR_ServingCellConfigCommon_t *scc = reconfWithSync->spCellConfigCommon; mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset); if (scc->physCellId) mac->physCellId = *scc->physCellId; mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position; UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t); config_common_ue(mac, scc, cc_idP); + const int bwp_id = 0; if (scc->downlinkConfigCommon) - configure_common_BWP_dl(mac, - 0, // bwp-id - scc->downlinkConfigCommon->initialDownlinkBWP); + configure_common_BWP_dl(mac, bwp_id, scc->downlinkConfigCommon->initialDownlinkBWP); if (scc->uplinkConfigCommon) - configure_common_BWP_ul(mac, - 0, // bwp-id - scc->uplinkConfigCommon->initialUplinkBWP); + configure_common_BWP_ul(mac, bwp_id, scc->uplinkConfigCommon->initialUplinkBWP); } mac->state = UE_NOT_SYNC; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 08f2fd607d..fb5a9fd8fc 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -996,40 +996,39 @@ static void nr_rrc_manage_rlc_bearers(NR_UE_RRC_INST_t *rrc, } } +static void nr_rrc_process_reconfigurationWithSync(NR_UE_RRC_INST_t *rrc, NR_ReconfigurationWithSync_t *reconfigurationWithSync) +{ + // perform Reconfiguration with sync according to 5.3.5.5.2 + if (!rrc->as_security_activated && !(get_softmodem_params()->phy_test || get_softmodem_params()->do_ra)) { + // if the AS security is not activated, perform the actions upon going to RRC_IDLE as specified in 5.3.11 + // with the release cause 'other' upon which the procedure ends + NR_Release_Cause_t release_cause = OTHER; + nr_rrc_going_to_IDLE(rrc, release_cause, NULL); + return; + } + + if (reconfigurationWithSync->spCellConfigCommon && + reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon && + reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL && + reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB) + rrc->arfcn_ssb = *reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; + + NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; + nr_timer_stop(&tac->T310); + int t304_value = nr_rrc_get_T304(reconfigurationWithSync->t304); + nr_timer_setup(&tac->T304, t304_value, 10); // 10ms step + nr_timer_start(&tac->T304); + rrc->rnti = reconfigurationWithSync->newUE_Identity; + // reset the MAC entity of this cell group (done at MAC in handle_reconfiguration_with_sync) +} + void nr_rrc_cellgroup_configuration(NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t *cellGroupConfig) { - NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; - NR_SpCellConfig_t *spCellConfig = cellGroupConfig->spCellConfig; - if(spCellConfig != NULL) { - if (spCellConfig->reconfigurationWithSync != NULL) { - NR_ReconfigurationWithSync_t *reconfigurationWithSync = spCellConfig->reconfigurationWithSync; - if (reconfigurationWithSync->spCellConfigCommon && - reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon && - reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL && - reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB) - rrc->arfcn_ssb = *reconfigurationWithSync->spCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; - // perform Reconfiguration with sync according to 5.3.5.5.2 - if (!rrc->as_security_activated && rrc->nrRrcState != RRC_STATE_IDLE_NR) { - // perform the actions upon going to RRC_IDLE as specified in 5.3.11 - // with the release cause 'other' upon which the procedure ends - // TODO - } - nr_timer_stop(&tac->T310); - int t304_value = nr_rrc_get_T304(reconfigurationWithSync->t304); - nr_timer_setup(&tac->T304, t304_value, 10); // 10ms step - nr_timer_start(&tac->T304); - rrc->rnti = reconfigurationWithSync->newUE_Identity; - // resume suspended radio bearers - for (int i = 0; i < NR_NUM_SRB; i++) { - if (rrc->Srb[i] == RB_SUSPENDED) - rrc->Srb[i] = RB_ESTABLISHED; - } - for (int i = 1; i <= MAX_DRBS_PER_UE; i++) { - if (get_DRB_status(rrc, i) == RB_SUSPENDED) - set_DRB_status(rrc, i, RB_ESTABLISHED); - } - // TODO reset MAC + if(spCellConfig) { + if (spCellConfig->reconfigurationWithSync) { + LOG_I(NR_RRC, "Processing reconfigurationWithSync\n"); + nr_rrc_process_reconfigurationWithSync(rrc, spCellConfig->reconfigurationWithSync); } nr_rrc_handle_SetupRelease_RLF_TimersAndConstants(rrc, spCellConfig->rlf_TimersAndConstants); if (spCellConfig->spCellConfigDedicated) {