From a01ade336f7b05bae3eced05abda5e43be613c64 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Thu, 3 Nov 2022 21:19:16 -0400 Subject: [PATCH] Start TX slot after receiving slot samples from RU --- executables/nr-ue.c | 60 +++++++-------------- openair1/SCHED_NR_UE/defs.h | 3 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 27 ++++++---- openair1/SIMULATION/NR_PHY/dlsim.c | 3 +- openair1/SIMULATION/NR_PHY/ulsim.c | 4 -- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 15 ++---- 6 files changed, 42 insertions(+), 70 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index b3de5d751a..19284a3d72 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -32,7 +32,6 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "executables/softmodem-common.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h" -#include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" @@ -668,7 +667,7 @@ void UE_processing(nr_rxtx_thread_data_t *rxtxD) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL ); #else uint64_t a=rdtsc_oai(); - phy_procedures_nrUE_RX(UE, proc, gNB_id, &phy_data, &rxtxD->txFifo); + phy_procedures_nrUE_RX(UE, proc, gNB_id, &phy_data); LOG_D(PHY, "In %s: slot %d, time %llu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc_oai()-a)/3500); #endif @@ -678,46 +677,6 @@ void UE_processing(nr_rxtx_thread_data_t *rxtxD) { 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); } - - // Wait for PUSCH processing to finish - notifiedFIFO_elt_t *res; - res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool)); - if (res == NULL) - return; // Tpool has been stopped - delNotifiedFIFO_elt(res); - } - - if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) { - nr_phy_data_tx_t phy_data = {0}; - if (UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) { - nr_uplink_indication_t ul_indication; - memset((void*)&ul_indication, 0, sizeof(ul_indication)); - ul_indication.module_id = UE->Mod_id; - ul_indication.gNB_index = gNB_id; - ul_indication.cc_id = UE->CC_id; - ul_indication.frame_rx = proc->frame_rx; - 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.ue_sched_mode = SCHED_PUCCH; - ul_indication.phy_data = &phy_data; - UE->if_inst->ul_indication(&ul_indication); - } - if (UE->UE_mode[gNB_id] <= PUSCH) { - pucch_procedures_ue_nr(UE, - gNB_id, - proc, - &phy_data); - } - - LOG_D(PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(UE, - proc->nr_slot_tx, - &UE->frame_parms, - UE->frame_parms.nb_antennas_tx); - - if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) - nr_ue_prach_procedures(UE, proc, proc->gNB_id); } ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); @@ -911,6 +870,7 @@ void *UE_thread(void *arg) { int slot_nr = absolute_slot % nb_slot_frame; nr_rxtx_thread_data_t curMsg = {0}; + initNotifiedFIFO(&curMsg.txFifo); curMsg.UE=UE; // update thread index for received subframe curMsg.proc.CC_id = UE->CC_id; @@ -980,8 +940,24 @@ void *UE_thread(void *arg) { UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp; + // Start TX slot processing here. It runs in parallel with RX slot processing + notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, &curMsg.txFifo, processSlotTX); + nr_rxtx_thread_data_t *curMsgTx = (nr_rxtx_thread_data_t *) NotifiedFifoData(newElt); + curMsgTx->proc = curMsg.proc; + curMsgTx->UE = UE; + pushTpool(&(get_nrUE_params()->Tpool), newElt); + + // RX slot processing UE_processing(&curMsg); + // Wait for PUSCH processing to finish + notifiedFIFO_elt_t *res; + res = pullTpool(&curMsg.txFifo, &(get_nrUE_params()->Tpool)); + if (res == NULL) + LOG_E(PHY, "Tpool has been aborted\n"); + else + delNotifiedFIFO_elt(res); + 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 diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index 4e65074c43..89e5d7501c 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -109,8 +109,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - nr_phy_data_t *phy_data, - notifiedFIFO_t *txFifo); + nr_phy_data_t *phy_data); int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index af44860664..fd916797cc 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -297,6 +297,23 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, if (ue->UE_mode[gNB_id] == PUSCH) { ue_srs_procedures_nr(ue, proc, gNB_id); } + + if (ue->UE_mode[gNB_id] <= PUSCH) { + pucch_procedures_ue_nr(ue, + gNB_id, + proc, + phy_data); + } + + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(ue, + proc->nr_slot_tx, + &ue->frame_parms, + ue->frame_parms.nb_antennas_tx); + + if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) + nr_ue_prach_procedures(ue, proc, proc->gNB_id); + LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); @@ -981,8 +998,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - nr_phy_data_t *phy_data, - notifiedFIFO_t *txFifo) { + nr_phy_data_t *phy_data) { int frame_rx = proc->frame_rx; int nr_slot_rx = proc->nr_slot_rx; @@ -1176,13 +1192,6 @@ 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 *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), proc->nr_slot_tx,txFifo,processSlotTX); - nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt); - curMsg->proc = *proc; - curMsg->UE = ue; - curMsg->ue_sched_mode = SCHED_PUSCH; - pushTpool(&(get_nrUE_params()->Tpool), newElt); start_meas(&ue->generic_stat); // do procedures for C-RNTI int ret_pdsch = 0; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 68f63d9512..0d2f7667be 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -1267,8 +1267,7 @@ int main(int argc, char **argv) phy_procedures_nrUE_RX(UE, &UE_proc, 0, - &phy_data, - NULL); + &phy_data); //---------------------------------------------------------- //---------------------- count errors ---------------------- diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 5355f34d65..5a3be4306d 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1243,10 +1243,6 @@ int main(int argc, char **argv) phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id, &phy_data); - /* We need to call common sending function to send signal */ - LOG_D(PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(UE, slot, &UE->frame_parms, UE->frame_parms.nb_antennas_tx); - if (n_trials == 1) { LOG_M("txsig0.m", "txs0", &UE->common_vars.txdata[0][slot_offset], slot_length, 1, 1); LOG_M("txsig0F.m", "txs0F", UE->common_vars.txdataF[0], frame_parms->ofdm_symbol_size * 14, 1, 1); diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index e606c409b4..d93a4ada98 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1140,17 +1140,10 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ 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); - switch (ul_info->ue_sched_mode) { - 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); - 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->phy_data); - break; + 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_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->phy_data); + nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); } switch(ret){