From a2c536bf8bdaafbce2d1a3c8c6db41c52c80a2ac Mon Sep 17 00:00:00 2001
From: laurent <laurent.thomas@open-cells.com>
Date: Mon, 26 Aug 2019 21:14:25 +0200
Subject: [PATCH] fix SR report from UE->DU->CU, remain later failure in PUSCH
 allocation

---
 executables/main-fs6.c                      | 41 ++++++++++++++-------
 executables/split_headers.h                 |  7 ++++
 openair1/PHY/LTE_TRANSPORT/pbch.c           |  2 +-
 openair1/PHY/LTE_TRANSPORT/prach_common.c   |  1 -
 openair1/PHY/LTE_TRANSPORT/transport_eNB.h  |  2 +-
 openair1/PHY/LTE_TRANSPORT/uci_tools.c      |  4 +-
 openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c | 34 +++++++++++++----
 openair1/SCHED/fapi_l1.c                    |  2 +-
 openair1/SCHED/fapi_l1.h                    |  2 +-
 openair1/SCHED/phy_procedures_lte_eNb.c     | 16 +++++---
 targets/ARCH/rfsimulator/simulator.c        |  2 +-
 11 files changed, 79 insertions(+), 34 deletions(-)

diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index 845e5c6f5..bb88c1d61 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -171,7 +171,7 @@ void prach_eNB_fromsplit(uint8_t *bufferZone, int bufSize, PHY_VARS_eNB *eNB) {
   }
 }
 
-void sendFs6Ulharq(int UEid,  PHY_VARS_eNB *eNB, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask) {
+void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask,  uint16_t rnti,  int32_t stat) {
   static int current_fsf=-1;
   int fsf=frame*16+subframe;
   uint8_t *bufferZone=eNB->FS6bufferZone;
@@ -200,16 +200,22 @@ void sendFs6Ulharq(int UEid,  PHY_VARS_eNB *eNB, int frame, int subframe, uint8_
       curBlock++;
     }
 
+  LOG_D(PHY,"FS6 du, block: %d: adding ul harq/sr: %d, rnti: %d, ueid: %d\n",
+	curBlock, type, rnti, UEid);
   commonUDP_t *newUDPheader=(commonUDP_t *) firstFreeByte;
   fs6_ul_uespec_uci_element_t *tmp=(fs6_ul_uespec_uci_element_t *)(hULUEuci(newUDPheader)+1);
   tmp+=hULUEuci(newUDPheader)->nb_active_ue;
+  tmp->type=type;
   tmp->UEid=UEid;
   tmp->frame=frame;
   tmp->subframe=subframe;
-  memcpy(tmp->harq_ack, harq_ack, 4);
+  if (harq_ack != NULL)
+    memcpy(tmp->harq_ack, harq_ack, 4);
   tmp->tdd_mapping_mode=tdd_mapping_mode;
   tmp->tdd_multiplexing_mask=tdd_multiplexing_mask;
   tmp->n0_subband_power_dB=eNB->measurements.n0_subband_power_dB[0][0];
+  tmp->rnti=rnti;
+  tmp->stat=stat;
   hULUEuci(newUDPheader)->nb_active_ue++;
   newUDPheader->contentBytes+=sizeof(fs6_ul_uespec_uci_element_t);
 }
@@ -636,12 +642,19 @@ void recvFs6Ul(uint8_t *bufferZone, int nbBlocks, PHY_VARS_eNB *eNB) {
       } else if ( type == fs6ULcch ) {
         int nb_uci=hULUEuci(bufPtr)->nb_active_ue;
         fs6_ul_uespec_uci_element_t *tmp=(fs6_ul_uespec_uci_element_t *)(hULUEuci(bufPtr)+1);
-
-        for (int i=0; i < nb_uci ; i++) {
+        for (int j=0; j < nb_uci ; j++) {
+	  LOG_D(PHY,"FS6 cu, block: %d/%d: received ul harq/sr: %d, rnti: %d, ueid: %d\n",
+		i, j, type, tmp->rnti, tmp->UEid);
           eNB->measurements.n0_subband_power_dB[0][0]=tmp->n0_subband_power_dB;
-          fill_uci_harq_indication (tmp->UEid, eNB, &eNB->uci_vars[tmp->UEid],
-                                    tmp->frame, tmp->subframe, tmp->harq_ack,
-                                    tmp->tdd_mapping_mode, tmp->tdd_multiplexing_mask);
+	  
+	  if ( tmp->type == fs6ULindicationHarq )
+	    fill_uci_harq_indication (tmp->UEid, eNB, &eNB->uci_vars[tmp->UEid],
+				      tmp->frame, tmp->subframe, tmp->harq_ack,
+				      tmp->tdd_mapping_mode, tmp->tdd_multiplexing_mask);
+	  else if ( tmp->type == fs6ULindicationSr )
+	    fill_sr_indication(tmp->UEid, eNB,tmp->rnti,tmp->frame,tmp->subframe,tmp->stat);
+	  else
+	    LOG_E(PHY, "Split FS6: impossible UL harq type\n");
           tmp++;
         }
       } else
@@ -655,6 +668,13 @@ void recvFs6Ul(uint8_t *bufferZone, int nbBlocks, PHY_VARS_eNB *eNB) {
 void phy_procedures_eNB_uespec_RX_fromsplit(uint8_t *bufferZone, int nbBlocks,PHY_VARS_eNB *eNB) {
   // The configuration arrived in Dl, so we can extract the UL data
   recvFs6Ul(bufferZone, nbBlocks, eNB);
+  
+  // dirty memory allocation in OAI...
+  for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++)
+    if ( eNB->uci_vars[i].frame == eNB->proc.frame_rx &&
+	 eNB->uci_vars[i].subframe == eNB->proc.subframe_rx )
+      eNB->uci_vars[i].active=0;
+
   pusch_procedures_fromsplit(bufferZone, nbBlocks, eNB);
 }
 
@@ -1025,13 +1045,8 @@ void phy_procedures_eNB_TX_tosplit(uint8_t *bufferZone, PHY_VARS_eNB *eNB, L1_rx
     LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
 
     if (ulsch->rnti>0) {
-      LOG_I(PHY,"check in UL scheduled harq %d: rnti %d, tx frame %d/%d, ulsch: %d, %d/%d (handled: %d)\n",
+      LOG_D(PHY,"check in UL scheduled harq %d: rnti %d, tx frame %d/%d, ulsch: %d, %d/%d (handled: %d)\n",
             harq_pid, ulsch->rnti, frame, subframe, ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled);
-
-      for (int k=0; k<8; k++)
-        if ( ulsch->harq_processes[k]->status == ACTIVE)
-          LOG_I(PHY,"check in UL scheduledi (harq_pid %d): rnti %d, tx frame %d/%d, ulsch: %d, %d/%d (handled: %d)\n", k,
-                ulsch->rnti, frame, subframe, ulsch->harq_processes[k]->status,  ulsch->harq_processes[k]->frame, ulsch->harq_processes[k]->subframe,  ulsch->harq_processes[k]->handled);
     }
 
     for (int k=0; k<8; k++) {
diff --git a/executables/split_headers.h b/executables/split_headers.h
index 0fed9d63c..576a3854a 100644
--- a/executables/split_headers.h
+++ b/executables/split_headers.h
@@ -67,6 +67,8 @@ enum pckType {
   fs6ULConfigCCH=27,
   fs6ULsch=28,
   fs6ULcch=29,
+  fs6ULindicationHarq=40,
+  fs6ULindicationSr=41,
 };
 
 typedef struct {
@@ -132,6 +134,7 @@ typedef struct {
 } fs6_ul_uespec_t;
 
 typedef struct {
+  enum pckType type:8;
   int UEid;
   int frame;
   int subframe;
@@ -139,6 +142,8 @@ typedef struct {
   uint8_t tdd_mapping_mode;
   uint16_t tdd_multiplexing_mask;
   unsigned short n0_subband_power_dB;
+  uint16_t rnti;
+  int32_t stat;
 } fs6_ul_uespec_uci_element_t;
 
 typedef struct {
@@ -174,6 +179,8 @@ static inline void *commonUDPdata(uint8_t *ptr) {
 }
 
 void setAllfromTS(uint64_t TS);
+void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask,  uint16_t rnti,  int32_t stat);
+void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen);
 void *cu_fs6(void *arg);
 void *du_fs6(void *arg);
 void fill_rf_config(RU_t *ru, char *rf_config_file);
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index d852248b6..37997c94b 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -195,7 +195,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
   pbch_E  = (frame_parms->Ncp==NORMAL) ? 1920 : 1728; //RE/RB * #RB * bits/RB (QPSK)
   //  pbch_E_bytes = pbch_coded_bits>>3;
 
-  LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4);
+  LOG_D(PHY,"%s(eNB_pbch:%p txdataF:%p amp:%d frame_parms:%p pbch_pdu:%p frame_mod4:%d)\n", __FUNCTION__, eNB_pbch, txdataF, amp, frame_parms, pbch_pdu, frame_mod4==0);
 
   if (frame_mod4==0) {
     bzero(pbch_a,PBCH_A>>3);
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c
index 32c37842b..5f7a904db 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c
@@ -36,7 +36,6 @@
 #include "common/utils/LOG/vcd_signal_dumper.h"
 
 
-#define PRACH_DEBUG
 uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
 uint16_t NCS_restricted[15]   = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case
 uint16_t NCS_4[7]             = {2,4,6,8,10,12,15};
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
index 4caca45ac..e1c68cc05 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
@@ -274,7 +274,7 @@ typedef struct {
   /// Pointers to transport block segments
   uint8_t *c[MAX_NUM_ULSCH_SEGMENTS];
   /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15)
-  uint32_t RTCC[MAX_NUM_ULSCH_SEGMENTS];
+  uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS];
   /// Current Number of Symbols
   uint8_t Nsymb_pusch;
   /// SRS active flag
diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
index c301c8510..08addbb63 100644
--- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c
@@ -49,7 +49,9 @@ int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_
     else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i;
   }
   if (type == SEARCH_EXIST) return(-1);
-  else return(first_free_index);
+  if (first_free_index==-1)
+	  LOG_E(MAC,"UCI table is full\n");
+  return(first_free_index);
 }
 
 
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index 59fd9b137..fbbe9eadb 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -44,9 +44,10 @@
 //#define DEBUG_ULSCH_DECODING
 #include "targets/RT/USER/rt_wrapper.h"
 #include "transport_proto.h"
+#include <executables/split_headers.h>
 
 extern WORKER_CONF_t get_thread_worker_conf(void);
-void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen);
+
 
 void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch) {
   int i,r;
@@ -275,7 +276,7 @@ int ulsch_decoding_data_2thread0(td_params *tdp) {
 
     Kr_bytes = Kr>>3;
     memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
-    ulsch_harq->RTCC[r] = generate_dummy_w(4+(Kr_bytes*8),
+    ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
                                           (uint8_t *)&dummy_w[r][0],
                                           (r==0) ? ulsch_harq->F : 0);
 #ifdef DEBUG_ULSCH_DECODING
@@ -287,7 +288,7 @@ int ulsch_decoding_data_2thread0(td_params *tdp) {
            ulsch_harq->Nl);
 #endif
 
-    if (lte_rate_matching_turbo_rx(ulsch_harq->RTCC[r],
+    if (lte_rate_matching_turbo_rx(ulsch_harq->RTC[r],
                                    G,
                                    ulsch_harq->w[r],
                                    (uint8_t *) &dummy_w[r][0],
@@ -449,7 +450,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
 
     Kr_bytes = Kr>>3;
     memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
-    ulsch_harq->RTCC[r] = generate_dummy_w(4+(Kr_bytes*8),
+    ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
                                           (uint8_t *)&dummy_w[r][0],
                                           (r==0) ? ulsch_harq->F : 0);
 #ifdef DEBUG_ULSCH_DECODING
@@ -462,7 +463,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
 #endif
     start_meas(&eNB->ulsch_rate_unmatching_stats);
 
-    if (lte_rate_matching_turbo_rx(ulsch_harq->RTCC[r],
+    if (lte_rate_matching_turbo_rx(ulsch_harq->RTC[r],
                                    G,
                                    ulsch_harq->w[r],
                                    (uint8_t *) &dummy_w[r][0],
@@ -572,7 +573,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
 
     Kr_bytes = Kr>>3;
     memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
-    ulsch_harq->RTCC[r] = generate_dummy_w(4+(Kr_bytes*8),
+    ulsch_harq->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
                                           (uint8_t *)&dummy_w[r][0],
                                           (r==0) ? ulsch_harq->F : 0);
 #ifdef DEBUG_ULSCH_DECODING
@@ -585,7 +586,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
 #endif
     start_meas(&eNB->ulsch_rate_unmatching_stats);
 
-    if (lte_rate_matching_turbo_rx(ulsch_harq->RTCC[r],
+    if (lte_rate_matching_turbo_rx(ulsch_harq->RTC[r],
                                    G,
                                    ulsch_harq->w[r],
                                    (uint8_t *) &dummy_w[r][0],
@@ -620,8 +621,24 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
     if ( getenv("fs6") != NULL && strncasecmp( getenv("fs6"), "du", 2) == 0 ) {
       // r is the segment id,
       // Kr is the segment length in short 
-// *3 because LTE redudancy scheme
+      // *3 because LTE redudancy scheme
       sendFs6Ul(eNB, UE_id, harq_pid, r, &ulsch_harq->d[r][96], Kr*sizeof(int16_t)*3);
+      LOG_D(PHY, "Cu should decode in %d iter\n",tc(&ulsch_harq->d[r][96],
+             NULL,
+             ulsch_harq->c[r],
+             NULL,
+             Kr,
+             ulsch->max_turbo_iterations,//MAX_TURBO_ITERATIONS,
+             crc_type,
+             (r==0) ? ulsch_harq->F : 0,
+             &eNB->ulsch_tc_init_stats,
+             &eNB->ulsch_tc_alpha_stats,
+             &eNB->ulsch_tc_beta_stats,
+             &eNB->ulsch_tc_gamma_stats,
+             &eNB->ulsch_tc_ext_stats,
+             &eNB->ulsch_tc_intl1_stats,
+             &eNB->ulsch_tc_intl2_stats));
+
       return 0;
     }
       
@@ -642,6 +659,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
              &eNB->ulsch_tc_intl1_stats,
              &eNB->ulsch_tc_intl2_stats);
     stop_meas(&eNB->ulsch_turbo_decoding_stats);
+    LOG_D(PHY,"turbo decode in %d iter\n",ret);
 
     // Reassembly of Transport block here
 
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index 5f8b4ec3d..41c6554c8 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -720,7 +720,7 @@ void handle_nfapi_ul_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
   } else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE) {
     AssertFatal(1==0,"NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE not handled yet\n");
   } else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE) {
-    AssertFatal((UE_id = find_uci(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,
+  AssertFatal((UE_id = find_uci(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,
                                   proc->frame_tx,proc->subframe_tx,eNB,SEARCH_EXIST_OR_FREE))>=0,
                 "No available UE UCI for rnti %x\n",ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti);
     handle_uci_sr_pdu(eNB,UE_id,ul_config_pdu,frame,subframe,srs_present);
diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h
index 77c254b13..0314fcc32 100644
--- a/openair1/SCHED/fapi_l1.h
+++ b/openair1/SCHED/fapi_l1.h
@@ -40,7 +40,7 @@
 void fill_uci_harq_indication(int UEid, PHY_VARS_eNB *eNB,LTE_eNB_UCI *uci,int frame,int subframe,uint8_t *harq_ack,uint8_t tdd_mapping_mode,uint16_t tdd_multiplexing_mask);
 void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,uint16_t rnti, int frame,int subframe,int bundling);
 void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe,LTE_UL_eNB_HARQ_t *ulsch_harq,uint16_t rnti);
-void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat);
+void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat);
 void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe);
 void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag);
 void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 4764ede39..e13999451 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -46,7 +46,7 @@
 #include <time.h>
 
 #include "intertask_interface.h"
-void sendFs6Ulharq(int UEid, PHY_VARS_eNB *eNB, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask);
+#include <executables/split_headers.h> 
 
 nfapi_ue_release_request_body_t release_rntis;
 
@@ -590,7 +590,11 @@ void srs_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
   }
 }
 
-void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat) {
+void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,uint32_t stat) {
+  if ( getenv("fs6") != NULL && strncasecmp( getenv("fs6"), "du", 2) == 0 ) {
+    sendFs6Ulharq(fs6ULindicationSr, UEid, eNB, frame, subframe, NULL,0,0, rnti, stat);
+    return;
+  }
   pthread_mutex_lock(&eNB->UL_INFO_mutex);
   nfapi_sr_indication_t       *sr_ind =         &eNB->UL_INFO.sr_ind;
   nfapi_sr_indication_body_t  *sr_ind_body =    &sr_ind->sr_indication_body;
@@ -706,7 +710,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
 
           if (uci->type == SR) {
             if (SR_payload == 1) {
-              fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
+              fill_sr_indication(i, eNB,uci->rnti,frame,subframe,metric_SR);
               break;
             } else {
               break;
@@ -742,7 +746,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
 
             /* cancel SR detection if reception on n1_pucch0 is better than on SR PUCCH resource index, otherwise send it up to MAC */
             if (uci->type==HARQ_SR && metric[0] > metric_SR) SR_payload = 0;
-            else if (SR_payload == 1) fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
+            else if (SR_payload == 1) fill_sr_indication(i, eNB,uci->rnti,frame,subframe,metric_SR);
 
             if (uci->type==HARQ_SR && metric[0] <= metric_SR) {
               /* when transmitting ACK/NACK on SR PUCCH resource index, SR payload is always 1 */
@@ -793,7 +797,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
                                 );
 
             if (uci->type==HARQ_SR && metric[0] > metric_SR) SR_payload = 0;
-            else if (SR_payload == 1) fill_sr_indication(eNB,uci->rnti,frame,subframe,metric_SR);
+            else if (SR_payload == 1) fill_sr_indication(i, eNB,uci->rnti,frame,subframe,metric_SR);
 
             if (uci->type==HARQ_SR && metric[0] <= metric_SR) {
               SR_payload = 1;
@@ -1757,7 +1761,7 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har
 
 void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask) {
   if ( getenv("fs6") != NULL && strncasecmp( getenv("fs6"), "du", 2) == 0 ) {
-    sendFs6Ulharq(UEid, eNB, frame, subframe, harq_ack, tdd_mapping_mode, tdd_multiplexing_mask);
+    sendFs6Ulharq(fs6ULindicationHarq, UEid, eNB, frame, subframe, harq_ack, tdd_mapping_mode, tdd_multiplexing_mask, 0, 0);
     return;
   }
   
diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c
index d30848609..c8469adbb 100644
--- a/targets/ARCH/rfsimulator/simulator.c
+++ b/targets/ARCH/rfsimulator/simulator.c
@@ -487,7 +487,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
 
   if ( first_sock ==  FD_SETSIZE ) {
     // no connected device (we are eNB, no UE is connected)
-    if (!flushInput(t, 10)) {
+    if (!flushInput(t, 100)) {
       for (int x=0; x < nbAnt; x++)
         memset(samplesVoid[x],0,sampleToByte(nsamps,1));
 
-- 
2.26.2