From 4d8bb4ef25404c08df942a0958237fb955d834d3 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 21 Oct 2023 18:25:53 +0200 Subject: [PATCH] unify handling of reconfiguration with sync --- executables/nr-uesoftmodem.c | 16 ++++++++------- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 4 +++- openair2/LAYER2/NR_MAC_UE/config_ue.c | 29 ++++++++++++--------------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 35bc218ac2..8e5751a190 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -437,8 +437,6 @@ int main( int argc, char **argv ) { if (set_exe_prio) set_priority(79); - //uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2; - PHY_VARS_NR_UE *UE[MAX_NUM_CCs]; start_background_system(); if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) { @@ -478,6 +476,13 @@ int main( int argc, char **argv ) { #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); + PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); + PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *) * MAX_NUM_CCs); + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE)); + memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(PHY_VARS_NR_UE)); + } + init_NR_UE(1, uecap_file, reconfig_file, rbconfig_file); int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 1; @@ -493,8 +498,6 @@ int main( int argc, char **argv ) { } } - PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); - PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs); if (get_softmodem_params()->emulate_l1) { RCconfig_nr_ue_macrlc(); get_channel_model_mode(uniqCfg); @@ -510,10 +513,9 @@ int main( int argc, char **argv ) { start_oai_nrue_threads(); if (!get_softmodem_params()->emulate_l1) { - for (int CC_id=0; CC_idMod_id][phy_config->CC_id]->nrUE_config; if(phy_config != NULL) { - memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t)); + memcpy(nrUE_config, &phy_config->config_req, sizeof(fapi_nr_config_request_t)); pushNotifiedFIFO(&PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->phy_config_ind, newNotifiedFIFO_elt(1,0,NULL,NULL)); } return 0; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 3b99bedbe9..fd68a3b9c3 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -835,7 +835,6 @@ int main(int argc, char **argv) UE->chest_time = chest_type[1]; UE_mac->if_module = nr_ue_if_module_init(0); - UE_mac->state = UE_CONNECTED; unsigned int available_bits=0; unsigned char *estimated_output_bit; @@ -855,6 +854,9 @@ int main(int argc, char **argv) nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false); nr_rrc_mac_config_req_scg(0, 0, secondaryCellGroup); + UE_mac->state = UE_CONNECTED; + UE_mac->ra.ra_state = RA_SUCCEEDED; + nr_dcireq_t dcireq; nr_scheduled_response_t scheduled_response; nr_phy_data_t phy_data = {0}; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 8b9d3f38ca..c93b607f9e 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -753,6 +753,19 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, mac->crnti = reconfigurationWithSync->newUE_Identity; LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti); config_common_ue(mac, scc, module_id, cc_idP); + + mac->state = UE_NOT_SYNC; + ra->ra_state = RA_UE_IDLE; + nr_ue_mac_default_configs(mac); + + if (!get_softmodem_params()->emulate_l1) { + mac->synch_request.Mod_id = module_id; + mac->synch_request.CC_id = cc_idP; + mac->synch_request.synch_req.target_Nid_cell = mac->physCellId; + mac->if_module->synch_request(&mac->synch_request); + mac->if_module->phy_config_request(&mac->phy_config); + mac->phy_config_request_sent = true; + } } void nr_rrc_mac_config_req_mcg(module_id_t module_id, @@ -778,23 +791,7 @@ void nr_rrc_mac_config_req_mcg(module_id_t module_id, if (cell_group_config->spCellConfig && cell_group_config->spCellConfig->reconfigurationWithSync) { LOG_A(NR_MAC, "Received the reconfigurationWithSync in %s\n", __FUNCTION__); - handle_reconfiguration_with_sync(mac, module_id, cc_idP, cell_group_config->spCellConfig->reconfigurationWithSync); - - mac->state = UE_NOT_SYNC; - mac->ra.ra_state = RA_UE_IDLE; - nr_ue_mac_default_configs(mac); - - if (!get_softmodem_params()->emulate_l1) { - mac->synch_request.Mod_id = module_id; - mac->synch_request.CC_id = cc_idP; - mac->synch_request.synch_req.target_Nid_cell = mac->physCellId; - mac->if_module->synch_request(&mac->synch_request); - mac->if_module->phy_config_request(&mac->phy_config); - mac->phy_config_request_sent = true; - } - // Setup the SSB to Rach Occasions mapping according to the config - build_ssb_to_ro_map(mac); } configure_current_BWP(mac, NULL, cell_group_config); }