From 02f3fecfef5e0da9085390673d080430afa0d87e Mon Sep 17 00:00:00 2001 From: Mahesh Date: Mon, 5 Jul 2021 22:55:35 +0530 Subject: [PATCH] future_ul_tti hardcoding solved, other hardcodings commented out --- nfapi/nrNFAPI.md | 4 -- openair2/GNB_APP/gnb_app.c | 4 +- openair2/GNB_APP/gnb_config.c | 1 - openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 23 +++++++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 11 +++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 33 +++++-------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 46 +++++++++---------- 7 files changed, 56 insertions(+), 66 deletions(-) diff --git a/nfapi/nrNFAPI.md b/nfapi/nrNFAPI.md index b78a205e84..9b996bbedf 100644 --- a/nfapi/nrNFAPI.md +++ b/nfapi/nrNFAPI.md @@ -38,7 +38,3 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path To be updated. -## Notes -* If running for the first time on local branch, run in the following order - VNF then PNF. This is so that necessary files are generated for the UE to run. Stop this run (it's ok if it stops on its own due to an error). From every subsequent run follow the next bullet. -* In order to achieve synchronization between the VNF and PNF, and receive P7 messages within the timing window, the order in which we should run the modules on different terminals is UE->VNF->PNF. -* Currently downlink transmission from gNB to UE is partially functional and we are working on improving this. Uplink P7 messages are disabled and we will work on uplink integration after completing downlink. diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 66302d056b..da8d75c67b 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -218,7 +218,7 @@ 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 (itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL) < 0) { @@ -240,7 +240,7 @@ void *gNB_app_task(void *args_p) 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/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 456d7cd6de..1942c9f934 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1410,7 +1410,6 @@ void NRRCConfig(void) { config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - // Get num MACRLC instances config_getlist( &MACRLCParamList,NULL,0, NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index a4c9a14aa3..7d9d55808a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -57,6 +57,8 @@ uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; +uint8_t first_sched_entry = 1; + void clear_mac_stats(gNB_MAC_INST *gNB) { memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t)); } @@ -367,6 +369,20 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, memset(&vrb_map_UL[last_slot * MAX_BWP_SIZE], 0, sizeof(uint16_t) * MAX_BWP_SIZE); clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot); + + //first entry + if (NFAPI_MODE == NFAPI_MODE_VNF){ + if(first_sched_entry == 1) + { + for (int i = 0; iUL_tti_req_ahead[CC_id][i].SFN = frame + 1; + else + gNB->UL_tti_req_ahead[CC_id][i].SFN = frame; + } + first_sched_entry = 0; + } + } } @@ -410,13 +426,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedules the DCI for Uplink and subsequently PUSCH - if(NFAPI_MODE == NFAPI_MODE_VNF){ - gNB->UL_tti_req_ahead[0][7].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7 - gNB->UL_tti_req_ahead[0][8].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8 - gNB->UL_tti_req_ahead[0][9].SFN = frame;//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]; - } - nr_schedule_ulsch(module_idP, frame, slot); // This schedules the DCI for Downlink and PDSCH diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7ffd544d10..17b1fc5233 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -834,8 +834,9 @@ void nr_schedule_ue_spec(module_id_t module_id, int8_t current_harq_pid = sched_pdsch->dl_harq_pid; if (current_harq_pid < 0) { /* PP has not selected a specific HARQ Process, get a new one */ - if (NFAPI_MODE == NFAPI_MODE_VNF) - sched_ctrl->available_dl_harq.head = 0; + // if (NFAPI_MODE == NFAPI_MODE_VNF) + // sched_ctrl->available_dl_harq.head = 0; + remove_front_nr_list(&sched_ctrl->available_dl_harq); current_harq_pid = sched_ctrl->available_dl_harq.head; AssertFatal(current_harq_pid >= 0, "no free HARQ process available for UE %d\n", @@ -852,9 +853,9 @@ void nr_schedule_ue_spec(module_id_t module_id, remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid); } NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; - if (NFAPI_MODE == NFAPI_MODE_VNF) { - harq->is_waiting = false; - } + // if (NFAPI_MODE == NFAPI_MODE_VNF) { + // harq->is_waiting = false; + // } DevAssert(!harq->is_waiting); add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid); NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[sched_pdsch->pucch_allocation]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 11bc09f7b3..93a2d87345 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -46,10 +46,6 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[mod_id]->UL_tti_req_ahead[0][pucch->ul_slot]; - if (NFAPI_MODE == NFAPI_MODE_VNF){ - future_ul_tti_req->SFN = pucch->frame; - future_ul_tti_req->Slot = pucch->ul_slot; - } AssertFatal(future_ul_tti_req->SFN == pucch->frame && future_ul_tti_req->Slot == pucch->ul_slot, @@ -64,7 +60,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, memset(pucch_pdu, 0, sizeof(nfapi_nr_pucch_pdu_t)); future_ul_tti_req->n_pdus += 1; - LOG_D(MAC, + LOG_I(MAC, "%4d.%2d Scheduling pucch reception in %4d.%2d: bits SR %d, ACK %d, CSI %d on res %d\n", frame, slot, @@ -148,7 +144,7 @@ void nr_schedule_pucch(int Mod_idP, || frameP != curr_pucch->frame || slotP != curr_pucch->ul_slot) continue; - LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack); + LOG_I(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack); nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id); memset(curr_pucch, 0, sizeof(*curr_pucch)); } @@ -519,9 +515,9 @@ void nr_csi_meas_reporting(int Mod_idP, // find free PUCCH that is in order with possibly existing PUCCH // schedulings (other CSI, SR) NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[1]; - if(NFAPI_MODE == NFAPI_MODE_VNF){ - curr_pucch->csi_bits = 0; curr_pucch->sr_flag = 0; curr_pucch->dai_c = 0; - } + // if(NFAPI_MODE == NFAPI_MODE_VNF){ + // curr_pucch->csi_bits = 0; curr_pucch->sr_flag = 0; curr_pucch->dai_c = 0; + // } AssertFatal(curr_pucch->csi_bits == 0 && !curr_pucch->sr_flag && curr_pucch->dai_c == 0, @@ -1141,23 +1137,16 @@ int nr_acknack_scheduling(int mod_id, __func__, pucch->csi_bits); /* if the currently allocated PUCCH of this UE is full, allocate it */ - if (NFAPI_MODE == NFAPI_MODE_VNF){ - pucch->sr_flag = 1; - pucch->dai_c = 1; - } + // if (NFAPI_MODE == NFAPI_MODE_VNF){ + // pucch->sr_flag = 1; + // pucch->dai_c = 1; + // } if (pucch->dai_c == 2) { /* advance the UL slot information in PUCCH by one so we won't schedule in * the same slot again */ const int f = pucch->frame; const int s = pucch->ul_slot; - 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->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]; - } nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; @@ -1194,8 +1183,8 @@ int nr_acknack_scheduling(int mod_id, get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); /* there is a HARQ. Check whether we can use it for this ACKNACK */ - if(NFAPI_MODE == NFAPI_MODE_VNF) - return 0; + // if(NFAPI_MODE == NFAPI_MODE_VNF) + // return 0; if (pucch->dai_c > 0) { /* this UE already has a PUCCH occasion */ DevAssert(pucch->frame == frame); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 9999581cf1..603f1ae3c7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1326,37 +1326,33 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) sched_ctrl->SR = false; int8_t harq_id = sched_pusch->ul_harq_pid; - if (NFAPI_MODE == NFAPI_MODE_VNF) - harq_id = 1; - else - { - if (harq_id < 0) { - /* PP has not selected a specific HARQ Process, get a new one */ - harq_id = sched_ctrl->available_ul_harq.head; - // if(NFAPI_MODE == NFAPI_MODE_VNF) - // harq_id = 1; - AssertFatal(harq_id >= 0, - "no free HARQ process available for UE %d\n", - UE_id); - remove_front_nr_list(&sched_ctrl->available_ul_harq); - sched_pusch->ul_harq_pid = harq_id; - } else { - /* PP selected a specific HARQ process. Check whether it will be a new - * transmission or a retransmission, and remove from the corresponding - * list */ - if (sched_ctrl->ul_harq_processes[harq_id].round == 0) - remove_nr_list(&sched_ctrl->available_ul_harq, harq_id); - else - remove_nr_list(&sched_ctrl->retrans_ul_harq, harq_id); - } + + if (harq_id < 0) { + /* PP has not selected a specific HARQ Process, get a new one */ + harq_id = sched_ctrl->available_ul_harq.head; + // if(NFAPI_MODE == NFAPI_MODE_VNF) + // harq_id = 1; + AssertFatal(harq_id >= 0, + "no free HARQ process available for UE %d\n", + UE_id); + remove_front_nr_list(&sched_ctrl->available_ul_harq); + sched_pusch->ul_harq_pid = harq_id; + } else { + /* PP selected a specific HARQ process. Check whether it will be a new + * transmission or a retransmission, and remove from the corresponding + * list */ + if (sched_ctrl->ul_harq_processes[harq_id].round == 0) + remove_nr_list(&sched_ctrl->available_ul_harq, harq_id); + else + remove_nr_list(&sched_ctrl->retrans_ul_harq, harq_id); } NR_UE_ul_harq_t *cur_harq = &sched_ctrl->ul_harq_processes[harq_id]; DevAssert(!cur_harq->is_waiting); add_tail_nr_list(&sched_ctrl->feedback_ul_harq, harq_id); cur_harq->feedback_slot = sched_pusch->slot; cur_harq->is_waiting = true; - if (NFAPI_MODE == NFAPI_MODE_VNF) - cur_harq->is_waiting = 0; + // if (NFAPI_MODE == NFAPI_MODE_VNF) + // cur_harq->is_waiting = 0; int rnti_types[2] = { NR_RNTI_C, 0 };