diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index b14e17d576..5c4dfa8c9f 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -1561,7 +1561,7 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name, // } struct timespec curr_time; clock_gettime(CLOCK_MONOTONIC, &curr_time); - printf("PNF SFN:%d, PNF slot:%d, VNF SFN:%d, VNF slot:%d, Curr time;%d.%d. \n",phy->sfn,phy->slot,sfn,slot,curr_time.tv_sec,curr_time.tv_nsec); + printf("PNF SFN:%d, PNF slot:%d, VNF SFN:%d, VNF slot:%d, SFN offset:%d, Curr time;%d.%d. \n",phy->sfn,phy->slot,sfn,slot, phy->sfn - sfn,curr_time.tv_sec,curr_time.tv_nsec); if(current_sfn_slot_dec <= recv_sfn_slot_dec + timing_window){ in_window = 1; NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec); @@ -1578,7 +1578,7 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name, }//Need to add more cases - + in_window = 0; // gokul return in_window; } diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c index 34318dcbcc..d7e2fa5311 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c @@ -181,9 +181,11 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) slot_start = timespec_add(slot_start, slot_duration); NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec); - + struct timespec ref_time; + clock_gettime(CLOCK_MONOTONIC, &ref_time); + uint8_t setup_time; while(vnf_p7->terminate == 0) - { + { fd_set rfds; int maxSock = 0; FD_ZERO(&rfds); @@ -193,6 +195,10 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) FD_SET(vnf_p7->socket, &rfds); maxSock = vnf_p7->socket; + struct timespec curr_time; + clock_gettime(CLOCK_MONOTONIC, &curr_time); + setup_time = curr_time.tv_sec - ref_time.tv_sec; + clock_gettime(CLOCK_MONOTONIC, &pselect_start); //long millisecond = pselect_start.tv_nsec / 1e6; @@ -404,6 +410,19 @@ struct timespec current_time; clock_gettime(CLOCK_MONOTONIC, ¤t_time); // pselect timed out + if(setup_time > 10){ + // Call the scheduler + struct PHY_VARS_gNB_s *gNB = RC.gNB[0]; + pthread_mutex_lock(&gNB->UL_INFO_mutex); + gNB->UL_INFO.frame = vnf_frame; + gNB->UL_INFO.slot = vnf_slot; + + gNB->UL_INFO.module_id = gNB->Mod_id; + gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); + } + while(curr != 0) { if (curr->slot == 19) @@ -418,13 +437,16 @@ struct timespec current_time; { curr->slot++; } - //printf("Frame = %d, slot = %d in VNF main loop. \n",curr->sfn,curr->slot); + printf("Frame = %d, slot = %d in VNF main loop. \n",curr->sfn,curr->slot); vnf_frame = curr->sfn; vnf_slot = curr->slot; struct timespec curr_time; clock_gettime(CLOCK_MONOTONIC, &curr_time); - vnf_nr_sync(vnf_p7, curr); + //vnf_nr_sync(vnf_p7, curr); + + (vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1); //hardcoded sync + curr = curr->next; } send_mac_slot_indications(vnf_p7); @@ -435,19 +457,10 @@ struct timespec current_time; // have a p7 message if(FD_ISSET(vnf_p7->socket, &rfds)) { - + printf("P7 message received \n"); vnf_nr_p7_read_dispatch_message(vnf_p7); - // Call the scheduler - struct PHY_VARS_gNB_s *gNB = RC.gNB[0]; - pthread_mutex_lock(&gNB->UL_INFO_mutex); - gNB->UL_INFO.frame = vnf_frame; - gNB->UL_INFO.slot = vnf_slot; - - gNB->UL_INFO.module_id = gNB->Mod_id; - gNB->UL_INFO.CC_id = gNB->CC_id; - gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); + } } else diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 8145cf893c..27892aa417 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -48,6 +48,8 @@ #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" +#include "nfapi/oai_integration/vendor_ext.h" + #include "T.h" //#define DEBUG_NR_PUCCH_RX 1 @@ -86,6 +88,8 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pucch_pdu_t *pucch_pdu) { + if (NFAPI_MODE == NFAPI_MODE_PNF) + gNB->pucch[0]->active = 0; int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB); AssertFatal( (id>=0) && (idUL_dci_req; frame_t frame = Sched_INFO->frame; sub_frame_t slot = Sched_INFO->slot; - + //printf("Inside nr_schedule_resp SFN:%d, slot:%d \n",Sched_INFO->frame, Sched_INFO->slot); AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n"); AssertFatal(RC.gNB[Mod_id]!=NULL,"RC.gNB[%d] is null\n",Mod_id); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index d5ae4aa4b3..46ccc8ac53 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1141,7 +1141,7 @@ int nr_acknack_scheduling(int mod_id, if(NFAPI_MODE == NFAPI_MODE_VNF){ gNB_MAC_INST *gNB = RC.nrmac[mod_id]; gNB->UL_tti_req_ahead[0][7].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7 - gNB->[8].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8 + gNB->UL_tti_req_ahead[0][8].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8 gNB->UL_tti_req_ahead[0][9].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 9 gNB->UL_tti_req[0] = &gNB->UL_tti_req_ahead[0][slot]; }