From ea3aecf486f2296c044cbcf505fdb92c167c85c2 Mon Sep 17 00:00:00 2001
From: tomita <tomita.y@jp.fujitsu.com>
Date: Mon, 19 Feb 2018 19:42:06 +0900
Subject: [PATCH] Bug fix about harq_pid calculation (harq_pid is calculated
 less than 0).

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

diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 186ade03d3..e7831ffe93 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3839,10 +3839,15 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
 	    int M = ul_ACK_subframe2_M(fp,subframeP);
 	    for(m=0;m<M;m++){
 	     subframe_tx = ul_ACK_subframe2_dl_subframe(fp,subframeP,m);
-	     if(frameP==1023&&subframeP>5)
-	         frame_tx= -1;
-	     else
-	         frame_tx = subframeP < 5 ? frameP-1:frameP; // not formal
+	     switch (cc->tdd_Config->subframeAssignment){
+	     case 1:
+	        if(frameP==0&&subframeP<4)
+	          frame_tx= 0;
+	        else
+	          frame_tx = subframeP < 4 ? frameP-1:frameP; // not formal
+	          break;
+	         // TODO : Other TDD Config
+	     }
 	     harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
 	     if(num_ack_nak==1){
 	         if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
-- 
GitLab