From cf0e9175dddd4c57394122ba75c08d46a5703558 Mon Sep 17 00:00:00 2001
From: bruno mongazon <bruno.mongazon-cazavet@nokia-bell-labs.com>
Date: Mon, 15 Jan 2018 18:47:07 +0100
Subject: [PATCH] Fix #582, RTAI, RTAI_ENABLED, ENABLE_RTAI_CLOCK,
 RTAI_ISNT_POSIX, _RTAI_MATH_H, CELLULAR, TIMER_ONESHOT_MODE, EMOS,
 EMOS_CHANNEL, OAI_EMU, OPENAIR_EMU, PHY_ABSTRACTION, PHY_ABSTRACTION_UL
 removed

---
 cmake_targets/CMakeLists.txt                  |   32 +-
 cmake_targets/epc_test/CMakeLists.template    |    4 -
 .../oaisim_build_oai/CMakeLists.template      |    4 -
 .../oaisim_mme_build_oai/CMakeLists.template  |    4 -
 .../oaisim_noS1_build_oai/CMakeLists.template |    4 -
 .../s1c_mme_test/CMakeLists.template          |    4 -
 common/utils/itti/intertask_interface.c       |  233 +--
 common/utils/itti/intertask_interface.h       |    6 -
 common/utils/itti/intertask_interface_dump.c  |   85 -
 common/utils/itti/memory_pools.c              |   37 -
 openair1/Makefile                             |  121 --
 openair1/PHY/LTE_ESTIMATION/defs.h            |   18 -
 .../lte_dl_channel_estimation_emos.c          |  149 --
 openair1/PHY/LTE_ESTIMATION/lte_sync_time.c   |   27 -
 openair1/PHY/LTE_TRANSPORT/dci.c              |   30 -
 openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c   |  307 ----
 openair1/PHY/LTE_TRANSPORT/pbch.c             |   46 -
 openair1/PHY/LTE_TRANSPORT/proto.h            |    8 +-
 openair1/PHY/LTE_TRANSPORT/ulsch_coding.c     |   74 -
 openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c   |  452 -----
 .../PHY/LTE_TRANSPORT/ulsch_demodulation.c    |    1 -
 openair1/PHY/TOOLS/defs.h                     |   14 -
 openair1/PHY/impl_defs_lte.h                  |    2 +
 openair1/PHY/impl_defs_top.h                  |    4 -
 openair1/SCHED/defs.h                         |    7 +-
 openair1/SCHED/extern.h                       |    6 -
 openair1/SCHED/fapi_l1.c                      |    4 +
 openair1/SCHED/phy_mac_stub.c                 |  182 --
 openair1/SCHED/phy_procedures_emos.h          |  108 --
 openair1/SCHED/phy_procedures_lte_eNb.c       |    7 +-
 openair1/SCHED/phy_procedures_lte_ue.c        |   64 -
 openair1/SCHED/rt_compat.h                    |  138 --
 openair1/SCHED/ru_procedures.c                |    4 -
 openair1/SIMULATION/LTE_PHY/Makefile          |  202 ---
 openair1/SIMULATION/LTE_PHY/mbmssim.c         |    3 -
 openair1/SIMULATION/LTE_PHY/pbchsim.c         |    6 -
 openair1/SIMULATION/LTE_PHY/pdcchsim.c        |    3 -
 openair1/SIMULATION/LTE_PHY/prachsim.c        |    7 -
 openair1/SIMULATION/LTE_PHY/pucchsim.c        |    6 -
 openair1/SIMULATION/LTE_PHY/scansim.c         |    6 -
 openair1/SIMULATION/LTE_PHY/syncsim.c         |   45 -
 openair1/SIMULATION/LTE_PHY/ulsim2.c          |    9 -
 openair1/SIMULATION/TOOLS/taus.c              |    5 -
 openair2/COMMON/mac_rrc_primitives.h          |    8 -
 openair2/COMMON/openair_types.h               |   25 -
 openair2/COMMON/platform_types.h              |   26 +-
 openair2/COMMON/rtos_header.h                 |   18 +-
 openair2/ENB_APP/enb_app.c                    |   30 -
 openair2/ENB_APP/enb_config.c                 |    4 -
 openair2/LAYER2/Makefile.inc                  |    4 -
 openair2/LAYER2/PDCP_v10.1.0/pdcp.c           |   68 +-
 openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c      |  148 --
 openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c   |   22 -
 openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c    |    2 -
 openair2/LAYER2/RLC/rlc.c                     |   10 -
 openair2/LAYER2/RLC/rlc_mac.c                 |   44 -
 openair2/LAYER2/RLC/rlc_rrc.c                 |   24 -
 openair2/LAYER2/register.c                    |   41 -
 openair2/Makefile                             |  254 ---
 .../NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile     |   48 -
 .../DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c  |  859 ---------
 .../DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h  |   49 -
 openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile   |   79 -
 .../DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c   | 1152 ------------
 .../DRIVER/CELLULAR/NASMT/nasmt_classifier.c  |  884 ---------
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c  |  542 ------
 .../DRIVER/CELLULAR/NASMT/nasmt_constant.h    |  210 ---
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c  |  565 ------
 .../DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c   |  764 --------
 .../DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h   |  211 ---
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c |  233 ---
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h   |  122 --
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h     |   73 -
 .../NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c    |  494 -----
 .../DRIVER/CELLULAR/NASMT/nasmt_variables.h   |  173 --
 openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile   |   79 -
 .../DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c   | 1494 ---------------
 .../DRIVER/CELLULAR/NASRG/nasrg_classifier.c  | 1139 ------------
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c  |  628 -------
 .../DRIVER/CELLULAR/NASRG/nasrg_constant.h    |  220 ---
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c  |  549 ------
 .../DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c   |  906 ----------
 .../DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h   |  251 ---
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c |  246 ---
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h   |  135 --
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h     |   77 -
 .../NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c    |  478 -----
 .../DRIVER/CELLULAR/NASRG/nasrg_variables.h   |  214 ---
 .../NAS/DRIVER/CELLULAR/NETLTEST/Makefile     |   48 -
 .../NAS/DRIVER/CELLULAR/NETLTEST/netltest     |  Bin 12462 -> 0 bytes
 .../NAS/DRIVER/CELLULAR/NETLTEST/netltest.c   |  213 ---
 .../DRIVER/CELLULAR/NETLTEST/nettestPDCP.c    |  149 --
 openair2/NAS/DRIVER/CELLULAR/readme.txt       |  157 --
 .../NAS/DRIVER/CELLULAR/start_mt_cellular     |   13 -
 .../DRIVER/CELLULAR/start_rg_cellular_noradvd |   17 -
 .../DRIVER/CELLULAR/start_rg_cellular_radvd   |   17 -
 openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular |    5 -
 openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular |    2 -
 openair2/NAS/Makefile.inc                     |    6 -
 openair2/NAS/SIMU_CELLULAR/Makefile           |   62 -
 openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h   |   54 -
 openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c  |  646 -------
 .../NAS/SIMU_CELLULAR/rrm_fifo_standalone.c   |  378 ----
 openair2/NETWORK_DRIVER/LITE/Makefile         |   72 -
 openair2/NETWORK_DRIVER/LITE/device.c         |   24 -
 openair2/NETWORK_DRIVER/MESH/Makefile         |   70 -
 openair2/NETWORK_DRIVER/MESH/common.c         |    4 -
 openair2/NETWORK_DRIVER/MESH/device.c         |   25 +-
 openair2/NETWORK_DRIVER/UE_IP/Makefile        |   49 -
 openair2/NETWORK_DRIVER/UE_IP/device.c        |    7 -
 openair2/RRC/LITE/MESSAGES/Makefile           |   31 -
 openair2/RRC/LITE/MESSAGES/rtai_mem.c         |  146 --
 openair2/RRC/LITE/MESSAGES/rtai_mem.h         |   44 -
 openair2/RRC/LITE/mesh_top.c                  |   39 -
 openair2/RRC/LITE/rrc_UE.c                    |   27 -
 openair2/RRC/LITE/rrc_eNB.c                   |   17 -
 openair2/UTIL/LOG/log.c                       |   89 -
 openair2/UTIL/LOG/vcd_signal_dumper.c         |   13 -
 openair2/UTIL/MATH/taus.c                     |    9 -
 openair2/UTIL/OCG/makefile                    |    2 -
 openair2/UTIL/OMG/makefile                    |    2 -
 openair2/UTIL/OMG/makefile_old                |    2 -
 openair2/UTIL/OPT/probe.c                     |   10 -
 openair2/X2AP/x2ap.h                          |    3 -
 openair3/S1AP/s1ap_eNB.c                      |    3 -
 openair3/S1AP/s1ap_eNB.h                      |    6 +-
 targets/Makefile                              |   35 -
 targets/RT/Makefile                           |  124 --
 targets/RT/USER/Makefile                      |  447 -----
 targets/RT/USER/Makefile.agilent              |  243 ---
 targets/RT/USER/Makefile.msg_many             |   21 -
 targets/RT/USER/condtest.c                    |  173 --
 targets/RT/USER/emos-raw.c                    | 1603 -----------------
 targets/RT/USER/init_rtai.sh                  |    5 -
 targets/RT/USER/make_for_usrp.sh              |   36 -
 targets/RT/USER/msg_helper.c                  |   87 -
 targets/RT/USER/msg_many.c                    |  181 --
 targets/RT/USER/msg_many.h                    |   53 -
 targets/RT/USER/sleeptest.c                   |  302 ----
 targets/RT/USER/synctest.c                    | 1318 --------------
 targets/SIMU/USER/Makefile                    |   13 +-
 targets/SIMU/USER/channel_sim.c               |   43 -
 targets/SIMU/USER/oaisim_functions.c          |  160 --
 targets/SIMU/USER/sinr_sim.c                  |  117 --
 targets/TEST/AT_COMMANDS/Makefile             |    2 -
 targets/TEST/PACKET_TRACER/Makefile           |    8 +-
 targets/TEST/PDCP/Makefile                    |    2 -
 .../TEST/PDCP/with_rlc/Makefile.data_bearer   |    2 -
 targets/TEST/RLC_AM_V9.3.0/Makefile           |   12 +-
 targets/TEST/RLC_UM_V9.3.0/Makefile           |   12 +-
 150 files changed, 45 insertions(+), 23495 deletions(-)
 delete mode 100644 openair1/Makefile
 delete mode 100644 openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c
 delete mode 100644 openair1/SCHED/phy_procedures_emos.h
 delete mode 100644 openair1/SCHED/rt_compat.h
 delete mode 100644 openair1/SIMULATION/LTE_PHY/Makefile
 delete mode 100644 openair2/COMMON/openair_types.h
 delete mode 100644 openair2/LAYER2/register.c
 delete mode 100755 openair2/Makefile
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c
 delete mode 100644 openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/readme.txt
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/start_mt_cellular
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular
 delete mode 100755 openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular
 delete mode 100644 openair2/NAS/Makefile.inc
 delete mode 100755 openair2/NAS/SIMU_CELLULAR/Makefile
 delete mode 100644 openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h
 delete mode 100644 openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c
 delete mode 100644 openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c
 delete mode 100755 openair2/NETWORK_DRIVER/LITE/Makefile
 delete mode 100755 openair2/NETWORK_DRIVER/MESH/Makefile
 delete mode 100755 openair2/NETWORK_DRIVER/UE_IP/Makefile
 delete mode 100644 openair2/RRC/LITE/MESSAGES/Makefile
 delete mode 100644 openair2/RRC/LITE/MESSAGES/rtai_mem.c
 delete mode 100644 openair2/RRC/LITE/MESSAGES/rtai_mem.h
 delete mode 100644 openair2/RRC/LITE/mesh_top.c
 delete mode 100644 targets/Makefile
 delete mode 100644 targets/RT/Makefile
 delete mode 100644 targets/RT/USER/Makefile
 delete mode 100644 targets/RT/USER/Makefile.agilent
 delete mode 100644 targets/RT/USER/Makefile.msg_many
 delete mode 100644 targets/RT/USER/condtest.c
 delete mode 100644 targets/RT/USER/emos-raw.c
 delete mode 100755 targets/RT/USER/init_rtai.sh
 delete mode 100755 targets/RT/USER/make_for_usrp.sh
 delete mode 100644 targets/RT/USER/msg_helper.c
 delete mode 100644 targets/RT/USER/msg_many.c
 delete mode 100644 targets/RT/USER/msg_many.h
 delete mode 100644 targets/RT/USER/sleeptest.c
 delete mode 100644 targets/RT/USER/synctest.c

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index f788f95f3c..8737df7ea0 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -262,9 +262,6 @@ if (${ENABLE_ITTI})
   set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
 endif (${ENABLE_ITTI})
 
-add_boolean_option(RTAI False "Use RTAI")
-
-
 #############################
 # ASN.1 grammar C code generation & dependancies
 ################################
@@ -594,7 +591,7 @@ add_boolean_option(DISABLE_USE_NAS False "???")
 add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
 add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
 add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
-add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
+add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????")
 add_boolean_option(OAISIM False "specific to oaisim")
 add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
 
@@ -616,9 +613,6 @@ add_boolean_option(ENB_MODE True "Swap the include directories between openair2
 ##########################
 add_boolean_option(ENABLE_PGM_TRANSPORT    False "specific to oaisim, emulation through ethernet, reliable multicast")
 add_boolean_option(ADDR_CONF               False "specific to oaisim, IP autoconf of user-plane IP interface")
-add_boolean_option(OPENAIR_EMU             False "specific to oaisim")
-add_boolean_option(OAI_EMU                 False "specific to oaisim")
-add_boolean_option(PHY_ABSTRACTION         False "specific to oaisim")
 
 ##########################
 # SCHEDULING/REAL-TIME/PERF options
@@ -733,16 +727,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM       False  "Otherwise it is UM, confi
 add_boolean_option(SPECTRA False "???")
 add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS False "EXTENSIONS TO MIH 802.21 IN CONTEXT OF IST PROJECT CALLED MEDIEVAL")
 
-
-
-add_boolean_option(EMOS False "????")
-if(${EMOS})
-  add_definitions("-D_FILE_OFFSET_BITS=64")
-  set(EMOS_LIB gps)
-endif(${EMOS})
-
-
- # add the binary tree to the search path for include files
+# add the binary tree to the search path for include files
 #######################################################
 # We will find ConfigOAI.h after generation in target directory
 include_directories("${OPENAIR_BIN_DIR}")
@@ -770,7 +755,6 @@ else()
 endif()
 include_directories("${NFAPI_DIR}")
 include_directories("${OPENAIR1_DIR}")
-include_directories("${OPENAIR2_DIR}/NAS")
 include_directories("${OPENAIR2_DIR}")
 include_directories("${OPENAIR2_DIR}/LAYER2/RLC")
 include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
@@ -1776,7 +1760,6 @@ add_executable(lte-softmodem
   ${OPENAIR_DIR}/common/utils/utils.c
   ${OPENAIR_DIR}/common/utils/system.c
   ${GTPU_need_ITTI}
-  ${RTAI_SOURCE}
   ${XFORMS_SOURCE}
   ${XFORMS_SOURCE_SOFTMODEM}
   ${T_SOURCE}
@@ -1813,7 +1796,6 @@ add_executable(lte-softmodem-nos1
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
   ${OPENAIR_DIR}/common/utils/system.c
-  ${RTAI_SOURCE}
   ${XFORMS_SOURCE}
   ${XFORMS_SOURCE_SOFTMODEM}
   ${T_SOURCE}
@@ -2166,15 +2148,7 @@ endfunction(make_driver name dir src)
 # nashmesh module
 ################
 list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
-# Actually nasty stuff to be FIXED: the hereafter flag is for RTAI compilation in the driver,
-# but has different meaning in the other parts of the code
-# We should change the constant name to xxx_RTAI or likely
-if(NOT ${module_cc_opt} MATCHES "DRTAI")
-  set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK")
-else()
-  string(REPLACE "-DNAS_NETLINK" "" tmp "${module_cc_opt}")
-  set(module_cc_opt ${tmp})
-endif()
+set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK -DPDCP_USE_NETLINK")
 # legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
 # so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
 if (OAI_NW_DRIVER_USE_NETLINK)
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
index 15fec380e9..6209cc9f0e 100644
--- a/cmake_targets/epc_test/CMakeLists.template
+++ b/cmake_targets/epc_test/CMakeLists.template
@@ -6,7 +6,6 @@ set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
 set (  EMIT_ASN_DEBUG False )
 set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
@@ -45,7 +44,6 @@ set (  NB_ANTENNAS_TX "2" )
 set (  NB_ANTENNAS_TXRX "2" )
 set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU False )
 set (  OAISIM False )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
@@ -59,7 +57,6 @@ set (  PC_DSP True )
 set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
 set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
@@ -70,7 +67,6 @@ set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  TEST_OMG False )
diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template
index 80d2b60500..3d88fb39ae 100644
--- a/cmake_targets/oaisim_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_build_oai/CMakeLists.template
@@ -5,7 +5,6 @@ set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
 set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING True )
@@ -44,7 +43,6 @@ set (  NB_ANTENNAS_TX "2" )
 set (  NB_ANTENNAS_TXRX "2" )
 set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
@@ -58,7 +56,6 @@ set (  PC_DSP True )
 set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
 set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
@@ -69,7 +66,6 @@ set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  SPECTRA False )
diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
index 0a11b8a249..528e09556d 100644
--- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template
@@ -5,7 +5,6 @@ set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 False )
-set (  EMOS False )
 set (  ENABLE_FXP False )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING False )
@@ -45,7 +44,6 @@ set (  NB_ANTENNAS_TX "2" )
 set (  NB_ANTENNAS_TXRX "2" )
 set (  NEW_FFT False )
 set (  NO_RRM False )
-set (  OAI_EMU False )
 set (  OAISIM False )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK False )
@@ -59,7 +57,6 @@ set (  PC_DSP False )
 set (  PC_TARGET False )
 set (  PDCP_MSG_PRINT False )
 set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION False )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM False )
@@ -69,7 +66,6 @@ set (  RF_BOARD "False" )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  SPECTRA False )
diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
index 510744cd7b..09c389fbcc 100644
--- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
+++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template
@@ -4,7 +4,6 @@ set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
 set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING False )
@@ -45,7 +44,6 @@ set (  NB_ANTENNAS_TX "2" )
 set (  NB_ANTENNAS_TXRX "2" )
 set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
@@ -60,7 +58,6 @@ set (  PC_DSP True )
 set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
 set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
@@ -70,7 +67,6 @@ set (  RF_BOARD "False" )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  SPECTRA False )
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
index 2bbf7bc536..0d8ec5e67a 100644
--- a/cmake_targets/s1c_mme_test/CMakeLists.template
+++ b/cmake_targets/s1c_mme_test/CMakeLists.template
@@ -5,7 +5,6 @@ set (  ADDR_CONF False )
 set (  DEBUG_OMG False )
 set (  DISABLE_XER_PRINT False )
 set (  DRIVER2013 True )
-set (  EMOS False )
 set (  ENABLE_FXP True )
 set (  ENABLE_ITTI True )
 set (  ENABLE_NAS_UE_LOGGING True )
@@ -45,7 +44,6 @@ set (  NB_ANTENNAS_TX "2" )
 set (  NB_ANTENNAS_TXRX "2" )
 set (  NEW_FFT True )
 set (  NO_RRM True )
-set (  OAI_EMU True )
 set (  OAISIM True )
 set (  OAI_NW_DRIVER_TYPE_ETHERNET False )
 set (  OAI_NW_DRIVER_USE_NETLINK True )
@@ -59,7 +57,6 @@ set (  PC_DSP True )
 set (  PC_TARGET True )
 set (  PDCP_MSG_PRINT False )
 set (  PERFECT_CE False )
-set (  PHY_ABSTRACTION True )
 set (  PHY_CONTEXT False )
 set (  PHY_EMUL False )
 set (  PHYSIM True )
@@ -70,7 +67,6 @@ set (  RLC_STOP_ON_LOST_PDU False )
 set (  RRC_ASN1_VERSION "Rel10" )
 set (  RRC_DEFAULT_RAB_IS_AM True)
 set (  RRC_MSG_PRINT False )
-set (  RTAI False )
 set (  SECU False )
 set (  SMBV False )
 set (  SPECTRA False )
diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c
index 6c9a95732b..449fa434af 100644
--- a/common/utils/itti/intertask_interface.c
+++ b/common/utils/itti/intertask_interface.c
@@ -31,10 +31,6 @@
 #include <sys/epoll.h>
 #include <sys/eventfd.h>
 
-#ifdef RTAI
-# include <rtai_shm.h>
-#endif
-
 #if !defined(TRUE)
 #define TRUE 1
 #endif
@@ -45,11 +41,6 @@
 #include "intertask_interface.h"
 #include "intertask_interface_dump.h"
 
-#if defined(OAI_EMU) || defined(RTAI)
-# include "memory_pools.h"
-# include "vcd_signal_dumper.h"
-#endif
-
 #if T_TRACER
 #include "T.h"
 #endif
@@ -64,14 +55,6 @@
 #include "signals.h"
 #include "timer.h"
 
-#ifdef RTAI
-# include <rtai.h>
-# include <rtai_fifos.h>
-#    define FIFO_PRINTF_MAX_STRING_SIZE 1000
-#    define FIFO_PRINTF_NO              62
-#    define FIFO_PRINTF_SIZE            65536
-#endif
-
 /* ITTI DEBUG groups */
 #define ITTI_DEBUG_POLL             (1<<0)
 #define ITTI_DEBUG_SEND             (1<<1)
@@ -83,22 +66,12 @@
 
 const int itti_debug = (ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS);
 
-/* Don't flush if using RTAI */
-#ifdef RTAI
-# define ITTI_DEBUG(m, x, args...)  do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0);
-#else
 # define ITTI_DEBUG(m, x, args...)  do { if ((m) & itti_debug) {fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout);} } while(0);
-#endif
 #define ITTI_ERROR(x, args...)      do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0);
 
 /* Global message size */
 #define MESSAGE_SIZE(mESSAGEiD) (sizeof(MessageHeader) + itti_desc.messages_info[mESSAGEiD].size)
 
-#ifdef RTAI
-# define ITTI_MEM_PAGE_SIZE (1024)
-# define ITTI_MEM_SIZE      (16 * 1024 * 1024)
-#endif
-
 typedef enum task_state_s {
   TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX,
 } task_state_t;
@@ -137,13 +110,11 @@ typedef struct thread_desc_s {
 
   int epoll_nb_events;
 
-  //#ifdef RTAI
   /* Flag to mark real time thread */
   unsigned real_time;
 
-  /* Counter to indicate from RTAI threads that messages are pending for the thread */
+  /* Counter to indicate that messages are pending for the thread */
   unsigned messages_pending;
-  //#endif
 } thread_desc_t;
 
 typedef struct task_desc_s {
@@ -175,17 +146,6 @@ typedef struct itti_desc_s {
   volatile uint32_t created_tasks;
   volatile uint32_t ready_tasks;
   volatile int      wait_tasks;
-#ifdef RTAI
-  pthread_t rt_relay_thread;
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  memory_pools_handle_t memory_pools_handle;
-
-  uint64_t vcd_poll_msg;
-  uint64_t vcd_receive_msg;
-  uint64_t vcd_send_msg;
-#endif
 } itti_desc_t;
 
 static itti_desc_t itti_desc;
@@ -194,20 +154,8 @@ void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize
 {
   void *ptr = NULL;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  ptr = memory_pools_allocate (itti_desc.memory_pools_handle, size, origin_task_id, destination_task_id);
-
-  if (ptr == NULL) {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_ERROR (" Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-
-#else
   ptr = malloc (size);
   if (ptr) memset(ptr,0,size);
-#endif
 
   AssertFatal (ptr != NULL, "Memory allocation of %d bytes failed (%d -> %d)!\n", (int) size, origin_task_id, destination_task_id);
 
@@ -219,13 +167,7 @@ int itti_free(task_id_t task_id, void *ptr)
   int result = EXIT_SUCCESS;
   AssertFatal (ptr != NULL, "Trying to free a NULL pointer (%d)!\n", task_id);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  result = memory_pools_free (itti_desc.memory_pools_handle, ptr, task_id);
-
-  AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory at %p (%d)!\n", ptr, task_id);
-#else
   free (ptr);
-#endif
 
   return (result);
 }
@@ -281,27 +223,6 @@ static task_id_t itti_get_current_task_id(void)
   return TASK_UNKNOWN;
 }
 
-#ifdef RTAI
-static void rt_log_debug(char *format, ...)
-{
-  task_id_t   task_id;
-  va_list     args;
-  char        log_buffer[FIFO_PRINTF_MAX_STRING_SIZE];
-  int         len;
-
-  task_id = itti_get_current_task_id ();
-  len = snprintf(log_buffer, FIFO_PRINTF_MAX_STRING_SIZE-1, "[ITTI][D][%s]", itti_get_task_name(task_id));
-  va_start(args, format);
-  len += vsnprintf(&log_buffer[len], FIFO_PRINTF_MAX_STRING_SIZE-1-len, format, args);
-  va_end (args);
-
-  if (task_id != TASK_UNKNOWN)
-    fwrite(log_buffer, len, 1, stdout);
-  else
-    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-}
-#endif
-
 void itti_update_lte_time(uint32_t frame, uint8_t slot)
 {
   itti_desc.lte_time.frame = frame;
@@ -358,10 +279,6 @@ MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds m
 
   AssertFatal (message_id < itti_desc.messages_id_max, "Message id (%d) is out of range (%d)!\n", message_id, itti_desc.messages_id_max);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG, size);
-#endif
-
   if (origin_task_id == TASK_UNKNOWN) {
     /* Try to identify real origin task ID */
     origin_task_id = itti_get_current_task_id();
@@ -373,10 +290,6 @@ MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds m
   temp->ittiMsgHeader.originTaskId = origin_task_id;
   temp->ittiMsgHeader.ittiMsgSize = size;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG, 0);
-#endif
-
   return temp;
 }
 
@@ -394,11 +307,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
   message_number_t message_number;
   uint32_t message_id;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_send_msg, 1L << destination_task_id));
-#endif
-
   AssertFatal (message != NULL, "Message is NULL!\n");
   AssertFatal (destination_task_id < itti_desc.task_max, "Destination task id (%d) is out of range (%d)\n", destination_task_id, itti_desc.task_max);
 
@@ -421,11 +329,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
                            sizeof(MessageHeader) + message->ittiMsgHeader.ittiMsgSize);
 
   if (destination_task_id != TASK_UNKNOWN) {
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
-
-    memory_pools_set_info (itti_desc.memory_pools_handle, message, 1, destination_task_id);
-#endif
 
     if (itti_desc.threads[destination_thread_id].task_state == TASK_STATE_ENDED) {
       ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Message %s, number %lu with priority %d can not be sent from %s to queue (%u:%s), ended destination task!\n",
@@ -458,17 +361,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
         AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n");
       }
 
-#if defined(OAI_EMU) || defined(RTAI)
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
-#endif
-
-#ifdef RTAI
-
-      if (itti_desc.threads[TASK_GET_THREAD_ID(origin_task_id)].real_time) {
-        /* This is a RT task, increase destination task messages pending counter */
-        __sync_fetch_and_add (&itti_desc.threads[destination_thread_id].messages_pending, 1);
-      } else
-#endif
       {
         /* Only use event fd for tasks, subtasks will pool the queue */
         if (TASK_GET_PARENT_TASK_ID(destination_task_id) == TASK_UNKNOWN) {
@@ -496,11 +388,6 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
     AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_send_msg, ~(1L << destination_task_id)));
-#endif
-
   return 0;
 }
 
@@ -645,17 +532,9 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
 
 void itti_receive_msg(task_id_t task_id, MessageDef **received_msg)
 {
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
-#endif
 
   itti_receive_msg_internal_event_fd(task_id, 0, received_msg);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_receive_msg, 1L << task_id));
-#endif
 }
 
 void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
@@ -664,11 +543,6 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
 
   *received_msg = NULL;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
-                                          __sync_or_and_fetch (&itti_desc.vcd_poll_msg, 1L << task_id));
-#endif
-
   {
     struct message_list_s *message;
 
@@ -685,10 +559,6 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg)
     ITTI_DEBUG(ITTI_DEBUG_POLL, " No message in queue[(%u:%s)]\n", task_id, itti_get_task_name(task_id));
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
-                                          __sync_and_and_fetch (&itti_desc.vcd_poll_msg, ~(1L << task_id)));
-#endif
 }
 
 int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p)
@@ -720,7 +590,6 @@ int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *ar
   return 0;
 }
 
-//#ifdef RTAI
 void itti_set_task_real_time(task_id_t task_id)
 {
   thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
@@ -729,7 +598,6 @@ void itti_set_task_real_time(task_id_t task_id)
 
   itti_desc.threads[thread_id].real_time = TRUE;
 }
-//#endif
 
 void itti_wait_ready(int wait_tasks)
 {
@@ -757,15 +625,6 @@ void itti_mark_task_ready(task_id_t task_id)
   /* Mark the thread as using LFDS queue */
   lfds611_queue_use(itti_desc.tasks[task_id].message_queue);
 
-#ifdef RTAI
-  /* Assign low priority to created threads */
-  {
-    struct sched_param sched_param;
-    sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
-    sched_setscheduler(0, SCHED_FIFO, &sched_param);
-  }
-#endif
-
   itti_desc.threads[thread_id].task_state = TASK_STATE_READY;
   itti_desc.ready_tasks ++;
 
@@ -778,15 +637,6 @@ void itti_mark_task_ready(task_id_t task_id)
 
 void itti_exit_task(void)
 {
-#if defined(OAI_EMU) || defined(RTAI)
-  task_id_t task_id = itti_get_current_task_id();
-
-  if (task_id > TASK_UNKNOWN) {
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
-                                            __sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
-  }
-
-#endif
   pthread_exit (NULL);
 }
 
@@ -802,45 +652,6 @@ void itti_terminate_tasks(task_id_t task_id)
   pthread_exit (NULL);
 }
 
-#ifdef RTAI
-static void *itti_rt_relay_thread(void *arg)
-{
-  thread_id_t thread_id;
-  unsigned pending_messages;
-
-  while (itti_desc.running) {
-    usleep (200); // Poll for messages a little more than 2 time by slot to get a small latency between RT and other tasks
-
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD, VCD_FUNCTION_IN);
-#endif
-
-    /* Checks for all non real time tasks if they have pending messages */
-    for (thread_id = THREAD_FIRST; thread_id < itti_desc.thread_max; thread_id++) {
-      if ((itti_desc.threads[thread_id].task_state == TASK_STATE_READY)
-          && (itti_desc.threads[thread_id].real_time == FALSE)) {
-        pending_messages = __sync_fetch_and_and (&itti_desc.threads[thread_id].messages_pending, 0);
-
-        if (pending_messages > 0) {
-          ssize_t write_ret;
-          eventfd_t sem_counter = pending_messages;
-
-          /* Call to write for an event fd must be of 8 bytes */
-          write_ret = write (itti_desc.threads[thread_id].task_event_fd, &sem_counter, sizeof(sem_counter));
-          DevCheck(write_ret == sizeof(sem_counter), write_ret, sem_counter, thread_id);
-        }
-      }
-    }
-
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_RELAY_THREAD, VCD_FUNCTION_OUT);
-#endif
-  }
-
-  return NULL;
-}
-#endif
-
 int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
               const message_info_t *messages_info, const char * const messages_definition_xml, const char * const dump_file_name)
 {
@@ -921,45 +732,12 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i
     ITTI_DEBUG(ITTI_DEBUG_EVEN_FD, " Successfully subscribed fd %d for thread %d\n",
                itti_desc.threads[thread_id].task_event_fd, thread_id);
 
-#ifdef RTAI
-    itti_desc.threads[thread_id].real_time = FALSE;
-    itti_desc.threads[thread_id].messages_pending = 0;
-#endif
   }
 
   itti_desc.running = 1;
   itti_desc.wait_tasks = 0;
   itti_desc.created_tasks = 0;
   itti_desc.ready_tasks = 0;
-#ifdef RTAI
-  /* Start RT relay thread */
-  DevAssert(pthread_create (&itti_desc.rt_relay_thread, NULL, itti_rt_relay_thread, NULL) >= 0);
-
-  rt_global_heap_open();
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  itti_desc.memory_pools_handle = memory_pools_create (5);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 1000 + ITTI_QUEUE_MAX_ELEMENTS,       50);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 1000 + (2 * ITTI_QUEUE_MAX_ELEMENTS), 100);
-  memory_pools_add_pool (itti_desc.memory_pools_handle, 10000,                                1000);
-  memory_pools_add_pool (itti_desc.memory_pools_handle,  400,                                 20050);
-  memory_pools_add_pool (itti_desc.memory_pools_handle,  100,                                 30050);
-
-  {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_DEBUG(ITTI_DEBUG_MP_STATISTICS, " Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-  itti_desc.vcd_poll_msg = 0;
-  itti_desc.vcd_receive_msg = 0;
-  itti_desc.vcd_send_msg = 0;
-#endif
-
   itti_dump_init (messages_definition_xml, dump_file_name);
 
   CHECK_INIT_RETURN(timer_init ());
@@ -1022,15 +800,6 @@ void itti_wait_tasks_end(void)
 
   itti_desc.running = 0;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  {
-    char *statistics = memory_pools_statistics (itti_desc.memory_pools_handle);
-
-    ITTI_DEBUG(ITTI_DEBUG_MP_STATISTICS, " Memory pools statistics:\n%s", statistics);
-    free (statistics);
-  }
-#endif
-
   if (ready_tasks > 0) {
     ITTI_DEBUG(ITTI_DEBUG_ISSUES, " Some threads are still running, force exit\n");
     exit (0);
diff --git a/common/utils/itti/intertask_interface.h b/common/utils/itti/intertask_interface.h
index 191d9199c3..606c851d1d 100644
--- a/common/utils/itti/intertask_interface.h
+++ b/common/utils/itti/intertask_interface.h
@@ -27,10 +27,6 @@
 
 #include <sys/epoll.h>
 
-#ifdef RTAI
-# include <rtai_sem.h>
-#endif
-
 #ifndef INTERTASK_INTERFACE_H_
 #define INTERTASK_INTERFACE_H_
 
@@ -155,12 +151,10 @@ int itti_create_task(task_id_t task_id,
                      void *(*start_routine) (void *),
                      void *args_p);
 
-//#ifdef RTAI
 /** \brief Mark the task as a real time task
  * \param task_id task to mark as real time
  **/
 void itti_set_task_real_time(task_id_t task_id);
-//#endif
 
 /** \brief Indicates to ITTI if newly created tasks should wait for all tasks to be ready
  * \param wait_tasks non 0 to make new created tasks to wait, 0 to let created tasks to run
diff --git a/common/utils/itti/intertask_interface_dump.c b/common/utils/itti/intertask_interface_dump.c
index a06b97c63b..bb77509726 100644
--- a/common/utils/itti/intertask_interface_dump.c
+++ b/common/utils/itti/intertask_interface_dump.c
@@ -51,23 +51,14 @@
 #include "intertask_interface.h"
 #include "intertask_interface_dump.h"
 
-#if defined(OAI_EMU) || defined(RTAI)
-#include "vcd_signal_dumper.h"
-#endif
-
 #if T_TRACER
 #include "T.h"
 #endif
 
 static const int itti_dump_debug = 0; // 0x8 | 0x4 | 0x2;
 
-#ifdef RTAI
-# define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) rt_printk("[ITTI_DUMP][D]"x, ##args); } \
-    while(0)
-#else
 # define ITTI_DUMP_DEBUG(m, x, args...) do { if ((m) & itti_dump_debug) fprintf(stdout, "[ITTI_DUMP][D]"x, ##args); } \
     while(0)
-#endif
 #define ITTI_DUMP_ERROR(x, args...) do { fprintf(stdout, "[ITTI_DUMP][E]"x, ##args); } \
     while(0)
 
@@ -99,13 +90,8 @@ typedef struct itti_desc_s {
 
   int nb_connected;
 
-#ifndef RTAI
   /* Event fd used to notify new messages (semaphore) */
   int event_fd;
-#else
-  unsigned long messages_in_queue __attribute__((aligned(8)));
-#endif
-
   int itti_listen_socket;
 
   itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON];
@@ -194,9 +180,7 @@ static int itti_dump_fwrite_message(itti_dump_queue_item_t *message)
     fwrite (&new_message_header, sizeof(itti_dump_message_t), 1, dump_file);
     fwrite (message->data, message->data_size, 1, dump_file);
     fwrite (&itti_dump_message_type_end, sizeof(itti_message_types_t), 1, dump_file);
-    // #if !defined(RTAI)
     fflush (dump_file);
-    // #endif
     return (1);
   }
 
@@ -280,10 +264,6 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
   int overwrite_flag;
   AssertFatal (new != NULL, "Message to queue is NULL!\n");
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_IN);
-#endif
-
   new->message_type = message_type;
   new->message_size = message_size;
 
@@ -303,9 +283,6 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
   lfds611_ringbuffer_put_write_element(itti_dump_queue.itti_message_queue, new_queue_element);
 
   if (overwrite_flag == 0) {
-#ifdef RTAI
-    __sync_fetch_and_add (&itti_dump_queue.messages_in_queue, 1);
-#else
     {
       ssize_t   write_ret;
       eventfd_t sem_counter = 1;
@@ -314,25 +291,18 @@ static int itti_dump_enqueue_message(itti_dump_queue_item_t *new, uint32_t messa
       write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
       AssertFatal (write_ret == sizeof(sem_counter), "Write to dump event failed (%d/%d)!\n", (int) write_ret, (int) sizeof(sem_counter));
     }
-#endif
     // add one to pending_messages, atomically
     __sync_fetch_and_add (&pending_messages, 1);
   }
 
   ITTI_DUMP_DEBUG (0x2, " Added element to queue %p %p, pending %u, type %u\n", new_queue_element, new, pending_messages, message_type);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE, VCD_FUNCTION_OUT);
-#endif
-
   return 0;
 }
 
 static void itti_dump_socket_exit(void)
 {
-#ifndef RTAI
   close(itti_dump_queue.event_fd);
-#endif
   close(itti_dump_queue.itti_listen_socket);
 
   /* Leave the thread as we detected end signal */
@@ -346,10 +316,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
   int     j;
   int     consumer;
 
-#ifdef RTAI
-  unsigned long number_of_messages;
-#endif
-
   /* Check if there is a least one consumer */
   consumer = 0;
 
@@ -365,18 +331,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
   }
 
   if (consumer > 0) {
-#ifdef RTAI
-    number_of_messages = itti_dump_queue.messages_in_queue;
-
-    ITTI_DUMP_DEBUG(0x4, "%lu elements in queue\n", number_of_messages);
-
-    if (number_of_messages == 0) {
-      return (consumer);
-    }
-
-    __sync_sub_and_fetch(&itti_dump_queue.messages_in_queue, number_of_messages);
-#endif
-
     do {
       /* Acquire the ring element */
       lfds611_ringbuffer_get_read_element(itti_dump_queue.itti_message_queue, &element);
@@ -419,9 +373,6 @@ static int itti_dump_flush_ring_buffer(int flush_all)
         lfds611_ringbuffer_put_read_element(itti_dump_queue.itti_message_queue, element);
       }
     } while(flush_all
-#ifdef RTAI
-            && --number_of_messages
-#endif
            );
   }
 
@@ -478,9 +429,6 @@ static void *itti_dump_socket(void *arg_p)
   struct sockaddr_in servaddr; /* socket address structure */
 
   struct timeval *timeout_p = NULL;
-#ifdef RTAI
-  struct timeval  timeout;
-#endif
 
   ITTI_DUMP_DEBUG(0x2, " Creating TCP dump socket on port %u\n", ITTI_PORT);
 
@@ -536,15 +484,11 @@ static void *itti_dump_socket(void *arg_p)
   /* Add the listener */
   FD_SET(itti_listen_socket, &read_set);
 
-#ifndef RTAI
   /* Add the event fd */
   FD_SET(itti_dump_queue.event_fd, &read_set);
 
   /* Max of both sd */
   max_sd = itti_listen_socket > itti_dump_queue.event_fd ? itti_listen_socket : itti_dump_queue.event_fd;
-#else
-  max_sd = itti_listen_socket;
-#endif
 
   itti_dump_queue.itti_listen_socket = itti_listen_socket;
 
@@ -557,14 +501,7 @@ static void *itti_dump_socket(void *arg_p)
     int i;
 
     memcpy(&working_set, &read_set, sizeof(read_set));
-#ifdef RTAI
-    timeout.tv_sec  = 0;
-    timeout.tv_usec = 100000;
-
-    timeout_p = &timeout;
-#else
     timeout_p = NULL;
-#endif
 
     /* No timeout: select blocks till a new event has to be handled
      * on sd's.
@@ -592,8 +529,6 @@ static void *itti_dump_socket(void *arg_p)
       if (FD_ISSET(i, &working_set)) {
         desc_ready -= 1;
 
-#ifndef RTAI
-
         if (i == itti_dump_queue.event_fd) {
           /* Notification of new element to dump from other tasks */
           eventfd_t sem_counter;
@@ -613,7 +548,6 @@ static void *itti_dump_socket(void *arg_p)
             if (itti_dump_running) {
               ITTI_DUMP_DEBUG (0x4, " No messages consumers, waiting ...\n");
               usleep(100 * 1000);
-#ifndef RTAI
               {
                 ssize_t   write_ret;
 
@@ -622,7 +556,6 @@ static void *itti_dump_socket(void *arg_p)
                 write_ret = write(itti_dump_queue.event_fd, &sem_counter, sizeof(sem_counter));
                 AssertFatal (write_ret == sizeof(sem_counter), "Failed to write to dump event FD (%d/%d)!\n", (int) write_ret, (int) sem_counter);
               }
-#endif
             } else {
               itti_dump_socket_exit();
             }
@@ -630,7 +563,6 @@ static void *itti_dump_socket(void *arg_p)
             ITTI_DUMP_DEBUG(0x1, " Write element to file\n");
           }
         } else
-#endif
           if (i == itti_listen_socket) {
             do {
               client_socket = accept(itti_listen_socket, NULL, NULL);
@@ -719,21 +651,9 @@ int itti_dump_queue_message(task_id_t sender_task,
     AssertFatal (message_name != NULL, "Message name is NULL!\n");
     AssertFatal (message_p != NULL, "Message is NULL!\n");
 
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
-#endif
     new = itti_malloc(sender_task, TASK_MAX, sizeof(itti_dump_queue_item_t));
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
-#endif
 
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_IN);
-#endif
     new->data = itti_malloc(sender_task, TASK_MAX, message_size);
-#if defined(OAI_EMU) || defined(RTAI)
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE_MALLOC, VCD_FUNCTION_OUT);
-#endif
 
     memcpy(new->data, message_p, message_size);
     new->data_size       = message_size;
@@ -791,9 +711,6 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
     AssertFatal (0, " Failed to create ring buffer!\n");
   }
 
-#ifdef RTAI
-  itti_dump_queue.messages_in_queue = 0;
-#else
   itti_dump_queue.event_fd = eventfd(0, EFD_SEMAPHORE);
 
   if (itti_dump_queue.event_fd == -1) {
@@ -801,8 +718,6 @@ int itti_dump_init(const char * const messages_definition_xml, const char * cons
     AssertFatal (0, "eventfd failed: %s!\n", strerror(errno));
   }
 
-#endif
-
   itti_dump_queue.nb_connected = 0;
 
   for(i = 0; i < ITTI_DUMP_MAX_CON; i++) {
diff --git a/common/utils/itti/memory_pools.c b/common/utils/itti/memory_pools.c
index 23c53b71ae..78b6923dc8 100644
--- a/common/utils/itti/memory_pools.c
+++ b/common/utils/itti/memory_pools.c
@@ -19,15 +19,8 @@
  *      contact@openairinterface.org
  */
 
-#ifdef RTAI
-# include <rtai_shm.h>
-#endif
-
 #include "assertions.h"
 #include "memory_pools.h"
-#if defined(OAI_EMU) || defined(RTAI)
-# include "vcd_signal_dumper.h"
-#endif
 
 #if T_TRACER
 #include <string.h>
@@ -37,18 +30,8 @@
 /*------------------------------------------------------------------------------*/
 const static int mp_debug = 0;
 
-#ifdef RTAI
-# define MP_DEBUG(x, args...) do { if (mp_debug) rt_printk("[MP][D]"x, ##args); } \
-    while(0)
-#else
 # define MP_DEBUG(x, args...) do { if (mp_debug) fprintf(stdout, "[MP][D]"x, ##args); fflush (stdout); } \
     while(0)
-#endif
-
-#if defined(OAI_EMU) || defined(RTAI)
-uint64_t vcd_mp_alloc;
-uint64_t vcd_mp_free;
-#endif
 
 /*------------------------------------------------------------------------------*/
 #ifndef CHARS_TO_UINT32
@@ -414,11 +397,6 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
   pool_id_t                   pool;
   items_group_index_t         item_index = ITEMS_GROUP_INDEX_INVALID;
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
-                                          __sync_or_and_fetch (&vcd_mp_alloc, 1L << info_0));
-#endif
-
   /* Recover memory_pools */
   memory_pools = memory_pools_from_handler (memory_pools_handle);
   AssertError (memory_pools != NULL, {}, "Failed to retrieve memory pool for handle %p!\n", memory_pools_handle);
@@ -464,11 +442,6 @@ memory_pool_item_handle_t memory_pools_allocate (memory_pools_handle_t memory_po
     MP_DEBUG(" Alloc [--][------]{------}, %3u %3u, %6u, failed!\n", info_0, info_1, item_size);
   }
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
-                                          __sync_and_and_fetch (&vcd_mp_alloc, ~(1L << info_0)));
-#endif
-
   return memory_pool_item_handle;
 }
 
@@ -493,11 +466,6 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
 
   info_1 = memory_pool_item->start.info[1];
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
-                                          __sync_or_and_fetch (&vcd_mp_free, 1L << info_1));
-#endif
-
   /* Recover pool index */
   pool = memory_pool_item->start.pool_id;
   AssertFatal (pool < memory_pools->pools_defined, "Pool index is invalid (%u/%u)!\n", pool, memory_pools->pools_defined);
@@ -531,11 +499,6 @@ int memory_pools_free (memory_pools_handle_t memory_pools_handle, memory_pool_it
 
   AssertError (result == EXIT_SUCCESS, {}, "Failed to free memory pool item (pool %u, item %d)!\n", pool, item_index);
 
-#if defined(OAI_EMU) || defined(RTAI)
-  VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
-                                          __sync_and_and_fetch (&vcd_mp_free, ~(1L << info_1)));
-#endif
-
   return (result);
 }
 
diff --git a/openair1/Makefile b/openair1/Makefile
deleted file mode 100644
index 04be9ff8b0..0000000000
--- a/openair1/Makefile
+++ /dev/null
@@ -1,121 +0,0 @@
-# command line flags are automatically exported and thus passed down to any sub-make. 
-# here we set the default flags in case on command line flags are provided
-# these flags have to be explicitely exported so that the sub-make is aware of them
-
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-ifndef OPENAIR_LTE
-export OPENAIR_LTE=1
-endif
-
-ifndef OPENAIR1
-export OPENAIR1=1
-endif
-
-ifndef OPENAIR2
-export OPENAIR2=0
-endif
-
-ifndef EMOS
-export EMOS=0
-endif
-
-ifndef FIRMWARE2010
-export FIRMWARE2010=0
-endif
-
-all: openair_rf_cbmimo1_softmodem.ko asn1_msg_kern.ko
-
-openair_rf_cbmimo1_softmodem.ko:  
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-oai_user_cbmimo1.ko:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 BIT8_TX=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-oai_user_exmimo.ko:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko openair_rf_softmodem.ko)
-
-asn1_msg_kern.ko:
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) -C $(KERNEL_DIR) V=0 M=`pwd` RTAI=1 -j2)
-
-#Remove all but source files
-cleanall: 
-	find -name '*.o' -delete -print; \
-	find -name '*.ko' -delete -print; \
-	find -name '*.bak' -delete -print; \
-	find -name '*.cmd' -delete -print; \
-	find -name '*~' -delete -print; \
-	find -name octave-core -delete -print; \
-
-#Remove files created by SVN, dangerous!!! DO NOT RUN ON YOUR WORKING REPOSITORY!
-#FK: Don't do this! Use svn export instead.
-#cleansvn:
-#	rm -rf `find -name *.svn* -print`; \
-#	find -name *.svn* -delete -print
-
-tgz:
-	mkdir /tmp/openair1_tmp; \
-	$(MAKE) cleanall; \
-	cp -r . /tmp/openair1_tmp; \
-	(cd /tmp/openair1_tmp && $(MAKE) cleansvn && cd .. && tar czfv openair1.tgz openair1_tmp) ; \
-	cp /tmp/openair1.tgz . ;\
-	rm -rf /tmp/openair1_tmp
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-openair0:
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-install_oai_user:
-	make fifos
-	insmod ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko
-
-updatefw:
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr_exmimo2/main -s 0x43fffff0 
-
-boot_exmimo:
-	sudo make install_oai_user
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-reboot_exmimo:
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 -b
-	rmmod openair_rf
-	make install_oai_user
-	USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	rmmod openair_rf
-	make install_oai_user
-
-install_softmodem:
-	make fifos
-ifeq ($(OPENAIR2),1)
-	insmod ../openair2/RRC/LITE/MESSAGES/asn1_msg_kern.ko
-endif
-	insmod ARCH/CBMIMO1/DEVICE_DRIVER/openair_rf_softmodem.ko ; \
-
-remove:
-	rmmod openair_rf
-ifeq ($(OPENAIR2),1)
-	rmmod asn1_msg_kern
-endif
-
-test:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) test RTAI=1 CBMIMO1=1)	
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) test)
-
-clean: clean_l1 
-
-clean_l1:
-	(cd ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) clean RTAI=1 CBMIMO1=1)
-
-clean_asn1:
-	(cd ../openair2/RRC/LITE/MESSAGES && $(MAKE) clean)
diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h
index aae97ecd9e..a7b5d14701 100644
--- a/openair1/PHY/LTE_ESTIMATION/defs.h
+++ b/openair1/PHY/LTE_ESTIMATION/defs.h
@@ -23,12 +23,6 @@
 #define __LTE_ESTIMATION_DEFS__H__
 
 #include "PHY/defs.h"
-/*
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
- */
-
 /** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
  * @{
  */
@@ -136,18 +130,6 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *phy_vars_ue,
                                     int subframe,
                                     unsigned char l);
 
-/*
-#ifdef EMOS
-int lte_dl_channel_estimation_emos(int dl_ch_estimates_emos[NB_ANTENNAS_RX*NB_ANTENNAS_TX][N_RB_DL_EMOS*N_PILOTS_PER_RB*N_SLOTS_EMOS],
-           int **rxdataF,
-           LTE_DL_FRAME_PARMS *frame_parms,
-           unsigned char Ns,
-           unsigned char p,
-           unsigned char l,
-           unsigned char sector);
-#endif
- */
-
 /*!
 \brief Frequency offset estimation for LTE
 We estimate the frequency offset by calculating the phase difference between channel estimates for symbols carrying pilots (l==0 or l==3/4). We take a moving average of the phase difference.
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c
deleted file mode 100644
index 4f1015a0e1..0000000000
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <string.h>
-#include "defs.h"
-#include "PHY/defs.h"
-#include "SCHED/phy_procedures_emos.h"
-
-// TODO: make channel estimation possible for multiple sectors (Gold sequences for pilots)
-
-//#define DEBUG_CH
-int lte_dl_channel_estimation_emos(int dl_ch_estimates_emos[NB_ANTENNAS_RX*NB_ANTENNAS_TX][N_RB_DL_EMOS*N_PILOTS_PER_RB*N_SLOTS_EMOS],
-                                   int **rxdataF,
-                                   LTE_DL_FRAME_PARMS *frame_parms,
-                                   unsigned char Ns,
-                                   unsigned char p,
-                                   unsigned char l,
-                                   unsigned char sector)
-{
-
-  int pilot[2][200] __attribute__((aligned(16)));
-  unsigned char nu,aarx;
-  unsigned short k;
-  unsigned int rb,pilot_cnt;
-  short ch[2],*pil,*rxF,*dl_ch,*dl_ch_prev; //*f,*f2,*fl,*f2l2,*fr,*f2r2;
-  int ch_offset,symbol_offset;
-  unsigned int n;
-  int i;
-
-  unsigned char symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
-
-  if ((p==0) && (l==0) )
-    nu = 0;
-  else if ((p==0) && (l>0))
-    nu = 3;
-  else if ((p==1) && (l==0))
-    nu = 3;
-  else if ((p==1) && (l>0))
-    nu = 0;
-  else {
-    msg("lte_dl_channel_estimation_emos: p %d, l %d -> ERROR\n",p,l);
-    return(-1);
-  }
-
-  if (sector > 2) {
-    msg("lte_dl_channel_estimation_emos: sector must be 0,1, or 2\n");
-    return(-1);
-  }
-
-  switch (Ns) {
-  case 0:
-    ch_offset = ((l==0)?0:1)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 1:
-    ch_offset = ((l==0)?2:3)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 12:
-    ch_offset = ((l==0)?4:5)*2*frame_parms->N_RB_DL;
-    break;
-
-  case 13:
-    ch_offset = ((l==0)?6:7)*2*frame_parms->N_RB_DL;
-    break;
-
-  default:
-    msg("lte_dl_channel_estimation_emos: Ns must be  0, 1, 12, or 13\n");
-    return(-1);
-    break;
-
-  }
-
-  symbol_offset = symbol*frame_parms->ofdm_symbol_size; // offset within rxdataF
-
-  k = nu + sector;
-
-  if (k > 6)
-    k -=6;
-
-#ifdef DEBUG_CH
-  printf("Channel Estimation : ch_offset %d, OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d, symbol=%d\n",ch_offset,frame_parms->ofdm_symbol_size,frame_parms->Ncp,l,Ns,k,symbol);
-#endif
-
-  // generate pilot
-  lte_dl_cell_spec_rx(&pilot[p][0],
-                      frame_parms,
-                      Ns,
-                      (l==0)?0:1,
-                      p);
-
-
-  for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
-
-    pil   = (short *)&pilot[p][0];
-    rxF   = (short *)&rxdataF[aarx][((symbol_offset+k+frame_parms->first_carrier_offset)<<1)];
-    dl_ch = (short *)&dl_ch_estimates_emos[(p<<1)+aarx][ch_offset];
-    memset(dl_ch,0,frame_parms->N_RB_DL);
-
-    for (pilot_cnt=0; pilot_cnt<frame_parms->N_RB_DL; pilot_cnt++) {
-
-      dl_ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
-      dl_ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
-
-      pil+=2;    // Re Im
-      rxF+=24;   // remember replicated format (Re0 Im0 Re0 Im0) !!!
-      dl_ch+=2;
-
-    }
-
-    // printf("Second half\n");
-    // Second half of RBs
-    rxF   = (short *)&rxdataF[aarx][((symbol_offset+1+k)<<1)];
-
-    for (pilot_cnt=0; pilot_cnt<frame_parms->N_RB_DL; pilot_cnt++) {
-
-
-      dl_ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15);
-      dl_ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15);
-
-      pil+=2;
-      rxF+=24;
-      dl_ch+=2;
-
-    }
-
-  }
-
-  return(0);
-}
-
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index c7625ba083..2525f19b0d 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -578,30 +578,3 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
 
 }
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#include "SIMULATION/RF/defs.h"
-//extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
-
-int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNB,
-                           uint8_t sect_id,
-                           int32_t *sync_val)
-{
-
-  uint8_t UE_id;
-  uint8_t CC_id = phy_vars_eNB->CC_id;
-
-  LOG_E(PHY,"[PHY] EMUL lte_sync_time_eNB_emul eNB %d, sect_id %d\n",phy_vars_eNB->Mod_id,sect_id);
-  *sync_val = 0;
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    //LOG_E(PHY,"[PHY] EMUL : eNB %d checking UE %d (PRACH %d) PL %d dB\n",phy_vars_eNB->Mod_id,UE_id,PHY_vars_UE_g[UE_id]->generate_prach,UE2eNB[UE_id][phy_vars_eNB->Mod_id]->path_loss_dB);
-    if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
-      *sync_val = 1;
-      return(0);
-    }
-  }
-
-  return(-1);
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c
index b74e05ab1b..fae1077763 100755
--- a/openair1/PHY/LTE_TRANSPORT/dci.c
+++ b/openair1/PHY/LTE_TRANSPORT/dci.c
@@ -4206,33 +4206,3 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
 
   return(dci_cnt);
 }
-
-#ifdef PHY_ABSTRACTION
-uint16_t dci_decoding_procedure_emul(LTE_UE_PDCCH **pdcch_vars,
-                                     uint8_t num_ue_spec_dci,
-                                     uint8_t num_common_dci,
-                                     DCI_ALLOC_t *dci_alloc_tx,
-                                     DCI_ALLOC_t *dci_alloc_rx,
-                                     int16_t eNB_id)
-{
-
-  uint8_t  dci_cnt=0,i;
-
-  memcpy(dci_alloc_rx,dci_alloc_tx,num_common_dci*sizeof(DCI_ALLOC_t));
-  dci_cnt = num_common_dci;
-  LOG_D(PHY,"[DCI][EMUL] : num_common_dci %d\n",num_common_dci);
-
-  for (i=num_common_dci; i<(num_ue_spec_dci+num_common_dci); i++) {
-    LOG_D(PHY,"[DCI][EMUL] Checking dci %d => %x format %d (bit 0 %d)\n",i,pdcch_vars[eNB_id]->crnti,dci_alloc_tx[i].format,
-          dci_alloc_tx[i].dci_pdu[0]&0x80);
-
-    if (dci_alloc_tx[i].rnti == pdcch_vars[eNB_id]->crnti) {
-      memcpy(dci_alloc_rx+dci_cnt,dci_alloc_tx+i,sizeof(DCI_ALLOC_t));
-      dci_cnt++;
-    }
-  }
-
-
-  return(dci_cnt);
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
index 384c633fdc..7acf6480eb 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c
@@ -758,310 +758,3 @@ uint32_t  dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
   return(ret);
 }
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#ifdef OPENAIR2
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/defs.h"
-#endif
-
-int dlsch_abstraction_EESM(double* sinr_dB, uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs, uint8_t dl_power_off)
-{
-
-  int ii;
-  double sinr_eff = 0;
-  int rb_count = 0;
-  int offset;
-  double bler = 0;
-
-  if(TM==5 && dl_power_off==1) {
-    //do nothing -- means there is no second UE and TM 5 is behaving like TM 6 for a singal user
-  } else
-    TM = TM-1;
-
-  for (offset = 0; offset <= 24; offset++) {
-    if (rb_alloc[0] & (1<<offset)) {
-      rb_count++;
-
-      for(ii=0; ii<12; ii++) {
-        sinr_eff += exp(-(pow(10, 0.1*(sinr_dB[(offset*12)+ii])))/beta1_dlsch[TM][mcs]);
-        //printf("sinr_eff1 = %f, power %lf\n",sinr_eff, exp(-pow(10,6.8)));
-
-        //  sinr_eff += exp(-(pow(10, (sinr_dB[offset*2+1])/10))/beta1_dlsch[TM][mcs]);
-        //printf("sinr_dB[%d]=%f\n",offset,sinr_dB[offset*2]);
-      }
-    }
-  }
-
-  LOG_D(OCM,"sinr_eff (lin, unweighted) = %f\n",sinr_eff);
-  sinr_eff =  -beta2_dlsch[TM][mcs]*log((sinr_eff)/(12*rb_count));
-  LOG_D(OCM,"sinr_eff (lin, weighted) = %f\n",sinr_eff);
-  sinr_eff = 10 * log10(sinr_eff);
-  LOG_D(OCM,"sinr_eff (dB) = %f\n",sinr_eff);
-
-  bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
-
-  if (uniformrandom() < bler) {
-    LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM);
-    return(1);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f, TM %d)\n",mcs,sinr_eff,bler, TM);
-    return(1);
-  }
-}
-
-int dlsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint32_t rb_alloc[4], uint8_t mcs,uint8_t dl_power_off)
-{
-  int ii;
-  double sinr_eff = 0;
-  double x = 0;
-  double I =0;
-  double qpsk_max=12.2;
-  double qam16_max=19.2;
-  double qam64_max=25.2;
-  double sinr_min = -20;
-  int rb_count = 0;
-  int offset=0;
-  double bler = 0;
-
-  if(TM==5 && dl_power_off==1) {
-    //do nothing -- means there is no second UE and TM 5 is behaving like TM 6 for a singal user
-  } else
-    TM = TM-1;
-
-
-  for (offset = 0; offset <= 24; offset++) {
-    if (rb_alloc[0] & (1<<offset)) {
-      rb_count++;
-
-      for(ii=0; ii<12; ii++) {
-        //x is the sinr_dB in dB
-        x = sinr_dB[(offset*12)+ii] - 10*log10(beta1_dlsch_MI[TM][mcs]);
-
-        if(x<sinr_min)
-          I +=0;
-        else {
-          if(mcs<10) {
-            if(x>qpsk_max)
-              I += 1;
-            else
-              I += (q_qpsk[0]*pow(x,7) + q_qpsk[1]*pow(x,6) + q_qpsk[2]*pow(x,5) + q_qpsk[3]*pow(x,4) + q_qpsk[4]*pow(x,3) + q_qpsk[5]*pow(x,2) + q_qpsk[6]*x + q_qpsk[7]);
-          } else if(mcs>9 && mcs<17) {
-            if(x>qam16_max)
-              I += 1;
-            else
-              I += (q_qam16[0]*pow(x,7) + q_qam16[1]*pow(x,6) + q_qam16[2]*pow(x,5) + q_qam16[3]*pow(x,4) + q_qam16[4]*pow(x,3) + q_qam16[5]*pow(x,2) + q_qam16[6]*x + q_qam16[7]);
-          } else if(mcs>16 && mcs<23) {
-
-            if(x>qam64_max)
-              I += 1;
-            else
-              I += (q_qam64[0]*pow(x,7) + q_qam64[1]*pow(x,6) + q_qam64[2]*pow(x,5) + q_qam64[3]*pow(x,4) + q_qam64[4]*pow(x,3) + q_qam64[5]*pow(x,2) + q_qam64[6]*x + q_qam64[7]);
-          }
-        }
-      }
-    }
-  }
-
-  // averaging of accumulated MI
-  I = I/(12*rb_count);
-  //Now  I->SINR_effective Mapping
-
-  if(mcs<10) {
-    sinr_eff = (p_qpsk[0]*pow(I,7) + p_qpsk[1]*pow(I,6) + p_qpsk[2]*pow(I,5) + p_qpsk[3]*pow(I,4) + p_qpsk[4]*pow(I,3) + p_qpsk[5]*pow(I,2) + p_qpsk[6]*I + p_qpsk[7]);
-  } else if(mcs>9 && mcs<17) {
-    sinr_eff = (p_qam16[0]*pow(I,7) + p_qam16[1]*pow(I,6) + p_qam16[2]*pow(I,5) + p_qam16[3]*pow(I,4) + p_qam16[4]*pow(I,3) + p_qam16[5]*pow(I,2) + p_qam16[6]*I + p_qam16[7]);
-  } else if(mcs>16 && mcs<23) {
-    sinr_eff = (p_qam64[0]*pow(I,7) + p_qam64[1]*pow(I,6) + p_qam64[2]*pow(I,5) + p_qam64[3]*pow(I,4) + p_qam64[4]*pow(I,3) + p_qam64[5]*pow(I,2) + p_qam64[6]*I + p_qam64[7]);
-  }
-
-  //sinr_eff = sinr_eff + 10*log10(beta2_dlsch_MI[TM][mcs]);
-  LOG_D(OCM,"SINR_Eff = %e\n",sinr_eff);
-
-  bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
-
-  if (uniformrandom() < bler) {
-    LOG_N(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-}
-
-/*
-uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
-                             uint8_t subframe,
-                             PDSCH_t dlsch_id,
-                             uint8_t eNB_id)
-{
-
-  LTE_UE_DLSCH_t *dlsch_ue;
-  LTE_eNB_DLSCH_t *dlsch_eNB;
-  uint8_t harq_pid;
-  uint32_t eNB_id2;
-  uint32_t ue_id;
-#ifdef DEBUG_DLSCH_DECODING
-  uint16_t i;
-#endif
-  uint8_t CC_id = phy_vars_ue->CC_id;
-
-  // may not be necessary for PMCH??
-  for (eNB_id2=0; eNB_id2<NB_eNB_INST; eNB_id2++) {
-    if (RC.eNB[eNB_id2][CC_id]->frame_parms.Nid_cell == phy_vars_ue->frame_parms.Nid_cell)
-      break;
-  }
-
-  AssertFatal(eNB_id2!=NB_eNB_INST,
-              "FATAL : Could not find attached eNB for DLSCH emulation !!!!\n");
-
-  LOG_D(PHY,"[UE] dlsch_decoding_emul : subframe %d, eNB_id %d, dlsch_id %d\n",subframe,eNB_id2,dlsch_id);
-
-  //  printf("dlsch_eNB_ra->harq_processes[0] %p\n",PHY_vars_eNB_g[eNB_id]->dlsch_eNB_ra->harq_processes[0]);
-
-
-  switch (dlsch_id) {
-  case SI_PDSCH: // SI
-    dlsch_ue = phy_vars_ue->dlsch_SI[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_SI;
-    //    printf("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
-    memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
-#ifdef DEBUG_DLSCH_DECODING
-    LOG_D(PHY,"SI Decoded\n");
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    LOG_T(PHY,"\n");
-#endif
-    return(1);
-    break;
-
-  case RA_PDSCH: // RA
-    dlsch_ue  = phy_vars_ue->dlsch_ra[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_ra;
-    memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
-#ifdef DEBUG_DLSCH_DECODING
-    LOG_D(PHY,"RA Decoded\n");
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    LOG_T(PHY,"\n");
-#endif
-    return(1);
-    break;
-
-  case PDSCH: // TB0
-    dlsch_ue  = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0];
-    harq_pid = dlsch_ue->current_harq_pid;
-    ue_id= (uint32_t)find_ue((int16_t)phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][(uint32_t)eNB_id]->crnti,RC.eNB[eNB_id2][CC_id]);
-    DevAssert( ue_id != (uint32_t)-1 );
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch[ue_id][0];
-
-#ifdef DEBUG_DLSCH_DECODING
-
-    for (i=0; i<dlsch_ue->harq_processes[harq_pid]->TBS>>3; i++)
-      LOG_T(PHY,"%x.",dlsch_eNB->harq_processes[harq_pid]->b[i]);
-
-    LOG_T(PHY,"\n current harq pid is %d ue id %d \n", harq_pid, ue_id);
-#endif
-
-    if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB,
-                                phy_vars_ue->transmission_mode[eNB_id],
-                                dlsch_eNB->harq_processes[harq_pid]->rb_alloc,
-                                dlsch_eNB->harq_processes[harq_pid]->mcs,
-                                RC.eNB[eNB_id][CC_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
-      // reset HARQ
-      dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
-      dlsch_ue->harq_processes[harq_pid]->round  = 0;
-      dlsch_ue->harq_ack[subframe].ack = 1;
-      dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-      dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-
-      if (dlsch_ue->harq_processes[harq_pid]->round == 0)
-        memcpy(dlsch_ue->harq_processes[harq_pid]->b,
-               dlsch_eNB->harq_processes[harq_pid]->b,
-               dlsch_ue->harq_processes[harq_pid]->TBS>>3);
-
-      return(1);
-    } else {
-      // retransmission
-      dlsch_ue->harq_processes[harq_pid]->status = ACTIVE;
-      dlsch_ue->harq_processes[harq_pid]->round++;
-      dlsch_ue->harq_ack[subframe].ack = 0;
-      dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-      dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-      dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-      return(1+dlsch_ue->max_turbo_iterations);
-    }
-
-    break;
-
-  case PDSCH1: { // TB1
-    dlsch_ue = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1];
-    harq_pid = dlsch_ue->current_harq_pid;
-    int8_t UE_id = find_ue( phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->crnti, RC.eNB[eNB_id2][CC_id] );
-
-    DevAssert( UE_id != -1 );
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch[UE_id][1];
-    // reset HARQ
-    dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
-    dlsch_ue->harq_processes[harq_pid]->round  = 0;
-    dlsch_ue->harq_ack[subframe].ack = 1;
-    dlsch_ue->harq_ack[subframe].harq_id = harq_pid;
-    dlsch_ue->harq_ack[subframe].send_harq_status = 1;
-
-    if (dlsch_ue->harq_processes[harq_pid]->round == 0)
-      memcpy(dlsch_eNB->harq_processes[harq_pid]->b,dlsch_ue->harq_processes[harq_pid]->b,dlsch_ue->harq_processes[harq_pid]->TBS>>3);
-
-    break;
-  }
-
-  case PMCH: // PMCH
-
-    dlsch_ue  = phy_vars_ue->dlsch_MCH[eNB_id];
-    dlsch_eNB = RC.eNB[eNB_id2][CC_id]->dlsch_MCH;
-
-    LOG_D(PHY,"decoding pmch emul (size is %d, enb %d %d)\n",  dlsch_ue->harq_processes[0]->TBS>>3, eNB_id, eNB_id2);
-#ifdef DEBUG_DLSCH_DECODING
-
-    for (i=0; i<dlsch_ue->harq_processes[0]->TBS>>3; i++)
-      printf("%x.",dlsch_eNB->harq_processes[0]->b[i]);
-
-    printf("\n");
-#endif
-
-    
-    //  if (dlsch_abstraction_MIESM(phy_vars_ue->sinr_dB, phy_vars_ue->transmission_mode[eNB_id], dlsch_eNB->rb_alloc,
-    //    dlsch_eNB->harq_processes[0]->mcs,RC.eNB[eNB_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
-    
-    if (1) {
-      // reset HARQ
-      dlsch_ue->harq_processes[0]->status = SCH_IDLE;
-      dlsch_ue->harq_processes[0]->round  = 0;
-      memcpy(dlsch_ue->harq_processes[0]->b,
-             dlsch_eNB->harq_processes[0]->b,
-             dlsch_ue->harq_processes[0]->TBS>>3);
-      dlsch_ue->last_iteration_cnt = 1;
-      return(1);
-    } else {
-      // retransmission
-      dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-      return(1+dlsch_ue->max_turbo_iterations);
-    }
-
-    break;
-
-  default:
-    dlsch_ue = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0];
-    LOG_E(PHY,"dlsch_decoding_emul: FATAL, unknown DLSCH_id %d\n",dlsch_id);
-    dlsch_ue->last_iteration_cnt = 1+dlsch_ue->max_turbo_iterations;
-    return(1+dlsch_ue->max_turbo_iterations);
-  }
-
-  LOG_E(PHY,"[FATAL] dlsch_decoding.c: Should never exit here ...\n");
-  return(0);
-  }*/
-#endif
-
diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c
index 4fbaf3f111..d2632f5b3b 100644
--- a/openair1/PHY/LTE_TRANSPORT/pbch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pbch.c
@@ -37,11 +37,6 @@
 #include "PHY/extern.h"
 #include "PHY/sse_intrin.h"
 
-#ifdef PHY_ABSTRACTION
-#include "SIMULATION/TOOLS/defs.h"
-#endif
-
-
 //#define DEBUG_PBCH 1
 //#define DEBUG_PBCH_ENCODING
 //#define INTERFERENCE_MITIGATION 1
@@ -1016,44 +1011,3 @@ uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
 
 
 }
-
-#ifdef PHY_ABSTRACTION
-uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
-                      uint8_t eNB_id,
-                      uint8_t pbch_phase)
-{
-
-  double bler=0.0;//, x=0.0;
-  double sinr=0.0;
-  uint16_t nb_rb = phy_vars_ue->frame_parms.N_RB_DL;
-  int16_t f;
-  uint8_t CC_id=phy_vars_ue->CC_id;
-  int frame_rx = phy_vars_ue->proc.proc_rxtx[0].frame_rx;
-
-  // compute effective sinr
-  // TODO: adapt this to varible bandwidth
-  for (f=(nb_rb*6-3*12); f<(nb_rb*6+3*12); f++) {
-    if (f!=0) //skip DC
-      sinr += pow(10, 0.1*(phy_vars_ue->sinr_dB[f]));
-  }
-
-  sinr = 10*log10(sinr/(6*12));
-
-  bler = pbch_bler(sinr);
-
-  LOG_D(PHY,"EMUL UE rx_pbch_emul: eNB_id %d, pbch_phase %d, sinr %f dB, bler %f \n",
-        eNB_id,
-        pbch_phase,
-        sinr,
-        bler);
-
-  if (pbch_phase == (frame_rx % 4)) {
-    if (uniformrandom() >= bler) {
-      memcpy(phy_vars_ue->pbch_vars[eNB_id]->decoded_output,RC.eNB[eNB_id][CC_id]->pbch_pdu,PBCH_PDU_SIZE);
-      return(RC.eNB[eNB_id][CC_id]->frame_parms.nb_antenna_ports_eNB);
-    } else
-      return(-1);
-  } else
-    return(-1);
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h
index 8a0e160f23..748d25fcbb 100644
--- a/openair1/PHY/LTE_TRANSPORT/proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/proto.h
@@ -2149,9 +2149,13 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
 	      uint16_t *max_preamble, 
 	      uint16_t *max_preamble_energy, 
 	      uint16_t *max_preamble_delay, 
+#ifdef Rel14
 	      uint16_t Nf, uint8_t tdd_mapindex,
-	      uint8_t br_flag);
-
+	      uint8_t br_flag
+#else
+	      uint16_t Nf, uint8_t tdd_mapindex
+#endif
+	      );
 /*!
   \brief Helper for MAC, returns number of available PRACH in TDD for a particular configuration index
   @param frame_parms Pointer to LTE_DL_FRAME_PARMS structure
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
index 71c36f7c3c..87209e190b 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c
@@ -953,77 +953,3 @@ uint32_t ulsch_encoding(uint8_t *a,
   return(0);
 }
 
-
-#ifdef PHY_ABSTRACTION
-#ifdef OPENAIR2
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/defs.h"
-#endif
-int ulsch_encoding_emul(uint8_t *ulsch_buffer,
-                        PHY_VARS_UE *ue,
-                        uint8_t eNB_id,
-                        uint8_t subframe_rx,
-                        uint8_t harq_pid,
-                        uint8_t control_only_flag)
-{
-
-  LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id];
-  LTE_UE_DLSCH_t **dlsch = ue->dlsch[0][eNB_id];
-  PHY_MEASUREMENTS *meas = &ue->measurements;
-  uint8_t tmode = ue->transmission_mode[eNB_id];
-  uint16_t rnti=ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
-  LOG_D(PHY,"EMUL UE ulsch_encoding for eNB %d,mod_id %d, harq_pid %d rnti %x, ACK(%d,%d) \n",
-        eNB_id,ue->Mod_id, harq_pid, rnti,ulsch->o_ACK[0],ulsch->o_ACK[1]);
-
-  if (ulsch->O>0) {
-    /*
-    if(flag_LA==1)
-      sinr_eff = sinr_eff_cqi_calc(ue, eNB_id);
-    else
-      sinr_eff = meas->wideband_cqi_avg[eNB_id];
-    */
-
-    fill_CQI(ulsch,meas,eNB_id,harq_pid,ue->frame_parms.N_RB_DL,rnti,tmode,ue->sinr_eff);
-    //LOG_D(PHY,"UE CQI\n");
-    //    print_CQI(ulsch->o,ulsch->uci_format,eNB_id);
-
-    // save PUSCH pmi for later (transmission modes 4,5,6)
-    //    printf("ulsch: saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
-    // if (ulsch->uci_format != HLC_subband_cqi_mcs_CBA)
-    dlsch[0]->harq_processes[harq_pid]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
-  }
-
-  memcpy(ue->ulsch[eNB_id]->harq_processes[harq_pid]->b,
-         ulsch_buffer,
-         ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3);
-
-
-  //memcpy(&UE_transport_info[ue->Mod_id].transport_blocks[UE_transport_info_TB_index[ue->Mod_id]],
-  memcpy(&UE_transport_info[ue->Mod_id][ue->CC_id].transport_blocks,
-         ulsch_buffer,
-         ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3);
-  //UE_transport_info_TB_index[ue->Mod_id]+=ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3;
-  // navid: currently more than one eNB is not supported in the code
-  UE_transport_info[ue->Mod_id][ue->CC_id].num_eNB = 1;
-  UE_transport_info[ue->Mod_id][ue->CC_id].rnti[0] = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][0]->crnti;
-  UE_transport_info[ue->Mod_id][ue->CC_id].eNB_id[0]  = eNB_id;
-  UE_transport_info[ue->Mod_id][ue->CC_id].harq_pid[0] = harq_pid;
-  UE_transport_info[ue->Mod_id][ue->CC_id].tbs[0]     = ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS>>3 ;
-  // printf("\nue->Mod_id%d\n",ue->Mod_id);
-
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_flag = 1;
-  //UE_transport_info[ue->Mod_id].cntl.pusch_uci = *(uint32_t *)ulsch->o;
-  memcpy(UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_uci,
-         ulsch->o,
-         MAX_CQI_BYTES);
-  // printf("[UE]cqi is %d \n", ((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1);
-
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.length_uci = ulsch->O;
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.uci_format = ulsch->uci_format;
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_ri = (ulsch->o_RI[0]&1)+((ulsch->o_RI[1]&1)<<1);
-  UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pusch_ack =   (ulsch->o_ACK[0]&1) + ((ulsch->o_ACK[1]&1)<<1);
-  //printf("ack is %d %d %d\n",UE_transport_info[ue->Mod_id].cntl.pusch_ack, (ulsch->o_ACK[1]&1)<<1, ulsch->o_ACK[0]&1);
-  return(0);
-
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
index dcf94c4826..bf7d2603f7 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c
@@ -44,11 +44,6 @@
 #include "PHY_INTERFACE/extern.h"
 #endif
 
-#ifdef PHY_ABSTRACTION
-#include "UTIL/OCG/OCG.h"
-#include "UTIL/OCG/OCG_extern.h"
-#endif
-
 #include "UTIL/LOG/vcd_signal_dumper.h"
 //#define DEBUG_ULSCH_DECODING
 
@@ -1582,450 +1577,3 @@ unsigned int  ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
   return(ret);
 }
 
-#ifdef PHY_ABSTRACTION
-
-#ifdef PHY_ABSTRACTION_UL
-int ulsch_abstraction(double* sinr_dB, uint8_t TM, uint8_t mcs,uint16_t nrb, uint16_t frb)
-{
-
-  int index,ii;
-  double sinr_eff = 0;
-  int rb_count = 0;
-  int offset;
-  double bler = 0;
-  TM = TM-1;
-  sinr_eff = sinr_dB[frb]; //the single sinr_eff value we calculated with MMSE FDE formula in init_snr_up function
-
-
-  sinr_eff *= 10;
-  sinr_eff = floor(sinr_eff);
-  sinr_eff /= 10;
-
-  LOG_D(PHY,"[ABSTRACTION] sinr_eff after rounding = %f\n",sinr_eff);
-
-  for (index = 0; index < 16; index++) {
-    if(index == 0) {
-      if (sinr_eff < sinr_bler_map_up[mcs][0][index]) {
-        bler = 1;
-        break;
-      }
-    }
-
-    if (sinr_eff == sinr_bler_map_up[mcs][0][index]) {
-      bler = sinr_bler_map_up[mcs][1][index];
-    }
-  }
-
-  if (uniformrandom() < bler) {
-    LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-}
-
-
-
-
-
-
-
-int ulsch_abstraction_MIESM(double* sinr_dB,uint8_t TM, uint8_t mcs,uint16_t nrb, uint16_t frb)
-{
-  int index;
-  double sinr_eff = 0;
-  double sinr_db1 = 0;
-  double sinr_db2 = 0;
-  double SI=0;
-  double RBIR=0;
-  int rb_count = 0;
-  int offset, M=0;
-  double bler = 0;
-  int start,middle,end;
-  TM = TM-1;
-
-  for (offset = frb; offset <= (frb + nrb -1); offset++) {
-
-    rb_count++;
-
-    //we need to do the table lookups here for the mutual information corresponding to the certain sinr_dB.
-
-    sinr_db1 = sinr_dB[offset*2];
-    sinr_db2 = sinr_dB[offset*2+1];
-
-    printf("sinr_db1=%f\n,sinr_db2=%f\n",sinr_db1,sinr_db2);
-
-    //rounding up for the table lookup
-    sinr_db1 *= 10;
-    sinr_db2 *= 10;
-
-    sinr_db1 = floor(sinr_db1);
-    sinr_db2 = floor(sinr_db2);
-
-    if ((int)sinr_db1%2) {
-      sinr_db1 += 1;
-    }
-
-    if ((int)sinr_db2%2) {
-      sinr_db2 += 1;
-    }
-
-    sinr_db1 /= 10;
-    sinr_db2 /= 10;
-
-    if(mcs<10) {
-      //for sinr_db1
-      for (index = 0; index < 162; index++) {
-        if (sinr_db1 < MI_map_4qam[0][0]) {
-          SI += (MI_map_4qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_4qam[0][161]) {
-          SI += (MI_map_4qam[1][161]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_4qam[0][index]) {
-          SI += (MI_map_4qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 162; index++) {
-        if (sinr_db2 < MI_map_4qam[0][0]) {
-          SI += (MI_map_4qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_4qam[0][161]) {
-          SI += (MI_map_4qam[1][161]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_4qam[0][index]) {
-          SI += (MI_map_4qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=2;
-          break;
-        }
-      }
-
-    } else if(mcs>9 && mcs<17) {
-      //for sinr_db1
-      for (index = 0; index < 197; index++) {
-        if (sinr_db1 < MI_map_16qam[0][0]) {
-          SI += (MI_map_16qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_16qam[0][196]) {
-          SI += (MI_map_16qam[1][196]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_16qam[0][index]) {
-          SI += (MI_map_16qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 197; index++) {
-        if (sinr_db2 < MI_map_16qam[0][0]) {
-          SI += (MI_map_16qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_16qam[0][196]) {
-          SI += (MI_map_16qam[1][196]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_16qam[0][index]) {
-          SI += (MI_map_16qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=4;
-          break;
-        }
-      }
-
-    } else if(mcs>16 && mcs<22) {
-      //for sinr_db1
-      for (index = 0; index < 227; index++) {
-        if (sinr_db1 < MI_map_64qam[0][0]) {
-          SI += (MI_map_64qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db1 > MI_map_64qam[0][226]) {
-          SI += (MI_map_64qam[1][226]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db1 == MI_map_64qam[0][index]) {
-          SI += (MI_map_64qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-      }
-
-      //for sinr_db2
-      for (index = 0; index < 227; index++) {
-        if (sinr_db2 < MI_map_64qam[0][0]) {
-          SI += (MI_map_64qam[1][0]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db2 > MI_map_64qam[0][226]) {
-          SI += (MI_map_64qam[1][226]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-
-        if (sinr_db2 == MI_map_64qam[0][index]) {
-          SI += (MI_map_64qam[1][index]/beta1_dlsch_MI[TM][mcs]);
-          M +=6;
-          break;
-        }
-      }
-    }
-  }
-
-  // }
-
-  RBIR = SI/M;
-
-  //Now RBIR->SINR_effective Mapping
-  //binary search method is performed here
-  if(mcs<10) {
-    start = 0;
-    end = 161;
-    middle = end/2;
-
-    if (RBIR <= MI_map_4qam[2][start]) {
-      sinr_eff =  MI_map_4qam[0][start];
-    } else {
-      if (RBIR >= MI_map_4qam[2][end])
-        sinr_eff =  MI_map_4qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_4qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_4qam[2][end]) && (RBIR >  MI_map_4qam[2][end-2])) {
-          sinr_eff = MI_map_4qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  }
-
-
-
-  else if (mcs>9 && mcs<17) {
-
-    start = 0;
-    end = 196;
-    middle = end/2;
-
-    if (RBIR <= MI_map_16qam[2][start]) {
-      sinr_eff =  MI_map_16qam[0][start];
-    } else {
-      if (RBIR >= MI_map_16qam[2][end])
-        sinr_eff =  MI_map_16qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_16qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_16qam[2][end]) && (RBIR >  MI_map_16qam[2][end-2])) {
-          sinr_eff = MI_map_16qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  } else if (mcs>16) {
-    start = 0;
-    end = 226;
-    middle = end/2;
-
-    if (RBIR <= MI_map_64qam[2][start]) {
-      sinr_eff =  MI_map_64qam[0][start];
-    } else {
-      if (RBIR >= MI_map_64qam[2][end])
-        sinr_eff =  MI_map_64qam[0][end];
-      else {
-        //while((end-start > 1) && (RBIR >= MI_map_4qam[2]))
-        if (RBIR < MI_map_64qam[2][middle]) {
-          end = middle;
-          middle = end/2;
-        } else {
-          start = middle;
-          middle = (end-middle)/2;
-        }
-      }
-
-      for (; end>start; end--) {
-        if ((RBIR < MI_map_64qam[2][end]) && (RBIR >  MI_map_64qam[2][end-2])) {
-          sinr_eff = MI_map_64qam[0][end-1];
-          break;
-        }
-      }
-    }
-
-    sinr_eff = sinr_eff * beta2_dlsch_MI[TM][mcs];
-  }
-
-  printf("SINR_Eff = %e\n",sinr_eff);
-
-  sinr_eff *= 10;
-  sinr_eff = floor(sinr_eff);
-  // if ((int)sinr_eff%2) {
-  //   sinr_eff += 1;
-  // }
-  sinr_eff /= 10;
-  printf("sinr_eff after rounding = %f\n",sinr_eff);
-
-  for (index = 0; index < 16; index++) {
-    if(index == 0) {
-      if (sinr_eff < sinr_bler_map_up[mcs][0][index]) {
-        bler = 1;
-        break;
-      }
-    }
-
-    if (sinr_eff == sinr_bler_map_up[mcs][0][index]) {
-      bler = sinr_bler_map_up[mcs][1][index];
-    }
-  }
-
-  if (uniformrandom() < bler) {
-    printf("abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(0);
-  } else {
-    printf("abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
-    return(1);
-  }
-}
-
-#endif
-
-uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc,
-                             uint8_t UE_index,
-                             uint16_t *crnti)
-{
-
-  uint8_t UE_id;
-  uint16_t rnti;
-  int subframe = proc->subframe_rx;
-  uint8_t harq_pid;
-  uint8_t CC_id = eNB->CC_id;
-
-  harq_pid = subframe2harq_pid(&eNB->frame_parms,proc->frame_rx,subframe);
-
-  rnti = eNB->ulsch[UE_index]->rnti;
-#ifdef DEBUG_PHY
-  LOG_D(PHY,"[eNB %d] ulsch_decoding_emul : subframe %d UE_index %d harq_pid %d rnti %x\n",eNB->Mod_id,subframe,UE_index,harq_pid,rnti);
-#endif
-
-  for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-    if (rnti == PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[PHY_vars_UE_g[UE_id][CC_id]->current_thread_id[subframe]][0]->crnti)
-      break;
-
-  }
-
-  if (UE_id==NB_UE_INST) {
-    LOG_W(PHY,"[eNB %d] ulsch_decoding_emul: FATAL, didn't find UE with rnti %x (UE index %d)\n",
-          eNB->Mod_id, rnti, UE_index);
-    return(1+eNB->ulsch[UE_id]->max_turbo_iterations);
-  } else {
-    LOG_D(PHY,"[eNB %d] Found UE with rnti %x => UE_id %d\n",eNB->Mod_id, rnti, UE_id);
-  }
-
-  if (PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->status == CBA_ACTIVE) {
-    *crnti = rnti;
-    PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->status=IDLE;
-  } else
-    *crnti = 0x0;
-
-  if (1) {
-    LOG_D(PHY,"ulsch_decoding_emul abstraction successful\n");
-
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->b,
-           PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->harq_processes[harq_pid]->b,
-           eNB->ulsch[UE_index]->harq_processes[harq_pid]->TBS>>3);
-
-    // get local ue's ack
-    if ((UE_index >= oai_emulation.info.first_ue_local) ||(UE_index <(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local))) {
-      get_ack(&eNB->frame_parms,
-              PHY_vars_UE_g[UE_id][CC_id]->dlsch[0][0][0]->harq_ack,
-              proc->subframe_tx,
-              proc->subframe_rx,
-              eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK,0);
-    } else { // get remote UEs' ack
-      eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[0];
-      eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_ACK[1];
-    }
-
-    // Do abstraction of PUSCH feedback
-#ifdef DEBUG_PHY
-    LOG_D(PHY,"[eNB %d][EMUL] ue index %d UE_id %d: subframe %d : o_ACK (%d %d), cqi (val %d, len %d)\n",
-          eNB->Mod_id,UE_index, UE_id, subframe,eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[0],
-          eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_ACK[1],
-          ((HLC_subband_cqi_rank1_2A_5MHz *)PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o)->cqi1,
-          PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O);
-#endif
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->Or1 = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O;
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->Or2 = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->O;
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->uci_format = PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->uci_format;
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->o,PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o,MAX_CQI_BYTES);
-    memcpy(eNB->ulsch[UE_index]->harq_processes[harq_pid]->o_RI,PHY_vars_UE_g[UE_id][CC_id]->ulsch[0]->o_RI,2);
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 1;
-
-    return(1);
-  } else {
-    LOG_W(PHY,"[eNB %d] ulsch_decoding_emul abstraction failed for UE %d\n",eNB->Mod_id,UE_index);
-
-    eNB->ulsch[UE_index]->harq_processes[harq_pid]->cqi_crc_status = 0;
-
-    // retransmission
-    return(1+eNB->ulsch[UE_index]->max_turbo_iterations);
-  }
-
-}
-#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index 795ed5896b..93c1af8d91 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -1360,7 +1360,6 @@ void rx_ulsch_emul(PHY_VARS_eNB *eNB,
 	 subframe,harq_pid,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
          eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS,eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm,
          eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch);
-  //#ifndef OAI_EMU
   write_output("/tmp/ulsch_d.m","ulsch_dseq",&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96],
                eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0);
   if (eNB->common_vars.rxdata) write_output("/tmp/rxsig0.m","rxs0", &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1);
diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/defs.h
index 5e215bfef1..b92c2a4236 100644
--- a/openair1/PHY/TOOLS/defs.h
+++ b/openair1/PHY/TOOLS/defs.h
@@ -34,13 +34,10 @@
 #include "PHY/sse_intrin.h"
 
 
-//defined in rtai_math.h
-#ifndef _RTAI_MATH_H
 struct complex {
   double x;
   double y;
 };
-#endif
 
 struct complexf {
   float r;
@@ -359,17 +356,6 @@ int16_t dB_fixed_times10(uint32_t x);
 int32_t phy_phase_compensation_top (uint32_t pilot_type, uint32_t initial_pilot,
                                     uint32_t last_pilot, int32_t ignore_prefix);
 
-/*!\fn void phy_phase_compensation (int16_t *ref_sch, int16_t *tgt_sch, int16_t *out_sym, int32_t ignore_prefix, int32_t aa, struct complex16 *perror_out);
-This function is used by the EMOS to compensate the phase rotation of the RF. It has been designed for symbols of type CHSCH or SCH, but cannot be used for the data channels.
-@param ref_sch reference symbol
-@param tgt_sch target symbol
-@param out_sym output of the operation
-@param ignore_prefix  set to 1 if cyclic prefix has not been removed (by the hardware)
-@param aa antenna index
-@param perror_out phase error (output parameter)
-*/
-void phy_phase_compensation (int16_t *ref_sch, int16_t *tgt_sch, int16_t *out_sym, int32_t ignore_prefix, int32_t aa, struct complex16 *perror_out );
-
 int32_t dot_product(int16_t *x,
                     int16_t *y,
                     uint32_t N, //must be a multiple of 8
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index e16409a6a1..2ff778907d 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -153,7 +153,9 @@ typedef struct {
   /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
   uint8_t prach_Config_enabled;
   /// PRACH Configuration Information
+#ifdef Rel14
   PRACH_eMTC_CONFIG_INFO prach_ConfigInfo;
+#endif  
 } PRACH_eMTC_CONFIG_COMMON;
 
 /// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h
index 6fe6b46a38..60d3fec5f4 100644
--- a/openair1/PHY/impl_defs_top.h
+++ b/openair1/PHY/impl_defs_top.h
@@ -125,10 +125,6 @@
 #define FIRST_CARRIER_OFFSET (HALF_NUMBER_OF_USEFUL_CARRIERS+NUMBER_OF_ZERO_CARRIERS)
 #define NUMBER_OF_OFDM_SYMBOLS_PER_SLOT (NUMBER_OF_SYMBOLS_PER_FRAME/LTE_SLOTS_PER_FRAME)
 
-#ifdef EMOS
-#define EMOS_SCH_INDEX 1
-#endif //EMOS
-
 #define EXTENSION_TYPE (PHY_config->PHY_framing.Extension_type)
 
 #define NUMBER_OF_OFDM_CARRIERS_BYTES   NUMBER_OF_OFDM_CARRIERS*4
diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h
index e29bbf7aad..003929a5e6 100644
--- a/openair1/SCHED/defs.h
+++ b/openair1/SCHED/defs.h
@@ -208,11 +208,12 @@ void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,re
   @param phy_vars_eNB Pointer to eNB variables on which to act
   @param br_flag indicator for eMTC PRACH
 */
-void prach_procedures(PHY_VARS_eNB *eNB,
 #ifdef Rel14
-		      int br_flag
+void prach_procedures(PHY_VARS_eNB *eNB,
+		      int br_flag);
+#else
+void prach_procedures(PHY_VARS_eNB *eNB);
 #endif
-		      );
 /*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
   @param frame_parms Pointer to DL frame parameter descriptor
   @param subframe Subframe index
diff --git a/openair1/SCHED/extern.h b/openair1/SCHED/extern.h
index 98d4703be8..b1e8df67ef 100644
--- a/openair1/SCHED/extern.h
+++ b/openair1/SCHED/extern.h
@@ -37,11 +37,5 @@ extern int synch_wait_cnt;
 
 extern int16_t hundred_times_delta_TF[100];
 extern uint16_t hundred_times_log10_NPRB[100];
-/*
-#ifdef EMOS
-extern fifo_dump_emos_UE emos_dump_UE;
-extern fifo_dump_emos_eNB emos_dump_eNB;
-#endif
-*/
 
 #endif /*__SCHED_EXTERN_H__ */
diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c
index 8aff92d485..70c4ea03fc 100644
--- a/openair1/SCHED/fapi_l1.c
+++ b/openair1/SCHED/fapi_l1.c
@@ -51,6 +51,7 @@ void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
   fill_dci_and_dlsch(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],pdu);
 }
 
+#ifdef Rel14
 void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
                              eNB_rxtx_proc_t *proc,
                              nfapi_dl_config_request_pdu_t *dl_config_pdu)
@@ -64,6 +65,7 @@ void handle_nfapi_mpdcch_pdu(PHY_VARS_eNB *eNB,
   // copy dci configuration into eNB structure
   fill_mdci_and_dlsch(eNB,proc,&mpdcch_vars->mdci_alloc[mpdcch_vars->num_dci],pdu);
 }
+#endif
 
 void handle_nfapi_hi_dci0_dci_pdu(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
                                   nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu)
@@ -679,10 +681,12 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
     case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
       //      handle_nfapi_epdcch_pdu(eNB,dl_config_pdu);
       break;
+#ifdef Rel14
     case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
       handle_nfapi_mpdcch_pdu(eNB,proc,dl_config_pdu);
       eNB->mpdcch_vars[subframe&1].num_dci++;
       break;
+#endif    
     }
   }
 
diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c
index 15c6fa7557..664791f7c4 100644
--- a/openair1/SCHED/phy_mac_stub.c
+++ b/openair1/SCHED/phy_mac_stub.c
@@ -36,10 +36,6 @@
 #include "SCHED/extern.h"
 #include "LAYER2/MAC/extern.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
-
 /* SYRTEM */
 uint8_t dci_ndi_toggle_even[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 uint8_t dci_ndi_toggle_odd[8]  = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -733,181 +729,3 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
   }
   */
 }
-
-void fill_dci_emos(DCI_PDU *DCI_pdu, uint8_t subframe, PHY_VARS_eNB *eNB)
-{
-
-  //uint8_t cooperation_flag = eNB->cooperation_flag;
-  uint8_t transmission_mode = eNB->transmission_mode[0];
-
-  //uint32_t rballoc = 0x00F0;
-  //uint32_t rballoc2 = 0x000F;
-  /*
-    uint32_t rand = taus();
-    if ((subframe==8) || (subframe==9) || (subframe==0))
-    rand = (rand%5)+5;
-    else
-    rand = (rand%4)+5;
-  */
-
-  DCI_pdu->Num_dci = 0;
-
-  switch (subframe) {
-  case 5:
-    DCI_pdu->Num_dci = 1;
-
-    if (transmission_mode<3) {
-      //user 1
-      DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1_5MHz_TDD_t;
-      DCI_pdu->dci_alloc[0].L            = 2;
-      DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-      DCI_pdu->dci_alloc[0].format       = format1;
-      DCI_pdu->dci_alloc[0].ra_flag      = 0;
-      DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu.rballoc          = eNB->ue_dl_rb_alloc;
-      DLSCH_alloc_pdu.TPC              = 0;
-      DLSCH_alloc_pdu.dai              = 0;
-      DLSCH_alloc_pdu.harq_pid         = 1;
-      DLSCH_alloc_pdu.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu.ndi              = 1;
-      DLSCH_alloc_pdu.rv               = 0;
-      memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
-
-      /*
-      //user2
-      DCI_pdu->dci_alloc[1].dci_length   = sizeof_DCI1_5MHz_TDD_t;
-      DCI_pdu->dci_alloc[1].L            = 2;
-      DCI_pdu->dci_alloc[1].rnti         = 0x1236;
-      DCI_pdu->dci_alloc[1].format       = format1;
-      DCI_pdu->dci_alloc[1].ra_flag      = 0;
-      DCI_pdu->dci_alloc[1].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu.rballoc          = rballoc2;
-      DLSCH_alloc_pdu.TPC              = 0;
-      DLSCH_alloc_pdu.dai              = 0;
-      DLSCH_alloc_pdu.harq_pid         = 1;
-      DLSCH_alloc_pdu.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu.ndi              = 1;
-      DLSCH_alloc_pdu.rv               = 0;
-      memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu,sizeof(DCI1_5MHz_TDD_t));
-      */
-    } else if (transmission_mode==5) {
-      DCI_pdu->Num_dci = 2;
-      // user 1
-      DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
-      DCI_pdu->dci_alloc[0].L            = 2;
-      DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-      DCI_pdu->dci_alloc[0].format       = format1E_2A_M10PRB;
-      DCI_pdu->dci_alloc[0].ra_flag      = 0;
-      DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-      DLSCH_alloc_pdu1E.tpmi             = 5; //5=use feedback
-      DLSCH_alloc_pdu1E.rv               = 0;
-      DLSCH_alloc_pdu1E.ndi              = 1;
-      DLSCH_alloc_pdu1E.mcs              = eNB->target_ue_dl_mcs;
-      DLSCH_alloc_pdu1E.harq_pid         = 1;
-      DLSCH_alloc_pdu1E.dai              = 0;
-      DLSCH_alloc_pdu1E.TPC              = 0;
-      DLSCH_alloc_pdu1E.rballoc          = eNB->ue_dl_rb_alloc;
-      DLSCH_alloc_pdu1E.rah              = 0;
-      DLSCH_alloc_pdu1E.dl_power_off     = 0; //0=second user present
-      memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
-
-      //user 2
-      DCI_pdu->dci_alloc[1].dci_length   = sizeof_DCI1E_5MHz_2A_M10PRB_TDD_t;
-      DCI_pdu->dci_alloc[1].L            = 2;
-      DCI_pdu->dci_alloc[1].rnti         = 0x1236;
-      DCI_pdu->dci_alloc[1].format       = format1E_2A_M10PRB;
-      DCI_pdu->dci_alloc[1].ra_flag      = 0;
-      DCI_pdu->dci_alloc[1].search_space = DCI_UE_SPACE;
-
-      memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&DLSCH_alloc_pdu1E,sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
-
-      // set the precoder of the second UE orthogonal to the first
-      eNB->UE_stats[1].DL_pmi_single = (eNB->UE_stats[0].DL_pmi_single ^ 0x1555);
-    }
-
-    break;
-
-  case 7:
-    DCI_pdu->Num_dci = 1;
-    DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI1A_5MHz_TDD_1_6_t;
-    DCI_pdu->dci_alloc[0].L            = 2;
-    DCI_pdu->dci_alloc[0].rnti         = 0xbeef;
-    DCI_pdu->dci_alloc[0].format       = format1A;
-    DCI_pdu->dci_alloc[0].ra_flag      = 1;
-    DCI_pdu->dci_alloc[0].search_space = DCI_COMMON_SPACE;
-
-    RA_alloc_pdu.type                = 1;
-    RA_alloc_pdu.vrb_type            = 0;
-    RA_alloc_pdu.rballoc             = computeRIV(25,12,3);
-    RA_alloc_pdu.ndi      = 1;
-    RA_alloc_pdu.rv       = 1;
-    RA_alloc_pdu.mcs      = 4;
-    RA_alloc_pdu.harq_pid = 0;
-    RA_alloc_pdu.TPC      = 1;
-
-    memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],&RA_alloc_pdu,sizeof(DCI1A_5MHz_TDD_1_6_t));
-    break;
-
-  case 9:
-    DCI_pdu->Num_dci = 1;
-
-    //user 1
-    DCI_pdu->dci_alloc[0].dci_length   = sizeof_DCI0_5MHz_TDD_1_6_t ;
-    DCI_pdu->dci_alloc[0].L            = 2;
-    DCI_pdu->dci_alloc[0].rnti         = 0x1235;
-    DCI_pdu->dci_alloc[0].format       = format0;
-    DCI_pdu->dci_alloc[0].ra_flag      = 0;
-    DCI_pdu->dci_alloc[0].search_space = DCI_UE_SPACE;
-
-    UL_alloc_pdu.type    = 0;
-    UL_alloc_pdu.hopping = 0;
-    UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb);
-    UL_alloc_pdu.mcs     = eNB->target_ue_ul_mcs;
-    UL_alloc_pdu.ndi     = 1;
-    UL_alloc_pdu.TPC     = 0;
-    UL_alloc_pdu.cshift  = 0;
-    UL_alloc_pdu.dai     = 0;
-    UL_alloc_pdu.cqi_req = 1;
-    memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
-
-    /*
-    //user 2
-    DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI0_5MHz_TDD_1_6_t ;
-    DCI_pdu->dci_alloc[1].L          = 2;
-    DCI_pdu->dci_alloc[1].rnti       = 0x1236;
-    DCI_pdu->dci_alloc[1].format     = format0;
-    DCI_pdu->dci_alloc[1].ra_flag    = 0;
-
-    UL_alloc_pdu.type    = 0;
-    UL_alloc_pdu.hopping = 0;
-    if (cooperation_flag==0)
-    UL_alloc_pdu.rballoc = computeRIV(25,2+eNB->ue_ul_nb_rb,eNB->ue_ul_nb_rb);
-    else
-    UL_alloc_pdu.rballoc = computeRIV(25,0,eNB->ue_ul_nb_rb);
-    UL_alloc_pdu.mcs     = eNB->target_ue_ul_mcs;
-    UL_alloc_pdu.ndi     = 1;
-    UL_alloc_pdu.TPC     = 0;
-    if ((cooperation_flag==0) || (cooperation_flag==1))
-    UL_alloc_pdu.cshift  = 0;
-    else
-    UL_alloc_pdu.cshift  = 1;
-    UL_alloc_pdu.dai     = 0;
-    UL_alloc_pdu.cqi_req = 1;
-    memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&UL_alloc_pdu,sizeof(DCI0_5MHz_TDD_1_6_t));
-    */
-    break;
-
-  default:
-    break;
-  }
-  /*
-  DCI_pdu->nCCE = 0;
-
-  for (i=0; i<DCI_pdu->Num_dci; i++) {
-    DCI_pdu->nCCE += (1<<(DCI_pdu->dci_alloc[i].L));
-  }
-  */
-}
diff --git a/openair1/SCHED/phy_procedures_emos.h b/openair1/SCHED/phy_procedures_emos.h
deleted file mode 100644
index 266a95b3c9..0000000000
--- a/openair1/SCHED/phy_procedures_emos.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __PHY_PROCEDURES_EMOS_H__
-#define __PHY_PROCEDURES_EMOS_H__
-
-/*
-#ifndef RTAI
-typedef uint64_t RTIME;
-#else
-*/
-#ifdef RTAI
-#include <rtai.h>
-#include <rtai_fifos.h>
-#endif
-
-//#include "PHY/TOOLS/defs.h"
-#include "PHY/defs.h"
-#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 20971520  // 20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-
-#define NUMBER_OF_OFDM_CARRIERS_EMOS 512 // the number of OFDM carriers used for channel sounding
-#define NUMBER_OF_USEFUL_CARRIERS_EMOS 300    // the number of OFDM carriers that contain data
-
-#define N_RB_UL_EMOS 25
-#define N_PILOTS_DL_EMOS 2  // ofdm symbols with pilots per slot
-#define N_PILOTS_UL_EMOS 2  // ofdm symbols with pilots per subframe
-#define N_SLOTS_DL_EMOS 2     // we take slots 14,15
-#define N_SUBFRAMES_UL_EMOS 1     // we take subframes 4
-#define NB_ANTENNAS_TX_EMOS 2
-#define NB_ANTENNAS_RX_EMOS 2
-
-struct fifo_dump_emos_struct_UE {
-  // RX
-  uint64_t              timestamp;              //! Timestamp of the receiver
-  unsigned int     frame_tx;               //! Framenumber of the TX (encoded in the BCH)
-  unsigned int     frame_rx;               //! Framenumber of the RX
-  UE_MODE_t        UE_mode;
-  PHY_MEASUREMENTS PHY_measurements;       //! Structure holding all PHY measurements (one for every slot)
-  unsigned int     pbch_errors;                        /// Total number of errors on PBCH
-  unsigned int     pbch_errors_last;                   /// Total number of errors on PBCH 100 frames ago
-  unsigned int     pbch_errors_conseq;                 /// Total number of consecutive errors on PBCH
-  unsigned int     pbch_fer;                           /// PBCH FER (in percent)
-  unsigned int     dlsch_errors;                       /// Total number of error on the DLSCH (data)
-  unsigned int     dlsch_errors_last;
-  unsigned int     dlsch_received;
-  unsigned int     dlsch_received_last;
-  unsigned int     dlsch_fer;
-  unsigned int     dlsch_cntl_errors;                  /// Total number of error on the DLSCH (control)
-  unsigned int     dlsch_ra_errors;                    /// Total number of error on the DLSCH (random access)
-  unsigned int     total_TBS;
-  unsigned int     total_TBS_last;
-  unsigned int     bitrate;
-  unsigned int     total_received_bits;
-  int              timing_offset;                      /// Timing offset
-  int              timing_advance;                     /// Timing advance
-  int              freq_offset;                        /// Frequency offset
-  int              use_ia_receiver;
-  unsigned short   pmi_saved;
-  unsigned short   mcs;
-  unsigned int     rx_total_gain_dB;                   /// Total gain
-  unsigned char    eNb_id;                             /// eNb_id UE is synched to
-  unsigned char    mimo_mode;                          /// Transmission mode
-#ifdef EMOS_CHANNEL
-  int              channel[NB_ANTENNAS_RX_EMOS][NB_ANTENNAS_TX_EMOS][NUMBER_OF_OFDM_CARRIERS_EMOS*N_PILOTS_DL_EMOS*N_SLOTS_DL_EMOS];
-#endif
-};
-
-typedef struct  fifo_dump_emos_struct_UE fifo_dump_emos_UE;
-
-
-struct fifo_dump_emos_struct_eNB {
-  // TX
-  uint64_t              timestamp;              //! Timestamp of the receiver
-  unsigned int     frame_tx;               //! Framenumber of the TX
-  unsigned char    mimo_mode;              /// Transmission mode
-  // RX
-  PHY_MEASUREMENTS_eNB PHY_measurements_eNB;            /// UL measurements
-  LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX]; /// Contains received feedback
-  unsigned int     rx_total_gain_dB;       /// Total gain
-#ifdef EMOS_CHANNEL
-  int              channel[NB_ANTENNAS_RX_EMOS][N_RB_UL_EMOS*12*N_PILOTS_UL_EMOS*N_SUBFRAMES_UL_EMOS]; ///UL channel estimate
-#endif
-};
-
-typedef struct  fifo_dump_emos_struct_eNB fifo_dump_emos_eNB;
-
-#endif
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index c99776e7e5..179f37507a 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -547,11 +547,12 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
 }
 
 
-void prach_procedures(PHY_VARS_eNB *eNB,
 #ifdef Rel14
-		      int br_flag
+void prach_procedures(PHY_VARS_eNB *eNB,
+		      int br_flag) {
+#else
+void prach_procedures(PHY_VARS_eNB *eNB) {
 #endif
-		      ) {
   uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
   uint16_t i;
   int frame,subframe;
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index 1a1dcc9abd..0e978b12ce 100644
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -51,10 +51,6 @@
 #include "LAYER2/MAC/defs.h"
 #include "UTIL/LOG/log.h"
 
-#ifdef EMOS
-fifo_dump_emos_UE emos_dump_UE;
-#endif
-
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 
@@ -1194,38 +1190,6 @@ uint16_t get_n1_pucch(PHY_VARS_UE *ue,
 }
 
 
-#ifdef EMOS
-/*
-  void phy_procedures_emos_UE_TX(uint8_t next_slot,uint8_t eNB_id) {
-  uint8_t harq_pid;
-
-
-  if (next_slot%2==0) {
-  // get harq_pid from subframe relationship
-  harq_pid = subframe2harq_pid(&ue->frame_parms,ue->frame,(next_slot>>1));
-  if (harq_pid==255) {
-  LOG_E(PHY,"[UE%d] Frame %d : FATAL ERROR: illegal harq_pid, returning\n",
-  0,ue->frame);
-  return;
-  }
-
-  if (ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag == 1) {
-  emos_dump_UE.uci_cnt[next_slot>>1] = 1;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o,ulsch[eNB_id]->o,MAX_CQI_BITS*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O = ulsch[eNB_id]->O;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o_RI,ulsch[eNB_id]->o_RI,2*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O_RI = ulsch[eNB_id]->O_RI;
-  memcpy(emos_dump_UE.UCI_data[0][next_slot>>1].o_ACK,ulsch[eNB_id]->o_ACK,4*sizeof(char));
-  emos_dump_UE.UCI_data[0][next_slot>>1].O_ACK = ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK;
-  }
-  else {
-  emos_dump_UE.uci_cnt[next_slot>>1] = 0;
-  }
-  }
-  }
-*/
-#endif
-
 void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empty_subframe) {
 
   int aa;
@@ -1425,9 +1389,6 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
     ue->prach_cnt=0;
 #ifdef SMBV
     ue->prach_resources[eNB_id]->ra_PreambleIndex = 19;
-#endif
-#ifdef OAI_EMU
-    ue->prach_PreambleIndex=ue->prach_resources[eNB_id]->ra_PreambleIndex;
 #endif
     LOG_I(PHY,"mode %d\n",mode);
     
@@ -1835,12 +1796,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
 	}
       }
       
-#ifdef PHY_ABSTRACTION
-      else {
-        ulsch_encoding_emul(ulsch_input_buffer,ue,eNB_id,proc->subframe_rx,harq_pid,0);
-      }
-      
-#endif
 #if UE_TIMING_TRACE
       stop_meas(&ue->ulsch_encoding_stats);
 #endif
@@ -2391,10 +2346,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
   start_meas(&ue->phy_proc_tx);
 #endif
 
-#ifdef EMOS
-  //phy_procedures_emos_UE_TX(next_slot);
-#endif
-
   ue->tx_power_dBm[subframe_tx]=-127;
 
       
@@ -2675,11 +2626,6 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
 			  ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
     }
 
-#ifdef EMOS
-    //emos_dump_UE.frame_tx = frame_tx;
-    //emos_dump_UE.mimo_mode = ue->pbch_vars[eNB_id]->decoded_output[1];
-#endif
-
     if (first_run) {
       first_run = 0;
 
@@ -4677,11 +4623,6 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr
 
     }
 
-#ifdef EMOS
-    phy_procedures_emos_UE_RX(ue,slot,eNB_id);
-#endif
-
-
     VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
 
 #if UE_TIMING_TRACE
@@ -5161,11 +5102,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,
   printf("after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0));
 #endif
 
-#ifdef EMOS
-  phy_procedures_emos_UE_RX(ue,slot,eNB_id);
-#endif
-
-
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
 
 #if UE_TIMING_TRACE
diff --git a/openair1/SCHED/rt_compat.h b/openair1/SCHED/rt_compat.h
deleted file mode 100644
index 35e99098fa..0000000000
--- a/openair1/SCHED/rt_compat.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/* Header file for making PLATON work on both RTLinux and RTAI using pthreads
-*  Copyright Frank Wartena, 2004
-*  Version: 0.1 January 28th, 2004 ## First version for scheduling test
-*     0.2 February 20th, 2004 ## All PLATON functions added
-*  It is mostly a conversion from RTLinux to RTAI, because PLATON was written
-*  for RTLinux.
-*  Not all necessary conversions can be done in this header file, other
-*  adjustments in the code are also necessary.
-*/
-
-#ifndef _RT_COMPAT_H_
-#define _RT_COMPAT_H_
-
-#ifdef RTAI_ENABLED
-//the conversions from RTLinux to RTAI
-
-//variable for containing times
-#define hrtime_t RTIME
-
-//function for making a thread periodic
-#define pthread_make_periodic_np(x,y,z) rt_task_make_periodic(x,rt_get_time(),nano2count(z))
-
-//function for printing to the kernel log
-#define rtl_printf printk
-
-//function for determining the current cpu
-#define rtl_getcpuid hard_cpu_id
-
-//function for initialising a mutex
-#define pthread_mutex_init pthread_mutex_init_rt
-
-//function for initialising a mutex attribute
-#define pthread_mutexattr_init pthread_mutexattr_init_rt
-
-//function for setting a mutex protocol, does not exist in RTAI
-#define pthread_mutexattr_setprotocol(x,y);
-
-//function for locking a mutex
-#define pthread_mutex_lock pthread_mutex_lock_rt
-
-//function for unlocking a mutex
-#define pthread_mutex_unlock pthread_mutex_unlock_rt
-
-//function for destroying a mutex
-#define pthread_mutex_destroy pthread_mutex_destroy_rt
-
-//function for getting the current time
-#define clock_gethrtime(x) rt_get_time_ns()
-#define gethrtime          rt_get_time_ns
-
-//function for initialising a condition
-#define pthread_cond_init pthread_cond_init_rt
-
-//function for waiting on a condition
-#define pthread_cond_wait pthread_cond_wait_rt
-
-//function for signalling a condition
-#define pthread_cond_signal pthread_cond_signal_rt
-
-//function for destroying a condition
-#define pthread_cond_destroy pthread_cond_destroy_rt
-
-//function for waking up a thread
-#define pthread_wakeup_np rt_task_resume
-
-//function for getting the current thread
-#define pthread_self rt_whoami
-
-//function for initialising an attribute
-#define pthread_attr_init pthread_attr_init_rt
-
-//function for setting a schedparam
-#define pthread_attr_setschedparam pthread_attr_setschedparam_rt
-
-//funcion for setting a schedpolicy
-#define pthread_attr_setschedpolicy pthread_attr_setschedpolicy_rt
-
-//function for creating a thread
-#define pthread_create pthread_create_rt
-
-//function for cancelling a thread
-#define pthread_cancel pthread_cancel_rt
-
-//function for deleting a thread, in RTAI both by calling cancel
-#define pthread_delete_np pthread_cancel_rt
-
-//testing if a cpuid exists
-#define rtl_cpu_exists(x) x<NR_RT_CPUS
-
-//function for flushing a fifo does not exist in RTAI
-#define rtf_flush(x);
-
-//function for setting the stacksize
-#define pthread_attr_setstacksize pthread_attr_setstacksize_rt
-
-//function for sleeping the indicated amount in nanoseconds
-//#define rtl_delay(x) rt_sleep(nano2count(x))
-//#define udelay(x) rt_sleep(nano2count(1000*x))
-//#define usleep(x) rt_sleep(nano2count(1000*x))
-
-#define pthread_exit pthread_exit_rt
-
-//function for indicating that a thread uses the FPU
-#define pthread_setfp_np rt_task_use_fpu
-
-//function for freeing a soft irq
-#define rtl_free_soft_irq(x) rt_free_linux_irq(x,NULL)
-
-//function for triggering a soft irq
-#define rtl_global_pend_irq rt_pend_linux_irq
-
-//function for setting the thread scheduling, does not exist in RTAI
-#define pthread_setschedparam(x,y,z);
-
-#endif /* RTAI_ENABLED */
-
-#endif /* _RT_COMPAT_H_ */
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index e04ef3456e..47a420d1d7 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -38,10 +38,6 @@
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
 #include "PHY/LTE_TRANSPORT/if5_tools.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
-
 #include "LAYER2/MAC/extern.h"
 #include "LAYER2/MAC/defs.h"
 #include "UTIL/LOG/log.h"
diff --git a/openair1/SIMULATION/LTE_PHY/Makefile b/openair1/SIMULATION/LTE_PHY/Makefile
deleted file mode 100644
index d235a01103..0000000000
--- a/openair1/SIMULATION/LTE_PHY/Makefile
+++ /dev/null
@@ -1,202 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-COMMON_UTILS_DIR = $(OPENAIR_DIR)/common/utils
-TOP_DIR = $(OPENAIR1_DIR)
-OPENAIR1_TOP = $(OPENAIR1_DIR)
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-OPENAIR3 = $(OPENAIR3_DIR)
-
-CFLAGS += -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO -DLOG_NO_THREAD # -Wno-packed-bitfield-compat
-
-# enable C99 mode
-CFLAGS += -std=gnu99
-
-# DCI Debug
-# CFLAGS += -DDEBUG_DCI_ENCODING
-# TODO: only for framegen
-#CFLAGS += -DOPENAIR2
-#CFLAGS += -DDEBUG_PHY_PROC
-#CFLAGS += -DDEBUG_GROUPHOP
-
-ifdef OMP
-CFLAGS += -DOMP -fopenmp
-endif
-ifdef LLR8
-CFLAGS += -DLLR8
-endif
-CFLAGS += -DNEW_FFT
-
-LFLAGS = -lm -lblas -lxml2 -lrt -lpthread $(LFDS_DIR)/bin/liblfds611.a
-
-ifdef GPIB
-LFLAGS += -lgpib
-endif
-
-CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH #-DIFFT_FPGA -DIFFT_FPGA_UE
-#CFLAGS += -DTBS_FIX
-CFLAGS += -DCELLULAR
-
-ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-
-ifdef EMOS
-CFLAGS += -DEMOS
-endif
-
-ifdef DEBUG_PHY
-CFLAGS += -DDEBUG_PHY
-endif
-
-ifdef MeNBMUE
-CFLAGS += -DMeNBMUE
-endif
-
-ifdef MU_RECEIVER
-CFLAGS += -DMU_RECEIVER
-endif
-
-ifdef ZBF_ENABLED
-CFLAGS += -DNULL_SHAPE_BF_ENABLED
-endif
-
-ifdef RANDOM_BF
-CFLAGS += -DRANDOM_BF
-endif
-
-ifdef PBS_SIM
-CFLAGS += -DPBS_SIM
-endif
-
-ifdef XFORMS
-CFLAGS += -DXFORMS
-LFLAGS += -lforms
-endif
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-ifdef PERFECT_CE
-CFLAGS += -DPERFECT_CE
-endif
-
-ifdef BIT8_TX
-CFLAGS += -DBIT8_TX
-endif
-
-CFLAGS += -DNO_RRM -DOPENAIR1 -DPHY_ABSTRACTION #-DOPENAIR2
-
-CFLAGS += -I/usr/include/X11 -I/usr/X11R6/include
-
-ifdef RTAI
-CFLAGS += -DRTAI_ENABLED  -D__IN_RTAI__ $(shell rtai-config --lxrt-cflags)
-LFLAGS += $(shell rtai-config --lxrt-ldflags) -llxrt
-endif
-
-include $(COMMON_UTILS_DIR)/Makefile.inc
-include $(TOP_DIR)/PHY/Makefile.inc
-include $(TOP_DIR)/SCHED/Makefile.inc
-include $(TOP_DIR)/SIMULATION/Makefile.inc
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-#LOG_OBJS +=  $(LOG_DIR)/vcd_signal_dumper.o
-
-CFLAGS += $(L2_incl) -I$(ASN1_MSG_INC) -I$(TOP_DIR) -I$(OPENAIR2_DIR) -I$(OPENAIR3) $(UTIL_incl) $(UTILS_incl)
-# EXTRA_CFLAGS = 
-
-#STATS_OBJS += $(TOP_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_proc.o
-
-#LAYER2_OBJ += $(OPENAIR2_DIR)/LAYER2/MAC/rar_tools.o
-#LAYER2_OBJ = $(OPENAIR2_DIR)/LAYER2/MAC/lte_transport_init.o
-
-OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(SCHED_OBJS) $(LAYER2_OBJ) $(LOG_OBJS) $(ITTI_DIR)/backtrace.o
-ifdef GPIB
-OBJ += LTE_Configuration.o
-endif
-#OBJ2 = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS)  
-
-ifdef XFORMS
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-endif
-
-ifdef STATIC
-LFLAGS += -static -L/usr/lib/libblas
-endif
-
-all: dlsim pbchsim pdcchsim ulsim pucchsim prachsim mbmssim scansim
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-test: $(SIMULATION_OBJS) $(TOOLS_OBJS) $(TOP_DIR)/PHY/INIT/lte_init.o test.c
-	$(CC)  test.c -I$(TOP_DIR) -o test $(CFLAGS) $(SIMULATION_OBJS) $(TOOLS_OBJS) -lm 
-
-OBJ += $(LIST_OBJ) 
-OBJ += $(MEM_OBJ)
-$(OBJ) : %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) -o $@ $<
-
-dlsim : $(OBJ) dlsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling dlsim.c ..."
-	@$(CC) dlsim.c  -o dlsim $(CFLAGS) $(OBJ) $(LFLAGS)
-
-dlsim2 : $(OBJ) dlsim2.c
-	@echo "Compiling dlsim2.c ..."
-	@$(CC) dlsim2.c  -o dlsim2 $(CFLAGS) $(OBJ) $(LFLAGS)
-
-framegen: $(OBJ) framegen.c
-	@echo "Compiling framegen.c"
-	@$(CC) framegen.c -o framegen $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pbchsim : $(OBJ) pbchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pbchsim.c"
-	@$(CC) pbchsim.c  -o pbchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-scansim : $(OBJ) scansim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling scansim.c"
-	@$(CC) scansim.c -o scansim $(CFLAGS) $(OBJ) $(LFLAGS)
-
-mbmssim : $(OBJ) mbmssim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling mbmssim.c"
-	@$(CC) mbmssim.c  -o mbmssim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pdcchsim : $(OBJ) pdcchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pdcchsim.c"
-	@$(CC) pdcchsim.c  -o pdcchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-pucchsim : $(OBJ) pucchsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling pucchsim.c"
-	@$(CC) pucchsim.c  -o pucchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-prachsim : $(OBJ) prachsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling prachsim.c"
-	@$(CC) prachsim.c  -o prachsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-ulsim : $(OBJ) ulsim.c $(LFDS_DIR)/bin/liblfds611.a #ulsim_form.c
-	@echo "Compiling [ulsim.c]"
-	@$(CC) ulsim.c -o ulsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-syncsim : $(OBJ) syncsim.c $(LFDS_DIR)/bin/liblfds611.a
-	@echo "Compiling syncsim.c"
-	@$(CC) syncsim.c  -o syncsim $(CFLAGS) $(OBJ) $(LFLAGS) 
-
-clean :
-	rm -f $(OBJ)
-	rm -f *.o
-
-cleanall : clean
-	rm -f dlsim pbchsim pdcchsim ulsim pucchsim mbmssim prachsim 
-	rm -f *.exe*
-
-showflags :
-	@echo $(CFLAGS)
-	@echo $(LFLAGS)
-
-showobj:
-	@echo $(SCHED_OBJS)
-
-cppcheck:
-	@echo "cppcheck ..."
-	cppcheck $(INCLUDES) ${OBJ:.o=.c} ${OAISIM_OBJS,.o=.c} ${ASN1_RRC_MSG_OBJS1,.o=.c}
diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c
index 773ec57a3e..fbe75fed16 100644
--- a/openair1/SIMULATION/LTE_PHY/mbmssim.c
+++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c
@@ -31,9 +31,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c
index e240f88ce6..d1e25da5c3 100644
--- a/openair1/SIMULATION/LTE_PHY/pbchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c
@@ -32,9 +32,6 @@
 #include "PHY/defs.h"
 #include "PHY/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -91,9 +88,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
   int8_t interf1=-21,interf2=-21;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
index 71e2f88172..ef0e221491 100644
--- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
@@ -28,9 +28,6 @@
 #include "PHY/defs.h"
 #include "PHY/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c
index cab2ecb8fb..58f89bd65b 100644
--- a/openair1/SIMULATION/LTE_PHY/prachsim.c
+++ b/openair1/SIMULATION/LTE_PHY/prachsim.c
@@ -27,9 +27,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -76,10 +73,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
   //  int8_t interf1=-19,interf2=-19;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
-
 
   SCM_t channel_model=Rayleigh1;
 
diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c
index 1e5f47e59e..d49367c4db 100644
--- a/openair1/SIMULATION/LTE_PHY/pucchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c
@@ -27,9 +27,6 @@
 #include "PHY/types.h"
 #include "PHY/defs.h"
 #include "PHY/vars.h"
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -77,9 +74,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0;
 
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   SCM_t channel_model=Rayleigh1_corr;
 
diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c
index 94bc991e3f..69aee01b32 100644
--- a/openair1/SIMULATION/LTE_PHY/scansim.c
+++ b/openair1/SIMULATION/LTE_PHY/scansim.c
@@ -33,9 +33,6 @@
 #include "PHY/vars.h"
 #include "MAC_INTERFACE/vars.h"
 
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "LAYER2/MAC/vars.h"
@@ -91,9 +88,6 @@ int main(int argc, char **argv)
   uint32_t nsymb,tx_lev,tx_lev1,tx_lev2;
   uint8_t extended_prefix_flag=0;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c
index acad27ca11..e491944ccf 100644
--- a/openair1/SIMULATION/LTE_PHY/syncsim.c
+++ b/openair1/SIMULATION/LTE_PHY/syncsim.c
@@ -30,11 +30,6 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
-#ifdef RTAI_ENABLED
-#include <rtai_mbx.h>
-#include <rtai_msg.h>
-#endif
-
 #include "SIMULATION/TOOLS/defs.h"
 #include "SIMULATION/RF/defs.h"
 #include "PHY/types.h"
@@ -44,9 +39,6 @@
 #ifdef IFFT_FPGA
 #include "PHY/LTE_REFSIG/mod_table.h"
 #endif
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 #include "SCHED/defs.h"
 #include "SCHED/vars.h"
 #include "ARCH/CBMIMO1/DEVICE_DRIVER/vars.h"
@@ -381,9 +373,6 @@ int main(int argc, char **argv)
   uint8_t extended_prefix_flag=0,frame_type=1;
   int8_t interf1=-21,interf2=-21;
   LTE_DL_FRAME_PARMS *frame_parms;
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
   char input_val_str[50],input_val_str2[50];
@@ -430,13 +419,6 @@ int main(int argc, char **argv)
 
   int rx_offset_mod;
 
-#ifdef RTAI_ENABLED
-  int period;
-  RTIME expected;
-  RT_TASK *task;
-#define PERIOD 1000000000
-#endif
-
   logInit();
 
   number_of_cards = 1;
@@ -694,23 +676,6 @@ int main(int argc, char **argv)
     }
   }
 
-#ifdef RTAI_ENABLED
-
-  if (!(task = rt_task_init_schmod(nam2num("SYNCSIM"), 0, 0, 0, SCHED_FIFO, 0xF))) {
-    printf("CANNOT INIT MASTER TASK\n");
-    exit(1);
-  }
-
-  rt_set_periodic_mode();
-
-  period = start_rt_timer(nano2count(PERIOD));
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-  rt_task_make_periodic(task, expected = rt_get_time() + 10*period, period);
-#endif
-
 #ifdef XFORMS
 
   if (do_forms==1) {
@@ -1374,11 +1339,6 @@ int main(int argc, char **argv)
 
       for (trial=0; trial<n_frames; trial++) {
 
-#ifdef RTAI_ENABLED
-        ret = rt_task_wait_period();
-        printf("rt_task_wait_period() returns %d, time %llu\n",ret, rt_get_time());
-#endif
-
         if (oai_hw_input == 0) {
 
           if (awgn_flag == 0) {
@@ -1752,11 +1712,6 @@ int main(int argc, char **argv)
     ioctl(openair_fd,openair_START_TX_SIG,(void *)NULL);
   }
 
-#ifdef RTAI_ENABLED
-  rt_make_soft_real_time();
-  rt_task_delete(task);
-#endif
-
 #ifdef XFORMS
 
   if (do_forms==1) {
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim2.c b/openair1/SIMULATION/LTE_PHY/ulsim2.c
index d91b35782c..6a474332e8 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim2.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim2.c
@@ -30,9 +30,6 @@
 #ifdef IFFT_FPGA
 #include "PHY/LTE_REFSIG/mod_table.h"
 #endif
-#ifdef EMOS
-#include "SCHED/phy_procedures_emos.h"
-#endif
 
 #define BW 10.0
 #define Td 1.0
@@ -69,12 +66,6 @@ int main(int argc, char **argv)
   double ip =0.0;
   double N0W, path_loss, path_loss_dB;
 
-#ifdef EMOS
-  fifo_dump_emos emos_dump;
-#endif
-
-
-
   if (argc>1)
     sigma2_dB = atoi(argv[1]);
 
diff --git a/openair1/SIMULATION/TOOLS/taus.c b/openair1/SIMULATION/TOOLS/taus.c
index 8b5ad7dfaf..0be7952da7 100644
--- a/openair1/SIMULATION/TOOLS/taus.c
+++ b/openair1/SIMULATION/TOOLS/taus.c
@@ -21,11 +21,6 @@
 
 #include <time.h>
 #include <stdlib.h>
-#ifdef RTAI_ENABLED
-#include <rtai.h>
-#include <rtai_sched.h>
-#define time(x) (unsigned int)(rt_get_time_ns())
-#endif
 
 unsigned int s0, s1, s2, b;
 
diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h
index 8df0970ba0..3a73000e50 100644
--- a/openair2/COMMON/mac_rrc_primitives.h
+++ b/openair2/COMMON/mac_rrc_primitives.h
@@ -244,9 +244,7 @@ typedef struct {
   LCHAN_DESC  Lchan_desc[2];  /*!< \brief Logical Channel QoS Descriptor (MAC component) */
   uint8_t L3_info_type;
   uint8_t L3_info[16];
-  //#ifndef CELLULAR
   unsigned short UE_eNB_index;
-  //#endif
 } __attribute__ ((__packed__))  MAC_CONFIG_REQ;
 #define MAC_CONFIG_REQ_SIZE sizeof(MAC_CONFIG_REQ)
 
@@ -314,18 +312,12 @@ typedef struct {
 
 #ifndef OPENAIR2_IN
 
-#ifndef CELLULAR
-//#include "L3_rrc_defs.h"
-#endif
-
 typedef struct {  //RRC_INTERFACE_FUNCTIONS
   unsigned int Frame_index;
   unsigned short UE_index[NB_MODULES_MAX][NB_SIG_CNX_UE];
   uint8_t  eNB_id[NB_MODULES_MAX][NB_CNX_UE];
-#ifndef CELLULAR
   //  L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH];
   uint8_t UE_id[NB_MODULES_MAX][NB_CNX_CH][5];
-#endif
   void (*openair_rrc_top_init)(void);
   char (*openair_rrc_eNB_init)(uint8_t );
   char (*openair_rrc_UE_init)(uint8_t, uint8_t);
diff --git a/openair2/COMMON/openair_types.h b/openair2/COMMON/openair_types.h
deleted file mode 100644
index 1ae2a2cefa..0000000000
--- a/openair2/COMMON/openair_types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __openair_TYPES_H__
-#define __openair_TYPES_H__
-
-#endif /*__openair_TYPES_H__ */
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index c0ee976fdd..1ce10c56bc 100644
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -30,7 +30,9 @@
 #ifndef __PLATFORM_TYPES_H__
 #    define __PLATFORM_TYPES_H__
 
+#if !defined(NAS_NETLINK)
 #include <stdint.h>
+#endif
 
 #if defined(ENABLE_ITTI)
 #include "itti_types.h"
@@ -269,29 +271,5 @@ typedef struct protocol_ctxt_s {
     (CTXT_Pp)->module_id, \
     (CTXT_Pp)->rnti
 
-#ifdef OAI_EMU
-#define CHECK_CTXT_ARGS(CTXT_Pp) \
-    if ((CTXT_Pp)->enb_flag) {\
-        AssertFatal (((CTXT_Pp)->module_id >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0),\
-                     "eNB module id is too low (%u/%d/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_enb_local,\
-                     oai_emulation.info.nb_enb_local);\
-        AssertFatal (((CTXT_Pp)->module_id < (oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local)) && (oai_emulation.info.nb_enb_local > 0),\
-                     "eNB module id is too high (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local);\
-    } else {\
-        AssertFatal ((CTXT_Pp)->module_id  < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local),\
-                     "UE module id is too high (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local);\
-        AssertFatal ((CTXT_Pp)->module_id  >= oai_emulation.info.first_ue_local,\
-                     "UE module id is too low (%u/%d)!\n",\
-                     (CTXT_Pp)->module_id,\
-                     oai_emulation.info.first_ue_local);\
-    }
-#else
 #define CHECK_CTXT_ARGS(CTXT_Pp)
 #endif
-#endif
diff --git a/openair2/COMMON/rtos_header.h b/openair2/COMMON/rtos_header.h
index 2ba3534d7e..05fc33463d 100644
--- a/openair2/COMMON/rtos_header.h
+++ b/openair2/COMMON/rtos_header.h
@@ -20,13 +20,13 @@
  */
 
 #ifndef _RTOS_HEADER_H_
-#    define _RTOS_HEADER_H_
-#    include <stdio.h>
-#    include <stdlib.h>
-#    include <string.h>
-#    include <math.h>
-#    include <pthread.h>
-#    include <assert.h>
-#    define rtf_get    read
-#    define rtf_put    write
+#define _RTOS_HEADER_H_
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <pthread.h>
+#include <assert.h>
+#define rtf_get    read
+#define rtf_put    write
 #endif
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index a163b031c9..504dd6b8f4 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -36,10 +36,6 @@
 #include "common/ran_context.h"
 
 #include "log.h"
-#if defined(OAI_EMU)
-# include "OCG.h"
-# include "OCG_extern.h"
-#endif
 
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
@@ -215,9 +211,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
   uint32_t         register_enb_pending = 0;
 
   for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
-#   if defined(OAI_EMU)
-    if (oai_emulation.info.cli_start_enb[enb_id] == 1)
-#   endif
     {
       s1ap_register_enb_req_t *s1ap_register_eNB;
 
@@ -310,19 +303,6 @@ void *eNB_app_task(void *args_p)
 
   if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
 
-  # if defined(ENABLE_ITTI)
-#   if defined(OAI_EMU)
-  enb_nb =        oai_emulation.info.nb_enb_local;
-  enb_id_start =  oai_emulation.info.first_enb_local;
-  enb_id_end =    oai_emulation.info.first_enb_local + enb_nb;
-
-  AssertFatal (enb_id_end <= NUMBER_OF_eNB_MAX,
-               "Last eNB index is greater or equal to maximum eNB index (%d/%d)!",
-               enb_id_end, NUMBER_OF_eNB_MAX);
-#   endif
-  # endif
-
-
   AssertFatal (enb_nb <= RC.nb_inst,
                "Number of eNB is greater than eNB defined in configuration file (%d/%d)!",
                enb_nb, RC.nb_inst);
@@ -396,16 +376,6 @@ void *eNB_app_task(void *args_p)
           msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
           itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
 
-#   if defined(OAI_EMU)
-
-          /* Also inform all NAS UE tasks */
-          for (instance = NB_eNB_INST + oai_emulation.info.first_ue_local;
-               instance < (NB_eNB_INST + oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local); instance ++) {
-            msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE);
-            itti_send_msg_to_task (TASK_NAS_UE, instance, msg_init_p);
-          }
-
-#   endif
         } else {
           uint32_t not_associated = enb_nb - registered_enb;
 
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index f2f89ad1ca..610ee4a787 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -36,10 +36,6 @@
 #include "enb_config.h"
 #include "UTIL/OTG/otg.h"
 #include "UTIL/OTG/otg_externs.h"
-#if defined(OAI_EMU)
-# include "OCG.h"
-# include "OCG_extern.h"
-#endif
 #if defined(ENABLE_ITTI)
 # include "intertask_interface.h"
 # if defined(ENABLE_USE_MME)
diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc
index c0e4df5617..2f5cea7555 100644
--- a/openair2/LAYER2/Makefile.inc
+++ b/openair2/LAYER2/Makefile.inc
@@ -54,10 +54,6 @@ SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_reassembly.c
 SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_receiver.c
 SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_dar.c
 
-ifeq ($(OPENAIR_EMU),1)
-SOURCES_L2 +=  $(RLC_UM_DIR)/rlc_um_very_simple_test.c
-endif
-
 SOURCES_L2 +=  $(RLC_DIR)/rlc_mac.c
 SOURCES_L2 +=  $(RLC_DIR)/rlc.c
 SOURCES_L2 +=  $(RLC_DIR)/rlc_rrc.c
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index 8bb04c37b8..0db15ffd59 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -61,10 +61,7 @@
 #  include "gtpv1u.h"
 #endif
 
-#ifndef OAI_EMU
 extern int otg_enabled;
-#endif
-
 
 //-----------------------------------------------------------------------------
 /*
@@ -436,11 +433,6 @@ pdcp_data_ind(
 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP);
-
-#endif
 #ifdef PDCP_MSG_PRINT
   int i=0;
   LOG_F(PDCP,"[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
@@ -688,49 +680,6 @@ pdcp_data_ind(
     payload_offset=0;
   }
 
-#if defined(OAI_EMU)
-
-  if (oai_emulation.info.otg_enabled == 1) {
-    //unsigned int dst_instance;
-    int    ctime;
-
-    if ((pdcp_p->rlc_mode == RLC_MODE_AM)&&(MBMS_flagP==0) ) {
-      pdcp_p->last_submitted_pdcp_rx_sn = sequence_number;
-    }
-
-#if defined(DEBUG_PDCP_PAYLOAD)
-    rlc_util_print_hex_octets(PDCP,
-                              (unsigned char*)&sdu_buffer_pP->data[payload_offset],
-                              sdu_buffer_sizeP - payload_offset);
-#endif
-
-    ctime = oai_emulation.info.time_ms; // avg current simulation time in ms : we may get the exact time through OCG?
-    if (MBMS_flagP == 0){
-      LOG_D(PDCP,
-	    PROTOCOL_PDCP_CTXT_FMT"Check received buffer :  (dst %d)\n",
-	    PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
-	    ctxt_pP->instance);
-    }
-    if (otg_rx_pkt(
-          ctxt_pP->instance,
-          ctime,
-          (const char*)(&sdu_buffer_pP->data[payload_offset]),
-                   sdu_buffer_sizeP - payload_offset ) == 0 ) {
-      free_mem_block(sdu_buffer_pP, __func__);
-
-      if (ctxt_pP->enb_flag) {
-        stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
-      } else {
-        stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_ind);
-      }
-
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
-      return TRUE;
-    }
-  }
-
-#else
-
   if (otg_enabled==1) {
     LOG_D(OTG,"Discarding received packed\n");
     free_mem_block(sdu_buffer_pP, __func__);
@@ -745,9 +694,6 @@ pdcp_data_ind(
     return TRUE;
   }
 
-#endif
-
-
   // XXX Decompression would be done at this point
 
   /*
@@ -806,22 +752,15 @@ pdcp_data_ind(
       // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
       if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
         ((pdcp_data_ind_header_t *) new_sdu_p->data)->rb_id = rb_id;
-#if defined(OAI_EMU)
-        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id + oai_emulation.info.nb_enb_local - oai_emulation.info.first_ue_local;
-#else
-#  if defined(ENABLE_USE_MME)
+#if defined(ENABLE_USE_MME)
         /* for the UE compiled in S1 mode, we need 1 here
          * for the UE compiled in noS1 mode, we need 0
          * TODO: be sure of this
          */
         ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = 1;
-#  endif
 #endif
       } else {
         ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB);
-#if defined(OAI_EMU)
-        ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst  = ctxt_pP->module_id - oai_emulation.info.first_enb_local;
-#endif
       }
 #ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
       static uint32_t pdcp_inst = 0;
@@ -978,11 +917,6 @@ pdcp_run (
     itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p);
   }
 # endif
-#endif
-
-#if defined(OAI_EMU)
-    pdcp_fifo_read_input_sdus_from_otg(ctxt_pP);
-
 #endif
 
   // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index c19adb6753..a5f400b4c2 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -33,9 +33,7 @@
 #define PDCP_DEBUG 1
 //#define DEBUG_PDCP_FIFO_FLUSH_SDU
 
-#ifndef OAI_EMU
 extern int otg_enabled;
-#endif
 
 #include "pdcp.h"
 #include "pdcp_primitives.h"
@@ -162,11 +160,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const  ctxt_pP)
         threadname, ctxt_pP->frame, ctxt_pP->subframe,
         ((pdcp_data_ind_header_t*) sdu_p->data)->inst,
         ((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
-#else
-#if ! defined(OAI_EMU)
-    /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
-//    ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
-#endif
 #endif
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
@@ -547,29 +540,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
                 nas_nlh_rx->nlmsg_len - sizeof(struct nlmsghdr));
 #endif
 
-#ifdef OAI_EMU
-
-          // overwrite function input parameters, because only one netlink socket for all instances
-          if (pdcp_read_header_g.inst < oai_emulation.info.nb_enb_local) {
-            ctxt.frame         = ctxt_cpy.frame;
-            ctxt.enb_flag      = ENB_FLAG_YES;
-            ctxt.module_id     = pdcp_read_header_g.inst  +  oai_emulation.info.first_enb_local;
-            ctxt.rnti          = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id ][pdcp_read_header_g.rb_id / maxDRB + oai_emulation.info.first_ue_local];
-            rab_id    = pdcp_read_header_g.rb_id % maxDRB;
-          } else {
-            ctxt.frame         = ctxt_cpy.frame;
-            ctxt.enb_flag      = ENB_FLAG_NO;
-            ctxt.module_id     = pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local + oai_emulation.info.first_ue_local;
-            ctxt.rnti          = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
-            rab_id    = pdcp_read_header_g.rb_id % maxDRB;
-          }
-
-          CHECK_CTXT_ARGS(&ctxt);
-          AssertFatal (rab_id    < maxDRB,                       "RB id is too high (%u/%d)!\n", rab_id, maxDRB);
-          /*LGpdcp_read_header.inst = (pdcp_read_header_g.inst >= oai_emulation.info.nb_enb_local) ? \
-                  pdcp_read_header_g.inst - oai_emulation.info.nb_enb_local+ NB_eNB_INST + oai_emulation.info.first_ue_local :
-                  pdcp_read_header_g.inst +  oai_emulation.info.first_enb_local;*/
-#else // OAI_EMU
           /* TODO: do we have to reset to 0 or not? not for a scenario with 1 UE at least */
 //          pdcp_read_header_g.inst = 0;
 //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
@@ -590,9 +560,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const  ctxt_pP)
             ctxt.rnti          = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id];
           }
 
-
-#endif
-
           if (ctxt.enb_flag) {
             if (rab_id != 0) {
               rab_id = rab_id % maxDRB;
@@ -804,121 +771,8 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const  ctxt_pP)
   module_id_t          dst_id; // dst for otg
   rb_id_t              rb_id;
   unsigned int         pkt_size=0;
-#if defined(OAI_EMU)
-  module_id_t          src_id;
-  static unsigned int  pkt_cnt_enb=0, pkt_cnt_ue=0;
-
-  Packet_otg_elt_t    *otg_pkt_info=NULL;
-  int                  result;
-  uint8_t              pdcp_mode, is_ue=0;
-#endif
   protocol_ctxt_t      ctxt;
   // we need to add conditions to avoid transmitting data when the UE is not RRC connected.
-#if defined(OAI_EMU)
-
-  if (oai_emulation.info.otg_enabled ==1 ) {
-    // module_id is source id
-    while ((otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[ctxt_pP->instance]))) != NULL) {
-      LOG_I(OTG,"Mod_id %d Frame %d Got a packet (%p), HEAD of otg_pdcp_buffer[%d] is %p and Nb elements is %d\n",
-            ctxt_pP->module_id,
-            ctxt_pP->frame,
-            otg_pkt_info,
-            ctxt_pP->instance,
-            pkt_list_get_head(&(otg_pdcp_buffer[ctxt_pP->instance])),
-            otg_pdcp_buffer[ctxt_pP->instance].nb_elements);
-      //otg_pkt_info = pkt_list_remove_head(&(otg_pdcp_buffer[module_id]));
-      dst_id    = (otg_pkt_info->otg_pkt).dst_id; // type is module_id_t
-      src_id    = (otg_pkt_info->otg_pkt).module_id; // type is module_id_t
-      rb_id     = (otg_pkt_info->otg_pkt).rb_id;
-      is_ue     = (otg_pkt_info->otg_pkt).is_ue;
-      pdcp_mode = (otg_pkt_info->otg_pkt).mode;
-      //    LOG_I(PDCP,"pdcp_fifo, pdcp mode is= %d\n",pdcp_mode);
-
-      // generate traffic if the ue is rrc reconfigured state
-      // if (mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id ) > 2 /*RRC_CONNECTED*/) { // not needed: this test is already done in update_otg_enb
-      otg_pkt = (unsigned char*) (otg_pkt_info->otg_pkt).sdu_buffer;
-      pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size;
-
-      if (otg_pkt != NULL) {
-        if (is_ue == 0 ) {
-          PROTOCOL_CTXT_SET_BY_MODULE_ID(
-            &ctxt,
-            src_id,
-            ENB_FLAG_YES,
-            oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
-            ctxt_pP->frame,
-            ctxt_pP->subframe,
-	    src_id);
-
-          LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d/%x) pkt size %d for pdcp mode %d\n",
-                ctxt.module_id,
-                ctxt.frame,
-                pkt_cnt_enb++,
-                src_id,
-                rb_id,
-                src_id,
-                dst_id,
-		oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id],
-                pkt_size,
-                pdcp_mode);
-          result = pdcp_data_req(&ctxt,
-                                 SRB_FLAG_NO,
-                                 rb_id,
-                                 RLC_MUI_UNDEFINED,
-                                 RLC_SDU_CONFIRM_NO,
-                                 pkt_size,
-                                 otg_pkt,
-                                 pdcp_mode);
-          if (result != TRUE) {
-            LOG_W(OTG,"PDCP data request failed!\n");
-          }
-        } else {
-          //rb_id= eNB_index * MAX_NUM_RB + DTCH;
-
-
-          LOG_D(OTG,"[UE %d] Frame %d: sending packet %d from module %d on rab id %d (src %d/%x, dst %d) pkt size %d\n",
-                ctxt_pP->module_id,
-                ctxt_pP->frame,
-                pkt_cnt_ue++,
-                ctxt_pP->module_id,
-                rb_id,
-                src_id,
-		pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id], // [src_id]
-                dst_id,
-                pkt_size);
-          PROTOCOL_CTXT_SET_BY_MODULE_ID(
-            &ctxt,
-            ctxt_pP->module_id, //src_id,
-            ENB_FLAG_NO,
-            pdcp_UE_UE_module_id_to_rnti[ctxt_pP->module_id],// [src_id]
-            ctxt_pP->frame,
-            ctxt_pP->subframe,
-	    dst_id);
-
-          result = pdcp_data_req( &ctxt,
-                                  SRB_FLAG_NO,
-                                  rb_id,
-                                  RLC_MUI_UNDEFINED,
-                                  RLC_SDU_CONFIRM_NO,
-                                  pkt_size,
-                                  otg_pkt,
-                                  PDCP_TRANSMISSION_MODE_DATA);
-          if (result != TRUE) {
-            LOG_W(OTG,"PDCP data request failed!\n");
-          }
-        }
-
-        free(otg_pkt);
-        otg_pkt = NULL;
-      }
-
-      // } //else LOG_D(OTG,"ctxt_pP->frame %d enb %d-> ue %d link not yet established state %d  \n", ctxt_pP->frame, eNB_index,dst_id - NB_eNB_INST, mac_get_rrc_status(module_id, ctxt_pP->enb_flag, dst_id - NB_eNB_INST));
-
-    }
-  }
-
-#else
-
   if ((otg_enabled==1) && (ctxt_pP->enb_flag == ENB_FLAG_YES)) { // generate DL traffic
     unsigned int ctime=0;
     ctime = ctxt_pP->frame * 100;
@@ -967,6 +821,4 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t* const  ctxt_pP)
       }
     }
   }
-
-#endif
 }
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
index e0a0c062d7..0df8e59e6d 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
@@ -101,13 +101,8 @@ pdcp_netlink_init(
   struct sched_param sched_param;
 
   reset_meas(&ip_pdcp_stats_tmp);
-#if defined(OAI_EMU)
-  nb_inst_enb = oai_emulation.info.nb_enb_local;
-  nb_inst_ue  = oai_emulation.info.nb_ue_local;
-#else
   nb_inst_enb = 1;
   nb_inst_ue  = 1;
-#endif
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
   nb_inst_enb = 0;
@@ -259,24 +254,7 @@ void *pdcp_netlink_thread_fct(void *arg)
           }
         } else {
           pdcp_thread_read_state = 0;
-
-#ifdef OAI_EMU
-
-          // LG: new_data_p->pdcp_read_header.inst will contain in fact a module id
-          if (new_data_p->pdcp_read_header.inst >= oai_emulation.info.nb_enb_local) {
-            module_id = new_data_p->pdcp_read_header.inst
-                                                - oai_emulation.info.nb_enb_local +
-                                                + oai_emulation.info.first_ue_local;
-            eNB_flag = 0;
-          } else {
-            module_id = new_data_p->pdcp_read_header.inst
-                                                + oai_emulation.info.first_enb_local;
-            eNB_flag = 1;
-          }
-
-#else
           module_id = 0;
-#endif
           new_data_p->data = malloc(sizeof(uint8_t) * new_data_p->pdcp_read_header.data_size);
           /* Copy the data */
           memcpy(new_data_p->data, NLMSG_DATA(nas_nlh_rx), new_data_p->pdcp_read_header.data_size);
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
index 0200ffdbf8..0b6be93d59 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c
@@ -110,9 +110,7 @@ int init_pdcp_thread(void)
 
   p.sched_priority = OPENAIR_THREAD_PRIORITY;
   pthread_attr_setschedparam  (&pdcp_thread_attr, &p);
-#ifndef RTAI_ISNT_POSIX
   pthread_attr_setschedpolicy (&pdcp_thread_attr, SCHED_FIFO);
-#endif
   pthread_mutex_init(&pdcp_mutex,NULL);
   pthread_cond_init(&pdcp_cond,NULL);
 
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index d70d85f2d5..d27d46ff42 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -135,11 +135,6 @@ rlc_op_status_t rlc_stat_req     (
   hash_key_t             key             = HASHTABLE_NOT_A_KEY_VALUE;
   hashtable_rc_t         h_rc;
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
   AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
   key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
   h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
@@ -346,11 +341,6 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t* const ctxt_pP,
 #else
   AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP);
 #endif
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
 
 #if T_TRACER
   if (ctxt_pP->enb_flag)
diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c
index 6793e71c54..497937d073 100644
--- a/openair2/LAYER2/RLC/rlc_mac.c
+++ b/openair2/LAYER2/RLC/rlc_mac.c
@@ -157,13 +157,6 @@ tbs_size_t mac_rlc_data_req(
     AssertFatal (channel_idP < NB_RB_MAX,        "channel id is too high (%u/%d)!\n",     channel_idP, NB_RB_MAX);
   }
 
-#ifdef OAI_EMU
-  CHECK_CTXT_ARGS(&ctxt);
-  //printf("MBMS_flagP %d, MBMS_FLAG_NO %d \n",MBMS_flagP, MBMS_FLAG_NO);
-  //  AssertFatal (MBMS_flagP == MBMS_FLAG_NO ," MBMS FLAG SHOULD NOT BE SET IN mac_rlc_data_req in UE\n");
-
-#endif
-
   if (MBMS_flagP) {
     if (enb_flagP) {
       mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
@@ -256,18 +249,6 @@ void mac_rlc_data_ind     (
   }
 
 #endif // DEBUG_MAC_INTERFACE
-#ifdef OAI_EMU
-
-  if (MBMS_flagP)
-    AssertFatal (channel_idP < RLC_MAX_MBMS_LC,  "channel id is too high (%u/%d)!\n",
-                 channel_idP, RLC_MAX_MBMS_LC);
-  else
-    AssertFatal (channel_idP < NB_RB_MAX,        "channel id is too high (%u/%d)!\n",
-                 channel_idP, NB_RB_MAX);
-
-  CHECK_CTXT_ARGS(&ctxt);
-
-#endif
 
 #if T_TRACER
   if (enb_flagP)
@@ -347,31 +328,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
   memset (&mac_rlc_status_resp, 0, sizeof(mac_rlc_status_resp_t));
   memset (&tx_status          , 0, sizeof(struct mac_status_ind));
 
-#ifdef OAI_EMU
-
-  if (MBMS_flagP)
-    AssertFatal (channel_idP < RLC_MAX_MBMS_LC,
-                 "%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
-                 (enb_flagP) ? "eNB" : "UE",
-                 channel_idP,
-                 RLC_MAX_MBMS_LC,
-                 module_idP,
-                 rntiP);
-  else
-    AssertFatal (channel_idP < NB_RB_MAX,
-                 "%s channel id is too high (%u/%d) enb module id %u ue %u!\n",
-                 (enb_flagP) ? "eNB" : "UE",
-                 channel_idP,
-                 NB_RB_MAX,
-                 module_idP,
-                 rntiP);
-
-  CHECK_CTXT_ARGS(&ctxt);
-
-#endif
-
-
-
   if (MBMS_flagP) {
     if (enb_flagP) {
       mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[module_idP][channel_idP];
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index 68f5971bf1..dee6ba7000 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -33,9 +33,6 @@
 #include "rlc_um.h"
 #include "rlc_tm.h"
 #include "UTIL/LOG/log.h"
-#ifdef OAI_EMU
-#include "UTIL/OCG/OCG_vars.h"
-#endif
 #include "RLC-Config.h"
 #include "DRB-ToAddMod.h"
 #include "DRB-ToAddModList.h"
@@ -88,12 +85,6 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t   * const ctxt_pP
   LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ ASN1 \n",
         PROTOCOL_CTXT_ARGS(ctxt_pP));
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
-
   if (srb2add_listP != NULL) {
     for (cnt=0; cnt<srb2add_listP->list.count; cnt++) {
       rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
@@ -489,10 +480,6 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
   rlc_union_t           *rlc_union_p = NULL;
 #if defined(Rel10) || defined(Rel14)
   rlc_mbms_id_t         *mbms_id_p  = NULL;
-#endif
-#ifdef OAI_EMU
-  CHECK_CTXT_ARGS(ctxt_pP)
-
 #endif
 
   /* for no gcc warnings */
@@ -597,12 +584,6 @@ rlc_union_t* rrc_rlc_add_rlc   (
   logical_chan_id_t      lcid            = 0;
 #endif
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
-
   if (MBMS_flagP == FALSE) {
     AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
     AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
@@ -706,11 +687,6 @@ rlc_op_status_t rrc_rlc_config_req   (
         PROTOCOL_CTXT_ARGS(ctxt_pP),
         rb_idP);
 
-#ifdef OAI_EMU
-
-  CHECK_CTXT_ARGS(ctxt_pP)
-
-#endif
   AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
 
   switch (actionP) {
diff --git a/openair2/LAYER2/register.c b/openair2/LAYER2/register.c
deleted file mode 100644
index 6d869a9508..0000000000
--- a/openair2/LAYER2/register.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*________________________rrc_register.c________________________
-
- Authors : Hicham Anouar, Raymond Knopp
- Company : EURECOM
- Emails  : anouar@eurecom.fr,  knopp@eurecom.fr
-________________________________________________________________*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <pthread.h>
-
-#include "COMMON/openair_types.h"
-#include "MAC/extern.h"
-
-#include <linux/module.h>
-
-
-
diff --git a/openair2/Makefile b/openair2/Makefile
deleted file mode 100755
index 2fbeb193a6..0000000000
--- a/openair2/Makefile
+++ /dev/null
@@ -1,254 +0,0 @@
-#/*
-# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
-# * contributor license agreements.  See the NOTICE file distributed with
-# * this work for additional information regarding copyright ownership.
-# * The OpenAirInterface Software Alliance licenses this file to You under
-# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
-# * except in compliance with the License.
-# * You may obtain a copy of the License at
-# *
-# *      http://www.openairinterface.org/?page_id=698
-# *
-# * Unless required by applicable law or agreed to in writing, software
-# * distributed under the License is distributed on an "AS IS" BASIS,
-# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# * See the License for the specific language governing permissions and
-# * limitations under the License.
-# *-------------------------------------------------------------------------------
-# * For more information about the OpenAirInterface (OAI) Software Alliance:
-# *      contact@openairinterface.org
-# */
-
-####################################################
-#       USER SPACE CODE GENERATION
-####################################################
-
-#---------------------------------------------------
-#
-#---------------------------------------------------
-
-
-#LM_LICENSE_FILE=
-#export LM_LICENSE_FILE
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-KERNEL_NAME:=$(shell uname -r)
-NUM_CORES=$(shell getconf _NPROCESSORS_CONF)
-
-export SET_UM=$(shell if grep --silent User\ Mode\ Linux /proc/cpuinfo ; then echo "ARCH=um" ; else echo ""; fi)
-
-#SUBDIRS_openair_USERRF  =   $(MAIN_RT_DIR) $(CONFIG_DIR)
-
-#openair_USERRFDIR  = openair_RFOBJS
-#openair_USERRFLIBS = $(addsuffix /${openair_USERRFDIR}/Lib.a, ${SUBDIRS_openair_USERRF})
-#openair_USERRFOBJS = $(addsuffix /${openair_USERRFDIR}/*.o, ${SUBDIRS_openair_USERRF})
-#openair_USERRFDEPS = $(addsuffix /${openair_USERRFDIR}/*.d, ${SUBDIRS_openair_USERRF})
-
-mac_sim_no_netlink:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim MASTER=1)
-
-mac_sim:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim MASTER=1 NETLINK=1 NO_RRM=1)
-
-mac_sim_rrm:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_rrm MASTER=1 NETLINK=1)
-
-mac_sim_mt_cellular:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_mt CELLULAR=1 NO_RRM=1)
-
-mac_sim_rg_cellular:
-	( cd SIMULATION/USER_TOOLS/LAYER2_SIM && make mac_sim_rg MASTER=1 CELLULAR=1 NO_RRM=1)
-
-openair_layer2_emul.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` NO_RRM=1 PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 PHYEMUL=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_emul_rrm.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 PHYEMUL=1 && mv openair_l2.ko openair_layer2.ko)
-
-
-openair_layer2.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` NO_RRM=1 PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_rrm.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2.ko)
-
-openair_layer2_2615.ko:
-	(cd LAYER2 && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 MASTER=1 OPEN_AIR=1 OPENAIR1=1 && mv openair_l2.ko openair_layer2_2615.ko)
-
-
-openair_rrc.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 NO_RRM=1 && mv openair_rrc.ko openair_RRC.ko)
-
-openair_rrc_rrm.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 && mv openair_rrc.ko openair_RRC.ko)
-
-
-openair_rrc_2615.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 && mv openair_rrc.ko openair_RRC_2615.ko)
-
-openair_rrc_emul.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 PHYEMUL=1 NO_RRM=1)
-
-openair_rrc_emul_rrm.ko:
-	(cd RRC/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 PHYEMUL=1)
-
-
-openair_emul.ko:
-	(cd SIMULATION/PHY_EMULATION/DEVICE_DRIVER/ && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1 NO_RRM=1)
-
-openair_emul_rrm.ko:
-	(cd SIMULATION/PHY_EMULATION/DEVICE_DRIVER/ && $(MAKE) V=1 -C $(KERNEL_DIR)/build  M=`pwd` PCTARGET=1 RTAI=1 OPEN_AIR=1 MASTER=1)
-
-
-
-create_device:
-	rm -f /dev/openair0
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-
-install_emul:
-	make devs
-	make fifos
-	(insmod SIMULATION/PHY_EMULATION/DEVICE_DRIVER/openair_emul.ko)
-	(insmod LAYER2/openair_layer2.ko)
-	(insmod RRC/MESH/openair_rrc.ko)
-	(insmod NETWORK_DRIVER/MESH/nasmesh.ko)
-
-remove_emul:
-	rmmod  nasmesh
-	sleep 1
-	rmmod  openair_rrc
-	sleep 1
-	rmmod  openair_l2
-	sleep 1
-	rmmod  openair_emul
-
-
-clean_nasmesh:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-nasmesh_address_fix.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) V=1 ADDRESS_FIX=1 -C $(KERNEL_DIR)/build M=`pwd`)
-
-nasmesh.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) V=1 -C $(KERNEL_DIR)/build M=`pwd`)
-
-# automatically detect the linux header files for driver compilation
-nasmesh_netlink.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-naslite_netlink_ether.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-oai_nw_ether.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-oai_nw_drv.ko:
-	(cd NETWORK_DRIVER/LITE && $(MAKE) -j$(NUM_CORES) $(SET_UM) OAI_NW_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nasmesh_netlink_address_fix.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 ADDRESS_FIX=1  V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-
-nasmesh_netlink_loopback.ko:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) $(SET_UM) PDCP_USE_NETLINK=1 LOOPBACK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-# drivers cellular version
-nascellmt_netlink.ko:
-	(cd NAS/DRIVER/CELLULAR/NASMT && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nascellmt_clean.ko:
-	(cd NAS/DRIVER/CELLULAR/NASMT && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-nascellrg_netlink.ko:
-	(cd NAS/DRIVER/CELLULAR/NASRG && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-nascellrg_clean.ko:
-	(cd NAS/DRIVER/CELLULAR/NASRG && $(MAKE) -j$(NUM_CORES) $(SET_UM) NAS_DRIVER_TYPE_ETHERNET=1 PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` clean)
-
-# Driver for UE using LTE core network (MME, S+P-GW)
-ue_ip.ko:
-	(cd NETWORK_DRIVER/UE_IP && $(MAKE) -j$(NUM_CORES) $(SET_UM) PDCP_USE_NETLINK=1 OAI_NW_DRIVER_USE_NETLINK=1 V=1 -C $(KERNEL_DIR)/build M=`pwd` modules)
-
-
-rt_emul:
-	(cd SIMULATION/USER_TOOLS/RT_EMUL_LAUNCHER && $(MAKE))
-
-bypass_phy:
-	(cd SIMULATION/PHY_EMULATION/TRANSPORT/KERNEL_INTERFACE && $(MAKE))
-
-rb_tool:
-	(cd NETWORK_DRIVER/MESH/RB_TOOL && $(MAKE))
-
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-#	cp arch/openair_CardBus_MIMO1/device_driver/openair_rf.ko $(KERNEL_DIR)/openair/
-#	depmod -aq
-
-devs:
-	if ! test -a /dev/openair0;\
-	then \
-	mknod /dev/openair0 c 127 0;\
-	chmod a+rw /dev/openair0;\
-	fi;
-
-load_sounder_ue: install_cbmimo1_ublaze
-	insmod mac/chansounder/openair_chansounder_ue.ko
-
-load_sounder_nodeb: install_platon
-	(cd openair_rf && ./openair_rf_platon 1917600 0 ../arch/platon/rbt_files/DAQ_B.rbt 30p 15p 10p 25p && ./openair_rf_platon 1917600 0 ../arch/platon/rbt_files/daq_platon_11_2005.rbt 30p 15p 10p 25p)
-
-
-stop_sounder:
-	rmmod openair_chansounder
-	rmmod openair_rf
-
-stop_sounder_nodeb:
-	(cd openair_rf && ./openair_rf_platon 1907600 4)
-	rmmod openair_chansounder
-	rmmod openair_rf
-
-
-emul_rt:
-	(cd SIMULATION/USER_TOOLS/RT_EMUL_LAUNCHER && $(MAKE))
-
-clean:
-	(cd NETWORK_DRIVER/MESH && $(MAKE) clean)
-	(cd NETWORK_DRIVER/LITE && $(MAKE) clean)
-	rm -rf NETWORK_DRIVER/MESH/RB_TOOL/rb_tool
-	rm -rf NETWORK_DRIVER/LITE/RB_TOOL/rb_tool
-
-cleanall:
-	find -name *.o -delete -print
-	find -name *.ko -delete -print
-	find -name *~ -delete -print
-	find -name *.bak -delete -print
-	rm -rf NETWORK_DRIVER/MESH/RB_TOOL/rb_tool
-	rm -rf NETWORK_DRIVER/LITE/RB_TOOL/rb_tool
-
-
-cleansvn:
-	rm -rf `find -name *.svn* -print` ; \
-	find -name *.svn* -delete -print
-
-tgz:
-	mkdir /tmp/openair2_tmp; \
-	$(MAKE) cleanall; \
-	cp -r . /tmp/openair2_tmp; \
-	(cd /tmp/openair2_tmp && $(MAKE) cleansvn && cd .. && tar czfv openair2.tgz openair2_tmp) ; \
-	cp /tmp/openair2.tgz . ;\
-	rm -rf /tmp/openair2_tmp
-
-print:
-	@echo $(IS_KERNEL_OPENAIRINTERFACE)
-	@echo $(KERNEL_DIR)
-	@echo $(IS_LINUX)
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile b/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile
deleted file mode 100755
index 427a9fad51..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# Lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-# You can modify the below as well, but probably
-# won't need to.
-
-#CC = egcs
-
-#UPDIR	:= $(shell /bin/pwd)
-#GRAAL_DIR  =$(UPDIR)/..
-#RRC_DIR =$(UPDIR)/../../../AS/L3/RRC
-
-CELL_UPDIR := $(shell /bin/pwd)
-NAS_DIR := $(OPENAIR2_DIR)/NAS/DRIVER/CELLULAR/NASMT
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-CFLAGS = -Wall -g -I$(NAS_DIR) -I$(RRC_DIR)
-
-COMPILE = $(CC) $(CFLAGS) -c
-
-OBJS = nascell_ioctl.o
-
-EXECUTABLE = gioctl
-
-# "all" is the default target. Simply make it point to myprogram.
-
-all: $(EXECUTABLE)
-
-# Define the components of the program, and how to link them together.
-# These components are defined as dependencies; that is, they must be
-# made up-to-date before the code is linked.
-
-$(EXECUTABLE): $(OBJS)
-	$(CC) $(CFLAGS) -o $(EXECUTABLE) $(OBJS)
-
-# Add any special rules here.
-
-# Specify that all .o files depend on .c files, and indicate how
-# the .c files are converted (compiled) to the .o files.
-
-%.o: %.c
-	$(COMPILE) -o $@ $<
-
-clean:
-	-rm $(OBJS) $(EXECUTABLE)
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c b/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c
deleted file mode 100644
index 0b520ed151..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include "nascell_ioctl.h"
-#include "rrc_nas_primitives.h"
-//#include "rrc_qos.h"
-//#include "graal_local.h"
-#include "nasmt_constant.h"
-#include "nasmt_iocontrol.h"
-#define USHRT_MAX 255
-//---------------------------------------------------------------------------
-void print_error(int status)
-{
-  //---------------------------------------------------------------------------
-  switch(status) {
-  case -NAS_ERROR_NOMEMORY:
-    printf(" The memory is low\n");
-    break;
-
-  case -NAS_ERROR_NORB:
-    printf(" The radio bearer is not identified\n");
-    break;
-
-  case -NAS_ERROR_NOTMT:
-    printf(" The entity must be a mobile\n");
-    break;
-
-  case -NAS_ERROR_NOTRG:
-    printf(" The entity must be an access router\n");
-    break;
-
-  case -NAS_ERROR_NOTIDLE:
-    printf(" The selected connection or radio bearer must be IDLE\n");
-    break;
-
-  case -NAS_ERROR_NOTCONNECTED:
-    printf(" The selected connection or radio bearer must be CONNECTED\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTLCR:
-    printf(" The LCR value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTDIR:
-    printf(" The DIR value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTDSCP:
-    printf(" The DSCP value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTVERSION:
-    printf(" The version value is not correct\n");
-    break;
-
-  case -NAS_ERROR_NOTCORRECTRABI:
-    printf(" The rab_id value is not correct\n");
-    break;
-
-  case -NAS_ERROR_ALREADYEXIST:
-    printf(" Some components must not be duplicated\n");
-    break;
-
-  default:
-    printf(" Unknown error cause %d\n", status);
-  }
-}
-
-//---------------------------------------------------------------------------
-void print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case NAS_IDLE:
-    printf("NAS_IDLE\n");
-    return;
-
-    //  case NAS_STATE_CONNECTED:printf("NAS_STATE_CONNECTED\n");return;
-    //  case NAS_STATE_ESTABLISHMENT_REQUEST:printf("NAS_STATE_ESTABLISHMENT_REQUEST\n");return;
-    //  case NAS_STATE_ESTABLISHMENT_FAILURE:printf("NAS_STATE_ESTABLISHMENT_FAILURE\n");return;
-    //  case NAS_STATE_RELEASE_FAILURE:printf("NAS_STATE_RELEASE_FAILURE\n");return;
-  case  NAS_CX_FACH:
-    printf("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printf("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printf("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printf("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printf("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printf("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printf("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printf("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printf("NAS_RB_RELEASING\n");
-    return;
-
-  default:
-    printf(" Unknown state\n");
-  }
-}
-
-//---------------------------------------------------------------------------
-void print_usage_class()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl class add {send <lcr>|receive} -f {qos <rab_id>|del|ctl|dc} -cr <classref> [-dscp <dscp>] [-ip {6|4} <saddr> <splen> <daddr> <dplen>] [-p {tcp|udp|icmp4|icmp6} <sport> <dport>]\n");
-  printf("Usage: gioctl class del {send <lcr>|receive} -cr <classref> [-dscp <dscp>] \n");
-  printf("Usage: gioctl class list {send <lcr>|receive} [-dscp <dscp>]\n");
-}
-//---------------------------------------------------------------------------
-void print_usage_cx()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl cx add <lcr> <cellid>\n");
-  printf("Usage: gioctl cx del <lcr>\n");
-  printf("Usage: gioctl cx list\n");
-}
-//---------------------------------------------------------------------------
-void print_usage_rb()
-{
-  //---------------------------------------------------------------------------
-  printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
-  printf("Usage: gioctl rb list <lcr>\n");
-}
-
-//---------------------------------------------------------------------------
-int main(int argc, char *argv[])
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl gifr;
-  int err, fd;
-
-  // Invalid number of arguments
-  if (argc<2) {
-    printf("Usage: gioctl statistic\n");
-    print_usage_cx();
-    print_usage_rb();
-    print_usage_class();
-    return  -1;
-  }
-
-  // Get an UDP IPv6 socket ??
-  fd=socket(AF_INET6, SOCK_DGRAM, 0);
-
-  if (fd<0)  {
-    printf("Error opening socket\n");
-    return 0;
-  }
-
-  strcpy(gifr.name, "oai0");
-  printf("Socket opened successfully\n");
-
-  /***************************/
-  if (strcmp(argv[1], "statistic")==0) {
-    struct nas_msg_statistic_reply *msgrep;
-    gifr.type=NAS_MSG_STATISTIC_REQUEST;
-    gifr.msg=(char *)malloc(sizeof(msgrep));
-    msgrep=(struct nas_msg_statistic_reply *)(gifr.msg);
-    printf(" Statistics requested\n");
-    err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-    if (err<0) {
-      printf("IOCTL error, err=%d\n",err);
-      return -1;
-    }
-
-    printf("tx_packets = %u, rx_packets = %u\n", msgrep->tx_packets, msgrep->rx_packets);
-    printf("tx_bytes = %u, rx_bytes = %u\n", msgrep->tx_bytes, msgrep->rx_bytes);
-    printf("tx_errors = %u, rx_errors = %u\n", msgrep->tx_errors, msgrep->rx_errors);
-    printf("tx_dropped = %u, rx_dropped = %u\n", msgrep->tx_dropped, msgrep->rx_dropped);
-    return 0;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "cx")==0) {
-    if (argc<3) {
-      print_usage_cx();
-      return -1;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx add <lcr> <cellid>\n");
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_cx_establishment_request *msgreq;
-      struct nas_msg_cx_establishment_reply *msgrep;
-
-      if (argc<5) {
-        print_usage_cx();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CX_ESTABLISHMENT_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_cx_establishment_request *)(gifr.msg);
-      msgrep=(struct nas_msg_cx_establishment_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->cellid=strtoul(argv[4], NULL, 0);
-      //
-      printf(" Connection establishment requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        perror("Connection establishment IOCTL error\n");
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Connexion establishment failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx del <lcr>\n");
-    if (strcmp(argv[2], "del")==0) {
-      struct nas_msg_cx_release_request *msgreq;
-      struct nas_msg_cx_release_reply *msgrep;
-
-      if (argc<4) {
-        print_usage_cx();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CX_RELEASE_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_cx_release_request *)(gifr.msg);
-      msgrep=(struct nas_msg_cx_release_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      //
-      printf(" Connexion release requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Connexion release failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl cx list\n");
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t i;
-      struct nas_msg_cx_list_reply *list;
-      uint8_t lcr;
-      gifr.type=NAS_MSG_CX_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1);
-      msgrep=(uint8_t *)(gifr.msg);
-      //
-      printf(" Connexion list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("Lcr\t\tCellId\tIID4\tIID6\t\t\tnrb\tnsclass\tState\n");
-      list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-      for(lcr=0; lcr<msgrep[0]; ++lcr) {
-        printf("%u\t\t%u\t%u\t", list[lcr].lcr, list[lcr].cellid, list[lcr].iid4);
-
-        for (i=0; i<8; ++i)
-          printf("%02x", *((uint8_t *)list[lcr].iid6+i));
-
-        printf("\t%u\t%u\t", list[lcr].num_rb, list[lcr].nsclassifier);
-        print_state(list[lcr].state);
-      }
-
-      return 0;
-    }
-
-    print_usage_cx();
-    return -1;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "rb")==0) {
-    if (argc<3) {
-      print_usage_rb();
-      return -1;
-    }
-
-    /***/
-    //  printf("Usage: gioctl rb add <lcr> <rab_id> <qos>\n");
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_rb_establishment_request *msgreq;
-      struct nas_msg_rb_establishment_reply *msgrep;
-
-      if (argc<6) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_ESTABLISHMENT_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_rb_establishment_request *)(gifr.msg);
-      msgrep=(struct nas_msg_rb_establishment_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->rab_id=strtoul(argv[4], NULL, 0);
-      msgreq->qos=strtoul(argv[5], NULL, 0);
-      //
-      printf(" Radio bearer establishment requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Radio bearer establishment failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "del")==0) {
-      struct nas_msg_rb_release_request *msgreq;
-      struct nas_msg_rb_release_reply *msgrep;
-
-      if (argc<5) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_RELEASE_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_rb_release_request *)(gifr.msg);
-      msgrep=(struct nas_msg_rb_release_reply *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      msgreq->rab_id=strtoul(argv[4], NULL, 0);
-      //
-      printf(" Radio Bearer release requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Radio bearer release failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    //  printf("Usage: gioctl rb list <lcr>\n");
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t rbi;
-      struct nas_msg_rb_list_reply *list;
-      struct nas_msg_rb_list_request *msgreq;
-
-      if (argc<4) {
-        print_usage_rb();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_RB_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1);
-      msgreq=(struct nas_msg_rb_list_request *)(gifr.msg);
-      msgrep=(uint8_t *)(gifr.msg);
-      msgreq->lcr=strtoul(argv[3], NULL, 0);
-      //
-      printf(" Radio bearer list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("rab_id\t\tSapi\t\tQoS\t\tState\n");
-      list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-      for(rbi=0; rbi<msgrep[0]; ++rbi) {
-        printf("%u\t\t%u\t\t%u\t\t", list[rbi].rab_id, list[rbi].sapi, list[rbi].qos);
-        print_state(list[rbi].state);
-      }
-
-      return 0;
-    }
-
-    print_usage_rb();
-    return -1;
-  }
-
-  /***************************/
-  if (strcmp(argv[1], "class")==0) {
-    if (argc<3) {
-      print_usage_class();
-      return  -1;
-    }
-
-    /***/
-    if (strcmp(argv[2], "add")==0) {
-      struct nas_msg_class_add_request *msgreq;
-      struct nas_msg_class_add_reply *msgrep;
-      uint8_t i,j;
-      gifr.type=NAS_MSG_CLASS_ADD_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_class_add_request *)(gifr.msg);
-      msgrep=(struct nas_msg_class_add_reply *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          ++i;
-        } else {
-          print_usage_class();
-          return -1;
-        }
-      }
-
-      msgreq->classref=USHRT_MAX;
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-      msgreq->version=NAS_VERSION_DEFAULT;
-      msgreq->protocol=NAS_PROTOCOL_DEFAULT;
-      msgreq->sport=NAS_PORT_DEFAULT;
-      msgreq->dport=NAS_PORT_DEFAULT;
-      msgreq->fct=0;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-cr")==0) {
-          msgreq->classref=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-dscp")==0) {
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-f")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "qos")==0) {
-            msgreq->fct=NAS_FCT_QOS_SEND;
-            msgreq->rab_id=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "del")==0) {
-            msgreq->fct=NAS_FCT_DEL_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "ctl")==0) {
-            msgreq->fct=NAS_FCT_CTL_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "dc")==0) {
-            msgreq->fct=NAS_FCT_DC_SEND;
-            msgreq->rab_id=0;
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        if (strcmp(argv[i], "-ip")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "4")==0) {
-            if (msgreq->version!=NAS_VERSION_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->version=NAS_VERSION_4;
-            inet_pton(AF_INET, argv[++i], (void *)(&msgreq->saddr));
-            msgreq->splen=strtoul(argv[++i], NULL, 0);
-            inet_pton(AF_INET, argv[++i], (void *)(&msgreq->daddr));
-            msgreq->dplen=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "6")==0) {
-            if (msgreq->version!=NAS_VERSION_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->version=NAS_VERSION_6;
-            inet_pton(AF_INET6, argv[++i], (void *)(&msgreq->saddr));
-            msgreq->splen=strtoul(argv[++i], NULL, 0);
-            inet_pton(AF_INET6, argv[++i], (void *)(&msgreq->daddr));
-            msgreq->dplen=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        if (strcmp(argv[i], "-p")==0) {
-          ++i;
-
-          if (strcmp(argv[i], "tcp")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_TCP;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "udp")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_UDP;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "icmp4")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_ICMP4;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          if (strcmp(argv[i], "icmp6")==0) {
-            if (msgreq->protocol!=NAS_PROTOCOL_DEFAULT) {
-              print_usage_class();
-              return -1;
-            }
-
-            msgreq->protocol=NAS_PROTOCOL_ICMP6;
-            msgreq->sport=strtoul(argv[++i], NULL, 0);
-            msgreq->dport=strtoul(argv[++i], NULL, 0);
-            ++i;
-            continue;
-          }
-
-          print_usage_class();
-          return -1;
-        }
-
-        print_usage_class();
-        return -1;
-      }
-
-      if ((msgreq->classref==USHRT_MAX)||(msgreq->fct==0)) {
-        print_usage_class();
-        return -1;
-      }
-
-      printf(" Class add requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Class add failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "del")==0) {
-      uint8_t i;
-      struct nas_msg_class_del_request *msgreq;
-      struct nas_msg_class_del_reply *msgrep;
-      gifr.type=NAS_MSG_CLASS_DEL_REQUEST;
-      gifr.msg=(char *)malloc(sizeof(msgrep)<sizeof(msgreq)?sizeof(msgreq):sizeof(msgrep));
-      msgreq=(struct nas_msg_class_del_request *)(gifr.msg);
-      msgrep=(struct nas_msg_class_del_reply *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          ++i;
-        } else {
-          print_usage_class();
-          return -1;
-        }
-      }
-
-      msgreq->classref=USHRT_MAX;
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-cr")==0) {
-          msgreq->classref=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        if (strcmp(argv[i], "-dscp")==0) {
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-          ++i;
-          continue;
-        }
-
-        print_usage_class();
-        return -1;
-      }
-
-      if (msgreq->classref==USHRT_MAX) {
-        print_usage_class();
-        return -1;
-      }
-
-      printf(" Class del requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      if (msgrep->status<0) {
-        printf(" Class add failure: ");
-        print_error(msgrep->status);
-        return -1;
-      }
-
-      return 0;
-    }
-
-    /***/
-    if (strcmp(argv[2], "list")==0) {
-      uint8_t *msgrep;
-      uint8_t cli, i;
-      struct nas_msg_class_list_reply *list;
-      struct nas_msg_class_list_request *msgreq;
-      char addr[45];
-
-      if (argc<4) {
-        print_usage_class();
-        return  -1;
-      }
-
-      gifr.type=NAS_MSG_CLASS_LIST_REQUEST;
-      gifr.msg=(char *)malloc(NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1);
-
-      if (gifr.msg==NULL) {
-        printf(" No memory\n");
-        return -1;
-      }
-
-      msgreq=(struct nas_msg_class_list_request *)(gifr.msg);
-      msgrep=(uint8_t *)(gifr.msg);
-      i=3;
-
-      if (strcmp(argv[i], "send")==0) {
-        msgreq->dir=NAS_DIRECTION_SEND;
-        msgreq->lcr=strtoul(argv[++i], NULL, 0);
-        ++i;
-      } else {
-        if (strcmp(argv[i], "receive")==0) {
-          msgreq->dir=NAS_DIRECTION_RECEIVE;
-          msgreq->lcr=0;
-          ++i;
-        } else {
-          print_usage_class();
-          return  -1;
-        }
-      }
-
-      msgreq->dscp=NAS_DSCP_DEFAULT;
-
-      while (i<argc) {
-        if (strcmp(argv[i], "-dscp")==0)
-          msgreq->dscp=strtoul(argv[++i], NULL, 0);
-      }
-
-      printf(" Classifier list requested\n");
-      err=ioctl(fd, NASMT_IOCTL_RAL, &gifr);
-
-      //
-      if (err<0) {
-        printf("IOCTL error, err=%d\n",err);
-        return -1;
-      }
-
-      printf("Lcr\trab_id\tCref\tFct\t(Vers., saddr, daddr)\t\t\t\t(Proto., Sport, Dport)\n");
-      list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-      for(cli=0; cli<msgrep[0]; ++cli) {
-        printf("%u\t%u\t%u\t", list[cli].lcr, list[cli].rab_id, list[cli].classref);
-
-        switch(list[cli].fct) {
-        case NAS_FCT_QOS_SEND:
-          printf("qos\t");
-          break;
-
-        case NAS_FCT_DEL_SEND:
-          printf("del\t");
-          break;
-
-        case NAS_FCT_CTL_SEND:
-          printf("ctl\t");
-          break;
-
-        case NAS_FCT_DC_SEND:
-          printf("dc\t");
-          break;
-
-        default:
-          printf("?\t");
-        }
-
-        switch(list[cli].version) {
-        case 4:
-          inet_ntop(AF_INET, (void *)&list[cli].saddr, addr, 45);
-          printf("(ip4, %s/%u,", addr, list[cli].splen);
-          inet_ntop(AF_INET, (void *)&list[cli].daddr, addr, 45);
-          printf("%s/%u\t", addr, list[cli].dplen);
-          break;
-
-        case 6:
-          inet_ntop(AF_INET6, (void *)&list[cli].saddr, addr, 45);
-          printf("(ip6, %s/%u", addr, list[cli].splen);
-          inet_ntop(AF_INET6, (void *)&list[cli].daddr, addr, 45);
-          printf("%s/%u\t", addr, list[cli].dplen);
-          break;
-
-        default:
-          printf("(--, --, --)\t\t\t");
-          break;
-        }
-
-        switch(list[cli].protocol) {
-        case IPPROTO_UDP:
-          printf("(udp, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_TCP:
-          printf("(tcp, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_ICMP:
-          printf("(icmp4, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        case IPPROTO_ICMPV6:
-          printf("(icmp6, %u, %u)\t\n", list[cli].sport, list[cli].dport);
-          break;
-
-        default:
-          printf("(--, --, --)\t\n");
-        }
-      }
-
-      return 0;
-    }
-
-    return 0;
-  }
-
-  printf(" Unknown command %s\n",argv[1]);
-  return 0;
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h b/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h
deleted file mode 100644
index 128503094f..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/CTL_TOOL/nascell_ioctl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef _IOCTL_H
-#define _IOCTL_H
-
-#include <sys/ioctl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <net/if.h>
-#include <linux/ipv6.h>
-#include <linux/in.h>
-#include <linux/in6.h>
-//#include <linux/netdevice.h>
-
-//#include <graal_constant.h>
-//#define GRAAL_STATE_IDLE      0
-//#define GRAAL_STATE_CONNECTED     1
-//#define GRAAL_STATE_ESTABLISHMENT_REQUEST 2
-//#define GRAAL_STATE_ESTABLISHMENT_FAILURE 3
-//#define GRAAL_STATE_RELEASE_FAILURE   4
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-
-extern int inet_pton(int af, const char *src, void *dst);
-extern char *inet_ntop(int af, const void *src, char *dst, size_t sise);
-
-#endif //_IOCTL_H
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile b/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile
deleted file mode 100755
index ec14990d63..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# NAS CELLULAR Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,)
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef NAS_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DNAS_DRIVER_TYPE_ETHERNET 
-endif
-
-
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      NASMTCELL extra compilation flags
-####################################################
-#RTAI=1
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nascellmt.o
-nascellmt-objs += nasmt_device.o
-nascellmt-objs += nasmt_common.o
-nascellmt-objs += nasmt_iocontrol.o
-nascellmt-objs += nasmt_classifier.o
-nascellmt-objs += nasmt_tool.o
-nascellmt-objs += nasmt_ascontrol.o
-ifdef PDCP_USE_NETLINK
-nascellmt-objs += nasmt_netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C  $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo subversion : $(SUBVERSION)
-	@echo RRC_DIR $(RRC_DIR)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c
deleted file mode 100644
index 666cbb1a04..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_ascontrol.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_ascontrol.c
-* \brief Access Stratum Control functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifdef NODE_MT
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-//---------------------------------------------------------------------------
-void nasmt_ASCTL_init(void)
-{
-  //---------------------------------------------------------------------------
-  //  struct cx_entity *cx;
-  int i;
-  gpriv->next_sclassref = NASMT_DEFAULTRAB_CLASSREF;
-
-  for (i = 0; i<NASMT_MBMS_SVCES_MAX; i++) {
-    gpriv->cx->joined_services[i]= -1;
-  }
-
-  printk("nasmt_ASCTL_init Complete\n");
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ASCTL_write(int sap, unsigned char *data_buffer, unsigned int data_length)
-{
-  //---------------------------------------------------------------------------
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xmit_buffer [NAS_MESSAGE_MAXLEN];
-  //MT xmit on DC-SAP only
-  xmit_buffer[0] = RRC_NAS_DC0_IN;
-  memcpy (&((char*)xmit_buffer)[1], data_buffer, data_length);
-  bytes_wrote = nasmt_netlink_send(xmit_buffer,data_length, NASNL_DEST_RRC);
-#else
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);  //original version
-  bytes_wrote = rtf_put(sap, data_buffer, data_length);
-#endif //PDCP_USE_NETLINK
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasmt_ASCTL_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("\nnasmt_ASCTL_start_default_sclass - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasmt_ASCTL_start_default_sclass - input parameter cx or rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  gc=nasmt_CLASS_add_sclassifier(cx, NAS_DSCP_DEFAULT, gpriv->next_sclassref);
-
-  //  gc=nasmt_CLASS_add_sclassifier(cx, 5, 0);
-  if (gc==NULL) {
-    printk("nasmt_ASCTL_start_default_sclass - Error - Classifier not added \n");
-    return;
-  }
-
-  gc->fct = nasmt_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASMT_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  //gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  //gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_ASCTL_start_default_sclass - end \n");
-  nasmt_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasmt_ASCTL_start_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("\nnasmt_ASCTL_start_sclass - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_start_sclass - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (rb==NULL) {
-    printk("nasmt_ASCTL_start_sclass - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  gc=nasmt_CLASS_add_sclassifier(cx, rb->dscp, gpriv->next_sclassref);
-
-  //  gc=nasmt_CLASS_add_sclassifier(cx, 5, 0);
-  if (gc==NULL) {
-    printk("nasmt_ASCTL_start_sclass - Error - Classifier not added \n");
-    return;
-  }
-
-  gc->fct = nasmt_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASMT_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_ASCTL_start_sclass - end \n");
-  nasmt_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_ASCTL_timer(unsigned long data)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx;
-  struct rb_entity *rb;
-  spin_lock(&gpriv->lock);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasmt_ASCTL_timer - begin \n");
-#endif
-  (gpriv->timer).function=nasmt_ASCTL_timer;
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-    cx=gpriv->cx+cxi;
-
-    if (cx==NULL) {
-#ifdef NAS_DEBUG_TIMER
-      printk("nasmt_ASCTL_timer - No pointer for connection %d \n", cxi);
-#endif
-      continue;
-    }
-
-    if (cx->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-      printk("nasmt_ASCTL_timer: lcr %u, countimer %u\n", cx->lcr, cx->countimer);
-#endif
-
-      if (cx->countimer==0) {
-        switch (cx->state) {
-        case NAS_CX_CONNECTING:
-        case NAS_CX_CONNECTING_FAILURE:
-          if (cx->retry<gpriv->retry_limit)
-            nasmt_ASCTL_DC_send_cx_establish_request(cx);
-          else {
-            printk("nasmt_ASCTL_timer: Establishment failure\n");
-            cx->state=NAS_IDLE;
-            cx->retry=0;
-            cx->countimer=NAS_TIMER_IDLE;
-          }
-
-          break;
-
-        case NAS_CX_RELEASING_FAILURE:
-          nasmt_ASCTL_DC_send_cx_release_request(cx);
-          break;
-
-        default:
-          printk("nasmt_ASCTL_timer: default value\n");
-          cx->countimer=NAS_TIMER_IDLE;
-        }
-      } else
-        --cx->countimer;
-    }
-
-    for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-      if (rb->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-        printk("nasmt_ASCTL_timer : rb countimer %d, rb state %d\n", rb->countimer, rb->state);
-#endif
-
-        if (rb->countimer==0) {
-          switch (rb->state) {
-          case NAS_RB_DCH:
-#ifdef DEMO_3GSM
-            if (cx->num_rb == 1) {
-              nasmt_ASCTL_start_default_sclassifier(cx, rb);
-            }
-
-#endif
-            nasmt_ASCTL_start_sclassifier(cx, rb);
-            rb->countimer=NAS_TIMER_IDLE;
-            break;
-
-          default:
-            rb->countimer=NAS_TIMER_IDLE;
-          }
-        } else {
-          --rb->countimer;
-          printk("nasmt_ASCTL_timer : rb countimer-- %d, rb state %d\n", rb->countimer, rb->state);
-        }
-      }
-    }
-  }
-
-  add_timer(&gpriv->timer);
-  spin_unlock(&gpriv->lock);
-}
-
-//---------------------------------------------------------------------------
-// Request the sleep of a connexion
-int nasmt_ASCTL_enter_sleep_mode(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_enter_sleep_mode - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_enter_sleep_mode - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  // send peer message to NASRG
-  sig_category = NAS_CMD_ENTER_SLEEP;
-  printk("nasmt_ASCTL_enter_sleep_mode - sig_category %u \n", sig_category);
-  nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-  cx->state=NAS_CX_RELEASING;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Request to reactivate a connexion
-int nasmt_ASCTL_leave_sleep_mode(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_leave_sleep_mode - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_leave_sleep_mode - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  cx->state=NAS_CX_DCH;
-  // send peer message to NASRG
-  sig_category = NAS_CMD_LEAVE_SLEEP;
-  printk("nasmt_ASCTL_leave_sleep_mode - sig_category %u \n", sig_category);
-  nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-  return 0;
-}
-
-/***********************************************
- *  Transmit Functions                         *
- ***********************************************/
-
-//---------------------------------------------------------------------------
-// Request the establishment of a connexion (DC channel)
-int nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_cx_establish - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_send_cx_establish - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-
-  switch (cx->state) {
-  case NAS_CX_CONNECTING:
-  case NAS_CX_CONNECTING_FAILURE:
-  case NAS_IDLE:
-    p= (struct nas_ue_dc_element *)(gpriv->xbuffer);
-    p->type = CONN_ESTABLISH_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASConnEstablishReq);
-    p->nasUEDCPrimitive.conn_establish_req.localConnectionRef = cx->lcr;
-    p->nasUEDCPrimitive.conn_establish_req.cellId = cx->cellid;
-#ifdef NAS_DEBUG_DC
-    printk ("\nCONN_ESTABLISH_REQ Buffer to Xmit: ");
-    nasmt_TOOL_print_buffer((char *)p,p->length);
-#endif
-    ++cx->retry;
-
-    //bytes_wrote = rtf_put(cx->sap[GRAAL_DC_INPUT_SAPI], p, p->length); //original version
-    bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-    //printk("nasmt_ASCTL_DC_send_cx_establish_request - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-    cx->countimer=gpriv->timer_establishment;
-
-    if (bytes_wrote==p->length) {
-      cx->state=NAS_CX_CONNECTING;
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_ASCTL_DC_send_cx_establish - Message sent successfully in DC-FIFO\n");
-      printk(" Local Connection reference %u\n", p->nasUEDCPrimitive.conn_establish_req.localConnectionRef);
-      printk(" Cell Identification %u\n", p->nasUEDCPrimitive.conn_establish_req.cellId);
-      nasmt_TOOL_print_state(cx->state);
-#endif
-    } else {
-      cx->state=NAS_CX_CONNECTING_FAILURE;
-      printk("nasmt_ASCTL_DC_send_cx_establish - Message sent failure in DC-FIFO\n");
-      nasmt_TOOL_print_state(cx->state);
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTIDLE;
-#ifdef NAS_DEBUG_DC
-    printk("nasmt_ASCTL_DC_send_cx_establish - NAS_ERROR_NOTIDLE \n");
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connexion (DC channel)
-int nasmt_ASCTL_DC_send_cx_release_request(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_cx_release - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_send_cx_release - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch (cx->state) {
-  case NAS_CX_RELEASING_FAILURE:
-  case NAS_CX_DCH:
-    p= (struct nas_ue_dc_element *)(gpriv->xbuffer);
-    p->type = CONN_RELEASE_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASConnReleaseReq);
-    p->nasUEDCPrimitive.conn_release_req.localConnectionRef = cx->lcr;
-    p->nasUEDCPrimitive.conn_release_req.releaseCause = NAS_CX_RELEASE_UNDEF_CAUSE;
-
-    //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-    bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-    //printk("nasmt_ASCTL_DC_send_cx_release - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-    if (bytes_wrote==p->length) {
-      cx->state=NAS_IDLE;
-      cx->iid4=0;
-      //      nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-      nasmt_COMMON_flush_rb(cx);
-      nasmt_CLASS_flush_sclassifier(cx);
-
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_ASCTL_DC_send_cx_release - Message sent successfully in DC-FIFO\n");
-      printk(" Local Connection Reference %u\n", p->nasUEDCPrimitive.conn_release_req.localConnectionRef);
-      printk(" Release Cause %u\n", p->nasUEDCPrimitive.conn_release_req.releaseCause);
-      nasmt_TOOL_print_state(cx->state);
-#endif
-    } else {
-      ++cx->retry;
-      cx->countimer=gpriv->timer_release;
-      cx->state=NAS_CX_RELEASING_FAILURE;
-      printk("nasmt_ASCTL_DC_send_cx_release - Message sent failure in DC-FIFO\n");
-      nasmt_TOOL_print_state(cx->state);
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTCONNECTED;
-#ifdef NAS_DEBUG_DC
-    printk("nasmt_ASCTL_DC_send_cx_release - NAS_ERROR_NOTCONNECTED \n");
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasmt_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  char data_type = 'A';
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_sig_data - begin \n");
-#endif
-
-  if (!skb || !gc || !cx) {
-    printk("nasmt_ASCTL_DC_send_sig_data - input parameter skb, gc or cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Not connected, so the message is dropped\n");
-    ++gpriv->stats.tx_dropped;
-    return;
-  }
-
-  p = (struct nas_ue_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasUEDCPrimitive.data_transfer_req.priority = 3;  // TBD
-  p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (skb->len)+1; //adds category character
-
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasmt_ASCTL_DC_send_sig_data - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-  if (bytes_wrote!=p->length) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&data_type, 1);
-  count += 1;
-  bytes_wrote = count;
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)&data_type, 1);
-#endif
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)skb->data, skb->len);
-#endif
-
-  if (bytes_wrote != p->length + skb->len + 1) {
-    printk("nasmt_ASCTL_DC_send_sig_data - Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_sig_data - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasmt_ASCTL_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_category)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ue_dc_element *p;
-  uint8_t nasmt_data[10];
-  unsigned int nasmt_length;
-  char data_type = 'Z';
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_peer_sig_data - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data: Not connected, so the message is dropped\n");
-    return;
-  }
-
-  // Initialize peer message
-  nasmt_length = 10;
-  memset (nasmt_data, 0, nasmt_length);
-  nasmt_data[0]= sig_category;
-  //
-  p = (struct nas_ue_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasUEDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasUEDCPrimitive.data_transfer_req.priority = 3;  // TBD
-  p->nasUEDCPrimitive.data_transfer_req.nasDataLength = (nasmt_length)+1; //adds category character
-
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasmt_ASCTL_DC_send_sig_data - Wrote %d bytes to RRC NAS_DC_INPUT_SAPI\n", bytes_wrote);
-
-  if (bytes_wrote!=p->length) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&data_type, 1);
-  count += 1;
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)&data_type, 1);
-#endif
-
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)nasmt_data, nasmt_length);
-  count += nasmt_length;
-  bytes_wrote = nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasmt_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (char *)nasmt_data, nasmt_length);
-#endif
-
-  if (bytes_wrote != p->length + nasmt_length + 1) {
-    printk("nasmt_ASCTL_DC_send_peer_sig_data - Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_send_peer_sig_data - end \n");
-#endif
-}
-
-/***************************************************************************
-     Reception side
- ***************************************************************************/
-//---------------------------------------------------------------------------
-// Decode CONN_ESTABLISH_RESP message from RRC
-void nasmt_ASCTL_DC_decode_cx_establish_resp(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-
-  uint8_t sig_category;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_cx_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_cx_establish - input parameter cx or p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->retry=0;
-
-  if (p->nasUEDCPrimitive.conn_establish_resp.status == TERMINATED) {
-    cx->state=NAS_CX_DCH; //to be changed to NAS_CX_FACH
-    cx->iid4=1;
-    nasmt_TOOL_imei2iid(NAS_RG_IMEI, (uint8_t *)cx->iid6);
-    sig_category = NAS_CMD_OPEN_RB;
-    //For demo, add automatically a radio bearer
-#ifdef DEMO_3GSM
-    printk("nasmt_ASCTL_DC_decode_cx_establish - sig_category %u \n", sig_category);
-    nasmt_ASCTL_DC_send_peer_sig_data_request(cx, sig_category);
-#endif
-  } else {
-    cx->state=NAS_IDLE;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_cx_establish: CONN_ESTABLISH_RESP\n");
-  printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef);
-  printk(" Connection Establishment status %u\n",p->nasUEDCPrimitive.conn_establish_resp.status);
-  nasmt_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_LOSS_IND message from RRC
-void nasmt_ASCTL_DC_decode_cx_loss_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_cx_loss - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_cx_loss - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_cx_loss - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state=NAS_IDLE;
-  cx->iid4=0;
-  //nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasmt_COMMON_flush_rb(cx);
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_cx_loss: CONN_LOSS_IND reception\n");
-  printk(" Local Connection reference %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-  nasmt_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_RELEASE_IND message from RRC
-//void nasmt_ASCTL_DC_decode_cx_release_ind(struct cx_entity *cx, struct nas_ue_dc_element *p){
-//---------------------------------------------------------------------------
-//      printk("\t\tCONN_RELEASE_IND\n");
-//      printk("\t\tLocal Connection reference %u\n", p->nasUEDCPrimitive.conn_release_ind.localConnectionRef);
-//      printk("\t\tRelease cause %u\n", p->nasRGDCPrimitive.conn_release_ind.releaseCause);
-//      if (gpriv->cx[cxi].state==NAS_CX_DCH)
-//      {
-//        gpriv->cx[cxi].state=NAS_IDLE;
-//        printk("\t\tMobile no more connected\n");
-//        return bytes_read;
-//      }
-//      printk("\t\tIncoherent state %u\n", gpriv->cx[cxi].state);
-//      return bytes_read;
-//}
-
-//---------------------------------------------------------------------------
-// Decode DATA_TRANSFER_IND message from RRC
-void nasmt_ASCTL_DC_decode_sig_data_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  //  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_sig_data - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_sig_data - input parameter cx or p is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_sig_data: DATA_TRANSFER_IND reception\n");
-  printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.data_transfer_ind.localConnectionRef);
-  printk(" Signaling Priority %u\n",p->nasUEDCPrimitive.data_transfer_ind.priority);
-  printk(" NAS Data length %u\n",p->nasUEDCPrimitive.data_transfer_ind.nasDataLength);
-  printk(" NAS Data string %s\n", (uint8_t *)p+p->length);
-#endif
-
-  //nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, cx->sap[GRAAL_DC_OUTPUT_SAPI]); // original
-#ifndef PDCP_USE_NETLINK
-  //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-  nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, NULL, 2, cx->sap[NAS_DC_OUTPUT_SAPI]);
-#else
-  nasmt_COMMON_receive(p->length, p->nasUEDCPrimitive.data_transfer_ind.nasDataLength, (unsigned char *)p+p->length, 2, 0);
-#endif
-
-}
-//---------------------------------------------------------------------------
-// Decode RB_ESTABLISH_IND message from RRC
-void nasmt_ASCTL_DC_decode_rb_establish_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  int hard_coded_rbId = 3;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_rb_establish - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_rb_establish - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_rb_establish - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // TEMP -MW - 26/9/13- Overwrite the rb_id sent by RRC
-  p->nasUEDCPrimitive.rb_establish_ind.rbId = hard_coded_rbId;
-  // TEMP -MW - 26/9/13- Rest should be kept unchanged
-  rb=nasmt_COMMON_search_rb(cx, p->nasUEDCPrimitive.rb_establish_ind.rbId);
-
-  if (rb==NULL) {
-    rb=nasmt_COMMON_add_rb(cx, p->nasUEDCPrimitive.rb_establish_ind.rbId, p->nasUEDCPrimitive.rb_establish_ind.QoSclass);
-    rb->state=NAS_RB_DCH;
-    cx->state=NAS_CX_DCH;
-    rb->dscp = p->nasUEDCPrimitive.rb_establish_ind.dscp;
-    rb->sapi = p->nasUEDCPrimitive.rb_establish_ind.sapId;
-    rb->countimer=1;
-#ifdef NAS_DEBUG_DC
-    printk(" nasmt_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_IND reception\n");
-    printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef);
-    printk(" Radio Bearer Identity %u \n",p->nasUEDCPrimitive.rb_establish_ind.rbId);
-    printk(" QoS Traffic Class %u\n",p->nasUEDCPrimitive.rb_establish_ind.QoSclass);
-    printk(" DSCP Code %u\n",p->nasUEDCPrimitive.rb_establish_ind.dscp);
-    printk(" SAP Id %u\n",p->nasUEDCPrimitive.rb_establish_ind.sapId);
-    nasmt_TOOL_print_state(cx->state);
-    nasmt_TOOL_print_rb_entity(rb);
-#endif
-  } else
-    printk("NAS_MT_DC_DECODE_RB_ESTABLISH_IND: RB_ESTABLISH_IND reception, Radio bearer already opened\n");
-}
-
-//---------------------------------------------------------------------------
-// Decode RB_RELEASE_IND message from RRC
-void nasmt_ASCTL_DC_decode_rb_release_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  uint8_t dscp;
-  int hard_coded_rbId = 3;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_rb_release - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_rb_release - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // TEMP -MW - 26/9/13- Overwrite the rb_id sent by RRC
-  p->nasUEDCPrimitive.rb_release_ind.rbId = hard_coded_rbId;
-  // TEMP -MW - 26/9/13- Rest should be kept unchanged
-  rb=nasmt_COMMON_search_rb(cx, p->nasUEDCPrimitive.rb_release_ind.rbId);
-
-  if (rb!=NULL) {
-#ifdef NAS_DEBUG_DC
-    printk(" nasmt_ASCTL_DC_decode_rb_release : RB_RELEASE_IND reception\n");
-    printk(" Local Connection reference %u\n",p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-    printk(" Radio Bearer Identity %u\n",p->nasUEDCPrimitive.rb_release_ind.rbId);
-    nasmt_TOOL_print_state(cx->state);
-#endif
-    // rb->state=NAS_IDLE;
-    dscp = rb->dscp;
-    nasmt_COMMON_del_rb(cx, p->nasUEDCPrimitive.rb_release_ind.rbId, dscp);
-  } else
-    printk("nasmt_ASCTL_DC_decode_rb_release: RB_RELEASE_IND reception, No corresponding radio bearer\n");
-
-}
-//---------------------------------------------------------------------------
-// Decode MEASUREMENT_IND message from RRC
-void nasmt_ASCTL_DC_decode_measurement_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_measurement - begin \n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_ASCTL_DC_decode_measurement - input parameter cx is NULL \n");
-    return;
-  }
-
-  if (p==NULL) {
-    printk("nasmt_ASCTL_DC_decode_measurement - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC_MEASURE
-  printk(" nasmt_ASCTL_DC_decode_measurement : MEASUREMENT_IND reception\n");
-  printk(" Local Connection reference: %u\n", p->nasUEDCPrimitive.measurement_ind.localConnectionRef);
-  printk(" Number of RGs: %u\n", p->nasUEDCPrimitive.measurement_ind.nb_rg);
-  nasmt_TOOL_print_state(cx->state);
-
-  for (i=0; i<p->nasUEDCPrimitive.measurement_ind.nb_rg; ++i) {
-    printk(" RG[%u]:  Cell_Id %u, Level: %u\n", i,
-           p->nasUEDCPrimitive.measurement_ind.measures[i].cell_id,
-           p->nasUEDCPrimitive.measurement_ind.measures[i].level);
-  }
-
-#endif
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_measurement - Local cell %d\n",p->nasUEDCPrimitive.measurement_ind.measures[0].cell_id);
-#endif
-  cx->num_measures = p->nasUEDCPrimitive.measurement_ind.nb_rg;
-
-  for (i=0; i<cx->num_measures; i++) {
-    cx->meas_cell_id[i]= (int)(p->nasUEDCPrimitive.measurement_ind.measures[i].cell_id);
-    cx->meas_level[i] = (int)(p->nasUEDCPrimitive.measurement_ind.measures[i].level);
-    //npriv->provider_id[i]=;
-  }
-
-  cx->provider_id[0]=25;
-  cx->provider_id[1]=1;
-  cx->provider_id[2]=25;
-
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_UE_NOTIFY_IND message from RRC
-void nasmt_ASCTL_DC_decode_mbms_ue_notify_ind(struct cx_entity *cx, struct nas_ue_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i, j, k;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasmt_ASCTL_DC_decode_mbms_ue_notify - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasmt_ASCTL_DC_decode_mbms_ue_notify - input parameter is NULL \n");
-    return;
-  }
-
-  for (i = 0; i<NASMT_MBMS_SVCES_MAX; i++) {
-    if (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId >=0) {
-      for (j = 0; j<NASMT_MBMS_SVCES_MAX; j++) {
-        if (cx->joined_services[j] ==-1) {
-          cx->joined_services[j]= p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId;
-          break;
-        }
-      }
-    }
-
-    if (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId >=0) {
-      for (k = 0; k<NASMT_MBMS_SVCES_MAX; k++) {
-        if (cx->joined_services[k] == p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId) {
-          cx->joined_services[k]=-1;
-          break;
-        }
-      }
-    }
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC
-  printk(" nasmt_ASCTL_DC_decode_mbms_ue_notify : MBMS_UE_NOTIFY_IND reception\n");
-  printk(" Local Connection reference: %u\n", p->nasUEDCPrimitive.mbms_ue_notify_ind.localConnectionRef);
-  nasmt_TOOL_print_state(cx->state);
-  printk("Joined services: ");
-
-  for (i = 0; i<MAX_MBMS_SERVICES && (int) (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId) >= 0; i++)
-    printk("%d    ", (p->nasUEDCPrimitive.mbms_ue_notify_ind.joined_services[i].mbms_serviceId));
-
-  printk("\n");
-  printk("Left services: ");
-
-  for (i = 0; i<MAX_MBMS_SERVICES && (int) (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId) >= 0; i++)
-    printk("%d    ", (p->nasUEDCPrimitive.mbms_ue_notify_ind.left_services[i].mbms_serviceId));
-
-  printk("\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in DC FIFO and decode it (MT)
-int nasmt_ASCTL_DC_receive(struct cx_entity *cx, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasmt_ASCTL_DC_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_ASCTL_DC_receive - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI] , gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  //
-  if (bytes_read>0) {
-    struct nas_ue_dc_element *p;
-
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_ue_dc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasmt_ASCTL_DC_receive: Problem while reading primitive header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_ue_dc_element *)(buffer);
-#endif
-
-    switch (p->type) {
-    case CONN_ESTABLISH_RESP :
-      if (p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: CONN_ESTABLISH_RESP, Local connection reference not correct %u\n",p->nasUEDCPrimitive.conn_establish_resp.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_CONNECTING:
-          nasmt_ASCTL_DC_decode_cx_establish_resp(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: CONN_ESTABLISH_RESP reception, Invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_LOSS_IND :
-      if (p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: CONN_LOSS_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_RELEASING_FAILURE:
-          cx->retry=0;
-
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_cx_loss_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: CONN_LOSS_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-      //    case CONN_RELEASE_IND :
-      //      break;
-    case DATA_TRANSFER_IND :
-      if (p->nasUEDCPrimitive.data_transfer_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_FACH:
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_sig_data_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_ESTABLISH_IND :
-      if (p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: RB_ESTABLISH_IND reception, Local connexion reference not correct %u\n", p->nasUEDCPrimitive.rb_establish_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_FACH:
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_rb_establish_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: RB_ESTABLISH_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_RELEASE_IND :
-      if (p->nasUEDCPrimitive.rb_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: RB_RELEASE_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_rb_release_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: RB_RELEASE_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    case MEASUREMENT_IND :
-      if (p->nasUEDCPrimitive.measurement_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: MEASUREMENT_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.measurement_ind.localConnectionRef);
-      else {
-        nasmt_ASCTL_DC_decode_measurement_ind(cx,p);
-      }
-
-      break;
-
-    case MBMS_UE_NOTIFY_IND :
-      if (p->nasUEDCPrimitive.rb_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasmt_ASCTL_DC_receive: MBMS_UE_NOTIFY_IND reception, Local connection reference not correct %u\n", p->nasUEDCPrimitive.rb_release_ind.localConnectionRef);
-      else {
-        switch (cx->state) {
-        case NAS_CX_DCH:
-          nasmt_ASCTL_DC_decode_mbms_ue_notify_ind(cx,p);   // process message
-          break;
-
-        default:
-          printk("nasmt_ASCTL_DC_receive: MBMS_UE_NOTIFY_IND reception, Invalid state %u", cx->state);
-        }
-      }
-
-      break;
-
-    default :
-      printk("nasmt_ASCTL_DC_receive: Invalid message received\n");
-    }
-  }
-
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasmt_ASCTL_DC_receive - end \n");
-#endif
-  return bytes_read;
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in GC FIFO and decode it (MT)
-int nasmt_ASCTL_GC_receive(char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read = 0;
-
-#ifdef NAS_DEBUG_GC
-  printk("nasmt_ASCTL_GC_receive - begin \n");
-#endif
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(gpriv->sap[NAS_GC_SAPI], gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  //
-  if (bytes_read>0) {
-    struct nas_ue_gc_element *p;
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_ue_gc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasmt_ASCTL_GC_receive: Problem while reading primitive's header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_ue_gc_element *)(buffer);
-    bytes_read = p->length;
-#endif
-
-    // start decoding message
-    switch (p->type) {
-    case INFO_BROADCAST_IND :
-#ifndef PDCP_USE_NETLINK
-      bytes_read += rtf_get(gpriv->sap[NAS_GC_SAPI], (uint8_t *)p+p->length, p->nasUEGCPrimitive.broadcast_ind.nasDataLength);
-
-      if (bytes_read!=p->length+p->nasUEGCPrimitive.broadcast_ind.nasDataLength) {
-        printk("nasmt_ASCTL_GC_receive: INFO_BROADCAST_IND reception, Problem while reading primitive's data\n");
-        return bytes_read;
-      }
-
-#endif
-#ifdef NAS_DEBUG_GC
-      printk(" nasmt_ASCTL_GC_receive : INFO_BROADCAST_IND reception\n");
-      printk(" Primitive length %d \n", (int)(p->type));
-      printk(" Data length %u\n", p->nasUEGCPrimitive.broadcast_ind.nasDataLength);
-      printk(" Data string %s\n", (uint8_t *)p+p->length);
-#endif
-      return bytes_read;
-
-    default :
-      printk("nasmt_ASCTL_GC_receive: Invalid message received, type %d\n", p->type);
-      nasmt_TOOL_print_buffer(buffer, 16);
-      return -1;
-    }
-  } else
-    return -1;
-}
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c
deleted file mode 100644
index 3cc1ac0879..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_classifier.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_classifier.c
-* \brief Flow classification functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-#include <net/ip6_fib.h>
-#include <net/route.h>
-
-#define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-
-/* Address to accept any incoming messages. */
-#define INADDR_ANY              ((unsigned long int) 0x00000000)
-
-#define NIPADDR(addr) \
-        (uint8_t)(addr & 0x000000FF), \
-        (uint8_t)((addr & 0x0000FF00) >> 8), \
-        (uint8_t)((addr & 0x00FF0000) >> 16), \
-        (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
-        ntohs((addr)->s6_addr16[0]), \
-        ntohs((addr)->s6_addr16[1]), \
-        ntohs((addr)->s6_addr16[2]), \
-        ntohs((addr)->s6_addr16[3]), \
-        ntohs((addr)->s6_addr16[4]), \
-        ntohs((addr)->s6_addr16[5]), \
-        ntohs((addr)->s6_addr16[6]), \
-        ntohs((addr)->s6_addr16[7])
-
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
-        (((__const uint32_t *) (a))[0] == 0                                   \
-         && ((__const uint32_t *) (a))[1] == 0                                \
-         && ((__const uint32_t *) (a))[2] == 0                                \
-         && ((__const uint32_t *) (a))[3] == 0)
-
-#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0])))  \
-         && ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1])))  \
-         && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2])))  \
-         && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
-
-#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0])))  \
-         && ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1])))  \
-         && ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2])))  \
-         && ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
-
-//---------------------------------------------------------------------------
-void nasmt_create_mask_ipv6_addr(struct in6_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  int   u6_addr8_index;
-  int   u6_addr1_index;
-  int   index;
-
-  masked_addrP->s6_addr32[0] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[1] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[2] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[3] = 0xFFFFFFFF;
-
-  u6_addr8_index = prefix_len >> 3;
-  u6_addr1_index = prefix_len & 0x07;
-
-  for (index = u6_addr8_index + 1; index < 16; index++) {
-    masked_addrP->s6_addr[index] = 0;
-  }
-
-  if (u6_addr1_index > 0) {
-    masked_addrP->s6_addr[u6_addr8_index] = 0xFF << (8-u6_addr1_index);
-  }
-}
-//---------------------------------------------------------------------------
-void nasmt_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  if (prefix_len > 32) {
-    prefix_len = 32;
-  }
-
-  masked_addrP->s_addr = 0xFFFFFFFF << (32 - prefix_len);
-  return;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (send direction)
-struct classifier_entity *nasmt_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_sclassifier: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_add_sclassifier - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  //***
-  for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_add_sclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  memset(gc, 0, sizeof(struct classifier_entity));
-  gc->next=cx->sclassifier[dscp];
-  gc->classref=classref;
-  cx->sclassifier[dscp]=gc;
-  ++cx->nsclassifier;
-  ++gpriv->next_sclassref; //increment send classref index - MW 15/01/07
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_sclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (receive direction)
-struct classifier_entity *nasmt_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_rclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->rclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_add_rclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->rclassifier[dscp];
-  gc->classref=classref;
-  gpriv->rclassifier[dscp]=gc;
-  ++gpriv->nrclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_add_rclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CLASS_flush_sclassifier(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_flush_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=cx->sclassifier[dscpi]; gc!=NULL; gc=cx->sclassifier[dscpi]) {
-      cx->sclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  cx->nsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CLASS_flush_rclassifier()
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_rclassifier: begin\n");
-#endif
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=gpriv->rclassifier[dscpi]; gc!=NULL; gc=gpriv->rclassifier[dscpi]) {
-      gpriv->rclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nrclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_flush_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nasmt_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_CLASS_del_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  p=cx->sclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    cx->sclassifier[dscp]=p->next;
-    kfree(p);
-    --cx->nsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --cx->nsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (receive direction)
-void nasmt_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_rclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->rclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->rclassifier[dscp]=p->next;
-    kfree(p);
-    --gpriv->nrclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nrclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_del_rclassifier: end\n");
-#endif
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-struct cx_entity *nasmt_CLASS_cx6(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx6: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-// Navid: the ipv6 classifier is not fully tested
-struct cx_entity *nasmt_CLASS_cx6(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx = NULL;
-  struct classifier_entity *sclassifier= NULL;
-  uint32_t mc_addr_hdr;
-  struct in6_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx6: begin\n");
-#endif
-
-  if (skb) {
-#ifdef NAS_DEBUG_CLASS
-    printk("SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
-    printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
-#endif
-    mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-
-    // First check if multicast [1st octet is FF]
-    if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-      // packet type according to the scope of the multicast packet
-      // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-      case (0x00020000):
-        *paddr_type = NAS_IPV6_ADDR_MC_SIGNALLING;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasmt_CLASS_cx6: multicast packet - signalling \n");
-#endif
-        break;
-
-      default:
-        printk("nasmt_CLASS_cx6: default multicast\n");
-        *paddr_type = NAS_IPV6_ADDR_UNKNOWN;
-      }
-    } else {
-      // This is not multicast, so we should be able to identify the MT
-      *paddr_type = NAS_IPV6_ADDR_UNICAST;
-      cxi = 0;
-      (*cx_index)++;
-      sclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-      while (sclassifier!=NULL) {
-        // verify that this is an IPv6 classifier
-        if ((sclassifier->version == NAS_VERSION_6) || (sclassifier->version == NAS_VERSION_DEFAULT)) {
-          /*LGif (IN6_IS_ADDR_UNSPECIFIED(&(sclassifier->daddr.ipv6))) {
-            printk("nas_CLASS_cx6: addr is null \n");
-            sclassifier = sclassifier->next;
-            continue;
-            }*/
-#ifdef NAS_DEBUG_CLASS
-          printk("cx %d : DSCP %d %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, dscp, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-          //if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
-          // LG: STRANGE
-          if (IN6_IS_ADDR_UNSPECIFIED(&ipv6_hdr(skb)->daddr)) {
-            printk("nasmt_CLASS_cx6: dst addr is null \n");
-            sclassifier = sclassifier->next;
-            continue;
-          }
-
-          nasmt_create_mask_ipv6_addr(&masked_addr, sclassifier->dplen);
-          // Modified MW to check only the iid6
-          masked_addr.s6_addr32[0] = 0x00000000;
-          masked_addr.s6_addr32[1] = 0x00000000;
-
-          if (IN6_ARE_ADDR_MASKED_EQUAL(&ipv6_hdr(skb)->daddr, &(sclassifier->daddr.ipv6), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_cx6: found cx %d: %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-            return &gpriv->cx[cxi];
-          }
-        }
-
-        // Go to next classifier entry for connection
-        sclassifier = sclassifier->next;
-      }
-    }
-  }
-
-  //printk("nas_CLASS_cx6 NOT FOUND: %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&ipv6_hdr(skb)->daddr));
-  return cx;
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasmt_CLASS_cx4(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx4: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasmt_CLASS_cx4(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  unsigned char cxi;
-  uint32_t daddr;
-  struct cx_entity *cx=NULL;
-  struct classifier_entity *pclassifier=NULL;
-  struct in_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_cx4: begin\n");
-#endif
-
-  if (skb!=NULL) {
-    daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
-
-    if (daddr != INADDR_ANY) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_cx4: SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
-      printk(" DEST ADDR %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr));
-#endif
-
-      if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
-        // TO BE CHECKED
-        *paddr_type = NAS_IPV4_ADDR_MC_SIGNALLING;
-      } else {
-        if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) {
-          // TO BE CHECKED
-          *paddr_type = NAS_IPV4_ADDR_BROADCAST;
-        } else {
-          if (IN_CLASSA(ip_hdr(skb)->daddr) || IN_CLASSB(ip_hdr(skb)->daddr) || IN_CLASSC(ip_hdr(skb)->daddr)) {
-            *paddr_type = NAS_IPV4_ADDR_UNICAST;
-            cxi = 0;
-            (*cx_index)++;
-            pclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-            while (pclassifier!=NULL) {
-              // verify that this is an IPv4 classifier
-              if ((pclassifier->version == NAS_VERSION_4)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-                nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-
-                if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasmt_CLASS_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen);
-#endif
-                  return &gpriv->cx[cxi];
-                }
-              }
-
-              // goto to next classification rule for the connection
-              pclassifier = pclassifier->next;
-            }
-          } else {
-            *paddr_type = NAS_IPV4_ADDR_UNKNOWN;
-          }
-        }
-      }
-    }
-  }
-
-  return cx;
-}
-
-//---------------------------------------------------------------------------
-// Search the sending function for IP Packet
-void nasmt_CLASS_send(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity  *pclassifier, *sp;
-  uint8_t *protocolh = NULL;
-  uint8_t version;
-  uint8_t protocol, dscp;
-  uint16_t classref;
-  struct cx_entity *cx;
-#ifdef NAS_DEBUG_CLASS
-  char sfct[10], sprotocol[10];
-#endif
-  struct net_device *dev = gdev;
-  unsigned char cx_index,no_connection;
-  int addr_type;
-  struct in6_addr masked6_addr;
-  struct in_addr  masked_addr;
-  // RARP vars
-  struct arphdr  *rarp;
-  unsigned char  *rarp_ptr;
-  /* s for "source", t for "target" */
-  __be32 sip, tip;
-  unsigned char *sha, *tha;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_send: begin -\n");
-#endif
-
-  if (skb==NULL) {
-    printk("nasmt_CLASS_send - input parameter skb is NULL \n");
-    return;
-  }
-
-  //***
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_CLASS_send - Received IP packet to transmit:");
-
-  if ((skb->data) != NULL) {
-    if (skb->len<100)
-      nasmt_TOOL_print_buffer(skb->data,skb->len);
-    else
-      nasmt_TOOL_print_buffer(skb->data,100);
-  }
-
-#endif
-  //***
-  // find all connections related to socket
-  cx_index   = 0;
-  no_connection = 1;
-  cx = NULL;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_CLASS_send: [before switch on IP protocol version] \n");
-#endif
-
-
-  // Get mobile connexion entity, protocol and dscp from IP packet
-  switch (ntohs(skb->protocol)) {
-  case ETH_P_IPV6:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : IPv6 \n");
-#endif
-    version = NAS_VERSION_6;
-    addr_type = NAS_IPV6_ADDR_UNKNOWN;
-    protocolh = nasmt_TOOL_get_protocol6(ipv6_hdr(skb), &protocol);
-    dscp      = nasmt_TOOL_get_dscp6 (ipv6_hdr(skb));
-    cx        = nasmt_CLASS_cx6 (skb, dscp, &addr_type, &cx_index);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send - ETH_P_IPV6 skb %p dscp %d gpriv %p cx_index %p \n",skb, dscp, gpriv, &cx_index);
-#endif
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV6_ADDR_MC_SIGNALLING:
-      case NAS_IPV6_ADDR_UNICAST:
-        pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-        while (pclassifier!=NULL) {
-          if ((pclassifier->version == NAS_VERSION_6) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-            // ok found default classifier for this packet
-            nasmt_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
-
-            if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
-              // then force dscp
-              cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasmt_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            } else {
-              if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
-                cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasmt_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n");
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              }
-            }
-          }
-
-          pclassifier = pclassifier->next;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV6_ADDR_UNKNOWN:
-      default:
-        printk("nasmt_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-    break;
-
-  case ETH_P_ARP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : ARP \n");
-#endif
-    version = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_BROADCAST;
-    dscp = 0;
-    cx = NULL;
-    // Basic sanity checks can be done without the lock
-    rarp = (struct arphdr *)skb_network_header(skb);
-
-    if (rarp) {
-      if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) {
-        printk("nasmt_CLASS_send: ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n");
-        break;
-      }
-    } else {
-      printk("nasmt_CLASS_send: ARP HEADER POINTER IS NULL\n");
-      break;
-    }
-
-    // If it's not Ethernet, delete it.
-    if (rarp->ar_pro != htons(ETH_P_IP)) {
-      printk("nasmt_CLASS_send: ARP PACKET PROTOCOL IS NOT ETHERNET\n");
-      break;
-    }
-
-    rarp_ptr = (unsigned char *) (rarp + 1);
-    sha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&sip, rarp_ptr, 4);
-    rarp_ptr += 4;
-    tha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&tip, rarp_ptr, 4);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send: ARP DEST IP transport IP = %d.%d.%d.%d\n",NIPADDR(tip));
-#endif
-    pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-    while (pclassifier!=NULL) {
-      if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-        // ok found default classifier for this packet
-        nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-        printk("nasmt_CLASS_send: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addr.s_addr));
-#endif
-
-        //
-        if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) {
-          // then force dscp
-          cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-          printk("nasmt_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n", pclassifier->dplen);
-#endif
-          dscp = NAS_DSCP_DEFAULT;
-          break;
-        } else {
-          if (INADDR_ANY == pclassifier->daddr.ipv4) {
-            cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-            dscp = NAS_DSCP_DEFAULT;
-            break;
-          }
-        }
-      }
-
-      pclassifier = pclassifier->next;
-    }
-
-    break;
-
-  case ETH_P_IP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send : skb->protocol : IPv4 \n");
-#endif
-    version   = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_UNKNOWN;
-    dscp      = nasmt_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
-    cx        = nasmt_CLASS_cx4(skb, dscp, &addr_type, &cx_index);
-    protocolh = nasmt_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol);
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV4_ADDR_MC_SIGNALLING:
-      case NAS_IPV4_ADDR_UNICAST:
-      case NAS_IPV4_ADDR_BROADCAST:
-        pclassifier=(&gpriv->cx[0])->sclassifier[NAS_DSCP_DEFAULT];
-
-        while (pclassifier != NULL) {
-          if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-            // ok found default classifier for this packet
-            nasmt_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-            printk("nasmt_CLASS_send : MASK = %d.%d.%d.%d\n", NIPADDR(masked_addr.s_addr));
-#endif
-
-            if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
-              // then force dscp
-              cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasmt_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            } else {
-              if(INADDR_ANY == pclassifier->daddr.ipv4) {
-                cx = &gpriv->cx[0];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasmt_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              }
-            }
-          }
-
-          pclassifier = pclassifier->next;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV4_ADDR_UNKNOWN:
-      default:
-        printk("nasmt_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-#ifdef NAS_DEBUG_CLASS
-
-    //printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %08X\n",ntohs(skb->protocol),dscp,cx);
-    if (cx)
-      printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %d\n",ntohs(skb->protocol),dscp,cx->lcr);
-    else
-      printk("nasmt_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, No valid connection\n",ntohs(skb->protocol),dscp);
-
-#endif
-    break;
-
-  default:
-    printk("nasmt_CLASS_send: Unknown IP version protocol\n");
-    version = 0;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_CLASS_send: [before if (cx != NULL)]\n");
-#endif
-
-  // If a valid connection for the DSCP/EXP with destination address
-  // is found scan all protocol-based classification rules
-  if (cx != NULL) {
-    classref = 0;
-    sp       = NULL;
-
-    if (cx->state!=NAS_CX_DCH) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_send: UE not connected, in state %d. Packet is dropped\n",cx->state);
-#endif
-      return;
-    }
-
-#ifdef NAS_DEBUG_CLASS
-    printk("nasmt_CLASS_send: DSCP %d version %d: looking for classifier entry\n",dscp, version);
-#endif
-
-    for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_CLASS_send: DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",dscp,pclassifier->classref,pclassifier->protocol,pclassifier->version);
-#endif
-
-      // normal rule checks that network protocol version matches
-      if ((pclassifier->version == version)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-        //printk("nasmt_CLASS_send: IP version are equals\n");
-        sp=pclassifier;
-        classref=sp->classref;
-#ifdef NAS_DEBUG_SEND_DETAIL
-        printk("nasmt_CLASS_send: classifier found for dscp %u \n", dscp);
-#endif
-        break;
-      }
-    }
-
-    if (sp!=NULL) {
-#ifdef NAS_DEBUG_CLASS
-
-      //char sfct[10], sprotocol[10];
-      // classifier entity found. Print its parameters
-      if (sp->fct==nasmt_COMMON_QOS_send)
-        strcpy(sfct, "data xfer");
-
-      if (sp->fct==nasmt_CTL_send)
-        strcpy(sfct, "iocontrol");
-
-      if (sp->fct==nasmt_COMMON_del_send)
-        strcpy(sfct, "delete");
-
-      if (sp->fct==nasmt_ASCTL_DC_send_sig_data_request)
-        strcpy(sfct, "DC-SAP");
-
-      switch(protocol) {
-      case NAS_PROTOCOL_UDP:
-        strcpy(sprotocol, "udp");
-        printk("udp packet\n");
-        break;
-
-      case NAS_PROTOCOL_TCP:
-        strcpy(sprotocol, "tcp");
-        printk("tcp packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP4:
-        strcpy(sprotocol, "icmp4");
-        printk("icmp4 packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP6:
-        strcpy(sprotocol, "icmp6");
-        nasmt_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
-        break;
-
-      default:
-        strcpy(sprotocol, "other L4");
-        break;
-      }
-
-      printk("nasmt_CLASS_send: (dscp %u, %s) received, (classref %u, fct %s, drb_id %u) classifier rule\n",
-             dscp, sprotocol, sp->classref, sfct, sp->rab_id);
-#endif
-
-      //forward packet to the correct entity
-      if (sp->fct!=NULL) {
-        sp->fct(skb, cx, sp);
-      } else {
-        printk("\n\nnasmt_CLASS_send: ERROR : CLASSIFIER FUNCTION IS NULL\n\n");
-      }
-
-      no_connection = 0;
-      // end : if classifier entry match found
-    } else {
-      printk("nasmt_CLASS_send: no corresponding item in the classifier list, so the message is dropped\n");
-      printk("nasmt_CLASS_send: packet parameters: dscp %u, %s\n", dscp, sprotocol);
-      nasmt_COMMON_del_send(skb, cx, NULL);  // Note MW: LG has commented this line. Why?
-    }
-  }   // if connection found
-
-#ifdef NAS_DEBUG_CLASS
-
-  if (no_connection == 1) {
-    printk("nasmt_CLASS_send: no corresponding connection, so the message is dropped\n");
-  }
-
-  printk("nasmt_CLASS_send: end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c
deleted file mode 100644
index bbafa86ad1..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_common.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_common.c
-* \brief Common functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-#include <linux/inetdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-
-//---------------------------------------------------------------------------
-// Receive data from FIFO (QOS or DC)
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlen, void *pdcp_sdu, int sap){
-void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *skb;
-  struct ipversion *ipv;
-  unsigned int hard_header_len;
-  uint16_t  *p_ether_type;
-  uint16_t  ether_type;
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: begin\n");
-#endif
-#ifdef PDCP_USE_NETLINK
-
-  // data_buffer is NULL if FIFOs
-  if (!data_buffer) {
-    printk("nasmt_COMMON_receive - input parameter data_buffer is NULL \n");
-    return;
-  }
-
-#endif
-
-  skb = dev_alloc_skb( payload_length + 2 );
-
-  if(!skb) {
-    printk("nasmt_COMMON_receive: low on memory\n");
-    ++gpriv->stats.rx_dropped;
-    return;
-  }
-
-  skb_reserve(skb,2);
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
-
-  if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
-    printk("nasmt_COMMON_receive: problem while reading DC sap\n");
-    kfree(skb->data);
-    dev_kfree_skb(skb);
-    return;
-  }
-
-#else
-  memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
-  bytes_read += payload_length;
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
-#endif
-
-  skb->dev = gdev;
-  hard_header_len = gdev->hard_header_len;
-  skb->mac_header = skb->data;
-  skb->pkt_type = PACKET_HOST;
-  skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-  ipv = (struct ipversion *)&(skb->data[hard_header_len]);
-
-  switch (ipv->version) {
-  case 6:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasmt_COMMON_receive: receive IPv6 message\n");
-#endif
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IPV6);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  case 4:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasmt_COMMON_receive: receive IPv4 message\n");
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
-    if (addr) {
-      printk("nasmt_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
-
-    if (addr) {
-      printk("[NAS][COMMON][RECEIVE] Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    printk("[NAS][COMMON][RECEIVE] protocol  %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
-#endif
-
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IP);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  default:
-    printk("nasmt_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-    skb->protocol = eth_type_trans(skb, gdev);
-    // minus 1(short) instead of 2(bytes) because uint16_t*
-    p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
-    ether_type = ntohs(*p_ether_type);
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasmt_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-
-    switch (ether_type) {
-    case ETH_P_ARP:
-      printk("[NAS][COMMON] ether_type = ETH_P_ARP\n");
-      skb->protocol = htons(ETH_P_ARP);
-      skb->network_header = &skb->mac_header[hard_header_len];
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-  }
-
-  ++gpriv->stats.rx_packets;
-  gpriv->stats.rx_bytes += bytes_read;
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
-#endif
-
-  netif_rx(skb);
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_receive: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_del_send - updating statistics \n");
-#endif
-  ++gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  //struct pdcp_data_req     pdcph;
-  struct pdcp_data_req_header_t     pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb || !gc || !cx) {
-    printk("nasmt_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (gc->rb==NULL) {
-    gc->rb = nasmt_COMMON_search_rb(cx, gc->rab_id);
-
-    if (gc->rb==NULL) {
-      ++gpriv->stats.tx_dropped;
-      printk("nasmt_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send #1 :");
-  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-  nasmt_TOOL_print_classifier(gc);
-#endif
-
-  pdcph.data_size  = skb->len;
-  pdcph.rb_id      = ((gc->rb)->rab_id+(32*cx->lcr))-NAS_SIG_NUM_SRB;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasmt_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-  //printk("nasmt_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-  //printk("nasmt_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasmt_COMMON_QOS_send: problem while writing PDCP's header\n");
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasmt_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len + NAS_PDCPH_SIZE) {
-    printk("nasmt_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id,NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND
-  printk("nasmt_COMMON_QOS_send - end \n");
-#endif
-}
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void nasmt_COMMON_QOS_receive(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sapi;
-  //struct pdcp_data_ind     pdcph;
-  struct pdcp_data_ind_header_t  pdcph;
-  int bytes_read = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasmt_COMMON_QOS_receive - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // LG force the use of only 1 rt fifo
-  sapi = NAS_DRB_OUTPUT_SAPI;
-
-  bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-
-  while (bytes_read>0) {
-    if (bytes_read != NAS_PDCPH_SIZE) {
-      printk("nasmt_COMMON_QOS_receive: problem while reading PDCP header\n");
-      return;
-    }
-
-    //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasmt_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
-    // check if another frame is in the FIFO, otherwise return
-    bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-  }
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - end \n");
-#endif
-}
-
-#else
-//---------------------------------------------------------------------------
-void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh)
-{
-  //---------------------------------------------------------------------------
-
-  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!nlh) {
-    printk("nasmt_COMMON_QOS_receive - input parameter nlh is NULL \n");
-    return;
-  }
-
-  // End debug information
-  pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasmt_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
-#endif //NAS_DEBUG_RECEIVE
-
-  //void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  nasmt_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
-
-}
-#endif //PDCP_USE_NETLINK
-
-
-//---------------------------------------------------------------------------
-struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_search_cx - lcr %d\n",lcr);
-#endif
-
-  if (lcr<NAS_CX_MAX)
-    return gpriv->cx+lcr;
-  else
-    return NULL;
-}
-
-//---------------------------------------------------------------------------
-// Search a Radio Bearer
-struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_search_rb - rab_id %d\n", rab_id);
-#endif
-
-  if (!cx) {
-    printk("nasmt_COMMON_search_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id==rab_id)
-      return rb;
-  }
-
-  return NULL;
-}
-
-//---------------------------------------------------------------------------
-struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_add_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  rb=nasmt_COMMON_search_rb(cx, rab_id);
-
-  if (rb==NULL) {
-    rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
-
-    if (rb!=NULL) {
-      rb->retry=0;
-      rb->countimer=NAS_TIMER_IDLE;
-      rb->rab_id=rab_id;
-      //      rb->rab_id=rab_id+(32*cx->lcr);
-#ifdef NAS_DEBUG_DC
-      printk("nasmt_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
-#endif
-      rb->qos=qos;
-      rb->sapi=NAS_DRB_INPUT_SAPI;
-      // LG force the use of only one rt-fifo rb->sapi=NAS_BA_INPUT_SAPI;
-      rb->state=NAS_IDLE;
-      rb->next=cx->rb;
-      cx->rb=rb;
-      ++cx->num_rb;
-    } else
-      printk("nasmt_COMMON_add_rb: no memory\n");
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_add_rb - end \n" );
-#endif
-  return rb;
-}
-
-//---------------------------------------------------------------------------
-// free the memory that has previously been allocated to rb and remove from linked list
-void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb, *curr_rb, *prev_rb;
-  struct classifier_entity *p;
-  uint16_t classref=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_del_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_del_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // Clear the associated classifier
-  for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
-    if (p->classref>=classref) {
-      classref=p->classref;
-#ifdef NAS_DEBUG_CLASS
-      printk("nasmt_COMMON_del_rb: classifier found for dscp %u \n", dscp);
-#endif
-    }
-  }
-
-  nasmt_CLASS_del_sclassifier(cx, dscp, classref);
-
-  // Now, delete the RB
-  curr_rb = NULL;
-  prev_rb = NULL;
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id == rab_id) {
-      curr_rb = rb;
-
-      if (prev_rb!=NULL) {
-        prev_rb->next = rb->next;
-      } else {
-        cx->rb=rb->next;
-      }
-
-      break;
-    } else {
-      prev_rb = rb;
-    }
-  }
-
-  if (curr_rb!= NULL) {
-    printk("nasmt_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
-    kfree(rb);
-    (cx->num_rb)--;
-  } else {
-    printk("\n\n--nasmt_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_del_rb - end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasmt_COMMON_flush_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  struct classifier_entity *gc;
-  uint8_t dscp;
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_flush_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasmt_COMMON_flush_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
-    printk("nasmt_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
-    cx->rb=rb->next;
-    kfree(rb);
-  }
-
-  cx->num_rb=0;
-  cx->rb=NULL;
-
-  for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
-    for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
-      gc->rb=NULL;
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasmt_COMMON_flush_rb - end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h
deleted file mode 100644
index bdba11ff79..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_constant.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_constant.h
-* \brief Defines all constants for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_CST
-#define _NASMTD_CST
-
-//Debug flags
-#define NAS_DEBUG_DC
-//#define NAS_DEBUG_DC_DETAIL    // detail of DC-SAP operation
-#define NAS_DEBUG_SEND
-#define NAS_DEBUG_SEND_DETAIL  // detail of packet transmission
-//#define NAS_DEBUG_RECEIVE
-#define NAS_DEBUG_RECEIVE_BASIC
-#define NAS_DEBUG_CLASS
-//#define NAS_DEBUG_GC
-//#define NAS_DEBUG_DC_MEASURE
-//#define NAS_DEBUG_TIMER
-#define NAS_DEBUG_DEVICE
-//#define NAS_DEBUG_INTERRUPT
-//#define NAS_DEBUG_TOOL
-#define NETLINK_DEBUG
-//#define NAS_DEBUG_RRCNL // RRC netlink socket
-
-// Other flags
-#define DEMO_3GSM
-#define ENABLE_SLEEP_MODE
-
-// Parameters for the default RAB started after attachment (needs DEMO_3GSM defined)
-#define NASMT_DEFAULTRAB_CLASSREF   1  //MW-01/01/07-
-#define NASMT_DEFAULTRAB_DSCP       0  //MW-01/01/07-
-#define NASMT_DEFAULTRAB_IPVERSION  NAS_VERSION_DEFAULT  //MW-01/01/07-
-
-#define NAS_DEFAULT_IPv6_PREFIX_LENGTH 128 // used to compare destination address
-
-
-// General Constants
-#define NAS_MTU  1500
-#define NAS_TX_QUEUE_LEN  100
-#define NAS_ADDR_LEN  8
-#define NAS_INET6_ADDRSTRLEN 46
-#define NAS_INET_ADDRSTRLEN  16
-
-#define NAS_RESET_RX_FLAGS  0
-
-#define NAS_CX_MAX 1
-//#define NAS_CX_MULTICAST_ALLNODE 2
-#define NASMT_MBMS_SVCES_MAX 4 // Identical to RRC constant
-
-#define NAS_RETRY_LIMIT_DEFAULT 5
-
-#define NAS_MESSAGE_MAXLEN 1600
-
-// UMTS
-#define NAS_SIG_SRB3 3
-#define NAS_SIG_SRB4 3 // not used yet
-//LTE
-#define NAS_SIG_NUM_SRB 3  // number of srbs in LTE to send Rb_Id to PDCP
-
-//peer-to-peer messages between NAS entities
-#define NAS_CMD_OPEN_RB     1
-#define NAS_CMD_ENTER_SLEEP 2
-#define NAS_CMD_LEAVE_SLEEP 3
-
-//#define NAS_IID1_CONTROL 0x0
-//#define NAS_IID2_CONTROL __constant_htonl(0xffffffff)
-
-//#define NAS_STATE_IDLE      0
-//#define NAS_STATE_CONNECTED     1
-//#define NAS_STATE_ESTABLISHMENT_REQUEST 2
-//#define NAS_STATE_ESTABLISHMENT_FAILURE 3
-//#define NAS_STATE_RELEASE_FAILURE   4
-#define NAS_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define NAS_IDLE                  0x01
-// Connection
-#define NAS_CX_FACH               0x06
-#define NAS_CX_DCH                0x0A
-#define NAS_CX_RECEIVED           0x10
-#define NAS_CX_CONNECTING         0x04
-#define NAS_CX_RELEASING          0x08
-#define NAS_CX_CONNECTING_FAILURE 0x14
-#define NAS_CX_RELEASING_FAILURE  0x18
-// Radio Bearers
-#define NAS_RB_ESTABLISHING       0x24
-#define NAS_RB_RELEASING          0x28
-#define NAS_RB_DCH                0x2A
-
-
-#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
-#define NAS_TIMER_RELEASE_DEFAULT 2
-#define NAS_TIMER_IDLE UINT_MAX
-#define NAS_TIMER_TICK HZ
-
-#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_t)
-#define NAS_IPV4_SIZE 20
-#define NAS_IPV6_SIZE 40
-
-#define NAS_DIRECTION_SEND  0
-#define NAS_DIRECTION_RECEIVE 1
-
-// function number
-#define NAS_FCT_DEL_SEND  1
-#define NAS_FCT_QOS_SEND  2
-#define NAS_FCT_DC_SEND         3
-#define NAS_FCT_CTL_SEND  4
-
-// type of IOCTL command
-#define NASMT_IOCTL_RAL 0x89F0
-
-// Error cause
-#define NAS_ERROR_ALREADYEXIST  1
-#define NAS_ERROR_NOMEMORY    3
-#define NAS_ERROR_NOTMT     9
-#define NAS_ERROR_NOTRG     10
-#define NAS_ERROR_NOTIDLE     11
-#define NAS_ERROR_NOTCONNECTED    12
-#define NAS_ERROR_NORB    14
-#define NAS_ERROR_NOTCORRECTVALUE 32
-#define NAS_ERROR_NOTCORRECTLCR 33
-#define NAS_ERROR_NOTCORRECTDIR 34
-#define NAS_ERROR_NOTCORRECTDSCP  35
-#define NAS_ERROR_NOTCORRECTVERSION 36
-#define NAS_ERROR_NOTCORRECTRABI  37
-
-
-/**********************************************************/
-/* Constants related with IP protocols                    */
-/**********************************************************/
-// Destination address types
-#define NAS_IPV6_ADDR_UNICAST        1
-#define NAS_IPV6_ADDR_MC_SIGNALLING  2
-#define NAS_IPV6_ADDR_MC_MBMS        3
-#define NAS_IPV6_ADDR_UNKNOWN        4
-
-#define NAS_IPV4_ADDR_UNICAST        5
-#define NAS_IPV4_ADDR_MC_SIGNALLING  6
-#define NAS_IPV4_ADDR_BROADCAST      7
-#define NAS_IPV4_ADDR_UNKNOWN        8
-
-
-//#define NAS_PORT_CONTROL __constant_htons(0xc45)
-//#define NAS_PORT_AUTHENTICATION __constant_htons(1811)
-
-//#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000) //Yan
-#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0ff00000)
-
-// Network control codepoint 111000 + IP version 6
-#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define NAS_DSCP_NCONTROL 56   //0x38
-// default codepoint 1000000
-#define NAS_DSCP_DEFAULT 64
-#define NAS_DSCP_MAX 65
-
-#define NAS_PROTOCOL_DEFAULT 0
-#define NAS_PROTOCOL_TCP IPPROTO_TCP
-#define NAS_PROTOCOL_UDP IPPROTO_UDP
-#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-
-#define NAS_PORT_DEFAULT  __constant_htons(65535)
-#define NAS_PORT_HTTP   __constant_htons(80)
-
-#define NAS_VERSION_DEFAULT  0
-#define NAS_VERSION_4        4
-#define NAS_VERSION_6        6 //?MW
-
-/**********************************************************/
-/* Constants related with Netlink sockets                 */
-/**********************************************************/
-#define OAI_IP_DRIVER_NETLINK_ID 31
-#define NL_DEST_PID 1
-
-// defined in rrc_nas_sap.h
-//#define NAS_RRCNL_ID 30
-//#define NL_DEST_RRC_PID 2
-
-#define NASNL_DEST_PDCP 0
-#define NASNL_DEST_RRC 1
-
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c
deleted file mode 100644
index efc8562bf9..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_device.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_device.c
-* \brief Networking Device Driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-//:::::::::::::::::::::::::::::::::::::::;;
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-//:::::::::::::::::::::::::::::::::::::::;;
-//#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/moduleparam.h>
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/if_ether.h>
-#endif
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-#include <asm/unistd.h>
-#include <linux/netdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-//:::::::::::::::::::::::::::::::::::::::;;
-struct net_device *gdev;
-struct nas_priv *gpriv;
-//int bytes_wrote;
-//int bytes_read;
-uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
-uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
-
-// TEMP
-//uint8_t nas_IMEI[14];
-static unsigned char nas_IMEI[14];
-static int m_arg=0;
-
-
-#ifdef PDCP_USE_NETLINK
-extern void nasmt_netlink_release(void);
-extern int nasmt_netlink_init(void);
-#endif
-extern void nasmt_ASCTL_timer(unsigned long data);
-
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-//void nasmt_interrupt(void){
-void *nasmt_interrupt(void)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  char *buffer = NULL;
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasmt_interrupt - begin\n");
-#endif
-  //spin_lock(&gpriv->lock);
-  cxi=0;
-  nasmt_COMMON_QOS_receive(gpriv->cx+cxi);
-  nasmt_ASCTL_GC_receive(buffer);
-  nasmt_ASCTL_DC_receive(gpriv->cx+cxi, buffer);
-  //spin_unlock(&gpriv->lock);
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasmt_interrupt: end\n");
-#endif
-}
-#endif //NETLINK
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is activated by ifconfig
-int nasmt_open(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_open: begin\n");
-
-  gpriv=netdev_priv(dev);
-
-  // Address has already been set at init
-#ifndef PDCP_USE_NETLINK
-
-  if (gpriv->irq==-EBUSY) {
-    printk("nasmt_open: irq failure\n");
-    return -EBUSY;
-  }
-
-#endif //NETLINK
-
-  // next lines prevent compilation of the driver with kernel version under 2.6.29
-  // ATTENTION !!!!!! NASMT is not usable with these versions
-
-  if(!netif_queue_stopped(dev))
-    netif_start_queue(dev);
-  else
-    netif_wake_queue(dev);
-
-  //
-  init_timer(&gpriv->timer);
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-  (gpriv->timer).function=nasmt_ASCTL_timer;
-  // ??LITE comments: add_timer(&gpriv->timer);
-  add_timer(&gpriv->timer);
-  //
-  printk("nasmt_open: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is desactivated by ifconfig
-int nasmt_stop(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *priv = netdev_priv(dev);
-  printk("nasmt_stop: begin\n");
-  del_timer(&priv->timer);
-  netif_stop_queue(dev);
-
-  printk("nasmt_stop: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_teardown(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  int cxi;
-#ifndef PDCP_USE_NETLINK
-  struct nas_priv *priv = netdev_priv(dev);
-#endif //PDCP_USE_NETLINK
-
-  printk("nasmt_teardown: begin\n");
-  //  priv=(struct nas_priv *)(gdev.priv);
-
-  if (dev) {
-#ifndef PDCP_USE_NETLINK
-
-    if (priv->irq!=-EBUSY) {
-      *pt_nas_ue_irq=-1;
-      rt_free_srq(priv->irq);
-    }
-
-#endif //PDCP_USE_NETLINK
-
-#ifdef PDCP_USE_NETLINK
-    nasmt_netlink_release();
-#endif //PDCP_USE_NETLINK
-    //  for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
-    //    close(priv->sap[sapi]);
-    nasmt_CLASS_flush_rclassifier();
-    cxi=0;
-    nasmt_COMMON_flush_rb(gpriv->cx+cxi);
-    nasmt_CLASS_flush_sclassifier(gpriv->cx+cxi);
-    // for (sapi=0; sapi<NAS_SAPI_CX_MAX; ++sapi)
-    // close(priv->cx[cxi].sap[sapi]);
-  } // check dev
-  else {
-    printk("nasmt_teardown: Device is null\n");
-  }
-
-  printk("nasmt_teardown: end\n");
-}
-
-//---------------------------------------------------------------------------
-int nasmt_set_config(struct net_device *dev, struct ifmap *map)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_set_config: begin\n");
-
-  if (dev->flags & IFF_UP)
-    return -EBUSY;
-
-  if (map->base_addr != dev->base_addr) {
-    printk(KERN_WARNING "nasmt_set_config: Can't change I/O address\n");
-    return -EOPNOTSUPP;
-  }
-
-  if (map->irq != dev->irq)
-    dev->irq = map->irq;
-
-  printk("nasmt_set_config: end\n");
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-//
-int nasmt_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasmt_hard_start_xmit: begin\n");
-#endif
-
-  if ((!skb)||(!dev)) {
-    printk("nasmt_hard_start_xmit - input parameter skb or dev is NULL \n");
-    return -1;
-  }
-
-  // End debug information
-  netif_stop_queue(dev);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 1\n");
-#endif
-  nasmt_CLASS_send(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 2\n");
-#endif
-  dev_kfree_skb(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasmt_hard_start_xmit: step 3\n");
-#endif
-  netif_wake_queue(dev);
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasmt_hard_start_xmit: end\n");
-#endif
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-struct net_device_stats *nasmt_get_stats(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  //  return &((struct nas_priv *)dev->priv)->stats;
-  struct nas_priv *npriv = netdev_priv(dev);
-  return &npriv->stats;
-}
-
-//---------------------------------------------------------------------------
-// New function from LITE DRIVER
-int nasmt_set_mac_address(struct net_device *dev, void *mac)
-{
-  //---------------------------------------------------------------------------
-  struct sockaddr *addr = mac;
-  printk("nasmt_set_mac_address: begin\n");
-  memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-  return 0;
-}
-
-
-//---------------------------------------------------------------------------
-int nasmt_change_mtu(struct net_device *dev, int mtu)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_change_mtu: begin\n");
-
-  if ((mtu<50) || (mtu>1500))
-    //  if ((mtu<1280) || (mtu>1500))
-    return -EINVAL;
-
-  dev->mtu = mtu;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_change_rx_flags(struct net_device *dev, int flags)
-{
-  //---------------------------------------------------------------------------
-  //struct nas_priv *priv =  netdev_priv(dev);
-  printk("nasmt_change_rx_flags %08X\n", flags);
-  gpriv->rx_flags ^= flags;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_tx_timeout(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  /* Transmitter timeout, serious problems. */
-  printk("nasmt_tx_timeout: begin\n");
-  //((struct nas_priv *)(dev->priv))->stats.tx_errors++;
-  (gpriv->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-  netif_wake_queue(dev);
-  printk("nasmt_tx_timeout: transmit timed out %s\n",dev->name);
-}
-
-//---------------------------------------------------------------------------
-// Define pointers for the module
-static const struct net_device_ops nasmt_netdev_ops = {
-  // ?? nasmt_interrupt
-  //
-  .ndo_open               = nasmt_open,
-  .ndo_stop               = nasmt_stop,
-  .ndo_start_xmit         = nasmt_hard_start_xmit,
-  .ndo_validate_addr      = NULL,
-  .ndo_get_stats          = nasmt_get_stats,
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_32
-  //    .ndo_set_multicast_list = NULL,
-  .ndo_set_mac_address    = nasmt_set_mac_address,
-  .ndo_set_config         = nasmt_set_config,
-  .ndo_do_ioctl           = nasmt_CTL_ioctl,
-  .ndo_change_mtu         = nasmt_change_mtu,
-  .ndo_tx_timeout         = nasmt_tx_timeout,
-  .ndo_change_rx_flags    = nasmt_change_rx_flags,
-  //#endif
-};
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-// Initialisation of the network device
-void nasmt_init(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi, dscpi;
-
-  printk("nasmt_init: begin\n");
-
-  if (dev) {
-    gpriv=netdev_priv(dev);
-    memset(gpriv, 0, sizeof(struct nas_priv));
-    // Initialize function pointers
-    dev->netdev_ops = &nasmt_netdev_ops;
-
-#ifndef NAS_DRIVER_TYPE_ETHERNET
-    //  Update driver properties
-    dev->type = ARPHRD_EURUMTS;
-    dev->features = NETIF_F_NO_CSUM;
-    dev->hard_header_len = 0;
-    dev->addr_len = NAS_ADDR_LEN;
-    dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
-    dev->tx_queue_len = NAS_TX_QUEUE_LEN;
-    dev->mtu = NAS_MTU;
-#endif
-    // Can be one of the following enum defined in include/linux/netdevice.h:
-    // enum netdev_state_t {
-    // __LINK_STATE_START,
-    // __LINK_STATE_PRESENT,
-    // __LINK_STATE_NOCARRIER,
-    // __LINK_STATE_LINKWATCH_PENDING,
-    // __LINK_STATE_DORMANT,
-    // };
-    set_bit(__LINK_STATE_PRESENT, &dev->state);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    // overwrite values written above ( header_ops,type,hard_header_len,mtu,addr_len,tx_queue_len,flags,broadcast)
-    printk("\nnasmt_init: WARNING Driver type ETHERNET\n");
-    ether_setup(dev);
-#endif
-
-    //
-    // Initialize private structure
-    gpriv->rx_flags = NAS_RESET_RX_FLAGS;
-
-    gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
-    gpriv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
-    gpriv->cx[0].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
-    gpriv->cx[0].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
-
-    //gpriv->sap[NAS_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
-    //gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
-    gpriv->sap[NAS_DRB_INPUT_SAPI]  = PDCP2PDCP_USE_RT_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
-    gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
-
-    gpriv->retry_limit = NAS_RETRY_LIMIT_DEFAULT;
-    gpriv->timer_establishment = NAS_TIMER_ESTABLISHMENT_DEFAULT;
-    gpriv->timer_release = NAS_TIMER_RELEASE_DEFAULT;
-
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-      gpriv->rclassifier[dscpi] = NULL;
-
-    gpriv->nrclassifier = 0;
-    //
-    cxi=0;
-#ifdef NAS_DEBUG_DEVICE
-    printk("nasmt_init: init classifiers, state and timer for MT %u\n", cxi);
-#endif
-    gpriv->cx[cxi].state = NAS_IDLE;
-    gpriv->cx[cxi].countimer = NAS_TIMER_IDLE;
-    gpriv->cx[cxi].retry = 0;
-    gpriv->cx[cxi].lcr = cxi;
-    gpriv->cx[cxi].rb = NULL;
-    gpriv->cx[cxi].num_rb = 0;
-
-    // initialisation of the classifiers
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-      gpriv->cx[cxi].sclassifier[dscpi]=NULL;
-    }
-
-    gpriv->cx[cxi].nsclassifier=0;
-    // initialisation of the IP address
-    nasmt_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
-    gpriv->cx[cxi].iid4=0;
-    //
-    spin_lock_init(&gpriv->lock);
-    printk("nasmt_init: init IMEI to IID\n");
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    nasmt_TOOL_eth_imei2iid(nas_IMEI, dev->dev_addr ,(uint8_t *)gpriv->cx[0].iid6, dev->addr_len);
-#else
-    nasmt_TOOL_imei2iid(nas_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
-    nasmt_TOOL_imei2iid(nas_IMEI, (uint8_t *)gpriv->cx[0].iid6);
-#endif
-
-    nasmt_ASCTL_init();
-  } else {
-    printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
-  }
-
-  printk("nasmt_init: end\n");
-  return;
-}
-
-//---------------------------------------------------------------------------
-int init_module (void)
-{
-  //---------------------------------------------------------------------------
-  int err;
-  int inst = 0;
-  int index;
-  struct nas_priv *priv;
-  char devicename[100];
-
-  printk("\n\n\ninit_module: begin \n");
-
-  // check IMEI parameter
-  printk("number of IMEI parameters %d, IMEI ", m_arg);
-
-  for (index = 0; index < m_arg;  index++) {
-    printk("%02X ", nas_IMEI[index]);
-  }
-
-  printk("\n");
-
-
-#ifndef PDCP_USE_NETLINK
-
-  // Initialize parameters shared with RRC (done first to avoid going further)
-  if (pt_nas_ue_irq==NULL) {
-    printk("init_module: shared irq parameter not initialised\n");
-    err =  -EBUSY;
-    printk("init_module: returning %d \n\n", err);
-    return err;
-  }
-
-  printk("init_module: pt_nas_ue_irq valid \n");
-#endif
-
-  // Allocate device structure
-  sprintf(devicename,"oai%d",inst);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasmt_init);
-#else
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, NET_NAME_PREDICTABLE, nasmt_init);
-#endif
-  priv = netdev_priv(gdev);
-  ////
-#ifndef PDCP_USE_NETLINK
-  priv->irq=rt_request_srq(0, nasmt_interrupt, NULL);
-
-  if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
-    printk("\n init_module: No interrupt resource available\n");
-
-    if (gdev) {
-      free_netdev(gdev);
-      printk("init_module: free_netdev ..\n");
-    }
-
-    return -EBUSY;
-  } else
-    printk("init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
-
-  if (pt_nas_ue_irq==NULL) {
-    printk("init_module: shared irq parameter has been reset\n");
-  } else {
-    *pt_nas_ue_irq=priv->irq;
-  }
-
-#endif
-
-#ifdef PDCP_USE_NETLINK
-
-  if ((err=nasmt_netlink_init()) == -1)
-    printk("init_module: NETLINK failed\n");
-
-  printk("init_module: NETLINK INIT successful\n");
-#endif //NETLINK
-  //
-  err= register_netdev(gdev);
-
-  if (err) {
-    printk("init_module: error %i registering device %s\n", err, gdev->name);
-  } else {
-    printk("init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
-  }
-
-  return err;
-}
-
-//---------------------------------------------------------------------------
-void cleanup_module(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_cleanup_module: begin\n");
-  unregister_netdev(gdev);
-  nasmt_teardown(gdev);
-  free_netdev(gdev);
-  printk("nasmt_cleanup_module: end\n\n\n\n");
-}
-
-//---------------------------------------------------------------------------
-// Replaced by init_module and cleanup_module
-//module_init (nasmt_init_module);
-//module_exit (nasmt_cleanup_module);
-//---------------------------------------------------------------------------
-
-#define DRV_NAME        "oai_nasmt"
-#define DRV_VERSION     "3.0.1"DRV_NAME
-#define DRV_DESCRIPTION "OPENAIR CELLULAR LTE NASMT Device Driver"
-#define DRV_COPYRIGHT   "-Copyright(c) GNU GPL Eurecom 2013"
-#define DRV_AUTHOR      "Michelle Wetterwald <michelle.wetterwald@eurecom.fr>"DRV_COPYRIGHT
-
-module_param_array_named(nas_IMEI,nas_IMEI,byte,&m_arg,0);
-//module_param_array(oai_nw_drv_IMEI,byte,&m_arg,0444);
-MODULE_PARM_DESC(nas_IMEI,"Terminal IMEI Identifier (14 digits, only first 10 significant if ETH option ON)");
-
-
-// MODULE_LICENSE("GPL");
-// MODULE_DESCRIPTION("LTE Driver for Mobile Terminal, playing as Non Access Stratum");
-// MODULE_AUTHOR("Michelle Wetterwald <michelle.wetterwald@eurecom.fr>");
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c
deleted file mode 100644
index 296ae78866..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_iocontrol.c
-* \brief I/O control functions for upper layers of driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasmt_variables.h"
-#include "nasmt_iocontrol.h"
-#include "nasmt_proto.h"
-
-//#include <linux/in.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/uaccess.h>
-
-extern int  nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx);
-
-// Statistic
-//---------------------------------------------------------------------------
-void nasmt_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  msgrep->rx_packets=gpriv->stats.rx_packets;
-  msgrep->tx_packets=gpriv->stats.tx_packets;
-  msgrep->rx_bytes=gpriv->stats.rx_bytes;
-  msgrep->tx_bytes=gpriv->stats.tx_bytes;
-  msgrep->rx_errors=gpriv->stats.rx_errors;
-  msgrep->tx_errors=gpriv->stats.tx_errors;
-  msgrep->rx_dropped=gpriv->stats.rx_dropped;
-  msgrep->tx_dropped=gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_statistic_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_statistic_reply msgrep;
-  printk("nasmt_ioCTL_statistic: stat requested\n");
-  nasmt_set_msg_statistic_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_statistic: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connections List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_list_reply(uint8_t *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  nasLocalConnectionRef_t lcr;
-  struct nas_msg_cx_list_reply *list;
-  msgrep[0]=NAS_CX_MAX;
-  list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-  for(lcr=0; lcr<NAS_CX_MAX; ++lcr) {
-    cx=nasmt_COMMON_search_cx(lcr);
-    list[lcr].lcr=lcr;
-    list[lcr].state=cx->state;
-    list[lcr].cellid=cx->cellid;
-    list[lcr].iid4=cx->iid4;
-    list[lcr].iid6[0]=cx->iid6[0];
-    list[lcr].iid6[1]=cx->iid6[1];
-    list[lcr].num_rb=cx->num_rb;
-    list[lcr].nsclassifier=cx->nsclassifier;
-    printk("nasmt_set_msg_cx_list_reply: nsc=%u\n",cx->nsclassifier);
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_cx_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1];
-  printk("nasmt_ioCTL_cx_list: connection list requested\n");
-  nasmt_set_msg_cx_list_reply(msgrep);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1)) {
-    printk("nasmt_ioCTL_cx_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_cx_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Establishment
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-#ifdef NODE_RG
-  msgrep->status=-NAS_ERROR_NOTMT;
-#else
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    if (cx->state == NAS_CX_RELEASING) {
-      msgrep->status=nasmt_ASCTL_leave_sleep_mode(cx);
-    } else {
-      cx->cellid=msgreq->cellid;
-      msgrep->status=nasmt_ASCTL_DC_send_cx_establish_request(cx);
-    }
-  } else
-    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-
-#endif
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_cx_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_establishment_request msgreq;
-  struct nas_msg_cx_establishment_reply msgrep;
-  printk("nasmt_ioCTL_cx_establishment: connection establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_cx_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_cx_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_cx_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Release
-//---------------------------------------------------------------------------
-void nasmt_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-#ifdef NODE_RG
-  msgrep->status=-NAS_ERROR_NOTMT;
-#else
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-#ifdef ENABLE_SLEEP_MODE
-    msgrep->status=nasmt_ASCTL_enter_sleep_mode(cx);
-#endif
-#ifndef ENABLE_SLEEP_MODE
-    msgrep->status=nasmt_ASCTL_DC_send_cx_release_request(cx);
-#endif
-  } else
-    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connection
-int nasmt_ioCTL_cx_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_release_request msgreq;
-  struct nas_msg_cx_release_reply msgrep;
-
-  printk("nasmt_ioCTL_cx_release: connection release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_cx_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_cx_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_cx_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_cx_release: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    uint8_t rbi;
-    struct rb_entity *rb;
-    struct nas_msg_rb_list_reply *list;
-
-    if (cx->num_rb > NAS_LIST_RB_MAX)
-      msgrep[0] = NAS_LIST_RB_MAX;
-    else
-      msgrep[0] = cx->num_rb;
-
-    list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-    for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) {
-      list[rbi].state=rb->state;
-      list[rbi].rab_id=rb->rab_id;
-      list[rbi].sapi=rb->sapi;
-      list[rbi].qos=rb->qos;
-    }
-  } else
-    msgrep[0]=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1];
-  struct nas_msg_rb_list_request msgreq;
-  printk("nasmt_ioCTL_rb_list: Radio Bearer list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1)) {
-    printk("nasmt_ioCTL_rb_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasmt_ioCTL_rb_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Establishment
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTRG;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_establishment_request msgreq;
-  struct nas_msg_rb_establishment_reply msgrep;
-  printk("nasmt_ioCTL_rb_establishment: Radio bearer establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_rb_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Release
-//---------------------------------------------------------------------------
-void nasmt_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTRG;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_rb_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_release_request msgreq;
-  struct nas_msg_rb_release_reply msgrep;
-  printk("nasmt_ioCTL_rb_release: Radio bearer release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_rb_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_rb_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_rb_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Classifier List
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  struct classifier_entity *gc;
-  struct nas_msg_class_list_reply *list;
-  uint8_t cli;
-  list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-  switch(msgreq->dir) {
-  case NAS_DIRECTION_SEND:
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx==NULL) {
-      msgrep[0]=0;
-      return;
-    }
-
-    gc=cx->sclassifier[msgreq->dscp];
-    break;
-
-  case NAS_DIRECTION_RECEIVE:
-    cx=NULL;
-    gc=gpriv->rclassifier[msgreq->dscp];
-    break;
-
-  default:
-    cx=NULL;
-    msgrep[0]=0;
-    return;
-  }
-
-  for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli) {
-    list[cli].classref=gc->classref;
-    list[cli].lcr=msgreq->lcr;
-    list[cli].dir=msgreq->dir;
-    list[cli].dscp=msgreq->dscp;
-    list[cli].rab_id=gc->rab_id;
-    list[cli].version=gc->version;
-
-    switch(gc->version) {
-    case 4:
-      list[cli].saddr.ipv4 = gc->saddr.ipv4;
-      list[cli].daddr.ipv4 = gc->daddr.ipv4;
-      break;
-
-    case 6:
-      list[cli].saddr.ipv6 = gc->saddr.ipv6;
-      list[cli].daddr.ipv6 = gc->daddr.ipv6;
-      break;
-    }
-
-    list[cli].protocol=gc->protocol;
-    list[cli].sport=ntohs(gc->sport);
-    list[cli].dport=ntohs(gc->dport);
-    list[cli].splen=gc->splen;
-    list[cli].dplen=gc->dplen;
-    list[cli].fct=nasmt_TOOL_invfct(gc);
-  }
-
-  msgrep[0]=cli;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
-  struct nas_msg_class_list_request msgreq;
-  printk("nasmt_ioCTL_class_list: classifier list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1)) {
-    printk("nasmt_ioCTL_class_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the addition of a classifier rule
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasmt_set_msg_class_add_reply: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) {
-      printk("nasmt_set_msg_class_add_reply: DSCP %d, Classref %d\n",msgreq->dscp, msgreq->classref );
-      gc=nasmt_CLASS_add_sclassifier(cx, msgreq->dscp, msgreq->classref);
-      printk("nasmt_set_msg_class_add_reply: %p %p\n" , msgreq, gc);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-
-    gc->rab_id=msgreq->rab_id;
-    gc->rb=nasmt_COMMON_search_rb(cx, gc->rab_id);
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE) {
-      gc=nasmt_CLASS_add_rclassifier(msgreq->dscp, msgreq->classref);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  nasmt_TOOL_fct(gc, msgreq->fct);
-  gc->version=msgreq->version;
-
-  switch(gc->version) {
-  case 4:
-    gc->saddr.ipv4=msgreq->saddr.ipv4;
-    gc->daddr.ipv4=msgreq->daddr.ipv4;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 6:
-    gc->saddr.ipv6=msgreq->saddr.ipv6;
-    gc->daddr.ipv6=msgreq->daddr.ipv6;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 0:
-    gc->saddr.ipv6.s6_addr32[0]=0;
-    gc->daddr.ipv6.s6_addr32[1]=0;
-    gc->saddr.ipv6.s6_addr32[2]=0;
-    gc->daddr.ipv6.s6_addr32[3]=0;
-    gc->splen=0;
-    gc->dplen=0;
-    break;
-
-  default:
-    msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
-    kfree(gc);
-    return;
-  }
-
-  gc->protocol=msgreq->protocol;
-  gc->sport=htons(msgreq->sport);
-  gc->dport=htons(msgreq->dport);
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_add_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_add_request msgreq;
-  struct nas_msg_class_add_reply msgrep;
-  printk("nasmt_ioCTL_class_add: Add classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_add: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_add_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_class_add: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the deletion of a classifier rule
-//---------------------------------------------------------------------------
-void nasmt_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasmt_set_msg_class_del_reply: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasmt_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL)
-      nasmt_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE)
-      nasmt_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_class_del_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_del_request msgreq;
-  struct nas_msg_class_del_reply msgrep;
-  printk("nasmt_ioCTL_class_del: Del classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_class_del: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_class_del_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_class_del: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Measurement
-// Messages for Measurement transfer
-
-//---------------------------------------------------------------------------
-void nasmt_set_msg_measure_reply(struct nas_msg_measure_reply *msgrep, struct nas_msg_measure_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0
-  int i;
-
-  cx = nasmt_COMMON_search_cx(lcr);
-
-  if (cx!=NULL) {
-    msgrep->num_cells = cx->num_measures;
-
-    for (i=0; i<cx->num_measures; i++) {
-      msgrep-> measures[i].cell_id = cx->meas_cell_id[i];
-      msgrep-> measures[i].level = cx->meas_level[i];
-      msgrep-> measures[i].provider_id = cx->provider_id[i];
-    }
-
-    msgrep->signal_lost_flag = 0;
-  } else {
-    //    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    //    return;
-  }
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_measure_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_measure_request msgreq;
-  struct nas_msg_measure_reply msgrep;
-  printk("nasmt_ioCTL_measure: Measurement requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasmt_ioCTL_measure: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasmt_set_msg_measure_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_measure: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// IMEI
-// Messages for IMEI transfer
-//---------------------------------------------------------------------------
-void nasmt_set_msg_imei_reply(struct nas_msg_l2id_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0
-  int i;
-
-  cx=nasmt_COMMON_search_cx(lcr);
-
-  if (cx!=NULL) {
-    msgrep->l2id[0] = cx->iid6[0];
-    msgrep->l2id[1] = cx->iid6[1];
-  } else {
-    //    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    //    return;
-  }
-}
-//---------------------------------------------------------------------------
-int nasmt_ioCTL_imei_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_l2id_reply msgrep;
-  printk("nasmt_ioCTL_imei: IMEI requested\n");
-  nasmt_set_msg_imei_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasmt_ioCTL_imei: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// IOCTL command
-//---------------------------------------------------------------------------
-int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl *gifr;
-  int r;
-  printk("nasmt_CTL_ioctl: begin\n");
-
-  //spin_lock(&gpriv->lock);
-  switch(cmd) {
-  case NASMT_IOCTL_RAL:
-    gifr=(struct nas_ioctl *)ifr;
-
-    switch(gifr->type) {
-    case NAS_MSG_STATISTIC_REQUEST:
-      r=nasmt_ioCTL_statistic_request(gifr);
-      break;
-
-    case NAS_MSG_CX_ESTABLISHMENT_REQUEST:
-      r=nasmt_ioCTL_cx_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_CX_RELEASE_REQUEST:
-      r=nasmt_ioCTL_cx_release_request(gifr);
-      break;
-
-    case NAS_MSG_CX_LIST_REQUEST:
-      r=nasmt_ioCTL_cx_list_request(gifr);
-      break;
-
-    case NAS_MSG_RB_ESTABLISHMENT_REQUEST:
-      r=nasmt_ioCTL_rb_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_RB_RELEASE_REQUEST:
-      r= nasmt_ioCTL_rb_release_request(gifr);
-      break;
-
-    case NAS_MSG_RB_LIST_REQUEST:
-      r=nasmt_ioCTL_rb_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_ADD_REQUEST:
-      r=nasmt_ioCTL_class_add_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_LIST_REQUEST:
-      r=nasmt_ioCTL_class_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_DEL_REQUEST:
-      r=nasmt_ioCTL_class_del_request(gifr);
-      break;
-
-    case NAS_MSG_MEAS_REQUEST:
-      r=nasmt_ioCTL_measure_request(gifr);
-      break;
-
-    case NAS_MSG_IMEI_REQUEST:
-      r=nasmt_ioCTL_imei_request(gifr);
-      break;
-
-    default:
-      printk("nasmt_CTL_ioctl: unkwon request type, type=%x\n", gifr->type);
-      r=-EFAULT;
-    }
-
-    break;
-
-  default:
-    printk("nasmt_CTL_ioctl: Unknown ioctl command, cmd=%x\n", cmd);
-    r=-EFAULT;
-  }
-
-  //spin_unlock(&gpriv->lock);
-  printk("nasmt_CTL_ioctl: end\n");
-  return r;
-}
-
-//---------------------------------------------------------------------------
-void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_CTL_send - void \n");
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h
deleted file mode 100644
index 40118d8368..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_iocontrol.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_iocontrol.h
-* \brief I/O control constnats and structures for upper layers of driver for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef NASMTD_CTL_H
-#define NASMTD_CTL_H
-
-#include <asm/byteorder.h>
-#include <asm/types.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-
-#define NAS_MSG_MAXLEN 1100
-
-// type of CTL message
-#define NAS_MSG_STATISTIC_REQUEST   1
-#define NAS_MSG_STATISTIC_REPLY     2
-#define NAS_MSG_ECHO_REQUEST        3
-#define NAS_MSG_ECHO_REPLY          4
-#define NAS_MSG_CX_ESTABLISHMENT_REQUEST  5
-#define NAS_MSG_CX_ESTABLISHMENT_REPLY    6
-#define NAS_MSG_CX_RELEASE_REQUEST  7
-#define NAS_MSG_CX_RELEASE_REPLY    8
-#define NAS_MSG_CX_LIST_REQUEST     9
-#define NAS_MSG_CX_LIST_REPLY      10
-#define NAS_MSG_RB_ESTABLISHMENT_REQUEST  11
-#define NAS_MSG_RB_ESTABLISHMENT_REPLY    12
-#define NAS_MSG_RB_RELEASE_REQUEST  13
-#define NAS_MSG_RB_RELEASE_REPLY    14
-#define NAS_MSG_RB_LIST_REQUEST    15
-#define NAS_MSG_RB_LIST_REPLY      16
-#define NAS_MSG_CLASS_ADD_REQUEST  17
-#define NAS_MSG_CLASS_ADD_REPLY    18
-#define NAS_MSG_CLASS_DEL_REQUEST  19
-#define NAS_MSG_CLASS_DEL_REPLY    20
-#define NAS_MSG_CLASS_LIST_REQUEST  21
-#define NAS_MSG_CLASS_LIST_REPLY    22
-#define NAS_MSG_MEAS_REQUEST  23
-#define NAS_MSG_MEAS_REPLY    24
-#define NAS_MSG_IMEI_REQUEST  25
-#define NAS_MSG_IMEI_REPLY    26
-
-// Max number of entry of a message list
-#define NAS_LIST_CX_MAX  32
-#define NAS_LIST_RB_MAX  32
-#define NAS_LIST_CLASS_MAX  32
-
-typedef uint16_t nasMsgType_t;
-
-struct nas_ioctl {
-  char name[IFNAMSIZ];
-  nasMsgType_t type;
-  char *msg;
-};
-
-struct nas_msg_statistic_reply {
-  uint32_t rx_packets;
-  uint32_t tx_packets;
-  uint32_t rx_bytes;
-  uint32_t tx_bytes;
-  uint32_t rx_errors;
-  uint32_t tx_errors;
-  uint32_t rx_dropped;
-  uint32_t tx_dropped;
-};
-
-struct nas_msg_cx_list_reply {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-  uint8_t state;
-  nasCellID_t cellid;    // cell identification
-  uint32_t iid6[2];       // IPv6  interface identification
-  uint8_t iid4;       // IPv4 interface identification
-  uint16_t num_rb;
-  uint16_t nsclassifier;
-};
-struct nas_msg_cx_establishment_reply {
-  int status;
-};
-struct nas_msg_cx_establishment_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  nasCellID_t cellid; // Cell identification
-};
-struct nas_msg_cx_release_reply {
-  int status;
-};
-struct nas_msg_cx_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-};
-
-struct nas_msg_rb_list_reply {
-  nasRadioBearerId_t rab_id;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  uint8_t state;
-};
-struct nas_msg_rb_list_request {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-};
-struct nas_msg_rb_establishment_reply {
-  int status;
-};
-struct nas_msg_rb_establishment_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  nasQoSTrafficClass_t qos;
-};
-
-struct nas_msg_rb_release_reply {
-  int status;
-};
-struct nas_msg_rb_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_class_add_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint8_t fct;
-  uint16_t classref;
-  uint8_t version;
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr; // IP source address
-  uint8_t splen; // prefix length
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr; // IP destination address
-  uint8_t dplen; // prefix length
-  uint8_t protocol;   // high layer protocol type
-  uint16_t sport;   // source port
-  uint16_t dport;   // destination port
-};
-struct nas_msg_class_add_reply {
-  int status;
-};
-struct nas_msg_class_del_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint16_t classref;
-};
-struct nas_msg_class_del_reply {
-  int status;
-};
-#define nas_msg_class_list_reply nas_msg_class_add_request
-struct nas_msg_class_list_request {
-  nasLocalConnectionRef_t lcr;   // Local Connection reference
-  uint8_t dir;
-  uint8_t dscp;
-};
-
-
-// Messages for Measurement transfer - MW 01/04/2005
-typedef uint32_t nioctlProviderId_t;
-typedef uint16_t nioctlSignalLoss_t;
-typedef struct nioctlMeasures {
-  nasCellID_t cell_id;
-  nasSigLevel_t level;
-  nioctlProviderId_t provider_id;
-} nioctlMeasures_t;
-
-struct nas_msg_measure_request {
-  nasNumRGsMeas_t num_cells;
-  nasCellID_t cellid[MAX_MEASURE_NB]; // Cell identification
-  uint16_t num_providers;
-  nioctlProviderId_t provider_id[MAX_MEASURE_NB]; // Provider identification
-};
-struct nas_msg_measure_reply {
-  nasNumRGsMeas_t num_cells;
-  nioctlMeasures_t measures[MAX_MEASURE_NB];
-  nioctlSignalLoss_t signal_lost_flag;
-};
-
-// Messages for L2Id transfer - MW
-typedef uint32_t nioctlL2Id_t[2];
-
-struct nas_msg_l2id_reply {
-  nioctlL2Id_t l2id;
-};
-
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c
deleted file mode 100644
index 2f92b94717..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_netlink.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_netlink.c
-* \brief Netlink socket functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-//#include <linux/config.h>
-#include <linux/socket.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netlink.h>
-#include <net/sock.h>
-#include <linux/kthread.h>
-
-#include <linux/mutex.h>
-
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-static struct sock *nas_nl_sk = NULL;
-static struct sock *nas_rrcnl_sk = NULL;
-
-//static int exit_netlink_thread=0;
-static DEFINE_MUTEX(nasmt_mutex);
-
-// This can also be implemented using thread to get the data from PDCP without blocking.
-//---------------------------------------------------------------------------
-// Function for transfer with PDCP (from NASLITE)
-static void nasmt_nl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasmt_nl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasmt_nl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NETLINK_DEBUG
-  printk("nasmt_nl_data_ready - Received socket from PDCP\n");
-#endif //NETLINK_DEBUG
-  nlh = (struct nlmsghdr *)skb->data;
-  nasmt_COMMON_QOS_receive(nlh);
-}
-
-//---------------------------------------------------------------------------
-//  Function for transfer with RRC
-static void nasmt_rrcnl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-  char target_sap;
-  uint8_t cxi = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasmt_rrcnl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasmt_rrcnl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  nlh = (struct nlmsghdr *)skb->data;
-  //pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-  //nasmt_TOOL_print_buffer((char *)NLMSG_DATA(nlh), 48);
-
-  target_sap = ((char*)NLMSG_DATA(nlh))[0];
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasmt_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
-#endif //NAS_DEBUG_RRCNL
-
-  switch (target_sap) {
-  case RRC_NAS_GC_OUT:
-    //printk("nasmt_rrcnl_data_ready - Calling  nasmt_ASCTL_GC_receive\n");
-    nasmt_ASCTL_GC_receive(&((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC0_OUT:
-    //printk("nasmt_rrcnl_data_ready - Calling  nasmt_ASCTL_DC_receive\n");
-    nasmt_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  default:
-    printk("nasmt_rrcnl_data_ready - Invalid SAP value received\n");
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasmt_netlink_init(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_netlink_init - begin \n");
-
-  nas_nl_sk = netlink_kernel_create(&init_net,OAI_IP_DRIVER_NETLINK_ID, 0, nasmt_nl_data_ready,
-                                    &nasmt_mutex, // NULL
-                                    THIS_MODULE);
-
-  if (!nas_nl_sk) {
-    printk("nasmt_netlink_init - netlink_kernel_create failed for PDCP socket\n");
-    return(-1);
-  }
-
-  nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasmt_rrcnl_data_ready,
-                                       &nasmt_mutex, // NULL
-                                       THIS_MODULE);
-
-  if (!nas_rrcnl_sk) {
-    printk("nasmt_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
-    return(-1);
-  }
-
-  return(0);
-}
-
-//---------------------------------------------------------------------------
-void nasmt_netlink_release(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasmt_netlink_release - begin \n");
-
-  //exit_netlink_thread=1;
-  printk("nasmt_netlink_release - Releasing netlink sockets\n");
-
-  if(nas_nl_sk) {
-    netlink_kernel_release(nas_nl_sk);
-  }
-
-  if(nas_rrcnl_sk) {
-    netlink_kernel_release(nas_rrcnl_sk);
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *nl_skb;
-  struct nlmsghdr *nlh;
-  int status;
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasmt_netlink_send - begin \n");
-#endif
-
-  if (!data_buffer) {
-    printk("nasmt_netlink_send - ERROR - input parameter data is NULL \n");
-    return(0);
-  }
-
-  if (!nas_nl_sk || !nas_rrcnl_sk) {
-    printk("nasmt_netlink_send - ERROR - socket is NULL\n");
-    return(0);
-  }
-
-  // End debug information
-
-  nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
-
-  if (!nl_skb) {
-    printk("nasmt_netlink_send - ERROR - could not allocate skbuffer\n");
-    return(0);
-  }
-
-  nlh = (struct nlmsghdr *)nl_skb->data;
-
-  //  printk("nasmt_netlink_send Sending %d bytes (%d)\n",data_length,NLMSG_SPACE(data_length));
-  skb_put(nl_skb, NLMSG_SPACE(data_length));
-  memcpy(NLMSG_DATA(nlh), data_buffer, data_length);
-  nlh->nlmsg_len = NLMSG_SPACE(data_length);
-
-  nlh->nlmsg_pid = 0;      /* from kernel */
-  NETLINK_CB(nl_skb).pid = 0;
-
-  // destination 0 = PDCP, 1 = RRC
-  if (!destination) {
-#ifdef NETLINK_DEBUG
-    printk("nasmt_netlink_send - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
-#endif //DEBUG_NETLINK
-    status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
-  } else {
-#ifdef NAS_DEBUG_RRCNL
-    printk("nasmt_rrcnl_send - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
-#endif //NAS_DEBUG_RRCNL
-    status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
-  }
-
-  if (status < 0) {
-    printk("nasmt_netlink_send - SEND status is %d\n",status);
-    return(0);
-  } else {
-#ifdef NETLINK_DEBUG
-    printk("nasmt_netlink_send - SEND status is %d, data_length %d\n",status, data_length);
-#endif
-    return data_length;
-  }
-}
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
deleted file mode 100644
index 3a6ffe4848..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_proto.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_proto.h
-* \brief Function prototypes for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_PROTO_H
-#define _NASMTD_PROTO_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-//#include "rrc_nas_primitives.h"
-//#include "protocol_vars_extern.h"
-//#include "as_sap.h"
-//#include "rrc_qos.h"
-//#include "rrc_sap.h"
-
-// nasmt_netlink.c
-void nasmt_netlink_release(void);
-int nasmt_netlink_init(void);
-int nasmt_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination);
-
-// nasmt_common.c
-//void nasmt_COMMON_receive(uint16_t hlen, uint16_t dlength, int sap);
-void nasmt_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-
-void nasmt_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasmt_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-#ifndef PDCP_USE_NETLINK
-void nasmt_COMMON_QOS_receive(struct cx_entity *cx);
-#else
-void nasmt_COMMON_QOS_receive(struct nlmsghdr *nlh);
-#endif
-struct rb_entity *nasmt_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos);
-struct rb_entity *nasmt_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi);
-struct cx_entity *nasmt_COMMON_search_cx(nasLocalConnectionRef_t lcr);
-void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp);
-void nasmt_COMMON_flush_rb(struct cx_entity *cx);
-
-
-//nasmt_ascontrol.c
-void nasmt_ASCTL_init(void);
-void nasmt_ASCTL_timer(unsigned long data);
-int  nasmt_ASCTL_DC_receive(struct cx_entity *cx, char *buffer);
-int  nasmt_ASCTL_GC_receive(char *buffer);
-int  nasmt_ASCTL_DC_send_cx_establish_request(struct cx_entity *cx);
-int  nasmt_ASCTL_DC_send_cx_release_request(struct cx_entity *cx);
-void nasmt_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasmt_ASCTL_DC_send_peer_sig_data_request(struct cx_entity *cx, uint8_t sig_category);
-int nasmt_ASCTL_leave_sleep_mode(struct cx_entity *cx);
-int nasmt_ASCTL_enter_sleep_mode(struct cx_entity *cx);
-
-// nasmt_iocontrol.c
-void nasmt_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-int nasmt_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-
-// nasmt_classifier.c
-void nasmt_CLASS_send(struct sk_buff *skb);
-struct classifier_entity *nasmt_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasmt_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref);
-void nasmt_CLASS_flush_sclassifier(struct cx_entity *cx);
-void nasmt_CLASS_flush_rclassifier(void);
-
-// nasmt_tool.c
-uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc);
-void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct);
-void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid);
-
-void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len);
-uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph);
-uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph);
-uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol);
-uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol);
-
-void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph);
-
-void nasmt_TOOL_print_state(uint8_t state);
-void nasmt_TOOL_print_buffer(unsigned char * buffer,int length);
-void nasmt_TOOL_print_rb_entity(struct rb_entity *rb);
-void nasmt_TOOL_print_classifier(struct classifier_entity *gc);
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h
deleted file mode 100644
index c0934f4622..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_sap.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_sap.h
-* \brief SAP constants for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_SAP_H
-#define _NASMTD_SAP_H
-
-// RT-FIFO identifiers ** must be identical to Access Stratum as_sap.h and rrc_sap.h
-#define RRC_DEVICE_GC          RRC_SAPI_UE_GCSAP
-#define RRC_DEVICE_NT          RRC_SAPI_UE_NTSAP
-#define RRC_DEVICE_DC_INPUT0   RRC_SAPI_UE_DCSAP_IN
-#define RRC_DEVICE_DC_OUTPUT0  RRC_SAPI_UE_DCSAP_OUT
-
-//#define QOS_DEVICE_CONVERSATIONAL_INPUT  QOS_SAPI_CONVERSATIONAL_INPUT_MT
-//#define QOS_DEVICE_CONVERSATIONAL_OUTPUT QOS_SAPI_CONVERSATIONAL_OUTPUT_MT
-
-#define PDCP2PDCP_USE_RT_FIFO 21
-#define NAS2PDCP_FIFO 22
-
-//FIFO indexes in control blocks
-#define NAS_DC_INPUT_SAPI    0
-#define NAS_DC_OUTPUT_SAPI   1
-#define NAS_SAPI_CX_MAX      2
-
-#define NAS_GC_SAPI         0
-#define NAS_NT_SAPI         1
-#define NAS_DRB_INPUT_SAPI  2  //NAS_CO_INPUT_SAPI
-#define NAS_DRB_OUTPUT_SAPI 3  //NAS_CO_OUTPUT_SAPI
-#define NAS_SAPI_MAX        4
-
-//#define NAS_QOS_CONVERSATIONAL UMTS_TRAFFIC_CONVERSATIONAL
-//
-
-/* Defined in RRC
-#define RRC_NAS_GC_IN   0
-#define RRC_NAS_GC_OUT  1
-#define RRC_NAS_NT_IN   2
-#define RRC_NAS_NT_OUT  3
-#define RRC_NAS_DC0_IN  4
-#define RRC_NAS_DC0_OUT 5
-#define RRC_NAS_DC1_IN  6
-#define RRC_NAS_DC1_OUT 7
-#define RRC_NAS_DC2_IN  8
-#define RRC_NAS_DC2_OUT 9
-*/
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c
deleted file mode 100644
index 4c5d3fcf6e..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_tool.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/***************************************************************************
-                          nasmt_tool.c  -  description
- ***************************************************************************
-
- ***************************************************************************/
-/*! \file nasmt_tool.c
-* \brief Tool functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-
-#include "nasmt_variables.h"
-#include "nasmt_proto.h"
-
-//---------------------------------------------------------------------------
-//
-void nasmt_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_fct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_fct - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  switch(fct) {
-  case NAS_FCT_QOS_SEND:
-    gc->fct=nasmt_COMMON_QOS_send;
-    break;
-
-  case NAS_FCT_CTL_SEND:
-    gc->fct=nasmt_CTL_send;
-    break;
-
-  case NAS_FCT_DC_SEND:
-    gc->fct=nasmt_ASCTL_DC_send_sig_data_request;
-    break;
-
-  case NAS_FCT_DEL_SEND:
-    gc->fct=nasmt_COMMON_del_send;
-    break;
-
-  default:
-    gc->fct=nasmt_COMMON_del_send;
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_invfct(struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_invfct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_invfct - input parameter gc is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  if (gc->fct==nasmt_COMMON_QOS_send)
-    return NAS_FCT_QOS_SEND;
-
-  if (gc->fct==nasmt_CTL_send)
-    return NAS_FCT_CTL_SEND;
-
-  if (gc->fct==nasmt_COMMON_del_send)
-    return NAS_FCT_DEL_SEND;
-
-  if (gc->fct==nasmt_ASCTL_DC_send_sig_data_request)
-    return NAS_FCT_DC_SEND;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_get_dscp6(struct ipv6hdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_dscp6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_dscp6 - input parameter ipv6hdr is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  //  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
-  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasmt_TOOL_get_dscp4(struct iphdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_dscp4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_dscp4 - input parameter ipv4hdr is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  return ((iph->tos)>>5)<<3;
-}
-
-
-//---------------------------------------------------------------------------
-uint8_t *nasmt_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  uint16_t size;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_protocol6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_protocol6 - input parameter ipv6hdr is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasmt_TOOL_get_protocol6 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->nexthdr;
-  size=NAS_IPV6_SIZE;
-
-  while (1) {
-    switch(*protocol) {
-    case IPPROTO_UDP:
-    case IPPROTO_TCP:
-    case IPPROTO_ICMPV6:
-      return (uint8_t *)((uint8_t *)iph+size);
-
-    case IPPROTO_HOPOPTS:
-    case IPPROTO_ROUTING:
-    case IPPROTO_DSTOPTS:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]*8+8;
-      break;
-
-    case IPPROTO_FRAGMENT:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]+8;
-      break;
-
-    case IPPROTO_NONE:
-    case IPPROTO_AH:
-    case IPPROTO_ESP:
-    default:
-      return NULL;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasmt_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_get_protocol4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasmt_TOOL_get_protocol4 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasmt_TOOL_get_protocol4 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->protocol;
-
-  switch(*protocol) {
-  case IPPROTO_UDP:
-  case IPPROTO_TCP:
-  case IPPROTO_ICMP:
-    return (uint8_t *)((uint8_t *)iph+iph->tot_len);
-
-  default:
-    return NULL;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasmt_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_imei2iid - begin \n");
-#endif
-
-  if (imei==NULL) {
-    printk("nasmt_TOOL_imei2iid - input parameter imei is NULL \n");
-    return;
-  }
-
-  if (iid==NULL) {
-    printk("nasmt_TOOL_imei2iid - input parameter iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x03;
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasmt_TOOL_eth_imei2iid(unsigned char *imei, unsigned char *addr ,unsigned char *iid, unsigned char len)
-{
-  //---------------------------------------------------------------------------
-  unsigned int index;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_eth_imei2iid - begin \n");
-#endif
-
-  if (!imei || !addr || !iid) {
-    printk("OAI_NW_DRV_TOOL_eNB_IMEI2IID - input parameter imei, addr or iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // set addr (should be device HW address)
-  memset(addr, 0, len);
-  addr[0] = 0x00;  // to be compatible between link local and global
-
-  // len -1 because of insertion of 0 above
-  for (index = 0; index < (len-1); index++) {
-    addr[index+1] = 16*imei[index*2]+imei[index*2+1];
-  }
-
-  // set iid6
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x02;
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 0xff;
-  iid[4] = 0xfe;
-  iid[5] = 16*imei[4]+imei[5];
-  iid[6] = 16*imei[6]+imei[7];
-  iid[7] = 16*imei[8]+imei[9];
-
-}
-
-//---------------------------------------------------------------------------
-void nasmt_TOOL_pk_icmp6(struct icmp6hdr *icmph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef GRAAL_DEBUG_TOOL
-  printk("nasmt_TOOL_pk_icmp6 - begin \n");
-#endif
-
-  if (!icmph) {
-    printk("nasmt_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
-
-  switch(icmph->icmp6_type) {
-  case ICMPV6_DEST_UNREACH:
-    printk("Destination unreachable\n");
-    break;
-
-  case ICMPV6_PKT_TOOBIG:
-    printk("Packet too big\n");
-    break;
-
-  case ICMPV6_TIME_EXCEED:
-    printk("Time exceeded\n");
-    break;
-
-  case ICMPV6_PARAMPROB:
-    printk("Parameter problem\n");
-    break;
-
-  case ICMPV6_ECHO_REQUEST:
-    printk("Echo request\n");
-    break;
-
-  case ICMPV6_ECHO_REPLY:
-    printk("Echo reply\n");
-    break;
-
-  case ICMPV6_MGM_QUERY:
-    printk("Multicast listener query\n");
-    break;
-
-  case ICMPV6_MGM_REPORT:
-    printk("Multicast listener report\n");
-    break;
-
-  case ICMPV6_MGM_REDUCTION:
-    printk("Multicast listener done\n");
-    break;
-
-  case NDISC_ROUTER_SOLICITATION:
-    printk("Router solicitation\n");
-    break;
-
-  case NDISC_ROUTER_ADVERTISEMENT:
-    printk("Router advertisment\n");
-    break;
-
-  case NDISC_NEIGHBOUR_SOLICITATION:
-    printk("Neighbour solicitation\n");
-    break;
-
-  case NDISC_NEIGHBOUR_ADVERTISEMENT:
-    printk("Neighbour advertisment\n");
-    break;
-
-  case NDISC_REDIRECT:
-    printk("redirect message\n");
-    break;
-  }
-}
-
-//---------------------------------------------------------------------------
-void nasmt_TOOL_print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case  NAS_IDLE:
-    printk("NAS_IDLE\n");
-    return;
-
-  case  NAS_CX_FACH:
-    printk("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printk("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printk("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printk("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printk("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printk("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printk("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printk("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printk("NAS_RB_RELEASING\n");
-    return;
-
-  case  NAS_RB_DCH:
-    printk("NAS_RB_DCH\n");
-    return;
-
-  default:
-    printk("nasmt_TOOL_print_state - Unknown state\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Print the content of a buffer in hexadecimal
-void nasmt_TOOL_print_buffer(unsigned char * buffer,int length)
-{
-  //-----------------------------------------------------------------------------
-  int i;
-
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_buffer - begin \n");
-#endif
-
-  if (buffer==NULL) {
-    printk("nasmt_TOOL_print_buffer - input parameter buffer is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nBuffer content: ");
-
-  for (i=0; i<length; i++)
-    printk("-%hx-",buffer[i]);
-
-  printk(",\t length %d\n", length);
-}
-//-----------------------------------------------------------------------------
-void nasmt_TOOL_print_rb_entity(struct rb_entity *rb)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_rb_entity - begin \n");
-#endif
-
-  if (rb==NULL) {
-    printk("nasmt_TOOL_print_rb_entity - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
-  printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
-};
-
-//-----------------------------------------------------------------------------
-void nasmt_TOOL_print_classifier(struct classifier_entity *gc)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasmt_TOOL_print_classifier - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasmt_TOOL_print_classifier - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
-  printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
-  nasmt_TOOL_print_rb_entity(gc->rb);
-};
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h b/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h
deleted file mode 100644
index c5754e948e..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASMT/nasmt_variables.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_variables.h
-* \brief Variable and structure definitions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASMTD_VAR_H
-#define _NASMTD_VAR_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <linux/unistd.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-#include "rrc_nas_primitives.h"
-#include "rrc_qos_classes.h"
-#include "rrc_nas_sap.h"
-
-#include "nasmt_constant.h"
-#include "nasmt_sap.h"
-
-struct cx_entity;
-
-struct rb_entity {
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;  //ue_rbId
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  nasQoSTrafficClass_t RadioQosClass;
-  nasIPdscp_t dscp;
-  uint8_t state;
-  uint8_t result;
-  uint8_t retry;
-  uint32_t countimer;
-  struct rb_entity *next;
-};
-
-struct classifier_entity {
-  uint32_t classref;               // classifier identity
-  uint8_t version;                 // IP version 4 or 6
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr;                    // IP source address
-  uint8_t splen;                   // IP prefix size
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr;                    // IP destination address
-  uint8_t dplen;                   // IP prefix size
-  uint8_t protocol;                 // layer 4 protocol type (tcp, udp, ...)
-  uint16_t sport;                   // source port
-  uint16_t dport;                   // destination port
-  struct rb_entity *rb;
-  nasRadioBearerId_t rab_id;  // RAB identification
-  void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-  struct classifier_entity *next;
-};
-
-
-struct cx_entity {
-  int sap[NAS_SAPI_CX_MAX];
-  uint8_t state;                     // state of the connection
-  nasLocalConnectionRef_t lcr;  // Local connection reference
-  nasCellID_t cellid;           // cell identification
-  uint32_t countimer;                // timeout's counter
-  uint8_t retry;                     // number of retransmissions
-  struct classifier_entity *sclassifier[NAS_DSCP_MAX]; // send classifiers table
-  uint16_t nsclassifier;
-  uint32_t iid6[2];                  // IPv6  interface identification
-  uint8_t iid4;                      // IPv4 interface identification
-  struct rb_entity *rb;
-  uint16_t num_rb;
-  //measures
-  int req_prov_id[MAX_MEASURE_NB];
-  int num_measures;
-  int meas_cell_id[MAX_MEASURE_NB];
-  int meas_level[MAX_MEASURE_NB];
-  int provider_id[MAX_MEASURE_NB];
-  //MBMS
-  int joined_services[NASMT_MBMS_SVCES_MAX];
-
-};
-
-struct nas_priv {
-  int irq;
-  int rx_flags;
-  struct timer_list timer;
-  spinlock_t lock;
-  struct net_device_stats stats;
-  uint8_t retry_limit;
-  uint32_t timer_establishment;
-  uint32_t timer_release;
-  struct cx_entity cx[NAS_CX_MAX];
-  struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier
-  uint16_t nrclassifier;
-  uint32_t next_sclassref;
-  int sap[NAS_SAPI_MAX];
-  uint8_t xbuffer[NAS_MAX_LENGTH]; // transmission buffer
-  uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer
-};
-
-struct ipversion {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-  uint8_t    reserved:4,
-             version:4;
-#else
-  uint8_t    version:4,
-             reserved:4;
-#endif
-};
-
-typedef struct pdcp_data_req_header_t {
-  unsigned int             rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  unsigned int            rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_ind_header_t;
-//
-
-extern struct nas_priv *gpriv;
-extern struct net_device *gdev;
-//extern int bytes_wrote;
-//extern int bytes_read;
-
-extern uint8_t NAS_NULL_IMEI[14];
-extern uint8_t NAS_RG_IMEI[14];
-
-//global variables shared with RRC
-extern int *pt_nas_ue_irq;
-//extern uint8_t nas_IMEI[14];
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile b/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile
deleted file mode 100755
index 758fa0420b..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# NAS CELLULAR Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef NAS_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DNAS_DRIVER_TYPE_ETHERNET 
-endif
-
-
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      NASRGCELL extra compilation flags
-####################################################
-#RTAI=1
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_RG
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nascellrg.o
-nascellrg-objs += nasrg_device.o
-nascellrg-objs += nasrg_common.o
-nascellrg-objs += nasrg_iocontrol.o
-nascellrg-objs += nasrg_classifier.o
-nascellrg-objs += nasrg_tool.o
-nascellrg-objs += nasrg_ascontrol.o
-ifdef PDCP_USE_NETLINK
-nascellrg-objs += nasrg_netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo RRC_DIR $(RRC_DIR)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c
deleted file mode 100644
index 4a6ef0e275..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_ascontrol.c
+++ /dev/null
@@ -1,1494 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_ascontrol.c
-* \brief Access Stratum Control functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifdef NODE_RG
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-//---------------------------------------------------------------------------
-void nasrg_ASCTL_init(void)
-{
-  //---------------------------------------------------------------------------
-  int cxi, i;
-
-  gpriv->next_sclassref = NASRG_DEFAULTRAB_CLASSREF;
-
-  // Initialize MBMS services list in MT
-  for (cxi=0; cxi<NAS_CX_MAX ; ++cxi) {
-    for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++) {
-      gpriv->cx[cxi].requested_joined_services[i]= -1;
-      gpriv->cx[cxi].requested_left_services[i]= -1;
-      gpriv->cx[cxi].joined_services[i]= -1;
-    }
-  }
-
-  printk("nasrg_ASCTL_init Complete\n");
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ASCTL_write(int sap, unsigned char *data_buffer, unsigned int data_length)
-{
-  //---------------------------------------------------------------------------
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xmit_buffer [NAS_MESSAGE_MAXLEN];
-
-  //write SAP_Id
-  switch (sap) {
-  case RRC_DEVICE_GC:
-    xmit_buffer[0] = RRC_NAS_GC_IN;
-    break;
-
-  case RRC_DEVICE_NT:
-    xmit_buffer[0] = RRC_NAS_NT_IN;
-    break;
-
-  case RRC_DEVICE_DC_INPUT0:
-    xmit_buffer[0] = RRC_NAS_DC0_IN;
-    break;
-
-  case RRC_DEVICE_DC_INPUT1:
-    xmit_buffer[0] = RRC_NAS_DC1_IN;
-    //case RRC_DEVICE_DC_INPUT2:
-    //xmit_buffer[0] = RRC_NAS_DC2_IN;
-    break;
-
-  default:
-    printk("nasrg_ASCTL_write - ERROR - Invalid SAP %d\n", sap);
-    return 0;
-    break;
-  }
-
-  memcpy (&((char*)xmit_buffer)[1], data_buffer, data_length);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_write - Sending data to RRC, sap %d, length %d (including NETLINK SAP value)\n", sap, data_length+1);
-  nasrg_TOOL_print_buffer(xmit_buffer,data_length+1);
-#endif
-  bytes_wrote = nasrg_netlink_send(xmit_buffer,data_length+1, NASNL_DEST_RRC);
-#else
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);  //original version
-  bytes_wrote = rtf_put(sap, data_buffer, data_length+1);
-#endif //PDCP_USE_NETLINK
-  return bytes_wrote-1;
-}
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a radio bearer
-//Equivalent to rb add send 0 5 2
-void nasrg_ASCTL_start_default_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-#ifdef DEMO_3GSM
-  struct rb_entity *rb;
-  int status;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_rb - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_start_default_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  rb = nasrg_COMMON_add_rb(cx, NASRG_DEFAULTRAB_RBID, NASRG_DEFAULTRAB_QoS);
-
-  if (rb!=NULL) {
-    rb->cnxid = (NAS_RB_MAX_NUM * cx->lcr)+1;
-    //rb->default_rab =1;
-    rb->dscp = NASRG_DEFAULTRAB_DSCP;
-    rb->dscp_ul = NASRG_DEFAULTRAB_DSCP;
-    status=nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-  } else
-    status=-NAS_ERROR_NOMEMORY;
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_rb - end %d \n",status);
-#endif
-}
-#endif
-
-//---------------------------------------------------------------------------
-//For demo, add automatically a classifier
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasrg_ASCTL_start_default_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_default_sclassifier - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_start_default_sclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  gc=nasrg_CLASS_add_sclassifier(cx, NAS_DSCP_DEFAULT, gpriv->next_sclassref);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_default_sclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  // copy locator part of address into the gc structure
-  //gc->daddr.ipv6.s6_addr32[0] = 0;
-  //gc->daddr.ipv6.s6_addr32[1] = 0;
-  //gc->daddr.ipv6.s6_addr32[2] = 0;
-  //gc->daddr.ipv6.s6_addr32[3] = 0;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_default_sclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Add automatically a classifier on DSCP
-//Equivalent to class add send 0 -f qos <x> -cr 0
-void nasrg_ASCTL_start_sclassifier(struct cx_entity *cx,struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_sclassifier - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_start_sclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  gc=nasrg_CLASS_add_sclassifier(cx, rb->dscp, gpriv->next_sclassref);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_sclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =rb->rab_id;
-  gc->rb= rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-  gc->dplen= NAS_DEFAULT_IPv6_PREFIX_LENGTH;
-  // copy locator part of address into the gc structure
-  gc->daddr.ipv6.s6_addr32[2] = cx->iid6[0];
-  gc->daddr.ipv6.s6_addr32[3] = cx->iid6[1];
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_sclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Add automatically a classifier for mbms
-void nasrg_ASCTL_start_mbmsclassifier(int mbms_ix,struct rb_entity *mbms_rb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_mbmsclassifier - begin \n");
-#endif
-
-  if (!mbms_rb) {
-    printk("nasrg_ASCTL_start_mbmsclassifier - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  //
-  //  gc=nasrg_CLASS_add_mbmsclassifier(mbms_ix, gpriv->next_mbmsclassref);
-  gc=nasrg_CLASS_add_mbmsclassifier(mbms_ix, gpriv->next_sclassref++);
-
-  if (gc==NULL) {
-    printk("nasrg_ASCTL_start_mbmsclassifier - Classifier pointer is null : not added \n");
-    return;
-  }
-
-  gc->fct = nasrg_COMMON_QOS_send;
-  gc->rab_id =mbms_rb->mbms_rbId;
-  gc->rb= mbms_rb;
-  gc->version = NASRG_DEFAULTRAB_IPVERSION;
-  gc->protocol= NAS_PROTOCOL_DEFAULT;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_ASCTL_start_mbmsclassifier - end \n");
-  nasrg_TOOL_print_classifier(gc);
-#endif
-}
-
-//---------------------------------------------------------------------------
-//Notifies automatically UE on default MBMS service
-void nasrg_ASCTL_start_default_ue_notification(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_ue_notification - begin \n");
-#endif
-
-  if (!cx) {
-    printk("\nERROR nasrg_ASCTL_start_default_ue_notification - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  // set value for default MBMS service
-  cx->requested_joined_services[0] = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-  nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-}
-
-//---------------------------------------------------------------------------
-//Notifies automatically UE on default MBMS service
-void nasrg_ASCTL_start_default_mbms_service(void)
-{
-  //---------------------------------------------------------------------------
-  int mbms_ix=0; // should allocate index based on Service_id /cnxid / MC IP address
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_start_default_mbms_service - begin \n");
-#endif
-
-  // Establish MBMS bearer if not already done
-  if ((gpriv->mbms_rb[mbms_ix].state != NAS_CX_DCH)&&(gpriv->mbms_rb[mbms_ix].state != NAS_RB_ESTABLISHING)) {
-    gpriv->mbms_rb[mbms_ix].cnxid = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-    gpriv->mbms_rb[mbms_ix].serviceId = (NAS_CX_MAX*NAS_RB_MAX_NUM) +1;
-    gpriv->mbms_rb[mbms_ix].sessionId = NASRG_TEMP_MBMS_SESSION_ID; //Temp hard coded
-    gpriv->mbms_rb[mbms_ix].mbms_rbId = NASRG_DEFAULTRAB_RBID;
-    gpriv->mbms_rb[mbms_ix].sapi = NAS_DC_INPUT_SAPI;
-#ifdef NAS_DEBUG_MBMS_PROT
-    gpriv->mbms_rb[mbms_ix].sapi = NAS_DRB_INPUT_SAPI; //Only one RT-FIFO is used
-#endif
-    gpriv->mbms_rb[mbms_ix].qos = 20; //from first version of MBMS traces
-    gpriv->mbms_rb[mbms_ix].dscp = 0; //maybe 7
-    gpriv->mbms_rb[mbms_ix].duration = NASRG_TEMP_MBMS_DURATION; //Temp hard coded
-    //memcpy ((char *)&(gpriv->mbms_rb[mbms_ix].mcast_address),(char *)&(msgreq->mcast_group), 16);
-    gpriv->mbms_rb[mbms_ix].mcast_address[0] = 0xFF;
-    gpriv->mbms_rb[mbms_ix].mcast_address[1] = 0x0E;
-    nasrg_ASCTL_GC_send_mbms_bearer_establish_req(mbms_ix);
-  } else {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_start_default_mbms_service - skipped, mbms_rb.state = %d \n", gpriv->mbms_rb[mbms_ix].state);
-#endif
-  }
-}
-//---------------------------------------------------------------------------
-void nasrg_ASCTL_timer(unsigned long data)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx;
-  struct rb_entity *rb;
-  spin_lock(&gpriv->lock);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasrg_ASCTL_timer - begin \n");
-#endif
-  (gpriv->timer).function = nasrg_ASCTL_timer;
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-
-  for (cxi=0; cxi<NAS_CX_MAX ; ++cxi) {
-    cx=gpriv->cx+cxi;
-
-    if (!cx) {
-      printk("nasrg_ASCTL_timer - No pointer for connection %d \n", cxi);
-      continue;
-    }
-
-    for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-      if (rb->countimer!=NAS_TIMER_IDLE) {
-#ifdef NAS_DEBUG_TIMER
-        printk("nasrg_ASCTL_timer : rb countimer %d, rb state %d\n", rb->countimer, rb->state);
-#endif
-
-        if (rb->countimer==0) {
-          switch (rb->state) {
-          case NAS_CX_CONNECTING:
-          case NAS_CX_CONNECTING_FAILURE:  // MW - 15/01/07 Useless, currently no retry if failure
-            if (rb->retry<gpriv->retry_limit) {
-              printk("nasrg_ASCTL_timer: Retry RB establishment %d\n", rb->retry);
-              nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-            } else {
-              printk("nasrg_ASCTL_timer: RB Establishment failure\n");
-              rb->state=NAS_IDLE;
-              rb->countimer=NAS_TIMER_IDLE;
-            }
-
-            break;
-
-          case NAS_CX_DCH:
-#ifdef DEMO_3GSM
-            if (cx->num_rb == 1) {
-              nasrg_ASCTL_start_default_sclassifier(cx, rb);
-            }
-
-#endif
-            nasrg_ASCTL_start_sclassifier(cx, rb);
-            rb->countimer=NAS_TIMER_IDLE;
-            break;
-
-          case NAS_CX_RELEASING_FAILURE:
-            nasrg_ASCTL_DC_send_rb_release_request(cx, rb);
-            break;
-
-          default:
-            rb->countimer=NAS_TIMER_IDLE;
-          }
-        } else {
-          --rb->countimer;
-          printk("nasrg_ASCTL_timer : rb countimer-- %d, rb state %d\n", rb->countimer, rb->state);
-        }
-      }
-    }
-  }
-
-  add_timer(&gpriv->timer);
-#ifdef NAS_DEBUG_TIMER
-  printk("nasrg_ASCTL_timer - end \n");
-#endif
-  spin_unlock(&gpriv->lock);
-}
-
-
-/***************************************************************************
-     Transmission side
- ***************************************************************************/
-//---------------------------------------------------------------------------
-// Encode INFO_BROADCAST_REQ message
-int nasrg_ASCTL_GC_send_broadcast_request(uint8_t category)
-{
-  //---------------------------------------------------------------------------
-  char *xmit_data = "TESTING BROADCASTING ROUTER ADVERTISEMENT. TESTING BROADCASTING ROUTER ADVERTISEMENT. BROADCASTING ROUTER.\0";
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  struct nas_rg_gc_element *p;
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = INFO_BROADCAST_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASInfoBroadcastReq);
-  //
-  p->nasRGGCPrimitive.broadcast_req.period = 0;
-  p->nasRGGCPrimitive.broadcast_req.category = category;
-  p->nasRGGCPrimitive.broadcast_req.nasDataLength = strlen(xmit_data)+1;  // TBD
-
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasrg_ASCTL_GC_send_broadcast_request - Wrote %d bytes to RRC NAS_GC_SAPII\n", bytes_wrote);
-
-  //bytes_wrote += rtf_put(gpriv->sap[NAS_GC_SAPI], xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-  count += p->nasRGGCPrimitive.broadcast_req.nasDataLength;
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write((gpriv->sap[NAS_GC_SAPI], xmit_data, p->nasRGGCPrimitive.broadcast_req.nasDataLength);
-#endif
-
-  if (bytes_wrote==p->length+p->nasRGGCPrimitive.broadcast_req.nasDataLength) {
-#ifdef NAS_DEBUG_GC
-    printk("nasrg_ASCTL_GC_send_broadcast: INFO_BROADCAST_REQ primitive sent successfully in GC-FIFO\n");
-#endif
-  } else {
-    printk("nasrg_ASCTL_GC_send_broadcast: Message sent failure in GC-FIFO\n");
-  }
-  return bytes_wrote;
-}
-
-
-//---------------------------------------------------------------------------
-// Encode INFO_BROADCAST_REQ message for RRC SIB1
-int nasrg_ASCTL_GC_send_SIB1_broadcast_request(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  char sib1_flag; // will be used for reception in nas_ue
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_GC
-  printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - input parameter is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = INFO_BROADCAST_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASInfoBroadcastReq);
-  //
-  p->nasRGGCPrimitive.broadcast_req.period = 10; // to be checked
-  p->nasRGGCPrimitive.broadcast_req.category = 1;
-  p->nasRGGCPrimitive.broadcast_req.nasDataLength = skb->len+1;  // TBD
-  sib1_flag = 1;
-  // send header
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length); //original version
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-#endif
-  //printk("nasrg_ASCTL_GC_send_broadcast_request - Wrote %d bytes to RRC NAS_GC_SAPII\n", bytes_wrote);
-
-
-  if (bytes_wrote!=p->length) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: Header send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-  // send sib1_flag
-  //bytes_wrote +=  rtf_put(gpriv->sap[NAS_GC_SAPI], &sib1_flag, 1);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)&sib1_flag, 1);
-  count += 1;
-  bytes_wrote = count;
-#else
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)&sib1_flag, 1);
-#endif
-
-  if (bytes_wrote!=p->length+1) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: sib1_flag send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-  // send data
-  //bytes_wrote += rtf_put(gpriv->sap[NAS_GC_SAPI], skb->data, skb->len);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], skb->data, skb->len);
-#endif
-
-
-  if (bytes_wrote!=p->length+skb->len+1) {
-    printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request: Data send failure in GC-FIFO\n");
-    return bytes_wrote;
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_GC_send_SIB1_broadcast_request - end \n");
-#endif
-  return bytes_wrote;
-}
-
-//-----------------------------------------------------------------------------
-// Encode MBMS_BEARER_ESTABLISH_REQ message
-int nasrg_ASCTL_GC_send_mbms_bearer_establish_req(int mbms_ix )
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  int bytes_wrote = 0;
-
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-  p->type = MBMS_BEARER_ESTABLISH_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSBearerEstablishReq);
-  //
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId = gpriv->mbms_rb[mbms_ix].serviceId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_sessionId = gpriv->mbms_rb[mbms_ix].sessionId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_sapId = gpriv->mbms_rb[mbms_ix].sapi;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_QoSclass = gpriv->mbms_rb[mbms_ix].qos;
-  p->nasRGGCPrimitive.mbms_establish_req.mbms_duration = gpriv->mbms_rb[mbms_ix].duration;
-  gpriv->mbms_rb[mbms_ix].state = NAS_RB_ESTABLISHING;
-  //
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_GC
-    printk(" nasrg_ASCTL_GC_send_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_REQ primitive sent successfully in GC-FIFO\n");
-    printk(" ServiceId %d, RB_Id %d , qos class %d \n",
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId,
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId,
-           p->nasRGGCPrimitive.mbms_establish_req.mbms_QoSclass);
-#endif
-  } else {
-    printk("nasrg_ASCTL_GC_send_mbms_bearer_establish: Message sent failure in GC-FIFO\n");
-  }
-
-  return bytes_wrote;
-}
-
-//-----------------------------------------------------------------------------
-// HNN - Encode MBMS_BEARER_RELEASE_REQ message
-int nasrg_ASCTL_GC_send_mbms_bearer_release_req(int mbms_ix)
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_gc_element *p;
-  uint16_t classref=0;
-  int bytes_wrote = 0;
-
-  p= (struct nas_rg_gc_element *)(gpriv->xbuffer);
-
-  p->type = MBMS_BEARER_RELEASE_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSBearerReleaseReq);
-  //
-  p->nasRGGCPrimitive.mbms_release_req.mbms_serviceId = gpriv->mbms_rb[mbms_ix].serviceId;
-  p->nasRGGCPrimitive.mbms_release_req.mbms_sessionId = gpriv->mbms_rb[mbms_ix].sessionId;
-  p->nasRGGCPrimitive.mbms_release_req.mbms_rbId = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-  //gpriv->mbms_rb[mbms_ix].state = NAS_RB_RELEASING;
-  //
-  //bytes_wrote = rtf_put(gpriv->sap[NAS_GC_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(gpriv->sap[NAS_GC_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_GC
-    printk(" nasrg_ASCTL_GC_send_mbms_bearer_release: MBMS_BEARER_RELEASE_REQ primitive sent successfully in GC-FIFO\n");
-    printk(" ServiceId %d, RB_Id %d \n", p->nasRGGCPrimitive.mbms_establish_req.mbms_serviceId, p->nasRGGCPrimitive.mbms_establish_req.mbms_rbId);
-#endif
-    // clean NASRG private structures
-    classref =  (gpriv->mbmsclassifier[mbms_ix])->classref;
-    nasrg_CLASS_del_mbmsclassifier(mbms_ix, classref);
-    //nasrg_CLASS_flush_mbmsclassifier();
-    //gpriv->mbms_rb[mbms_ix].state = NAS_IDLE;
-    memset (&(gpriv->mbms_rb[mbms_ix]),0,sizeof (struct rb_entity));
-  } else {
-    printk("nasrg_ASCTL_GC_send_mbms_bearer_release: Message sent failure in GC-FIFO\n");
-  }
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Confirm the establishment of a connection (DC channel)
-int nasrg_ASCTL_DC_send_cx_establish_confirm(struct cx_entity *cx, uint8_t response)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_cx_establish - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_cx_establish - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = CONN_ESTABLISH_CNF;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASConnEstablishConf);
-  p->nasRGDCPrimitive.conn_establish_conf.localConnectionRef = cx->lcr;
-  p->nasRGDCPrimitive.conn_establish_conf.status = response;  // can be ACCEPTED  or FAILURE
-  p->nasRGDCPrimitive.conn_establish_conf.num_RBs = 0; // Hard coded in first step
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_cx_establish: CONN_ESTABLISH_CNF primitive sent successfully in DC-FIFO\n");
-    printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.conn_establish_conf.localConnectionRef);
-    printk(" Status %u\n",p->nasRGDCPrimitive.conn_establish_conf.status);
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_cx_establish: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Request the establishment of a radio bearer
-int nasrg_ASCTL_DC_send_rb_establish_request(struct cx_entity *cx, struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_rb_establish - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_DC_send_rb_establish - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch(rb->state) {
-  case NAS_CX_CONNECTING:
-  case NAS_CX_CONNECTING_FAILURE:
-  case NAS_IDLE:
-    ++rb->retry;
-    rb->countimer=gpriv->timer_establishment;
-
-    if (cx->state==NAS_CX_DCH) {
-      p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-      p->type = RB_ESTABLISH_REQ;
-      p->length =  NAS_TL_SIZE + sizeof(struct NASrbEstablishReq);
-      p->nasRGDCPrimitive.rb_establish_req.localConnectionRef = cx->lcr;
-      p->nasRGDCPrimitive.rb_establish_req.rbId = rb->rab_id + (NAS_RB_MAX_NUM * cx->lcr);
-      p->nasRGDCPrimitive.rb_establish_req.QoSclass = rb->qos;
-      p->nasRGDCPrimitive.rb_establish_req.dscp = rb->dscp_ul;
-      //
-      //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-      bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-      if (bytes_wrote==p->length) {
-        rb->state=NAS_CX_CONNECTING;
-#ifdef NAS_DEBUG_DC
-        printk(" nasrg_ASCTL_DC_send_rb_establish: RB_ESTABLISH_REQ primitive sent successfully in DC-FIFO\n");
-        printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.rb_establish_req.localConnectionRef);
-        printk(" Radio Bearer identification %u\n",p->nasRGDCPrimitive.rb_establish_req.rbId);
-        printk(" QoS %u\n",p->nasRGDCPrimitive.rb_establish_req.QoSclass);
-#endif
-      } else {
-        rb->state=NAS_CX_CONNECTING_FAILURE;
-        printk("nasrg_ASCTL_DC_send_rb_establish: Message sent failure in DC-FIFO\n");
-      }
-
-      return bytes_wrote;
-    } else {
-      rb->state=NAS_CX_CONNECTING_FAILURE;
-      printk("nasrg_ASCTL_DC_send_rb_establish: Failure \n");
-      return 0;
-    }
-
-  default:
-    return -NAS_ERROR_NOTIDLE;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a radio bearer
-int nasrg_ASCTL_DC_send_rb_release_request(struct cx_entity *cx, struct rb_entity *rb)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_rb_release - begin \n");
-#endif
-
-  if (!cx || !rb) {
-    printk("nasrg_ASCTL_DC_send_rb_release - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  switch (rb->state) {
-  case NAS_CX_RELEASING_FAILURE:
-  case NAS_CX_DCH:
-    p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-    p->type = RB_RELEASE_REQ;
-    p->length =  NAS_TL_SIZE + sizeof(struct NASrbReleaseReq);
-    p->nasRGDCPrimitive.rb_release_req.localConnectionRef = cx->lcr;
-    p->nasRGDCPrimitive.rb_release_req.rbId = rb->rab_id + (NAS_RB_MAX_NUM * cx->lcr);
-    //
-    //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-    bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-    if (bytes_wrote) {
-      rb->state=NAS_IDLE;
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_ASCTL_DC_send_rb_release: RB_RELEASE_REQ primitive sent successfully in DC-FIFO\n");
-#endif
-    } else {
-      ++rb->retry;
-      rb->countimer=gpriv->timer_release;
-      rb->state=NAS_CX_RELEASING_FAILURE;
-      printk("nasrg_ASCTL_DC_send_rb_release: Message sent failure in DC-FIFO\n");
-    }
-
-    return bytes_wrote;
-
-  default:
-    return -NAS_ERROR_NOTCONNECTED;
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Request the notification of a UE to joined or left services
-int nasrg_ASCTL_DC_send_mbms_ue_notify_req(struct cx_entity *cx)
-{
-  //-----------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int i;
-  int bytes_wrote = 0;
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req - input parameter is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = MBMS_UE_NOTIFY_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASMBMSUENotifyReq);
-  //
-  p->nasRGDCPrimitive.mbms_ue_notify_req.localConnectionRef = cx->lcr;
-
-  // joined/left services are lists of MAX_MBMS_SERVICES
-  // -1 means the end of the list
-  for (i = 0; i < MAX_MBMS_SERVICES; i++) {
-    p->nasRGDCPrimitive.mbms_ue_notify_req.joined_services[i].mbms_serviceId = (nasMBMSServiceId_t)cx->requested_joined_services[i];
-    p->nasRGDCPrimitive.mbms_ue_notify_req.left_services[i].mbms_serviceId = (nasMBMSServiceId_t)cx->requested_left_services[i];
-  }
-
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req: MBMS_UE_NOTIFY_REQ primitive sent successfully in DC-FIFO\n");
-    printk(" lcr (Mobile_id) %u\n",p->nasRGDCPrimitive.mbms_ue_notify_req.localConnectionRef);
-    printk(" joined service %d, left service %d\n",cx->requested_joined_services[0], cx->requested_left_services[0] );
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_mbms_ue_notify_req: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (DC SAP)
-void nasrg_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-#ifdef PDCP_USE_NETLINK
-  unsigned char xbuffer[NAS_MESSAGE_MAXLEN];
-  int count=0;
-#endif
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_sig_data - begin \n");
-#endif
-
-  if (!skb || !gc || !cx) {
-    printk("nasrg_ASCTL_DC_send_sig_data - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (cx->state!=NAS_CX_DCH) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Not connected, so the message is dropped\n");
-    ++gpriv->stats.tx_dropped;
-    return;
-  }
-
-  p = (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = DATA_TRANSFER_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASDataReq);
-  p->nasRGDCPrimitive.data_transfer_req.localConnectionRef = cx->lcr;
-  p->nasRGDCPrimitive.data_transfer_req.priority = NAS_SIG_SRB3;
-  p->nasRGDCPrimitive.data_transfer_req.nasDataLength = skb->len;
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-#ifdef PDCP_USE_NETLINK
-  memcpy(xbuffer,(unsigned char *)p, p->length);
-  count = p->length;
-  bytes_wrote = count;
-#else
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-#endif
-
-  if (bytes_wrote!=p->length) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Header sent failure in DC-FIFO\n");
-    return;
-  }
-
-  //bytes_wrote += rtf_put(cx->sap[NAS_DC_INPUT_SAPI], skb->data, skb->len);
-#ifdef PDCP_USE_NETLINK
-  memcpy(&(xbuffer[count]),(unsigned char *)skb->data, skb->len);
-  count += skb->len;
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], xbuffer, count);
-#else
-  bytes_wrote += nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)skb->data, skb->len);
-#endif
-
-  if (bytes_wrote!=p->length+skb->len) {
-    printk("nasrg_ASCTL_DC_send_sig_data: Data sent failure in DC-FIFO\n");
-    return;
-  }
-
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_sig_data - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Confirm the establishment of a connection (DC channel)
-int nasrg_ASCTL_DC_send_eNBmeasurement_req(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct nas_rg_dc_element *p;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_send_eNBmeasurement_req - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req - input parameter cx is NULL \n");
-    return NAS_ERROR_NOTCORRECTVALUE;
-  }
-
-  // End debug information
-  p= (struct nas_rg_dc_element *)(gpriv->xbuffer);
-  p->type = ENB_MEASUREMENT_REQ;
-  p->length =  NAS_TL_SIZE + sizeof(struct NASENbMeasureReq);
-  p->nasRGDCPrimitive.eNBmeasurement_req.cell_id = cx->cellid;
-  //
-  //bytes_wrote = rtf_put(cx->sap[NAS_DC_INPUT_SAPI], p, p->length);
-  bytes_wrote = nasrg_ASCTL_write(cx->sap[NAS_DC_INPUT_SAPI], (unsigned char *)p, p->length);
-
-  if (bytes_wrote==p->length) {
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req: ENB_MEASUREMENT_REQ primitive sent successfully in DC-FIFO\n");
-    printk(" cell_id %u\n",p->nasRGDCPrimitive.eNBmeasurement_req.cell_id);
-#endif
-  } else
-    printk("nasrg_ASCTL_DC_send_eNBmeasurement_req: Message transmission failure to DC-FIFO\n");
-
-  return bytes_wrote;
-}
-
-/***************************************************************************
-     Reception side
- ***************************************************************************/
-
-//---------------------------------------------------------------------------
-// Decode CONN_ESTABLISH_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_establish_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (nasrg_ASCTL_DC_send_cx_establish_confirm(cx, ACCEPTED)>0) {
-    nasrg_TOOL_imei2iid(p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI, (uint8_t *)cx->iid6);
-    cx->iid4=97;  // A AUTOMATISER
-    cx->lcr = p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef;
-    cx->state=NAS_CX_DCH;
-#ifdef NAS_DEBUG_DC
-    printk("nasrg_ASCTL_DC_decode_cx_establish: CONN_ESTABLISH_IND reception\n");
-    printk(" primitive length %d\n",p->length);
-    printk(" Local Connection reference %d\n",p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef);
-    printk(" IMEI ");
-
-    for (i=0; i<14; ++i)
-      printk("%u",p->nasRGDCPrimitive.conn_establish_ind.InterfaceIMEI[i]);
-
-    printk(" state ");
-    nasrg_TOOL_print_state(cx->state);
-#endif
-  }
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_RELEASE_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_release_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_release - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_release - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state=NAS_IDLE;
-  cx->iid4=0;
-  nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasrg_COMMON_flush_rb(cx);
-  nasrg_CLASS_flush_sclassifier(cx);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_release: CONN_RELEASE_IND reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.conn_release_ind.localConnectionRef);
-  printk(" Release cause %u\n",p->nasRGDCPrimitive.conn_release_ind.releaseCause);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode CONN_LOSS_IND message from RRC
-void nasrg_ASCTL_DC_decode_cx_loss_ind(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_loss - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_cx_loss - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  cx->state = NAS_IDLE;
-  cx->iid4=0;
-  nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)cx->iid6);
-  nasrg_COMMON_flush_rb(cx);
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_cx_loss: CONN_LOSS_IND reception\n");
-  printk(" Primitive length %u\n",(int)(p->length));
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-//---------------------------------------------------------------------------
-// Decode RB_ESTABLISH_CNF message from RRC
-void nasrg_ASCTL_DC_decode_rb_establish_cnf(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  int rb_id;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_rb_establish - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_rb_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  rb_id = p->nasRGDCPrimitive.rb_establish_conf.rbId;
-  rb=nasrg_COMMON_search_rb(cx, rb_id - (NAS_RB_MAX_NUM * cx->lcr));
-
-  //
-  if (rb!=NULL) {
-    if (rb->state==NAS_CX_CONNECTING) {
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF received\n");
-      printk(" Primitive length %u\n", p->length);
-      printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      printk(" RB Id %u\n",p->nasRGDCPrimitive.rb_establish_conf.rbId);
-      printk(" SAP Id %u\n",p->nasRGDCPrimitive.rb_establish_conf.sapId);
-      printk(" Status %u, Failure code %d, Cx state, RB state\n",p->nasRGDCPrimitive.rb_establish_conf.status, p->nasRGDCPrimitive.rb_establish_conf.fail_code);
-      nasrg_TOOL_print_state(cx->state);
-      nasrg_TOOL_print_state(rb->state);
-#endif
-
-      switch (p->nasRGDCPrimitive.rb_establish_conf.status) {
-      case ACCEPTED:
-        rb->state = NAS_CX_DCH;
-        rb->countimer=1;
-        break;
-
-      case FAILURE:
-        printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF rejected\n");
-        rb->state = NAS_CX_CONNECTING_FAILURE;
-        //delete rb
-        break;
-
-      default:
-        printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF reception, invalid status\n");
-      }
-    } else
-      printk("nasrg_ASCTL_DC_decode_rb_establish: invalid state %u\n", cx->state);
-  } else
-    printk("nasrg_ASCTL_DC_decode_rb_establish: RB_ESTABLISH_CNF, No corresponding radio bearer\n");
-}
-
-//---------------------------------------------------------------------------
-// Decode DATA_TRANSFER_IND message from RRC
-void nasrg_ASCTL_DC_decode_data_transfer_ind(struct cx_entity *cx, struct nas_rg_dc_element *p, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  uint8_t nasrg_data[10];
-  unsigned int nas_length;
-  char data_type;
-  int bytes_read=0;
-  unsigned int peer_command;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_data_transfer - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_data_transfer - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  bytes_read=p->length;
-  // Get first character
-  nas_length = (p->nasRGDCPrimitive.data_transfer_ind.nasDataLength) -1;
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], &data_type, 1);
-#else
-  memcpy (&data_type, (char *)(&buffer[bytes_read]), 1);
-  bytes_read ++;
-#endif
-
-  //check if peer message
-  if (data_type =='A') {
-    // receive in a skbuff
-    //nasrg_COMMON_receive((p->length) + 1, nas_length, cx->sap[NAS_DC_OUTPUT_SAPI]); // original
-#ifndef PDCP_USE_NETLINK
-    //void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasrg_COMMON_receive((p->length) + 1, nas_length, NULL, 2, cx->sap[NAS_DC_OUTPUT_SAPI]);
-#else
-    //nasrg_COMMON_receive((p->length) + 1, nas_length, (unsigned char *)p+p->length+1, 2, 0);
-    nasrg_COMMON_receive((p->length) + 1, nas_length, (unsigned char *)(&buffer[bytes_read]), 2, 0);
-#endif
-  } else {
-    // if FIFO, empty remaining data
-#ifndef PDCP_USE_NETLINK
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (gpriv->rbuffer)+ (p->length), nas_length);
-#endif
-
-    if (data_type=='Z') {
-#ifndef PDCP_USE_NETLINK
-      memcpy (&nasrg_data, (char *)(gpriv->rbuffer)+ (p->length), 10);
-#else
-      memcpy (&nasrg_data, (char *)(&buffer[bytes_read]), 10);
-#endif
-      peer_command = (int)nasrg_data[0];
-      printk("nasrg_ASCTL_DC_decode_data_transfer: Received peer message %d %d \n", nasrg_data[0], peer_command);
-      nasrg_TOOL_print_buffer(nasrg_data, 10);
-
-      if (nasrg_data[0]== NAS_CMD_OPEN_RB) {
-        // open radio bearer
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Opening Default Radio Bearer\n");
-        nasrg_ASCTL_start_default_rb(cx);
-      } else if (nasrg_data[0]== NAS_CMD_ENTER_SLEEP) {
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Entering Sleep Mode\n");
-        cx->state = NAS_CX_RELEASING;
-      } else if (nasrg_data[0]== NAS_CMD_LEAVE_SLEEP) {
-        printk("nasrg_ASCTL_DC_decode_data_transfer: Leaving Sleep Mode\n");
-        cx->state = NAS_CX_DCH;
-      } else {
-        printk("\n\nnasrg_ASCTL_DC_decode_data_transfer: Unknown peer command\n");
-      }
-    } else
-      printk("nasrg_ASCTL_DC_decode_data_transfer: Error during reception of the message - Dropped\n");
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_data_transfer: DATA_TRANSFER_IND reception\n");
-  printk(" Primitive length %u\n", p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.data_transfer_ind.localConnectionRef);
-  printk(" Data Length %u\n", p->nasRGDCPrimitive.data_transfer_ind.nasDataLength);
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_BEARER_ESTABLISH_CNF message from RRC
-void nasrg_ASCTL_DC_decode_mbms_bearer_establish_cnf(struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int mbms_ix;
-  int rb_id;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish - begin \n");
-#endif
-
-  if (!p) {
-    printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  rb_id = p->nasRGDCPrimitive.mbms_establish_cnf.rbId;
-  mbms_ix = 0;  // A revoir - find using cnxid...
-
-  if (rb_id == gpriv->mbms_rb[mbms_ix].mbms_rbId) {
-    switch (p->nasRGDCPrimitive.mbms_establish_cnf.status) {
-    case ACCEPTED:
-      gpriv->mbms_rb[mbms_ix].state = NAS_CX_DCH;
-      gpriv->mbms_rb[mbms_ix].rab_id = gpriv->mbms_rb[mbms_ix].mbms_rbId;
-      nasrg_ASCTL_start_mbmsclassifier(mbms_ix,&(gpriv->mbms_rb[mbms_ix]));
-      break;
-
-    case FAILURE:
-      printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF rejected\n");
-      gpriv->mbms_rb[mbms_ix].state = NAS_CX_CONNECTING_FAILURE; //supprimer l'entree
-      break;
-
-    default:
-      printk("nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF reception, invalid status\n");
-    }
-  } else
-    printk(" nasrg_ASCTL_DC_decode_mbms_bearer_establish: invalid RB_Id %d\n", rb_id);
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasrg_ASCTL_DC_decode_mbms_bearer_establish: MBMS_BEARER_ESTABLISH_CNF reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" rb_id %d, status %d\n",p->nasRGDCPrimitive.mbms_establish_cnf.rbId, p->nasRGDCPrimitive.mbms_establish_cnf.status);
-  nasrg_TOOL_print_state(gpriv->mbms_rb[mbms_ix].state);
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Decode MBMS_UE_NOTIFY_CNF message from RRC
-void nasrg_ASCTL_DC_decode_mbms_ue_notify_cnf(struct cx_entity *cx, struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  int i, j, k;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_mbms_ue_notify - begin \n");
-#endif
-
-  if (!cx || !p) {
-    printk("nasrg_ASCTL_DC_decode_mbms_ue_notify - input parameter is NULL \n");
-    return;
-  }
-
-  // End debug information
-  if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.mbmsStatus == ACCEPTED) {
-    for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++) {
-      if (cx->requested_joined_services[i] >=0) {
-        for (j = 0; j<NASRG_MBMS_SVCES_MAX; j++) {
-          if (cx->joined_services[j] ==-1) {
-            cx->joined_services[j]= cx->requested_joined_services[i];
-            cx->requested_joined_services[i]=-1;
-            break;
-          }
-        }
-      }
-
-      if (cx->requested_left_services[i] >=0) {
-        for (k = 0; k<NASRG_MBMS_SVCES_MAX; k++) {
-          if (cx->joined_services[k] == cx->requested_left_services[i]) {
-            cx->joined_services[k]=-1;
-            cx->requested_left_services[i]=-1;
-            break;
-          }
-        }
-      }
-    }
-  }
-
-#ifdef NAS_DEBUG_DC
-  printk(" nasrg_ASCTL_DC_decode_mbms_ue_notify: MBMS_UE_NOTIFY_CNF reception\n");
-  printk(" Primitive length %u\n",p->length);
-  printk(" Local Connection reference %u\n",p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef);
-  printk(" MBMS Status: %d\n", p->nasRGDCPrimitive.mbms_ue_notify_cnf.mbmsStatus);
-  printk(" UE services currently joined \n");
-
-  for (i = 0; i<NASRG_MBMS_SVCES_MAX; i++)
-    printk ("%d * ", cx->joined_services[i]);
-
-  nasrg_TOOL_print_state(cx->state);
-#endif
-}
-/*
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.cell_id = protocol_bs->rrc.rg_cell_id;
-  // next values are temp hard coded, to be replaced by real values
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.num_UEs = num_connected_UEs;
-  for (ix=0; ix<ralpriv->num_connected_UEs; ix++){
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].rlcBufferOccupancy = 100 - (30*ix);
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].scheduledPRB = 500 - (200*ix);
-    msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.measures[ix].totalDataVolume = 640000 + (160000*ix);
-  }
-  msgToBuild->nasRgPrimitive.dc_sap_prim.nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs = 1000;
-
-*/
-//---------------------------------------------------------------------------
-// Decode ENB_MEASUREMENT_IND message from RRC
-void nasrg_ASCTL_DC_decode_eNBmeasurement_ind(struct nas_rg_dc_element *p)
-{
-  //---------------------------------------------------------------------------
-  uint8_t i;
-  // Start debug information
-#ifdef NAS_DEBUG_DC
-  printk("nasrg_ASCTL_DC_decode_eNBmeasurement_ind - begin \n");
-#endif
-
-  if (!p) {
-    printk("nasrg_ASCTL_DC_decode_eNBmeasurement_ind - input parameter p is NULL \n");
-    return;
-  }
-
-  // End debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk(" nasrg_ASCTL_DC_decode_eNBmeasurement_ind : ENB_MEASUREMENT_IND reception\n");
-  printk(" Measured Cell: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.cell_id);
-  printk(" Number of Connected Mobiles: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs);
-
-  for (i=0; i<p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs; ++i) {
-    printk(" UE[%u]:  rlcBufferOccupancy %u, scheduledPRB: %u, totalDataVolume: %u\n", i,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].rlcBufferOccupancy,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].scheduledPRB,
-           p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].totalDataVolume);
-  }
-
-  printk(" Total number of PRBs: %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs);
-#endif
-  // store Measures
-  gpriv->measured_cell_id = p->nasRGDCPrimitive.eNBmeasurement_ind.cell_id;
-  gpriv->num_UEs = p->nasRGDCPrimitive.eNBmeasurement_ind.num_UEs;
-
-  for (i=0; i<gpriv-> num_UEs; ++i) {
-    gpriv->rlcBufferOccupancy[i] = p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].rlcBufferOccupancy;
-    gpriv->scheduledPRB[i] += p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].scheduledPRB;
-    gpriv->totalDataVolume[i] += p->nasRGDCPrimitive.eNBmeasurement_ind.measures[i].totalDataVolume;
-  }
-
-  gpriv->totalNumPRBs += p->nasRGDCPrimitive.eNBmeasurement_ind.totalNumPRBs;
-}
-
-//---------------------------------------------------------------------------
-// Check if anything in DC FIFO and process it (RG Finite State Machine)
-int nasrg_ASCTL_DC_receive(struct cx_entity *cx, char *buffer)
-{
-  //---------------------------------------------------------------------------
-  int bytes_read=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_DC_DETAIL
-  printk("nasrg_ASCTL_DC_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_ASCTL_DC_receive - input parameter cx is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read = rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI] , gpriv->rbuffer, NAS_TL_SIZE);
-#else
-  bytes_read = NAS_TL_SIZE;
-#endif
-
-  if (bytes_read>0) {
-    struct nas_rg_dc_element *p;
-#ifndef PDCP_USE_NETLINK
-    p= (struct nas_rg_dc_element *)(gpriv->rbuffer);
-    //get the rest of the primitive
-    bytes_read += rtf_get(cx->sap[NAS_DC_OUTPUT_SAPI], (uint8_t *)p+NAS_TL_SIZE, p->length-NAS_TL_SIZE);
-
-    if (bytes_read!=p->length) {
-      printk("nasrg_ASCTL_DC_receive: Problem while reading primitive's header\n");
-      return bytes_read;
-    }
-
-#else
-    p= (struct nas_rg_dc_element *)(buffer);
-    bytes_read=p->length;
-#endif
-
-    switch (p->type) {
-    case CONN_ESTABLISH_IND :
-      if (p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_ESTABLISH_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_establish_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_IDLE:
-          nasrg_ASCTL_DC_decode_cx_establish_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_ESTABLISH_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_RELEASE_IND :
-      if (p->nasRGDCPrimitive.conn_release_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_RELEASE_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_release_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_cx_release_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_RELEASE_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case CONN_LOSS_IND:
-      if (p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: CONN_LOSS_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.conn_loss_ind.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_cx_loss_ind(cx,p);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: CONN_LOSS_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case RB_ESTABLISH_CNF:
-      if (p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: RB_ESTABLISH_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_rb_establish_cnf(cx,p);
-#ifdef NAS_AUTO_MBMS
-          nasrg_ASCTL_start_default_ue_notification(cx);
-#endif
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: RB_ESTABLISH_CNF reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-    case DATA_TRANSFER_IND:
-      if (p->nasRGDCPrimitive.data_transfer_ind.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: DATA_TRANSFER_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-        case NAS_CX_RELEASING:
-          nasrg_ASCTL_DC_decode_data_transfer_ind(cx,p,buffer);
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: DATA_TRANSFER_IND reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-      // Temp - Should be in uplink GC-SAP
-    case MBMS_BEARER_ESTABLISH_CNF:
-      //      if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef!=cx->lcr)
-      //        printk("nasrg_ASCTL_DC_receive: MBMS_BEARER_ESTABLISH_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      //      else
-      nasrg_ASCTL_DC_decode_mbms_bearer_establish_cnf(p);
-      break;
-
-    case MBMS_UE_NOTIFY_CNF:
-      if (p->nasRGDCPrimitive.mbms_ue_notify_cnf.localConnectionRef!=cx->lcr)
-        printk("nasrg_ASCTL_DC_receive: MBMS_UE_NOTIFY_CNF reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.rb_establish_conf.localConnectionRef);
-      else {
-        switch(cx->state) {
-        case NAS_CX_DCH:
-          nasrg_ASCTL_DC_decode_mbms_ue_notify_cnf(cx,p);
-          /* //Temp
-          nasrg_ASCTL_start_default_mbms_service();*/
-          break;
-
-        default:
-          printk("nasrg_ASCTL_DC_receive: MBMS_UE_NOTIFY_CNF reception, invalid state %u\n", cx->state);
-        }
-      }
-
-      break;
-
-      // Temp - Should be in uplink GC-SAP
-    case ENB_MEASUREMENT_IND :
-      //      if (p->nasRGDCPrimitive.eNBmeasurement_ind.localConnectionRef!=cx->lcr)
-      //        printk("nasrg_ASCTL_DC_receive: ENB_MEASUREMENT_IND reception, Local connection reference not correct %u\n", p->nasRGDCPrimitive.eNBmeasurement_ind.localConnectionRef);
-      //      else
-      nasrg_ASCTL_DC_decode_eNBmeasurement_ind(p);
-      break;
-
-    default :
-      printk("nasrg_ASCTL_DC_receive: Invalid message received\n");
-    }
-  }
-
-  return bytes_read;
-}
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c
deleted file mode 100644
index 4c0cf8aa1e..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_classifier.c
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_classifier.c
-* \brief Flow classification functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-#include <net/ip6_fib.h>
-#include <net/route.h>
-
-#define IN_CLASSA(a)            ((((long int) (a)) & 0x80000000) == 0)
-#define IN_CLASSB(a)            ((((long int) (a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSC(a)            ((((long int) (a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
-
-/* Address to accept any incoming messages. */
-#define INADDR_ANY              ((unsigned long int) 0x00000000)
-
-#define NIPADDR(addr) \
-        (uint8_t)(addr & 0x000000FF), \
-        (uint8_t)((addr & 0x0000FF00) >> 8), \
-        (uint8_t)((addr & 0x00FF0000) >> 16), \
-        (uint8_t)((addr & 0xFF000000) >> 24)
-
-#define NIP6ADDR(addr) \
-        ntohs((addr)->s6_addr16[0]), \
-        ntohs((addr)->s6_addr16[1]), \
-        ntohs((addr)->s6_addr16[2]), \
-        ntohs((addr)->s6_addr16[3]), \
-        ntohs((addr)->s6_addr16[4]), \
-        ntohs((addr)->s6_addr16[5]), \
-        ntohs((addr)->s6_addr16[6]), \
-        ntohs((addr)->s6_addr16[7])
-
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) \
-        (((__const uint32_t *) (a))[0] == 0                                   \
-         && ((__const uint32_t *) (a))[1] == 0                                \
-         && ((__const uint32_t *) (a))[2] == 0                                \
-         && ((__const uint32_t *) (a))[3] == 0)
-
-#define IN6_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint32_t *) (a))[0] & (((__const uint32_t *) (m))[0])) == (((__const uint32_t *) (b))[0] & (((__const uint32_t *) (m))[0])))  \
-         && ((((__const uint32_t *) (a))[1] & (((__const uint32_t *) (m))[1])) == (((__const uint32_t *) (b))[1] & (((__const uint32_t *) (m))[1])))  \
-         && ((((__const uint32_t *) (a))[2] & (((__const uint32_t *) (m))[2])) == (((__const uint32_t *) (b))[2] & (((__const uint32_t *) (m))[2])))  \
-         && ((((__const uint32_t *) (a))[3] & (((__const uint32_t *) (m))[3])) == (((__const uint32_t *) (b))[3] & (((__const uint32_t *) (m))[3]))))
-
-#define IN_ARE_ADDR_MASKED_EQUAL(a,b,m) \
-           (((((__const uint8_t *) (a))[0] & (((__const uint8_t *) (m))[0])) == (((__const uint8_t *) (b))[0] & (((__const uint8_t *) (m))[0])))  \
-         && ((((__const uint8_t *) (a))[1] & (((__const uint8_t *) (m))[1])) == (((__const uint8_t *) (b))[1] & (((__const uint8_t *) (m))[1])))  \
-         && ((((__const uint8_t *) (a))[2] & (((__const uint8_t *) (m))[2])) == (((__const uint8_t *) (b))[2] & (((__const uint8_t *) (m))[2])))  \
-         && ((((__const uint8_t *) (a))[3] & (((__const uint8_t *) (m))[3])) == (((__const uint8_t *) (b))[3] & (((__const uint8_t *) (m))[3]))))
-
-//---------------------------------------------------------------------------
-void nasrg_create_mask_ipv6_addr(struct in6_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  int   u6_addr8_index;
-  int   u6_addr1_index;
-  int   index;
-
-  masked_addrP->s6_addr32[0] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[1] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[2] = 0xFFFFFFFF;
-  masked_addrP->s6_addr32[3] = 0xFFFFFFFF;
-
-  u6_addr8_index = prefix_len >> 3;
-  u6_addr1_index = prefix_len & 0x07;
-
-  for (index = u6_addr8_index + 1; index < 16; index++) {
-    masked_addrP->s6_addr[index] = 0;
-  }
-
-  if (u6_addr1_index > 0) {
-    masked_addrP->s6_addr[u6_addr8_index] = 0xFF << (8-u6_addr1_index);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  //printk("nasrg_create_mask_ipv6_addr: MASK = %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(masked_addrP));
-#endif
-}
-//---------------------------------------------------------------------------
-void nasrg_create_mask_ipv4_addr(struct in_addr *masked_addrP, int prefix_len)
-{
-  //---------------------------------------------------------------------------
-  if (prefix_len > 32) {
-    prefix_len = 32;
-  }
-
-  masked_addrP->s_addr = 0xFFFFFFFF << (32 - prefix_len);
-#ifdef NAS_DEBUG_CLASS
-  //printk("nasrg_create_mask_ipv4_addr: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addrP));
-#endif
-  return;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (send direction)
-struct classifier_entity *nasrg_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_sclassifier: begin for dscp %d, classref %d\n", dscp,classref);
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_add_sclassifier - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  //***
-  for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_sclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  memset(gc, 0, sizeof(struct classifier_entity));
-  gc->next=cx->sclassifier[dscp];
-  gc->classref=classref;
-  cx->sclassifier[dscp]=gc;
-  ++cx->nsclassifier;
-  ++gpriv->next_sclassref; //increment send classref index - MW 15/01/07
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_sclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (receive direction)
-struct classifier_entity *nasrg_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_rclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->rclassifier[dscp]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_rclassifier: classifier already exist for dscp %d, classref %d\n",dscp,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_KERNEL);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->rclassifier[dscp];
-  gc->classref=classref;
-  gpriv->rclassifier[dscp]=gc;
-  ++gpriv->nrclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_rclassifier: classifier created for dscp %d, classref %d\n",dscp,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-// Add a new classifier rule (mbms direction)
-struct classifier_entity *nasrg_CLASS_add_mbmsclassifier(int mbms_ix, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_mbmsclassifier: begin\n");
-#endif
-
-  //***
-  for (gc=gpriv->mbmsclassifier[mbms_ix]; gc!=NULL; gc=gc->next) {
-    if (gc->classref==classref) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_add_mbmsclassifier: classifier already exist for service %d, classref %d\n",mbms_ix,classref);
-#endif
-      return gc;
-    }
-  }
-
-  gc=(struct classifier_entity *)kmalloc(sizeof(struct classifier_entity), GFP_ATOMIC);
-
-  if (gc==NULL)
-    return NULL;
-
-  gc->next=gpriv->mbmsclassifier[mbms_ix];
-  gc->classref=classref;
-  gpriv->mbmsclassifier[mbms_ix]=gc;
-  ++gpriv->nmbmsclassifier;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_add_mbmsclassifier: classifier created for service index %d, classref %d\n",mbms_ix,classref);
-#endif
-  return gc;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_sclassifier(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_flush_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=cx->sclassifier[dscpi]; gc!=NULL; gc=cx->sclassifier[dscpi]) {
-      cx->sclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  cx->nsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_rclassifier()
-{
-  //---------------------------------------------------------------------------
-  uint8_t dscpi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_rclassifier: begin\n");
-#endif
-
-  //***
-  for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi) {
-    for (gc=gpriv->rclassifier[dscpi]; gc!=NULL; gc=gpriv->rclassifier[dscpi]) {
-      gpriv->rclassifier[dscpi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nrclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CLASS_flush_mbmsclassifier()
-{
-  //---------------------------------------------------------------------------
-  int mbmsi;
-  struct classifier_entity *gc;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_mbmsclassifier: begin\n");
-#endif
-
-  //***
-  for (mbmsi=0; mbmsi<NASRG_MBMS_SVCES_MAX; ++mbmsi) {
-    for (gc=gpriv->mbmsclassifier[mbmsi]; gc!=NULL; gc=gpriv->mbmsclassifier[mbmsi]) {
-      gpriv->mbmsclassifier[mbmsi]=gc->next;
-      kfree(gc);
-    }
-  }
-
-  gpriv->nmbmsclassifier=0;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_flush_mbmsclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (send direction)
-void nasrg_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_sclassifier: begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_CLASS_del_sclassifier - input parameter cx is NULL \n");
-    return;
-  }
-
-  //***
-  p=cx->sclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    cx->sclassifier[dscp]=p->next;
-    kfree(p);
-    --cx->nsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --cx->nsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_sclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (receive direction)
-void nasrg_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_rclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->rclassifier[dscp];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->rclassifier[dscp]=p->next;
-    kfree(p);
-    --gpriv->nrclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nrclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_rclassifier: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete a classifier rule (mbms direction)
-void nasrg_CLASS_del_mbmsclassifier(int mbms_ix, uint16_t classref)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *p,*np;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_mbmsclassifier: begin\n");
-#endif
-  //***
-  p=gpriv->mbmsclassifier[mbms_ix];
-
-  if (p==NULL)
-    return;
-
-  if (p->classref==classref) {
-    gpriv->mbmsclassifier[mbms_ix]=p->next;
-    kfree(p);
-    --gpriv->nmbmsclassifier;
-    return;
-  }
-
-  for (np=p->next; np!=NULL; p=np) {
-    if (np->classref==classref) {
-      p->next=np->next;
-      kfree(np);
-      --gpriv->nmbmsclassifier;
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_del_mbmsclassifier: end\n");
-#endif
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasrg_CLASS_cx4(struct sk_buff *skb){
-//---------------------------------------------------------------------------
-  uint8_t cxi;
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx4: begin\n");
-  #endif
-  cxi=0;
-  return gpriv->cx+cxi;
-//#endif
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv4 address 'addr'
-struct cx_entity *nasrg_CLASS_cx4(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index)
-{
-  //---------------------------------------------------------------------------
-  unsigned char cxi;
-  uint32_t daddr;
-  struct cx_entity *cx=NULL;
-  struct classifier_entity *pclassifier=NULL;
-  struct in_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx4: begin\n");
-#endif
-
-  if (skb!=NULL) {
-    daddr = ((struct iphdr*)(skb_network_header(skb)))->daddr;
-
-    if (daddr != INADDR_ANY) {
-#ifdef NAS_DEBUG_CLASS
-      printk("SOURCE ADDR %d.%d.%d.%d",NIPADDR(ip_hdr(skb)->saddr));
-      printk(" DEST ADDR %d.%d.%d.%d\n",NIPADDR(ip_hdr(skb)->daddr));
-#endif
-
-      if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
-        // TO BE CHECKED
-        *paddr_type = NAS_IPV4_ADDR_MC_SIGNALLING;
-      } else {
-        if (ipv4_is_lbcast(ip_hdr(skb)->daddr)) {
-          // TO BE CHECKED
-          *paddr_type = NAS_IPV4_ADDR_BROADCAST;
-        } else {
-          if (IN_CLASSA(ip_hdr(skb)->daddr) || IN_CLASSB(ip_hdr(skb)->daddr) || IN_CLASSC(ip_hdr(skb)->daddr)) {
-            *paddr_type = NAS_IPV4_ADDR_UNICAST;
-
-            for (cxi=*cx_index; cxi<NAS_CX_MAX; ++cxi) {
-              (*cx_index)++;
-              pclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-              while (pclassifier!=NULL) {
-                // verify that this is an IPv4 classifier
-                if ((pclassifier->version == NAS_VERSION_4)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-                  nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-
-                  if (IN_ARE_ADDR_MASKED_EQUAL(&ip_hdr(skb)->daddr, &(pclassifier->daddr.ipv4), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-                    printk("nasrg_CLASS_cx4: IP MASK MATCHED: found cx %d: %d.%d.%d.%d/%d\n",cxi, NIPADDR(pclassifier->daddr.ipv4), pclassifier->dplen);
-#endif
-                    return &gpriv->cx[cxi];
-                  }
-                }
-
-                // goto to next classification rule for the connection
-                pclassifier = pclassifier->next;
-              }
-            }
-          } else {
-            *paddr_type = NAS_IPV4_ADDR_UNKNOWN;
-          }
-        }
-      }
-    }
-  }
-
-  return cx;
-}
-
-/*  ORIGINAL VERSION
-//---------------------------------------------------------------------------
-// Search the entity corresponding to destination address in IPv6 header
-struct cx_entity *nasrg_CLASS_cx6(struct sk_buff *skb, int* paddr_type, int* pmbms_ix){
-//---------------------------------------------------------------------------
-  struct cx_entity * cx=NULL;
-  uint8_t cxi;
-  uint32_t mc_addr_hdr, uni_ifid1, uni_ifid2;
-  //int addr_type = NASRG_ADDR_UNKNOWN;
-
-  #ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx6: begin\n");
-  #endif
-  if (!skb){
-     printk("nasrg_CLASS_cx6 - input parameter skb is NULL \n");
-    return cx;
-  }
-  *paddr_type = NASRG_ADDR_UNKNOWN;
-  //mc_addr_hdr = ntohl(skb->nh.ipv6h->daddr.in6_u.u6_addr32[0]);
-  mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-  // First check if multicast [1st octet is FF]
-  if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-     // packet type according to the scope of the multicast packet
-     // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-       case (0x00020000):
-         *paddr_type = NASRG_ADDR_MC_SIGNALLING;
-         #ifdef NAS_DEBUG_CLASS
-         printk("nasrg_CLASS_cx6: multicast packet - signalling \n");
-         #endif
-         break;
-       case (0x000E0000):
-         *paddr_type = NASRG_ADDR_MC_MBMS;
-         *pmbms_ix = 0;
-         cx=gpriv->cx;  // MBMS associate to Mobile 0
-         #ifdef NAS_DEBUG_CLASS
-         printk("nasrg_CLASS_cx6: multicast packet - MBMS data \n");
-         #endif
-         break;
-       default:
-         *paddr_type = NASRG_ADDR_UNKNOWN;
-         *pmbms_ix = NASRG_MBMS_SVCES_MAX;
-     }
-  // This is not multicast, so we should be able to identify the MT
-  }else{
-     #ifdef NAS_DEBUG_CLASS
-     printk("nasrg_CLASS_cx6: unicast packet\n");
-     #endif
-     *paddr_type = NASRG_ADDR_UNICAST;
-     uni_ifid1 = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[2]);
-     uni_ifid2 = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[3]);
-     for (cxi=0; cxi<NAS_CX_MAX; cxi++){
-       cx=gpriv->cx+cxi;
-       #ifdef NAS_DEBUG_SEND_DETAIL
-       printk("nasrg_CLASS_cx6: Compared addresses \n");
-       printk("                Daddr[2] %ul, Daddr[3] %ul\n",
-                 ipv6_hdr(skb)->daddr.in6_u.u6_addr32[2],ipv6_hdr(skb)->daddr.in6_u.u6_addr32[3]);
-       printk("          ntohl Daddr[2] %ul, Daddr[3] %ul\n",uni_ifid1,uni_ifid2);
-       printk("                IIF[0]   %ul, IIF[1]   %ul\n",cx->iid6[0],cx->iid6[1]);
-       printk("          htonl IIF[0]   %ul, IIF[1]   %ul\n",htonl(cx->iid6[0]),htonl(cx->iid6[1]));
-       #endif
-       if (((cx->iid6[0] == uni_ifid1)&&(cx->iid6[1] == uni_ifid2))
-              || ((htonl(cx->iid6[0]) == uni_ifid1)&&(htonl(cx->iid6[1]) == uni_ifid2))){
-         return cx;
-       }
-     }
-  }
-  return cx;
-}*/
-
-//---------------------------------------------------------------------------
-// Search the entity with the IPv6 address 'addr'
-// Navid: the ipv6 classifier is not fully tested
-struct cx_entity *nasrg_CLASS_cx6(struct sk_buff *skb, unsigned char dscp, int *paddr_type, unsigned char *cx_index, int* pmbms_ix)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-  struct cx_entity *cx = NULL;
-  struct classifier_entity *sclassifier= NULL;
-  uint32_t mc_addr_hdr;
-  struct in6_addr masked_addr;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_cx6: begin\n");
-#endif
-
-  if (skb) {
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_cx6: SOURCE ADDR %X:%X:%X:%X:%X:%X:%X:%X",NIP6ADDR(&(ipv6_hdr(skb)->saddr)));
-    printk(" DEST ADDR %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&(ipv6_hdr(skb)->daddr)));
-#endif
-    mc_addr_hdr = ntohl(ipv6_hdr(skb)->daddr.in6_u.u6_addr32[0]);
-
-    // First check if multicast [1st octet is FF]
-    if ((mc_addr_hdr & 0xFF000000) == 0xFF000000) {
-      // packet type according to the scope of the multicast packet
-      // we don't consider RPT bits in second octet [maybe done later if needed]
-      switch(mc_addr_hdr & 0x000F0000) {
-      case (0x00020000):
-        *paddr_type = NAS_IPV6_ADDR_MC_SIGNALLING;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_cx6: multicast packet - signalling \n");
-#endif
-        break;
-
-      case (0x000E0000):
-        *paddr_type = NAS_IPV6_ADDR_MC_MBMS;
-        *pmbms_ix = 0;
-        cx=gpriv->cx;  // MBMS associate to Mobile 0
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_cx6: multicast packet - MBMS data \n");
-#endif
-        break;
-
-      default:
-        printk("nasrg_CLASS_cx6: default multicast\n");
-        *paddr_type = NAS_IPV6_ADDR_UNKNOWN;
-        *pmbms_ix = NASRG_MBMS_SVCES_MAX;
-      }
-    } else {
-      // This is not multicast, so we should be able to identify the MT
-      *paddr_type = NAS_IPV6_ADDR_UNICAST;
-
-      for (cxi=*cx_index; cxi<NAS_CX_MAX; cxi++) {
-        //cxi = 0;
-        (*cx_index)++;
-        sclassifier = gpriv->cx[cxi].sclassifier[dscp];
-
-        while (sclassifier!=NULL) {
-          // verify that this is an IPv6 classifier
-          if ((sclassifier->version == NAS_VERSION_6) || (sclassifier->version == NAS_VERSION_DEFAULT)) {
-            /*LGif (IN6_IS_ADDR_UNSPECIFIED(&(sclassifier->daddr.ipv6))) {
-              printk("nas_CLASS_cx6: addr is null \n");
-              sclassifier = sclassifier->next;
-              continue;
-              }*/
-#ifdef NAS_DEBUG_CLASS
-            printk("cx %d : DSCP %d %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, dscp, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-            //if ((dst = (unsigned int*)&(((struct rt6_info *)skbdst)->rt6i_gateway)) == 0){
-            // LG: STRANGE
-            if (IN6_IS_ADDR_UNSPECIFIED(&ipv6_hdr(skb)->daddr)) {
-              printk("nasrg_CLASS_cx6: dst addr is null \n");
-              sclassifier = sclassifier->next;
-              continue;
-            }
-
-            nasrg_create_mask_ipv6_addr(&masked_addr, sclassifier->dplen);
-            // Modified MW to check only the iid6
-            masked_addr.s6_addr32[0] = 0x00000000;
-            masked_addr.s6_addr32[1] = 0x00000000;
-
-            if (IN6_ARE_ADDR_MASKED_EQUAL(&ipv6_hdr(skb)->daddr, &(sclassifier->daddr.ipv6), &masked_addr)) {
-#ifdef NAS_DEBUG_CLASS
-              printk("nasrg_CLASS_cx6: found cx %d: %X:%X:%X:%X:%X:%X:%X:%X\n",cxi, NIP6ADDR(&(sclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-              return &gpriv->cx[cxi];
-            }
-          }
-
-          // Go to next classifier entry for connection
-          sclassifier = sclassifier->next;
-        }
-      }
-    }
-  }
-
-  //printk("nas_CLASS_cx6 NOT FOUND: %X:%X:%X:%X:%X:%X:%X:%X\n",NIP6ADDR(&ipv6_hdr(skb)->daddr));
-  return cx;
-}
-
-//---------------------------------------------------------------------------
-// Search the sending function for IP Packet
-void nasrg_CLASS_send(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity  *pclassifier, *sp;
-  uint8_t *protocolh = NULL;
-  uint8_t version;
-  uint8_t protocol, dscp;
-  uint16_t classref;
-  struct cx_entity *cx;
-  unsigned int i;
-#ifdef NAS_DEBUG_CLASS
-  char sfct[10], sprotocol[10];
-#endif
-  struct net_device *dev = gdev;
-  unsigned char cx_index,no_connection;
-  int addr_type;
-  int mbms_ix;
-  struct in6_addr masked6_addr;
-  struct in_addr  masked_addr;
-  // RARP vars
-  struct arphdr  *rarp;
-  unsigned char  *rarp_ptr;
-  /* s for "source", t for "target" */
-  __be32 sip, tip;
-  unsigned char *sha, *tha;
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_send: begin -\n");
-#endif
-
-  if (skb==NULL) {
-    printk("nasrg_CLASS_send - input parameter skb is NULL \n");
-    return;
-  }
-
-  //***
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_CLASS_send - Received IP packet to transmit, length %d\n", skb->len);
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-
-  if ((skb->data) != NULL) {
-    if (skb->len<150)
-      nasrg_TOOL_print_buffer(skb->data,skb->len);
-    else
-      nasrg_TOOL_print_buffer(skb->data,150);
-  }
-
-#endif
-  //***
-  // find all connections related to socket
-  cx_index   = 0;
-  no_connection = 1;
-  cx = NULL;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_CLASS_send: [before switch on IP protocol version] \n");
-#endif
-
-
-  // Get mobile connexion entity, protocol and dscp from IP packet
-  switch (ntohs(skb->protocol)) {
-  case ETH_P_IPV6:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send : skb->protocol : IPv6 \n");
-#endif
-    version = NAS_VERSION_6;
-    addr_type = NAS_IPV6_ADDR_UNKNOWN;
-    protocolh = nasrg_TOOL_get_protocol6(ipv6_hdr(skb), &protocol);
-    dscp      = nasrg_TOOL_get_dscp6 (ipv6_hdr(skb));
-    cx        = nasrg_CLASS_cx6 (skb, dscp, &addr_type, &cx_index, &mbms_ix);
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send - ETH_P_IPV6 skb %p dscp %d gpriv %p cx_index %p \n",skb, dscp, gpriv, &cx_index);
-#endif
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV6_ADDR_MC_SIGNALLING:
-      case NAS_IPV6_ADDR_UNICAST:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-        printk("nasrg_CLASS_send - case NAS_IPV6_ADDR_MC_SIGNALLING | NAS_IPV6_ADDR_UNICAST\n");
-#endif //NAS_DEBUG_CLASS
-
-        for (i=0; i<NAS_CX_MAX; i++) {
-          pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-          while (pclassifier!=NULL) {
-            if ((pclassifier->version == NAS_VERSION_6) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-              // ok found default classifier for this packet
-              nasrg_create_mask_ipv6_addr(&masked6_addr, pclassifier->dplen);
-              // Modified MW to let everything go (pb with signalling)
-              masked6_addr.s6_addr32[0] = 0x00000000;
-              masked6_addr.s6_addr32[1] = 0x00000000;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-              printk("nasrg_CLASS_send - cx %d : DSCP NAS_DSCP_DEFAULT %X:%X:%X:%X:%X:%X:%X:%X\n",i, NIP6ADDR(&(pclassifier->daddr.ipv6)));
-#endif //NAS_DEBUG_CLASS
-
-              if (IN6_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv6, &ipv6_hdr(skb)->daddr, &masked6_addr)) {
-                // then force dscp
-                cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasrg_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              } else {
-                if(IN6_IS_ADDR_UNSPECIFIED(&pclassifier->daddr.ipv6)) {
-                  cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasrg_CLASS_send - ETH_P_IPV6 FOUND NAS_DSCP_DEFAULT with IN6_IS_ADDR_UNSPECIFIED\n");
-#endif
-                  dscp = NAS_DSCP_DEFAULT;
-                  break;
-                }
-              }
-            }
-
-            pclassifier = pclassifier->next;
-          }
-        }
-
-        break;
-
-        // MBMS is broken!!!! To be updated (these values will be over-ridden afterwards
-      case NAS_IPV6_ADDR_MC_MBMS:
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_send - case NAS_IPV6_ADDR_MC_MBMS\n");
-#endif //NAS_DEBUG_CLASS
-        pclassifier = gpriv->mbmsclassifier[mbms_ix];
-        printk("nasrg_CLASS_send: MBMS is broken!!!!\n\n\n");
-        sp = gpriv->mbmsclassifier[mbms_ix];
-
-        if (sp!= NULL) {
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-          printk("nasrg_CLASS_send: classifier found for multicast service %d \n", mbms_ix);
-#endif
-        } else {
-          printk("nasrg_CLASS_send: No corresponding multicast bearer, so the message is dropped\n");
-          return;
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV6_ADDR_UNKNOWN:
-      default:
-        printk("nasrg_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-    break;
-
-  case ETH_P_ARP:
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_send : skb->protocol : ARP \n");
-#endif
-    version = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_BROADCAST;
-    dscp = 0;
-    cx = NULL;
-    // Basic sanity checks can be done without the lock
-    rarp = (struct arphdr *)skb_network_header(skb);
-
-    if (rarp) {
-      if (rarp->ar_hln != dev->addr_len || dev->type != ntohs(rarp->ar_hrd)) {
-        printk("nasrg_CLASS_send: ARP PACKET WRONG ADDR LEN or WRONG ARP HEADER TYPE\n");
-        break;
-      }
-    } else {
-      printk("nasrg_CLASS_send: ARP HEADER POINTER IS NULL\n");
-      break;
-    }
-
-    // If it's not Ethernet, delete it.
-    if (rarp->ar_pro != htons(ETH_P_IP)) {
-      printk("nasrg_CLASS_send: ARP PACKET PROTOCOL IS NOT ETHERNET\n");
-      break;
-    }
-
-    rarp_ptr = (unsigned char *) (rarp + 1);
-    sha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&sip, rarp_ptr, 4);
-    rarp_ptr += 4;
-    tha = rarp_ptr;
-    rarp_ptr += dev->addr_len;
-    memcpy(&tip, rarp_ptr, 4);
-#ifdef NAS_DEBUG_CLASS
-    printk("nasrg_CLASS_send: ARP DEST IP transport IP = %d.%d.%d.%d\n",NIPADDR(tip));
-#endif
-
-    for (i=0; i<NAS_CX_MAX; i++) {
-      pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-      while (pclassifier!=NULL) {
-        if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-          // ok found default classifier for this packet
-          nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS
-          printk("nasrg_CLASS_send: MASK = %d.%d.%d.%d\n",NIPADDR(masked_addr.s_addr));
-#endif
-
-          //
-          if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &tip, &masked_addr.s_addr)) {
-            // then force dscp
-            cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-            printk("nasrg_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n", pclassifier->dplen);
-#endif
-            dscp = NAS_DSCP_DEFAULT;
-            break;
-          } else {
-            if (INADDR_ANY == pclassifier->daddr.ipv4) {
-              cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-              printk("nasrg_CLASS_send: ETH_P_ARP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-              dscp = NAS_DSCP_DEFAULT;
-              break;
-            }
-          }
-        }
-
-        pclassifier = pclassifier->next;
-      }
-    }
-
-    break;
-
-  case ETH_P_IP:
-#ifdef NAS_DEBUG_CLASS_DETAIL
-    printk("nasrg_CLASS_send : skb->protocol : IPv4 \n");
-#endif
-    version   = NAS_VERSION_4;
-    addr_type = NAS_IPV4_ADDR_UNKNOWN;
-    dscp      = nasrg_TOOL_get_dscp4((struct iphdr *)(skb_network_header(skb)));
-    cx        = nasrg_CLASS_cx4(skb, dscp, &addr_type, &cx_index);
-    protocolh = nasrg_TOOL_get_protocol4((struct iphdr *)(skb_network_header(skb)), &protocol);
-
-    // find in default DSCP a valid classification
-    if (cx == NULL) {
-      switch (addr_type) {
-      case NAS_IPV4_ADDR_MC_SIGNALLING:
-      case NAS_IPV4_ADDR_UNICAST:
-      case NAS_IPV4_ADDR_BROADCAST:
-        for (i=0; i<NAS_CX_MAX; i++) {
-          pclassifier=(&gpriv->cx[i])->sclassifier[NAS_DSCP_DEFAULT];
-
-          while (pclassifier != NULL) {
-            if ((pclassifier->version == NAS_VERSION_4) || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-              // ok found default classifier for this packet
-              nasrg_create_mask_ipv4_addr(&masked_addr, pclassifier->dplen);
-#ifdef NAS_DEBUG_CLASS_DETAIL
-              printk("nasrg_CLASS_send : MASK = %d.%d.%d.%d\n", NIPADDR(masked_addr.s_addr));
-#endif
-
-              if (IN_ARE_ADDR_MASKED_EQUAL(&pclassifier->daddr.ipv4, &ip_hdr(skb)->daddr, &masked_addr.s_addr)) {
-                // then force dscp
-                cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                printk("nasrg_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with IN_ARE_ADDR_MASKED_EQUAL(%d bits)\n",pclassifier->dplen);
-#endif
-                dscp = NAS_DSCP_DEFAULT;
-                break;
-              } else {
-                if(INADDR_ANY == pclassifier->daddr.ipv4) {
-                  cx = &gpriv->cx[i];
-#ifdef NAS_DEBUG_CLASS
-                  printk("nasrg_CLASS_send : ETH_P_IP FOUND NAS_DSCP_DEFAULT with INADDR_ANY\n");
-#endif
-                  dscp = NAS_DSCP_DEFAULT;
-                  break;
-                }
-              }
-            }
-
-            pclassifier = pclassifier->next;
-          }
-        }
-
-        break;
-
-        // should have found a valid classification rule
-      case NAS_IPV4_ADDR_UNKNOWN:
-      default:
-        printk("nasrg_CLASS_send: No corresponding address type\n");
-      }
-    }
-
-#ifdef NAS_DEBUG_CLASS
-
-    if (cx)
-      printk("nasrg_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, cx = %d\n",ntohs(skb->protocol),dscp,cx->lcr);
-    else
-      printk("nasrg_CLASS_send: ETH_P_IP Received IPv4 packet (%02X), dscp = %d, No valid connection\n",ntohs(skb->protocol),dscp);
-
-#endif
-    break;
-
-  default:
-    printk("nasrg_CLASS_send: Unknown IP version protocol\n");
-    version = 0;
-    return;
-  }
-
-#ifdef NAS_DEBUG_CLASS_DETAIL
-  printk("nasrg_CLASS_send: [before if (cx != NULL)]\n");
-#endif
-
-  //Next lines bypass classifiers to test the netlink socket
-  //#define DEBUG_NETLINKRG_TEST
-#ifdef DEBUG_NETLINKRG_TEST
-  nasrg_COMMON_QOS_send_test_netlink(skb);
-  return;
-#endif
-
-  // If a valid connection for the DSCP/EXP with destination address
-  // is found scan all protocol-based classification rules
-  if (cx != NULL) {
-    classref = 0;
-    sp = NULL;
-
-    if (cx->state!=NAS_CX_DCH) {
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_CLASS_send: UE not connected, in state %d. Packet is dropped\n",cx->state);
-#endif
-      return;
-    }
-
-    if (addr_type==NAS_IPV6_ADDR_MC_MBMS) {
-      sp = gpriv->mbmsclassifier[mbms_ix];
-
-      if (sp!= NULL) {
-        classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS
-        printk("nasrg_CLASS_send: classifier found for multicast index %d, service %d\n", mbms_ix, gpriv->mbms_rb[mbms_ix].cnxid);
-#endif
-      } else {
-        // Temp MEDIEVAL : use default classifier
-        sp = cx->sclassifier[NAS_DSCP_DEFAULT];
-
-        if (sp!= NULL) {
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS
-          printk("nasrg_CLASS_send: classifier for multicast service %d replaced by default %d\n", mbms_ix, classref);
-#endif
-#ifdef NAS_AUTO_MBMS
-          nasrg_ASCTL_start_default_mbms_service();
-#endif
-        } else {
-          printk("nasrg_CLASS_send: No corresponding multicast bearer, so the message is dropped\n");
-          return;
-        }
-      }
-    } else {
-#ifdef NAS_DEBUG_CLASS_DETAIL
-      printk("nasrg_CLASS_send: DSCP %d version %d: looking for classifier entry\n",dscp, version);
-#endif
-
-      for (pclassifier=cx->sclassifier[dscp]; pclassifier!=NULL; pclassifier=pclassifier->next) {
-#ifdef NAS_DEBUG_CLASS_DETAIL
-        printk("nasrg_CLASS_send: DSCP %d p->classref=%d,p->protocol=%d,p->version=%d\n",dscp,pclassifier->classref,pclassifier->protocol,pclassifier->version);
-#endif
-
-        // normal rule checks that network protocol version matches
-        if ((pclassifier->version == version)  || (pclassifier->version == NAS_VERSION_DEFAULT)) {
-          //printk("nasrg_CLASS_send: IP version are equals\n");
-          sp=pclassifier;
-          classref=sp->classref;
-#ifdef NAS_DEBUG_CLASS_DETAIL
-          printk("nasrg_CLASS_send: classifier found for dscp %u \n", dscp);
-#endif
-          break;
-        }
-      }
-    }
-
-    if (sp!=NULL) {
-#ifdef NAS_DEBUG_CLASS
-
-      //char sfct[10], sprotocol[10];
-      // classifier entity found. Print its parameters
-      if (sp->fct==nasrg_COMMON_QOS_send)
-        strcpy(sfct, "data xfer");
-
-      if (sp->fct==nasrg_CTL_send)
-        strcpy(sfct, "iocontrol");
-
-      if (sp->fct==nasrg_COMMON_del_send)
-        strcpy(sfct, "delete");
-
-      if (sp->fct==nasrg_ASCTL_DC_send_sig_data_request)
-        strcpy(sfct, "DC-SAP");
-
-      switch(protocol) {
-      case NAS_PROTOCOL_UDP:
-        strcpy(sprotocol, "udp");
-        printk("udp packet\n");
-        break;
-
-      case NAS_PROTOCOL_TCP:
-        strcpy(sprotocol, "tcp");
-        printk("tcp packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP4:
-        strcpy(sprotocol, "icmp4");
-        printk("icmp4 packet\n");
-        break;
-
-      case NAS_PROTOCOL_ICMP6:
-        strcpy(sprotocol, "icmp6");
-        nasrg_TOOL_pk_icmp6((struct icmp6hdr*)protocolh);
-        break;
-
-      default:
-        strcpy(sprotocol, "other L4");
-        break;
-      }
-
-      printk("nasrg_CLASS_send: (dscp %u, %s) received, (classref %u, fct %s, drb_id %u) classifier rule\n",
-             dscp, sprotocol, sp->classref, sfct, sp->rab_id);
-#endif
-
-      //forward packet to the correct entity
-      if (sp->fct!=NULL) {
-        sp->fct(skb, cx, sp);
-      } else {
-        printk("\n\nnasrg_CLASS_send: ERROR : CLASSIFIER FUNCTION IS NULL\n\n");
-      }
-
-      no_connection = 0;
-      // end : if classifier entry match found
-    } else {
-      printk("nasrg_CLASS_send: no corresponding item in the classifier list, so the message is dropped\n");
-      printk("nasrg_CLASS_send: packet parameters: dscp %u, %s\n", dscp, sprotocol);
-      nasrg_COMMON_del_send(skb, cx, NULL);  // Note MW: LG has commented this line. Why?
-    }
-  }   // if connection found
-
-#ifdef NAS_DEBUG_CLASS
-
-  if (no_connection == 1) {
-    printk("nasrg_CLASS_send: no corresponding connection, so the message is dropped\n");
-  }
-
-#endif
-#ifdef NAS_DEBUG_CLASS_DETAIL
-  printk("nasrg_CLASS_send: end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c
deleted file mode 100644
index 6bfd77a17d..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_common.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_common.c
-* \brief Common functions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-#include <linux/inetdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-
-//---------------------------------------------------------------------------
-// Receive data from FIFO (QOS or DC)
-//void nasrg_COMMON_receive(uint16_t hlen, uint16_t dlen, int sap){
-void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *skb;
-  struct ipversion *ipv;
-  unsigned int hard_header_len;
-  uint16_t  *p_ether_type;
-  uint16_t  ether_type;
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: begin\n");
-#endif
-#ifdef PDCP_USE_NETLINK
-
-  // data_buffer is NULL if FIFOs
-  if (!data_buffer) {
-    printk("nasrg_COMMON_receive - input parameter data_buffer is NULL \n");
-    return;
-  }
-
-#endif
-
-  skb = dev_alloc_skb( payload_length + 2 );
-
-  if(!skb) {
-    printk("nasrg_COMMON_receive: low on memory\n");
-    ++gpriv->stats.rx_dropped;
-    return;
-  }
-
-  skb_reserve(skb,2);
-
-#ifndef PDCP_USE_NETLINK
-  bytes_read += rtf_get(sap, skb_put(skb, payload_length), payload_length);
-
-  if (bytes_read != NAS_PDCPH_SIZE + payload_length) {
-    printk("nasrg_COMMON_receive: problem while reading rtf sap\n");
-    kfree(skb->data);
-    dev_kfree_skb(skb);
-    return;
-  }
-
-#else
-  memcpy(skb_put(skb, payload_length), data_buffer, payload_length);
-  bytes_read += payload_length;
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: received packet from PDCP, length %d\n", bytes_read);
-#endif
-
-  skb->dev = gdev;
-  hard_header_len = gdev->hard_header_len;
-  skb->mac_header = skb->data;
-  skb->pkt_type = PACKET_HOST;
-  skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-  ipv = (struct ipversion *)&(skb->data[hard_header_len]);
-
-  switch (ipv->version) {
-  case 6:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasrg_COMMON_receive: receive IPv6 message\n");
-#endif
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IPV6);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  case 4:
-#ifdef NAS_DEBUG_RECEIVE_BASIC
-    printk("nasrg_COMMON_receive: receive IPv4 message\n");
-#endif
-
-#ifdef NAS_DEBUG_RECEIVE
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->saddr;
-
-    if (addr) {
-      printk("nasrg_COMMON_receive: Source %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    addr = (unsigned char *)&((struct iphdr *)&skb->data[hard_header_len])->daddr;
-
-    if (addr) {
-      printk("nasrg_COMMON_receive Dest %d.%d.%d.%d\n",addr[0],addr[1],addr[2],addr[3]);
-    }
-
-    printk("nasrg_COMMON_receive protocol  %d\n",((struct iphdr *)&skb->data[hard_header_len])->protocol);
-#endif
-
-    skb->network_header = &skb->data[hard_header_len];
-    // set  protocol default value
-    skb->protocol = htons(ETH_P_IP);
-    // If type Ethernet, correct it
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    skb->protocol = eth_type_trans(skb, gdev);
-#endif
-    break;
-
-  default:
-    printk("nasrg_COMMON_receive: Packet is not IPv4 or IPv6 (version=%d)\n", ipv->version);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-    skb->protocol = eth_type_trans(skb, gdev);
-    // minus 1(short) instead of 2(bytes) because uint16_t*
-    p_ether_type = (uint16_t *)&(skb->mac_header[hard_header_len-2]);
-    ether_type = ntohs(*p_ether_type);
-#ifdef NAS_DEBUG_RECEIVE
-    printk("nasrg_COMMON_receive: ether_type=%04X\n", ether_type);
-#endif
-
-    switch (ether_type) {
-    case ETH_P_ARP:
-      printk("nasrg_COMMON_receive: ether_type = ETH_P_ARP\n");
-      skb->protocol = htons(ETH_P_ARP);
-      skb->network_header = &skb->mac_header[hard_header_len];
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-  }
-
-  ++gpriv->stats.rx_packets;
-  gpriv->stats.rx_bytes += bytes_read;
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: forwarding packet of size %d to kernel\n",skb->len);
-#endif
-
-  netif_rx(skb);
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_receive: end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Delete the data
-void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *sp)
-{
-  //---------------------------------------------------------------------------
-  ++gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  struct pdcp_data_req_header_t  pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb || !gc || !cx) {
-    printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  if (gc->rb==NULL) {
-    gc->rb=nasrg_COMMON_search_rb(cx, gc->rab_id);
-
-    if (gc->rb==NULL) {
-      ++gpriv->stats.tx_dropped;
-      printk("nasrg_COMMON_QOS_send: No corresponding Radio Bearer, so message is dropped, rab_id=%u \n", gc->rab_id);
-      return;
-    }
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #1 :");
-  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  nasrg_TOOL_print_classifier(gc);
-#endif
-  pdcph.data_size  = skb->len;
-  //pdcph.rb_id      = (gc->rb)->rab_id+(NAS_RB_MAX_NUM*cx->lcr);
-  pdcph.rb_id      = ((gc->rb)->rab_id)-NAS_SIG_NUM_SRB;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasrg_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#endif
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
-    printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send #2 :");
-  printk("Header bytes written : %d\n", bytes_wrote);
-#endif
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasrg_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #3 :");
-  printk(" %d bytes written to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_COMMON_QOS_send - end \n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-// Request the transfer of data (QoS SAP)
-void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct pdcp_data_req_header_t  pdcph;
-  int bytes_wrote = 0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - begin \n");
-#endif
-
-  //  if (cx->state!=NAS_STATE_CONNECTED) // <--- A REVOIR
-  //  {
-  //    gpriv->stats.tx_dropped ++;
-  //    printk("NAS_QOS_SEND: No connected, so message are dropped \n");
-  //    return;
-  //  }
-  if (!skb ) {
-    printk("nasrg_COMMON_QOS_send - input parameter skb|gc|cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #1 :");
-  //  printk("lcr %u, rab_id %u, rab_id %u\n", cx->lcr, (gc->rb)->rab_id, gc->rab_id);
-  //  nasrg_TOOL_print_classifier(gc);
-#endif
-  pdcph.data_size  = skb->len;
-  //pdcph.rb_id      = (gc->rb)->rab_id+(NAS_RB_MAX_NUM*cx->lcr);
-  pdcph.rb_id      = 6;
-  pdcph.inst       = 0;
-
-#ifdef PDCP_USE_NETLINK
-  bytes_wrote = nasrg_netlink_send((unsigned char *)&pdcph,NAS_PDCPH_SIZE, NASNL_DEST_PDCP);
-  //printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP via netlink\n", bytes_wrote,skb->len);
-#else
-  //bytes_wrote = rtf_put(gpriv->sap[(gc->rb)->sapi], &pdcph, NAS_PDCPH_SIZE);
-  bytes_wrote = rtf_put(NAS2PDCP_FIFO, &pdcph, NAS_PDCPH_SIZE);
-  //printk("nasrg_COMMON_QOS_send - Wrote %d bytes (header for %d byte skb) to PDCP fifo\n", bytes_wrote,skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's header\n");
-    //    printk("PDCP rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #2 :");
-  printk("Header bytes wrote : %d\n", bytes_wrote);
-#endif
-
-#ifdef  PDCP_USE_NETLINK
-  bytes_wrote += nasrg_netlink_send((unsigned char *)skb->data,skb->len, NASNL_DEST_PDCP);
-#else
-  //bytes_wrote += rtf_put(gpriv->sap[(gc->rb)->sapi], skb->data, skb->len);
-  bytes_wrote += rtf_put(NAS2PDCP_FIFO, skb->data, skb->len);
-#endif //PDCP_USE_NETLINK
-
-  if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
-    printk("nasrg_COMMON_QOS_send: problem while writing PDCP's data\n"); // congestion
-    //    printk("rb_id %d, SAP index %d, Wrote %d to fifo %d, Header Size %d \n", pdcph.rb_id , (gc->rb)->sapi, bytes_wrote, NAS2PDCP_FIFO, NAS_PDCPH_SIZE);
-    gpriv->stats.tx_dropped ++;
-    return;
-  }
-
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send #3 :");
-  printk(" %d bytes wrote to rb_id %d, sap %d \n", bytes_wrote, pdcph.rb_id, NAS2PDCP_FIFO);
-#endif
-  gpriv->stats.tx_bytes   += skb->len;
-  gpriv->stats.tx_packets ++;
-#ifdef NAS_DEBUG_SEND
-  printk("nasrg_COMMON_QOS_send - end \n");
-#endif
-}
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void nasrg_COMMON_QOS_receive(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  uint8_t sapi;
-  struct pdcp_data_ind_header_t  pdcph;
-  int bytes_read = 0;
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!cx) {
-    printk("nasrg_COMMON_QOS_receive - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // LG force the use of only 1 rt fifo
-  sapi = NAS_DRB_OUTPUT_SAPI;
-
-  bytes_read =  rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-
-  while (bytes_read>0) {
-    if (bytes_read != NAS_PDCPH_SIZE) {
-      printk("nasrg_COMMON_QOS_receive: problem while reading PDCP header\n");
-      return;
-    }
-
-    // data_buffer is NULL because FIFO should be read directly in the skbuff (LITE has an intermediary buffer)
-    nasrg_COMMON_receive(NAS_PDCPH_SIZE, pdcph.data_size, NULL, pdcph->rb_id, gpriv->sap[sapi]);
-    // check if another frame is in the FIFO, otherwise return
-    bytes_read = rtf_get(gpriv->sap[sapi], &pdcph, NAS_PDCPH_SIZE);
-  }
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - end \n");
-#endif
-}
-#else
-//---------------------------------------------------------------------------
-void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh)
-{
-  //---------------------------------------------------------------------------
-
-  struct pdcp_data_ind_header_t  *pdcph;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - begin \n");
-#endif
-
-  if (!nlh) {
-    printk("nasrg_COMMON_QOS_receive - input parameter nlh is NULL \n");
-    return;
-  }
-
-  // End debug information
-  pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-
-#ifdef NAS_DEBUG_RECEIVE
-  printk("nasrg_COMMON_QOS_receive - receive from PDCP, size %d, rab %d\\n", pdcph->data_size, pdcph->rb_id);
-#endif //NAS_DEBUG_RECEIVE
-
-  //void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-  nasrg_COMMON_receive(NAS_PDCPH_SIZE + pdcph->data_size, pdcph->data_size, (unsigned char *)NLMSG_DATA(nlh) + NAS_PDCPH_SIZE, pdcph->rb_id, 0);
-}
-#endif //PDCP_USE_NETLINK
-
-//---------------------------------------------------------------------------
-struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr)
-{
-  //---------------------------------------------------------------------------
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_search_cx - lcr %d\n",lcr);
-#endif
-
-  if (lcr<NAS_CX_MAX)
-    return gpriv->cx+lcr;
-  else
-    return NULL;
-}
-
-//---------------------------------------------------------------------------
-// Search a Radio Bearer
-struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_search_rb - rab_id %d\n", rab_id);
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_search_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id==rab_id)
-      return rb;
-  }
-
-  return NULL;
-}
-
-//---------------------------------------------------------------------------
-struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasQoSTrafficClass_t qos)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_add_rb - begin for rab_id %d , qos %d\n", rab_id, qos );
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_add_rb - input parameter cx is NULL \n");
-    return NULL;
-  }
-
-  rb=nasrg_COMMON_search_rb(cx, rab_id);
-
-  if (rb==NULL) {
-    rb=(struct rb_entity *)kmalloc(sizeof(struct rb_entity), GFP_KERNEL);
-
-    if (rb!=NULL) {
-      rb->retry=0;
-      rb->countimer=NAS_TIMER_IDLE;
-      rb->rab_id=rab_id;
-      //      rb->rab_id=rab_id+(32*cx->lcr);
-#ifdef NAS_DEBUG_DC
-      printk("nasrg_COMMON_add_rb: rb rab_id=%u, rab_id=%u, mt_id=%u\n",rb->rab_id,rab_id, cx->lcr);
-#endif
-      //      rb->dscp = NASRG_TEMP_2NDRAB_DSCP; //TEMP
-      rb->qos=qos;
-      rb->sapi=NAS_DRB_INPUT_SAPI;
-      // LG force the use of only one rt-fifo
-      // rb->sapi=NAS_BA_INPUT_SAPI;
-      rb->state=NAS_IDLE;
-      rb->next=cx->rb;
-      cx->rb=rb;
-      (cx->num_rb)++;
-    } else
-      printk("nasrg_COMMON_add_rb: no memory\n");
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_add_rb - end \n" );
-#endif
-  return rb;
-}
-
-//---------------------------------------------------------------------------
-// free the memory that has previously been allocated to rb and remove from linked list
-void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb, *curr_rb, *prev_rb;
-  struct classifier_entity *p;
-  uint16_t classref=0;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_del_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_del_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  // Clear the associated classifier
-  for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next) {
-    if (p->classref>=classref) {
-      classref=p->classref;
-#ifdef NAS_DEBUG_CLASS
-      printk("nasrg_COMMON_del_rb: classifier found for dscp %u \n", dscp);
-#endif
-    }
-  }
-
-  nasrg_CLASS_del_sclassifier(cx, dscp, classref);
-
-  // Now, delete the RB
-  curr_rb = NULL;
-  prev_rb = NULL;
-
-  for (rb=cx->rb; rb!=NULL; rb=rb->next) {
-    if (rb->rab_id == rab_id) {
-      curr_rb = rb;
-
-      if (prev_rb!=NULL) {
-        prev_rb->next = rb->next;
-      } else {
-        cx->rb=rb->next;
-      }
-
-      break;
-    } else {
-      prev_rb = rb;
-    }
-  }
-
-  if (curr_rb!= NULL) {
-    printk("nasrg_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
-    kfree(rb);
-    (cx->num_rb)--;
-  } else {
-    printk("\n\n--nasrg_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_del_rb - end\n");
-#endif
-}
-
-//---------------------------------------------------------------------------
-void nasrg_COMMON_flush_rb(struct cx_entity *cx)
-{
-  //---------------------------------------------------------------------------
-  struct rb_entity *rb;
-  struct classifier_entity *gc;
-  uint8_t dscp;
-
-  // Start debug information
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_flush_rb - begin\n");
-#endif
-
-  if (cx==NULL) {
-    printk("nasrg_COMMON_flush_rb - input parameter cx is NULL \n");
-    return;
-  }
-
-  // End debug information
-  for (rb=cx->rb; rb!=NULL; rb=cx->rb) {
-    printk("nasrg_COMMON_flush_rb: del rab_id %u\n", rb->rab_id);
-    cx->rb=rb->next;
-    kfree(rb);
-  }
-
-  cx->num_rb=0;
-  cx->rb=NULL;
-
-  for(dscp=0; dscp<NAS_DSCP_MAX; ++dscp) {
-    for (gc=cx->sclassifier[dscp]; gc!=NULL; gc=gc->next)
-      gc->rb=NULL;
-  }
-
-#ifdef NAS_DEBUG_CLASS
-  printk("nasrg_COMMON_flush_rb - end\n");
-#endif
-}
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h
deleted file mode 100644
index 7a0e69cc48..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_constant.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_constant.h
-* \brief Defines all constants for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_CST
-#define _NASRGD_CST
-
-//Debug flags
-#define NAS_DEBUG_DC
-//#define NAS_DEBUG_DC_DETAIL
-#define NAS_DEBUG_SEND
-//#define NAS_DEBUG_SEND_DETAIL  // detail of packet transmission
-//#define NAS_DEBUG_RECEIVE
-#define NAS_DEBUG_RECEIVE_BASIC
-#define NAS_DEBUG_CLASS
-//#define NAS_DEBUG_CLASS_DETAIL
-#define NAS_DEBUG_GC
-//#define NAS_DEBUG_DC_MEASURE
-//#define NAS_DEBUG_TIMER
-#define NAS_DEBUG_DEVICE
-//#define NAS_DEBUG_INTERRUPT
-//#define NAS_DEBUG_TOOL
-//#define NAS_DEBUG_MBMS_PROT //Only one RT-FIFO is used
-#define NETLINK_DEBUG
-#define NAS_DEBUG_RRCNL // RRC netlink socket
-
-// Other flags
-#define DEMO_3GSM
-//#define NODE_RG
-//#define NAS_AUTO_MBMS
-
-// Begin default RAB
-// Parameters for the default RAB started after network attachment (needs DEMO_3GSM defined)
-// RBId value to be synchronized with RAL-RG
-#define NASRG_DEFAULTRAB_RBID  6  //MW-01/01/07- RBID 5 => MBMS, 6 => DEFAULTRAB, 7+ => others
-// Only one of next lines must be active - other values in l3/rrc/rrc_qos.h
-#define NASRG_DEFAULTRAB_QoS 2  //MW-01/01/07- RRC_QOS_CONV_64_64
-//#define NASRG_DEFAULTRAB_QoS 3  //MW-01/01/07- RRC_QOS_CONV_128_128
-//#define NASRG_DEFAULTRAB_QoS 4  //MW-01/01/07- RRC_QOS_CONV_256_256
-//#define NASRG_DEFAULTRAB_QoS 5  //MW-01/01/07- RRC_QOS_CONV_320_320
-//#define NASRG_DEFAULTRAB_QoS 11   //LG RRC_QOS_INTER_128_64
-//
-#define NASRG_DEFAULTRAB_CLASSREF   1  //MW-01/01/07
-#define NASRG_DEFAULTRAB_DSCP       0  //MW-01/01/07
-#define NASRG_DEFAULTRAB_IPVERSION  NAS_VERSION_DEFAULT  //MW-01/01/07
-// End default RAB
-
-//Temp - hard coded
-#define NASRG_OWN_CELLID 5
-#define NASRG_TEMP_2NDRAB_DSCP 5
-#define NASRG_TEMP_MBMS_SESSION_ID 1
-#define NASRG_TEMP_MBMS_DURATION 999
-#define NAS_DEFAULT_IPv6_PREFIX_LENGTH 128 // used to compare destination address with MT's
-
-// General Constants
-#define NAS_MTU 1500
-#define NAS_TX_QUEUE_LEN 100
-#define NAS_ADDR_LEN 8
-#define NAS_INET6_ADDRSTRLEN 46
-#define NAS_INET_ADDRSTRLEN 16
-
-#define NAS_RESET_RX_FLAGS  0
-
-#define NAS_CX_MAX 3  //Identical to RRC constant
-//#define NAS_CX_MULTICAST_ALLNODE 2
-
-#define NASRG_MBMS_SVCES_MAX 4 // Identical to RRC constant
-
-#define NAS_RB_MAX_NUM 32 // maximum number of RBs per MT - 25.331
-#define NAS_RETRY_LIMIT_DEFAULT 5
-
-#define NAS_MESSAGE_MAXLEN 1600
-
-// UMTS
-#define NAS_SIG_SRB3 3
-#define NAS_SIG_SRB4 3 // not used yet
-//LTE
-#define NAS_SIG_NUM_SRB 3  // number of srbs in LTE to send Rb_Id to PDCP
-
-
-//peer-to-peer messages between NAS entities
-#define NAS_CMD_OPEN_RB 1
-#define NAS_CMD_ENTER_SLEEP 2
-#define NAS_CMD_LEAVE_SLEEP 3
-
-#define NAS_CX_RELEASE_UNDEF_CAUSE 1
-
-// MT+RG NAS States
-#define NAS_IDLE                  0x01
-// Connection
-#define NAS_CX_FACH               0x06
-#define NAS_CX_DCH                0x0A
-#define NAS_CX_RECEIVED           0x10
-#define NAS_CX_CONNECTING         0x04
-#define NAS_CX_RELEASING          0x08
-#define NAS_CX_CONNECTING_FAILURE 0x14
-#define NAS_CX_RELEASING_FAILURE  0x18
-// Radio Bearers
-#define NAS_RB_ESTABLISHING       0x24
-#define NAS_RB_RELEASING          0x28
-#define NAS_RB_ESTABLISHED        0x2A
-
-
-#define NAS_TIMER_ESTABLISHMENT_DEFAULT 12
-#define NAS_TIMER_RELEASE_DEFAULT 2
-#define NAS_TIMER_IDLE UINT_MAX
-#define NAS_TIMER_TICK HZ
-
-#define NAS_PDCPH_SIZE sizeof(struct pdcp_data_req_header_t)
-#define NAS_IPV4_SIZE 20
-#define NAS_IPV6_SIZE 40
-
-#define NAS_DIRECTION_SEND  0
-#define NAS_DIRECTION_RECEIVE 1
-
-// function number
-#define NAS_FCT_DEL_SEND  1
-#define NAS_FCT_QOS_SEND  2
-#define NAS_FCT_DC_SEND 3
-#define NAS_FCT_CTL_SEND  4
-
-// type of IOCTL command
-#define NASRG_IOCTL_RAL 0x89F0
-
-// Error cause
-#define NAS_ERROR_ALREADYEXIST  1
-#define NAS_ERROR_NOMEMORY    3
-#define NAS_ERROR_NOTMT     9
-#define NAS_ERROR_NOTRG     10
-#define NAS_ERROR_NOTIDLE     11
-#define NAS_ERROR_NOTCONNECTED    12
-#define NAS_ERROR_NORB    14
-#define NAS_ERROR_NOTCORRECTVALUE 32
-#define NAS_ERROR_NOTCORRECTLCR 33
-#define NAS_ERROR_NOTCORRECTDIR 34
-#define NAS_ERROR_NOTCORRECTDSCP  35
-#define NAS_ERROR_NOTCORRECTVERSION 36
-#define NAS_ERROR_NOTCORRECTRABI  37
-
-
-/**********************************************************/
-/* Constants related with IP protocols                    */
-/**********************************************************/
-
-// Destination address types
-#define NAS_IPV6_ADDR_UNICAST        1
-#define NAS_IPV6_ADDR_MC_SIGNALLING  2
-#define NAS_IPV6_ADDR_MC_MBMS        3
-#define NAS_IPV6_ADDR_UNKNOWN        4
-
-#define NAS_IPV4_ADDR_UNICAST        5
-#define NAS_IPV4_ADDR_MC_SIGNALLING  6
-#define NAS_IPV4_ADDR_BROADCAST      7
-#define NAS_IPV4_ADDR_UNKNOWN        8
-
-//#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0fc00000) Yan
-#define NAS_TRAFFICCLASS_MASK __constant_htonl(0x0ff00000)
-
-// Network control codepoint 111000 + IP version 6
-#define NAS_FLOWINFO_NCONTROL __constant_htonl(0x6e000000)
-// network control codepoint 111000
-#define NAS_DSCP_NCONTROL 56   //0x38
-// default codepoint 1000000
-#define NAS_DSCP_DEFAULT 64
-#define NAS_DSCP_MAX 65
-
-#define NAS_PROTOCOL_DEFAULT 0
-#define NAS_PROTOCOL_TCP IPPROTO_TCP
-#define NAS_PROTOCOL_UDP IPPROTO_UDP
-#define NAS_PROTOCOL_ICMP4 IPPROTO_ICMP
-#define NAS_PROTOCOL_ICMP6 IPPROTO_ICMPV6
-
-#define NAS_PORT_DEFAULT  __constant_htons(65535)
-#define NAS_PORT_HTTP   __constant_htons(80)
-
-#define NAS_VERSION_DEFAULT   0
-#define NAS_VERSION_4   4
-#define NAS_VERSION_6   6 //?MW
-
-/**********************************************************/
-/* Constants related with Netlink sockets                 */
-/**********************************************************/
-#define OAI_IP_DRIVER_NETLINK_ID 31
-#define NL_DEST_PID 1
-
-// defined in rrc_nas_sap.h
-//#define NAS_RRCNL_ID 30
-//#define NL_DEST_RRC_PID 2
-
-#define NASNL_DEST_PDCP 0
-#define NASNL_DEST_RRC 1
-
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c
deleted file mode 100644
index 8fe2d48e3f..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_device.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_device.c
-* \brief Networking Device Driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-//:::::::::::::::::::::::::::::::::::::::;;
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-//:::::::::::::::::::::::::::::::::::::::;;
-//#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/if_ether.h>
-#endif
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-#include <asm/unistd.h>
-#include <linux/netdevice.h>
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-#include <linux/etherdevice.h>
-#endif
-//:::::::::::::::::::::::::::::::::::::::;;
-/* Global variables */
-struct net_device *gdev;
-struct nas_priv *gpriv;
-//int bytes_wrote;
-//int bytes_read;
-uint8_t NAS_RG_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x01};
-uint8_t NAS_NULL_IMEI[14]= {0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ,0x00, 0x00, 0x00};
-
-uint16_t local_rg_cell_id;
-
-#ifdef PDCP_USE_NETLINK
-extern void nasrg_netlink_release(void);
-extern int nasrg_netlink_init(void);
-#endif
-extern void nasrg_ASCTL_timer(unsigned long data);
-
-#ifndef PDCP_USE_NETLINK
-//---------------------------------------------------------------------------
-void *nasrg_interrupt(void)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi;
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasrg_interrupt - begin\n");
-#endif
-
-  //spin_lock(&gpriv->lock);
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
-    nasrg_COMMON_QOS_receive(gpriv->cx+cxi);
-
-  for (cxi=0; cxi<NAS_CX_MAX; ++cxi)
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi);
-
-  //spin_unlock(&gpriv->lock);
-#ifdef NAS_DEBUG_INTERRUPT
-  printk("nasrg_interrupt: end\n");
-#endif
-  //  return 0;
-}
-#endif //NETLINK
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is activated by ifconfig
-int nasrg_open(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_open: begin\n");
-
-  gpriv=netdev_priv(dev);
-
-  // Address has already been set at init
-#ifndef PDCP_USE_NETLINK
-
-  if (gpriv->irq==-EBUSY) {
-    printk("nasrg_open: irq failure\n");
-    return -EBUSY;
-  }
-
-#endif //NETLINK
-
-  if(!netif_queue_stopped(dev))
-    netif_start_queue(dev);
-  else
-    netif_wake_queue(dev);
-
-  //
-  init_timer(&gpriv->timer);
-  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
-  (gpriv->timer).data=0L;
-  (gpriv->timer).function=nasrg_ASCTL_timer;
-  add_timer(&gpriv->timer);
-  //
-  printk("nasrg_open: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-// Called by ifconfig when the device is desactivated by ifconfig
-int nasrg_stop(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *priv = netdev_priv(dev);
-  printk("nasrg_stop: begin\n");
-  del_timer(&priv->timer);
-  netif_stop_queue(dev);
-
-  printk("nasrg_stop: name = %s, end\n", dev->name);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_teardown(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  int cxi;
-#ifndef PDCP_USE_NETLINK
-  struct nas_priv *priv = netdev_priv(dev);
-#endif //PDCP_USE_NETLINK
-
-  printk("nasrg_teardown: begin\n");
-
-  if (dev) {
-#ifndef PDCP_USE_NETLINK
-
-    if (priv->irq!=-EBUSY) {
-      *pt_nas_rg_irq=-1;
-      rt_free_srq(priv->irq);
-    }
-
-#endif //PDCP_USE_NETLINK
-
-#ifdef PDCP_USE_NETLINK
-    nasrg_netlink_release();
-#endif //PDCP_USE_NETLINK
-
-    //  for (sapi=0; sapi<NAS_SAPI_MAX; ++sapi)
-    //    close(priv->sap[sapi]);
-    nasrg_CLASS_flush_rclassifier();
-    nasrg_CLASS_flush_mbmsclassifier();
-
-    for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-      nasrg_COMMON_flush_rb(gpriv->cx+cxi);
-      nasrg_CLASS_flush_sclassifier(gpriv->cx+cxi);
-      //for (sapi=0; sapi<NAS_SAPI_CX_MAX; ++sapi)
-      //  close(priv->cx[cxi].sap[sapi]);
-    }
-  } // check dev
-  else {
-    printk("nasmt_teardown: Device is null\n");
-  }
-
-  printk("nasrg_teardown: end\n");
-}
-
-//---------------------------------------------------------------------------
-int nasrg_set_config(struct net_device *dev, struct ifmap *map)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_set_config: begin\n");
-
-  if (dev->flags & IFF_UP)
-    return -EBUSY;
-
-  if (map->base_addr != dev->base_addr) {
-    printk(KERN_WARNING "nasrg_set_config: Can't change I/O address\n");
-    return -EOPNOTSUPP;
-  }
-
-  if (map->irq != dev->irq)
-    dev->irq = map->irq;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasrg_hard_start_xmit: begin\n");
-#endif
-
-  if ((!skb )||(!dev)) {
-    printk("nasrg_hard_start_xmit - input parameter skb or dev is NULL \n");
-    return -1;
-  }
-
-  // End debug information
-  netif_stop_queue(dev);
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 1\n");
-#endif
-  nasrg_CLASS_send(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 2\n");
-#endif
-  dev_kfree_skb(skb);
-#ifdef NAS_DEBUG_SEND_DETAIL
-  printk("nasrg_hard_start_xmit: step 3\n");
-#endif
-  netif_wake_queue(dev);
-#ifdef NAS_DEBUG_DEVICE
-  printk("nasrg_hard_start_xmit: end\n");
-#endif
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-struct net_device_stats *nasrg_get_stats(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  struct nas_priv *npriv = netdev_priv(dev);
-  return &npriv->stats;
-}
-
-//---------------------------------------------------------------------------
-// New function from LITE DRIVER
-int nasrg_set_mac_address(struct net_device *dev, void *mac)
-{
-  //---------------------------------------------------------------------------
-  struct sockaddr *addr = mac;
-  printk("nasrg_set_mac_address: begin\n");
-  memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_change_mtu(struct net_device *dev, int mtu)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_change_mtu: begin\n");
-
-  if ((mtu<50) || (mtu>1500))
-    //  if ((mtu<1280) || (mtu>1500))
-    return -EINVAL;
-
-  dev->mtu = mtu;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_change_rx_flags(struct net_device *dev, int flags)
-{
-  //---------------------------------------------------------------------------
-  //struct nas_priv *priv =  netdev_priv(dev);
-  printk("nasrg_change_rx_flags %08X\n", flags);
-  gpriv->rx_flags ^= flags;
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_tx_timeout(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  /* Transmitter timeout, serious problems. */
-  printk("nasrg_tx_timeout: begin\n");
-  //  ((struct nas_priv *)(dev->priv))->stats.tx_errors++;
-  (gpriv->stats).tx_errors++;
-#if  LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-  netif_trans_update(dev);
-#else
-  dev->trans_start = jiffies;
-#endif
-  netif_wake_queue(dev);
-  printk("nasrg_tx_timeout: transmit timed out %s\n",dev->name);
-}
-
-//---------------------------------------------------------------------------
-// Define pointers for the module
-static const struct net_device_ops nasrg_netdev_ops = {
-  // ?? nasrg_ interrupt
-  //
-  .ndo_open               = nasrg_open,
-  .ndo_stop               = nasrg_stop,
-  .ndo_start_xmit         = nasrg_hard_start_xmit,
-  .ndo_validate_addr      = NULL,
-  .ndo_get_stats          = nasrg_get_stats,
-  //#ifdef  KERNEL_VERSION_GREATER_THAN_32
-  //  .ndo_set_multicast_list = NULL,
-  .ndo_set_mac_address    = nasrg_set_mac_address,
-  .ndo_set_config         = nasrg_set_config,
-  .ndo_do_ioctl           = nasrg_CTL_ioctl,
-  .ndo_change_mtu         = nasrg_change_mtu,
-  .ndo_tx_timeout         = nasrg_tx_timeout,
-  .ndo_change_rx_flags    = nasrg_change_rx_flags,
-  //#endif
-};
-//---------------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------
-// Initialisation of the network device
-void nasrg_init(struct net_device *dev)
-{
-  //---------------------------------------------------------------------------
-  uint8_t cxi, dscpi;
-
-  printk("nasrg_init: begin\n");
-
-  if (dev) {
-    gpriv=netdev_priv(dev);
-
-    memset(gpriv, 0, sizeof(struct nas_priv));
-    // Initialize function pointers
-    dev->netdev_ops = &nasrg_netdev_ops;
-
-#ifndef NAS_DRIVER_TYPE_ETHERNET
-    dev->type = ARPHRD_EURUMTS;
-    dev->features = NETIF_F_NO_CSUM;
-    dev->hard_header_len = 0;
-    dev->addr_len = NAS_ADDR_LEN;
-    dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
-    dev->tx_queue_len = NAS_TX_QUEUE_LEN;
-    dev->mtu = NAS_MTU;
-#endif
-    // Can be one of the following enum defined in include/linux/netdevice.h:
-    // enum netdev_state_t {
-    // __LINK_STATE_START,
-    // __LINK_STATE_PRESENT,
-    // __LINK_STATE_NOCARRIER,
-    // __LINK_STATE_LINKWATCH_PENDING,
-    // __LINK_STATE_DORMANT,
-    // };
-    set_bit(__LINK_STATE_PRESENT, &dev->state);
-
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-    // overwrite values written above ( header_ops,type,hard_header_len,mtu,addr_len,tx_queue_len,flags,broadcast)
-    printk("\nnasrg_init: WARNING Driver type ETHERNET\n");
-    ether_setup(dev);
-#endif
-    //
-    // Initialize private structure
-    gpriv->rx_flags = NAS_RESET_RX_FLAGS;
-
-    gpriv->sap[NAS_GC_SAPI] = RRC_DEVICE_GC;
-    gpriv->sap[NAS_NT_SAPI] = RRC_DEVICE_NT;
-    gpriv->cx[0].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT0;
-    gpriv->cx[0].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT0;
-    gpriv->cx[1].sap[NAS_DC_INPUT_SAPI] = RRC_DEVICE_DC_INPUT1;
-    gpriv->cx[1].sap[NAS_DC_OUTPUT_SAPI] = RRC_DEVICE_DC_OUTPUT1;
-    //  gpriv->sap[NAS_CO_INPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_INPUT;
-    //  gpriv->sap[NAS_CO_OUTPUT_SAPI] = QOS_DEVICE_CONVERSATIONAL_OUTPUT;
-    gpriv->sap[NAS_DRB_INPUT_SAPI]  = PDCP2PDCP_USE_RT_FIFO;//QOS_DEVICE_CONVERSATIONAL_INPUT;
-    gpriv->sap[NAS_DRB_OUTPUT_SAPI] = NAS2PDCP_FIFO;//QOS_DEVICE_STREAMING_INPUT;
-    //
-    gpriv->retry_limit=NAS_RETRY_LIMIT_DEFAULT;
-    gpriv->timer_establishment=NAS_TIMER_ESTABLISHMENT_DEFAULT;
-    gpriv->timer_release=NAS_TIMER_RELEASE_DEFAULT;
-
-    for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-      gpriv->rclassifier[dscpi]=NULL;
-
-    gpriv->nrclassifier=0;
-
-    //
-    for(cxi=0; cxi<NAS_CX_MAX; ++cxi) {
-#ifdef NAS_DEBUG_DEVICE
-      printk("nasrg_init: init classifiers, state and timer for MTs %u\n", cxi);
-#endif
-      gpriv->cx[cxi].state=NAS_IDLE;
-      gpriv->cx[cxi].countimer=NAS_TIMER_IDLE;
-      gpriv->cx[cxi].retry=0;
-      gpriv->cx[cxi].lcr=cxi;
-      gpriv->cx[cxi].rb=NULL;
-      gpriv->cx[cxi].num_rb=0;
-
-      // initialisation of the classifier
-      for (dscpi=0; dscpi<NAS_DSCP_MAX; ++dscpi)
-        gpriv->cx[cxi].sclassifier[dscpi]=NULL;
-
-      gpriv->cx[cxi].nsclassifier=0;
-      // initialisation of the IP address
-      nasrg_TOOL_imei2iid(NAS_NULL_IMEI, (uint8_t *)gpriv->cx[cxi].iid6);
-      gpriv->cx[cxi].iid4=0;
-    }
-
-    spin_lock_init(&gpriv->lock);
-
-    nasrg_TOOL_RGimei2iid(NAS_RG_IMEI, dev->dev_addr);// IMEI to device address (for stateless autoconfiguration address)
-    printk("nasrg_init: init IMEI to IID\n");
-    nasrg_ASCTL_init();
-  } else {
-    printk("\n\nnasmt_init: ERROR, Device is NULL!!\n");
-  }
-
-  printk("nasrg_init: end\n");
-  return ;
-}
-
-//---------------------------------------------------------------------------
-int init_module (void)
-{
-  //---------------------------------------------------------------------------
-  int err;
-  int inst = 0;
-  struct nas_priv *priv;
-  char devicename[100];
-
-  printk("\n\n\n\nnasrg_init_module: begin \n");
-
-  // Initialize parameters shared with RRC
-#ifndef PDCP_USE_NETLINK
-
-  if (pt_nas_rg_irq==NULL) {
-    printk("nasrg_init_module: shared irq parameter not initialised\n");
-    err =  -EBUSY;
-    printk("nasrg_init_module: returning %d \n\n", err);
-    return err;
-  }
-
-  printk("nasrg_init_module: pt_nas_rg_irq valid \n");
-#endif
-
-  /*
-    if (pt_rg_own_cell_id==NULL){
-      printk("nasrg_init_module: shared cell_id parameter not initialised\n");
-      err =  -EBUSY;
-      printk("nasrg_init_module: returning %d \n\n\n", err);
-      return err;
-    }
-    printk("nasrg_init_module: pt_rg_own_cell_id valid \n");
-    *pt_rg_own_cell_id = NASRG_OWN_CELLID;
-  */
-  local_rg_cell_id = NASRG_OWN_CELLID;
-
-  // Allocate device structure
-  sprintf(devicename,"oai%d",inst);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, nasrg_init);
-#else
-  gdev = alloc_netdev(sizeof(struct nas_priv), devicename, NET_NAME_PREDICTABLE, nasrg_init);
-#endif
-  printk("nasrg_init_module: after alloc_netdev \n");
-  priv = netdev_priv(gdev);
-  ////
-  //
-#ifndef PDCP_USE_NETLINK
-  priv->irq=rt_request_srq(0, nasrg_interrupt, NULL);
-
-  if (priv->irq == -EBUSY || priv->irq == -EINVAL) {
-    printk("nasrg_init_module: No interrupt resource available\n");
-
-    if (gdev) {
-      free_netdev(gdev);
-      printk("nasrg_init_module: free_netdev ..\n");
-    }
-
-    return -EBUSY;
-  } else
-    printk("nasrg_init_module: Interrupt %d, ret = %d \n", priv->irq , ret);
-
-  if (pt_nas_rg_irq==NULL) {
-    printk("nasmt_init_module: shared irq parameter has been reset\n");
-  } else {
-    *pt_nas_rg_irq=priv->irq;
-  }
-
-#endif
-  //
-  //////
-#ifdef PDCP_USE_NETLINK
-
-  if ((err=nasrg_netlink_init()) < 0)
-    printk("nasrg_init_module: NETLINK failed\n");
-
-  printk("nasrg_init_module: NETLINK INIT successful\n");
-#endif //NETLINK
-
-  err= register_netdev(gdev);
-
-  if (err) {
-    printk("nasrg_init_module: error %i registering device %s\n", err, gdev->name);
-  } else {
-    printk("nasrg_init_module: registering device %s, ifindex = %d\n\n",gdev->name, gdev->ifindex);
-  }
-
-  return err;
-}
-
-//---------------------------------------------------------------------------
-void cleanup_module(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_cleanup_module: begin\n");
-  unregister_netdev(gdev);
-  nasrg_teardown(gdev);
-  free_netdev(gdev);
-  printk("nasrg_cleanup_module: end\n\n\n\n");
-}
-
-//---------------------------------------------------------------------------
-// Replaced by init_module and cleanup_module
-//module_init (nasrg_init_module);
-//module_exit (nasrg_cleanup_module);
-//---------------------------------------------------------------------------
-
-#define DRV_NAME        "oai_nasrg"
-#define DRV_VERSION     "3.0.1"DRV_NAME
-#define DRV_DESCRIPTION "OPENAIR CELLULAR LTE NASRG (eNodeB) Device Driver"
-#define DRV_COPYRIGHT   "-Copyright(c) GNU GPL Eurecom 2013"
-#define DRV_AUTHOR      "Michelle Wetterwald <michelle.wetterwald@eurecom.fr>"DRV_COPYRIGHT
-
-// MODULE_LICENSE("GPL");
-// MODULE_DESCRIPTION("LTE Driver for eNodeB, playing as Non Access Stratum");
-// MODULE_AUTHOR("Michelle Wetterwald <michelle.wetterwald@eurecom.fr>");
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c
deleted file mode 100644
index 3c8f5d3cc6..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_iocontrol.c
-* \brief I/O control functions for upper layers of driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#include "nasrg_variables.h"
-#include "nasrg_iocontrol.h"
-#include "nasrg_proto.h"
-
-//#include <linux/in.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/uaccess.h>
-
-// Statistic
-///////////////////////////////////////////////////////////////////////////////
-
-//---------------------------------------------------------------------------
-void nasrg_set_msg_statistic_reply(struct nas_msg_statistic_reply *msgrep)
-{
-  //---------------------------------------------------------------------------
-  msgrep->rx_packets=gpriv->stats.rx_packets;
-  msgrep->tx_packets=gpriv->stats.tx_packets;
-  msgrep->rx_bytes=gpriv->stats.rx_bytes;
-  msgrep->tx_bytes=gpriv->stats.tx_bytes;
-  msgrep->rx_errors=gpriv->stats.rx_errors;
-  msgrep->tx_errors=gpriv->stats.tx_errors;
-  msgrep->rx_dropped=gpriv->stats.rx_dropped;
-  msgrep->tx_dropped=gpriv->stats.tx_dropped;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_statistic_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_statistic_reply msgrep;
-  printk("nasrg_ioCTL_statistic: stat requested\n");
-  nasrg_set_msg_statistic_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_statistic: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Connections List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_list_reply(uint8_t *msgrep)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  nasLocalConnectionRef_t lcr;
-  struct nas_msg_cx_list_reply *list;
-  msgrep[0]=NAS_CX_MAX;
-  list=(struct nas_msg_cx_list_reply *)(msgrep+1);
-
-  for(lcr=0; lcr<NAS_CX_MAX; ++lcr) {
-    cx=nasrg_COMMON_search_cx(lcr);
-    list[lcr].lcr=lcr;
-    list[lcr].state=cx->state;
-    list[lcr].cellid=cx->cellid;
-    list[lcr].iid4=cx->iid4;
-    list[lcr].iid6[0]=cx->iid6[0];
-    list[lcr].iid6[1]=cx->iid6[1];
-    list[lcr].num_rb=cx->num_rb;
-    list[lcr].nsclassifier=cx->nsclassifier;
-    printk("nasrg_set_msg_cx_list: nsc=%u\n",cx->nsclassifier);
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_cx_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1];
-  printk("nasrg_ioCTL_cx_list: connection list requested\n");
-  nasrg_set_msg_cx_list_reply(msgrep);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_CX_MAX*sizeof(struct nas_msg_cx_list_reply)+1)) {
-    printk("nasrg_ioCTL_cx_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_ioCTL_cx_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Establishment
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep, struct nas_msg_cx_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTMT;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_cx_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_establishment_request msgreq;
-  struct nas_msg_cx_establishment_reply msgrep;
-  printk("nasrg_ioCTL_cx_establishment: connection establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_cx_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_cx_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_cx_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Connection Release
-//---------------------------------------------------------------------------
-void nasrg_set_msg_cx_release_reply(struct nas_msg_cx_release_reply *msgrep, struct nas_msg_cx_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  msgrep->status=-NAS_ERROR_NOTMT;
-}
-
-//---------------------------------------------------------------------------
-// Request the release of a connection
-int nasrg_ioCTL_cx_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_cx_release_request msgreq;
-  struct nas_msg_cx_release_reply msgrep;
-
-  printk("nasrg_set_msg_cx_release: connection release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_set_msg_cx_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_cx_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_set_msg_cx_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_set_msg_cx_release: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_list_reply(uint8_t *msgrep, struct nas_msg_rb_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-  if (cx!=NULL) {
-    uint8_t rbi;
-    struct rb_entity *rb;
-    struct nas_msg_rb_list_reply *list;
-
-    if (cx->num_rb > NAS_LIST_RB_MAX)
-      msgrep[0] = NAS_LIST_RB_MAX;
-    else
-      msgrep[0] = cx->num_rb;
-
-    list=(struct nas_msg_rb_list_reply *)(msgrep+1);
-
-    // list all radio bearers
-    for (rb=cx->rb, rbi=0; (rb!=NULL)&&(rbi<msgrep[0]); rb=rb->next, ++rbi) {
-      list[rbi].state=rb->state;
-      list[rbi].rab_id=rb->rab_id;
-      list[rbi].sapi=rb->sapi;
-      list[rbi].qos=rb->qos;
-      list[rbi].cnxid=rb->cnxid;
-    }
-
-    // check if mt0 requested and multicast bearer started, then add it to the list
-    if ((msgreq->lcr==0)&&(gpriv->mbms_rb[0].mbms_rbId!=0)) {
-      printk("MT %d, MBMS bearer rb_id %d\n", msgreq->lcr, gpriv->mbms_rb[0].mbms_rbId);
-      //++rbi;
-      ++msgrep[0];
-      list[rbi].state=gpriv->mbms_rb[0].state;
-      list[rbi].rab_id=gpriv->mbms_rb[0].mbms_rbId;
-      list[rbi].sapi=gpriv->mbms_rb[0].sapi;
-      list[rbi].qos=gpriv->mbms_rb[0].qos;
-      list[rbi].cnxid=gpriv->mbms_rb[0].cnxid;
-      printk("rab_id  cnxid  Sapi  QoS  State\n");
-      printk("%u  %u  %u  %u  ", list[rbi].rab_id,list[rbi].cnxid, list[rbi].sapi, list[rbi].qos);
-      nasrg_TOOL_print_state(list[rbi].state);
-      printk("\n");
-    }
-  } else
-    msgrep[0]=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1];
-  struct nas_msg_rb_list_request msgreq;
-  printk("nasrg_ioCTL_rb_list: Radio Bearer list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_RB_MAX*sizeof(struct nas_msg_rb_list_reply)+1)) {
-    printk("nasrg_ioCTL_rb_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  printk("nasrg_ioCTL_rb_list: end\n");
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Establishment
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_establishment_reply(struct nas_msg_rb_establishment_reply *msgrep, struct nas_msg_rb_establishment_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if ((msgreq->rab_id<5)||(msgreq->rab_id>(NAS_RB_MAX_NUM-1)))
-    msgrep->status=-NAS_ERROR_NOTCORRECTRABI;
-  else {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) { //not multicast
-      struct rb_entity *rb;
-      rb=nasrg_COMMON_add_rb(cx, msgreq->rab_id, msgreq->qos);
-
-      if (rb!=NULL) {
-        rb->cnxid = msgreq->cnxid;
-        rb->dscp = msgreq->dscp_dl;
-        rb->dscp_ul = msgreq->dscp_ul;
-        msgrep->status=nasrg_ASCTL_DC_send_rb_establish_request(cx, rb);
-      } else {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-      }
-    } else { //no MT found
-      if (msgreq->mcast_flag) { //multicast
-        int mbms_ix=0; // should allocate index based on Service_id /cnxid / MC IP address
-        //
-        gpriv->mbms_rb[mbms_ix].cnxid = msgreq->cnxid;
-        gpriv->mbms_rb[mbms_ix].serviceId = msgreq->cnxid;
-        gpriv->mbms_rb[mbms_ix].sessionId = NASRG_TEMP_MBMS_SESSION_ID; //Temp hard coded
-        gpriv->mbms_rb[mbms_ix].mbms_rbId = msgreq->rab_id;
-        gpriv->mbms_rb[mbms_ix].sapi = NAS_DC_INPUT_SAPI;
-#ifdef NAS_DEBUG_MBMS_PROT
-        gpriv->mbms_rb[mbms_ix].sapi = NAS_DRB_INPUT_SAPI; //Only one RT-FIFO is used
-#endif
-        gpriv->mbms_rb[mbms_ix].qos = msgreq->qos;
-        gpriv->mbms_rb[mbms_ix].dscp = msgreq->dscp_dl;
-        gpriv->mbms_rb[mbms_ix].duration = NASRG_TEMP_MBMS_DURATION; //Temp hard coded
-        memcpy ((char *)&(gpriv->mbms_rb[mbms_ix].mcast_address),(char *)&(msgreq->mcast_group), 16);
-        msgrep->status=nasrg_ASCTL_GC_send_mbms_bearer_establish_req(mbms_ix);
-      } else {
-        msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      }
-
-      msgrep->cnxid  = msgreq->cnxid;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_establishment_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_establishment_request msgreq;
-  struct nas_msg_rb_establishment_reply msgrep;
-  printk("nasrg_ioCTL_rb_establishment: Radio bearer establishment requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_establishment: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_establishment_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_rb_establishment: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Radio Bearer Release
-//---------------------------------------------------------------------------
-void nasrg_set_msg_rb_release_reply(struct nas_msg_rb_release_reply *msgrep, struct nas_msg_rb_release_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->lcr<NAS_CX_MAX) {
-    if (msgreq->rab_id!=NASRG_DEFAULTRAB_RBID) {
-      struct rb_entity *rb;
-      struct cx_entity *cx;
-      cx=nasrg_COMMON_search_cx(msgreq->lcr);
-      rb=nasrg_COMMON_search_rb(cx, msgreq->rab_id);
-
-      if ((rb!=NULL)&&(cx!=NULL)) {
-        uint8_t dscp;
-        msgrep->status=nasrg_ASCTL_DC_send_rb_release_request(cx, rb);
-        dscp=rb->dscp;
-        nasrg_COMMON_del_rb(cx, msgreq->rab_id, dscp);
-      } else
-        msgrep->status=-NAS_ERROR_NOTCONNECTED;
-
-      msgrep->cnxid  = msgreq->cnxid;
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTRABI;
-    }
-  } else {
-    if (msgreq->mcast_flag) { // multicast
-      int mbms_ix=0;  // should search mbms_ix based on cnxid
-      msgrep->status=nasrg_ASCTL_GC_send_mbms_bearer_release_req(mbms_ix);
-      msgrep->cnxid  = msgreq->cnxid;
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_rb_release_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_rb_release_request msgreq;
-  struct nas_msg_rb_release_reply msgrep;
-  printk("nasrg_ioCTL_rb_release: Radio bearer release requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_rb_release: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_rb_release_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_rb_release: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Classifier List
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_list_reply(uint8_t *msgrep, struct nas_msg_class_list_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  struct classifier_entity *gc;
-  struct nas_msg_class_list_reply *list;
-  uint8_t cli;
-  list=(struct nas_msg_class_list_reply *)(msgrep+1);
-
-  switch(msgreq->dir) {
-  case NAS_DIRECTION_SEND:
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx==NULL) {
-      msgrep[0]=0;
-      return;
-    }
-
-    gc=cx->sclassifier[msgreq->dscp];
-    break;
-
-  case NAS_DIRECTION_RECEIVE:
-    cx=NULL;
-    gc=gpriv->rclassifier[msgreq->dscp];
-    break;
-
-  default:
-    cx=NULL;
-    msgrep[0]=0;
-    return;
-  }
-
-  for (cli=0; (gc!=NULL)&&(cli<NAS_LIST_CLASS_MAX); gc=gc->next, ++cli) {
-    list[cli].classref=gc->classref;
-    list[cli].lcr=msgreq->lcr;
-    list[cli].dir=msgreq->dir;
-    list[cli].dscp=msgreq->dscp;
-    list[cli].rab_id=gc->rab_id;
-    list[cli].version=gc->version;
-
-    switch(gc->version) {
-    case 4:
-      list[cli].saddr.ipv4 = gc->saddr.ipv4;
-      list[cli].daddr.ipv4 = gc->daddr.ipv4;
-      break;
-
-    case 6:
-      list[cli].saddr.ipv6 = gc->saddr.ipv6;
-      list[cli].daddr.ipv6 = gc->daddr.ipv6;
-      break;
-    }
-
-    list[cli].protocol=gc->protocol;
-    list[cli].sport=ntohs(gc->sport);
-    list[cli].dport=ntohs(gc->dport);
-    list[cli].splen=gc->splen;
-    list[cli].dplen=gc->dplen;
-    list[cli].fct=nasrg_TOOL_invfct(gc);
-  }
-
-  msgrep[0]=cli;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_list_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  uint8_t msgrep[NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1];
-  struct nas_msg_class_list_request msgreq;
-  printk("nasrg_ioCTL_class_list: classifier list requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_list: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_list_reply(msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, msgrep, NAS_LIST_CLASS_MAX*sizeof(struct nas_msg_class_list_reply)+1)) {
-    printk("nasrg_ioCTL_class_list: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the addition of a classifier rule
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_add_reply(struct nas_msg_class_add_reply *msgrep, struct nas_msg_class_add_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct classifier_entity *gc;
-
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasrg_set_msg_class_add: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL) {
-      printk("nasrg_set_msg_class_add: DSCP %d, Classref %d\n",msgreq->dscp, msgreq->classref );
-      gc=nasrg_CLASS_add_sclassifier(cx, msgreq->dscp, msgreq->classref);
-      printk("nasrg_set_msg_class_add: %p %p\n" , msgreq, gc);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-
-    gc->rab_id=msgreq->rab_id;
-    gc->rb=nasrg_COMMON_search_rb(cx, gc->rab_id);
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE) {
-      gc=nasrg_CLASS_add_rclassifier(msgreq->dscp, msgreq->classref);
-
-      if (gc==NULL) {
-        msgrep->status=-NAS_ERROR_NOMEMORY;
-        return;
-      }
-    } else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  nasrg_TOOL_fct(gc, msgreq->fct);
-  gc->version=msgreq->version;
-
-  switch(gc->version) {
-  case 4:
-    gc->saddr.ipv4=msgreq->saddr.ipv4;
-    gc->daddr.ipv4=msgreq->daddr.ipv4;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 6:
-    gc->saddr.ipv6=msgreq->saddr.ipv6;
-    gc->daddr.ipv6=msgreq->daddr.ipv6;
-    gc->splen=msgreq->splen;
-    gc->dplen=msgreq->dplen;
-    break;
-
-  case 0:
-    gc->saddr.ipv6.s6_addr32[0]=0;
-    gc->daddr.ipv6.s6_addr32[1]=0;
-    gc->saddr.ipv6.s6_addr32[2]=0;
-    gc->daddr.ipv6.s6_addr32[3]=0;
-    gc->splen=0;
-    gc->dplen=0;
-    break;
-
-  default:
-    msgrep->status=-NAS_ERROR_NOTCORRECTVERSION;
-    kfree(gc);
-    return;
-  }
-
-  gc->protocol=msgreq->protocol;
-  gc->sport=htons(msgreq->sport);
-  gc->dport=htons(msgreq->dport);
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_add_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_add_request msgreq;
-  struct nas_msg_class_add_reply msgrep;
-  printk("nasrg_ioCTL_class_add: Add classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_add: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_add_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_class_add: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Request the deletion of a classifier rule
-//---------------------------------------------------------------------------
-void nasrg_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
-    printk("nasrg_set_msg_class_del: Incoherent parameter value\n");
-    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
-    return;
-  }
-
-  if (msgreq->dir==NAS_DIRECTION_SEND) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->lcr);
-
-    if (cx!=NULL)
-      nasrg_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
-      return;
-    }
-  } else {
-    if (msgreq->dir==NAS_DIRECTION_RECEIVE)
-      nasrg_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
-    else {
-      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
-      return;
-    }
-  }
-
-  msgrep->status=0;
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_class_del_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_class_del_request msgreq;
-  struct nas_msg_class_del_reply msgrep;
-  printk("nasrg_ioCTL_class_del: Del classifier components requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_class_del: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_class_del_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_class_del: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// UE Multicast Join
-//---------------------------------------------------------------------------
-void nasrg_set_ue_multicast_join_reply(struct nas_msg_mt_mcast_reply *msgrep, struct nas_msg_mt_mcast_join *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->ue_id<NAS_CX_MAX) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->ue_id);
-    cx->requested_joined_services[0] = msgreq->cnxid;
-    msgrep->ue_id  = msgreq->ue_id;
-    msgrep->result = nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-    msgrep->cnxid  = msgreq->cnxid;
-  } else {
-    msgrep->result=-NAS_ERROR_NOTCORRECTLCR;
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_ue_multicast_join_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_mt_mcast_join msgreq;
-  struct nas_msg_mt_mcast_reply msgrep;
-  printk("nasrg_ioCTL_ue_multicast_join: UE multicast join requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_ue_multicast_join: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_ue_multicast_join_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_ue_multicast_join: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// UE Multicast Leave
-//---------------------------------------------------------------------------
-void nasrg_set_ue_multicast_leave_reply(struct nas_msg_mt_mcast_reply *msgrep, struct nas_msg_mt_mcast_leave *msgreq)
-{
-  //---------------------------------------------------------------------------
-  if (msgreq->ue_id<NAS_CX_MAX) {
-    struct cx_entity *cx;
-    cx=nasrg_COMMON_search_cx(msgreq->ue_id);
-    cx->requested_left_services[0] = msgreq->cnxid;
-    msgrep->ue_id  = msgreq->ue_id;
-    msgrep->result = nasrg_ASCTL_DC_send_mbms_ue_notify_req(cx);
-    msgrep->cnxid  = msgreq->cnxid;
-  } else {
-    msgrep->result=-NAS_ERROR_NOTCORRECTLCR;
-  }
-}
-
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_ue_multicast_leave_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_mt_mcast_leave msgreq;
-  struct nas_msg_mt_mcast_reply msgrep;
-  printk("nasrg_ioCTL_ue_multicast_leave: UE multicast leave requested\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_ue_multicast_leave: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_ue_multicast_leave_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_ue_multicast_leave: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ENB Measures
-// Messages for triggering measurement
-//---------------------------------------------------------------------------
-void nasrg_set_msg_eNBmeasure_trigger_reply(struct nas_msg_enb_measure_trigger_reply *msgrep, struct nas_msg_enb_measure_trigger *msgreq)
-{
-  //---------------------------------------------------------------------------
-  struct cx_entity *cx;
-  int lcr=0; // Temp lcr->mt =0 (should be GC uplink)
-
-  cx=nasrg_COMMON_search_cx(lcr);
-
-  if (msgreq->cell_id != cx->cellid)
-    printk("\nERROR : invalid cell_id received\n\n");
-
-  if (nasrg_ASCTL_DC_send_eNBmeasurement_req(cx)>0)
-    msgrep->status = 0;
-  else
-    msgrep->status = NAS_ERROR_NOTCORRECTVALUE ;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_eNBmeasure_trigger_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_enb_measure_trigger msgreq;
-  struct nas_msg_enb_measure_trigger_reply msgrep;
-  printk("nasrg_ioCTL_eNBmeasure_trigger_request: Measures triggered\n");
-
-  if (copy_from_user(&msgreq, gifr->msg, sizeof(msgreq))) {
-    printk("nasrg_ioCTL_eNBmeasure_trigger_request: copy_from_user failure\n");
-    return -EFAULT;
-  }
-
-  nasrg_set_msg_eNBmeasure_trigger_reply(&msgrep, &msgreq);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_eNBmeasure_trigger_request: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ENb Measurement
-// Messages for Measurement retrieval
-//---------------------------------------------------------------------------
-void nasrg_set_msg_eNBmeasure_retrieve_reply(struct nas_msg_enb_measure_retrieve *msgrep)
-{
-  //---------------------------------------------------------------------------
-  int i;
-
-  msgrep->cell_id = gpriv->measured_cell_id;
-  msgrep->num_UEs = gpriv->num_UEs;
-
-  for (i=0; i<gpriv-> num_UEs; i++) {
-    msgrep->measures[i].rlcBufferOccupancy = gpriv->rlcBufferOccupancy[i];
-    msgrep->measures[i].scheduledPRB = gpriv->scheduledPRB[i];
-    msgrep->measures[i].totalDataVolume = gpriv->totalDataVolume[i];
-    //clean variables
-    gpriv->rlcBufferOccupancy[i] = 0;
-    gpriv->scheduledPRB[i] = 0;
-    gpriv->totalDataVolume[i] = 0;
-  }
-
-  msgrep->totalNumPRBs = gpriv->totalNumPRBs;
-  //clean variable
-  gpriv->totalNumPRBs = 0;
-}
-//---------------------------------------------------------------------------
-int nasrg_ioCTL_eNBmeasure_retrieve_request(struct nas_ioctl *gifr)
-{
-  //---------------------------------------------------------------------------
-  struct nas_msg_enb_measure_retrieve msgrep;
-  printk("nasrg_ioCTL_eNBmeasure_retrieve_request: Measurement requested\n");
-
-  nasrg_set_msg_eNBmeasure_retrieve_reply(&msgrep);
-
-  if (copy_to_user(gifr->msg, &msgrep, sizeof(msgrep))) {
-    printk("nasrg_ioCTL_eNBmeasure_retrieve_request: copy_to_user failure\n");
-    return -EFAULT;
-  }
-
-  return 0;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// IOCTL command
-//---------------------------------------------------------------------------
-int nasrg_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-  //---------------------------------------------------------------------------
-  struct nas_ioctl *gifr;
-  int r;
-  printk("nasrg_CTL_ioctl: begin\n");
-  spin_lock(&gpriv->lock);
-
-  switch(cmd) {
-  case NASRG_IOCTL_RAL:
-    gifr=(struct nas_ioctl *)ifr;
-
-    switch(gifr->type) {
-    case NAS_MSG_STATISTIC_REQUEST:
-      r=nasrg_ioCTL_statistic_request(gifr);
-      break;
-
-    case NAS_MSG_CX_ESTABLISHMENT_REQUEST:
-      r=nasrg_ioCTL_cx_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_CX_RELEASE_REQUEST:
-      r=nasrg_ioCTL_cx_release_request(gifr);
-      break;
-
-    case NAS_MSG_CX_LIST_REQUEST:
-      r=nasrg_ioCTL_cx_list_request(gifr);
-      break;
-
-    case NAS_MSG_RB_ESTABLISHMENT_REQUEST:
-      r=nasrg_ioCTL_rb_establishment_request(gifr);
-      break;
-
-    case NAS_MSG_RB_RELEASE_REQUEST:
-      r=nasrg_ioCTL_rb_release_request(gifr);
-      break;
-
-    case NAS_MSG_RB_LIST_REQUEST:
-      r=nasrg_ioCTL_rb_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_ADD_REQUEST:
-      r=nasrg_ioCTL_class_add_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_LIST_REQUEST:
-      r=nasrg_ioCTL_class_list_request(gifr);
-      break;
-
-    case NAS_MSG_CLASS_DEL_REQUEST:
-      r=nasrg_ioCTL_class_del_request(gifr);
-      break;
-
-    case NAS_RG_MSG_MT_MCAST_JOIN:
-      r=nasrg_ioCTL_ue_multicast_join_request(gifr);
-      break;
-
-    case NAS_RG_MSG_MT_MCAST_LEAVE:
-      r=nasrg_ioCTL_ue_multicast_leave_request(gifr);
-      break;
-
-    case NAS_MSG_ENB_MEAS_TRIGGER:
-      r=nasrg_ioCTL_eNBmeasure_trigger_request(gifr);
-      break;
-
-    case NAS_MSG_ENB_MEAS_RETRIEVE:
-      r=nasrg_ioCTL_eNBmeasure_retrieve_request(gifr);
-      break;
-
-    default:
-      printk("nasrg_CTL_ioctl: unkwon request type, type=%x\n", gifr->type);
-      r=-EFAULT;
-    }
-
-    break;
-
-  default:
-    printk("nasrg_CTL_ioctl: Unknown ioctl command, cmd=%x\n", cmd);
-    r=-EFAULT;
-  }
-
-  spin_unlock(&gpriv->lock);
-  printk("nasrg_CTL_ioctl: end\n");
-  return r;
-}
-
-//---------------------------------------------------------------------------
-void nasrg_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_CTL_send - void \n");
-}
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h
deleted file mode 100644
index bd7baac3b6..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_iocontrol.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_iocontrol.h
-* \brief I/O control constnats and structures for upper layers of driver for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef NASRGD_CTL_H
-#define NASRGD_CTL_H
-
-#include <asm/byteorder.h>
-#include <asm/types.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-
-#define NAS_MSG_MAXLEN 1100
-
-// type of CTL message
-#define NAS_MSG_STATISTIC_REQUEST       1
-#define NAS_MSG_STATISTIC_REPLY         2
-#define NAS_MSG_ECHO_REQUEST   3
-#define NAS_MSG_ECHO_REPLY   4
-#define NAS_MSG_CX_ESTABLISHMENT_REQUEST 5
-#define NAS_MSG_CX_ESTABLISHMENT_REPLY 6
-#define NAS_MSG_CX_RELEASE_REQUEST  7
-#define NAS_MSG_CX_RELEASE_REPLY  8
-#define NAS_MSG_CX_LIST_REQUEST  9
-#define NAS_MSG_CX_LIST_REPLY   10
-#define NAS_MSG_RB_ESTABLISHMENT_REQUEST 11
-#define NAS_MSG_RB_ESTABLISHMENT_REPLY 12
-#define NAS_MSG_RB_RELEASE_REQUEST  13
-#define NAS_MSG_RB_RELEASE_REPLY  14
-#define NAS_MSG_RB_LIST_REQUEST  15
-#define NAS_MSG_RB_LIST_REPLY   16
-#define NAS_MSG_CLASS_ADD_REQUEST  17
-#define NAS_MSG_CLASS_ADD_REPLY  18
-#define NAS_MSG_CLASS_DEL_REQUEST  19
-#define NAS_MSG_CLASS_DEL_REPLY  20
-#define NAS_MSG_CLASS_LIST_REQUEST  21
-#define NAS_MSG_CLASS_LIST_REPLY  22
-#define NAS_MSG_NEIGHBOUR_REQUEST  23
-#define NAS_MSG_NEIGHBOUR_REPLY  24
-//MBMS
-#define NAS_RG_MSG_MT_MCAST_JOIN           30
-#define NAS_RG_MSG_MT_MCAST_LEAVE          31
-#define NAS_RG_MSG_MT_MCAST_REPLY          32
-// ENB MEASURES (MEDIEVAL DEMO 3)
-#define NAS_MSG_ENB_MEAS_TRIGGER  33
-#define NAS_MSG_ENB_MEAS_RETRIEVE 34
-
-
-// Max number of entry of a message list
-#define NAS_LIST_CX_MAX 32
-#define NAS_LIST_RB_MAX 32
-#define NAS_LIST_CLASS_MAX 32
-
-typedef uint16_t nasMsgType_t;
-
-struct nas_ioctl {
-  char name[IFNAMSIZ];
-  nasMsgType_t type;
-  char *msg;
-};
-
-//****
-struct nas_msg_statistic_reply {
-  uint32_t rx_packets;
-  uint32_t tx_packets;
-  uint32_t rx_bytes;
-  uint32_t tx_bytes;
-  uint32_t rx_errors;
-  uint32_t tx_errors;
-  uint32_t rx_dropped;
-  uint32_t tx_dropped;
-};
-
-//****
-struct nas_msg_cx_list_reply {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  uint8_t state;
-  nasCellID_t cellid;  // cell identification
-  uint32_t iid6[2];    // IPv6  interface identification
-  uint8_t iid4;    // IPv4 interface identification
-  uint16_t num_rb;
-  uint16_t nsclassifier;
-};
-//****
-struct nas_msg_cx_establishment_reply {
-  int status;
-};
-struct nas_msg_cx_establishment_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasCellID_t cellid; // Cell identification
-};
-//****
-struct nas_msg_cx_release_reply {
-  int status;
-};
-struct nas_msg_cx_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-};
-
-//****
-struct nas_msg_rb_list_reply {
-  nasRadioBearerId_t rab_id;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  uint8_t state;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_list_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-};
-//****
-struct nas_msg_rb_establishment_reply {
-  int status;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_establishment_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  nasQoSTrafficClass_t qos;
-  uint16_t dscp_ul;
-  uint16_t dscp_dl;
-  uint16_t mcast_flag;
-  uint8_t mcast_group[16];
-  uint32_t cnxid;
-};
-
-//****
-struct nas_msg_rb_release_reply {
-  int status;
-  uint32_t cnxid;
-};
-struct nas_msg_rb_release_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint16_t mcast_flag;
-  uint32_t cnxid;
-};
-
-//****
-struct nas_msg_class_add_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  nasRadioBearerId_t rab_id;
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint8_t fct;
-  uint16_t classref;
-  uint8_t version;
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr; // IP source address
-  uint8_t splen; // prefix length
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr; // IP destination address
-  uint8_t dplen; // prefix length
-  uint8_t protocol;  // high layer protocol type
-  uint16_t sport;  // source port
-  uint16_t dport;  // destination port
-};
-struct nas_msg_class_add_reply {
-  int status;
-};
-//****
-struct nas_msg_class_del_request {
-  nasLocalConnectionRef_t lcr; // Local Connection reference
-  uint8_t dir; // direction (send or receive)
-  uint8_t dscp; // codepoint
-  uint16_t classref;
-};
-struct nas_msg_class_del_reply {
-  int status;
-};
-//****
-#define nas_msg_class_list_reply nas_msg_class_add_request
-struct nas_msg_class_list_request {
-  nasLocalConnectionRef_t lcr;  // Local Connection reference
-  uint8_t dir;
-  uint8_t dscp;
-};
-
-//****
-struct nas_msg_neighbour_cell_list_reply {
-  nasCellID_t cellid;  // cell identification
-  uint32_t iid6[4];    // IPv6  address of access router
-};
-
-//MBMS
-//****
-struct nas_msg_mt_mcast_join {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_mt_mcast_leave {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;
-};
-
-struct nas_msg_mt_mcast_reply {
-  nasLocalConnectionRef_t  ue_id;
-  uint32_t   cnxid;
-  int  result;
-};
-//****
-
-//MEDIEVAL DEMO 3
-//****
-struct nas_msg_enb_measure_trigger {
-  nasCellID_t cell_id;
-};
-struct nas_msg_enb_measure_trigger_reply {
-  int status;
-};
-
-struct nas_msg_enb_measure_retrieve {
-  nasCellID_t cell_id;
-  nasNumConnUEs_t num_UEs;
-  nasENbMeasures_t measures[MAX_MEASURE_UE];
-  nasENbMeasure_t totalNumPRBs;
-};
-
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c
deleted file mode 100644
index d0a3516567..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_netlink.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_netlink.c
-* \brief Netlink socket functions for OpenAirInterface CELLULAR version - MT
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-//#include <linux/config.h>
-#include <linux/socket.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netlink.h>
-#include <net/sock.h>
-#include <linux/kthread.h>
-
-#include <linux/mutex.h>
-
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-static struct sock *nas_nl_sk = NULL;
-static struct sock *nas_rrcnl_sk = NULL;
-
-//static int exit_netlink_thread=0;
-static DEFINE_MUTEX(nasrg_mutex);
-
-// This can also be implemented using thread to get the data from PDCP without blocking.
-//---------------------------------------------------------------------------
-// Function for transfer with PDCP (from NASLITE)
-static void nasrg_nl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasrg_nl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_nl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-#ifdef NETLINK_DEBUG
-  printk("nasrg_nl_data_ready - Received socket from PDCP\n");
-#endif //NETLINK_DEBUG
-  nlh = (struct nlmsghdr *)skb->data;
-  nasrg_COMMON_QOS_receive(nlh);
-}
-
-//---------------------------------------------------------------------------
-//  Function for transfer with RRC
-static void nasrg_rrcnl_data_ready (struct sk_buff *skb)
-{
-  //---------------------------------------------------------------------------
-  struct nlmsghdr *nlh = NULL;
-  char target_sap;
-  uint8_t cxi;
-
-  // Start debug information
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasrg_rrcnl_data_ready - begin \n");
-#endif
-
-  if (!skb) {
-    printk("nasrg_rrcnl_data_ready - input parameter skb is NULL \n");
-    return;
-  }
-
-  // End debug information
-
-  nlh = (struct nlmsghdr *)skb->data;
-  //pdcph = (struct pdcp_data_ind_header_t *)NLMSG_DATA(nlh);
-  //nasrg_TOOL_print_buffer((char *)NLMSG_DATA(nlh), 48);
-
-  target_sap = ((char*)NLMSG_DATA(nlh))[0];
-#ifdef NAS_DEBUG_RRCNL
-  printk("nasrg_rrcnl_data_ready - Received on socket from RRC, SAP %d\n", target_sap);
-#endif //NAS_DEBUG_RRCNL
-
-  switch (target_sap) {
-  case RRC_NAS_DC0_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 0;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC1_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 1;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  case RRC_NAS_DC2_OUT:
-    //printk("nasrg_rrcnl_data_ready - Calling  nasrg_ASCTL_DC_receive\n");
-    cxi = 2;
-    nasrg_ASCTL_DC_receive(gpriv->cx+cxi, &((char*)NLMSG_DATA(nlh))[1]);
-    break;
-
-  default:
-    printk("nasrg_rrcnl_data_ready - Invalid SAP value received\n");
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasrg_netlink_init(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_netlink_init - begin \n");
-
-  nas_nl_sk = netlink_kernel_create(&init_net,OAI_IP_DRIVER_NETLINK_ID, 0, nasrg_nl_data_ready,
-                                    &nasrg_mutex, // NULL
-                                    THIS_MODULE);
-
-  if (!nas_nl_sk) {
-    printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket\n");
-    // TEMP printk("nasrg_netlink_init - netlink_kernel_create failed for PDCP socket %d\n", errno);
-    return(-1);
-  }
-
-  nas_rrcnl_sk = netlink_kernel_create(&init_net,NAS_RRCNL_ID, 0, nasrg_rrcnl_data_ready,
-                                       &nasrg_mutex, // NULL
-                                       THIS_MODULE);
-
-  if (!nas_rrcnl_sk) {
-    printk("nasrg_rrcnl_init - netlink_kernel_create failed for RRC socket\n");
-    return(-1);
-  }
-
-  return(0);
-}
-
-//---------------------------------------------------------------------------
-void nasrg_netlink_release(void)
-{
-  //---------------------------------------------------------------------------
-  printk("nasrg_netlink_release - begin \n");
-
-  //exit_netlink_thread=1;
-  printk("nasrg_netlink_release - Releasing netlink sockets\n");
-
-  if(nas_nl_sk) {
-    netlink_kernel_release(nas_nl_sk);
-  }
-
-  if(nas_rrcnl_sk) {
-    netlink_kernel_release(nas_rrcnl_sk);
-  }
-
-}
-
-//---------------------------------------------------------------------------
-int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination)
-{
-  //---------------------------------------------------------------------------
-  struct sk_buff *nl_skb;
-  struct nlmsghdr *nlh;
-  int status;
-  // Start debug information
-#ifdef NETLINK_DEBUG
-  printk("nasrg_netlink_send - begin \n");
-#endif
-
-  if (!data_buffer) {
-    printk("nasrg_netlink_send - ERROR - input parameter data is NULL \n");
-    return(0);
-  }
-
-  if (!nas_nl_sk || !nas_rrcnl_sk) {
-    printk("nasrg_netlink_send - ERROR - socket is NULL\n");
-    return(0);
-  }
-
-  // End debug information
-
-  nl_skb = alloc_skb(NLMSG_SPACE(data_length),GFP_ATOMIC);
-
-  if (!nl_skb) {
-    printk("nasrg_netlink_send - ERROR - could not allocate skbuffer\n");
-    return(0);
-  }
-
-  nlh = (struct nlmsghdr *)nl_skb->data;
-
-  //  printk("nasrg_netlink_send Sending %d bytes (%d)\n",data_length,NLMSG_SPACE(data_length));
-  skb_put(nl_skb, NLMSG_SPACE(data_length));
-  memcpy(NLMSG_DATA(nlh), data_buffer, data_length);
-  nlh->nlmsg_len = NLMSG_SPACE(data_length);
-
-  nlh->nlmsg_pid = 0;      /* from kernel */
-  NETLINK_CB(nl_skb).pid = 0;
-
-  // destination 0 = PDCP, 1 = RRC
-  if (destination== NASNL_DEST_PDCP) {
-#ifdef NETLINK_DEBUG
-    printk("nasrg_netlink_send - Sending to PDCP - nl_skb %p, nl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_nl_sk, nlh, nlh->nlmsg_len);
-#ifdef NAS_DEBUG_SEND_DETAIL
-    nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),48);
-#endif
-#endif //DEBUG_NETLINK
-    status = netlink_unicast(nas_nl_sk, nl_skb, NL_DEST_PID, MSG_DONTWAIT);
-  } else {
-#ifdef NAS_DEBUG_RRCNL
-    printk("nasrg_netlink_send - Sending to RRC - nl_skb %p, nas_rrcnl_sk %p, nlh %p, nlh->nlmsg_len %d\n", nl_skb, nas_rrcnl_sk, nlh, nlh->nlmsg_len);
-    nasrg_TOOL_print_buffer(NLMSG_DATA(nlh),data_length);
-#endif //NAS_DEBUG_RRCNL
-    status = netlink_unicast(nas_rrcnl_sk, nl_skb, NL_DEST_RRC_PID, MSG_DONTWAIT);
-  }
-
-  if (status < 0) {
-    printk("nasrg_netlink_send - SEND status is %d\n",status);
-    return(0);
-  } else {
-#ifdef NETLINK_DEBUG
-    printk("nasrg_netlink_send - SEND status is %d, data_length %d\n",status, data_length);
-#endif
-    return data_length;
-  }
-}
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h
deleted file mode 100644
index 9053c88a56..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_proto.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_proto.h
-* \brief Function prototypes for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_PROTO_H
-#define _NASRGD_PROTO_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-// #include "rrc_nas_primitives.h"
-// #include "protocol_vars_extern.h"
-// #include "as_sap.h"
-// #include "rrc_qos.h"
-// #include "rrc_sap.h"
-
-// nasrg_netlink.c
-void nasrg_netlink_release(void);
-int nasrg_netlink_init(void);
-int nasrg_netlink_send(unsigned char *data_buffer, unsigned int data_length, int destination);
-
-// nasrg_common.c
-//void nasrg_COMMON_receive(uint16_t hlen, uint16_t dlength, int sap);
-void nasrg_COMMON_receive(uint16_t bytes_read, uint16_t payload_length, void *data_buffer, int rb_id, int sap);
-
-void nasrg_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-void nasrg_COMMON_QOS_send_test_netlink(struct sk_buff *skb);
-void nasrg_COMMON_del_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-#ifndef PDCP_USE_NETLINK
-void nasrg_COMMON_QOS_receive(struct cx_entity *cx);
-#else
-void nasrg_COMMON_QOS_receive(struct nlmsghdr *nlh);
-#endif
-struct rb_entity *nasrg_COMMON_add_rb(struct cx_entity *cx, nasRadioBearerId_t rabi, nasQoSTrafficClass_t qos);
-struct rb_entity *nasrg_COMMON_search_rb(struct cx_entity *cx, nasRadioBearerId_t rabi);
-struct cx_entity *nasrg_COMMON_search_cx(nasLocalConnectionRef_t lcr);
-void nasrg_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp);
-void nasrg_COMMON_flush_rb(struct cx_entity *cx);
-
-//nasrg_ascontrol.c
-void nasrg_ASCTL_init(void);
-void nasrg_ASCTL_timer(unsigned long data);
-void nasrg_ASCTL_DC_send_sig_data_request(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-//int nasrg_ASCTL_DC_receive(struct cx_entity *cx);
-int nasrg_ASCTL_DC_receive(struct cx_entity *cx, char *buffer);
-//
-int nasrg_ASCTL_DC_send_cx_establish_confirm(struct cx_entity *cx, uint8_t response);
-int nasrg_ASCTL_DC_send_rb_establish_request(struct cx_entity *cx, struct rb_entity *rb);
-int nasrg_ASCTL_DC_send_rb_release_request(struct cx_entity *cx, struct rb_entity *rb);
-int nasrg_ASCTL_GC_send_mbms_bearer_establish_req(int mbms_ix );
-int nasrg_ASCTL_GC_send_mbms_bearer_release_req(int mbms_ix);
-int nasrg_ASCTL_DC_send_mbms_ue_notify_req(struct cx_entity *cx);
-int nasrg_ASCTL_DC_send_eNBmeasurement_req(struct cx_entity *cx);
-
-void nasrg_ASCTL_start_default_mbms_service(void);
-
-// nasrg_iocontrol.c
-void nasrg_CTL_send(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-int nasrg_CTL_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-
-// nasrg_classifier.c
-void nasrg_CLASS_send(struct sk_buff *skb);
-struct classifier_entity *nasrg_CLASS_add_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasrg_CLASS_add_rclassifier(uint8_t dscp, uint16_t classref);
-struct classifier_entity *nasrg_CLASS_add_mbmsclassifier(int mbms_ix, uint16_t classref);
-void nasrg_CLASS_del_sclassifier(struct cx_entity *cx, uint8_t dscp, uint16_t classref);
-void nasrg_CLASS_del_rclassifier(uint8_t dscp, uint16_t classref);
-void nasrg_CLASS_del_mbmsclassifier(int mbms_ix, uint16_t classref);
-void nasrg_CLASS_flush_sclassifier(struct cx_entity *cx);
-void nasrg_CLASS_flush_rclassifier(void);
-void nasrg_CLASS_flush_mbmsclassifier(void);
-
-// nasrg_tool.c
-uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc);
-void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct);
-void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid);
-void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid);
-uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph);
-uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph);
-uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol);
-uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol);
-char *nasrg_TOOL_get_udpmsg(struct udphdr *udph);
-uint16_t nasrg_TOOL_udpcksum(struct in6_addr *saddr, struct in6_addr *daddr, uint8_t proto, uint32_t udplen, void *data);
-int nasrg_TOOL_network6(struct in6_addr *addr, struct in6_addr *prefix, uint8_t plen);
-int nasrg_TOOL_network4(uint32_t *addr, uint32_t *prefix, uint8_t plen);
-
-void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph);
-
-void nasrg_TOOL_pk_all(struct sk_buff *skb);
-void nasrg_TOOL_pk_ipv6(struct ipv6hdr *iph);
-void nasrg_TOOL_print_state(uint8_t state);
-void nasrg_TOOL_print_buffer(unsigned char * buffer,int length);
-void nasrg_TOOL_print_rb_entity(struct rb_entity *rb);
-void nasrg_TOOL_print_classifier(struct classifier_entity *gc);
-
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h
deleted file mode 100644
index e2835adf7d..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_sap.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasmt_sap.h
-* \brief SAP constants for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_SAP_H
-#define _NASRGD_SAP_H
-
-
-// RT-FIFO identifiers ** must be identical to Access Stratum as_sap.h and rrc_sap.h
-
-#define RRC_DEVICE_GC                    RRC_SAPI_RG_GCSAP
-#define RRC_DEVICE_NT                    RRC_SAPI_RG_NTSAP
-#define RRC_DEVICE_DC_INPUT0             RRC_SAPI_RG_DCSAP0_IN
-#define RRC_DEVICE_DC_INPUT1             RRC_SAPI_RG_DCSAP1_IN
-#define RRC_DEVICE_DC_OUTPUT0            RRC_SAPI_RG_DCSAP0_OUT
-#define RRC_DEVICE_DC_OUTPUT1            RRC_SAPI_RG_DCSAP1_OUT
-//
-//#define QOS_DEVICE_CONVERSATIONAL_INPUT  QOS_SAPI_CONVERSATIONAL_INPUT_RG
-//#define QOS_DEVICE_CONVERSATIONAL_OUTPUT QOS_SAPI_CONVERSATIONAL_OUTPUT_RG
-
-#define PDCP2PDCP_USE_RT_FIFO 21
-#define NAS2PDCP_FIFO 22
-
-//FIFO indexes in control blocks
-#define NAS_DC_INPUT_SAPI  0
-#define NAS_DC_OUTPUT_SAPI 1
-#define NAS_SAPI_CX_MAX    2
-
-#define NAS_GC_SAPI         0
-#define NAS_NT_SAPI         1
-#define NAS_DRB_INPUT_SAPI  2  //NAS_CO_INPUT_SAPI
-#define NAS_DRB_OUTPUT_SAPI 3  //NAS_CO_OUTPUT_SAPI
-#define NAS_SAPI_MAX        4
-
-//#define NAS_QOS_CONVERSATIONAL UMTS_TRAFFIC_CONVERSATIONAL
-//
-
-/* Defined in RRC
-#define RRC_NAS_GC_IN   0
-#define RRC_NAS_GC_OUT  1
-#define RRC_NAS_NT_IN   2
-#define RRC_NAS_NT_OUT  3
-#define RRC_NAS_DC0_IN  4
-#define RRC_NAS_DC0_OUT 5
-#define RRC_NAS_DC1_IN  6
-#define RRC_NAS_DC1_OUT 7
-#define RRC_NAS_DC2_IN  8
-#define RRC_NAS_DC2_OUT 9
-*/
-#endif
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c
deleted file mode 100644
index 54324cf63f..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_tool.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include "nasrg_variables.h"
-#include "nasrg_proto.h"
-
-//---------------------------------------------------------------------------
-//
-void nasrg_TOOL_fct(struct classifier_entity *gc, uint8_t fct)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_fct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasrg_TOOL_fct - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  switch(fct) {
-  case NAS_FCT_QOS_SEND:
-    gc->fct=nasrg_COMMON_QOS_send;
-    break;
-
-  case NAS_FCT_CTL_SEND:
-    gc->fct=nasrg_CTL_send;
-    break;
-
-  case NAS_FCT_DC_SEND:
-    gc->fct=nasrg_ASCTL_DC_send_sig_data_request;
-    break;
-
-  case NAS_FCT_DEL_SEND:
-    gc->fct=nasrg_COMMON_del_send;
-    break;
-
-  default:
-    gc->fct=nasrg_COMMON_del_send;
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_invfct(struct classifier_entity *gc)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_invfct - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("nasrg_TOOL_invfct - input parameter gc is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  if (gc->fct==nasrg_COMMON_QOS_send)
-    return NAS_FCT_QOS_SEND;
-
-  if (gc->fct==nasrg_CTL_send)
-    return NAS_FCT_CTL_SEND;
-
-  if (gc->fct==nasrg_COMMON_del_send)
-    return NAS_FCT_DEL_SEND;
-
-  if (gc->fct==nasrg_ASCTL_DC_send_sig_data_request)
-    return NAS_FCT_DC_SEND;
-
-  return 0;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_get_dscp6(struct ipv6hdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_dscp6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_dscp6 - input parameter iph is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  // return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>22; //Yan
-  return (ntohl(((*(__u32 *)iph)&NAS_TRAFFICCLASS_MASK)))>>20;
-}
-
-//---------------------------------------------------------------------------
-uint8_t nasrg_TOOL_get_dscp4(struct iphdr *iph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_dscp4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_dscp4 - input parameter iph is NULL \n");
-    return 0;
-  }
-
-  // End debug information
-  return ((iph->tos)>>5)<<3;
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasrg_TOOL_get_protocol6(struct ipv6hdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  uint16_t size;
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_protocol6 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_protocol6 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasrg_TOOL_get_protocol6 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-
-  *protocol=iph->nexthdr;
-  size=NAS_IPV6_SIZE;
-
-  while (1) {
-    switch(*protocol) {
-    case IPPROTO_UDP:
-    case IPPROTO_TCP:
-    case IPPROTO_ICMPV6:
-      return (uint8_t *)((uint8_t *)iph+size);
-
-    case IPPROTO_HOPOPTS:
-    case IPPROTO_ROUTING:
-    case IPPROTO_DSTOPTS:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]*8+8;
-      break;
-
-    case IPPROTO_FRAGMENT:
-      *protocol=((uint8_t *)iph+size)[0];
-      size+=((uint8_t *)iph+size)[1]+8;
-      break;
-
-    case IPPROTO_NONE:
-    case IPPROTO_AH:
-    case IPPROTO_ESP:
-    default:
-      return NULL;
-    }
-  }
-}
-
-//---------------------------------------------------------------------------
-uint8_t *nasrg_TOOL_get_protocol4(struct iphdr *iph, uint8_t *protocol)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_get_protocol4 - begin \n");
-#endif
-
-  if (iph==NULL) {
-    printk("nasrg_TOOL_get_protocol4 - input parameter iph is NULL \n");
-    return NULL;
-  }
-
-  if (protocol==NULL) {
-    printk("nasrg_TOOL_get_protocol4 - input parameter protocol is NULL \n");
-    return NULL;
-  }
-
-  // End debug information
-  *protocol=iph->protocol;
-
-  switch(*protocol) {
-  case IPPROTO_UDP:
-  case IPPROTO_TCP:
-  case IPPROTO_ICMP:
-    return (uint8_t *)((uint8_t *)iph+iph->tot_len);
-
-  default:
-    return NULL;
-  }
-}
-
-//---------------------------------------------------------------------------
-// Convert the IMEI to iid
-void nasrg_TOOL_imei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_imei2iid - begin \n");
-#endif
-
-  if (imei==NULL) {
-    printk("nasrg_TOOL_imei2iid - input parameter imei is NULL \n");
-    return;
-  }
-
-  if (iid==NULL) {
-    printk("nasrg_TOOL_imei2iid - input parameter iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x03;
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-  iid[0] = 0x02;
-#endif
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-#ifdef NAS_DRIVER_TYPE_ETHERNET
-  iid[3] = 0xff;
-  iid[4] = 0xfe;
-#endif
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-// Convert the RG IMEI to iid
-void nasrg_TOOL_RGimei2iid(uint8_t *imei, uint8_t *iid)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_RGimei2iid - begin \n");
-#endif
-
-  if (!imei || !iid) {
-    printk("nasrg_TOOL_RGimei2iid - input parameter imei or iid is NULL \n");
-    return;
-  }
-
-  // End debug information
-  memset(iid, 0, NAS_ADDR_LEN);
-  iid[0] = 0x00;   // to be compatible between link local and global
-  iid[1] = 16*imei[0]+imei[1];
-  iid[2] = 16*imei[2]+imei[3];
-  iid[3] = 16*imei[4]+imei[5];
-  iid[4] = 16*imei[6]+imei[7];
-  iid[5] = 16*imei[8]+imei[9];
-  iid[6] = 16*imei[10]+imei[11];
-  iid[7] = 16*imei[12]+imei[13];
-}
-
-//---------------------------------------------------------------------------
-void nasrg_TOOL_pk_icmp6(struct icmp6hdr *icmph)
-{
-  //---------------------------------------------------------------------------
-  // Start debug information
-#ifdef GRAAL_DEBUG_TOOL
-  printk("nasrg_TOOL_pk_icmp6 - begin \n");
-#endif
-
-  if (!icmph) {
-    printk("nasrg_TOOL_pk_icmp6 - input parameter icmph is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("ICMPv6:\t type= %d, code = %d\n", icmph->icmp6_type, icmph->icmp6_code);
-
-  switch(icmph->icmp6_type) {
-  case ICMPV6_DEST_UNREACH:
-    printk("Destination unreachable\n");
-    break;
-
-  case ICMPV6_PKT_TOOBIG:
-    printk("Packet too big\n");
-    break;
-
-  case ICMPV6_TIME_EXCEED:
-    printk("Time exceeded\n");
-    break;
-
-  case ICMPV6_PARAMPROB:
-    printk("Parameter problem\n");
-    break;
-
-  case ICMPV6_ECHO_REQUEST:
-    printk("Echo request\n");
-    break;
-
-  case ICMPV6_ECHO_REPLY:
-    printk("Echo reply\n");
-    break;
-
-  case ICMPV6_MGM_QUERY:
-    printk("Multicast listener query\n");
-    break;
-
-  case ICMPV6_MGM_REPORT:
-    printk("Multicast listener report\n");
-    break;
-
-  case ICMPV6_MGM_REDUCTION:
-    printk("Multicast listener done\n");
-    break;
-
-  case NDISC_ROUTER_SOLICITATION:
-    printk("Router solicitation\n");
-    break;
-
-  case NDISC_ROUTER_ADVERTISEMENT:
-    printk("Router advertisment\n");
-    break;
-
-  case NDISC_NEIGHBOUR_SOLICITATION:
-    printk("Neighbour solicitation\n");
-    break;
-
-  case NDISC_NEIGHBOUR_ADVERTISEMENT:
-    printk("Neighbour advertisment\n");
-    break;
-
-  case NDISC_REDIRECT:
-    printk("redirect message\n");
-    break;
-  }
-}
-
-
-//---------------------------------------------------------------------------
-void nasrg_TOOL_print_state(uint8_t state)
-{
-  //---------------------------------------------------------------------------
-  switch(state) {
-  case  NAS_IDLE:
-    printk("NAS_IDLE\n");
-    return;
-
-  case  NAS_CX_FACH:
-    printk("NAS_CX_FACH\n");
-    return;
-
-  case  NAS_CX_DCH:
-    printk("NAS_CX_DCH\n");
-    return;
-
-  case  NAS_CX_RECEIVED:
-    printk("NAS_CX_RECEIVED\n");
-    return;
-
-  case  NAS_CX_CONNECTING:
-    printk("NAS_CX_CONNECTING\n");
-    return;
-
-  case  NAS_CX_RELEASING:
-    printk("NAS_CX_RELEASING\n");
-    return;
-
-  case  NAS_CX_CONNECTING_FAILURE:
-    printk("NAS_CX_CONNECTING_FAILURE\n");
-    return;
-
-  case  NAS_CX_RELEASING_FAILURE:
-    printk("NAS_CX_RELEASING_FAILURE\n");
-    return;
-
-  case  NAS_RB_ESTABLISHING:
-    printk("NAS_RB_ESTABLISHING\n");
-    return;
-
-  case  NAS_RB_RELEASING:
-    printk("NAS_RB_RELEASING\n");
-    return;
-
-  case  NAS_RB_ESTABLISHED:
-    printk("NAS_RB_ESTABLISHED\n");
-    return;
-
-  default:
-    printk(" Unknown state\n");
-  }
-}
-
-//-----------------------------------------------------------------------------
-// Print the content of a buffer in hexadecimal
-void nasrg_TOOL_print_buffer(unsigned char * buffer,int length)
-{
-  //-----------------------------------------------------------------------------
-  int i;
-
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_buffer - begin \n");
-#endif
-
-  if (buffer==NULL) {
-    printk("\n nasrg_TOOL_print_buffer - input parameter buffer is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("Buffer content: ");
-
-  for (i=0; i<length; i++)
-    printk("-%hx-",buffer[i]);
-
-  printk(",\t length %d\n", length);
-}
-
-//-----------------------------------------------------------------------------
-void nasrg_TOOL_print_rb_entity(struct rb_entity *rb)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_rb_entity - begin \n");
-#endif
-
-  if (rb==NULL) {
-    printk("\n nasrg_TOOL_print_rb_entity - input parameter rb is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nrb_entity content: rab_id %d, sapi %d, qos %d, dscp %d, \n", rb->rab_id, rb->sapi, rb->qos, rb->dscp);
-  printk("state %d, retry %d, countimer %d\n",rb->state, rb->retry, rb->countimer);
-};
-
-//-----------------------------------------------------------------------------
-void nasrg_TOOL_print_classifier(struct classifier_entity *gc)
-{
-  //-----------------------------------------------------------------------------
-  // Start debug information
-#ifdef NAS_DEBUG_TOOL
-  printk("nasrg_TOOL_print_classifier - begin \n");
-#endif
-
-  if (gc==NULL) {
-    printk("\n nasrg_TOOL_print_classifier - input parameter gc is NULL \n");
-    return;
-  }
-
-  // End debug information
-  printk("\nClassifier content: classref %d, version %d, splen %d, dplen %d,\n", gc->classref, gc->version, gc->splen, gc->dplen);
-  printk("protocol %d, sport %d, dport %d, rab_id %d\n", gc->protocol, gc->sport, gc->dport, gc->rab_id);
-  nasrg_TOOL_print_rb_entity(gc->rb);
-};
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h b/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h
deleted file mode 100644
index 7c2b69459c..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NASRG/nasrg_variables.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file nasrg_variables.h
-* \brief Variable and structure definitions for OpenAirInterface CELLULAR version - RG
-* \author  michelle.wetterwald, navid.nikaein, raymond.knopp, Lionel Gauthier
-* \company Eurecom
-* \email: michelle.wetterwald@eurecom.fr, raymond.knopp@eurecom.fr, navid.nikaein@eurecom.fr,  lionel.gauthier@eurecom.fr
-*/
-/*******************************************************************************/
-#ifndef _NASRGD_VAR_H
-#define _NASRGD_VAR_H
-
-#include <linux/if_arp.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <linux/ipv6.h>
-#include <linux/ip.h>
-#include <linux/sysctl.h>
-#include <linux/timer.h>
-#include <linux/unistd.h>
-//#include <asm/unistd.h>
-#include <asm/param.h>
-//#include <sys/sysctl.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
-#include <linux/icmp.h>
-#include <linux/icmpv6.h>
-#include <linux/in.h>
-#include <net/ndisc.h>
-
-#include "rrc_nas_primitives.h"
-#include "rrc_qos_classes.h"
-#include "rrc_nas_sap.h"
-
-#include "nasrg_constant.h"
-#include "nasrg_sap.h"
-
-struct cx_entity;
-
-struct rb_entity {
-  //  uint16_t default_rab;
-  uint32_t   cnxid;
-  nasRadioBearerId_t rab_id;  //ue_rbId
-  nasRadioBearerId_t rg_rbId;
-  nasRadioBearerId_t mbms_rbId;
-  nasSapId_t sapi;
-  nasQoSTrafficClass_t qos;
-  nasQoSTrafficClass_t RadioQosClass;
-  nasIPdscp_t dscp;  //this is DL dscp
-  nasIPdscp_t dscp_ul;
-  uint8_t state;
-  uint8_t result;
-  uint8_t retry;
-  uint32_t countimer;
-  //for MBMS
-  uint16_t serviceId;
-  uint16_t sessionId;
-  uint16_t duration;
-  uint8_t  mcast_address[16];
-  //
-  struct rb_entity *next;
-};
-
-struct classifier_entity {
-  uint32_t classref;               // classifier identity
-  uint8_t version;                 // IP version 4 or 6
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } saddr;                    // IP source address
-  uint8_t splen;                   // IP prefix size
-  union {
-    struct in6_addr ipv6;
-    uint32_t ipv4;
-  } daddr;                    // IP destination address
-  uint8_t dplen;                   // IP prefix size
-  uint8_t protocol;                 // layer 4 protocol type (tcp, udp, ...)
-  uint16_t sport;                   // source port
-  uint16_t dport;                   // destination port
-  struct rb_entity *rb;
-  nasRadioBearerId_t rab_id;  // RAB identification
-  void (*fct)(struct sk_buff *skb, struct cx_entity *cx, struct classifier_entity *gc);
-  struct classifier_entity *next;
-};
-
-
-struct cx_entity {
-  int sap[NAS_SAPI_CX_MAX];
-  uint8_t state;                     // state of the connection
-  nasLocalConnectionRef_t lcr;  // Local connection reference
-  nasCellID_t cellid;            // cell identification
-  uint32_t countimer;                // timeout's counter
-  uint8_t retry;                      // number of retransmissions
-  struct classifier_entity *sclassifier[NAS_DSCP_MAX]; // send classifiers table
-  uint16_t nsclassifier;
-  uint32_t iid6[2];                   // IPv6  interface identification
-  uint8_t iid4;                       // IPv4 interface identification
-  struct rb_entity *rb;         // RB entities for RABs
-  uint16_t num_rb;
-  // MW - 17/5/05
-  int  ue_id;
-  int rrc_state;
-  // MBMS
-  int requested_joined_services[NASRG_MBMS_SVCES_MAX];
-  int requested_left_services[NASRG_MBMS_SVCES_MAX];
-  int joined_services[NASRG_MBMS_SVCES_MAX];
-};
-
-//struct mbms_rb_entity{
-//  uint32_t   cnxid;
-//  nasRadioBearerId_t mbms_rbId;
-//  nasSapId_t sapi;
-//  nasQoSTrafficClass_t qos;
-//  nasQoSTrafficClass_t RadioQosClass;
-//  uint8_t state;
-//  uint8_t result;
-//  uint8_t retry;
-//  uint32_t countimer;
-//
-//  uint16_t serviceId;
-//  uint16_t sessionId;
-//  uint16_t duration;
-//};
-//
-
-struct nas_priv {
-  int irq;
-  int rx_flags;
-  struct timer_list timer;
-  spinlock_t lock;
-  struct net_device_stats stats;
-  uint8_t retry_limit;
-  uint32_t timer_establishment;
-  uint32_t timer_release;
-  struct cx_entity cx[NAS_CX_MAX];
-  struct classifier_entity *rclassifier[NAS_DSCP_MAX]; // receive classifier
-  int nrclassifier;
-  uint32_t next_sclassref;
-  int sap[NAS_SAPI_MAX];
-  uint8_t xbuffer[NAS_MAX_LENGTH]; // transmission buffer
-  uint8_t rbuffer[NAS_MAX_LENGTH]; // reception buffer
-  // MW - 17/5/05
-  int broadcast_counter;
-  int SIB18_counter;
-  // MBMS
-  struct rb_entity mbms_rb[NASRG_MBMS_SVCES_MAX];
-  struct classifier_entity *mbmsclassifier[NASRG_MBMS_SVCES_MAX]; // mbms classifier
-  int nmbmsclassifier;
-  uint32_t next_mbmsclassref;
-  //Added for demo 3 - MW
-  nasCellID_t measured_cell_id;
-  uint16_t num_UEs;
-  uint32_t rlcBufferOccupancy[NAS_CX_MAX];
-  uint32_t scheduledPRB[NAS_CX_MAX];
-  uint32_t totalDataVolume[NAS_CX_MAX];
-  uint32_t totalNumPRBs;
-};
-
-struct ipversion {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-  uint8_t    reserved:4,
-             version:4;
-#else
-  uint8_t    version:4,
-             reserved:4;
-#endif
-};
-
-typedef struct pdcp_data_req_header_t {
-  unsigned int             rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  unsigned int            rb_id;
-  unsigned int           data_size;
-  int            inst;
-} pdcp_data_ind_header_t;
-//
-extern struct nas_priv *gpriv;
-extern struct net_device *gdev;
-//extern int bytes_wrote;
-//extern int bytes_read;
-
-extern uint8_t NAS_RG_IMEI[14];
-extern uint8_t NAS_NULL_IMEI[14];
-
-//global variables shared with RRC
-extern int *pt_nas_rg_irq;
-//extern uint16_t *pt_rg_own_cell_id;
-extern uint16_t local_rg_cell_id;
-#endif
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile
deleted file mode 100755
index eec82de367..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# Lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-# You can modify the below as well, but probably
-# won't need to.
-
-#CC = egcs
-
-#UPDIR	:= $(shell /bin/pwd)
-#GRAAL_DIR  =$(UPDIR)/..
-#RRC_DIR =$(UPDIR)/../../../AS/L3/RRC
-
-CELL_UPDIR := $(shell /bin/pwd)
-NAS_DIR := $(OPENAIR2_DIR)/NAS/DRIVER/CELLULAR/NASMT
-RRC_DIR := $(OPENAIR2_DIR)/RRC/CELLULAR
-EXTRA_CFLAGS += -I$(RRC_DIR) -DNODE_MT
-
-CFLAGS = -Wall -g -I$(NAS_DIR) -I$(RRC_DIR)
-
-COMPILE = $(CC) $(CFLAGS) -c
-
-OBJS = netltest.o
-
-EXECUTABLE = netltest
-
-# "all" is the default target. Simply make it point to myprogram.
-
-all: $(EXECUTABLE)
-
-# Define the components of the program, and how to link them together.
-# These components are defined as dependencies; that is, they must be
-# made up-to-date before the code is linked.
-
-$(EXECUTABLE): $(OBJS)
-	$(CC) $(CFLAGS) -o $(EXECUTABLE) $(OBJS)
-
-# Add any special rules here.
-
-# Specify that all .o files depend on .c files, and indicate how
-# the .c files are converted (compiled) to the .o files.
-
-%.o: %.c
-	$(COMPILE) -o $@ $<
-
-clean:
-	-rm $(OBJS) $(EXECUTABLE)
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest
deleted file mode 100755
index f44ea64b09862efd61f5e17082141e4be4e9a500..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 12462
zcmeHNe{@vUoxgA94ZKMvVIZOWFyKH!ffgqGh!lSlk_eFqm_$XXJ|{CTnUTp%cIFLW
z>p6u6*2chs*0bxjZh^)1cuuwA*4=W%dSJ1Qc6(ZCZR_c2ySmjqp|V}KrIsq1{e13y
zcQP6DobK6w_a^t<@8^Dh-Cys{z4zTOv~}EI7>3ZnC;Wow*k03WLfSn~ahgO#SYna*
zq^K8@kVRh8F32EC1t<lOXCnH^18&+4K4J|pBYDV{5s47gMSQhN2uA9Qu;PcN2oXAD
zT8yiq^b#WdlJ7$j0Y3sB;~8K^^67(dJ>=KJH)AU>qvqZGmYV>)BxwCk@Js!lha@BQ
zS^ma!s;4oXSei~{3Ol3uY;=X<p=gr7ZsRSWR5@uAMU}d>NZB^zFWSB5SFite%j+#K
z{_ueVxhwacs=w{m<V{7aK%`D3q7L-Sz`C;>^hJ5vw-DKOLBz?3Aw)E%s77R<jxL*Q
z<A{hbpLtJh`1MKBr9t~*UIcMH2`@}Tx=RD3#8;Hzt!22U3@<Lj&1HB~8BUks?lOE$
z8Qxijb7gp08J-Q?vCp*Fu2b16w%ymC&DeQ2mUC@epu6Mj=2gOO--O&mDq|P&PD13f
z@okPPoSi9G3^=)5HYWxOZe9%JQW>{b^gI1|uzOOOgy@f@)7iKv<kOBbAo8icSlmrz
zGa{bO<{i-+&$wxkbK=|k^L=nnkDmMfSSlmdb+oT-u~$S@$$jY2kNaca8Te!0GBSiy
zDGUdnct}C<4&Iqb6g+HNlaZQCF-R<?7*rvqXpAsZ447J`7-%z@Vt~~##h{BY#h`0o
zib1=GDF*ElrWl0Fn8I@tQw+w{Ofj%;8G5U0@SHiy;%wc0+PzGO;V)kt8ynmEiW?Z6
zi`>zFK(R*ehOaGKUp_r{#RZgjY{5l5sWY~KB~Ow(`#RLd7O)0M^3I--m^DeV`e#o{
z%o-(U5+9S8HA_Z_4@=A%CKnMOl$bS5va!$Zl9)A4t|lIkm^DwXA--E;wm@<{@n(tH
z63NZPYb0iiB)1SRlb9`&yqh>8F<U6f3Y`s0%$7<H5DQ?W#jyN8?;3hz@XdENcXuWa
z4nyiN9yi~beDp6(Yt#?n^9LscudR1o+X|DSaQ%_>NKec}OYVNV7SB`f`v%`Ou6!*&
zcmF@r$>2%jC`HC<_mVBeuY4^x`rQBx7=tgGTkkx*-~FW6|NKJA!~Wp8nMdj%yZ59!
z?Kty51V_vU=8c_s`Sd|0gPhHH$wq(s;n>)bB#aH24Wp+B&UoNi07$U~MlXP--ka}q
z?LPNBjE?MSc#_5uMp_$c6R7Wgq@daFVyLyjgf6GL(IwCwyf9V>A!C3p-~RxHA$Yk`
zHaT&E#{n`r1;R&JoZ;zw9{*b?40Sh{ES(=bSybr-evq1+CCI!1%%MFEPXHeOCX|LB
zmbBI#@qBVPQ?1nJSHU~VS`Sa>^Y}|8J`aE=TjZmBz5=H9dEru@U7k<=0MI8A)-w$s
zqd&t7);kg)9Tp>j0i>J)MglG<3O+|xv9>g!s}d^l8rgqIO@9f?ENq$AZkQX5DX*mI
zbqiAE^|PR)SF(!rE%o}>P}Oy9y3}jmM|*t~=0@LsU)Gg0y&m>_jRYRk)TPCJk&6GQ
z6iHL@B`qHKzNRp0(5$1g;QeR^GLP^vBABVjH6d0|(!C>VFl%z4VWf@z2W%hROcg$$
zf=oqvD$G_YQv2xLl%@G$aWp{{6uJ(!OL}$}vPVC75A7cy$qJ7I_TVY|BJd?pv@#Od
zho>wTogCeXhjb0g_mO|8<tLCmdQ@5_$rc$2Jc*~Wd<+z=j0B#=vshyqVpHfM@;$i=
zMpQjNg4qn_+s47-u;Y-RGHXNSAAyfS@EDu)4E@1|mSMRl^OTY~jQqjprKs3huNp3V
z{IeK27{`1&X+#g{#n6E;btueM84e$RcwCqqEqw7$a$Z`2tkIL82h~($4DXXu(sMt)
zsV6-2(jR|w>b*%rFP*w@`OuFSpB{QGb#fH%{LuFn|I5&sy(g#aoq=iX_{(Y_KUre^
zYp{6seM}~D-o~6)KEK{}Yu6~3M7vM7V+A>Qu5R?ig|V^yCuYLn{y{z$kDMCw?HzL)
zmcKjP7RFR)4Y!3jBM!H*g~lHKCZz_yYh3wZ?pK2^)@{AZzVq~OUBl^voSXSue1z+4
z%$aV@2~xcW2j4cw&J6oGjh-KrlYUWl6lLM>_VZZNk3Ndh-;UpCPHzU*810e1tQ+BS
zW@*ck2v;|$Okc!XC_$zrTSzA&8OWqESYM^n5jW{XGR}?&)<l_DI+BcK5@{zVHVrr#
zC*f&EcBI^7q&E>+kf>0LrAW?k3%N{Q=D=<)7q<(JopD^O%D366Ov;TcjeNY3kCvC~
zunDHQc$<*%vA!;q>~!KzYC9^ixwU2UgqozCOdl$=AQ4%VNn^=pBO`Jx@M5n0i+Y`%
zEq}HeTju}6|EUG=j>xr^PHBu&8`lY(_S`+D#eLNh{PJRw6Z^2Y{KJQ1**B4LUsXGZ
zbv07+i>AfScodO)IO<PFWZ-*p9&Z>IDmxLmC*+=Q2I58NlRl4>`zp?K+&44D{E&SW
z`6yeKWqJqcF<_AY>%cv;R(cL~`X1uX5r2dD9%98_)0&O=Da5M~Z$!KU@gBs_AwGck
z6+~@gT}#VVkwv%k6f$lh(iClqu3Xwwkm!o&^2I7g@Ry5~R@+x0xPV(IccU^>oI;}b
zKSdkf15R%?D;`2BcR+sxfp<2OwlnFZm;w=nIJ4Nj2{CUx2Qxt|k;sXa#jJ#rcU4|n
zF)x+fE^aF#Zo5)Id9D0;fN{0`K=gYEDHWfgsOR}KXsR>30@|yj@dUcsxCVW79yzS-
zFjndm@)_3OA=~GhJRKaLIr$|bbMk2>#-u}%7g!5PzZt+rQuwUE)iCC>Ccgll`9*5o
zzmk^Bz#1@2m-GStMg&Z5+<+d;;yKBLy~nA;;pjU_9kT-u|Bp#>k0#6-;}Im*uE5+M
zAq{SY^}yvMef2nsxC+D@h?TqXxLlZTz+WKp96+c8lGdc9(_ugO9nh1a2apY|ppA4=
z<57uBQS}IzrnPu01gpOceWQ9ENMH5i$oE%&9kf}!5_F*YXW&k%J^{sw>H>0h?TS>t
z1^%wEFdsxZdCn5>LWdw0ww^wKoZ#)Ctz)!J&s9*eo*~0m?-LadLYnO<OJ5~IXCPc>
zy*mX`!8?#|{ZSYB^F$ZEp^6;jG+@0)F<-qEJWHeRAC<gNu#3D8lwLUa1M)spyxJ*I
z^8CgoDLNCY!gHX^r|E76OK$!GkKk-Je%M@&?5W1Jcuu2&2u(&ALKXAazrklw(u(=I
zTF-)AQBMn~R`4f~t7wQo%vWy)SCh9uAxngQ0L5^{;-ApS+hl!8u|#kYvMN3;#~jpX
ztYV2mlY+bHZmDM^_zHPZg+ij{0-#wr{{r-D;}EQ@XL)Pa0#`P$A%yvR6sd9nomy7q
znne%_Zev#Sc5vA-3y@Z>O-N)4D^$5|D~0}vHrA{562Ze1YFEe%{(<O5dPOHtWz%03
z?QWi6_h!$oQt2$J)K=d1%c9Db2`aa1mEH7mhw^C!|D9;-9z1>Zq2Ti@-DedF3(KsG
zou|2BJSuxwany_z?we&IJI)Fxvno6I5Oq^tUBq;^^6D&vYPrd-yhf5=A=%=GvDz!B
zx`EC12|MSC$}Toe?bj)ACo5e$j{<R4ruG*k?_ohi1<ii}X65*<6QPUX?W$~gk;TbT
z?g~`^5j0txRbFv|o#d@n$O_(1w2gH@rG@!v!ZgjApMd>P_otyd-K?7XCuG%*Age0!
zLz0~Hs^(9}%#3k71&JKT(<F5OnHb|NN!X-f=pJP3tD4;dxnK+ys~UceY>tfwh?cwo
zKF4z>Q6tOduis+?e@VC^0WE+1mkcq(2%9u9)8Nm8alOHrm4_dYm%kRXu#QB&tQ%hc
z*~Wcf7;=bFjFT{jK7UUx+kr+jZoCYn&#kRX31fqF>pp4JVR<Qx4h5eu>aac&#!U)7
zW?a@zMGqb}#GHQO%Y&Hxjewt<iLjid=hUDnjR@6{&;84sVbb&X(j$j^-#IT(SLbk_
zHRoAs%|EBKxXYTei8A$^$)Lr3&m7Kd#wyQFnmI30M(1!RIG4Xz#%H`zaU(gGzg@;^
z&oXz0b7s-zm0k&xl;Llgah2zb`!HclH5OFYRQjtgtDb61Gs66lYY>%{*C7kt;*sb9
zj2D0PRh3s)w%1@bSNWLGr$82Sx5o^SY1J5&m6S99f>lMe)%c;RFpTyZ=2y-W?KO>1
z4b>R_>T&rha{{bh1ob*B%%*sD;DL6+^h;+`ryC1HG&n5)gIH6|n4n)f?jGZOMoGaw
z0gk2XGh@0~7{b7d8rO$Z?!pk8W6dO*o)svH`rv!El=9kQT<Wr>VofPk2k6-+oHNe7
zKE#Z<<9wANzKQPg3BI9*@qTp`p7PrbabqE$YfNS0=|aM3>`CDmTITRuMPEGLm}*+R
zN`0|d+LtLb%4M1sSCXFY1kf1E_b=_kPAr#-Ph`lCA3|`$<zjgijblIx_uc^~AH}G{
z^2kjjoL<lv>V-@S5HyA;UQZl~E15zn>j`5m#WmYF(jr*@EKR3ZHGzZK!rR^f;GKn~
zRHj#3kh@1PlnZsbuFPR5`Z!DYuQQS-UViz7e?7Lx`u(@9-&=jYh8k<TCU#g)J$UGl
zZvnG3CG!pw9<gelI`Iu_`co&KK6Ju*>d>J>hrRTO^=<z=>!<#n2+ZOC?|t>Ph_g-%
z`c~9f_xS?oBn(Eh4)+x}o4?NrnI@((x%OwPv2gqqZ?3l1?)6m#BFseKeDz<bwa$0L
z{>irl-<ch}I3M2#u(!t2*9FCuC?+UHr~14dG+;hu7g7nVT)D;UO~?B3pzXd~wlI(v
z`D8Z7T{y))=Rlf5@odJ;Wz$^ba!)GqF&oY7eXFqTfmDKm{3HR}*uT4lyk3awm9xDq
zl}?kL-HuNpg^Zwucrwj$*aNYI=-Sk>!QR~5vZ1Y;_VtEel@cCMqr%D+vhZ%I-|>ns
zO9P*&zU{HJEGs87R-FR}y8>MfwhA@`l<bWa(yX2wCu|<t%ax8<S(esyoy|AVUp$*|
zr0Glyev#3G!w9A<6%ts=WQzhU5wdzyPC9|+jM=@h{#5#2_$g#4iH(0e8Oy2qcDCN+
z6_CYFXK^SZA4O4i1RIF;hxR}gjVMdEanr`N9cVHXfK`Wi5FGd{5n31}g6~Akjd@*K
zW|G~?_flEwYP(rCeTvow+#EaGiOUMeA!6HXVGJwX@x?BZ<!R~I)V8Iqg}o$41DyBA
z^4nM%HoF{+j$7igv-vg(FJDCw*K0}Hvm9kTF?|0j8G7ER%VAE*=FnMWL5|st$!x!q
zZ|vXUxNc)MmfC*Bj%;pQV-_bxu~e>Uou*baZfx#qZ0&5nwXL(UrLCjmmX7Am#*J;=
z9o=nR-6f6BHjihqZS}eazQ+3zrDX$AW_;s`gDUT3P{TFv`~_<z_nWeHy1F~tIGDU~
z$#1=p7H<oT?o~s?GdRA#l*W?Sv#Rmf(z02#KW0kwHv^^%%%rZ#6jK~&iz(*~pC}af
z;>1@fzRC1zMO#d{-7b|C(fqyrZmb8Xn^S30Q>eC+8xT>P)H%`Swe3sYSf7XR^AYVS
zr0@Y8eHkT6#_~xKP28J-J(XfqNe-rfJU?@m0vo)Xlcu~P2Jn(bd15D`uCo)*UI4JN
za!^N|q}`k23mJ`LNaW!_CHKT(2uASM#o-_eMLeR?n$qmaLpq-A?|0CN(S*}e=(A(F
zSf<aR6$u9lJ$%`VSiV?Vw5KQMY}b<b!9x+0mRBAH&}2HFpLqZLfbX7Ozj}8i(79Mj
z6a)L3p&oHEB7RBLodz%>pmo4cgbd5^)N)CjNhKlI;PIGfx%Hqi6r??#VeNz57GSLF
zWS|^lE8@F2XQE%8alPsJEtlH}K2~Yco{6(B?lr=YWm%9&Tm1dI6;X{{{PyAOsuqA}
zWI9lm;Vwj;bI~u)xQ;<?K4|Ti`Hb5Tc`inpXJfBIE&{sLFQE7wBJV~}j%RD!JMo3l
z_E=ZqK}0Rbv$%_p+v&;i+)vBx1I@BhpJ#$D7|THGKsko{5w+Z7kb8^_T}hCHjQlRI
z<#_Mr7&_-ZT{!UAb_|aoYB`=kF2Qn?$7(ugzh6TJ<yhbKkXsMAy=8u>^EjfGJA)4s
zXHZFPgM3XN^W@MR>Q2rS)n1fg&~o1bO?#B%$K%?Mk$a&;jvtBZAg67BRisaYW;4*9
zyz2wGGoabO4Af!2eIHT#<=uvNKEfVle^esJGuZQx<GY{(Wf*^ssO?>Y4bU~{0Q%8^
zG7PUHGN0vZg<LD-4uaM}%e{pR+FRx^D7Qchc|7ue>(QE(f?Py{65a<TG}%Lt`wj^&
z&=x}#2u%}joGJtlS9Q=lxd+slNE>G2LWX7nYjPn7O;h~oSweiPBtw%c%jA-n=r&Wq
z3%Xs_cyi0U{Ns>2$Hw#m?J;gBv-cRj<8!{!fieuJp6m+=@VE%MTQw6{lT7(;=+L@Q
zhzQz+eZsp;EFYRw&IKjK5s9Tj+*p#K?LqXCz<Y1ZRJZBWysfbE%=uYiWsvi*!m4#R
z-zpqnA~>%qtU8eMr^4!O(BA_5-bm$qsQ8@G)V!xK_LT^n-xTJ|t>!U>F<BsRzEYSo
zpSlmIFt+>%oPQL?ON79AMq#!b-c!sc3bR+#yrD3^Y^eD`VfBm0c|c))5kY?xvHEht
z_ge9JCWZPGF~6J$!S|G@UtsVe@O@<J7Z{`^!7pZ)AoBSuJRbZLW>oU$j59&`1ut}r
z2R{zQOM_oTN+IOumErltaY%+K{(Foq&abY-25!``gq%MWuEDKK%=1NDE63>T-uD+D
zZuxBhpY`Q<G*I6=kgf;jNFq)mU4y+O5{&!mOZ;<%87|tNCUyhs{xk4a9RM!%|5ae&
z^*8N3L+l0C=Xub&e+=IY!Q*6IKjE7ueqDy&1=js-_@)b<zU%&spg${6G2V6Jn=lRj
zW&`tg5>R3uj`Glr^_`0P@_2+tYiw8ItAKTgfM_qncLH<#D*doX0PFER4L33G0p?*D
z9nxN=M4zL1R~hEl9Ui6W^6)a74wNsQGl^dYzoW$eYry(Ufc52xuWpYp+T$!RkNkA~
zeg~`r?eQ+34#cy7d5oybk1r#F2YXyQus#ccA1$%R4-;#EX=AEyrnnB6hmKl)Juq*O
zDSnN(1(?^+IPO?p2UrLC-%*C|2j)SiF8|+@@t*+J?{666>De;=cY%4FsoVE^z^{7c
zrTh=e<o~S<{|=akv05K5X)&<8Q-MqU&n)Bfoc=xUW8O4hwYVNwpVhGbt-xFt(&#jP
zIgaPtyj$q)#UYt(w{&mnv^(0nx^c7Awp%Bl8(T_PiLBk1&h}srDmOfKtgsWi)&7CB
z<2s4xXO^v4F37M`iJe3%h1`|ci9&z>z1mOP##ZU(2ApuT*&5M}rpLX=-IerGa;Rso
z>)5omxx?Oc!wp?+-FA2L+Kx7so7*+)rE;-*Z3ky06EftzSz)){zOnhH_7=gtn7Ygg
zF?q8!o-f#PkLP8N@2|a&y2Z1ki5GG08@Jn?P9F{vom@*gmd|6~X7>)*$sI_zXXM$6
zx^=r|&G?<!OYYN_GWBO%b$_>%qweaK=9FFk<rfHBp1gSVD1JRI9-WkG)05+t=BV1r
zLgVCN{5Swc^I7lIrQ~SB8!fu$icKlE&g#x_sdZjRDaFd$xEFc#xKzNlv0?VAqV6k~
za``nu_BF3KmomI-%M-HXmwMf_@>WeL+jivsocE?DWZS7#t5-$)aOg1*x7}nRvn|@Q
LQyn+T0Vn<kx7)D1

diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c
deleted file mode 100644
index 84de51a68d..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-//-----------------------------------------------------------------------------
-// For FIFOS / NETLINK interface
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/********************
-// RRC definitions
- ********************/
-#include "nasmt_constant.h"
-#include "rrc_nas_sap.h"
-#include "rrc_constant.h"
-//-----------------------------------------------------------------------------
-//#define MAX_PAYLOAD 4096  /* this sould cover the max mtu size*/
-struct nlmsghdr *rrcnl_nlh;
-int rrcnl_sock_fd;
-struct sockaddr_nl rrcnl_src_addr, rrcnl_dest_addr;
-struct iovec rrcnl_iov;
-struct msghdr rrcnl_msg;
-
-//-----------------------------------------------------------------------------
-typedef unsigned int       sdu_size_t;
-typedef unsigned int       rb_id_t;
-
-typedef struct pdcp_data_req_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_ind_header_t;
-
-#define MAX_PAYLOAD 1024  /* maximum payload size*/
-struct sockaddr_nl src_addr, dest_addr;
-struct nlmsghdr *nlh = NULL;
-struct iovec iov;
-int sock_fd;
-struct msghdr msg;
-#define OAI_IP_DRIVER_NETLINK_ID 31
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-void foo( int sig )
-{
-  //-----------------------------------------------------------------------------
-  printf("I got cntl-C, closing socket\n");
-  close(sock_fd);
-  close(rrcnl_sock_fd);
-  exit(-1);
-}
-
-//-----------------------------------------------------------------------------
-int main()
-{
-  //-----------------------------------------------------------------------------
-  struct sigaction newaction;
-  int i=0;
-  int ret;
-  int len, count;
-
-  newaction.sa_handler = foo;
-
-  // register cntl-C handler
-  if ( sigaction( SIGINT, &newaction, NULL ) == -1)
-    perror("Could not install the new signal handler");
-
-  // create both sockets
-  sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
-  printf("Opened socket with fd %d\n",sock_fd);
-  ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
-  printf("fcntl returns %d\n",ret);
-
-  rrcnl_sock_fd = socket(PF_NETLINK, SOCK_RAW, NAS_RRCNL_ID);
-  printf("rrc_ue_netlink_init - Opened socket with fd %d\n", rrcnl_sock_fd);
-  ret = fcntl(rrcnl_sock_fd,F_SETFL,O_NONBLOCK);
-  printf("rrc_ue_netlink_init - fcntl returns %d\n",ret);
-
-  // set src addresses blocks
-  memset(&src_addr, 0, sizeof(src_addr));
-  src_addr.nl_family = AF_NETLINK;
-  src_addr.nl_pid = 1;//getpid();  /* self pid */
-  src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(sock_fd, (struct sockaddr*)&src_addr, sizeof(src_addr));
-  printf("bind returns %d\n",ret);
-
-  memset(&rrcnl_src_addr, 0, sizeof(rrcnl_src_addr));
-  rrcnl_src_addr.nl_family = AF_NETLINK;
-  rrcnl_src_addr.nl_pid = NL_DEST_RRC_PID;//getpid();  /* self pid */
-  rrcnl_src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(rrcnl_sock_fd, (struct sockaddr*)&rrcnl_src_addr, sizeof(rrcnl_src_addr));
-  printf("rrc_ue_netlink_init - bind returns %d\n",ret);
-
-  // set dest addresses blocks
-  memset(&dest_addr, 0, sizeof(dest_addr));
-  dest_addr.nl_family = AF_NETLINK;
-  dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  dest_addr.nl_groups = 0; /* unicast */
-
-  memset(&rrcnl_dest_addr, 0, sizeof(rrcnl_dest_addr));
-  rrcnl_dest_addr.nl_family = AF_NETLINK;
-  rrcnl_dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  rrcnl_dest_addr.nl_groups = 0; /* unicast */
-
-  // set nlh
-  nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
-  nlh->nlmsg_pid = 1;//getpid();  /* self pid */
-  nlh->nlmsg_flags = 0;
-
-  rrcnl_nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(RRC_NAS_MAX_SIZE));
-  //memset(rrcnl_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  rrcnl_nlh->nlmsg_len = NLMSG_SPACE(RRC_NAS_MAX_SIZE);
-  rrcnl_nlh->nlmsg_pid = NL_DEST_RRC_PID;//getpid();  /* self pid */
-  rrcnl_nlh->nlmsg_flags = 0;
-
-  // set iov
-  iov.iov_base = (void *)nlh;
-  iov.iov_len = nlh->nlmsg_len;
-  memset(&msg,0,sizeof(msg));
-  msg.msg_name = (void *)&dest_addr;
-  msg.msg_namelen = sizeof(dest_addr);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
-
-  rrcnl_iov.iov_base = (void *)rrcnl_nlh;
-  rrcnl_iov.iov_len = rrcnl_nlh->nlmsg_len;
-  memset(&rrcnl_msg,0,sizeof(rrcnl_msg));
-  rrcnl_msg.msg_name = (void *)&rrcnl_dest_addr;
-  rrcnl_msg.msg_namelen = sizeof(rrcnl_dest_addr);
-  rrcnl_msg.msg_iov = &rrcnl_iov;
-  rrcnl_msg.msg_iovlen = 1;
-
-  /* Read message from kernel */
-  memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  /* Read message from kernel */
-  memset(rrcnl_nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  while (1) {
-    len = recvmsg(sock_fd, &msg, 0);
-    count = recvmsg(rrcnl_sock_fd, &rrcnl_msg, 0);
-
-    if (len<0) {
-      //  exit(-1);
-    } else {
-      printf("Received PDCP socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
-    }
-
-    if (count<0) {
-      //  exit(-1);
-    } else {
-      printf("Received RRC socket with length %d (nlmsg_len = %d)\n",count,rrcnl_nlh->nlmsg_len);
-    }
-
-    /*    usleep(1000);
-        i=i+1;
-        if ((i % 100) == 0)
-          printf("%d\n",i);*/
-    usleep(50);
-    i=i+1;
-
-    if ((i % 1000) == 0)
-      printf("%d\n",i);
-
-    /*
-    for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
-      printf("%x ",
-       ((unsigned char *)NLMSG_DATA(nlh))[i]);
-       }
-       */
-  }
-
-  /* Close Netlink Socket */
-  return 0;
-}
-
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c
deleted file mode 100644
index 121d3bba8b..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/nettestPDCP.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-typedef unsigned int       sdu_size_t;
-typedef unsigned int       rb_id_t;
-
-typedef struct pdcp_data_req_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_req_header_t;
-
-typedef struct pdcp_data_ind_header_t {
-  rb_id_t             rb_id;
-  sdu_size_t           data_size;
-  int       inst;
-} pdcp_data_ind_header_t;
-
-#define MAX_PAYLOAD 1024  /* maximum payload size*/
-struct sockaddr_nl src_addr, dest_addr;
-struct nlmsghdr *nlh = NULL;
-struct iovec iov;
-int sock_fd;
-struct msghdr msg;
-
-
-void foo( int sig )
-{
-
-  printf("I got cntl-C, closing socket\n");
-
-
-  close(sock_fd);
-  exit(-1);
-}
-
-
-#define OAI_IP_DRIVER_NETLINK_ID 31
-
-void main()
-{
-
-
-  struct sigaction newaction;
-  int i=0;
-  int ret;
-  int len;
-
-  newaction.sa_handler = foo;
-
-  if ( sigaction( SIGINT, &newaction, NULL ) == -1)
-    perror("Could not install the new signal handler");
-
-  sock_fd = socket(PF_NETLINK, SOCK_RAW,OAI_IP_DRIVER_NETLINK_ID);
-
-  printf("Opened socket with fd %d\n",sock_fd);
-
-  ret = fcntl(sock_fd,F_SETFL,O_NONBLOCK);
-  printf("fcntl returns %d\n",ret);
-
-  memset(&src_addr, 0, sizeof(src_addr));
-  src_addr.nl_family = AF_NETLINK;
-  src_addr.nl_pid = 1;//getpid();  /* self pid */
-  src_addr.nl_groups = 0;  /* not in mcast groups */
-  ret = bind(sock_fd, (struct sockaddr*)&src_addr,
-             sizeof(src_addr));
-  printf("bind returns %d\n",ret);
-
-  memset(&dest_addr, 0, sizeof(dest_addr));
-  dest_addr.nl_family = AF_NETLINK;
-  dest_addr.nl_pid = 0;   /* For Linux Kernel */
-  dest_addr.nl_groups = 0; /* unicast */
-
-  nlh=(struct nlmsghdr *)malloc(NLMSG_SPACE(MAX_PAYLOAD));
-  /* Fill the netlink message header */
-  nlh->nlmsg_len = NLMSG_SPACE(MAX_PAYLOAD);
-  nlh->nlmsg_pid = 1;//getpid();  /* self pid */
-  nlh->nlmsg_flags = 0;
-
-  iov.iov_base = (void *)nlh;
-  iov.iov_len = nlh->nlmsg_len;
-  memset(&msg,0,sizeof(msg));
-  msg.msg_name = (void *)&dest_addr;
-  msg.msg_namelen = sizeof(dest_addr);
-  msg.msg_iov = &iov;
-  msg.msg_iovlen = 1;
-
-
-  /* Read message from kernel */
-  memset(nlh, 0, NLMSG_SPACE(MAX_PAYLOAD));
-
-  while (1) {
-    len = recvmsg(sock_fd, &msg, 0);
-
-
-    if (len<0) {
-
-      //  exit(-1);
-    } else {
-      printf("Received socket with length %d (nlmsg_len = %d)\n",len,nlh->nlmsg_len);
-    }
-
-    usleep(1000);
-    i=i+1;
-
-    if ((i % 100) == 0)
-      printf("%d\n",i);
-
-    /*
-    for (i=0;i<nlh->nlmsg_len - sizeof(struct nlmsghdr);i++) {
-      printf("%x ",
-       ((unsigned char *)NLMSG_DATA(nlh))[i]);
-       }
-       */
-  }
-
-  /* Close Netlink Socket */
-
-}
-
-
-
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/readme.txt b/openair2/NAS/DRIVER/CELLULAR/readme.txt
deleted file mode 100755
index fd4411a25b..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/readme.txt
+++ /dev/null
@@ -1,157 +0,0 @@
-         ---------------------------------
-         | UMTS-TDD (TD-CDMA) NAS driver |
-         ---------------------------------
-
-
-  
-1 - COMPILATION
----------------
-Pre-Req :
- - RTAI installed and running
- - IPv6 patched as described below (see 4 - Patching IPv6)
-  
-From RHODOS26 directory:
-  
- - make nasrg : creates the NAS RG driver (nasrg.ko) and copies it to the RHODOS26/bin directory
-  
- - make cleannasrg : deletes all object and temporary files from the nasrg directory
-  
- - make nasmt : creates the NAS MT driver (nasmt.ko) and copies it to the RHODOS26/bin directory
-  
- - make cleannasmt : deletes all object and temporary files from the nasmt directory
-  
-  
-2 - OPERATION - RG side
------------------------
-  
-A1 - Compile the Access Stratum (for IF mode)
-  
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-  
-  > make rgif
-  > make asrguserif
-  > make rrmumts 
-
-A2 - Compile the Access Stratum (for RF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-
-  > make guimakefiles
-  > make rgrf
-  > make asrguserrfa2
-  > make rrmumts
-
-
-B - Start the Access Stratum
-  
- (as root      )  > cd  <..>RHODOS26/bin
-  
- (first install)  > create_rtfifos
- (first install)  > mknod -m 666 /dev/daq0 c 127 1
- (after cleanas)  > cp
-../src/rrm_umts/congestion_control/resources_manager/rrm_master.properties .
-  
- (--           )  > ./start_rtos
- (--           )  > ./runrgif [for IF]   [or ./runrga2 for RF]
-  
- ==> to check correct operation:
- (as root      ) cat /dev/rtf62
- (as root      ) tail -f /var/log/messages
-  
-C - Start the NAS Driver
-  
- (as root      ) > cd  <..>RHODOS26/bin
- (--           ) > insmod nasrg.ko
- (--           ) > ./access_router.up
-  
-D - Stop the NAS Driver and the Access Stratum
-  
- (--           ) > ./access_router.down
- (--           ) > rmmod nasrg
- (--           ) > <CTRL+C> on Acccess stratum window
- (--           ) > ./stop_rtos
-  
-E - Clean Access Stratum compilation
-  
- > make cleanas
-  
-3 - OPERATION - MT side
------------------------
-  
-A1 - Compile the Access Stratum (for IF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-          file RHODOS26/src/access_stratum/l1/low/control/mmx.h copied in /usr/include
-
-  > make mtif
-  > make asmtuserif
-  > make fpgatest
-
-A2 - Compile the Access Stratum (for RF mode)
-
-Pre-Req : RTAI installed and running
-          ICC 8.0 installed and running
-          file RHODOS26/src/access_stratum/l1/low/control/mmx.h copied in /usr/include
-
-  > make guimakefiles
-  > make mtrf
-  > make asmtuserrf
-  > make fpgatest
-
-
-B - Start the Access Stratum
-
- (as root      )  > cd  <..>RHODOS26/bin
-
- (first install)  > create_rtfifos
- (first install)  > mknod -m 666 /dev/daq0 c 127 1
-
- (--           )  > ./start_rtos
- (--           )  > ./runrgif [for IF]   [or ./runrga2 for RF]
-
- ==> to check correct operation:
- (as root      ) cat /dev/rtf62
- (as root      ) tail -f /var/log/messages
-
-C - Start the NAS Driver
-
- (as root      ) > cd  <..>RHODOS26/bin
- (--           ) > insmod nasmt.ko
- (--           ) > ./mobile_node.up
-
-D - Stop the NAS Driver and the Access Stratum
-
- (--           ) > ./mobile_node.down
- (--           ) > rmmod nasmt
- (--           ) > <CTRL+C> on Acccess stratum window
- (--           ) > ./stop_rtos
-
-E - Clean Access Stratum compilation
-
- > make cleanas
-
-
-4 - Patching IPv6
------------------------
-
-For Linux with 2.6.xx kernel version (xx = 10 or 81):
-
-- move RHODOS26/non_access_stratum/driver/src/addrconf.c.26.xx to /usr/src/linux/net/ipv6/addrconf.c
-- move RHODOS26/non_access_stratum/driver/src/if_arp.h.26.xx   to /usr/src/linux/include/linux/if_arp.h
-- recompile IPv6 (inside the kernel or as a module, as usual)
-  
-5 - Start the MT connection
------------------------
-
-You can use either the RAL-UMTS (RAL-CDMA) -- see corresponding documentation --
-
-* OR *
-
-the tool provided with the driver (directory RHODOS26/src/non_access_stratum/driver/mt_tools).
-Install the tool, update the Cell_id field if needed and click on the "Attach" button.
-  
-
- 
\ No newline at end of file
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular b/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular
deleted file mode 100755
index c89f19e9c0..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_mt_cellular
+++ /dev/null
@@ -1,13 +0,0 @@
-#xterm -hold "tail -f /var/log/messages" &
-insmod ./NASMT/nascellmt.ko nas_IMEI=3,5,6,0,1,4,9,1,5,0,0,0,0,0
-#insmod ./NASMT/nascellmt.ko
-sleep 2
-ifconfig oai0 10.0.1.2 netmask 255.255.255.0 broadcast 10.0.1.255
-#ifconfig oai0 add 2001:660:382:14:335:600:8014:9150/64
-#./bin/mobile_node.up
-#sleep 3
-#./CTL_TOOL/gioctl cx add 0 5
-#xterm -hold -e ./bin/IALdummy &
-#sleep 1
-#xterm -hold -e ./bin/tdcdma_gui &
-#lsmod
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd b/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd
deleted file mode 100755
index 3d51140dcd..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_noradvd
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#xterm -hold -e ant -buildfile rrm_umts.xml run &
-#sleep 2
-insmod ./NASRG/nascellrg.ko
-sleep 2
-#bin/access_router_noradvd.up
-sysctl -w net.ipv6.conf.default.dad_transmits=0
-#sysctl -w net.ipv6.conf.all.forwarding=1
-#sysctl -w net.ipv4.conf.all.forwarding=1
-
-#ifconfig oai0 192.168.14.100
-ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
-ifconfig oai0 add 2001:660:382:14::1/64
-#ifconfig graal0 192.168.14.100
-#ifconfig graal0 add 2001:690:2380:7777::1/64
-#ifconfig graal0 add 2001:660:382:14::1/64
-#lsmod
\ No newline at end of file
diff --git a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd b/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd
deleted file mode 100755
index f57fb7712d..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/start_rg_cellular_radvd
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#xterm -hold -e ant -buildfile rrm_umts.xml run &
-#sleep 2
-insmod ./NASRG/nascellrg.ko
-sleep 2
-#bin/access_router_noradvd.up
-sysctl -w net.ipv6.conf.default.dad_transmits=0
-sysctl -w net.ipv6.conf.all.forwarding=1
-#sysctl -w net.ipv4.conf.all.forwarding=1
-
-#ifconfig oai0 192.168.14.100
-ifconfig oai0 10.0.1.3 netmask 255.255.255.0 broadcast 10.0.1.255
-ifconfig oai0 add 2001:660:382:14::1/64
-
-#lsmod
-sleep 4s
-radvd
diff --git a/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular b/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular
deleted file mode 100755
index e7325cf40f..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/stop_mt_cellular
+++ /dev/null
@@ -1,5 +0,0 @@
-#killall -qw tdcdma_gui
-#killall -qw IALdummy
-#./bin/mobile_node.down
-rmmod -w nascellmt
-
diff --git a/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular b/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular
deleted file mode 100755
index 88d17a7e6b..0000000000
--- a/openair2/NAS/DRIVER/CELLULAR/stop_rg_cellular
+++ /dev/null
@@ -1,2 +0,0 @@
-ifconfig oai0 down
-rmmod -w nascellrg
diff --git a/openair2/NAS/Makefile.inc b/openair2/NAS/Makefile.inc
deleted file mode 100644
index a06e8f690a..0000000000
--- a/openair2/NAS/Makefile.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-NAS_UE_DIR = $(OPENAIR2_TOP)/NAS
-
-NAS_UE_OBJS =
-
-NAS_UE_incl = \
-    -I$(NAS_UE_DIR)
diff --git a/openair2/NAS/SIMU_CELLULAR/Makefile b/openair2/NAS/SIMU_CELLULAR/Makefile
deleted file mode 100755
index 12070071a6..0000000000
--- a/openair2/NAS/SIMU_CELLULAR/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-# lines starting with the pound sign are comments.
-#
-# These things are options that you might need
-# to tweak.
-
-
-# You can modify the below as well, but probably
-# won't need to.
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-#UPDIR	:= /homes/mwett/rh_mw/RHODOS
-COMMON_DIR = $(OPENAIR2_DIR)/COMMON
-RRC_CELL_DIR = $(OPENAIR2_DIR)/RRC/CELLULAR
-NAS_SIMU_DIR = $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR
-#ASN1_DIR = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
-ASN1_DIR = $(OPENAIR2_DIR)
-
-#UPDIR	:= $(EURECOM_SRC_PATH)
-#GRAAL_DIR  =$(UPDIR)/non_access_stratum/driver/nasmt
-#RRC_DIR =$(UPDIR)/access_stratum/l3/rrc
-
-#CFLAGS += -Wall -g -DDEBUG_RRC_STATE -DNODE_RG -DNODE_MT
-CFLAGS += -std=gnu99 -I$(KERNEL_DIR)  -DNB_ANTENNAS_RX=1
-
-ifdef CELL_RRM
-CFLAGS += -DNODE_RG
-OBJ +=rrm_fifo_standalone.o nasrg_simu_meas.o
-else
-ifdef MASTER
-CFLAGS += -DNODE_RG
-OBJ +=nasrg_simu_main.o nasrg_simu_control.o nasrg_simu_rrm_fifo.o nasrg_simu_meas.o
-else
-CFLAGS += -DNODE_MT
-OBJ +=nasmt_simu_main.o nasmt_simu_control.o
-endif
-endif
-
-ifdef CELLULAR
-CFLAGS += -DCELLULAR -DNO_RRM -I$(COMMON_DIR) -I$(RRC_CELL_DIR) -I$(NAS_SIMU_DIR) -I$(ASN1_DIR)
-endif
-
-
-$(OBJ) : %.o : %.c
-	$(CC) $(CFLAGS) -c -o $@ $< -pthread
-
-all: nasmt_simu nasrg_simu
-
-nasmt_sim : $(OBJ)
-	$(CC)  -o nasmt_simu $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv nasmt_simu $(OPENAIR_TARGETS)/SIMU/USER
-
-nasrg_sim : $(OBJ)
-	$(CC)  -o nasrg_simu $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv nasrg_simu $(OPENAIR_TARGETS)/SIMU/USER
-
-cell_rrm : $(OBJ)
-	$(CC)  -o cell_rrm $(OBJ) $(CFLAGS) -lm -lrt -pthread
-	mv cell_rrm $(OPENAIR_TARGETS)/SIMU/USER
-
-clean:
-	-rm $(OBJ) $(EXECUTABLE)
-
diff --git a/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h b/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h
deleted file mode 100644
index 86ab7a1ec5..0000000000
--- a/openair2/NAS/SIMU_CELLULAR/nas_simu_proto.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __NAS_CONTROL_H__
-#define __NAS_CONTROL_H__
-
-#ifdef NODE_MT
-//-----------------------------------------------------------------------------
-void nas_ue_control_init (void);
-//int nas_ue_DC_attach(void);
-//int nas_ue_DC_attach_complete(void);
-int  nas_ue_GC_Rcve_FIFO (void);
-int  nas_ue_NT_Rcve_FIFO (void);
-int  nas_ue_DC_Rcve_FIFO (void);
-#endif
-
-#ifdef NODE_RG
-//-----------------------------------------------------------------------------
-void nas_rg_control_init (void);
-//int nas_rg_DC_ConnectMs(void) ;
-int  nas_rg_DC_Rcve_FIFO (int time);
-
-int nasrg_rrm_socket_init(void);
-void nasrg_rrm_fifos_init (void);
-void nasrg_rrm_to_rrc_write (void);
-void nasrg_rrm_from_rrc_read (void);
-
-int nasrg_meas_loop (int time, int UE_Id);
-void nas_rg_print_buffer (char *buffer, int length);
-/*void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type);
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type);*/
-void nasrg_print_meas_report (char *rrc_rrm_meas_payload, unsigned short type);
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, unsigned short type);
-#endif
-
-#endif
diff --git a/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c b/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c
deleted file mode 100644
index a192b82d72..0000000000
--- a/openair2/NAS/SIMU_CELLULAR/nasrg_simu_meas.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-
-#include "openair_types.h"
-#include "rrc_constant.h"
-
-#include "rrc_msg_constant.h"
-#include "rrc_rrm_primitives.h"
-#include "rrc_msg_ies.h"
-
-#include "nas_simu_proto.h"
-
-extern int  rrc_rg_rrm_in_fifo;
-
-int sim_counter=0;
-
-/* Mobile Station */
-//-------------------------------------------------------------------
-void nasrg_meas_if_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Intra-Frequency
-  rrm_control->type = IX_ifM;
-  // measurementCommand         SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount16;
-  rrm_control->period = int2000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_if_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Intra-Frequency
-  rrm_control->type = IX_ifM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount_inf;
-  rrm_control->period = int2000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount2; //for test
-  //rrm_control->amount = amount_inf; // for execution
-  rrm_control->period = int3000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_ue_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal UE
-  rrm_control->type = IX_iueM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount8;
-  rrm_control->period = int1000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_ue_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal UE
-  rrm_control->type = IX_iueM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 0;
-  rrm_control->UE_Id = UE_Id;
-}
-
-
-/* Base Station */
-//-------------------------------------------------------------------
-void nasrg_meas_bs_tv_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvbM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount_inf;
-  rrm_control->period = int4000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_tv_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Traffic Volume
-  rrm_control->type = IX_tvbM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qbM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-  rrm_control->amount = amount2;
-  rrm_control->period = int3000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_bs_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Quality
-  rrm_control->type = IX_qbM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = UE_Id;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_bs_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal BS
-  rrm_control->type = IX_ibsM;
-  // measurementCommand   SETUP
-  rrm_control->command = MC_setup;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = maxUsers;        //should not be set
-  rrm_control->amount = amount16;
-  rrm_control->period = int4000;
-}
-
-//-------------------------------------------------------------------
-void nasrg_meas_int_bs_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  // measurement identity  Internal BS
-  rrm_control->type = IX_ibsM;
-  // measurementCommand    RELEASE
-  rrm_control->command = MC_release;
-  rrm_control->BaseStation = 1;
-  rrm_control->UE_Id = maxUsers;        //should not be set
-}
-
-//-------------------------------------------------------------------
-void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  measurement_request meas_request;
-  int count =0;
-
-  printf ("[NASRG_MEAS_TEST] RPC_MEASUREMENT_REQUEST --> RRC\n ");
-  memset ((char*)& rpc_mess, 0, sizeof (rpc_message));
-  memset ((char*)& meas_request, 0, sizeof (measurement_request));
-  //build header
-  rpc_mess.type = RPC_MEASUREMENT_REQUEST;
-  rpc_mess.length = sizeof (measurement_request);
-  // build content
-  meas_request.measurement_type = rrm_control->type;
-  meas_request.measurement_command = rrm_control->command;
-  // different conding between RRM and RRC
-  // Mobile terminal RRC = 0, RRM = 1
-  // Base Station    RRC = 1, RRM = 2
-  meas_request.equipment_type = rrm_control->BaseStation + 1;
-  meas_request.equipment_id = rrm_control->UE_Id;
-  meas_request.amount = rrm_control->amount;
-  meas_request.period = rrm_control->period;
-
-  // send to RRC
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & meas_request, sizeof (measurement_request));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-#ifdef DEBUG_NAS_MEAS_SIMU
-  nas_rg_print_buffer ((char *) & rpc_mess, sizeof (rpc_message));
-  nas_rg_print_buffer ((char *) & meas_request, sizeof (meas_request));
-#endif
-}
-
-//-------------------------------------------------------------------
-//  in case not  rrc_rg_meas_loop (time,UE_Id);
-int nasrg_rrm_meas_stop (int time, int UE_Id)
-{
-  //-------------------------------------------------------------------
-  struct rrc_rrm_measure_ctl control;
-
-  // Measurement Control  - Stop Quality previously sent by RRM
-  nasrg_meas_q_release (UE_Id, &control);
-  //rrc_rrm_measure_request (control);
-  nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  return 0;
-}
-//-------------------------------------------------------------------
-//        rrc_rg_meas_loop (time,UE_Id);
-int nasrg_meas_loop (int time, int UE_Id)
-{
-  //-------------------------------------------------------------------
-  struct rrc_rrm_measure_ctl control;
-
-  sim_counter++;
-  //  if (time % 5 == 0) {
-#ifdef DEBUG_NAS_MEAS_SIMU
-  printf ("\n[NASRG_MEAS_TEST] Simu Measurement Time : %d, counter : %d\n", time, sim_counter);
-#endif
-
-  //  }
-  if (sim_counter == 8) {
-    // Measurement Control  - Stop Quality previously sent by RRM
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] NAS sends Measurement Control (Stop Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_release (UE_Id, &control);
-    //rrc_rrm_measure_request (control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Intra-Frequency
-  //  if (sim_counter == 140) {
-  if (sim_counter == 16) {
-    // Measurement Control  - Start Intra-frequency
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Intra-freq) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_if_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 700) {
-  if (sim_counter == 70) {
-    // Measurement Control  - Stop Intra-frequency
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Intra-freq) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_if_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Traffic Volume
-  //  if (sim_counter == 100) {
-  if (sim_counter == 12) {
-    // Measurement Control  - Start Traffic Volume
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Traffic Volume) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_tv_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 990) {
-  if (sim_counter == 92) {
-    // Measurement Control  - Stop Traffic Volume
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Traffic Volume) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_tv_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Quality
-  //  if (sim_counter == 503) {
-  if (sim_counter == 50) {
-    // Measurement Control  - Start Quality
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 995) {
-  if (sim_counter == 96) {
-    // Measurement Control  - Stop Quality
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Quality) message at time : %d\n\n", sim_counter);
-#endif
-    // setup if measurement for MT
-    nasrg_meas_q_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Internal UE
-  //  if (sim_counter == 210) {
-  if (sim_counter == 20) {
-    // Measurement Control  - Start Internal UE
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Start Int UE) message at time : %d\n\n", sim_counter);
-#endif
-    // setup int_ue measurement for MT
-    nasrg_meas_int_ue_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 999) {
-  if (sim_counter == 98) {
-    // Measurement Control  - Stop Internal UE
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG sends Measurement Control (Stop Int UE) message at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_ue_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Internal BS
-  //  if (sim_counter == 105) {
-  if (sim_counter == 14) {
-    // Measurement Control  - Start Internal BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Int BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_bs_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 980) {
-  if (sim_counter == 86) {
-    // Measurement Control  - Stop Internal BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Int BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_int_bs_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Traffic Volume BS
-  //  if (sim_counter == 220) {
-  if (sim_counter == 22) {
-    // Measurement Control  - Start Traffic Volume BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Traffic Volume BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_tv_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 900) {
-  if (sim_counter == 80) {
-    // Measurement Control  - Stop Traffic Volume BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Traffic Volume BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_tv_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  // Quality BS
-  //  if (sim_counter == 625) {
-  if (sim_counter == 62) {
-    // Measurement Control  - Start Quality BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG starts internal Measurement (Quality BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_q_setup (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  //  if (sim_counter == 989) {
-  if (sim_counter == 90) {
-    // Measurement Control  - Stop Quality BS
-#ifdef DEBUG_NAS_MEAS_SIMU
-    printf ("\n\n[NASRG_MEAS_TEST] RG stops internal Measurement (Quality BS) at time : %d\n\n", sim_counter);
-#endif
-    nasrg_meas_bs_q_release (UE_Id, &control);
-    nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  }
-
-  return sim_counter;
-}
-
-//-----------------------------------------------------------------------------
-//void rrc_rg_print_meas_report (struct rrc_rg_mt_meas_rep *p){
-void nasrg_print_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
-{
-  //-----------------------------------------------------------------------------
-  int i, j;
-  char *payload[20] =
-  { "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
-  char *average[20] = {
-    "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
-    "pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k","pla1024k"
-  };
-  char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
-
-  printf ("\n[NASRG-MEAS] **************  MT  Measurement Report Message   *****************\n");
-
-  switch (type) {
-  case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT: {
-    struct rrc_rrm_meas_report_mt_if *p;
-    p = (struct rrc_rrm_meas_report_mt_if *)rrc_rrm_meas_payload;
-    printf ("Intra Frequency Measurement\t Number of cells: %d\n", p->if_num_cells);
-
-    for (i = 0; i < p->if_num_cells; i++) {
-      printf ("[NASRG-MEAS] Cell number: %d\tCell Identity: %d\tCell Parameters Id: %d\tP-CCPCH RSCP: %d\tPathloss: %d\n", i, p->if_cell_id[i], p->if_cell_parms_id[i], p->if_BCH_RSCP[i], p->if_pathloss[i]);
-      printf ("\tTimeslot ISCP for each slot:\t");
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->if_slot_iscp[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT: {
-    struct rrc_rrm_meas_report_mt_tv *p;
-    p = (struct rrc_rrm_meas_report_mt_tv *)rrc_rrm_meas_payload;
-    printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
-
-    for (i = 0; i < p->tv_num_rbs; i++)
-      printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
-              p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT: {
-    struct rrc_rrm_meas_report_mt_q *p;
-    p = (struct rrc_rrm_meas_report_mt_q *)rrc_rrm_meas_payload;
-    printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
-    printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
-
-    for (i = 0; i < p->q_num_TrCH; i++)
-      printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
-
-    printf ("\n");
-    printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
-
-    for (i = 0; i < p->q_num_tfcs; i++) {
-      printf ("%d: ", p->q_tfcs_id[i]);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d, ", p->q_sir[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT: {
-    struct rrc_rrm_meas_report_mt_int *p;
-    p = (struct rrc_rrm_meas_report_mt_int *)rrc_rrm_meas_payload;
-    printf ("UE internal Measurement\t Timing Advance: %d\n", p->int_timing_advance);
-    printf ("[NASRG-MEAS] Transmitted Power for each slot:\t");
-
-    for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-      printf ("%d: %d, ", j, p->int_xmit_power[j]);
-
-    printf ("\n");
-  }
-  break;
-  }
-
-  printf ("[NASRG-MEAS] *****END*********    Measurement Report Message   *******\n\n");
-}
-
-//-----------------------------------------------------------------------------
-void nasrg_print_bs_meas_report (char *rrc_rrm_meas_payload, uint16_t type)
-{
-  //-----------------------------------------------------------------------------
-  int i, j;
-  char *payload[20] =
-  { "pl0", "pl4", "pl8", "pl16", "pl32", "pl64", "pl128", "pl256", "pl512", "pl1024", "pl2k", "pl4k", "pl8k", "pl16k", "pl32k", "pl64k", "pl128k", "pl256k", "pl512k", "pl1024k" };
-  char *average[20] = {
-    "pla0", "pla4", "pla8", "pla16", "pla32", "pla64", "pla128", "pla256", "pla512", "pla1024", "pla2k",
-    "pla4k", "pla8k", "pla16k", "pla32k", "pla64k", "pla128k", "pla256k", "pla512k", "pla1024k"
-  };
-  char *variance[14] = { "plv0", "plv4", "plv8", "plv16", "plv32", "plv64", "plv128", "plv256", "plv512", "plv1024", "plv2k", "plv4k", "plv8k", "plv16k" };
-
-  printf ("\n[NASRG-MEAS] **************  BS  Measurement Report Message   *****************\n");
-
-  switch (type) {
-  case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT: {
-    struct rrc_rrm_meas_report_bs_tv *p;
-    p = (struct rrc_rrm_meas_report_bs_tv *)rrc_rrm_meas_payload;
-    printf ("Traffic Volume Measurement -\t Number of RBs: %d\n", p->tv_num_rbs);
-
-    for (i = 0; i < p->tv_num_rbs; i++)
-      printf ("[NASRG-MEAS] RB_Id : %d\t, RLC_BufferPayload : %s\t, Average : %s\t, Variance : %s\n",
-              p->tv_rbid[i], payload[p->tv_rb_payload[i]], average[p->tv_rb_average[i]], variance[p->tv_rb_variance[i]]);
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT: {
-    struct rrc_rrm_meas_report_bs_q *p;
-    p = (struct rrc_rrm_meas_report_bs_q *)rrc_rrm_meas_payload;
-    printf ("Quality Measurement -\t Number of Transport Channels : %d, Number of TFCS : %d\n", p->q_num_TrCH, p->q_num_tfcs);
-    printf ("[NASRG-MEAS] BLER for each Transport Channel:\t");
-
-    for (i = 0; i < p->q_num_TrCH; i++)
-      printf ("%d: %d, ", p->q_dl_TrCH_id[i], p->q_dl_TrCH_BLER[i]);
-
-    printf ("\n");
-    printf ("[NASRG-MEAS] SIR for each TFCS for each slot:\n");
-
-    for (i = 0; i < p->q_num_tfcs; i++) {
-      printf ("%d: ", p->q_tfcs_id[i]);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d, ", p->q_sir[i][j]);
-
-      printf ("\n");
-    }
-  }
-  break;
-
-  case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT: {
-    struct rrc_rrm_meas_report_bs_int *p;
-    p = (struct rrc_rrm_meas_report_bs_int *)rrc_rrm_meas_payload;
-    printf ("BS internal Measurement\n");
-
-    for (i = 0; i < numANTENNAS; i++) {
-      printf ("[NASRG-MEAS] Transmitted Power for each slot on antenna %d :  ", i);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->int_xmit_power[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < JRRM_SLOTS_PER_FRAME; i++) {
-      printf ("[NASRG-MEAS] RSCP for each channel on slot %d :  ", i);
-
-      for (j = 0; j < MAXCH; j++)
-        printf ("%d: %d, ", j, p->int_rscp[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < numANTENNAS; i++) {
-      printf ("[NASRG-MEAS] RSSI RF for each slot on antenna %d :  ", i);
-
-      for (j = 0; j < JRRM_SLOTS_PER_FRAME; j++)
-        printf ("%d: %d, ", j, p->int_rssi_rf[i][j]);
-
-      printf ("\n");
-    }
-
-    for (i = 0; i < NUMSPARE; i++) {
-      printf ("[NASRG-MEAS] Spare value : %d: %d\n", i, p->int_spare[i]);
-    }
-  }
-  break;
-  }
-
-  printf ("[NASRG-MEAS] *****END*********    Measurement Report Message   *******\n\n");
-}
-
diff --git a/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c b/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c
deleted file mode 100644
index e9cefdd926..0000000000
--- a/openair2/NAS/SIMU_CELLULAR/rrm_fifo_standalone.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <errno.h>
-#include <sys/time.h>
-#include <ctype.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-//
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-//-----------------------------------------------------------------------------
-#include "openair_types.h"
-#include "rrc_constant.h"
-#include "nas_simu_proto.h"
-
-#include "rrc_rrm_sap.h"
-#include "rrc_msg_constant.h"
-#include "rrc_rrm_primitives.h"
-
-void nasrg_meas_q_setup (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control);
-void nasrg_meas_q_release (int UE_Id, struct rrc_rrm_measure_ctl *rrm_control);
-void nasrg_send_meas_request_to_rrc (int ue_id, struct rrc_rrm_measure_ctl *rrm_control);
-//-----------------------------------------------------------------------------
-int  rrc_rg_rrm_in_fifo;
-int  rrc_rg_rrm_out_fifo;
-int  tXmit_id;
-#define RRM_MSG_MAX_LENGTH 1500
-struct rrc_rrm_measure_ctl control;
-
-//-----------------------------------------------------------------------------
-// Open FIFOs for RG RRC SAPs
-void nasrg_rrm_fifos_init (void)
-{
-  //-----------------------------------------------------------------------------
-  int write_flag = O_WRONLY | O_NONBLOCK | O_NDELAY;
-  int read_flag = O_RDONLY | O_NONBLOCK | O_NDELAY;
-
-  // Open FIFOs
-
-  while ((rrc_rg_rrm_in_fifo = open (RRM_INPUT_SAPI, write_flag)) < 0) {
-    printf ("%s returned value %d\n", RRM_INPUT_SAPI, rrc_rg_rrm_in_fifo);
-    fflush(stdout);
-    sleep (1);
-  }
-
-  while ((rrc_rg_rrm_out_fifo = open (RRM_OUTPUT_SAPI, read_flag)) < 0) {
-    printf ("%s returned value %d\n", RRM_OUTPUT_SAPI, rrc_rg_rrm_out_fifo);
-    fflush(stdout);
-    sleep (1);
-  }
-
-  printf ("FIFO RRM_INPUT_SAPI, %d\n", rrc_rg_rrm_in_fifo);
-  printf ("FIFO RRM_OUTPUT_SAPI, %d\n", rrc_rg_rrm_out_fifo);
-}
-
-//-------------------------------------------------------------------
-void rrm_connection_response (void)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  connection_response response;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  printf ("[CELL-RRM] RPC_CONNECTION_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_CONNECTION_RESPONSE;
-  rpc_mess.length = sizeof (connection_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.status = STATUS_CONNECTION_ACCEPTED;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (connection_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_add_user_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  add_user_response response;
-  add_user_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (add_user_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_ADD_USER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_ADD_USER_RESPONSE;
-  rpc_mess.length = sizeof (add_user_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.user_id = request->user_id;
-  response.tx_id = request->tx_id;
-  response.status = ADD_USER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_user_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_remove_user_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  remove_user_response response;
-  remove_user_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (remove_user_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_REMOVE_USER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_REMOVE_USER_RESPONSE;
-  rpc_mess.length = sizeof (remove_user_response)+ strlen (sim_data);
-  response.equipment_id = 0;
-  response.user_id = request->user_id;
-  response.tx_id = request->tx_id;
-  response.status = REMOVE_USER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_user_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-  /* Not sure it is really needed here
-  usleep (5000); //wait 5ms
-  // stop q measurement for MT
-  nasrg_meas_q_release (UE_Id, &control);
-  nasrg_send_meas_request_to_rrc (UE_Id, &control);
-  */
-}
-
-//-------------------------------------------------------------------
-void rrm_add_radio_access_bearer_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  add_radio_access_bearer_response response;
-  add_radio_access_bearer_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (add_radio_access_bearer_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_ADD_RADIO_ACCESS_BEARER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_ADD_RADIO_ACCESS_BEARER_RESPONSE;
-  rpc_mess.length = sizeof (add_radio_access_bearer_response)+ strlen (sim_data);
-  response.user_id = request->user_id;
-  response.rab_id = request->rab_id;
-  response.tx_id = request->tx_id;
-  response.status = ADD_RADIO_ACCESS_BEARER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (add_radio_access_bearer_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-}
-
-//-------------------------------------------------------------------
-void rrm_add_measurement_request (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  add_radio_access_bearer_confirm *confirm;
-
-  confirm = (add_radio_access_bearer_confirm *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_L1_MEASUREMENT_MT_QUALITY_REPORT --> RRC\n ");
-
-  // TEMP removed the Meas request (causes bothe messages to be received together by RRC RG
-  //   usleep (20000); //wait 5ms
-  // setup q measurement for MT
-  nasrg_meas_q_setup (confirm->user_id, &control);
-  nasrg_send_meas_request_to_rrc (confirm->user_id, &control);
-
-}
-
-
-//-------------------------------------------------------------------
-void rrm_remove_radio_access_bearer_response (char *rcve_buffer)
-{
-  //-------------------------------------------------------------------
-  rpc_message     rpc_mess;
-  remove_radio_access_bearer_response response;
-  remove_radio_access_bearer_request *request;
-  int count=0;
-  char *sim_data = "Void configuration\0";
-
-  request = (remove_radio_access_bearer_request *)rcve_buffer;
-  printf ("[CELL-RRM] RPC_REMOVE_RADIO_ACCESS_BEARER_RESPONSE --> RRC\n ");
-  rpc_mess.type = RPC_REMOVE_RADIO_ACCESS_BEARER_RESPONSE;
-  rpc_mess.length = sizeof (remove_radio_access_bearer_response)+ strlen (sim_data);
-  response.user_id = request->user_id;
-  response.rab_id = request->rab_id;
-  response.tx_id = request->tx_id;
-  response.status = REMOVE_RADIO_ACCESS_BEARER_SUCCESSFUL;
-
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  //count = rtf_put (protocol_bs->rrc.rc_rrm.output_fifo, (uint8_t *) & confirm, sizeof (add_user_confirm));
-  count = write(rrc_rg_rrm_in_fifo, (uint8_t *) & rpc_mess, sizeof (rpc_message));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) & response, sizeof (remove_radio_access_bearer_response));
-  count += write(rrc_rg_rrm_in_fifo, (uint8_t *) sim_data, strlen (sim_data));
-
-  if (count > 0) {
-    printf ("RRM message sent successfully on RRM FIFO, length: %d\n", count);
-  } else {
-    printf ("RRM FIFO transmit failed");
-  }
-
-  usleep (20000); //wait 5ms
-  // stop q measurement for MT
-  nasrg_meas_q_release (request->user_id, &control);
-  nasrg_send_meas_request_to_rrc (request->user_id, &control);
-}
-
-
-//-----------------------------------------------------------------------------
-// Check if anything in RRC FIFO and send it to RRM
-void nasrg_rrm_from_rrc_read (void)
-{
-  //-----------------------------------------------------------------------------
-  char rcve_buffer[RRM_MSG_MAX_LENGTH];
-  int  rpc_header_size=0;
-  int  count = 0;
-  rpc_message *rrc_rrm_mess;
-  char *rrc_rrm_meas_payload;
-
-  memset (rcve_buffer, 0, RRM_MSG_MAX_LENGTH - 1);
-  rpc_header_size = sizeof (rpc_message);
-  rrc_rrm_mess = (rpc_message *) rcve_buffer;
-
-  if ((count = read (rrc_rg_rrm_out_fifo, rcve_buffer, rpc_header_size)) > 0) {
-    //printf("\n RRM FIFO %d, bytes count %d", rrc_rg_rrm_out_fifo, count);
-#ifdef DEBUG_RRC_RRM_INTF
-    printf ("\n [DEBUG]Message Received in RRM FIFO %d , length %d, type %d \n", rrc_rg_rrm_out_fifo, rrc_rrm_mess->length, rrc_rrm_mess->type);
-#endif
-    //get the rest of the primitive
-    count += read (rrc_rg_rrm_out_fifo, &(rcve_buffer[rpc_header_size]), rrc_rrm_mess->length );
-
-    switch (rrc_rrm_mess->type) {
-    case RPC_CONNECTION_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_CONNECTION_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_connection_response();
-      break;
-
-    case RPC_ADD_USER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_ADD_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_add_user_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_REMOVE_USER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_REMOVE_USER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_remove_user_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_ADD_RADIO_ACCESS_BEARER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_ADD_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_add_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST:
-      printf ("\n[CELL-RRM]Received RPC_REMOVE_RADIO_ACCESS_BEARER_REQUEST, length %d\n", rrc_rrm_mess->length);
-      rrm_remove_radio_access_bearer_response(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_ADD_USER_CONFIRM:
-      printf ("\n[CELL-RRM]Received RPC RPC_ADD_USER_CONFIRM , length %d\n", rrc_rrm_mess->length);
-      break;
-
-    case RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM:
-      printf ("\n[CELL-RRM]Received RPC RPC_ADD_RADIO_ACCESS_BEARER_CONFIRM , length %d\n", rrc_rrm_mess->length);
-      //rrm_add_measurement_request(&(rcve_buffer[rpc_header_size]));
-      break;
-
-    case RPC_L1_MEASUREMENT_RG_INTERNAL_REPORT:
-    case RPC_L1_MEASUREMENT_RG_QUALITY_REPORT:
-    case RPC_L1_MEASUREMENT_RG_TRAFFIC_VOLUME_REPORT:
-      rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
-      //nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
-      nasrg_print_bs_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
-      break;
-
-    case RPC_L1_MEASUREMENT_MT_INTERNAL_REPORT:
-    case RPC_L1_MEASUREMENT_MT_QUALITY_REPORT:
-    case RPC_L1_MEASUREMENT_MT_TRAFFIC_VOLUME_REPORT:
-    case RPC_L1_MEASUREMENT_MT_INTRA_FREQUENCY_REPORT:
-      rrc_rrm_meas_payload = (char *)rcve_buffer +12; //12 = rpc_header + equipment_id
-      //nas_rg_print_buffer (rrc_rrm_meas_payload, rrc_rrm_mess->length);
-      nasrg_print_meas_report (rrc_rrm_meas_payload,rrc_rrm_mess->type);
-      break;
-
-    default:
-      break;
-    }
-
-    fflush(stdout);
-  }
-}
-
-
-//-----------------------------------------------------------------------------
-int main (int argc, char **argv)
-{
-  //-----------------------------------------------------------------------------
-  int time = 0;
-  //     int rc, sd_rrm;
-  //     fd_set readfds;
-  //     struct timeval tv;
-  tXmit_id =0;
-  nasrg_rrm_fifos_init ();
-  printf ("[RRM] RRM FIFOs ready\n");
-  fflush(stdout);
-
-  while (1) {
-    usleep (100000);
-    time ++;
-    //printf ("\n[RRM_TEST] Simu Measurement Time at Main: %d\n", time);
-
-    // check RRM FIFO
-    nasrg_rrm_from_rrc_read();
-  }
-}
diff --git a/openair2/NETWORK_DRIVER/LITE/Makefile b/openair2/NETWORK_DRIVER/LITE/Makefile
deleted file mode 100755
index 76ba3b5bdb..0000000000
--- a/openair2/NETWORK_DRIVER/LITE/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# NASMESH Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-KERNEL_ARCH:=$(shell echo `uname -m`)
-SET_X64:=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi)
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -I$(OPENAIR2_DIR)/COMMON -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) 
-
-ifdef ADDRCONF
-EXTRA_CFLAGS += -DADDRCONF
-endif
-
-ifdef OAI_NW_DRIVER_TYPE_ETHERNET
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_TYPE_ETHERNET
-endif
-
-ifdef OAI_NW_DRIVER_USE_NETLINK
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ccflags-y= $(CFLAGS) $(EXTRA_CFLAGS)
-CFLAGS=
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += oai_nw_drv.o
-oai_nw_drv-objs += device.o
-oai_nw_drv-objs += common.o
-oai_nw_drv-objs += ioctl.o
-oai_nw_drv-objs += classifier.o
-oai_nw_drv-objs += tool.o
-ifdef OAI_NW_DRIVER_USE_NETLINK
-oai_nw_drv-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-	#make $(x)$(y) PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#oai_nw_drv.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-print:
-	@echo subversion : $(SUBVERSION)
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name .*.o     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NETWORK_DRIVER/LITE/device.c b/openair2/NETWORK_DRIVER/LITE/device.c
index fe60d82c15..854c3bcc99 100644
--- a/openair2/NETWORK_DRIVER/LITE/device.c
+++ b/openair2/NETWORK_DRIVER/LITE/device.c
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // OAI_NW_DRIVER_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
@@ -519,23 +512,12 @@ int init_module (void)
 
 #ifndef OAI_NW_DRIVER_USE_NETLINK
 
-#ifdef RTAI //with RTAI you have to indicate which irq# you want
-
-  pdcp_2_oai_nw_drv_irq=rt_request_srq(0, oai_nw_drv_interrupt, NULL);
-
-#endif
-
   if (pdcp_2_oai_nw_drv_irq == -EBUSY || pdcp_2_oai_nw_drv_irq == -EINVAL) {
     printk("[OAI_IP_DRV][%s] No interrupt resource available\n", __FUNCTION__);
     return -EBUSY;
   } else
     printk("[OAI_IP_DRV][%s] Interrupt %d\n", __FUNCTION__, pdcp_2_oai_nw_drv_irq);
 
-  //rt_startup_irq(RTAI_IRQ);
-
-  //rt_enable_irq(RTAI_IRQ);
-
-
 #endif //NETLINK
 
   for (inst=0; inst<OAI_NW_DRV_NB_INSTANCES_MAX; inst++) {
@@ -601,12 +583,6 @@ void cleanup_module(void)
 
   if (pdcp_2_oai_nw_drv_irq!=-EBUSY) {
     pdcp_2_oai_nw_drv_irq=0;
-#ifdef RTAI
-    // V1
-    //    rt_free_linux_irq(priv->irq, NULL);
-    // END V1
-    rt_free_srq(pdcp_2_oai_nw_drv_irq);
-#endif
     // Start IRQ linux
     //free_irq(priv->irq, NULL);
     // End IRQ linux
diff --git a/openair2/NETWORK_DRIVER/MESH/Makefile b/openair2/NETWORK_DRIVER/MESH/Makefile
deleted file mode 100755
index f4bf87f318..0000000000
--- a/openair2/NETWORK_DRIVER/MESH/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-# NASMESH Driver makefile
-#
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-####################################################
-#      NASMESH compilation flags
-####################################################
-#RTAI=1
-
-####################################################
-#  D E B U G   F L A G S
-####################################################
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-#EXTRA_CFLAGS = -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-EXTRA_CFLAGS += -I$(OPENAIR2_DIR)
-ifdef PDCP_USE_NETLINK
-EXTRA_CFLAGS += -DPDCP_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-ifdef LOOPBACK
-EXTRA_CFLAGS += -DLOOPBACK_TEST
-endif
-
-ifdef ADDRESS_FIX
-EXTRA_CFLAGS += -DNAS_ADDRESS_FIX
-endif
-ifdef NAS_DEBUG_RECEIVE
-EXTRA_CFLAGS += -DNAS_DEBUG_RECEIVE
-endif
-
-ifdef NAS_DEBUG_SEND
-EXTRA_CFLAGS += -DNAS_DEBUG_SEND
-endif
-
-ccflags-y := $(CFLAGS) $(EXTRA_CFLAGS)
-CFLAGS=
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += nasmesh.o
-nasmesh-objs += device.o
-nasmesh-objs += common.o
-nasmesh-objs += ioctl.o
-nasmesh-objs += classifier.o
-nasmesh-objs += tool.o
-nasmesh-objs += mesh.o
-ifdef PDCP_USE_NETLINK
-nasmesh-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-#netlink.ko:
-#	make PDCP_USE_NETLINK=1 V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-#nasmesh.ko:
-#	make  V=1 -C $(KERNEL_DIR) M=`pwd` modules
-
-clean:
-	rm -f $(nasmesh-objs) $(obj-m)
-#	make -C $(KERNEL_DIR) modules
diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c
index 0eb7530ee6..d380b8a4d8 100644
--- a/openair2/NETWORK_DRIVER/MESH/common.c
+++ b/openair2/NETWORK_DRIVER/MESH/common.c
@@ -28,12 +28,8 @@
 * \email: navid.nikaein@eurecom.fr, lionel.gauthier@eurecom.fr
 */
 
-//#include "nas_common.h"
 #include "local.h"
 #include "proto_extern.h"
-#ifdef RTAI
-#include "rtai_fifos.h"
-#endif
 
 //#define NAS_DEBUG_RECEIVE 1
 //#define NAS_DEBUG_SEND 1
diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c
index f9bc592bce..086ec3909c 100644
--- a/openair2/NETWORK_DRIVER/MESH/device.c
+++ b/openair2/NETWORK_DRIVER/MESH/device.c
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef PDCP_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // PDCP_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
@@ -116,6 +109,7 @@ void *nas_interrupt(void)
   printk("INTERRUPT: end\n");
 #endif
   //  return 0;
+  return NULL;
 }
 #endif //NETLINK
 
@@ -449,23 +443,12 @@ int init_module (void)
 
 #ifndef PDCP_USE_NETLINK
 
-#ifdef RTAI //with RTAI you have to indicate which irq# you want
-
-  pdcp_2_nas_irq=rt_request_srq(0, nas_interrupt, NULL);
-
-#endif
-
   if (pdcp_2_nas_irq == -EBUSY || pdcp_2_nas_irq == -EINVAL) {
     printk("[NAS][INIT] No interrupt resource available\n");
     return -EBUSY;
   } else
     printk("[NAS][INIT]: Interrupt %d\n", pdcp_2_nas_irq);
 
-  //rt_startup_irq(RTAI_IRQ);
-
-  //rt_enable_irq(RTAI_IRQ);
-
-
 #endif //NETLINK
 
   for (inst=0; inst<NB_INSTANCES_MAX; inst++) {
@@ -529,12 +512,6 @@ void cleanup_module(void)
 
   if (pdcp_2_nas_irq!=-EBUSY) {
     pdcp_2_nas_irq=0;
-#ifdef RTAI
-    // V1
-    //    rt_free_linux_irq(priv->irq, NULL);
-    // END V1
-    rt_free_srq(pdcp_2_nas_irq);
-#endif
     // Start IRQ linux
     //    free_irq(priv->irq, NULL);
     // End IRQ linux
diff --git a/openair2/NETWORK_DRIVER/UE_IP/Makefile b/openair2/NETWORK_DRIVER/UE_IP/Makefile
deleted file mode 100755
index fbcf85fabb..0000000000
--- a/openair2/NETWORK_DRIVER/UE_IP/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# UE IP Driver makefile
-#
-NAS_UPDIR	:= $(shell /bin/pwd)
-
-KERNEL_ARCH=$(shell echo `uname -m`)
-SET_X64=$(shell if [ $(KERNEL_ARCH) = 'x86_64' ]; then echo true ; fi)
-
-####################################################
-#      EXTRA COMPILER FLAGS
-####################################################
-EXTRA_CFLAGS = -I$(OPENAIR2_DIR)/COMMON -fno-common -fno-stack-protector -mpreferred-stack-boundary=4 $(if $(SET_X64),-DARCH_64,) $(if $(SET_X64),-mcmodel=kernel,) $(if $(SET_X64),-m64,) 
-
-
-
-ifdef OAI_NW_DRIVER_USE_NETLINK
-EXTRA_CFLAGS += -DOAI_NW_DRIVER_USE_NETLINK
-else
-EXTRA_CFLAGS += $(shell rtai-config --module-cflags) -DRTAI -D__IN_RTAI__ -Wall
-endif
-
-
-####################################################
-#      LOADABLE MODULE GOALS
-####################################################
-obj-m += ue_ip.o
-ue_ip-objs += device.o
-ue_ip-objs += common.o
-ifdef OAI_NW_DRIVER_USE_NETLINK
-ue_ip-objs += netlink.o
-endif
-
-####################################################
-#      REVOIR LE CLEAN
-####################################################
-
-
-print:
-	@echo SET_X64             : $(SET_X64)
-
-clean:
-	rm -f *.ko
-	rm -f .*.ko.cmd
-	rm -f .*.o.cmd
-	rm -f *.o
-	rm -f *.mod.c
-	find . -name *.ko     -delete
-	find . -name .*.o     -delete
-	find . -name *.o      -delete
-	find . -name *.mod.c  -delete
diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c
index a4398e9d9e..29db4ae07a 100644
--- a/openair2/NETWORK_DRIVER/UE_IP/device.c
+++ b/openair2/NETWORK_DRIVER/UE_IP/device.c
@@ -28,13 +28,6 @@
 */
 /*******************************************************************************/
 
-#ifndef OAI_NW_DRIVER_USE_NETLINK
-#ifdef RTAI
-#include "rtai_posix.h"
-#define RTAI_IRQ 30 //try to get this irq with RTAI
-#endif // RTAI
-#endif // OAI_NW_DRIVER_USE_NETLINK
-
 #include "constant.h"
 #include "local.h"
 #include "proto_extern.h"
diff --git a/openair2/RRC/LITE/MESSAGES/Makefile b/openair2/RRC/LITE/MESSAGES/Makefile
deleted file mode 100644
index bd99081ad2..0000000000
--- a/openair2/RRC/LITE/MESSAGES/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-OPENAIR2_TOP = ../../..
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-
-EXTRA_CFLAGS += -I$(OPENAIR1_DIR) -I/usr/realtime/include -D__need_Emath -D__NO_ASSERT_H__ 
-
-ifdef RTAI
-# Get the RTAI variables
-CCC = $(shell rtai-config --cc)
-RTAI_SUBVERSION=$(shell rtai-config --version | sed -e 's/^..\(.\).*$$/\1/')
-IS_RTAI_SUBVERSION_LESS_THAN_FIVE=$(shell if [ $(RTAI_SUBVERSION) -lt 5 ] ; then echo true ; fi)
-
-EXTRA_CFLAGS += -D__IN_RTAI__ $(shell rtai-config --module-cflags) -g -march=pentium4 -DNODE_RG -DBIGPHYSAREA -DRTAI -DRTAI_ENABLED -fno-stack-protector -DHW_PREFIX_REMOVAL -Wall -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DWIDENS_DLC -I$(KERNEL_DIR)/build/include -I$(KERNEL_DIR)/build/include/asm/mach-default -include $(KERNEL_DIR)/build/include/linux/autoconf.h $(if $(IS_RTAI_SUBVERSION_LESS_THAN_FIVE),-DRTAI_ISNT_POSIX,)
-endif
-
-
-obj-m = asn1_msg_kern.o
-asn1_msg_kern-objs = $(ASN1_CONVERTER_OBJS) $(ASN1_MODULE_OBJS) bsearch.o rtai_mem.o
-
-clean:
-	rm -rf $(asn1_msg_kern-objs) $(obj-m)
-
-test:
-	echo $(asn1_msg_kern-objs) $(obj-m)
-
-regen: regenerate-from-asn1-source
-
-regenerate-from-asn1-source:
-	asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy asn1c/ASN1_files/EUTRA-RRC-Definitions.asn
-
diff --git a/openair2/RRC/LITE/MESSAGES/rtai_mem.c b/openair2/RRC/LITE/MESSAGES/rtai_mem.c
deleted file mode 100644
index c522a1f0bf..0000000000
--- a/openair2/RRC/LITE/MESSAGES/rtai_mem.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file rtai_mem.c
-* \brief a wrapper for Unified RTAI real-time memory management.
-* \author Florian Kaltenberger
-* \date 2011-04-06
-* \version 0.1
-* \company Eurecom
-* \email: florian.kaltenberger@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-
-#include <asm/io.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/delay.h>
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-
-#include <linux/slab.h>
-//#include <linux/config.h>
-#include <linux/version.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-
-#include <linux/errno.h>
-
-#include <linux/slab.h>
-
-#include <asm/rtai.h>
-#include <rtai.h>
-#include <rtai_shm.h>
-#include <rtai_malloc.h>
-
-/*
-void* rt_alloc_wrapper(int size) {
-
-  unsigned long* tmp_ptr;
-  static unsigned long name = 0;
-
-  rt_shm_free(name);
-  tmp_ptr = (unsigned long*) rt_shm_alloc(name,size+sizeof(unsigned long),GFP_KERNEL);
-
-  if (!tmp_ptr) {
-    printk("rt_mem.c: failed to allocate %d bytes for name %ld at %p\n",size,name,tmp_ptr);
-    return NULL;
-  }
-
-  printk("rt_mem.c: allocated %d bytes for name %ld at %p\n",size,name,tmp_ptr+1);
-
-  tmp_ptr[0] = name;
-  name++;
-
-  return (void*) (tmp_ptr+1);
-
-}
-
-int rt_free_wrapper(void* ptr) {
-
-  unsigned long name;
-
-  printk("rt_mem.c: freeing memory at %p, ",ptr);
-
-  name = *(((unsigned long*) ptr)-1);
-
-  printk("name %ld\n",name);
-
-  return rt_shm_free(name);
-
-}
-
-void* rt_realloc_wrapper(void* oldptr, int size) {
-
-  void* newptr;
-
-  printk("rt_mem.c: reallocating %p with %d bytes\n",oldptr,size);
-
-  if (oldptr==NULL)
-    newptr = rt_alloc_wrapper(size);
-  else {
-    newptr = rt_alloc_wrapper(size);
-    memcpy(newptr,oldptr,size);
-    rt_free_wrapper(oldptr);
-  }
-
-  return newptr;
-}
-*/
-
-void* rt_realloc(void* oldptr, int size)
-{
-
-  void* newptr;
-
-  printk("rt_mem.c: reallocating %p with %d bytes\n",oldptr,size);
-
-  if (oldptr==NULL) {
-    newptr = rt_malloc(size);
-  } else {
-    newptr = rt_malloc(size);
-    memcpy(newptr,oldptr,size);
-    rt_free(oldptr);
-  }
-
-  return newptr;
-}
-
-void* rt_calloc(int nmemb, int size)
-{
-
-  void* newptr;
-
-  printk("rt_mem.c: allocating %d elements with %d bytes\n",nmemb,size);
-
-  newptr = rt_malloc(nmemb*size);
-  memset(newptr,0,nmemb*size);
-
-  return newptr;
-}
diff --git a/openair2/RRC/LITE/MESSAGES/rtai_mem.h b/openair2/RRC/LITE/MESSAGES/rtai_mem.h
deleted file mode 100644
index 9efc24851f..0000000000
--- a/openair2/RRC/LITE/MESSAGES/rtai_mem.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file rtai_mem.h
-* \brief a wrapper for Unified RTAI real-time memory management.
-* \author Florian Kaltenberger
-* \date 2011-04-06
-* \version 0.1
-* \company Eurecom
-* \email: florian.kaltenberger@eurecom.fr
-* \note
-* \bug
-* \warning
-*/
-
-/*
-void* rt_alloc_wrapper(int size);
-
-int rt_free_wrapper(void* ptr);
-
-void* rt_realloc_wrapper(void* oldptr, int size);
-*/
-
-void* rt_realloc(void* oldptr, int size);
-
-void* rt_calloc(int nmemb, int size);
diff --git a/openair2/RRC/LITE/mesh_top.c b/openair2/RRC/LITE/mesh_top.c
deleted file mode 100644
index a2b4e0f7d0..0000000000
--- a/openair2/RRC/LITE/mesh_top.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*________________________openair_rrc_top.c________________________
-
- Authors : Hicham Anouar
- Company : EURECOM
- Emails  : anouar@eurecom.fr
-________________________________________________________________*/
-
-
-#include "defs.h"
-#include "vars.h"
-
-extern MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE*);
-extern int mac_rrc_unregister(RRC_XFACE *);
-
-extern void *bigphys_malloc(int);
-
-
-
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index bae76203c6..d66025301f 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -62,10 +62,6 @@
 #include "TDD-Config.h"
 #include "UECapabilityEnquiry.h"
 #include "UE-CapabilityRequest.h"
-#ifdef PHY_ABSTRACTION
-#include "OCG.h"
-#include "OCG_extern.h"
-#endif
 #include "RRC/NAS/nas_config.h"
 #include "RRC/NAS/rb_config.h"
 #if ENABLE_RAL
@@ -728,13 +724,8 @@ rrc_ue_establish_drb(
    */
 #ifdef PDCP_USE_NETLINK
 #   if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
-#    ifdef OAI_EMU
-  ip_addr_offset3 = oai_emulation.info.nb_enb_local;
-  ip_addr_offset4 = NB_eNB_INST;
-#    else
   ip_addr_offset3 = 0;
   ip_addr_offset4 = 8;
-#    endif
   LOG_I(OIP,"[UE %d] trying to bring up the OAI interface oai%d, IP 10.0.%d.%d\n", ue_mod_idP, ip_addr_offset3+ue_mod_idP,
         ip_addr_offset3+ue_mod_idP+1,ip_addr_offset4+ue_mod_idP+1);
   oip_ifup=nas_config(ip_addr_offset3+ue_mod_idP,   // interface_id
@@ -742,9 +733,6 @@ rrc_ue_establish_drb(
                       ip_addr_offset4+ue_mod_idP+1); // fourth_octet
 
   if (oip_ifup == 0 ) { // interface is up --> send a config the DRB
-#        ifdef OAI_EMU
-    oai_emulation.info.oai_ifup[ue_mod_idP]=1;
-#        endif
     LOG_I(OIP,"[UE %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
           ue_mod_idP,
           ip_addr_offset3+ue_mod_idP,
@@ -760,10 +748,6 @@ rrc_ue_establish_drb(
     LOG_D(RRC,"[UE %d] State = Attached (eNB %d)\n",ue_mod_idP,eNB_index);
   }
 
-#    else
-#        ifdef OAI_EMU
-  oai_emulation.info.oai_ifup[ue_mod_idP]=1;
-#        endif
 #    endif
 #endif
 
@@ -1538,17 +1522,6 @@ rrc_ue_process_radioResourceConfigDedicated(
   
   UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_CONNECTED;
   LOG_I(RRC,"[UE %d] State = RRC_CONNECTED (eNB %d)\n",ctxt_pP->module_id,eNB_index);
-#if !defined(ENABLE_USE_MME) && defined(OAI_EMU)
-#    ifdef OAI_EMU
-  rrc_eNB_emulation_notify_ue_module_id(
-    ctxt_pP->module_id,
-    ctxt_pP->rnti,
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[0],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[1],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[2],
-    UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->cellAccessRelatedInfo.cellIdentity.buf[3]);
-#    endif /* OAI_EMU */
-#endif
 }
 
 
diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c
index e4c162d5f7..5a127fdfd7 100644
--- a/openair2/RRC/LITE/rrc_eNB.c
+++ b/openair2/RRC/LITE/rrc_eNB.c
@@ -796,14 +796,6 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
      *  in order to allow the UE to perform the NAS recovery
      *  procedure, see TS 23.401 [17].
      */
-#else
-#if defined(OAI_EMU)
-    AssertFatal(ue_context_pP->local_uid < NUMBER_OF_UE_MAX, "local_uid invalid (%d<%d) for UE %x!", ue_context_pP->local_uid, NUMBER_OF_UE_MAX, rnti);
-    ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid];
-    AssertFatal(ue_module_id < NUMBER_OF_UE_MAX, "ue_module_id invalid (%d<%d) for UE %x!", ue_module_id, NUMBER_OF_UE_MAX, rnti);
-    oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid] = -1;
-    oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI;
-#endif
 #endif
 
     rrc_mac_remove_ue(enb_mod_idP,rnti);
@@ -3559,12 +3551,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                        ctxt_pP->module_id + 1);  // fourth octet
 
           if (oip_ifup == 0) {    // interface is up --> send a config the DRB
-#      ifdef OAI_EMU
-            oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1;
-            dest_ip_offset = NB_eNB_INST;
-#      else
             dest_ip_offset = 8;
-#      endif
             LOG_I(OIP,
                   "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n",
                   ctxt_pP->module_id, ctxt_pP->module_id,
@@ -3581,10 +3568,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
                   ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id);
           }
 
-#   else
-#      ifdef OAI_EMU
-          oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1;
-#      endif
 #   endif
 #endif
 
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
index 887ce5bff6..2c66f79521 100644
--- a/openair2/UTIL/LOG/log.c
+++ b/openair2/UTIL/LOG/log.c
@@ -44,13 +44,6 @@
 
 # include <pthread.h>
 # include <string.h>
-#ifdef RTAI
-# include <rtai.h>
-# include <rtai_fifos.h>
-#    define FIFO_PRINTF_MAX_STRING_SIZE 1000
-#    define FIFO_PRINTF_NO              62
-#    define FIFO_PRINTF_SIZE            65536
-#endif
 #include "common/config/config_userapi.h"
 // main log variables
 log_t *g_log;
@@ -90,9 +83,7 @@ int log_list_head = 0;
 int log_shutdown;
 #endif
 
-#ifndef RTAI
 static int gfd;
-#endif
 
 static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_ORANGE, LOG_BLUE, "", ""};  /*!< \brief Optional start-format strings for highlighting */
 static char *log_level_highlight_end[]   = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET,LOG_RESET,  "",""};   /*!< \brief Optional end-format strings for highlighting */
@@ -162,9 +153,7 @@ void  log_getconfig(log_t *g_log) {
 
 int logInit (void)
 {
-#ifndef RTAI
   int i;
-#endif
   g_log = calloc(1, sizeof(log_t));
 
   if (g_log == NULL) {
@@ -473,7 +462,6 @@ int logInit (void)
   g_log->level  = LOG_TRACE;
   g_log->flag   = LOG_LOW;
 
-#ifndef RTAI
   g_log->config.remote_ip      = 0;
   g_log->config.remote_level   = LOG_EMERG;
   g_log->config.facility       = LOG_LOCAL7;
@@ -501,12 +489,6 @@ int logInit (void)
     }
   }
 
-#else
-  g_log->syslog = 0;
-  g_log->filelog   = 0;
-  rtf_create (FIFO_PRINTF_NO, FIFO_PRINTF_SIZE);
-#endif
-
   printf("log init done\n");
 
   return 0;
@@ -634,23 +616,9 @@ void logRecord_thread_safe(const char *file, const char *func,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
-#ifdef RTAI
-
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-    if (len > 0) {
-      rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-    }
-
-#else
     fprintf(stdout, "%s", log_buffer);
-#endif
   }
 
-#ifndef RTAI
-
   if (g_log->syslog) {
     syslog(g_log->level, "%s", log_buffer);
   }
@@ -667,8 +635,6 @@ void logRecord_thread_safe(const char *file, const char *func,
     }
   }
 
-#endif
-
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
                                           VCD_FUNCTION_OUT);
 }
@@ -818,20 +784,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-#ifdef RTAI
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-  if (len > 0) {
-    rtf_put (FIFO_PRINTF_NO, c->log_buffer, len);
-  }
-
-#else
     fwrite(c->log_buffer, len, 1, stdout);
-#endif
-
-#ifndef RTAI
 
   if (g_log->syslog) {
     syslog(g_log->level, "%s", c->log_buffer);
@@ -849,15 +802,6 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
     }
   }
 
-#else
-
-  // online print messges
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    printf(c->log_buffer);
-  }
-
-#endif
-
 #if defined(ENABLE_ITTI)
 
   if (level <= LOG_DEBUG) {
@@ -1116,20 +1060,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
 
   // OAI printf compatibility
   if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-#ifdef RTAI
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-  if (len > 0) {
-    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-  }
-
-#else
     fwrite(log_buffer, len, 1, stdout);
-#endif
-
-#ifndef RTAI
 
   if (g_log->syslog) {
     syslog(g_log->level, "%s", log_buffer);
@@ -1147,15 +1078,6 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
     }
   }
 
-#else
-
-  // online print messges
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    printf(log_buffer);
-  }
-
-#endif
-
 #if defined(ENABLE_ITTI)
 
   if (level <= LOG_DEBUG) {
@@ -1382,16 +1304,11 @@ void set_component_filelog(int comp)
 {
   if (g_log->log_component[comp].filelog ==  0) {
     g_log->log_component[comp].filelog =  1;
-#ifndef RTAI
 
     if (g_log->log_component[comp].fd == 0) {
       g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name,
                                            O_WRONLY | O_CREAT | O_TRUNC, 0666);
     }
-
-#else
-
-#endif
   }
 }
 
@@ -1447,9 +1364,6 @@ int is_newline( char *str, int size)
 
 void logClean (void)
 {
-#ifdef RTAI
-  rtf_destroy (FIFO_PRINTF_NO);
-#else
   int i;
 
   if (g_log->syslog) {
@@ -1465,9 +1379,6 @@ void logClean (void)
       close(g_log->log_component[i].fd);
     }
   }
-
-#endif
-
 }
 
 #if defined(ENABLE_ITTI)
diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c
index e0c20f9243..a9b91f3226 100644
--- a/openair2/UTIL/LOG/vcd_signal_dumper.c
+++ b/openair2/UTIL/LOG/vcd_signal_dumper.c
@@ -48,10 +48,6 @@
 
 #include "vcd_signal_dumper.h"
 
-#if defined(ENABLE_RTAI_CLOCK)
-#include "rtai_lxrt.h"
-#endif
-
 #define VCDSIGNALDUMPER_VERSION_MAJOR 0
 #define VCDSIGNALDUMPER_VERSION_MINOR 1
 
@@ -412,8 +408,6 @@ static inline unsigned long long int vcd_get_time(void);
 
 #if defined(ENABLE_USE_CPU_EXECUTION_TIME)
 struct timespec     g_time_start;
-#elif defined(ENABLE_RTAI_CLOCK)
-RTIME start;
 #endif
 
 
@@ -609,8 +603,6 @@ void vcd_signal_dumper_init(char *filename)
 
 #if defined(ENABLE_USE_CPU_EXECUTION_TIME)
     clock_gettime(CLOCK_MONOTONIC, &g_time_start);
-#elif defined(ENABLE_RTAI_CLOCK)
-    start=rt_get_time_ns();
 #endif
 
     vcd_signal_dumper_create_header();
@@ -663,9 +655,6 @@ static inline void vcd_signal_dumper_print_time_since_start(void)
     secondsSinceStart     = (long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec;
     /* Write time in nanoseconds */
     fprintf(vcd_fd, "#%llu\n", nanosecondsSinceStart + (secondsSinceStart * 1000000000UL));
-#elif defined(ENABLE_RTAI_CLOCK)
-    /* Write time in nanoseconds */
-    fprintf(vcd_fd, "#%llu\n",rt_get_time_ns()-start);
 #endif
   }
 }
@@ -679,8 +668,6 @@ static inline unsigned long long int vcd_get_time(void)
 
   return (long long unsigned int)((time.tv_nsec - g_time_start.tv_nsec)) +
          ((long long unsigned int)time.tv_sec - (long long unsigned int)g_time_start.tv_sec) * 1000000000UL;
-#elif defined(ENABLE_RTAI_CLOCK)
-  return rt_get_time_ns() - start;
 #endif
 }
 
diff --git a/openair2/UTIL/MATH/taus.c b/openair2/UTIL/MATH/taus.c
index 6e0fd84e66..632b1544dd 100644
--- a/openair2/UTIL/MATH/taus.c
+++ b/openair2/UTIL/MATH/taus.c
@@ -29,21 +29,12 @@
 * @ingroup util
 */
 
-#ifndef RTAI_ENABLED
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <math.h>
 #include "oml.h"
-#else
-#include <asm/io.h>
-#include <asm/rtai.h>
-#include <rtai.h>
-#include <rtai_sched.h>
-#define time(x) (unsigned int)(rt_get_time_ns())
-#endif
-
 
 unsigned int s0[MAX_NUM_COMPS], s1[MAX_NUM_COMPS], s2[MAX_NUM_COMPS], b[MAX_NUM_COMPS], r[MAX_NUM_COMPS];
 
diff --git a/openair2/UTIL/OCG/makefile b/openair2/UTIL/OCG/makefile
index da28c888d4..578c2006cb 100644
--- a/openair2/UTIL/OCG/makefile
+++ b/openair2/UTIL/OCG/makefile
@@ -22,8 +22,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 #ifdef OCG
 CFLAGS += -I/usr/include/libxml2 -lxml2
 #endif
diff --git a/openair2/UTIL/OMG/makefile b/openair2/UTIL/OMG/makefile
index 1fb0f3efd9..1aa3d2d451 100644
--- a/openair2/UTIL/OMG/makefile
+++ b/openair2/UTIL/OMG/makefile
@@ -75,8 +75,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/openair2/UTIL/OMG/makefile_old b/openair2/UTIL/OMG/makefile_old
index 06d4a6f46f..aa622f8522 100644
--- a/openair2/UTIL/OMG/makefile_old
+++ b/openair2/UTIL/OMG/makefile_old
@@ -77,8 +77,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index 711436d2cd..ebc52bb1e0 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -410,18 +410,8 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
   /* PCAP Header                                                  */
   /* TODO: Timestamp might want to be relative to a more sensible
      base time... */
-#if defined(RTAI)
-  {
-    unsigned long long int current_ns;
-
-    current_ns = rt_get_time_ns();
-    packet_header.ts_sec  = current_ns / 1000000000UL;
-    packet_header.ts_usec = current_ns % 1000;
-  }
-#else
   packet_header.ts_sec = context->subframesSinceCaptureStart / 1000;
   packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
-#endif
   packet_header.incl_len = offset + length;
   packet_header.orig_len = offset + length;
 
diff --git a/openair2/X2AP/x2ap.h b/openair2/X2AP/x2ap.h
index 65529c7119..89e8540b97 100644
--- a/openair2/X2AP/x2ap.h
+++ b/openair2/X2AP/x2ap.h
@@ -33,10 +33,7 @@
 typedef struct x2ap_config_s {
 } x2ap_config_t;
 
-#if defined(OAI_EMU)
-#else
 extern x2ap_config_t x2ap_config;
-#endif
 
 void *x2ap_task(void *arg);
 
diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c
index 08a18b629e..5b61f4ca79 100644
--- a/openair3/S1AP/s1ap_eNB.c
+++ b/openair3/S1AP/s1ap_eNB.c
@@ -65,10 +65,7 @@
 #include "oaisim_mme_test_s1c.h"
 #endif
 
-
-#if !defined(OAI_EMU)
 s1ap_eNB_config_t s1ap_config;
-#endif
 
 static int s1ap_eNB_generate_s1_setup_request(
   s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p);
diff --git a/openair3/S1AP/s1ap_eNB.h b/openair3/S1AP/s1ap_eNB.h
index 85bf00a4fa..e122703d82 100644
--- a/openair3/S1AP/s1ap_eNB.h
+++ b/openair3/S1AP/s1ap_eNB.h
@@ -35,13 +35,9 @@ typedef struct s1ap_eNB_config_s {
   unsigned char mme_enabled;          ///< MME enabled ?
 } s1ap_eNB_config_t;
 
-#if defined(OAI_EMU)
-# define EPC_MODE_ENABLED       oai_emulation.info.s1ap_config.mme_enabled
-#else
 extern s1ap_eNB_config_t s1ap_config;
 
-# define EPC_MODE_ENABLED       s1ap_config.mme_enabled
-#endif
+#define EPC_MODE_ENABLED       s1ap_config.mme_enabled
 
 void *s1ap_eNB_task(void *arg);
 
diff --git a/targets/Makefile b/targets/Makefile
deleted file mode 100644
index b604898d2a..0000000000
--- a/targets/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-build: 
-	./build_oai.bash -c  -m
-
-build_rtai:
-	./build_oai.bash -c -b -eRTAI -tSOFTMODEM  -m
-
-build_usrp_rtai:
-	./build_oai.bash -c -b -eRTAI -tSOFTMODEM -wUSRP -m
-
-
-help:
-	@echo make check1 performs a simple sanity check
-	@echo make check2 performs another simple sanity check
-	@echo make check does both the above checks
-
-all: help
-
-check1:
-	@echo Doing 1 eNB 1 UE test
-	(cd SIMU/EXAMPLES/VIRT_EMUL_1eNB && make one_eNB_one_UE )
-
-check2:
-	@echo Doing 1 eNB 4 UE test
-	(cd SIMU/EXAMPLES/VIRT_EMUL_1eNB && make one_eNB_four_UE )
-
-install:
-	@echo Generating ASN1 files
-	@sh SCRIPTS/install_asn1.sh 
-
-check: check1 check2
-
-clean:
-	(cd SIMU/USER && make clean)
diff --git a/targets/RT/Makefile b/targets/RT/Makefile
deleted file mode 100644
index 1be49d2db8..0000000000
--- a/targets/RT/Makefile
+++ /dev/null
@@ -1,124 +0,0 @@
-# command line flags are automatically exported and thus passed down to any sub-make. 
-# here we set the default flags in case on command line flags are provided
-# these flags have to be explicitely exported so that the sub-make is aware of them
-
-
-include $(OPENAIR_DIR)/common/utils/Makefile.inc
-ifndef OPENAIR_LTE
-export OPENAIR_LTE=1
-export OPENAIR_EMU=0
-endif
-
-ifndef OPENAIR1
-export OPENAIR1=0
-endif
-
-ifndef OPENAIR2
-export OPENAIR2=0
-endif
-
-ifndef OPENAIR3
-export OPENAIR3=0
-endif
-
-ifndef EMOS
-export EMOS=0
-endif
-
-ifndef rrc_cellular
-export rrc_cellular = 0
-export rrc_cellular_eNB = 0
-export rrc_cellular_UE = 0
-else
- export rrc_cellular = 1	
-  ifeq ($(eNB_flag),1)
-    export rrc_cellular_eNB=1
-  endif
-  ifeq ($(UE_flag),1)
-    export rrc_cellular_UE=1
-  endif
-endif
-
-all: openair_rf_cbmimo1_softmodem.ko asn1_msg_kern.ko nasmesh.ko rb_tool openair_rf scope
-
-openair_rf_cbmimo1_softmodem.ko:  
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-oai_user_cbmimo1.ko:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 BIT8_TX=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-oai_user_exmimo.ko:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) -C $(KERNEL_DIR)/build V=1 M=`pwd` RTAI=1 CBMIMO1=1 OPENAIR1=0 OPENAIR2=0 && mv openair_rf.ko $(CURDIR)/openair_rf_softmodem.ko)
-
-asn1_msg_kern.ko:
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) -C $(KERNEL_DIR)/build V=0 M=`pwd` RTAI=1 -j2 && mv asn1_msg_kern.ko $(CURDIR)/asn1_msg_kern.ko)
-
-nasmesh.ko:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH && $(MAKE) V=1 -C $(KERNEL_DIR)/build M=`pwd` && mv nasmesh.ko $(CURDIR)/nasmesh.ko)
-
-rb_tool:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-
-openair_rf:
-	(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/OPENAIR_RF && $(MAKE) clean CBMIMO1=1 && $(MAKE) all CBMIMO1=1 && $(MAKE) clean CBMIMO1=1)
-
-scope:
-	(cd $(OPENAIR1_DIR)/USERSPACE_TOOLS/SCOPE && $(MAKE) clean && $(MAKE) all && $(MAKE) clean )	
-
-#Remove all but source files
-cleanall: 
-	(cd $(OPENAIR1_DIR) && $(MAKE) cleanall)
-	(cd $(OPENAIR2_DIR) && $(MAKE) cleanall)
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
-
-openair0:
-	mknod /dev/openair0 c 127 0
-	chmod a+rw /dev/openair0
-
-install_oai_user:
-	make fifos
-	insmod openair_rf_softmodem.ko
-
-updatefw:
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-
-boot_exmimo:
-	sudo make install_oai_user
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 
-	sleep 1
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-reboot_exmimo:
-	$(OPENAIR1_DIR)/USERSPACE_TOOLS/OAI_FW_INIT/updatefw -f $$OPENAIR0_DIR/express-mimo/software/sdr/main -s 0x43fffff0 -b
-	sudo rmmod openair_rf
-	sudo make install_oai_user
-
-install_softmodem:
-	make fifos
-ifeq ($(OPENAIR2),1)
-	insmod asn1_msg_kern.ko
-endif
-	insmod openair_rf_softmodem.ko
-
-remove:
-	rmmod openair_rf
-ifeq ($(OPENAIR2),1)
-	rmmod asn1_msg_kern
-endif
-
-test:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) test RTAI=1 CBMIMO1=1)	
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) test)
-
-clean:
-	(cd $(OPENAIR1_DIR)/ARCH/CBMIMO1/DEVICE_DRIVER && $(MAKE) clean RTAI=1 CBMIMO1=1)
-	(cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES && $(MAKE) clean)
diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile
deleted file mode 100644
index ae5e006d06..0000000000
--- a/targets/RT/USER/Makefile
+++ /dev/null
@@ -1,447 +0,0 @@
-# Include some shared directives
-include $(OPENAIR_TARGETS)/Makerules
-
-default: lte-softmodem
-all: lte-softmodem rrh
-
-include $(OPENAIR_TARGETS)/Makefile.common
-
-KERNEL_VERSION:=$(shell echo `uname -r | cut -d. -f-2`)
-KERNEL_TYPE:=$(shell echo `uname -r | cut -d. -f-3 | cut -d- -f3`)
-DEADLINE_SCHEDULER_KERNEL:=$(shell if [ $(KERNEL_TYPE) = "lowlatency" ]; then echo "1" ; else echo "0" ; fi)
-
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-ifdef EXMIMO
-#ifdef DEADLINE_SCHEDULER # this ifdef is to be removed after the debugging
-ifeq ($(DEADLINE_SCHEDULER_KERNEL),1)
-CFLAGS+=-DDEADLINE_SCHEDULER
-endif 
-#endif 
-endif
-
-ifndef USRP
-USRP=0
-endif
-
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/COMMON  -I.
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-
-ifdef DEBUG
-DISABLE_XER_PRINT=0
-MSG_PRINT=1
-endif
-
-ifdef Rel10
-CFLAGS += -DRel10
-endif
-
-ifeq ($(EXMIMO),1)
-  CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
-endif
-
-ifeq ($(ETHERNET),1)
-  CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/ETHERNET/USERSPACE/LIB/ -DETHERNET
-endif
-
-ifeq ($(DEBUG),1)	
-CFLAGS += -g -ggdb
-#CFLAGS += -DRRC_MSG_PRINT
-#CFLAGS += -DPDCP_MSG_PRINT
-else 
-CFLAGS += -O2 
-endif
-
-ifdef ($(MSG_PRINT),1)
-CFLAGS += -DRRC_MSG_PRINT
-CFLAGS += -DPDCP_MSG_PRINT
-endif
-
-SRC = synctest.c condtest.c 
-
-ifndef RTAI
-RTAI=1
-endif
-
-ifeq ($(LOCALIZATION), 1)
-CFLAGS += -DLOCALIZATION
-endif
-
-ifeq ($(LINUX_LIST), 1)
-CFLAGS += -DLINUX_LIST
-endif
-
-ifeq ($(RTAI),1)
-CFLAGS += -DENABLE_RTAI_CLOCK
-CFLAGS += -DCONFIG_RTAI_LXRT_INLINE  #remend the RTAI warning
-RTAI_OBJ = sched_dlsch.o sched_rx_pdsch.o rt_wrapper.o 
-else #RTAI
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-OBJ += sched_dlsch.o sched_rx_pdsch.o rt_wrapper.o
-endif
-
-OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o 
-
-ifeq ($(EXMIMO),1)
-OBJ += $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS 
-endif
-
-CFLAGS += -DENABLE_VCD_FIFO
-
-
-TOP_DIR = $(OPENAIR1_DIR)
-include $(OPENAIR1_DIR)/PHY/Makefile.inc
-include $(OPENAIR1_DIR)/SCHED/Makefile.inc
-
-OBJ += $(PHY_OBJS)
-ifeq ($(RTAI),1)
-RTAI_OBJ += $(SCHED_OBJS)
-else
-OBJ += $(SCHED_OBJS)
-endif
-
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
-include $(OPENAIR2_DIR)/ENB_APP/Makefile.inc
-
-ifeq ($(USRP),1)
-
-include $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/Makefile.inc
-#CFLAGS += -I/opt/include/uhd -L/opt/lib -luhd -lpthread -lstdc++
-CFLAGS += -I/usr/include/uhd -L/usr/lib -luhd -lpthread -lstdc++
-CFLAGS += -DOAI_USRP
-#LDFLAGS += -L/opt/lib -luhd -lpthread -lstdc++ 
-LDFLAGS += -L/usr/lib/ -luhd -lpthread -lstdc++
-endif
-
-ifeq ($(ETHERNET),1)
-include $(OPENAIR_TARGETS)/ARCH/ETHERNET/USERSPACE/LIB/Makefile.inc
-LDFLAGS += -lpthread
-endif
-
-OBJ +=  $(ENB_APP_OBJS)
-
-ifeq ($(RTAI),1)
-CFLAGS += -I/usr/realtime/include -I/usr/realtime/include/asm
-LOG_OBJS=
-RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
-RTAI_OBJ+=$(LOG_DIR)/log.o
-endif
-
-
-OBJ += $(LOG_OBJS) 
-
-ifeq ($(OPENAIR2),1)
-ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
-OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS)  $(OSA_OBJS) $(OPT_OBJS) 
-OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
-#OBJ += $(PDCP_DIR)/pdcp_thread.o
-CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
-endif
-
-#ifdef ENABLE_ITTI
-RTAI_OBJ += $(UTILS_OBJS)
-#else
-#OBJ += $(UTILS_OBJS)
-#endif
-
-ifdef SPECTRA
-CFLAGS += -DSPECTRA
-endif
-
-#ifdef ENABLE_ITTI
-CFLAGS += -DEXMIMO_IOT
-#endif
-
-CFLAGS += $(L2_incl) $(ENB_APP_incl) $(UTIL_incl) $(UTILS_incl)
-
-CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES	#-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM
-
-CFLAGS += -DNEW_FFT -DLOG_NO_THREAD
-
-ifeq ($(XFORMS),1)
-CFLAGS += -DXFORMS -I/usr/include/X11
-LDFLAGS += -lforms
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-OBJ += stats.o
-endif
-
-OBJ_SYNC = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o 
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-CFLAGS += -DPHYSIM -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 
-CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 #-DDLSCH_THREAD #-DULSCH_THREAD
-
-
-ifeq ($(EXMIMO),1)
-CFLAGS += -DEXMIMO
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
-endif
-
-ifeq ($(HARD_RT),1)
-CFLAGS += -DHARD_RT
-endif
-
-ifeq ($(EMOS),1)
-CFLAGS += -D_FILE_OFFSET_BITS=64 #-DEMOS -DEMOS_CHANNEL
-LDFLAGS += -lgps
-endif
-
-
-ifeq ($(LINK_ENB_PDCP_TO_GTPV1U), 1)
-CFLAGS += -DLINK_ENB_PDCP_TO_GTPV1U 
-endif
-
-ifeq ($(LINK_ENB_PDCP_TO_IP_DRIVER), 1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-OBJ += $(NAS_OBJS)
-NAS_FLAG=1
-endif
-
-LDFLAGS += -lpthread -lm -lforms -lconfig -lrt
-ifeq ($(RTAI),1)
-RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags) -DRTAI
-LDFLAGS += $(shell rtai-config --lxrt-ldflags)
-endif
-
-#ifeq ($(USRP),1)
-#CFLAGS += -I/opt/uhd/include -L/opt/uhd/lib -luhd -lpthread -lstdc++
-#CFLAGS += -DOAI_USRP
-#endif
-#CFLAGS += -I/usr/include/c++/4.6 -I/usr/include/c++/4.6/x86_64-linux-gnu -I/usr/include/rtai/
-
-LFDS_OBJ_DIR		 = $(subst $(OPENAIR_DIR),$(OBJS_DIR),$(LFDS_DIR))
-LFDS_LIB		 = $(LFDS_OBJ_DIR)/bin/liblfds611.a
-LIBS 			+= $(LFDS_LIB)
-SHARED_DEPENDENCIES 	+= $(LFDS_LIB)
-
--include $(OBJ:.o=.d)
--include $(ASN1_MSG_OBJS1:.o=.d)
--include $(RTAI_OBJ:.o=.d)
--include lte-softmodem.d
--include lte-ue.d
--include rrh.d
-
-$(LFDS_LIB):
-	@if [ ! -d $(LFDS_OBJ_DIR)/bin ]; then mkdir -p $(LFDS_OBJ_DIR)/bin; fi;
-	@if [ ! -d $(LFDS_OBJ_DIR)/obj ]; then mkdir -p $(LFDS_OBJ_DIR)/obj; fi;
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux OUTDIR=$(LFDS_OBJ_DIR)
-
-ifeq ($(USRP),1)
-$(USRP_OBJ):$(USRP_FILE_OBJ)
-	@echo Compiling $<
-	@$(CXX) -c  -g -ggdb $(USRP_CFLAGS) $(USRP_FILE_OBJ) -o $(USRP_OBJ)
-endif
-
-ifeq ($(ETHERNET),1)
-$(ETHERNET_OBJ):$(ETHERNET_FILE_OBJ)
-	@echo Compiling $<
-	@$(CC) -c -g -ggdb $(ETHERNET_CFLAGS) $(ETHERNET_FILE_OBJ) -o $(ETHERNET_OBJ)
-endif
-
-ifeq ($(RTAI),1)
-$(RTAI_OBJ) lte-softmodem.o lte-ue.o: %.o : %.c
-else
-$(RTAI_OBJ): %.o : %.c
-endif
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.d
-	@mv -f $*.d $*.d.tmp
-	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
-	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
-	@rm -f $*.d.tmp
-
-ifdef ENABLE_ITTI
-$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
-endif
-
-ifeq ($(RTAI),1)
-$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
-else
-$(OBJ) $(ASN1_MSG_OBJS1) lte-softmodem.o lte-ue.o: %.o : %.c
-endif
-
-rrh.o: %.o : %.c
-
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
-	@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $< > $*.d
-	@mv -f $*.d $*.d.tmp
-	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
-	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
-	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
-	@rm -f $*.d.tmp
-
-OBJ_EMOS = $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/gain_control.o rt_wrapper.o $(OPENAIR2_DIR)/UTIL/LOG/log.o $(OPENAIR2_DIR)/UTIL/LOG/vcd_signal_dumper.o $(OPENAIR1_DIR)/PHY/TOOLS/signal_energy.o $(OPENAIR1_DIR)/PHY/TOOLS/dB_routines.o
-ifeq ($(XFORMS),1)
-OBJ_EMOS+=lte_scope.o
-endif
-
-condtest: condtest.c 
-	$(CC) $(CFLAGS) $(LDFLAGS) condtest.c -o condtest
-
-synctest: $(OBJ_SYNC) $(SHARED_DEPENDENCIES) synctest.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_SYNC) -o synctest synctest.c $(LDFLAGS) $(LIBS)
-
-sleeptest: rt_wrapper.o sleeptest.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) rt_wrapper.o -o sleeptest sleeptest.c $(LDFLAGS) 
-
-lte-softmodem: $(OBJ) $(USRP_OBJ) $(ETHERNET_OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) lte-ue.o lte-softmodem.o $(SHARED_DEPENDENCIES)
-	@echo Linking $@
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(USRP_OBJ) $(ETHERNET_OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) lte-ue.o lte-softmodem.o -o lte-softmodem $(LDFLAGS) $(LIBS)
-
-rrh: rrh.o
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) rrh.o -o rrh -lpthread -lrt
-
-emos-raw: $(SHARED_DEPENDENCIES) $(OBJ_EMOS) emos-raw.c
-	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $(OBJ_EMOS) -o emos-raw emos-raw.c $(LDFLAGS) $(LIBS)
-
-
-synctest_eNB: synctest
-	cp synctest synctest_eNB
-
-synctest_UE: synctest
-	cp synctest synctest_UE
-
-drivers:
-#	cd $(OPENAIR2_DIR) && make clean && make nasmesh_netlink.ko
-#	cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make clean && make
-	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom && make clean && make 
-	cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT && make clean && make 
-	cp $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw $(OPENAIR_TARGETS)/bin/.
-
-run: condtest
-	rtai-load condtest --verbose
-
-run_eNB_test: 
-	rtai-load eNB_test --verbose
-
-run_eNB: 
-	rtai-load eNB --verbose
-
-run_UE: 
-	rtai-load UE --verbose
-
-run_UE0:
-	rtai-load UE0 --verbose
-
-run_UE0_smbv:
-	rtai-load UE0_smbv --verbose
-
-run_UE850:
-	rtai-load UE850 --verbose
-
-run_eNB850:
-	rtai-load eNB850 --verbose
-
-run_UE0prach:
-	rtai-load UE0prach --verbose
-
-run_UE1prach:
-	rtai-load UE1prach --verbose
-
-run_UE2prach:
-	rtai-load UE2prach --verbose
-
-run_UE0noL2:
-	rtai-load UE0noL2 -- verbose
-
-run_UE1noL2: 
-	rtai-load UE1noL2 --verbose
-
-run_UE2noL2: 
-	rtai-load UE2noL2 --verbose
-
-run_UE0calib:
-	rtai-load UE0calib --verbose
-
-run_UE0calibmed:
-	rtai-load UE0calibmed --verbose
-
-run_UE0calibbyp:
-	rtai-load UE0calibbyp --verbose
-
-run_UE1: 
-	rtai-load UE1 --verbose
-
-run_UE2: 
-	rtai-load UE2 --verbose
-
-run_eNB0:
-	rtai-load eNB0 --verbose
-
-run_eNB1:
-	rtai-load eNB1 --verbose
-
-run_eNB2:
-	rtai-load eNB2 --verbose
-
-clean: cleanmodem common-clean
-
-cleanmodem:
-	@$(RM_F_V) $(OBJ) $(RTAI_OBJ) $(OBJ_EMOS) $(OBJ_SYNC) $(USRP_OBJ) $(ETHERNET_OBJ)
-	@$(RM_F_V) $(OBJ:.o=.d) $(RTAI_OBJ:.o=.d) $(OBJ_EMOS:.o=.d) $(OBJ_SYNC:.o=.d)
-	@$(RM_F_V) $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.o $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1_msg.d
-	@$(RM_F_V) lte-ue.o lte-ue.d rrh.o rrh.d lte-softmodem.o lte-softmodem.d
-	@$(RM_F_V) rrh.o lte-ue.o lte-softmodem.o
-
-cleanasn1:
-	rm -f $(ASN1_MSG_OBJS1)
-	$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel*
-
-cleancell:
-	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.o
-	rm -f $(OPENAIR2_DIR)/RRC/CELLULAR/*.d
-	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.o
-	rm -f $(OPENAIR2_DIR)/RRC/L2_INTERFACE/*.d
-	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.o
-	rm -f $(OPENAIR2_DIR)/NAS/SIMU_CELLULAR/*.d
-
-cleanalmostall: cleanmodem 
-	rm -f $(ASN1_MSG_OBJS1)
-	rm -rf condtest synctest lte-softmodem rrh
-	rm -rf synctest_eNB synctest_UE
-
-cleanall: common-cleanall clean cleanasn1
-	rm -rf condtest synctest lte-softmodem rrh
-	rm -rf synctest_eNB synctest_UE
-
-show:
-	@echo $(CFLAGS)
-	@echo $(EXTRA_CFLAGS)
-	@echo $(OBJ) $(RTAI_OBJ) 
-	@echo $(USRP_OBJ)
-	@echo $(ETHERNET_OBJ)
-	@echo $(ETHERNET_FILE_OBJ)
-	@echo IS_REL8 is $(IS_REL8)
-	@echo IS_REL10 is $(IS_REL10)
-	@echo openssl $(OPENSSL_FOUND) 
-	@echo nettle $(NETTLE_FOUND)
-	@echo lowlatency kernel: $(DEADLINE_SCHEDULER_KERNEL)
-
-beautiful:
-	astyle --style=gnu -s2 $(SRC)
-
-fifos:
-	@for i in `seq 0 64`;\
-	do \
-	have_rtfX=`ls /dev/ |grep -c rtf$$i`;\
-	if [ "$$have_rtfX" -eq 0 ] ;then \
-	mknod -m 666 /dev/rtf$$i c 150 $$i; \
-	fi;\
-	done
diff --git a/targets/RT/USER/Makefile.agilent b/targets/RT/USER/Makefile.agilent
deleted file mode 100644
index 31dd3b6e7f..0000000000
--- a/targets/RT/USER/Makefile.agilent
+++ /dev/null
@@ -1,243 +0,0 @@
-include $(OPENAIR_TARGETS)/Makerules
-
-include $(OPENAIR_TARGETS)/Makefile.common
-
-CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO -DEXMIMO_IOT
-
-SRC = lte-enb.c
-
-ifndef RTAI
-RTAI=1
-endif
-
-ifeq ($(RTAI),1)
-CFLAGS += -DENABLE_RTAI_CLOCK -DRTAI
-RTAI_OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o 
-else
-OBJ = sched_dlsch.o sched_ulsch.o sched_rx_pdsch.o lte-enb.o rt_wrapper.o
-CFLAGS += -DENABLE_USE_CPU_EXECUTION_TIME
-endif
-
-OBJ += $(OPENAIR1_DIR)/SIMULATION/TOOLS/taus.o $(OPENAIR_TARGETS)/SIMU/USER/init_lte.o $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.o
-
-TOP_DIR = $(OPENAIR1_DIR)
-include $(OPENAIR1_DIR)/PHY/Makefile.inc
-include $(OPENAIR1_DIR)/SCHED/Makefile.inc
-
-OBJ += $(PHY_OBJS)
-ifeq ($(RTAI),1)
-RTAI_OBJ += $(SCHED_OBJS)
-else
-OBJ += $(SCHED_OBJS)
-endif
-
-#ifndef rrc_cellular
-ifeq ($(rrc_cellular),0)
-rrc_cellular = 0
-rrc_cellular_eNB = 0
-rrc_cellular_UE = 0
-else
-  ifeq ($(eNB_flag),1)
-    rrc_cellular_eNB=1
-  endif
-  ifeq ($(UE_flag),1)
-    rrc_cellular_UE=1
-  endif
-endif
-
-export rrc_cellular
-
-OPENAIR2_TOP = $(OPENAIR2_DIR)
-include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
-include $(OPENAIR2_DIR)/UTIL/Makefile.inc
-include $(OPENAIR2_DIR)/RRC/NAS/Makefile.inc
-
-ifeq ($(RTAI),1)
-LOG_OBJS=
-RTAI_OBJ+=$(LOG_DIR)/vcd_signal_dumper.o
-RTAI_OBJ+=$(LOG_DIR)/log.o
-endif
-
-include $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc
-
-OBJ += $(LOG_OBJS) 
-
-ifndef OPENAIR2
-OPENAIR2=1
-endif
-ifeq ($(OPENAIR2),1)
-ASN1_MSG_OBJS1=$(addprefix $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/, $(ASN1_MSG_OBJS))
-OBJ += $(L2_OBJS) $(LIST_OBJ) $(TIMER_OBJ) $(MEM_OBJ) $(OTG_OBJS) $(MATH_OBJS) 
-OBJ += $(OPENAIR1_DIR)/SIMULATION/ETH_TRANSPORT/netlink_init.o
-OBJ += $(PDCP_DIR)/pdcp_thread.o
-CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
-endif
-
-CFLAGS += $(L2_incl) $(UTIL_incl) $(UTILS_incl)
-
-CFLAGS += -I$(OPENAIR1_DIR) -I$(OPENAIR2_DIR)/RRC/LITE/MESSAGES	#-I$(OPENAIR3_DIR)/MESH -I$(OPENAIR3_DIR)/MESH/RRM
-
-CFLAGS += -DNEW_FFT -DLOG_NO_THREAD
-
-ifeq ($(XFORMS),1)
-CFLAGS += -DXFORMS -I/usr/include/X11
-LDFLAGS += -lforms
-OBJ += $(OPENAIR1_DIR)/PHY/TOOLS/lte_phy_scope.o
-OBJ += stats.o
-endif
-
-ifdef SMBV
-CFLAGS += -DSMBV
-endif
-
-CFLAGS += -DPHYSIM -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1
-CFLAGS += -DOPENAIR_LTE -DENABLE_FXP -DOPENAIR1 -DDLSCH_THREAD #-DULSCH_THREAD
-
-#only for CBMIMO1
-ifdef CBMIMO1
-CFLAGS += -DFW2011 -DBIT8_TX -DCBMIMO1
-else
-#only for EXPRESS MIMO
-CFLAGS += -DEXMIMO
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=138 #this is for ExpressMIMO 1
-#CFLAGS += -DEXMIMO -DTIMING_ADVANCE_HW=45 #this is for ExpressMIMO 2
-endif
-
-ifndef HARD_RT
-HARD_RT=1
-endif
-
-ifeq ($(HARD_RT),1)
-CFLAGS += -DHARD_RT
-endif
-
-ifeq ($(EMOS),1)
-CFLAGS += -DEMOS -DEMOS_CHANNEL
-LDFLAGS += -lgps
-endif
-
-ifndef NAS
-NAS=1
-endif
-
-ifeq ($(NAS),1)
-CFLAGS += -DPDCP_USE_NETLINK -DLINUX
-OBJ += $(NAS_OBJS)
-endif
-
-RTAI_CFLAGS += $(shell rtai-config --lxrt-cflags)
-CFLAGS += -I/usr/realtime/include -DRTAI
-LDFLAGS += -lpthread -lm -lforms
-ifeq ($(RTAI),1)
-LDFLAGS += $(shell rtai-config --lxrt-ldflags) 
-else
-LDFLAGS += -lrt
-endif
-
-#ifndef USE_MME
-#  USE_MME=R8
-#endif
-
-ifdef USE_MME
-  include $(OPENAIR2_DIR)/S1AP/Makefile.inc
-  include $(OPENAIR2_DIR)/S1AP/MESSAGES/Makefile.inc
-  CFLAGS += -DENABLE_USE_MME -DENB_MODE
-  LDFLAGS += -lsctp
-  CFLAGS_S1AP += -DENB_MODE -DENABLE_USE_MME -DEMIT_ASN_DEBUG=1
-  S1AP_BUILT_OBJS += $(S1AP_OBJS) $(addprefix $(OPENAIR2_DIR)/S1AP/MESSAGES/, $(S1AP_ASN_MODULE_SOURCES))
-  S1AP_BUILT_OBJS += $(OPENAIR3_DIR)/OPENAIRMME/SCTP/sctp_primitives_client.o
-endif
-
-
-ASN1RELDIR=R9.8
-ifeq ($(USE_MME), R8)
-  ASN1RELDIR=R8.10
-else
-  CFLAGS_S1AP += -DUPDATE_RELEASE_9
-endif
-S1AP_DIR=$(OPENAIR2_DIR)/S1AP
-ASN1MESSAGESDIR=$(S1AP_DIR)/MESSAGES
-ASN1DIR=$(ASN1MESSAGESDIR)/ASN1
-
-all: lte-enb
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-
-$(RTAI_OBJ): %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
-
-$(OBJ) $(ASN1_MSG_OBJS1): %.o : %.c
-	@echo Compiling $< ...
-	@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
-
-$(S1AP_BUILT_OBJS): %.o : %.c
-	@echo Compiling $<
-	@$(CC) -Wall -c $(CFLAGS_S1AP) $(S1AP_Incl) $(UTIL_incl) -o $@ $<
-
-$(ASN1MESSAGESDIR)/s1ap_ieregen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU-Contents.asn $(ASN1DIR)/asn1tostruct.py
-	echo Timestamp > $@
-	(cd $(ASN1DIR) && python $(ASN1DIR)/asn1tostruct.py -f$<)
-
-$(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp: $(ASN1DIR)/$(ASN1RELDIR)/S1AP-CommonDataTypes.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-Constants.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-IEs.asn $(ASN1DIR)/$(ASN1RELDIR)/S1AP-PDU.asn
-	echo Timestamp > $@
-	(cd $(ASN1MESSAGESDIR) && asn1c -gen-PER -fnative-types -fskeletons-copy $^)
-
-$(S1AP_DIR)/libs1ap.a: $(ASN1MESSAGESDIR)/s1ap_ieregen.stamp $(ASN1MESSAGESDIR)/s1ap_asn1regen.stamp $(S1AP_BUILT_OBJS)
-	@echo Creating $@
-	$(AR) rcs $@ $^
-
-$(LFDS_DIR)/bin/liblfds611.a:
-	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
-
-ifdef USE_MME
-  lte-enb: $(OBJ) $(S1AP_DIR)/libs1ap.a $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
-else
-  lte-enb: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(LFDS_DIR)/bin/liblfds611.a
-endif
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-enb $(LDFLAGS) $(LFDS_DIR)/bin/liblfds611.a
-
-
-
-nasmesh:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-	(cd $(OPENAIR2_DIR) && $(MAKE) nasmesh_netlink.ko)
-	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
-rb_tool:
-	(cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && $(MAKE))
-
-nasmesh_install:
-	(sudo rmmod nasmesh)
-	(sudo insmod $(OPENAIR2_DIR)/NAS/DRIVER/MESH/nasmesh.ko)
-
-clean:
-	rm -rf $(OBJ) $(RTAI_OBJ)
-	rm -f $(S1AP_BUILT_OBJS)
-	rm -f $(ASN1MESSAGESDIR)/libs1ap.a
-
-cleanasn1:
-	rm -f $(ASN1_MSG_OBJS1)
-	$(shell cd $(OPENAIR2_DIR)/RRC/LITE/MESSAGES ; rm -f $(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) *.o *.d )
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.am.sample
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/Makefile.inc.generated
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel8
-	rm -f $(OPENAIR2_DIR)/RRC/LITE/MESSAGES/asn1c/ASN1_files/.lock-rel10
-
-cleanall: clean cleanasn1
-	rm -rf condtest synctest lte-softmodem
-	rm -rf synctest_eNB synctest_UE
-
-show:
-	@echo $(CFLAGS)
-	@echo $(EXTRA_CFLAGS)
-	@echo $(OBJ) $(RTAI_OBJ)
-	@echo rrc_cellular variable is $(rrc_cellular)
-	@echo eNB_flag is $(eNB_flag)
-	@echo UE_flag is $(UE_flag)
-	@echo IS_REL8 is $(IS_REL8)
-	@echo IS_REL10 is $(IS_REL10)
-
-beautiful:
-	astyle --style=gnu -s2 $(SRC)
diff --git a/targets/RT/USER/Makefile.msg_many b/targets/RT/USER/Makefile.msg_many
deleted file mode 100644
index bc7840c1e5..0000000000
--- a/targets/RT/USER/Makefile.msg_many
+++ /dev/null
@@ -1,21 +0,0 @@
-CFLAGS = $(shell rtai-config --lxrt-cflags)
-LDFLAGS = $(shell rtai-config --lxrt-ldflags) -lpthread -llxrt -lm
-
-CFLAGS += -D__IN_RTAI__ -Wall -O2 -I.
-
-OBJS = msg_many.o msg_helper.o
-
-all: msg_many
-
-msg_many: $(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJS)
-
-$(OBJS): msg_many.h
-
-run: msg_many
-	rtai-load msg_many --verbose
-
-.PHONY: clean
-clean:
-	rm -f msg_many $(OBJS)
-
diff --git a/targets/RT/USER/condtest.c b/targets/RT/USER/condtest.c
deleted file mode 100644
index b6f00e80b3..0000000000
--- a/targets/RT/USER/condtest.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-
-
-#include <rtai_lxrt.h>
-#include <rtai_sem.h>
-#include <rtai_msg.h>
-
-#define PERIOD 100000000
-#define THRESHOLD 1
-
-static SEM *mutex;
-static CND *cond;
-
-static int thread0;
-static int thread1;
-
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-
-static void *fun0(void *arg)
-{
-  RT_TASK *task;
-  int done1=0, cnt1=0;
-  RTIME right_now;
-  int ret;
-
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-
-  while (cnt1 < THRESHOLD) {
-    rt_sem_wait(mutex);
-    rt_printk("fun0: Hello World %d, instance_cnt %d!\n",cnt1,instance_cnt);
-
-    while (instance_cnt<0) {
-      ret = rt_cond_wait(cond, mutex);
-
-      if (ret != 0) {
-        rt_printk("error in rt_cond_wait, code %d\n",ret);
-
-        switch (ret) {
-        case RTE_PERM:
-          rt_printk("error RTE_PERM %d\n",ret);
-          break;
-
-        case RTE_UNBLKD:
-          rt_printk("error RTE_UNBLKD %d\n",ret);
-          break;
-
-        case RTE_OBJREM:
-          rt_printk("error RTE_OBJREM %d\n",ret);
-          break;
-
-        default:
-          rt_printk("unknown error code %d\n",ret);
-          break;
-        }
-
-        break;
-      }
-    }
-
-    rt_sem_signal(mutex);
-
-    // do some work here
-    cnt1++;
-
-    rt_sem_wait(mutex);
-    instance_cnt--;
-    rt_sem_signal(mutex);
-
-  }
-
-  // makes task soft real time
-  rt_make_soft_real_time();
-
-  printf("Back to soft RT\n");
-  // clean task
-  rt_task_delete(task);
-  printf("Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(void)
-{
-  RT_TASK *task;
-  RTIME now;
-  int cnt=0;
-
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  // start realtime timer and scheduler
-  //rt_set_oneshot_mode();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  now = rt_get_time() + 10*PERIOD;
-  rt_task_make_periodic(task, now, PERIOD);
-
-  printf("Init mutex and cond.\n");
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0)
-    printf("Error init mutex\n");
-
-  cond = rt_cond_init(nam2num("CONDITION"));
-
-  if (cond==0)
-    printf("Error init cond\n");
-
-  thread0 = rt_thread_create(fun0, NULL, 10000);
-  //thread1 = rt_thread_create(fun1, NULL, 20000);
-
-  //rt_sleep(PERIOD);
-
-  while (cnt < THRESHOLD) {
-    rt_task_wait_period();
-    rt_printk("main: Hello World %d!\n",cnt);
-    rt_sem_wait(mutex); //now the mutex should have value 0
-
-    if (instance_cnt==0) {
-      rt_sem_signal(mutex); //now the mutex should have vaule 1
-      rt_printk("worker thread busy!\n");
-    } else {
-      instance_cnt++;
-      rt_cond_signal(cond);
-      rt_sem_signal(mutex); //now the mutex should have vaule 1
-      rt_printk("signaling worker thread to start!\n");
-    }
-
-    cnt++;
-  }
-
-  // wait for end of program
-  printf("TYPE <ENTER> TO TERMINATE\n");
-  getchar();
-
-  // cleanup
-  stop_rt_timer();
-  return 0;
-}
diff --git a/targets/RT/USER/emos-raw.c b/targets/RT/USER/emos-raw.c
deleted file mode 100644
index 2cf0e18c71..0000000000
--- a/targets/RT/USER/emos-raw.c
+++ /dev/null
@@ -1,1603 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-
-#include "rt_wrapper.h"
-
-#include "PHY/types.h"
-#include "PHY/TOOLS/defs.h"
-#include "openair0_lib.h"
-
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-
-#include "gain_control.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface_init.h"
-# include "timer.h"
-# if defined(ENABLE_USE_MME)
-#   include "s1ap_eNB.h"
-#   include "sctp_eNB_task.h"
-# endif
-#endif
-
-#define OPENAIR_THREAD_PRIORITY       255
-#define OPENAIR_THREAD_STACK_SIZE    8192
-
-#ifdef XFORMS
-/*
-#include "PHY/TOOLS/lte_phy_scope.h"
-#include "stats.h"
-// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
-// at eNB 0, an UL scope for every UE
-FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
-FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
-FD_stats_form *form_stats=NULL;
-char title[255];
-unsigned char scope_enb_num_ue = 1;
-*/
-#include "lte_scope.h"
-FD_lte_scope *form_lte;
-char title[255];
-#endif //XFORMS
-
-#ifdef EMOS
-#include <gps.h>
-struct gps_fix_t dummy_gps_data;
-#ifdef RTAI
-#include <rtai_fifos.h>
-#endif
-
-//#define CHANSOUNDER_FIFO_SIZE 10485760  //  10 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 20971520  //  20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_SIZE 52428800  //  50 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 104857600 // 100 Mbytes FIFO
-//#define CHANSOUNDER_FIFO_SIZE 1073741824 // 1Gbyte FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-#endif
-
-#define FRAME_PERIOD 100000000ULL
-#define DAQ_PERIOD 66667ULL
-#define LTE_SLOTS_PER_FRAME  20
-//#define RESAMPLING_FACTOR 0
-#define SAMPLES_PER_SLOT 15360
-#define FRAME_LENGTH_COMPLEX_SAMPLES (SAMPLES_PER_SLOT*LTE_SLOTS_PER_FRAME)
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-//static long int thread1;
-//static long int sync_thread;
-#else
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-pthread_t  thread2; //xforms
-pthread_t  thread3; //emos
-pthread_t  thread4; //GPS
-pthread_t  thread5; //log
-
-/*
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-int instance_cnt_ptr_kern,*instance_cnt_ptr_user;
-int pci_interface_ptr_kern;
-*/
-//extern unsigned int bigphys_top;
-//extern unsigned int mem_base;
-
-int number_of_cards = 1;
-exmimo_config_t *p_exmimo_config;
-exmimo_id_t     *p_exmimo_id;
-volatile unsigned int *DAQ_MBOX;
-
-int oai_exit = 0;
-
-//int time_offset[4] = {-138,-138,-138,-138};
-//int time_offset[4] = {-145,-145,-145,-145};
-int time_offset[4] = {0,0,0,0};
-
-int fs4_test=0;
-char UE_flag=0;
-uint8_t  eNB_id=0,UE_id=0;
-
-// this array sets the bandwidth used for each card (and applies to all chains on one card).
-exmimo_bw_t bandwidth[MAX_CARDS]    = {BW5,BW5,BW5,BW5};
-// the array  carrier_freq sets the frequency for each chain of each card. A 0 means that the chain is disabled.
-// Please make sure that the total number of channels enabled per card is in accordance with the following rules:
-// BW20: one channel, BW10: 2 channels, BW5: 4 channels
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0},{0,0,0,0}};
-uint32_t      carrier_freq[MAX_CARDS][4] = {{771500000,771500000,771500000,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
-
-// the following paramters set the aquisition time and period. These parameters have to be set in accordance with the write speed of your harddisk and the required throughput according to the setting above (see also channel_buffer_size which is computed later).
-#define AQU_LENGTH_FRAMES 100 //Aquisition time in frames
-#define AQU_PERIOD_FRAMES 100 //Repetition time of aquisition in frames
-#define AQU_LENGTH_SLOTS (AQU_LENGTH_FRAMES*LTE_SLOTS_PER_FRAME) //Aquisition time in slots
-#define AQU_PERIOD_SLOTS (AQU_PERIOD_FRAMES*LTE_SLOTS_PER_FRAME) //Repetition time of aquisition in slots
-
-int32_t rx_total_gain_dB[3] = {-112, -124, -136};
-
-/*
-// this array sets the bandwidth used for each card (and applies to all chains on one card).
-exmimo_bw_t bandwidth[MAX_CARDS]    = {BW20,BW20,BW10,BW5};
-// the array  carrier_freq sets the frequency for each chain of each card. A 0 means that the chain is disabled.
-// Please make sure that the total number of channels enabled per card is in accordance with the following rules:
-// BW20: one channel, BW10: 2 channels, BW5: 4 channels
-uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{2605000000,2605000000,0,0},{0,0,0,0},{0,0,0,0}};
-//uint32_t      carrier_freq[MAX_CARDS][4] = {{2590000000,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
-
-// the following paramters set the aquisition time and period. These parameters have to be set in accordance with the write speed of your harddisk and the required throughput according to the setting above (see also channel_buffer_size which is computed later).
-#define AQU_LENGTH_FRAMES 100 //Aquisition time in frames
-#define AQU_PERIOD_FRAMES 200 //Repetition time of aquisition in frames
-#define AQU_LENGTH_SLOTS (AQU_LENGTH_FRAMES*LTE_SLOTS_PER_FRAME) //Aquisition time in slots
-#define AQU_PERIOD_SLOTS (AQU_PERIOD_FRAMES*LTE_SLOTS_PER_FRAME) //Repetition time of aquisition in slots
-
-int32_t rx_total_gain_dB[3] = {-105, -110, -115};
-*/
-
-char dumpfile_dir[256] = "/mnt/emos";
-
-char *conf_config_file_name = NULL;
-
-unsigned int lost_bytes=0;
-unsigned int rssi_lin[MAX_CARDS][4],rssi_lin_max[MAX_CARDS],rssi_lin_avg[MAX_CARDS];
-uint8_t rssi_avg_dB[MAX_CARDS];
-long long unsigned int total_bytes=0;
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-extern int16_t* sync_corr_ue0;
-extern int16_t prach_ifft[4][1024*2];
-
-unsigned int frame;
-int rx_input_level_dBm;
-#ifdef XFORMS
-extern int otg_enabled;
-#else
-int otg_enabled;
-#endif
-
-int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-
-//void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-//void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag);
-
-unsigned int build_rflocal(int txi, int txq, int rxi, int rxq)
-{
-  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
-}
-unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe)
-{
-  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
-}
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-#ifdef XFORMS
-extern void ia_receiver_on_off( FL_OBJECT * form, long arg) {}
-
-
-void *scope_thread(void *arg)
-{
-  int16_t prach_corr[1024];
-  char stats_buffer[16384];
-  //FILE *UE_stats, *eNB_stats;
-  int i,len=0;
-  float rxsig_t_dB[4][FRAME_LENGTH_COMPLEX_SAMPLES];
-  float time[FRAME_LENGTH_COMPLEX_SAMPLES];
-  struct sched_param sched_param;
-  int card,ant,idx;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("Scope thread has priority %d\n",sched_param.sched_priority);
-
-  /*
-    if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-    else
-    eNB_stats = fopen("eNB_stats.txt", "w");
-  */
-
-  while (!oai_exit) {
-    /*
-      if (UE_flag==1) {
-          len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm);
-          fl_set_object_label(form_stats->stats_text, stats_buffer);
-          //rewind (UE_stats);
-          //fwrite (stats_buffer, 1, len, UE_stats);
-
-          phy_scope_UE(form_ue[UE_id],
-                       PHY_vars_UE_g[UE_id],
-                       eNB_id,
-                       UE_id,7);
-
-      } else {
-          len = dump_eNB_stats (PHY_vars_eNB_g[0], stats_buffer, 0);
-          fl_set_object_label(form_stats->stats_text, stats_buffer);
-          //rewind (eNB_stats);
-          //fwrite (stats_buffer, 1, len, eNB_stats);
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              phy_scope_eNB(form_enb[UE_id],
-                            PHY_vars_eNB_g[eNB_id],
-                            UE_id);
-          }
-
-      }
-    */
-
-    idx = 0;
-
-    for (card=0; card<number_of_cards; card++) {
-      for (ant=0; ant<4; ant++) {
-        if ((carrier_freq[card][ant] != 0) && (idx<4)) {
-          len = FRAME_LENGTH_COMPLEX_SAMPLES/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-
-          for (i=0; i<len; i++) {
-            //rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i])*(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i])+(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])*(((int16_t*) openair0_exmimo_pci[card].adc_head[0])[2*i+1])));
-            rxsig_t_dB[0][i] = (float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[ant])[2*i]));
-            rxsig_t_dB[1][i] = (float) ((((int16_t*) openair0_exmimo_pci[card].adc_head[ant])[2*i+1]));
-            time[i] = (float) i;
-          }
-
-          fl_set_xyplot_data(form_lte->channel_t_re[idx],time,rxsig_t_dB[0],len,"","","");
-          fl_set_xyplot_data(form_lte->channel_t_im[idx],time,rxsig_t_dB[1],len,"","","");
-          idx++;
-        }
-      }
-    }
-
-    //printf("doing forms\n");
-    usleep(100000);
-  }
-
-  //fclose (UE_stats);
-  //fclose (eNB_stats);
-
-  pthread_exit((void*)arg);
-}
-#endif
-
-int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
-
-
-#ifdef EMOS
-void* gps_thread (void *arg)
-{
-
-  struct gps_data_t gps_data;
-  struct gps_data_t *gps_data_ptr = &gps_data;
-  struct sched_param sched_param;
-  int ret;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("GPS thread has priority %d\n",sched_param.sched_priority);
-
-  memset(&dummy_gps_data,0,sizeof(struct gps_fix_t));
-
-#if GPSD_API_MAJOR_VERSION>=5
-  ret = gps_open("127.0.0.1","2947",gps_data_ptr);
-
-  if (ret!=0)
-#else
-  gps_data_ptr = gps_open("127.0.0.1","2947");
-
-  if (gps_data_ptr == NULL)
-#endif
-  {
-    printf("[EMOS] Could not open GPS\n");
-    pthread_exit((void*)arg);
-  }
-
-#if GPSD_API_MAJOR_VERSION>=4
-  else if (gps_stream(gps_data_ptr, WATCH_ENABLE,NULL) != 0)
-#else
-  else if (gps_query(gps_data_ptr, "w+x") != 0)
-#endif
-  {
-    printf("[EMOS] Error sending command to GPS\n");
-    pthread_exit((void*) arg);
-  } else
-    printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data_ptr);
-
-
-  while (!oai_exit) {
-    printf("[EMOS] polling data from gps\n");
-#if GPSD_API_MAJOR_VERSION>=5
-
-    if (gps_waiting(gps_data_ptr,500)) {
-      if (gps_read(gps_data_ptr) <= 0) {
-#else
-
-    if (gps_waiting(gps_data_ptr)) {
-      if (gps_poll(gps_data_ptr) != 0) {
-#endif
-        printf("[EMOS] problem polling data from gps\n");
-      } else {
-        memcpy(&dummy_gps_data,&(gps_data_ptr->fix),sizeof(struct gps_fix_t));
-        printf("[EMOS] lat %g, lon %g\n",gps_data_ptr->fix.latitude,gps_data_ptr->fix.longitude);
-      }
-    } //gps_waiting
-    else {
-      printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
-    }
-
-    //rt_sleep_ns(1000000000LL);
-    sleep(1);
-  } //oai_exit
-
-  pthread_exit((void*) arg);
-
-}
-
-void *log_thread (void *arg)
-{
-  //struct tm now_sec;
-  struct timeval now;
-  int card;
-  FILE *logfile_id;
-  char logfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  //open file
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(logfile_name,1024,"%s/%s_data_%d%02d%02d_%02d%02d%02d.log",
-           dumpfile_dir,
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-  logfile_id = fopen(logfile_name,"w");
-
-  if ((logfile_id == NULL)) {
-    fprintf(stderr, "[EMOS] Error opening logfile %s\n",logfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-  fprintf(logfile_id,
-          "#time, frame, total bytes wrote, total bytes lost, GPS time, GPS mode, lat, lon, alt, speed, rssi_lin_max[0], rssi_lin_avg[0], rssi_avg_dBm[0], rssi_avg_dB[0], rx_gain[0], LNA[0], ...\n");
-
-  while (!oai_exit) {
-    gettimeofday(&now,NULL);
-    //localtime_r(&(now.tv_sec),&now_sec);
-    fprintf(logfile_id,"%d.%06d, %d, %llu, %u, %e, %d, %e, %e, %e, %e, ",
-            (int) now.tv_sec, (int)now.tv_usec,
-            frame, total_bytes,lost_bytes,
-            dummy_gps_data.time, dummy_gps_data.mode, dummy_gps_data.latitude, dummy_gps_data.longitude, dummy_gps_data.altitude, dummy_gps_data.speed);
-
-    for (card=0; card<number_of_cards; card++)
-      if (carrier_freq[card][0] != 0)
-        fprintf(logfile_id,"%d, %d, %d, %d, %d, %d, ", rssi_lin_max[card], rssi_lin_avg[card],
-                rssi_avg_dB[card] + rx_total_gain_dB[((openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14)-1] - openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],
-                rssi_avg_dB[card], openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0], (openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14);
-
-    fprintf(logfile_id,"\n");
-    usleep(10000);
-  }
-
-  //close file
-  fclose(logfile_id);
-
-  pthread_exit((void*) arg);
-
-}
-
-void *emos_thread (void *arg)
-{
-  char c;
-  char *fifo2file_buffer, *fifo2file_ptr;
-
-  int fifo, counter=0, bytes;
-
-  FILE  *dumpfile_id;
-  char  dumpfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  //time_t timer;
-  struct tm now_sec;
-  struct timeval now;
-
-  struct sched_param sched_param;
-  int ret;
-
-  int card, ant;
-  int channel_buffer_size=0; //in bytes
-
-  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
-
-  sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("EMOS thread has priority %d\n",sched_param.sched_priority);
-
-  //timer = time(NULL);
-  //now = localtime(&timer);
-
-  for (card=0; card<number_of_cards; card++)
-    for (ant=0; ant<4; ant++)
-      if (carrier_freq[card][ant] != 0) {
-        printf("card %d, ant %d: freq %u, BW %d\n",card,ant,carrier_freq[card][ant],bandwidth[card]);
-        channel_buffer_size += SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-      }
-
-  channel_buffer_size *= 4; //4 bytes per sample
-
-  // allocate memory for NO_FRAMES_DISK channes estimations
-  fifo2file_buffer = malloc(AQU_LENGTH_SLOTS*channel_buffer_size);
-  fifo2file_ptr = fifo2file_buffer;
-
-  if (fifo2file_buffer == NULL) {
-    printf("[EMOS] Cound not allocate memory for fifo2file_buffer\n");
-    exit(EXIT_FAILURE);
-  }
-
-  if ((fifo = open(CHANSOUNDER_FIFO_DEV, O_RDONLY)) < 0) {
-    fprintf(stderr, "[EMOS] Error opening the fifo\n");
-    exit(EXIT_FAILURE);
-  }
-
-
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(dumpfile_name,1024,"%s/%s_data_%d%02d%02d_%02d%02d%02d.EMOS",
-           dumpfile_dir,
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-
-  dumpfile_id = fopen(dumpfile_name,"w");
-
-  if ((dumpfile_id == NULL)) {
-    fprintf(stderr, "[EMOS] Error opening dumpfile %s\n",dumpfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-  printf("[EMOS] starting dump, channel_buffer_size=%d ...\n",channel_buffer_size);
-
-  while (!oai_exit) {
-    //bytes = rtf_read_timed(fifo, fifo2file_ptr, channel_buffer_size,100);
-    bytes = rtf_read_all_at_once(fifo, fifo2file_ptr, channel_buffer_size);
-
-    if (bytes<=0) {
-      usleep(100);
-      continue;
-    }
-
-    if (bytes != channel_buffer_size) {
-      printf("[EMOS] Frame %d: ERROR! Only got %d bytes instead of %d!\n",frame,bytes,channel_buffer_size);
-    }
-
-    /*
-    if (UE_flag==0)
-    printf("eNB: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_eNB*)fifo2file_ptr)->frame_tx,bytes);
-    else
-    printf("UE: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_UE*)fifo2file_ptr)->frame_rx,bytes);
-    */
-
-    fifo2file_ptr += channel_buffer_size;
-    counter ++;
-    total_bytes += bytes;
-
-    if ((counter%AQU_LENGTH_SLOTS)==0) {
-      //reset stuff
-      fifo2file_ptr = fifo2file_buffer;
-      //counter = 0;
-
-      printf("[EMOS] Frame %d: start writing %d bytes to disk\n",frame,AQU_LENGTH_SLOTS*channel_buffer_size);
-
-      //flush buffer to disk
-      if (fwrite(fifo2file_buffer, sizeof(char), AQU_LENGTH_SLOTS*channel_buffer_size, dumpfile_id) != AQU_LENGTH_SLOTS*channel_buffer_size) {
-        fprintf(stderr, "[EMOS] Error writing to dumpfile\n");
-        exit(EXIT_FAILURE);
-      } else
-        printf("[EMOS] Frame %d: wrote %d bytes to disk\n",frame,AQU_LENGTH_SLOTS*channel_buffer_size);
-
-    }
-
-    if ((counter%AQU_LENGTH_SLOTS)==0) {
-      //time(&starttime_tmp);
-      gettimeofday(&now,NULL);
-      localtime_r(&(now.tv_sec),&now_sec);
-      printf("[EMOS] %02d:%02d:%02d.%03d, frame %d, total bytes wrote %llu, bytes lost %u\n",
-             now_sec.tm_hour, now_sec.tm_min, now_sec.tm_sec, (int)(now.tv_usec/1000), frame, total_bytes,lost_bytes);
-
-      for (card=0; card<number_of_cards; card++)
-        if (carrier_freq[card][0] != 0)
-          printf("[EMOS] %02d:%02d:%02d.%03d, card %d, rssi_lin_max %d, rssi_lin_avg %d, rssi_avg_dBm %d (rssi_avg_dB %d, rx_gain %d, LNA %d)\n",
-                 now_sec.tm_hour, now_sec.tm_min, now_sec.tm_sec, (int)(now.tv_usec/1000), card, rssi_lin_max[card], rssi_lin_avg[card],
-                 rssi_avg_dB[card] + rx_total_gain_dB[((openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14)-1] - openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],
-                 rssi_avg_dB[card], openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0], (openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0] & LNAGAINMASK) >> 14);
-
-      //printf("[EMOS] %02d:%02d:%02d, frame %d, GPS time %e, GPS mode %d, lat %e, lon %e, alt %e, speed %e\n", starttime.tm_hour, starttime.tm_min, starttime.tm_sec, counter/20, dummy_gps_data.time, dummy_gps_data.mode, dummy_gps_data.latitude, dummy_gps_data.longitude, dummy_gps_data.altitude, dummy_gps_data.speed);
-    }
-  }
-
-  free(fifo2file_buffer);
-  fclose(dumpfile_id);
-  close(fifo);
-
-  pthread_exit((void*) arg);
-
-}
-#endif
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-#endif
-  unsigned char slot=0,last_slot, next_slot, hw_slot;
-  unsigned int msg1;
-  unsigned int aa,slot_offset, slot_offset_F;
-  int diff;
-  int delay_cnt;
-  RTIME time_in, time_diff;
-  int mbox_target=0,mbox_current=0;
-  int i,ret;
-  int tx_offset;
-  int bytes, bytes_tot=0, bytes_len;
-  long long int k1=1000;
-  long long int k2=1024-k1;
-  int ant,len,card = 0;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  LOG_D(HW,"Started eNB thread (id %p)\n",task);
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB frame %d, time %llu: slot %d, hw_slot %d (mbox %d)\n",frame,rt_get_time_ns(),slot,hw_slot,((unsigned int *)DAQ_MBOX)[0]);
-    //this is the mbox counter where we should be
-    //mbox_target = ((((slot+1)%20)*15+1)>>1)%150;
-    mbox_target = mbox_bounds[slot];
-    //this is the mbox counter where we are
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    //this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD)
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-    if (diff < (-7)) {
-      // at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
-      LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, diff);
-      slot++;
-
-      //if (frame>0)
-      //oai_exit=1;
-      if (slot==20) {
-        slot=0;
-        frame++;
-      }
-
-      continue;
-    }
-
-    if (diff>8)
-      LOG_D(HW,"eNB Frame %d, time %llu: skipped slot, waiting for hw to catch up (slot %d, hw_slot %d, mbox_current %d, mbox_target %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, mbox_current,
-            mbox_target, diff);
-
-    delay_cnt = 0;
-
-    while ((diff>0) && (!oai_exit)) {
-      time_in = rt_get_time_ns();
-      //LOG_D(HW,"eNB Frame %d delaycnt %d : hw_slot %d (%d), slot %d, (slot+1)*15=%d, diff %d, time %llu\n",frame,delay_cnt,hw_slot,((unsigned int *)DAQ_MBOX)[0],slot,(((slot+1)*15)>>1),diff,time_in);
-      //LOG_D(HW,"eNB Frame %d, time %llu: sleeping for %llu (slot %d, hw_slot %d, diff %d, mbox %d, delay_cnt %d)\n", frame, time_in, diff*DAQ_PERIOD,slot,hw_slot,diff,((volatile unsigned int *)DAQ_MBOX)[0],delay_cnt);
-      ret = rt_sleep_ns(diff*DAQ_PERIOD);
-
-      if (ret)
-        LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
-
-      hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-      //LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
-      delay_cnt++;
-
-      if (delay_cnt == 10) {
-        oai_exit = 1;
-        LOG_D(HW,"eNB Frame %d: HW stopped ... \n",frame);
-      }
-
-      mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-      if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-        diff = 150-mbox_current+mbox_target;
-      else if ((mbox_current<15) && (mbox_target>=135))
-        diff = -150+mbox_target-mbox_current;
-      else
-        diff = mbox_target - mbox_current;
-    }
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    if (frame>=AQU_LENGTH_FRAMES) {
-      timing_info.time_last = timing_info.time_now;
-      timing_info.time_now = rt_get_time_ns();
-
-      if (timing_info.n_samples>0) {
-        time_diff = timing_info.time_now - timing_info.time_last;
-
-        if (time_diff < timing_info.time_min)
-          timing_info.time_min = time_diff;
-
-        if (time_diff > timing_info.time_max)
-          timing_info.time_max = time_diff;
-
-        timing_info.time_avg += time_diff;
-      }
-
-      timing_info.n_samples++;
-
-      // do measurements for rssi
-      if (last_slot==0) {
-        for (card=0; card<number_of_cards; card++) {
-          len = SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[0]);
-          rssi_lin_max[card] = 0;
-
-          for (ant=0; ant<4; ant++) {
-            if (carrier_freq[card][ant] != 0) {
-              rssi_lin[card][ant] = signal_energy(&(((int32_t*) openair0_exmimo_pci[card].adc_head[ant])[last_slot*len]), len);
-              rssi_lin_max[card] = max(rssi_lin_max[card],rssi_lin[card][ant]);
-            }
-          }
-
-          rssi_lin_avg[card] = (int) ((k1*((long long int)(rssi_lin_avg[card])) + (k2*((long long int)(rssi_lin_max[card]))))>>10);
-          rssi_avg_dB[card] = dB_fixed(rssi_lin_avg[card]);
-
-          if (frame%100==0) {
-            gain_control_all(rssi_avg_dB[card],card);
-            //printf("AGC for card %d: rx_power_fil_dB=%d, rx_gain=%d, LNA=%d (1=Byp,2=Med,3=Max)\n",card,rssi_avg_dB,openair0_exmimo_pci[card].exmimo_config_ptr->rf.rx_gain[0][0],(openair0_exmimo_pci[card].exmimo_config_ptr->rf.rf_mode[0]&LNAGAINMASK)>>14);
-          }
-        }
-      }
-
-#ifdef EMOS
-
-      // save raw samples here
-      if ((last_slot==0) && ((frame%AQU_PERIOD_FRAMES)==0)) {
-        printf("[EMOS] Frame %d: start writing to FIFO\n",frame);
-        bytes_tot=0;
-      }
-
-      if ((frame%AQU_PERIOD_FRAMES)<AQU_LENGTH_FRAMES) {
-        for (card=0; card<number_of_cards; card++) {
-          for (ant=0; ant<4; ant++) {
-            if (carrier_freq[card][ant] != 0) {
-              len = SAMPLES_PER_SLOT/(1<<openair0_exmimo_pci[card].exmimo_config_ptr->framing.resampling_factor[ant]);
-              bytes_len = len*4;
-              bytes = rtf_put(CHANSOUNDER_FIFO_MINOR, &(((int32_t*) openair0_exmimo_pci[card].adc_head[ant])[last_slot*len]), bytes_len);
-              bytes_tot += bytes;
-
-              if (bytes!=bytes_len) {
-                lost_bytes += bytes_len - bytes;
-                LOG_W(PHY,"Frame %d, slot %d: Problem writing EMOS data to FIFO (bytes=%d, size=%d)\n",
-                      frame, last_slot, bytes, bytes_len);
-              }
-            }
-          }
-        }
-
-        if ((last_slot==19) && ((frame%AQU_PERIOD_FRAMES)==99))
-          printf("[EMOS] Frame %d: sent %d bytes to FIFO\n",frame,bytes_tot);
-
-      }
-
-#endif
-    }
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-
-#if defined(ENABLE_ITTI)
-    itti_update_lte_time(frame, slot);
-#endif
-  }
-
-  LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  LOG_D(HW,"Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-#endif
-  int i,j,aa;
-  void *status;
-  int card = 0;
-
-  uint32_t rf_mode_base   = TXLPFNORM + TXLPFEN  + RXLPFNORM + RXLPFEN + LNA1ON +LNAMax + RFBBNORM;
-  uint32_t rf_local[4]    = {8255000,8255000,8255000,8255000}; // UE zepto
-  //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
-  //{8255067,8254810,8257340,8257340}; // eNB PETRONAS
-  uint32_t rf_vcocal[4]   = {910,910,910,910};
-  uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015};
-  uint32_t rf_rxdc[4]     = {32896,32896,32896,32896};
-  uint32_t rxgain[4]      = {30,30,30,30};
-  uint32_t txgain[4]      = {0,0,0,0};
-
-  uint16_t Nid_cell = 0;
-  uint8_t  cooperation_flag=0, transmission_mode=1, abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
-  int c;
-  char do_forms=0;
-  unsigned int fd;
-  unsigned int tcxo = 114;
-
-  int amp;
-  uint8_t prach_fmt;
-  int N_ZC;
-
-  char rxg_fname[100];
-  char txg_fname[100];
-  char rflo_fname[100];
-  char rfdc_fname[100];
-  FILE *rxg_fd=NULL;
-  FILE *txg_fd=NULL;
-  FILE *rflo_fd=NULL;
-  FILE *rfdc_fd=NULL;
-  unsigned int rxg_max[4]= {133,133,133,133}, rxg_med[4]= {127,127,127,127}, rxg_byp[4]= {120,120,120,120};
-  int tx_max_power=0;
-
-  char line[1000];
-  int l;
-  int ret, ant;
-  int ant_offset=0;
-
-  int error_code;
-  char *itti_dump_file = NULL;
-
-  const struct option long_options[] = {
-    {"calib-ue-rx", required_argument, NULL, 256},
-    {"calib-ue-rx-med", required_argument, NULL, 257},
-    {"calib-ue-rx-byp", required_argument, NULL, 258},
-    {"debug-ue-prach", no_argument, NULL, 259},
-    {"no-L2-connect", no_argument, NULL, 260},
-    {NULL, 0, NULL, 0}
-  };
-
-  //mode = normal_txrx;
-
-
-  while ((c = getopt_long (argc, argv, "C:K:O:ST:UdF:V",long_options,NULL)) != -1) {
-    switch (c) {
-    case 'V':
-      ouput_vcd = 1;
-      break;
-
-    case 'd':
-      do_forms=1;
-      break;
-
-    case 'U':
-      UE_flag = 1;
-      break;
-
-    case 'C':
-      for (card=0; card<MAX_CARDS; card++) {
-        carrier_freq[card][0] = atof(optarg);
-        carrier_freq[card][1] = atof(optarg);
-        carrier_freq[card][2] = atof(optarg);
-        carrier_freq[card][3] = atof(optarg);
-      }
-
-      break;
-
-    case 'S':
-      fs4_test=1;
-      break;
-
-    case 'T':
-      tcxo=atoi(optarg);
-      break;
-
-    case 'K':
-#if defined(ENABLE_ITTI)
-      itti_dump_file = strdup(optarg);
-#else
-      printf("-K option is disabled when ENABLE_ITTI is not defined\n");
-#endif
-      break;
-
-    case 'O':
-      conf_config_file_name = optarg;
-      break;
-
-    case 'F':
-      sprintf(rxg_fname,"%srxg.lime",optarg);
-      rxg_fd = fopen(rxg_fname,"r");
-
-      if (rxg_fd) {
-        printf("Loading RX Gain parameters from %s\n",rxg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), rxg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
-          else {
-            if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
-
-            if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
-
-            if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",rxg_fname);
-
-      sprintf(txg_fname,"%stxg.lime",optarg);
-      txg_fd = fopen(txg_fname,"r");
-
-      if (txg_fd) {
-        printf("Loading TX Gain parameters from %s\n",txg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), txg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) {
-            continue; //ignore empty or comment lines
-          } else {
-            if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
-
-            if (l==1) sscanf(line,"%d",&tx_max_power);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",txg_fname);
-
-      sprintf(rflo_fname,"%srflo.lime",optarg);
-      rflo_fd = fopen(rflo_fname,"r");
-
-      if (rflo_fd) {
-        printf("Loading RF LO parameters from %s\n",rflo_fname);
-        fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
-      } else
-        printf("%s not found, running with defaults\n",rflo_fname);
-
-      sprintf(rfdc_fname,"%srfdc.lime",optarg);
-      rfdc_fd = fopen(rfdc_fname,"r");
-
-      if (rfdc_fd) {
-        printf("Loading RF DC parameters from %s\n",rfdc_fname);
-        fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
-      } else
-        printf("%s not found, running with defaults\n",rfdc_fname);
-
-      break;
-
-      /*
-      case 256:
-      mode = rx_calib_ue;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 257:
-      mode = rx_calib_ue_med;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 258:
-      mode = rx_calib_ue_byp;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 259:
-      mode = debug_prach;
-      break;
-      case 260:
-      mode = no_L2_connect;
-      break;
-      */
-    default:
-      break;
-    }
-  }
-
-  if (UE_flag==1)
-    printf("configuring for UE\n");
-  else
-    printf("configuring for eNB\n");
-
-  //randominit (0);
-  //set_taus_seed (0);
-
-  // initialize the log (see log.h for details)
-  logInit();
-
-#if defined(ENABLE_ITTI)
-  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
-
-# if defined(ENABLE_USE_MME)
-
-  if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
-    return -1;
-  }
-
-  if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
-    return -1;
-  }
-
-# endif
-
-  if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
-    return -1;
-  }
-
-  // Handle signals until all tasks are terminated
-  //   itti_wait_tasks_end();
-#endif
-
-  if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
-  }
-
-#ifdef PDCP_USE_NETLINK
-  netlink_init();
-#endif
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  g_log->log_component[HW].level = LOG_DEBUG;
-  g_log->log_component[HW].flag  = LOG_HIGH;
-#ifdef OPENAIR2
-  g_log->log_component[PHY].level = LOG_INFO;
-#else
-  g_log->log_component[PHY].level = LOG_DEBUG;
-#endif
-  g_log->log_component[PHY].flag  = LOG_HIGH;
-  g_log->log_component[MAC].level = LOG_INFO;
-  g_log->log_component[MAC].flag  = LOG_HIGH;
-  g_log->log_component[RLC].level = LOG_INFO;
-  g_log->log_component[RLC].flag  = LOG_HIGH;
-  g_log->log_component[PDCP].level = LOG_INFO;
-  g_log->log_component[PDCP].flag  = LOG_HIGH;
-  g_log->log_component[OTG].level = LOG_INFO;
-  g_log->log_component[OTG].flag  = LOG_HIGH;
-  g_log->log_component[RRC].level = LOG_INFO;
-  g_log->log_component[RRC].flag  = LOG_HIGH;
-
-
-  // Initialize card
-  ret = openair0_open();
-
-  if ( ret != 0 ) {
-    if (ret == -1)
-      printf("Error opening /dev/openair0");
-
-    if (ret == -2)
-      printf("Error mapping bigshm");
-
-    if (ret == -3)
-      printf("Error mapping RX or TX buffer");
-
-    return(ret);
-  }
-
-  number_of_cards = openair0_num_detected_cards;
-
-  for (card=0; card<number_of_cards; card++) {
-    printf ("Configuring card %d of %d (number of antennas %d).\n", card, openair0_num_detected_cards, openair0_num_antennas[card]);
-
-    p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
-    p_exmimo_id     = openair0_exmimo_pci[card].exmimo_id_ptr;
-
-    printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
-
-    if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2)
-      p_exmimo_config->framing.eNB_flag   = 0;
-    else
-      p_exmimo_config->framing.eNB_flag   = !UE_flag;
-
-    if (card==0)
-      p_exmimo_config->framing.multicard_syncmode = SYNCMODE_MASTER;
-    else
-      p_exmimo_config->framing.multicard_syncmode = SYNCMODE_SLAVE;
-
-    //p_exmimo_config->framing.multicard_syncmode = SYNCMODE_FREE;
-
-
-    p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_TESTRX; //TXRXSWITCH_LSB;
-
-    /*
-      for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
-      p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-      for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
-      p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-      for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
-      p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-      for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
-      p_exmimo_config->rf.rf_mode[ant] = 0;
-      carrier_freq[ant] = 0; //this turns off all other LIMEs
-      }
-    */
-
-    for (ant=0; ant<4; ant++) {
-      if (carrier_freq[card][ant] != 0) {
-        p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-
-        switch (bandwidth[card]) {
-        case BW20:
-          p_exmimo_config->framing.resampling_factor[ant] = 0;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF10 + TXLPF10;
-          break;
-
-        case BW10:
-          p_exmimo_config->framing.resampling_factor[ant] = 1;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF5 + TXLPF5;
-          break;
-
-        case BW5:
-          p_exmimo_config->framing.resampling_factor[ant] = 2;
-          p_exmimo_config->rf.rf_mode[ant] += RXLPF25 + TXLPF25;
-          break;
-        }
-
-        //p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-        p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-      } else {
-        p_exmimo_config->rf.rf_mode[ant] = 0;
-      }
-    }
-
-    for (ant = 0; ant<4; ant++) {
-      p_exmimo_config->rf.do_autocal[ant] = 1;
-      p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[card][ant];
-      p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[card][ant];
-      p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
-      p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
-
-      p_exmimo_config->rf.rf_local[ant]   = rf_local[ant];
-      p_exmimo_config->rf.rf_rxdc[ant]    = rf_rxdc[ant];
-
-      if ((carrier_freq[card][ant] >= 850000000) && (carrier_freq[card][ant] <= 865000000)) {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal_850[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
-      } else if ((carrier_freq[card][ant] >= 1900000000) && (carrier_freq[card][ant] <= 2000000000)) {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
-      } else {
-        p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-        p_exmimo_config->rf.rffe_band_mode[ant] = 0;
-      }
-
-      p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
-      p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
-      p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
-      p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
-    }
-
-
-    openair0_dump_config(card);
-
-    printf("EXMIMO_CONFIG card %d: freq0..3 %u %u %u %u Hz, freqtx0..1 %u %u Hz, RX gain0..1 %d %d dB\n",
-           card,
-           p_exmimo_config->rf.rf_freq_rx[0],
-           p_exmimo_config->rf.rf_freq_rx[1],
-           p_exmimo_config->rf.rf_freq_rx[2],
-           p_exmimo_config->rf.rf_freq_rx[3],
-           p_exmimo_config->rf.rf_freq_tx[0],
-           p_exmimo_config->rf.rf_freq_tx[1],
-           p_exmimo_config->rf.rx_gain[0][0],
-           p_exmimo_config->rf.rx_gain[1][0]);
-    printf("EXMIMO_CONFIG card %d: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
-           card,
-           p_exmimo_config->rf.rf_mode[0],
-           p_exmimo_config->rf.rf_mode[1],
-           p_exmimo_config->rf.rf_mode[2],
-           p_exmimo_config->rf.rf_mode[3],
-           (p_exmimo_config->rf.rf_mode[0]&3),  // RXen+TXen
-           (p_exmimo_config->rf.rf_mode[0]&4)>>2,         //TXLPFen
-           (p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF
-           (p_exmimo_config->rf.rf_mode[0]&128)>>7,      //RXLPFen
-           (p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF
-           (p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode
-           (p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode
-           (p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode
-           p_exmimo_config->rf.rf_rxdc[0],
-           p_exmimo_config->rf.rf_local[0],
-           p_exmimo_config->rf.rf_vcocal[0]);
-
-    for (ant=0; ant<4; ant++)
-      p_exmimo_config->rf.do_autocal[ant] = 0;
-  } //card
-
-  card=0;
-
-#ifdef EMOS
-  error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE);
-
-  if (error_code==0)
-    printf("[OPENAIR][SCHED][INIT] Created EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENODEV)
-    printf("[OPENAIR][SCHED][INIT] Problem: EMOS FIFO %d is greater than or equal to RTF_NO\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENOMEM)
-    printf("[OPENAIR][SCHED][INIT] Problem: cannot allocate memory for EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else
-    printf("[OPENAIR][SCHED][INIT] Problem creating EMOS FIFO %d, error_code %d\n",CHANSOUNDER_FIFO_MINOR,error_code);
-
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-  //rt_set_oneshot_mode();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  //now = rt_get_time() + 10*PERIOD;
-  //rt_task_make_periodic(task, now, PERIOD);
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[0].rxcnt_ptr[0];
-
-  // this starts the DMA transfers
-  if (UE_flag!=1)
-    for (card=0; card<number_of_cards; card++)
-      openair0_start_rt_acquisition(card);
-
-
-#ifdef XFORMS
-
-  if (do_forms==1) {
-    fl_initialize (&argc, argv, NULL, 0, 0);
-    /*
-    form_stats = create_form_stats_form();
-    if (UE_flag==1) {
-        form_ue[UE_id] = create_lte_phy_scope_ue();
-        sprintf (title, "LTE DL SCOPE UE");
-        fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-    } else {
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              form_enb[UE_id] = create_lte_phy_scope_enb();
-              sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
-              fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-          }
-    }
-    fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-    if (UE_flag==0) {
-        for (UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-            if (otg_enabled) {
-                fl_set_button(form_enb[UE_id]->button_0,1);
-                fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON");
-            }
-            else {
-                fl_set_button(form_enb[UE_id]->button_0,0);
-                fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF");
-            }
-        }
-    }
-    else {
-        if (openair_daq_vars.use_ia_receiver) {
-            fl_set_button(form_ue[UE_id]->button_0,1);
-            fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-        }
-        else {
-            fl_set_button(form_ue[UE_id]->button_0,0);
-            fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-        }
-    }
-    */
-    form_lte = create_form_lte_scope();
-    fl_show_form (form_lte->lte_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "Scope");
-
-    ret = pthread_create(&thread2, NULL, scope_thread, NULL);
-    printf("Scope thread created, ret=%d\n",ret);
-  }
-
-#endif
-
-#ifdef EMOS
-  ret = pthread_create(&thread3, NULL, emos_thread, NULL);
-  printf("EMOS thread created, ret=%d\n",ret);
-  ret = pthread_create(&thread4, NULL, gps_thread, NULL);
-  printf("GPS thread created, ret=%d\n",ret);
-  ret = pthread_create(&thread5, NULL, log_thread, NULL);
-  printf("LOG thread created, ret=%d\n",ret);
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-  // start the main thread
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    thread1 = rt_thread_create(UE_thread, NULL, 100000000);
-    #else
-    error_code = pthread_create(&thread1, &attr_dlsch_threads, UE_thread, NULL);
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
-      return(error_code);
-    }
-    else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate UE_thread successful\n");
-    }
-    #endif
-    #ifdef DLSCH_THREAD
-    init_rx_pdsch_thread();
-    rt_sleep_ns(FRAME_PERIOD/10);
-    init_dlsch_threads();
-    #endif
-    printf("UE threads created\n");
-    */
-  } else {
-#ifdef RTAI
-    thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-    error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-      return(error_code);
-    } else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n");
-    }
-
-#endif
-#ifdef ULSCH_THREAD
-    init_ulsch_threads();
-#endif
-    printf("eNB threads created\n");
-  }
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0)
-    rt_sleep_ns(FRAME_PERIOD);
-
-  // stop threads
-#ifdef XFORMS
-  printf("waiting for XFORMS thread\n");
-
-  if (do_forms==1) {
-    pthread_join(thread2,&status);
-    /*
-      fl_hide_form(form_stats->stats_form);
-      fl_free_form(form_stats->stats_form);
-      if (UE_flag==1) {
-          fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue);
-          fl_free_form(form_ue[UE_id]->lte_phy_scope_ue);
-      } else {
-          for(UE_id=0;UE_id<scope_enb_num_ue;UE_id++) {
-              fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
-              fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
-          }
-      }
-    */
-    fl_hide_form(form_lte->lte_scope);
-    fl_free_form(form_lte->lte_scope);
-  }
-
-#endif
-
-  printf("stopping MODEM threads\n");
-
-  // cleanup
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    rt_thread_join(thread1);
-    #else
-    pthread_join(thread1,&status);
-    #endif
-    #ifdef DLSCH_THREAD
-    cleanup_dlsch_threads();
-    cleanup_rx_pdsch_thread();
-    #endif
-    */
-  } else {
-#ifdef RTAI
-    rt_thread_join(thread0);
-#else
-    pthread_join(thread0,&status);
-#endif
-#ifdef ULSCH_THREAD
-    cleanup_ulsch_threads();
-#endif
-  }
-
-#ifdef OPENAIR2
-  //cleanup_pdcp_thread();
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  printf("stopping card\n");
-
-  for (card=0; card<number_of_cards; card++)
-    openair0_stop(card);
-
-  printf("closing openair0_lib\n");
-  openair0_close();
-
-#ifdef EMOS
-  printf("waiting for EMOS thread\n");
-  pthread_cancel(thread3);
-  pthread_join(thread3,&status);
-  printf("waiting for GPS thread\n");
-  pthread_cancel(thread4);
-  pthread_join(thread4,&status);
-  printf("waiting for log thread\n");
-  pthread_cancel(thread5);
-  pthread_join(thread5,&status);
-#endif
-
-#ifdef EMOS
-  error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-
-  while (error_code>0)
-    error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-
-  printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code);
-#endif
-
-  if (ouput_vcd)
-    VCD_SIGNAL_DUMPER_CLOSE();
-
-  logClean();
-
-  return 0;
-}
-
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag)
-{
-  p_exmimo_config->framing.eNB_flag   = !UE_flag;
-  p_exmimo_config->framing.tdd_config = 0;
-  p_exmimo_config->framing.resampling_factor[ant] = 2;
-
-  p_exmimo_config->rf.rf_freq_rx[ant] = 1907600000;
-  p_exmimo_config->rf.rf_freq_tx[ant] = 1907600000;;
-  p_exmimo_config->rf.rx_gain[ant][0] = 20;
-  p_exmimo_config->rf.tx_gain[ant][0] = 10;
-  p_exmimo_config->rf.rf_mode[ant] = rf_mode;
-
-  p_exmimo_config->rf.rf_local[ant] = build_rflocal(20,25,26,04);
-  p_exmimo_config->rf.rf_rxdc[ant] = build_rfdc(128, 128);
-  p_exmimo_config->rf.rf_vcocal[ant] = (0xE<<6) + 0xE;
-}
-
-/*
-void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i;
-  if (phy_vars_ue) {
-
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-      phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-
-      printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
-      phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-      printf("txdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.txdata[i]);
-    }
-  }
-}
-
-void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i,j;
-
-  if (phy_vars_eNB) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-        printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("rxbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
-        }
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-        printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("txbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j] = 16-j;
-  }
-    }
-  }
-}
-*/
diff --git a/targets/RT/USER/init_rtai.sh b/targets/RT/USER/init_rtai.sh
deleted file mode 100755
index 69b127de33..0000000000
--- a/targets/RT/USER/init_rtai.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-sudo insmod /usr/realtime/modules/rtai_hal.ko 
-sudo insmod /usr/realtime/modules/rtai_sched.ko 
-sudo insmod /usr/realtime/modules/rtai_sem.ko 
-sudo insmod /usr/realtime/modules/rtai_fifos.ko 
-sudo insmod /usr/realtime/modules/rtai_mbx.ko 
diff --git a/targets/RT/USER/make_for_usrp.sh b/targets/RT/USER/make_for_usrp.sh
deleted file mode 100755
index 998cd7c462..0000000000
--- a/targets/RT/USER/make_for_usrp.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-############### make nasmesh.ko ###############
-sudo rmmod nasmesh
-#cd ${OPENAIR2_DIR} && make nasmesh_netlink.ko
-#cd ${OPENAIR2_DIR}/NAS/DRIVER/MESH/RB_TOOL/ && make
-#make all
-sudo insmod $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko
-
-############## Ethernet config  ####################
-sudo ifconfig eth0 mtu 4000
-sudo sysctl -w net.core.wmem_max=1048576
-sudo sysctl -w net.core.rmem_max=50000000
-
-############## rtai modules ###################
-if test \! -c /dev/rtai_shm; then
-        sudo mknod -m 666 /dev/rtai_shm c 10 254
-fi
-for n in `seq 0 9`; do
-        f=/dev/rtf$n
-        if test \! -c $f; then
-                sudo mknod -m 666 $f c 150 $n
-        fi
-done
-sudo modprobe rtai_hal
-sudo modprobe rtai_sched
-sudo modprobe rtai_fifos
-sudo modprobe rtai_sem
-sudo modprobe rtai_mbx
-sudo modprobe rtai_msg
-
-############## make  ###################
-make lte-softmodem-usrp NAS=1 USRP=1 XFORMS=1 RTAI=1 HARD_RT=1 #DRIVER2013=1
-#make lte-softmodem NAS=1 XFORMS=1 USRP=0 RTAI=1 DRIVER2013=1
-echo DONE!
-exit 0
diff --git a/targets/RT/USER/msg_helper.c b/targets/RT/USER/msg_helper.c
deleted file mode 100644
index ac99e48ff7..0000000000
--- a/targets/RT/USER/msg_helper.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <rtai_sem.h>
-
-#include "msg_many.h"
-
-/*
- * Add a task task to ri->worker.
- * Return the used index in ri->worker on success
- * Return -TM_WORKER_FULL_ERROR if ri->worker full
- * Return -TM_WORKER_ERROR else
-*/
-int tm_add_task(RT_TASK *task, run_info_t *ri)
-{
-  if(ri->used >= NUM_THREADS)
-    return -TM_WORKER_FULL_ERROR;
-
-  rt_sem_wait(ri->update_sem);
-  (*ri->worker)[ri->used] = task;
-  ri->used++;
-  rt_sem_signal(ri->update_sem);
-
-  return ri->used - 1;
-}
-
-/*
- * Remove the a hole in worker at index index by
- * shift the next slots by one.
- * This function assume that update_sem are locked.
- * Return the new used counter.
-*/
-int _tm_clean_worker(RT_TASK *(*worker)[], int index, int used)
-{
-  int i;
-
-  for(i = index; i < used; i++)
-    (*worker)[i] = (*worker)[i + 1];
-
-  return used - 1;
-}
-
-/*
- * Remove a task from ri->worker a index task_index
- * Return 0 on success
- * Return -TM_WORKER_ERROR else
-*/
-int tm_del_task(int task_index, run_info_t *ri)
-{
-  rt_sem_wait(ri->update_sem);
-  ri->used = _tm_clean_worker(ri->worker, task_index, ri->used);
-  rt_sem_signal(ri->update_sem);
-
-  return 0;
-}
-
-/*
- * Return next index to use on ri->worker.
- * It depends on the old_index and ri->used.
- * Return -TM_WORKER_ERROR if ri->used == 0.
-*/
-inline int tm_get_next_task_index(int old_index, run_info_t *ri)
-{
-  if(ri->used == 0)
-    return -TM_WORKER_ERROR;
-
-  return (old_index + 1) % ri->used;
-}
-
diff --git a/targets/RT/USER/msg_many.c b/targets/RT/USER/msg_many.c
deleted file mode 100644
index 17e03c6c5a..0000000000
--- a/targets/RT/USER/msg_many.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-
-#include <rtai_lxrt.h>
-#include <rtai_sem.h>
-#include <rtai_msg.h>
-
-#include "msg_many.h"
-
-static void *msg_test_thread(void *arg)
-{
-  RT_TASK *self;
-  RT_TASK *sender_task;
-  thread_info_t *ti = (thread_info_t *)arg;
-  run_info_t *ri = ti->ri;
-  unsigned int msg;
-  int counter = 0;
-  char name[6];
-  int task_index;
-
-  /* Build custom task name for each thread */
-  snprintf(name, 6, "%s%03i", THREAD_NAME_PREFIX, ti->thread_num);
-
-  self = rt_task_init_schmod(nam2num(name), 0, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-
-  task_index = tm_add_task(self, ri);
-
-  if(task_index != -TM_WORKER_FULL_ERROR) {
-    while (*(ri->exit_condition) == 0) {
-      // wait only one PERIOD to avoid wait for ever
-      sender_task = rt_receive_timed(ri->sender, &msg, ri->period);
-
-      //sender_task = rt_receive(0, &msg);
-      if(sender_task == ri->sender)
-        counter++;
-    }
-
-    rt_printk("%s: counter == %i\n", name, counter);
-    tm_del_task(task_index, ri);
-  } else {
-    rt_printk("%s: Worker array full!\n", name);
-  }
-
-  rt_make_soft_real_time();
-
-  rt_task_delete(self);
-
-  free((void *) ti);
-
-  return 0;
-}
-
-
-int main(void)
-{
-  RT_TASK *self;
-  RT_TASK *tmp_worker_task;
-  RT_TASK *worker_tasks[NUM_THREADS];
-  int worker_threads[NUM_THREADS];
-  RTIME now;
-  unsigned int i, ii;
-  run_info_t ri;
-  thread_info_t *ti;
-  uint8_t exit_condition = 0;
-  int fail_count = 0;
-  int old_index = 0;
-  uint8_t lost;
-
-  // make main thread LXRT soft realtime
-  self = rt_task_init_schmod(nam2num("MAINTK"), 10, 0, 0, SCHED_FIFO, 0xF);
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  rt_make_hard_real_time();
-  rt_set_periodic_mode();
-  start_rt_timer(0);
-
-  /* Build all information need to run in main and the thread */
-  ri.sender = self;
-  ri.exit_condition = &exit_condition;
-  ri.period = nano2count(PERIOD);
-  ri.update_sem = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if(ri.update_sem == 0)
-    exit(-1);
-
-  ri.used = 0;
-  ri.worker = &worker_tasks;
-
-  now = rt_get_time() + ri.period;
-  rt_task_make_periodic(self, now, ri.period);
-
-  /* start all threads */
-  for(i = 0; i < NUM_THREADS; i++) {
-    ti = (thread_info_t *)malloc(sizeof(thread_info_t));
-
-    if(ti == NULL) {
-      rt_printk("MAINTK: can't get memory!\n");
-      exit(-1);
-    }
-
-    ti->ri = &ri;
-    ti->thread_num = i;
-    worker_threads[i] = rt_thread_create(msg_test_thread, ti , 10000);
-  }
-
-  rt_sleep(NUM_THREADS * ri.period);
-
-  rt_printk("start\n");
-
-  for(i = 0; i < THRESHOLD; i++) {
-    rt_task_wait_period();
-    lost = 1;
-
-    for(ii = 0; ii < ri.used; ii++) {
-      old_index = tm_get_next_task_index(old_index, &ri);
-
-      if(old_index == -TM_WORKER_ERROR) {
-        rt_printk("MAINTK: No Tasks!\n");
-        break;
-      }
-
-      tmp_worker_task = rt_send_if(worker_tasks[old_index], i);
-
-      if(tmp_worker_task == worker_tasks[old_index]) {
-        lost = 0;
-        break;
-      }
-    }
-
-    if(lost)
-      fail_count++;
-  }
-
-  rt_printk("fail_count == %i\n", fail_count);
-
-  // cleanup
-  exit_condition = 1;
-  rt_make_soft_real_time();
-
-  rt_task_delete(self);
-
-  /* wait for the worker threadss  */
-  for(ii = 0; ii < ri.used; ii++) {
-    rt_thread_join(worker_threads[ii]);
-  }
-
-  stop_rt_timer();
-  return 0;
-}
diff --git a/targets/RT/USER/msg_many.h b/targets/RT/USER/msg_many.h
deleted file mode 100644
index 5b9d465e33..0000000000
--- a/targets/RT/USER/msg_many.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-#ifndef __MSG_MANY_H__
-#define __MSG_MANY_H__
-#include <stdint.h>
-
-#define PERIOD 500000 /* in nano seconds */
-#define THRESHOLD 1000000
-#define THREAD_NAME_PREFIX "TK"
-#define NUM_THREADS 10
-
-#define TM_WORKER_FULL_ERROR 1
-#define TM_WORKER_ERROR 2
-
-typedef struct run_info {
-  RT_TASK *sender;
-  uint8_t *exit_condition;
-  long long period;
-  SEM *update_sem; /* protect the task array */
-  int used; /* counter of used slots in worker */
-  RT_TASK *(*worker)[]; /* declare worker as pointer to array of pointer to RT_TASK */
-} run_info_t;
-
-typedef struct thread_info {
-  run_info_t *ri;
-  uint8_t thread_num;
-} thread_info_t;
-
-int tm_add_task(RT_TASK *task, run_info_t *ri);
-int tm_del_task(int task_index, run_info_t *ri);
-inline int tm_get_next_task_index(int old_index, run_info_t *ri);
-
-#endif
-
diff --git a/targets/RT/USER/sleeptest.c b/targets/RT/USER/sleeptest.c
deleted file mode 100644
index ba5cb0ce15..0000000000
--- a/targets/RT/USER/sleeptest.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-#include <pthread.h>
-
-#include "rt_wrapper.h"
-
-#define TIMER_ONESHOT_MODE
-#define FRAME_PERIOD 10000000ULL
-#define DAQ_PERIOD 500000ULL
-#define LTE_SLOTS_PER_FRAME  20
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-static long int thread1;
-//static long int sync_thread;
-#else
-#define OPENAIR_THREAD_STACK_SIZE    8192
-#define OPENAIR_THREAD_PRIORITY        255
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-int oai_exit = 0;
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-int frame=0,slot=0;
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME now;
-#endif
-  unsigned char last_slot, next_slot;
-  RTIME time_in, time_diff;
-  int ret;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  printf("Started eNB thread (id %p)\n",task);
-#ifndef TIMER_ONESHOT_MODE
-  now = rt_get_time();
-  ret = rt_task_make_periodic(task, now, nano2count(DAQ_PERIOD));
-
-  if (ret!=0)
-    printf("Problem with periodic timer\n");
-
-#endif
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    time_in = rt_get_time_ns();
-#ifdef TIMER_ONESHOT_MODE
-    ret = rt_sleep_ns(DAQ_PERIOD);
-
-    if (ret)
-      printf("eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame,time_in,ret);
-
-#else
-    rt_task_wait_period();
-#endif
-    time_diff = rt_get_time_ns() - time_in;
-
-    if (time_diff > timing_info.time_max)
-      timing_info.time_max = time_diff;
-
-    if (time_diff < timing_info.time_min)
-      timing_info.time_min = time_diff;
-
-    timing_info.time_avg = (timing_info.time_avg*timing_info.n_samples + time_diff)/(timing_info.n_samples+1);
-    timing_info.n_samples++;
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-  }
-
-  printf("eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  printf("Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME period;
-#else
-  int error_code;
-#endif
-  int i,j,aa;
-  void *status;
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-#ifdef TIMER_ONESHOT_MODE
-  rt_set_oneshot_mode();
-  start_rt_timer(0);
-  printf("started RTAI timer in oneshot mode\n");
-#else
-  rt_set_periodic_mode();
-  period = start_rt_timer(nano2count(500000));
-  printf("started RTAI timer with period %llu ns\n",count2nano(period));
-#endif
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-#ifdef RTAI
-  thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-  error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-  if (error_code!= 0) {
-    printf("[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-    return(error_code);
-  } else {
-    printf("[lte-softmodem.c] Allocate eNB_thread successful\n");
-  }
-
-#endif
-  printf("eNB threads created\n");
-
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0) {
-
-    printf("eNB Frame %d, hw_slot %d (time %llu): period %llu, sleep time (avg/min/max/samples) %llu / %llu / %llu / %d, ratio %f\n",frame,slot,rt_get_time_ns(),DAQ_PERIOD,timing_info.time_avg,
-           timing_info.time_min,timing_info.time_max,timing_info.n_samples,(double)timing_info.time_avg/DAQ_PERIOD);
-
-
-    rt_sleep_ns(100*FRAME_PERIOD);
-  }
-
-  // stop threads
-#ifdef RTAI
-  rt_thread_join(thread0);
-#else
-  pthread_join(thread0,&status);
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  return 0;
-}
-
diff --git a/targets/RT/USER/synctest.c b/targets/RT/USER/synctest.c
deleted file mode 100644
index ff65231df1..0000000000
--- a/targets/RT/USER/synctest.c
+++ /dev/null
@@ -1,1318 +0,0 @@
-/*
- * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The OpenAirInterface Software Alliance licenses this file to You under
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.openairinterface.org/?page_id=698
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *-------------------------------------------------------------------------------
- * For more information about the OpenAirInterface (OAI) Software Alliance:
- *      contact@openairinterface.org
- */
-
-/*! \file lte-softmodem.c
-* \brief main program to control HW and scheduling
-* \author R. Knopp, F. Kaltenberger
-* \date 2012
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <signal.h>
-#include <execinfo.h>
-#include <getopt.h>
-
-#include "rt_wrapper.h"
-
-#include "PHY/types.h"
-//#include "PHY/defs.h"
-#include "openair0_lib.h"
-
-#include "UTIL/LOG/log.h"
-#include "UTIL/LOG/vcd_signal_dumper.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface_init.h"
-# include "timer.h"
-# if defined(ENABLE_USE_MME)
-#   include "s1ap_eNB.h"
-#   include "sctp_eNB_task.h"
-# endif
-#endif
-
-#ifdef XFORMS
-#include "PHY/TOOLS/lte_phy_scope.h"
-#include "stats.h"
-// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
-// at eNB 0, an UL scope for every UE
-FD_lte_phy_scope_ue  *form_ue[NUMBER_OF_UE_MAX];
-FD_lte_phy_scope_enb *form_enb[NUMBER_OF_UE_MAX];
-FD_stats_form *form_stats=NULL;
-char title[255];
-unsigned char scope_enb_num_ue = 1;
-#endif //XFORMS
-
-#ifdef EMOS
-#include <gps.h>
-#include <rtai_fifos.h>
-
-//#define CHANSOUNDER_FIFO_SIZE 10485760 // 10 Mbytes FIFO
-#define CHANSOUNDER_FIFO_SIZE 20971520  // 20 Mbytes FIFO
-#define CHANSOUNDER_FIFO_MINOR 4               // minor of the FIFO device - this is /dev/rtf3
-#define CHANSOUNDER_FIFO_DEV "/dev/rtf4"
-#endif
-
-#define TIMER_ONESHOT_MODE
-#define FRAME_PERIOD 100000000ULL
-#define DAQ_PERIOD 66667ULL
-#define LTE_SLOTS_PER_FRAME  20
-#define RESAMPLING_FACTOR 2
-#define SAMPLES_PER_SLOT (15360/(1<<RESAMPLING_FACTOR))
-#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
-
-#ifdef RTAI
-static SEM *mutex;
-//static CND *cond;
-
-static long int thread0;
-static long int thread1;
-//static long int sync_thread;
-#else
-#define OPENAIR_THREAD_STACK_SIZE    8192
-#define OPENAIR_THREAD_PRIORITY        255
-pthread_t thread0;
-//pthread_t thread1;
-pthread_attr_t attr_dlsch_threads;
-struct sched_param sched_param_dlsch;
-#endif
-
-pthread_t  thread2; //xforms
-pthread_t  thread3; //emos
-
-/*
-static int instance_cnt=-1; //0 means worker is busy, -1 means its free
-int instance_cnt_ptr_kern,*instance_cnt_ptr_user;
-int pci_interface_ptr_kern;
-*/
-//extern unsigned int bigphys_top;
-//extern unsigned int mem_base;
-
-int card = 0;
-exmimo_config_t *p_exmimo_config;
-exmimo_id_t     *p_exmimo_id;
-volatile unsigned int *DAQ_MBOX;
-
-int oai_exit = 0;
-
-//int time_offset[4] = {-138,-138,-138,-138};
-//int time_offset[4] = {-145,-145,-145,-145};
-int time_offset[4] = {0,0,0,0};
-
-int fs4_test=0;
-char UE_flag=0;
-uint8_t  eNB_id=0,UE_id=0;
-
-uint32_t carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000};
-
-struct timing_info_t {
-  //unsigned int frame, hw_slot, last_slot, next_slot;
-  RTIME time_min, time_max, time_avg, time_last, time_now;
-  //unsigned int mbox0, mbox1, mbox2, mbox_target;
-  unsigned int n_samples;
-} timing_info;
-
-extern int16_t* sync_corr_ue0;
-extern int16_t prach_ifft[4][1024*2];
-
-
-int rx_input_level_dBm;
-#ifdef XFORMS
-extern int otg_enabled;
-#else
-int otg_enabled;
-#endif
-int number_of_cards = 1;
-
-int mbox_bounds[20] = {8,16,24,30,38,46,54,60,68,76,84,90,98,106,114,120,128,136,144, 0}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-//int mbox_bounds[20] = {6,14,22,28,36,44,52,58,66,74,82,88,96,104,112,118,126,134,142, 148}; ///boundaries of slots in terms ob mbox counter rounded up to even numbers
-
-int init_dlsch_threads(void);
-void cleanup_dlsch_threads(void);
-int32_t init_rx_pdsch_thread(void);
-void cleanup_rx_pdsch_thread(void);
-int init_ulsch_threads(void);
-void cleanup_ulsch_threads(void);
-
-//void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-//void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier);
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag);
-
-unsigned int build_rflocal(int txi, int txq, int rxi, int rxq)
-{
-  return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
-}
-unsigned int build_rfdc(int dcoff_i_rxfe, int dcoff_q_rxfe)
-{
-  return (dcoff_i_rxfe + (dcoff_q_rxfe<<8));
-}
-
-void signal_handler(int sig)
-{
-  void *array[10];
-  size_t size;
-
-  if (sig==SIGSEGV) {
-    // get void*'s for all entries on the stack
-    size = backtrace(array, 10);
-
-    // print out all the frames to stderr
-    fprintf(stderr, "Error: signal %d:\n", sig);
-    backtrace_symbols_fd(array, size, 2);
-    exit(-1);
-  } else {
-    oai_exit=1;
-  }
-}
-
-void exit_fun(const char* s)
-{
-  void *array[10];
-  size_t size;
-
-  printf("Exiting: %s\n",s);
-
-  oai_exit=1;
-  //rt_sleep_ns(FRAME_PERIOD);
-
-  //exit (-1);
-}
-
-#ifdef XFORMS
-void *scope_thread(void *arg)
-{
-  int16_t prach_corr[1024], i;
-  char stats_buffer[16384];
-  //FILE *UE_stats, *eNB_stats;
-  int len=0;
-  struct sched_param sched_param;
-
-  sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("Scope thread has priority %d\n",sched_param.sched_priority);
-
-  /*
-    if (UE_flag==1)
-    UE_stats  = fopen("UE_stats.txt", "w");
-    else
-    eNB_stats = fopen("eNB_stats.txt", "w");
-  */
-
-  while (!oai_exit) {
-    if (UE_flag==1) {
-      len = dump_ue_stats (PHY_vars_UE_g[0], stats_buffer, 0, mode,rx_input_level_dBm);
-      fl_set_object_label(form_stats->stats_text, stats_buffer);
-      //rewind (UE_stats);
-      //fwrite (stats_buffer, 1, len, UE_stats);
-
-      phy_scope_UE(form_ue[UE_id],
-                   PHY_vars_UE_g[UE_id],
-                   eNB_id,
-                   UE_id,7);
-
-    } else {
-      len = dump_eNB_stats (PHY_vars_eNB_g[0], stats_buffer, 0);
-      fl_set_object_label(form_stats->stats_text, stats_buffer);
-
-      //rewind (eNB_stats);
-      //fwrite (stats_buffer, 1, len, eNB_stats);
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        phy_scope_eNB(form_enb[UE_id],
-                      PHY_vars_eNB_g[eNB_id],
-                      UE_id);
-      }
-
-    }
-
-    //printf("doing forms\n");
-    usleep(100000);
-  }
-
-  //fclose (UE_stats);
-  //fclose (eNB_stats);
-
-  pthread_exit((void*)arg);
-}
-#endif
-
-int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
-
-#ifdef EMOS
-#define NO_ESTIMATES_DISK 20 //No. of estimates that are aquired before dumped to disk
-int channel_buffer_size =  SAMPLES_PER_SLOT*4; //one slot, 4 byte per sample
-
-
-void *emos_thread (void *arg)
-{
-  char c;
-  char *fifo2file_buffer, *fifo2file_ptr;
-
-  int fifo, counter=0, bytes;
-  long long unsigned int total_bytes=0;
-
-  FILE  *dumpfile_id;
-  char  dumpfile_name[1024];
-  time_t starttime_tmp;
-  struct tm starttime;
-
-  time_t timer;
-  struct tm *now;
-
-  struct gps_data_t *gps_data = NULL;
-  struct gps_fix_t dummy_gps_data;
-
-  struct sched_param sched_param;
-  int ret;
-
-  sched_param.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
-  sched_setscheduler(0, SCHED_FIFO,&sched_param);
-
-  printf("EMOS thread has priority %d\n",sched_param.sched_priority);
-
-  timer = time(NULL);
-  now = localtime(&timer);
-
-  memset(&dummy_gps_data,1,sizeof(struct gps_fix_t));
-
-#if GPSD_API_MAJOR_VERSION>=5
-  ret = gps_open("127.0.0.1","2947",gps_data);
-
-  if (ret!=0)
-#else
-  gps_data = gps_open("127.0.0.1","2947");
-
-  if (gps_data == NULL)
-#endif
-  {
-    printf("[EMOS] Could not open GPS\n");
-    //exit(-1);
-  }
-
-#if GPSD_API_MAJOR_VERSION>=4
-  else if (gps_stream(gps_data, WATCH_ENABLE,NULL) != 0)
-#else
-  else if (gps_query(gps_data, "w+x") != 0)
-#endif
-  {
-    //sprintf(tmptxt,"Error sending command to GPS, gps_data = %x", gps_data);
-    printf("[EMOS] Error sending command to GPS\n");
-    //exit(-1);
-  } else
-    printf("[EMOS] Opened GPS, gps_data=%p\n", gps_data);
-
-  /*
-  if (UE_flag==0)
-    channel_buffer_size = sizeof(fifo_dump_emos_eNB);
-  else
-    channel_buffer_size = sizeof(fifo_dump_emos_UE);
-  */
-
-  // allocate memory for NO_FRAMES_DISK channes estimations
-  fifo2file_buffer = malloc(NO_ESTIMATES_DISK*channel_buffer_size);
-  fifo2file_ptr = fifo2file_buffer;
-
-  if (fifo2file_buffer == NULL) {
-    printf("[EMOS] Cound not allocate memory for fifo2file_buffer\n");
-    exit(EXIT_FAILURE);
-  }
-
-  if ((fifo = open(CHANSOUNDER_FIFO_DEV, O_RDONLY)) < 0) {
-    fprintf(stderr, "[EMOS] Error opening the fifo\n");
-    exit(EXIT_FAILURE);
-  }
-
-
-  time(&starttime_tmp);
-  localtime_r(&starttime_tmp,&starttime);
-  snprintf(dumpfile_name,1024,"/tmp/%s_data_%d%02d%02d_%02d%02d%02d.EMOS",
-           (UE_flag==0) ? "eNB" : "UE",
-           1900+starttime.tm_year, starttime.tm_mon+1, starttime.tm_mday, starttime.tm_hour, starttime.tm_min, starttime.tm_sec);
-
-  dumpfile_id = fopen(dumpfile_name,"w");
-
-  if (dumpfile_id == NULL) {
-    fprintf(stderr, "[EMOS] Error opening dumpfile %s\n",dumpfile_name);
-    exit(EXIT_FAILURE);
-  }
-
-
-  printf("[EMOS] starting dump, channel_buffer_size=%d ...\n",channel_buffer_size);
-
-  while (!oai_exit) {
-    bytes = rtf_read_timed(fifo, fifo2file_ptr, channel_buffer_size,100);
-
-    if (bytes<=0)
-      continue;
-
-    /*
-    if (UE_flag==0)
-    printf("eNB: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_eNB*)fifo2file_ptr)->frame_tx,bytes);
-    else
-    printf("UE: count %d, frame %d, read: %d bytes from the fifo\n",counter, ((fifo_dump_emos_UE*)fifo2file_ptr)->frame_rx,bytes);
-    */
-
-    fifo2file_ptr += channel_buffer_size;
-    counter ++;
-    total_bytes += bytes;
-
-    if ((counter%NO_ESTIMATES_DISK)==0) {
-      //reset stuff
-      fifo2file_ptr = fifo2file_buffer;
-      //counter = 0;
-
-      //flush buffer to disk
-      if (fwrite(fifo2file_buffer, sizeof(char), NO_ESTIMATES_DISK*channel_buffer_size, dumpfile_id) != NO_ESTIMATES_DISK*channel_buffer_size) {
-        fprintf(stderr, "[EMOS] Error writing to dumpfile\n");
-        exit(EXIT_FAILURE);
-      }
-
-      /*
-      if (gps_data)
-        {
-          if (gps_poll(gps_data) != 0) {
-      printf("[EMOS] problem polling data from gps\n");
-          }
-          else {
-      printf("[EMOS] lat %g, lon %g\n",gps_data->fix.latitude,gps_data->fix.longitude);
-          }
-          if (fwrite(&(gps_data->fix), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
-      {
-        printf("[EMOS] Error writing to dumpfile, stopping recording\n");
-        exit(EXIT_FAILURE);
-      }
-        }
-      else
-        {
-          printf("[EMOS] WARNING: No GPS data available, storing dummy packet\n");
-          if (fwrite(&(dummy_gps_data), sizeof(char), sizeof(struct gps_fix_t), dumpfile_id) != sizeof(struct gps_fix_t))
-      {
-        printf("[EMOS] Error writing to dumpfile, stopping recording\n");
-        exit(EXIT_FAILURE);
-      }
-        }
-      */
-    }
-
-    if ((counter%2000)==0)
-      printf("[EMOS] count %d (%d sec), total bytes wrote %llu\n", counter, counter/2000, total_bytes);
-  }
-
-  free(fifo2file_buffer);
-  fclose(dumpfile_id);
-  close(fifo);
-
-  pthread_exit((void*) arg);
-
-}
-#endif
-
-/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
-static void *eNB_thread(void *arg)
-{
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME now;
-#endif
-  unsigned char slot=0,last_slot, next_slot;
-  int hw_slot,frame=0;
-  unsigned int msg1;
-  unsigned int aa,slot_offset, slot_offset_F;
-  int diff;
-  int delay_cnt;
-  RTIME time_in, time_diff;
-  int mbox_target=0,mbox_current=0;
-  int i,ret;
-  int tx_offset;
-  int bytes;
-
-#ifdef RTAI
-  task = rt_task_init_schmod(nam2num("TASK0"), 0, 0, 0, SCHED_FIFO, 0xF);
-  LOG_D(HW,"Started eNB thread (id %p)\n",task);
-#ifndef TIMER_ONESHOT_MODE
-  now = rt_get_time();
-  ret = rt_task_make_periodic(task, now, nano2count(500000LL));
-
-  if (ret!=0)
-    LOG_E(HW,"Problem with periodic timer\n");
-
-#endif
-#endif
-
-#ifdef HARD_RT
-  rt_make_hard_real_time();
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-  timing_info.time_min = 100000000ULL;
-  timing_info.time_max = 0;
-  timing_info.time_avg = 0;
-  timing_info.n_samples = 0;
-
-  while (!oai_exit) {
-    hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB frame %d, time %llu: slot %d, hw_slot %d (mbox %d)\n",frame,rt_get_time_ns(),slot,hw_slot,((unsigned int *)DAQ_MBOX)[0]);
-    //this is the mbox counter where we should be
-    //mbox_target = ((((slot+1)%20)*15+1)>>1)%150;
-    mbox_target = mbox_bounds[slot];
-    //this is the mbox counter where we are
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    //this is the time we need to sleep in order to synchronize with the hw (in multiples of DAQ_PERIOD)
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_ENB, slot);
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_ENB, frame);
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0]));
-    VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DIFF, diff);
-
-    time_in = rt_get_time_ns();
-    //LOG_D(HW,"eNB Frame %d delaycnt %d : hw_slot %d (%d), slot %d, (slot+1)*15=%d, diff %d, time %llu\n",frame,delay_cnt,hw_slot,((unsigned int *)DAQ_MBOX)[0],slot,(((slot+1)*15)>>1),diff,time_in);
-    //LOG_D(HW,"eNB Frame %d, time %llu: sleeping for %llu (slot %d, hw_slot %d, diff %d, mbox %d, delay_cnt %d)\n", frame, time_in, diff*DAQ_PERIOD,slot,hw_slot,diff,((volatile unsigned int *)DAQ_MBOX)[0],delay_cnt);
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP,1);
-#ifdef TIMER_ONESHOT_MODE
-    //ret = rt_sleep_ns(DAQ_PERIOD * (slot%4==0?6:8));
-    ret = rt_sleep_ns(500000);
-
-    if (ret)
-      LOG_D(HW,"eNB Frame %d, time %llu: rt_sleep_ns returned %d\n",frame, time_in);
-
-#else
-    rt_task_wait_period();
-#endif
-    VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RT_SLEEP,0);
-
-    //hw_slot = (((((volatile unsigned int *)DAQ_MBOX)[0]+1)%150)<<1)/15;
-    //LOG_D(HW,"eNB Frame %d : hw_slot %d, time %llu\n",frame,hw_slot,rt_get_time_ns());
-
-    mbox_current = ((volatile unsigned int *)DAQ_MBOX)[0];
-
-    if ((mbox_current>=135) && (mbox_target<15)) //handle the frame wrap-arround
-      diff = 150-mbox_current+mbox_target;
-    else if ((mbox_current<15) && (mbox_target>=135))
-      diff = -150+mbox_target-mbox_current;
-    else
-      diff = mbox_target - mbox_current;
-
-
-    last_slot = (slot)%LTE_SLOTS_PER_FRAME;
-
-    if (last_slot <0)
-      last_slot+=20;
-
-    next_slot = (slot+3)%LTE_SLOTS_PER_FRAME;
-
-    slot++;
-
-    if (slot==20) {
-      slot=0;
-      frame++;
-    }
-
-    if (frame==1000)
-      oai_exit=1;
-
-#if defined(ENABLE_ITTI)
-    itti_update_lte_time(frame, slot);
-#endif
-  }
-
-  LOG_D(HW,"eNB_thread: finished, ran %d times.\n",frame);
-
-#ifdef HARD_RT
-  rt_make_soft_real_time();
-#endif
-
-  // clean task
-#ifdef RTAI
-  rt_task_delete(task);
-#endif
-  LOG_D(HW,"Task deleted. returning\n");
-  return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-
-#ifdef RTAI
-  RT_TASK *task;
-  RTIME period;
-#endif
-  int i,j,aa;
-  void *status;
-
-  /*
-  uint32_t rf_mode_max[4]     = {55759,55759,55759,55759};
-  uint32_t rf_mode_med[4]     = {39375,39375,39375,39375};
-  uint32_t rf_mode_byp[4]     = {22991,22991,22991,22991};
-  */
-  uint32_t my_rf_mode = RXEN + TXEN + TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM + DMAMODE_RX + DMAMODE_TX;
-  uint32_t rf_mode_base = TXLPFNORM + TXLPFEN + TXLPF25 + RXLPFNORM + RXLPFEN + RXLPF25 + LNA1ON +LNAMax + RFBBNORM;
-  uint32_t rf_mode[4]     = {my_rf_mode,0,0,0};
-  uint32_t rf_local[4]    = {8255000,8255000,8255000,8255000}; // UE zepto
-  //{8254617, 8254617, 8254617, 8254617}; //eNB khalifa
-  //{8255067,8254810,8257340,8257340}; // eNB PETRONAS
-
-  uint32_t rf_vcocal[4]   = {910,910,910,910};
-  uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015};
-  uint32_t rf_rxdc[4]     = {32896,32896,32896,32896};
-  uint32_t rxgain[4]      = {20,20,20,20};
-  uint32_t txgain[4]      = {20,20,20,20};
-
-  uint16_t Nid_cell = 0;
-  uint8_t  cooperation_flag=0, transmission_mode=1, abstraction_flag=0;
-  uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
-
-  int c;
-  char do_forms=0;
-  unsigned int fd;
-  unsigned int tcxo = 114;
-
-  int amp;
-  uint8_t prach_fmt;
-  int N_ZC;
-
-  char rxg_fname[100];
-  char txg_fname[100];
-  char rflo_fname[100];
-  char rfdc_fname[100];
-  FILE *rxg_fd=NULL;
-  FILE *txg_fd=NULL;
-  FILE *rflo_fd=NULL;
-  FILE *rfdc_fd=NULL;
-  unsigned int rxg_max[4]= {133,133,133,133}, rxg_med[4]= {127,127,127,127}, rxg_byp[4]= {120,120,120,120};
-  int tx_max_power=0;
-
-  char line[1000];
-  int l;
-  int ret, ant;
-  int ant_offset=0;
-
-  int error_code;
-  char *itti_dump_file = NULL;
-
-  const struct option long_options[] = {
-    {"calib-ue-rx", required_argument, NULL, 256},
-    {"calib-ue-rx-med", required_argument, NULL, 257},
-    {"calib-ue-rx-byp", required_argument, NULL, 258},
-    {"debug-ue-prach", no_argument, NULL, 259},
-    {"no-L2-connect", no_argument, NULL, 260},
-    {NULL, 0, NULL, 0}
-  };
-
-  //mode = normal_txrx;
-
-
-  while ((c = getopt_long (argc, argv, "C:K:O:ST:UdF:V",long_options,NULL)) != -1) {
-    switch (c) {
-    case 'V':
-      ouput_vcd = 1;
-      break;
-
-    case 'd':
-      do_forms=1;
-      break;
-
-    case 'U':
-      UE_flag = 1;
-      break;
-
-    case 'C':
-      carrier_freq[0] = atoi(optarg);
-      carrier_freq[1] = atoi(optarg);
-      carrier_freq[2] = atoi(optarg);
-      carrier_freq[3] = atoi(optarg);
-      break;
-
-    case 'S':
-      fs4_test=1;
-      break;
-
-    case 'T':
-      tcxo=atoi(optarg);
-      break;
-
-    case 'K':
-#if defined(ENABLE_ITTI)
-      itti_dump_file = strdup(optarg);
-#else
-      printf("-K option is disabled when ENABLE_ITTI is not defined\n");
-#endif
-      break;
-
-    case 'O':
-#if defined(ENABLE_USE_MME)
-      EPC_MODE_ENABLED = 1;
-
-      if (optarg == NULL) { /* No IP address provided: use localhost */
-        memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
-      } else {
-        uint8_t ip_length = strlen(optarg) + 1;
-        memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
-               ip_length > 16 ? 16 : ip_length);
-      }
-
-#else
-      printf("You enabled mme mode without s1ap compiled...\n");
-#endif
-      break;
-
-    case 'F':
-      sprintf(rxg_fname,"%srxg.lime",optarg);
-      rxg_fd = fopen(rxg_fname,"r");
-
-      if (rxg_fd) {
-        printf("Loading RX Gain parameters from %s\n",rxg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), rxg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
-          else {
-            if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
-
-            if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
-
-            if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",rxg_fname);
-
-      sprintf(txg_fname,"%stxg.lime",optarg);
-      txg_fd = fopen(txg_fname,"r");
-
-      if (txg_fd) {
-        printf("Loading TX Gain parameters from %s\n",txg_fname);
-        l=0;
-
-        while (fgets(line, sizeof(line), txg_fd)) {
-          if ((strlen(line)==0) || (*line == '#')) {
-            continue; //ignore empty or comment lines
-          } else {
-            if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
-
-            if (l==1) sscanf(line,"%d",&tx_max_power);
-
-            l++;
-          }
-        }
-      } else
-        printf("%s not found, running with defaults\n",txg_fname);
-
-      sprintf(rflo_fname,"%srflo.lime",optarg);
-      rflo_fd = fopen(rflo_fname,"r");
-
-      if (rflo_fd) {
-        printf("Loading RF LO parameters from %s\n",rflo_fname);
-        fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
-      } else
-        printf("%s not found, running with defaults\n",rflo_fname);
-
-      sprintf(rfdc_fname,"%srfdc.lime",optarg);
-      rfdc_fd = fopen(rfdc_fname,"r");
-
-      if (rfdc_fd) {
-        printf("Loading RF DC parameters from %s\n",rfdc_fname);
-        fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
-      } else
-        printf("%s not found, running with defaults\n",rfdc_fname);
-
-      break;
-
-      /*
-      case 256:
-      mode = rx_calib_ue;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 257:
-      mode = rx_calib_ue_med;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 258:
-      mode = rx_calib_ue_byp;
-      rx_input_level_dBm = atoi(optarg);
-      printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
-      break;
-      case 259:
-      mode = debug_prach;
-      break;
-      case 260:
-      mode = no_L2_connect;
-      break;
-      */
-    default:
-      break;
-    }
-  }
-
-  if (UE_flag==1)
-    printf("configuring for UE\n");
-  else
-    printf("configuring for eNB\n");
-
-  //randominit (0);
-  //set_taus_seed (0);
-
-  // initialize the log (see log.h for details)
-  logInit();
-
-#if defined(ENABLE_ITTI)
-  itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
-
-# if defined(ENABLE_USE_MME)
-
-  if (itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing SCTP task interface: FAILED\n");
-    return -1;
-  }
-
-  if (itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
-    return -1;
-  }
-
-# endif
-
-  if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
-    LOG_E(EMU, "Create task failed");
-    LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
-    return -1;
-  }
-
-  // Handle signals until all tasks are terminated
-  //   itti_wait_tasks_end();
-#endif
-
-  if (ouput_vcd) {
-    if (UE_flag==1)
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd");
-    else
-      VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd");
-  }
-
-#ifdef PDCP_USE_NETLINK
-  netlink_init();
-#endif
-
-  // to make a graceful exit when ctrl-c is pressed
-  signal(SIGSEGV, signal_handler);
-  signal(SIGINT, signal_handler);
-
-#ifndef RTAI
-  check_clock();
-#endif
-
-  g_log->log_component[HW].level = LOG_DEBUG;
-  g_log->log_component[HW].flag  = LOG_HIGH;
-#ifdef OPENAIR2
-  g_log->log_component[PHY].level = LOG_INFO;
-#else
-  g_log->log_component[PHY].level = LOG_INFO;
-#endif
-  g_log->log_component[PHY].flag  = LOG_HIGH;
-  g_log->log_component[MAC].level = LOG_INFO;
-  g_log->log_component[MAC].flag  = LOG_HIGH;
-  g_log->log_component[RLC].level = LOG_INFO;
-  g_log->log_component[RLC].flag  = LOG_HIGH;
-  g_log->log_component[PDCP].level = LOG_INFO;
-  g_log->log_component[PDCP].flag  = LOG_HIGH;
-  g_log->log_component[OTG].level = LOG_INFO;
-  g_log->log_component[OTG].flag  = LOG_HIGH;
-  g_log->log_component[RRC].level = LOG_INFO;
-  g_log->log_component[RRC].flag  = LOG_HIGH;
-
-
-  // Initialize card
-  ret = openair0_open();
-
-  if ( ret != 0 ) {
-    if (ret == -1)
-      printf("Error opening /dev/openair0");
-
-    if (ret == -2)
-      printf("Error mapping bigshm");
-
-    if (ret == -3)
-      printf("Error mapping RX or TX buffer");
-
-    return(ret);
-  }
-
-  printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[card]);
-
-  p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
-  p_exmimo_id     = openair0_exmimo_pci[card].exmimo_id_ptr;
-
-  printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
-
-  if (p_exmimo_id->board_swrev>=BOARD_SWREV_CNTL2)
-    p_exmimo_config->framing.eNB_flag   = 0;
-  else
-    p_exmimo_config->framing.eNB_flag   = !UE_flag;
-
-  p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
-
-  for (ant=0; ant<4; ant++)
-    p_exmimo_config->framing.resampling_factor[ant] = RESAMPLING_FACTOR;
-
-  /*
-  for (ant=0;ant<max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant++)
-    p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-  for (ant=0;ant<frame_parms->nb_antennas_tx;ant++)
-    p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-  for (ant=0;ant<frame_parms->nb_antennas_rx;ant++)
-    p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-  for (ant=max(frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);ant<4;ant++) {
-    p_exmimo_config->rf.rf_mode[ant] = 0;
-    carrier_freq[ant] = 0; //this turns off all other LIMEs
-  }
-  */
-
-  ant_offset = 0;
-
-  for (ant=0; ant<4; ant++) {
-    if (ant==ant_offset) {
-      //if (1) {
-      p_exmimo_config->rf.rf_mode[ant] = rf_mode_base;
-      //p_exmimo_config->rf.rf_mode[ant] += (TXEN + DMAMODE_TX);
-      p_exmimo_config->rf.rf_mode[ant] += (RXEN + DMAMODE_RX);
-    } else {
-      p_exmimo_config->rf.rf_mode[ant] = 0;
-      carrier_freq[ant] = 0; //this turns off all other LIMEs
-    }
-  }
-
-  for (ant = 0; ant<4; ant++) {
-    p_exmimo_config->rf.do_autocal[ant] = 1;
-    p_exmimo_config->rf.rf_freq_rx[ant] = carrier_freq[ant];
-    p_exmimo_config->rf.rf_freq_tx[ant] = carrier_freq[ant];
-    p_exmimo_config->rf.rx_gain[ant][0] = rxgain[ant];
-    p_exmimo_config->rf.tx_gain[ant][0] = txgain[ant];
-
-    p_exmimo_config->rf.rf_local[ant]   = rf_local[ant];
-    p_exmimo_config->rf.rf_rxdc[ant]    = rf_rxdc[ant];
-
-    if ((carrier_freq[ant] >= 850000000) && (carrier_freq[ant] <= 865000000)) {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal_850[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = DD_TDD;
-    } else if ((carrier_freq[ant] >= 1900000000) && (carrier_freq[ant] <= 2000000000)) {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = B19G_TDD;
-    } else {
-      p_exmimo_config->rf.rf_vcocal[ant]  = rf_vcocal[ant];
-      p_exmimo_config->rf.rffe_band_mode[ant] = 0;
-    }
-
-    p_exmimo_config->rf.rffe_gain_txlow[ant] = 31;
-    p_exmimo_config->rf.rffe_gain_txhigh[ant] = 31;
-    p_exmimo_config->rf.rffe_gain_rxfinal[ant] = 52;
-    p_exmimo_config->rf.rffe_gain_rxlow[ant] = 31;
-  }
-
-
-  number_of_cards = openair0_num_detected_cards;
-  /*
-  if (p_exmimo_id->board_exmimoversion==1) //ExpressMIMO1
-    openair_daq_vars.timing_advance = 138;
-  else //ExpressMIMO2
-    openair_daq_vars.timing_advance = 0;
-  */
-
-  openair0_dump_config(card);
-
-  printf("EXMIMO_CONFIG: rf_mode 0x %x %x %x %x, [0]: TXRXEn %d, TXLPFEn %d, TXLPF %d, RXLPFEn %d, RXLPF %d, RFBB %d, LNA %d, LNAGain %d, RXLPFMode %d, SWITCH %d, rf_rxdc %d, rf_local %d, rf_vcocal %d\n",
-         p_exmimo_config->rf.rf_mode[0],
-         p_exmimo_config->rf.rf_mode[1],
-         p_exmimo_config->rf.rf_mode[2],
-         p_exmimo_config->rf.rf_mode[3],
-         (p_exmimo_config->rf.rf_mode[0]&3),  // RXen+TXen
-         (p_exmimo_config->rf.rf_mode[0]&4)>>2,         //TXLPFen
-         (p_exmimo_config->rf.rf_mode[0]&TXLPFMASK)>>3, //TXLPF
-         (p_exmimo_config->rf.rf_mode[0]&128)>>7,      //RXLPFen
-         (p_exmimo_config->rf.rf_mode[0]&RXLPFMASK)>>8, //TXLPF
-         (p_exmimo_config->rf.rf_mode[0]&RFBBMASK)>>16, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&LNAMASK)>>12, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&LNAGAINMASK)>>14, // RFBB mode
-         (p_exmimo_config->rf.rf_mode[0]&RXLPFMODEMASK)>>19, // RXLPF mode
-         (p_exmimo_config->framing.tdd_config&TXRXSWITCH_MASK)>>1, // Switch mode
-         p_exmimo_config->rf.rf_rxdc[0],
-         p_exmimo_config->rf.rf_local[0],
-         p_exmimo_config->rf.rf_vcocal[0]);
-
-  for (ant=0; ant<4; ant++)
-    p_exmimo_config->rf.do_autocal[ant] = 0;
-
-#ifdef EMOS
-  error_code = rtf_create(CHANSOUNDER_FIFO_MINOR,CHANSOUNDER_FIFO_SIZE);
-
-  if (error_code==0)
-    printf("[OPENAIR][SCHED][INIT] Created EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENODEV)
-    printf("[OPENAIR][SCHED][INIT] Problem: EMOS FIFO %d is greater than or equal to RTF_NO\n",CHANSOUNDER_FIFO_MINOR);
-  else if (error_code==ENOMEM)
-    printf("[OPENAIR][SCHED][INIT] Problem: cannot allocate memory for EMOS FIFO %d\n",CHANSOUNDER_FIFO_MINOR);
-  else
-    printf("[OPENAIR][SCHED][INIT] Problem creating EMOS FIFO %d, error_code %d\n",CHANSOUNDER_FIFO_MINOR,error_code);
-
-#endif
-
-  mlockall(MCL_CURRENT | MCL_FUTURE);
-
-#ifdef RTAI
-  // make main thread LXRT soft realtime
-  task = rt_task_init_schmod(nam2num("MYTASK"), 9, 0, 0, SCHED_FIFO, 0xF);
-
-  // start realtime timer and scheduler
-#ifdef TIMER_ONESHOT_MODE
-  rt_set_oneshot_mode();
-  start_rt_timer(0);
-  printf("started RTAI timer inoneshot mode\n");
-#else
-  rt_set_periodic_mode();
-  period = start_rt_timer(nano2count(500000));
-  printf("started RTAI timer with period %llu ns\n",count2nano(period));
-#endif
-
-  printf("Init mutex\n");
-  //mutex = rt_get_adr(nam2num("MUTEX"));
-  mutex = rt_sem_init(nam2num("MUTEX"), 1);
-
-  if (mutex==0) {
-    printf("Error init mutex\n");
-    exit(-1);
-  } else
-    printf("mutex=%p\n",mutex);
-
-#endif
-
-  DAQ_MBOX = (volatile unsigned int *) openair0_exmimo_pci[card].rxcnt_ptr[0];
-
-  // this starts the DMA transfers
-  if (UE_flag!=1)
-    openair0_start_rt_acquisition(card);
-
-
-#ifdef XFORMS
-
-  if (do_forms==1) {
-    fl_initialize (&argc, argv, NULL, 0, 0);
-    form_stats = create_form_stats_form();
-
-    if (UE_flag==1) {
-      form_ue[UE_id] = create_lte_phy_scope_ue();
-      sprintf (title, "LTE DL SCOPE UE");
-      fl_show_form (form_ue[UE_id]->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-    } else {
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        form_enb[UE_id] = create_lte_phy_scope_enb();
-        sprintf (title, "UE%d LTE UL SCOPE eNB",UE_id+1);
-        fl_show_form (form_enb[UE_id]->lte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
-      }
-    }
-
-    fl_show_form (form_stats->stats_form, FL_PLACE_HOTSPOT, FL_FULLBORDER, "stats");
-
-    if (UE_flag==0) {
-      for (UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        if (otg_enabled) {
-          fl_set_button(form_enb[UE_id]->button_0,1);
-          fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic ON");
-        } else {
-          fl_set_button(form_enb[UE_id]->button_0,0);
-          fl_set_object_label(form_enb[UE_id]->button_0,"DL Traffic OFF");
-        }
-      }
-    } else {
-      if (openair_daq_vars.use_ia_receiver) {
-        fl_set_button(form_ue[UE_id]->button_0,1);
-        fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver ON");
-      } else {
-        fl_set_button(form_ue[UE_id]->button_0,0);
-        fl_set_object_label(form_ue[UE_id]->button_0, "IA Receiver OFF");
-      }
-    }
-
-    ret = pthread_create(&thread2, NULL, scope_thread, NULL);
-    printf("Scope thread created, ret=%d\n",ret);
-  }
-
-#endif
-
-#ifdef EMOS
-  ret = pthread_create(&thread3, NULL, emos_thread, NULL);
-  printf("EMOS thread created, ret=%d\n",ret);
-#endif
-
-  rt_sleep_ns(10*FRAME_PERIOD);
-
-#ifndef RTAI
-  pthread_attr_init (&attr_dlsch_threads);
-  pthread_attr_setstacksize(&attr_dlsch_threads,OPENAIR_THREAD_STACK_SIZE);
-  //attr_dlsch_threads.priority = 1;
-  sched_param_dlsch.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
-  pthread_attr_setschedparam  (&attr_dlsch_threads, &sched_param_dlsch);
-  pthread_attr_setschedpolicy (&attr_dlsch_threads, SCHED_FIFO);
-#endif
-
-  // start the main thread
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    thread1 = rt_thread_create(UE_thread, NULL, 100000000);
-    #else
-    error_code = pthread_create(&thread1, &attr_dlsch_threads, UE_thread, NULL);
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
-      return(error_code);
-    }
-    else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate UE_thread successful\n");
-    }
-    #endif
-    #ifdef DLSCH_THREAD
-    init_rx_pdsch_thread();
-    rt_sleep_ns(FRAME_PERIOD/10);
-    init_dlsch_threads();
-    #endif
-    printf("UE threads created\n");
-    */
-  } else {
-#ifdef RTAI
-    thread0 = rt_thread_create(eNB_thread, NULL, 100000000);
-#else
-    error_code = pthread_create(&thread0, &attr_dlsch_threads, eNB_thread, NULL);
-
-    if (error_code!= 0) {
-      LOG_D(HW,"[lte-softmodem.c] Could not allocate eNB_thread, error %d\n",error_code);
-      return(error_code);
-    } else {
-      LOG_D(HW,"[lte-softmodem.c] Allocate eNB_thread successful\n");
-    }
-
-#endif
-#ifdef ULSCH_THREAD
-    init_ulsch_threads();
-#endif
-    printf("eNB threads created\n");
-  }
-
-
-  // wait for end of program
-  printf("TYPE <CTRL-C> TO TERMINATE\n");
-
-  //getchar();
-  while (oai_exit==0)
-    rt_sleep_ns(FRAME_PERIOD);
-
-  // stop threads
-#ifdef XFORMS
-  printf("waiting for XFORMS thread\n");
-
-  if (do_forms==1) {
-    pthread_join(thread2,&status);
-    fl_hide_form(form_stats->stats_form);
-    fl_free_form(form_stats->stats_form);
-
-    if (UE_flag==1) {
-      fl_hide_form(form_ue[UE_id]->lte_phy_scope_ue);
-      fl_free_form(form_ue[UE_id]->lte_phy_scope_ue);
-    } else {
-      for(UE_id=0; UE_id<scope_enb_num_ue; UE_id++) {
-        fl_hide_form(form_enb[UE_id]->lte_phy_scope_enb);
-        fl_free_form(form_enb[UE_id]->lte_phy_scope_enb);
-      }
-    }
-  }
-
-#endif
-
-  printf("stopping MODEM threads\n");
-
-  // cleanup
-  if (UE_flag == 1) {
-    /*
-    #ifdef RTAI
-    rt_thread_join(thread1);
-    #else
-    pthread_join(thread1,&status);
-    #endif
-    #ifdef DLSCH_THREAD
-    cleanup_dlsch_threads();
-    cleanup_rx_pdsch_thread();
-    #endif
-    */
-  } else {
-#ifdef RTAI
-    rt_thread_join(thread0);
-#else
-    pthread_join(thread0,&status);
-#endif
-#ifdef ULSCH_THREAD
-    cleanup_ulsch_threads();
-#endif
-  }
-
-#ifdef OPENAIR2
-  //cleanup_pdcp_thread();
-#endif
-
-#ifdef RTAI
-  stop_rt_timer();
-#endif
-
-  printf("stopping card\n");
-  openair0_stop(card);
-  printf("closing openair0_lib\n");
-  openair0_close();
-
-#ifdef EMOS
-  printf("waiting for EMOS thread\n");
-  pthread_cancel(thread3);
-  pthread_join(thread3,&status);
-#endif
-
-#ifdef EMOS
-  error_code = rtf_destroy(CHANSOUNDER_FIFO_MINOR);
-  printf("[OPENAIR][SCHED][CLEANUP] EMOS FIFO closed, error_code %d\n", error_code);
-#endif
-
-  if (ouput_vcd)
-    VCD_SIGNAL_DUMPER_CLOSE();
-
-  logClean();
-
-  return 0;
-}
-
-void test_config(int card, int ant, unsigned int rf_mode, int UE_flag)
-{
-  p_exmimo_config->framing.eNB_flag   = !UE_flag;
-  p_exmimo_config->framing.tdd_config = 0;
-  p_exmimo_config->framing.resampling_factor[ant] = 2;
-
-  p_exmimo_config->rf.rf_freq_rx[ant] = 1907600000;
-  p_exmimo_config->rf.rf_freq_tx[ant] = 1907600000;;
-  p_exmimo_config->rf.rx_gain[ant][0] = 20;
-  p_exmimo_config->rf.tx_gain[ant][0] = 10;
-  p_exmimo_config->rf.rf_mode[ant] = rf_mode;
-
-  p_exmimo_config->rf.rf_local[ant] = build_rflocal(20,25,26,04);
-  p_exmimo_config->rf.rf_rxdc[ant] = build_rfdc(128, 128);
-  p_exmimo_config->rf.rf_vcocal[ant] = (0xE<<6) + 0xE;
-}
-
-/*
-void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i;
-  if (phy_vars_ue) {
-
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-      phy_vars_ue->lte_ue_common_vars.rxdata[i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-
-      printf("rxdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.rxdata[i]);
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-      free(phy_vars_ue->lte_ue_common_vars.txdata[i]);
-      phy_vars_ue->lte_ue_common_vars.txdata[i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-      printf("txdata[%d] @ %p\n",i,phy_vars_ue->lte_ue_common_vars.txdata[i]);
-    }
-  }
-}
-
-void setup_eNB_buffers(PHY_VARS_eNB *phy_vars_eNB, LTE_DL_FRAME_PARMS *frame_parms, int carrier) {
-
-  int i,j;
-
-  if (phy_vars_eNB) {
-    if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
-      printf("RX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    if ((frame_parms->nb_antennas_tx>1) && (carrier>0)) {
-      printf("TX antennas > 1 and carrier > 0 not possible\n");
-      exit(-1);
-    }
-
-    // replace RX signal buffers with mmaped HW versions
-    for (i=0;i<frame_parms->nb_antennas_rx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[card].adc_head[i+carrier];
-
-        printf("rxdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("rxbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.rxdata[0][i][j] = 16-j;
-        }
-    }
-    for (i=0;i<frame_parms->nb_antennas_tx;i++) {
-        free(phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        phy_vars_eNB->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[card].dac_head[i+carrier];
-
-        printf("txdata[%d] @ %p\n",i,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i]);
-        for (j=0;j<16;j++) {
-            printf("txbuffer %d: %x\n",j,phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j]);
-            phy_vars_eNB->lte_eNB_common_vars.txdata[0][i][j] = 16-j;
-  }
-    }
-  }
-}
-*/
diff --git a/targets/SIMU/USER/Makefile b/targets/SIMU/USER/Makefile
index e48b4b62ad..12595aa86c 100644
--- a/targets/SIMU/USER/Makefile
+++ b/targets/SIMU/USER/Makefile
@@ -34,7 +34,7 @@ CFLAGS += -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS)
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
 CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 CFLAGS += -DNEW_FFT
 #CFLAGS += -DLLR8
 CFLAGS += -DPACKAGE_NAME='"oaisim"'
@@ -48,15 +48,6 @@ DISABLE_XER_PRINT=0
 MSG_PRINT=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-CFLAGS += -DOAISIM
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifeq ($(LOCALIZATION), 1)
 CFLAGS += -DLOCALIZATION
 endif
@@ -179,7 +170,7 @@ ifdef OAI_NW_DRIVER_TYPE_ETHERNET
 CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
 endif
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_FXP -DENABLE_USE_CPU_EXECUTION_TIME
 ifndef DISABLE_XER_PRINT
 CFLAGS += -DXER_PRINT
 endif
diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c
index 91fc1cd059..b31c47ba95 100644
--- a/targets/SIMU/USER/channel_sim.c
+++ b/targets/SIMU/USER/channel_sim.c
@@ -403,9 +403,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 {
 
   int32_t **txdata,**rxdata;
-#ifdef PHY_ABSTRACTION_UL
-  int32_t att_eNB_id=-1;
-#endif
   uint8_t UE_id=0;
 
   uint8_t nb_antennas_rx = UE2RU[0][0][CC_id]->nb_rx; // number of rx antennas at eNB
@@ -418,14 +415,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
 
   uint8_t hold_channel=0;
 
-#ifdef PHY_ABSTRACTION_UL
-  double min_path_loss=-200;
-  uint16_t ul_nb_rb=0 ;
-  uint16_t ul_fr_rb=0;
-  int ulnbrb2 ;
-  int ulfrrb2 ;
-  uint8_t harq_pid;
-#endif
   double s_re0[30720];
   double s_re1[30720];
   double *s_re[2];
@@ -450,38 +439,6 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
   r_im0[1] = r_im01;
   
   if (abstraction_flag!=0)  {
-#ifdef PHY_ABSTRACTION_UL
-    // wire this to 0 until we figure this out
-    int eNB_id=0;
-
-    for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
-      if (!hold_channel) {
-	random_channel(UE2RU[UE_id][eNB_id][CC_id],abstraction_flag);
-	freq_channel(UE2RU[UE_id][eNB_id][CC_id], frame_parms->N_RB_UL,frame_parms->N_RB_UL*12+1);
-	
-	// REceived power at the eNB
-	rx_pwr = signal_energy_fp2(UE2RU[UE_id][eNB_id][CC_id]->ch[0],
-				   UE2RU[UE_id][eNB_id][CC_id]->channel_length)*UE2RU[UE_id][att_eNB_id][CC_id]->channel_length; // calculate the rx power at the eNB
-      }
-      
-      //  write_output("SINRch.m","SINRch",PHY_vars_eNB_g[att_eNB_id]->sinr_dB_eNB,frame_parms->N_RB_UL*12+1,1,1);
-      if(subframe>1 && subframe <5) {
-	harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
-	ul_nb_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->nb_rb;
-	ul_fr_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->first_rb;
-      }
-      
-      if(ul_nb_rb>1 && (ul_fr_rb < 25 && ul_fr_rb > -1)) {
-	number_rb_ul = ul_nb_rb;
-	first_rbUL = ul_fr_rb;
-	init_snr_up(UE2RU[UE_id][att_eNB_id][CC_id],enb_data[att_eNB_id], ue_data[UE_id],PHY_vars_eNB_g[att_eNB_id][CC_id]->sinr_dB,&PHY_vars_UE_g[att_eNB_id][CC_id]->N0,ul_nb_rb,ul_fr_rb);
-	
-      }
-    } //UE_id
-
-#else
-
-#endif
   } else { //without abstraction
 
     pthread_mutex_lock(&UE_output_mutex[ru_id]);
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 852b764ed7..ae139b797f 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -1358,9 +1358,6 @@ void init_ocm(void)
   if (abstraction_flag) {
 
     get_beta_map();
-#ifdef PHY_ABSTRACTION_UL
-    get_beta_map_up();
-#endif
     get_MIESM_param();
 
     //load_pbch_desc();
@@ -1566,117 +1563,6 @@ void update_ocm()
 void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
 {
 
-#if defined(OAI_EMU)
-
-  //int rrc_state=0;
-
-  if (oai_emulation.info.otg_enabled ==1 ) {
-
-    int dst_id, app_id;
-    Packet_otg_elt_t *otg_pkt;
-
-    for (dst_id = 0; dst_id < NUMBER_OF_UE_MAX; dst_id++) {
-      for_times += 1;
-
-      // generate traffic if the ue is rrc reconfigured state
-      //if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 /*RRC_CONNECTED*/ ) {
-      if (mac_eNB_get_rrc_status(enb_module_idP, oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_idP][dst_id]) > 2 ){
-	if_times += 1;
-
-        for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++) {
-          otg_pkt = malloc (sizeof(Packet_otg_elt_t));
-
-          (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
-
-          if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
-            otg_times += 1;
-            (otg_pkt->otg_pkt).rb_id = DTCH-2; // app could be binded to a given DRB
-            (otg_pkt->otg_pkt).module_id = enb_module_idP;
-            (otg_pkt->otg_pkt).dst_id = dst_id;
-            (otg_pkt->otg_pkt).is_ue = 0;
-            (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
-            //Adding the packet to the OTG-PDCP buffer
-            pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
-            LOG_D(EMU,"[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
-                  (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id);
-          } else {
-            free(otg_pkt);
-            otg_pkt=NULL;
-          }
-        }
-      }
-    }
-
-#if defined(Rel10) || defined(Rel14)
-    mbms_service_id_t service_id;
-    mbms_session_id_t session_id;
-    rb_id_t           rb_id;
-
-    // MBSM multicast traffic
-    if (ctime >= 500 ) {// only generate when UE can receive MTCH (need to control this value)
-      for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
-        for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
-          if (pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].instanciated_instance == TRUE) { // this service/session is configured
-
-            otg_pkt = malloc (sizeof(Packet_otg_elt_t));
-            // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n", service_id, session_id, service_id*maxSessionPerPMCH + session_id);
-            rb_id = pdcp_mbms_array_eNB[enb_module_idP][service_id][session_id].rb_id;
-            (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen_multicast(enb_module_idP, session_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
-
-            if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
-              (otg_pkt->otg_pkt).rb_id      = rb_id;
-              (otg_pkt->otg_pkt).module_id  = enb_module_idP;
-              (otg_pkt->otg_pkt).dst_id     = session_id;
-              (otg_pkt->otg_pkt).is_ue      = FALSE;
-              //Adding the packet to the OTG-PDCP buffer
-              (otg_pkt->otg_pkt).mode       = PDCP_TRANSMISSION_MODE_TRANSPARENT;
-              pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
-              LOG_D(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
-                    (otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
-            } else {
-              //LOG_I(EMU, "OTG returns null \n");
-              free(otg_pkt);
-              otg_pkt=NULL;
-            }
-
-
-            // old version
-            /*      // MBSM multicast traffic
-            #if defined(Rel10) || defined(Rel14)
-            if (frame >= 46) {// only generate when UE can receive MTCH (need to control this value)
-            for (service_id = 0; service_id < 2 ; service_id++) { //maxServiceCount
-            for (session_id = 0; session_id < 2; session_id++) { // maxSessionPerPMCH
-            //   LOG_I(OTG,"DUY:frame %d, pdcp_mbms_array[module_id][rb_id].instanciated_instance is %d\n",frame,pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].instanciated_instance);
-            if ((pdcp_mbms_array[module_idP][service_id*maxSessionPerPMCH + session_id].instanciated_instance== module_idP + 1) && (eNB_flag == 1)){ // this service/session is configured
-            // LOG_T(OTG,"multicast packet gen for (service/mch %d, session/lcid %d)\n", service_id, session_id);
-            // Duy add
-            LOG_I(OTG, "frame %d, multicast packet gen for (service/mch %d, session/lcid %d, rb_id %d)\n",frame, service_id, session_id,service_id*maxSessionPerPMCH + session_id);
-            // end Duy add
-            rb_id = pdcp_mbms_array[module_id][service_id*maxSessionPerPMCH + session_id].rb_id;
-            otg_pkt=(uint8_t*) packet_gen_multicast(module_idP, session_id, ctime, &pkt_size);
-            if (otg_pkt != NULL) {
-            LOG_D(OTG,"[eNB %d] sending a multicast packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", eNB_index, module_idP, rb_id, module_idP, session_id, pkt_size);
-            pdcp_data_req(module_id, frame, eNB_flag, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, pkt_size, otg_pkt,PDCP_TM);
-            free(otg_pkt);
-            }
-            }
-            }
-            }
-            } // end multicast traffic
-            #endif
-             */
-
-
-          }
-        }
-      }
-
-    } // end multicast traffic
-
-#endif
-  }
-
-#else
 #if 0 //  defined(EXMIMO) || defined(OAI_USRP)
   if (otg_enabled==1) {
     ctime = frame * 100;
@@ -1703,57 +1589,11 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
       }
     }
   }
-
-#endif
 #endif
 }
 
 void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime)
 {
-#if defined(OAI_EMU)
-
-  int app_id;
-  if (oai_emulation.info.otg_enabled ==1 ) {
-    module_id_t dst_id, src_id; //dst_id = eNB_index
-    module_id_t module_id = ue_mod_idP+NB_eNB_INST;
-
-    src_id = module_id;
-
-    for (dst_id=0; dst_id<NB_SIG_CNX_UE; dst_id++) {
-      // only consider the first attached eNB
-      if (mac_UE_get_rrc_status(ue_mod_idP, dst_id ) > 2 /*RRC_CONNECTED*/) {
-        for (app_id=0; app_id<MAX_NUM_APPLICATION; app_id++) {
-	  Packet_otg_elt_t *otg_pkt = malloc (sizeof(Packet_otg_elt_t));
-
-	  if (otg_pkt!=NULL)
-	    memset(otg_pkt,0,sizeof(Packet_otg_elt_t));
-	  else {
-	    LOG_E(OTG,"not enough memory\n");
-	    exit(-1);
-	  }// Manage to add this packet to the tail of your list
-
-	  (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size));
-
-	  if ((otg_pkt->otg_pkt).sdu_buffer != NULL) {
-	    (otg_pkt->otg_pkt).rb_id     = DTCH-2;
-	    (otg_pkt->otg_pkt).module_id = module_id;
-	    (otg_pkt->otg_pkt).dst_id    = dst_id;
-	    (otg_pkt->otg_pkt).is_ue     = 1;
-	    //Adding the packet to the OTG-PDCP buffer
-	    (otg_pkt->otg_pkt).mode      = PDCP_TRANSMISSION_MODE_DATA;
-	    pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id]));
-	    LOG_D(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n",
-		  (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
-	  } else {
-	    free(otg_pkt);
-	    otg_pkt=NULL;
-	  }
-	}
-      }
-    }
-  }
-
-#endif
 }
 #endif
 
diff --git a/targets/SIMU/USER/sinr_sim.c b/targets/SIMU/USER/sinr_sim.c
index 522f4147ce..7c752ce432 100644
--- a/targets/SIMU/USER/sinr_sim.c
+++ b/targets/SIMU/USER/sinr_sim.c
@@ -475,70 +475,6 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
   }//switch
 }//function ends
 
-#ifdef PHY_ABSTRACTION_UL
-void init_snr_up(channel_desc_t* UE2eNB, node_desc_t *enb_data, node_desc_t *ue_data, double* sinr_dB, double* N0,uint16_t nb_rb,uint16_t fr_rb)
-{
-
-  int return_value;
-  double thermal_noise;
-  int count;
-  int aarx;
-
-  // nb_rb = phy_vars_eNB->ulsch_eNB[UE_id]->harq_processes[harq_pid]->nb_rb;
-  /* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann's constant T = room temperature B = bandwidth */
-  thermal_noise = -174 + 10*log10(UE2eNB->sampling_rate*1e6); //value in dBm
-  *N0 = thermal_noise + enb_data->rx_noise_level;//? all the element have the same noise level?????
-  double lambda ;
-  double residual;
-  double sinrlin;
-  double residual_db;
-  residual = 0 ;
-  int ccc;
-  /*
-   for (count = (fr_rb*12) ; count < (12 * (fr_rb+nb_rb)); count++)
-        {
-                residual +=  ( 1 / ( pow((UE2eNB -> chF[0][count].x),2) + pow((UE2eNB -> chF[0][count].y),2)));
-        }
-   *///sinreff(nn) = ((sum((1/p).*(snrm(nn,:)./(snrm(nn,:)+1)),2).^(-1) )-1).^-1;
-
-  sinrlin = 0 ;
-  lambda = 0;
-
-  ////First calculate SINRs of subcarriers just like OFDM
-  for (count = (fr_rb*12) ; count < (12 * (fr_rb+nb_rb)); count++) {
-    sinr_dB[count] = ue_data->tx_power_dBm
-                     + UE2eNB->path_loss_dB
-                     - (thermal_noise + enb_data->rx_noise_level)
-                     + 10 * log10 (pow(UE2eNB->chF[0][count].x, 2)
-                                   + pow(UE2eNB->chF[0][count].y, 2));
-
-
-  }
-
-  //Then apply formula :
-  if(nb_rb > 0) {
-    //calculate lambdas and fill the same with all but just use one of them when necessary for abstraction
-    for (count = fr_rb*12; count < (12 * (fr_rb+nb_rb)); count++) {
-      sinrlin = pow((sinr_dB[count]/10),10); // convert SINR to linear
-      lambda += (sinrlin /  (sinrlin + 1)) ;
-    }
-
-    for (count = fr_rb*12; count < (12 * (fr_rb+nb_rb)); count++) {
-      sinr_dB[count] = pow(lambda,2) /(((nb_rb)*lambda)-pow(lambda,2)) ;
-      sinr_dB[count] = 10*log10(sinr_dB[count]) ; //save it in db
-    }
-
-    printf("tx_power %g, path_loss %g, sinr_dB[0] %g\n",ue_data->tx_power_dBm ,UE2eNB->path_loss_dB,sinr_dB[count-1]);
-
-    for (ccc = 0; ccc < 301 ; ccc++ ) {
-      SINRpost_eff[ccc] = 0;
-      SINRpost_eff[ccc] = sinr_dB[ccc];
-    }
-  }
-}//function ends
-
-#endif
-
 void calculate_sinr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_data, double *sinr_dB, uint16_t nb_rb)
 {
 
@@ -737,60 +673,7 @@ void get_MIESM_param()
 
   free(file_path);
 }
-#ifdef PHY_ABSTRACTION_UL
-void get_beta_map_up()
-{
-  char *file_path = NULL;
-  int table_len = 0;
-  int mcs = 0;
-  char *sinr_bler;
-  char buffer[1000];
-  FILE *fp;
 
-  file_path = (char*) malloc(512);
-
-  for (mcs = 0; mcs < MCS_COUNT; mcs++) {
-    sprintf(file_path,"%s/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/awgn_abst/awgn_snr_bler_mcs%d_up.csv",getenv("OPENAIR1_DIR"),mcs);
-    fp = fopen(file_path,"r");
-
-    if (fp == NULL) {
-      LOG_W(OCM,"ERROR: Unable to open the file %s, try an alternative path\n", file_path);
-      memset(file_path, 0, 512);
-      sprintf(file_path,"AWGN/awgn_snr_bler_mcs%d.csv",mcs);
-      LOG_I(OCM,"Opening the alternative path %s\n", file_path);
-      fp = fopen(file_path,"r");
-
-      if (fp == NULL) {
-        LOG_E(OCM,"ERROR: Unable to open the file %s, exisitng\n", file_path);
-        exit(-1);
-      }
-    }
-
-    // else {
-    fgets(buffer, 1000, fp);
-    table_len=0;
-
-    while (!feof(fp)) {
-      sinr_bler = strtok(buffer, ",");
-      sinr_bler_map_up[mcs][0][table_len] = atof(sinr_bler);
-      sinr_bler = strtok(NULL,",");
-      sinr_bler_map_up[mcs][1][table_len] = atof(sinr_bler);
-      table_len++;
-      fgets(buffer, 1000, fp);
-    }
-
-    fclose(fp);
-    //   }
-    LOG_D(OCM,"Print the table for mcs %d\n",mcs);
-
-    for (table_len = 0; table_len < 16; table_len++)
-      LOG_D(OCM,"%lf  %lf \n ",sinr_bler_map_up[mcs][0][table_len],sinr_bler_map_up[mcs][1][table_len]);
-  }
-
-  free(file_path);
-}
-
-#endif
 
 
 
diff --git a/targets/TEST/AT_COMMANDS/Makefile b/targets/TEST/AT_COMMANDS/Makefile
index 41d079bbcb..3f52e2af60 100755
--- a/targets/TEST/AT_COMMANDS/Makefile
+++ b/targets/TEST/AT_COMMANDS/Makefile
@@ -23,8 +23,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/PACKET_TRACER/Makefile b/targets/TEST/PACKET_TRACER/Makefile
index 93e67bc9e2..4d01cd6a69 100755
--- a/targets/TEST/PACKET_TRACER/Makefile
+++ b/targets/TEST/PACKET_TRACER/Makefile
@@ -11,16 +11,12 @@ CFLAGS += -m32 -DPHYSIM -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
 CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE  
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION -DOAI_EMU
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1
 CFLAGS += -DEMIT_ASN_DEBUG=1
 ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
 # activate OCG and libxml only under linux
 ifeq ($(linux),1) 
 CFLAGS += -I/usr/include/libxml2 -L/usr/local/lib -I/usr/include/atlas -L/usr/X11R6/lib 
@@ -61,8 +57,6 @@ ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 -DFULL_BUFFER=1
 endif
 
-CFLAGS += -DOAI_EMU
-
 include $(OPENAIR1_DIR)/PHY/Makefile.inc
 include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 include $(OPENAIR2_DIR)/LAYER2/Makefile.inc
diff --git a/targets/TEST/PDCP/Makefile b/targets/TEST/PDCP/Makefile
index 12193cbb99..7b9e20ce64 100755
--- a/targets/TEST/PDCP/Makefile
+++ b/targets/TEST/PDCP/Makefile
@@ -25,8 +25,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
index 495dcda572..3f7d841d6a 100755
--- a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
+++ b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
@@ -25,8 +25,6 @@ ifdef PDCP_USE_NETLINK
 CFLAGS += -DPDCP_USE_NETLINK -DLINUX -DDEBUG_CONTROL
 endif
 
-CFLAGS += -DPHY_ABSTRACTION  #-DEMIT_ASN_DEBUG=1
-
 #include $(OPENAIR1_DIR)/PHY/Makefile.inc
 #include $(OPENAIR1_DIR)/SCHED/Makefile.inc
 
diff --git a/targets/TEST/RLC_AM_V9.3.0/Makefile b/targets/TEST/RLC_AM_V9.3.0/Makefile
index 68f520b31d..d29697ea6a 100755
--- a/targets/TEST/RLC_AM_V9.3.0/Makefile
+++ b/targets/TEST/RLC_AM_V9.3.0/Makefile
@@ -13,7 +13,7 @@ CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
 CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 CFLAGS += -DNEW_FFT
 #CFLAGS += -DLLR8
 
@@ -21,14 +21,6 @@ ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
 endif
@@ -114,7 +106,7 @@ endif
 
 CFLAGS += $(shell if [ `uname -o` = "Cygwin" ] ; then echo "-DCYGWIN" ;fi)
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_FXP -DENABLE_USE_CPU_EXECUTION_TIME
 
 ifneq ($(USE_MME), R8)
 UPDATE_RELEASE_9=1
diff --git a/targets/TEST/RLC_UM_V9.3.0/Makefile b/targets/TEST/RLC_UM_V9.3.0/Makefile
index 91ad44e08b..aa88a73c33 100755
--- a/targets/TEST/RLC_UM_V9.3.0/Makefile
+++ b/targets/TEST/RLC_UM_V9.3.0/Makefile
@@ -13,7 +13,7 @@ CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr
 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES
 
 CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
-CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
+CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1
 CFLAGS += -DNEW_FFT
 #CFLAGS += -DLLR8
 
@@ -21,14 +21,6 @@ ifndef OPENAIR2
 OPENAIR2=1
 endif
 
-ifndef OPENAIR_EMU
-export OPENAIR_EMU=1
-endif
-
-ifdef EMOS
-CFLAGS+=-DEMOS
-endif
-
 ifdef TRAFFIC_TM5
 CFLAGS += -DRLC_UM_TEST_TRAFFIC=1 #-DFULL_BUFFER=1
 endif
@@ -109,7 +101,7 @@ ifdef OAI_NW_DRIVER_TYPE_ETHERNET
 CFLAGS+=-DOAI_NW_DRIVER_TYPE_ETHERNET
 endif
 
-CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME
+CFLAGS += -DENABLE_FXP -DENABLE_USE_CPU_EXECUTION_TIME
 
 ifneq ($(USE_MME), R8)
 UPDATE_RELEASE_9=1
-- 
GitLab