From b2748da3c957afb791fd64ec4e05b6fca95bcb20 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Sun, 20 Jan 2019 13:18:49 +0100
Subject: [PATCH] removal of warnings and excessive logging

---
 openair1/PHY/CODING/crc_byte.c            | 33 ++++++++++++-----------
 openair1/SCHED/fapi_l1.c                  |  6 ++---
 openair2/LAYER2/MAC/eNB_scheduler_bch.c   |  4 +--
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 23 ++++++++--------
 4 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c
index f2f7e4e5c7..06a43fdb79 100644
--- a/openair1/PHY/CODING/crc_byte.c
+++ b/openair1/PHY/CODING/crc_byte.c
@@ -32,21 +32,6 @@
 
 #include "PHY/types.h"
 
-// For initialization && verification purposes, bit by bit implementation with any polynomial
-// The first bit is in the MSB of each byte
-
-// Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9)
-// The highest degree is set by default
-/** 1000 0110 0100 1100 1111 1011  D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 */
-static const uint32_t poly24a = 0x864cfb00;
-/** 1000 0000 0000 0000 0110 0011  D^24 + D^23 + D^6 + D^5 + D + 1 */
-static const uint32_t poly24b = 0x80006300;
-/** 0001 0000 0010 0001            D^16 + D^12 + D^5 + 1 */
-static const uint32_t poly16  = 0x10210000;
-/** 1000 0000 1111                 D^12 + D^11 + D^3 + D^2 + D + 1 */
-static const uint32_t poly12  = 0x80F00000;
-/** 1001 1011                      D^8  + D^7  + D^4 + D^3 + D + 1 */
-static const uint32_t poly8   = 0x9B000000;
 
 // The following arrays are generated with the function 'crcTableInit'
 /** Encoding table for CRC 24A */
@@ -96,6 +81,24 @@ uint32_t crcbit (uint8_t * inputptr, int32_t octetlen, uint32_t poly)
 // CRC table initialization
 
 /*
+  RK: Note that this should be brought back and use crcTableInit instead of static declaration
+      Commented out to remove warning
+  // For initialization && verification purposes, bit by bit implementation with any polynomial
+  // The first bit is in the MSB of each byte
+
+ // Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9)
+// The highest degree is set by default
+// 1000 0110 0100 1100 1111 1011  D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 
+static const uint32_t poly24a = 0x864cfb00;
+// 1000 0000 0000 0000 0110 0011  D^24 + D^23 + D^6 + D^5 + D + 1 
+static const uint32_t poly24b = 0x80006300;
+// 0001 0000 0010 0001            D^16 + D^12 + D^5 + 1 
+static const uint32_t poly16  = 0x10210000;
+// 1000 0000 1111                 D^12 + D^11 + D^3 + D^2 + D + 1 
+static const uint32_t poly12  = 0x80F00000;
+// 1001 1011                      D^8  + D^7  + D^4 + D^3 + D + 1 
+static const uint32_t poly8   = 0x9B000000;
+ 
 void crcTableInit (void)
 {
     uint8_t c = 0;
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index e04f8fa480..0140e63746 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -73,7 +73,7 @@ void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
   LTE_eNB_MPDCCH *mpdcch_vars     = &eNB->mpdcch_vars[idx];
   nfapi_dl_config_mpdcch_pdu *pdu = &dl_config_pdu->mpdcch_pdu;
 
-  LOG_I(PHY,"Frame %d, Subframe %d: MDCI processing\n",proc->frame_tx,proc->subframe_tx);
+  LOG_D(PHY,"Frame %d, Subframe %d: MDCI processing\n",proc->frame_tx,proc->subframe_tx);
 
   // copy dci configuration into eNB structure
   fill_mdci_and_dlsch(eNB,proc,&mpdcch_vars->mdci_alloc[mpdcch_vars->num_dci],pdu);
@@ -101,7 +101,7 @@ void handle_nfapi_hi_dci0_mpdcch_dci_pdu(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,
   int idx                         = proc->subframe_tx&1;
   LTE_eNB_MPDCCH *pdcch_vars      = &eNB->mpdcch_vars[idx];
   // copy dci configuration in to eNB structure
-  fill_mpdcch_dci0(eNB,proc,&pdcch_vars->mdci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->dci_pdu);
+  fill_mpdcch_dci0(eNB,proc,&pdcch_vars->mdci_alloc[pdcch_vars->num_dci], &hi_dci0_config_pdu->mpdcch_dci_pdu);
 }
 
 
@@ -265,7 +265,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro
     dlsch0_harq     = dlsch0->harq_processes[0];
     dlsch0_harq->pdu                    = sdu;
 
-    if (proc->frame_tx < 200) LOG_I(PHY,"NFAPI: frame %d, subframe %d (TX %d.%d): Programming SI-BR (%d) => %d\n",frame,subframe,proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id);
+    if (proc->frame_tx < 200) LOG_D(PHY,"NFAPI: frame %d, subframe %d (TX %d.%d): Programming SI-BR (%d) => %d\n",frame,subframe,proc->frame_tx,proc->subframe_tx,rel13->pdsch_payload_type,UE_id);
  
     dlsch0->rnti             = 0xFFFF;
     dlsch0->Kmimo            = 1;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index c5bea89c11..339d4102aa 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -211,7 +211,7 @@ schedule_SIB1_BR(module_id_t module_idP,
 		    bcch_sdu_length, TBS);
 
 	if ((frameP & 1023) < 200)
-	    LOG_I(MAC,
+	    LOG_D(MAC,
 		  "[eNB %d] Frame %d Subframe %d: SIB1_BR->DLSCH CC_id %d, Received %d bytes, scheduling on NB %d (i %d,m %d,N_S_NB %d)  rvidx %d\n",
 		  module_idP, frameP, subframeP, CC_id, bcch_sdu_length,
 		  n_NB, i, m, N_S_NB, rvidx);
@@ -409,7 +409,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
 	    vrb_map[first_rb+5] = 1;
 
 	    if ((frameP&1023) < 200) 
-	      LOG_I(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
+	      LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
 					   module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
 					   sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
 					   bcch_sdu_length);	    
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 9a99701897..c4a6a59e2b 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -105,8 +105,6 @@ rx_sdu(const module_id_t enb_mod_idP,
   int lcgid_updated[4] = {0, 0, 0, 0};
   UE_list_t *UE_list = &mac->UE_list;
   int crnti_rx = 0;
-  RA_t *ra =
-    (RA_t *) & RC.mac[enb_mod_idP]->common_channels[CC_idP].ra[0];
   int first_rb = 0;
   rrc_eNB_ue_context_t *ue_contextP = NULL;
   start_meas(&mac->rx_ulsch_sdu);
@@ -218,8 +216,11 @@ rx_sdu(const module_id_t enb_mod_idP,
       return;
     }
   } else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti
+
+    RA_t *ra = (RA_t *) & mac->common_channels[CC_idP].ra[RA_id];
+	  
 #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
-    if (UE_list->UE_template[CC_idP][UE_id].rach_resource_type > 0) harq_pid=0;
+    if (ra->rach_resource_type > 0) harq_pid=0;
 #endif
     AssertFatal(mac->common_channels[CC_idP].
                 radioResourceConfigCommon->rach_ConfigCommon.
@@ -230,7 +231,7 @@ rx_sdu(const module_id_t enb_mod_idP,
                 maxHARQ_Msg3Tx);
     LOG_D(MAC,
           "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n",
-          enb_mod_idP, harq_pid, CC_idP, ra[RA_id].msg3_round,
+          enb_mod_idP, harq_pid, CC_idP, ra->msg3_round,
           current_rnti, RA_id, ul_cqi);
     first_rb = ra->msg3_first_rb;
 
@@ -238,21 +239,21 @@ rx_sdu(const module_id_t enb_mod_idP,
       LOG_D(MAC,
             "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
             enb_mod_idP, CC_idP, RA_id,
-            ra[RA_id].msg3_round,
+            ra->msg3_round,
             (int) mac->common_channels[CC_idP].
             radioResourceConfigCommon->rach_ConfigCommon.
             maxHARQ_Msg3Tx);
 
-      if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
+      if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
         cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
       } else {
         first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid];
-        ra[RA_id].msg3_round++;
+        ra->msg3_round++;
         // prepare handling of retransmission
         get_Msg3allocret(&mac->common_channels[CC_idP],
-                         ra[RA_id].Msg3_subframe, ra[RA_id].Msg3_frame,
-                         &ra[RA_id].Msg3_frame, &ra[RA_id].Msg3_subframe);
-        add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP);
+                         ra->Msg3_subframe, ra->Msg3_frame,
+                         &ra->Msg3_frame, &ra->Msg3_subframe);
+        add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP);
       }
 
       /* TODO: program NACK for PHICH? */
@@ -337,7 +338,7 @@ rx_sdu(const module_id_t enb_mod_idP,
            * the UE state in the eNB is wrong.
            */
           for (ii = 0; ii < NB_RA_PROC_MAX; ii++) {
-            ra = &mac->common_channels[CC_idP].ra[ii];
+            RA_t *ra = &mac->common_channels[CC_idP].ra[ii];
 
             if ((ra->rnti == current_rnti) && (ra->state != IDLE)) {
               mac_rrc_data_ind(enb_mod_idP,
-- 
2.26.2