From d2415060436d62896693b74f695c9c89ec947aa9 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 23 Nov 2023 12:14:39 +0100 Subject: [PATCH] fix for L2 simulator --- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 8 +++++++- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index f638ea789f..87c983d76e 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -364,7 +364,7 @@ void nr_get_prach_resources(module_id_t mod_id, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigDedicated_t * rach_ConfigDedicated); -void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, NR_UE_HARQ_STATUS_t *current_harq, int ack_nack); +void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack); void configure_initial_pucch(PUCCH_sched_t *pucch, int res_ind); void init_RA(module_id_t mod_id, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 07907addc5..73228af0d1 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -951,8 +951,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res } } -void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, NR_UE_HARQ_STATUS_t *current_harq, int ack_nack) +void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) { + NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[pid]; int sched_slot = current_harq->ul_slot; int sched_frame = current_harq->ul_frame; fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, sched_slot, 0); @@ -970,6 +971,11 @@ void prepare_msg4_feedback(NR_UE_MAC_INST_t *mac, NR_UE_HARQ_STATUS_t *current_h pucch.n_harq = 1; current_harq->active = false; current_harq->ack_received = false; + if (get_softmodem_params()->emulate_l1) { + mac->nr_ue_emul_l1.harq[pid].active = true; + mac->nr_ue_emul_l1.harq[pid].active_dl_harq_sfn = sched_frame; + mac->nr_ue_emul_l1.harq[pid].active_dl_harq_slot = sched_slot; + } nr_ue_configure_pucch(mac, sched_slot, mac->ra.t_crnti, diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 0b655ab010..b8ccdf3d8d 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1112,7 +1112,7 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac LOG_D(PHY,"Updating harq_status for harq_id %d, ack/nak %d\n", harq_pid, current_harq->ack); // we can prepare feedback for MSG4 in advance if (mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION) - prepare_msg4_feedback(mac, current_harq, ack_nack); + prepare_msg4_feedback(mac, harq_pid, ack_nack); else { current_harq->ack = ack_nack; current_harq->ack_received = true;