From db90088c5b08a2fad45cd0977352f863e7a2f1b0 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 29 Jul 2020 17:01:48 +0200 Subject: [PATCH] Fixed bug in ul harq handler --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 4 ++-- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 22 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 91c9ae2144..e4466d3030 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -786,7 +786,7 @@ uint8_t select_ul_harq_pid(NR_UE_sched_ctrl_t *sched_ctrl) { cur_harq = sched_ctrl->ul_harq_processes[hrq_id]; if (cur_harq.state==ACTIVE_NOT_SCHED) { #ifdef UL_HARQ_PRINT - printf("[SCHED] Found active ulharq id %d, scheduling it for retransmission\n",harq_id); + printf("[SCHED] Found active ulharq id %d, scheduling it for retransmission\n",hrq_id); #endif return hrq_id; } @@ -797,7 +797,7 @@ uint8_t select_ul_harq_pid(NR_UE_sched_ctrl_t *sched_ctrl) { cur_harq = sched_ctrl->ul_harq_processes[hrq_id]; if (cur_harq.state==INACTIVE) { #ifdef UL_HARQ_PRINT - printf("[SCHED] Found inactive ulharq id %d, scheduling it\n",harq_id); + printf("[SCHED] Found inactive ulharq id %d, scheduling it\n",hrq_id); #endif return hrq_id; } diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 1a08cd60d5..91697e713a 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -136,27 +136,27 @@ void handle_nr_ul_harq(uint16_t slot, NR_UE_sched_ctrl_t *sched_ctrl, uint8_t cr int max_harq_rounds = 4; // TODO define macro for (uint8_t hrq_id = 0; hrq_id < NR_MAX_NB_HARQ_PROCESSES; hrq_id++) { - NR_UE_ul_harq_t cur_harq = sched_ctrl->ul_harq_processes[hrq_id]; - if ((cur_harq.last_tx_slot == slot-1) && cur_harq.state==ACTIVE_SCHED) { + NR_UE_ul_harq_t *cur_harq = &sched_ctrl->ul_harq_processes[hrq_id]; + if ((cur_harq->last_tx_slot == slot-1) && cur_harq->state==ACTIVE_SCHED) { if (!crc_status) { - cur_harq.ndi ^= 1; - cur_harq.round = 0; - cur_harq.state = INACTIVE; // passed -> make inactive. can be used by scheduder for next grant + cur_harq->ndi ^= 1; + cur_harq->round = 0; + cur_harq->state = INACTIVE; // passed -> make inactive. can be used by scheduder for next grant #ifdef UL_HARQ_PRINT printf("[HARQ HANDLER] Ulharq id %d crc passed, freeing it for scheduler\n",hrq_id); #endif } else { - cur_harq.round++; - cur_harq.state = ACTIVE_NOT_SCHED; + cur_harq->round++; + cur_harq->state = ACTIVE_NOT_SCHED; #ifdef UL_HARQ_PRINT printf("[HARQ HANDLER] Ulharq id %d crc failed, requesting retransmission\n",hrq_id); #endif } - if (!(cur_harq.round make inactive - cur_harq.round = 0; + if (!(cur_harq->roundndi ^= 1; + cur_harq->state = INACTIVE; // failed after 4 rounds -> make inactive + cur_harq->round = 0; #ifdef UL_HARQ_PRINT printf("[HARQ HANDLER] Ulharq id %d crc failed in all round, freeing it for scheduler\n",hrq_id); #endif