From 6d93b6a663a2e75173a74d4e736b8efac2da82c3 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 4 Jun 2021 10:02:17 -0700 Subject: [PATCH] Removed change to gNB scheduler Changed NFAPI_mode check in the gNB scheduler to ensure that the frame is correctly updated for msg3. Also added comments in NR UE for handling the RAR and implementing the dci/rx_ind handover for the RAR procedure. --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 5 ---- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 24 ++++++++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 2bafdd70eb..b50125b016 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -108,7 +108,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, { memset(pdcch, 0, sizeof(**pdcch) * MAX_NUM_BWP * MAX_NUM_CORESET); } - if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { // monolithic or PNF + if (1) { // Melissa. NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF DL_req[CC_idP].SFN = frameP; DL_req[CC_idP].Slot = slotP; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index bb831bdea7..806952ac03 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -286,11 +286,6 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP }else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe slot_index = 0; } - const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; - const int n = slots_per_frame[*scc->ssbSubcarrierSpacing]; - for (int i = 0; i < n; ++i) { - RC.nrmac[module_idP]->UL_tti_req_ahead[0][i].SFN = (frameP != 1023) ? frameP + 1 : 0; - } UL_tti_req->SFN = frameP; UL_tti_req->Slot = slotP; for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 0435b4764f..59f95ee40a 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -148,7 +148,6 @@ void send_nsa_standalone_msg(nfapi_nr_rach_indication_t *rach_ind) static void check_and_process_rar(nfapi_nr_dl_tti_request_t *dl_tti_request) { - bool filled_pdsch_pdu = false; bool filled_pdcch_pdu = false; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; if (num_pdus <= 0) @@ -158,17 +157,20 @@ static void check_and_process_rar(nfapi_nr_dl_tti_request_t *dl_tti_request) } nr_downlink_indication_t dl_info; + dl_info.rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t)); + dl_info.dci_ind = CALLOC(1, sizeof(fapi_nr_dci_indication_t)); for (int i = 0; i < num_pdus; i++) { nfapi_nr_dl_tti_request_pdu_t *pdu_list = &dl_tti_request->dl_tti_request_body.dl_tti_pdu_list[i]; if (pdu_list->PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) { - LOG_I(NR_PHY, "Melissa in [%d, %d], we got the PDSCH (RAR payload)for rnti %x in \n", + LOG_I(NR_PHY, "Melissa in [%d, %d], we got the PDSCH (RAR transmission configuration)for rnti %x in \n", dl_tti_request->SFN, dl_tti_request->Slot, pdu_list->pdsch_pdu.pdsch_pdu_rel15.rnti); - // Melissa, what can I fill pdu with? dl_info.rx_ind->rx_indication_body->pdsch_pdu.pdu = pdu_list->pdsch_pdu.pdsch_pdu_rel15. - dl_info.rx_ind->rx_indication_body->pdsch_pdu.pdu_length = pdu_list->PDUSize; - filled_pdsch_pdu = true; + /* Copy from tx_req the pdu put it in the rx_ind pdsch.pdu thing and then call nr_ue_dl_indication */ + } +//int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){ + if (pdu_list->PDUType == NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE) { if (pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci > 0) @@ -176,18 +178,22 @@ static void check_and_process_rar(nfapi_nr_dl_tti_request_t *dl_tti_request) for (int j = 0; j < pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci; j++) { nfapi_nr_dl_dci_pdu_t *dci_pdu_list = &pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[j]; - LOG_I(NR_PHY, "Melissa in [%d, %d], we got the PDCCH DCI (control data) for rnti %x\n", + LOG_I(NR_PHY, "Melissa in [%d, %d], we got the PDCCH DCI (Payload) for rnti %x\n", dl_tti_request->SFN, dl_tti_request->Slot, dci_pdu_list->RNTI); for (int k = 0; k < DCI_PAYLOAD_BYTE_LEN; k++) { - // Melissa, why is dl_info payload 16 elements and received dl_tti_req payload is 8 elements? + /* This has to happen first. Dont call nr_ue_dl_indication, instead you need to send dci_ind to mac layer + then you get back a scheduled response (the one we made a new one return 0;) and + then we send up payload. Then the phy layer will receive a PDSCH and then we extract + the tx_tti pdu and fill the dl_indication pdsch pdu from tx_tti and that should tell NR UE we got RAR */ + dl_info.dci_ind->dci_list->payloadBits[k] = dci_pdu_list->Payload[k]; } dl_info.dci_ind->dci_list->payloadSize = dci_pdu_list->PayloadSizeBits; filled_pdcch_pdu = true; } } - + handle_dci(0, 0, 0, dl_tti_request->SFN, dl_tti_request->Slot, dl_info.dci_ind->dci_list); } } @@ -197,7 +203,7 @@ static void check_and_process_rar(nfapi_nr_dl_tti_request_t *dl_tti_request) if (mac->scc == NULL) { return; } - if (is_nr_UL_slot(mac->scc, dl_info.slot) && filled_pdsch_pdu && filled_pdcch_pdu) { + if (0) { //(is_nr_UL_slot(mac->scc, dl_info.slot) && filled_pdcch_pdu LOG_I(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", dl_info.slot, __FUNCTION__); nr_ue_dl_indication(&dl_info, NULL); }