diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3a561cc60a1e1effa02d9d3feaec2cf429c8cc72..03ee12cb821af3b88020d000e75f3f763076b44e 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 ################################ @@ -485,7 +482,6 @@ include_directories ("${X2AP_DIR}") ################################### add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") -add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4") add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR") @@ -587,15 +583,13 @@ Message("CPU_Affinity flag is ${CPU_AFFINITY}") add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB") add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB") add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO") -add_boolean_option(USER_MODE True "????") add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer") add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????") -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 "????") @@ -612,22 +606,12 @@ add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN ########################## add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" ) -########################## -# Emulation options -########################## -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 ########################## add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues") add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") -add_boolean_option(HARD_RT False "???") add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") @@ -637,24 +621,15 @@ add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") # PHY options ########################## add_boolean_option(DRIVER2013 True "only relevant for EXMIMO") -add_boolean_option(ENABLE_FXP True "????") add_boolean_option(ENABLE_NEW_MULTICAST False "specific to oaisim") add_boolean_option(EXMIMO_IOT True "????") add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120") add_boolean_option(LOCALIZATION False "???") add_integer_option(MAX_NUM_CCs 1 "????") add_boolean_option(MU_RECEIVER False "????") -add_boolean_option(NEW_FFT True "????") -add_boolean_option(OPENAIR1 True "????") -add_boolean_option(PBS_SIM False "????") -add_boolean_option(PC_DSP True "????") -add_boolean_option(PC_TARGET True "????") -add_boolean_option(PERFECT_CE False "????") add_boolean_option(PHYSIM True "for L1 simulators (dlsim, ulsim, ...)") add_boolean_option(PHY_CONTEXT True "not clear: must remain False for dlsim") add_boolean_option(PHY_EMUL False "not clear: must remain False for dlsim") -add_boolean_option(PUCCH True "????") -add_boolean_option(RANDOM_BF False "????") add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator") add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options") add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures") @@ -727,23 +702,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, confi ########################## # none -########################## -# PROJECTS (IST, FRENCH COLL., etc) -# SPECIFIC OPTIONS -########################## -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}") @@ -776,7 +735,6 @@ include_directories("${NFAPI_DIR}/nfapi/inc") include_directories("${NFAPI_DIR}/sim_common/inc") include_directories("${NFAPI_DIR}/pnf_sim/inc") 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") @@ -1302,26 +1260,6 @@ if (${ENABLE_RAL}) set(RAL_LIB RAL) endif() -if(${MIH_C_MEDIEVAL_EXTENSIONS}) - set(MIH_SRC - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_header_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_msg_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_primitive_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F2_general_data_types_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F13_data_types_for_information_elements_codec.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_L2_type_values_for_tlv_encoding.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_Medieval_extensions.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_bit_buffer.c - ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C.c - ) - add_library(MIH ${MIH_SRC}) - set(MIH_LIB MIH) -endif() - # CN libs ########################## @@ -1671,7 +1609,6 @@ ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c #${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c -${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/pgm_link.c ) add_library(OPENAIR0_LIB @@ -1843,7 +1780,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} @@ -1853,7 +1789,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group z dl) @@ -1882,7 +1818,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} @@ -1891,7 +1826,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1899,27 +1834,6 @@ target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${T_LIB}) -# rrh -################################ -#Note: only one RF type (USRP) is currently supported for RRH -add_executable(rrh_gw - ${OPENAIR_TARGETS}/RT/USER/rrh_gw.c - ${OPENAIR_TARGETS}/RT/USER/eNB_transport_IQ.c - ${OPENAIR_TARGETS}/RT/USER/UE_transport_IQ.c - ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c - ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c - ${T_SOURCE} - ) -target_include_directories(rrh_gw PRIVATE ${OPENAIR_DIR}/common/utils/itti) -target_link_libraries(rrh_gw - -Wl,--start-group - UTIL LFDS -ldl - -Wl,--end-group ) -target_link_libraries (rrh_gw rt pthread m ) -target_link_libraries (rrh_gw ${LIB_LMS_LIBRARIES}) -target_link_libraries (rrh_gw ${T_LIB}) - - # USIM process ################# #add_executable(usim @@ -1983,7 +1897,7 @@ add_executable(oaisim target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim -Wl,-ldl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -Wl,--end-group ) @@ -2028,7 +1942,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) @@ -2136,7 +2050,7 @@ endforeach(myExe) if (${T_TRACER}) foreach(i #all "add_executable" definitions (except tests, rb_tool, updatefw) - lte-softmodem lte-softmodem-nos1 rrh_gw oaisim oaisim_nos1 + lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1 dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim #all "add_library" definitions @@ -2144,7 +2058,7 @@ if (${T_TRACER}) oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_eth_transpro FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA - SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL MIH CN_UTILS + SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB) if (TARGET ${i}) add_dependencies(${i} generate_T) @@ -2206,7 +2120,6 @@ get_directory_property(DirDefs COMPILE_DEFINITIONS ) foreach( d ${DirDefs} ) set(module_cc_opt_tmp "${module_cc_opt_tmp} -D${d}") endforeach() -string(REPLACE "-DUSER_MODE" "" module_cc_opt ${module_cc_opt_tmp}) get_directory_property( DirDefs INCLUDE_DIRECTORIES ) foreach( d ${DirDefs} ) set(module_cc_opt "${module_cc_opt} -I${d}") @@ -2238,15 +2151,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/build_oai b/cmake_targets/build_oai index 7eb583bcfd723a278a4df3d83b305cfa28cc46c6..0d48f51df91bc743d844a3306ef3577b4cd1cb5e 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -100,8 +100,6 @@ Options Specify conf_nvram_path (default \"$conf_nvram_path\") --UE-gen-nvram [output path] Specify gen_nvram_path (default \"$gen_nvram_path\") ---RRH - Makes the RRH -a | --agent Enables agent for software-defined control of the eNB -r | --3gpp-release @@ -219,10 +217,6 @@ function main() { --UE-gen-nvram) gen_nvram_path=$(readlink -f $2) shift 2;; - --RRH) - RRH=1 - echo_info "Will compile RRH" - shift;; -r | --3gpp-release) REL=$2 echo_info "Setting release to: $REL" @@ -371,7 +365,7 @@ function main() { echo_info "CMAKE_CMD=$CMAKE_CMD" ######################################################### - # check validity of HW and TP parameters for RRH and eNB + # check validity of HW and TP parameters for eNB ######################################################### # to be discussed @@ -387,15 +381,6 @@ function main() { fi fi - if [ "$RRH" = "1" ] ; then - if [ "$TP" = "None" ] ; then - echo_fatal "A transport protocol (e.g. -t ETHERNET) must be defined!" - fi - if [ "$HW" = "None" ] ; then - echo_info "No radio head has been selected (HW set to $HW)" - fi - fi - echo_info "RF HW set to $HW" #Now we set flags to enable deadline scheduler settings #By default: USRP: disable, @@ -793,36 +778,6 @@ function main() { # oaisim_mme $dbin/oaisim_mme.$REL fi - # RRH compilation - ##################### - if [ "$RRH" = "1" ] ; then - - rrh_exec=rrh_gw - rrh_build_dir=rrh_gw - - echo_info "Compiling $rrh_exec ..." - - [ "$CLEAN" = "1" ] && rm -rf $DIR/rrh_gw/build - mkdir -p $DIR/$rrh_build_dir/build - cmake_file=$DIR/$rrh_build_dir/CMakeLists.txt - echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file - echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file - echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file - echo "set ( ENABLE_ITTI False )" >> $cmake_file - echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file - echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file - echo 'set ( PACKAGE_NAME "\"rrh_gw\"")' >> $cmake_file - echo "set ( DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file - echo "set ( CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file - echo "set ( T_TRACER $T_TRACER )" >> $cmake_file - echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file - cd $DIR/$rrh_build_dir/build - eval $CMAKE_CMD - compilations \ - rrh_gw rrh_gw \ - rrh_gw $dbin/rrh_gw - - fi # Telnet server compilation ##################### if [ "$BUILD_TELNETSRV" = "1" ] ; then @@ -841,13 +796,9 @@ function main() { fi # build RF device and transport protocol libraries ##################################### - if [ "$eNB" = "1" -o "$UE" = "1" -o "$RRH" = "1" ] ; then + if [ "$eNB" = "1" -o "$UE" = "1" ] ; then - if [ "$eNB" = "1" -o "$UE" = "1" ] ; then - build_dir=$lte_build_dir - else - build_dir=$rrh_build_dir - fi + build_dir=$lte_build_dir # build RF device libraries if [ "$HW" != "None" ] ; then diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template index 76defbc7d7f1318602aa6c9ecbc85be4169a94ff..e046bb75391a178a605ed390cbb13a91b05bcbd7 100644 --- a/cmake_targets/epc_test/CMakeLists.template +++ b/cmake_targets/epc_test/CMakeLists.template @@ -2,17 +2,13 @@ cmake_minimum_required(VERSION 2.8) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) set ( ASN_DEBUG False) -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 ) set ( ENABLE_NAS_UE_LOGGING True ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_SECURITY True ) set ( ENABLE_STANDALONE_EPC False) set ( ENABLE_USE_CPU_EXECUTION_TIME True ) @@ -21,7 +17,6 @@ set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) set ( ENABLE_VCD_FIFO False ) set ( ENB_MODE True ) set ( EXMIMO_IOT True ) -set ( HARD_RT False ) set ( JUMBO_FRAME True ) set ( LARGE_SCALE False ) set ( LINK_ENB_PDCP_TO_GTPV1U True) @@ -33,7 +28,6 @@ set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) set ( MESSAGE_CHART_GENERATOR False) -set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) @@ -42,38 +36,25 @@ set ( NAS_MME False ) set ( NAS_UE True ) set ( NB_ANTENNAS_RX "2" ) 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 ) -set ( OPENAIR1 True ) set ( OPENAIR2 True ) set ( OPENAIR_LTE True ) set ( PACKAGE_NAME "epc_test" ) -set ( PBS_SIM False ) set ( PDCP_USE_NETLINK True ) -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 ) -set ( PUCCH True ) -set ( RANDOM_BF False ) set ( RF_BOARD "False" ) 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 ) set ( USE_MME "R10" ) -set ( USER_MODE True ) set ( XER_PRINT True ) diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt index ab718a8503d3a1339d0ba3996eae2e082458319d..ca754449d7f9c6bbea10e1dcf726160df18a9f97 100644 --- a/cmake_targets/lte-simulators/CMakeLists.txt +++ b/cmake_targets/lte-simulators/CMakeLists.txt @@ -6,9 +6,6 @@ set(XFORMS True) set(ENABLE_ITTI False) set(DEBUG_PHY False) set(MU_RECIEVER False) -set(RANDOM_BF False) -set(PBS_SIM False) -set(PERFECT_CE True) set(NAS_UE False) set(MESSAGE_CHART_GENERATOR False) diff --git a/cmake_targets/oaisim_build_oai/CMakeLists.template b/cmake_targets/oaisim_build_oai/CMakeLists.template index 0a05d68d10d5d6ce758e8aa17588c444632bf700..22faac75b5855fd33b2fb6630c5dde36e8fe83a4 100644 --- a/cmake_targets/oaisim_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_build_oai/CMakeLists.template @@ -1,16 +1,12 @@ cmake_minimum_required(VERSION 2.8) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) -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 ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY True ) set ( ENABLE_STANDALONE_EPC False) @@ -20,7 +16,6 @@ set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) set ( ENABLE_VCD_FIFO False ) set ( ENB_MODE True ) set ( EXMIMO_IOT True ) -set ( HARD_RT False ) set ( JUMBO_FRAME True ) set ( LARGE_SCALE False ) set ( LINK_ENB_PDCP_TO_GTPV1U True) @@ -32,7 +27,6 @@ set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) set ( MESSAGE_CHART_GENERATOR False) -set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) @@ -41,40 +35,26 @@ set ( NAS_MME False ) set ( NAS_UE True ) set ( NB_ANTENNAS_RX "2" ) 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 ) -set ( OPENAIR1 True ) set ( OPENAIR2 True ) set ( OPENAIR_LTE True ) set ( PACKAGE_NAME "oaisim" ) -set ( PBS_SIM False ) set ( PDCP_USE_NETLINK True ) -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 ) -set ( PUCCH True ) -set ( RANDOM_BF False ) set ( RF_BOARD "False" ) 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 ) set ( TEST_OMG False ) set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) set ( USE_MME "R10" ) -set ( USER_MODE True ) set ( XER_PRINT False ) diff --git a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template index 69fa209b16d266e5a5d846facba62904bd11143b..b18b23ee9abf72e93a74a9d70a9edede932a0b8c 100644 --- a/cmake_targets/oaisim_mme_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_mme_build_oai/CMakeLists.template @@ -1,16 +1,12 @@ cmake_minimum_required(VERSION 2.8) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) -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 ) set ( ENABLE_NEW_MULTICAST False ) -set ( ENABLE_PGM_TRANSPORT False ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) set ( ENABLE_STANDALONE_EPC False ) @@ -21,7 +17,6 @@ set ( ENABLE_VCD_FIFO False ) set ( ENB_MODE False ) set ( EPC_BUILD True ) set ( EXMIMO_IOT False ) -set ( HARD_RT False ) set ( JUMBO_FRAME False ) set ( LARGE_SCALE False ) set ( LINK_ENB_PDCP_TO_GTPV1U True) @@ -32,7 +27,6 @@ set ( LOG_NO_THREAD False ) set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) -set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) @@ -42,42 +36,27 @@ set ( NAS_NETLINK False ) set ( NAS_UE False ) set ( NB_ANTENNAS_RX "2" ) 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 ) -set ( OPENAIR1 False ) set ( OPENAIR2 False ) -set ( OPENAIR_EMU False ) set ( OPENAIR_LTE False ) set ( PACKAGE_NAME "EPC" ) -set ( PBS_SIM False ) -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 ) -set ( PUCCH False ) -set ( RANDOM_BF False ) 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 ) set ( TEST_OMG False ) set ( UPDATE_RELEASE_9 True) set ( UPDATE_RELEASE_10 True) set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) set ( USE_MME "R10" ) -set ( USER_MODE True ) set ( XER_PRINT False ) set ( XFORMS False ) diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index 8e1670ea43e9208190d895d1948467e580c602bc..e0f100ca0af9128c153a5748ea0cb1280b16bc26 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -1,15 +1,11 @@ cmake_minimum_required(VERSION 2.8) -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 ) set ( ENABLE_NEW_MULTICAST True ) -set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY False ) set ( ENABLE_STANDALONE_EPC False) @@ -19,7 +15,6 @@ set ( ENABLE_USE_RAW_SOCKET_FOR_SGI False) set ( ENABLE_VCD_FIFO False ) set ( ENB_MODE True ) set ( EXMIMO_IOT True ) -set ( HARD_RT False ) set ( JUMBO_FRAME True ) set ( LARGE_SCALE False ) set ( LINK_ENB_PDCP_TO_GTPV1U False) @@ -33,7 +28,6 @@ set ( MAX_NUM_CCs 1 ) set ( MESSAGE_CHART_GENERATOR False ) set ( MESSAGE_CHART_GENERATOR_RLC_MAC False ) set ( MESSAGE_CHART_GENERATOR_PHY False ) -set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX True ) @@ -42,42 +36,27 @@ set ( NAS_MME False ) set ( NAS_UE False ) set ( NB_ANTENNAS_RX "2" ) 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 ) -set ( OPENAIR1 True ) set ( OPENAIR2 True ) -set ( OPENAIR_EMU False ) set ( OPENAIR_LTE True ) set ( PACKAGE_NAME "oaisim" ) -set ( PBS_SIM False ) set ( PDCP_USE_NETLINK True ) -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 ) -set ( PUCCH True ) -set ( RANDOM_BF False ) 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 ) set ( TEST_OMG False ) set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) set ( USE_MME "R10" ) -set ( USER_MODE True ) set ( XER_PRINT False ) set ( DEBUG_PHY False ) set ( DEBUG_PHY_PROC False) diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template index 994edf835232401dbc9f41e70ae8b8e9e47e4740..9f1ff3e36015965cf5403c37472f259f32d29a25 100644 --- a/cmake_targets/s1c_mme_test/CMakeLists.template +++ b/cmake_targets/s1c_mme_test/CMakeLists.template @@ -1,17 +1,13 @@ cmake_minimum_required(VERSION 2.8) set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) -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 ) set ( ENABLE_NEW_MULTICAST True ) set ( ENABLE_PDCP_NETLINK_FIFO False ) -set ( ENABLE_PGM_TRANSPORT True ) set ( ENABLE_RAL False ) set ( ENABLE_SECURITY True ) set ( ENABLE_STANDALONE_EPC False) @@ -21,7 +17,6 @@ set ( ENABLE_USE_RAW_SOCKET_FOR_SGI True) set ( ENABLE_VCD_FIFO False ) set ( ENB_MODE True ) set ( EXMIMO_IOT True ) -set ( HARD_RT False ) set ( JUMBO_FRAME True ) set ( LARGE_SCALE False ) set ( LINK_ENB_PDCP_TO_GTPV1U True) @@ -33,7 +28,6 @@ set ( DEADLINE_SCHEDULER False ) set ( MAC_CONTEXT 1 ) set ( MAX_NUM_CCs 1 ) set ( MESSAGE_CHART_GENERATOR False) -set ( MIH_C_MEDIEVAL_EXTENSIONS False ) set ( MSG_PRINT False ) set ( MU_RECEIVER False ) set ( NAS_ADDRESS_FIX False ) @@ -42,44 +36,30 @@ set ( NAS_MME False ) set ( NAS_UE True ) set ( NB_ANTENNAS_RX "2" ) 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 ) -set ( OPENAIR1 True ) set ( OPENAIR2 True ) set ( OPENAIR_LTE True ) set ( PACKAGE_NAME "oaisim" ) -set ( PBS_SIM False ) set ( PDCP_USE_NETLINK True ) -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 ) -set ( PUCCH True ) -set ( RANDOM_BF False ) set ( RF_BOARD "False" ) 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 ) set ( TEST_OMG False ) set ( TEST_S1C_MME True ) set ( USE_3GPP_ADDR_AS_LINK_ADDR False ) set ( USE_MME "R10" ) -set ( USER_MODE True ) set ( XER_PRINT False ) set ( XFORMS False ) diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c index 6c9a95732bccddc1d96f19f6529e4f2d980554fe..449fa434af09d62c38c3e556bf41cd614514451f 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 191d9199c33b58d9bb67a7879e21d30e296f9928..606c851d1de02dd6647f68321499a83da3e6fcc3 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 a06b97c63b36eea50583a43ffd20e53a70058f3c..bb7750972664b8ef5ca48e71554277a10fdbf0a9 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/itti_types.h b/common/utils/itti/itti_types.h index 7f01901712346275b778fd75dd59889b0edccad8..d07853133bae343772b1d3b277602923b5fc3761 100644 --- a/common/utils/itti/itti_types.h +++ b/common/utils/itti/itti_types.h @@ -27,11 +27,7 @@ #ifndef _ITTI_TYPES_H_ #define _ITTI_TYPES_H_ -#ifdef USER_MODE #include <stdint.h> -#else -#include <linux/types.h> -#endif #define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) diff --git a/common/utils/itti/memory_pools.c b/common/utils/itti/memory_pools.c index 23c53b71ae210400cb10b0d171d90c3bc935f2b2..78b6923dc863f982683d57a126c539651ef3817d 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/common/utils/telnetsrv/CMakeLists.txt b/common/utils/telnetsrv/CMakeLists.txt index 51284ad2e835377e9eb6f8d682578594bd2bec16..bc4a550742291e2c9a67cbf4e923ca79d00eb8e0 100644 --- a/common/utils/telnetsrv/CMakeLists.txt +++ b/common/utils/telnetsrv/CMakeLists.txt @@ -24,7 +24,7 @@ set(OPENAIR_NFAPIINC $ENV{NFAPI_DIR} ) set(CMAKE_INSTALL_PREFIX $ENV{OPENAIR_TARGETS}) -add_definitions (-DRel14 -DCMAKER -DENABLE_FXP -DENABLE_ITTI -DENABLE_NAS_UE_LOGGING -DENABLE_SECURITY -DENABLE_USE_CPU_EXECUTION_TIME -DENABLE_USE_MME -DENABLE_VCD -DENB_AGENT -DENB_MODE -DETHERNET=1 -DEXMIMO_IOT -DJUMBO_FRAME -DLINK_ENB_PDCP_TO_GTPV1U -DLOG_NO_THREAD -DMAC_CONTEXT -DMAX_NUM_CCs=1 -DNAS_BUILT_IN_UE -DNAS_UE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DNB_ANTENNAS_TXRX=2 -DNEW_FFT -DNO_RRM -DNone=1 -DOAI_NW_DRIVER_USE_NETLINK -DOPENAIR1 -DOPENAIR2 -DOPENAIR_LTE -DPC_DSP -DPC_TARGET -DPHYSIM -DPHY_CONTEXT -DPUCCH -DRel10=1 -DS1AP_VERSION=R10 -DTRACE_RLC_MUTEX -DUSER_MODE -DX2AP_VERSION=R11 -DXFORMS -mavx2 -msse4.1 -mssse3) +add_definitions (-DRel14 -DCMAKER -DENABLE_ITTI -DENABLE_NAS_UE_LOGGING -DENABLE_SECURITY -DENABLE_USE_CPU_EXECUTION_TIME -DENABLE_USE_MME -DENABLE_VCD -DENB_AGENT -DENB_MODE -DETHERNET=1 -DEXMIMO_IOT -DJUMBO_FRAME -DLINK_ENB_PDCP_TO_GTPV1U -DLOG_NO_THREAD -DMAC_CONTEXT -DMAX_NUM_CCs=1 -DNAS_BUILT_IN_UE -DNAS_UE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DNO_RRM -DNone=1 -DOAI_NW_DRIVER_USE_NETLINK -DOPENAIR2 -DOPENAIR_LTE -DPHYSIM -DPHY_CONTEXT -DRel10=1 -DS1AP_VERSION=R10 -DTRACE_RLC_MUTEX -DX2AP_VERSION=R11 -DXFORMS -mavx2 -msse4.1 -mssse3) add_compile_options( -fPIC -march=native -Ofast) include_directories( ./ ${OPENAIR_COMMON_DIR} ${OPENAIR_DIR} ${OPENAIR1_DIR} ${OPENAIR2_DIR} ${OPENAIR2_COMMON_DIR} ${OPENAIR2_DIR}/UTIL/LOG diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c index 1eb85e6254b0c7ee9a23e0d642cb0dbf67122c74..b429e0a6ce586b1efd943e7f337464e7852e26a2 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p4.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <stdint.h> #include <nfapi_interface.h> #include <nfapi.h> diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c index b3b9b534917a8e167d2d531ad8385bd96da28fa9..c78b8291358c2a611763649d024bb86acf2b9fba 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c @@ -29,6 +29,7 @@ #include <unistd.h> #include <errno.h> #include <pthread.h> +#include <stdint.h> #include <nfapi_interface.h> #include <nfapi.h> diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 69ff86077446d7ba89fe5c3d30f6230526b137aa..3754fe379fef576b75d2ea026f1a4c35007bd807 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -31,6 +31,7 @@ #include <unistd.h> #include <errno.h> #include <pthread.h> +#include <stdint.h> #include <nfapi_interface.h> #include <nfapi.h> diff --git a/openair1/Makefile b/openair1/Makefile deleted file mode 100644 index 04be9ff8b0ed954d4019967c5d1dc707247db9dd..0000000000000000000000000000000000000000 --- 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/CODING/Makefile.arm b/openair1/PHY/CODING/Makefile.arm index 07dbf559098a689e12c8db2d657fb16c296f363c..04598075e325aaa6b048b8a4e9ca54625793214a 100644 --- a/openair1/PHY/CODING/Makefile.arm +++ b/openair1/PHY/CODING/Makefile.arm @@ -5,7 +5,7 @@ RATE12CC_SRC = ccoding_byte.c viterbi.c crc_byte.c all: 3gpplte_sse 3gpplte_sse: $(TURBO_SRC) - gcc -O3 -gdwarf-2 -mfloat-abi=hard -mfpu=neon -lm -lgcc -lrt ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DTC_MAIN -DNB_ANTENNAS_RX=1 -o 3gpplte_sse 3gpplte_sse.c -Wall -g -ggdb -DTC_MAIN + gcc -O3 -gdwarf-2 -mfloat-abi=hard -mfpu=neon -lm -lgcc -lrt ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DTC_MAIN -DNB_ANTENNAS_RX=1 -o 3gpplte_sse 3gpplte_sse.c -Wall -g -ggdb -DTC_MAIN diff --git a/openair1/PHY/CODING/TESTBENCH/Makefile b/openair1/PHY/CODING/TESTBENCH/Makefile index a8ddd1fcb55b59875f018b17cb8e2ca4f95b30a1..030f19b47bb0747fa1c28c944721fa74ca6a487b 100644 --- a/openair1/PHY/CODING/TESTBENCH/Makefile +++ b/openair1/PHY/CODING/TESTBENCH/Makefile @@ -7,7 +7,7 @@ OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -DNODE_RG -DUSER_MODE -DPC_TARGET -DNO_UL_REF -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DOPENAIR_LTE -DMAX_NUM_CCs=1 +CFLAGS += -DNODE_RG -DNO_UL_REF -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DOPENAIR_LTE -DMAX_NUM_CCs=1 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index 4f0dcf2196749111989bd5f8e9cc5567476b97b9..5ec4fcaaa4bc73f8a26aec421159a4c0286c9ecf 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -31,13 +31,6 @@ */ -#ifndef USER_MODE -#define __NO_VERSION__ - -#endif - -//#include "PHY/types.h" - #include "defs.h" diff --git a/openair1/PHY/CODING/defs.h b/openair1/PHY/CODING/defs.h index 06311a188bc9c9123162df5a3467fd0723608e9e..80e28b15867e79244181cfe8c02fc28000f22a56 100644 --- a/openair1/PHY/CODING/defs.h +++ b/openair1/PHY/CODING/defs.h @@ -29,11 +29,7 @@ #include <stdint.h> -#ifndef NO_OPENAIR1 #include "PHY/defs.h" -#else -#include "PHY/TOOLS/time_meas.h" -#endif #define CRC24_A 0 #define CRC24_B 1 diff --git a/openair1/PHY/CODING/viterbi_lte.c b/openair1/PHY/CODING/viterbi_lte.c index d112e7c10958aa91db1ef898c4575a492c886d07..5e11cb3453ab9dd2f425a175389acfd0edcca432 100644 --- a/openair1/PHY/CODING/viterbi_lte.c +++ b/openair1/PHY/CODING/viterbi_lte.c @@ -28,10 +28,6 @@ date: 21.10.2009 */ -#ifdef USER_MODE -#include <stdio.h> -#endif - #ifndef TEST_DEBUG #include "PHY/defs.h" #include "PHY/extern.h" @@ -126,7 +122,7 @@ void print_shorts(__m128i x,char *s) { } */ -#endif // USER_MODE +#endif // DEBUG_VITERBI diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c index c4d5850501813961470a02f9ca90c0391f947114..218beb4faf825c9a024c24155b9abdb342a7a19b 100644 --- a/openair1/PHY/INIT/init_top.c +++ b/openair1/PHY/INIT/init_top.c @@ -20,10 +20,6 @@ */ /*!\brief Initilization and reconfiguration routines for LTE PHY */ -#ifndef USER_MODE -#define __NO_VERSION__ -#endif - #include "defs.h" #include "PHY/extern.h" #include "MAC_INTERFACE/extern.h" diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h index aae97ecd9e9c3565120e69b57e9462466672e208..a7b5d14701874da4fb4894dca2382bfd7102708b 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_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c index cd032e688fab2ed984f6fc3e8415cb0699dab498..18444076f315de40ee4ef925e31ccd93043b1d37 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c @@ -149,10 +149,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, int temp, i, aa, max_pos = 0,ind; int max_val=0; short Re,Im,ncoef; -#ifdef USER_MODE #ifdef DEBUG_PHY char fname[100],vname[100]; -#endif #endif ncoef = 32768 - coef; @@ -187,12 +185,10 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms, 1); break; } -#ifdef USER_MODE #ifdef DEBUG_PHY sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa); sprintf(vname,"srs_time_%d%d",ind,aa); write_output(fname,vname,lte_eNB_srs->srs_ch_estimates_time[aa],frame_parms->ofdm_symbol_size*2,2,1); -#endif #endif } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 8dcf4b1c113f55e08ead44a08c02f05dc00e1aab..55d2cf6c5c5f2aae5eb34b045f394fdfeea08f24 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -19,9 +19,7 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <string.h> -#endif #include "defs.h" #include "PHY/defs.h" #include "filt16_32.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index fb935e47a856f3c18b5d2069ff3ebaf87b3dea33..a4b29bb25ec407efbbb4ec696bada4557bbd1ec1 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -19,9 +19,7 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <string.h> -#endif #include "defs.h" #include "SCHED/defs.h" #include "PHY/defs.h" 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 a64aa797af06b8fe7df5f207675a519c65b9e749..0000000000000000000000000000000000000000 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation_emos.c +++ /dev/null @@ -1,151 +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 - */ - -#ifdef USER_MODE -#include <string.h> -#endif -#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_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c index f298f8738cfb0d2ad6e7520eaf894afe3e51c5b2..17d44b22f8815442a5c10921410e685b02d64f1a 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c @@ -19,9 +19,7 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <string.h> -#endif #include "defs.h" #include "PHY/defs.h" diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index c7625ba083e43550036165bfb9aeb443bb1af2f0..2525f19b0df9f2c74575133a1e0d732e895e2132 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_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index acda933d388b8b66fa94638b509a7bc9a3f7458b..c4df34638bf2a06fc5a0894d35bfae6a94c1eb5c 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -38,7 +38,6 @@ int16_t cond_num_threshold = 0; -#ifdef USER_MODE void print_shorts(char *s,short *x) { @@ -57,8 +56,6 @@ void print_ints(char *s,int *x) ); } -#endif - int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) { diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index b495385612c20c37451cba56978163f3029e9a5c..18069f9759efcfdc3b48fea930d656843939ff77 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -91,7 +91,6 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32))); eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12; -#if defined(USER_MODE) Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints); if (Msc_idx_ptr) @@ -101,26 +100,14 @@ int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32))); return(-1); } -#else - uint8_t b; - - for (b=0; b<33; b++) - if (Msc_RS==dftsizes[b]) - Msc_RS_idx = b; - -#endif - // LOG_I(PHY,"subframe %d, Ns %d, l %d, Msc_RS = %d, Msc_RS_idx = %d, u %d, v %d, cyclic_shift %d\n",subframe,Ns,l,Msc_RS, Msc_RS_idx,u,v,cyclic_shift); #ifdef DEBUG_CH -#ifdef USER_MODE - if (Ns==0) write_output("drs_seq0.m","drsseq0",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1); else write_output("drs_seq1.m","drsseq1",ul_ref_sigs_rx[u][v][Msc_RS_idx],2*Msc_RS,2,1); -#endif #endif @@ -489,12 +476,10 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, 15, 0); -#ifdef USER_MODE #ifdef DEBUG_SRS sprintf(fname,"srs_ch_est%d.m",aa); sprintf(vname,"srs_est%d",aa); write_output(fname,vname,srs_vars->srs_ch_estimates[aa],frame_parms->ofdm_symbol_size,1,1); -#endif #endif } diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c index b715b3ffa293177b2385e94eb2f033e10514974a..5bf69578d194269b656266e0245d38fbd2a39b56 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c @@ -19,10 +19,8 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> -#endif #include "defs.h" #include "PHY/defs.h" diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c index 445c84623cb369d8285b7a0fb7ec6d7835a5aa94..35e5fe6affa62885f33bde299fe1d63a7375d475 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_mbsfn.c @@ -21,10 +21,8 @@ // 6.10.2.2 MBSFN reference signals Mapping to resource elements -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> -#endif #include "defs.h" #include "PHY/defs.h" diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c index ed9ff1f5cd5b35b5fa775a9c76052b71b7c6359f..a7db8fd5aa321848cb1a4b903b5fb2b1cc780842 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -30,10 +30,8 @@ * \warning */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> -#endif #include "defs.h" #include "PHY/defs.h" diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 36638f383b81cba85c87f3aace38e9895c6233ea..39e61c601d16bcbcf38c8b611d76c562ee58fd6a 100755 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -29,11 +29,9 @@ * \note * \warning */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif #include "PHY/defs.h" #include "PHY/extern.h" #include "SCHED/defs.h" @@ -4240,33 +4238,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_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index dbfae80840c4c76fe605fa11fb8023cfb4877b13..bd3c92454f4be0375d355b624bd83bae51415b07 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -247,6 +247,7 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) Mdlharq = dlsch->Mdlharq; dlsch->rnti = 0; dlsch->active = 0; + dlsch->harq_mask = 0; for (i=0; i<10; i++) dlsch->harq_ids[i] = Mdlharq; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index 271de54795337416bf1ba5ec513bfda37dbcb7b8..7acf6480eb40df1d7aef3e2c4be17bdcb2dc2fa4 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -758,318 +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]); - -#ifdef USER_MODE // need to be adapted for the emulation in the kernel space - - 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); - } - -#endif -} - -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]); - -#ifdef USER_MODE // need to be adapted for the emulation in the kernel space - - 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); - } - -#endif -} - -/* -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/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index f53e83dbaf0bbea9e3ed820ef47a3bbff230f00f..1bd0076e1428bb656941cd1cc8bf965d4a1b694a 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -37,11 +37,7 @@ #include "PHY/sse_intrin.h" #include "T.h" -#ifndef USER_MODE -#define NOCYGWIN_STATIC static -#else #define NOCYGWIN_STATIC -#endif /* dynamic shift for LLR computation for TM3/4 * set as command line argument, see lte-softmodem.c @@ -6027,9 +6023,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, //============================================================================================== -#ifdef USER_MODE - - void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid) { unsigned int nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12; @@ -6119,7 +6112,6 @@ void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *c // printf("log2_maxh = %d\n",ue->pdsch_vars[eNB_id]->log2_maxh); } -#endif #ifdef DEBUG_DLSCH_DEMOD /* diff --git a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c index 2a94d77b8e0a22d207077fb75ba5f34e97272b78..a432cde4e4fb20ed7721e223475f57953623f7f5 100644 --- a/openair1/PHY/LTE_TRANSPORT/drs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/drs_modulation.c @@ -81,7 +81,6 @@ int generate_drs_pusch(PHY_VARS_UE *ue, // cyclic_shift1 = 0; Msc_RS = 12*nb_rb; -#ifdef USER_MODE Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints); if (Msc_idx_ptr) @@ -91,20 +90,6 @@ int generate_drs_pusch(PHY_VARS_UE *ue, return(-1); } -#else - uint8_t b; - - for (b=0; b<33; b++) - if (Msc_RS==dftsizes[b]) - Msc_RS_idx = b; - -#endif -#ifdef DEBUG_DRS - printf("[PHY] drs_modulation: Msc_RS = %d, Msc_RS_idx = %d,cyclic_shift %d, u0 %d, v0 %d, u1 %d, v1 %d,cshift0 %d,cshift1 %d\n",Msc_RS, Msc_RS_idx,cyclic_shift,u0,v0,u1,v1,cyclic_shift0,cyclic_shift1); - -#endif - - for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0; l<frame_parms->symbols_per_tti; l += (7 - frame_parms->Ncp),u=u1,v=v1,cyclic_shift=cyclic_shift1) { diff --git a/openair1/PHY/LTE_TRANSPORT/edci.c b/openair1/PHY/LTE_TRANSPORT/edci.c index 49a60ae9e89354e210eae247739c11b6fdea1264..37b1c56349f3edbc727482e8301f47bdcbbf0c61 100755 --- a/openair1/PHY/LTE_TRANSPORT/edci.c +++ b/openair1/PHY/LTE_TRANSPORT/edci.c @@ -29,11 +29,9 @@ * \note * \warning */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif #include "PHY/defs.h" #include "PHY/extern.h" #include "SCHED/defs.h" diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index d1880b0c554fedbd746797edd106fb60f19b3c5f..918696968b373ce1830f4abe081fa01505e4e7ae 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -237,10 +237,6 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2; ue->proc.proc_rxtx[i].frame_rx = (((ue->pbch_vars[0]->decoded_output[2]&3)<<6) + (ue->pbch_vars[0]->decoded_output[1]>>2))<<2; -#ifndef USER_MODE - // one frame delay - ue->proc.proc_rxtx[i].frame_rx ++; -#endif ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx; } #ifdef DEBUG_INITIAL_SYNCH diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index 226d5ef0ca34842d9116e67b08b378c852366f48..9e5b6757fc84e9411c32e28fecd2465b575aac0b 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 @@ -260,13 +255,11 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, #endif #ifdef DEBUG_PBCH - #ifdef USER_MODE write_output("pbch_encoded_output2.m","pbch_encoded_out2", pbch_coded_data2, pbch_coded_bits, 1, 4); - #endif //USER_MODE #endif //DEBUG_PBCH */ #ifdef DEBUG_PBCH_ENCODING @@ -288,8 +281,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, #ifdef DEBUG_PBCH -#ifdef USER_MODE - if (frame_mod4==0) { write_output("pbch_e.m","pbch_e", eNB_pbch->pbch_e, @@ -300,8 +291,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, for (i=0; i<16; i++) printf("e[%d] %d\n",i,eNB_pbch->pbch_e[i]); } - -#endif //USER_MODE #endif //DEBUG_PBCH // scrambling @@ -309,8 +298,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, eNB_pbch->pbch_e, pbch_E); #ifdef DEBUG_PBCH -#ifdef USER_MODE - if (frame_mod4==0) { write_output("pbch_e_s.m","pbch_e_s", eNB_pbch->pbch_e, @@ -321,8 +308,6 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, for (i=0; i<16; i++) printf("e_s[%d] %d\n",i,eNB_pbch->pbch_e[i]); } - -#endif //USER_MODE #endif //DEBUG_PBCH } // frame_mod4==0 @@ -1028,44 +1013,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/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 6e955322b8dc1331d8acb8101d7288fa14111202..2bd7140c32ccc96524b58d9e489280bae5cf7754 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -38,10 +38,6 @@ #include "LAYER2/MAC/extern.h" #include "LAYER2/MAC/defs.h" -#ifndef USER_MODE -#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h" -#endif - #include "T.h" //#define DEBUG_PHICH 1 diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 5f1b3ce448ae42cb905f2c0d6d26969e03ea94e5..a332670a5992dd05cafd76779e90d5f6c942cfa1 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -342,7 +342,6 @@ uint16_t prach_root_sequence_map4[138] = { 1,138,2,137,3,136,4,135,5,134,6,133, 61,78,62,77,63,76,64,75,65,74,66,73,67,72,68,71,69,70 }; -#ifdef USER_MODE void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) { @@ -363,7 +362,6 @@ void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) fclose(fd); } -#endif // This function computes the du void fill_du(uint8_t prach_fmt) diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 284523e3817d94a79f68048ebcc595cf0cab2eed..8afb7b14a30841cff7d1883eb82dce8c56d91879 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -2151,9 +2151,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/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c index a360b35ff6a0733a15d8bbfd54b685e1a4593b3a..c4c02e631279a3833da27c1b2aedceb431e55b7d 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c @@ -180,7 +180,6 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, return(-1); } -#ifdef USER_MODE Msc_idx_ptr = (uint16_t*) bsearch((uint16_t*) &Msc_RS, (uint16_t*) dftsizes, 33, sizeof(uint16_t), compareints); if (Msc_idx_ptr) @@ -190,19 +189,6 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, return(-1); } -#else //stdlib not availiable in RTAI - - if (Msc_RS==216) - Msc_RS_idx = 12; - else if (Msc_RS==144) - Msc_RS_idx = 9; - else { - LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); - return(-1); - } - -#endif - #ifdef DEBUG_SRS LOG_D(PHY,"generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d, k0 = %d\n",Msc_RS, Msc_RS_idx,k0); #endif @@ -279,7 +265,6 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, return(-1); } -#ifdef USER_MODE Msc_idx_ptr = (uint16_t*) bsearch((uint16_t*) &Msc_RS, (uint16_t*) dftsizes, 33, sizeof(uint16_t), compareints); if (Msc_idx_ptr) @@ -289,19 +274,6 @@ int generate_srs_rx(LTE_DL_FRAME_PARMS *frame_parms, return(-1); } -#else //stdlib not availiable in RTAI - - if (Msc_RS==216) - Msc_RS_idx = 12; - else if (Msc_RS==144) - Msc_RS_idx = 9; - else { - LOG_E(PHY,"generate_srs: index for Msc_RS=%d not implemented\n",Msc_RS); - return(-1); - } - -#endif - #ifdef DEBUG_SRS LOG_I(PHY,"generate_srs_rx: Msc_RS = %d, Msc_RS_idx = %d, k0=%d\n",Msc_RS, Msc_RS_idx,k0); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c index 71c36f7c3c206c69443e8c1efff7ea3b407cf4c5..87209e190b1749d27c9f96d3c04a3359eefb49c7 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 e067137a14b8ff180f67702b906317999efbb7c3..57087051d3c9d251382809eb3425189d88625872 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 @@ -170,6 +165,7 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch) //ulsch = (LTE_eNB_ULSCH_t *)malloc16(sizeof(LTE_eNB_ULSCH_t)); if (ulsch) { ulsch->rnti = 0; + ulsch->harq_mask = 0; for (i=0; i<8; i++) { if (ulsch->harq_processes[i]) { @@ -1604,461 +1600,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]; - } - } - -#ifdef USER_MODE // need to be adapted for the emulation in the kernel space - - 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); - } - -#endif -} - - - - - - - -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]; - } - } - -#ifdef USER_MODE // need to be adapted for the emulation in the kernel space - - 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 - -} - -#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 795ed5896b2debb49be34b06a9d5075513b44b2a..93c1af8d9184db6cce5e16e5ab36117f949e6833 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/MODULATION/ul_7_5_kHz.c b/openair1/PHY/MODULATION/ul_7_5_kHz.c index f2e43a533e23e86fd1d9fff77834293e51e8a8fb..80efc70c40cbe1159cdb18ea5414b21287684027 100644 --- a/openair1/PHY/MODULATION/ul_7_5_kHz.c +++ b/openair1/PHY/MODULATION/ul_7_5_kHz.c @@ -23,11 +23,7 @@ #include "PHY/extern.h" #include "extern.h" #include "kHz_7_5.h" -#ifdef USER_MODE #include <math.h> -#else -#include "rtai_math.h" -#endif #include "PHY/sse_intrin.h" short conjugate75[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ; diff --git a/openair1/PHY/TOOLS/Makefile b/openair1/PHY/TOOLS/Makefile index eee9d7834426077de14d2b71b80d7011283ce276..59b6a1e03beedc51371c2a611964fb3d5a2682b6 100644 --- a/openair1/PHY/TOOLS/Makefile +++ b/openair1/PHY/TOOLS/Makefile @@ -1,14 +1,14 @@ lte_dfts_sse4: lte_dfts.c - gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS + gcc -O2 -msse4.1 -g -ggdb -o lte_dfts_sse4 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS lte_dfts_avx2: lte_dfts.c - gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS + gcc -O2 -mavx2 -g -ggdb -o lte_dfts_avx2 lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS lte_dfts_avx2.s: lte_dfts.c - gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS + gcc -O2 -mavx2 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS lte_dfts_sse4.s: lte_dfts.c - gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DUSER_MODE -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS + gcc -O2 -msse4.1 -S lte_dfts.c time_meas.c file_output.c ../../SIMULATION/TOOLS/taus.c -I$$OPENAIR1_DIR -I$$OPENAIR_TARGETS -I$$OPENAIR2_DIR/COMMON -DMR_MAIN -DNB_ANTENNAS_RX=1 # -DD256STATS #-DD64STATS dft_cycles_avx2: lte_dfts_avx2 ./lte_dfts_avx2 | egrep cycles diff --git a/openair1/PHY/TOOLS/cmult_vv.c b/openair1/PHY/TOOLS/cmult_vv.c index b5b551f008ea4bd9aa1e57738ffd79a10f20b915..13facf69077a165a0f6c05378bb1f847c6c4ab0b 100644 --- a/openair1/PHY/TOOLS/cmult_vv.c +++ b/openair1/PHY/TOOLS/cmult_vv.c @@ -20,10 +20,7 @@ */ #include "defs.h" -//#include "MAC_INTERFACE/extern.h" -#ifdef USER_MODE #include <stdio.h> -#endif #if defined(__x86_64__) || defined(__i386__) int16_t conjug[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ; @@ -267,4 +264,4 @@ int multadd_cpx_vector(int16_t *x1, _mm_empty(); _m_empty(); return(0); -} \ No newline at end of file +} diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/defs.h index 41d7c9528adc52c45a79a6923b872abcf87eae56..b92c2a42367b59acae680d167af8665f3de7093e 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; @@ -286,7 +283,6 @@ void bit8_txmux(int32_t length,int32_t offset); void bit8_rxdemux(int32_t length,int32_t offset); -#ifdef USER_MODE /*!\fn int32_t write_output(const char *fname, const char *vname, void *data, int length, int dec, char format); \brief Write output file from signal data @param fname output file name @@ -297,7 +293,6 @@ void bit8_rxdemux(int32_t length,int32_t offset); @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) */ int32_t write_output(const char *fname, const char *vname, void *data, int length, int dec, char format); -#endif void Zero_Buffer(void *,uint32_t); void Zero_Buffer_nommx(void *buf,uint32_t length); @@ -361,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/TOOLS/file_output.c b/openair1/PHY/TOOLS/file_output.c index 1a4adb04cd6a49d525de3aafd3d89e8ba4976f37..1e0b31a47f0a31b08a17c279e09a5fb9f53d473f 100644 --- a/openair1/PHY/TOOLS/file_output.c +++ b/openair1/PHY/TOOLS/file_output.c @@ -19,8 +19,6 @@ * contact@openairinterface.org */ -#ifdef USER_MODE - #include <string.h> #include <stdio.h> #include <stdlib.h> @@ -180,5 +178,3 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d return 0; } - -#endif // USER_MODE diff --git a/openair1/PHY/TOOLS/lte_dfts.c b/openair1/PHY/TOOLS/lte_dfts.c index dc4708ce6cefab738e9e1e5b22b7e927323bf6a8..e0e171f6bfc601fd839fe40e4b8ead6a29a69b23 100644 --- a/openair1/PHY/TOOLS/lte_dfts.c +++ b/openair1/PHY/TOOLS/lte_dfts.c @@ -19,11 +19,9 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif #include <stdint.h> diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index d72a2bd8d6886823269728589d8025d6e7795170..ac54be36fb426c104d2811d40643f4f42676c431 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 6fe6b46a380537afe004d5e13d74932eb78fe777..60d3fec5f4da660076ae16cc68fdf8e2c145aff3 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/PHY/types.h b/openair1/PHY/types.h index be8ec7115a5aed02091bea5973df54ee8a333b3b..c0a9af388cfcc02643e118851719e05364c60570 100644 --- a/openair1/PHY/types.h +++ b/openair1/PHY/types.h @@ -22,11 +22,7 @@ #ifndef __openair_TYPES_H__ #define __openair_TYPES_H__ -#ifdef USER_MODE #include <stdint.h> -#else -#include <linux/types.h> -#endif #endif /*__openair_TYPES_H__ */ diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index 7fb9e6991d58e187bf06d9d9383b8ce724c637f4..3c232a82b755bc001c59f50d4de5a6433f47db3d 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 Number(DL and S) as a function of Frame type and TDD Configuration @param frame_parms Pointer to DL frame parameter descriptor diff --git a/openair1/SCHED/extern.h b/openair1/SCHED/extern.h index 80a815dda769d16f63fc38f95123f8f8a7c6140d..b1e8df67ef86a5bb11c9cf9bb2d5dd57374d2eee 100644 --- a/openair1/SCHED/extern.h +++ b/openair1/SCHED/extern.h @@ -24,40 +24,6 @@ #ifndef __SCHED_EXTERN_H__ #define __SCHED_EXTERN_H__ -#ifndef USER_MODE -#define __NO_VERSION__ - - -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/module.h> -#include <linux/version.h> -#include <linux/types.h> - -#include <asm/io.h> -#include <asm/bitops.h> - -#include <asm/uaccess.h> -#include <asm/segment.h> -#include <asm/page.h> - - - - -#ifdef RTAI_ENABLED -#include <rtai.h> -//#include <rtai_posix.h> -#include <rtai_fifos.h> -#include <rtai_sched.h> -#include <rtai_sem.h> -//#include "rt_compat.h" - -#else -#include <unistd.h> -#endif - -#endif /* USER_MODE */ - #include "defs.h" //#include "dlc_engine.h" @@ -71,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 d005d6cd0ac24ceef3c61bbd6a1edc0dda1dccef..7c6ded9ba9a8352ed68d52d4aff396eee3b76ea2 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -62,6 +62,7 @@ void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB, LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populated pdcch_vars->dci_alloc[%d] proc:subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci); } +#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) @@ -75,6 +76,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,int frame,int subframe,eNB_rxtx_proc_t *proc, nfapi_hi_dci0_request_pdu_t *hi_dci0_config_pdu) @@ -754,10 +756,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 15c6fa7557da2d4eb0bed5d9a7d8b895ae1d720c..664791f7c459632d51541e413ef844384e6c8ab1 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 266a95b3c9fe42576545c8f6480e1ddae6c25166..0000000000000000000000000000000000000000 --- 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 4aa9600c06585ba25da7eda923e50320096c7d03..e426c31110df84e3d0306f36e0dd1fb633462140 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -576,11 +576,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 869723391e5acefe7160ba0ee071f76ddd4c120d..f57e6c1806bfc100dab0d7f6b8f2b65a63d4e63b 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" @@ -68,6 +64,8 @@ fifo_dump_emos_UE emos_dump_UE; #include "T.h" +#include "PHY/TOOLS/defs.h" + #define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs) #define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs) @@ -1193,38 +1191,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; @@ -1424,9 +1390,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); @@ -1834,12 +1797,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 @@ -2390,10 +2347,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; @@ -2674,11 +2627,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; @@ -4676,11 +4624,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 @@ -5160,11 +5103,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 35e99098fa37473e96dfff4c2c8b11029d1f7a97..0000000000000000000000000000000000000000 --- 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 d9943f03d9642c219b520a42c13f621af0ed77a3..dcab55d66f6686eea679b871150bbeb4c1d942a8 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/ETH_TRANSPORT/bypass_session_layer.c b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c index 01bc8f490106736c9615187c02e397b21c997a6e..e96db24521f8772a19ce1a7e0d202219604c42dd 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c @@ -38,10 +38,7 @@ #include "UTIL/OCG/OCG_extern.h" #include "UTIL/LOG/log.h" -#ifdef USER_MODE -# include "multicast_link.h" -# include "pgm_link.h" -#endif +#include "multicast_link.h" char rx_bufferP[BYPASS_RX_BUFFER_SIZE]; unsigned int num_bytesP = 0; @@ -51,10 +48,6 @@ static unsigned int byte_tx_count; unsigned int Master_list_rx; static uint64_t seq_num_tx = 0; -#if defined(ENABLE_PGM_TRANSPORT) -extern unsigned int pgm_would_block; -#endif - mapping transport_names[] = { {"WAIT PM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_PM}, {"WAIT SM TRANSPORT INFO", EMU_TRANSPORT_INFO_WAIT_SM}, @@ -62,9 +55,6 @@ mapping transport_names[] = { {"ENB_TRANSPORT INFO", EMU_TRANSPORT_INFO_ENB}, {"UE TRANSPORT INFO", EMU_TRANSPORT_INFO_UE}, {"RELEASE TRANSPORT INFO", EMU_TRANSPORT_INFO_RELEASE}, -#if defined(ENABLE_PGM_TRANSPORT) - {"NACK TRANSPORT INFO", EMU_TRANSPORT_NACK}, -#endif {NULL, -1} }; @@ -79,9 +69,6 @@ void init_bypass (void) pthread_mutex_init (&emul_low_mutex, NULL); pthread_cond_init (&emul_low_cond, NULL); emul_low_mutex_var = 1; -#endif -#if defined(ENABLE_PGM_TRANSPORT) - pgm_oai_init(oai_emulation.info.multicast_ifname); #endif bypass_init (emul_tx_handler, emul_rx_handler); } @@ -90,10 +77,8 @@ void init_bypass (void) void bypass_init (tx_handler_t tx_handlerP, rx_handler_t rx_handlerP) { /***************************************************************************/ -#if defined(USER_MODE) multicast_link_start (bypass_rx_handler, oai_emulation.info.multicast_group, oai_emulation.info.multicast_ifname); -#endif //USER_MODE tx_handler = tx_handlerP; rx_handler = rx_handlerP; Master_list_rx=0; @@ -322,20 +307,12 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, frame, next_slot, is_master); #if defined(ENABLE_NEW_MULTICAST) -# if defined(ENABLE_PGM_TRANSPORT) - num_bytesP = pgm_recv_msg(oai_emulation.info.multicast_group, - (uint8_t *)&rx_bufferP[0], sizeof(rx_bufferP), - frame, next_slot); - - DevCheck(num_bytesP > 0, num_bytesP, 0, 0); -# else if (multicast_link_read_data_from_sock(is_master) == 1) { /* We got a timeout */ return -1; } -# endif #else pthread_mutex_lock(&emul_low_mutex); @@ -363,10 +340,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, num_bytesP, map_int_to_str(transport_names, messg->Message_type), messg->master_id, messg->seq_num); -#if defined(ENABLE_PGM_TRANSPORT) - - if (messg->Message_type != EMU_TRANSPORT_NACK) -#endif DevCheck4((messg->frame == frame) && (messg->subframe == (next_slot>>1)), messg->frame, frame, messg->subframe, next_slot>>1); @@ -409,20 +382,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, Master_list_rx = oai_emulation.info.master_list; LOG_E(EMU, "RX EMU_TRANSPORT_INFO_RELEASE\n"); break; -#if defined(ENABLE_PGM_TRANSPORT) - - case EMU_TRANSPORT_NACK: - if (messg->failing_master_id == oai_emulation.info.master_id) { - /* We simply re-send the last message */ - pgm_link_send_msg(oai_emulation.info.multicast_group, - (uint8_t *)bypass_tx_buffer, byte_tx_count); - } else { - /* Sleep awhile till other peers have recovered data */ - usleep(500); - } - - break; -#endif default: LOG_E(EMU, "[MAC][BYPASS] ERROR RX UNKNOWN MESSAGE\n"); @@ -448,35 +407,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, return bytes_read; } -/******************************************************************************************************/ -#ifndef USER_MODE -int bypass_rx_handler(unsigned int fifo, int rw) -{ - /******************************************************************************************************/ - int bytes_read; - int bytes_processed=0; - int header_bytes; //, elapsed_time; - //printk("[BYPASS] BYPASS_RX_HANDLER IN...\n"); - header_bytes= rtf_get(fifo_bypass_phy_user2kern, rx_bufferP, - sizeof(bypass_proto2multicast_header_t) ); - - if (header_bytes> 0) { - bytes_read = rtf_get(fifo_bypass_phy_user2kern, &rx_bufferP[header_bytes], - ((bypass_proto2multicast_header_t *) (&rx_bufferP[0]))->size); - - // printk("BYTES_READ=%d\n",bytes_read); - if (bytes_read > 0) { - num_bytesP=header_bytes+bytes_read; - emul_low_mutex_var=0; - //printk("BYPASS_PHY SIGNAL MAC_LOW...\n"); - pthread_cond_signal(&emul_low_cond); - } - } - - // } - return 0; -} -#else //USER_MODE /******************************************************************************************************/ void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer) { @@ -503,7 +433,6 @@ void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer) #endif } } -#endif //USER_MODE /******************************************************************************************************/ void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot, @@ -511,57 +440,12 @@ void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot, { /******************************************************************************************************/ if (Master_list_rx != oai_emulation.info.master_list) { -#ifndef USER_MODE - rtf_put(fifo_mac_bypass, &tt, 1); - /* the Rx window is still opened (Re)signal bypass_phy (emulate MAC signal) */ -#endif bypass_rx_data(frame, last_slot, next_slot, is_master); } else { Master_list_rx = 0; } } -#ifndef USER_MODE -/***************************************************************************/ -int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP) -{ - /***************************************************************************/ - int tx_bytes=0; - - pthread_mutex_lock(&Tx_mutex); - - while(!Tx_mutex_var) { - pthread_cond_wait(&Tx_cond,&Tx_mutex); - } - - Tx_mutex_var=0; - N_P=(int)((sizeP-sizeof (bypass_proto2multicast_header_t))/1000)+2; - tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes], - sizeof (bypass_proto2multicast_header_t)); - - while(tx_bytes<sizeP) { - if(sizeP-tx_bytes<=1000) { - tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes], - sizeP-tx_bytes); - } else { - tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],1000); - } - } - - //RG_tx_mutex_var=0; - pthread_mutex_unlock(&Tx_mutex); - - return tx_bytes; -} -#endif - -#if defined(ENABLE_PGM_TRANSPORT) -void bypass_tx_nack(unsigned int frame, unsigned int next_slot) -{ - bypass_tx_data(NACK_TRANSPORT, frame, next_slot); -} -#endif - /***************************************************************************/ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int next_slot) { @@ -591,26 +475,6 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int byte_tx_count = sizeof (bypass_msg_header_t) + sizeof ( bypass_proto2multicast_header_t); -#if defined(ENABLE_PGM_TRANSPORT) - - if (Type == NACK_TRANSPORT) { - int i; - messg->Message_type = EMU_TRANSPORT_NACK; - - for (i = 0; i < oai_emulation.info.nb_master; i++) { - /* Skip our id */ - if (i == oai_emulation.info.master_id) - continue; - - if ((Master_list_rx & (1 << i)) == 0) { - messg->failing_master_id = i; - break; - } - } - - LOG_T(EMU,"[TX_DATA] NACK TRANSPORT\n"); - } else -#endif if (Type == WAIT_PM_TRANSPORT) { messg->Message_type = EMU_TRANSPORT_INFO_WAIT_PM; LOG_T(EMU,"[TX_DATA] WAIT SYNC PM TRANSPORT\n"); @@ -702,32 +566,11 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int ((bypass_proto2multicast_header_t *) bypass_tx_buffer)->size = byte_tx_count - sizeof (bypass_proto2multicast_header_t); -#if defined(ENABLE_PGM_TRANSPORT) - pgm_link_send_msg(oai_emulation.info.multicast_group, - (uint8_t *)bypass_tx_buffer, byte_tx_count); -#else multicast_link_write_sock(oai_emulation.info.multicast_group, bypass_tx_buffer, byte_tx_count); -#endif LOG_D(EMU, "Frame %d, subframe %d (%d): Sent %d bytes [%s] with master_id %d and seq %"PRIuMAX"\n", frame, next_slot>>1, next_slot,byte_tx_count, map_int_to_str(transport_names, Type), messg->master_id, messg->seq_num); } -#ifndef USER_MODE -/*********************************************************************************************************************/ -int bypass_tx_handler(unsigned int fifo, int rw) -{ - /***************************************************************************/ - if(++N_R==N_P) { - rtf_reset(fifo_bypass_phy_kern2user); - - Tx_mutex_var=1; - N_R=0; - - pthread_cond_signal(&Tx_cond); - } -} -#endif - diff --git a/openair1/SIMULATION/ETH_TRANSPORT/defs.h b/openair1/SIMULATION/ETH_TRANSPORT/defs.h index 3b744aa859fd74b2bca76305dab11019918c9151..5cd961b61a2cb6479622355617ba6f613be40f0e 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/defs.h +++ b/openair1/SIMULATION/ETH_TRANSPORT/defs.h @@ -41,9 +41,6 @@ typedef enum emu_transport_info_e { EMU_TRANSPORT_INFO_ENB, EMU_TRANSPORT_INFO_UE, EMU_TRANSPORT_INFO_RELEASE -#if defined(ENABLE_PGM_TRANSPORT) - ,EMU_TRANSPORT_NACK -#endif } emu_transport_info_t; #define WAIT_PM_TRANSPORT 1 @@ -52,9 +49,6 @@ typedef enum emu_transport_info_e { #define ENB_TRANSPORT 4 #define UE_TRANSPORT 5 #define RELEASE_TRANSPORT 6 -#if defined(ENABLE_PGM_TRANSPORT) -# define NACK_TRANSPORT 7 -#endif #define WAIT_SYNC_TRANSPORT 1 #define SYNCED_TRANSPORT 2 diff --git a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c index 186201cd0b19e9ed03759e2b1faa5c7e27dbe9cd..f71a8ee11727b06e7cd9379475afebe45739a99f 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/emu_transport.c @@ -40,49 +40,17 @@ #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" -#include "pgm_link.h" - extern unsigned int Master_list_rx; extern unsigned char NB_INST; //#define DEBUG_CONTROL 1 //#define DEBUG_EMU 1 -#if defined(ENABLE_PGM_TRANSPORT) -extern unsigned int pgm_would_block; -#endif - void emu_transport_sync(void) { LOG_D(EMU, "Entering EMU transport SYNC is primary master %d\n", oai_emulation.info.is_primary_master); -#if defined(ENABLE_PGM_TRANSPORT) - - if (oai_emulation.info.is_primary_master == 0) { - bypass_tx_data(WAIT_SM_TRANSPORT,0,0); - // just wait to recieve the master 0 msg - Master_list_rx = oai_emulation.info.master_list - 1; - bypass_rx_data(0,0,0,1); - } else { - bypass_rx_data(0,0,0,0); - bypass_tx_data(WAIT_PM_TRANSPORT,0,0); - } - - if (oai_emulation.info.master_list != 0) { - bypass_tx_data(SYNC_TRANSPORT,0,0); - bypass_rx_data(0,0,0,0); - - // i received the sync from all secondary masters - if (emu_rx_status == SYNCED_TRANSPORT) { - emu_tx_status = SYNCED_TRANSPORT; - } - - LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n"); - } - -#else - if (oai_emulation.info.is_primary_master == 0) { retry: bypass_tx_data(WAIT_SM_TRANSPORT,0,0); @@ -115,8 +83,6 @@ retry2: LOG_D(EMU,"TX secondary master SYNC_TRANSPORT state \n"); } -#endif - LOG_D(EMU, "Leaving EMU transport SYNC is primary master %d\n", oai_emulation.info.is_primary_master); } @@ -154,9 +120,6 @@ void emu_transport(unsigned int frame, unsigned int last_slot, } } -#if defined(ENABLE_PGM_TRANSPORT) - pgm_would_block = 0; -#endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_EMU_TRANSPORT, VCD_FUNCTION_OUT); } diff --git a/openair1/SIMULATION/ETH_TRANSPORT/extern.h b/openair1/SIMULATION/ETH_TRANSPORT/extern.h index fafa7009f5480bd1ec0983b58cea8cf21f4aa863..c01b5584e23f70b44f7820ef15832e94760118ed 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/extern.h +++ b/openair1/SIMULATION/ETH_TRANSPORT/extern.h @@ -31,11 +31,7 @@ #ifndef __BYPASS_SESSION_LAYER_EXTERN_H__ # define __BYPASS_SESSION_LAYER_EXTERN_H__ -#ifndef USER_MODE -#include <rtai_posix.h> -#else #include <pthread.h> -#endif //RTAI_ENABLED extern unsigned char Emulation_status; extern unsigned char emu_tx_status; diff --git a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c index f32823f3bb51fe66f74a8f82a996175f51dda847..1ba724976fabdd87b82c623ee50ea9b43cb8cbfb 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/multicast_link.c @@ -54,9 +54,7 @@ #include "socket.h" #include "multicast_link.h" -#ifdef USER_MODE -# include "UTIL/LOG/log.h" -#endif //USER_MODE +#include "UTIL/LOG/log.h" extern unsigned short Master_id; @@ -316,9 +314,7 @@ void multicast_link_start(void (*rx_handlerP) (unsigned int, char *), LOG_I(EMU, "[MULTICAST] LINK START on interface=%s for group=%d: handler=%p\n", (multicast_if == NULL) ? "not specified" : multicast_if, multicast_group, rx_handler); -#if !defined(ENABLE_PGM_TRANSPORT) multicast_link_init (); -#endif #if ! defined(ENABLE_NEW_MULTICAST) LOG_D(EMU, "[MULTICAST] multicast link start thread\n"); diff --git a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c b/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c deleted file mode 100644 index 61bf9406607e4198920a8a35649daf629e9a9cd4..0000000000000000000000000000000000000000 --- a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.c +++ /dev/null @@ -1,417 +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 pgm_link.c - * \brief implementation a warpper for openpgm for reliable multicast transmission - * \author Navid Nikaein and S. Roux - * \date 2013 - 2014 - * \version 1.0 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr - */ - -#include <pthread.h> -#include <stdint.h> -#include <string.h> -#include <errno.h> -#include <unistd.h> - -#include <arpa/inet.h> - -#if defined(ENABLE_PGM_TRANSPORT) - -#include <pgm/pgm.h> - -#include "assertions.h" - -#include "pgm_link.h" -#include "multicast_link.h" - -#include "UTIL/OCG/OCG.h" -#include "UTIL/OCG/OCG_extern.h" - -#include "UTIL/LOG/log.h" - -// #define ENABLE_PGM_DEBUG - -typedef struct { - pgm_sock_t *sock; - uint16_t port; - uint8_t rx_buffer[40000]; -} pgm_multicast_group_t; - -pgm_multicast_group_t pgm_multicast_group[MULTICAST_LINK_NUM_GROUPS]; - -static -int pgm_create_socket(int index, const char *if_addr); - -unsigned int pgm_would_block = 1; - -#if defined(ENABLE_PGM_DEBUG) -static void -log_handler ( - const int log_level, - const char* message, - void* closure -) -{ - printf("%s\n", message); -} -#endif - -int pgm_oai_init(char *if_addr) -{ - pgm_error_t* pgm_err = NULL; - - memset(pgm_multicast_group, 0, - MULTICAST_LINK_NUM_GROUPS * sizeof(pgm_multicast_group_t)); - -#if defined(ENABLE_PGM_DEBUG) - pgm_messages_init(); - pgm_min_log_level = PGM_LOG_LEVEL_DEBUG; - pgm_log_mask = 0xFFF; - - pgm_log_set_handler(log_handler, NULL); -#endif - - if (!pgm_init(&pgm_err)) { - LOG_E(EMU, "Unable to start PGM engine: %s\n", pgm_err->message); - pgm_error_free (pgm_err); - exit(EXIT_FAILURE); - } - - return pgm_create_socket(oai_emulation.info.multicast_group, if_addr); -} - -int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length, - unsigned int frame, unsigned int next_slot) -{ - size_t num_bytes = 0; - int status = 0; - pgm_error_t* pgm_err = NULL; - struct pgm_sockaddr_t from; - socklen_t fromlen = sizeof(from); - uint32_t timeout = 0; - int flags = 0; - - if (pgm_would_block == 0) { - flags = MSG_DONTWAIT; - } - - DevCheck((group <= MULTICAST_LINK_NUM_GROUPS) && (group >= 0), - group, MULTICAST_LINK_NUM_GROUPS, 0); - -#ifdef DEBUG_EMU - LOG_I(EMU, "[PGM] Entering recv function for group %d\n", group); -#endif - - do { - status = pgm_recvfrom(pgm_multicast_group[group].sock, - buffer, - length, - flags, - &num_bytes, - &from, - &fromlen, - &pgm_err); - - if (PGM_IO_STATUS_NORMAL == status) { -#ifdef DEBUG_EMU - LOG_D(EMU, "[PGM] Received %d bytes for group %d\n", num_bytes, group); -#endif - return num_bytes; - } else if (PGM_IO_STATUS_TIMER_PENDING == status) { - if (pgm_would_block == 0) { - /* We sleep for 50 usec */ - usleep(50); - - timeout ++; - - if (timeout == (1000000 / 50)) { - LOG_W(EMU, "[PGM] A packet has been lost -> ask for retransmit\n"); - /* If we do not receive a packet after 10000usec - * -> send a NACK */ - bypass_tx_nack(frame, next_slot); - timeout = 0; - } - } - } else if (PGM_IO_STATUS_RESET == status) { - LOG_W(EMU, "[PGM] Got session reset\n"); - } else { -#ifdef DEBUG_EMU - LOG_D(EMU, "[PGM] Got status %d\n", status); -#endif - - if (pgm_err) { - LOG_E(EMU, "[PGM] recvform failed: %s", pgm_err->message); - pgm_error_free (pgm_err); - pgm_err = NULL; - } - } - } while(status != PGM_IO_STATUS_NORMAL); - - return -1; -} - -int pgm_link_send_msg(int group, uint8_t *data, uint32_t len) -{ - int status; - size_t bytes_written = 0; - - do { - status = pgm_send(pgm_multicast_group[group].sock, data, len, &bytes_written); - } while(status == PGM_IO_STATUS_WOULD_BLOCK); - - if (status != PGM_IO_STATUS_NORMAL) { - return -1; - } - - return bytes_written; -} - -static -int pgm_create_socket(int index, const char *if_addr) -{ - struct pgm_addrinfo_t* res = NULL; - pgm_error_t* pgm_err = NULL; - sa_family_t sa_family = AF_INET; - int udp_encap_port = 46014 + index; - int max_tpdu = 1500; - int sqns = 100; - int port = 0; - struct pgm_sockaddr_t addr; - int blocking = 1; - int multicast_loop = 0; - int multicast_hops = 0; - int dscp, i; - - port = udp_encap_port; - - /* Use PGM */ - udp_encap_port = 0; - - LOG_D(EMU, "[PGM] Preparing socket for group %d and address %s\n", - index, if_addr); - - if (!pgm_getaddrinfo(if_addr, NULL, &res, &pgm_err)) { - LOG_E(EMU, "Parsing network parameter: %s\n", pgm_err->message); - goto err_abort; - } - - if (udp_encap_port) { - LOG_I(EMU, "[PGM] Creating PGM/UDP socket for encapsulated port %d\n", - udp_encap_port); - - if (!pgm_socket (&pgm_multicast_group[index].sock, sa_family, - SOCK_SEQPACKET, IPPROTO_UDP, &pgm_err)) { - LOG_E(EMU, "[PGM] Socket: %s\n", pgm_err->message); - goto err_abort; - } - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_UDP_ENCAP_UCAST_PORT, &udp_encap_port, - sizeof(udp_encap_port)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_UDP_ENCAP_MCAST_PORT, &udp_encap_port, - sizeof(udp_encap_port)); - } else { - LOG_I(EMU, "[PGM] Creating PGM/IP socket\n"); - - if (!pgm_socket(&pgm_multicast_group[index].sock, sa_family, - SOCK_SEQPACKET, IPPROTO_PGM, &pgm_err)) { - LOG_E(EMU, "Creating PGM/IP socket: %s\n", pgm_err->message); - goto err_abort; - } - } - - { - /* Use RFC 2113 tagging for PGM Router Assist */ - const int no_router_assist = 0; - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_IP_ROUTER_ALERT, &no_router_assist, - sizeof(no_router_assist)); - } - - // pgm_drop_superuser(); - - { - /* set PGM parameters */ - const int recv_only = 0, - passive = 0, - peer_expiry = pgm_secs (300), - spmr_expiry = pgm_msecs (250), - nak_bo_ivl = pgm_msecs (10), - nak_rpt_ivl = pgm_secs (2), - nak_rdata_ivl = pgm_secs (2), - nak_data_retries = 50, - nak_ncf_retries = 50, - ambient_spm = pgm_secs(30); - const int heartbeat_spm[] = { - pgm_msecs (100), - pgm_msecs (100), - pgm_msecs (100), - pgm_msecs (100), - pgm_msecs (1300), - pgm_secs (7), - pgm_secs (16), - pgm_secs (25), - pgm_secs (30) - }; - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_RECV_ONLY, &recv_only, sizeof(recv_only)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_PASSIVE, &passive, sizeof(passive)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_MTU, &max_tpdu, sizeof(max_tpdu)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_RXW_SQNS, &sqns, sizeof(sqns)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_PEER_EXPIRY, &peer_expiry, sizeof(peer_expiry)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_SPMR_EXPIRY, &spmr_expiry, sizeof(spmr_expiry)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_NAK_BO_IVL, &nak_bo_ivl, sizeof(nak_bo_ivl)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_NAK_RPT_IVL, &nak_rpt_ivl, sizeof(nak_rpt_ivl)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_NAK_RDATA_IVL, &nak_rdata_ivl, sizeof(nak_rdata_ivl)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_NAK_DATA_RETRIES, &nak_data_retries, sizeof(nak_data_retries)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_NAK_NCF_RETRIES, &nak_ncf_retries, sizeof(nak_ncf_retries)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_AMBIENT_SPM, &ambient_spm, sizeof(ambient_spm)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_HEARTBEAT_SPM, &heartbeat_spm, sizeof(heartbeat_spm)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_TXW_SQNS, &sqns, sizeof(sqns)); - } - - /* create global session identifier */ - memset (&addr, 0, sizeof(addr)); - /* sa_port should be in host byte order */ - addr.sa_port = port; - addr.sa_addr.sport = DEFAULT_DATA_SOURCE_PORT + index; - - if (!pgm_gsi_create_from_hostname(&addr.sa_addr.gsi, &pgm_err)) { - LOG_E(EMU, "[PGM] Creating GSI: %s\n", pgm_err->message); - goto err_abort; - } - - LOG_D(EMU, "[PGM] Created GSI %s\n", pgm_tsi_print(&addr.sa_addr)); - - /* assign socket to specified address */ - { - struct pgm_interface_req_t if_req; - memset (&if_req, 0, sizeof(if_req)); - if_req.ir_interface = res->ai_recv_addrs[0].gsr_interface; - if_req.ir_scope_id = 0; - - if (AF_INET6 == sa_family) { - struct sockaddr_in6 sa6; - memcpy (&sa6, &res->ai_recv_addrs[0].gsr_group, sizeof(sa6)); - if_req.ir_scope_id = sa6.sin6_scope_id; - } - - if (!pgm_bind3(pgm_multicast_group[index].sock, &addr, sizeof(addr), - &if_req, sizeof(if_req), /* tx interface */ - &if_req, sizeof(if_req), /* rx interface */ - &pgm_err)) { - LOG_E(EMU, "[PGM] Error: %s\n", pgm_err->message); - goto err_abort; - } - } - - /* join IP multicast groups */ - { - struct group_req req; - struct sockaddr_in addr_in; - - memset(&req, 0, sizeof(req)); - - /* Interface index */ - req.gr_interface = res->ai_recv_addrs[0].gsr_interface; - - addr_in.sin_family = AF_INET; - addr_in.sin_port = htons(port); - - for (i = 0; i < MULTICAST_LINK_NUM_GROUPS; i++) { - addr_in.sin_addr.s_addr = inet_addr(multicast_group_list[i]); - memcpy(&req.gr_group, &addr_in, sizeof(addr_in)); - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_JOIN_GROUP, &req, - sizeof(struct group_req)); - } - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_SEND_GROUP, &req, - sizeof(struct group_req)); - } - - pgm_freeaddrinfo(res); - res = NULL; - - /* set IP parameters */ - multicast_hops = 64; - dscp = 0x2e << 2; /* Expedited Forwarding PHB for network elements, no ECN. */ - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_MULTICAST_LOOP, &multicast_loop, sizeof(multicast_loop)); - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, - PGM_MULTICAST_HOPS, &multicast_hops, sizeof(multicast_hops)); - - if (AF_INET6 != sa_family) - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, PGM_TOS, - &dscp, sizeof(dscp)); - - pgm_setsockopt(pgm_multicast_group[index].sock, IPPROTO_PGM, PGM_NOBLOCK, - &blocking, sizeof(blocking)); - - if (!pgm_connect(pgm_multicast_group[index].sock, &pgm_err)) { - LOG_E(EMU, "[PGM] Connecting socket: %s\n", pgm_err->message); - goto err_abort; - } - - return 0; - -err_abort: - - if (NULL != pgm_multicast_group[index].sock) { - pgm_close(pgm_multicast_group[index].sock, FALSE); - pgm_multicast_group[index].sock = NULL; - } - - if (NULL != res) { - pgm_freeaddrinfo(res); - res = NULL; - } - - if (NULL != pgm_err) { - pgm_error_free(pgm_err); - pgm_err = NULL; - } - - exit(EXIT_FAILURE); -} - -#endif diff --git a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h b/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h deleted file mode 100644 index 03fa6d4b482aa1b84ed4e6d35814c6d1fedd739e..0000000000000000000000000000000000000000 --- a/openair1/SIMULATION/ETH_TRANSPORT/pgm_link.h +++ /dev/null @@ -1,38 +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 PGM_LINK_H_ -#define PGM_LINK_H_ - -/* Define prototypes only if enabled */ -#if defined(ENABLE_PGM_TRANSPORT) -void bypass_tx_nack(unsigned int frame, unsigned int next_slot); - -int pgm_oai_init(char *if_name); - -int pgm_recv_msg(int group, uint8_t *buffer, uint32_t length, - unsigned int frame, unsigned int next_slot); - -int pgm_link_send_msg(int group, uint8_t *data, uint32_t len); - -#endif - -#endif /* PGM_LINK_H_ */ diff --git a/openair1/SIMULATION/ETH_TRANSPORT/proto.h b/openair1/SIMULATION/ETH_TRANSPORT/proto.h index 6a693085c99867f2ccec551a01339df1a63b999f..25b3265757d74b9ff471021211afefc31c7790e0 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/proto.h +++ b/openair1/SIMULATION/ETH_TRANSPORT/proto.h @@ -39,14 +39,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot, unsigned int next_slot, uint8_t is_master); void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot, unsigned int next_slot, uint8_t is_master); -#ifndef USER_MODE -int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP); -int bypass_tx_handler(unsigned int fifo, int rw); -int bypass_rx_handler(unsigned int fifo, int rw); -#else -void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer); -#endif - void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int next_slot); void emulation_tx_rx(void); diff --git a/openair1/SIMULATION/ETH_TRANSPORT/socket.c b/openair1/SIMULATION/ETH_TRANSPORT/socket.c index e288dcb37896f70b79951a33491f50149931a920..2b28a6617032adf2bb0eca4f93f192e81d681326 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/socket.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/socket.c @@ -41,9 +41,7 @@ //#include "openair_defs.h" #include "socket.h" -#ifdef USER_MODE #define msg printf -#endif //------------------------------------------------------------------------------ void socket_setnonblocking (int sockP) diff --git a/openair1/SIMULATION/ETH_TRANSPORT/vars.h b/openair1/SIMULATION/ETH_TRANSPORT/vars.h index 0ec38a8e907ad153ac8d5b4d37a3341005c60334..f49678642ed19458f41b349034a5688de544161d 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/vars.h +++ b/openair1/SIMULATION/ETH_TRANSPORT/vars.h @@ -28,11 +28,7 @@ * \email: navid.nikaein@eurecom.fr */ -#ifndef USER_MODE -#include <rtai_posix.h> -#else #include <pthread.h> -#endif #include "defs.h" #ifndef __BYPASS_SESSION_LAYER_VARS_H__ diff --git a/openair1/SIMULATION/LTE_PHY/Makefile b/openair1/SIMULATION/LTE_PHY/Makefile deleted file mode 100644 index 713bfba3706fc0b3d086f6df1ae7bc61fd2db489..0000000000000000000000000000000000000000 --- 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 -DUSER_MODE -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 773ec57a3e914284a6a151e9214e7ad161f99afd..fbe75fed16980180a53120747da823c7d296a849 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 e240f88ce6665f36529871a19386591b8ffb43ed..d1e25da5c3c6b9a6bbac62ecc5df498680c1dc6f 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 71e2f881721dc7a38b1fefca9317c4e03add7745..ef0e22149141a2f3de879d8ae01e5e74acd05d61 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 cab2ecb8fb06c813fc01489432a9ff41ce5cc0f9..58f89bd65bd5dba83d41b897045e9888e8f6bc88 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 1e5f47e59eaa8411d98f64804e27861381cadf63..d49367c4db4be34db1d797eee23f1850de2bc686 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 94bc991e3fd67e7e8382db0739e6194ff7d6ee08..69aee01b32b472db4be2d149b6453cb27aaa0064 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 acad27ca113797d96bf4edfb01d3593d56ee6926..e491944ccf555e55797d42b6a114d77e8e3fd8b6 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 d91b35782cfd5985f030d62717d7c6dccb6d8ec7..6a474332e8b4d760a33f01be987c6dd39a756952 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/RF/Makefile b/openair1/SIMULATION/RF/Makefile index 5b713b1d947967778658b23e3889393d44be5cc5..c6c03ad8d59f14a908ac70bc9015f3c0b0225ab3 100644 --- a/openair1/SIMULATION/RF/Makefile +++ b/openair1/SIMULATION/RF/Makefile @@ -1,6 +1,6 @@ include $(OPENAIR_DIR)/common/utils/Makefile.inc OBJS = rf.o ../../PHY/TOOLS/file_output.o ../TOOLS/rangen_double.o -CFLAGS += -DRF_MAIN -DUSER_MODE -DDEBUG_PHY +CFLAGS += -DRF_MAIN -DDEBUG_PHY all: $(OBJS) gcc -o rf $(OBJS) -lm diff --git a/openair1/SIMULATION/TOOLS/rangen_double.c b/openair1/SIMULATION/TOOLS/rangen_double.c index 5168a64ef40a667a611b4088e3763f861e2f3aaa..0fc01a8d3132233ff34502b71466e4a3886adb3a 100644 --- a/openair1/SIMULATION/TOOLS/rangen_double.c +++ b/openair1/SIMULATION/TOOLS/rangen_double.c @@ -19,12 +19,10 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> -#endif #include "defs.h" diff --git a/openair1/SIMULATION/TOOLS/taus.c b/openair1/SIMULATION/TOOLS/taus.c index a86be23aec6a5c92fa463aa356f3ce0d7c5e43ed..0be7952da71c4fa017e13c7a76a4f8a25342497d 100644 --- a/openair1/SIMULATION/TOOLS/taus.c +++ b/openair1/SIMULATION/TOOLS/taus.c @@ -19,18 +19,8 @@ * contact@openairinterface.org */ -#ifdef USER_MODE #include <time.h> #include <stdlib.h> -#else -#include <asm/io.h> -#include <asm/rtai.h> -#endif -#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; @@ -55,21 +45,14 @@ unsigned int taus(void) void set_taus_seed(unsigned int seed_init) { -#ifdef USER_MODE struct drand48_data buffer; unsigned long result = 0; -#endif if (seed_init == 0) { s0 = (unsigned int)time(NULL); s1 = (unsigned int)time(NULL); s2 = (unsigned int)time(NULL); } else { -#ifndef USER_MODE - s0 = (unsigned int)0x1e23d852; - s1 = (unsigned int)0x81f38a1c; - s2 = (unsigned int)0xfe1a133e; -#else /* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */ srand48_r((long int)seed_init, &buffer); mrand48_r(&buffer, (long int *)&result); @@ -78,7 +61,6 @@ void set_taus_seed(unsigned int seed_init) s1 = result; mrand48_r(&buffer, (long int *)&result); s2 = result; -#endif } } #endif @@ -87,10 +69,8 @@ void set_taus_seed(unsigned int seed_init) void set_taus_seed(unsigned int seed_init) { -#ifdef USER_MODE struct drand48_data buffer; unsigned long result = 0; -#endif s0 = (unsigned int)0x1e23d852; s1 = (unsigned int)0x81f38a1c; s2 = (unsigned int)0xfe1a133e; @@ -102,11 +82,6 @@ void set_taus_seed(unsigned int seed_init) s1 = (unsigned int)time(NULL); s2 = (unsigned int)time(NULL); } else { -#ifndef USER_MODE - s0 = (unsigned int)0x1e23d852; - s1 = (unsigned int)0x81f38a1c; - s2 = (unsigned int)0xfe1a133e; -#else // Use reentrant version of rand48 to ensure that no conflicts with other generators occur */ srand48_r((long int)seed_init, &buffer); mrand48_r(&buffer, (long int *)&result); @@ -115,7 +90,6 @@ void set_taus_seed(unsigned int seed_init) s1 = result; mrand48_r(&buffer, (long int *)&result); s2 = result; -#endif } } #endif diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index 8df0970ba0183d0f3dbeb710d591973a41872722..3a73000e505aa5452bd53543669bf3bec0e0ec8e 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_defs.h b/openair2/COMMON/openair_defs.h index 908f8f98131cc5df026f635f040b9d80dd9bb1fd..4d8d50606c814a6e6ccc77ebbfbba93686c19042 100644 --- a/openair2/COMMON/openair_defs.h +++ b/openair2/COMMON/openair_defs.h @@ -22,12 +22,6 @@ #ifndef __openair_DEFS_H__ #define __openair_DEFS_H__ -#ifndef USER_MODE -#include <linux/kernel.h> -#endif //USER_MODE - - -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #if !defined (msg) @@ -49,44 +43,7 @@ #define PAGE_MASK 0xfffff000 #define virt_to_phys(x) (x) -#else // USER_MODE -#include <rtai.h> -#define msg rt_printk - -#ifdef BIGPHYSAREA - -#define bigmalloc(x) (bigphys_malloc(x)) -#define bigmalloc16(x) (bigphys_malloc(x)) - -#define malloc16(x) (bigphys_malloc(x)) -#define free16(y,x) - -#define bigfree(y,x) - -#else // BIGPHYSAREA - -#define bigmalloc(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0)) -#define bigmalloc16(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0)) -#define bigfree(y,x) (dma_free_coherent(pdev[0],(x),(void *)(y),dummy_dma_ptr)) -#define malloc16(x) (kmalloc(x,GFP_KERNEL)) -#define free16(y,x) (kfree(y)) - -#endif // BIGPHYSAREA - - -#ifdef CBMIMO1 -#define openair_get_mbox() (*(unsigned int *)mbox) -#else //CBMIMO1 -#define openair_get_mbox() (*(unsigned int *)PHY_vars->mbox>>1) -#endif //CBMIMO1 - - -#endif // USERMODE - -// #define bzero(s,n) (memset((s),0,(n))) - #define cmax(a,b) ((a>b) ? (a) : (b)) #define cmin(a,b) ((a<b) ? (a) : (b)) #endif // /*__openair_DEFS_H__ */ - diff --git a/openair2/COMMON/openair_types.h b/openair2/COMMON/openair_types.h deleted file mode 100644 index d28380e752eb0588d4b259a91a2cb4a974e573a0..0000000000000000000000000000000000000000 --- a/openair2/COMMON/openair_types.h +++ /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 - */ - -#ifndef __openair_TYPES_H__ -#define __openair_TYPES_H__ - -//#ifdef USER_MODE -//#include <stdint.h> -//typedef int8_t s8; /* 8 bit signed integer */ -//typedef int16_t s16; /* 16 bit signed integer */ -//typedef int32_t s32; /* 32 bit signed integer */ -//typedef int64_t s64; /* 64 bit signed integer */ - -//typedef uint8_t u8; /* 8 bit unsigned integer */ -//typedef uint16_t u16; /* 16 bit unsigned integer */ -//typedef uint32_t u32; /* 32 bit unsigned integer */ -//typedef uint64_t u64; /* 64 bit unsigned integer */ -//#else -//#include <linux/types.h> -//#endif -#endif /*__openair_TYPES_H__ */ diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 533c5eaa2bfcb20cae20988d4abb792ec0161ec9..f4004bdbf991c4c87bec639aacfb13d3071caf76 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -43,7 +43,6 @@ #define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/ #endif -#ifdef USER_MODE #ifdef LARGE_SCALE # define NB_MODULES_MAX 128 # define NB_NODE_MAX 128 @@ -51,11 +50,6 @@ # define NB_MODULES_MAX 32 # define NB_NODE_MAX 32 #endif -#else -# define NB_MODULES_MAX 1 -# define NB_NODE_MAX 1 -#endif //PHY_EMUL - #ifdef JUMBO_FRAME # define MAX_IP_PACKET_SIZE 10000 // 9000 @@ -132,9 +126,7 @@ #define UNUSED_PARAM_MBMS_SESSION_ID 0 #define UNUSED_PARAM_MBMS_SERVICE_ID 0 -#ifdef USER_MODE #define printk printf -#endif #define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE) diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 3997d579bd309dde38f9bc7801011604c5dccc12..1ce10c56bcea7929046cea6104f8cfdd8f8bf7a2 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -30,7 +30,7 @@ #ifndef __PLATFORM_TYPES_H__ # define __PLATFORM_TYPES_H__ -#ifdef USER_MODE +#if !defined(NAS_NETLINK) #include <stdint.h> #endif @@ -271,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 63bc57d9423994d7600f7567249c4f397dc161fa..05fc33463d6454abb7249fe217fab838f58c414a 100644 --- a/openair2/COMMON/rtos_header.h +++ b/openair2/COMMON/rtos_header.h @@ -20,45 +20,13 @@ */ #ifndef _RTOS_HEADER_H_ -# define _RTOS_HEADER_H_ -# if defined(RTAI) && !defined(USER_MODE) -// CONVERSION BETWEEN POSIX PTHREAD AND RTAI FUNCTIONS -/* -# define pthread_mutex_init pthread_mutex_init_rt -# define pthread_mutexattr_init pthread_mutexattr_init_rt -# define pthread_mutex_lock pthread_mutex_lock_rt -# define pthread_mutex_unlock pthread_mutex_unlock_rt -# define pthread_mutex_destroy pthread_mutex_destroy_rt -# define pthread_cond_init pthread_cond_init_rt -# define pthread_cond_wait pthread_cond_wait_rt -# define pthread_cond_signal pthread_cond_signal_rt -# define pthread_cond_destroy pthread_cond_destroy_rt -# define pthread_attr_init pthread_attr_init_rt -# define pthread_attr_setschedparam pthread_attr_setschedparam_rt -# define pthread_create pthread_create_rt -# define pthread_cancel pthread_cancel_rt -# define pthread_delete_np pthread_cancel_rt -# define pthread_attr_setstacksize pthread_attr_setstacksize_rt -# define pthread_self rt_whoami -*/ -# include <asm/rtai.h> -# include <rtai.h> -# include <rtai_posix.h> -# include <rtai_fifos.h> -# include <rtai_sched.h> -# ifdef CONFIG_PROC_FS -# include <rtai_proc_fs.h> -# endif -# else -# ifdef USER_MODE -# 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 -# endif +#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 1699eaad553e84850611e500ea2d5d616383bb40..ca404ddc23cb8ef2b6eba5aee687b9d4258cdbed 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; @@ -314,19 +307,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); @@ -402,16 +382,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 c7585521f1c64ea6c1a2ba195c3861e060cba7d7..eb01c3bd05646d1b6c5be0e026794d120552638a 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/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 78a74f00d3f1a48b705cc15a03dc880e5d5f226e..1afb0d6c4381a6c3da289c0151de29c4412b92b8 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -39,15 +39,9 @@ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif - -//#include "COMMON/openair_defs.h" - - #include "PHY/defs.h" #include "PHY/LTE_TRANSPORT/defs.h" @@ -109,9 +103,7 @@ //#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high #endif -#ifdef USER_MODE #define printk printf -#endif //USER_MODE /*!\brief Maximum number of logical channl group IDs */ #define MAX_NUM_LCGID 4 diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 42835a5a8824089a97088e88b66ee042665b195b..e5fd8d941eab7e1c9b23885df1fba16f32c60f7b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -722,14 +722,18 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, break; } } - for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) { - LTE_eNB_ULSCH_t *ulsch = NULL; - ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; + LTE_eNB_ULSCH_t *ulsch = RC.eNB[module_idP][CC_id]->ulsch[ii]; if((ulsch != NULL) && (ulsch->rnti == rnti)){ LOG_I(MAC, "clean_eNb_ulsch UE %x \n", rnti); clean_eNb_ulsch(ulsch); - break; + } + } + for (int ii=0; ii<NUMBER_OF_UE_MAX; ii++) { + LTE_eNB_DLSCH_t *dlsch = RC.eNB[module_idP][CC_id]->dlsch[ii][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(MAC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); } } diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index d0c8706ad6728ab8cbfae407c77a1a429671c493..e7489ca8e6fffcabb25c34cbb188b1dc7f25dd7c 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -32,10 +32,6 @@ #ifndef __MAC_EXTERN_H__ #define __MAC_EXTERN_H__ - -#ifdef USER_MODE -//#include "stdio.h" -#endif //USER_MODE #include "PHY/defs.h" #include "defs.h" diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index 0feea028aa8fe5e9dd5ed5b422928f1253523cee..2ad3e6a038beb82b26e41deb647add79ed44317c 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -248,10 +248,6 @@ int rlcmac_init_global_param(void) void mac_top_cleanup(void) { -#ifndef USER_MODE - pdcp_module_cleanup(); -#endif - if (NB_UE_INST > 0) { free(UE_mac_inst); } diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index 23d3f3bd603770684c0b2c4364d5f59e609e9668..ff8939d82bba3fd9fa23d5310bcb3d614d7bde8d 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -59,12 +59,6 @@ //#define ICIC 0 -/* - #ifndef USER_MODE - #define msg debug_msg - #endif -*/ - /* this function checks that get_eNB_UE_stats returns * a non-NULL pointer for all the active CCs of an UE */ diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 5b73a76312804f1a34536227101c90bda01a0ca8..7a9b811d0e86cd9e47daa747e3cfe04e0e4d1468 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -71,11 +71,6 @@ extern uint8_t usim_test; -/* -#ifndef USER_MODE -#define msg debug_msg -#endif - */ mapping BSR_names[] = { {"NONE", 0}, {"SHORT BSR", 1}, diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 238608816121c5e438f0089a8bd8d96df9191113..d153c82aeeef2e2ed132cd7c790ffd10150d18d5 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -32,9 +32,6 @@ #ifndef __MAC_VARS_H__ #define __MAC_VARS_H__ -#ifdef USER_MODE -//#include "stdio.h" -#endif //USER_MODE #include "PHY/defs.h" #include "defs.h" #include "COMMON/mac_rrc_primitives.h" diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc index c0e4df5617a7faf659f048bf4fe75305cae9ba92..2f5cea7555462e485dcf00b0d1ec9dc10a98feb5 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 894abeb100a5e5ca2fdccae21181661723ad89de..7023defc439d8b61893bc5c9410784907e650381 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -30,9 +30,6 @@ #define PDCP_C //#define DEBUG_PDCP_FIFO_FLUSH_SDU -#ifndef USER_MODE -#include <rtai_fifos.h> -#endif #include "assertions.h" #include "hashtable.h" #include "pdcp.h" @@ -64,9 +61,7 @@ # include "gtpv1u.h" #endif -#ifndef OAI_EMU extern int otg_enabled; -#endif #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -441,11 +436,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); @@ -693,49 +683,6 @@ pdcp_data_ind( payload_offset=0; } -#if defined(USER_MODE) && 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__); @@ -750,9 +697,6 @@ pdcp_data_ind( return TRUE; } -#endif - - // XXX Decompression would be done at this point /* @@ -811,22 +755,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; @@ -998,11 +935,6 @@ pdcp_run ( itti_send_msg_to_task(TASK_MAC_ENB, 3, msg_resp_p); } # endif -#endif - -#if defined(USER_MODE) && 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 37ff231198b7c6d35336fba8a2f46e1a98823e63..eb060e85352eab6dcd05cce3bed337bcee825f19 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -33,14 +33,11 @@ #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" -#ifdef USER_MODE #include <pthread.h> #include <errno.h> #include <stdio.h> @@ -48,9 +45,6 @@ extern int otg_enabled; #include <unistd.h> #define rtf_put write #define rtf_get read -#else -#include <rtai_fifos.h> -#endif //USER_MODE #include "../MAC/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" @@ -168,11 +162,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) @@ -553,29 +542,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" @@ -596,9 +562,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; @@ -810,121 +773,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(USER_MODE) && 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(USER_MODE) && 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; @@ -973,6 +823,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 eddd42c34b5317588889bd111153ae3a0b641b1b..0df8e59e6d4536bd09654ac739d5651c11fc78d5 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(USER_MODE) && 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 0200ffdbf8fc485d837b35ccc913d1abd017c94c..0b6be93d59a5f44448282293529f0c1ff337e95b 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/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 131d56e1f89a6f677ec7750ac5c6c7d948dafe1d..5130bde38b9f32f6a8d3b18c6d4d8e139c388c84 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -73,10 +73,6 @@ # include "RLC-Config.h" //# include "rlc_am_test.h" -#ifdef USER_MODE -//# include "rlc_am_very_simple_test.h" -#endif - #define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u]" #define PROTOCOL_RLC_AM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\ diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c index f6dd0c58095c5a946b326582cee0edd104797d9a..01a635656e24ce819f112c399f70f99ccf7a3e1a 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c @@ -21,9 +21,7 @@ #define RLC_AM_MODULE 1 #define RLC_AM_INIT_C 1 -#ifdef USER_MODE #include <string.h> -#endif //----------------------------------------------------------------------------- #include "rlc_am.h" #include "LAYER2/MAC/extern.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c index addc949d356bd875eb03d6f0aac753256cee774a..d0b5b52395417f9e01e6581402111ec51d2c05de 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c @@ -268,11 +268,9 @@ rlc_am_reassemble_pdu( //} break; -#if USER_MODE default: assert(0 != 0); -#endif } } else { switch (pdu_info->fi) { @@ -382,19 +380,13 @@ rlc_am_reassemble_pdu( if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug // data is already ok, done by last loop above rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size); - } else { -#if USER_MODE - //assert (5!=5); -#endif } //rlc_pP->reassembly_missing_sn_detected = 0; break; -#if USER_MODE default: assert(1 != 1); -#endif } } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c index afce72b45571112aaaf459034beff3fd1a678246..c16e897bb6f67fdadddb2111694cb95e7ad11097 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_segment.c @@ -22,9 +22,7 @@ #define RLC_AM_MODULE 1 #define RLC_AM_SEGMENT_C 1 //----------------------------------------------------------------------------- -#if USER_MODE #include <assert.h> -#endif //----------------------------------------------------------------------------- #include "platform_types.h" //----------------------------------------------------------------------------- @@ -468,9 +466,7 @@ void rlc_am_segment_10 ( PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); -#if USER_MODE assert(1!=1); -#endif memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); pdu_mngt_p->payload_size += sdu_mngt_p->sdu_remaining_size; pdu_remaining_size = pdu_remaining_size - sdu_mngt_p->sdu_remaining_size; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h index a6c340a165299bdc59ed1dc3e5e8363e774a05f1..147fd44d07e0cb0f55af32d92eca4b8011aeda2e 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_structs.h @@ -36,9 +36,7 @@ # include "list.h" # include "mem_block.h" # include "rlc_am_constants.h" -//#ifdef USER_MODE # include "mac_rlc_primitives.h" -//#endif //USER_MODE # include "mac_primitives.h" # include "rlc_primitives.h" /** diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c index f0cacc287486123a4c19a777d59e25eb47e68c30..7a3005334e8cdd7d8ef0d393230ecc3f459c85cc 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_windows.c @@ -22,9 +22,7 @@ #define RLC_AM_MODULE 1 #define RLC_AM_WINDOWS_C 1 //----------------------------------------------------------------------------- -#if USER_MODE #include <assert.h> -#endif //----------------------------------------------------------------------------- #include "platform_types.h" //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 2e1629f8c882b58d17a11579f03f017d1b93a8a9..7bd0da83a903e40f909f8538a73d5f1c7c192232 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -682,10 +682,6 @@ rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t { rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP; -#if ! USER_MODE - unsigned long int rlc_um_time_us; - int min, sec, usec; -#endif #if TRACE_RLC_UM_PDU #if ENABLE_ITTI MessageDef *msg_p; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h index c7754f587a09a3638c8f04cfec386ac4c2492e31..abf4f8ad6e991a59fd7e98c086b7d557f51f969f 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h @@ -64,9 +64,6 @@ # include "rlc_um_receiver.h" # include "rlc_um_segment.h" # include "rlc_um_test.h" -#ifdef USER_MODE -//# include "rlc_um_very_simple_test.h" -#endif #define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] %s()" #define PROTOCOL_RLC_UM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\ diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c index 468a7d062aded4e95a01741caaa962eafd11a70a..91e1ba66d1bfa662eb29f75cdd286260c48e5147 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_reassembly.c @@ -23,9 +23,7 @@ #define RLC_UM_REASSEMBLY_C 1 #include "platform_types.h" //----------------------------------------------------------------------------- -#if USER_MODE #include <string.h> -#endif #if ENABLE_ITTI # include "platform_types.h" # include "intertask_interface.h" diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 4d4362251eaf96847882391c09d9eb83bc8d6e43..f9af7c1cc2b167a3935615aca9b973784ef3cd40 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -25,9 +25,7 @@ #include "platform_types.h" #include "platform_constants.h" //----------------------------------------------------------------------------- -#if USER_MODE #include <assert.h> -#endif #include "assertions.h" #include "msc.h" #include "list.h" @@ -367,10 +365,8 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); #endif -#if USER_MODE #if !EXMIMO assert(1!=1); -#endif #endif memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); // reduce the size of the PDU @@ -754,9 +750,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) sdu_mngt_p->sdu_remaining_size, pdu_remaining_size - sdu_mngt_p->sdu_remaining_size); #endif -#if USER_MODE assert(1!=1); -#endif memcpy(data, data_sdu_p, sdu_mngt_p->sdu_remaining_size); // reduce the size of the PDU continue_fill_pdu_with_sdu = 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h index a5425cb8a0f8a5e6a754ba4dfd364528495cf1fb..7ab9798a38d66a128079abe3142ddf3f960ffb04 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_structs.h @@ -36,9 +36,7 @@ # include "rlc_um_constants.h" # include "mac_primitives.h" # include "rlc_primitives.h" -//#ifdef USER_MODE # include "mac_rlc_primitives.h" -//#endif //USER_MODE //----------------------- /** * @addtogroup _rlc_um_impl_ diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d70d85f2d52519316977d3e5faf3f2100a0df7ad..d27d46ff4282b4ca3488a85ffb649f6f5d7d80ee 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.h b/openair2/LAYER2/RLC/rlc.h index fca786b4d3eed3bfcf02e16851ac59e8037c9547..ffd963204eeba97839d93bf27cf393dedb9846c5 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -662,10 +662,6 @@ public_rlc(rlc_op_status_t rlc_stat_req ( public_rlc(int rlc_module_init(void);) /** @} */ -#ifndef USER_MODE -#define assert(x) ((x)?msg("rlc assertion fails\n"):0) -#endif - #define RLC_FG_COLOR_BLACK "\e[0;30m" #define RLC_FG_COLOR_RED "\e[0;31m" diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 6793e71c547ffd1d9fa5782b049bf96565273ea4..497937d073841cdb37ce5ddf17b0f8aadee419cf 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_primitives.h b/openair2/LAYER2/RLC/rlc_primitives.h index 8d679ab9aaf61f8f67d720ef68df79adcbb84e33..eb7b9ae0053b925a3d52132c99e3240b1658181d 100644 --- a/openair2/LAYER2/RLC/rlc_primitives.h +++ b/openair2/LAYER2/RLC/rlc_primitives.h @@ -31,10 +31,8 @@ #ifndef __RLC_PRIMITIVES_H__ # define __RLC_PRIMITIVES_H__ -# ifdef USER_MODE -# include <stdio.h> -# include <stdlib.h> -# endif +# include <stdio.h> +# include <stdlib.h> # include "platform_types.h" # include "platform_constants.h" # include "mem_block.h" diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 68f5971bf1e1986d6a1064a11e610685b2054b94..dee6ba700017d6dc48151b32ccac8f7a82eead0c 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/openair2_proc.c b/openair2/LAYER2/openair2_proc.c index a5a8135feda8037c2b3131c8ceedd63a1585d876..a3e8e2164a91dda95238a40076c0c962786aeb6d 100644 --- a/openair2/LAYER2/openair2_proc.c +++ b/openair2/LAYER2/openair2_proc.c @@ -29,21 +29,7 @@ # @ingroup _openair2 */ -#ifdef USER_MODE -# include <inttypes.h> -#else -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/proc_fs.h> - -# ifndef PRIu64 -# if __WORDSIZE == 64 -# define PRIu64 "lu" -# else -# define PRIu64 "llu" -# endif -# endif -#endif +#include <inttypes.h> #include "LAYER2/RLC/rlc.h" #include "LAYER2/MAC/defs.h" @@ -410,11 +396,7 @@ int dump_eNB_l2_stats(char *buffer, int length) } #ifdef PROC -#ifndef USER_MODE -static int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) -#else int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) -#endif { int len = 0,fg,Overhead, Sign; @@ -697,36 +679,4 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) return len; } -#ifndef USER_MODE -static struct proc_dir_entry *proc_openair2_root; -/* - * Initialize the module and add the /proc file. - */ -int add_openair2_stats() -{ - struct proc_dir_entry *pde; - - proc_openair2_root = proc_mkdir("openair2",0); - // pde = proc_create_entry("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root); - pde = proc_create_data("lchan_stats", S_IFREG | S_IRUGO, proc_openair2_root, NULL,openair2_stats_read); - - if (!pde) { - printk("[OPENAIR][ERROR] can't create proc entry !\n"); - } - - return 0; -} -/* - * Unregister the file when the module is closed. - */ -void remove_openair_stats() -{ - - if (proc_openair2_root) { - printk("[OPENAIR][CLEANUP] Removing openair proc entry\n"); - remove_proc_entry("lchan_stats", proc_openair2_root); - - } -} -#endif #endif diff --git a/openair2/LAYER2/register.c b/openair2/LAYER2/register.c deleted file mode 100644 index 964666875a5a5d6a86a9bbb7276c567c3121c870..0000000000000000000000000000000000000000 --- a/openair2/LAYER2/register.c +++ /dev/null @@ -1,81 +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 -________________________________________________________________*/ - - -#ifndef USER_MODE -#define __NO_VERSION__ -#else -#include <stdio.h> -#include <stdlib.h> - -#include <pthread.h> -#endif - -#include "COMMON/openair_types.h" -#include "MAC/extern.h" - -#include <linux/module.h> - -#ifndef USER_MODE - -//-----------------------------------------------------------------------------------------------------------// -MAC_RLC_XFACE* mac_rrc_register(RRC_XFACE* RRC_xface) -{ - //-----------------------------------------------------------------------------------------------------------// - if(Is_rrc_registered) { - msg("[OPENAIR][MAC][RRC_REGISTER] RRC interface already registered, aborting ...\n"); - return NULL; - } else { - msg("[OPENAIR][MAC][RRC_REGISTER] Registering RRC Interface, Mac_rlc_xface=%p\n",Mac_rlc_xface); - Rrc_xface=RRC_xface; - Is_rrc_registered=1; - return Mac_rlc_xface; - } -} - -//-----------------------------------------------------------------------------------------------------------// -int mac_rrc_unregister(RRC_XFACE *RRC_xface) -{ - //-----------------------------------------------------------------------------------------------------------// - if (Rrc_xface == RRC_xface) { - msg("[OPENAIR][MAC XFACE][RRC_UNREGISTER] Unregistering RRC interface\n"); - Rrc_xface=NULL; - Is_rrc_registered=0; - return(0); - } else { - msg("[OPENAIR][MAC XFACE][RRC_UNREGISTER] Not the right interface descriptor pointer!!!, aborting ...\n"); - return (-1); - } - -} - -EXPORT_SYMBOL(mac_rrc_register); -EXPORT_SYMBOL(mac_rrc_unregister); -#endif //USER_MODE - - diff --git a/openair2/Makefile b/openair2/Makefile deleted file mode 100755 index 2fbeb193a6e949e8a4ff9b5de1aa9837a01e57b9..0000000000000000000000000000000000000000 --- 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 427a9fad518f07312b3564ee19bc83219b3e3b2f..0000000000000000000000000000000000000000 --- 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 0b520ed151bc3e06672f58fe4ed2893cece59189..0000000000000000000000000000000000000000 --- 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 128503094f3deda19e45c54406c50a0ac58e7c5a..0000000000000000000000000000000000000000 --- 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 ec14990d6321e4c64a76bad8ca43ec005c85daa1..0000000000000000000000000000000000000000 --- 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 666cbb1a044c9b98c1f0b6d7d9bca26b6ad071f4..0000000000000000000000000000000000000000 --- 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 3cc1ac0879822d1ad85d169ac1cc665774386f67..0000000000000000000000000000000000000000 --- 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 bbafa86ad1c0fdb0b74301b78e8d3ace99802789..0000000000000000000000000000000000000000 --- 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 bdba11ff79bc77d4ca5d97f527ecae698205a537..0000000000000000000000000000000000000000 --- 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 efc8562bf9fa5f6e7ec5dc8adb733d382ac7fd7f..0000000000000000000000000000000000000000 --- 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 296ae788666e83b4ce1b7fbe0bf4e057d2ea5acb..0000000000000000000000000000000000000000 --- 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 40118d8368257a4586b7f6b07db91ddaf7ea91ae..0000000000000000000000000000000000000000 --- 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 2f92b94717ea2eca2171298ee8fcaecd09258f27..0000000000000000000000000000000000000000 --- 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 3a6ffe4848a0deffb0b81c01263a1224748f317f..0000000000000000000000000000000000000000 --- 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 c0934f4622a2c519bbe6e5143e073b0041b1cec7..0000000000000000000000000000000000000000 --- 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 4c5d3fcf6e700742a13ba017caad1af567de051a..0000000000000000000000000000000000000000 --- 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 c5754e948eb0ba1440bdc76a7b68ff1a499b18d0..0000000000000000000000000000000000000000 --- 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 758fa0420b0220e949ebae6266e6a11e403e1926..0000000000000000000000000000000000000000 --- 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 4a6ef0e27510e512703b35804237b107b2add8c3..0000000000000000000000000000000000000000 --- 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 4c0cf8aa1ed4e9da01083b0143ee05f13a9fe3fe..0000000000000000000000000000000000000000 --- 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 6bfd77a17d3aa636397ea777f7582ed2bb2e37f2..0000000000000000000000000000000000000000 --- 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 7a0e69cc4847caa05129ce397efb81008a86c841..0000000000000000000000000000000000000000 --- 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 8fe2d48e3fabaf29bf4d8acaf3490a76f3764b89..0000000000000000000000000000000000000000 --- 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 3c8f5d3cc6e9f41ecb384168765ed3a47470f104..0000000000000000000000000000000000000000 --- 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 bd7baac3b63bbb2d3e948d3bc40a99a9517f8f78..0000000000000000000000000000000000000000 --- 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 d0a3516567f952089b11e17796d8cf5bdf98b577..0000000000000000000000000000000000000000 --- 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 9053c88a56e24775213ee88a842fd04710779e56..0000000000000000000000000000000000000000 --- 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 e2835adf7d61773552bb9090993c5de106b0009b..0000000000000000000000000000000000000000 --- 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 54324cf63fc322866bd4ecb33acee592e1ed8698..0000000000000000000000000000000000000000 --- 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 7c2b69459ca7ee733225665270f9f98c6645c18c..0000000000000000000000000000000000000000 --- 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 eec82de367aaa0dd70afc5d94cf3a397a9dc3ed7..0000000000000000000000000000000000000000 --- 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 Binary files a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest and /dev/null differ diff --git a/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c b/openair2/NAS/DRIVER/CELLULAR/NETLTEST/netltest.c deleted file mode 100644 index 84de51a68d5a6b9ad5581cb8323d144c74901075..0000000000000000000000000000000000000000 --- 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 121d3bba8b9cb9ade5a35f79a82d7ab7d37d5f39..0000000000000000000000000000000000000000 --- 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 fd4411a25bf46168b66fed55a4c9aa442cba6d39..0000000000000000000000000000000000000000 --- 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 c89f19e9c04e315fdce80edaff46645816c9efee..0000000000000000000000000000000000000000 --- 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 3d51140dcde1916cec44af8f32674ca7e9e65f87..0000000000000000000000000000000000000000 --- 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 f57fb7712d6fb16a76d1041e1e31af8c082767fc..0000000000000000000000000000000000000000 --- 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 e7325cf40f586f45dc4bb2cf20ff12d6507a0e2f..0000000000000000000000000000000000000000 --- 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 88d17a7e6bffae19a5ff224c8157bf0aac45fe45..0000000000000000000000000000000000000000 --- 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 a06e8f690aa3d9ae1aea78d27767f293eace592b..0000000000000000000000000000000000000000 --- 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 26af978a4ef741d386f7be4614948057b91af3e6..0000000000000000000000000000000000000000 --- 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 -DUSER_MODE -DNODE_RG -DNODE_MT -CFLAGS += -std=gnu99 -I$(KERNEL_DIR) -DUSER_MODE -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 86ab7a1ec53173011bc0302f2089ca484f2d11b6..0000000000000000000000000000000000000000 --- 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 a192b82d7247eafc2f8ae8e94df2e88d65507fb0..0000000000000000000000000000000000000000 --- 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 e9cefdd926a169c48986c4627541a2d13079f08c..0000000000000000000000000000000000000000 --- 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 76ba3b5bdb3baaed7780d38cb60ee40699fc6d5e..0000000000000000000000000000000000000000 --- 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 fe60d82c157881236a6c0955106af1beca2b6ffd..854c3bcc997b07b4231b088a2eabd9215d8e6f42 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 f4bf87f3185dab440d6bf00b5598c942f2a0597b..0000000000000000000000000000000000000000 --- 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 0eb7530ee6fabbf8c130d5172d5e9e27339879d0..d380b8a4d829cf31bf1369996d05de279cab73a5 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 f9bc592bce4a3ddf335064842a377a1490fba732..086ec3909ca225376d36cf520dca88f44aaf55d4 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 fbcf85fabb3527bed1233302289f75e1c4a899d2..0000000000000000000000000000000000000000 --- 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 a4398e9d9ed62634afadfebe37e9566e90f67056..29db4ae07a172f26e49dd14811420084f88816a7 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/PHY_INTERFACE/mac_phy_primitives.c b/openair2/PHY_INTERFACE/mac_phy_primitives.c index 3d42393d1140800fa08cefb67652729689e68cd0..06e06d096dc53caf0066bbdd26f6546dd5f7f9ee 100644 --- a/openair2/PHY_INTERFACE/mac_phy_primitives.c +++ b/openair2/PHY_INTERFACE/mac_phy_primitives.c @@ -187,9 +187,6 @@ MACPHY_DATA_REQ *new_macphy_data_req(unsigned char Mod_id) return((MACPHY_DATA_REQ*)0); } -#ifndef USER_MODE -EXPORT_SYMBOL(new_macphy_data_req); -#endif #endif //PHY_CONTEXT @@ -262,13 +259,7 @@ void macphy_data_ind(unsigned char Mod_id,unsigned char Pdu_type,void *pdu,unsig } } msg("[OPENAIR][MAC][ERROR] No more PHY_RESOURCES !!!!\n"); -#ifdef USER_MODE exit(-1); -#else - print_active_indications(); - print_active_requests(); - mac_xface->macphy_exit(); -#endif } */ diff --git a/openair2/PHY_INTERFACE/vars.h b/openair2/PHY_INTERFACE/vars.h index 736d6f89db2038bb3dd87cf71be8dc44d7063922..566f4347b6e5e264ff19a5a28193b1c96258ab97 100644 --- a/openair2/PHY_INTERFACE/vars.h +++ b/openair2/PHY_INTERFACE/vars.h @@ -42,7 +42,3 @@ unsigned int mac_registered; #endif -#ifndef USER_MODE -EXPORT_SYMBOL(mac_xface); -#endif //PHY_EMUL - diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c index 8d69b6e76ba8e22a217e53a1da33a6098eb0ec2a..0844593d93e787a710b2dafb8b00aeb88bfaf19f 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c @@ -28,45 +28,10 @@ * \email: navid.nikaein@eurecom.fr */ -#ifdef USER_MODE #include <fcntl.h> #include <stdio.h> #include <stdlib.h> -#else //USER_MODE - -#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/version.h> -#include <linux/kernel.h> -#include <linux/fs.h> - -#include <linux/errno.h> - - -#ifdef KERNEL2_6 - -#include <linux/slab.h> -#endif - -#ifdef KERNEL2_4 -#include <linux/malloc.h> -#include <linux/wrapper.h> -#endif -#endif //USER_MODE - #include "platform_types.h" #include "openair_defs.h" diff --git a/openair2/RRC/LITE/MESSAGES/Makefile b/openair2/RRC/LITE/MESSAGES/Makefile deleted file mode 100644 index bd99081ad2e3d6768cf7bb16fa44fce5d51c4dbd..0000000000000000000000000000000000000000 --- 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/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index db5ce5db9537e088340448ada83a135a8048894b..b8a4148b1131a6d8a9960d6fcc5050a4a9d89711 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -28,7 +28,6 @@ * \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr */ -#ifdef USER_MODE #include <stdio.h> #include <sys/types.h> #include <stdlib.h> /* for atoi(3) */ @@ -36,14 +35,7 @@ #include <string.h> /* for strerror(3) */ #include <sysexits.h> /* for EX_* exit codes */ #include <errno.h> /* for errno */ -#else -#include <linux/module.h> /* Needed by all modules */ -#endif -#ifdef USER_MODE -//#include "RRC/LITE/defs.h" -//#include "COMMON/mac_rrc_primitives.h" #include "UTIL/LOG/log.h" -#endif #include <asn_application.h> #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */ #include <per_encoder.h> @@ -93,16 +85,8 @@ #include "common/ran_context.h" #include "secu_defs.h" -//#include "PHY/defs.h" -#ifndef USER_MODE -#define msg printk -#ifndef errno -int errno; -#endif -#else -# if !defined (msg) -# define msg printf -# endif +#if !defined (msg) +#define msg printf #endif //#define XER_PRINT @@ -486,9 +470,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif if (enc_rval.encoded==-1) { return(-1); @@ -1016,9 +998,7 @@ uint8_t do_SIB23(uint8_t Mod_id, # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif if (enc_rval.encoded==-1) { msg("[RRC] ASN1 : SI encoding failed for SIB23\n"); @@ -1105,9 +1085,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); -#endif return((enc_rval.encoded+7)/8); @@ -1188,9 +1166,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin # endif #endif -#ifdef USER_MODE LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif return((enc_rval.encoded+7)/8); @@ -1250,9 +1226,7 @@ do_RRCConnectionReconfigurationComplete( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif return((enc_rval.encoded+7)/8); } @@ -1639,10 +1613,8 @@ do_RRCConnectionSetup( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes), ecause %d\n", enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); -#endif // FREEMEM(SRB_list); // free(SRB1_config); @@ -1712,13 +1684,11 @@ do_SecurityModeCommand( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rnti, enc_rval.encoded, (enc_rval.encoded+7)/8); -#endif if (enc_rval.encoded==-1) { LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n", @@ -1790,13 +1760,11 @@ do_UECapabilityEnquiry( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rnti, enc_rval.encoded, (enc_rval.encoded+7)/8); -#endif if (enc_rval.encoded==-1) { LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n", @@ -1956,13 +1924,11 @@ do_RRCConnectionReconfiguration( # endif #endif - //#ifdef USER_MODE LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); // for (i=0;i<30;i++) // msg("%x.",buffer[i]); // msg("\n"); - //#endif return((enc_rval.encoded+7)/8); } @@ -2225,10 +2191,8 @@ do_RRCConnectionReestablishmentReject( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif return((enc_rval.encoded+7)/8); } @@ -2286,10 +2250,8 @@ do_RRCConnectionReject( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif return((enc_rval.encoded+7)/8); } @@ -2477,9 +2439,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, # endif #endif -#ifdef USER_MODE LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif if (enc_rval.encoded==-1) { msg("[RRC] ASN1 : MCCH encoding failed for MBSFNAreaConfiguration\n"); @@ -2611,9 +2571,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ # endif #endif -#ifdef USER_MODE printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif return((enc_rval.encoded+7)/8); } diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h index 270d9bc58fea6c3b3764bca0770893c9b72197ee..05396bf727961b03a8278f00ddbbf606da6bd629 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h @@ -28,7 +28,6 @@ * \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr */ -#ifdef USER_MODE #include <stdio.h> #include <sys/types.h> #include <stdlib.h> /* for atoi(3) */ @@ -36,9 +35,6 @@ #include <string.h> /* for strerror(3) */ #include <sysexits.h> /* for EX_* exit codes */ #include <errno.h> /* for errno */ -#else -#include <linux/module.h> /* Needed by all modules */ -#endif #include <asn_application.h> #include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */ diff --git a/openair2/RRC/LITE/MESSAGES/rtai_mem.c b/openair2/RRC/LITE/MESSAGES/rtai_mem.c deleted file mode 100644 index c522a1f0bfdc566b008d38abaf876e8d5f8786af..0000000000000000000000000000000000000000 --- 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 9efc24851f0d57b92c7a43c78330e13e6586962b..0000000000000000000000000000000000000000 --- 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/defs.h b/openair2/RRC/LITE/defs.h index 0a661849988efbea794cc129772db7074a56fb01..507d70e459ac7fbc0466fa9275480a18e2ff008f 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -31,11 +31,9 @@ #ifndef __OPENAIR_RRC_DEFS_H__ #define __OPENAIR_RRC_DEFS_H__ -#ifdef USER_MODE #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif #include "collection/tree.h" #include "rrc_types.h" @@ -47,11 +45,6 @@ #include "LAYER2/MAC/defs.h" -//#include "COMMON/openair_defs.h" -#ifndef USER_MODE -#include <rtai.h> -#endif - #include "SystemInformationBlockType1.h" #include "SystemInformation.h" #include "RRCConnectionReconfiguration.h" diff --git a/openair2/RRC/LITE/mesh_top.c b/openair2/RRC/LITE/mesh_top.c deleted file mode 100644 index 16395e99c64294ca1179e25a14071dfc359d1a45..0000000000000000000000000000000000000000 --- a/openair2/RRC/LITE/mesh_top.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 - */ - -/*________________________openair_rrc_top.c________________________ - - Authors : Hicham Anouar - Company : EURECOM - Emails : anouar@eurecom.fr -________________________________________________________________*/ - - -#ifndef USER_MODE -#define __NO_VERSION__ - -#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/version.h> -#include <linux/kernel.h> -#include <linux/fs.h> - -#include <linux/errno.h> -#ifdef KERNEL2_6 -#include <linux/slab.h> -#endif - -#ifdef KERNEL2_4 -#include <linux/malloc.h> -#include <linux/wrapper.h> -#endif - -#endif - - - -#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); - - - - -#ifndef USER_MODE - -/*------------------------------------------------*/ -/* Prototypes */ -/*------------------------------------------------*/ -#ifdef KERNEL2_4 -static int init_module( void ); -static void cleanup_module(void); -#else -static int openair_rrc_init_module( void ); -static void openair_rrc_cleanup_module(void); -#endif - -#ifdef KERNEL2_6 -static int __init openair_rrc_init_module( void ) -#else -int init_module( void ) -#endif //KERNEL2_6 -{ - printk("[OPENAIR][RRC][INIT] inserting module\n"); - - - Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE)); - - if(Rrc_xface == NULL) { - printk("[RRC] FATAL EROOR: Could not allocate memory for Rrc_xface !!!\n"); - return (-1); - } - - Mac_rlc_xface=mac_rrc_register(Rrc_xface); - - if( Mac_rlc_xface == NULL ) { - printk("[OPENAIR][RRC][INIT] Could not get RRC descriptor\n"); - return -1; - } else { - printk("[OPENAIR][RRC][INIT] Got RRC descriptor , Rcc_xface %p,Mac_rlc_xface=%p \n",Rrc_xface,Mac_rlc_xface); - } - - if(rrc_init_global_param()==-1) { - printk("[OPENAIR][RRC][INIT] FATAL ERROR: INIT_GLOBAL_PARAM_NOK\n"); - return -1; - } - - return 0; -} - -#ifdef KERNEL2_6 -static void __exit openair_rrc_cleanup_module(void) -#else -void cleanup_module(void) -#endif //KERNEL2_6 -{ -#ifndef NO_RRM - rtf_destroy(RRC2RRM_FIFO); - rtf_destroy(RRM2RRC_FIFO); -#endif //NO_RRM - printk("[OPENAIR][RRC][CLEANUP] cleanup module\n"); - mac_rrc_unregister(Rrc_xface); - -} - -MODULE_AUTHOR -("Lionel GAUTHIER <lionel.gauthier@eurecom.fr>, Raymond KNOPP <raymond.knopp@eurecom.fr>, Aawatif MENOUNI <aawatif.menouni@eurecom.fr>,Dominique NUSSBAUM <dominique.nussbaum@eurecom.fr>, Michelle WETTERWALD <michelle.wetterwald@eurecom.fr>, Maxime GUILLAUD <maxime.guillaud@eurecom.fr, Hicham ANOUAR <hicham.anouar@eurecom.fr>"); -MODULE_DESCRIPTION ("openair RRC layer module"); -MODULE_LICENSE ("GPL"); -module_init (openair_rrc_init_module); -module_exit (openair_rrc_cleanup_module); - -#endif //USER_MODE - - diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index f0f495e8b77baffd9f39effdff25d383251e1d3b..d66025301f59e9eea60b0865804b1ae6cbf3274a 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -62,14 +62,8 @@ #include "TDD-Config.h" #include "UECapabilityEnquiry.h" #include "UE-CapabilityRequest.h" -#ifdef PHY_ABSTRACTION -#include "OCG.h" -#include "OCG_extern.h" -#endif -#ifdef USER_MODE #include "RRC/NAS/nas_config.h" #include "RRC/NAS/rb_config.h" -#endif #if ENABLE_RAL #include "rrc_UE_ral.h" #endif @@ -730,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 @@ -744,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, @@ -762,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 @@ -1540,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 } @@ -1730,9 +1701,7 @@ rrc_ue_process_securityModeCommand( # endif #endif -#ifdef USER_MODE LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); -#endif for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { LOG_T(RRC, "%02x.", buffer[i]); @@ -1835,9 +1804,7 @@ rrc_ue_process_ueCapabilityEnquiry( # endif #endif -#ifdef USER_MODE LOG_D(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); -#endif for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { LOG_T(RRC, "%02x.", buffer[i]); @@ -4246,10 +4213,6 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i #endif // rel10 -#ifndef USER_MODE -EXPORT_SYMBOL(Rlc_info_am_config); -#endif - #if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- void *rrc_ue_task( void *args_p ) diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c index 4bccf7d6beebef71be5c5b9430112639a88b99fd..d16ae97435de89f092d0ab6259839da66d4df15f 100644 --- a/openair2/RRC/LITE/rrc_common.c +++ b/openair2/RRC/LITE/rrc_common.c @@ -97,9 +97,7 @@ rrc_init_global_param( //----------------------------------------------------------------------------- { - //#ifdef USER_MODE // Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE)); - //#endif //USRE_MODE // Rrc_xface->openair_rrc_top_init = openair_rrc_top_init; // Rrc_xface->openair_rrc_eNB_init = openair_rrc_eNB_init; diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index c9ef58129b92b4580a6479622510b0b55085172e..66e8a93a3a5b356ba9f3e589257086f071e78d0c 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -63,12 +63,10 @@ #include "MeasResults.h" //#endif -#ifdef USER_MODE -# include "RRC/NAS/nas_config.h" -# include "RRC/NAS/rb_config.h" -# include "OCG.h" -# include "OCG_extern.h" -#endif +#include "RRC/NAS/nas_config.h" +#include "RRC/NAS/rb_config.h" +#include "OCG.h" +#include "OCG_extern.h" #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" @@ -809,6 +807,7 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* rnti_t rnti = ue_context_pP->ue_context.rnti; int i, j , CC_id, pdu_number; LTE_eNB_ULSCH_t *ulsch = NULL; + LTE_eNB_DLSCH_t *dlsch = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL; PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; @@ -835,14 +834,6 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* */ return; } -#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 for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; @@ -851,7 +842,13 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* if((ulsch != NULL) && (ulsch->rnti == rnti)){ LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); clean_eNb_ulsch(ulsch); - break; + } + } + for (i=0; i<NUMBER_OF_UE_MAX; i++) { + dlsch = eNB_PHY->dlsch[i][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); } } @@ -4876,12 +4873,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, @@ -4898,10 +4890,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/RRC/LITE/rrc_rrm_interface.c b/openair2/RRC/LITE/rrc_rrm_interface.c index 822ce554af389f51022e353738c7f5a4b40eaafb..9f4270be8941487cc8ffe55bd0f08f1a316a1865 100644 --- a/openair2/RRC/LITE/rrc_rrm_interface.c +++ b/openair2/RRC/LITE/rrc_rrm_interface.c @@ -292,10 +292,5 @@ int send_msg_fifo(int *s, msg_t *fmsg) int send_msg(void *s, msg_t *smsg) { -#ifdef USER_MODE send_msg_sock((sock_rrm_t *)s, smsg); -#else - send_msg_fifo((int *)s,smsg); -#endif - } diff --git a/openair2/RRC/LITE/rrc_rrm_interface.h b/openair2/RRC/LITE/rrc_rrm_interface.h index d204ab2db60b8749bfbf3d951a92d32380989edf..0880859a59d6cd2c91ab4e339b4039bb71322227 100644 --- a/openair2/RRC/LITE/rrc_rrm_interface.h +++ b/openair2/RRC/LITE/rrc_rrm_interface.h @@ -101,8 +101,6 @@ extern "C" { #define START_MSG_PUSU 0xCC -#ifdef USER_MODE - #include <sys/socket.h> #include <sys/un.h> @@ -128,16 +126,6 @@ char *recv_msg( sock_rrm_t *s ) ; } #endif -#else //USER_MODE -#include <rtai_fifos.h> - -#define RRC2RRM_FIFO 14 -#define RRM2RRC_FIFO 15 -int send_msg_fifo(int *s ,msg_t *msg ) ; -#endif //USER_MODE - int send_msg(void *, msg_t *); - - #endif diff --git a/openair2/RRC/LITE/rrm_2_rrc_msg.c b/openair2/RRC/LITE/rrm_2_rrc_msg.c index 3ef0bc2e0a7ecec6ce4692bbbfa52d08094d774f..3ed3a9d8594a3f4fbc6f583b0a08d7531cda551d 100644 --- a/openair2/RRC/LITE/rrm_2_rrc_msg.c +++ b/openair2/RRC/LITE/rrm_2_rrc_msg.c @@ -65,17 +65,12 @@ void fn_rrc (void) /******************************************************************************/ msg_head_t *Header ; -#ifdef USER_MODE char *Data; -#else - int bytes_read; -#endif L2_ID Mac_id; while(1) { -#ifdef USER_MODE Header = (msg_head_t *) recv_msg(&S_rrc) ; if(Header==NULL) { @@ -83,52 +78,9 @@ void fn_rrc (void) } Data_to_read=Header->size; -#else - - if(Header_read_idx < Header_size) { - bytes_read = rtf_get (RRM2RRC_FIFO,&Header_buf[Header_read_idx],Header_size-Header_read_idx); - - if(bytes_read >0) { - msg("RRC: GET FIFOS RETURNS %d bytes, header %d\n",bytes_read,Header_read_idx); - } - - Header_read_idx+=bytes_read; - - if(Header_read_idx == Header_size) { - Header = (msg_head_t *) Header_buf; - Data_to_read=Header->size; - msg("RRC: Header read completed, data size %d\n",Data_to_read); - } - //msg("[fn_rrc]TTI %d: rcv_msg return Null\n",Rrc_xface->Frame_index); - else { - break; - } - } - -#endif if (Data_to_read > 0 ) { -#ifdef USER_MODE Data = (char *) (Header +1) ; -#else - bytes_read = rtf_get (RRM2RRC_FIFO,&Data[Data_read_idx],Data_to_read); - - if(bytes_read >0) { - msg("RRC: GET FIFOS RETURNS %d bytes, Data_to_read %d\n",bytes_read,Data_to_read); - } - - Data_to_read-=bytes_read; - Data_read_idx+=bytes_read; - - if(Data_to_read > 0 ) { - break; - } - - msg("RRC: DATA read completed, data size %d\n",Data_to_read); - Header_read_idx=0; - Data_read_idx=0; - Data_to_read=0; -#endif } msg("Got MSG of Type %d on Inst %d\n",Header->msg_type,Header->inst); diff --git a/openair2/RRC/LITE/utils.c b/openair2/RRC/LITE/utils.c index fd37fdf65cfb0e9985022aeeaba4ed0c1f9c4518..bbf97046bf5a0baba7f8b1eda2f866076610863f 100644 --- a/openair2/RRC/LITE/utils.c +++ b/openair2/RRC/LITE/utils.c @@ -29,25 +29,8 @@ ________________________________________________________________*/ -//#include "openair_types.h" #include "defs.h" #include "extern.h" -//#include "openair_proto.h" - - -#ifndef USER_MODE -char bcmp(void *x, void *y,int Size ) -{ - unsigned char i; - - for(i=0; i<Size; i++) - if(*(char*)(x+i)!= *(char*)(y+i)) { - return 1; - } - - return 0; -} -#endif //------------------------------------------------------------------------------------------------------------------// @@ -63,7 +46,6 @@ uint16_t find_free_dtch_position(uint8_t Mod_id, uint16_t UE_CH_index) for(i=j; i<NB_RAB_MAX; i++) { //first RAB IS BROADCAST DTCH - //msg("i=%d\n",i); if(CH_rrc_inst[Mod_id].Rab[i][UE_CH_index].Active==0) { return( i); } @@ -130,11 +112,7 @@ uint8_t find_rrc_info_index(uint8_t Mod_id,uint8_t CH_id) if(Rrc_inst[Mod_id].Rrc_info[i].Info.UE_info.CH_id == CH_id) return i; } error_msg("[OPENAIR][RRC] RRC_INFO_INDEX: FATAL ERROR: Not yet Pre_Synchronized with CH ???%d\n",CH_id); - #ifndef USER_MODE - // mac_xface->macphy_exit(); - #else exit(-1); - #endif */ } /* diff --git a/openair2/UTIL/LISTS/list2.c b/openair2/UTIL/LISTS/list2.c index 875f5e2d2fcbf4a69c6876e11efc521d89845940..3f0a59df53be4ca3548207f22a2c015bb772f4bb 100644 --- a/openair2/UTIL/LISTS/list2.c +++ b/openair2/UTIL/LISTS/list2.c @@ -38,11 +38,7 @@ ***************************************************************************/ #define LIST2_C #include "list.h" -#ifdef USER_MODE #include "assertions.h" -#else -#define NULL 0 -#endif #include <string.h> @@ -336,9 +332,7 @@ list2_display (list2_t * listP) nb_elements++; } msg (" found nb_elements %d nb_elements %d\n", nb_elements, listP->nb_elements); - #ifdef USER_MODE AssertFatal(nb_elements == listP->nb_elements, "Bad count of elements %d != %d", nb_elements, listP->nb_elements); - #endif } }*/ } diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 08672022d408b51f09486cbbafc3729840009b4d..948425e8daa27b45643b2bca6587953ea9b0beab 100644 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -42,17 +42,8 @@ # include "intertask_interface.h" #endif -#ifdef USER_MODE # include <pthread.h> # include <string.h> -#endif -#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; @@ -92,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 */ @@ -164,24 +153,12 @@ void log_getconfig(log_t *g_log) { int logInit (void) { -#ifdef USER_MODE -#ifndef RTAI int i; -#endif g_log = calloc(1, sizeof(log_t)); -#else - g_log = kmalloc(sizeof(log_t), GFP_KERNEL); -#endif - if (g_log == NULL) { -#ifdef USER_MODE perror ("cannot allocated memory for log generation module \n"); exit(EXIT_FAILURE); -#else - printk("cannot allocated memory for log generation module \n"); - return(-1); -#endif } @@ -485,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; @@ -513,17 +489,7 @@ int logInit (void) } } -#else - g_log->syslog = 0; - g_log->filelog = 0; - rtf_create (FIFO_PRINTF_NO, FIFO_PRINTF_SIZE); -#endif - -#ifdef USER_MODE printf("log init done\n"); -#else - printk("log init done\n"); -#endif return 0; } @@ -982,23 +948,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); } @@ -1015,8 +967,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); } @@ -1166,20 +1116,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); @@ -1197,15 +1134,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) { @@ -1464,20 +1392,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); @@ -1495,15 +1410,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) { @@ -1730,16 +1636,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 } } @@ -1795,9 +1696,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) { @@ -1813,9 +1711,6 @@ void logClean (void) close(g_log->log_component[i].fd); } } - -#endif - } #if defined(ENABLE_ITTI) diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 1d795740b673839bc46fc97960dd73c1e284e7b1..c21407f6eb51854c2eb7bb0ab432dffd9ab057f2 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -32,7 +32,6 @@ # define __LOG_H__ /*--- INCLUDES ---------------------------------------------------------------*/ -#ifdef USER_MODE #include <unistd.h> #include <stdio.h> #include <stdlib.h> @@ -53,9 +52,6 @@ #define _GNU_SOURCE #endif #include <pthread.h> -#else -#include "rtai_fifos.h" -#endif /*----------------------------------------------------------------------------*/ @@ -282,20 +278,11 @@ void *log_thread_function(void * list); * @ingroup _macro * @brief Macro used to call tr_log_full_ex with file, function and line information * @{*/ -#ifdef USER_MODE -//#define logIt(component, level, format, args...) do {logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args);} while(0); #ifdef LOG_NO_THREAD #define logIt(component, level, format, args...) logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args) #else //default #define logIt(component, level, format, args...) logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args) #endif -#else -#ifdef LOG_NO_THREAD -#define logIt(component, level, format, args...) logRecord_mt(NULL, __FUNCTION__, __LINE__, component, level, format, ##args) -#else // default -#define logIt(component, level, format, args...) logRecord(NULL, __FUNCTION__, __LINE__, component, level, format, ##args) -#endif -#endif /* @}*/ /*----------------macro definitions for reading log configuration from the config module */ @@ -326,7 +313,6 @@ void *log_thread_function(void * list); * @{*/ // debugging macros -#ifdef USER_MODE # if T_TRACER # include "T.h" # define LOG_I(c, x...) T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) @@ -364,17 +350,6 @@ void *log_thread_function(void * list); # define LOG_T(c, x...) logIt(c, LOG_TRACE, x) # endif /*DISABLE_LOG_X*/ # endif /* T_TRACER */ -#else /* USER_MODE */ -# define LOG_G(c, x...) printk(x) -# define LOG_A(c, x...) printk(x) -# define LOG_C(c, x...) printk(x) -# define LOG_E(c, x...) printk(x) -# define LOG_W(c, x...) printk(x) -# define LOG_N(c, x...) printk(x) -# define LOG_I(c, x...) printk(x) -# define LOG_D(c, x...) printk(x) -# define LOG_T(c, x...) printk(x) -#endif /* @}*/ diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 08d4e61497618543ff0e6d1fbf680b3f3f4f43da..b18d2a25ffd714c778e16a96a971db1e081694d9 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 @@ -423,8 +419,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 @@ -620,8 +614,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(); @@ -674,9 +666,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 } } @@ -690,8 +679,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/random.c b/openair2/UTIL/MATH/random.c index 06caa3bc3ce6fc9e93c60a80a30a23e4625c0daa..30a6e9b1abba957f3257b924c67bb789bbe8c35a 100644 --- a/openair2/UTIL/MATH/random.c +++ b/openair2/UTIL/MATH/random.c @@ -29,11 +29,7 @@ #include "rtos_header.h" #include "platform_types.h" -#ifdef USER_MODE -# include <sys/time.h> -#else -#include <rtai_sched.h> -#endif +#include <sys/time.h> /* Random generators */ @@ -47,7 +43,6 @@ static int seed; void init_uniform (void) { -#ifdef USER_MODE struct timeval tv; struct timezone tz; @@ -61,9 +56,6 @@ init_uniform (void) #warning TO DO seed = rgId //seed += rgId; #endif -#else - seed = rt_get_time_ns(); -#endif } diff --git a/openair2/UTIL/MATH/taus.c b/openair2/UTIL/MATH/taus.c index 6e0fd84e66c16e39b71b1ce11a272ca4a0c3fc5a..632b1544dd0970b484fbe0a2ef4d585cae550604 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/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c index 09f10547cb05df8334658b4cfb37a8291f618841..9c3a50467a785f4f218d3f2eef034e327d5dde78 100644 --- a/openair2/UTIL/MEM/mem_block.c +++ b/openair2/UTIL/MEM/mem_block.c @@ -54,7 +54,7 @@ static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER; //#define DEBUG_MEM_MNGT_ALLOC_SIZE //#define DEBUG_MEM_MNGT_ALLOC //----------------------------------------------------------------------------- -#if defined(USER_MODE) && defined(DEBUG_MEM_MNGT_ALLOC) +#if defined(DEBUG_MEM_MNGT_ALLOC) uint32_t counters[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; #endif //----------------------------------------------------------------------------- @@ -269,10 +269,8 @@ get_free_mem_block (uint32_t sizeP, const char* caller) #ifdef DEBUG_MEM_MNGT_ALLOC LOG_E (RLC,"[MEM_MNGT][ERROR][MINOR] memory pool %d is empty trying next pool alloc count = %d\n", pool_selected, counters[pool_selected]); -#ifdef USER_MODE // display_mem_load (); // check_mem_area ((void *)&mem_block_var); -#endif #endif } while (pool_selected++ < 12); diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h index b7e36bf5b374fc73f6f88d5207c0f6dcabc441f3..e9673802698fac9094f450c0e858e341a67ab197 100644 --- a/openair2/UTIL/MEM/mem_block.h +++ b/openair2/UTIL/MEM/mem_block.h @@ -31,9 +31,7 @@ #ifndef __MEM_BLOCK_H__ # define __MEM_BLOCK_H__ -#ifdef USER_MODE #include <stdint.h> -#endif #ifdef MEM_BLOCK_C # define public_mem_block(x) x # define private_mem_block(x) x @@ -63,19 +61,8 @@ public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * d public_mem_block(void display_mem_load (void);) public_mem_block(void check_mem_area (void);) -# ifdef USER_MODE private_mem_block(void check_free_mem_block (mem_block_t * leP);) -# endif -#ifdef USER_MODE -//# define MEM_SCALE MAX_MOBILES_PER_ENB*NB_RB_MAX # define MEM_SCALE MAX_MOBILES_PER_ENB -#else -# ifdef NODE_RG -# define MEM_SCALE 2 -# else -# define MEM_SCALE 1 -# endif -#endif // definition of the size of the allocated memory area # define MEM_MNGT_MB0_BLOCK_SIZE 64 // 64 diff --git a/openair2/UTIL/MEM/mem_mngt.c b/openair2/UTIL/MEM/mem_mngt.c index 49cd310ac907fda38c1213ee411661f6ea0c1df2..57c90ea4f909268f0c6aadcbacb7305e51f5bf4f 100644 --- a/openair2/UTIL/MEM/mem_mngt.c +++ b/openair2/UTIL/MEM/mem_mngt.c @@ -49,9 +49,7 @@ // #endif //----------------------------------------------------------------------------- -#ifdef USER_MODE uint32_t counters[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#endif //----------------------------------------------------------------------------- /* * initialize all ures @@ -227,10 +225,8 @@ get_free_mem_block (uint16_t sizeP, __func__) #ifdef DEBUG_MEM_MNGT_ALLOC msg ("[MEM_MNGT][ERROR][MINOR] memory pool %d is empty trying next pool alloc count = %d\n", pool_selected, counters[pool_selected]); -# ifdef USER_MODE display_mem_load (); check_mem_area (mem); -# endif #endif } while (pool_selected++ < 9); diff --git a/openair2/UTIL/OCG/makefile b/openair2/UTIL/OCG/makefile index 1e531f94941f71b8e680f5671012dc0b4ded936b..1ef4ec98dca850bf5ad3c5ab91f92a27f62d465b 100644 --- a/openair2/UTIL/OCG/makefile +++ b/openair2/UTIL/OCG/makefile @@ -7,7 +7,7 @@ OPENAIR2_TOP = ../../../openair2 OPENAIR3_TOP = ../../../openair3 OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat +CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat CFLAGS += -m32 -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE @@ -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 319b8296cd6f39e7ae019cd5818c71d86b6ba533..80ab8c6394f701b75416d15b9d42ce35c0277115 100644 --- a/openair2/UTIL/OMG/makefile +++ b/openair2/UTIL/OMG/makefile @@ -60,7 +60,7 @@ OPENAIR2_TOP = ../../../openair2 OPENAIR3_TOP = ../../../openair3 OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat +CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE @@ -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 acc89254fb12228c799e3acf36f2d80ef3a6ef96..7bc551cb03c968ea5f174446e8f802c943e07b22 100644 --- a/openair2/UTIL/OMG/makefile_old +++ b/openair2/UTIL/OMG/makefile_old @@ -62,7 +62,7 @@ OPENAIR2_TOP = ../../../openair2 OPENAIR3_TOP = ../../../openair3 OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat +CFLAGS += -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 #-Wno-packed-bitfield-compat CFLAGS += -DOPENAIR_LTE -DOPENAIR2 #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE @@ -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/OMG/makefile_standalone b/openair2/UTIL/OMG/makefile_standalone index 68170543eedc73012c487ae70a3a9912485c9507..d612c018370da3fb0bf5cf9a9ac4168c8236fa49 100644 --- a/openair2/UTIL/OMG/makefile_standalone +++ b/openair2/UTIL/OMG/makefile_standalone @@ -8,7 +8,7 @@ OBJsumo = omg.c common.c sumo.c client_traci_OMG.c socket_traci_OMG.c storage_tr OBJ = omg.c common.c static.c job.c rwp.c rwalk.c trace.c steadystaterwp.c sumo.c grid.c mobility_parser.c hashtable.c client_traci_OMG.c socket_traci_OMG.c storage_traci_OMG.c id_manager.c -CFLAGS += -DSTANDALONE -DUSER_MODE -g +CFLAGS += -DSTANDALONE -g .PHONY: help staticOMG rwpOMG clean diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index 711436d2cd1ca9d703ce01e6fb4008f61720a1ab..ebc52bb1e04450d356de56054b01508a99aee915 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/UTIL/TRACE/print.h b/openair2/UTIL/TRACE/print.h index 5982d249fa8497c43c9a2af82fdebf3a50ea63cd..72c43f20d473d51b20a842aa38ec3b3a80d2ae2b 100644 --- a/openair2/UTIL/TRACE/print.h +++ b/openair2/UTIL/TRACE/print.h @@ -28,14 +28,5 @@ ***************************************************************************/ #ifndef __PRINT_H__ # define __PRINT_H__ -# ifdef USER_MODE -# define msg printf -# else -# ifdef FIFO_PRINTF -# include "fifo_printf_proto_extern.h" -# define msg fifo_printf -# else -# define msg fifo_printf_null -# endif -# endif +# define msg printf #endif diff --git a/openair2/X2AP/Makefile.inc b/openair2/X2AP/Makefile.inc index 7369cf8dfa1b92421099fade99949ca65d10bd4c..a301a9934e924736868412284605a76a4946b668 100755 --- a/openair2/X2AP/Makefile.inc +++ b/openair2/X2AP/Makefile.inc @@ -28,7 +28,6 @@ CFLAGS = \ -Wall \ -DENB_MODE \ -DENABLE_USE_MME \ - -DUSER_MODE \ -I. \ -I$(ASN1MESSAGESDIR)/ASN1/$(ASN1RELDIR) \ -I$(ASN1MESSAGESDIR) \ diff --git a/openair2/X2AP/x2ap.h b/openair2/X2AP/x2ap.h index 65529c7119c186d2d6ec802473b64e57999ca5ab..89e8540b97c75c3563cca8cbd899f4bf71db1701 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/COMMON/nas_messages_def.h b/openair3/COMMON/nas_messages_def.h index 5214a1517153f81023403ad37fd0c3ca970e96e7..9bdcde4fdf06293338e7ef8659776b2a0fffaec1 100644 --- a/openair3/COMMON/nas_messages_def.h +++ b/openair3/COMMON/nas_messages_def.h @@ -61,9 +61,3 @@ MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL, MESSAGE_PRIORITY_MED, nas_pdn_ MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp) MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail) -#if defined(DISABLE_USE_NAS) -MESSAGE_DEF(NAS_ATTACH_REQ, MESSAGE_PRIORITY_MED, nas_attach_req_t, nas_attach_req) -MESSAGE_DEF(NAS_ATTACH_ACCEPT, MESSAGE_PRIORITY_MED, nas_attach_accept_t, nas_attach_accept) -MESSAGE_DEF(NAS_AUTHENTICATION_RESP, MESSAGE_PRIORITY_MED, nas_auth_resp_t, nas_auth_resp) -MESSAGE_DEF(NAS_AUTHENTICATION_REQ, MESSAGE_PRIORITY_MED, nas_auth_req_t, nas_auth_req) -#endif diff --git a/openair3/COMMON/nas_messages_types.h b/openair3/COMMON/nas_messages_types.h index 45de68840e804f63ec73b4767099d5e9a2a37833..81a44fa4f4c42fe476822ca3d1f879f5468c4f6c 100644 --- a/openair3/COMMON/nas_messages_types.h +++ b/openair3/COMMON/nas_messages_types.h @@ -233,17 +233,7 @@ typedef struct nas_conn_est_ind_s { typedef nas_establish_rsp_t nas_conn_est_rej_t; -#if defined(DISABLE_USE_NAS) -typedef struct nas_conn_est_cnf_s { - uint32_t ue_id; - - nas_establish_cnf_t nas_establish_cnf; - /* Transparent message from MME_APP to S1AP */ - s1ap_initial_ctxt_setup_req_t transparent; -} nas_conn_est_cnf_t; -#else typedef nas_establish_cnf_t nas_conn_est_cnf_t; -#endif typedef struct nas_conn_rel_ind_s { @@ -336,10 +326,4 @@ typedef struct nas_auth_param_fail_s { } nas_auth_param_fail_t; -#if defined(DISABLE_USE_NAS) -typedef struct nas_attach_accept_s { - s1ap_initial_ctxt_setup_req_t transparent; -} nas_attach_accept_t; -#endif - #endif /* NAS_MESSAGES_TYPES_H_ */ diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index aba32aa494cf41049669a2a096892fc5470296e1..301df6e81600fdff0e6f3ffae37e69e2d8d13019 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 85bf00a4faaa9a3b11139fb2e38f2aab7d5aa3a9..e122703d82f2dbda6d5cf42b1bcbf08446a270a4 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/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile index c9c5f82819e1bce3acef7db958e2a19b37bca99a..77b3d41f25fb2f39d20e77cb94723ce7021a7805 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile +++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/Makefile @@ -1,5 +1,5 @@ CC = gcc -CFLAGS = -DUSER_MODE -DEXMIMO -g +CFLAGS = -DEXMIMO -g XTRA_CFLAGS = -msse -msse2 -mssse3 -fPIC #ifndef OPENAIR0_DIR diff --git a/targets/Makefile b/targets/Makefile deleted file mode 100644 index b604898d2aef8230ad3a23c4d669a6a9303079eb..0000000000000000000000000000000000000000 --- 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/Makefile.common b/targets/Makefile.common index 042a36bf4562946b77087d306e123838fd28c714..ac0771770ba8c4737370a8f7670a71be2dc1b01e 100644 --- a/targets/Makefile.common +++ b/targets/Makefile.common @@ -86,7 +86,6 @@ endif ifeq ($(ENABLE_ITTI),1) COMMON_CFLAGS += -DENABLE_ITTI -COMMON_CFLAGS += -DUSER_MODE COMMON_CFLAGS += -I$(OPENAIR1_DIR) COMMON_CFLAGS += -I$(OPENAIR2_DIR)/NAS COMMON_CFLAGS += $(L2_incl) diff --git a/targets/PROJECTS/E-MBMS/build_all.bash b/targets/PROJECTS/E-MBMS/build_all.bash index 0cbece916eae4351990afb2dbc8e40468586cc16..bac9b33736853980953114bfb326de1d72a79131 100755 --- a/targets/PROJECTS/E-MBMS/build_all.bash +++ b/targets/PROJECTS/E-MBMS/build_all.bash @@ -61,8 +61,8 @@ echo_success "\n###############################" echo_success "# COMPILE oaisim" echo_success "###############################" cd $OPENAIR_TARGETS/SIMU/USER -echo_success "Executing: make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo `" -make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo ` +echo_success "Executing: make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo `" +make oaisim NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 Rel10=1 -j`grep -c ^processor /proc/cpuinfo ` if [[ $? -eq 2 ]] ; then exit 1 fi diff --git a/targets/RT/Makefile b/targets/RT/Makefile deleted file mode 100644 index 1be49d2db80ce4595fd0263eebb15f35c2aa2163..0000000000000000000000000000000000000000 --- 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 8c413d4e2e254048621c62d66f5d05634dcca154..0000000000000000000000000000000000000000 --- 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 -DUSER_MODE -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 061c15a31cc4067ed7897916429781b6da6a19f6..0000000000000000000000000000000000000000 --- 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 -DUSER_MODE -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 -DUSER_MODE - 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 bc7840c1e574c63a7fb8344e9dea882db9883a4c..0000000000000000000000000000000000000000 --- 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/UE_transport_IQ.c b/targets/RT/USER/UE_transport_IQ.c deleted file mode 100644 index 16f491263d6ea604955cb63651f04bb76c518c39..0000000000000000000000000000000000000000 --- a/targets/RT/USER/UE_transport_IQ.c +++ /dev/null @@ -1,548 +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 UE_transport_IQ.c - * \brief UE transport IQ sampels - * \author Katerina Trilyraki, Navid Nikaein, Raymond Knopp - * \date 2015 - * \version 0.1 - * \company Eurecom - * \maintainer: navid.nikaein@eurecom.fr - * \note - * \warning very experimental - */ - -#include <unistd.h> -#include <time.h> -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> - -#include "common_lib.h" -#include "PHY/defs.h" -#include "rrh_gw.h" -#include "rrh_gw_externs.h" - -#define START_CMD 1 -#define RRH_UE_PORT 51000 -#define RRH_UE_DEST_IP "127.0.0.1" -#define PRINTF_PERIOD 3750 - -/****************************************************************************** - ** FUNCTION PROTOTYPES ** - ******************************************************************************/ -void *rrh_proc_UE_thread(void *); -void *rrh_UE_thread(void *); -void *rrh_UE_rx_thread(void *); -void *rrh_UE_tx_thread(void *); - - - -openair0_timestamp timestamp_UE_tx[4]= {0,0,0,0},timestamp_UE_rx[4]= {0,0,0,0}; -openair0_timestamp nrt_UE_counter[4]= {0,0,0,0}; - -pthread_t main_rrh_UE_thread,main_rrh_proc_UE_thread; -pthread_attr_t attr, attr_proc; -struct sched_param sched_param_rrh, sched_param_rrh_proc; -pthread_cond_t sync_UE_cond[4]; -pthread_mutex_t sync_UE_mutex[4]; - -int32_t overflow_rx_buffer_UE[4]= {0,0,0,0}; -int32_t nsamps_UE[4]= {0,0,0,0}; -int32_t UE_tx_started=0,UE_rx_started=0; -int32_t RT_flag_UE=0, NRT_flag_UE=1; -int32_t counter_UE_rx[4]= {0,0,0,0}; -int32_t counter_UE_tx[4]= {0,0,0,0}; -int32_t **tx_buffer_UE, **rx_buffer_UE; - -int sync_UE_rx[4]= {-1,-1,-1,-1}; -void *rrh_UE_thread_status; - - -void *rx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_rx -void *tx_ue[2]; // FIXME hard coded array size; indexed by lte_frame_parms.nb_antennas_tx - - -void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag) { - - int i; - int error_code_UE, error_code_proc_UE; - - RT_flag_UE=RT_flag; - NRT_flag_UE=NRT_flag; - - pthread_attr_init(&attr); - sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_init(&attr_proc); - sched_param_rrh_proc.sched_priority = sched_get_priority_max(SCHED_FIFO-1); - - pthread_attr_setschedparam(&attr,&sched_param_rrh); - pthread_attr_setschedpolicy(&attr,SCHED_FIFO); - pthread_attr_setschedparam(&attr_proc,&sched_param_rrh_proc); - pthread_attr_setschedpolicy(&attr_proc,SCHED_FIFO-1); - - - for (i=0; i<4; i++) { - pthread_mutex_init(&sync_UE_mutex[i],NULL); - pthread_cond_init(&sync_UE_cond[i],NULL); - } - - error_code_UE = pthread_create(&main_rrh_UE_thread, &attr, rrh_UE_thread, (void *)dev_ue); - error_code_proc_UE = pthread_create(&main_rrh_proc_UE_thread, &attr_proc, rrh_proc_UE_thread, (void *)dev_ue); - - if (error_code_UE) { - printf("Error while creating UE thread\n"); - exit(-1); - } - - if (error_code_proc_UE) { - printf("Error while creating UE proc thread\n"); - exit(-1); - } - -} - - -/*! \fn void *rrh_proc_UE_thread((void *)dev_ue) -* \brief this function -* \param[in] -* \param[out] -* \return -* \note -* @ingroup _oai -*/ -void *rrh_proc_UE_thread(void * arg) { - - int antenna_index,i; - openair0_timestamp truncated_timestamp, truncated_timestamp_final, last_hw_counter=0; - struct timespec time_req, time_rem; - int16_t *txp,*rxp; - unsigned int samples_per_frame=0; - rrh_module_t *dev=(rrh_module_t *)arg; - - samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame; - AssertFatal(samples_per_frame <=0, "invalide samples_per_frame !%u\n",samples_per_frame); - - time_req.tv_sec = 0; - time_req.tv_nsec = 1000; - - while (rrh_exit==0) { - //wait until some data has been copied - for (antenna_index=0; antenna_index<4; antenna_index++) { - if (sync_UE_rx[antenna_index]==0) { - if (!UE_tx_started) { - UE_tx_started=1; //Set this flag to 1 to indicate that a UE started retrieving data - if (RT_flag_UE==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_flag_UE==1) { - if (hw_counter > last_hw_counter+1) { - printf("L1"); - // goto end_copy_UE; - } else { - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req,&time_rem); - } - } - } - - truncated_timestamp = timestamp_UE_tx[antenna_index]%(samples_per_frame); - truncated_timestamp_final = (timestamp_UE_tx[antenna_index]+nsamps_UE[antenna_index])%samples_per_frame; - - if ((truncated_timestamp + nsamps_UE[antenna_index]) > samples_per_frame) { - if ((timestamp_eNB_rx[antenna_index]%samples_per_frame < nsamps_UE[antenna_index]) && (eNB_rx_started==1)) { - overflow_rx_buffer_eNB[antenna_index]++; - printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp); - - if (NRT_flag_UE==1) { - while ((timestamp_eNB_rx[antenna_index]%samples_per_frame) < nsamps_UE[antenna_index]) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp]; - - for (i=0; i<(samples_per_frame<<1)-(truncated_timestamp<<1); i++) { - rxp[i] = txp[i]>>6; - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][0]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][0]; - - for (i=0; i<nsamps_eNB[antenna_index]-(samples_per_frame)+(truncated_timestamp); i++) { - rxp[i] = txp[i]>>6; - } - - } else { - if (((truncated_timestamp < (timestamp_eNB_rx[antenna_index]%samples_per_frame)) && - (truncated_timestamp_final > (timestamp_eNB_rx[antenna_index]%samples_per_frame))) && - (eNB_rx_started==1)) { - overflow_rx_buffer_eNB[antenna_index]++; - printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp); - - if (NRT_flag_UE==1) { - while (truncated_timestamp_final > timestamp_eNB_rx[antenna_index]%samples_per_frame) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp]; - - for (i=0; i<(nsamps_eNB[antenna_index]); i++) { - rxp[i] =txp[i]>>6; - } - - } - //end_copy_UE : - last_hw_counter=hw_counter; - pthread_mutex_lock(&sync_UE_mutex[antenna_index]); - sync_UE_rx[antenna_index]--; - pthread_mutex_unlock(&sync_UE_mutex[antenna_index]); - - } - } - - } - - return(0); -} - -/*! \fn void *rrh_UE_thread(void *arg) -* \brief this function -* \param[in] -* \param[out] -* \return -* \note -* @ingroup _oai -*/ -void *rrh_UE_thread(void *arg) { - - rrh_module_t *dev=(rrh_module_t *)arg; - - struct sched_param sched_param_UE_rx, sched_param_UE_tx; - int16_t i,cmd; //,nsamps,antenna_index; - //struct timespec time_req_1us; - pthread_t UE_rx_thread, UE_tx_thread; - pthread_attr_t attr_UE_rx, attr_UE_tx; - int error_code_UE_rx, error_code_UE_tx; - void *tmp; - unsigned int samples_per_frame=0; - - samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame; - //time_req_1us.tv_sec = 0; - //time_req_1us.tv_nsec = 1000; - - while (rrh_exit==0) { - - cmd=dev->eth_dev.trx_start_func(&dev->eth_dev); - - /* allocate memory for TX/RX buffers */ - rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*)); - tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*)); - - for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) { - tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4)); - memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4)); - rx_buffer_UE[i]=(tmp+4*sizeof(int32_t)); - } - - for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) { - tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4)); - memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4)); - tx_buffer_UE[i]=(tmp+4*sizeof(int32_t)); - } - - printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" , dev->eth_dev.openair0_cfg->remote_addr, - dev->eth_dev.openair0_cfg->remote_port, - dev->eth_dev.openair0_cfg->num_rb_dl, - dev->eth_dev.openair0_cfg->rx_num_channels, - dev->eth_dev.openair0_cfg->tx_num_channels); - - if (cmd==START_CMD) { - - pthread_attr_init(&attr_UE_rx); - pthread_attr_init(&attr_UE_tx); - sched_param_UE_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); - sched_param_UE_tx.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_setschedparam(&attr_UE_rx,&sched_param_UE_rx); - pthread_attr_setschedparam(&attr_UE_tx,&sched_param_UE_tx); - pthread_attr_setschedpolicy(&attr_UE_rx,SCHED_FIFO); - pthread_attr_setschedpolicy(&attr_UE_tx,SCHED_FIFO); - - error_code_UE_rx = pthread_create(&UE_rx_thread, &attr_UE_rx, rrh_UE_rx_thread, (void *)&dev); - error_code_UE_tx = pthread_create(&UE_tx_thread, &attr_UE_tx, rrh_UE_tx_thread, (void *)&dev); - - if (error_code_UE_rx) { - printf("Error while creating UE RX thread\n"); - exit(-1); - } - - if (error_code_UE_tx) { - printf("Error while creating UE TX thread\n"); - exit(-1); - } - - while (rrh_exit==0) - sleep(1); - } - } - - - rrh_UE_thread_status = 0; - pthread_exit(&rrh_UE_thread_status); - - return(0); -} - - -/*! \fn void *rrh_UE_rx_thread(void *arg) -* \brief this function -* \param[in] -* \param[out] -* \return -* \note -* @ingroup _oai -*/ -void *rrh_UE_rx_thread(void *arg) { - - rrh_module_t *dev = (rrh_module_t *)arg; - struct timespec time0,time1,time2; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_sent; - int antenna_index, nsamps; - int trace_cnt=0; - unsigned long long max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0; - unsigned int samples_per_frame=0; - openair0_timestamp last_hw_counter=0; - - antenna_index = 0; - nsamps = dev->eth_dev.openair0_cfg->samples_per_packet; - samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame; - - /* TODO: check if setting time0 has to be done here */ - clock_gettime(CLOCK_MONOTONIC,&time0); - - while (rrh_exit == 0) { - if (!UE_rx_started) { - UE_rx_started=1; //Set this flag to 1 to indicate that a UE started retrieving data - - if (RT_flag_UE==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_flag_UE==1) { - if (hw_counter > last_hw_counter+1) { - printf("L1"); - //goto end_copy_UE; - } else { - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - } - - clock_gettime(CLOCK_MONOTONIC,&time1); - - // send return - - if ((timestamp_UE_rx[antenna_index]%(samples_per_frame)+nsamps) > samples_per_frame) { // Wrap around if nsamps exceeds the buffer limit - if (((timestamp_eNB_tx[antenna_index]%(samples_per_frame)) < ((timestamp_UE_rx[antenna_index]+nsamps)%(samples_per_frame))) && (eNB_tx_started==1)) { - printf("UE underflow wraparound timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n", - (int)(timestamp_UE_rx[antenna_index]%(samples_per_frame)), - (int)(timestamp_eNB_tx[antenna_index]%samples_per_frame)); - - if (NRT_flag_UE==1) { - while ((timestamp_eNB_tx[antenna_index]%samples_per_frame) < ((timestamp_UE_rx[antenna_index]+nsamps)%(samples_per_frame))) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - - rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(samples_per_frame)]; - if ((bytes_sent =dev->eth_dev.trx_write_func (dev, - timestamp_UE_rx[antenna_index], - rx_ue, - ( samples_per_frame- (timestamp_eNB_rx[antenna_index]%(samples_per_frame)) ), - antenna_index, - 0))<0) - perror("RRH UE : sendto for RX"); - - rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][3]; - if ((bytes_sent =dev->eth_dev.trx_write_func (dev, - timestamp_UE_rx[antenna_index], - rx_ue, - (nsamps - samples_per_frame + (timestamp_eNB_rx[antenna_index]%(samples_per_frame))), - antenna_index, - 0))<0) - perror("RRH UE : sendto for RX"); - - } else { - if (((timestamp_UE_rx[antenna_index]%samples_per_frame)< timestamp_eNB_tx[antenna_index]%samples_per_frame) && - (((timestamp_UE_rx[antenna_index]+nsamps)%samples_per_frame) > (timestamp_eNB_tx[antenna_index]%samples_per_frame)) && - (eNB_tx_started==1) ) { - printf("UE underflow timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n", - (int)(timestamp_UE_rx[antenna_index]%samples_per_frame), - (int)(timestamp_eNB_tx[antenna_index]%samples_per_frame)); - - if (NRT_flag_UE==1) { - while (((timestamp_UE_rx[antenna_index]+nsamps)%samples_per_frame) > (timestamp_eNB_tx[antenna_index]%samples_per_frame)) { - nanosleep(&time_req_1us,&time_rem_1us); - } - } - } - - rx_ue[antenna_index]=(void*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(samples_per_frame)]; - if ((bytes_sent = dev->eth_dev.trx_write_func (dev, - timestamp_UE_rx[antenna_index], - rx_ue, - nsamps, - antenna_index, - 0))<0) - perror("RRH UE thread: sendto for RX"); - } - - timestamp_UE_rx[antenna_index]+=nsamps; - last_hw_counter=hw_counter; - - clock_gettime(CLOCK_MONOTONIC,&time2); - - if (trace_cnt++ > 10) { - total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec); - - if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time; - - if ((total_rx_time > 0) && (total_rx_time < 1000000000)) { - trial++; - - if (total_rx_time < min_rx_time) - min_rx_time = total_rx_time; - - if (total_rx_time > max_rx_time) - max_rx_time = total_rx_time; - - average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1); - } - - if (s_period++ == PRINTF_PERIOD) { - s_period=0; - printf("Average UE RX time : %llu\tMax RX time : %llu\tMin RX time : %llu\n",average_rx_time,max_rx_time,min_rx_time); - - } - - //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec), - // (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec)); - - } - - memcpy(&time0,&time2,sizeof(struct timespec)); - - } //while (UE_exit==0) - - return(0); - -} - - -/*! \fn void *rrh_UE_tx_thread(void *arg) -* \brief this function -* \param[in] -* \param[out] -* \return -* \note -* @ingroup _oai -*/ -void *rrh_UE_tx_thread(void *arg) { - - struct timespec time0a,time0,time1,time2; - struct timespec time_req_1us, time_rem_1us; - - - rrh_module_t *dev = (rrh_module_t *)arg; - ssize_t bytes_received; - int antenna_index, nsamps; - unsigned int samples_per_frame=0; - - antenna_index = 0; - nsamps = dev->eth_dev.openair0_cfg->samples_per_packet; - samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame; - - - while (rrh_exit == 0) { - - clock_gettime(CLOCK_MONOTONIC,&time0a); - - bytes_received = dev->eth_dev.trx_read_func(dev, - ×tamp_UE_tx[antenna_index], - tx_ue, - nsamps, - antenna_index); - - clock_gettime(CLOCK_MONOTONIC,&time1); - - if (NRT_flag_UE==1) { - nrt_UE_counter[antenna_index]++; - } - printf(" first part size: %d second part size: %"PRId64" idx=%"PRId64"\n", - (int32_t)(((samples_per_frame)<<2)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2)), - (nsamps<<2)-((samples_per_frame)<<2)+((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2), - timestamp_UE_tx[antenna_index]%(samples_per_frame)); - if ((timestamp_UE_tx[antenna_index]%(samples_per_frame)+nsamps) > samples_per_frame) { // Wrap around if nsamps exceeds the buffer limit - memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(samples_per_frame)],(void*)(tx_ue[antenna_index]), - (samples_per_frame<<2)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2)); - - memcpy(&tx_buffer_UE[antenna_index][0], (void*)(tx_ue[antenna_index]+(samples_per_frame*4)-((timestamp_UE_tx[antenna_index]%(samples_per_frame))<<2)), - (nsamps<<2)-((samples_per_frame-(timestamp_UE_tx[antenna_index]%(samples_per_frame)))<<2)); - //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2)); - } else { - memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(samples_per_frame)], (void*)(tx_ue[antenna_index]),(nsamps<<2)); - } - - while (sync_UE_rx[antenna_index]==0) - nanosleep(&time_req_1us,&time_rem_1us); - - pthread_mutex_lock(&sync_UE_mutex[antenna_index]); - sync_UE_rx[antenna_index]++; - - if (!sync_UE_rx[antenna_index]) { - counter_UE_tx[antenna_index]=(counter_UE_tx[antenna_index]+nsamps)%samples_per_frame; - nsamps_UE[antenna_index]=nsamps; - } else { - printf("rrh_eNB_proc thread is busy, will exit\n"); - exit(-1); - } - - pthread_mutex_unlock(&sync_UE_mutex[antenna_index]); - - clock_gettime(CLOCK_MONOTONIC,&time2); - - memcpy(&time0,&time2,sizeof(struct timespec)); - - } - - return(0); - -} - - diff --git a/targets/RT/USER/condtest.c b/targets/RT/USER/condtest.c deleted file mode 100644 index b6f00e80b3ac9a68e2ddc2ad32cb90e10fe7b246..0000000000000000000000000000000000000000 --- 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/eNB_transport_IQ.c b/targets/RT/USER/eNB_transport_IQ.c deleted file mode 100644 index b822a5ea75bd81faed46b3097b380adeeeaad9d8..0000000000000000000000000000000000000000 --- a/targets/RT/USER/eNB_transport_IQ.c +++ /dev/null @@ -1,744 +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 eNB_transport_IQ.c - * \brief eNB transport IQ samples - * \author Katerina Trilyraki, Navid Nikaein, Raymond Knopp - * \date 2015 - * \version 0.1 - * \company Eurecom - * \maintainer: navid.nikaein@eurecom.fr - * \note - * \warning very experimental - */ -#include <unistd.h> -#include <time.h> -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> - -#include "common_lib.h" -#include "PHY/defs.h" -#include "rrh_gw.h" -#include "rrh_gw_externs.h" -#include "rt_wrapper.h" - -#define PRINTF_PERIOD 3750 -#define HEADER_SIZE ((sizeof(int32_t) + sizeof(openair0_timestamp))>>2) - -pthread_cond_t sync_eNB_cond[4]; -pthread_mutex_t sync_eNB_mutex[4]; -pthread_mutex_t sync_trx_mutex=PTHREAD_MUTEX_INITIALIZER; -pthread_cond_t sync_trx_cond=PTHREAD_COND_INITIALIZER; - -openair0_timestamp nrt_eNB_counter[4]= {0,0,0,0}; -int32_t overflow_rx_buffer_eNB[4]= {0,0,0,0}; -int32_t nsamps_eNB[4]= {0,0,0,0}; -int32_t eNB_tx_started=0,eNB_rx_started=0; -int32_t counter_eNB_rx[4]= {0,0,0,0}; -int32_t counter_eNB_tx[4]= {0,0,0,0}; -uint8_t RT_flag_eNB,NRT_flag_eNB; -void *rrh_eNB_thread_status; -int sync_eNB_rx[4]= {-1,-1,-1,-1}; -unsigned int sync_trx=0; - -int32_t **tx_buffer_eNB; -int32_t **rx_buffer_eNB; -void **rx_eNB; //was fixed to 2 ant -void **tx_eNB; //was fixed to 2 ant - -openair0_timestamp timestamp_eNB_tx[4]= {0,0,0,0};// all antennas must have the same ts -openair0_timestamp timestamp_eNB_rx[4]= {0,0,0,0}; -openair0_timestamp timestamp_rx=0,timestamp_tx=0; - -unsigned int rx_pos=0, next_rx_pos=0; -unsigned int tx_pos=0, tx_pos_rf=0, prev_tx_pos=0; -unsigned int rt_period=0; - -struct itimerspec timerspec; -pthread_mutex_t timer_mutex; - - - -/*! \fn void *rrh_eNB_rx_thread(void *arg) - * \brief this function - * \param[in] - * \return none - * \note - * @ingroup _oai - */ -void *rrh_eNB_rx_thread(void *); -/*! \fn void *rrh_eNB_tx_thread(void *arg) - * \brief this function - * \param[in] - * \return none - * \note - * @ingroup _oai - */ -void *rrh_eNB_tx_thread(void *); -/*! \fn void *rrh_eNB_thread(void *arg) - * \brief this function - * \param[in] - * \return none - * \note - * @ingroup _oai - */ -void *rrh_eNB_thread(void *); -/*! \fn void check_dev_config( rrh_module_t *mod_enb) - * \brief this function - * \param[in] *mod_enb - * \return none - * \note - * @ingroup _oai - */ -static void check_dev_config( rrh_module_t *mod_enb); -/*! \fn void calc_rt_period_ns( openair0_config_t openair0_cfg) - * \brief this function - * \param[in] openair0_cfg - * \return none - * \note - * @ingroup _oai - */ -static void calc_rt_period_ns( openair0_config_t *openair0_cfg); - - - -void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) { - - int error_code_eNB; - pthread_t main_rrh_eNB_thread; - pthread_attr_t attr; - struct sched_param sched_param_rrh; - - RT_flag_eNB=RT_flag; - NRT_flag_eNB=NRT_flag; - - /* init socket and have handshake-like msg with client to exchange parameters */ - mod_enb->eth_dev.trx_start_func(&mod_enb->eth_dev);//change port make it plus_id - - mod_enb->devs->openair0_cfg = mod_enb->eth_dev.openair0_cfg; - - /* check sanity of configuration parameters and print */ - check_dev_config(mod_enb); - if (rf_config_file[0] == '\0') - mod_enb->devs->openair0_cfg->configFilename = NULL; - else - mod_enb->devs->openair0_cfg->configFilename = rf_config_file; - /* initialize and configure the RF device */ - if (openair0_device_load(mod_enb->devs, mod_enb->devs->openair0_cfg)<0) { - LOG_E(RRH,"Exiting, cannot initialize RF device.\n"); - exit(-1); - } else { - if (mod_enb->devs->type != NONE_DEV) { - /* start RF device */ - if (mod_enb->devs->type == EXMIMO_DEV) { - //call start function for exmino - } else { - - if (mod_enb->devs->trx_start_func(mod_enb->devs)!=0) - LOG_E(RRH,"Unable to initiate RF device.\n"); - else - LOG_I(RRH,"RF device has been initiated.\n"); - } - - } - } - - /* create main eNB module thread - main_rrh_eNB_thread allocates memory - for TX/RX buffers and creates TX/RX - threads for every eNB module */ - pthread_attr_init(&attr); - sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_setschedparam(&attr,&sched_param_rrh); - pthread_attr_setschedpolicy(&attr,SCHED_FIFO); - error_code_eNB = pthread_create(&main_rrh_eNB_thread, &attr, rrh_eNB_thread, (void *)mod_enb); - - if (error_code_eNB) { - LOG_E(RRH,"Error while creating eNB thread\n"); - exit(-1); - } - -} - - -void *rrh_eNB_thread(void *arg) { - - rrh_module_t *dev=(rrh_module_t *)arg; - pthread_t eNB_rx_thread, eNB_tx_thread; - int error_code_eNB_rx, error_code_eNB_tx; - int32_t i,j; - void *tmp; - unsigned int samples_per_frame=0; - - samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame; - - while (rrh_exit==0) { - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX, 1 ); - - /* calculate packet period */ - calc_rt_period_ns(dev->eth_dev.openair0_cfg); - - /* allocate memory for TX/RX buffers - each antenna port has a TX and a RX buffer - each TX and RX buffer is of (samples_per_frame + HEADER_SIZE) samples (size of samples is 4 bytes) */ - rx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*)); - tx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*)); - LOG_D(RRH,"rx_buffer_eNB address =%p tx_buffer_eNB address =%p \n",rx_buffer_eNB,tx_buffer_eNB); - - /* rx_buffer_eNB points to the beginning of data */ - for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) { - tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32)); - memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32)); - rx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) ); - LOG_D(RRH,"i=%d rx_buffer_eNB[i]=%p tmp= %p\n",i,rx_buffer_eNB[i],tmp); - } - /* tx_buffer_eNB points to the beginning of data */ - for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) { - tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32)); - memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32)); - tx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) ); - LOG_D(RRH,"i= %d tx_buffer_eNB[i]=%p tmp= %p \n",i,tx_buffer_eNB[i],tmp); - } - /* dummy initialization for TX/RX buffers */ - for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) { - for (j=0; j<samples_per_frame; j++) { - rx_buffer_eNB[i][j]=32+i; - } - } - /* dummy initialization for TX/RX buffers */ - for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) { - for (j=0; j<samples_per_frame; j++) { - tx_buffer_eNB[i][j]=12+i; - } - } - /* allocate TX/RX buffers pointers used in write/read operations */ - rx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*)); - tx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*)); - - /* init mutexes */ - for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) { - pthread_mutex_init(&sync_eNB_mutex[i],NULL); - pthread_cond_init(&sync_eNB_cond[i],NULL); - } - /* init mutexes */ - pthread_mutex_init(&sync_trx_mutex,NULL); - - /* create eNB module's TX/RX threads */ -#ifdef DEADLINE_SCHEDULER - error_code_eNB_rx = pthread_create(&eNB_rx_thread, NULL, rrh_eNB_rx_thread, (void *)dev); - error_code_eNB_tx = pthread_create(&eNB_tx_thread, NULL, rrh_eNB_tx_thread, (void *)dev); - LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to eNB TX/RX threads\n"); -#else - pthread_attr_t attr_eNB_rx, attr_eNB_tx; - struct sched_param sched_param_eNB_rx, sched_param_eNB_tx; - - pthread_attr_init(&attr_eNB_rx); - pthread_attr_init(&attr_eNB_tx); - sched_param_eNB_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); - sched_param_eNB_tx.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_setschedparam(&attr_eNB_rx,&sched_param_eNB_rx); - pthread_attr_setschedparam(&attr_eNB_tx,&sched_param_eNB_tx); - pthread_attr_setschedpolicy(&attr_eNB_rx,SCHED_FIFO); - pthread_attr_setschedpolicy(&attr_eNB_tx,SCHED_FIFO); - - error_code_eNB_rx = pthread_create(&eNB_rx_thread, &attr_eNB_rx, rrh_eNB_rx_thread, (void *)dev); - error_code_eNB_tx = pthread_create(&eNB_tx_thread, &attr_eNB_tx, rrh_eNB_tx_thread, (void *)dev); - LOG_I(RRH,"[eNB][SCHED] FIFO scheduling applied to eNB TX/RX threads\n"); -#endif - - if (error_code_eNB_rx) { - LOG_E(RRH,"[eNB] Error while creating eNB RX thread\n"); - exit(-1); - } - if (error_code_eNB_tx) { - LOG_E(RRH,"[eNB] Error while creating eNB TX thread\n"); - exit(-1); - } - - /* create timer thread; when no RF device is present a software clock is generated */ - if (dev->devs->type == NONE_DEV) { - - int error_code_timer; - pthread_t main_timer_proc_thread; - - LOG_I(RRH,"Creating timer thread with rt period %d ns.\n",rt_period); - - /* setup the timer to generate an interrupt: - -for the first time in (sample_per_packet/sample_rate) ns - -and then every (sample_per_packet/sample_rate) ns */ - timerspec.it_value.tv_sec = rt_period/1000000000; - timerspec.it_value.tv_nsec = rt_period%1000000000; - timerspec.it_interval.tv_sec = rt_period/1000000000; - timerspec.it_interval.tv_nsec = rt_period%1000000000; - - -#ifdef DEADLINE_SCHEDULER - error_code_timer = pthread_create(&main_timer_proc_thread, NULL, timer_proc, (void *)&timerspec); - LOG_I(RRH,"[eNB][SCHED] deadline scheduling applied to timer thread \n"); -#else - pthread_attr_t attr_timer; - struct sched_param sched_param_timer; - - pthread_attr_init(&attr_timer); - sched_param_timer.sched_priority = sched_get_priority_max(SCHED_FIFO-1); - pthread_attr_setschedparam(&attr_timer,&sched_param_timer); - pthread_attr_setschedpolicy(&attr_timer,SCHED_FIFO-1); - - pthread_mutex_init(&timer_mutex,NULL); - - error_code_timer = pthread_create(&main_timer_proc_thread, &attr_timer, timer_proc, (void *)&timerspec); - LOG_I(RRH,"[eNB][SCHED] FIFO scheduling applied to timer thread \n"); -#endif - - if (error_code_timer) { - LOG_E(RRH,"Error while creating timer proc thread\n"); - exit(-1); - } - - } - - while (rrh_exit==0) - sleep(1); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TRX,0 ); - } - - rrh_eNB_thread_status = 0; - pthread_exit(&rrh_eNB_thread_status); - return(0); -} - -/* Receive from RF and transmit to RRH */ - -void *rrh_eNB_rx_thread(void *arg) { - - /* measurement related vars */ - struct timespec time0,time1,time2; - unsigned long long max_rx_time=0, min_rx_time=rt_period, total_rx_time=0, average_rx_time=rt_period, s_period=0, trial=0; - int trace_cnt=0; - - struct timespec time_req_1us, time_rem_1us; - rrh_module_t *dev = (rrh_module_t *)arg; - ssize_t bytes_sent; - int i=0 ,pck_rx=0, s_cnt=0; - openair0_timestamp last_hw_counter=0; //volatile int64_t - unsigned int samples_per_frame=0,samples_per_subframe=0, spp_rf=0, spp_eth=0; - uint8_t loopback=0,measurements=0; - unsigned int subframe=0; - unsigned int frame=0; - - time_req_1us.tv_sec = 0; - time_req_1us.tv_nsec =1000; //time_req_1us.tv_nsec = (int)rt_period/2;--->granularity issue - spp_eth = dev->eth_dev.openair0_cfg->samples_per_packet; - spp_rf = dev->devs->openair0_cfg->samples_per_packet; - - samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame; - samples_per_subframe = (unsigned int)samples_per_frame/10; - loopback = dev->loopback; - measurements = dev->measurements; - next_rx_pos = spp_eth; - -#ifdef DEADLINE_SCHEDULER - struct sched_attr attr; - unsigned int flags = 0; - - attr.size = sizeof(attr); - attr.sched_flags = 0; - attr.sched_nice = 0; - attr.sched_priority = 0; - - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = (0.8 * 100) * 10000;//4 * 10000; - attr.sched_deadline = (0.9 * 100) * 10000;//rt_period-2000; - attr.sched_period = 1 * 1000000;//rt_period; - - if (sched_setattr(0, &attr, flags) < 0 ) { - perror("[SCHED] eNB RX thread: sched_setattr failed (run with sudo)\n"); - exit(-1); - } -#endif - - while (rrh_exit == 0) { - while (rx_pos <(1 + subframe)*samples_per_subframe) { - //LOG_D(RRH,"starting a new send:%d %d\n",sync_trx,frame); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX, 1 ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME_RX, frame); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME_RX, subframe ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_PCK, pck_rx ); - LOG_D(RRH,"pack=%d rx_pos=%d subframe=%d frame=%d\n ",pck_rx, rx_pos, subframe,frame); - - if (dev->devs->type == NONE_DEV) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_HWCNT, hw_counter ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_LHWCNT, last_hw_counter ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_CNT, s_cnt ); - if (!eNB_rx_started) { - eNB_rx_started=1; // set this flag to 1 to indicate that eNB started - if (RT_flag_eNB==1) { - last_hw_counter=hw_counter;//get current counter - } - } else { - if (RT_flag_eNB==1) { - if (hw_counter > last_hw_counter+1) { - printf("LR"); - } else { - while ((hw_counter < last_hw_counter+1)) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP, 1 ); - nanosleep(&time_req_1us,&time_rem_1us); //rt_sleep_ns(sleep_ns); - s_cnt++; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX_SLEEP, 0 ); - } - } - } - } - } - - - if (measurements == 1 ) clock_gettime(CLOCK_MONOTONIC,&time1); - - if (loopback == 1 ) { - if (sync_eNB_rx[i]==0) { - rx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos]; - LOG_I(RRH,"tx_buffer_eNB[i][tx_pos]=%d ,tx_pos=%d\n",tx_buffer_eNB[i][tx_pos],tx_pos); - } else { - rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos]; - LOG_I(RRH,"rx_buffer_eNB[i][rx_pos]=%d ,rx_pos=%d\n",rx_buffer_eNB[i][rx_pos],rx_pos); - } - } - - for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) { - rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos]; - LOG_D(RRH," rx_eNB[i]=%p rx_buffer_eNB[i][rx_pos]=%p ,rx_pos=%d, i=%d ts=%d\n",rx_eNB[i],&rx_buffer_eNB[i][rx_pos],rx_pos,i,timestamp_rx); - } - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RXCNT, rx_pos ); - if (dev->devs->type != NONE_DEV) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF, 1 ); - /* Read operation to RF device (RX)*/ - if ( dev->devs->trx_read_func (dev->devs, - ×tamp_rx, - rx_eNB, - spp_rf, - dev->devs->openair0_cfg->rx_num_channels - )<0) { - perror("RRH eNB : USRP read"); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_RF, 0 ); - } - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_TS, timestamp_rx&0xffffffff ); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); - if ((bytes_sent = dev->eth_dev.trx_write_func (&dev->eth_dev, - timestamp_rx, - rx_eNB, - spp_eth, - dev->eth_dev.openair0_cfg->rx_num_channels, - 0))<0) { - perror("RRH eNB : ETHERNET write"); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); - - /* when there is no RF timestamp is updated by number of samples */ - if (dev->devs->type == NONE_DEV) { - timestamp_rx+=spp_eth; - last_hw_counter=hw_counter; - } - - if (measurements == 1 ) { - - clock_gettime(CLOCK_MONOTONIC,&time2); - - if (trace_cnt++ > 10) { - total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec); - if (total_rx_time < 0) - total_rx_time=1000000000-total_rx_time; - - if ((total_rx_time > 0) && (total_rx_time < 1000000000)) { - trial++; - if (total_rx_time < min_rx_time) - min_rx_time = total_rx_time; - if (total_rx_time > max_rx_time){ - max_rx_time = total_rx_time; - LOG_I(RRH,"Max value %d update at rx_position %d \n",total_rx_time,timestamp_rx); - } - average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1); - } - if (s_period++ == PRINTF_PERIOD) { - s_period=0; - LOG_I(RRH,"Average eNB RX time : %lu ns\tMax RX time : %lu ns\tMin RXX time : %lu ns\n",average_rx_time,max_rx_time,min_rx_time); - } - } - - memcpy(&time0,&time2,sizeof(struct timespec)); - } - - if (loopback == 1 ) { - pthread_mutex_lock(&sync_eNB_mutex[i]); - sync_eNB_rx[i]--; - pthread_mutex_unlock(&sync_eNB_mutex[i]); - } - - rx_pos += spp_eth; - pck_rx++; - next_rx_pos=(rx_pos+spp_eth); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_RX, 0 ); - /* - if (frame>50) { - pthread_mutex_lock(&sync_trx_mutex); - while (sync_trx) { - pthread_cond_wait(&sync_trx_cond,&sync_trx_mutex); - } - sync_trx=1; - LOG_D(RRH,"out of while send:%d %d\n",sync_trx,frame); - pthread_cond_signal(&sync_trx_cond); - pthread_mutex_unlock(&sync_trx_mutex); - }*/ - } // while - - subframe++; - s_cnt=0; - - /* wrap around rx buffer index */ - if (next_rx_pos >= samples_per_frame) - next_rx_pos -= samples_per_frame; - if (rx_pos >= samples_per_frame) - rx_pos -= samples_per_frame; - /* wrap around subframe number */ - if (subframe == 10 ) { - subframe = 0; - frame++; - } - - - } //while (eNB_exit==0) - return 0; -} - -/* Receive from eNB and transmit to RF */ - -void *rrh_eNB_tx_thread(void *arg) { - - struct timespec time0,time1,time2; - - rrh_module_t *dev = (rrh_module_t *)arg; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_received; - int i; - //openair0_timestamp last_hw_counter=0; - unsigned int samples_per_frame=0,samples_per_subframe=0; - unsigned int spp_rf=0, spp_eth=0; - uint8_t loopback=0,measurements=0; - unsigned int subframe=0,frame=0; - unsigned int pck_tx=0; - -#ifdef DEADLINE_SCHEDULER - struct sched_attr attr; - unsigned int flags = 0; - - attr.size = sizeof(attr); - attr.sched_flags = 0; - attr.sched_nice = 0; - attr.sched_priority = 0; - - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = (0.8 * 100) * 10000; - attr.sched_deadline = (0.9 * 100) * 10000; - attr.sched_period = 1 * 1000000; - - if (sched_setattr(0, &attr, flags) < 0 ) { - perror("[SCHED] eNB TX thread: sched_setattr failed\n"); - exit(-1); - } -#endif - - time_req_1us.tv_sec = 1; - time_req_1us.tv_nsec = 0; - spp_eth = dev->eth_dev.openair0_cfg->samples_per_packet; - spp_rf = dev->devs->openair0_cfg->samples_per_packet; - samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame; - samples_per_subframe = (unsigned int)samples_per_frame/10; - tx_pos=0; - - loopback = dev->loopback; - measurements = dev->measurements; - - while (rrh_exit == 0) { - while (tx_pos < (1 + subframe)*samples_per_subframe) { - - //LOG_D(RRH,"bef lock read:%d %d\n",sync_trx,frame); - //pthread_mutex_lock(&sync_trx_mutex); - - //while (!sync_trx) { - //LOG_D(RRH,"in sync read:%d %d\n",sync_trx,frame); - //pthread_cond_wait(&sync_trx_cond,&sync_trx_mutex); - //} - //LOG_D(RRH,"out of while read:%d %d\n",sync_trx,frame); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, 1 ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_FRAME, frame); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_HW_SUBFRAME, subframe ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK, pck_tx ); - - if (measurements == 1 ) clock_gettime(CLOCK_MONOTONIC,&time1); - for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) tx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos]; - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TXCNT, tx_pos ); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); - - /* Read operation to ETHERNET device */ - if (( bytes_received = dev->eth_dev.trx_read_func(&dev->eth_dev, - ×tamp_tx, - tx_eNB, - spp_eth, - dev->eth_dev.openair0_cfg->tx_num_channels))<0) { - perror("RRH eNB : ETHERNET read"); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); - - if (dev->devs->type != NONE_DEV) { - LOG_D(RRH," tx_buffer_eNB[i][tx_pos]=%x t_buffer_eNB[i][tx_pos+1]=%x t_buffer_eNB[i][tx_pos+2]=%x \n",tx_buffer_eNB[0][tx_pos],tx_buffer_eNB[0][tx_pos+1],tx_buffer_eNB[0][tx_pos+2]); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF, 1 ); - /* Write operation to RF device (TX)*/ - if ( dev->devs->trx_write_func (dev->devs, - timestamp_tx, - tx_eNB, - spp_rf, - dev->devs->openair0_cfg->tx_num_channels, - 1)<0){ - perror("RRH eNB : USRP write"); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_RF, 0 ); - } - - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_TS, timestamp_tx&0xffffffff ); - - - //if (dev->devs->type == NONE_DEV) last_hw_counter=hw_counter; - - - if (loopback ==1 ) { - while (sync_eNB_rx[i]==0) - nanosleep(&time_req_1us,&time_rem_1us); - - pthread_mutex_lock(&sync_eNB_mutex[i]); - sync_eNB_rx[i]++; - pthread_mutex_unlock(&sync_eNB_mutex[i]); - } - - if (measurements == 1 ) { - clock_gettime(CLOCK_MONOTONIC,&time2); - memcpy(&time0,&time2,sizeof(struct timespec)); - } - - prev_tx_pos=tx_pos; - tx_pos += spp_eth; - pck_tx++; - - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, 0 ); - //sync_trx=0; - //pthread_cond_signal(&sync_trx_cond); - //pthread_mutex_unlock(&sync_trx_mutex); - } - - /* wrap around tx buffer index */ - if (tx_pos >= samples_per_frame) - tx_pos -= samples_per_frame; - /* wrap around subframe number */ - subframe++; - if (subframe == 10 ) { - subframe = 0; // the radio frame is complete, start over - frame++; - } - - } //while (eNB_exit==0) - return 0; -} - - -static void calc_rt_period_ns( openair0_config_t *openair0_cfg) { - - rt_period= (double)(openair0_cfg->samples_per_packet/(openair0_cfg->samples_per_frame/10.0)*1000000); - AssertFatal(rt_period > 0, "Invalid rt period !%u\n", rt_period); - LOG_I(RRH,"[eNB] Real time period is set to %u ns\n", rt_period); -} - - -static void check_dev_config( rrh_module_t *mod_enb) { - - AssertFatal( (mod_enb->devs->openair0_cfg->num_rb_dl==100 || mod_enb->devs->openair0_cfg->num_rb_dl==50 || mod_enb->devs->openair0_cfg->num_rb_dl==25 || mod_enb->devs->openair0_cfg->num_rb_dl==6) , "Invalid number of resource blocks! %d\n", mod_enb->devs->openair0_cfg->num_rb_dl); - AssertFatal( mod_enb->devs->openair0_cfg->samples_per_frame > 0 , "Invalid number of samples per frame! %d\n",mod_enb->devs->openair0_cfg->samples_per_frame); - AssertFatal( mod_enb->devs->openair0_cfg->sample_rate > 0.0, "Invalid sample rate! %f\n", mod_enb->devs->openair0_cfg->sample_rate); - AssertFatal( mod_enb->devs->openair0_cfg->samples_per_packet > 0 , "Invalid number of samples per packet! %d\n",mod_enb->devs->openair0_cfg->samples_per_packet); - AssertFatal( mod_enb->devs->openair0_cfg->rx_num_channels > 0 , "Invalid number of RX antennas! %d\n", mod_enb->devs->openair0_cfg->rx_num_channels); - AssertFatal( mod_enb->devs->openair0_cfg->tx_num_channels > 0 , "Invalid number of TX antennas! %d\n", mod_enb->devs->openair0_cfg->tx_num_channels); - AssertFatal( mod_enb->devs->openair0_cfg->rx_freq[0] > 0.0 ,"Invalid RX frequency! %f\n", mod_enb->devs->openair0_cfg->rx_freq[0]); - AssertFatal( mod_enb->devs->openair0_cfg->tx_freq[0] > 0.0 ,"Invalid TX frequency! %f\n", mod_enb->devs->openair0_cfg->tx_freq[0]); - AssertFatal( mod_enb->devs->openair0_cfg->rx_gain[0] > 0.0 ,"Invalid RX gain! %f\n", mod_enb->devs->openair0_cfg->rx_gain[0]); - AssertFatal( mod_enb->devs->openair0_cfg->tx_gain[0] > 0.0 ,"Invalid TX gain! %f\n", mod_enb->devs->openair0_cfg->tx_gain[0]); - AssertFatal( mod_enb->devs->openair0_cfg->rx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->rx_bw); - AssertFatal( mod_enb->devs->openair0_cfg->tx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->tx_bw); - AssertFatal( mod_enb->devs->openair0_cfg->autocal[0] > 0 , "Invalid auto calibration choice! %d\n", mod_enb->devs->openair0_cfg->autocal[0]); - - printf("\n---------------------RF device configuration parameters---------------------\n"); - - printf("\tMod_id=%d\n \tlog level=%d\n \tDL_RB=%d\n \tsamples_per_frame=%d\n \tsample_rate=%f\n \tsamples_per_packet=%d\n \ttx_sample_advance=%d\n \trx_num_channels=%d\n \ttx_num_channels=%d\n \trx_freq_0=%f\n \ttx_freq_0=%f\n \trx_freq_1=%f\n \ttx_freq_1=%f\n \trx_freq_2=%f\n \ttx_freq_2=%f\n \trx_freq_3=%f\n \ttx_freq_3=%f\n \trxg_mode=%d\n \trx_gain_0=%f\n \ttx_gain_0=%f\n \trx_gain_1=%f\n \ttx_gain_1=%f\n \trx_gain_2=%f\n \ttx_gain_2=%f\n \trx_gain_3=%f\n \ttx_gain_3=%f\n \trx_gain_offset_2=%f\n \ttx_gain_offset_3=%f\n \trx_bw=%f\n \ttx_bw=%f\n \tautocal=%d\n", - mod_enb->devs->openair0_cfg->Mod_id, - mod_enb->devs->openair0_cfg->log_level, - mod_enb->devs->openair0_cfg->num_rb_dl, - mod_enb->devs->openair0_cfg->samples_per_frame, - mod_enb->devs->openair0_cfg->sample_rate, - mod_enb->devs->openair0_cfg->samples_per_packet, - mod_enb->devs->openair0_cfg->tx_sample_advance, - mod_enb->devs->openair0_cfg->rx_num_channels, - mod_enb->devs->openair0_cfg->tx_num_channels, - mod_enb->devs->openair0_cfg->rx_freq[0], - mod_enb->devs->openair0_cfg->tx_freq[0], - mod_enb->devs->openair0_cfg->rx_freq[1], - mod_enb->devs->openair0_cfg->tx_freq[1], - mod_enb->devs->openair0_cfg->rx_freq[2], - mod_enb->devs->openair0_cfg->tx_freq[2], - mod_enb->devs->openair0_cfg->rx_freq[3], - mod_enb->devs->openair0_cfg->tx_freq[3], - mod_enb->devs->openair0_cfg->rxg_mode[0], - mod_enb->devs->openair0_cfg->tx_gain[0], - mod_enb->devs->openair0_cfg->tx_gain[0], - mod_enb->devs->openair0_cfg->rx_gain[1], - mod_enb->devs->openair0_cfg->tx_gain[1], - mod_enb->devs->openair0_cfg->rx_gain[2], - mod_enb->devs->openair0_cfg->tx_gain[2], - mod_enb->devs->openair0_cfg->rx_gain[3], - mod_enb->devs->openair0_cfg->tx_gain[3], - //mod_enb->devs->openair0_cfg->rx_gain_offset[0], - //mod_enb->devs->openair0_cfg->rx_gain_offset[1], - mod_enb->devs->openair0_cfg->rx_gain_offset[2], - mod_enb->devs->openair0_cfg->rx_gain_offset[3], - mod_enb->devs->openair0_cfg->rx_bw, - mod_enb->devs->openair0_cfg->tx_bw, - mod_enb->devs->openair0_cfg->autocal[0] - ); - - printf("----------------------------------------------------------------------------\n"); - - -} diff --git a/targets/RT/USER/emos-raw.c b/targets/RT/USER/emos-raw.c deleted file mode 100644 index 2cf0e18c7171f51cde0cacbbba2a79bfc5e6b40a..0000000000000000000000000000000000000000 --- 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 69b127de3322ae5388a46a28f6ae83fb05de1d0f..0000000000000000000000000000000000000000 --- 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 998cd7c462d5a0f4a66926d5d4890509c0b21050..0000000000000000000000000000000000000000 --- 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 ac99e48ff747f6edef813c4ff29f9a28902bb42c..0000000000000000000000000000000000000000 --- 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 17e03c6c5a023bd3135a404d31f2958f18c48d34..0000000000000000000000000000000000000000 --- 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 5b9d465e33658b9f8b992d3058cae13b99a93619..0000000000000000000000000000000000000000 --- 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/rrh.c b/targets/RT/USER/rrh.c deleted file mode 100644 index 88bd3f644dde90213cbffa24a287a7df9681a454..0000000000000000000000000000000000000000 --- a/targets/RT/USER/rrh.c +++ /dev/null @@ -1,1220 +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 - */ - -/** ethernet_lib : API to stream I/Q samples over standard ethernet (RRH component) -* -* Authors: Raymond Knopp <raymond.knopp@eurecom.fr>, Riadh Ghaddab <riadh.ghaddab@eurecom.fr> -* -* Changelog: -* 06.10.2014: Initial version -*/ - -#include <arpa/inet.h> -#include <linux/if_packet.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <net/if.h> -#include <netinet/ether.h> -#include <unistd.h> -#include <signal.h> -#include <execinfo.h> -#include <pthread.h> -#include <time.h> - -#include "common_lib.h" - -#define BUF_LEN 4096+32 -#define RRH_eNB_PORT 50000 -#define RRH_eNB_DEST_IP "127.0.0.1" -#define RRH_UE_PORT 51000 -#define RRH_UE_DEST_IP "127.0.0.1" - -#define FRAME_MAX_SIZE 307200//76800 -#define DEFAULT_PERIOD_NS 133333//200000 - -#define START_CMD 1 -#define PRINTF_PERIOD 3750 - -typedef struct { - int eNB_port; - char eNB_dest_ip[20]; - int UE_port; - char UE_dest_ip[20]; - struct timespec time_req; -} rrh_desc_t; - -typedef struct { - int32_t nsamps; - int32_t antenna_index_eNB_rx; - int32_t antenna_index_eNB_tx; - int sockid_eNB; - struct sockaddr clientaddr; - socklen_t clientaddrlen; -} rrh_eNB_desc_t; - -typedef struct { - int32_t nsamps; - int32_t antenna_index_UE_rx; - int32_t antenna_index_UE_tx; - int sockid_UE; - struct sockaddr clientaddr; - socklen_t clientaddrlen; -} rrh_UE_desc_t; - -int rrh_exit=0; - -int32_t tx_buffer_eNB[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE],rx_buffer_eNB[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE]; -int32_t tx_buffer_UE[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE],rx_buffer_UE[4][(1+(sizeof(openair0_timestamp)>>2))+FRAME_MAX_SIZE]; -void *rrh_eNB_thread_status; -void *rrh_UE_thread_status; -int32_t counter_UE_rx[4]= {0,0,0,0}; -int32_t counter_UE_tx[4]= {0,0,0,0}; -int32_t counter_eNB_rx[4]= {0,0,0,0}; -int32_t counter_eNB_tx[4]= {0,0,0,0}; -int32_t overflow_rx_buffer_UE[4]= {0,0,0,0}; -int32_t overflow_rx_buffer_eNB[4]= {0,0,0,0}; -int32_t nsamps_eNB[4]= {0,0,0,0}; -int32_t nsamps_UE[4]= {0,0,0,0}; -int32_t UE_tx_started=0,eNB_tx_started=0, UE_rx_started=0,eNB_rx_started=0; -int32_t RT_FLAG=0, NRT_FLAG=1; -openair0_timestamp nrt_eNB_counter[4]= {0,0,0,0}; -openair0_timestamp nrt_UE_counter[4]= {0,0,0,0}; - -openair0_timestamp timestamp_eNB_tx[4],timestamp_eNB_rx[4]= {0,0,0,0}; -openair0_timestamp timestamp_UE_tx[4],timestamp_UE_rx[4]= {0,0,0,0}; -openair0_timestamp hw_counter=0; - -pthread_cond_t sync_UE_cond[4]; -pthread_mutex_t sync_UE_mutex[4]; -pthread_cond_t sync_eNB_cond[4]; -pthread_mutex_t sync_eNB_mutex[4]; -pthread_mutex_t timer_mutex; - -int sync_UE_rx[4]= {-1,-1,-1,-1}; -int sync_eNB_rx[4]= {-1,-1,-1,-1}; - -//functions prototype -void timer_signal_handler(int); -void *timer_proc(void *); -void *rrh_proc_eNB_thread(); -void *rrh_proc_UE_thread(); -void *rrh_UE_thread(void *); -void *rrh_UE_rx_thread(void *); -void *rrh_UE_tx_thread(void *); -void *rrh_eNB_thread(void *); -void *rrh_eNB_rx_thread(void *); -void *rrh_eNB_tx_thread(void *); - -void timer_signal_handler(int sig) -{ - - if (sig == SIGALRM) { - pthread_mutex_lock(&timer_mutex); - hw_counter ++; - //printf("[RRH] : hw_counter : %d\n",(int)hw_counter); - pthread_mutex_unlock(&timer_mutex); - } - - -} - - -void *timer_proc(void *arg) -{ - timer_t timerid; // timer ID for timer - //struct sigevent event; // event to deliver - struct itimerspec *timer = (struct itimerspec*)arg; // the timer data structure - struct itimerspec *old_value; - - - //printf("Starting the timer\n"); - if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1) { - fprintf (stderr, "couldn't create a timer\n"); - perror (NULL); - exit (EXIT_FAILURE); - } - - signal(SIGALRM, timer_signal_handler); - // and start it! - timer_settime (timerid, 0, timer, old_value); - - while (!rrh_exit) { - sleep(1); - } - - timer_delete(timerid); - return (0); - - -} - - -void *rrh_proc_eNB_thread() -{ - - //rrh_desc_t *rrh_desc = (rrh_desc_t *)arg; - int antenna_index,i; - openair0_timestamp truncated_timestamp, truncated_timestamp_final, last_hw_counter=0; - struct timespec time_req, time_rem; - int16_t *rxp,*txp; - - time_req.tv_sec = 0; - time_req.tv_nsec = 1000; - - while (rrh_exit==0) { - //wait until some data has been copied - for (antenna_index=0; antenna_index<4; antenna_index++) { - if (sync_eNB_rx[antenna_index]==0) { - if (!eNB_tx_started) { - eNB_tx_started=1; // set this flag to 1 to indicate that eNB started - - if (RT_FLAG==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_FLAG==1) { - if (hw_counter > last_hw_counter+1) { - printf("L"); - // goto end_copy_eNB; - } else { - //printf("hw_counter : %llu, last_hw_counter : %llu\n",hw_counter,last_hw_counter); - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req,&time_rem); - } - } - } - - truncated_timestamp = timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE); - truncated_timestamp_final = (timestamp_eNB_tx[antenna_index]+nsamps_eNB[antenna_index])%FRAME_MAX_SIZE; - - if ((truncated_timestamp + nsamps_eNB[antenna_index]) > FRAME_MAX_SIZE) { - if ((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE < nsamps_eNB[antenna_index]) && (UE_rx_started==1)) { - overflow_rx_buffer_UE[antenna_index]++; - printf("UE Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_UE[antenna_index],(int)truncated_timestamp); - - if (NRT_FLAG==1) { - while ((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE) < nsamps_eNB[antenna_index]) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)]; - txp = (int16_t*)&tx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)]; - - for (i=0; i<(FRAME_MAX_SIZE<<1)-(truncated_timestamp<<1); i++) { - rxp[i] = txp[i]>>6; - } - - rxp = (int16_t*)&rx_buffer_UE[antenna_index][(sizeof(openair0_timestamp)>>2)]; - txp = (int16_t*)&tx_buffer_eNB[antenna_index][0]; - - for (i=0; i<nsamps_eNB[antenna_index]-(FRAME_MAX_SIZE)+(truncated_timestamp); i++) { - rxp[i] = txp[i]>>6; - } - - /* memcpy(&rx_buffer_UE[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][truncated_timestamp],(FRAME_MAX_SIZE<<2)-(truncated_timestamp<<2)); - memcpy(&rx_buffer_UE[antenna_index][(sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][0],(nsamps_eNB[antenna_index]<<2)-(FRAME_MAX_SIZE<<2)+(truncated_timestamp<<2));*/ - } else { - if (((truncated_timestamp < (timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE)) && (truncated_timestamp_final > (timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE))) && (UE_rx_started==1)) { - overflow_rx_buffer_UE[antenna_index]++; - printf("UE Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_UE[antenna_index],(int)truncated_timestamp); - - if (NRT_FLAG==1) { - while (truncated_timestamp_final > timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp))]; - txp = (int16_t*)&tx_buffer_eNB[antenna_index][truncated_timestamp]; - - for (i=0; i<(nsamps_eNB[antenna_index]); i++) { - rxp[i] =txp[i]>>6; - } - - /* - memcpy(&rx_buffer_UE[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_eNB[antenna_index][truncated_timestamp],(nsamps_eNB[antenna_index]<<2));*/ - } - - - // end_copy_eNB : - last_hw_counter=hw_counter; - pthread_mutex_lock(&sync_eNB_mutex[antenna_index]); - sync_eNB_rx[antenna_index]--; - pthread_mutex_unlock(&sync_eNB_mutex[antenna_index]); - - } - } - - } - - return(0); -} - -void *rrh_proc_UE_thread() -{ - - //rrh_desc_t *rrh_desc = (rrh_desc_t *)arg; - int antenna_index,i; - openair0_timestamp truncated_timestamp, truncated_timestamp_final, last_hw_counter=0; - struct timespec time_req, time_rem; - int16_t *txp,*rxp; - - time_req.tv_sec = 0; - time_req.tv_nsec = 1000; - - - while (rrh_exit==0) { - //wait until some data has been copied - for (antenna_index=0; antenna_index<4; antenna_index++) { - if (sync_UE_rx[antenna_index]==0) { - if (!UE_tx_started) { - UE_tx_started=1; //Set this flag to 1 to indicate that a UE started retrieving data - - if (RT_FLAG==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_FLAG==1) { - if (hw_counter > last_hw_counter+1) { - printf("L1"); - // goto end_copy_UE; - } else { - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req,&time_rem); - } - } - } - - truncated_timestamp = timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE); - truncated_timestamp_final = (timestamp_UE_tx[antenna_index]+nsamps_UE[antenna_index])%FRAME_MAX_SIZE; - - if ((truncated_timestamp + nsamps_UE[antenna_index]) > FRAME_MAX_SIZE) { - if ((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE < nsamps_UE[antenna_index]) && (eNB_rx_started==1)) { - overflow_rx_buffer_eNB[antenna_index]++; - printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp); - - if (NRT_FLAG==1) { - while ((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE) < nsamps_UE[antenna_index]) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp)>>2)]; - - for (i=0; i<(FRAME_MAX_SIZE<<1)-(truncated_timestamp<<1); i++) { - rxp[i] = txp[i]>>6; - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][(sizeof(openair0_timestamp)>>2)]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][0]; - - for (i=0; i<nsamps_eNB[antenna_index]-(FRAME_MAX_SIZE)+(truncated_timestamp); i++) { - rxp[i] = txp[i]>>6; - } - - /* - memcpy(&rx_buffer_eNB[antenna_index][truncated_timestamp + (sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][truncated_timestamp],(FRAME_MAX_SIZE<<2)-(truncated_timestamp<<2)); - memcpy(&rx_buffer_eNB[antenna_index][(sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][0],(nsamps_UE[antenna_index]<<2)-(FRAME_MAX_SIZE<<2)+(truncated_timestamp<<2));*/ - - } else { - if (((truncated_timestamp < (timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE)) && (truncated_timestamp_final > (timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE))) && (eNB_rx_started==1)) { - overflow_rx_buffer_eNB[antenna_index]++; - printf("eNB Overflow[%d] : %d, timestamp : %d\n",antenna_index,overflow_rx_buffer_eNB[antenna_index],(int)truncated_timestamp); - - if (NRT_FLAG==1) { - while (truncated_timestamp_final > timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE) - nanosleep(&time_req,&time_rem); - } - } - - rxp = (int16_t*)&rx_buffer_eNB[antenna_index][truncated_timestamp+(sizeof(openair0_timestamp))]; - txp = (int16_t*)&tx_buffer_UE[antenna_index][truncated_timestamp]; - - for (i=0; i<(nsamps_eNB[antenna_index]); i++) { - rxp[i] =txp[i]>>6; - } - - /* memcpy(&rx_buffer_eNB[antenna_index][truncated_timestamp+ (sizeof(openair0_timestamp)>>2)],&tx_buffer_UE[antenna_index][truncated_timestamp],(nsamps_UE[antenna_index]<<2));*/ - } - - //end_copy_UE : - last_hw_counter=hw_counter; - pthread_mutex_lock(&sync_UE_mutex[antenna_index]); - sync_UE_rx[antenna_index]--; - pthread_mutex_unlock(&sync_UE_mutex[antenna_index]); - - } - } - - } - - return(0); -} - - -void *rrh_UE_rx_thread(void *arg) -{ - - struct sockaddr clientaddr; - socklen_t clientaddrlen; - rrh_UE_desc_t *rrh_UE_rx_desc = (rrh_UE_desc_t *)arg; - struct timespec time0,time1,time2; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_sent; - int antenna_index, nsamps; - int trace_cnt=0; - int sockid; - char str[INET_ADDRSTRLEN]; - unsigned long long max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0; - - openair0_timestamp temp, last_hw_counter=0; - - antenna_index = rrh_UE_rx_desc->antenna_index_UE_rx; - nsamps = rrh_UE_rx_desc->nsamps; - sockid = rrh_UE_rx_desc->sockid_UE; - - - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - //printf("Waiting for eNB ...\n"); - //printf("[RRH eNB RX thread] received parameters : nsamps : %d, antenna_index : %d\n",nsamps,antenna_index); - clientaddr = rrh_UE_rx_desc->clientaddr; - clientaddrlen = rrh_UE_rx_desc->clientaddrlen; - - inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN); - printf("Received UE RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str, - ntohs(((struct sockaddr_in*)&clientaddr)->sin_port)); - - while (rrh_exit == 0) { - if (!UE_rx_started) { - UE_rx_started=1; //Set this flag to 1 to indicate that a UE started retrieving data - - if (RT_FLAG==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_FLAG==1) { - if (hw_counter > last_hw_counter+1) { - printf("L1"); - // goto end_copy_UE; - } else { - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - } - - clock_gettime(CLOCK_MONOTONIC,&time1); - - // send return - temp=*(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)]; - *(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)]=timestamp_UE_rx[antenna_index]; - - if ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit - if (((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)) < ((timestamp_UE_rx[antenna_index]+nsamps)%(FRAME_MAX_SIZE))) && (eNB_tx_started==1)) { - printf("UE underflow wraparound timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",(int)(timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)),(int)(timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)); - - if (NRT_FLAG==1) { - while ((timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE) < ((timestamp_UE_rx[antenna_index]+nsamps)%(FRAME_MAX_SIZE))) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - - if ((bytes_sent = sendto(sockid, - &rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)], - ((FRAME_MAX_SIZE)<<2) - ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE))<<2) + sizeof(openair0_timestamp), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH UE : sendto for RX"); - - if ((bytes_sent = sendto(sockid, - &rx_buffer_UE[antenna_index][0], - (nsamps<<2) - ((FRAME_MAX_SIZE)<<2) + ((timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE))<<2), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH UE : sendto for RX"); - } else { - if (((timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE)< timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE) - && (((timestamp_UE_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)) && (eNB_tx_started==1) ) { - printf("UE underflow timestamp_UE_rx : %d, timestamp_eNB_tx : %d\n",(int)(timestamp_UE_rx[antenna_index]%FRAME_MAX_SIZE),(int)(timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)); - - if (NRT_FLAG==1) { - while (((timestamp_UE_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_eNB_tx[antenna_index]%FRAME_MAX_SIZE)) { - nanosleep(&time_req_1us,&time_rem_1us); - } - } - } - - - if ((bytes_sent = sendto(sockid, - &rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)], - (nsamps<<2)+sizeof(openair0_timestamp), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH UE thread: sendto for RX"); - } - - //printf("bytes_sent %d(timestamp_UE_rx[%d] %d)\n",(int)bytes_sent,antenna_index,(int)timestamp_UE_rx[antenna_index]); - *(openair0_timestamp*)&rx_buffer_UE[antenna_index][timestamp_UE_rx[antenna_index]%(FRAME_MAX_SIZE)]=temp; - timestamp_UE_rx[antenna_index]+=nsamps; - last_hw_counter=hw_counter; - - clock_gettime(CLOCK_MONOTONIC,&time2); - - if (trace_cnt++ > 10) { - total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec); - - if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time; - - if ((total_rx_time > 0) && (total_rx_time < 1000000000)) { - trial++; - - if (total_rx_time < min_rx_time) - min_rx_time = total_rx_time; - - if (total_rx_time > max_rx_time) - max_rx_time = total_rx_time; - - average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1); - } - - if (s_period++ == PRINTF_PERIOD) { - s_period=0; - printf("Average UE RX time : %lu\tMax RX time : %lu\tMin RX time : %lu\n",average_rx_time,max_rx_time,min_rx_time); - - } - - //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec), - // (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec)); - - } - - memcpy(&time0,&time2,sizeof(struct timespec)); - - - } //while (rrh_exit==0) - - return(0); - -} - - -void *rrh_UE_tx_thread(void *arg) -{ - struct sockaddr clientaddr; - socklen_t clientaddrlen; - struct timespec time0a,time0,time1,time2; - rrh_UE_desc_t *rrh_UE_tx_desc = (rrh_UE_desc_t *)arg; - // struct timespec time_rem; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_received; - int antenna_index, nsamps; - int8_t buf[BUF_LEN]; - int trace_cnt=0; - int sockid; - - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - - antenna_index = rrh_UE_tx_desc->antenna_index_UE_tx; - nsamps = rrh_UE_tx_desc->nsamps; - sockid = rrh_UE_tx_desc->sockid_UE; - - while (rrh_exit == 0) { - - clock_gettime(CLOCK_MONOTONIC,&time0a); - - bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen); - timestamp_eNB_tx[antenna_index] = *(openair0_timestamp*)(buf+4); - - clock_gettime(CLOCK_MONOTONIC,&time1); - - if (NRT_FLAG==1) { - nrt_UE_counter[antenna_index]++; - } - - //printf("Received UE TX request for antenna %d, nsamps %d, timestamp %d bytes_received %d\n",antenna_index,nsamps,(int)timestamp_UE_tx[antenna_index],(int)bytes_received); - if ((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit - memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t), - (FRAME_MAX_SIZE<<2)-((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE))<<2)); - memcpy(&tx_buffer_UE[antenna_index][0],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t)+(FRAME_MAX_SIZE*4)-((timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE))<<2), - (nsamps<<2)-((FRAME_MAX_SIZE-(timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)))<<2)); - //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2)); - } else { - memcpy(&tx_buffer_UE[antenna_index][timestamp_UE_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),(nsamps<<2)); - } - - //printf("Received UE TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2)); - - while (sync_UE_rx[antenna_index]==0) - nanosleep(&time_req_1us,&time_rem_1us); - - pthread_mutex_lock(&sync_UE_mutex[antenna_index]); - sync_UE_rx[antenna_index]++; - - if (!sync_UE_rx[antenna_index]) { - counter_UE_tx[antenna_index]=(counter_UE_tx[antenna_index]+nsamps)%FRAME_MAX_SIZE; - nsamps_UE[antenna_index]=nsamps; - } else { - printf("rrh_eNB_proc thread is busy, will exit\n"); - exit(-1); - } - - pthread_mutex_unlock(&sync_UE_mutex[antenna_index]); - - clock_gettime(CLOCK_MONOTONIC,&time2); - - memcpy(&time0,&time2,sizeof(struct timespec)); - - } - - return(0); - -} - - - -void *rrh_UE_thread(void *arg) -{ - - int sockid=-1; - struct sockaddr_in serveraddr; - struct sockaddr clientaddr; - socklen_t clientaddrlen; - rrh_desc_t *rrh_desc = (rrh_desc_t *)arg; - char str[INET_ADDRSTRLEN]; - //int8_t msg_header[4+sizeof(openair0_timestamp)]; - int8_t buf[BUF_LEN]; - int16_t cmd; //,nsamps,antenna_index; - ssize_t bytes_received; - // struct timespec time_rem; - // ssize_t bytes_sent; - // openair0_timestamp temp; - // openair0_timestamp last_hw_counter=0; - struct timespec time_req_1us, time_rem_1us; - - rrh_UE_desc_t rrh_UE_desc; - pthread_t UE_rx_thread, UE_tx_thread; - pthread_attr_t attr_UE_rx, attr_UE_tx; - struct sched_param sched_param_UE_rx, sched_param_UE_tx; - int error_code_UE_rx, error_code_UE_tx; - - time_req_1us.tv_sec = 0; - time_req_1us.tv_nsec = 1000; - - while (rrh_exit==0) { - - - sockid=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); - - if (sockid==-1) { - perror("Cannot create UE socket: "); - rrh_exit=1; - } - - - bzero((char *)&serveraddr,sizeof(serveraddr)); - serveraddr.sin_family=AF_INET; - serveraddr.sin_port=htons(rrh_desc->UE_port); - inet_pton(AF_INET,rrh_desc->UE_dest_ip,&serveraddr.sin_addr.s_addr); - - inet_ntop(AF_INET, &(serveraddr.sin_addr), str, INET_ADDRSTRLEN); - printf("Binding to UE socket for %s:%d\n",str,ntohs(serveraddr.sin_port)); - - if (bind(sockid,(struct sockaddr *)&serveraddr,sizeof(serveraddr))<0) { - perror("Cannot bind to UE socket: "); - rrh_exit = 1; - } - - // now wait for commands from eNB - - // get header info - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - //printf("Waiting for UE ...\n"); - - bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen); - cmd = buf[0]; - - rrh_UE_desc.antenna_index_UE_rx = cmd>>1; - rrh_UE_desc.antenna_index_UE_tx = cmd>>1; - //rrh_eNB_desc.timestamp_eNB_tx[rrh_eNB_desc.antenna_index_eNB_tx] = *(openair0_timestamp*)(buf+4); //we don't need timestamp when receiving the first command - rrh_UE_desc.nsamps = *(int16_t *)(buf+2); - rrh_UE_desc.sockid_UE = sockid; - rrh_UE_desc.clientaddr = clientaddr; - rrh_UE_desc.clientaddrlen = clientaddrlen; - - cmd = cmd&1; - inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN); - - if (cmd==START_CMD) { - - pthread_attr_init(&attr_UE_rx); - pthread_attr_init(&attr_UE_tx); - sched_param_UE_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); - sched_param_UE_tx.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_setschedparam(&attr_UE_rx,&sched_param_UE_rx); - pthread_attr_setschedparam(&attr_UE_tx,&sched_param_UE_tx); - pthread_attr_setschedpolicy(&attr_UE_rx,SCHED_FIFO); - pthread_attr_setschedpolicy(&attr_UE_tx,SCHED_FIFO); - - error_code_UE_rx = pthread_create(&UE_rx_thread, &attr_UE_rx, rrh_UE_rx_thread, (void *)&rrh_UE_desc); - error_code_UE_tx = pthread_create(&UE_tx_thread, &attr_UE_tx, rrh_UE_tx_thread, (void *)&rrh_UE_desc); - - if (error_code_UE_rx) { - printf("Error while creating UE RX thread\n"); - exit(-1); - } - - if (error_code_UE_tx) { - printf("Error while creating UE TX thread\n"); - exit(-1); - } - - while (rrh_exit==0) - sleep(1); - } - } - - close(sockid); - - rrh_UE_thread_status = 0; - pthread_exit(&rrh_UE_thread_status); - - return(0); -} - - - -void *rrh_eNB_rx_thread(void *arg) -{ - - struct sockaddr clientaddr; - socklen_t clientaddrlen; - rrh_eNB_desc_t *rrh_eNB_rx_desc = (rrh_eNB_desc_t *)arg; - struct timespec time0,time1,time2; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_sent; - int antenna_index, nsamps; - int trace_cnt=0; - int sockid; - char str[INET_ADDRSTRLEN]; - unsigned long long max_rx_time=0, min_rx_time=133333, total_rx_time=0, average_rx_time=133333, s_period=0, trial=0; - - openair0_timestamp temp, last_hw_counter=0; - - antenna_index = rrh_eNB_rx_desc->antenna_index_eNB_rx; - nsamps = rrh_eNB_rx_desc->nsamps; - sockid = rrh_eNB_rx_desc->sockid_eNB; - - - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - //printf("Waiting for eNB ...\n"); - //printf("[RRH eNB RX thread] received parameters : nsamps : %d, antenna_index : %d\n",nsamps,antenna_index); - clientaddr = rrh_eNB_rx_desc->clientaddr; - clientaddrlen = rrh_eNB_rx_desc->clientaddrlen; - - inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN); - printf("Received eNB RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str, - ntohs(((struct sockaddr_in*)&clientaddr)->sin_port)); - - while (rrh_exit == 0) { - //printf("Received eNB RX request for antenna %d, nsamps %d (from %s:%d)\n",antenna_index,nsamps,str, - // ntohs(((struct sockaddr_in*)&clientaddr)->sin_port)); - - if (!eNB_rx_started) { - eNB_rx_started=1; // set this flag to 1 to indicate that eNB started - - if (RT_FLAG==1) { - last_hw_counter=hw_counter; - } - } else { - if (RT_FLAG==1) { - if (hw_counter > last_hw_counter+1) { - printf("L"); - // goto end_copy_eNB; - } else { - while (hw_counter < last_hw_counter+1) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - } - - clock_gettime(CLOCK_MONOTONIC,&time1); - - // send return - temp=*(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)]; - *(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)]=timestamp_eNB_rx[antenna_index]; - - if ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit - if ((timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE < ((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE)) && (UE_tx_started==1)) { - printf("eNB underflow\n"); - - if (NRT_FLAG==1) { - while ((timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE) < nsamps) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - - - if ((bytes_sent = sendto(sockid, - &rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)], - ((FRAME_MAX_SIZE)<<2) - ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE))<<2) + sizeof(openair0_timestamp), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH eNB : sendto for RX"); - - if ((bytes_sent = sendto(sockid, - &rx_buffer_eNB[antenna_index][0], - (nsamps<<2) - ((FRAME_MAX_SIZE)<<2) + ((timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE))<<2), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH eNB : sendto for RX"); - } else { - if (((timestamp_eNB_rx[antenna_index]%FRAME_MAX_SIZE)< timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE) - && (((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE)) && (UE_tx_started==1)) { - printf("eNB underflow\n"); - - if (NRT_FLAG==1) { - while (((timestamp_eNB_rx[antenna_index]+nsamps)%FRAME_MAX_SIZE) > (timestamp_UE_tx[antenna_index]%FRAME_MAX_SIZE)) - nanosleep(&time_req_1us,&time_rem_1us); - } - } - - if ((bytes_sent = sendto(sockid, - &rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)], - (nsamps<<2)+sizeof(openair0_timestamp), - 0, - (struct sockaddr*)&clientaddr, - sizeof(struct sockaddr)))<0) - perror("RRH eNB : sendto for RX"); - - } - - //printf("bytes_sent %d(timestamp_eNB_rx[%d] %d)\n",(int)bytes_sent,antenna_index,(int)timestamp_eNB_rx[antenna_index]); - - - *(openair0_timestamp*)&rx_buffer_eNB[antenna_index][timestamp_eNB_rx[antenna_index]%(FRAME_MAX_SIZE)]=temp; - timestamp_eNB_rx[antenna_index]+=nsamps; - last_hw_counter=hw_counter; - - clock_gettime(CLOCK_MONOTONIC,&time2); - - if (trace_cnt++ > 10) { - total_rx_time = (unsigned int)(time2.tv_nsec - time0.tv_nsec); - - if (total_rx_time < 0) total_rx_time=1000000000-total_rx_time; - - if ((total_rx_time > 0) && (total_rx_time < 1000000000)) { - trial++; - - if (total_rx_time < min_rx_time) - min_rx_time = total_rx_time; - - if (total_rx_time > max_rx_time) - max_rx_time = total_rx_time; - - average_rx_time = (long long unsigned int)((average_rx_time*trial)+total_rx_time)/(trial+1); - } - - if (s_period++ == PRINTF_PERIOD) { - s_period=0; - printf("Average eNB RX time : %lu\tMax RX time : %lu\tMin RX time : %lu\n",average_rx_time,max_rx_time,min_rx_time); - - } - - //printf("RX: t1 %llu (time from last send), t2 %llu (sendto of %lu bytes) total time : %llu\n",(long long unsigned int)(time1.tv_nsec - time0.tv_nsec), (long long unsigned int)(time2.tv_nsec - time1.tv_nsec), - // (nsamps<<2)+sizeof(openair0_timestamp),(long long unsigned int)(time2.tv_nsec - time0.tv_nsec)); - - } - - memcpy(&time0,&time2,sizeof(struct timespec)); - - - } //while (rrh_exit==0) - - return(0); - -} - - -void *rrh_eNB_tx_thread(void *arg) -{ - - struct sockaddr clientaddr; - socklen_t clientaddrlen; - struct timespec time0a,time0,time1,time2; - rrh_eNB_desc_t *rrh_eNB_tx_desc = (rrh_eNB_desc_t *)arg; - // struct timespec time_rem; - struct timespec time_req_1us, time_rem_1us; - ssize_t bytes_received; - int antenna_index, nsamps; - int8_t buf[BUF_LEN]; - int trace_cnt=0; - int sockid; - - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - //printf("Waiting for eNB ...\n"); - - antenna_index = rrh_eNB_tx_desc->antenna_index_eNB_tx; - nsamps = rrh_eNB_tx_desc->nsamps; - sockid = rrh_eNB_tx_desc->sockid_eNB; - - while (rrh_exit == 0) { - - clock_gettime(CLOCK_MONOTONIC,&time0a); - - bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen); - timestamp_eNB_tx[antenna_index] = *(openair0_timestamp*)(buf+4); - - clock_gettime(CLOCK_MONOTONIC,&time1); - - if (NRT_FLAG==1) { - nrt_eNB_counter[antenna_index]++; - } - - //printf("Received eNB TX request for antenna %d, nsamps %d, timestamp %d bytes_received %d\n",antenna_index,nsamps,(int)timestamp_eNB_tx[antenna_index],(int)bytes_received); - - if ((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)+nsamps) > FRAME_MAX_SIZE) { // Wrap around if nsamps exceeds the buffer limit - memcpy(&tx_buffer_eNB[antenna_index][timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t), - ((FRAME_MAX_SIZE)<<2)-((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2)); - //printf("Done first part size : %d\n",(int32_t)(((FRAME_MAX_SIZE)<<2)-((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2))); - memcpy(&tx_buffer_eNB[antenna_index][0],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t) + ((FRAME_MAX_SIZE)<<2) -((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2), - (nsamps<<2)-((FRAME_MAX_SIZE)<<2)+((timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE))<<2)); - //printf("Received eNB TX samples for antenna %d, nsamps %d (%d)\n",antenna_index,nsamps,(int)(bytes_received>>2)); - } else { - memcpy(&tx_buffer_eNB[antenna_index][timestamp_eNB_tx[antenna_index]%(FRAME_MAX_SIZE)],buf+sizeof(openair0_timestamp)+2*sizeof(int16_t),nsamps<<2); - } - - while (sync_eNB_rx[antenna_index]==0) - nanosleep(&time_req_1us,&time_rem_1us); - - //printf("launching eNB proc\n"); - pthread_mutex_lock(&sync_eNB_mutex[antenna_index]); - sync_eNB_rx[antenna_index]++; - - if (!sync_eNB_rx[antenna_index]) { - counter_eNB_tx[antenna_index]=(counter_eNB_tx[antenna_index]+nsamps)%FRAME_MAX_SIZE; - nsamps_eNB[antenna_index]=nsamps; - } else { - printf("rrh_eNB_proc thread is busy, will exit\n"); - exit(-1); - } - - pthread_mutex_unlock(&sync_eNB_mutex[antenna_index]); - - clock_gettime(CLOCK_MONOTONIC,&time2); - - //if (trace_cnt++ < 10) - // printf("TX: t0 %llu (time from previous run) t1 %llu (time of memcpy TX samples), t2 %llu (total time)\n",(long long unsigned int)(time1.tv_nsec - time0.tv_nsec), - // (long long unsigned int)(time2.tv_nsec - time1.tv_nsec), - // (long long unsigned int)(time2.tv_nsec - time0.tv_nsec)); - - memcpy(&time0,&time2,sizeof(struct timespec)); - - - - } - - return(0); - -} - -void *rrh_eNB_thread(void *arg) -{ - - int sockid=-1; - struct sockaddr_in serveraddr; - struct sockaddr clientaddr; - socklen_t clientaddrlen; - rrh_desc_t *rrh_desc = (rrh_desc_t *)arg; - char str[INET_ADDRSTRLEN]; - //int8_t msg_header[4+sizeof(openair0_timestamp)]; - int8_t buf[BUF_LEN]; - int16_t cmd; //,nsamps,antenna_index; - ssize_t bytes_received; - //ssize_t bytes_sent; - //openair0_timestamp temp, last_hw_counter=0; - //struct timespec time_rem; - struct timespec time_req_1us, time_rem_1us; - //struct timespec time0a,time0,time1,time2; - //int trace_cnt=0; - rrh_eNB_desc_t rrh_eNB_desc; - pthread_t eNB_rx_thread, eNB_tx_thread; - pthread_attr_t attr_eNB_rx, attr_eNB_tx; - struct sched_param sched_param_eNB_rx, sched_param_eNB_tx; - int error_code_eNB_rx, error_code_eNB_tx; - - time_req_1us.tv_sec = 0; - time_req_1us.tv_nsec = 1000; - - - while (rrh_exit==0) { - - - sockid=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); - - if (sockid==-1) { - perror("Cannot create eNB socket: "); - rrh_exit=1; - } - - - bzero((char *)&serveraddr,sizeof(serveraddr)); - serveraddr.sin_family=AF_INET; - serveraddr.sin_port=htons(rrh_desc->eNB_port); - inet_pton(AF_INET,rrh_desc->eNB_dest_ip,&serveraddr.sin_addr.s_addr); - - inet_ntop(AF_INET, &(serveraddr.sin_addr), str, INET_ADDRSTRLEN); - printf("Binding to eNB socket for %s:%d\n",str,ntohs(serveraddr.sin_port)); - - if (bind(sockid,(struct sockaddr *)&serveraddr,sizeof(serveraddr))<0) { - perror("Cannot bind to eNB socket: "); - rrh_exit = 1; - } - - // now wait for commands from eNB - - // get header info - bzero((void*)&clientaddr,sizeof(struct sockaddr)); - clientaddrlen = sizeof(struct sockaddr); - //printf("Waiting for eNB ...\n"); - - - - bytes_received = recvfrom(sockid,buf,BUF_LEN,0,&clientaddr,&clientaddrlen); - cmd = buf[0]; - rrh_eNB_desc.antenna_index_eNB_rx = cmd>>1; - rrh_eNB_desc.antenna_index_eNB_tx = cmd>>1; - //rrh_eNB_desc.timestamp_eNB_tx[rrh_eNB_desc.antenna_index_eNB_tx] = *(openair0_timestamp*)(buf+4); //we don't need timestamp when receiving the first command - rrh_eNB_desc.nsamps = *(int16_t *)(buf+2); - rrh_eNB_desc.sockid_eNB = sockid; - rrh_eNB_desc.clientaddr = clientaddr; - rrh_eNB_desc.clientaddrlen = clientaddrlen; - - //cmd = cmd&1; - cmd = cmd|1;//in order to make cmd evalution dummy (the first message from lte to rrh has changed, see: @ethernet_lib.c trx_start_func has been substituted by trx_request_func ) - inet_ntop(AF_INET, &(((struct sockaddr_in*)&clientaddr)->sin_addr), str, INET_ADDRSTRLEN); - - if (cmd==START_CMD) { - - pthread_attr_init(&attr_eNB_rx); - pthread_attr_init(&attr_eNB_tx); - sched_param_eNB_rx.sched_priority = sched_get_priority_max(SCHED_FIFO); - sched_param_eNB_tx.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_setschedparam(&attr_eNB_rx,&sched_param_eNB_rx); - pthread_attr_setschedparam(&attr_eNB_tx,&sched_param_eNB_tx); - pthread_attr_setschedpolicy(&attr_eNB_rx,SCHED_FIFO); - pthread_attr_setschedpolicy(&attr_eNB_tx,SCHED_FIFO); - - error_code_eNB_rx = pthread_create(&eNB_rx_thread, &attr_eNB_rx, rrh_eNB_rx_thread, (void *)&rrh_eNB_desc); - error_code_eNB_tx = pthread_create(&eNB_tx_thread, &attr_eNB_tx, rrh_eNB_tx_thread, (void *)&rrh_eNB_desc); - - if (error_code_eNB_rx) { - printf("Error while creating eNB RX thread\n"); - exit(-1); - } - - if (error_code_eNB_tx) { - printf("Error while creating eNB TX thread\n"); - exit(-1); - } - - while (rrh_exit==0) - sleep(1); - - } - - - } //while (rrh_exit==0) - - close(sockid); - - rrh_eNB_thread_status = 0; - pthread_exit(&rrh_eNB_thread_status); - - return(0); -} - - -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 { - printf("trying to exit gracefully...\n"); - rrh_exit = 1; - } -} - -int main(int argc, char **argv) -{ - - pthread_t main_rrh_eNB_thread, main_rrh_UE_thread, main_rrh_proc_eNB_thread, main_rrh_proc_UE_thread, main_timer_proc_thread; - pthread_attr_t attr, attr_proc, attr_timer; - struct sched_param sched_param_rrh, sched_param_rrh_proc, sched_param_timer; - int error_code_eNB, error_code_UE, error_code_proc_eNB, error_code_proc_UE, error_code_timer; - int i; - int opt; - int nsecs=0, rt_period=0; - rrh_desc_t rrh; - struct itimerspec timer; - - - rrh.time_req.tv_sec = 0; - rrh.time_req.tv_nsec = 0; - - rrh.eNB_port = RRH_eNB_PORT; - strcpy(rrh.eNB_dest_ip,RRH_eNB_DEST_IP); - rrh.UE_port = RRH_UE_PORT; - strcpy(rrh.UE_dest_ip ,RRH_UE_DEST_IP); - - nsecs = 0; - - while ((opt = getopt(argc, argv, "t:rE:U:")) != -1) { - switch (opt) { - case 't': - rt_period = atoi(optarg); - RT_FLAG=1; - NRT_FLAG=0; - break; - - case 'r': - rt_period = DEFAULT_PERIOD_NS; - RT_FLAG=1; - NRT_FLAG=0; - break; - - case 'E': - strcpy(rrh.eNB_dest_ip,optarg); - break; - - case 'U': - strcpy(rrh.UE_dest_ip,optarg); - break; - - default: /* '?' */ - fprintf(stderr, "Usage: %s [-d nsecs]\n", argv[0]); - exit(-1); - } - } - - // if (optind >= argc) { - // fprintf(stderr, "Expected argument after options\n"); - // exit(EXIT_FAILURE); - // } - - // setup the timer (1s delay, 1s reload) - timer.it_value.tv_sec = rt_period/1000000000; - timer.it_value.tv_nsec = rt_period%1000000000; - timer.it_interval.tv_sec = rt_period/1000000000; - timer.it_interval.tv_nsec = rt_period%1000000000; - - - // to make a graceful exit when ctrl-c is pressed - signal(SIGSEGV, signal_handler); - signal(SIGINT, signal_handler); - - - pthread_attr_init(&attr); - sched_param_rrh.sched_priority = sched_get_priority_max(SCHED_FIFO); - pthread_attr_init(&attr_proc); - sched_param_rrh_proc.sched_priority = sched_get_priority_max(SCHED_FIFO-1); - pthread_attr_init(&attr_timer); - sched_param_timer.sched_priority = sched_get_priority_max(SCHED_FIFO-2); - - pthread_attr_setschedparam(&attr,&sched_param_rrh); - pthread_attr_setschedpolicy(&attr,SCHED_FIFO); - pthread_attr_setschedparam(&attr_proc,&sched_param_rrh_proc); - pthread_attr_setschedpolicy(&attr_proc,SCHED_FIFO-1); - pthread_attr_setschedparam(&attr_timer,&sched_param_timer); - pthread_attr_setschedpolicy(&attr_timer,SCHED_FIFO-2); - - for (i=0; i<4; i++) { - pthread_mutex_init(&sync_eNB_mutex[i],NULL); - pthread_cond_init(&sync_eNB_cond[i],NULL); - pthread_mutex_init(&sync_UE_mutex[i],NULL); - pthread_cond_init(&sync_UE_cond[i],NULL); - } - - pthread_mutex_init(&timer_mutex,NULL); - - error_code_eNB = pthread_create(&main_rrh_eNB_thread, &attr, rrh_eNB_thread, (void *)&rrh); - error_code_UE = pthread_create(&main_rrh_UE_thread, &attr, rrh_UE_thread, (void *)&rrh); - error_code_proc_UE = pthread_create(&main_rrh_proc_UE_thread, &attr_proc, rrh_proc_UE_thread, NULL); - error_code_proc_eNB = pthread_create(&main_rrh_proc_eNB_thread, &attr_proc, rrh_proc_eNB_thread, NULL); - error_code_timer = pthread_create(&main_timer_proc_thread, &attr_timer, timer_proc, (void *)&timer); - - if (error_code_eNB) { - printf("Error while creating eNB thread\n"); - exit(-1); - } - - if (error_code_UE) { - printf("Error while creating UE thread\n"); - exit(-1); - } - - if (error_code_proc_UE) { - printf("Error while creating UE proc thread\n"); - exit(-1); - } - - if (error_code_proc_eNB) { - printf("Error while creating eNB proc thread\n"); - exit(-1); - } - - if (error_code_timer) { - printf("Error while creating timer proc thread\n"); - exit(-1); - } - - printf("TYPE <CTRL-C> TO TERMINATE\n"); - - while (rrh_exit==0) - sleep(1); - - - //pthread_join(main_rrh_eNB_thread,&rrh_eNB_thread_status); - return 0; -} diff --git a/targets/RT/USER/rrh.gtkw b/targets/RT/USER/rrh.gtkw deleted file mode 100644 index 891f23ada52417ffd360f617eab2eeecd2ef16cd..0000000000000000000000000000000000000000 --- a/targets/RT/USER/rrh.gtkw +++ /dev/null @@ -1,195 +0,0 @@ -[*] -[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI -[*] Fri Jan 29 16:34:46 2016 -[*] -[dumpfile] "/tmp/openair_dump_rrh.vcd" -[dumpfile_mtime] "Fri Jan 29 16:20:55 2016" -[dumpfile_size] 224259458 -[savefile] "/home/guepe/openairinterface5g_rrh/openairinterface5g/targets/RT/USER/rrh.gtkw" -[timestart] 31315875900 -[size] 1004 1028 -[pos] 926 -1 -*-17.429794 31316090054 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -[sst_width] 224 -[signals_width] 261 -[sst_expanded] 1 -[sst_vpaned_height] 278 -@24 -[color] 1 -variables.hw_frame_rx[63:0] -[color] 1 -variables.hw_subframe_rx[63:0] -@28 -[color] 1 -functions.eNB_rx -functions.eNB_rx_sleep -[color] 3 -functions.trx_read_rf -[color] 7 -functions.trx_write -@c00024 -variables.rxcnt[63:0] -@28 -(0)variables.rxcnt[63:0] -(1)variables.rxcnt[63:0] -(2)variables.rxcnt[63:0] -(3)variables.rxcnt[63:0] -(4)variables.rxcnt[63:0] -(5)variables.rxcnt[63:0] -(6)variables.rxcnt[63:0] -(7)variables.rxcnt[63:0] -(8)variables.rxcnt[63:0] -(9)variables.rxcnt[63:0] -(10)variables.rxcnt[63:0] -(11)variables.rxcnt[63:0] -(12)variables.rxcnt[63:0] -(13)variables.rxcnt[63:0] -(14)variables.rxcnt[63:0] -(15)variables.rxcnt[63:0] -(16)variables.rxcnt[63:0] -(17)variables.rxcnt[63:0] -(18)variables.rxcnt[63:0] -(19)variables.rxcnt[63:0] -(20)variables.rxcnt[63:0] -(21)variables.rxcnt[63:0] -(22)variables.rxcnt[63:0] -(23)variables.rxcnt[63:0] -(24)variables.rxcnt[63:0] -(25)variables.rxcnt[63:0] -(26)variables.rxcnt[63:0] -(27)variables.rxcnt[63:0] -(28)variables.rxcnt[63:0] -(29)variables.rxcnt[63:0] -(30)variables.rxcnt[63:0] -(31)variables.rxcnt[63:0] -(32)variables.rxcnt[63:0] -(33)variables.rxcnt[63:0] -(34)variables.rxcnt[63:0] -(35)variables.rxcnt[63:0] -(36)variables.rxcnt[63:0] -(37)variables.rxcnt[63:0] -(38)variables.rxcnt[63:0] -(39)variables.rxcnt[63:0] -(40)variables.rxcnt[63:0] -(41)variables.rxcnt[63:0] -(42)variables.rxcnt[63:0] -(43)variables.rxcnt[63:0] -(44)variables.rxcnt[63:0] -(45)variables.rxcnt[63:0] -(46)variables.rxcnt[63:0] -(47)variables.rxcnt[63:0] -(48)variables.rxcnt[63:0] -(49)variables.rxcnt[63:0] -(50)variables.rxcnt[63:0] -(51)variables.rxcnt[63:0] -(52)variables.rxcnt[63:0] -(53)variables.rxcnt[63:0] -(54)variables.rxcnt[63:0] -(55)variables.rxcnt[63:0] -(56)variables.rxcnt[63:0] -(57)variables.rxcnt[63:0] -(58)variables.rxcnt[63:0] -(59)variables.rxcnt[63:0] -(60)variables.rxcnt[63:0] -(61)variables.rxcnt[63:0] -(62)variables.rxcnt[63:0] -(63)variables.rxcnt[63:0] -@1401200 --group_end -@24 -variables.pck_rx[63:0] -variables.rx_ts[63:0] -@c00024 -variables.tx_seq_num[63:0] -@28 -(0)variables.tx_seq_num[63:0] -(1)variables.tx_seq_num[63:0] -(2)variables.tx_seq_num[63:0] -(3)variables.tx_seq_num[63:0] -(4)variables.tx_seq_num[63:0] -(5)variables.tx_seq_num[63:0] -(6)variables.tx_seq_num[63:0] -(7)variables.tx_seq_num[63:0] -(8)variables.tx_seq_num[63:0] -(9)variables.tx_seq_num[63:0] -(10)variables.tx_seq_num[63:0] -(11)variables.tx_seq_num[63:0] -(12)variables.tx_seq_num[63:0] -(13)variables.tx_seq_num[63:0] -(14)variables.tx_seq_num[63:0] -(15)variables.tx_seq_num[63:0] -(16)variables.tx_seq_num[63:0] -(17)variables.tx_seq_num[63:0] -(18)variables.tx_seq_num[63:0] -(19)variables.tx_seq_num[63:0] -(20)variables.tx_seq_num[63:0] -(21)variables.tx_seq_num[63:0] -(22)variables.tx_seq_num[63:0] -(23)variables.tx_seq_num[63:0] -(24)variables.tx_seq_num[63:0] -(25)variables.tx_seq_num[63:0] -(26)variables.tx_seq_num[63:0] -(27)variables.tx_seq_num[63:0] -(28)variables.tx_seq_num[63:0] -(29)variables.tx_seq_num[63:0] -(30)variables.tx_seq_num[63:0] -(31)variables.tx_seq_num[63:0] -(32)variables.tx_seq_num[63:0] -(33)variables.tx_seq_num[63:0] -(34)variables.tx_seq_num[63:0] -(35)variables.tx_seq_num[63:0] -(36)variables.tx_seq_num[63:0] -(37)variables.tx_seq_num[63:0] -(38)variables.tx_seq_num[63:0] -(39)variables.tx_seq_num[63:0] -(40)variables.tx_seq_num[63:0] -(41)variables.tx_seq_num[63:0] -(42)variables.tx_seq_num[63:0] -(43)variables.tx_seq_num[63:0] -(44)variables.tx_seq_num[63:0] -(45)variables.tx_seq_num[63:0] -(46)variables.tx_seq_num[63:0] -(47)variables.tx_seq_num[63:0] -(48)variables.tx_seq_num[63:0] -(49)variables.tx_seq_num[63:0] -(50)variables.tx_seq_num[63:0] -(51)variables.tx_seq_num[63:0] -(52)variables.tx_seq_num[63:0] -(53)variables.tx_seq_num[63:0] -(54)variables.tx_seq_num[63:0] -(55)variables.tx_seq_num[63:0] -(56)variables.tx_seq_num[63:0] -(57)variables.tx_seq_num[63:0] -(58)variables.tx_seq_num[63:0] -(59)variables.tx_seq_num[63:0] -(60)variables.tx_seq_num[63:0] -(61)variables.tx_seq_num[63:0] -(62)variables.tx_seq_num[63:0] -(63)variables.tx_seq_num[63:0] -@1401200 --group_end -@24 -variables.hw_frame[63:0] -variables.hw_subframe[63:0] -@28 -[color] 1 -functions.eNB_tx -functions.eNB_tx_sleep -[color] 7 -functions.trx_read -[color] 3 -functions.trx_write_rf -@24 -variables.txcnt[63:0] -variables.pck_tx[63:0] -variables.tx_ts[63:0] -@25 -variables.rx_seq_num_prv[63:0] -@24 -variables.rx_seq_num[63:0] -variables.hw_cnt_rx[63:0] -variables.lhw_cnt_rx[63:0] -[color] 3 -variables.cnt[63:0] -[pattern_trace] 1 -[pattern_trace] 0 diff --git a/targets/RT/USER/rrh_gw.c b/targets/RT/USER/rrh_gw.c deleted file mode 100644 index 7aea0484be466aacab2783c4078e1552622970cc..0000000000000000000000000000000000000000 --- a/targets/RT/USER/rrh_gw.c +++ /dev/null @@ -1,460 +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 rrh_gw.h - * \brief top-level for the remote radio head gateway (RRH_gw) module reusing the ethernet library - * \author Navid Nikaein, Katerina Trilyraki, Raymond Knopp - * \date 2015 - * \version 0.1 - * \company Eurecom - * \maintainer: navid.nikaein@eurecom.fr - * \note - * \warning very experimental - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <signal.h> -#include <execinfo.h> -#include <unistd.h> -#include <sys/socket.h> -#include <arpa/inet.h> -#include <net/if.h> -#include <time.h> - -#include "common_lib.h" -#include "rrh_gw.h" -#include "rt_wrapper.h" -#include "rrh_gw_externs.h" - - -#include "log_if.h" -#include "log_extern.h" -#include "vcd_signal_dumper.h" - -/***************************************************************************************** - * ---------- * - * ------- RRH_BBU_IF ------- RRH_RF_IF -------USRP - COTS_UE- * - * - BBU - --------------- - RRH - ------------- -------BLADERF ---------- * - * ------- ------- -------EXMIMO * - * --------- * - * -------ETH_IF - EMU_UE- * - * --------- * - *****************************************************************************************/ - - -/* local IP/MAC address is detected*/ -char rrh_ip[20] = "0.0.0.0"; -unsigned char rrh_mac[20] = "0:0:0:0:0:0"; -int rrh_port = 50000; // has to be an option - -/* log */ -int16_t glog_level = LOG_DEBUG; -int16_t glog_verbosity = LOG_MED; -int16_t rrh_log_level = LOG_INFO; -int16_t rrh_log_verbosity = LOG_MED; -int16_t enb_log_level = LOG_INFO; -int16_t enb_log_verbosity = LOG_MED; -int16_t ue_log_level = LOG_INFO; -int16_t ue_log_verbosity = LOG_MED; - - -/* flag definitions */ -uint8_t eNB_flag=0; -uint8_t UE_flag=0; -uint8_t EXMIMO_flag=0; -uint8_t USRP_flag=0; -uint8_t RT_flag=0, NRT_flag=1; -uint8_t rrh_exit=0; -uint8_t loopback_flag=0; -uint8_t measurements_flag=0; - -/* Default operation as RRH: - - there are neither eNB nor UE modules - - no RF hardware is specified (NONE_IF) - - default ethernet interface is local */ -uint8_t num_eNB_mod=0; -uint8_t num_UE_mod=0; -char* if_name="lo"; -uint8_t eth_mode=ETH_UDP_MODE; - -rrh_module_t *enb_array; -rrh_module_t *ue_array; - -openair0_vtimestamp hw_counter=0; - -char rf_config_file[1024]; - -static void debug_init(void); -static void get_options(int argc, char *argv[]); -static void print_help(void); - -/*!\fn static rrh_module_t new_module(unsigned int id); -* \brief creation of a eNB/UE module -* \param[in] module id -* \return module -* \note -* @ingroup _oai -*/ -static rrh_module_t new_module(unsigned int id); - -/*!\fn static int get_address(char* if_name, uint8_t flag); - * \brief retrieves IP address from the specified network interface - * \param[in] name of network interface - * \return 0 - * \note - * @ingroup _oai - */ -static int get_address(char* if_name, uint8_t flag); - - - - - -int main(int argc, char **argv) { - - unsigned int i; - rf_config_file[0]='\0'; - /* parse input arguments */ - get_options(argc, argv); - /* initialize logger and signal analyzer */ - debug_init(); - /* */ - set_latency_target(); - /* make a graceful exit when ctrl-c is pressed */ - signal(SIGSEGV, signal_handler); - signal(SIGINT, signal_handler); - - /* create modules based on input arguments */ - if (eNB_flag==1){ - enb_array=(rrh_module_t*)malloc(num_eNB_mod*sizeof(rrh_module_t)); - for(i=0;i<num_eNB_mod;i++){ - enb_array[i]=new_module(i);//enb_array[i]=new_module(i, get_RF_interfaces(&hardware_target)); - config_BBU_mod(&enb_array[i],RT_flag,NRT_flag); - LOG_I(RRH,"[eNB %d] module(s) created (out of %u) \n",i,num_eNB_mod); - } - } - if (UE_flag==1){ - ue_array=(rrh_module_t*)malloc(num_UE_mod*sizeof(rrh_module_t)); - for(i=0;i<num_UE_mod;i++){ - ue_array[i]=new_module(i); - config_UE_mod(&ue_array[i],RT_flag,NRT_flag); - LOG_I(RRH,"[UE %d] module(s) created (out of %u)\n",i, num_UE_mod); - } - } - - printf("TYPE <CTRL-C> TO TERMINATE\n"); - - while (rrh_exit==0) - sleep(1); - - return EXIT_SUCCESS; -} - - -static rrh_module_t new_module (unsigned int id) { - - rrh_module_t rrh_mod; - openair0_config_t openair0_cfg; - - rrh_mod.id=id; - rrh_mod.loopback=loopback_flag; - rrh_mod.measurements=measurements_flag; - - /* each module is associated with an ethernet device */ - rrh_mod.eth_dev.type=NONE_DEV; - rrh_mod.eth_dev.transp_type=NONE_TP; - /* ethernet device is functioning within RRH */ - rrh_mod.eth_dev.host_type=RRH_HOST; - /* */ - rrh_mod.eth_dev.openair0_cfg = (openair0_config_t*)malloc(sizeof(openair0_config_t)); - memset(rrh_mod.eth_dev.openair0_cfg,0,sizeof(openair0_config_t)); - /* get IP and MAC address */ - get_address(if_name,eth_mode); - - if(eth_mode==ETH_UDP_MODE) { - openair0_cfg.my_addr = &rrh_ip[0]; - openair0_cfg.my_port = rrh_port; - LOG_I(RRH,"UDP mode selected for ethernet.\n"); - } else if (eth_mode==ETH_RAW_MODE) { - openair0_cfg.my_addr = (char*)&rrh_mac[0]; - openair0_cfg.my_port = rrh_port; - LOG_I(RRH,"RAW mode selected for ethernet.\n"); - } - - /* */ - eth_params_t *eth_params = (eth_params_t*)malloc(sizeof(eth_params_t)); - memset(eth_params, 0, sizeof(eth_params_t)); - eth_params->local_if_name = if_name; - eth_params->transp_preference = eth_mode; - - /* ethernet device initialization */ - if (openair0_transport_load(&rrh_mod.eth_dev, &openair0_cfg,eth_params)<0) { - LOG_E(RRH,"Exiting, cannot initialize ethernet interface.\n"); - exit(-1); - } - - /* allocate space and specify associated RF device */ - openair0_device *oai_dv = (openair0_device *)malloc(sizeof(openair0_device)); - memset(oai_dv,0,sizeof(openair0_device)); - - rrh_mod.devs=oai_dv; - rrh_mod.devs->type=NONE_DEV; - rrh_mod.devs->transp_type=NONE_TP; - rrh_mod.devs->host_type=RRH_HOST; - - return rrh_mod; -} - -static void debug_init(void) { - - /* log initialization */ - logInit(); - set_glog(glog_level, glog_verbosity); - - set_comp_log(RRH, rrh_log_level, rrh_log_verbosity, 1); - //set_comp_log(ENB_LOG, enb_log_level, enb_log_verbosity, 1); - //set_comp_log(UE_LOG, ue_log_level, ue_log_verbosity, 1); - - /* vcd initialization */ - if (ouput_vcd) { - vcd_signal_dumper_init("/tmp/openair_dump_rrh.vcd"); - - } -} - - -static void get_options(int argc, char *argv[]) { - - int opt; - - while ((opt = getopt(argc, argv, "xvhlte:n:u:g:r:m:i:f:")) != -1) { - - switch (opt) { - case 'n': - eNB_flag=1; - num_eNB_mod=atoi(optarg); - break; - case 'u': - UE_flag=1; - num_UE_mod=atoi(optarg); - break; - case 'g': - glog_level=atoi(optarg); - break; - case 'i': - if (optarg) { - if_name=strdup(optarg); - printf("RRH interface name is set to %s\n", if_name); - } - break; - case 'm': - eth_mode=atoi(optarg); - break; - case 'r': - //rrh_log_level=atoi(optarg); - break; - case 'e': - //enb_log_level=atoi(optarg); - break; - case 'x': - rt_period = DEFAULT_PERIOD_NS; - RT_flag=1; - NRT_flag=0; - break; - case 'v': - /* extern from vcd */ - ouput_vcd=1; - break; - case 'l': - /*In loopback mode rrh sends back to bbu what it receives*/ - loopback_flag=1; - break; - case 'f': - if (optarg){ - if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) { - printf("no configuration filename is provided\n"); - } - else if (strlen(optarg)<=1024){ - // rf_config_file = strdup(optarg); - strcpy(rf_config_file,optarg); - }else { - printf("Configuration filename is too long\n"); - exit(-1); - } - } - break; - case 't': - /* When measurements are enabled statistics related to TX/RX time are printed */ - measurements_flag=1; - break; - case 'h': - print_help(); - exit(-1); - default: /* '?' */ - //fprintf(stderr, "Usage: \n", argv[0]); - exit(-1); - } -} - -} - -static int get_address(char* if_name, uint8_t flag) { - - int fd; - struct ifreq ifr; - - fd = socket(AF_INET, SOCK_DGRAM, 0); - /* I want to get an IPv4 IP address */ - ifr.ifr_addr.sa_family = AF_INET; - /* I want IP address attached to "if_name" */ - strncpy(ifr.ifr_name, if_name, IFNAMSIZ-1); - - if (flag==ETH_UDP_MODE) { - if ( ioctl(fd, SIOCGIFADDR, &ifr)<0 ) { - perror("IOCTL:"); - exit(-1); - } - snprintf(&rrh_ip[0],20,"%s", inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)); - LOG_I(RRH,"%s: IP address: %s\n",if_name,rrh_ip); - } else if (flag==ETH_RAW_MODE) { - if ( ioctl(fd, SIOCGIFHWADDR, &ifr)<0 ) { - perror("IOCTL:"); - exit(-1); - } - ether_ntoa_r ((struct ether_addr *)ifr.ifr_hwaddr.sa_data, (char*)rrh_mac); - LOG_I(RRH,"%s: MAC address: %s\n",if_name,rrh_mac); - } - - close(fd); - return 0; -} - - -static void print_help(void) { - - puts("Usage: \n"); - puts(" sudo -E chrt 99 ./rrh -n1 -g6 -v -t -i lo -m1"); - puts("Options:\n"); - puts("\t -n create eNB module\n"); - puts("\t -u create UE module\n"); - puts("\t -g define global log level\n"); - puts("\t -i set the RRH interface (default lo)\n"); - puts("\t -m set ethernet mode to be used by RRH, valid options: (1:raw, 0:udp) \n"); - puts("\t -r define rrh log level\n"); - puts("\t -e define eNB log level\n"); - puts("\t -x enable real time bahaviour\n"); - puts("\t -v enable vcd dump\n"); - puts("\t -l enable loopback mode\n"); - puts("\t -t enable measurements\n"); - puts("\t -h display info\n"); - -} - - -void *timer_proc(void *arg) { - - timer_t timerid; - struct itimerspec *timer= (struct itimerspec *)arg ; // the timer data structure - struct itimerspec old_value; - - -#ifdef DEADLINE_SCHEDULER - struct sched_attr attr; - unsigned int flags = 0; - - attr.size = sizeof(attr); - attr.sched_flags = 0; - attr.sched_nice = 0; - attr.sched_priority = 0; - - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = (0.1 * 100) * 10000; // - attr.sched_deadline = rt_period-30000;//(0.1 * 100) * 10000; - attr.sched_period = rt_period;//(0.1 * 100) * 10000; // each TX/RX thread has, as a function of RT PERIOD ?? - - if (sched_setattr(0, &attr, flags) < 0 ) { - perror("[SCHED] timer thread: sched_setattr failed\n"); - exit(-1); - } -#endif - - if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1) { - fprintf (stderr, "couldn't create a timer\n"); - perror (NULL); - exit (EXIT_FAILURE); - } - - signal(SIGALRM, timer_signal_handler); - LOG_I(RRH,"Timer has started!\n"); - timer_settime (timerid, 0, timer, &old_value); - - while (!rrh_exit) { - sleep(1); - } - - timer_delete(timerid); - - return (0); -} - - -void timer_signal_handler(int sig) { - - if (sig == SIGALRM) { - pthread_mutex_lock(&timer_mutex); - hw_counter ++; - pthread_mutex_unlock(&timer_mutex); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_CNT, hw_counter);//USED ELSEWHERE - } -} - - -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 { - printf("trying to exit gracefully...\n"); - rrh_exit = 1; - } -} - -void exit_fun(const char* s) { - if (s != NULL) { - printf("%s %s() Exiting RRH: %s\n",__FILE__, __FUNCTION__, s); - } - rrh_exit = 1; - exit (-1); -} - - diff --git a/targets/RT/USER/rrh_gw.h b/targets/RT/USER/rrh_gw.h deleted file mode 100644 index 97ffa5a893fb25cbda241a57c4fa677b39032129..0000000000000000000000000000000000000000 --- a/targets/RT/USER/rrh_gw.h +++ /dev/null @@ -1,104 +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 rrh_gw.h - * \brief header file for remote radio head gateway (RRH_gw) module - * \author Navid Nikaein, Katerina Trilyraki, Raymond Knopp - * \date 2015 - * \version 0.1 - * \company Eurecom - * \maintainer: navid.nikaein@eurecom.fr - * \note - * \warning very experimental - */ - -#ifndef RRH_GW_H_ -#define RRH_GW_H_ - -#include "ethernet_lib.h" -#include "vcd_signal_dumper.h" -#include "assertions.h" - -#define DEFAULT_PERIOD_NS 200000 /* default value is calculated for 25 PRB */ -#define RRH_UE_PORT 51000 -#define RRH_UE_DEST_IP "127.0.0.1" - -/*! \brief RRH supports two types of modules: eNB and UE - each module is associated with an ethernet device (device of ETH_IF) - and optionally with a RF device (device type can be USRP_B200/USRP_X300/BLADERF_IF/EXMIMO_IF/NONE_IF) - UE modules will always have RF device type NONE_IF */ -typedef struct { -/*! \brief module id */ - uint8_t id; -/*! \brief! loopback flag */ -uint8_t loopback; -/*! \brief measurement flag */ -uint8_t measurements; -/*! \brief module's ethernet device */ -openair0_device eth_dev; -/*! \brief pointer to RF module's device (pointer->since it's optional) */ -openair0_device *devs; -}rrh_module_t; - -/*! \fn void timer_signal_handler(int sig) - * \brief this function - * \param[in] signal type - * \return none - * \note - * @ingroup _oai -*/ -void timer_signal_handler(int); - -/*! \fn void *timer_proc(void *arg) - * \brief this function - * \param[in] - * \param[out] - * \return - * \note - * @ingroup _oai - */ -void *timer_proc(void *); - -/*! \fn void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag,uint8_t NRT_flag) - * \brief receive and apply configuration to modules' optional device - * \param[in] *mod_enb pointer to module - * \param[in] RT_flag real time flag - * \return none - * \note - * @ingroup _oai - */ -void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag); - -/*! \fn void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag,uint8_t NRT_flag) - * \brief this function - * \param[in] *mod_ue pointer to module - * \param[in] - * \return none - * \note - * @ingroup _oai - */ -void config_UE_mod( rrh_module_t *dev_ue, uint8_t RT_flag, uint8_t NRT_flag); - - - -void signal_handler(int sig); - -#endif diff --git a/targets/RT/USER/rrh_gw_externs.h b/targets/RT/USER/rrh_gw_externs.h deleted file mode 100644 index 0786743399630eda5240be1c44ab89365ad2be10..0000000000000000000000000000000000000000 --- a/targets/RT/USER/rrh_gw_externs.h +++ /dev/null @@ -1,48 +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 rrh_gw_extern.h - * \brief rrh gatewy external vars - * \author Navid Nikaein, Katerina Trilyraki, Raymond Knopp - * \date 2015 - * \version 0.1 - * \company Eurecom - * \maintainer: navid.nikaein@eurecom.fr - * \note - * \warning very experimental - */ - -#ifndef RRH_GW_EXTERNS_H_ -#define RRH_GW_EXTERNS_H_ -extern char rf_config_file[1024]; - -extern openair0_timestamp timestamp_UE_tx[4] ,timestamp_UE_rx[4] ,timestamp_eNB_rx[4],timestamp_eNB_tx[4]; -extern openair0_vtimestamp hw_counter; -extern int32_t UE_tx_started,UE_rx_started,eNB_rx_started ,eNB_tx_started; -extern int32_t nsamps_UE[4],nsamps_eNB[4]; -extern int32_t overflow_rx_buffer_eNB[4],overflow_rx_buffer_UE[4]; -extern uint8_t rrh_exit; -extern int32_t **rx_buffer_eNB, **rx_buffer_UE; -extern unsigned int rt_period; -extern pthread_mutex_t timer_mutex; - - -#endif diff --git a/targets/RT/USER/sleeptest.c b/targets/RT/USER/sleeptest.c deleted file mode 100644 index ba5cb0ce1551dfb56f3a8dc717b87ecadaa31412..0000000000000000000000000000000000000000 --- 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 ff65231df1d05622c4fbb559b1002ecdbfbb82fb..0000000000000000000000000000000000000000 --- 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 7de5f9382fc6577e919ed15381de13ddeebca7b1..ec5f5eb0ccb382c0e0e38420a3dccc68f4660fde 100644 --- a/targets/SIMU/USER/Makefile +++ b/targets/SIMU/USER/Makefile @@ -29,13 +29,12 @@ endif CFLAGS += -Wpointer-sign -CFLAGS += -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat +CFLAGS += -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 $(CPUFLAGS) -I/usr/include/X11 #-Wno-packed-bitfield-compat 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 += -DNEW_FFT +CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE +CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1 #CFLAGS += -DLLR8 CFLAGS += -DPACKAGE_NAME='"oaisim"' @@ -48,15 +47,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 @@ -141,8 +131,6 @@ CFLAGS += -DSTOP_ON_IP_TRAFFIC_OVERLOAD endif -ifeq ($(MIH_C_MEDIEVAL_EXTENSIONS), 1) -CFLAGS += -DMIH_C_MEDIEVAL_EXTENSIONS ifeq ($(USE_3GPP_ADDR_AS_LINK_ADDR), 1) CFLAGS += -DUSE_3GPP_ADDR_AS_LINK_ADDR endif @@ -179,7 +167,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_USE_CPU_EXECUTION_TIME ifndef DISABLE_XER_PRINT CFLAGS += -DXER_PRINT endif @@ -272,7 +260,7 @@ endif # Check if libpgm is installed and use it if found instead of the unreliable # multicast ifeq ($(PGM_FOUND), 1) -CFLAGS += $(PGM_CFLAGS) -DENABLE_PGM_TRANSPORT +CFLAGS += $(PGM_CFLAGS) LIBS += $(PGM_LIBS) endif diff --git a/targets/SIMU/USER/channel_sim.c b/targets/SIMU/USER/channel_sim.c index 91fc1cd0591934c539fc99ae893b41987beb2ff2..b31c47ba95d58f7d3f71fdce9510e3177f069aea 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 778f250a78756553dbbb2b9f8bae429abc595d04..ae139b797f74e374de0efdcae64bd5103b84612a 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(USER_MODE) && 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(USER_MODE) && 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 522f4147cebd44392442afe16ed24a6fde2606e5..7c752ce432f2b268cc7d11b2efd1f770a2c2482b 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 2939b30c0175f546c371e9e56179152e0d3a7c22..fc5f55032914228525f3c6d903eba69bae54b317 100755 --- a/targets/TEST/AT_COMMANDS/Makefile +++ b/targets/TEST/AT_COMMANDS/Makefile @@ -6,7 +6,7 @@ OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR3_TOP = $(OPENAIR3_DIR) OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 +CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES @@ -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/OAI/case01.py b/targets/TEST/OAI/case01.py index cdc3bd9eb48d1c90459118eadb206f0ddfbe0227..9595f7e35d0b2103ff10fe8c168506ed2d66a193 100644 --- a/targets/TEST/OAI/case01.py +++ b/targets/TEST/OAI/case01.py @@ -246,7 +246,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout): log.start() test = '14' name = 'Compile oai.rel8.itti.ral.make' - conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1' + conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1' trace = logdir + '/log_' + case + test + '.txt;' tee = ' 2>&1 | tee ' + trace diag = 'check the compilation errors for ITTI Rel8' @@ -254,7 +254,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout): oai.send('make cleanall;') oai.send('make cleanasn1;') oai.send('rm -f ./oaisim.rel8.itti.ral.'+host) - oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1, timeout) + oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1 -j4' + tee, makerr1, timeout) oai.send('cp ./oaisim ./oaisim.rel8.itti.ral.'+host) except log.err, e: log.fail(case, test, name, conf, e.value, diag, logfile,trace) @@ -265,7 +265,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout): log.start() test = '15' name = 'Compile oai.rel10.itti.ral.make' - conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1' + conf = 'make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1' trace = logdir + '/log_' + case + test + '.txt;' tee = ' 2>&1 | tee ' + trace diag = 'check the compilation errors for ITTI Rel10' @@ -273,7 +273,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,timeout): oai.send('make cleanall;') oai.send('make cleanasn1;') oai.send('rm -f ./oaisim.rel10.itti.ral.'+host) - oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1, timeout) + oai.send_expect_false('make DISABLE_XER_PRINT=1 LINK_ENB_PDCP_TO_IP_DRIVER=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1 -j4' + tee, makerr1, timeout) oai.send('cp ./oaisim ./oaisim.rel10.itti.ral.'+host) except log.err, e: log.fail(case, test, name, conf, e.value, diag, logfile,trace) diff --git a/targets/TEST/PACKET_TRACER/Makefile b/targets/TEST/PACKET_TRACER/Makefile index 46fa86037ce67df98240d1b321cb76072ae00bf4..e7a4e70bf9318779c1c2af091f46d07f60254326 100755 --- a/targets/TEST/PACKET_TRACER/Makefile +++ b/targets/TEST/PACKET_TRACER/Makefile @@ -6,21 +6,17 @@ OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR3_TOP = $(OPENAIR3_DIR) OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -m32 -DPHYSIM -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 +CFLAGS += -m32 -DPHYSIM -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 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 += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE +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 66af847af5ee7aeeea6dd0d1e2f10df1f75d0259..805cabe7cb53e2cb5af930e36c230acc6a5a6c6d 100755 --- a/targets/TEST/PDCP/Makefile +++ b/targets/TEST/PDCP/Makefile @@ -8,7 +8,7 @@ OPENAIR3 = $(OPENAIR3_DIR) EXE_FILE_NAME = test_pdcp -CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 +CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES @@ -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 00f07c1b928fdf7772b2baa00353209aa16522c2..d1397d3f4986c84b30a5d9cf639c2456ebfa17d0 100755 --- a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer +++ b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer @@ -8,7 +8,7 @@ OPENAIR3 = $(OPENAIR3_DIR) EXE_FILE_NAME = test_pdcp_rlc -CFLAGS += -m32 -DPHYSIM -DNODE_RG -DUSER_MODE -DPC_TARGET -DPC_DSP -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 +CFLAGS += -m32 -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DMAX_MODULES=1 -I/usr/include/X11 ASN1_MSG_INC = $(OPENAIR2_DIR)/RRC/LITE/MESSAGES @@ -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 9c807cd82654af0fa2487169e07516b6e64dbb6a..8884d7b667fc6eb96f14fcacd29960afa81966db 100755 --- a/targets/TEST/RLC_AM_V9.3.0/Makefile +++ b/targets/TEST/RLC_AM_V9.3.0/Makefile @@ -8,27 +8,18 @@ OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR3_TOP = $(OPENAIR3_DIR) OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -m32 -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 +CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 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 += -DNEW_FFT +CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE +CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1 #CFLAGS += -DLLR8 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 +105,7 @@ endif CFLAGS += $(shell if [ `uname -o` = "Cygwin" ] ; then echo "-DCYGWIN" ;fi) -CFLAGS += -DENABLE_FXP -DOAI_EMU -DENABLE_USE_CPU_EXECUTION_TIME +CFLAGS += -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 b01ea156f4f639a39d534435fe6f25d1dc2f481e..919def5f1e29680119a8fee96545d61802a8d69b 100755 --- a/targets/TEST/RLC_UM_V9.3.0/Makefile +++ b/targets/TEST/RLC_UM_V9.3.0/Makefile @@ -8,27 +8,18 @@ OPENAIR2_TOP = $(OPENAIR2_DIR) OPENAIR3_TOP = $(OPENAIR3_DIR) OPENAIR3 = $(OPENAIR3_DIR) -CFLAGS += -m32 -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 +CFLAGS += -m32 -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -I/usr/include/X11 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 += -DNEW_FFT +CFLAGS += -DOPENAIR_LTE #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE +CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 #-DRLC_UM_TEST_TRAFFIC=1 #CFLAGS += -DLLR8 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 +100,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_USE_CPU_EXECUTION_TIME ifneq ($(USE_MME), R8) UPDATE_RELEASE_9=1