From 1654af9a63c9071d7208738535a1602000933ec5 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Wed, 8 Jun 2016 00:28:16 +0200
Subject: [PATCH] removed some traces that flooded the screen. Added UE
 information in PHY/MAC/RRC to indicate status of active/failing UEs every
 10.24 seconds.

---
 openair1/SCHED/phy_procedures_lte_eNb.c | 23 +++++++++++++----------
 openair2/LAYER2/MAC/eNB_scheduler.c     |  8 +++++---
 openair2/RRC/LITE/rrc_common.c          | 13 +++++++++++++
 openair2/RRC/LITE/rrc_eNB.c             |  3 ++-
 targets/RT/USER/lte-enb.c               |  3 ++-
 targets/RT/USER/lte-softmodem.c         |  2 +-
 6 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 619a5d6329..4601781e68 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -159,12 +159,11 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *eNB)
 {
   uint8_t i;
 
-#ifdef DEBUG_PHY_PROC
-  LOG_I(PHY,"[eNB %d/%d] Adding UE with rnti %x\n",
+
+  LOG_D(PHY,"[eNB %d/%d] Adding UE with rnti %x\n",
         eNB->Mod_id,
         eNB->CC_id,
         (uint16_t)rnti);
-#endif
 
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     if ((eNB->dlsch[i]==NULL) || (eNB->ulsch[i]==NULL)) {
@@ -209,9 +208,9 @@ int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rntiP) {
       } else {
 	if (eNB->UE_stats[i].crnti==rntiP) {
 	  MSC_LOG_EVENT(MSC_PHY_ENB, "0 Removed ue %"PRIx16" ", rntiP);
-#ifdef DEBUG_PHY_PROC
-	  LOG_I(PHY,"eNB %d removing UE %d with rnti %x\n",eNB->Mod_id,i,rnti);
-#endif
+
+	  LOG_D(PHY,"eNB %d removing UE %d with rnti %x\n",eNB->Mod_id,i,rntiP);
+
 	  //LOG_D(PHY,("[PHY] UE_id %d\n",i);
 	  clean_eNb_dlsch(eNB->dlsch[i][0]);
 	  clean_eNb_ulsch(eNB->ulsch[i]);
@@ -841,7 +840,7 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
   int frame = proc->frame_tx;
   int subframe = proc->subframe_tx;
 
-  LOG_I(PHY,
+  LOG_D(PHY,
 	"[eNB %"PRIu8"][PUSCH %"PRIu8"] Frame %d subframe %d UL Frame %"PRIu32", UL Subframe %"PRIu8", Generated ULSCH (format0) DCI (rnti %"PRIx16", dci %"PRIx8"), aggregation %d\n",
 	eNB->Mod_id,
 	subframe2harq_pid(fp,
@@ -1137,7 +1136,11 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 
   for (i=0; i<NUMBER_OF_UE_MAX; i++) {
     // If we've dropped the UE, go back to PRACH mode for this UE
-
+    if ((frame==0)&&(subframe==0)) {
+      if (eNB->UE_stats[i].crnti > 0) {
+	LOG_I(PHY,"UE %d : rnti %x\n",i,eNB->UE_stats[i].crnti);
+      }
+    }
     if (eNB->UE_stats[i].ulsch_consecutive_errors == ULSCH_max_consecutive_errors) {
       LOG_W(PHY,"[eNB %d, CC %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached %u, triggering UL Failure\n",
             eNB->Mod_id,eNB->CC_id,frame,subframe, i, eNB->UE_stats[i].ulsch_consecutive_errors);
@@ -1947,7 +1950,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,uint8_t abstraction_flag)
       eNB->UE_stats[(uint32_t)UE_id].UE_timing_offset = preamble_delay_list[preamble_max]&0x1FFF; //limit to 13 (=11+2) bits
 
       eNB->UE_stats[(uint32_t)UE_id].sector = 0;
-      LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n",
+      LOG_D(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure (UE_id %d) with preamble %d, energy %d.%d dB, delay %d\n",
             eNB->Mod_id,
             eNB->CC_id,
             frame,
@@ -2616,7 +2619,7 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
 {
   //RX processing for ue-specific resources (i
   UNUSED(r_type);
-  uint32_t l, ret=0,i,j,k;
+  uint32_t ret=0,i,j,k;
   uint32_t harq_pid, harq_idx, round;
   uint8_t nPRS;
   int sync_pos;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 65098e975f..4167db00fd 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -119,8 +119,10 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
   while (i>=0) {
     rnti = UE_RNTI(module_idP, i);
     CC_id = UE_PCCID(module_idP, i);
-    LOG_D(MAC,"UE %d: rnti %x (%p)\n", i, rnti,
-          mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti));
+    if ((frameP==0)&&(subframeP==0))
+      LOG_I(MAC,"UE  rnti %x : %s\n", rnti, 
+	    UE_list->UE_sched_ctrl[i].ul_out_of_sync==0 ? "in synch" : "out of sync");
+
     next_i= UE_list->next[i];
 
     PHY_vars_eNB_g[module_idP][CC_id]->pusch_stats_bsr[i][(frameP*10)+subframeP]=-63;
@@ -317,7 +319,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
 
   //if (subframeP%5 == 0)
   //#ifdef EXMIMO
-  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,module_idP);
+  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, subframeP,module_idP);
   pdcp_run(&ctxt);
   //#endif
 
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index 2092317647..e05e957e36 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -525,6 +525,19 @@ rrc_rx_tx(
 
     // check for UL failure
     RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) {
+      if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
+	if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+	  LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+	else {
+	  LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
+		ue_context_p->ue_context.rnti,
+		ue_context_p->ue_context.ul_failure_timer);
+	}
+      }
       if (ue_context_p->ue_context.ul_failure_timer>0) {
 	ue_context_p->ue_context.ul_failure_timer++;
 	if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index dcc3264828..b0ee647fc8 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -3742,12 +3742,13 @@ rrc_eNB_decode_ccch(
             if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) {
 
 		//#warning "TODO: stmsi_exist: remove UE from MAC/PHY (how?)"
-	      LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti);
+	      LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti);
 	      stmsi_received=1;
 	      ue_context_p->ue_context.rnti = ctxt_pP->rnti;
 	      //   AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)");
 	      //              ue_context_p = NULL;
             } else {
+	      LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %x => %x\n",ue_context_p,m_tmsi);
               ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
 	      ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE;
 	      ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code;
diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c
index daeca00f42..373a13e150 100644
--- a/targets/RT/USER/lte-enb.c
+++ b/targets/RT/USER/lte-enb.c
@@ -741,7 +741,8 @@ static void* eNB_thread_rx_common( void* param )
 #if defined(ENABLE_ITTI)
   wait_system_ready ("Waiting for eNB application to be ready %s\r", &start_eNB);
 #endif 
-
+  if (openair0.trx_start_func(&openair0) != 0 ) 
+    LOG_E(HW,"Could not start the device\n");
  // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
  while (!oai_exit) {
    
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 26c4a9ae88..70769c6957 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1762,7 +1762,7 @@ int main( int argc, char **argv )
 
 
 #ifndef USRP_DEBUG
-  if (mode!=loop_through_memory)
+  if ((UE_flag==1) && (mode!=loop_through_memory))
     if (openair0.trx_start_func(&openair0) != 0 ) 
       LOG_E(HW,"Could not start the device\n");
 
-- 
GitLab