From 9696e229c1d3750ab0999c81ecd7dca300a284d7 Mon Sep 17 00:00:00 2001
From: Haruki NAOI <naoi.haruki@jp.fujitsu.com>
Date: Fri, 29 Jun 2018 17:45:15 +0900
Subject: [PATCH] fix: round is not match between layer1 and layer2.

---
 openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 9d5bdf90ef..7b86a405e7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3432,9 +3432,12 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
            sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
            LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
          }else{ //nack
-         if( sched_ctl->round[CC_idP][harq_pid]<8)
-           sched_ctl->round[CC_idP][harq_pid]++;
-       LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
+           sched_ctl->round[CC_idP][harq_pid]++; // increment round
+           if (sched_ctl->round[CC_idP][harq_pid] == 4) {
+             sched_ctl->round[CC_idP][harq_pid] = 8;     // release HARQ process
+             sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
+           }
+           LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
       if(sched_ctl->round[CC_idP][harq_pid] == 8){
        for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
         if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
-- 
GitLab