From 615a56fff6412bd31b984a1cf69f9c3cdfca3ddd Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 29 Apr 2019 18:33:59 +0200 Subject: [PATCH] Remove deprecated build options, now available as config options: noS1, basic_simulator. Remove DISABLE_LOG_X macros, disabling logs now available via disabling the T_TRACER --- cmake_targets/CMakeLists.txt | 84 +---- cmake_targets/build_oai | 229 ++----------- common/utils/LOG/log.h | 6 +- openair1/PHY/INIT/lte_parms.c | 198 +++++------ .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 52 +-- openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c | 318 +++++++----------- openair2/ENB_APP/flexran_agent_common.c | 38 ++- openair2/LAYER2/MAC/ue_procedures.c | 7 +- 8 files changed, 270 insertions(+), 662 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 7ff9e11297..f578fccb38 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -247,10 +247,7 @@ add_boolean_option(T_TRACER True "Activate the T tracer, a debugging add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") -add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros") add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode") -#add_boolean_option(UE_NAS_USE_TUN False "Enable UE NAS TUN device instead of ue_ip.ko") -add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") @@ -2116,46 +2113,6 @@ target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CR target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) -# lte-softmodem-nos1 is both eNB and UE implementation -################################################### -add_executable(lte-softmodem-nos1 - ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c - ${OPENAIR_TARGETS}/RT/USER/lte-enb.c - ${OPENAIR_TARGETS}/RT/USER/lte-ru.c - ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c - ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c - ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c - ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/COMMON/create_tasks.c - ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c - ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c - ${OPENAIR_DIR}/common/utils/utils.c - ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} - ${XFORMS_SOURCE} - ${XFORMS_SOURCE_SOFTMODEM} - ${T_SOURCE} - ${CONFIG_SOURCES} - ${SHLIB_LOADER_SOURCES} - ) - -add_dependencies(lte-softmodem-nos1 rrc_flag s1ap_flag x2_flag) - -target_link_libraries (lte-softmodem-nos1 - -Wl,--start-group - RRC_LIB F1AP F1AP_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} LFDS7 - NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB - -Wl,--end-group z dl) - -target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 ${T_LIB}) # lte-uesoftmodem is UE implementation ####################################### @@ -2197,46 +2154,7 @@ target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${ target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${T_LIB}) -# lte-uesoftmodem-nos1 is UE implementation -################################################### -add_executable(lte-uesoftmodem-nos1 - ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c - ${OPENAIR_TARGETS}/RT/USER/lte-ue.c - ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c - ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c - ${OPENAIR_TARGETS}/RT/USER/lte-ru.c - ${OPENAIR_TARGETS}/RT/USER/rfsim.c - ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c - ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c - ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c - ${OPENAIR2_DIR}/RRC/NAS/nas_config.c - ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c - ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c - ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c - ${OPENAIR_DIR}/common/utils/utils.c - ${OPENAIR_DIR}/common/utils/system.c - ${XFORMS_SOURCE} - ${XFORMS_SOURCE_SOFTMODEM} - ${T_SOURCE} - ${CONFIG_SOURCES} - ${SHLIB_LOADER_SOURCES} - ) -add_dependencies(lte-uesoftmodem-nos1 rrc_flag s1ap_flag x2_flag) - -target_link_libraries (lte-uesoftmodem-nos1 - -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB F1AP F1AP_LIB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE SIMU - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} - NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB - -Wl,--end-group z dl) - -target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) -target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES}) -target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB}) # USIM process ################# #add_executable(usim @@ -2356,7 +2274,7 @@ endforeach(myExe) if (${T_TRACER}) foreach(i #all "add_executable" definitions (except tests, rb_tool, updatefw) - lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1 + lte-softmodem lte-uesoftmodem dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim ulsim cu_test du_test #all "add_library" definitions diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 9d8a609671..74627d620d 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -52,7 +52,6 @@ CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False REL="Rel14" HW="None" TP="None" -NOS1=0 EPC=0 VERBOSE_COMPILE=0 CFLAGS_PROCESSOR_USER="" @@ -66,10 +65,8 @@ CMAKE_CMD="$CMAKE" UE_AUTOTEST_TRACE="False" UE_DEBUG_TRACE="False" UE_TIMING_TRACE="False" -DISABLE_LOG_X="False" USRP_REC_PLAY="False" BUILD_ECLIPSE=0 -UE_NAS_USE_TUN="False" BASIC_SIMULATOR=0 trap handle_ctrl_c INT @@ -130,8 +127,6 @@ Options --install-system-files Install OpenArInterface required files in Linux system (will ask root password) ---noS1 - Compiles lte-softmodem without S1 interface, using direct link to IP instead --verbose-compile Shows detailed compilation instructions in makefile --cflags_processor @@ -154,8 +149,6 @@ Options Enable traces for UE debugging --ue-timing Enable traces for timing ---disable-log - Disable all LOG_* macros --build-eclipse Build eclipse project files. Paths are auto corrected by fixprj.sh --build-telnet @@ -164,8 +157,6 @@ Options Build MSC tracing utility, specify --msc on command line to start it (eNB and UE) --usrp-recplay Build for I/Q record-playback modes ---ue-nas-use-tun - Use TUN devices for the UEs instead of ue_ip.ko --basic-simulator Generates a basic [1 UE + 1 eNB + no channel] simulator. See targets/ARCH/tcp_bridge/README.tcp_bridge_oai for documentation. @@ -294,10 +285,6 @@ function main() { INSTALL_SYSTEM_FILES=1 echo_info "Will copy OpenAirInterface files in Linux directories" shift;; - --noS1) - NOS1=1 - echo_info "Will compile without S1 interface" - shift;; --verbose-compile) VERBOSE_COMPILE=1 echo_info "Will compile with verbose instructions" @@ -340,11 +327,7 @@ function main() { shift 1;; --ue-timing) UE_TIMING_TRACE="True" - echo_info "Enabling UE timing trace" - shift 1;; - --disable-log) - DISABLE_LOG_X="True" - echo_info "Disabling all LOG_* traces" + x echo_info "Enabling UE timing trace" shift 1;; --uhd-images-dir) UHD_IMAGES_DIR=$2 @@ -367,17 +350,13 @@ function main() { USRP_REC_PLAY="True" echo_info "Enabling USRP record playback mode" shift 1;; - --ue-nas-use-tun) - UE_NAS_USE_TUN="True" - echo_info "Enabling UE NAS TUN device usage instead of ue_ip.ko" - shift 1;; --basic-simulator) BASIC_SIMULATOR=1 - echo_info "Compiling the basic simulator" + echo_info "Compiling the basic simulator device" shift 1;; --rfsimulator) RFSIMULATOR=true - echo_info "Compiling the RF simulator" + echo_info "Compiling the RF simulator device" shift 1;; -h | --help) print_help @@ -504,15 +483,10 @@ function main() { if [ "$T_TRACER" = "False" ] ; then noLOGDirsuffix="_noLOG" fi - if [ "$NOS1" = "1" ] ; then - noS1Dir="_noS1" - bin_suffix="-nos1" - else - lte_build_dir=lte_build_oai - bin_suffix="" - fi + lte_build_dir=lte_build_oai + bin_suffix="" - lte_build_dir="lte${noS1Dir}_build_oai${noLOGDirsuffix}" + lte_build_dir="lte_build_oai${noLOGDirsuffix}" # configuration module libraries, one currently available, using libconfig config_libconfig_shlib=params_libconfig @@ -545,13 +519,7 @@ function main() { echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file - echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file - if [ "$UE" = 1 -a "$NOS1" = "0" ] ; then - echo_info "Compiling UE S1 build : enabling Linux and NETLINK" - echo "set (LINUX True )" >> $cmake_file - echo "set (PDCP_USE_NETLINK True )" >> $cmake_file - fi echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$lte_build_dir/build eval $CMAKE_CMD @@ -570,46 +538,41 @@ function main() { compilations \ $lte_build_dir coding \ libcoding.so $dbin/libcoding.so - - if [ "$NOS1" = "1" ] ; then - compilations \ - $lte_build_dir nasmesh \ - CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko - compilations \ - $lte_build_dir rb_tool \ - rb_tool $dbin/rb_tool - cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin - fi +# optional libs (used when noS1 with kernel modules + compilations \ + $lte_build_dir nasmesh \ + CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko + compilations \ + $lte_build_dir rb_tool \ + rb_tool $dbin/rb_tool + cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin fi if [ "$UE" = 1 ] ; then - lte_exec=lte-uesoftmodem${bin_suffix} - compilations \ - $lte_build_dir $lte_exec \ - $lte_exec $dbin/$lte_exec.$REL - - # mandatory shared lib - compilations \ - $lte_build_dir $config_libconfig_shlib \ - lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so - compilations \ - $lte_build_dir coding \ - libcoding.so $dbin/libcoding.so - - if [ "$NOS1" = "1" ] ; then - compilations \ - $lte_build_dir nasmesh \ - CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko - compilations \ - $lte_build_dir rb_tool \ - rb_tool $dbin/rb_tool - cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin - else - # ue_ip driver compilation - echo_info "Compiling UE specific part" + lte_exec=lte-uesoftmodem${bin_suffix} compilations \ - $lte_build_dir ue_ip \ - CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko + $lte_build_dir $lte_exec \ + $lte_exec $dbin/$lte_exec.$REL + + # mandatory shared lib + compilations \ + $lte_build_dir $config_libconfig_shlib \ + lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so + compilations \ + $lte_build_dir coding \ + libcoding.so $dbin/libcoding.so +# optional libs (used when noS1 with kernel modules + compilations \ + $lte_build_dir nasmesh \ + CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko + compilations \ + $lte_build_dir rb_tool \ + rb_tool $dbin/rb_tool + cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin + # ue_ip driver compilation + compilations \ + $lte_build_dir ue_ip \ + CMakeFiles/ue_ip/ue_ip.ko $dbin/ue_ip.ko # mkdir -p $DIR/at_commands/build # cd $DIR/at_commands/build @@ -644,7 +607,6 @@ function main() { echo_warning "not generated UE NAS files: binaries not found" fi fi - fi if [ "$SIMUS_PHY" = "1" -o "$SIMUS_CORE" = "1" ] ; then cd $OPENAIR_DIR/cmake_targets/lte-simulators @@ -854,123 +816,6 @@ function main() { echo_info "10. Bypassing the Tests ..." fi - # basic simulator - ##################### - if [ "$BASIC_SIMULATOR" = "1" ]; then - echo_info "Build basic simulator" - [ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/basic_simulator - [ "$CLEAN" = "1" ] && rm -rf $OPENAIR_DIR/cmake_targets/nas_sim_tools/build - mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator - mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator/enb - mkdir -p $OPENAIR_DIR/cmake_targets/basic_simulator/ue - mkdir -p $OPENAIR_DIR/cmake_targets/nas_sim_tools/build - - # enb - - cmake_file=$OPENAIR_DIR/cmake_targets/basic_simulator/enb/CMakeLists.txt - echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file - echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file - echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file - echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file - echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file - echo "set ( XFORMS $XFORMS )" >> $cmake_file - echo "set ( RF_BOARD \"OAI_USRP\")" >> $cmake_file - echo "set ( TRANSP_PRO \"None\")" >> $cmake_file - echo "set(PACKAGE_NAME \"simulator_enb\")" >> $cmake_file - echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file - echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file - echo "set ( T_TRACER \"True\" )" >> $cmake_file - echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file - echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file - echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file - echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file - echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file - echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file - echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file - - echo_info "Build eNB" - echo_info "logs are in $dlog/basic_simulator_enb.txt" - set +e - { - cd $OPENAIR_DIR/cmake_targets/basic_simulator/enb - cmake . - make -j`nproc` lte-softmodem - make -j`nproc` coding params_libconfig tcp_bridge_oai - ln -sf libtcp_bridge_oai.so liboai_device.so - cd ../.. - } > $dlog/basic_simulator_enb.txt 2>&1 - set -e - if [ -s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/lte-softmodem -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libcoding.so -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libparams_libconfig.so -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/enb/libtcp_bridge_oai.so ] ; then - echo_success "eNB compiled" - check_warnings "$dlog/basic_simulator_enb.txt" - else - echo_error "eNB compilation failed" - exit 1 - fi - - # ue - - echo_info "Compile conf2uedata" - cd $OPENAIR_DIR/cmake_targets/nas_sim_tools/build - eval $CMAKE_CMD - compilations \ - nas_sim_tools conf2uedata \ - conf2uedata $dbin/conf2uedata - - cmake_file=$OPENAIR_DIR/cmake_targets/basic_simulator/ue/CMakeLists.txt - echo "cmake_minimum_required(VERSION 2.8)" > $cmake_file - echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file - echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file - echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file - echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file - echo "set ( XFORMS $XFORMS )" >> $cmake_file - echo "set ( RF_BOARD \"OAI_USRP\")" >> $cmake_file - echo "set ( TRANSP_PRO \"None\")" >> $cmake_file - echo "set(PACKAGE_NAME \"simulator_ue\")" >> $cmake_file - echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file - echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file - echo "set ( T_TRACER \"True\" )" >> $cmake_file - echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file - echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file - echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file - echo "set (DISABLE_LOG_X $DISABLE_LOG_X)" >> $cmake_file - echo "set (USRP_REC_PLAY $USRP_REC_PLAY)" >> $cmake_file - echo "set (LINUX True )" >> $cmake_file - echo "set (PDCP_USE_NETLINK True )" >> $cmake_file - echo "set (BASIC_SIMULATOR \"True\" )" >> $cmake_file -# echo "set (UE_NAS_USE_TUN \"True\" )" >> $cmake_file - echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file - - echo_info "Build UE" - echo_info "logs are in $dlog/basic_simulator_ue.txt" - set +e - { - cd $OPENAIR_DIR/cmake_targets/basic_simulator/ue - cmake . - make -j`nproc` lte-uesoftmodem - make -j`nproc` coding params_libconfig tcp_bridge_oai - ln -sf libtcp_bridge_oai.so liboai_device.so - cd ../.. - } > $dlog/basic_simulator_ue.txt 2>&1 - set -e - if [ -s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/lte-uesoftmodem -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libcoding.so -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libparams_libconfig.so -a \ - -s $OPENAIR_DIR/cmake_targets/basic_simulator/ue/libtcp_bridge_oai.so ] ; then - echo_success "UE compiled" - check_warnings "$dlog/basic_simulator_ue.txt" - else - echo_error "UE compilation failed" - exit 1 - fi - - echo_info "Generate UE SIM data" - $OPENAIR_DIR/targets/bin/conf2uedata -c $OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf -o $OPENAIR_DIR/cmake_targets/basic_simulator/ue - - fi } main "$@" diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index dea756a3ac..1c413d580e 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -481,10 +481,10 @@ static inline void printMeas(char *txt, Meas *M, int period) { M->iterations, M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5], M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]); -#if DISABLE_LOG_X - printf("%s",txt2); +#if T_TRACER + LOG_W(PHY,"%s",txt2); #else - LOG_W(PHY, "%s",txt2); + printf("%s",txt2); #endif } } diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c index 03f226c637..4d149c0026 100644 --- a/openair1/PHY/INIT/lte_parms.c +++ b/openair1/PHY/INIT/lte_parms.c @@ -22,33 +22,22 @@ #include "phy_init.h" #include "common/utils/LOG/log.h" -uint16_t dl_S_table_normal[10]={3,9,10,11,12,3,9,10,11,6}; -uint16_t dl_S_table_extended[10]={3,8,9,10,3,8,9,5,0,0}; +uint16_t dl_S_table_normal[10]= {3,9,10,11,12,3,9,10,11,6}; +uint16_t dl_S_table_extended[10]= {3,8,9,10,3,8,9,5,0,0}; void set_S_config(LTE_DL_FRAME_PARMS *fp) { - int X = fp->srsX; - fp->ul_symbols_in_S_subframe=(1+X); if ((fp->Ncp==EXTENDED) && (fp->tdd_config_S>7)) AssertFatal(1==0,"Illegal S subframe configuration for Extended Prefix mode\n"); fp->dl_symbols_in_S_subframe = (fp->Ncp==NORMAL)?dl_S_table_normal[fp->tdd_config_S] : dl_S_table_extended[fp->tdd_config_S]; - - } -int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) -{ - +int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) { uint8_t log2_osf; - -#if DISABLE_LOG_X - printf("Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); -#else LOG_I(PHY,"Initializing frame parms for N_RB_DL %d, Ncp %d, osf %d\n",frame_parms->N_RB_DL,frame_parms->Ncp,osf); -#endif if (frame_parms->Ncp==EXTENDED) { frame_parms->nb_prefix_samples0=512; @@ -58,125 +47,109 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) frame_parms->nb_prefix_samples0 = 160; frame_parms->nb_prefix_samples = 144; frame_parms->symbols_per_tti = 14; - } - switch(osf) { - case 1: - log2_osf = 0; - break; + case 1: + log2_osf = 0; + break; - case 2: - log2_osf = 1; - break; + case 2: + log2_osf = 1; + break; - case 4: - log2_osf = 2; - break; + case 4: + log2_osf = 2; + break; - case 8: - log2_osf = 3; - break; + case 8: + log2_osf = 3; + break; - case 16: - log2_osf = 4; - break; + case 16: + log2_osf = 4; + break; - default: - AssertFatal(1==0,"Illegal oversampling %d\n",osf); - + default: + AssertFatal(1==0,"Illegal oversampling %d\n",osf); } switch (frame_parms->N_RB_DL) { + case 100: + AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); - case 100: - AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); - + if (frame_parms->threequarter_fs) { + frame_parms->ofdm_symbol_size = 1536; + frame_parms->samples_per_tti = 23040; + frame_parms->first_carrier_offset = 1536-600; + frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2; + frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2; + } else { + frame_parms->ofdm_symbol_size = 2048; + frame_parms->samples_per_tti = 30720; + frame_parms->first_carrier_offset = 2048-600; + } - if (frame_parms->threequarter_fs) { + frame_parms->N_RBGS = 4; + frame_parms->N_RBG = 25; + break; + + case 75: + AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); frame_parms->ofdm_symbol_size = 1536; frame_parms->samples_per_tti = 23040; - frame_parms->first_carrier_offset = 1536-600; + frame_parms->first_carrier_offset = 1536-450; frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2; frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2; + frame_parms->N_RBGS = 4; + frame_parms->N_RBG = 25; + break; - } - else { - frame_parms->ofdm_symbol_size = 2048; - frame_parms->samples_per_tti = 30720; - frame_parms->first_carrier_offset = 2048-600; - } - frame_parms->N_RBGS = 4; - frame_parms->N_RBG = 25; - break; + case 50: + AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); + frame_parms->ofdm_symbol_size = 1024*osf; + frame_parms->samples_per_tti = 15360*osf; + frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300; + frame_parms->nb_prefix_samples>>=(1-log2_osf); + frame_parms->nb_prefix_samples0>>=(1-log2_osf); + frame_parms->N_RBGS = 3; + frame_parms->N_RBG = 17; + break; - case 75: - AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); + case 25: + AssertFatal(osf<=2,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); + frame_parms->ofdm_symbol_size = 512*osf; + frame_parms->samples_per_tti = 7680*osf; + frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150; + frame_parms->nb_prefix_samples>>=(2-log2_osf); + frame_parms->nb_prefix_samples0>>=(2-log2_osf); + frame_parms->N_RBGS = 2; + frame_parms->N_RBG = 13; + break; - frame_parms->ofdm_symbol_size = 1536; - frame_parms->samples_per_tti = 23040; - frame_parms->first_carrier_offset = 1536-450; - frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2; - frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2; - frame_parms->N_RBGS = 4; - frame_parms->N_RBG = 25; - break; + case 15: + frame_parms->ofdm_symbol_size = 256*osf; + frame_parms->samples_per_tti = 3840*osf; + frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90; + frame_parms->nb_prefix_samples>>=(3-log2_osf); + frame_parms->nb_prefix_samples0>>=(3-log2_osf); + frame_parms->N_RBGS = 2; + frame_parms->N_RBG = 8; + break; - case 50: - AssertFatal(osf==1,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); + case 6: + frame_parms->ofdm_symbol_size = 128*osf; + frame_parms->samples_per_tti = 1920*osf; + frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36; + frame_parms->nb_prefix_samples>>=(4-log2_osf); + frame_parms->nb_prefix_samples0>>=(4-log2_osf); + frame_parms->N_RBGS = 1; + frame_parms->N_RBG = 6; + break; - frame_parms->ofdm_symbol_size = 1024*osf; - frame_parms->samples_per_tti = 15360*osf; - frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300; - frame_parms->nb_prefix_samples>>=(1-log2_osf); - frame_parms->nb_prefix_samples0>>=(1-log2_osf); - frame_parms->N_RBGS = 3; - frame_parms->N_RBG = 17; - break; - - case 25: - AssertFatal(osf<=2,"Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL); - - - frame_parms->ofdm_symbol_size = 512*osf; - - - frame_parms->samples_per_tti = 7680*osf; - frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150; - frame_parms->nb_prefix_samples>>=(2-log2_osf); - frame_parms->nb_prefix_samples0>>=(2-log2_osf); - frame_parms->N_RBGS = 2; - frame_parms->N_RBG = 13; - - break; - - case 15: - frame_parms->ofdm_symbol_size = 256*osf; - frame_parms->samples_per_tti = 3840*osf; - frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90; - frame_parms->nb_prefix_samples>>=(3-log2_osf); - frame_parms->nb_prefix_samples0>>=(3-log2_osf); - frame_parms->N_RBGS = 2; - frame_parms->N_RBG = 8; - - break; - - case 6: - frame_parms->ofdm_symbol_size = 128*osf; - frame_parms->samples_per_tti = 1920*osf; - frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36; - frame_parms->nb_prefix_samples>>=(4-log2_osf); - frame_parms->nb_prefix_samples0>>=(4-log2_osf); - frame_parms->N_RBGS = 1; - frame_parms->N_RBG = 6; - - break; - - default: - AssertFatal(1==0,"Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms); - - break; + default: + AssertFatal(1==0,"Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms); + break; } LOG_I(PHY,"lte_parms.c: Setting N_RB_DL to %d, ofdm_symbol_size %d\n",frame_parms->N_RB_DL, frame_parms->ofdm_symbol_size); @@ -188,8 +161,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf) } -void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) -{ +void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) { LOG_I(PHY,"frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL); LOG_I(PHY,"frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL); LOG_I(PHY,"frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index aafd579899..9573f66f79 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -62,14 +62,6 @@ int16_t dlsch_demod_shift = 0; int16_t interf_unaw_shift = 13; -//#define DEBUG_HARQ - -//#define DEBUG_PHY 1 -//#define DEBUG_DLSCH_DEMOD 1 - -//#define DISABLE_LOG_X - -// [MCS][i_mod (0,1,2) = (2,4,6)] unsigned char offset_mumimo_llr_drange_fix=0; //inferference-free case unsigned char interf_unaw_shift_tm4_mcs[29]= {5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, @@ -379,14 +371,9 @@ int rx_pdsch(PHY_VARS_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,subframe,slot, - symbol,ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,subframe,slot,symbol, ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); #endif -#endif #if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif @@ -412,13 +399,7 @@ int rx_pdsch(PHY_VARS_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#endif -#endif -#if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif @@ -527,15 +508,8 @@ int rx_pdsch(PHY_VARS_UE *ue, #endif #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,subframe,slot,symbol,first_symbol_flag, - ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,subframe,slot,symbol,first_symbol_flag, ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#endif -#endif -#if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif @@ -758,16 +732,8 @@ int rx_pdsch(PHY_VARS_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level, - ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh, ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#endif -#endif - // MRC -#if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif @@ -840,13 +806,7 @@ int rx_pdsch(PHY_VARS_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#endif -#endif -#if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif //printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol); @@ -1210,11 +1170,7 @@ int rx_pdsch(PHY_VARS_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); -#if DISABLE_LOG_X - printf("[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#else LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); -#endif #endif // Please keep it: useful for debugging #if 0 @@ -1224,7 +1180,7 @@ int rx_pdsch(PHY_VARS_UE *ue, if(1) { #if 1 - LOG_M("rxdataF0.m" , "rxdataF0", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); + LOG_M("rxdataF0.m", "rxdataF0", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); //LOG_M("rxdataF1.m" , "rxdataF1", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); LOG_M("dl_ch_estimates00.m", "dl_ch_estimates00", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0],14*frame_parms->ofdm_symbol_size,1,1); //LOG_M("dl_ch_estimates01.m", "dl_ch_estimates01", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][1][0],14*frame_parms->ofdm_symbol_size,1,1); @@ -4767,8 +4723,7 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, dl_ch0+=12; rxF+=12; - } - else { // Odd number of RBs + } else { // Odd number of RBs for (rb=0; rbN_RB_DL>>1; rb++) { #ifdef DEBUG_DLSCH_DEMOD printf("dlch_ext %u\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); @@ -5811,8 +5766,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, dl_ch0+=12; rxF+=12; - } - else { // Odd number of RBs + } else { // Odd number of RBs for (rb=0; rbN_RB_DL>>1; rb++) { skip_half=0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c index aac636f07c..26ad1d24ef 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c @@ -45,61 +45,56 @@ extern openair0_config_t openair0_cfg[]; //#define DEBUG_INITIAL_SYNCH -int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) -{ - +int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) { uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; char phich_resource[6]; - #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",ue->Mod_id, ue->rx_offset); #endif for (l=0; lsymbols_per_tti/2; l++) { - slot_fep(ue, - l, - 0, - ue->rx_offset, - 0, - 1); + l, + 0, + ue->rx_offset, + 0, + 1); } + for (l=0; lsymbols_per_tti/2; l++) { - slot_fep(ue, - l, - 1, - ue->rx_offset, - 0, - 1); + l, + 1, + ue->rx_offset, + 0, + 1); } + slot_fep(ue, - 0, - 2, - ue->rx_offset, - 0, - 1); - + 0, + 2, + ue->rx_offset, + 0, + 1); lte_ue_measurements(ue, - ue->rx_offset, - 0, + ue->rx_offset, + 0, + 0, 0, - 0, 0); - if (ue->frame_parms.frame_type == TDD) { ue_rrc_measurements(ue, - 2, - 0); - } - else { + 2, + 0); + } else { ue_rrc_measurements(ue, - 0, - 0); + 0, + 0); } + #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE %d] RX RSSI %d dBm, digital (%d, %d) dB, linear (%d, %d), avg rx power %d dB (%d lin), RX gain %d dB\n", ue->Mod_id, @@ -111,7 +106,6 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) ue->measurements.rx_power_avg_dB[0], ue->measurements.rx_power_avg[0], ue->rx_total_gain_dB); - LOG_I(PHY,"[UE %d] N0 %d dBm digital (%d, %d) dB, linear (%d, %d), avg noise power %d dB (%d lin)\n", ue->Mod_id, ue->measurements.n0_power_tot_dBm, @@ -122,7 +116,6 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) ue->measurements.n0_power_avg_dB, ue->measurements.n0_power_avg); #endif - pbch_decoded = 0; for (frame_mod4=0; frame_mod4<4; frame_mod4++) { @@ -153,94 +146,85 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) } } - if (pbch_decoded) { - frame_parms->nb_antenna_ports_eNB = pbch_tx_ant; - // set initial transmission mode to 1 or 2 depending on number of detected TX antennas // openair_daq_vars.dlsch_transmission_mode = (pbch_tx_ant>1) ? 2 : 1; - - // flip byte endian on 24-bits for MIB // dummy = ue->pbch_vars[0]->decoded_output[0]; // ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2]; // ue->pbch_vars[0]->decoded_output[2] = dummy; - // now check for Bandwidth of Cell dummy = (ue->pbch_vars[0]->decoded_output[2]>>5)&7; switch (dummy) { + case 0 : + frame_parms->N_RB_DL = 6; + break; - case 0 : - frame_parms->N_RB_DL = 6; - break; + case 1 : + frame_parms->N_RB_DL = 15; + break; - case 1 : - frame_parms->N_RB_DL = 15; - break; + case 2 : + frame_parms->N_RB_DL = 25; + break; - case 2 : - frame_parms->N_RB_DL = 25; - break; + case 3 : + frame_parms->N_RB_DL = 50; + break; - case 3 : - frame_parms->N_RB_DL = 50; - break; + case 4 : + frame_parms->N_RB_DL = 75; + break; - case 4 : - frame_parms->N_RB_DL = 75; - break; + case 5: + frame_parms->N_RB_DL = 100; + break; - case 5: - frame_parms->N_RB_DL = 100; - break; - - default: - LOG_E(PHY,"[UE%d] Initial sync: PBCH decoding: Unknown N_RB_DL\n",ue->Mod_id); - return -1; - break; + default: + LOG_E(PHY,"[UE%d] Initial sync: PBCH decoding: Unknown N_RB_DL\n",ue->Mod_id); + return -1; + break; } - // now check for PHICH parameters frame_parms->phich_config_common.phich_duration = (PHICH_DURATION_t)((ue->pbch_vars[0]->decoded_output[2]>>4)&1); dummy = (ue->pbch_vars[0]->decoded_output[2]>>2)&3; switch (dummy) { - case 0: - frame_parms->phich_config_common.phich_resource = oneSixth; - sprintf(phich_resource,"1/6"); - break; + case 0: + frame_parms->phich_config_common.phich_resource = oneSixth; + sprintf(phich_resource,"1/6"); + break; - case 1: - frame_parms->phich_config_common.phich_resource = half; - sprintf(phich_resource,"1/2"); - break; + case 1: + frame_parms->phich_config_common.phich_resource = half; + sprintf(phich_resource,"1/2"); + break; - case 2: - frame_parms->phich_config_common.phich_resource = one; - sprintf(phich_resource,"1"); - break; + case 2: + frame_parms->phich_config_common.phich_resource = one; + sprintf(phich_resource,"1"); + break; - case 3: - frame_parms->phich_config_common.phich_resource = two; - sprintf(phich_resource,"2"); - break; + case 3: + frame_parms->phich_config_common.phich_resource = two; + sprintf(phich_resource,"2"); + break; - default: - LOG_E(PHY,"[UE%d] Initial sync: Unknown PHICH_DURATION\n",ue->Mod_id); - return -1; - break; + default: + LOG_E(PHY,"[UE%d] Initial sync: Unknown PHICH_DURATION\n",ue->Mod_id); + return -1; + break; } - for(int i=0; iproc.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; - - ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx; + for(int i=0; iproc.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; + ue->proc.proc_rxtx[i].frame_tx = ue->proc.proc_rxtx[0].frame_rx; } + #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully p %d, tx_ant %d, frame %d, N_RB_DL %d, phich_duration %d, phich_resource %s!\n", ue->Mod_id, @@ -255,16 +239,13 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) } else { return(-1); } - } char phich_string[13][4] = {"","1/6","","1/2","","","one","","","","","","two"}; char duplex_string[2][4] = {"FDD","TDD"}; char prefix_string[2][9] = {"NORMAL","EXTENDED"}; -int initial_sync(PHY_VARS_UE *ue, runmode_t mode) -{ - +int initial_sync(PHY_VARS_UE *ue, runmode_t mode) { int32_t sync_pos,sync_pos2,sync_pos_slot; int32_t metric_fdd_ncp=0,metric_fdd_ecp=0,metric_tdd_ncp=0,metric_tdd_ecp=0; uint8_t phase_fdd_ncp,phase_fdd_ecp,phase_tdd_ncp,phase_tdd_ecp; @@ -281,7 +262,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) frame_parms->Ncp=NORMAL; frame_parms->frame_type=FDD; frame_parms->nb_antenna_ports_eNB = 2; - init_frame_parms(frame_parms,1); /* LOG_M("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); @@ -300,9 +280,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d\n",ue->Mod_id,sync_pos,ue->common_vars.eNb_id); #endif - // SSS detection - // PSS is hypothesized in last symbol of first slot in Frame sync_pos_slot = (frame_parms->samples_per_tti>>1) - frame_parms->ofdm_symbol_size - frame_parms->nb_prefix_samples; @@ -326,7 +304,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); ret = pbch_detection(ue,mode); // LOG_M("rxdata2.m","rxd2",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); - #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"FDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n", frame_parms->Nid_cell,metric_fdd_ncp,phase_fdd_ncp,flip_fdd_ncp,ret); @@ -337,9 +314,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) #endif } - if (ret==-1) { - // Now FDD extended prefix frame_parms->Ncp=EXTENDED; frame_parms->frame_type=FDD; @@ -362,7 +337,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) if (((sync_pos2 - sync_pos_slot) >=0 ) && ((sync_pos2 - sync_pos_slot) < ((FRAME_LENGTH_COMPLEX_SAMPLES-frame_parms->samples_per_tti/2)))) { - rx_sss(ue,&metric_fdd_ecp,&flip_fdd_ecp,&phase_fdd_ecp); frame_parms->nushift = frame_parms->Nid_cell%6; @@ -413,11 +387,9 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) frame_parms->nushift = frame_parms->Nid_cell%6; init_frame_parms(&ue->frame_parms,1); - lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); ret = pbch_detection(ue,mode); // LOG_M("rxdata4.m","rxd4",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); - #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"TDD Normal prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n", frame_parms->Nid_cell,metric_tdd_ncp,phase_tdd_ncp,flip_tdd_ncp,ret); @@ -427,7 +399,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) // Now TDD extended prefix frame_parms->Ncp=EXTENDED; frame_parms->frame_type=TDD; - frame_parms->tdd_config=1; + frame_parms->tdd_config=1; init_frame_parms(frame_parms,1); sync_pos2 = sync_pos - frame_parms->nb_prefix_samples; @@ -453,8 +425,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) init_frame_parms(&ue->frame_parms,1); lte_gold(frame_parms,ue->lte_gold_table[0],frame_parms->Nid_cell); ret = pbch_detection(ue,mode); - - // LOG_M("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); + // LOG_M("rxdata5.m","rxd5",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); #ifdef DEBUG_INITIAL_SYNCH LOG_I(PHY,"TDD Extended prefix: CellId %d metric %d, phase %d, flip %d, pbch %d\n", frame_parms->Nid_cell,metric_tdd_ecp,phase_tdd_ecp,flip_tdd_ecp,ret); @@ -464,104 +435,51 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) } /* Consider this is a false detection if the offset is > 1000 Hz */ - if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) ) - { - ret=-1; -#if DISABLE_LOG_X - printf("Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); -#else - LOG_E(HW, "Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); -#endif + if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) ) { + ret=-1; + LOG_E(HW, "Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); } if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters - - //#ifdef DEBUG_INITIAL_SYNCH -#if DISABLE_LOG_X - printf("[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset); -#else LOG_I(PHY, "[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset); -#endif - //#endif if (ue->UE_scan_carrier == 0) { - - #if UE_AUTOTEST_TRACE +#if UE_AUTOTEST_TRACE LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", - ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - ue->rx_offset, - ue->common_vars.freq_offset ); - #endif - -// send sync status to higher layers later when timing offset converge to target timing - + ue->Mod_id, + ue->proc.proc_rxtx[0].frame_rx, + ue->rx_offset, + ue->common_vars.freq_offset ); +#endif + // send sync status to higher layers later when timing offset converge to target timing generate_pcfich_reg_mapping(frame_parms); generate_phich_reg_mapping(frame_parms); - - ue->pbch_vars[0]->pdu_errors_conseq=0; - } -#if DISABLE_LOG_X - printf("[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rssi), - ue->rx_total_gain_dB, - ue->measurements.n0_power_tot_dBm, - 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, - (10*log10(ue->measurements.rsrq[0]))); - - - printf("[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n", - ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - duplex_string[ue->frame_parms.frame_type], - prefix_string[ue->frame_parms.Ncp], - ue->frame_parms.Nid_cell, - ue->frame_parms.N_RB_DL, - ue->frame_parms.phich_config_common.phich_duration, - phich_string[ue->frame_parms.phich_config_common.phich_resource], - ue->frame_parms.nb_antenna_ports_eNB); -#else LOG_I(PHY, "[UE %d] Frame %d RRC Measurements => rssi %3.1f dBm (dig %3.1f dB, gain %d), N0 %d dBm, rsrp %3.1f dBm/RE, rsrq %3.1f dB\n",ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rssi), - ue->rx_total_gain_dB, - ue->measurements.n0_power_tot_dBm, - 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, - (10*log10(ue->measurements.rsrq[0]))); - + ue->proc.proc_rxtx[0].frame_rx, + 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, + 10*log10(ue->measurements.rssi), + ue->rx_total_gain_dB, + ue->measurements.n0_power_tot_dBm, + 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, + (10*log10(ue->measurements.rsrq[0]))); LOG_I(PHY, "[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n", - ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - duplex_string[ue->frame_parms.frame_type], - prefix_string[ue->frame_parms.Ncp], - ue->frame_parms.Nid_cell, - ue->frame_parms.N_RB_DL, - ue->frame_parms.phich_config_common.phich_duration, - phich_string[ue->frame_parms.phich_config_common.phich_resource], - ue->frame_parms.nb_antenna_ports_eNB); -#endif - -#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) -# if DISABLE_LOG_X - printf("[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", - ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset, - ue->common_vars.freq_offset); -# else + ue->Mod_id, + ue->proc.proc_rxtx[0].frame_rx, + duplex_string[ue->frame_parms.frame_type], + prefix_string[ue->frame_parms.Ncp], + ue->frame_parms.Nid_cell, + ue->frame_parms.N_RB_DL, + ue->frame_parms.phich_config_common.phich_duration, + phich_string[ue->frame_parms.phich_config_common.phich_resource], + ue->frame_parms.nb_antenna_ports_eNB); LOG_I(PHY, "[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", - ue->Mod_id, - ue->proc.proc_rxtx[0].frame_rx, - openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset, - ue->common_vars.freq_offset); -# endif -#endif + ue->Mod_id, + ue->proc.proc_rxtx[0].frame_rx, + openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset, + ue->common_vars.freq_offset); } else { #ifdef DEBUG_INITIAL_SYNC LOG_I(PHY,"[UE%d] Initial sync : PBCH not ok\n",ue->Mod_id); @@ -575,12 +493,10 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) LOG_I(PHY,"[UE%d] Initial sync : Estimated Nid_cell %d, Frame_type %d\n",ue->Mod_id, frame_parms->Nid_cell,frame_parms->frame_type); #endif - ue->UE_mode[0] = NOT_SYNCHED; ue->pbch_vars[0]->pdu_errors_last=ue->pbch_vars[0]->pdu_errors; ue->pbch_vars[0]->pdu_errors++; ue->pbch_vars[0]->pdu_errors_conseq++; - } // gain control @@ -590,43 +506,35 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) // do a measurement on the best guess of the PSS for (aarx=0; aarxnb_antennas_rx; aarx++) rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2], - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); /* // do a measurement on the full frame for (aarx=0; aarxnb_antennas_rx; aarx++) rx_power += signal_energy(&ue->common_vars.rxdata[aarx][0], - frame_parms->samples_per_tti*10); + frame_parms->samples_per_tti*10); */ - // we might add a low-pass filter here later ue->measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx; - ue->measurements.rx_power_avg_dB[0] = dB_fixed(ue->measurements.rx_power_avg[0]); - #ifdef DEBUG_INITIAL_SYNCH - LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] ); + LOG_I(PHY,"[UE%d] Initial sync : Estimated power: %d dB\n",ue->Mod_id,ue->measurements.rx_power_avg_dB[0] ); #endif - #ifndef OAI_USRP #ifndef OAI_BLADERF #ifndef OAI_LMSSDR - phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); + phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0); #endif #endif #endif - - } - else { - + } else { #ifndef OAI_USRP #ifndef OAI_BLADERF #ifndef OAI_LMSSDR - phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); + phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0); #endif #endif #endif - } // exit_fun("debug exit"); diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 539c7f2a5c..88db41bbe3 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -127,7 +127,6 @@ int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessa hello_msg->bs_id = flexran_get_bs_id(mod_id); hello_msg->has_bs_id = 1; hello_msg->n_capabilities = flexran_get_capabilities(mod_id, &hello_msg->capabilities); - *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -296,15 +295,18 @@ int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { for (int i = 0; i < reply->n_cell_config; i++) { if (reply->cell_config[i]->mbsfn_subframe_config_rfoffset) free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); + if (reply->cell_config[i]->mbsfn_subframe_config_rfperiod) free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); - if (reply->cell_config[i]->mbsfn_subframe_config_sfalloc); + + if (reply->cell_config[i]->mbsfn_subframe_config_sfalloc) free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); if (reply->cell_config[i]->si_config) { for(int j = 0; j < reply->cell_config[i]->si_config->n_si_message; j++) { free(reply->cell_config[i]->si_config->si_message[j]); } + free(reply->cell_config[i]->si_config->si_message); free(reply->cell_config[i]->si_config); } @@ -319,6 +321,7 @@ int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { } free(reply->cell_config[i]->slice_config->dl); + for (int j = 0; j < reply->cell_config[i]->slice_config->n_ul; ++j) { if (reply->cell_config[i]->slice_config->ul[j]->n_sorting > 0) free(reply->cell_config[i]->slice_config->ul[j]->sorting); @@ -492,16 +495,15 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl goto error; lc_config_reply_msg->header = header; - /* the lc_config_reply entirely depends on MAC except for the * mac_eNB_get_rrc_status() function (which in the current OAI implementation * is reachable if F1 is present). Therefore we check here wether MAC CM is * present and the message gets properly filled if it is or remains empty if * not */ lc_config_reply_msg->n_lc_ue_config = - flexran_agent_get_mac_xface(mod_id) ? flexran_get_mac_num_ues(mod_id) : 0; - + flexran_agent_get_mac_xface(mod_id) ? flexran_get_mac_num_ues(mod_id) : 0; Protocol__FlexLcUeConfig **lc_ue_config = NULL; + if (lc_config_reply_msg->n_lc_ue_config > 0) { lc_ue_config = malloc(sizeof(Protocol__FlexLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); @@ -512,6 +514,7 @@ int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Fl // Fill the config for each UE for (int i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); + if (!lc_ue_config[i]) goto error; protocol__flex_lc_ue_config__init(lc_ue_config[i]); @@ -554,8 +557,7 @@ error: * ************************************ */ -int sort_ue_config(const void *a, const void *b) -{ +int sort_ue_config(const void *a, const void *b) { const Protocol__FlexUeConfig *fa = a; const Protocol__FlexUeConfig *fb = b; @@ -563,6 +565,7 @@ int sort_ue_config(const void *a, const void *b) return -1; else if (fa->rnti < fb->rnti) return 1; + return 0; } @@ -584,8 +587,8 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl goto error; ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = 0; + if (flexran_agent_get_rrc_xface(mod_id)) ue_config_reply_msg->n_ue_config = flexran_get_rrc_num_ues(mod_id); else if (flexran_agent_get_mac_xface(mod_id)) @@ -597,7 +600,7 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl const int nmac = flexran_get_mac_num_ues(mod_id); ue_config_reply_msg->n_ue_config = nrrc < nmac ? nrrc : nmac; LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %lu UEs\n", - __func__, nrrc, nmac, ue_config_reply_msg->n_ue_config); + __func__, nrrc, nmac, ue_config_reply_msg->n_ue_config); } Protocol__FlexUeConfig **ue_config; @@ -608,8 +611,10 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (ue_config == NULL) { goto error; } + rnti_t rntis[ue_config_reply_msg->n_ue_config]; flexran_get_rrc_rnti_list(mod_id, rntis, ue_config_reply_msg->n_ue_config); + for (int i = 0; i < ue_config_reply_msg->n_ue_config; i++) { const rnti_t rnti = rntis[i]; ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); @@ -617,11 +622,13 @@ int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Fl if (flexran_agent_get_rrc_xface(mod_id)) flexran_agent_fill_rrc_ue_config(mod_id, rnti, ue_config[i]); + if (flexran_agent_get_mac_xface(mod_id)) { const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); flexran_agent_fill_mac_ue_config(mod_id, UE_id, ue_config[i]); } } + ue_config_reply_msg->ue_config = ue_config; } @@ -725,14 +732,20 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F if(cell_conf == NULL) goto error; - for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++){ + + for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++) { cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); + if (!cell_conf[i]) goto error; + protocol__flex_cell_config__init(cell_conf[i]); + if (flexran_agent_get_phy_xface(mod_id)) flexran_agent_fill_phy_cell_config(mod_id, i, cell_conf[i]); + if (flexran_agent_get_rrc_xface(mod_id)) flexran_agent_fill_rrc_cell_config(mod_id, i, cell_conf[i]); + if (flexran_agent_get_mac_xface(mod_id)) flexran_agent_fill_mac_cell_config(mod_id, i, cell_conf[i]); @@ -804,10 +817,11 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot if (enb_config->n_cell_config > 1) LOG_W(FLEXRAN_AGENT, "ignoring slice configs for other cell except cell 0\n"); + if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) { prepare_update_slice_config(mod_id, enb_config->cell_config[0]->slice_config); - //} else { - // initiate_soft_restart(mod_id, enb_config->cell_config[0]); + //} else { + // initiate_soft_restart(mod_id, enb_config->cell_config[0]); } *msg = NULL; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 6561cbf625..4be98d590a 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -3329,7 +3329,7 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframeP) { - mac_rlc_status_resp_t rlc_status; //, rlc_status_data; + mac_rlc_status_resp_t rlc_status = {0,0,0,0,0}; //, rlc_status_data; uint32_t absSF = (frameP*10)+subframeP; UE_MAC_INST *ue = &UE_mac_inst[module_idP]; int rvtab[4] = {0,2,3,1}; @@ -3370,10 +3370,7 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ (ue->sltx_active == 1)) { // every 4th subframe, check for new data from RLC // 10 PRBs, mcs 19 int TBS = 4584/8; - int req; - - if (TBS <= rlc_status.bytes_in_buffer) req = TBS; - else req = rlc_status.bytes_in_buffer; + int req = (TBS <= rlc_status.bytes_in_buffer) ? TBS : rlc_status.bytes_in_buffer; if (req>0) { sdu_length = mac_rlc_data_req(module_idP,