From 8a71877eeca3956256b676d63039c1b703cc6283 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 26 Sep 2022 16:12:04 -0400 Subject: [PATCH] Remove thread id and make slot processing in series --- .../utils/telnetsrv/telnetsrv_cpumeasur_def.h | 22 ++--- executables/nr-ue.c | 90 +++++-------------- openair1/PHY/INIT/nr_init_ue.c | 69 +++++--------- openair1/PHY/MODULATION/slot_fep_nr.c | 12 +-- .../nr_dl_channel_estimation.c | 20 ++--- .../PHY/NR_UE_ESTIMATION/nr_ue_measurements.c | 8 +- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 4 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 2 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 48 +++++----- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 6 +- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 1 - openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 5 +- openair1/PHY/NR_UE_TRANSPORT/sss_nr.c | 6 +- openair1/PHY/TOOLS/nr_phy_scope.c | 10 +-- openair1/PHY/defs_nr_UE.h | 44 ++++----- openair1/PHY/thread_NR_UE.h | 2 - openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 7 +- openair1/SCHED_NR_UE/harq_nr.c | 12 +-- openair1/SCHED_NR_UE/harq_nr.h | 6 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 70 +++++++-------- openair1/SIMULATION/NR_PHY/dlschsim.c | 25 +++--- openair1/SIMULATION/NR_PHY/dlsim.c | 26 +++--- openair1/SIMULATION/NR_PHY/ulschsim.c | 17 ++-- openair1/SIMULATION/NR_PHY/ulsim.c | 4 +- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 6 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 18 ++-- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 8 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h | 6 -- 28 files changed, 228 insertions(+), 326 deletions(-) diff --git a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h index ed8b5e2301..05cd40dccf 100644 --- a/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h +++ b/common/utils/telnetsrv/telnetsrv_cpumeasur_def.h @@ -103,8 +103,8 @@ /* from openair1/PHY/defs_nr_UE.h */ #define CPU_PHYNRUE_MEASURE \ { \ - {"phy_proc", &(UE->phy_proc[0]),0,RX_NB_TH},\ - {"phy_proc_rx", &(UE-> phy_proc_rx[0]),0,RX_NB_TH},\ + {"phy_proc", &(UE->phy_proc),0,1},\ + {"phy_proc_rx", &(UE-> phy_proc_rx),0,1},\ {"phy_proc_tx", &(UE->phy_proc_tx),0,1},\ {"ue_ul_indication_stats", &(UE->ue_ul_indication_stats),0,1},\ {"ofdm_mod_stats", &(UE->ofdm_mod_stats),0,1},\ @@ -116,7 +116,7 @@ {"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\ {"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\ {"generic_stat", &(UE->generic_stat),0,1},\ - {"generic_stat_bis", &(UE->generic_stat_bis[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ + {"generic_stat_bis", &(UE->generic_stat_bis[0]),0,LTE_SLOTS_PER_SUBFRAME},\ {"ofdm_demod_stats", &(UE->ofdm_demod_stats),0,1},\ {"dlsch_rx_pdcch_stats", &(UE->dlsch_rx_pdcch_stats),0,1},\ {"rx_dft_stats", &(UE->rx_dft_stats),0,1},\ @@ -144,14 +144,14 @@ {"dlsch_modulation_SIC_stats", &(UE->dlsch_modulation_SIC_stats),0,1},\ {"dlsch...ping_unit_SIC_stats", &(UE->dlsch_llr_stripping_unit_SIC_stats),0,1},\ {"dlsch_unscrambling_SIC_stats", &(UE->dlsch_unscrambling_SIC_stats),0,1},\ - {"ue_front_end_stat", &(UE->ue_front_end_stat[0]),0,RX_NB_TH},\ - {"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ - {"pdcch_procedures_stat", &(UE->pdcch_procedures_stat[0]),0,RX_NB_TH},\ + {"ue_front_end_stat", &(UE->ue_front_end_stat),0,1},\ + {"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\ + {"pdcch_procedures_stat", &(UE->pdcch_procedures_stat),0,1},\ {"rx_pdsch_stats", &(UE->rx_pdsch_stats), 0, 1}, \ - {"pdsch_procedures_stat", &(UE->pdsch_procedures_stat[0]),0,RX_NB_TH},\ - {"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ - {"dlsch_procedures_stat", &(UE->dlsch_procedures_stat[0]),0,RX_NB_TH},\ - {"dlsch_decoding_stats", &(UE->dlsch_decoding_stats[0]),0,RX_NB_TH},\ - {"dlsch_llr_stats_para", &(UE->dlsch_llr_stats_parallelization[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\ + {"pdsch_procedures_stat", &(UE->pdsch_procedures_stat),0,1},\ + {"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0]),0,LTE_SLOTS_PER_SUBFRAME},\ + {"dlsch_procedures_stat", &(UE->dlsch_procedures_stat),0,1},\ + {"dlsch_decoding_stats", &(UE->dlsch_decoding_stats),0,1},\ + {"dlsch_llr_stats_para", &(UE->dlsch_llr_stats_parallelization[0]),0,LTE_SLOTS_PER_SUBFRAME},\ } #endif diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e65a1450c5..d2c29cc21a 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -112,12 +112,10 @@ static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max const char *end = output + max_len; output += print_meas_log(&ue->phy_proc_tx, "L1 TX processing", NULL, NULL, output, end - output); output += print_meas_log(&ue->ulsch_encoding_stats, "ULSCH encoding", NULL, NULL, output, end - output); - output += print_meas_log(&ue->phy_proc_rx[0], "L1 RX processing t0", NULL, NULL, output, end - output); - output += print_meas_log(&ue->phy_proc_rx[1], "L1 RX processing t1", NULL, NULL, output, end - output); + output += print_meas_log(&ue->phy_proc_rx, "L1 RX processing", NULL, NULL, output, end - output); output += print_meas_log(&ue->ue_ul_indication_stats, "UL Indication", NULL, NULL, output, end - output); output += print_meas_log(&ue->rx_pdsch_stats, "PDSCH receiver", NULL, NULL, output, end - output); - output += print_meas_log(&ue->dlsch_decoding_stats[0], "PDSCH decoding t0", NULL, NULL, output, end - output); - output += print_meas_log(&ue->dlsch_decoding_stats[1], "PDSCH decoding t1", NULL, NULL, output, end - output); + output += print_meas_log(&ue->dlsch_decoding_stats, "PDSCH decoding", NULL, NULL, output, end - output); output += print_meas_log(&ue->dlsch_deinterleaving_stats, " -> Deinterleive", NULL, NULL, output, end - output); output += print_meas_log(&ue->dlsch_rate_unmatching_stats, " -> Rate Unmatch", NULL, NULL, output, end - output); output += print_meas_log(&ue->dlsch_ldpc_decoding_stats, " -> LDPC Decode", NULL, NULL, output, end - output); @@ -436,7 +434,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) mac->dl_info.module_id = mod_id; mac->dl_info.frame = frame; mac->dl_info.slot = slot; - mac->dl_info.thread_id = 0; mac->dl_info.dci_ind = NULL; mac->dl_info.rx_ind = NULL; @@ -457,8 +454,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) { LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__); nr_ue_scheduler(NULL, &ul_info); - nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); - nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id, NULL); + nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx); + nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, NULL); check_nr_prach(mac, &ul_info, &prach_resources); } if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) { @@ -628,7 +625,6 @@ void processSlotTX(void *arg) { ul_indication.slot_rx = proc->nr_slot_rx; ul_indication.frame_tx = proc->frame_tx; ul_indication.slot_tx = proc->nr_slot_tx; - ul_indication.thread_id = proc->thread_id; ul_indication.ue_sched_mode = rxtxD->ue_sched_mode; UE->if_inst->ul_indication(&ul_indication); @@ -639,9 +635,8 @@ void processSlotTX(void *arg) { } } -void UE_processing(void *arg) { +void UE_processing(nr_rxtx_thread_data_t *rxtxD) { - nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; UE_nr_rxtx_proc_t *proc = &rxtxD->proc; PHY_VARS_NR_UE *UE = rxtxD->UE; uint8_t gNB_id = 0; @@ -841,8 +836,6 @@ void *UE_thread(void *arg) { notifiedFIFO_t freeBlocks; initNotifiedFIFO_nothreadSafe(&freeBlocks); - int nbSlotProcessing=0; - int thread_idx=0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); int timing_advance = UE->timing_advance; @@ -850,21 +843,8 @@ void *UE_thread(void *arg) { const int nb_slot_frame = UE->frame_parms.slots_per_frame; int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; - for (int i=0; itxFifo); - pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt); - } - while (!oai_exit) { if (UE->lost_sync) { - int nb = abortTpoolJob(&(get_nrUE_params()->Tpool),RX_JOB_ID); - nb += abortNotifiedFIFOJob(&nf, RX_JOB_ID); - LOG_I(PHY,"Number of aborted slots %d\n",nb); - for (int i=0; iis_synchronized = 0; UE->lost_sync = 0; } @@ -926,27 +906,19 @@ void *UE_thread(void *arg) { absolute_slot++; - // whatever means thread_idx - // Fix me: will be wrong when slot 1 is slow, as slot 2 finishes - // Slot 3 will overlap if NR_RX_NB_TH is 2 - // this is general failure in UE !!! - thread_idx = absolute_slot % NR_RX_NB_TH; int slot_nr = absolute_slot % nb_slot_frame; - notifiedFIFO_elt_t *msgToPush; - AssertFatal((msgToPush=pullNotifiedFIFO_nothreadSafe(&freeBlocks)) != NULL,"chained list failure"); - nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(msgToPush); - curMsg->UE=UE; + nr_rxtx_thread_data_t curMsg = {0}; + curMsg.UE=UE; // update thread index for received subframe - curMsg->proc.thread_id = thread_idx; - curMsg->proc.CC_id = UE->CC_id; - curMsg->proc.nr_slot_rx = slot_nr; - curMsg->proc.nr_slot_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame; - curMsg->proc.frame_rx = (absolute_slot/nb_slot_frame) % MAX_FRAME_NUMBER; - curMsg->proc.frame_tx = ((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame) % MAX_FRAME_NUMBER; - curMsg->proc.rx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_rx, curMsg->proc.nr_slot_rx); - curMsg->proc.tx_slot_type = nr_ue_slot_select(cfg, curMsg->proc.frame_tx, curMsg->proc.nr_slot_tx); - curMsg->proc.decoded_frame_rx=-1; - //LOG_I(PHY,"Process slot %d thread Idx %d total gain %d\n", slot_nr, thread_idx, UE->rx_total_gain_dB); + curMsg.proc.CC_id = UE->CC_id; + curMsg.proc.nr_slot_rx = slot_nr; + curMsg.proc.nr_slot_tx = (absolute_slot + DURATION_RX_TO_TX) % nb_slot_frame; + curMsg.proc.frame_rx = (absolute_slot/nb_slot_frame) % MAX_FRAME_NUMBER; + curMsg.proc.frame_tx = ((absolute_slot+DURATION_RX_TO_TX)/nb_slot_frame) % MAX_FRAME_NUMBER; + curMsg.proc.rx_slot_type = nr_ue_slot_select(cfg, curMsg.proc.frame_rx, curMsg.proc.nr_slot_rx); + curMsg.proc.tx_slot_type = nr_ue_slot_select(cfg, curMsg.proc.frame_tx, curMsg.proc.nr_slot_tx); + curMsg.proc.decoded_frame_rx=-1; + //LOG_I(PHY,"Process slot %d total gain %d\n", slot_nr, UE->rx_total_gain_dB); #ifdef OAI_ADRV9371_ZC706 /*uint32_t total_gain_dB_prev = 0; @@ -1001,30 +973,20 @@ void *UE_thread(void *arg) { LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols); } - curMsg->proc.timestamp_tx = timestamp+ + curMsg.proc.timestamp_tx = timestamp+ UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp; - notifiedFIFO_elt_t *res; + UE_processing(&curMsg); - while (nbSlotProcessing >= NR_RX_NB_TH) { - res=pullTpool(&nf, &(get_nrUE_params()->Tpool)); - if (res == NULL) - break; // Tpool has been stopped - nbSlotProcessing--; - nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData; + if (curMsg.proc.decoded_frame_rx != -1) + decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | curMsg.proc.decoded_frame_rx); + else + decoded_frame_rx=-1; - if (tmp->proc.decoded_frame_rx != -1) - decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); - else - decoded_frame_rx=-1; - - pushNotifiedFIFO_nothreadSafe(&freeBlocks,res); - } - - if (decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx) + if (decoded_frame_rx>0 && decoded_frame_rx != curMsg.proc.frame_rx) LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", - decoded_frame_rx, curMsg->proc.frame_rx); + decoded_frame_rx, curMsg.proc.frame_rx); // use previous timing_advance value to compute writeTimestamp writeTimestamp = timestamp+ @@ -1079,10 +1041,6 @@ void *UE_thread(void *arg) { for (int i=0; iframe_parms.nb_antennas_tx; i++) memset(txp[i], 0, writeBlockSize); - nbSlotProcessing++; - LOG_D(PHY,"Number of slots being processed at the moment: %d\n",nbSlotProcessing); - pushTpool(&(get_nrUE_params()->Tpool), msgToPush); - } // while !oai_exit return NULL; diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 31b535e93f..164e72fce9 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -146,7 +146,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) NR_UE_CSI_RS **const csirs_vars = ue->csirs_vars; NR_UE_SRS **const srs_vars = ue->srs_vars; - int i, slot, symb, gNB_id, th_id; + int i, slot, symb, gNB_id; LOG_I(PHY, "Initializing UE vars for gNB TXant %u, UE RXant %u\n", fp->nb_antennas_tx, fp->nb_antennas_rx); @@ -238,17 +238,11 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // init RX buffers common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); - - for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); - } + common_vars->rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); for (i=0; inb_antennas_rx; i++) { common_vars->rxdata[i] = (int32_t *) malloc16_clear( (2*(fp->samples_per_frame)+2048)*sizeof(int32_t) ); - - for (th_id=0; th_idcommon_vars_rx_data_per_thread[th_id].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) ); - } + common_vars->rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->samples_per_slot_wCP) ); } // ceil(((NB_RB<<1)*3)/32) // 3 RE *2(QPSK) @@ -292,21 +286,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) // DLSCH for (gNB_id = 0; gNB_id < ue->n_connected_gNB+1; gNB_id++) { - for (th_id=0; th_idpdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH)); - } - for (th_id=0; th_idpdsch_vars[th_id][gNB_id], fp ); - } + ue->pdsch_vars[gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH)); + phy_init_nr_ue_PDSCH( ue->pdsch_vars[gNB_id], fp ); int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 - } - for (i=0; ipdsch_vars[th_id][gNB_id]->layer_llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 - } + for (i=0; ipdsch_vars[gNB_id]->llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 + } + for (i=0; ipdsch_vars[gNB_id]->layer_llr[i] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );//Q_m = 8 bits/Sym, Code_Rate=3, Number of Segments =8, Circular Buffer K_cb = 8448 } } @@ -390,12 +378,9 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int i = 0; i < fp->nb_antennas_rx; i++) { free_and_zero(common_vars->rxdata[i]); - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) - free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF[i]); - } - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - free_and_zero(common_vars->common_vars_rx_data_per_thread[th_id].rxdataF); + free_and_zero(common_vars->rxdataF[i]); } + free_and_zero(common_vars->rxdataF); free_and_zero(common_vars->rxdata); for (int slot = 0; slot < fp->slots_per_frame; slot++) { @@ -418,12 +403,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) for (int gNB_id = 0; gNB_id < ue->n_connected_gNB+1; gNB_id++) { // PDSCH - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr_shifts); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream); - phy_term_nr_ue__PDSCH(ue->pdsch_vars[th_id][gNB_id], fp); - free_and_zero(ue->pdsch_vars[th_id][gNB_id]); - } + free_and_zero(ue->pdsch_vars[gNB_id]->llr_shifts); + free_and_zero(ue->pdsch_vars[gNB_id]->llr128_2ndstream); + phy_term_nr_ue__PDSCH(ue->pdsch_vars[gNB_id], fp); + free_and_zero(ue->pdsch_vars[gNB_id]); } for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { @@ -459,11 +442,9 @@ void term_nr_ue_transport(PHY_VARS_NR_UE *ue) const int N_RB_DL = ue->frame_parms.N_RB_DL; for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { for (int j = 0; j < 2; j++) { - for (int k = 0; k < RX_NB_TH_MAX; k++) { - free_nr_ue_dlsch(&ue->dlsch[k][i][j], N_RB_DL); - if (j==0) - free_nr_ue_ulsch(&ue->ulsch[k][i], N_RB_DL, &ue->frame_parms); - } + free_nr_ue_dlsch(&ue->dlsch[i][j], N_RB_DL); + if (j==0) + free_nr_ue_ulsch(&ue->ulsch[i], N_RB_DL, &ue->frame_parms); } free_nr_ue_dlsch(&ue->dlsch_SI[i], N_RB_DL); @@ -479,13 +460,11 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) { for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) { for (int j=0; jdlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,ue->max_ldpc_iterations,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); - LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[k][i][j]); - if (j==0) { - AssertFatal((ue->ulsch[k][i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES,&ue->frame_parms))!=NULL,"Can't get ue ulsch structures\n"); - LOG_D(PHY,"ulsch[%d][%d] => %p\n",k,i,ue->ulsch[k][i]); - } + AssertFatal((ue->dlsch[i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,ue->max_ldpc_iterations,ue->frame_parms.N_RB_DL))!=NULL,"Can't get ue dlsch structures\n"); + LOG_D(PHY,"dlsch[%d][%d] => %p\n",i,j,ue->dlsch[i][j]); + if (j==0) { + AssertFatal((ue->ulsch[i] = new_nr_ue_ulsch(ue->frame_parms.N_RB_UL, NR_MAX_ULSCH_HARQ_PROCESSES,&ue->frame_parms))!=NULL,"Can't get ue ulsch structures\n"); + LOG_D(PHY,"ulsch[%d] => %p\n",i,ue->ulsch[i]); } } diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 71be5ba6ed..5aa861cba6 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -75,7 +75,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, //#endif for (unsigned char aa=0; aanb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); + memset(&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; @@ -92,7 +92,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, dft(dftsize, rxdata_ptr, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + (int16_t *)&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], 1); stop_meas(&ue->rx_dft_stats); @@ -108,7 +108,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, #endif c16_t *shift_rot = frame_parms->timeshift_symbol_rotation; - c16_t *this_symbol = (c16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol]; + c16_t *this_symbol = (c16_t *)&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol]; if (frame_parms->N_RB_DL & 1) { rotate_cpx_vector(this_symbol, &rot2, this_symbol, @@ -188,7 +188,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, #endif for (unsigned char aa=0; aanb_antennas_rx; aa++) { - memset(&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); + memset(&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int32_t)); int16_t *rxdata_ptr; rx_offset%=frame_length_samples*2; @@ -224,7 +224,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, dft(dftsize, rxdata_ptr, - (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], + (int16_t *)&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], 1); stop_meas(&ue->rx_dft_stats); @@ -239,7 +239,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, symbol+symb_offset,rot2.r,rot2.i); #endif - c16_t *this_symbol = (c16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol]; + c16_t *this_symbol = (c16_t *)&common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*symbol]; rotate_cpx_vector(this_symbol, &rot2, this_symbol, frame_parms->ofdm_symbol_size, 15); } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index ba7e61afe6..7cc19a2755 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -55,7 +55,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, uint8_t nushift; uint8_t ssb_index=current_ssb->i_ssb; uint8_t n_hf=current_ssb->n_hf; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int **rxdataF=ue->common_vars.rxdataF; nushift = ue->frame_parms.Nid_cell%4; ue->frame_parms.nushift = nushift; @@ -72,7 +72,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, k = nushift; #ifdef DEBUG_CH - printf("PBCH DMRS Correlation : ThreadId %d, gNB_id %d , OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n",proc->thread_id, gNB_id,ue->frame_parms.ofdm_symbol_size, + printf("PBCH DMRS Correlation : gNB_id %d , OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n", gNB_id,ue->frame_parms.ofdm_symbol_size, ue->frame_parms.Ncp,Ns,k, symbol); #endif @@ -218,7 +218,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, //int slot_pbch; uint8_t nushift; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int **rxdataF=ue->common_vars.rxdataF; nushift = ue->frame_parms.Nid_cell%4; ue->frame_parms.nushift = nushift; @@ -237,7 +237,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, k = nushift; #ifdef DEBUG_CH - printf("PBCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n",proc->thread_id, gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size, + printf("PBCH Channel Estimation : gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n", gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size, ue->frame_parms.Ncp,Ns,k, symbol); #endif @@ -481,7 +481,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int16_t ch[2],*pil,*rxF,*dl_ch; int ch_offset,symbol_offset; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int **rxdataF=ue->common_vars.rxdataF; ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -489,8 +489,8 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, #ifdef DEBUG_PDCCH - printf("PDCCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, symbol %d\n", - proc->thread_id, gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size,ue->frame_parms.Ncp,Ns,symbol); + printf("PDCCH Channel Estimation : gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, symbol %d\n", + gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size,ue->frame_parms.Ncp,Ns,symbol); #endif #if CH_INTERP @@ -714,8 +714,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int ch_offset,symbol_offset; uint8_t nushift; - int **dl_ch_estimates = ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates; - int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int **dl_ch_estimates = ue->pdsch_vars[gNB_id]->dl_ch_estimates; + int **rxdataF=ue->common_vars.rxdataF; ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -725,7 +725,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int re_offset = k; #ifdef DEBUG_PDSCH - printf("PDSCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n",proc->thread_id, gNB_id,ch_offset,symbol_offset,ue->frame_parms.ofdm_symbol_size, + printf("PDSCH Channel Estimation : gNB_id %d ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n", gNB_id,ch_offset,symbol_offset,ue->frame_parms.ofdm_symbol_size, ue->frame_parms.Ncp,Ns,k, symbol); #endif diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index bf7b93b180..b0756282a3 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -117,7 +117,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, int aarx, aatx, gNB_id = 0; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int ch_offset = frame_parms->ofdm_symbol_size*2; - NR_UE_DLSCH_t *dlsch = ue->dlsch[proc->thread_id][gNB_id][0]; + NR_UE_DLSCH_t *dlsch = ue->dlsch[gNB_id][0]; uint8_t harq_pid = dlsch->current_harq_pid; int N_RB_DL = dlsch->harq_processes[harq_pid]->nb_rb; @@ -134,7 +134,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, for (aatx = 0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++){ - ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = (signal_energy_nodc(&ue->pdsch_vars[proc->thread_id][0]->dl_ch_estimates[gNB_id][ch_offset], N_RB_DL*NR_NB_SC_PER_RB)); + ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = (signal_energy_nodc(&ue->pdsch_vars[0]->dl_ch_estimates[gNB_id][ch_offset], N_RB_DL*NR_NB_SC_PER_RB)); if (ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]<0) ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = 0; @@ -229,7 +229,7 @@ void nr_ue_ssb_rsrp_measurements(PHY_VARS_NR_UE *ue, for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) { - int16_t *rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset]; + int16_t *rxF_sss = (int16_t *)&ue->common_vars.rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset]; for(int k = k_start; k < k_end; k++){ @@ -283,7 +283,7 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, nb_nulls = 0; ue->measurements.n0_power[aarx] = 0; - rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset]; + rxF_sss = (int16_t *)&ue->common_vars.rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset]; //-ve spectrum from SSS for(k = k_left; k < k_left + k_length; k++){ diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index ae8b733301..64222cab9a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -192,7 +192,7 @@ int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue, uint32_t *rsrp, int *rsrp_dBm) { - int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int32_t **rxdataF = ue->common_vars.rxdataF; const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; uint16_t meas_count = 0; uint32_t rsrp_sum = 0; @@ -731,7 +731,7 @@ int nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue, const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu, uint32_t *interference_plus_noise_power) { - int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + int32_t **rxdataF = ue->common_vars.rxdataF; const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; const uint16_t end_rb = csiim_config_pdu->start_rb + csiim_config_pdu->nr_of_rbs > csiim_config_pdu->bwp_size ? diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 68a0ec56d8..60d1966e91 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -698,7 +698,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); - nr_pdcch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + nr_pdcch_extract_rbs_single(common_vars->rxdataF, pdcch_est_size, pdcch_dl_ch_estimates, rx_size, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 88cc419dc1..b8e544f3f8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -177,22 +177,22 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, switch (type) { case SI_PDSCH: - pdsch_vars = ue->pdsch_vars[proc->thread_id]; + pdsch_vars = ue->pdsch_vars; dlsch = &ue->dlsch_SI[gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; break; case RA_PDSCH: - pdsch_vars = ue->pdsch_vars[proc->thread_id]; + pdsch_vars = ue->pdsch_vars; dlsch = &ue->dlsch_ra[gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; break; case PDSCH: - pdsch_vars = ue->pdsch_vars[proc->thread_id]; - dlsch = ue->dlsch[proc->thread_id][gNB_id]; + pdsch_vars = ue->pdsch_vars; + dlsch = ue->dlsch[gNB_id]; dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; if (NR_MAX_NB_LAYERS>4) dlsch1_harq = dlsch[1]->harq_processes[harq_pid]; @@ -306,8 +306,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //---------------------------------------------------------- //--------------------- RBs extraction --------------------- //---------------------------------------------------------- - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); - nr_dlsch_extract_rbs(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + start_meas(&ue->generic_stat_bis[slot]); + nr_dlsch_extract_rbs(common_vars->rxdataF, pdsch_vars[gNB_id]->dl_ch_estimates, pdsch_vars[gNB_id]->rxdataF_ext, pdsch_vars[gNB_id]->dl_ch_estimates_ext, @@ -321,10 +321,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, frame_parms, dlsch0_harq->dlDmrsSymbPos, ue->chest_time); - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n", - frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); int nl = dlsch0_harq->Nl; int n_rx = frame_parms->nb_antennas_rx; @@ -332,7 +332,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //---------------------------------------------------------- //--------------------- Channel Scaling -------------------- //---------------------------------------------------------- - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + start_meas(&ue->generic_stat_bis[slot]); nr_dlsch_scale_channel(pdsch_vars[gNB_id]->dl_ch_estimates_ext, frame_parms, nl, @@ -342,16 +342,16 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pilots, nb_re_pdsch, nb_rb_pdsch); - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); if (cpumeas(CPUMEAS_GETSTATE)) LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n", - frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); //---------------------------------------------------------- //--------------------- Channel Level Calc. ---------------- //---------------------------------------------------------- - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + start_meas(&ue->generic_stat_bis[slot]); if (first_symbol_flag==1) { nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, frame_parms, @@ -392,7 +392,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, avg[0], avgs); } - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); #if T_TRACER if (type == PDSCH) @@ -403,13 +403,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); //---------------------------------------------------------- //--------------------- channel compensation --------------- //---------------------------------------------------------- // Disable correlation measurement for optimizing UE - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + start_meas(&ue->generic_stat_bis[slot]); nr_dlsch_channel_compensation(pdsch_vars[gNB_id]->rxdataF_ext, pdsch_vars[gNB_id]->dl_ch_estimates_ext, pdsch_vars[gNB_id]->dl_ch_mag0, @@ -426,11 +426,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, nb_rb_pdsch, pdsch_vars[gNB_id]->log2_maxh, measurements); // log2_maxh+I0_shift - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + start_meas(&ue->generic_stat_bis[slot]); if (n_rx > 1) { nr_dlsch_detection_mrc(pdsch_vars[gNB_id]->rxdataF_comp0, @@ -457,16 +457,16 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, symbol, nb_re_pdsch); } - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); //printf("start compute LLR\n"); rxdataF_comp_ptr = pdsch_vars[gNB_id_i]->rxdataF_comp0; dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and zero forcing %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine and zero forcing %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); - start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + start_meas(&ue->generic_stat_bis[slot]); /* Store the valid DL RE's */ pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = nb_re_pdsch; @@ -542,9 +542,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->layer_llr); } - stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); + stop_meas(&ue->generic_stat_bis[slot]); if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[slot].p_time/(cpuf*1000.0)); // Please keep it: useful for debugging #ifdef DEBUG_PDSCH_RX @@ -552,7 +552,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, uint8_t aa = 0; snprintf(filename, 50, "rxdataF0_symb_%d_nr_slot_rx_%d.m", symbol, nr_slot_rx); - write_output(filename, "rxdataF0", &common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); + write_output(filename, "rxdataF0", &common_vars->rxdataF[0][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); snprintf(filename, 50, "dl_ch_estimates0%d_symb_%d_nr_slot_rx_%d.m", aa, symbol, nr_slot_rx); write_output(filename, "dl_ch_estimates", &pdsch_vars[gNB_id]->dl_ch_estimates[aa][0], NR_SYMBOLS_PER_SLOT*frame_parms->ofdm_symbol_size, 1, 1); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index d7b1c93e1d..3303855709 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -422,9 +422,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, symbol_offset=0; #ifdef DEBUG_PBCH - //printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF); + //printf("address dataf %p",nr_ue_common_vars->rxdataF); write_output("rxdataF0_pbch.m","rxF0pbch", - &nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][(symbol_offset+1)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size*3,1,1); + &nr_ue_common_vars->rxdataF[0][(symbol_offset+1)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size*3,1,1); #endif // symbol refers to symbol within SSB. symbol_offset is the offset of the SSB wrt start of slot double log2_maxh; @@ -434,7 +434,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, __attribute__ ((aligned(32))) struct complex16 rxdataF_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_ext[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL]; memset(dl_ch_estimates_ext,0, sizeof dl_ch_estimates_ext); - nr_pbch_extract(nr_ue_common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + nr_pbch_extract(nr_ue_common_vars->rxdataF, estimateSz, dl_ch_estimates, rxdataF_ext, 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 6d99ac9b8c..9918d00e5e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1041,7 +1041,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, unsigned char harq_pid, uint32_t frame, uint8_t slot, - uint8_t thread_id, int gNB_id); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index dba1fd194d..dbd96078b4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -110,7 +110,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, unsigned char harq_pid, uint32_t frame, uint8_t slot, - uint8_t thread_id, int gNB_id) { LOG_D(PHY,"nr_ue_ulsch_procedures hard_id %d %d.%d\n",harq_pid,frame,slot); @@ -127,7 +126,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, int N_PRB_oh = 0; // higher layer (RRC) parameter xOverhead in PUSCH-ServingCellConfig uint16_t number_dmrs_symbols = 0; - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[thread_id][gNB_id]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[gNB_id]; NR_UL_UE_HARQ_t *harq_process_ul_ue = ulsch_ue->harq_processes[harq_pid]; nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &harq_process_ul_ue->pusch_pdu; @@ -554,7 +553,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, }// port loop NR_UL_UE_HARQ_t *harq_process_ulsch=NULL; - harq_process_ulsch = UE->ulsch[thread_id][gNB_id]->harq_processes[harq_pid]; + harq_process_ulsch = UE->ulsch[gNB_id]->harq_processes[harq_pid]; harq_process_ulsch->status = SCH_IDLE; for (int nl = 0; nl < Nl; nl++) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c index ff8d5d42ff..53191f0946 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c @@ -332,7 +332,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue, pss_symbol = 0; sss_symbol = SSS_SYMBOL_NB-PSS_SYMBOL_NB; - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; + rxdataF = ue->common_vars.rxdataF; unsigned int ofdm_symbol_size = frame_parms->ofdm_symbol_size; @@ -444,8 +444,8 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric, #ifdef DEBUG_PLOT_SSS write_output("rxsig0.m","rxs0",&ue->common_vars.rxdata[0][0],ue->frame_parms.samples_per_subframe,1,1); - write_output("rxdataF0_pss.m","rxF0_pss",&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][0],frame_parms->ofdm_symbol_size,1,1); - write_output("rxdataF0_sss.m","rxF0_sss",&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0][(SSS_SYMBOL_NB-PSS_SYMBOL_NB)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); + write_output("rxdataF0_pss.m","rxF0_pss",&ue->common_vars.rxdataF[0][0],frame_parms->ofdm_symbol_size,1,1); + write_output("rxdataF0_sss.m","rxF0_sss",&ue->common_vars.rxdataF[0][(SSS_SYMBOL_NB-PSS_SYMBOL_NB)*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); write_output("pss_ext.m","pss_ext",pss_ext,LENGTH_PSS_NR,1,1); #endif diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 73f9324570..d1a47a299a 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -601,7 +601,7 @@ static void ueFreqWaterFall (scopeGraphData_t **data, OAIgraph_t *graph,PHY_VARS NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms; //use 1st antenna genericWaterFall(graph, - (scopeSample_t *)phy_vars_ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0], + (scopeSample_t *)phy_vars_ue->common_vars.rxdataF[0], frame_parms->samples_per_slot_wCP, phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame frequency" ); @@ -719,7 +719,7 @@ static void uePcchIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_U } static void uePdschLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDSCH LLRs - if (!phy_vars_ue->pdsch_vars[0][eNB_id]->llr[0]) + if (!phy_vars_ue->pdsch_vars[eNB_id]->llr[0]) return; int num_re = 4500; @@ -730,7 +730,7 @@ static void uePdschLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR int base=0; for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { - int16_t *pdsch_llr = (int16_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->llr[0]; // stream 0 + int16_t *pdsch_llr = (int16_t *) phy_vars_ue->pdsch_vars[eNB_id]->llr[0]; // stream 0 for (int i=0; ipdsch_vars[0][eNB_id]->rxdataF_comp0[0]) + if (!phy_vars_ue->pdsch_vars[eNB_id]->rxdataF_comp0[0]) return; NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; @@ -758,7 +758,7 @@ static void uePdschIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_ memset(Q+base, 0, sz*RX_NB_TH_MAX * sizeof(*Q)); for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { - scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->rxdataF_comp0[0]; + scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[eNB_id]->rxdataF_comp0[0]; for (int s=0; s4 ? 2:1]; // two RxTx Threads - NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX]; + NR_UE_DLSCH_t *dlsch[NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_LAYERS>4 ? 2:1]; + NR_UE_ULSCH_t *ulsch[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; @@ -906,9 +900,9 @@ typedef struct { /// Transmission mode per gNB uint8_t transmission_mode[NUMBER_OF_CONNECTED_gNB_MAX]; - time_stats_t phy_proc[RX_NB_TH]; + time_stats_t phy_proc; time_stats_t phy_proc_tx; - time_stats_t phy_proc_rx[RX_NB_TH]; + time_stats_t phy_proc_rx; time_stats_t ue_ul_indication_stats; @@ -924,13 +918,13 @@ typedef struct { time_stats_t ulsch_multiplexing_stats; time_stats_t generic_stat; - time_stats_t generic_stat_bis[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t ue_front_end_stat[RX_NB_TH]; - time_stats_t ue_front_end_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t pdcch_procedures_stat[RX_NB_TH]; - time_stats_t pdsch_procedures_stat[RX_NB_TH]; - time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t dlsch_procedures_stat[RX_NB_TH]; + time_stats_t generic_stat_bis[LTE_SLOTS_PER_SUBFRAME]; + time_stats_t ue_front_end_stat; + time_stats_t ue_front_end_per_slot_stat[LTE_SLOTS_PER_SUBFRAME]; + time_stats_t pdcch_procedures_stat; + time_stats_t pdsch_procedures_stat; + time_stats_t pdsch_procedures_per_slot_stat[LTE_SLOTS_PER_SUBFRAME]; + time_stats_t dlsch_procedures_stat; time_stats_t rx_pdsch_stats; time_stats_t ofdm_demod_stats; @@ -938,13 +932,13 @@ typedef struct { time_stats_t rx_dft_stats; time_stats_t dlsch_channel_estimation_stats; time_stats_t dlsch_freq_offset_estimation_stats; - time_stats_t dlsch_decoding_stats[2]; + time_stats_t dlsch_decoding_stats; time_stats_t dlsch_demodulation_stats; time_stats_t dlsch_rate_unmatching_stats; time_stats_t dlsch_ldpc_decoding_stats; time_stats_t dlsch_deinterleaving_stats; time_stats_t dlsch_llr_stats; - time_stats_t dlsch_llr_stats_parallelization[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; + time_stats_t dlsch_llr_stats_parallelization[LTE_SLOTS_PER_SUBFRAME]; time_stats_t dlsch_unscrambling_stats; time_stats_t dlsch_rate_matching_stats; time_stats_t dlsch_ldpc_encoding_stats; diff --git a/openair1/PHY/thread_NR_UE.h b/openair1/PHY/thread_NR_UE.h index 4fa5433f44..5bf04bd853 100644 --- a/openair1/PHY/thread_NR_UE.h +++ b/openair1/PHY/thread_NR_UE.h @@ -4,8 +4,6 @@ #include /// Context data structure for RX/TX portion of subframe processing typedef struct { - /// index of the current UE RX/TX thread - int thread_id; /// Component Carrier index uint8_t CC_id; /// timestamp transmitted to HW diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 0acd33edd3..ae80536abf 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -352,13 +352,12 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if(scheduled_response != NULL){ module_id_t module_id = scheduled_response->module_id; - uint8_t cc_id = scheduled_response->CC_id, thread_id; + uint8_t cc_id = scheduled_response->CC_id; int slot = scheduled_response->slot; // Note: we have to handle the thread IDs for this. To be revisited completely. - thread_id = scheduled_response->thread_id; NR_UE_DLSCH_t *dlsch0 = NULL; - NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0]; + NR_UE_ULSCH_t *ulsch = PHY_vars_UE_g[module_id][cc_id]->ulsch[0]; NR_UE_PUCCH *pucch_vars = &((nr_phy_data_t *)scheduled_response->phy_data)->pucch_vars; NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0]; NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0]; @@ -418,7 +417,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ break; case FAPI_NR_DL_CONFIG_TYPE_DLSCH: dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; - dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0]; + dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[0][0]; configure_dlsch(dlsch0, dlsch_config_pdu, module_id, dl_config->dl_config_list[i].dlsch_config_pdu.rnti); break; diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index dc62ea646c..25e23551e0 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -113,7 +113,7 @@ * *********************************************************************/ -void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx, uint8_t number_harq_processes_pusch) +void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx, uint8_t number_harq_processes_pusch) { NR_UE_ULSCH_t *ulsch; @@ -123,7 +123,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i memset(ulsch,0,sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id] = ulsch; + ue->ulsch[gNB_id] = ulsch; } else { LOG_E(PHY, "Fatal memory allocation problem at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__); @@ -148,7 +148,7 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i } for (int slot_tx = 0; slot_tx < NR_MAX_SLOTS_PER_FRAME; slot_tx++) { - ue->ulsch[thread_id][gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; + ue->ulsch[gNB_id]->harq_process_id[slot_tx] = NR_MAX_HARQ_PROCESSES; } } @@ -165,9 +165,9 @@ void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, i * *********************************************************************/ -void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx) +void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx) { - NR_UE_ULSCH_t *ulsch = ue->ulsch[thread_id][gNB_id]; + NR_UE_ULSCH_t *ulsch = ue->ulsch[gNB_id]; for (int process_id = 0; process_id < ulsch->number_harq_processes_for_pusch; process_id++) { @@ -178,7 +178,7 @@ void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, free16(ulsch, sizeof(NR_UE_ULSCH_t)); - ue->ulsch[thread_id][gNB_id] = NULL; + ue->ulsch[gNB_id] = NULL; } /******************************************************************* diff --git a/openair1/SCHED_NR_UE/harq_nr.h b/openair1/SCHED_NR_UE/harq_nr.h index 5586518d7c..b707e2d983 100644 --- a/openair1/SCHED_NR_UE/harq_nr.h +++ b/openair1/SCHED_NR_UE/harq_nr.h @@ -69,21 +69,19 @@ /** \brief This function configures uplink HARQ context @param PHY_VARS_NR_UE ue context @param gNB_id gNodeB identifier - @param thread_id RXTX thread index @param code_word_idx code word index @param number_harq_processes_pusch maximum number of uplink HARQ processes @returns none */ -void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx, uint8_t number_harq_processes_pusch); +void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx, uint8_t number_harq_processes_pusch); /** \brief This function releases uplink HARQ context @param PHY_VARS_NR_UE ue context @param gNB_id gNodeB identifier - @param thread_id RXTX thread index @param code_word_idx code word index @returns none */ -void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int thread_id, int code_word_idx); +void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int code_word_idx); /** \brief This function stores slot for transmission in HARQ context @param ulsch uplink context diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 79ddbbaa94..e997835f10 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -99,7 +99,6 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, dl_ind->cc_id = ue->CC_id; dl_ind->frame = proc->frame_rx; dl_ind->slot = proc->nr_slot_rx; - dl_ind->thread_id = proc->thread_id; dl_ind->phy_data = phy_data; if (dci_ind) { @@ -298,9 +297,9 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, if (ue->UE_mode[gNB_id] <= PUSCH){ - for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[proc->thread_id][gNB_id]->number_harq_processes_for_pusch; harq_pid++) { - if (ue->ulsch[proc->thread_id][gNB_id]->harq_processes[harq_pid]->status == ACTIVE) - nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); + for (uint8_t harq_pid = 0; harq_pid < ue->ulsch[gNB_id]->number_harq_processes_for_pusch; harq_pid++) { + if (ue->ulsch[gNB_id]->harq_processes[harq_pid]->status == ACTIVE) + nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id); } } @@ -609,7 +608,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ char filename[100]; for (uint8_t aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { sprintf(filename,"PDSCH_CHANNEL_frame%d_slot%d_sym%d_port%d_rx%d.m", nr_frame_rx, nr_slot_rx, m, aatx,aarx); - int **dl_ch_estimates = ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates; + int **dl_ch_estimates = ue->pdsch_vars[gNB_id]->dl_ch_estimates; LOG_M(filename,"channel_F",&dl_ch_estimates[aatx*ue->frame_parms.nb_antennas_rx+aarx][ue->frame_parms.ofdm_symbol_size*m],ue->frame_parms.ofdm_symbol_size, 1, 1); } #endif @@ -619,7 +618,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ if (ue->chest_time == 1) { // averaging time domain channel estimates nr_chest_time_domain_avg(&ue->frame_parms, - ue->pdsch_vars[proc->thread_id][gNB_id]->dl_ch_estimates, + ue->pdsch_vars[gNB_id]->dl_ch_estimates, dlsch0_harq->nb_symbols, dlsch0_harq->start_symbol, dlsch0_harq->dlDmrsSymbPos, @@ -652,7 +651,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ uint8_t slot = 0; if(m >= ue->frame_parms.symbols_per_slot>>1) slot = 1; - start_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); + start_meas(&ue->dlsch_llr_stats_parallelization[slot]); // process DLSCH received symbols in the slot // symbol by symbol processing (if data/DMRS are multiplexed is checked inside the function) if (pdsch == PDSCH || pdsch == SI_PDSCH || pdsch == RA_PDSCH) { @@ -671,9 +670,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ return -1; } else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); - stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); + stop_meas(&ue->dlsch_llr_stats_parallelization[slot]); if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[slot].p_time/(cpuf*1000.0)); if(first_symbol_flag) { proc->first_symbol_available = 1; } @@ -741,7 +740,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, case RA_PDSCH: case P_PDSCH: case PDSCH: - pdsch_vars = ue->pdsch_vars[proc->thread_id][gNB_id]; + pdsch_vars = ue->pdsch_vars[gNB_id]; break; case PMCH: case PDSCH1: @@ -789,11 +788,11 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_I(PHY,"start ldpc decode for CW 0 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch0->harq_processes[harq_pid]->Nl); LOG_I(PHY,"start ldpc decode for CW 0 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch0->harq_processes[harq_pid]->G); LOG_I(PHY,"start ldpc decode for CW 0 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch0->Kmimo); - LOG_I(PHY,"start ldpc decode for CW 0 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, nr_slot_rx, harq_pid, ue->pdcch_vars[proc->thread_id][gNB_id]->num_pdcch_symbols); + LOG_I(PHY,"start ldpc decode for CW 0 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, nr_slot_rx, harq_pid, ue->pdcch_vars[gNB_id]->num_pdcch_symbols); #endif - start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + start_meas(&ue->dlsch_decoding_stats); ret = nr_dlsch_decoding(ue, proc, @@ -834,12 +833,12 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch0->harq_processes[harq_pid]->TBS, dlsch0->harq_processes[harq_pid]->TBS / 8); - stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + stop_meas(&ue->dlsch_decoding_stats); if (cpumeas(CPUMEAS_GETSTATE)) { LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats.p_time)/(cpuf*1000.0)); } if(is_cw1_active) { @@ -865,10 +864,10 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_I(PHY,"start ldpc decode for CW 1 for AbsSubframe %d.%d / %d --> Nl %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch1->harq_processes[harq_pid]->Nl); LOG_I(PHY,"start ldpc decode for CW 1 for AbsSubframe %d.%d / %d --> G %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch1->harq_processes[harq_pid]->G); LOG_I(PHY,"start ldpc decode for CW 1 for AbsSubframe %d.%d / %d --> Kmimo %d \n", frame_rx, nr_slot_rx, harq_pid, dlsch1->Kmimo); - LOG_I(PHY,"start ldpc decode for CW 1 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, nr_slot_rx, harq_pid, ue->pdcch_vars[proc->thread_id][gNB_id]->num_pdcch_symbols); + LOG_I(PHY,"start ldpc decode for CW 1 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, nr_slot_rx, harq_pid, ue->pdcch_vars[gNB_id]->num_pdcch_symbols); #endif - start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + start_meas(&ue->dlsch_decoding_stats); ret1 = nr_dlsch_decoding(ue, @@ -885,12 +884,12 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, pdsch==PDSCH);//proc->decoder_switch LOG_T(PHY,"CW dlsch decoding, ret1 = %d\n", ret1); - stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); + stop_meas(&ue->dlsch_decoding_stats); if (cpumeas(CPUMEAS_GETSTATE)) { LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", - frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); + frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats.p_time)/(cpuf*1000.0)); } LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } @@ -1323,11 +1322,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *fp = &ue->frame_parms; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - start_meas(&ue->phy_proc_rx[proc->thread_id]); + start_meas(&ue->phy_proc_rx); - LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d (energy %d dB)****** \n", - frame_rx%1024, nr_slot_rx, - dB_fixed(signal_energy(ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[0],2048*14))); + LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", + frame_rx%1024, nr_slot_rx); // checking if current frame is compatible with SSB periodicity if (cfg->ssb_table.ssb_period == 0 || @@ -1471,8 +1469,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, LOG_D(PHY,"[UE %d] Frame %d, nr_slot_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_slot_rx, dci_cnt); NR_UE_DLSCH_t *dlsch = NULL; - if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1){ - dlsch = ue->dlsch[proc->thread_id][gNB_id][0]; + if (ue->dlsch[gNB_id][0]->active == 1){ + dlsch = ue->dlsch[gNB_id][0]; } else if (ue->dlsch_SI[0]->active == 1){ dlsch = ue->dlsch_SI[0]; } else if (ue->dlsch_ra[0]->active == 1){ @@ -1513,13 +1511,13 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat); // do procedures for C-RNTI int ret_pdsch = 0; - if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { + if (ue->dlsch[gNB_id][0]->active == 1) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, PDSCH, - ue->dlsch[proc->thread_id][gNB_id][0], + ue->dlsch[gNB_id][0], NULL); nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx); @@ -1597,34 +1595,34 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } // do procedures for C-RNTI - if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { + if (ue->dlsch[gNB_id][0]->active == 1) { LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d\n", nr_slot_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - start_meas(&ue->dlsch_procedures_stat[proc->thread_id]); + start_meas(&ue->dlsch_procedures_stat); NR_UE_DLSCH_t *dlsch1 = NULL; if (NR_MAX_NB_LAYERS>4) - dlsch1 = ue->dlsch[proc->thread_id][gNB_id][1]; + dlsch1 = ue->dlsch[gNB_id][1]; if (ret_pdsch >= 0) nr_ue_dlsch_procedures(ue, proc, gNB_id, PDSCH, - ue->dlsch[proc->thread_id][gNB_id][0], + ue->dlsch[gNB_id][0], dlsch1, &ue->dlsch_errors[gNB_id]); - stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]); + stop_meas(&ue->dlsch_procedures_stat); if (cpumeas(CPUMEAS_GETSTATE)) { - LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); - LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat.p_time/(cpuf*1000.0)); + LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat.p_time/(cpuf*1000.0)); } // deactivate dlsch once dlsch proc is done - ue->dlsch[proc->thread_id][gNB_id][0]->active = 0; + ue->dlsch[gNB_id][0]->active = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); @@ -1697,9 +1695,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); - stop_meas(&ue->phy_proc_rx[proc->thread_id]); + stop_meas(&ue->phy_proc_rx); if (cpumeas(CPUMEAS_GETSTATE)) - LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0)); + LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx.p_time/(cpuf*1000.0)); LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_slot_rx); return (0); diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index f429409d5a..4268e1bcaf 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -421,17 +421,15 @@ int main(int argc, char **argv) //nr_init_frame_parms_ue(&UE->frame_parms); //init_nr_ue_transport(UE, 0); int num_codeword = NR_MAX_NB_LAYERS > 4? 2:1; - for (int sf = 0; sf < 2; sf++) { - for (i = 0; i < num_codeword; i++) { - UE->dlsch[sf][0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL); - if (!UE->dlsch[sf][0][i]) { - printf("Can't get ue dlsch structures\n"); - exit(-1); - } + for (i = 0; i < num_codeword; i++) { + UE->dlsch[0][i] = new_nr_ue_dlsch(Kmimo, 8, Nsoft, 5, N_RB_DL); + if (!UE->dlsch[0][i]) { + printf("Can't get ue dlsch structures\n"); + exit(-1); + } - UE->dlsch[sf][0][i]->rnti = n_rnti; - } - } + UE->dlsch[0][i]->rnti = n_rnti; + } unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; processingData_L1tx_t msgDataTx; @@ -476,7 +474,7 @@ int main(int argc, char **argv) unsigned char test_input_bit[16 * 68 * 384]; //estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); unsigned char estimated_output_bit[16 * 68 * 384]; - NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0][0]; + NR_UE_DLSCH_t *dlsch0_ue = UE->dlsch[0][0]; NR_DL_UE_HARQ_t *harq_process = dlsch0_ue->harq_processes[harq_pid]; harq_process->mcs = Imcs; harq_process->mcs_table = mcs_table; @@ -638,9 +636,8 @@ int main(int argc, char **argv) free(RC.gNB); int num_cw = NR_MAX_NB_LAYERS > 4? 2:1; - for (int sf = 0; sf < 2; sf++) - for (int i = 0; i < num_cw; i++) - free_nr_ue_dlsch(&UE->dlsch[sf][0][i], N_RB_DL); + for (int i = 0; i < num_cw; i++) + free_nr_ue_dlsch(&UE->dlsch[0][i], N_RB_DL); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 4836a570f3..71472055ff 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -1028,7 +1028,6 @@ int main(int argc, char **argv) scheduled_response.CC_id = 0; scheduled_response.frame = frame; scheduled_response.slot = slot; - scheduled_response.thread_id = 0; scheduled_response.phy_data = &phy_pdcch_config; nr_ue_phy_config_request(&UE_mac->phy_config); @@ -1077,14 +1076,13 @@ int main(int argc, char **argv) //multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0); UE->rx_offset=0; - UE_proc.thread_id = 0; UE_proc.frame_rx = frame; UE_proc.nr_slot_rx = slot; dcireq.frame = frame; dcireq.slot = slot; - NR_UE_DLSCH_t *dlsch0 = UE->dlsch[UE_proc.thread_id][0][0]; + NR_UE_DLSCH_t *dlsch0 = UE->dlsch[0][0]; int harq_pid = slot; NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid]; @@ -1269,11 +1267,11 @@ int main(int argc, char **argv) //---------------------- count errors ---------------------- //---------------------------------------------------------- - if (UE->dlsch[UE_proc.thread_id][0][0]->last_iteration_cnt >= - UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1) + if (UE->dlsch[0][0]->last_iteration_cnt >= + UE->dlsch[0][0]->max_ldpc_iterations+1) n_errors[round][snrRun]++; - NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id]; + NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars; int16_t *UE_llr = pdsch_vars[0]->llr[0]; TBS = UE_harq_process->TBS;//rel15->TBSize[0]; @@ -1407,9 +1405,9 @@ int main(int argc, char **argv) printStatIndent(&UE->dlsch_unscrambling_stats,"DLSCH unscrambling time"); printStatIndent(&UE->dlsch_rate_unmatching_stats,"DLSCH Rate Unmatching"); printf("|__ DLSCH Turbo Decoding(%d bits), avg iterations: %.1f %.2f us (%d cycles, %d trials)\n", - UE->dlsch[UE_proc.thread_id][0][0]->harq_processes[0]->Cminus ? - UE->dlsch[UE_proc.thread_id][0][0]->harq_processes[0]->Kminus : - UE->dlsch[UE_proc.thread_id][0][0]->harq_processes[0]->Kplus, + UE->dlsch[0][0]->harq_processes[0]->Cminus ? + UE->dlsch[0][0]->harq_processes[0]->Kminus : + UE->dlsch[0][0]->harq_processes[0]->Kplus, UE->dlsch_tc_intl1_stats.trials/(double)UE->dlsch_tc_init_stats.trials, (double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials*timeBase, (int)((double)UE->dlsch_turbo_decoding_stats.diff/UE->dlsch_turbo_decoding_stats.trials), @@ -1429,11 +1427,11 @@ int main(int argc, char **argv) LOG_M("rxsig0.m","rxs0", UE->common_vars.rxdata[0], frame_length_complex_samples, 1, 1); if (UE->frame_parms.nb_antennas_rx>1) LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1); - LOG_M("rxF0.m","rxF0", UE->common_vars.common_vars_rx_data_per_thread[UE_proc.thread_id].rxdataF[0], frame_parms->samples_per_slot_wCP, 1, 1); - LOG_M("rxF_ext.m","rxFe",&UE->pdsch_vars[0][0]->rxdataF_ext[0][0],g_rbSize*12*14,1,1); - LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1); - write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); - LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0); + LOG_M("rxF0.m","rxF0", UE->common_vars.rxdataF[0], frame_parms->samples_per_slot_wCP, 1, 1); + LOG_M("rxF_ext.m","rxFe",&UE->pdsch_vars[0]->rxdataF_ext[0][0],g_rbSize*12*14,1,1); + LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1); + write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); + LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[0]->llr[0],available_bits,1,0); break; } diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6ef8bff116..91377e3d31 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -121,7 +121,7 @@ nrUE_params_t *get_nrUE_params(void) { int main(int argc, char **argv) { char c; - int i,sf; + int i; double SNR, snr0 = -2.0, snr1 = 2.0, SNR_lin; double snr_step = 0.1; uint8_t snr1set = 0; @@ -428,12 +428,10 @@ int main(int argc, char **argv) exit(-1); } - for (sf = 0; sf < 2; sf++) { - UE->ulsch[sf][0] = new_nr_ue_ulsch(N_RB_UL, 8, frame_parms); - if (!UE->ulsch[sf][0]) { - printf("Can't get ue ulsch structures.\n"); - exit(-1); - } + UE->ulsch[0] = new_nr_ue_ulsch(N_RB_UL, 8, frame_parms); + if (!UE->ulsch[0]) { + printf("Can't get ue ulsch structures.\n"); + exit(-1); } unsigned char harq_pid = 0; @@ -451,7 +449,7 @@ int main(int argc, char **argv) NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_processes[harq_pid]; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0]; if ((Nl==4)||(Nl==3)) nb_re_dmrs = nb_re_dmrs*2; @@ -636,8 +634,7 @@ int main(int argc, char **argv) printf("\n"); } - for (sf = 0; sf < 2; sf++) - free_nr_ue_ulsch(&UE->ulsch[sf][0], N_RB_UL, frame_parms); + free_nr_ue_ulsch(&UE->ulsch[0], N_RB_UL, frame_parms); term_nr_ue_signal(UE, 1); free(UE); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 43ac3fc145..7744825dc1 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -868,7 +868,7 @@ int main(int argc, char **argv) nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu; - NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0][0]; + NR_UE_ULSCH_t *ulsch_ue = UE->ulsch[0]; unsigned char *estimated_output_bit; unsigned char *test_input_bit; @@ -1105,7 +1105,6 @@ int main(int argc, char **argv) gNB->ulsch[0]->harq_processes[harq_pid]->round = round; rv_index = nr_rv_round_map[round]; - UE_proc.thread_id = 0; UE_proc.nr_slot_tx = slot; UE_proc.frame_tx = frame; @@ -1188,7 +1187,6 @@ int main(int argc, char **argv) scheduled_response.CC_id = 0; scheduled_response.frame = frame; scheduled_response.slot = slot; - scheduled_response.thread_id = UE_proc.thread_id; scheduled_response.dl_config = NULL; scheduled_response.ul_config = &ul_config; scheduled_response.tx_request = &tx_req; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index ffa8c6f5c1..7dae4e9279 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -141,7 +141,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, int cc_id, frame_t frame, int slot, - int thread_id, void *phy_data); /*! \fn int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP); @@ -353,11 +352,10 @@ and fills the PRACH PDU per each FD occasion. @param module_idP Index of UE instance @param frameP Frame index @param slotP Slot index -@param thread_id RX/TX Thread ID @returns void */ -void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id); -void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id, void *phy_data); +void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); +void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, void *phy_data); void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot); void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index cab9f92a8d..cac302980c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -94,7 +94,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, int cc_id, frame_t frame, int slot, - int thread_id, void *phy_data){ scheduled_response->dl_config = dl_config; @@ -104,7 +103,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, scheduled_response->CC_id = cc_id; scheduled_response->frame = frame; scheduled_response->slot = slot; - scheduled_response->thread_id = thread_id; scheduled_response->phy_data = phy_data; } @@ -1126,7 +1124,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in nr_schedule_csi_for_im(mac, rx_frame, rx_slot); dcireq.dl_config_req = mac->dl_config_request; - fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data); + fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) { LOG_D(NR_MAC,"1# scheduled_response transmitted, %d, %d\n", rx_frame, rx_slot); mac->if_module->scheduled_response(&scheduled_response); @@ -1144,7 +1142,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in fill_dci_search_candidates(mac->ra.ss, rel15, -1 , -1); dl_config->number_pdus = 1; LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } @@ -1253,7 +1251,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } pthread_mutex_unlock(&ul_config->mutex_ul_config); // avoid double lock - fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, ul_info->thread_id, NULL); + fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, NULL); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){ LOG_D(NR_MAC,"3# scheduled_response transmitted,%d, %d\n", frame_tx, slot_tx); mac->if_module->scheduled_response(&scheduled_response); @@ -2318,7 +2316,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) { } -void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, int thread_id, void *phy_data) { +void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, void *phy_data) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); int O_SR = 0; @@ -2410,7 +2408,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in O_SR, O_ACK, O_CSI); LOG_D(NR_MAC, "Configuring pucch, is_common = %d\n", pucch.is_common); nr_scheduled_response_t scheduled_response; - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, phy_data); + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } @@ -2642,7 +2640,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) { // PRACH formats 9, 10, 11 are corresponding to dual PRACH format configurations A1/B1, A2/B2, A3/B3. // - todo: // - Partial configuration is actually already stored in (fapi_nr_prach_config_t) &mac->phy_config.config_req->prach_config -void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, int thread_id) { +void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { uint16_t format, format0, format1, ncs; int is_nr_prach_slot; @@ -2781,7 +2779,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s } } // if format1 - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, NULL); + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, NULL); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } // is_nr_prach_slot @@ -2845,7 +2843,7 @@ void nr_ue_sib1_scheduler(module_id_t module_idP, slot_s = mac->type0_PDCCH_CSS_config.n_c; } LOG_D(MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",dl_config->number_pdus); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, module_idP, cc_id, frame_s, slot_s, 0, phy_data); // TODO fix thread_id, for now assumed 0 + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, module_idP, cc_id, frame_s, slot_s, phy_data); if (dl_config->number_pdus) { if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d3d4a7262d..2b2624b365 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -772,7 +772,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, mac->frame_type) && mac->ra.ra_state != RA_SUCCEEDED) { nr_ue_scheduler(NULL, &ul_info); - nr_ue_prach_scheduler(ul_info.module_id, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id); + nr_ue_prach_scheduler(ul_info.module_id, ul_info.frame_tx, ul_info.slot_tx); } } } @@ -1135,14 +1135,14 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ case SCHED_PUSCH: ret = nr_ue_scheduler(NULL, ul_info); if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) - nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); + nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); break; case SCHED_PUCCH: if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) - nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id, ul_info->phy_data); + nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->phy_data); LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); break; @@ -1204,7 +1204,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ if (ret >= 0) { AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" ); AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" ); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->thread_id, dl_info->phy_data); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->phy_data); nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response); } memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 31a28fcdac..82130a2bbb 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -78,8 +78,6 @@ typedef struct { frame_t frame; /// slot int slot; - /// index of the current UE RX/TX thread - int thread_id; /// NR UE FAPI-like P7 message, direction: L1 to L2 /// data reception indication structure @@ -110,8 +108,6 @@ typedef struct { frame_t frame_tx; /// slot tx uint32_t slot_tx; - /// index of the current UE RX/TX thread - int thread_id; /// dci reception indication structure fapi_nr_dci_indication_t *dci_ind; @@ -133,8 +129,6 @@ typedef struct { frame_t frame; /// slot int slot; - /// index of the current UE RX/TX thread - int thread_id; /// NR UE FAPI-like P7 message, direction: L2 to L1 /// downlink transmission configuration request structure