diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index a0284edb71..c55fa766cc 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -404,26 +404,6 @@ pipeline { } } } - stage ("Test L2 simulator") { - when { - expression {doFullTestsuite} - } - steps { - lock (vmResource) { - script { - timeout (time: 30, unit: 'MINUTES') { - try { - gitlabCommitStatus(name: "Test L2-sim") { - sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } stage ("Destroy all Virtual Machines") { when { expression {doMandatoryTests} diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 19fac7fd78..6ef6b2e254 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -1033,116 +1033,6 @@ function report_test { echo " " >> ./test_simulator_results.html fi - ARCHIVES_LOC=archives/l2_sim/test - if [ -d $ARCHIVES_LOC ] - then - echo "

4G LTE L2-NFAPI Simulator Check

" >> ./test_simulator_results.html - - if [ -f $ARCHIVES_LOC/test_final_status.log ] - then - if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ] - then - echo "
" >> ./test_simulator_results.html - echo " TEST was SUCCESSFUL " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - else - echo "
" >> ./test_simulator_results.html - echo " TEST was a FAILURE! " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - else - echo "
" >> ./test_simulator_results.html - echo " COULD NOT DETERMINE TEST FINAL STATUS! " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - - echo " " >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - - EPC_CONFIGS=("wS1" "noS1") - TRANS_MODES=("fdd") - BW_CASES=(05) - NB_USERS=(01 04) - for CN_CONFIG in ${EPC_CONFIGS[@]} - do - for TMODE in ${TRANS_MODES[@]} - do - for BW in ${BW_CASES[@]} - do - for UES in ${NB_USERS[@]} - do - echo " " >> ./test_simulator_results.html - if [[ $CN_CONFIG =~ .*wS1.* ]] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log - UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"` - if [ -f $ENB_LOG ] && [ -f $UE_LOG ] - then - NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"` - NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` - NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` - NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG` - if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 2 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] - then - echo " " >> ./test_simulator_results.html - else - echo " " >> ./test_simulator_results.html - fi - echo " " >> ./test_simulator_results.html - echo " " >> ./test_simulator_results.html - fi - PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null` - analyzePingFiles - - IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null` - analyzeIperfFiles - - IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null` - analyzeIperfFiles - done - done - done - done - - echo "
Log File NameCommandStatusStatistics
Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)
$NAME_ENB --- $NAME_UEN/AOKKO
" >> ./test_simulator_results.html
-                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
-                    then
-                        echo "- eNB --> got sync" >> ./test_simulator_results.html
-                    else
-                        echo "- eNB NEVER got sync" >> ./test_simulator_results.html
-                    fi
-                    if [ $NB_UE_GOT_SYNC -gt 2 ]
-                    then
-                        echo "- UE --> got sync" >> ./test_simulator_results.html
-                    else
-                        echo "- UE NEVER got sync" >> ./test_simulator_results.html
-                    fi
-                    if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
-                    then
-                        echo "- UE attached to eNB" >> ./test_simulator_results.html
-                    else
-                        echo "- UE NEVER attached to eNB" >> ./test_simulator_results.html
-                    fi
-                    echo "        
" >> ./test_simulator_results.html - echo "
" >> ./test_simulator_results.html - fi - ARCHIVES_LOC=archives/phy_sim/test if [ -d $ARCHIVES_LOC ] then diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index de696cdc64..be25ab0e1a 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1472,13 +1472,18 @@ function run_test_on_vm { echo "############################################################" echo "OAI CI VM script" echo "############################################################" - if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] + if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] then - ENB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#enb-ethernet#" -e "s#rf-sim#enb-ethernet#"` + echo "This VM test type is no longer supported in the pipeline framework" + return + fi + if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] + then + ENB_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#enb-ethernet#"` ENB_VM_CMDS=${ENB_VM_NAME}_cmds.txt echo "ENB_VM_NAME = $ENB_VM_NAME" echo "ENB_VM_CMD_FILE = $ENB_VM_CMDS" - UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#ue-ethernet#" -e "s#rf-sim#ue-ethernet#"` + UE_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#ue-ethernet#"` UE_VM_CMDS=${UE_VM_NAME}_cmds.txt echo "UE_VM_NAME = $UE_VM_NAME" echo "UE_VM_CMD_FILE = $UE_VM_CMDS" @@ -1499,7 +1504,7 @@ function run_test_on_vm { echo "JENKINS_WKSP = $JENKINS_WKSP" echo "ARCHIVES_LOC = $ARCHIVES_LOC" - if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] + if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]] then echo "############################################################" echo "Waiting for ENB VM to be started" diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5a403721be..78d9499575 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1539,6 +1539,7 @@ set(NFAPI_USER_SRC ${NFAPI_USER_DIR}/nfapi.c ${NFAPI_USER_DIR}/nfapi_pnf.c ${NFAPI_USER_DIR}/nfapi_vnf.c + ${NFAPI_USER_DIR}/gnb_ind_vars.c ) add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC}) add_dependencies(NFAPI_USER_LIB rrc_flag) @@ -2068,6 +2069,7 @@ set(NR_L2_SRC_UE ${NR_UE_RRC_DIR}/L2_interface_ue.c ${NR_UE_RRC_DIR}/main_ue.c ${NR_UE_RRC_DIR}/rrc_UE.c + ${NR_UE_RRC_DIR}/rrc_nsa.c ) set (MAC_SRC @@ -3282,14 +3284,16 @@ add_executable(nr_dlsim ${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${NR_UE_RRC_DIR}/rrc_nsa.c ${NFAPI_USER_DIR}/nfapi.c ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c + ${PHY_INTERFACE_DIR}/queue.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_dlsim - -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3302,13 +3306,15 @@ add_executable(nr_prachsim ${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${NR_UE_RRC_DIR}/rrc_nsa.c ${NFAPI_USER_DIR}/nfapi.c ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c + ${PHY_INTERFACE_DIR}/queue.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim - -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl) add_executable(nr_ulschsim @@ -3317,6 +3323,7 @@ add_executable(nr_ulschsim ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c + ${PHY_INTERFACE_DIR}/queue.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -3335,13 +3342,15 @@ add_executable(nr_ulsim ${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${NR_UE_RRC_DIR}/rrc_nsa.c ${NFAPI_USER_DIR}/nfapi.c + ${PHY_INTERFACE_DIR}/queue.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} ) target_link_libraries(nr_ulsim - -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group + -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index ce3ada3972..6083d23580 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -426,7 +426,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0) # define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */ # define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0) -# define LOG_D(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) +# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) # define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0) # define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0) diff --git a/common/utils/utils.c b/common/utils/utils.c index 05e5fdf3a7..f0f3ddf8a7 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include #include "utils.h" void *calloc_or_fail(size_t size) { @@ -137,3 +140,32 @@ void *memcpy1(void *dst,const void *src,size_t n) { asm volatile("rep movsb" : "+D" (dst) : "c"(n), "S"(src) : "cc","memory"); return(ret); } + +void set_priority(int priority) +{ + /* When running with a realtime scheduler, a buggy run-away process can take + down the host requiring a reboot to recover. To avoid this scenario, we + use alarm(2) to set a maximum running time */ + unsigned max_runtime_seconds = 10 * 60; /* default */ + const char *env = getenv("MAX_RUNTIME_SECONDS"); + if (env != NULL) + { + max_runtime_seconds = atoi(env); + } + unsigned was_alarm = alarm(max_runtime_seconds); + /* Normally, was_alarm should be 0 indicating there was no previous alarm set. + A non-zero value could indicate a mistake */ + fprintf(stderr, "Set alarm for %u seconds, was %u (see $MAX_RUNTIME_SECONDS)\n", + max_runtime_seconds, was_alarm); + + struct sched_param param = + { + .sched_priority = priority, + }; + fprintf(stderr, "Calling sched_setscheduler(%d)\n", priority); + if (sched_setscheduler(0, SCHED_RR, ¶m) == -1) + { + fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno)); + abort(); + } +} diff --git a/common/utils/utils.h b/common/utils/utils.h index 9295ab7b54..d4337e71a6 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -19,6 +19,7 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz void *memcpy1(void *dst,const void *src,size_t n); +void set_priority(int priority); char *itoa(int i); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index f0817a9213..b4e541bcae 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -612,7 +612,32 @@ static void wait_nfapi_init(char *thread_name) { } void init_pdcp(void) { - //if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { + if (!get_softmodem_params()->nsa) { + if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { + //pdcp_layer_init(); + uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? + (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + + if (IS_SOFTMODEM_NOS1) { + printf("IS_SOFTMODEM_NOS1 option enabled \n"); + pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT; + } + + nr_pdcp_module_init(pdcp_initmask, 0); + + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + } else { + LOG_I(PDCP, "node is gNB \n"); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + } + } else { + LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); + } + } else if (get_softmodem_params()->nsa) { pdcp_layer_init(); uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; @@ -623,17 +648,12 @@ void init_pdcp(void) { } nr_pdcp_module_init(pdcp_initmask, 0); - - /*if (NODE_IS_CU(RC.rrc[0]->node_type)) { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); - } else {*/ pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); - //} - /*} else { + } else { + LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); - }*/ - + } } @@ -694,21 +714,22 @@ int main( int argc, char **argv ) { init_opt(); #ifdef PDCP_USE_NETLINK -if(!IS_SOFTMODEM_NOS1) - netlink_init(); + + if (!IS_SOFTMODEM_NOS1) { + netlink_init(); + if (get_softmodem_params()->nsa) { + init_pdcp(); + } + } #if defined(PDCP_USE_NETLINK_QUEUES) pdcp_netlink_init(); #endif #endif - #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" #endif LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); - if(!IS_SOFTMODEM_NOS1) - init_pdcp(); - if (RC.nb_nr_L1_inst > 0) RCconfig_NR_L1(); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index fd094770ea..2782f874c2 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -27,8 +27,8 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" +#include "executables/softmodem-common.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h" -//#include "executables/softmodem-common.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" @@ -191,7 +191,7 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_p free(rach_ind->pdu_list); free(rach_ind); } - LOG_I(NR_MAC, "Melissa, We have successfully filled the rach_ind queue with the recently filled rach ind\n"); + LOG_D(NR_MAC, "We have successfully filled the rach_ind queue with the recently filled rach ind\n"); } static bool sfn_slot_matcher(void *wanted, void *candidate) @@ -447,7 +447,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) int slot = NFAPI_SFNSLOT2SLOT(sfn_slot); nr_uplink_indication_t ul_info; int slots_per_frame = 20; //30 kHZ subcarrier spacing - int slot_ahead = 2; // Melissa lets make this dynamic + int slot_ahead = 2; // TODO: Make this dynamic ul_info.cc_id = CC_id; ul_info.gNB_index = gNB_id; ul_info.module_id = mod_id; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 9abcf1f3ce..fc72eb51dc 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -159,7 +159,6 @@ char uecap_xer[1024]; */ uint8_t abstraction_flag=0; -uint16_t ue_id_g; uint16_t ue_idx_standalone = 0xFFFF; /*---------------------BMC: timespec helpers -----------------------------*/ @@ -398,13 +397,11 @@ void init_pdcp(int ue_id) { if (IS_SOFTMODEM_NOKRNMOD) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; } - if (rlc_module_init(0) != 0) { + if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) { LOG_I(RLC, "Problem at RLC initiation \n"); } pdcp_layer_init(); nr_pdcp_module_init(pdcp_initmask, ue_id); - - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); } @@ -416,6 +413,13 @@ void *rrc_enb_process_msg(void *notUsed) { int main( int argc, char **argv ) { + set_priority(79); + if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) + { + fprintf(stderr, "mlockall: %s\n", strerror(errno)); + return EXIT_FAILURE; + } + //uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2; PHY_VARS_NR_UE *UE[MAX_NUM_CCs]; start_background_system(); @@ -463,14 +467,13 @@ int main( int argc, char **argv ) { uint16_t node_number = get_softmodem_params()->node_number; ue_id_g = (node_number == 0) ? 0 : node_number - 2; AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n"); - - if(node_number == 0) - { - init_pdcp(0); - } - else - { - init_pdcp(mode_offset + ue_id_g); + if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa || get_softmodem_params()->nsa) { + if(node_number == 0) { + init_pdcp(0); + } + else { + init_pdcp(mode_offset + ue_id_g); + } } NB_UE_INST=1; @@ -541,13 +544,6 @@ int main( int argc, char **argv ) { // wait for end of program printf("TYPE TO TERMINATE\n"); -#if 0 - if (create_tasks_nrue(1) < 0) { - printf("cannot create ITTI tasks\n"); - exit(-1); // need a softer mode - } -#endif - // Sleep a while before checking all parameters have been used // Some are used directly in external threads, asynchronously sleep(20); diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index d8d5427d5d..318fd6b008 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -209,10 +209,12 @@ void set_softmodem_sighandler(void) { act.sa_handler=signal_handler; sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact); // Disabled in order generate a core dump for analysis with gdb - // printf("Send signal %d to display resource usage...\n",SIGRTMIN+1); - // signal(SIGSEGV, signal_handler); - // signal(SIGINT, signal_handler); - // signal(SIGTERM, signal_handler); - // signal(SIGABRT, signal_handler); + # if 0 + printf("Send signal %d to display resource usage...\n",SIGRTMIN+1); + signal(SIGSEGV, signal_handler); + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + signal(SIGABRT, signal_handler); + #endif } diff --git a/nfapi/oai_integration/gnb_ind_vars.c b/nfapi/oai_integration/gnb_ind_vars.c new file mode 100644 index 0000000000..148c28a5c4 --- /dev/null +++ b/nfapi/oai_integration/gnb_ind_vars.c @@ -0,0 +1,7 @@ +#include "gnb_ind_vars.h" + +queue_t gnb_rach_ind_queue; +queue_t gnb_rx_ind_queue; +queue_t gnb_crc_ind_queue; +queue_t gnb_uci_ind_queue; +queue_t gnb_slot_ind_queue; diff --git a/nfapi/oai_integration/gnb_ind_vars.h b/nfapi/oai_integration/gnb_ind_vars.h new file mode 100644 index 0000000000..aff5baa7e4 --- /dev/null +++ b/nfapi/oai_integration/gnb_ind_vars.h @@ -0,0 +1,9 @@ +#pragma once + +#include "openair2/PHY_INTERFACE/queue.h" + +extern queue_t gnb_rach_ind_queue; +extern queue_t gnb_rx_ind_queue; +extern queue_t gnb_crc_ind_queue; +extern queue_t gnb_uci_ind_queue; +extern queue_t gnb_slot_ind_queue; diff --git a/nfapi/oai_integration/nfapi.c b/nfapi/oai_integration/nfapi.c index 3b14eaabd5..5e71c5e2a4 100644 --- a/nfapi/oai_integration/nfapi.c +++ b/nfapi/oai_integration/nfapi.c @@ -40,15 +40,9 @@ typedef struct { static nfapi_params_t nfapi_params = {0}; void set_thread_priority(int priority) { - //printf("%s(priority:%d)\n", __FUNCTION__, priority); + set_priority(priority); + pthread_attr_t ptAttr; - struct sched_param schedParam; - schedParam.__sched_priority = priority; //79; - - if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) { - printf("Failed to set scheduler to SCHED_RR\n"); - } - if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) { printf("Failed to set pthread sched policy SCHED_RR\n"); } diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index cabcebd415..3a59be41e9 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -218,14 +218,9 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) } void pnf_set_thread_priority(int priority) { + set_priority(priority); + pthread_attr_t ptAttr; - struct sched_param schedParam; - schedParam.__sched_priority = priority; - - if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) { - printf("failed to set SCHED_RR\n"); - } - if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) { printf("failed to set pthread SCHED_RR %d\n", errno); } diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index fb01064f09..b14553a40b 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -44,6 +44,7 @@ #include "common/ran_context.h" #include "openair2/PHY_INTERFACE/queue.h" +#include "gnb_ind_vars.h" #define TEST @@ -172,12 +173,6 @@ typedef struct { } vnf_info; -queue_t gnb_rach_ind_queue; -queue_t gnb_rx_ind_queue; -queue_t gnb_crc_ind_queue; -queue_t gnb_uci_ind_queue; -queue_t gnb_slot_ind_queue; - int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) { //NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n"); nfapi_tl_t *tlv = (nfapi_tl_t *)ve; diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index 42e4e5e6ed..fb1a713e56 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -3264,10 +3264,6 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7) struct timespec pselect_start; - struct timespec timeout; - timeout.tv_sec = 0; - timeout.tv_nsec = 500000; - struct timespec slot_duration; slot_duration.tv_sec = 0; slot_duration.tv_nsec = 0.5e6; @@ -3286,6 +3282,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7) struct timespec timeout; timeout.tv_sec = 100; timeout.tv_nsec = 0; + clock_gettime(CLOCK_MONOTONIC, &pselect_start); //setting the timeout diff --git a/nfapi/open-nFAPI/vnf/src/vnf_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_interface.c index 41a357ab34..633dd18f24 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_interface.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_interface.c @@ -1154,7 +1154,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy info->timing_window = 30; // This seems to override what gets set by the user - why??? //TODO: Change in NR in terms of microsecends,what should be the value? info->timing_info_mode = 0x03; - info->timing_info_period = 10; // Melissa come back to this + info->timing_info_period = 10; nfapi_vnf_phy_info_list_add(config, info); diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 21a1010cf9..308a059d51 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -553,14 +553,12 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { LTE_eNB_PRACH *const prach_vars_br = &eNB->prach_vars_br; int i, UE_id; - if (common_vars->txdataF) { - for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) { - if (i < fp->nb_antenna_ports_eNB || i == 5) { - free_and_zero(common_vars->txdataF[i]); - } + for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) { + if (i < fp->nb_antenna_ports_eNB || i == 5) { + free_and_zero(common_vars->txdataF[i]); + /* rxdataF[i] is not allocated -> don't free */ } } - /* rxdataF[i] is not allocated -> don't free */ free_and_zero(common_vars->txdataF); free_and_zero(common_vars->rxdataF); @@ -582,20 +580,14 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { free_and_zero(prach_vars->prachF); - if (prach_vars->prach_ifft[0]) { - for (i = 0; i < 64; i++) { - free_and_zero(prach_vars->prach_ifft[0][i]); - } - free_and_zero(prach_vars->prach_ifft[0]); - } + for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]); + + free_and_zero(prach_vars->prach_ifft[0]); for (int ce_level = 0; ce_level < 4; ce_level++) { - if (prach_vars_br->prach_ifft[ce_level]) { - for (i = 0; i < 64; i++) { - free_and_zero(prach_vars_br->prach_ifft[ce_level][i]); - } - free_and_zero(prach_vars_br->prach_ifft[ce_level]); - } + for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]); + + free_and_zero(prach_vars_br->prach_ifft[ce_level]); free_and_zero(prach_vars->rxsigF[ce_level]); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index bb943ebe23..80eb274812 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -429,22 +429,20 @@ void nr_processULSegment(void* arg) { if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { #ifdef PRINT_CRC_CHECK - LOG_I(PHY, "Segment %d CRC OK, iterations %d/%d\n",r,no_iteration_ldpc,max_ldpc_iterations); + LOG_I(PHY, "Segment %d CRC OK\n",r); #endif rdata->decodeIterations = no_iteration_ldpc; if (rdata->decodeIterations > p_decoderParms->numMaxIter) rdata->decodeIterations--; } else { -// #ifdef PRINT_CRC_CHECK +#ifdef PRINT_CRC_CHECK LOG_I(PHY, "CRC NOK\n"); -// #endif +#endif rdata->decodeIterations = max_ldpc_iterations + 1; } for (int m=0; m < Kr>>3; m ++) { ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m]; - //printf("%x ", ulsch_harq->c[r][m]); } - //printf("\n"); //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); } @@ -524,7 +522,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, A = (harq_process->TBS)<<3; - LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d, Coderate %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers, R); + LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); if (R<1024) Coderate = (float) R /(float) 1024; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 1dedcf8c27..f030c41d68 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -169,7 +169,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - printf("Inside nr_decode_pucch0. \n"); + int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; int soffset=(slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size; @@ -1103,7 +1103,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - printf("Inside nr_decode_pucch2. \n"); + int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; //pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c index 699c8af0fe..4b4637d7d2 100644 --- a/openair1/SCHED_NR/nr_prach_procedures.c +++ b/openair1/SCHED_NR/nr_prach_procedures.c @@ -51,8 +51,6 @@ extern uint8_t nfapi_mode; extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind); -/* Melissa, this is what fills the rach ind. It gets filled here in - the gNB. This is then sent to the proxy. */ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0}; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 42ed54c952..bd44a1e983 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -210,7 +210,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, /* - if ((cfg->subframe_config.duplex_mode.value == TDD) && + if ((cfg->subframe_config.duplex_mode.value == TDD) && ((nr_slot_select(fp,frame,slot)&NR_DOWNLINK_SLOT)==SF_DL)) return; // VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX,1); @@ -230,7 +230,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) { rdata->segment_r, ulsch_harq->processedSegments, rdata->nbSegments); gNB->nbDecode--; LOG_D(PHY,"remain to decoded in subframe: %d\n", gNB->nbDecode); - + if (decodeSuccess) { memcpy(ulsch_harq->b+rdata->offset, ulsch_harq->c[r], @@ -328,7 +328,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu; - + uint8_t l, number_dmrs_symbols = 0; uint32_t G; uint16_t start_symbol, number_symbols, nb_re_dmrs; @@ -350,7 +350,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs pusch_pdu->qam_mod_order, pusch_pdu->nrOfLayers); - + AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n", pusch_pdu->rb_size, number_symbols, diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index dcb1262a26..c402884ff9 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -94,7 +94,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response rx_ind->pdu_list[j].ul_cqi = 255; // scheduled_response->tx_request->tx_config.ul_cqi; char buffer[1024]; hexdump(rx_ind->pdu_list[j].pdu, rx_ind->pdu_list[j].pdu_length, buffer, sizeof(buffer)); - LOG_D(MAC, "Melissa Elkadi, this is hexdump of pdu %s before queuing rx_ind\n", + LOG_D(NR_MAC, "Hexdump of pdu %s before queuing rx_ind\n", buffer); } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 363ce60003..bf12fe4f39 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2179,7 +2179,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->prach_vars[gNB_id]->amp); if (ue->mac_enabled == 1) - nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); //Once rach is = 1, then call this + nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index 150165203e..953fb22885 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -99,11 +99,11 @@ int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ..., int ret; char ifname[64]; - if ( id > 0 ){ - sprintf(ifname, "oaitun_%.3s%d",ifprefix, id-1); + if (id > 0) { + sprintf(ifname, "oaitun_%.3s%d", ifprefix, id-1); } - else{ - sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons + else { + sprintf(ifname, "oaitun_%.3s1", ifprefix); // added "1": for historical reasons } nas_sock_mbms_fd = tun_alloc(ifname); diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 630a021588..b0ca06daec 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -220,7 +220,7 @@ typedef struct kenb_refresh_req_s { } kenb_refresh_req_t; typedef struct nsa_oai_tun_nsa_s { - uint8_t buffer[500]; //Melissa TODO + uint8_t buffer[500]; } nas_oai_tun_nsa_t; /* diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 5b1e1aab5b..49a415d9f0 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -206,8 +206,8 @@ void *gNB_app_task(void *args_p) configure_nr_rrc(gnb_id); } - if (RC.nb_nr_inst > 0) { - //init_pdcp(); + if (RC.nb_nr_inst > 0 && !get_softmodem_params()->nsa) { + init_pdcp(); } if (is_x2ap_enabled() ) { //&& !NODE_IS_DU(RC.rrc[0]->node_type) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index df1145c6a5..d647eff7cb 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -592,7 +592,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, eNB->frame, eNB->subframe, frameP, subframeP, delta); return; } - LOG_I(MAC, "Entering dlsch_ulsch scheduler %d.%d -> %d.%d = %d\n", + LOG_D(MAC, "Entering dlsch_ulsch scheduler %d.%d -> %d.%d = %d\n", eNB->frame, eNB->subframe, frameP, subframeP, delta); eNB->frame = frameP; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 05e9b44f77..5a49f122fb 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -421,7 +421,6 @@ uint16_t set_ra_rnti(NR_UE_MAC_INST_t *mac, fapi_nr_ul_config_prach_pdu *prach_p uint8_t s_id = prach_pdu->prach_start_symbol; ra->ra_rnti = 1 + s_id + 14 * t_id + 1120 * f_id + 8960 * ul_carrier_id; - //gNB: ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); LOG_D(MAC, "Computed ra_RNTI is %x \n", ra->ra_rnti); @@ -543,7 +542,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t lcid = UL_SCH_LCID_CCCH; uint8_t *payload; uint16_t size_sdu = 0; unsigned short post_padding; @@ -554,9 +552,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated; - uint8_t sdu_lcids[NB_RB_MAX] = {0}; uint16_t sdu_lengths[NB_RB_MAX] = {0}; - int num_sdus = 0; int offset = 0; int TBS_bytes = 848; int header_length_total=0; @@ -564,8 +560,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, // Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side if (!prach_resources->init_msg1) { - if ( (mac->common_configuration_complete>0 || get_softmodem_params()->do_ra==1 || get_softmodem_params()->nsa) && - ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150){ + if ((mac->common_configuration_complete > 0 || get_softmodem_params()->do_ra || get_softmodem_params()->nsa) && + ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150) { prach_resources->init_msg1 = 1; } else { LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame); @@ -574,7 +570,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } LOG_D(NR_MAC,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n", - frame,prach_resources->init_msg1,ra->ra_state,ra->RA_active); + frame, prach_resources->init_msg1, ra->ra_state, ra->RA_active); if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { @@ -586,9 +582,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, int TBS_max = 848; //8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); payload = (uint8_t*) mac->CCCH_pdu.payload; mac_ce_len = 0; - num_sdus = 1; post_padding = 1; - sdu_lcids[0] = lcid; // initialisation by RRC @@ -605,8 +599,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac_sdus[i] = (unsigned char) (lrand48()&0xff); } //Sending SDUs with size 1 - //Initialize elements of sdu_lcids and sdu_lengths - sdu_lcids[0] = lcid; + //Initialize elements of sdu_lengths sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len; header_length_total += 2 + (sdu_lengths[0] >= 128); size_sdu += sdu_lengths[0]; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 7e76e58d61..28a421fe83 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -589,7 +589,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE); else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs; - LOG_I(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); + LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); switch(dci_format){ case NR_UL_DCI_FORMAT_0_0: { @@ -3440,7 +3440,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, mac_subheader_len = 2; } - LOG_I(MAC, "Melissa Elkadi [UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len); + LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len); #if defined(ENABLE_MAC_PAYLOAD_DEBUG) LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); @@ -3633,8 +3633,6 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t return 0; } - int cc_id = dl_info->cc_id; - uint8_t gNB_id = dl_info->gNB_index; NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; uint8_t n_subPDUs = 0; // number of RAR payloads diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 256f5d6a7c..01fe4725f7 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1893,7 +1893,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu)); - ul_config->number_pdus += 1; //Melissa Elkadi come back here! + ul_config->number_pdus += 1; fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PRACH); LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index f3bd1cd864..956a76ddbb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -361,7 +361,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, const int bwp_id = 1; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc = gNB->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 7374ea5aaf..1e84199c89 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -288,6 +288,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP }else if (N_RA_slot <= 1) { //1 PRACH slot in a subframe slot_index = 0; } + UL_tti_req->SFN = frameP; UL_tti_req->Slot = slotP; for (int fdm_index=0; fdm_index < fdm; fdm_index++) { // one structure per frequency domain occasion diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 32e457a06d..7ac61ab923 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -140,7 +140,6 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t * } } - // Compute and write all MAC CEs and subheaders, and return number of written // bytes int nr_write_ce_dlsch_pdu(module_id_t module_idP, @@ -929,7 +928,7 @@ void nr_schedule_ue_spec(module_id_t module_id, const int coresetid = (bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; if (!pdcch_pdu) { - LOG_I(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); + LOG_D(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n"); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a6aeef2124..86524afe29 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1092,8 +1092,8 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - /* Melissa: according to nfapi_nr_interface_scf.h, harq_value = 0 is a pass - (check below was for harq_value == 1 in develop branch) */ + /* According to nfapi_nr_interface_scf.h, harq_value = 0 is a pass + (The check below was for harq_value == 1 in the develop branch) */ handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e62d1b0ea6..53995478b0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1522,6 +1522,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, sched_ctrl->tpc0); + /* PUSCH in a later slot, but corresponding DCI now! */ nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_pusch->slot]; AssertFatal(future_ul_tti_req->SFN == sched_pusch->frame diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 0f6892c2a3..5d52aa70ca 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1288,7 +1288,7 @@ pdcp_run ( // IP/NAS -> PDCP traffic : TX, read the pkt from the upper layer buffer // if (LINK_ENB_PDCP_TO_GTPV1U && ctxt_pP->enb_flag == ENB_FLAG_NO) { - if (!get_softmodem_params()->nsa) { + if (!get_softmodem_params()->nsa && (!EPC_MODE_ENABLED || ctxt_pP->enb_flag == ENB_FLAG_NO)) { pdcp_fifo_read_input_sdus(ctxt_pP); } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index eed4f04312..46abbba761 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -45,6 +45,7 @@ #include "LTE_MBMS-SessionInfoList-r9.h" #include "LTE_PMCH-InfoList-r9.h" + typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const, const srb_flag_t, const MBMS_flag_t, const rb_id_t, const mui_t, @@ -91,9 +92,6 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -// Global variable to identify each UE. Updated in main() of lte-uesoftmodem.c -//extern uint16_t ue_id_g; - extern uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; extern uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; extern uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 81d5c68f44..ed88dbcefe 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -89,7 +89,7 @@ extern struct msghdr nas_msg_rx; extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP); -uint16_t ue_id_g;// global variable to identify ue id for each ue. Change happens only in main function of lte-uesoftmodem.c +uint16_t ue_id_g; // Global variable to identify the ID for each UE. It is updated in main() of lte-uesoftmodem.c void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) { LOG_I(PDCP,"%s: \nPC5S message, header traffic_type: %d)\n", title, sl_pc5s_msg->pc5s_header.traffic_type); @@ -147,7 +147,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { nas_nlh_tx->nlmsg_len = sizeToWrite; ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); } // PDCP_USE_NETLINK - + AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) @@ -562,8 +562,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA, - (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.sourceL2Id, - (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.destinationL2Id + (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.sourceL2Id, + (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.destinationL2Id ); } else { /* else of h_rc == HASH_TABLE_OK */ MSC_LOG_RX_DISCARDED_MESSAGE( @@ -607,8 +607,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx pdcp_read_header_g.data_size, (unsigned char *)NLMSG_DATA(nas_nlh_rx), PDCP_TRANSMISSION_MODE_DATA, - (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.sourceL2Id, - (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.destinationL2Id + (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.sourceL2Id, + (NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL : &pdcp_read_header_g.destinationL2Id ); } /* rab_id == 0 */ } /*pdcp_read_state_g != 0 */ @@ -875,3 +875,4 @@ pdcp_pc5_socket_init() { exit(1); } } + diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index f25c43a5b1..8a56d5cf4b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -296,9 +296,6 @@ static void *ue_tun_read_thread(void *_) } LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); - char buffer[1024]; - hexdump(rx_buf, len, buffer, sizeof(buffer)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s from tunnel interface\n", buffer); nr_pdcp_manager_lock(nr_pdcp_ue_manager); rnti = nr_pdcp_get_first_rnti(nr_pdcp_ue_manager); @@ -416,19 +413,24 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id) nas_getparams(); if(UE_NAS_USE_TUN) { - /* Melissa TODO: Brute force changes made below to allow nr-UE to have unique tunnel interfaces. - When the NODE_NUMBER param is not used to determine functionality and LTE tunnel - interfaces, we should update the netlink_init_tun() and nas_config() calls below as well. */ int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1; netlink_init_tun("nrue", num_if, id); //Add --nr-ip-over-lte option check for next line - if (IS_SOFTMODEM_NOS1) + if (IS_SOFTMODEM_NOS1 && get_softmodem_params()->nsa) nas_config(1, 1, 3, "nrue"); + else if (IS_SOFTMODEM_NOS1) + nas_config(1, 1, 2, "ue"); LOG_I(PDCP, "UE pdcp will use tun interface\n"); start_pdcp_tun_ue(); } else if(ENB_NAS_USE_TUN) { - netlink_init_tun("gnb", 1, id); - nas_config(1, 1, 1, "gnb"); + if (get_softmodem_params()->nsa) { + netlink_init_tun("gnb", 1, id); + nas_config(1, 1, 1, "gnb"); + } + else { + netlink_init_tun("enb", 1, id); + nas_config(1, 1, 1, "enb"); + } LOG_I(PDCP, "ENB pdcp will use tun interface\n"); start_pdcp_tun_enb(); } else { @@ -860,7 +862,6 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } else { - LOG_I(PDCP, "%s:%d:%s: Melissa Elkadi, we will call deliver_sdu_drb\n", __FILE__, __LINE__, __FUNCTION__); pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap, has_sdapULheader,has_sdapDLheader, deliver_sdu_drb, ue, deliver_pdu_drb, ue, @@ -1232,10 +1233,7 @@ static boolean_t pdcp_data_req_drb( nr_pdcp_manager_unlock(nr_pdcp_ue_manager); return 0; } - char buffer[1024]; - hexdump((char *)sdu_buffer, sdu_buffer_size, buffer, sizeof(buffer)); - LOG_I(PDCP, "Melissa Elkadi in %s, this is hexdump of pdu %s from tunnel interface in PDCP layer\n", - __FUNCTION__, buffer); + rb->recv_sdu(rb, (char *)sdu_buffer, sdu_buffer_size, muiP); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index c3a0856e56..8db5ce31ad 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -204,7 +204,6 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) int so = 0; int bad_sdu = 0; - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); /* go to first segment of sn */ pdu = entity->rx_list; while (pdu->sn != sn) @@ -232,7 +231,6 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) return; /* deliver */ - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, sdu, so); @@ -246,16 +244,13 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) entity->rx_next_highest = (x + 1) % entity->sn_modulus; /* todo: room for optimization: we can run through rx_list only once */ - LOG_I(RLC, "Melissa Elkadi, checking if sdu_full is true %s()\n", __FUNCTION__); if (sdu_full(entity, x)) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); reassemble_and_deliver(entity, x); if (x == entity->rx_highest_status) { int rx_highest_status = entity->rx_highest_status; while (sdu_delivered(entity, rx_highest_status)) rx_highest_status = (rx_highest_status + 1) % entity->sn_modulus; - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); entity->rx_highest_status = rx_highest_status; } @@ -278,10 +273,8 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) entity->rx_next = rx_next; } } - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (entity->t_reassembly_start) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (entity->rx_next_status_trigger == entity->rx_next || (entity->rx_next_status_trigger == (entity->rx_next + 1) % entity->sn_modulus && @@ -294,7 +287,6 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) } if (entity->t_reassembly_start == 0) { - LOG_I(RLC, "Melissa Elkadi, we are in %s(): at %d\n", __FUNCTION__, __LINE__); if (sn_compare_rx(entity, entity->rx_next_highest, (entity->rx_next + 1) % entity->sn_modulus) > 0 || (entity->rx_next_highest == (entity->rx_next + 1) @@ -552,13 +544,9 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, int control_e2; int control_e3; unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */ - char buf_3[1024]; - hexdump(buffer, size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); + nr_rlc_pdu_decoder_init(&decoder, buffer, size); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); - LOG_I(RLC, "Melissa Elkadi, we are here %s(): %d. dc = %d\n", __FUNCTION__, __LINE__, dc); if (dc == 0) goto control; /* data PDU */ @@ -622,7 +610,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, entity->rx_list, pdu); /* do reception actions (38.322 5.2.3.2.3) */ - LOG_I(RLC, "Melissa Elkadi, we are calling reception_actions from %s()\n", __FUNCTION__); reception_actions(entity, pdu); if (p) { @@ -831,20 +818,9 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity, nr_rlc_pdu_encoder_put_bits(&encoder, 1, 1); /* D/C: 1 = data */ nr_rlc_pdu_encoder_put_bits(&encoder, 0, 1); /* P: reserve, set later */ - char buf_1[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_1, __FUNCTION__, __LINE__); + nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_first,1);/* 1st bit of SI */ - char buf_2[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_2, sizeof(buf_2)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_2, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_last,1); /* 2nd bit of SI */ - char buf_3[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); if (entity->sn_field_length == 18) nr_rlc_pdu_encoder_put_bits(&encoder, 0, 2); /* R */ @@ -860,10 +836,7 @@ static int serialize_sdu(nr_rlc_entity_am_t *entity, if (p) include_poll(entity, buffer); - char buf[1024]; - hexdump(buffer + encoder.byte, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling generate_pdu in %s\n", - buf, __FUNCTION__); + return encoder.byte + sdu->size; } @@ -1599,6 +1572,7 @@ int nr_rlc_entity_am_generate_pdu(nr_rlc_entity_t *_entity, if (ret != 0) return ret; } + return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index 2e09452f14..26ae481889 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -104,7 +104,6 @@ int nr_rlc_entity_tm_generate_pdu(nr_rlc_entity_t *_entity, char *buffer, int size) { nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity; - LOG_I(MAC, "Melissa Elkadi, in %s(): %d\n", __FUNCTION__, __LINE__); return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 07b2d7b9f3..71173eee5a 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -353,20 +353,9 @@ static int serialize_sdu(nr_rlc_entity_um_t *entity, /* generate header */ nr_rlc_pdu_encoder_init(&encoder, buffer, bufsize); - char buf_1[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_1, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_first,1);/* 1st bit of SI */ - char buf_2[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_2, sizeof(buf_2)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_2, __FUNCTION__, __LINE__); nr_rlc_pdu_encoder_put_bits(&encoder, 1-sdu->is_last,1); /* 2nd bit of SI */ - char buf_3[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_3, sizeof(buf_3)); - LOG_I(MAC, "Melissa Elkadi, %s in %s():%d\n", - buf_3, __FUNCTION__, __LINE__); + /* SN, if required */ if (sdu->is_first == 1 && sdu->is_last == 1) { nr_rlc_pdu_encoder_put_bits(&encoder, 0, 6); /* R */ @@ -380,23 +369,9 @@ static int serialize_sdu(nr_rlc_entity_um_t *entity, if (!sdu->is_first) nr_rlc_pdu_encoder_put_bits(&encoder, sdu->so, 16); /* SO */ - char buf_sdu[1024]; - hexdump(sdu->sdu->data, sdu->size, buf_sdu, sizeof(buf_sdu)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of sdu->data %s in %s\n", - buf_sdu, __FUNCTION__); - /* data */ memcpy(buffer + encoder.byte, sdu->sdu->data + sdu->so, sdu->size); - char buf_5[1024]; - hexdump(buffer, sdu->size, buf_5, sizeof(buf_5)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after memcpy of just buffer %s\n", - buf_5, __FUNCTION__); - - char buf[1024]; - hexdump(buffer + encoder.byte, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after memcpy sdu into buffer in %s\n", - buf, __FUNCTION__); return encoder.byte + sdu->size; } @@ -504,15 +479,9 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) /* update tx_next if the SDU is an SDU segment and is the last */ if (!sdu->is_first && sdu->is_last) entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus; - char buf[1024]; - hexdump(buffer, sdu->size, buf, sizeof(buf)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right before calling serialize_sdu in %s\n", - buf, __FUNCTION__); + ret = serialize_sdu(entity, sdu, buffer, size); - char buf_1[1024]; - hexdump(buffer, size, buf_1, sizeof(buf_1)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling serialize_sdu in %s\n", - buf_1, __FUNCTION__); + entity->tx_size -= sdu->size; nr_rlc_free_sdu_segment(sdu); @@ -554,7 +523,6 @@ int nr_rlc_entity_um_generate_pdu(nr_rlc_entity_t *_entity, char *buffer, int size) { nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; - LOG_I(MAC, "Melissa Elkadi, in %s(): %d\n", __FUNCTION__, __LINE__); return generate_tx_pdu(entity, buffer, size); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index a70e15cf17..0feb4cb2d4 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -218,10 +218,6 @@ tbs_size_t mac_rlc_data_req( rb->set_time(rb, nr_rlc_current_time); maxsize = tb_sizeP; ret = rb->generate_pdu(rb, buffer_pP, maxsize); - char buffer[1024]; - hexdump(buffer_pP, ret, buffer, sizeof(buffer)); - LOG_I(MAC, "Melissa Elkadi, this is hexdump of pdu %s right after calling generate_pdu in %s\n", - buffer, __FUNCTION__); } else { ret = 0; } @@ -515,7 +511,7 @@ rb_found: return; } } - LOG_I(PDCP, "Melissa Elkadi we are calling PDCP layer from RLC in %s\n", __FUNCTION__); + LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c index a5d2c90d5b..b42410ab72 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c @@ -106,16 +106,11 @@ void nr_rlc_pdu_decoder_init(nr_rlc_pdu_decoder_t *decoder, static int get_bit(nr_rlc_pdu_decoder_t *decoder) { int ret; - LOG_I(RLC, "Melissa Elkadi, in %s():. bytes = %d size = %d, bit %d, shifted bit %d \n", - __FUNCTION__, decoder->byte, decoder->size, decoder->bit, (7-decoder->bit)); + if (decoder->byte >= decoder->size) { decoder->error = 1; return 0; } - LOG_I(RLC, "Melissa Elkadi, in %s():. (%d >> (7 - decoder->bit)) & 1 = %d (returned val) \n", - __FUNCTION__, - decoder->buffer[decoder->byte], - ((decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1)); ret = (decoder->buffer[decoder->byte] >> (7 - decoder->bit)) & 1; diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index afc335f1bb..50d1bd6c92 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -37,6 +37,7 @@ #include "common/ran_context.h" #include "executables/softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" +#include "nfapi/oai_integration/gnb_ind_vars.h" #include "openair2/PHY_INTERFACE/queue.h" #define MAX_IF_MODULES 100 @@ -59,11 +60,6 @@ extern uint8_t nfapi_mode; extern uint16_t sf_ahead; extern uint16_t sl_ahead; -extern queue_t gnb_rach_ind_queue; -extern queue_t gnb_rx_ind_queue; -extern queue_t gnb_crc_ind_queue; -extern queue_t gnb_uci_ind_queue; - void handle_nr_rach(NR_UL_IND_t *UL_info) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 00d17d81bd..c3fc7ccf03 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -607,7 +607,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, nr_uplink_indication_t ul_info; memset(&ul_info, 0, sizeof(ul_info)); int slots_per_frame = 20; //30 kHZ subcarrier spacing - int slot_ahead = 2; // Melissa lets make this dynamic + int slot_ahead = 2; // TODO: Make this dynamic ul_info.frame_rx = frame; ul_info.slot_rx = slot; ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; @@ -617,6 +617,16 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, { nr_ue_ul_indication(&ul_info); } + + + #if 0 // TODO: Heap use after free caught by sanitizer + free(dl_info.dci_ind); + dl_info.dci_ind = NULL; + + free(dl_info.rx_ind); + dl_info.rx_ind = NULL; + #endif + } void save_nr_measurement_info(nfapi_nr_dl_tti_request_t *dl_tti_request) @@ -1074,7 +1084,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_inst[module_id]->current_frame = 0; nr_ue_if_module_inst[module_id]->current_slot = 0; nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request; - if (get_softmodem_params()->nsa) //Melissa, this is also a hack. Get a better flag. + if (get_softmodem_params()->nsa) //TODO: Get a better flag for using stub nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub; else nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response; diff --git a/openair2/PHY_INTERFACE/queue.c b/openair2/PHY_INTERFACE/queue.c index 8e263dcdca..c6e1fb6d2f 100644 --- a/openair2/PHY_INTERFACE/queue.c +++ b/openair2/PHY_INTERFACE/queue.c @@ -165,4 +165,4 @@ void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, v pthread_mutex_unlock(&q->mutex); return item; -} \ No newline at end of file +} diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index 33d76770aa..b1f2e6d9b3 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -2380,7 +2380,6 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin static void assign_scg_ConfigResponseNR_r15(LTE_RRCConnectionReconfigurationComplete_t *rrc, OCTET_STRING_t *str) { - /* Melissa TODO: Need to free this memory when we are done. */ LTE_RRCConnectionReconfigurationComplete_r8_IEs_t *rrc_r8 = &rrc->criticalExtensions.choice. rrcConnectionReconfigurationComplete_r8; typeof(rrc_r8->nonCriticalExtension) nce1; @@ -2444,7 +2443,7 @@ do_RRCConnectionReconfigurationComplete( buffer_size); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - LOG_I(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); + LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8); } @@ -4259,6 +4258,13 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size return((enc_rval.encoded+7)/8); } +#define asn1cCallocOne(VaR, VaLue) \ + VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; +#define asn1cCalloc(VaR, lOcPtr) \ + typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ + TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ + ASN_SEQUENCE_ADD(&VaR,lOcPtr); ssize_t do_nrMeasurementReport(uint8_t *buffer, size_t bufsize, @@ -4269,8 +4275,7 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, long rsrp_tar, long rsrq_tar) { - LTE_UL_DCCH_Message_t ul_dcch_msg; - memset(&ul_dcch_msg, 0, sizeof(ul_dcch_msg)); + LTE_UL_DCCH_Message_t ul_dcch_msg={0}; ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_measurementReport; @@ -4282,98 +4287,20 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId = measid; measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult = rsrp_s; measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult = rsrq_s; - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells = - calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present = - LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15; - LTE_MeasResultListEUTRA_t *measResultListEUTRA2; - measResultListEUTRA2 = CALLOC(1, sizeof(*measResultListEUTRA2)); - struct LTE_MeasResultEUTRA *measresulteutra_list; - measresulteutra_list = CALLOC(1, sizeof(*measresulteutra_list)); + asn1cCalloc(measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells, + measResultNeighCells); + measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15; + LTE_MeasResultListEUTRA_t *measResultListEUTRA2=&measResultNeighCells->choice.measResultListEUTRA; + asn1cSequenceAdd(measResultListEUTRA2->list, struct LTE_MeasResultEUTRA, measresulteutra_list); measresulteutra_list->physCellId = phy_id; - //struct LTE_MeasResultEUTRA *eutra_array; - //eutra_array = CALLOC(1, sizeof(*eutra_array)); - struct LTE_MeasResultEUTRA__cgi_Info *measresult_cgi2; - measresult_cgi2 = CALLOC(1, sizeof(*measresult_cgi2)); - memset(&measresult_cgi2->cellGlobalId, 0, sizeof(measresult_cgi2->cellGlobalId)); - memset(&measresult_cgi2->trackingAreaCode, 0, sizeof(measresult_cgi2->trackingAreaCode)); - struct LTE_PLMN_IdentityList2 *plmn_id_list; - plmn_id_list = CALLOC(1, sizeof(*plmn_id_list)); - struct LTE_MeasResultEUTRA__measResult measResult; - //measResult = CALLOC(1, sizeof(*measResult)); - //measResult->rsrpResult = CALLOC(1, sizeof(*measResult->rsrpResult)); - measResult.rsrpResult = &rsrp_tar; - //measResult->rsrqResult = CALLOC(1, sizeof(*measResult->rsrqResult)); - measResult.rsrqResult = &rsrq_tar; - measResult.ext1 = NULL; - //struct LTE_MeasResultEUTRA__measResult__ext1 *measResult_ext; - //measResult_ext = CALLOC(1, sizeof(*measResult_ext)); - measresulteutra_list->measResult = measResult; - measresulteutra_list->cgi_Info = measresult_cgi2; - ASN_SEQUENCE_ADD(&measResultListEUTRA2->list, measresulteutra_list); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2); - - #if 0 //Melissa: This was a hack. Incomplete filling of ul_dcch_msg is done above - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array = - calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0] = - calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0])); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrpResult = - calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrpResult)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult = - calloc(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult)); - if (measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells == NULL) - LOG_E(MAC, "Melissa, the calloc failed on neighcells.....!!\n"); - LTE_MeasResults_t *mr_r8 = &measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults; - mr_r8->measId = measid; - mr_r8->measResultPCell.rsrpResult = rsrp_s; - mr_r8->measResultPCell.rsrqResult = rsrq_s; - mr_r8->measResultNeighCells = CALLOC(1, sizeof(*mr_r8->measResultNeighCells)); - mr_r8->measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15; - mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.count = 1; - - mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array)); - mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0] = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0])); - mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15 = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15)); - mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15 = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15)); - //mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15 = rsrp_tar; - //mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15 = rsrq_tar; - LOG_D(RRC, "Melissa Elkadi RSRQ of Target %ld\n", - *mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15); - LOG_D(RRC, "Melissa Elkadi RSRP of Target %ld\n", - *mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15); - - //mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.count = 1; - //mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId = 0; - mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array)); - mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0] = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0])); - mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrpResult = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrpResult)); - mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult = - calloc(1, sizeof(*mr_r8->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult)); - - LTE_MeasResultCellNR_r15_t *measResultCellNR_r15; - measResultCellNR_r15 = CALLOC(1, sizeof(*measResultCellNR_r15)); - measResultCellNR_r15->ext1 //Melissa should be null - measResultCellNR_r15->pci_r15 = phy_id; - measResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = &rsrp_tar; - measResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = &rsrq_tar; - - LTE_MeasResultCellListNR_r15_t *measResultListNR_r15; - measResultListNR_r15 = CALLOC(1, sizeof(*measResultListNR_r15)); - ASN_SEQUENCE_ADD(&measResultListNR_r15->list, measResultCellNR_r15); - - ASN_SEQUENCE_ADD(&mr_r8->measResultNeighCells->choice.measResultNeighCellListNR_r15.list, measResultListNR_r15); - - //xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, &ul_dcch_msg); - #endif - + asn1cCalloc(measresulteutra_list->cgi_Info, measresult_cgi2); + //measresult_cgi2->cellGlobalId= {0}; + //measresult_cgi2->trackingAreaCode= {0}; + struct LTE_MeasResultEUTRA__measResult* measResult= &measresulteutra_list->measResult; + asn1cCallocOne(measResult->rsrpResult, rsrp_tar); + asn1cCallocOne(measResult->rsrqResult, rsrq_tar); + + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, &ul_dcch_msg, @@ -4385,28 +4312,7 @@ ssize_t do_nrMeasurementReport(uint8_t *buffer, SEQUENCE_free(&asn_DEF_LTE_UL_DCCH_Message, &ul_dcch_msg, ASFM_FREE_UNDERLYING_AND_RESET); return -1; } - #if 0 - LTE_UL_DCCH_Message_t *ul_dcch_msg_dec = NULL; - asn_dec_rval_t dec_rval = uper_decode( - NULL, - &asn_DEF_LTE_UL_DCCH_Message, - (void **)&ul_dcch_msg_dec, - buffer, - bufsize, - 0, - 0); - if (1) { - xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg_dec); - } - LOG_I(RRC, "Melissa, this is rsrp_result %ld\n", - *ul_dcch_msg_dec->message.choice.c1.choice.measurementReport.criticalExtensions. - choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells-> - choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15); - AssertFatal(ul_dcch_msg_dec->message.choice.c1.choice.measurementReport.criticalExtensions. - choice.c1.choice.measurementReport_r8.measResults. - measResultNeighCells->choice.measResultListEUTRA.list.array[0]->measResult.rsrqResult != NULL, "rsrq not allocated! and dec_val = %lu", dec_rval.consumed); - SEQUENCE_free(&asn_DEF_LTE_UL_DCCH_Message, &ul_dcch_msg, ASFM_FREE_UNDERLYING_AND_RESET); Melissa, might want to figure this out! - #endif + return((enc_rval.encoded+7)/8); } diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index bb6364dfbd..e158b1ac73 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -788,6 +788,7 @@ rrc_ue_establish_drb( return(0); } + //----------------------------------------------------------------------------- void rrc_ue_process_measConfig( @@ -1734,7 +1735,7 @@ rrc_ue_process_nrueCapabilityEnquiry( OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ue_CapabilityRAT_Container, (const char *)nrue_cap_info->mesg, nrue_cap_info->mesg_len); - # if(1) //Melissa: This is a hack. The MRDC capabilites should be filled in the NR UE + # if(1) // TODO: The MRDC capabilites should be filled in the NR UE NR_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container_mrdc; memset(&ue_CapabilityRAT_Container_mrdc, 0, sizeof(ue_CapabilityRAT_Container_mrdc)); uint8_t buffer_mrdc[RRC_BUF_SIZE]; @@ -1971,15 +1972,6 @@ rrc_ue_process_rrcConnectionReconfiguration( nsa_sendmsg_to_nrue(&msg, sizeof(msg), RRC_CONFIG_COMPLETE_REQ); LOG_A(RRC, "Sent RRC_CONFIG_COMPLETE_REQ to the NR UE\n"); - #if 0 //Melissa, this is a hack. We need the transaction_id from latest dl_dcch_msg the LTE UE received. (Ln 6658) - LTE_RRCConnectionReconfiguration_t *rrc = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].dl_dcch_msg->message. - choice.c1.choice.rrcConnectionReconfiguration; - if (rrc != NULL) { - SEQUENCE_free(&asn_DEF_LTE_RRCConnectionReconfiguration, rrc, ASFM_FREE_EVERYTHING); - } - rrc->rrc_TransactionIdentifier = rrcConnectionReconfiguration->rrc_TransactionIdentifier; - rrcConnectionReconfiguration = NULL; - #endif } if (r_r8->mobilityControlInfo) { @@ -2059,7 +2051,7 @@ rrc_ue_process_rrcConnectionReconfiguration( NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } - LOG_I(RRC, "Melissa Elkadi, we have sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n"); + LOG_D(RRC, "Sent NAS_CONN_ESTABLI_CNF to NAS layer via itti!\n"); free (r_r8->dedicatedInfoNASList); } @@ -2517,7 +2509,6 @@ rrc_ue_decode_dcch( UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP]; if (info->dl_dcch_msg != NULL) { info->dl_dcch_msg = NULL; - //SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); Melissa } info->dl_dcch_msg = dl_dcch_msg; dl_dcch_msg = NULL; @@ -2533,7 +2524,6 @@ rrc_ue_decode_dcch( UE_RRC_INFO *info = &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP]; if (info->dl_dcch_msg != NULL) { info->dl_dcch_msg = NULL; - //SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, info->dl_dcch_msg, ASFM_FREE_EVERYTHING); Melissa } info->dl_dcch_msg = dl_dcch_msg; dl_dcch_msg = NULL; @@ -2571,7 +2561,7 @@ rrc_ue_decode_dcch( #ifndef NO_RRM send_msg(&S_rrc,msg_rrc_end_scan_req(ctxt_pP->module_id,eNB_indexP)); #endif - if (0) //Melissa hack: Were not done with underlying members of dl_dcch_msg (Use after free) + if (0) //We're not done with underlying members of dl_dcch_msg (Use after free error when enabled) { SEQUENCE_free(&asn_DEF_LTE_DL_DCCH_Message, dl_dcch_msg, ASFM_FREE_EVERYTHING); } @@ -5067,7 +5057,7 @@ void *rrc_ue_task( void *args_p ) { } case NAS_OAI_TUN_NSA: { - LOG_I(NAS, "Melissa Elkadi Received %s: length %lu. About to send this to the NR UE\n", ITTI_MSG_NAME (msg_p), + LOG_D(NAS, "Received %s: length %lu. About to send this to the NR UE\n", ITTI_MSG_NAME (msg_p), sizeof(NAS_OAI_TUN_NSA (msg_p).buffer)); char buffer[RRC_BUF_SIZE]; memcpy(buffer, NAS_OAI_TUN_NSA(msg_p).buffer, sizeof(buffer)); diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index e84d946e0a..8c4c2d56d4 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -90,6 +90,7 @@ #include #include "intertask_interface.h" +#include "softmodem-common.h" #if ENABLE_RAL #include "rrc_eNB_ral.h" @@ -4600,8 +4601,8 @@ rrc_eNB_process_MeasurementReport( if(is_en_dc_supported(ue_context_pP->ue_context.UE_Capability)) { - //AssertFatal(measResults2->measResultNeighCells!=NULL,"no measResultNeighCells, shouldn't happen!\n"); - //AssertFatal(measResults2->measResultNeighCells->present==LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15,"field is not LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15"); + AssertFatal(measResults2->measResultNeighCells!=NULL,"no measResultNeighCells, shouldn't happen!\n"); + AssertFatal(measResults2->measResultNeighCells->present==LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15,"field is not LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15"); /** to add gNB as Secondary node CG-ConfigInfo to be added as per 36.423 r15 **/ if(encode_CG_ConfigInfo(enc_buf,sizeof(enc_buf),ue_context_pP,&enc_size) == RRC_OK) LOG_I(RRC,"CG-ConfigInfo encoded successfully\n"); @@ -7990,7 +7991,7 @@ rrc_eNB_decode_dcch( /*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/ int flexran_agent_handover = 0; - if (1) { //Melissa: This is a hack. We are bypassing EPC mode here. if(EPC_MODE_ENABLED) + if (EPC_MODE_ENABLED || get_softmodem_params()->nsa) { if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { dedicated_DRB = 1; LOG_I(RRC, diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index da6057aafd..f0456005f5 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -529,6 +529,7 @@ rrc_data_req_ue( const pdcp_transmission_mode_t modeP ); + void rrc_data_ind( const protocol_ctxt_t *const ctxt_pP, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 79704b86f5..11e510050b 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1033,7 +1033,6 @@ void fill_initial_SpCellConfig(rnti_t rnti, // one symbol (13) NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); pucchres0->pucch_ResourceId=0; - //pucchres0->startingPRB=0; pucchres0->startingPRB=(8+rnti) % curr_bwp; LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp); pucchres0->intraSlotFrequencyHopping=NULL; diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c index 04749b2800..c4cd41c5b4 100644 --- a/openair2/RRC/NR/rrc_gNB_internode.c +++ b/openair2/RRC/NR/rrc_gNB_internode.c @@ -59,6 +59,7 @@ int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2 AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %lu\n", dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size); } + rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList, m,cg_ConfigInfo); } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 7ba3d773c5..5107d252c5 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -308,7 +308,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, ue_context_p->ue_id_rnti, 0, 0,rrc->module_id); memset(&create_tunnel_resp, 0, sizeof(create_tunnel_resp)); if (!IS_SOFTMODEM_NOS1) { - LOG_I(RRC, "Melissa Elkadi calling gtpv1u_create_s1u_tunnel()\n"); + LOG_D(RRC, "Calling gtpv1u_create_s1u_tunnel()\n"); gtpv1u_create_s1u_tunnel( ctxt.instance, &create_tunnel_req, @@ -417,7 +417,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ (LTE_PMCH_InfoList_r9_t *) NULL, ue_context_p->ue_context.secondaryCellGroup->rlc_BearerToAddModList); - LOG_I(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); + LOG_D(RRC, "%s:%d: done RRC PDCP/RLC ASN1 request for UE rnti %x\n", __FUNCTION__, __LINE__, ctxt.rnti); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 8fec4c002e..1636ee5b24 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -129,10 +129,6 @@ nr_rrc_ue_generate_rrcReestablishmentComplete( mui_t nr_rrc_mui=0; -static const char nsa_ipaddr[] = "127.0.0.1"; -static int from_lte_ue_fd = -1; -static int to_lte_ue_fd = -1; - static Rrc_State_NR_t nr_rrc_get_state (module_id_t ue_mod_idP) { return NR_UE_rrc_inst[ue_mod_idP].nrRrcState; } @@ -205,7 +201,6 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); -static void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len); static void start_oai_nrue_threads(void); // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) @@ -2030,15 +2025,6 @@ nr_rrc_ue_establish_srb2( } } - /*rrc_data_req_nr_ue ( - ctxt_pP, - DCCH, - nr_rrc_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); Melissa Elkadi come back here!*/ - if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_ssb_RSRP) { NR_UE_rrc_inst[ctxt_pP->module_id].s_measure = measConfig->s_MeasureConfig->choice.ssb_RSRP; } else if (measConfig->s_MeasureConfig->present == NR_MeasConfig__s_MeasureConfig_PR_csi_RSRP) { @@ -2729,38 +2715,6 @@ nr_rrc_ue_process_ueCapabilityEnquiry( } } -//----------------------------------------------------------------------------- -#if 0 -static void nr_rrc_ue_generate_RRCReestablishmentRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index ) -{ - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size = - do_RRCReestablishmentRequest( - ctxt_pP->module_id, - (uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, 1); - LOG_I(NR_RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCReestablishmentRequest (bytes %d, gNB %d)\n", - ctxt_pP->module_id, ctxt_pP->frame, NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index); - - for (int i=0; imodule_id].Srb0[gNB_index].Tx_buffer.payload_size; i++) { - LOG_T(NR_RRC,"%x.",NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload[i]); - } - - LOG_T(NR_RRC,"\n"); - -#ifdef ITTI_SIM - MessageDef *message_p; - uint8_t *message_buffer; - message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND); - UE_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - UE_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); -#endif -} -#endif - void nr_rrc_ue_generate_rrcReestablishmentComplete( const protocol_ctxt_t *const ctxt_pP, @@ -2793,6 +2747,7 @@ nr_rrc_ue_generate_rrcReestablishmentComplete( void *recv_msgs_from_lte_ue(void *args_p) { itti_mark_task_ready (TASK_RRC_NSA_NRUE); + int from_lte_ue_fd = get_from_lte_ue_fd(); for (;;) { nsa_msg_t msg; @@ -2812,77 +2767,6 @@ void *recv_msgs_from_lte_ue(void *args_p) } return NULL; } - -void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type) -{ - LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__); - nsa_msg_t n_msg; - if (msg_len > sizeof(n_msg.msg_buffer)) - { - LOG_E(NR_RRC, "%s: message too big: %zu\n", __func__, msg_len); - abort(); - } - n_msg.msg_type = msg_type; - memcpy(n_msg.msg_buffer, message, msg_len); - size_t to_send = sizeof(n_msg.msg_type) + msg_len; - - struct sockaddr_in sa = - { - .sin_family = AF_INET, - .sin_port = htons(6007 + ue_id_g * 2), - }; - int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0, - (struct sockaddr *)&sa, sizeof(sa)); - if (sent == -1) - { - LOG_E(NR_RRC, "%s: sendto: %s\n", __func__, strerror(errno)); - return; - } - if (sent != to_send) - { - LOG_E(RRC, "%s: Short send %d != %zu\n", __func__, sent, to_send); - return; - } - LOG_D(NR_RRC, "Sent a %d message to the LTE UE (%d bytes) \n", msg_type, sent); -} - -void init_connections_with_lte_ue(void) -{ - struct sockaddr_in sa = - { - .sin_family = AF_INET, - .sin_port = htons(6008 + ue_id_g * 2), - }; - AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd %d was assigned already", from_lte_ue_fd); - from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); - if (from_lte_ue_fd == -1) - { - LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, from_lte_ue_fd, errno, strerror(errno)); - abort(); - } - - if (inet_aton(nsa_ipaddr, &sa.sin_addr) == 0) - { - LOG_E(NR_RRC, "Bad nsa_ipaddr '%s'\n", nsa_ipaddr); - abort(); - } - - if (bind(from_lte_ue_fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) - { - LOG_E(NR_RRC,"%s: Failed to bind the socket\n", __FUNCTION__); - abort(); - } - - AssertFatal(to_lte_ue_fd == -1, "to_lte_ue_fd was assigned already"); - to_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); - if (to_lte_ue_fd == -1) - { - LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, to_lte_ue_fd, errno, strerror(errno)); - abort(); - } - LOG_I(NR_RRC, "Started LTE-NR link in the nr-UE\n"); -} - static void start_oai_nrue_threads() { init_queue(&nr_rach_ind_queue); @@ -2925,7 +2809,7 @@ static void nsa_rrc_ue_process_ueCapabilityEnquiry(void) UECap->sdu_size = (enc_rval.encoded + 7) / 8; LOG_A(NR_RRC, "[NR_RRC] NRUE Capability encoded, %d bytes (%zd bits)\n", UECap->sdu_size, enc_rval.encoded + 7); - /* Melissa: Hack. Need to add ctxt->mod_id as array indices */ + NR_UE_rrc_inst[0].UECap = UECap; NR_UE_rrc_inst[0].UECapability = UECap->sdu; NR_UE_rrc_inst[0].UECapability_size = UECap->sdu_size; @@ -3066,7 +2950,7 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) LOG_I(NR_RRC, "We got an OAI_TUN_IFACE_NSA!!\n"); char cmd_line[RRC_BUF_SIZE]; memcpy(cmd_line, msg_buffer, sizeof(cmd_line)); - LOG_I(NR_RRC, "Melissa Elkadi, this is the command line we got: %s\n", cmd_line); + LOG_D(NR_RRC, "Command line: %s\n", cmd_line); if (background_system(cmd_line) != 0) { LOG_E(NR_RRC, "ESM-PROC - failed command '%s'", cmd_line); diff --git a/openair2/RRC/NR_UE/rrc_nsa.c b/openair2/RRC/NR_UE/rrc_nsa.c new file mode 100644 index 0000000000..9e62243c65 --- /dev/null +++ b/openair2/RRC/NR_UE/rrc_nsa.c @@ -0,0 +1,85 @@ +#include +#include +#include +#include "common/utils/LOG/log.h" +#include "openair2/RRC/NR_UE/rrc_proto.h" + +static const char nsa_ipaddr[] = "127.0.0.1"; +static int from_lte_ue_fd = -1; +static int to_lte_ue_fd = -1; +uint16_t ue_id_g; + +int get_from_lte_ue_fd() +{ + return from_lte_ue_fd; +} + +void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type) +{ + LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__); + nsa_msg_t n_msg; + if (msg_len > sizeof(n_msg.msg_buffer)) + { + LOG_E(NR_RRC, "%s: message too big: %zu\n", __func__, msg_len); + abort(); + } + n_msg.msg_type = msg_type; + memcpy(n_msg.msg_buffer, message, msg_len); + size_t to_send = sizeof(n_msg.msg_type) + msg_len; + + struct sockaddr_in sa = + { + .sin_family = AF_INET, + .sin_port = htons(6007 + ue_id_g * 2), + }; + int sent = sendto(from_lte_ue_fd, &n_msg, to_send, 0, + (struct sockaddr *)&sa, sizeof(sa)); + if (sent == -1) + { + LOG_E(NR_RRC, "%s: sendto: %s\n", __func__, strerror(errno)); + return; + } + if (sent != to_send) + { + LOG_E(NR_RRC, "%s: Short send %d != %zu\n", __func__, sent, to_send); + return; + } + LOG_D(NR_RRC, "Sent a %d message to the LTE UE (%d bytes) \n", msg_type, sent); +} + +void init_connections_with_lte_ue(void) +{ + struct sockaddr_in sa = + { + .sin_family = AF_INET, + .sin_port = htons(6008 + ue_id_g * 2), + }; + AssertFatal(from_lte_ue_fd == -1, "from_lte_ue_fd %d was assigned already", from_lte_ue_fd); + from_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); + if (from_lte_ue_fd == -1) + { + LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, from_lte_ue_fd, errno, strerror(errno)); + abort(); + } + + if (inet_aton(nsa_ipaddr, &sa.sin_addr) == 0) + { + LOG_E(NR_RRC, "Bad nsa_ipaddr '%s'\n", nsa_ipaddr); + abort(); + } + + if (bind(from_lte_ue_fd, (struct sockaddr *) &sa, sizeof(sa)) == -1) + { + LOG_E(NR_RRC,"%s: Failed to bind the socket\n", __FUNCTION__); + abort(); + } + + AssertFatal(to_lte_ue_fd == -1, "to_lte_ue_fd was assigned already"); + to_lte_ue_fd = socket(AF_INET, SOCK_DGRAM, 0); + if (to_lte_ue_fd == -1) + { + LOG_E(NR_RRC, "%s: Error opening socket %d (%d:%s)\n", __FUNCTION__, to_lte_ue_fd, errno, strerror(errno)); + abort(); + } + LOG_I(NR_RRC, "Started LTE-NR link in the nr-UE\n"); +} diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 2abc680943..6b3e81a3a9 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -173,6 +173,10 @@ void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_ \param gNB_index gNB index */ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index); +void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len); + +int get_from_lte_ue_fd(); + /** @}*/ #endif diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index 13618a921c..9724e0cc38 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -1734,7 +1734,7 @@ int x2ap_eNB_generate_ENDC_x2_SgNB_addition_request( X2AP_ERROR("Failed to encode ENDC X2 SgNB_addition request message\n"); return -1; } - # if 0 //Melissa: This is a hack becasue we are trying to access this after free. + # if 0 // TODO: Sanitizer complains we are trying to access this after free. free(ie->value.choice.MeNBtoSgNBContainer.buf); #endif MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_eNB_data_p->assoc_id); diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 6ba3fc2a86..b801ca2ad5 100644 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -263,7 +263,7 @@ int esm_ebr_context_create( netmask = 32; strcpy(broadcast, ipv4_addr); } - LOG_I(NAS, "Melissa Elkadi setting commandline string: " + LOG_D(NAS, "setting commandline string: " "ip address add %s/%d broadcast %s dev %s%d && " "ip link set %s%d up && " "ip rule add from %s/32 table %d && " @@ -276,7 +276,7 @@ int esm_ebr_context_create( ipv4_addr, ueid + 10000, UE_NAS_USE_TUN ? "oaitun_ue" : "oip", ueid + 1, ueid + 10000); - if (get_softmodem_params()->nsa == 0) + if (!get_softmodem_params()->nsa) { res = sprintf(command_line, "ip address add %s/%d broadcast %s dev %s%d && " @@ -307,7 +307,7 @@ int esm_ebr_context_create( * common/utils/system.c for details. */ - LOG_TRACE(INFO, "Melissa Elkadi ESM-PROC - executing %s ", + LOG_TRACE(INFO, "ESM-PROC - executing %s ", command_line); if (background_system(command_line) != 0) { @@ -332,7 +332,7 @@ int esm_ebr_context_create( if ( res<0 ) { LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string"); } - LOG_I(NAS, "Melissa Elkadi, sending NAS_OAI_TUN_NSA msg to LTE UE via itti\n"); + LOG_D(NAS, "Sending NAS_OAI_TUN_NSA msg to LTE UE via itti\n"); MessageDef *msg_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_OAI_TUN_NSA); memcpy(NAS_OAI_TUN_NSA(msg_p).buffer, command_line, sizeof(NAS_OAI_TUN_NSA(msg_p).buffer)); itti_send_msg_to_task(TASK_RRC_UE, 0, msg_p); diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 8c03fe43be..670600e0ad 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -252,7 +252,7 @@ void *nas_ue_task(void *args_p) break; case NAS_CONN_ESTABLI_CNF: - LOG_I(NAS, "Melissa Elkadi [UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), + LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p), NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS) diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index c3eba11895..5cbf643a84 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -61,9 +61,10 @@ int create_tasks(uint32_t enb_nb) { rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL); AssertFatal(rc >= 0, "Create task for RRC eNB failed\n"); - rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for SCTP failed\n"); - + if (get_softmodem_params()->nsa || (EPC_MODE_ENABLED && split73 != SPLIT73_DU)) { + rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for SCTP failed\n"); + } if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) { rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index ef250c0865..0bdf29227f 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -958,7 +958,6 @@ void init_eNB_proc(int inst) { // Original Code from Fujitsu w/ old structure/field name //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); - pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc ); if (pthread_setname_np(L1_proc->pthread, "oai:enb-L1-rx") != 0) { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index cf00b7bd85..16c2f80c48 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -524,15 +524,7 @@ static void wait_nfapi_init(char *thread_name) { int main ( int argc, char **argv ) { - struct sched_param param = - { - .sched_priority = 79 - }; - if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 ) - { - fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno)); - return EXIT_FAILURE; - } + set_priority(79); if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) { fprintf(stderr, "mlockall: %s\n", strerror(errno)); @@ -751,6 +743,8 @@ int main ( int argc, char **argv ) create_tasks_mbms(1); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); } + else + create_tasks_mbms(1); //create_tasks_mbms(1); // wait for end of program diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index fb16af0fa1..349362b3b2 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -547,15 +547,7 @@ AssertFatal(false,""); } int main( int argc, char **argv ) { - struct sched_param param = - { - .sched_priority = 79 - }; - if (sched_setscheduler( 0, SCHED_RR, ¶m ) == -1 ) - { - fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno)); - return EXIT_FAILURE; - } + set_priority(79); if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) { fprintf(stderr, "mlockall: %s\n", strerror(errno));