Commit 4637214f authored by Robert Schmidt's avatar Robert Schmidt

Call into scheduler directly when receiving slot indication

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 7939736b
...@@ -1215,15 +1215,45 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ ...@@ -1215,15 +1215,45 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
//NR phy 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) { int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
uint8_t vnf_slot_ahead = 0; uint8_t vnf_slot_ahead = 0;
uint32_t vnf_sfn_slot = sfnslot_add_slot(ind->sfn, ind->slot, vnf_slot_ahead); uint32_t vnf_sfn_slot = sfnslot_add_slot(ind->sfn, ind->slot, vnf_slot_ahead);
uint16_t vnf_sfn = NFAPI_SFNSLOT2SFN(vnf_sfn_slot); uint16_t vnf_sfn = NFAPI_SFNSLOT2SFN(vnf_sfn_slot);
uint8_t vnf_slot = NFAPI_SFNSLOT2SLOT(vnf_sfn_slot); uint8_t vnf_slot = NFAPI_SFNSLOT2SLOT(vnf_sfn_slot);
LOG_I(MAC, "VNF SFN/Slot %d.%d \n", vnf_sfn, vnf_slot); LOG_D(MAC, "VNF SFN/Slot %d.%d \n", vnf_sfn, vnf_slot);
trigger_scheduler(ind);
// received slot indication // received slot indication
/*
nfapi_nr_slot_indication_scf_t *nr_slot_ind = CALLOC(1, sizeof(*nr_slot_ind)); nfapi_nr_slot_indication_scf_t *nr_slot_ind = CALLOC(1, sizeof(*nr_slot_ind));
nr_slot_ind->header = ind->header; nr_slot_ind->header = ind->header;
nr_slot_ind->sfn = vnf_sfn; nr_slot_ind->sfn = vnf_sfn;
...@@ -1234,6 +1264,7 @@ int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) { ...@@ -1234,6 +1264,7 @@ int phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
free(nr_slot_ind); free(nr_slot_ind);
nr_slot_ind = NULL; nr_slot_ind = NULL;
} }
*/
return 1; return 1;
} }
......
...@@ -1465,7 +1465,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf ...@@ -1465,7 +1465,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
} }
else 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) if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
{ {
......
...@@ -96,15 +96,8 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs) ...@@ -96,15 +96,8 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
// monitor the p7 endpoints and the timing loop and // monitor the p7 endpoints and the timing loop and
// send indications to mac // send indications to mac
extern void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info);
extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
extern int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t* tx_data_req);
extern int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t* ul_dci_req);
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) 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) if(config == 0)
return -1; return -1;
...@@ -163,8 +156,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -163,8 +156,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
struct timespec ref_time; struct timespec ref_time;
clock_gettime(CLOCK_MONOTONIC, &ref_time); clock_gettime(CLOCK_MONOTONIC, &ref_time);
uint8_t setup_done = 1; uint8_t setup_done = 1;
NR_Sched_Rsp_t *sched_resp = malloc(sizeof(*sched_resp));
AssertFatal(sched_resp != NULL, "out of memory\n");
while(vnf_p7->terminate == 0) while(vnf_p7->terminate == 0)
{ {
fd_set rfds; fd_set rfds;
...@@ -185,43 +176,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -185,43 +176,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
} }
} }
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) {
gNB->UL_INFO.frame = slot_ind->sfn;
gNB->UL_INFO.slot = slot_ind->slot;
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "gNB->UL_INFO.frame = %d and slot %d, prev_slot = %d\n",
gNB->UL_INFO.frame, gNB->UL_INFO.slot, prev_slot);
if (setup_done && prev_slot != gNB->UL_INFO.slot) { //Give the VNF sufficient time to setup before starting scheduling && prev_slot != gNB->UL_INFO.slot
// Call into the scheduler (this is hardcoded and should be init properly!)
gNB->UL_INFO.module_id = gNB->Mod_id;
gNB->UL_INFO.CC_id = gNB->CC_id;
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Calling NR_UL_indication for gNB->UL_INFO.frame = %d and slot %d\n",
gNB->UL_INFO.frame, gNB->UL_INFO.slot);
memset(sched_resp, 0, sizeof(*sched_resp));
gNB_dlsch_ulsch_scheduler(0, slot_ind->sfn, slot_ind->slot, sched_resp);
prev_slot = gNB->UL_INFO.slot;
}
if (sched_resp->DL_req.dl_tti_request_body.nPDUs > 0)
oai_nfapi_dl_tti_req(&sched_resp->DL_req);
if (sched_resp->UL_tti_req.n_pdus > 0)
oai_nfapi_ul_tti_req(&sched_resp->UL_tti_req);
if (sched_resp->TX_req.Number_of_PDUs > 0)
oai_nfapi_tx_data_req(&sched_resp->TX_req);
if (sched_resp->UL_dci_req.numPdus > 0)
oai_nfapi_ul_dci_req(&sched_resp->UL_dci_req);
free(slot_ind);
slot_ind = NULL;
}
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL); selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
if(selectRetval == 0) if(selectRetval == 0)
...@@ -254,7 +208,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -254,7 +208,6 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
} }
} }
} }
free(sched_resp);
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
close(vnf_p7->socket); close(vnf_p7->socket);
......
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