diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 2d054afbd9..e07c213760 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -27,6 +27,7 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" +#include "executables/softmodem-common.h" /* * NR SLOT PROCESSING SEQUENCE @@ -316,14 +317,9 @@ static void UE_synch(void *arg) { } } -typedef struct processingData_s { - UE_nr_rxtx_proc_t proc; - PHY_VARS_NR_UE *UE; -} processingData_t; - void processSlotTX(void *arg) { - processingData_t *rxtxD = (processingData_t *) arg; + 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; fapi_nr_config_request_t *cfg = &UE->nrUE_config; @@ -354,12 +350,11 @@ void processSlotTX(void *arg) { phy_procedures_nrUE_TX(UE,proc,0); } } - ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); } void processSlotRX(void *arg) { - processingData_t *rxtxD = (processingData_t *) arg; + 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; fapi_nr_config_request_t *cfg = &UE->nrUE_config; @@ -389,14 +384,44 @@ void processSlotRX(void *arg) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); } - } - notifiedFIFO_elt_t *res; - res = pullTpool(UE->txFifo,&(get_nrUE_params()->Tpool)); - processingData_t *curMsg=(processingData_t *)NotifiedFifoData(res); - *curMsg = *rxtxD; - res->key = 1; - pushTpool(&(get_nrUE_params()->Tpool), res); + // Wait for PUSCH processing to finish + notifiedFIFO_elt_t *res; + res = pullTpool(UE->txFifo,&(get_nrUE_params()->Tpool)); + pushNotifiedFIFO_nothreadSafe(UE->txFifo, res); + + if (get_softmodem_params()->usim_test==0) { + pucch_procedures_ue_nr(UE, + gNB_id, + proc, + FALSE); + } + + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(UE, + proc->nr_slot_tx, + &UE->frame_parms,1); + + ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); + + } else { + processSlotTX(rxtxD); + + if (get_softmodem_params()->usim_test==0) { + pucch_procedures_ue_nr(UE, + gNB_id, + proc, + FALSE); + } + + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(UE, + proc->nr_slot_tx, + &UE->frame_parms,1); + + ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); + + } } @@ -524,12 +549,12 @@ void *UE_thread(void *arg) { notifiedFIFO_t rxFifo; UE->rxFifo = &rxFifo; initNotifiedFIFO(&rxFifo); - pushNotifiedFIFO_nothreadSafe(&rxFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 1,&rxFifo,processSlotRX)); + pushNotifiedFIFO_nothreadSafe(&rxFifo, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), 1,&rxFifo,processSlotRX)); notifiedFIFO_t txFifo; UE->txFifo = &txFifo; initNotifiedFIFO(&txFifo); - pushNotifiedFIFO_nothreadSafe(&txFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 1,&txFifo,processSlotTX)); + pushNotifiedFIFO_nothreadSafe(&txFifo, newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), 1,&txFifo,processSlotTX)); int nbSlotProcessing=0; int thread_idx=0; @@ -612,7 +637,7 @@ void *UE_thread(void *arg) { int slot_nr = absolute_slot % nb_slot_frame; notifiedFIFO_elt_t *msgToPush; AssertFatal((msgToPush=pullTpool(&rxFifo,&(get_nrUE_params()->Tpool))) != NULL,"chained list failure"); - processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush); + nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(msgToPush); curMsg->UE=UE; // update thread index for received subframe curMsg->proc.thread_id = thread_idx; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 2d1f061694..5dcea9b257 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -299,19 +299,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); } - if (get_softmodem_params()->usim_test==0) { - LOG_D(PHY, "Generating PUCCH\n"); - pucch_procedures_ue_nr(ue, - gNB_id, - proc, - FALSE); - } - - LOG_D(PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(ue, - slot_tx, - &ue->frame_parms,1); - } if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) { @@ -1867,6 +1854,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } #endif //NR_PDCCH_SCHED + + // Start PUSCH processing here. It runs in parallel with PDSCH processing + notifiedFIFO_elt_t *res; + res = pullTpool(ue->txFifo,&(get_nrUE_params()->Tpool)); + nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(res); + curMsg->proc = *proc; + curMsg->UE = ue; + res->key = 1; + pushTpool(&(get_nrUE_params()->Tpool), res); #if UE_TIMING_TRACE start_meas(&ue->generic_stat); @@ -1999,6 +1995,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } + #if UE_TIMING_TRACE start_meas(&ue->generic_stat); #endif