diff --git a/nfapi/nfapi_vnf.c b/nfapi/nfapi_vnf.c index b361f62f6faa87e8be974c7901f3c9d8e315de24..c37b0928651600f5a5dfbd8032a6b2172bbada2f 100644 --- a/nfapi/nfapi_vnf.c +++ b/nfapi/nfapi_vnf.c @@ -291,6 +291,7 @@ int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessag void install_schedule_handlers(IF_Module_t *if_inst); extern int single_thread_flag; extern void init_eNB_afterRU(void); +extern uint16_t sf_ahead; void oai_create_enb(void) { @@ -512,7 +513,7 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) } #endif - // wake up TX for subframe n+4 + // wake up TX for subframe n+sf_ahead // lock the TX mutex and make sure the thread is ready if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx ); @@ -542,13 +543,13 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired // transmitted timestamp of the next TX slot (first). // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, - // we want to generate subframe (n+4), so TS_tx = TX_rx+4*samples_per_tti, - // and proc->subframe_tx = proc->subframe_rx+4 - proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); + // we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti, + // and proc->subframe_tx = proc->subframe_rx+sf_ahead + proc_rxtx->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); proc_rxtx->frame_rx = proc->frame_rx; proc_rxtx->subframe_rx = proc->subframe_rx; - proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; - proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10; + proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; + proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10; LOG_E(PHY, "sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d timestamp_rx:%ld timestamp_tx:%ld] proc_rxtx[instance_cnt_rxtx:%d frame_rx:%d subframe_rx:%d]\n", sfn, sf, proc->frame_rx, proc->subframe_rx, proc->timestamp_rx, proc->timestamp_tx, proc_rxtx->instance_cnt_rxtx, proc_rxtx->frame_rx, proc_rxtx->subframe_rx); diff --git a/open-nfapi.oai.patch b/open-nfapi.oai.patch index 1fefcdcab31cf62c6fbd992770d1a79b85986182..48fad9e48e997abb4d2117ed5d2060e19b58b223 100644 --- a/open-nfapi.oai.patch +++ b/open-nfapi.oai.patch @@ -289,10 +289,10 @@ index 74f29a0..7310fc0 100644 } diff --git a/pnf/src/pnf_p7.c b/pnf/src/pnf_p7.c -index 0fd7828..db08efb 100644 +index 0fd7828..c980086 100644 --- a/pnf/src/pnf_p7.c +++ b/pnf/src/pnf_p7.c -@@ -25,12 +25,61 @@ +@@ -25,12 +25,64 @@ #include <unistd.h> #include <errno.h> #include <pthread.h> @@ -303,6 +303,9 @@ index 0fd7828..db08efb 100644 #define FAPI2_IP_DSCP 0 -uint32_t get_current_time_hr() ++extern uint16_t sf_ahead; ++//uint16_t sf_ahead=4; ++ +void add_sf(uint16_t *frameP, uint16_t *subframeP, int offset) +{ + *frameP = *frameP + ((*subframeP + offset) / 10); @@ -355,7 +358,7 @@ index 0fd7828..db08efb 100644 { struct timeval now; (void)gettimeofday(&now, NULL); -@@ -64,11 +113,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr) +@@ -64,11 +116,14 @@ void pnf_p7_free(pnf_p7_t* pnf_p7, void* ptr) // todo : for now these just malloc/free need to move to a memory cache nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7) { @@ -371,7 +374,7 @@ index 0fd7828..db08efb 100644 if(pnf_p7->_public.codec_config.deallocate) { (pnf_p7->_public.codec_config.deallocate)(req->dl_config_request_body.dl_config_pdu_list); -@@ -83,11 +135,14 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t +@@ -83,11 +138,14 @@ void deallocate_nfapi_dl_config_request(nfapi_dl_config_request_t* req, pnf_p7_t nfapi_ul_config_request_t* allocate_nfapi_ul_config_request(pnf_p7_t* pnf_p7) { @@ -387,7 +390,7 @@ index 0fd7828..db08efb 100644 if(pnf_p7->_public.codec_config.deallocate) { (pnf_p7->_public.codec_config.deallocate)(req->ul_config_request_body.ul_config_pdu_list); -@@ -107,6 +162,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7) +@@ -107,6 +165,7 @@ nfapi_hi_dci0_request_t* allocate_nfapi_hi_dci0_request(pnf_p7_t* pnf_p7) void deallocate_nfapi_hi_dci0_request(nfapi_hi_dci0_request_t* req, pnf_p7_t* pnf_p7) { @@ -395,7 +398,7 @@ index 0fd7828..db08efb 100644 if(pnf_p7->_public.codec_config.deallocate) { (pnf_p7->_public.codec_config.deallocate)(req->hi_dci0_request_body.hi_dci0_pdu_list); -@@ -127,6 +183,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7) +@@ -127,6 +186,9 @@ nfapi_tx_request_t* allocate_nfapi_tx_request(pnf_p7_t* pnf_p7) void deallocate_nfapi_tx_request(nfapi_tx_request_t* req, pnf_p7_t* pnf_p7) { int i = 0; @@ -405,7 +408,7 @@ index 0fd7828..db08efb 100644 for(i = 0; i < req->tx_request_body.number_of_pdus; ++i) { void* data = req->tx_request_body.tx_pdu_list[i].segments[0].segment_data; -@@ -307,11 +366,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas +@@ -307,11 +369,11 @@ void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reas } @@ -419,7 +422,7 @@ index 0fd7828..db08efb 100644 return 0; } else -@@ -482,29 +541,41 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7) +@@ -482,29 +544,41 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7) void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf) { @@ -466,7 +469,7 @@ index 0fd7828..db08efb 100644 (pnf_p7->_public.lbt_dl_config_req)(&pnf_p7->_public, pnf_p7->_public.dummy_subframe.lbt_dl_config_req); } } -@@ -526,10 +597,14 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -526,10 +600,14 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) return -1; } @@ -476,13 +479,13 @@ index 0fd7828..db08efb 100644 + pnf_p7->sf_start_time_hr = pnf_get_current_time_hr(); pnf_p7->sfn_sf = sfn_sf; -+ uint32_t sfn_sf_tx = sfnsf_add_sf(sfn_sf, 4); ++ uint32_t sfn_sf_tx = sfnsf_add_sf(sfn_sf, sf_ahead); + uint32_t tx_sfn_sf_dec = NFAPI_SFNSF2DEC(sfn_sf_tx); + // If the subframe_buffer has been configured if(pnf_p7->_public.subframe_buffer_size != 0) { -@@ -550,6 +625,10 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -550,6 +628,10 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/sf (%d -> %d)\n", pnf_p7->sfn_sf_shift, NFAPI_SFNSF2DEC(sfn_sf), shifted_sfn_sf); sfn_sf = shifted_sfn_sf; @@ -493,7 +496,7 @@ index 0fd7828..db08efb 100644 pnf_p7->sfn_sf_shift = 0; } -@@ -558,77 +637,104 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -558,77 +640,104 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) nfapi_pnf_p7_subframe_buffer_t* subframe_buffer = &(pnf_p7->subframe_buffer[buffer_index]); @@ -624,7 +627,7 @@ index 0fd7828..db08efb 100644 } } -@@ -637,7 +743,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -637,7 +746,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) if(pnf_p7->_public.lbt_dl_config_req) (pnf_p7->_public.lbt_dl_config_req)(&(pnf_p7->_public), subframe_buffer->lbt_dl_config_req); @@ -633,7 +636,7 @@ index 0fd7828..db08efb 100644 } else { -@@ -650,14 +756,31 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -650,14 +759,31 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) } @@ -666,7 +669,7 @@ index 0fd7828..db08efb 100644 // send the periodic timing info if configured if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period) { -@@ -678,14 +801,15 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -678,14 +804,15 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) } else { @@ -684,7 +687,7 @@ index 0fd7828..db08efb 100644 pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late, pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late, pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late, -@@ -694,6 +818,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) +@@ -694,6 +821,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats)); } pnf_p7->tick++; @@ -692,7 +695,7 @@ index 0fd7828..db08efb 100644 if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0) { -@@ -724,7 +849,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) +@@ -724,7 +852,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) if(recv_sfn_sf_dec > ((current_sfn_sf_dec + timing_window) % NFAPI_MAX_SFNSFDEC)) { // out of window @@ -701,7 +704,7 @@ index 0fd7828..db08efb 100644 } else { -@@ -736,7 +861,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) +@@ -736,7 +864,7 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) else { // too late @@ -710,7 +713,7 @@ index 0fd7828..db08efb 100644 } } -@@ -751,8 +876,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) +@@ -751,8 +879,8 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) } else { @@ -721,7 +724,7 @@ index 0fd7828..db08efb 100644 } } -@@ -785,15 +910,32 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_ +@@ -785,15 +913,32 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_ return; } @@ -759,7 +762,7 @@ index 0fd7828..db08efb 100644 //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)", // pMyPhyInfo->sfnSf, bufferIdx, // SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf)); -@@ -994,6 +1136,16 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) +@@ -994,6 +1139,16 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) uint32_t sfn_sf_dec = NFAPI_SFNSF2DEC(req->sfn_sf); uint8_t buffer_index = sfn_sf_dec % pnf_p7->_public.subframe_buffer_size; @@ -776,7 +779,7 @@ index 0fd7828..db08efb 100644 if(pnf_p7->subframe_buffer[buffer_index].tx_req != 0) { //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing tx_req at index %d (%d/%d)", -@@ -1010,6 +1162,8 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) +@@ -1010,6 +1165,8 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) } else { @@ -785,7 +788,7 @@ index 0fd7828..db08efb 100644 deallocate_nfapi_tx_request(req, pnf_p7); if(pnf_p7->_public.timing_info_mode_aperiodic) -@@ -1126,12 +1280,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t +@@ -1126,12 +1283,27 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr); uint32_t t2 = (NFAPI_SFNSF2DEC(sfn_sf) * 1000) + sf_time_us; @@ -814,7 +817,7 @@ index 0fd7828..db08efb 100644 uint32_t sf_time_us = get_sf_time(now_time_hr, sf_start_time_hr); -@@ -1391,6 +1560,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time) +@@ -1391,6 +1563,8 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time) // read the segment recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size); @@ -823,7 +826,7 @@ index 0fd7828..db08efb 100644 if(recvfrom_result > 0) { pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time); -@@ -1417,7 +1588,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time) +@@ -1417,7 +1591,10 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time) // need to update the time as we would only use the value from the // select @@ -835,7 +838,7 @@ index 0fd7828..db08efb 100644 } while(recvfrom_result > 0); } -@@ -1512,7 +1686,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7) +@@ -1512,7 +1689,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7) selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout); diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 69836209db720dfdf2999eb76728a33221d194f8..5e754416438c3e4f98480d9bf3ff6a1f46fc6e96 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -832,8 +832,7 @@ int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) for (i=0; i<NUMBER_OF_UE_MAX; i++) { AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i); AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i); - LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", - rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); + //LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); if ((eNB->dlsch[i][0]->harq_mask >0) && (eNB->dlsch[i][0]->rnti==rnti)) return i; else if ((eNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i; diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 73fa7608970939e26ec8aa5a8bb6fdae47691799..8603815cd235ee57521edbcaba28d5c3acaf6dc4 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -615,7 +615,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) eNB->pdcch_vars[subframe&1].num_dci = number_dci; eNB->phich_vars[subframe&1].num_hi = 0; - LOG_D(PHY,"NFAPI: Frame %d, Subframe %d: received %d dl_pdu, %d tx_req, %d hi_dci0_config_req, %d UL_config num_pdcch_symbols:%d\n", + LOG_D(PHY,"NFAPI: Sched_INFO[Frame %d, Subframe %d]: %d dl_pdu, %d tx_req, %d hi_dci0_config_req, %d UL_config num_pdcch_symbols:%d\n", frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu, eNB->pdcch_vars[subframe&1].num_pdcch_symbols ); diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index be5983d1bfd3227c252a543a77f3216faa7b099a..43ae586b7905ac49d141ec367a6b3d4611797e79 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -552,11 +552,11 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,1); generate_phich_top(eNB, proc, AMP); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PHICH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+offset,0); if (do_meas==1) stop_meas(&eNB->phy_proc_tx); diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 6f3682afe6e9dddca6514976fbbff55866211c60..73865e6c39da701e53b5842b2ad67658672571f3 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -74,9 +74,12 @@ void feptx0(RU_t *ru,int slot) { ((fp->Ncp==1) ? 6 : 7); int subframe = ru->proc.subframe_tx; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 1 ); + slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1)); - // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); + //LOG_D(PHY,"SFN/SF:RU:TX:%d/%d Generating slot %d\n",ru->proc.frame_tx, ru->proc.subframe_tx,slot); for (aa=0; aa<ru->nb_tx; aa++) { if (fp->Ncp == EXTENDED) PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot*slot_sizeF], @@ -132,6 +135,7 @@ void feptx0(RU_t *ru,int slot) { } } } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+slot , 0); } static void *feptx_thread(void *param) { @@ -359,6 +363,10 @@ void feptx_prec(RU_t *ru) { eNB = eNB_list[0]; fp = &eNB->frame_parms; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 1); + + //LOG_D(PHY, "%s() subframe:%d\n", __FUNCTION__, subframe); + if (0) LOG_E(PHY,"%s() run->nb_tx:%u subframe:%u fp->symbols_per_tti:%u fp->ofdm_symbol_size:%u symbols:(%d, %d), (%d,%d)\n", __FUNCTION__, ru->nb_tx, subframe, fp->symbols_per_tti, fp->ofdm_symbol_size, ((short*)&eNB->common_vars.txdataF[0][1])[0], @@ -371,6 +379,8 @@ void feptx_prec(RU_t *ru) { memcpy((void*)ru->common.txdataF_BF[aa], (void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size], fp->symbols_per_tti*fp->ofdm_symbol_size*sizeof(int32_t)); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC , 0); } else { for (i=0;i<ru->num_eNB;i++) { @@ -406,6 +416,8 @@ void fep0(RU_t *ru,int slot) { // printf("fep0: slot %d\n",slot); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 1); + remove_7_5_kHz(ru,(slot&1)+(proc->subframe_rx<<1)); for (l=0; l<fp->symbols_per_tti/2; l++) { slot_fep_ul(ru, @@ -414,6 +426,7 @@ void fep0(RU_t *ru,int slot) { 0 ); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+slot, 0); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 90afc492334371792e9b5d4faa14fd10d98e04a8..569d479a03c7c80018511063eebd066db6b48b35 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -63,6 +63,7 @@ #include "T.h" extern uint8_t nfapi_mode; +extern int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req); void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset) { @@ -210,6 +211,9 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_ hi_dci0_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4); hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; + oai_nfapi_hi_dci0_req(hi_dci0_req); + hi_dci0_req_body->number_of_hi=0; + LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi); // save UL scheduling information for preprocessor diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index 1ff08502abc6ecbfe9d6f7afe84c57cf5f80e9a7..d76d1704fb7e78d2377d1796895a3bf40e74406b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -631,7 +631,7 @@ schedule_SI( 0); // not used in this case if (bcch_sdu_length > 0) { - LOG_D(MAC,"[eNB %d] Frame %d subframe %d : BCCH->DLSCH CC_id %d, Received %d bytes \n",module_idP,frameP,subframeP,CC_id,bcch_sdu_length); + //LOG_D(MAC,"[eNB %d] Frame %d subframe %d : BCCH->DLSCH CC_id %d, Received %d bytes \n",module_idP,frameP,subframeP,CC_id,bcch_sdu_length); // Allocate 4 PRBs in a random location /* @@ -702,7 +702,7 @@ schedule_SI( dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t)(sizeof(nfapi_dl_config_dci_dl_pdu)); dl_req->number_dci++; - LOG_D(MAC, "%s() number_dci:%u\n", __FUNCTION__, dl_req->number_dci); + //LOG_D(MAC, "%s() number_dci:%u\n", __FUNCTION__, dl_req->number_dci); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4; @@ -720,17 +720,16 @@ schedule_SI( dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST; dl_config_request->sfn_sf = sfn_sf; - LOG_D(MAC, "%s() mcs:%d bcch_sdu_length:%d N_RB_DL:%d first_rb:%d resource_block_coding:%d\n", __FUNCTION__, mcs, bcch_sdu_length, N_RB_DL, first_rb, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding); + //LOG_D(MAC, "%s() mcs:%d bcch_sdu_length:%d N_RB_DL:%d first_rb:%d resource_block_coding:%d\n", __FUNCTION__, mcs, bcch_sdu_length, N_RB_DL, first_rb, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding); if (!CCE_allocation_infeasible(module_idP,CC_id,0,subframeP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,SI_RNTI)) { - LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", - frameP,subframeP); + //LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP,subframeP); dl_req->number_dci++; dl_req->number_pdu++; dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG; - LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP,subframeP); + //LOG_D(MAC,"Frame %d: Subframe %d : Adding common DCI for S_RNTI\n", frameP,subframeP); dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); @@ -786,7 +785,7 @@ schedule_SI( eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG; eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST; - if (frameP%100==0) LOG_D(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n", + if (0 && frameP%100==0) LOG_D(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(eNB->TX_req[CC_id].sfn_sf), eNB->TX_req[CC_id].tx_request_body.number_of_pdus, TX_req->pdu_length, TX_req->pdu_index, TX_req->num_segments, TX_req->segments[0].segment_length); } @@ -815,7 +814,7 @@ schedule_SI( bcch_sdu_length, mcs); } else { - LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", + if (0) LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH->DLSCH (FDD) for CC_id %d SI %d bytes (mcs %d, rb 3)\n", frameP, CC_id, bcch_sdu_length, diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index cbb0e6c3535f99f5007c5bfde0a2a9c517544e45..090e822a072bcd98800e6dd0974e0342e65777db 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -538,7 +538,7 @@ schedule_ue_spec( VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id); + //LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n",CC_id); dl_req = &eNB->DL_req[CC_id].dl_config_request_body; @@ -585,8 +585,7 @@ schedule_ue_spec( if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,aggregation,rnti) ) { - LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", - module_idP, frameP, UE_id, CC_id); + //LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", module_idP, frameP, UE_id, CC_id); continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 44145a4619253657762f263e9ba2b73dc356c26c..a4bd28b4e6c2a283a6f5774562e41298bf361703 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1692,8 +1692,7 @@ unsigned char get_aggregation (uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt) LOG_W(MAC,"unsupported DCI format %d\n",dci_fmt); } - LOG_D(MAC,"Aggregation level %d (cqi %d, bw_index %d, format %d)\n", - 1<<aggregation, cqi,bw_index,dci_fmt); + //LOG_D(MAC,"Aggregation level %d (cqi %d, bw_index %d, format %d)\n", 1<<aggregation, cqi,bw_index,dci_fmt); return 1<<aggregation; } @@ -2700,7 +2699,7 @@ int allocate_CCEs(int module_idP, int i,j,idci; int nCCE=0; - LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",subframeP,test_onlyP,DL_req->number_pdu,DL_req->number_dci,HI_DCI0_req->number_of_dci); + //LOG_D(MAC,"Allocate CCEs subframe %d, test %d : (DL PDU %d, DL DCI %d, UL %d)\n",subframeP,test_onlyP,DL_req->number_pdu,DL_req->number_dci,HI_DCI0_req->number_of_dci); DL_req->number_pdcch_ofdm_symbols=1; try_again: @@ -2712,7 +2711,7 @@ try_again: if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==2) ) { - LOG_D(MAC,"Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", + if (0) LOG_D(MAC,"Trying to allocate COMMON DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, DL_req->number_dci,HI_DCI0_req->number_of_dci, dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti, @@ -2761,10 +2760,10 @@ try_again: // the allocation is feasible, rnti rule passes nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level; - LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); + //LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); if (test_onlyP == 0) { dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; - LOG_D(MAC,"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",subframeP,test_onlyP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,fCCE); + //LOG_D(MAC,"Allocate COMMON DCI CCEs subframe %d, test %d => L %d fCCE %d\n",subframeP,test_onlyP,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,fCCE); } idci++; } @@ -2838,7 +2837,7 @@ try_again: // allocate DL UE specific DCIs if ((dl_config_pdu[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)&& (dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type==1)) { - LOG_D(MAC,"Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", + if (0)LOG_D(MAC,"Trying to allocate DL UE-SPECIFIC DCI %d/%d (%d,%d) : rnti %x, aggreg %d nCCE %d / %d (num_pdcch_symbols %d)\n", idci,DL_req->number_dci+HI_DCI0_req->number_of_dci, DL_req->number_dci,HI_DCI0_req->number_of_dci, dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti,dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, @@ -2887,10 +2886,10 @@ try_again: // the allocation is feasible, rnti rule passes nCCE += dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level; - LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); + //LOG_D(MAC,"Allocating at nCCE %d\n",fCCE); if (test_onlyP == 0) { dl_config_pdu[i].dci_dl_pdu.dci_dl_pdu_rel8.cce_idx=fCCE; - LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); + //LOG_D(MAC,"Allocate CCEs subframe %d, test %d\n",subframeP,test_onlyP); } idci++; } diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index 0792b413d5a2706a3742622ccf04fb1994a92fc5..feb568552aff25c80db878c103be5a8744eb3aab 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -891,7 +891,7 @@ void dlsch_scheduler_pre_processor_reset (int module_idP, #endif - LOG_D(MAC,"Running preprocessor for UE %d (%x)\n",UE_id,rnti); + //LOG_D(MAC,"Running preprocessor for UE %d (%x)\n",UE_id,rnti); // initialize harq_pid and round if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--; @@ -1014,11 +1014,11 @@ void dlsch_scheduler_pre_processor_reset (int module_idP, for (j = 0; j < rb_size; j++) { if (vrb_map[j+(i*RBGsize)] != 0) { rballoc_sub[CC_id][i] = 1; - LOG_D(MAC,"Frame %d, subframe %d : vrb %d allocated\n",frameP,subframeP,j+(i*RBGsize)); + //LOG_D(MAC,"Frame %d, subframe %d : vrb %d allocated\n",frameP,subframeP,j+(i*RBGsize)); break; } } - LOG_D(MAC,"Frame %d Subframe %d CC_id %d RBG %i : rb_alloc %d\n",frameP,subframeP,CC_id,i,rballoc_sub[CC_id][i]); + //LOG_D(MAC,"Frame %d Subframe %d CC_id %d RBG %i : rb_alloc %d\n",frameP,subframeP,CC_id,i,rballoc_sub[CC_id][i]); MIMO_mode_indicator[CC_id][i] = 2; } } @@ -1124,7 +1124,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, } } - LOG_D(MAC,"In ulsch_preprocessor: step2 \n"); + //LOG_D(MAC,"In ulsch_preprocessor: step2 \n"); // step 2: calculate the average rb per UE total_ue_count =0; max_num_ue_to_be_scheduled=0; @@ -1142,11 +1142,11 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, UE_id = i; - LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x\n",UE_id,rnti); + //LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x\n",UE_id,rnti); for (n=0; n<UE_list->numactiveULCCs[UE_id]; n++) { // This is the actual CC_id in the list CC_id = UE_list->ordered_ULCCids[n][UE_id]; - LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x CCid %d\n",UE_id,rnti,CC_id); + //LOG_D(MAC,"In ulsch_preprocessor: handling UE %d/%x CCid %d\n",UE_id,rnti,CC_id); UE_template = &UE_list->UE_template[CC_id][UE_id]; average_rbs_per_user[CC_id]=0; @@ -1177,9 +1177,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, } } } - if (total_ue_count > 0) - LOG_D(MAC,"[eNB %d] Frame %d subframe %d: total ue to be scheduled %d/%d\n", - module_idP, frameP, subframeP,total_ue_count, max_num_ue_to_be_scheduled); + //if (total_ue_count > 0) LOG_D(MAC,"[eNB %d] Frame %d subframe %d: total ue to be scheduled %d/%d\n", module_idP, frameP, subframeP,total_ue_count, max_num_ue_to_be_scheduled); //LOG_D(MAC,"step3\n"); @@ -1209,7 +1207,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, } total_allocated_rbs[CC_id]+= nb_allocated_rbs[CC_id][UE_id]; - LOG_D(MAC,"In ulsch_preprocessor: assigning %d RBs for UE %d/%x CCid %d, harq_pid %d\n",nb_allocated_rbs[CC_id][UE_id],UE_id,rnti,CC_id,harq_pid); + //LOG_D(MAC,"In ulsch_preprocessor: assigning %d RBs for UE %d/%x CCid %d, harq_pid %d\n",nb_allocated_rbs[CC_id][UE_id],UE_id,rnti,CC_id,harq_pid); } } @@ -1245,8 +1243,8 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, } } else { UE_template->pre_allocated_nb_rb_ul= nb_allocated_rbs[CC_id][UE_id]; - LOG_D(MAC,"******************UL Scheduling Information for UE%d CC_id %d ************************\n",UE_id, CC_id); - LOG_D(MAC,"[eNB %d] total RB allocated for UE%d CC_id %d = %d\n", module_idP, UE_id, CC_id, UE_template->pre_allocated_nb_rb_ul); + //LOG_D(MAC,"******************UL Scheduling Information for UE%d CC_id %d ************************\n",UE_id, CC_id); + //LOG_D(MAC,"[eNB %d] total RB allocated for UE%d CC_id %d = %d\n", module_idP, UE_id, CC_id, UE_template->pre_allocated_nb_rb_ul); } } } @@ -1255,7 +1253,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { if (total_allocated_rbs[CC_id]>0) { - LOG_D(MAC,"[eNB %d] total RB allocated for all UEs = %d/%d\n", module_idP, total_allocated_rbs[CC_id], N_RB_UL - first_rb[CC_id]); + //LOG_D(MAC,"[eNB %d] total RB allocated for all UEs = %d/%d\n", module_idP, total_allocated_rbs[CC_id], N_RB_UL - first_rb[CC_id]); } } } diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index 356e23a08d72a8e08ca01dfccf6bd9f1e71fc033..b76a7171255185425badfbadd0e35114de7de1c2 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -15,6 +15,7 @@ extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern uint8_t nfapi_mode; +extern uint16_t sf_ahead; void handle_rach(UL_IND_t *UL_info) { int i; @@ -135,8 +136,8 @@ void handle_harq(UL_IND_t *UL_info) { for (i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++) harq_indication(UL_info->module_id, UL_info->CC_id, - UL_info->frame, - UL_info->subframe, + NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf), + NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf), &UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]); UL_info->harq_ind.harq_indication_body.number_of_harqs=0; @@ -206,13 +207,13 @@ void handle_ulsch(UL_IND_t *UL_info) { } // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++) } - if (NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf) == UL_info->frame && NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf) == UL_info->subframe && UL_info->rx_ind.rx_indication_body.number_of_pdus>0) + if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0) { UL_info->rx_ind.rx_indication_body.number_of_pdus = 0; LOG_D(PHY, "UL_INFO:SFN/SF:%d/%d ZEROING rx_ind.number_of_pdus:%d \n", UL_info->frame, UL_info->subframe, UL_info->rx_ind.rx_indication_body.number_of_pdus); } - if (NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf) == UL_info->frame && NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf) == UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) + if (UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) { LOG_D(PHY, "UL_INFO:SFN/SF:%d/%d crcs:%d Reset to zero\n", UL_info->frame, UL_info->subframe, UL_info->crc_ind.crc_indication_body.number_of_crcs); UL_info->crc_ind.crc_indication_body.number_of_crcs=0; @@ -557,19 +558,19 @@ void UL_indication(UL_IND_t *UL_info) if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) { eNB_dlsch_ulsch_scheduler(module_id, - (UL_info->frame+((UL_info->subframe>5)?1:0)) % 1024, - (UL_info->subframe+4)%10); + (UL_info->frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024, + (UL_info->subframe+sf_ahead)%10); ifi->CC_mask = 0; sched_info->module_id = module_id; sched_info->CC_id = CC_id; - sched_info->frame = (UL_info->frame + ((UL_info->subframe>5) ? 1 : 0)) % 1024; - sched_info->subframe = (UL_info->subframe+4)%10; + sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024; + sched_info->subframe = (UL_info->subframe+sf_ahead)%10; sched_info->DL_req = &mac->DL_req[CC_id]; sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id]; if ((mac->common_channels[CC_id].tdd_Config==NULL) || - (is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+4)%10)>0)) + (is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0)) sched_info->UL_req = &mac->UL_req[CC_id]; else sched_info->UL_req = NULL; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index d2ac1b6dea7ce12eab0b1919d24a5d03d8260113..51ac9c40b30c6ed1ba828f9595e30fd92ac50c57 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -121,6 +121,8 @@ extern int transmission_mode; extern int oaisim_flag; +uint16_t sf_ahead=2; + //pthread_t main_eNB_thread; time_stats_t softmodem_stats_mt; // main thread @@ -236,7 +238,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam pthread_mutex_unlock(&eNB->UL_INFO_mutex); // ***************************************** - // TX processing for subframe n+4 + // TX processing for subframe n+sf_ahead // run PHY TX procedures the one after the other for all CCs to avoid race conditions // (may be relaxed in the future for performance reasons) // ***************************************** @@ -348,8 +350,8 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string) proc_rxtx->subframe_rx = proc->subframe_rx; proc_rxtx->frame_rx = proc->frame_rx; - proc_rxtx->subframe_tx = (proc->subframe_rx+4)%10; - proc_rxtx->frame_tx = (proc->subframe_rx>5) ? (1+proc->frame_rx)&1023 : proc->frame_rx; + proc_rxtx->subframe_tx = (proc->subframe_rx+sf_ahead)%10; + proc_rxtx->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (1+proc->frame_rx)&1023 : proc->frame_rx; proc->frame_tx = proc_rxtx->frame_tx; proc_rxtx->timestamp_tx = proc->timestamp_tx; @@ -412,7 +414,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { } #endif - // wake up TX for subframe n+4 + // wake up TX for subframe n+2 // lock the TX mutex and make sure the thread is ready if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) { LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx ); @@ -427,13 +429,13 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired // transmitted timestamp of the next TX slot (first). // The last (TS_rx mod samples_per_frame) was n*samples_per_tti, - // we want to generate subframe (n+4), so TS_tx = TX_rx+4*samples_per_tti, - // and proc->subframe_tx = proc->subframe_rx+4 - proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); + // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti, + // and proc->subframe_tx = proc->subframe_rx+sf_ahead + proc_rxtx->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_tti); proc_rxtx->frame_rx = proc->frame_rx; proc_rxtx->subframe_rx = proc->subframe_rx; - proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; - proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10; + proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > (9-sf_ahead)) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx; + proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + sf_ahead)%10; LOG_D(PHY,"Signal &proc_rxtx->cond_rxtx\n"); diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index d6e4ce7536e3ad0e31180fb54f0c5c3309b3b813..5348e83f056983cf2c018344e0dc9f7f083dcdd4 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -130,6 +130,7 @@ int attach_rru(RU_t *ru); int connect_rau(RU_t *ru); extern uint8_t nfapi_mode; +extern uint16_t sf_ahead; /*************************************************************/ /* Functions to attach and configure RRU */ @@ -388,8 +389,8 @@ void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) { proc->frame_rx = f; proc->timestamp_rx = ((proc->frame_rx * 10) + proc->subframe_rx ) * fp->samples_per_tti ; // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); - proc->subframe_tx = (sf+4)%10; - proc->frame_tx = (sf>5) ? (f+1)&1023 : f; + proc->subframe_tx = (sf+sf_ahead)%10; + proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f; if (proc->first_rx == 0) { if (proc->subframe_rx != *subframe){ @@ -726,9 +727,9 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; // synchronize first reception to frame 0 subframe 0 - proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti); - proc->subframe_tx = (proc->subframe_rx+4)%10; - proc->frame_tx = (proc->subframe_rx>5) ? (proc->frame_rx+1)&1023 : proc->frame_rx; + proc->timestamp_tx = proc->timestamp_rx+(sf_ahead*fp->samples_per_tti); + proc->subframe_tx = (proc->subframe_rx+sf_ahead)%10; + proc->frame_tx = (proc->subframe_rx>(9-sf_ahead)) ? (proc->frame_rx+1)&1023 : proc->frame_rx; #if 0 LOG_D(PHY,"RU %d/%d TS %llu (off %d), frame %d, subframe %d\n", @@ -788,7 +789,9 @@ void tx_rf(RU_t *ru) { lte_subframe_t prevSF_type = subframe_select(fp,(proc->subframe_tx+9)%10); lte_subframe_t nextSF_type = subframe_select(fp,(proc->subframe_tx+1)%10); - //LOG_E(PHY,"%s() nb_tx:%d sf:%d tti:%d\n", __FUNCTION__, ru->nb_tx, proc->subframe_tx, fp->samples_per_tti); + //struct timespec t; + //clock_gettime(CLOCK_MONOTONIC, &t); + //LOG_E(PHY,"%s() nb_tx:%d sf:%d tti:%d t:%ld.%09ld\n", __FUNCTION__, ru->nb_tx, proc->subframe_tx, fp->samples_per_tti, t.tv_sec, t.tv_nsec); if ((SF_type == SF_DL) || (SF_type == SF_S)) { @@ -1526,7 +1529,7 @@ static void* ru_thread( void* param ) { // do RX front-end processing (frequency-shift, dft) if needed - if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); + //if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); if (ru->feprx) ru->feprx(ru); // At this point, all information for subframe has been received on FH interface @@ -1538,11 +1541,10 @@ static void* ru_thread( void* param ) { if (ru->num_eNB>0) wakeup_eNBs(ru); //LOG_E(PHY,"%s() Before wait_on_condition()\n", __FUNCTION__); - // wait until eNBs are finished subframe RX n and TX n+4 + // wait until eNBs are finished subframe RX n and TX n+sf_ahead wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread"); - //LOG_E(PHY,"%s() AFTER wait_on_condition() ru->feptx_prec:%p ru->fh_north_asynch_in:%p ru->feptx_ofdm:%p ru->fh_south_out:%p ru->fh_north_out:%p\n", - //__FUNCTION__, ru->feptx_prec, ru->fh_north_asynch_in, ru->feptx_ofdm, ru->fh_south_out, ru->fh_north_out); + //LOG_E(PHY,"%s() AFTER wait_on_condition() ru->feptx_prec:%p ru->fh_north_asynch_in:%p ru->feptx_ofdm:%p ru->fh_south_out:%p ru->fh_north_out:%p\n", __FUNCTION__, ru->feptx_prec, ru->fh_north_asynch_in, ru->feptx_ofdm, ru->fh_south_out, ru->fh_north_out); // do TX front-end processing if needed (precoding and/or IDFTs) if (ru->feptx_prec) ru->feptx_prec(ru); diff --git a/targets/RT/USER/pnf.gtkw b/targets/RT/USER/pnf.gtkw index 97ac08dcab6616db7429a7ff6b4358c208d84042..979d6321383e625d12369a7dfd8dcdfc0d482b6a 100644 --- a/targets/RT/USER/pnf.gtkw +++ b/targets/RT/USER/pnf.gtkw @@ -20,39 +20,35 @@ functions.trx_write @24 variables.trx_ts[63:0] variables.trx_tst[63:0] -@28 -functions.eNB_thread_rxtx0 -@24 +@25 variables.frame_number_RX0_RU[63:0] variables.subframe_number_RX0_RU[63:0] @25 variables.frame_number_TX0_RU[63:0] -@24 variables.subframe_number_TX0_RU[63:0] -@28 -functions.phy_procedures_eNb_tx0 -functions.eNB_thread_rxtx1 -functions.phy_enb_sfgen -functions.phy_enb_prach_rx @24 +functions.phy_procedures_ru_feprx0 +functions.phy_procedures_ru_feprx1 functions.phy_procedures_eNb_rx_uespec0 -functions.phy_procedures_eNb_rx_uespec1 +functions.phy_procedures_eNb_tx0 +functions.eNB_thread_rxtx1 functions.phy_enb_prach_rx -functions.phy_eNB_dlsch_encoding -functions.phy_eNB_dlsch_modulation -functions.phy_eNB_dlsch_scrambling functions.phy_enb_rs_tx functions.phy_enb_pdcch_tx -functions.pdsch_thread functions.nfapi_subframe functions.generate_pcfich functions.generate_dci0 -functions.generate_dlsch -functions.generate_phich functions.pdcch_scrambling functions.pdcch_modulation functions.pdcch_interleaving functions.pdcch_tx +functions.generate_dlsch +functions.generate_phich functions.udp_enb_task +functions.phy_procedures_ru_feptx_ofdm0 +functions.phy_procedures_ru_feptx_ofdm1 +functions.phy_procedures_ru_feptx_prec0 +functions.phy_procedures_ru_feptx_prec1 +functions.phy_enb_prach_rx [pattern_trace] 1 [pattern_trace] 0