From 719762ccabef3157826292b802181516cfe622b1 Mon Sep 17 00:00:00 2001
From: oai <francois.taburet@nokia-bell-labs.com>
Date: Fri, 6 Jul 2018 15:30:02 +0200
Subject: [PATCH] fix basic_simulator compilation failure

---
 common/utils/T/T.h                      | 27 ++++++++++++++++++++++---
 openair1/SCHED/phy_procedures_lte_eNb.c | 10 +++++----
 openair2/NETWORK_DRIVER/UE_IP/device.c  |  4 ++--
 targets/RT/USER/lte-softmodem.h         | 15 --------------
 4 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/common/utils/T/T.h b/common/utils/T/T.h
index c44b9013cd..5e7f53e081 100644
--- a/common/utils/T/T.h
+++ b/common/utils/T/T.h
@@ -14,6 +14,7 @@
 /* T message IDs */
 #include "T_IDs.h"
 
+#define T_ACTIVE_STDOUT  2
 /* known type - this is where you add new types */
 
 #define T_INT(x) int, (x)
@@ -99,7 +100,7 @@ struct T_header;
         20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
 #define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
         n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
-#define T(...) TN(__VA_ARGS__)
+#define T(...) if(T_stdout == 0) {TN(__VA_ARGS__);}
 
 /* type used to send arbitrary buffer data */
 typedef struct {
@@ -564,10 +565,30 @@ extern T_cache_t *T_cache;
     } \
   } while (0)
 
-extern int *T_active;
 
-void T_init(int remote_port, int wait_for_tracer, int dont_fork);
+#define CONFIG_HLP_TPORT         "tracer port\n"
+#define CONFIG_HLP_NOTWAIT       "don't wait for tracer, start immediately\n"
+#define CONFIG_HLP_TNOFORK       "to ease debugging with gdb\n"
+#define CONFIG_HLP_STDOUT        "print log messges on console\n"
+
+#define TTRACER_CONFIG_PREFIX   "TTracer"
+/*------------------------------------------------------------------------------------------------------------------------------------------*/
+/*                                            configuration parameters for TTRACE utility                                                   */
+/*   optname                     helpstr                paramflags           XXXptr           defXXXval         type       numelt           */
+/*------------------------------------------------------------------------------------------------------------------------------------------*/
+#define CMDLINE_TTRACEPARAMS_DESC {  \
+{"T_port",                     CONFIG_HLP_TPORT,      0,		iptr:&T_port,	     defintval:2021,	TYPE_INT,   0},	   \
+{"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,	iptr:&T_nowait,      defintval:0,	TYPE_INT,   0},	   \
+{"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,	iptr:&T_dont_fork,   defintval:0,	TYPE_INT,   0},	   \
+{"T_stdout",                   CONFIG_HLP_STDOUT,     PARAMFLAG_BOOL,	iptr:&T_stdout,      defintval:1,	TYPE_INT,   0},	   \
+} 
+
 
+
+extern int *T_active;
+extern int T_stdout;         /* log on stdout */
+void T_init(int remote_port, int wait_for_tracer, int dont_fork);
+void T_Config_Init(void);
 #else /* T_TRACER */
 
 /* if T_TRACER is not defined or is 0, the T is deactivated */
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 7a347245e8..635d8c6b61 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -1769,12 +1769,13 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
       {
         int subframe_tx = (subframe+6)%10;
         int frame_tx = subframe_tx >= 6 ? (frame+1023)%1024 : frame;
-        if (ulsch_harq->o_ACK[i] != 1)
+        if (ulsch_harq->o_ACK[i] != 1) {
           T(T_ENB_PHY_DLSCH_UE_NACK, T_INT(0), T_INT(frame), T_INT(subframe),
             T_INT(rnti), T_INT(eNB->dlsch[UE_id][0]->harq_ids[frame_tx%2][subframe_tx]));
-        else
+        } else {
           T(T_ENB_PHY_DLSCH_UE_ACK, T_INT(0), T_INT(frame), T_INT(subframe),
             T_INT(rnti), T_INT(eNB->dlsch[UE_id][0]->harq_ids[frame_tx%2][subframe_tx]));
+        }
       }
 #endif
     }
@@ -1871,12 +1872,13 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
       {
         int subframe_tx = (subframe+6)%10;
         int frame_tx = subframe_tx >= 6 ? (frame+1023)%1024 : frame;
-        if (harq_ack[0] != 1)
+        if (harq_ack[0] != 1) {
           T(T_ENB_PHY_DLSCH_UE_NACK, T_INT(0), T_INT(frame), T_INT(subframe),
             T_INT(uci->rnti), T_INT(eNB->dlsch[UE_id][0]->harq_ids[frame_tx%2][subframe_tx]));
-        else
+        } else {
           T(T_ENB_PHY_DLSCH_UE_ACK, T_INT(0), T_INT(frame), T_INT(subframe),
             T_INT(uci->rnti), T_INT(eNB->dlsch[UE_id][0]->harq_ids[frame_tx%2][subframe_tx]));
+        }
       }
 #endif
     }
diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c
index 36c6afe914..b8b4428709 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/device.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/device.c
@@ -236,7 +236,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP)
 
     // End debug information
     netif_stop_queue(dev_pP);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
     netif_trans_update(dev_pP);
 #else
     dev_pP->trans_start = jiffies;
@@ -312,7 +312,7 @@ void ue_ip_tx_timeout(struct net_device *dev_pP)
   printk("[UE_IP_DRV][%s] begin\n", __FUNCTION__);
   //  (ue_ip_priv_t *)(dev_pP->priv_p)->stats.tx_errors++;
   (priv_p->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || RHEL_RELEASE_CODE >= 1796
+#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) || (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= 1796)
   netif_trans_update(dev_pP);
 #else
   dev_pP->trans_start = jiffies;
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 8aae82faf0..10e9d420ff 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -209,21 +209,6 @@
 #define CMDLINE_STARTTELN_IDX     3
 
 
-extern int T_port;
-extern int T_nowait;
-extern int T_dont_fork;
-
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
-/*                                            command line parameters for TTRACE utility                                                    */
-/*   optname                     helpstr                paramflags           XXXptr           defXXXval         type       numelt           */
-/*------------------------------------------------------------------------------------------------------------------------------------------*/
-#define CMDLINE_TTRACEPARAMS_DESC {  \
-{"T_port",                     CONFIG_HLP_TPORT,      0,		iptr:&T_port,	     defintval:0,	TYPE_INT,   0},	   \
-{"T_nowait",                   CONFIG_HLP_NOTWAIT,    PARAMFLAG_BOOL,	iptr:&T_nowait,      defintval:0,	TYPE_INT,   0},	   \
-{"T_dont_fork",                CONFIG_HLP_TNOFORK,    PARAMFLAG_BOOL,	iptr:&T_dont_fork,   defintval:1,	TYPE_INT,   0},	   \
-} 
-
-
 /***************************************************************************************************************************************/  
 /*  */
 extern pthread_cond_t sync_cond;
-- 
GitLab