From 96be5588b4f3de2263e907fd19ead84b38f8e07d Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 27 May 2021 12:53:27 -0700 Subject: [PATCH] Ready to fill rach indication. Had to hack the code to schedule the prach. Need to verify this is ok because ul_config = NULL. Also had to change logic for calling fill_schedule_response. --- executables/nr-ue.c | 7 +++++- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 9 +++---- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 26 ++++---------------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index dbc6a7e28f..a3336d6386 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -179,8 +179,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) if (nr_prach == 1) { + /* Fill rach indication here and send to proxy. Basically take pieces from + L1_nr_prach_procedures() and send it to the proxy. prach from ue->gNb->gnb sends rach->ue receives rach + The UE is basically filling the rach and proxy will receive and think that it came from the gNB. The + received rach in the proxy will trigger gNB to send back the RAR. RAR will go to proxy then goes to UE + and the UE will get the DCI for RAR and the payload. have to handle receving the RAR once we get it. */ LOG_I(NR_PHY, "Melissa! Calling nr_Msg1_transmitted!!!\n"); - nr_Msg1_transmitted(mod_id, CC_id, frame_tx, gNB_id); + nr_Msg1_transmitted(mod_id, CC_id, frame_tx, gNB_id); //This is called when phy layer has sent the prach } else if (nr_prach == 2) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 8969032a74..c5428f1478 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -529,7 +529,10 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } if (prach_resources->init_msg1) { - + if (is_nr_UL_slot(mac->scc, nr_slot_tx)) { + LOG_D(MAC, "calling nr_ue_prach_scheduler\n"); + nr_ue_prach_scheduler(mod_id, nr_slot_tx, frame, 0); + } if (ra->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ @@ -626,10 +629,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // Fill in preamble and PRACH resources ra->RA_window_cnt--; nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); - if (is_nr_UL_slot(mac->scc, nr_slot_tx)) { - nr_ue_scheduler(NULL, mac->ul_config_request); - nr_ue_prach_scheduler(mod_id, frame, nr_slot_tx, 0); - } } else if (ra->RA_backoff_cnt > 0) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index b9d90f5dc8..4777b9437e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1650,17 +1650,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s //fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP); fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0]; - #if 0 //Melissa - fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP); - fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PRACH); - if (!ul_config) { - LOG_W(MAC, "In %s: ul_config request is NULL. " - "Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", - __FUNCTION__, frameP, slotP); - return; - } - #endif - fapi_nr_ul_config_prach_pdu *prach_config_pdu; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; fapi_nr_prach_config_t *prach_config = &cfg->prach_config; @@ -1693,12 +1682,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s format = prach_occasion_info_p->format; format0 = format & 0xff; // single PRACH format format1 = (format >> 8) & 0xff; // dual PRACH format - #if 1 //Melissa - ul_config->sfn = frameP; - ul_config->slot = slotP; - - ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PRACH; - #endif + if (ul_config == NULL) + return; prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu)); ul_config->number_pdus += 1; @@ -1779,11 +1764,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s AssertFatal(1 == 0, "Invalid PRACH format"); } } // if format1 + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); + if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) + mac->if_module->scheduled_response(&scheduled_response); } // is_nr_prach_slot - - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); - if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) - mac->if_module->scheduled_response(&scheduled_response); } // if is_nr_UL_slot }