From 4189af6c7cddaceaf6d46db4bf7b937d3d462942 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 13 Apr 2021 08:28:29 +0200 Subject: [PATCH] Removed common txFifo for multiple threads --- executables/nr-ue.c | 25 +++++++-------------- openair1/PHY/defs_nr_UE.h | 2 +- openair1/SCHED_NR_UE/defs.h | 5 ++++- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 11 +++++---- openair1/SIMULATION/NR_PHY/dlsim.c | 3 ++- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index bb3690e45f..30c551fc5e 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -324,7 +324,6 @@ void processSlotRX(void *arg) { fapi_nr_config_request_t *cfg = &UE->nrUE_config; int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx); int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); - bool isTxRunning = true; uint8_t gNB_id = 0; if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ @@ -340,7 +339,7 @@ void processSlotRX(void *arg) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL ); #else uint64_t a=rdtsc(); - phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel); + phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo); LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500); #endif @@ -352,15 +351,9 @@ void processSlotRX(void *arg) { } // Wait for PUSCH processing to finish - while (isTxRunning) { - notifiedFIFO_elt_t *res; - res = pullTpool(UE->txFifo,&(get_nrUE_params()->Tpool)); - if (res->key == proc->nr_slot_tx) { - isTxRunning = false; - res->key = TX_JOB_ID; - } - pushNotifiedFIFO(UE->txFifo, res); - } + notifiedFIFO_elt_t *res; + res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool)); + delNotifiedFIFO_elt(res); } else { processSlotTX(rxtxD); @@ -514,10 +507,6 @@ void *UE_thread(void *arg) { notifiedFIFO_t freeBlocks; initNotifiedFIFO_nothreadSafe(&freeBlocks); - notifiedFIFO_t txFifo; - UE->txFifo = &txFifo; - initNotifiedFIFO(&txFifo); - int nbSlotProcessing=0; int thread_idx=0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); @@ -528,8 +517,10 @@ void *UE_thread(void *arg) { int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; for (int i=0; itxFifo); + pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt); } while (!oai_exit) { diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 0fa6d90617..e3c0737838 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -1073,7 +1073,6 @@ typedef struct { SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX]; SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX]; #endif - notifiedFIFO_t *txFifo; int dl_stats[5]; @@ -1085,6 +1084,7 @@ typedef struct { typedef struct nr_rxtx_thread_data_s { UE_nr_rxtx_proc_t proc; PHY_VARS_NR_UE *UE; + notifiedFIFO_t txFifo; } nr_rxtx_thread_data_t; #include "SIMULATION/ETH_TRANSPORT/defs.h" diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index f7f44a520d..2675e46a04 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -115,14 +115,17 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t @param proc Pointer to proc information @param gNB_id Local id of eNB on which to act @param dlsch_parallel use multithreaded dlsch processing + @param txFifo Result fifo if PDSCH is run in parallel */ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - uint8_t dlsch_parallel); + uint8_t dlsch_parallel, + notifiedFIFO_t *txFifo); int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type); +void processSlotTX(void *arg); #ifdef UE_SLOT_PARALLELISATION void *UE_thread_slot1_dl_processing(void *arg); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 7afb4e17a3..131aba1923 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1600,7 +1600,8 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - uint8_t dlsch_parallel + uint8_t dlsch_parallel, + notifiedFIFO_t *txFifo ) { int frame_rx = proc->frame_rx; @@ -1759,13 +1760,11 @@ 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); + 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; - res->key = proc->nr_slot_tx; - pushTpool(&(get_nrUE_params()->Tpool), res); + pushTpool(&(get_nrUE_params()->Tpool), newElt); #if UE_TIMING_TRACE start_meas(&ue->generic_stat); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 43d7e7f459..3e91c51057 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -1121,7 +1121,8 @@ int main(int argc, char **argv) phy_procedures_nrUE_RX(UE, &UE_proc, 0, - dlsch_threads); + dlsch_threads, + NULL); //printf("dlsim round %d ends\n",round); round++;