diff --git a/nfapi/oai_integration/aerial/fapi_vnf_p5.c b/nfapi/oai_integration/aerial/fapi_vnf_p5.c index 9acd67147d..1b01fd6c09 100644 --- a/nfapi/oai_integration/aerial/fapi_vnf_p5.c +++ b/nfapi/oai_integration/aerial/fapi_vnf_p5.c @@ -49,7 +49,6 @@ void *aerial_vnf_nr_p7_config_init(void *ptr) init_queue(&gnb_rx_ind_queue); init_queue(&gnb_crc_ind_queue); init_queue(&gnb_uci_ind_queue); - init_queue(&gnb_slot_ind_queue); p7_vnf->config->port = p7_vnf->local_port; p7_vnf->config->sync_indication = NULL; diff --git a/nfapi/oai_integration/gnb_ind_vars.c b/nfapi/oai_integration/gnb_ind_vars.c index f1f22bcc66..80ed29d318 100644 --- a/nfapi/oai_integration/gnb_ind_vars.c +++ b/nfapi/oai_integration/gnb_ind_vars.c @@ -25,4 +25,3 @@ queue_t gnb_rach_ind_queue; queue_t gnb_rx_ind_queue; queue_t gnb_crc_ind_queue; queue_t gnb_uci_ind_queue; -queue_t gnb_slot_ind_queue; diff --git a/nfapi/oai_integration/gnb_ind_vars.h b/nfapi/oai_integration/gnb_ind_vars.h index 8561037d3e..0f03ba1174 100644 --- a/nfapi/oai_integration/gnb_ind_vars.h +++ b/nfapi/oai_integration/gnb_ind_vars.h @@ -6,4 +6,3 @@ extern queue_t gnb_rach_ind_queue; extern queue_t gnb_rx_ind_queue; extern queue_t gnb_crc_ind_queue; extern queue_t gnb_uci_ind_queue; -extern queue_t gnb_slot_ind_queue; diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index ed8d2f758b..16f23069b7 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1074,6 +1074,34 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ //NR phy indication + +NR_Sched_Rsp_t g_sched_resp; +void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info); +int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req); +int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req); +int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t* tx_data_req); +int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t* ul_dci_req); + +int trigger_scheduler(nfapi_nr_slot_indication_scf_t *slot_ind) +{ + // Call into the scheduler (this is hardcoded and should be init properly!) + // memset(sched_resp, 0, sizeof(*sched_resp)); + gNB_dlsch_ulsch_scheduler(0, slot_ind->sfn, slot_ind->slot, &g_sched_resp); + + if (g_sched_resp.DL_req.dl_tti_request_body.nPDUs > 0) + oai_nfapi_dl_tti_req(&g_sched_resp.DL_req); + + if (g_sched_resp.UL_tti_req.n_pdus > 0) + oai_nfapi_ul_tti_req(&g_sched_resp.UL_tti_req); + + if (g_sched_resp.TX_req.Number_of_PDUs > 0) + oai_nfapi_tx_data_req(&g_sched_resp.TX_req); + + if (g_sched_resp.UL_dci_req.numPdus > 0) + oai_nfapi_ul_dci_req(&g_sched_resp.UL_dci_req); + return 1; +} + int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) { uint8_t vnf_slot_ahead = 0; @@ -1082,16 +1110,7 @@ int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) { uint8_t vnf_slot = NFAPI_SFNSLOT2SLOT(vnf_sfn_slot); LOG_D(MAC, "VNF SFN/Slot %d.%d \n", vnf_sfn, vnf_slot); - nfapi_nr_slot_indication_scf_t *nr_slot_ind = CALLOC(1, sizeof(*nr_slot_ind)); - nr_slot_ind->header = ind->header; - nr_slot_ind->sfn = vnf_sfn; - nr_slot_ind->slot = vnf_slot; - if (!put_queue(&gnb_slot_ind_queue, nr_slot_ind)) - { - LOG_E(NR_MAC, "Put_queue failed for slot_ind\n"); - free(nr_slot_ind); - nr_slot_ind = NULL; - } + trigger_scheduler(ind); return 1; } @@ -1369,7 +1388,6 @@ void *vnf_nr_p7_thread_start(void *ptr) init_queue(&gnb_rx_ind_queue); init_queue(&gnb_crc_ind_queue); init_queue(&gnb_uci_ind_queue); - init_queue(&gnb_slot_ind_queue); vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr; p7_vnf->config->port = p7_vnf->local_port; diff --git a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h index 30d1edfe32..138a9a3570 100644 --- a/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h +++ b/nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h @@ -901,7 +901,6 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config); * This function is blocking and will not return until the nfapi_vnf_p7_stop * function is called. */ -extern queue_t gnb_slot_ind_queue; int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config); int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config); diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index 8ceba4f62a..7cd4c1dfef 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1497,7 +1497,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf } else { - nfapi_nr_slot_indication_scf_t ind; + nfapi_nr_slot_indication_scf_t ind = {0}; if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0) { diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c index a883ccf4a2..904a838179 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c @@ -98,8 +98,6 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs) // send indications to mac int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) { - struct PHY_VARS_gNB_s *gNB = RC.gNB[0]; - uint8_t prev_slot = 0; if(config == 0) return -1; @@ -157,7 +155,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) struct timespec ref_time; clock_gettime(CLOCK_MONOTONIC, &ref_time); - uint8_t setup_done; while(vnf_p7->terminate == 0) { fd_set rfds; @@ -169,39 +166,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) FD_SET(vnf_p7->socket, &rfds); maxSock = vnf_p7->socket; - if (setup_done == 0) { - struct timespec curr_time; - clock_gettime(CLOCK_MONOTONIC, &curr_time); - uint8_t setup_time = curr_time.tv_sec - ref_time.tv_sec; - if (setup_time > 3) { - setup_done = 1; - } - } - - nfapi_nr_slot_indication_scf_t *slot_ind = get_queue(&gnb_slot_ind_queue); - NFAPI_TRACE(NFAPI_TRACE_DEBUG, "This is the slot_ind queue size %ld in %s():%d\n", - gnb_slot_ind_queue.num_items, __FUNCTION__, __LINE__); - if (slot_ind) { - NR_UL_IND_t UL_INFO = {.frame = slot_ind->sfn, .slot = slot_ind->slot}; - - NFAPI_TRACE(NFAPI_TRACE_DEBUG, "UL_INFO.frame = %d and slot %d, prev_slot = %d\n", UL_INFO.frame, UL_INFO.slot, prev_slot); - if (setup_done && prev_slot != UL_INFO.slot) { // Give the VNF sufficient time to setup before starting scheduling && - // prev_slot != UL_INFO.slot - - // Call the scheduler - UL_INFO.module_id = gNB->Mod_id; - UL_INFO.CC_id = gNB->CC_id; - NFAPI_TRACE(NFAPI_TRACE_DEBUG, - "Calling NR_UL_indication for UL_INFO.frame = %d and slot %d\n", - UL_INFO.frame, - UL_INFO.slot); - gNB->if_inst->NR_UL_indication(&UL_INFO); - prev_slot = UL_INFO.slot; - } - free(slot_ind); - slot_ind = NULL; - } - selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL); if(selectRetval == 0)