diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 61665ae71eb8b182351d862a5fdcda373abfde85..6011e47aeed82b83b89999173dd8251d4bcab530 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -3022,6 +3022,7 @@ target_link_libraries(nr_ulschsim add_executable(nr_ulsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 27b0ed08ddbde4c335b8d670aaa98ec95f89f031..b5c2e53a04f02692795301ae93cfca366de09d5e 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -793,6 +793,11 @@ void init_gNB_proc(int inst) { pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL); pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); sync_phy_proc.phy_proc_CC_id = 0; + + gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initTpool("n", gNB->threadPool, true); + initNotifiedFIFO(gNB->respDecode); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index a5c1d2842a09fe8f9c064d24ff57f91ff3946cab..082fbf09668b2280bf1600783a3c5e4cb492f758 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -330,7 +330,7 @@ uint32_t nr_processULSegment(void* arg) { t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats* p_procTime = &procTime ; - start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); + //start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// nr_deinterleaving_ldpc /////////////////////////////////// @@ -367,7 +367,7 @@ uint32_t nr_processULSegment(void* arg) { ///////////////////////// ulsch_harq->e =====> ulsch_harq->d ///////////////////////// - start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); + //start_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats); if (nr_rate_matching_ldpc_rx(Ilbrm, Tbslbrm, @@ -406,7 +406,7 @@ uint32_t nr_processULSegment(void* arg) { length_dec = (ulsch_harq->B+24*ulsch_harq->C)/ulsch_harq->C; } - start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); + //start_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); memset(pv,0,2*ulsch_harq->Z*sizeof(int16_t)); memset((pv+K_bytes_F),127,ulsch_harq->F*sizeof(int16_t)); @@ -456,7 +456,7 @@ uint32_t nr_processULSegment(void* arg) { ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m]; } - stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); + //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); } uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, @@ -493,6 +493,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, int Kr_bytes = Kr>>3; phy_vars_gNB->nbDecode = 0; + harq_process->processedSegments = 0; if (!harq_process) { LOG_E(PHY,"ulsch_decoding.c: NULL harq_process pointer\n"); @@ -619,6 +620,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, rdata->p_decoderParms = p_decParams; rdata->ulsch_llr = ulsch_llr; rdata->Kc = kc; + rdata->harq_pid = harq_pid; rdata->segment_r = r; rdata->nbSegments = harq_process->C; rdata->E = E; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 2c91f3b255b7db89933fb1e4113d037f8cc89314..8f7533369084a1d78211fb044d883e84fa308452 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -268,7 +268,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { LOG_D(PHY, "ULSCH received ok \n"); nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0); } else { - LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n", + LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n", gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot, rdata->harq_pid,ulsch_harq->status, ulsch_harq->round,ulsch_harq->TBS,r); if (ulsch_harq->round >= ulsch->Mlimit) { @@ -354,13 +354,13 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH slot_rx, harq_pid, G); - stop_meas(&gNB->ulsch_decoding_stats); while (gNB->nbDecode > 0) { notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool); nr_postDecode(gNB, req); delNotifiedFIFO_elt(req); } + stop_meas(&gNB->ulsch_decoding_stats); } @@ -374,6 +374,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint16_t mu = gNB->frame_parms.numerology_index; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid]; + printf("ulsch_id %d harq_pid %d\n",ULSCH_id,harq_pid); nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 6c62e96130729fe43c508ccd61265b68b39f96fa..35992e51315ced5cdc1ceeafd8c5fbc31e0a33f0 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -56,6 +56,7 @@ //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" +#include "common/utils/threadPool/thread-pool.h" #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" @@ -470,6 +471,10 @@ int main(int argc, char **argv) RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB)); gNB = RC.gNB[0]; + gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); + gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); + initTpool("n", gNB->threadPool, true); + initNotifiedFIFO(gNB->respDecode); //gNB_config = &gNB->gNB_config; //memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); @@ -1050,9 +1055,9 @@ int main(int argc, char **argv) printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation"); printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling"); printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time"); - printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving"); - printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx"); - printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding"); + //printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving"); + //printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx"); + //printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding"); printf("\n"); }