diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index bc569c3d1b..6111b69bf9 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -3523,7 +3523,7 @@ static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, ui if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) && push16(pNfapiMsg->slot , ppWritePackedMsg, end) && - push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end) + push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end) )) return 0; @@ -3748,11 +3748,11 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe break; case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: - result = pack_nr_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); + result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); break; case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: - result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); + result = pack_nr_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); break; case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index 2c98cb538b..e390031554 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -2214,11 +2214,11 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7 break; case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION: - vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7); + vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7); break; case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: - vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7); + vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7); break; case NFAPI_UE_RELEASE_RESPONSE: diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c index 2137965a7e..4878150330 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c @@ -153,31 +153,8 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) //struct timespec original_pselect_timeout; struct timespec pselect_timeout; pselect_timeout.tv_sec = 100; - pselect_timeout.tv_nsec = 0; // ns in a 0.5 ms - //pselect_timeout.tv_nsec = 500000; + pselect_timeout.tv_nsec = 0; - struct timespec pselect_start; - struct timespec pselect_stop; - - -// struct timespec sf_duration; //Change to slot_duration? -// sf_duration.tv_sec = 0; -// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR - struct timespec slot_duration; - slot_duration.tv_sec = 0; - //slot_duration.tv_nsec = 0.5e6; - slot_duration.tv_nsec = 0.5e6; - - -// struct timespec sf_start; //Change to slot_start? - struct timespec slot_start; -// clock_gettime(CLOCK_MONOTONIC, &sf_start); - clock_gettime(CLOCK_MONOTONIC, &slot_start); - //long millisecond = slot_start.tv_nsec / 0.5e6; -// sf_start = timespec_add(sf_start, sf_duration); - 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; @@ -195,26 +172,8 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) 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); - //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec); - - if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec))) - { - // overran the end of the subframe we do not want to wait - pselect_timeout.tv_sec = 0; - pselect_timeout.tv_nsec = 0; - LOG_D(MAC, "Slot overrun detected \n"); - //NFAPI_TRACE(NFAPI_TRACE_INFO, "Slot overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec); - } - else - { - // still time before the end of the subframe wait - pselect_timeout = timespec_sub(slot_start, pselect_start); - } - - if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){ + if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){ //Give the VNF sufficient time to setup before starting scheduling //Call the scheduler pthread_mutex_lock(&gNB->UL_INFO_mutex); @@ -226,53 +185,12 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) } selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL); - - clock_gettime(CLOCK_MONOTONIC, &pselect_stop); nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections; if(selectRetval == 0) { - // pselect timed out - - // calculate the start of the next slot - - slot_start = timespec_add(slot_start, slot_duration); - //NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec); - if (slot_start.tv_nsec > 1e9) - { - slot_start.tv_sec++; - slot_start.tv_nsec-=1e9; - } - else if (slot_start.tv_nsec < 0) - { - slot_start.tv_sec--; - slot_start.tv_nsec+=1e9; - } - - vnf_p7->slot_start_time_hr = vnf_get_current_time_hr(); - - while(curr != 0) - { - if (curr->slot == 19) - { - curr->sfn = (curr->sfn + 1) % 1024; - curr->slot=0; - } - else - { - curr->slot++; - } - //printf("Frame = %d, slot = %d in VNF main loop. \n",curr->sfn,curr->slot); - - //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); - + // pselect timed out, continue } else if(selectRetval > 0) { diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 85617c4073..5104021399 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -219,29 +219,30 @@ void *gNB_app_task(void *args_p) //registered_gnb = 0; __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end); } -if (RC.nb_nr_inst > 0) { - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + + if (RC.nb_nr_inst > 0) { + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) { - LOG_E(F1AP, "Create task for F1AP CU failed\n"); - AssertFatal(1==0,"exiting"); - } - } + if (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) { + LOG_E(F1AP, "Create task for F1AP CU failed\n"); + AssertFatal(1==0,"exiting"); + } + } - if (NODE_IS_DU(RC.nrrrc[0]->node_type)) { + if (NODE_IS_DU(RC.nrrrc[0]->node_type)) { - if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) { - LOG_E(F1AP, "Create task for F1AP DU failed\n"); - AssertFatal(1==0,"exiting"); + if (itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL) < 0) { + LOG_E(F1AP, "Create task for F1AP DU failed\n"); + AssertFatal(1==0,"exiting"); + } + // configure F1AP here for F1C + LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); + RCconfig_NR_DU_F1(msg_p, 0); + + itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); } - // configure F1AP here for F1C - LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); - RCconfig_NR_DU_F1(msg_p, 0); - - itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); } -} do { // Wait for a message itti_receive_msg (TASK_GNB_APP, &msg_p); diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index dcd469f363..58a477aa36 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -61,7 +61,7 @@ extern uint16_t sl_ahead; void handle_nr_rach(NR_UL_IND_t *UL_info) { if(NFAPI_MODE == NFAPI_MODE_PNF) { if (UL_info->rach_ind.number_of_pdus>0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + LOG_D(PHY,"UL_info->UL_info->rach_ind.number_of_pdus:%d SFN/Slot:%d.%d \n", UL_info->rach_ind.number_of_pdus, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); oai_nfapi_nr_rach_indication(&UL_info->rach_ind); UL_info->rach_ind.number_of_pdus = 0; } @@ -113,14 +113,12 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) break; case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: { - //printf("handle uci format 0_1 \n"); const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1; handle_nr_uci_pucch_0_1(mod_id, frame, slot, uci_pdu); break; } case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: { - //printf("handle uci format 2_3_4 \n"); const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &uci_list[i].pucch_pdu_format_2_3_4; handle_nr_uci_pucch_2_3_4(mod_id, frame, slot, uci_pdu); break; @@ -137,13 +135,13 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) { if(NFAPI_MODE == NFAPI_MODE_PNF) { if (UL_info->crc_ind.number_crcs>0) { - //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + LOG_D(PHY,"UL_info->UL_info->crc_ind.number_crcs:%d CRC_IND:SFN/Slot:%d.%d\n", UL_info->crc_ind.number_crcs, UL_info->crc_ind.sfn, UL_info->crc_ind.slot); oai_nfapi_nr_crc_indication(&UL_info->crc_ind); UL_info->crc_ind.number_crcs = 0; } if (UL_info->rx_ind.number_of_pdus>0) { - //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/Slot:%d.%d \n", UL_info->rx_ind.number_of_pdus, UL_info->rx_ind.sfn, UL_info->rx_ind.slot); oai_nfapi_nr_rx_data_indication(&UL_info->rx_ind); UL_info->rx_ind.number_of_pdus = 0; }