diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 85bb10290a..b5680a9bf8 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3809,6 +3809,18 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_A(NR_MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR)); ra->RA_RAPID_found = 1; + if (get_softmodem_params()->emulate_l1) { + LOG_I(NR_MAC, "If we found the RAR, the other PDUs are for other UEs and we dont need to process. " + "Only save rx_indication_body[%d] as only PDU in RX_indication\n", pdu_id); + dl_info->rx_ind->number_pdus = 1; + if (pdu_id != 0) { + memcpy(&dl_info->rx_ind->rx_indication_body[0], + &dl_info->rx_ind->rx_indication_body[pdu_id], + sizeof(fapi_nr_rx_indication_body_t)); + } + mac->nr_ue_emul_l1.expected_rar = false; + memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar)); + } break; } if (rarh->E == 0) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c7b54950d7..b98a9c8789 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -292,11 +292,11 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ { NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); mac->nr_ue_emul_l1.expected_sib = false; - memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(*mac->nr_ue_emul_l1.index_has_sib)); + memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(mac->nr_ue_emul_l1.index_has_sib)); mac->nr_ue_emul_l1.expected_rar = false; - memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(*mac->nr_ue_emul_l1.index_has_rar)); + memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(mac->nr_ue_emul_l1.index_has_rar)); mac->nr_ue_emul_l1.expected_dci = false; - memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(*mac->nr_ue_emul_l1.index_has_dci)); + memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(mac->nr_ue_emul_l1.index_has_dci)); int pdu_idx = 0; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; @@ -420,7 +420,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi if (!dl_info->rx_ind) { - dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t)); + dl_info->rx_ind = CALLOC(num_pdus, sizeof(fapi_nr_rx_indication_t)); } AssertFatal(dl_info->rx_ind != NULL, "%s: Out of memory in calloc", __FUNCTION__); fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind;