Commit 53172663 authored by Robert Schmidt's avatar Robert Schmidt

Call directly into scheduler from VNF, start immediately

The previous designs seems to do:

    loop {
      poll_ind_queue()
      if (msg)
        scheduler;

      pselect() on messages;
      handle_message {
        if slot_ind
          put_ind_queue()
      }
    }

So basically, we artificially put a queue for slot indications in the
middle, but still handle it in the same thread(!). This for some reason
results in a big slow down if the PNF runs faster.

Now, we just do pselect(), waiting for messages. We handle the slot
indication immediately (the schedule should take some microseconds),
then return to pselect().
parent 41244607
......@@ -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;
......
......@@ -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;
......@@ -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;
......@@ -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;
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment