From 053ef8fc4485d72166c73ae5c784388db3f43b05 Mon Sep 17 00:00:00 2001
From: francescomani <email@francescomani.it>
Date: Thu, 20 Apr 2023 11:47:37 +0200
Subject: [PATCH] bug fix for msg3 retrasmission scheduling frame

---
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index d08d2fefb3..5adb036931 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -715,7 +715,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP,
   NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ul_bwp->tdaList_Common;
   int mu = ul_bwp->scs;
   uint8_t K2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2;
-  const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]);
+  const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu])) % 1024;
   const int sched_slot = (slot + K2) % nr_slots_per_frame[mu];
 
   if (is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) {
-- 
2.26.2