From 262efe7902cbcc74690a25fa4e8483d3130f8af1 Mon Sep 17 00:00:00 2001 From: "Deokseong \"David\" Kim" Date: Wed, 1 Sep 2021 21:10:10 +0000 Subject: [PATCH] Fix to handle multiple UEs and typo bug. --- executables/nr-ue.c | 6 ++++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 13 +++++++++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++++ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 6 +++--- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 6b63bf7486..bb57b09ea8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -158,6 +158,7 @@ void init_nrUE_standalone_thread(int ue_idx) static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_prach_pdu *prach_pdu) { + NR_UE_MAC_INST_t *mac = get_mac_inst(0); nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind)); rach_ind->sfn = frame; rach_ind->slot = slot; @@ -176,7 +177,8 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_p rach_ind->pdu_list[pdu_index].num_preamble = 1; const int num_p = rach_ind->pdu_list[pdu_index].num_preamble; rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t)); - rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = 63; //Melissa, need to get this out of rrc_reconfig_msg + rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex; + rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0; rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; @@ -295,7 +297,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx; ul_info.ue_sched_mode = SCHED_ALL; - if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); + if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); memset(&mac->dl_info, 0, sizeof(mac->dl_info)); mac->dl_info.cc_id = CC_id; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 3c37e63fbb..619f393c50 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -510,10 +510,15 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits); - int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); - if ((ret&1) == 1) return -1; - else if (ret == 2) dci->dci_format = NR_UL_DCI_FORMAT_0_0; - return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci)); + if ((dci->rnti == mac->crnti) || (dci->rnti == mac->ra.ra_rnti)) { + int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); + if ((ret&1) == 1) + return -1; + else if (ret == 2) + dci->dci_format = NR_UL_DCI_FORMAT_0_0; + return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci)); + } + return 0; } int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, fapi_nr_dci_indication_pdu_t *dci_ind) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index ed4530b34b..9a9f0635f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -527,6 +527,10 @@ void nr_initiate_ra_proc(module_id_t module_idP, for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &cc->ra[i]; pr_found = 0; + const int UE_id = find_nr_UE_id(module_idP, ra->rnti); + if (UE_id != -1) { + continue; + } if (ra->state == RA_IDLE) { for(int j = 0; j < ra->preambles.num_preambles; j++) { //check if the preamble received correspond to one of the listed or configured preambles diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index b10dae6e87..05668a71eb 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -300,10 +300,10 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id]; NR_IF_Module_t *ifi = nr_if_inst[module_id]; gNB_MAC_INST *mac = RC.nrmac[module_id]; - LOG_D(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n", + LOG_D(NR_PHY,"SFN/SLOT:%d.%d module_id:%d CC_id:%d UL_info[rach_pdus:%zu rx_ind:%zu crcs:%zu]\n", UL_info->frame,UL_info->slot, - module_id,CC_id, UL_info->rach_ind.number_of_pdus, - UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs); + module_id,CC_id, gnb_rach_ind_queue.num_items, + gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items); if (NFAPI_MODE != NFAPI_MODE_PNF) {