From f2b3597b5532d18a140c9d09e0196fcb9b5493c3 Mon Sep 17 00:00:00 2001
From: Cedric Roux <roux@eurecom.fr>
Date: Tue, 10 Nov 2015 10:19:07 +0100
Subject: [PATCH] This is a very basic fix, more work is needed.

The problem seems that we reuse HARQ processes too early.
For example, at subframe 0 we allocate PID 0. At subframe 4
we receive an ACK. At subframe 5 we may well reallocate this
PID. It seems category 3 UEs don't like that. They expect
some delay. How much? I don't know. 8 maybe, as for UL.

This commit forces allocation of HARQ PID:
  0 on subframe 1,
  1 on subframe 2,
  2 on subframe 3,
  3 on subframe 4,
  4 on subframe 6,
  5 on subframe 7,
  6 on subframe 8,
  7 on subframe 9.

We don't use subframes 0 and 5 (for initial transmission at
least). (Current develop branch doesn't either I think.)

This is not a good solution, just a quick and dirty one. With this
commit I can achieve 12Mbps with iperf UDP on a 5MHz band 7 carrier
with a cat3 UE. And more than 11Mbps with iperf TCP. And a bad
radio link.

We may want to implement some sort of free-list and take the
oldest PID in there, if it is older than let's say 8 subframes
(that is: the last transmission with this pid was done more
than 8 subframes ealier). We may well have no free PID if a
lot of retransmissions are done.
---
 openair1/SCHED/phy_procedures_lte_eNb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 165f2fbac6..5442085514 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -224,6 +224,7 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB)
 
 int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag)
 {
+  int sf2hp[] = { 1, 2, 3, 4, 6, 7, 8, 9 };
 
   LTE_eNB_DLSCH_t *DLSCH_ptr;
   LTE_eNB_ULSCH_t *ULSCH_ptr;
@@ -249,7 +250,7 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
       if (DLSCH_ptr->harq_processes[i]!=NULL) {
 	if (DLSCH_ptr->harq_processes[i]->status != ACTIVE) {
 	  // store first inactive process
-	  if (first_proc_found == 0) {
+	  if (sf2hp[i] == subframe && first_proc_found == 0) {
 	    first_proc_found = 1;
 	    *harq_pid = i;
 	    *round = 0;
-- 
GitLab