From a05baa3c772ce323acba2458d33517b548eb8d68 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 30 Oct 2023 17:41:58 +0100 Subject: [PATCH] fixes to avoid double synchronization call --- executables/nr-ue.c | 19 ++++++------------- openair1/PHY/INIT/nr_init_ue.c | 17 +++++++++++++++++ .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 12 ------------ 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 8cb2a29d15..e7fcdcfa0f 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -367,7 +367,7 @@ static void UE_synch(void *arg) { PHY_VARS_NR_UE *UE = syncD->UE; sync_mode_t sync_mode = pbch; //int CC_id = UE->CC_id; - static int freq_offset=0; + static int freq_offset = 0; UE->is_synchronized = 0; if (UE->UE_scan == 0) { @@ -460,15 +460,10 @@ static void UE_synch(void *arg) { openair0_cfg[UE->rf_map.card].tx_freq[0]); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0]); - if (UE->UE_scan_carrier == 1) { + if (UE->UE_scan_carrier == 1) UE->UE_scan_carrier = 0; - } else { + else UE->is_synchronized = 1; - } - if (UE->synch_request.received_synch_request == 1) { - UE->is_synchronized = 0; - UE->synch_request.received_synch_request = 0; - } } else { if (UE->UE_scan_carrier == 1) { @@ -590,13 +585,11 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) { // Start synchronization with a target gNB - if (UE->synch_request.received_synch_request == 1 && UE->target_Nid_cell == -1) { + if (UE->synch_request.received_synch_request == 1) { UE->is_synchronized = 0; UE->target_Nid_cell = UE->synch_request.synch_req.target_Nid_cell; - clean_UE_ulsch(UE, proc->gNB_id); - } else if (UE->synch_request.received_synch_request == 1 && UE->target_Nid_cell != -1) { + clean_UE_harq(UE); UE->synch_request.received_synch_request = 0; - UE->target_Nid_cell = -1; } /* send tick to RLC and PDCP every ms */ @@ -810,7 +803,7 @@ void *UE_thread(void *arg) } } - AssertFatal( !syncRunning, "At this point synchronization can't be running\n"); + AssertFatal(!syncRunning, "At this point synchronization can't be running\n"); if (!UE->is_synchronized) { readFrame(UE, ×tamp, false); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 32220ca38b..454099f5b0 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -629,6 +629,23 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { ue->dl_stats[i] = 0; } +void clean_UE_harq(PHY_VARS_NR_UE *UE) +{ + for (int harq_pid = 0; harq_pid < NR_MAX_DLSCH_HARQ_PROCESSES; harq_pid++) { + for (int i = 0; i < 2; i++) { + NR_DL_UE_HARQ_t *dl_harq_process = &UE->dl_harq_processes[i][harq_pid]; + init_downlink_harq_status(dl_harq_process); + } + } + for (int harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) { + NR_UL_UE_HARQ_t *ul_harq_process = &UE->ul_harq_processes[harq_pid]; + ul_harq_process->tx_status = NEW_TRANSMISSION_HARQ; + ul_harq_process->status = SCH_IDLE; + ul_harq_process->round = 0; + ul_harq_process->first_tx = 1; + } +} + void init_N_TA_offset(PHY_VARS_NR_UE *ue){ diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 4ab7baa4af..4047abe164 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -258,7 +258,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, const uint8_t n_antenna_ports, c16_t **txdataF); -int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id); +void clean_UE_harq(PHY_VARS_NR_UE *UE); void nr_dlsch_unscrambling(int16_t* llr, uint32_t size, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 93c314b389..e04cb295c1 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -639,15 +639,3 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, //////////////////////////////////////////////////// return 0; } - -int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id) -{ - for (int harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) { - NR_UL_UE_HARQ_t *ul_harq_process = &UE->ul_harq_processes[harq_pid]; - ul_harq_process->tx_status = NEW_TRANSMISSION_HARQ; - ul_harq_process->status = SCH_IDLE; - ul_harq_process->round = 0; - ul_harq_process->first_tx = 1; - } - return 0; -}