diff --git a/CMakeLists.txt b/CMakeLists.txt index 7124548c39..93cbe3cc9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -374,9 +374,6 @@ endif() ############# set(asn1_generated_dir ${OPENAIR_BIN_DIR}) -set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") -set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) - # RRC ###### set (RRC_ASN1_VERSION "Rel15") @@ -1068,179 +1065,6 @@ include_directories("${OPENAIR2_DIR}/UTIL/OMV") include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") include_directories("${OPENAIR_DIR}") -# flexran -################ -# Make lfds as a own source code (even if it is a outside library) -# only user: Flexran, please don't use lfds in any other component -################################################################### - -set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) -file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) -file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) -file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) -file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) -file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) -file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) -file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) -file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) -file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) -file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) - -add_library(LFDS7 - ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} -) - -target_include_directories(LFDS7 PRIVATE "${lfds7}") -# set the version of protobuf messages, V3 not supported yet -add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) - -if (${FLPT_VERSION} STREQUAL "V2") - set (FLPTDIR V2) -elseif (${FLPT_VERSION} STREQUAL "V3") - set (FLPTDIR V3) -endif(${FLPT_VERSION} STREQUAL "V2") - -set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} ) -set(FLPT_MSG_FILES - ${FLPT_MSG_DIR}/header.proto - ${FLPT_MSG_DIR}/flexran.proto - ${FLPT_MSG_DIR}/stats_common.proto - ${FLPT_MSG_DIR}/stats_messages.proto - ${FLPT_MSG_DIR}/time_common.proto - ${FLPT_MSG_DIR}/controller_commands.proto - ${FLPT_MSG_DIR}/mac_primitives.proto - ${FLPT_MSG_DIR}/config_messages.proto - ${FLPT_MSG_DIR}/config_common.proto - ${FLPT_MSG_DIR}/control_delegation.proto - ) - -set(FLPT_C_DIR ${protobuf_generated_dir}/FLPT_${FLPTDIR}) -#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") -execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES}) -file(GLOB FLPT_source ${FLPT_C_DIR}/*.c) -set(FLPT_OAI_generated - ${FLPT_C_DIR}/header.pb-c.c - ${FLPT_C_DIR}/flexran.pb-c.c - ${FLPT_C_DIR}/stats_common.pb-c.c - ${FLPT_C_DIR}/stats_messages.pb-c.c - ${FLPT_C_DIR}/time_common.pb-c.c - ${FLPT_C_DIR}/controller_commands.pb-c.c - ${FLPT_C_DIR}/mac_primitives.pb-c.c - ${FLPT_C_DIR}/config_messages.pb-c.c - ${FLPT_C_DIR}/config_common.pb-c.c - ${FLPT_C_DIR}/control_delegation.pb-c.c - ) - -file(GLOB flpt_h ${FLPT_C_DIR}/*.h) -set(flpt_h ${flpt_h} ) - -add_library(FLPT_MSG - ${FLPT_OAI_generated} - ${FLPT_source} - ) -target_link_libraries(FLPT_MSG LFDS7) -add_dependencies(FLPT_MSG LFDS7) - -set(FLPT_MSG_LIB FLPT_MSG) -#message("prpt c dir is : ${FLPT_C_DIR}") -include_directories (${FLPT_C_DIR}) - -add_library(ASYNC_IF - ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c - ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c - ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c - ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c - ) -set(ASYNC_IF_LIB ASYNC_IF) -target_include_directories(ASYNC_IF PRIVATE "${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") -include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) - -add_library(FLEXRAN_AGENT - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c - ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_app.c - ) -add_dependencies(FLEXRAN_AGENT rrc_flag ASYNC_IF) -target_link_libraries(FLEXRAN_AGENT ASYNC_IF LFDS7) -target_include_directories(FLEXRAN_AGENT PRIVATE "${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") -set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) -add_library(flapp_sample SHARED - ${OPENAIR2_DIR}/ENB_APP/flexran_apps/sample.c -) -set_target_properties(flapp_sample PROPERTIES C_VISIBILITY_PRESET hidden) -add_library(flapp_imsi SHARED - ${OPENAIR2_DIR}/ENB_APP/flexran_apps/imsi.c -) -set_target_properties(flapp_imsi PROPERTIES C_VISIBILITY_PRESET hidden) -add_custom_target(flapp_all DEPENDS - flapp_sample - flapp_imsi -) -#include_directories(${OPENAIR2_DIR}/ENB_APP) - -set(PROTOBUF_LIB "protobuf-c") - -FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h) -FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR) -MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) - -#set(PROTOBUF_LIB "protobuf") #for Cpp - -# set the version of protobuf messages, V3 not supported yet -add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3) - -if (${FSPT_VERSION} STREQUAL "V2") - set (FSPTDIR V2) -elseif (${FSPT_VERSION} STREQUAL "V3") - set (FSPTDIR V3) -endif(${FSPT_VERSION} STREQUAL "V2") - -set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} ) -set(FSPT_MSG_FILES - ${FSPT_MSG_DIR}/flexsplit.proto - ) - -set(FSPT_C_DIR ${protobuf_generated_dir}/FSPT_${FSPTDIR}) -message("calling protoc_call=${protoc_call} FSPT_C_DIR=${FSPT_C_DIR} FSPT_MSG_DIR=${FSPT_MSG_DIR} FSPT_MSG_FILES=${FSPT_MSG_FILES}") -execute_process(COMMAND ${protoc_call} ${FSPT_C_DIR} ${FSPT_MSG_DIR} ${FSPT_MSG_FILES}) -file(GLOB FSPT_source ${FSPT_C_DIR}/*.c) -set(FSPT_OAI_generated - ${FSPT_C_DIR}/flexsplit.pb-c.c - ) - -file(GLOB fspt_h ${FSPT_C_DIR}/*.h) -set(fspt_h ${fspt_h} ) - -add_library(FSPT_MSG - ${FSPT_OAI_generated} - ${FSPT_source} - ) -set(FSPT_MSG_LIB FSPT_MSG) -message("fspt c dir is : ${FSPT_C_DIR}") -include_directories (${FSPT_C_DIR}) - -set(PROTOBUF_LIB "protobuf-c") - -#set(PROTOBUF_LIB "protobuf") #for Cpp - ########### # Utilities ############### @@ -2660,11 +2484,11 @@ target_link_libraries (lte-softmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} + ${RAL_LIB} ${NAS_UE_LIB} ITTI -Wl,--end-group z dl) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) @@ -2700,9 +2524,9 @@ target_link_libraries (ocp-enb RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB SIMU_COMMON - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} + ${RAL_LIB} ${NAS_UE_LIB} ITTI -Wl,--end-group z dl) -target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB}) +target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIB_LMS_LIBRARIES} ${T_LIB}) add_executable(oairu ${OPENAIR_TARGETS}/RT/USER/lte-ru.c @@ -2758,11 +2582,11 @@ target_link_libraries (lte-uesoftmodem RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU L2_UE L2_LTE SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB - ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ATLAS_LIBRARIES} + ${RAL_LIB} ${NAS_UE_LIB} ITTI ${ATLAS_LIBRARIES} -Wl,--end-group z dl) target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (lte-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-uesoftmodem ${T_LIB}) @@ -2791,19 +2615,18 @@ add_executable(nr-softmodem ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c ) target_link_libraries (nr-softmodem -Wl,--start-group UTIL HASHTABLE SCTP_CLIENT SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU GTPV1U SECU_CN SECU_OSA - ITTI ${FLPT_MSG_LIB} ${FLEXRAN_AGENT_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB + ITTI ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB - X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${FSPT_MSG_LIB} + X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB -Wl,--end-group z dl) target_link_libraries (nr-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (nr-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (nr-softmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) target_link_libraries (nr-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (nr-softmodem ${T_LIB}) @@ -2846,7 +2669,7 @@ target_link_libraries (nr-uesoftmodem -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (nr-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${ATLAS_LIBRARIES}) +target_link_libraries (nr-uesoftmodem pthread m CONFIG_LIB rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${XFORMS_LIBRARIES} ${CMAKE_DL_LIBS} ${ATLAS_LIBRARIES}) target_link_libraries (nr-uesoftmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (nr-uesoftmodem ${T_LIB}) @@ -3085,7 +2908,7 @@ if (${T_TRACER}) #all "add_library" definitions ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP params_libconfig oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer - oai_eth_transpro oai_mobipass coding FLPT_MSG FLEXRAN_AGENT HASHTABLE UTIL OMG_SUMO + oai_eth_transpro oai_mobipass coding HASHTABLE UTIL OMG_SUMO SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 9d95049afb..e2086950d7 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -54,10 +54,6 @@ pipeline { echo "Platform is ${env.TESTPLATFORM_OWNER}" } - if (fileExists("flexran")) { - sh "rm -Rf flexran > /dev/null 2>&1" - } - echo '\u2705 \u001B[32mVerify Labels\u001B[0m' if ("MERGE".equals(env.gitlabActionType)) { LABEL_CHECK = sh returnStdout: true, script: 'ci-scripts/checkGitLabMergeRequestLabels.sh --mr-id ' + env.gitlabMergeRequestIid diff --git a/ci-scripts/checkAddedWarnings.sh b/ci-scripts/checkAddedWarnings.sh index cb0993cf4f..3c51a5717f 100755 --- a/ci-scripts/checkAddedWarnings.sh +++ b/ci-scripts/checkAddedWarnings.sh @@ -110,7 +110,7 @@ MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-sta NB_WARNINGS_FILES=0 # Retrieve list of warnings -LIST_WARNING_FILES=`egrep "error:|warning:" archives/*/*.txt | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto" | sed -e "s#^.*/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" -e "s#common/utils/.*/itti#common/utils/itti#" | awk -F ":" '{print $1}' | sort | uniq` +LIST_WARNING_FILES=`egrep "error:|warning:" archives/*/*.txt | egrep -v "jobserver unavailable|Clock skew detected." | sed -e "s#^.*/home/ubuntu/tmp/##" -e "s#^.*/tmp/CI-eNB/##" -e "s#common/utils/.*/itti#common/utils/itti#" | awk -F ":" '{print $1}' | sort | uniq` echo "" echo "List of files that have been modified by the Merge Request AND" diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 184bb7bdb3..69569c79a3 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -188,8 +188,6 @@ class Containerize(): self.testCase_id = '' - self.flexranCtrlDeployed = False - self.flexranCtrlIpAddress = '' self.cli = '' self.cliBuildOptions = '' self.dockerfileprefix = '' diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 05181a168e..23058770f9 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -299,50 +299,6 @@ class OaiCiTest(): HTML.CreateHtmlTabFooter(False) self.ConditionalExit() - def CheckFlexranCtrlInstallation(self,RAN,EPC,CONTAINERS): - if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '': - return - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command('ls -ls /opt/flexran_rtc/*/rt_controller', '\$', 5) - result = re.search('/opt/flexran_rtc/build/rt_controller', SSH.getBefore()) - if result is not None: - RAN.flexranCtrlInstalled=True - RAN.flexranCtrlIpAddress=EPC.IPAddress - logging.debug('Flexran Controller is installed') - else: - # Maybe flexran-rtc is deployed into a container - SSH.command('docker inspect --format="FLEX_RTC_IP_ADDR = {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" prod-flexran-rtc', '\$', 5) - result = re.search('FLEX_RTC_IP_ADDR = (?P[0-9\.]+)', SSH.getBefore()) - if result is not None: - RAN.flexranCtrlDeployed=True - RAN.flexranCtrlIpAddress=result.group('flex_ip_addr') - CONTAINERS.flexranCtrlDeployed=True - CONTAINERS.flexranCtrlIpAddress=result.group('flex_ip_addr') - logging.debug('Flexran Controller is deployed: ' + RAN.flexranCtrlIpAddress) - SSH.close() - - def InitializeFlexranCtrl(self, HTML,RAN,EPC): - if RAN.flexranCtrlInstalled == False: - return - if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command('cd /opt/flexran_rtc', '\$', 5) - SSH.command('echo ' + EPC.Password + ' | sudo -S rm -f log/*.log', '\$', 5) - SSH.command('echo ' + EPC.Password + ' | sudo -S echo "build/rt_controller -c log_config/basic_log" > ./my-flexran-ctl.sh', '\$', 5) - SSH.command('echo ' + EPC.Password + ' | sudo -S chmod 755 ./my-flexran-ctl.sh', '\$', 5) - SSH.command('echo ' + EPC.Password + ' | sudo -S daemon --unsafe --name=flexran_rtc_daemon --chdir=/opt/flexran_rtc -o /opt/flexran_rtc/log/flexranctl_' + self.testCase_id + '.log ././my-flexran-ctl.sh', '\$', 5) - SSH.command('ps -aux | grep --color=never rt_controller', '\$', 5) - result = re.search('rt_controller -c ', SSH.getBefore()) - if result is not None: - logging.debug('\u001B[1m Initialize FlexRan Controller Completed\u001B[0m') - RAN.flexranCtrlStarted=True - SSH.close() - HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - def InitializeUE_common(self, device_id, idx,COTS_UE): try: SSH = sshconnection.SSHConnection() @@ -1464,27 +1420,8 @@ class OaiCiTest(): i += 1 for job in multi_jobs: job.join() - if (RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted) or RAN.flexranCtrlDeployed: - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command('cd ' + EPC.SourceCodePath + '/scripts', '\$', 5) - SSH.command('curl http://' + RAN.flexranCtrlIpAddress + ':9999/stats | jq \'.\' > check_status_' + self.testCase_id + '.log 2>&1', '\$', 5) - SSH.command('cat check_status_' + self.testCase_id + '.log | jq \'.eNB_config[0].UE\' | grep -c rnti | sed -e "s#^#Nb Connected UE = #"', '\$', 5) - result = re.search('Nb Connected UE = (?P[0-9]+)', SSH.getBefore()) - passStatus = True - if result is not None: - nb_ues = int(result.group('nb_ues')) - htmlOptions = 'Nb Connected UE(s) to eNB = ' + str(nb_ues) - logging.debug('\u001B[1;37;44m ' + htmlOptions + ' \u001B[0m') - if self.expectedNbOfConnectedUEs > -1: - if nb_ues != self.expectedNbOfConnectedUEs: - passStatus = False - else: - htmlOptions = 'N/A' - SSH.close() - else: - passStatus = True - htmlOptions = 'N/A' + passStatus = True + htmlOptions = 'N/A' if (status_queue.empty()): HTML.CreateHtmlTestRow(htmlOptions, 'KO', CONST.ALL_PROCESSES_OK) @@ -3145,8 +3082,6 @@ class OaiCiTest(): if logStatus < 0: result = logStatus RAN.eNBLogFiles[0]='' - if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted: - self.TerminateFlexranCtrl() return result def CheckOAIUEProcessExist(self, initialize_OAI_UE_flag,HTML,RAN): @@ -3462,22 +3397,6 @@ class OaiCiTest(): return global_status - def TerminateFlexranCtrl(self,HTML,RAN,EPC): - if RAN.flexranCtrlInstalled == False or RAN.flexranCtrlStarted == False: - return - if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - SSH = sshconnection.SSHConnection() - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - SSH.command('echo ' + EPC.Password + ' | sudo -S daemon --name=flexran_rtc_daemon --stop', '\$', 5) - time.sleep(1) - SSH.command('echo ' + EPC.Password + ' | sudo -S killall --signal SIGKILL rt_controller', '\$', 5) - time.sleep(1) - SSH.close() - RAN.flexranCtrlStarted=False - HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - def TerminateUE_common(self, device_id, idx,COTS_UE): try: SSH = sshconnection.SSHConnection() @@ -3628,13 +3547,6 @@ class OaiCiTest(): logging.debug('Auto Termination of Instance ' + str(instance) + ' : ' + RAN.air_interface[instance]) RAN.eNB_instance=instance RAN.TerminateeNB(HTML,EPC) - if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted: - self.testCase_id = 'AUTO-KILL-flexran-ctl' - HTML.testCase_id = self.testCase_id - self.desc = 'Automatic Termination of FlexRan CTL' - HTML.desc = self.desc - self.ShowTestID() - self.TerminateFlexranCtrl(HTML,RAN,EPC) if CONTAINERS.yamlPath[0] != '': self.testCase_id = 'AUTO-KILL-CONTAINERS' HTML.testCase_id = self.testCase_id @@ -3662,13 +3574,6 @@ class OaiCiTest(): logging.debug('Auto Termination of Instance ' + str(instance) + ' : ' + RAN.air_interface[instance]) RAN.eNB_instance=instance RAN.TerminateeNB(HTML,EPC) - if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted: - self.testCase_id = 'AUTO-KILL-flexran-ctl' - HTML.testCase_id = self.testCase_id - self.desc = 'Automatic Termination of FlexRan CTL' - HTML.desc = self.desc - self.ShowTestID() - self.TerminateFlexranCtrl(HTML,RAN,EPC) if CONTAINERS.yamlPath[0] != '': self.testCase_id = 'AUTO-KILL-CONTAINERS' HTML.testCase_id = self.testCase_id @@ -3712,9 +3617,6 @@ class OaiCiTest(): ueIdx += 1 cnt += 1 - msg = "FlexRan Controller is connected to " + str(self.x2NbENBs) + " eNB(s)" - logging.debug(msg) - message += msg + '\n' cnt = 0 while cnt < self.x2NbENBs: msg = " -- eNB: " + str(self.x2ENBBsIds[idx][cnt]) + " is connected to " + str(len(self.x2ENBConnectedUEs[idx][cnt])) + " UE(s)" @@ -3736,65 +3638,7 @@ class OaiCiTest(): logging.debug(msg) fullMessage += msg + '\n' if self.x2_ho_options == 'network': - if RAN.flexranCtrlInstalled and RAN.flexranCtrlStarted: - self.x2ENBBsIds = [] - self.x2ENBConnectedUEs = [] - self.x2ENBBsIds.append([]) - self.x2ENBBsIds.append([]) - self.x2ENBConnectedUEs.append([]) - self.x2ENBConnectedUEs.append([]) - fullMessage += self.X2_Status(0, self.testCase_id + '_pre_ho.json') - - msg = "Activating the X2 Net control on each eNB" - logging.debug(msg) - fullMessage += msg + '\n' - eNB_cnt = self.x2NbENBs - cnt = 0 - while cnt < eNB_cnt: - cmd = "curl -XPOST http://" + EPC.IPAddress + ":9999/rrc/x2_ho_net_control/enb/" + str(self.x2ENBBsIds[0][cnt]) + "/1" - logging.debug(cmd) - fullMessage += cmd + '\n' - subprocess.run(cmd, shell=True) - cnt += 1 - # Waiting for the activation to be active - time.sleep(10) - msg = "Switching UE(s) from eNB to eNB" - logging.debug(msg) - fullMessage += msg + '\n' - cnt = 0 - while cnt < eNB_cnt: - ueIdx = 0 - while ueIdx < len(self.x2ENBConnectedUEs[0][cnt]): - cmd = "curl -XPOST http://" + EPC.IPAddress() + ":9999/rrc/ho/senb/" + str(self.x2ENBBsIds[0][cnt]) + "/ue/" + str(self.x2ENBConnectedUEs[0][cnt][ueIdx]) + "/tenb/" + str(self.x2ENBBsIds[0][eNB_cnt - cnt - 1]) - logging.debug(cmd) - fullMessage += cmd + '\n' - subprocess.run(cmd, shell=True) - ueIdx += 1 - cnt += 1 - time.sleep(10) - # check - logging.debug("Checking the Status after X2 Handover") - fullMessage += self.X2_Status(1, self.testCase_id + '_post_ho.json') - cnt = 0 - x2Status = True - while cnt < eNB_cnt: - if len(self.x2ENBConnectedUEs[0][cnt]) == len(self.x2ENBConnectedUEs[1][cnt]): - x2Status = False - cnt += 1 - if x2Status: - msg = "X2 Handover was successful" - logging.debug(msg) - fullMessage += msg + '' - html_queue.put(fullMessage) - HTML.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue) - else: - msg = "X2 Handover FAILED" - logging.error(msg) - fullMessage += msg + '' - html_queue.put(fullMessage) - HTML.CreateHtmlTestRowQueue('N/A', 'OK', len(self.UEDevices), html_queue) - else: - HTML.CreateHtmlTestRow('Cannot perform requested X2 Handover', 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRow('Cannot perform requested X2 Handover', 'KO', CONST.ALL_PROCESSES_OK) def LogCollectBuild(self,RAN): # Some pipelines are using "none" IP / Credentials diff --git a/ci-scripts/conf_files/benetel-4g.conf b/ci-scripts/conf_files/benetel-4g.conf index e2974a171d..0aef179a7d 100644 --- a/ci-scripts/conf_files/benetel-4g.conf +++ b/ci-scripts/conf_files/benetel-4g.conf @@ -256,16 +256,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf index 1102528cd3..e47d52d492 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf @@ -203,15 +203,5 @@ log_config = { global_log_level = "info"; pdcp_log_level = "info"; rrc_log_level = "info"; - flexran_agent_log_level = "info"; gtp_log_level = "info"; }; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf index ec7620a724..ff3870a3c5 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.25PRB.conf @@ -203,15 +203,5 @@ log_config = { global_log_level = "info"; pdcp_log_level = "info"; rrc_log_level = "info"; - flexran_agent_log_level = "info"; gtp_log_level = "info"; }; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf index 7e64ad8039..ab5661d826 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.50PRB.conf @@ -203,15 +203,5 @@ log_config = { global_log_level = "info"; pdcp_log_level = "info"; rrc_log_level = "info"; - flexran_agent_log_level = "info"; gtp_log_level = "info"; }; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index 217c694055..7a97a1c2c1 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -100,16 +100,6 @@ log_config = { phy_log_level = "info"; mac_log_level = "info"; rlc_log_level = "info"; - flexran_agent_log_level = "info"; -}; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; }; THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf index 61d4cff51b..dd5d4a662d 100644 --- a/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.25PRB.usrpb210.conf @@ -100,16 +100,6 @@ log_config = { phy_log_level = "info"; mac_log_level = "info"; rlc_log_level = "info"; - flexran_agent_log_level = "info"; -}; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; }; THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf index 4342e8f4b4..f518dcfc12 100644 --- a/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.50PRB.usrpb210.conf @@ -100,16 +100,6 @@ log_config = { phy_log_level = "info"; mac_log_level = "info"; rlc_log_level = "info"; - flexran_agent_log_level = "info"; -}; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; }; THREAD_STRUCT = ( diff --git a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf index 122654df26..6bd83038c7 100644 --- a/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band13.tm1.25PRB.usrpb210.conf @@ -235,16 +235,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf index ae572f9e05..ba10f14299 100644 --- a/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf +++ b/ci-scripts/conf_files/enb.band13.tm1.50PRB.emtc.conf @@ -437,16 +437,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf index 5a4be9f187..b85d2c2989 100644 --- a/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band17.tm1.25PRB.usrpb210.conf @@ -247,16 +247,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf index 7ac056b75e..dffa4010b7 100644 --- a/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band17.tm1.mbms.25PRB.usrpb210.conf @@ -391,16 +391,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf index a7100a97e3..4110591808 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2.100PRB.usrpn310.conf @@ -251,16 +251,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf index 1f358c1571..02e0bc04ab 100644 --- a/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.lte_2x2_tm2.100PRB.usrpn310.conf @@ -251,16 +251,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf index f7088aee52..799bd9354a 100644 --- a/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf +++ b/ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf @@ -251,16 +251,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf index 2df7ed455a..ae9aacf0ca 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -216,13 +216,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf index 5738a65569..736f0e161d 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -216,13 +216,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf index 8ea3abf01e..bc3179f98d 100644 --- a/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -216,13 +216,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf index 926e65eddd..99b2140ffa 100644 --- a/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band40.tm2.25PRB.FairScheduler.usrpb210.conf @@ -214,13 +214,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf index bd7e19ca60..27c52d7408 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.100PRB.usrpb210.conf @@ -243,16 +243,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf index fdd2304ba5..d78a559611 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.slave.usrpb210.conf @@ -252,16 +252,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf index 5b05627700..035c7e58a9 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf @@ -250,16 +250,6 @@ THREAD_STRUCT = } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 44d22a8953..5fd6142c9d 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -251,15 +251,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf index 38cd90cd44..12e27c7864 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf @@ -251,16 +251,6 @@ THREAD_STRUCT = } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf index c8223d0c42..dcbe68ff03 100644 --- a/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm2.25PRB.usrpb210.conf @@ -245,16 +245,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf index 609d76d720..2a82dee0b9 100644 --- a/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.slave.band13.tm1.25PRB.usrpb210.conf @@ -240,16 +240,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "eth0"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/ci-scripts/conf_files/lte-fdd-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-basic-sim.conf index 6c81d512a6..600b8a71d0 100644 --- a/ci-scripts/conf_files/lte-fdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-basic-sim.conf @@ -244,16 +244,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "ens3"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf index c2f6ab9d6c..74e9f4acc0 100644 --- a/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-fembms-basic-sim.conf @@ -393,16 +393,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "ens3"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf index 9c74d2e328..09535c13f4 100644 --- a/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf +++ b/ci-scripts/conf_files/lte-fdd-mbms-basic-sim.conf @@ -393,16 +393,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "ens3"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/lte-tdd-basic-sim.conf b/ci-scripts/conf_files/lte-tdd-basic-sim.conf index ddfdddda83..fa017ce63e 100644 --- a/ci-scripts/conf_files/lte-tdd-basic-sim.conf +++ b/ci-scripts/conf_files/lte-tdd-basic-sim.conf @@ -216,13 +216,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "ens3"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf index 47bcc35cb3..094ea88ad1 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.100PRB.FairScheduler.usrpb210.conf @@ -223,13 +223,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf index f430f51ebe..c325870035 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.25PRB.FairScheduler.usrpb210.conf @@ -223,13 +223,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf index 98699aac26..41a3c08552 100644 --- a/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band40.tm1.50PRB.FairScheduler.usrpb210.conf @@ -223,13 +223,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf index 798871edce..a6829fe215 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.100PRB.usrpb210.conf @@ -250,16 +250,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf index 628188aea2..a94a243b89 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.25PRB.usrpb210.conf @@ -250,16 +250,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf index 75d947c009..3366e1ee4b 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.if4p5.lo.50PRB.usrpb210.conf @@ -250,16 +250,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "CI_FLEXRAN_CTL_IP_ADDR"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index a636bf9433..8ee4a0a5e6 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -638,10 +638,6 @@ class EPCManagement(): # Checking for additional services mySSH.command('docker-compose config', '\$', 5) configResponse = mySSH.getBefore() - if configResponse.count('flexran_rtc') == 1: - mySSH.command('docker-compose up -d flexran_rtc', '\$', 60) - listOfContainers += ' prod-flexran-rtc' - expectedHealthyContainers += 1 if configResponse.count('trf_gen') == 1: mySSH.command('docker-compose up -d trf_gen', '\$', 60) listOfContainers += ' prod-trf-gen' @@ -760,9 +756,6 @@ class EPCManagement(): # Checking for additional services mySSH.command('docker-compose config', '\$', 5) configResponse = mySSH.getBefore() - if configResponse.count('flexran_rtc') == 1: - listOfContainers += ' prod-flexran-rtc' - nbContainers += 1 if configResponse.count('trf_gen') == 1: listOfContainers += ' prod-trf-gen' nbContainers += 1 diff --git a/ci-scripts/main.py b/ci-scripts/main.py index f1ec41a1e7..d1e3638a28 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -796,7 +796,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re logging.error('requested test is invalidly formatted: ' + test) sys.exit(1) if (EPC.IPAddress != '') and (EPC.IPAddress != 'none'): - CiTestObj.CheckFlexranCtrlInstallation(RAN,EPC,CONTAINERS) EPC.SetMmeIPAddress() EPC.SetAmfIPAddress() @@ -943,10 +942,6 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re EPC.DeployEpc(HTML) elif action == 'Undeploy_EPC': EPC.UndeployEpc(HTML) - elif action == 'Initialize_FlexranCtrl': - CiTestObj.InitializeFlexranCtrl(HTML,RAN,EPC) - elif action == 'Terminate_FlexranCtrl': - CiTestObj.TerminateFlexranCtrl(HTML,RAN,EPC) elif action == 'IdleSleep': CiTestObj.IdleSleep(HTML) elif action == 'Perform_X2_Handover': diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index c758e620b7..fd6a073f21 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -85,10 +85,6 @@ class RANManagement(): self.eNBOptions = ['', '', ''] self.eNBmbmsEnables = [False, False, False] self.eNBstatuses = [-1, -1, -1] - self.flexranCtrlInstalled = False - self.flexranCtrlStarted = False - self.flexranCtrlDeployed = False - self.flexranCtrlIpAddress = '' self.testCase_id = '' self.epcPcapFile = '' self.runtime_stats= '' @@ -443,11 +439,6 @@ class RANManagement(): mySSH.command('sed -i -e \'s/CI_RRU1_IP_ADDR/' + self.eNB1IPAddress + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_RRU2_IP_ADDR/' + self.eNB2IPAddress + '/\' ' + ci_full_config_file, '\$', 2); mySSH.command('sed -i -e \'s/CI_FR1_CTL_ENB_IP_ADDR/' + self.eNBIPAddress + '/\' ' + ci_full_config_file, '\$', 2); - if (self.flexranCtrlInstalled and self.flexranCtrlStarted) or self.flexranCtrlDeployed: - mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED = "yes";/\' ' + ci_full_config_file, '\$', 2); - mySSH.command('sed -i -e \'s/CI_FLEXRAN_CTL_IP_ADDR/' + self.flexranCtrlIpAddress + '/\' ' + ci_full_config_file, '\$', 2); - else: - mySSH.command('sed -i -e \'s/FLEXRAN_ENABLED.*;/FLEXRAN_ENABLED = "no";/\' ' + ci_full_config_file, '\$', 2); self.eNBmbmsEnables[int(self.eNB_instance)] = False mySSH.command('grep --colour=never enable_enb_m2 ' + ci_full_config_file, '\$', 2); result = re.search('yes', mySSH.getBefore()) diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 4e1630715f..f6c683c598 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -53,7 +53,7 @@ function details_table { echo " Message" >> $3 echo " " >> $3 - LIST_MESSAGES=`egrep "error:|warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto|disabling jobserver mode"` + LIST_MESSAGES=`egrep "error:|warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|disabling jobserver mode"` COMPLETE_MESSAGE="start" for MESSAGE in $LIST_MESSAGES do @@ -146,7 +146,7 @@ function summary_table_row { else echo " $NB_ERRORS" >> ./build_results.html fi - NB_WARNINGS=`egrep "warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|flexran.proto|disabling jobserver mode" | egrep -c "warning:"` + NB_WARNINGS=`egrep "warning:" $2 | egrep -v "jobserver unavailable|Clock skew detected.|disabling jobserver mode" | egrep -c "warning:"` if [ $NB_WARNINGS -eq 0 ] then echo " $NB_WARNINGS" >> ./build_results.html diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index a191bd3332..b4dabb1654 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -20,8 +20,6 @@ - Ping - Iperf - Reboot_UE - - Initialize_FlexranCtrl - - Terminate_FlexranCtrl - Deploy_EPC - Undeploy_EPC - Initialize_HSS diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml index 1667e94f71..fdf20e5e91 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml @@ -22,7 +22,7 @@ --> test-05-tm1-rrc-w-flex - Test-05MHz-TM1-RRC-Inactivity-FlexRan + Test-05MHz-TM1-RRC-Inactivity tasks 1 @@ -70,19 +70,9 @@ 2 - - Initialize_FlexranCtrl - Starting Flexran Controller - - - - Terminate_FlexranCtrl - Stopping Flexran Controller - - Initialize_eNB - Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -- with FlexRan Ctl + Initialize eNB (FDD/Band7/5MHz) for RRC Inactivity Timer testing -O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --log_config.global_log_options level,nocolor,time diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml index 36c4e2c1a8..e3198bacee 100644 --- a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml @@ -91,16 +91,6 @@ 1 - - Initialize_FlexranCtrl - Starting Flexran Controller - - - - Terminate_FlexranCtrl - Stopping Flexran Controller - - Attach_UE Attach UE @@ -188,16 +178,4 @@ 50 - - Perform_X2_Handover - Doing a Flexran-Controlled X2 Handover - network - - - - Perform_X2_Handover - Doing a Flexran-Controlled X2 Handover - network - - diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_full_terminate.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_full_terminate.xml index f8aaafd9a0..488b95af13 100644 --- a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_full_terminate.xml +++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_full_terminate.xml @@ -43,10 +43,4 @@ 1 1 - - - Terminate_FlexranCtrl - Stopping Flexran Controller - - diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml index e7a2c42cd6..40a137adb4 100644 --- a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml @@ -48,16 +48,6 @@ 10 - - Initialize_FlexranCtrl - Starting Flexran Controller - - - - Terminate_FlexranCtrl - Stopping Flexran Controller - - Initialize_eNB Initialize Master eNB (FDD/Band7/5MHz) @@ -177,16 +167,4 @@ single-ue - - Perform_X2_Handover - Doing a Flexran-Controlled X2 Handover - network - - - - Perform_X2_Handover - Doing a Flexran-Controlled X2 Handover - network - - diff --git a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml index 0562adab4b..b3e3ede92e 100644 --- a/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_l2sim_fdd/docker-compose.yml @@ -203,9 +203,6 @@ services: ENB_INTERFACE_NAME_FOR_S1U: eth0 ENB_IPV4_ADDRESS_FOR_S1U: 192.168.61.1 ENB_IPV4_ADDRESS_FOR_X2C: 192.168.61.1 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.1 LOCAL_S_IF_NAME: 'lo:' REMOTE_S_ADDRESS: 127.0.0.1 LOCAL_S_ADDRESS: 127.0.0.2 diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml index b44e09e454..ab54c3ada1 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/docker-compose.yml @@ -206,9 +206,6 @@ services: ENB_S1U_IF_NAME: eth0 ENB_S1U_IP_ADDRESS: 192.168.61.20 ENB_X2_IP_ADDRESS: 192.168.61.20 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.10 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time healthcheck: test: /bin/bash -c "pgrep lte-softmodem" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml index e0a059222f..dea6724926 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz_noS1/docker-compose.yml @@ -28,9 +28,6 @@ services: ENB_S1U_IF_NAME: eth0 ENB_S1U_IP_ADDRESS: 192.168.61.20 ENB_X2_IP_ADDRESS: 192.168.61.20 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.10 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time --noS1 healthcheck: test: /bin/bash -c "pgrep lte-softmodem" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml index 730cedd720..b24ebd367d 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_10MHz/docker-compose.yml @@ -206,9 +206,6 @@ services: ENB_S1U_IF_NAME: eth0 ENB_S1U_IP_ADDRESS: 192.168.61.20 ENB_X2_IP_ADDRESS: 192.168.61.20 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.10 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time healthcheck: test: /bin/bash -c "pgrep lte-softmodem" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml index c1ea936f58..ebe2b2f4a0 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_20MHz/docker-compose.yml @@ -206,9 +206,6 @@ services: ENB_S1U_IF_NAME: eth0 ENB_S1U_IP_ADDRESS: 192.168.61.20 ENB_X2_IP_ADDRESS: 192.168.61.20 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.10 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time healthcheck: test: /bin/bash -c "pgrep lte-softmodem" diff --git a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml index f497709221..63c4965ddb 100644 --- a/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/4g_rfsimulator_tdd_05MHz/docker-compose.yml @@ -205,9 +205,6 @@ services: F1_CU_IP_ADDRESS: 192.168.61.20 S1U_IF_NAME: eth0 F1_CU_IP_ADDRESS: 192.168.61.20 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 192.168.61.10 USE_ADDITIONAL_OPTIONS: --rfsim --log_config.global_log_options level,nocolor,time healthcheck: test: /bin/bash -c "pgrep lte-softmodem" diff --git a/ci-scripts/yaml_files/fr1_enb_mono_fdd_tim/docker-compose.yml b/ci-scripts/yaml_files/fr1_enb_mono_fdd_tim/docker-compose.yml index b7dd3d0296..be4ccbf0aa 100644 --- a/ci-scripts/yaml_files/fr1_enb_mono_fdd_tim/docker-compose.yml +++ b/ci-scripts/yaml_files/fr1_enb_mono_fdd_tim/docker-compose.yml @@ -24,9 +24,6 @@ services: ENB_S1U_IF_NAME: eth0 ENB_S1U_IP_ADDRESS: 192.168.61.30 ENB_X2_IP_ADDRESS: 192.168.61.30 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: CI_FLEXRAN_CTL_IP_ADDR USE_ADDITIONAL_OPTIONS: --RUs.[0].max_rxgain 115 --RUs.[0].max_pdschReferenceSignalPower -27 --eNBs.[0].component_carriers.[0].pucch_p0_Nominal -96 --log_config.global_log_options level,nocolor,time volumes: - /dev:/dev diff --git a/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1/docker-compose.yml b/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1/docker-compose.yml index b98830d0f3..7ed56bffe4 100644 --- a/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1/docker-compose.yml +++ b/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 172.21.18.46 ENB_X2_IP_ADDRESS: 172.21.18.46 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.18.48 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1_no_rrc_activity/docker-compose.yml b/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1_no_rrc_activity/docker-compose.yml index e7309df77c..804b9c758b 100644 --- a/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1_no_rrc_activity/docker-compose.yml +++ b/ci-scripts/yaml_files/lte_b200_fdd_05Mhz_tm1_no_rrc_activity/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 172.21.18.46 ENB_X2_IP_ADDRESS: 172.21.18.46 RRC_INACTIVITY_THRESHOLD: 30 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.18.48 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1/docker-compose.yml b/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1/docker-compose.yml index ddcc805955..d428549f2b 100644 --- a/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1/docker-compose.yml +++ b/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 172.21.18.46 ENB_X2_IP_ADDRESS: 172.21.18.46 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.18.48 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --RUs.[0].max_rxgain 120 --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1_cdrx/docker-compose.yml b/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1_cdrx/docker-compose.yml index 78eb94eaca..6a8dcaf746 100644 --- a/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1_cdrx/docker-compose.yml +++ b/ci-scripts/yaml_files/lte_b200_fdd_10Mhz_tm1_cdrx/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 172.21.18.46 ENB_X2_IP_ADDRESS: 172.21.18.46 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.18.48 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --RUs.[0].max_rxgain 120 --eNBs.[0].component_carriers.[0].drx_Config_present prSetup --eNBs.[0].component_carriers.[0].drx_onDurationTimer psf1 --eNBs.[0].component_carriers.[0].drx_InactivityTimer psf1 --eNBs.[0].component_carriers.[0].drx_RetransmissionTimer psf1 --eNBs.[0].component_carriers.[0].drx_longDrx_CycleStartOffset_present prSf128 --eNBs.[0].component_carriers.[0].drx_longDrx_CycleStartOffset 0 --eNBs.[0].component_carriers.[0].drx_shortDrx_Cycle sf16 --eNBs.[0].component_carriers.[0].drx_shortDrx_ShortCycleTimer 3 --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/lte_b200_fdd_20Mhz_tm1/docker-compose.yml b/ci-scripts/yaml_files/lte_b200_fdd_20Mhz_tm1/docker-compose.yml index cc52d72602..1f21fd9152 100644 --- a/ci-scripts/yaml_files/lte_b200_fdd_20Mhz_tm1/docker-compose.yml +++ b/ci-scripts/yaml_files/lte_b200_fdd_20Mhz_tm1/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 172.21.18.46 ENB_X2_IP_ADDRESS: 172.21.18.46 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.18.48 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --RUs.[0].max_rxgain 115 --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml index 2df5eac61b..70e8fc7c8e 100644 --- a/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_enb/docker-compose.yml @@ -27,9 +27,6 @@ services: ENB_S1U_IP_ADDRESS: 192.168.68.130 ENB_X2_IP_ADDRESS: 192.168.68.130 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_SINGLE_THREAD USE_ADDITIONAL_OPTIONS: --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml index 208e1564cd..06f0cd8d4a 100644 --- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml @@ -22,9 +22,6 @@ services: GNB_S1U_IP_ADDRESS: 192.168.68.194 GNB_X2_IP_ADDRESS: 192.168.68.194 RRC_INACTIVITY_THRESHOLD: 0 - FLEXRAN_ENABLED: 'no' - FLEXRAN_INTERFACE_NAME: eth0 - FLEXRAN_IPV4_ADDRESS: 172.21.16.136 THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function volumes: diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 7bff788fd8..7a7f4229fe 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -259,9 +259,6 @@ function main() { RU=1 echo_info "Will compile RRU" shift;; - -a | --agent) - echo_info "FlexRAN support is always compiled into the eNB" - shift;; --UE) UE=1 echo_info "Will compile UE" @@ -511,9 +508,6 @@ function main() { # flash_firmware_iris #fi fi - echo_info "Installing protobuf/protobuf-c for flexran agent support" - install_protobuf_c - echo_success "protobuf/protobuf-c installation successful" fi if [ "$INSTALL_OPTIONAL" = "1" ] ; then diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 6a308deaaa..facbb5ea0c 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -245,89 +245,6 @@ compilations() { # External packages installers ############################################ -install_protobuf_from_source(){ - protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt - echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " - ( - cd /tmp - echo "Downloading protobuf" - #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 - #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz - #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner - #cd protobuf-2.6.1/ - - if [ $IS_CONTAINER -eq 0 ] - then - rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 - wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner - cd protobuf-3.3.0/ - else - export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs - rm -rf /tmp/protobuf - git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf - cd /tmp/protobuf - git submodule update --init --recursive - ./autogen.sh - fi - ./configure - echo "Compiling protobuf" - make -j`nproc` - $SUDO make install - $SUDO ldconfig - if [[ -v CI_ENV ]]; then - cd /tmp - $SUDO rm -rf protobuf* - fi - ) >& $protobuf_install_log -} - -install_protobuf_c_from_source(){ - protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt - echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " - ( - if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - fi - cd /tmp - echo "Downloading protobuf-c" - rm -rf /tmp/protobuf-c - git clone https://github.com/protobuf-c/protobuf-c.git - cd protobuf-c - git checkout 2a46af42784abf86804d536f6e0122d47cfeea45 - ./autogen.sh - ./configure - echo "Compiling protobuf-c" - make -j`nproc` - $SUDO make install - $SUDO ldconfig - if [[ -v CI_ENV ]]; then - cd /tmp - $SUDO rm -rf protobuf* - fi - ) >& $protobuf_c_install_log -} - -install_protobuf_c() { - local protobuf_packages="" - case "$(get_distribution_release)" in - "ubuntu18.04" | "ubuntu20.04" | "ubuntu21.04" | "ubuntu22.04") - protobuf_packages="protobuf-c-compiler libprotobuf-c1 libprotobuf-c-dev" - ;; - esac - case "$OS_DISTRO" in - "rhel" | "centos" | "fedora") # in EPEL and Fedora repos (at least as of 35) - protobuf_packages="protobuf-c-compiler protobuf-c protobuf-c-devel" - ;; - esac - if [[ "$protobuf_packages" == "" ]]; then - install_protobuf_from_source - install_protobuf_c_from_source - else - $SUDO $INSTALLER -y install $protobuf_packages - fi -} - install_usrp_uhd_driver_from_source(){ uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log " @@ -802,7 +719,6 @@ check_install_oai_software() { openssl \ subversion \ xmlstarlet \ - libyaml-dev \ wget \ libxpm-dev \ libboost-all-dev @@ -883,8 +799,7 @@ check_install_oai_software() { lapack \ lapack-devel \ blas \ - blas-devel \ - libyaml-devel + blas-devel fi install_asn1c_from_source $1 diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf deleted file mode 100755 index 5c1b523f8c..0000000000 --- a/cmake_targets/tools/generate_protobuf +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -function main() -{ -mkdir -p $1 - -#echo generate protobuf messages inside $1 $2 - -c_out=$1 -shift -proto_path=$1 -shift - -protoc-c --c_out=$c_out --proto_path=$proto_path $* -#protoc --cpp_out=$c_out --proto_path=$proto_path $* - -} - -main "$@" diff --git a/common/ran_context.h b/common/ran_context.h index 055c6f783e..7a035f59bb 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -39,9 +39,6 @@ #include "PHY/types.h" #include "PHY/impl_defs_top.h" -//#include "ENB_APP/enb_config.h" -#include "flexran_agent_defs.h" - #include "PHY/defs_L1_NB_IoT.h" #include "RRC/LTE/defs_NB_IoT.h" #include "RRC/LTE/rrc_defs.h" @@ -82,8 +79,6 @@ typedef struct { int *nb_L1_CC; /// Number of RU instances in this node int nb_RU; - /// FlexRAN context variables - flexran_agent_info_t **flexran; /// eNB context variables struct PHY_VARS_eNB_s ***eNB; /// gNB context variables diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md index d601da2e7b..04ff9647a8 100644 --- a/common/utils/LOG/DOC/rtusage.md +++ b/common/utils/LOG/DOC/rtusage.md @@ -71,7 +71,6 @@ The list of components defined within oai can be retrieved from the [config mod [CONFIG] log_config.eral_log_level set to default value "info" [CONFIG] log_config.mral_log_level set to default value "info" [CONFIG] log_config.enb_app_log_level set to default value "info" -[CONFIG] log_config.flexran_agent_log_level set to default value "info" [CONFIG] log_config.tmr_log_level set to default value "info" [CONFIG] log_config.usim_log_level set to default value "info" [CONFIG] log_config.localize_log_level set to default value "info" @@ -140,8 +139,6 @@ The list of components defined within oai can be retrieved from the [config mod [CONFIG] log_config.mral_log_infile set to default value [CONFIG] enb_app_log_infile: 0 [CONFIG] log_config.enb_app_log_infile set to default value -[CONFIG] flexran_agent_log_infile: 0 -[CONFIG] log_config.flexran_agent_log_infile set to default value [CONFIG] tmr_log_infile: 0 [CONFIG] log_config.tmr_log_infile set to default value [CONFIG] usim_log_infile: 0 diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index b5c2f20767..2215e4bd40 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -471,8 +471,6 @@ int logInit (void) register_log_component("ENB_APP","log",ENB_APP); register_log_component("MCE_APP","log",MCE_APP); register_log_component("MME_APP","log",MME_APP); - register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT); - register_log_component("PROTO_AGENT","log",PROTO_AGENT); register_log_component("TMR","",TMR); register_log_component("EMU","log",EMU); register_log_component("USIM","txt",USIM); diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 06cc9a83ba..bf1ca28ed0 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -229,11 +229,9 @@ typedef enum { ENB_APP, MCE_APP, MME_APP, - FLEXRAN_AGENT, TMR, USIM, LOCALIZE, - PROTO_AGENT, F1U, X2AP, M2AP, diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 4d18bea384..97185aa138 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -675,27 +675,6 @@ ID = LEGACY_MME_APP_TRACE GROUP = ALL:LEGACY_MME_APP:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log -ID = LEGACY_FLEXRAN_AGENT_INFO - DESC = FLEXRAN_AGENT legacy logs - info level - GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_INFO:LEGACY - FORMAT = string,log -ID = LEGACY_FLEXRAN_AGENT_ERROR - DESC = FLEXRAN_AGENT legacy logs - error level - GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_ERROR:LEGACY - FORMAT = string,log -ID = LEGACY_FLEXRAN_AGENT_WARNING - DESC = FLEXRAN_AGENT legacy logs - warning level - GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_WARNING:LEGACY - FORMAT = string,log -ID = LEGACY_FLEXRAN_AGENT_DEBUG - DESC = FLEXRAN_AGENT legacy logs - debug level - GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_DEBUG:LEGACY - FORMAT = string,log -ID = LEGACY_FLEXRAN_AGENT_TRACE - DESC = FLEXRAN_AGENT legacy logs - trace level - GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_TRACE:LEGACY - FORMAT = string,log - ID = LEGACY_SCTP_INFO DESC = SCTP legacy logs - info level GROUP = ALL:LEGACY_SCTP:LEGACY_GROUP_INFO:LEGACY @@ -1183,26 +1162,6 @@ ID = LEGACY_componentP_TRACE -ID = LEGACY_PROTO_AGENT_DEBUG - DESC = PROTO AGENT DEBUG LEVEL - GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_DEBUG:LEGACY - FORMAT = string,log - -ID = LEGACY_PROTO_AGENT_INFO - DESC = PROTO AGENT INFO LEVEL - GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY - FORMAT = string,log - -ID = LEGACY_PROTO_AGENT_WARNING - DESC = PROTO AGENT WARNING LEVEL - GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_WARNING:LEGACY - FORMAT = string,log - -ID = LEGACY_PROTO_AGENT_ERROR - DESC = PROTO AGENT ERROR LEVEL - GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY - FORMAT = string,log - ID = LEGACY_F1U_DEBUG DESC = F1U DEBUG LEVEL GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY diff --git a/common/utils/ocp_itti/all_msg.h b/common/utils/ocp_itti/all_msg.h index c4bedc2cf6..ab75eaffdd 100644 --- a/common/utils/ocp_itti/all_msg.h +++ b/common/utils/ocp_itti/all_msg.h @@ -14,7 +14,6 @@ #include "openair2/COMMON/sctp_messages_def.h" #include "openair2/COMMON/udp_messages_def.h" #include "openair2/COMMON/gtpv1_u_messages_def.h" -#include "openair2/COMMON/flexran_messages_def.h" #include "openair2/COMMON/f1ap_messages_def.h" #include "openair2/COMMON/ngap_messages_def.h" diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index a8518af660..9da3f03c23 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -327,7 +327,6 @@ void *rrc_enb_process_msg(void *); TASK_DEF(TASK_GNB_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MCE_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \ - TASK_DEF(TASK_FLEXRAN_AGENT,TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_PHY_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MAC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RLC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md index cb008fc8bb..c11274b0ab 100644 --- a/common/utils/telnetsrv/DOC/telnetlog.md +++ b/common/utils/telnetsrv/DOC/telnetlog.md @@ -32,11 +32,10 @@ log level/verbosity comp 27 OSA set to info / medium (disabled) log level/verbosity comp 28 eRAL set to info / medium (disabled) log level/verbosity comp 29 mRAL set to info / medium (disabled) log level/verbosity comp 30 ENB_APP set to info / medium (disabled) -log level/verbosity comp 31 FLEXRAN_AGENT set to info / medium (disabled) -log level/verbosity comp 32 TMR set to info / medium (disabled) -log level/verbosity comp 33 USIM set to info / medium (disabled) -log level/verbosity comp 34 LOCALIZE set to info / medium (disabled) -log level/verbosity comp 35 RRH set to info / medium (disabled) +log level/verbosity comp 31 TMR set to info / medium (disabled) +log level/verbosity comp 32 USIM set to info / medium (disabled) +log level/verbosity comp 33 LOCALIZE set to info / medium (disabled) +log level/verbosity comp 34 RRH set to info / medium (disabled) softmodem> softmodem log show Available log levels: emerg alert crit error warn notice info debug file trace @@ -73,13 +72,12 @@ component verbosity level enabled 28 eRAL: medium info N 29 mRAL: medium info N 30 ENB_APP: medium info N -31 FLEXRAN_AGENT: medium info N -32 TMR: medium info N -33 USIM: medium info N -34 LOCALIZE: medium info N -35 RRH: medium info N -36 comp36?: medium info Y -37 LOADER: medium alert Y +31 TMR: medium info N +32 USIM: medium info N +33 LOCALIZE: medium info N +34 RRH: medium info N +35 comp36?: medium info Y +36 LOADER: medium alert Y softmodem> softmodem log level_error 0-4 log level/verbosity comp 0 PHY set to error / medium (enabled) log level/verbosity comp 1 MAC set to error / medium (enabled) diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index 9a2d9e22f2..20d8f79ff0 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -144,8 +144,7 @@ runs tests: triggers pipelines: - [eNB-CI-FDD-Band7-B210](https://open5glab.eurecom.fr:8083/jenkins/job/eNB-CI-FDD-Band7-B210/) - hutch + B210, nano w/ ltebox + 2x UE - - tests T tracer, information through FlexRAN, RRC inactivity timers, - inactivity timers + FlexRAN, different bandwidths + - tests T tracer, RRC inactivity timers, different bandwidths - [eNB-CI-IF4p5-FDD-Band7-B210](https://open5glab.eurecom.fr:8083/jenkins/job/eNB-CI-IF4p5-FDD-Band7-B210/) - hutch + B210, nano w/ ltebox + 2x UE - tests IF4.5 split over bandwidths 5, 10, 20 MHz in Band 7 diff --git a/doc/testing_gnb_w_cots_ue_resources/oai_enb.log b/doc/testing_gnb_w_cots_ue_resources/oai_enb.log index a24e22432a..50d2ecb2d2 100755 --- a/doc/testing_gnb_w_cots_ue_resources/oai_enb.log +++ b/doc/testing_gnb_w_cots_ue_resources/oai_enb.log @@ -54,7 +54,6 @@ ITTI init, useMME: 1 [TMR] Starting itti queue: TASK_GNB_APP as task 23 [TMR] Starting itti queue: TASK_MCE_APP as task 24 [TMR] Starting itti queue: TASK_MME_APP as task 25 -[TMR] Starting itti queue: TASK_FLEXRAN_AGENT as task 26 [TMR] Starting itti queue: TASK_PHY_UE as task 27 [TMR] Starting itti queue: TASK_MAC_UE as task 28 [TMR] Starting itti queue: TASK_RLC_UE as task 29 @@ -113,7 +112,6 @@ No SL configuration skipping it Creating RC.ru[0]:0x2b41780 Setting function for RU 0 to eNodeB_3GPP [PHY] number of L1 instances 1, number of RU 1, number of CPU cores 4 -[FLEXRAN_AGENT] FlexRAN Agent for eNB 0 is DISABLED [PDCP] PDCP layer has been initialized [PDCP] pdcp init,usegtp [PDCP] ENB pdcp will use tun interface for MBMS diff --git a/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log b/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log index 3c76c0d0d6..b1da30a9aa 100755 --- a/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log +++ b/doc/testing_gnb_w_cots_ue_resources/oai_gnb.log @@ -50,7 +50,6 @@ CPU Freq is 3.092986 [TMR] Starting itti queue: TASK_GNB_APP as task 23 [TMR] Starting itti queue: TASK_MCE_APP as task 24 [TMR] Starting itti queue: TASK_MME_APP as task 25 -[TMR] Starting itti queue: TASK_FLEXRAN_AGENT as task 26 [TMR] Starting itti queue: TASK_PHY_UE as task 27 [TMR] Starting itti queue: TASK_MAC_UE as task 28 [TMR] Starting itti queue: TASK_RLC_UE as task 29 diff --git a/docker/Dockerfile.base.rhel8.2 b/docker/Dockerfile.base.rhel8.2 index 5f897bd0e2..ae41956379 100644 --- a/docker/Dockerfile.base.rhel8.2 +++ b/docker/Dockerfile.base.rhel8.2 @@ -52,9 +52,7 @@ RUN rm -f /etc/rhsm-host && \ psmisc \ git \ # python3-pip and pyyaml are used for conf template generation - python3-pip \ - #unzip is needed for protobuf - unzip && \ + python3-pip && \ pip3 install --ignore-installed pyyaml && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf diff --git a/docker/Dockerfile.base.ubuntu18 b/docker/Dockerfile.base.ubuntu18 index ca23688430..1a19304c10 100644 --- a/docker/Dockerfile.base.ubuntu18 +++ b/docker/Dockerfile.base.ubuntu18 @@ -42,8 +42,6 @@ RUN apt-get update && \ psmisc \ git \ xxd \ - #unzip is needed for protobuf - unzip \ # python3-pip for conf template generation python3-pip && \ pip3 install --ignore-installed pyyaml diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index cc4501b66b..38c5d8ae49 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -48,8 +48,7 @@ RUN yum update -y && \ python3-pip \ net-tools \ iputils \ - iproute \ - libyaml && \ + iproute && \ pip3 install six && \ pip3 install requests && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ @@ -97,7 +96,6 @@ COPY --from=enb-base \ # Now we are copying from builder-image the UHD files. COPY --from=enb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=enb-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=enb-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=enb-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-enb/bin diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 172d04943a..565ee9b85d 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -58,8 +58,7 @@ RUN apt-get update && \ python3 \ python3-six \ python3-requests \ - libusb-1.0-0 \ - libyaml-0-2 && \ + libusb-1.0-0 && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/oai-enb/bin @@ -82,10 +81,7 @@ COPY --from=enb-build \ # Now we are copying from builder-image the UHD files. COPY --from=enb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=enb-base \ - /usr/local/lib/libuhd.so.3.15.0 \ - /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ - /usr/local/lib/ +COPY --from=enb-base /usr/local/lib/libuhd.so.3.15.0 /usr/local/lib COPY --from=enb-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-enb/bin COPY --from=enb-base \ /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.65.1 \ diff --git a/docker/Dockerfile.gNB.aw2s.rhel8.2 b/docker/Dockerfile.gNB.aw2s.rhel8.2 index 09602f6039..0f0c7f9c5c 100644 --- a/docker/Dockerfile.gNB.aw2s.rhel8.2 +++ b/docker/Dockerfile.gNB.aw2s.rhel8.2 @@ -56,8 +56,7 @@ RUN yum repolist --disablerepo=* && \ tzdata \ net-tools \ iputils \ - python3-pip \ - libyaml && \ + python3-pip && \ pip3 install six && \ pip3 install requests && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ @@ -91,8 +90,6 @@ COPY --from=gnb-base \ /lib64/liblapacke.so.3 \ /lib64/ -COPY --from=gnb-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib - RUN ln -s /usr/local/lib/libaw2sori_transpro.so /usr/local/lib/libthirdparty_transpro.so && \ ldconfig diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2 index 6420b469d4..33dc30bd8a 100644 --- a/docker/Dockerfile.gNB.rhel8.2 +++ b/docker/Dockerfile.gNB.rhel8.2 @@ -50,8 +50,7 @@ RUN yum repolist --disablerepo=* && \ python3 \ python3-pip \ net-tools \ - iputils \ - libyaml && \ + iputils && \ pip3 install six && \ pip3 install requests && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ @@ -101,7 +100,6 @@ COPY --from=gnb-base \ # Now we are copying from builder-image the UHD files. COPY --from=gnb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=gnb-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=gnb-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=gnb-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-gnb/bin diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18 index 5c38e8ccef..29b68507a0 100644 --- a/docker/Dockerfile.gNB.ubuntu18 +++ b/docker/Dockerfile.gNB.ubuntu18 @@ -57,8 +57,7 @@ RUN apt-get update && \ python3 \ python3-six \ python3-requests \ - libusb-1.0-0 \ - libyaml-0-2 && \ + libusb-1.0-0 && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/oai-gnb/bin @@ -83,10 +82,7 @@ COPY --from=gnb-build \ # Now we are copying from builder-image the UHD files. COPY --from=gnb-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=gnb-base \ - /usr/local/lib/libuhd.so.3.15.0 \ - /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ - /usr/local/lib/ +COPY --from=gnb-base /usr/local/lib/libuhd.so.3.15.0 /usr/local/lib COPY --from=gnb-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-gnb/bin COPY --from=gnb-base \ /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.65.1 \ diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index f37a04fff1..701e65c8ca 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -49,8 +49,7 @@ RUN yum update -y && \ python3-pip \ iproute \ net-tools \ - iputils \ - libyaml && \ + iputils && \ pip3 install six && \ pip3 install requests && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ @@ -99,7 +98,6 @@ COPY --from=lte-ue-base \ # Now we are copying from builder-image the UHD files. COPY --from=lte-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=lte-ue-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=lte-ue-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=lte-ue-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-lte-ue/bin diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index e387718ab5..e070ba20af 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -58,8 +58,7 @@ RUN apt-get update && \ libusb-1.0-0 \ iputils-ping \ iproute2 \ - iperf \ - libyaml-0-2 && \ + iperf && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/oai-lte-ue/bin @@ -84,10 +83,7 @@ COPY --from=lte-ue-build \ # Now we are copying from builder-image the UHD files. COPY --from=lte-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=lte-ue-base \ - /usr/local/lib/libuhd.so.3.15.0 \ - /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ - /usr/local/lib/ +COPY --from=lte-ue-base /usr/local/lib/libuhd.so.3.15.0 /usr/local/lib COPY --from=lte-ue-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-lte-ue/bin COPY --from=lte-ue-base \ diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2 index 95f1bf1eef..46281b687f 100644 --- a/docker/Dockerfile.nrUE.rhel8.2 +++ b/docker/Dockerfile.nrUE.rhel8.2 @@ -50,8 +50,7 @@ RUN yum update -y && \ python3 \ python3-pip \ libXpm \ - libX11 \ - libyaml && \ + libX11 && \ pip3 install six && \ pip3 install requests && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ @@ -108,7 +107,6 @@ COPY --from=nr-ue-base \ # Now we are copying from builder-image the UHD files. COPY --from=nr-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=nr-ue-base /usr/lib64/libprotobuf-c.so.1 /usr/local/lib COPY --from=nr-ue-base /usr/local/lib64/libuhd.so.3.15.0 /usr/local/lib64 COPY --from=nr-ue-base /usr/local/lib64/uhd/utils/uhd_images_downloader.py /opt/oai-nr-ue/bin diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18 index c7afd2cd24..25379803c0 100644 --- a/docker/Dockerfile.nrUE.ubuntu18 +++ b/docker/Dockerfile.nrUE.ubuntu18 @@ -58,8 +58,7 @@ RUN apt-get update && \ libusb-1.0-0 \ iputils-ping \ iproute2 \ - iperf \ - libyaml-0-2 && \ + iperf && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/oai-nr-ue/bin @@ -91,10 +90,7 @@ COPY --from=nr-ue-build \ # Now we are copying from builder-image the UHD files. COPY --from=nr-ue-base /usr/local/bin/uhd_find_devices /usr/local/bin -COPY --from=nr-ue-base \ - /usr/local/lib/libuhd.so.3.15.0 \ - /usr/lib/x86_64-linux-gnu/libprotobuf-c.so.1 \ - /usr/local/lib/ +COPY --from=nr-ue-base /usr/local/lib/libuhd.so.3.15.0 /usr/local/lib COPY --from=nr-ue-base /usr/local/lib/uhd/utils/uhd_images_downloader.py /opt/oai-nr-ue/bin COPY --from=nr-ue-base \ diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index 944689c21e..ba044d6203 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -55,8 +55,7 @@ RUN yum update -y && \ net-tools \ iputils \ bc \ - iproute \ - libyaml && \ + iproute && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml index b3cd02e941..701911299a 100644 --- a/docker/scripts/enb_parameters.yaml +++ b/docker/scripts/enb_parameters.yaml @@ -174,12 +174,6 @@ env: "@ENB_X2_IP_ADDRESS@" - key: rrc_inactivity_threshold env: "@RRC_INACTIVITY_THRESHOLD@" - - key: FLEXRAN_ENABLED - env: "@FLEXRAN_ENABLED@" - - key: FLEXRAN_INTERFACE_NAME - env: "@FLEXRAN_INTERFACE_NAME@" - - key: FLEXRAN_IPV4_ADDRESS - env: "@FLEXRAN_IPV4_ADDRESS@" - key: parallel_config env: "@THREAD_PARALLEL_CONFIG@" diff --git a/docker/scripts/gnb_parameters.yaml b/docker/scripts/gnb_parameters.yaml index 0d1a02974b..8ee23dd035 100644 --- a/docker/scripts/gnb_parameters.yaml +++ b/docker/scripts/gnb_parameters.yaml @@ -62,12 +62,6 @@ env: "@GNB_X2_IP_ADDRESS@" - key: rrc_inactivity_threshold env: "@RRC_INACTIVITY_THRESHOLD@" - - key: FLEXRAN_ENABLED - env: "@FLEXRAN_ENABLED@" - - key: FLEXRAN_INTERFACE_NAME - env: "@FLEXRAN_INTERFACE_NAME@" - - key: FLEXRAN_IPV4_ADDRESS - env: "@FLEXRAN_IPV4_ADDRESS@" - key: parallel_config env: "@THREAD_PARALLEL_CONFIG@" diff --git a/executables/create_tasks.c b/executables/create_tasks.c index a6ae906d9d..16c735d9f3 100644 --- a/executables/create_tasks.c +++ b/executables/create_tasks.c @@ -85,7 +85,6 @@ int create_tasks(uint32_t enb_nb) { if (NODE_IS_DU(type)) { rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); - // DU is now GTP-U instead of protobuf rc = itti_create_task(TASK_GTPV1_U, gtpv1uTask, NULL); AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 54ae31f4aa..9567b63180 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -86,13 +86,6 @@ char *split73_config; int split73; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0}; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0}; -void flexran_agent_slice_update(mid_t module_idP) { -} -int proto_agent_start(mid_t mod_id, const cudu_params_t *p) { - return 0; -} -void proto_agent_stop(mid_t mod_id) { -} static void *ru_thread( void *param ); void kill_RU_proc(RU_t *ru) { @@ -1077,62 +1070,6 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) { itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } -int stop_L1L2(module_id_t enb_id) { - LOG_W(ENB_APP, "stopping lte-softmodem\n"); - /* these tasks need to pick up new configuration */ - terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB); - oai_exit = 1; - LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id); - //kill_RU_proc(RC.ru[enb_id]); - LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id); - kill_eNB_proc(enb_id); - oai_exit = 0; - - for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) { - free_transport(RC.eNB[enb_id][cc_id]); - phy_free_lte_eNB(RC.eNB[enb_id][cc_id]); - } - - //phy_free_RU(RC.ru[enb_id]); - free_lte_top(); - return 0; -} - -/* - * Restart the lte-softmodem after it has been soft-stopped with stop_L1L2() - */ -int restart_L1L2(module_id_t enb_id) { - RU_t *ru = NULL; //RC.ru[enb_id]; - MessageDef *msg_p = NULL; - LOG_W(ENB_APP, "restarting lte-softmodem\n"); - /* block threads */ - pthread_mutex_lock(&sync_mutex); - sync_var = -1; - pthread_mutex_unlock(&sync_mutex); - /* copy the changed frame parameters to the RU */ - /* TODO this should be done for all RUs associated to this eNB */ - memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS)); - /* reset the list of connected UEs in the MAC, since in this process with - * loose all UEs (have to reconnect) */ - init_UE_info(&RC.mac[enb_id]->UE_info); - LOG_I(ENB_APP, "attempting to create ITTI tasks\n"); - // No more rrc thread, as many race conditions are hidden behind - rrc_enb_init(); - itti_mark_task_ready(TASK_RRC_ENB); - /* pass a reconfiguration request which will configure everything down to - * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); - RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - init_eNB_afterRU(); - printf("Sending sync to all threads\n"); - pthread_mutex_lock(&sync_mutex); - sync_var=0; - pthread_cond_broadcast(&sync_cond); - pthread_mutex_unlock(&sync_mutex); - return 0; -} - int main ( int argc, char **argv ) { //mtrace(); int i; @@ -1177,8 +1114,6 @@ int main ( int argc, char **argv ) { // some initialization is necessary and init_ru_vnf do this. RU_t ru; - /* We need to read RU configuration before FlexRAN starts so it knows what - * splits to report. Actual RU start comes later. */ if ( NFAPI_MODE != NFAPI_MODE_VNF) { ocpRCconfig_RU(&ru); LOG_I(PHY, @@ -1201,9 +1136,6 @@ int main ( int argc, char **argv ) { if (RC.nb_inst > 0) { /* Start the agent. If it is turned off in the configuration, it won't start */ - for (i = 0; i < RC.nb_inst; i++) { - //flexran_agent_start(i); - } /* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks * for monolithic/F1 modes */ diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 4e8176e9a4..101f3dde41 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -487,86 +487,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) { //extern void free_transport(PHY_VARS_gNB *); extern void nr_phy_free_RU(RU_t *); -int stop_L1L2(module_id_t gnb_id) { - LOG_W(GNB_APP, "stopping nr-softmodem\n"); - oai_exit = 1; - - if (!RC.ru) { - LOG_F(GNB_APP, "no RU configured\n"); - return -1; - } - - /* stop trx devices, multiple carrier currently not supported by RU */ - if (RC.ru[gnb_id]) { - if (RC.ru[gnb_id]->rfdevice.trx_stop_func) { - RC.ru[gnb_id]->rfdevice.trx_stop_func(&RC.ru[gnb_id]->rfdevice); - LOG_I(GNB_APP, "turned off RU rfdevice\n"); - } else { - LOG_W(GNB_APP, "can not turn off rfdevice due to missing trx_stop_func callback, proceeding anyway!\n"); - } - - if (RC.ru[gnb_id]->ifdevice.trx_stop_func) { - RC.ru[gnb_id]->ifdevice.trx_stop_func(&RC.ru[gnb_id]->ifdevice); - LOG_I(GNB_APP, "turned off RU ifdevice\n"); - } else { - LOG_W(GNB_APP, "can not turn off ifdevice due to missing trx_stop_func callback, proceeding anyway!\n"); - } - } else { - LOG_W(GNB_APP, "no RU found for index %d\n", gnb_id); - return -1; - } - - /* these tasks need to pick up new configuration */ - terminate_task(TASK_RRC_ENB, gnb_id); - LOG_I(GNB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id); - kill_gNB_proc(gnb_id); - LOG_I(GNB_APP, "calling kill_NR_RU_proc() for instance %d\n", gnb_id); - kill_NR_RU_proc(gnb_id); - oai_exit = 0; - //free_transport(RC.gNB[gnb_id]); - phy_free_nr_gNB(RC.gNB[gnb_id]); - nr_phy_free_RU(RC.ru[gnb_id]); - free_lte_top(); - return 0; -} - -/* - * Restart the nr-softmodem after it has been soft-stopped with stop_L1L2() - */ -int restart_L1L2(module_id_t gnb_id) { - RU_t *ru = RC.ru[gnb_id]; - MessageDef *msg_p = NULL; - LOG_W(GNB_APP, "restarting nr-softmodem\n"); - /* block threads */ - sync_var = -1; - RC.gNB[gnb_id]->configured = 0; - RC.ru_mask |= (1 << ru->idx); - set_function_spec_param(RC.ru[gnb_id]); - LOG_I(GNB_APP, "attempting to create ITTI tasks\n"); - // No more rrc thread, as many race conditions are hidden behind - rrc_enb_init(); - itti_mark_task_ready(TASK_RRC_ENB); - /* pass a reconfiguration request which will configure everything down to - * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); - RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[gnb_id]->configuration; - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); - /* TODO XForms might need to be restarted, but it is currently (09/02/18) - * broken, so we cannot test it */ - wait_gNBs(); - init_RU_proc(ru); - ru->rf_map.card = 0; - ru->rf_map.chain = 0; /* CC_id + chain_offset;*/ - wait_RUs(); - init_eNB_afterRU(); - printf("Sending sync to all threads\n"); - pthread_mutex_lock(&sync_mutex); - sync_var=0; - pthread_cond_broadcast(&sync_cond); - pthread_mutex_unlock(&sync_mutex); - return 0; -} - static void wait_nfapi_init(char *thread_name) { printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); pthread_mutex_lock( &nfapi_sync_mutex ); @@ -664,14 +584,6 @@ int main( int argc, char **argv ) { int ret=create_gNB_tasks(1); AssertFatal(ret==0,"cannot create ITTI tasks\n"); - /* Start the agent. If it is turned off in the configuration, it won't start */ - /* - RCconfig_nr_flexran(); - - for (i = 0; i < RC.nb_nr_L1_inst; i++) { - flexran_agent_start(i); - } - */ // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs); diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 69e441acb8..e01a6cd5ed 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -3,7 +3,6 @@ #include -#include "flexran_agent.h" #include "PHY/defs_gNB.h" #define DEFAULT_DLF 2680000000 @@ -61,8 +60,6 @@ extern void reset_opp_meas(void); extern void print_opp_meas(void); void init_gNB_afterRU(void); -extern int stop_L1L2(module_id_t gnb_id); -extern int restart_L1L2(module_id_t gnb_id); void init_pdcp(void); #endif diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 88a95573f5..7bb81f97ef 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -37,6 +37,7 @@ #include "T.h" #include "executables/nr-softmodem.h" #include "executables/softmodem-common.h" +#include "nfapi/oai_integration/vendor_ext.h" #include "assertions.h" diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 08c199943e..e2f9401e59 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -49,6 +49,7 @@ #endif #include "LAYER2/MAC/mac.h" +#include "rrc_proto.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" diff --git a/openair2/COMMON/flexran_messages_def.h b/openair2/COMMON/flexran_messages_def.h deleted file mode 100644 index fdcdf698dc..0000000000 --- a/openair2/COMMON/flexran_messages_def.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/* - * flexran_messages_def.h - * - * Created on: Apr 26, 2018 - * Author: R. Schmidt - */ - -MESSAGE_DEF(SOFT_RESTART_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, IttiMsgEmpty, soft_restart_message) diff --git a/openair2/COMMON/messages_def.h b/openair2/COMMON/messages_def.h index 0d302cfea0..394b40eeed 100644 --- a/openair2/COMMON/messages_def.h +++ b/openair2/COMMON/messages_def.h @@ -41,4 +41,3 @@ #include "sctp_messages_def.h" #include "udp_messages_def.h" #include "gtpv1_u_messages_def.h" -#include "flexran_messages_def.h" diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c deleted file mode 100644 index 51e495b027..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ /dev/null @@ -1,2082 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac.c - * \brief FlexRAN agent message handler for MAC layer - * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein - * \date 2016 - * \version 0.1 - */ - -#include "flexran_agent_mac.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_common.h" -#include "flexran_agent_mac_internal.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_ran_api.h" - -#include "LAYER2/MAC/mac_proto.h" - -#include "liblfds700.h" - -#include "common/utils/LOG/log.h" - -#include - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -/*Array containing the Agent-MAC interfaces*/ -AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; - -/* Ringbuffer related structs used for maintaining the dl mac config messages */ -//message_queue_t *dl_mac_config_queue; -struct lfds700_misc_prng_state ps[NUM_MAX_ENB]; -struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; -struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; - -/* Ringbuffer-related to slice configuration */ -struct lfds700_ringbuffer_element *slice_config_array[NUM_MAX_ENB]; -struct lfds700_ringbuffer_state slice_config_ringbuffer_state[NUM_MAX_ENB]; - -/* Ringbuffer related to slice configuration if we need to wait for additional - * controller information */ -struct lfds700_ringbuffer_element *store_slice_config_array[NUM_MAX_ENB]; -struct lfds700_ringbuffer_state store_slice_config_ringbuffer_state[NUM_MAX_ENB]; -/* stores the (increasing) xid for messages to prevent double use */ -int xid = 50; - -/* Ringbuffer-related to slice configuration */ -struct lfds700_ringbuffer_element *ue_assoc_array[NUM_MAX_ENB]; -struct lfds700_ringbuffer_state ue_assoc_ringbuffer_state[NUM_MAX_ENB]; - -/* a list of shared objects that are loaded into the user plane */ -SLIST_HEAD(flexran_so_handle, flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB]; - -int flexran_agent_mac_stats_reply_ue(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags) { - const int cc_id = 0; // TODO: make for multiple CCs - - for (int i = 0; i < n_ue; i++) { - const rnti_t rnti = ue_report[i]->rnti; - const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); - - /* buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { - ue_report[i]->n_bsr = 4; //TODO should be automated - uint32_t *elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); - if (elem == NULL) - goto error; - for (int j = 0; j < ue_report[i]->n_bsr; j++) { - elem[j] = flexran_get_ue_bsr_ul_buffer_info (mod_id, i, j); - } - ue_report[i]->bsr = elem; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR; - } - - /* power headroom report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { - ue_report[i]->phr = flexran_get_ue_phr (mod_id, UE_id); - ue_report[i]->has_phr = 1; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR; - } - - /* Check flag for creation of RLC buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { - ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs - Protocol__FlexRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); - if (rlc_reports == NULL) - goto error; - - for (int j = 0; j < ue_report[i]->n_rlc_report; j++) { - rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); - if (rlc_reports[j] == NULL) { - for (int k = 0; k < j; k++) { - free(rlc_reports[k]); - } - free(rlc_reports); - goto error; - } - protocol__flex_rlc_bsr__init(rlc_reports[j]); - rlc_reports[j]->lc_id = j+1; - rlc_reports[j]->has_lc_id = 1; - rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(mod_id, UE_id, j + 1); - rlc_reports[j]->has_tx_queue_size = 1; - - rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(mod_id, UE_id, j + 1); - rlc_reports[j]->has_tx_queue_hol_delay = 1; - //TODO:Set retransmission queue size in bytes - rlc_reports[j]->retransmission_queue_size = 10; - rlc_reports[j]->has_retransmission_queue_size = 0; - //TODO:Set retransmission queue head of line delay in ms - rlc_reports[j]->retransmission_queue_hol_delay = 100; - rlc_reports[j]->has_retransmission_queue_hol_delay = 0; - rlc_reports[j]->status_pdu_size = flexran_get_num_pdus_buffer(mod_id, UE_id, j + 1); - rlc_reports[j]->has_status_pdu_size = 1; - - } - if (ue_report[i]->n_rlc_report > 0) - ue_report[i]->rlc_report = rlc_reports; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS; - } - - /* MAC CE buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { - // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(mod_id, UE_id, 0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; - // Use as bitmap. Set one or more of the; - // PROTOCOL__FLEX_CE_TYPE__FLPCET_ values - // found in stats_common.pb-c.h. See - // flex_ce_type in FlexRAN specification - ue_report[i]->has_pending_mac_ces = 1; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS; - } - - /* DL CQI report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { - // TODO: Fill in the actual DL CQI report for the UE based on its configuration - Protocol__FlexDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); - if (dl_report == NULL) - goto error; - protocol__flex_dl_cqi_report__init(dl_report); - - dl_report->sfn_sn = flexran_get_sfn_sf(mod_id); - dl_report->has_sfn_sn = 1; - dl_report->n_csi_report = flexran_get_active_CC(mod_id, UE_id); - dl_report->n_csi_report = 1 ; - //Create the actual CSI reports. - Protocol__FlexDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); - if (csi_reports == NULL) { - free(dl_report); - goto error; - } - for (int j = 0; j < dl_report->n_csi_report; j++) { - csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); - if (csi_reports[j] == NULL) { - for (int k = 0; k < j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_dl_csi__init(csi_reports[j]); - csi_reports[j]->serv_cell_index = j; - csi_reports[j]->has_serv_cell_index = 1; - csi_reports[j]->ri = flexran_get_current_RI(mod_id, UE_id, j); - csi_reports[j]->has_ri = 1; - //TODO: the type of CSI report based on the configuration of the UE - //For now we only support type P10, which only needs a wideband value - csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; - csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI; - - if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI) { - Protocol__FlexCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__FlexCsiP10)); - if (csi10 == NULL) { - for (int k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p10__init(csi10); - csi10->wb_cqi = flexran_get_ue_wcqi(mod_id, UE_id); - csi10->has_wb_cqi = 1; - csi_reports[j]->p10csi = csi10; - } - - /* - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI) { - - - Protocol__FlexCsiP11 *csi11; - csi11 = malloc(sizeof(Protocol__FlexCsiP11)); - if (csi11 == NULL) { - for (int k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p11__init(csi11); - - csi11->wb_cqi = malloc(sizeof(csi11->wb_cqi)); - csi11->n_wb_cqi = 1; - csi11->wb_cqi[0] = flexran_get_ue_wcqi (mod_id, UE_id); - // According To spec 36.213 - - if (flexran_get_antenna_ports(mod_id, j) == 2 && csi_reports[j]->ri == 1) { - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - } - - else if (flexran_get_antenna_ports(mod_id, j) == 2 && csi_reports[j]->ri == 2) { - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - } - - else if (flexran_get_antenna_ports(mod_id, j) == 4 && csi_reports[j]->ri == 2) { - // TODO PMI - csi11->wb_pmi = flexran_get_ue_wpmi(mod_id, UE_id, 0); - csi11->has_wb_pmi = 1; - - - } - - csi11->has_wb_pmi = 0; - csi_reports[j]->p11csi = csi11; - } - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI) { - - Protocol__FlexCsiP20 *csi20; - csi20 = malloc(sizeof(Protocol__FlexCsiP20)); - if (csi20 == NULL) { - for (int k = 0; k <= j; k++) { - free(csi_reports[k]); - } - free(csi_reports); - csi_reports = NULL; - goto error; - } - protocol__flex_csi_p20__init(csi20); - - csi20->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); - csi20->has_wb_cqi = 1; - csi20->bandwidth_part_index = 1 ; //TODO - csi20->has_bandwidth_part_index = 0; - csi20->sb_index = 1; //TODO - csi20->has_sb_index = 1; - csi_reports[j]->p20csi = csi20; - } - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI) { - - // Protocol__FlexCsiP21 *csi21; - // csi21 = malloc(sizeof(Protocol__FlexCsiP21)); - // if (csi21 == NULL) - // goto error; - // protocol__flex_csi_p21__init(csi21); - - // csi21->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); - - - // csi21->wb_pmi = flexran_get_ue_pmi(mod_id); //TDO inside - // csi21->has_wb_pmi = 1; - - // csi21->sb_cqi = 1; // TODO - - // csi21->bandwidth_part_index = 1 ; //TDO inside - // csi21->has_bandwidth_part_index = 1 ; - - // csi21->sb_index = 1 ;//TODO - // csi21->has_sb_index = 1 ; - - - // csi_reports[j]->p20csi = csi21; - - } - - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI) { - - - // Protocol__FlexCsiA12 *csi12; - // csi12 = malloc(sizeof(Protocol__FlexCsiA12)); - // if (csi12 == NULL) - // goto error; - // protocol__flex_csi_a12__init(csi12); - - // csi12->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); - - // csi12->sb_pmi = 1 ; //TODO inside - - // TODO continou - } - - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI) { - - // Protocol__FlexCsiA22 *csi22; - // csi22 = malloc(sizeof(Protocol__FlexCsiA22)); - // if (csi22 == NULL) - // goto error; - // protocol__flex_csi_a22__init(csi22); - - // csi22->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); - - // csi22->sb_cqi = 1 ; //TODO inside - - // csi22->wb_pmi = flexran_get_ue_wcqi (mod_id, UE_id); - // csi22->has_wb_pmi = 1; - - // csi22->sb_pmi = 1 ; //TODO inside - // csi22->has_wb_pmi = 1; - - // csi22->sb_list = flexran_get_ue_wcqi (mod_id, UE_id); - - - } - - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI) { - - // Protocol__FlexCsiA20 *csi20; - // csi20 = malloc(sizeof(Protocol__FlexCsiA20)); - // if (csi20 == NULL) - // goto error; - // protocol__flex_csi_a20__init(csi20); - - // csi20->wb_cqi = flexran_get_ue_wcqi (mod_id, UE_id); - // csi20->has_wb_cqi = 1; - - // csi20>sb_cqi = 1 ; //TODO inside - // csi20>has_sb_cqi = 1 ; - - // csi20->sb_list = 1; // TODO inside - - - } - - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI) { - - } - - else if (csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI) { - - } - */ - - } - dl_report->csi_report = csi_reports; - ue_report[i]->dl_cqi_report = dl_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI; - } - - /* paging buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { - //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI - //set in the report must be a P-RNTI - Protocol__FlexPagingBufferReport *paging_report; - paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport)); - if (paging_report == NULL) - goto error; - protocol__flex_paging_buffer_report__init(paging_report); - paging_report->n_paging_info = 1; - Protocol__FlexPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); - if (p_info == NULL) { - free(paging_report); - goto error; - } - - for (int j = 0; j < paging_report->n_paging_info; j++) { - - p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); - if (p_info[j] == NULL) { - for (int k = 0; k < j; k++) { - free(p_info[k]); - } - free(p_info); - p_info = NULL; - free(paging_report); - goto error; - } - protocol__flex_paging_info__init(p_info[j]); - //TODO: Set paging index. This index is the same that will be used for the scheduling of the - //paging message by the controller - p_info[j]->paging_index = 10; - p_info[j]->has_paging_index = 0; - //TODO:Set the paging message size - p_info[j]->paging_message_size = 100; - p_info[j]->has_paging_message_size = 0; - //TODO: Set the paging subframe - p_info[j]->paging_subframe = 10; - p_info[j]->has_paging_subframe = 0; - //TODO: Set the carrier index for the pending paging message - p_info[j]->carrier_index = 0; - p_info[j]->has_carrier_index = 0; - - } - //Add all paging info to the paging buffer rerport - paging_report->paging_info = p_info; - //Add the paging report to the UE report - ue_report[i]->pbr = paging_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS; - } - - /* Check flag for creation of UL CQI report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { - - //Fill in the full UL CQI report of the UE - Protocol__FlexUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); - if (full_ul_report == NULL) - goto error; - protocol__flex_ul_cqi_report__init(full_ul_report); - full_ul_report->sfn_sn = flexran_get_sfn_sf(mod_id); - full_ul_report->has_sfn_sn = 1; - //TODO:Set the number of UL measurement reports based on the types of measurements - //configured for this UE and on the servCellIndex - full_ul_report->n_cqi_meas = 1; - Protocol__FlexUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); - if (ul_report == NULL) { - free(full_ul_report); - goto error; - } - //Fill each UL report of the UE for each of the configured report types - for (int j = 0; j < full_ul_report->n_cqi_meas; j++) { - - ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); - if (ul_report[j] == NULL) { - for (int k = 0; k < j; k++) { - free(ul_report[k]); - } - free(ul_report); - free(full_ul_report); - goto error; - } - protocol__flex_ul_cqi__init(ul_report[j]); - //TODO: Set the type of the UL report. As an example set it to SRS UL report - ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS; - ul_report[j]->has_type = 1; - //TODO:Set the number of SINR measurements based on the report type - ul_report[j]->n_sinr = 0; - uint32_t *sinr_meas; - sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); - if (sinr_meas == NULL) { - for (int k = 0; k < j; k++) { - free(ul_report[k]); - } - free(ul_report); - free(full_ul_report); - goto error; - } - //TODO:Set the SINR measurements for the specified type - for (int k = 0; k < ul_report[j]->n_sinr; k++) { - sinr_meas[k] = 10; - } - ul_report[j]->sinr = sinr_meas; - //TODO: Set the servCellIndex for this report - ul_report[j]->serv_cell_index = 0; - ul_report[j]->has_serv_cell_index = 1; - - //Set the list of UL reports of this UE to the full UL report - full_ul_report->cqi_meas = ul_report; - - full_ul_report->n_pucch_dbm = MAX_NUM_CCs; - full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm); - - for (int j = 0; j < MAX_NUM_CCs; j++) { - - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm)); - protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); - full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; - full_ul_report->pucch_dbm[j]->serv_cell_index = j; - - if (flexran_get_p0_pucch_dbm(mod_id, UE_id, j) != -1) { - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(mod_id, UE_id, j); - full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; - } - } - - - } - // Add full UL CQI report to the UE report - ue_report[i]->ul_cqi_report = full_ul_report; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI; - - } - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { - - Protocol__FlexMacStats *macstats; - macstats = malloc(sizeof(Protocol__FlexMacStats)); - if (macstats == NULL) - goto error; - protocol__flex_mac_stats__init(macstats); - macstats->total_bytes_sdus_dl = flexran_get_total_size_dl_mac_sdus(mod_id, UE_id, cc_id); - macstats->has_total_bytes_sdus_dl = 1; - macstats->total_bytes_sdus_ul = flexran_get_total_size_ul_mac_sdus(mod_id, UE_id, cc_id); - macstats->has_total_bytes_sdus_ul = 1; - macstats->tbs_dl = flexran_get_TBS_dl(mod_id, UE_id, cc_id); - macstats->has_tbs_dl = 1; - macstats->tbs_ul = flexran_get_TBS_ul(mod_id, UE_id, cc_id); - macstats->has_tbs_ul = 1; - macstats->prb_retx_dl = flexran_get_num_prb_retx_dl_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_retx_dl = 1; - macstats->prb_retx_ul = flexran_get_num_prb_retx_ul_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_retx_ul = 1; - macstats->prb_dl = flexran_get_num_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_dl = 1; - macstats->prb_ul = flexran_get_num_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); - macstats->has_prb_ul = 1; - macstats->mcs1_dl = flexran_get_mcs1_dl(mod_id, UE_id, cc_id); - macstats->has_mcs1_dl = 1; - macstats->mcs2_dl = flexran_get_mcs2_dl(mod_id, UE_id, cc_id); - macstats->has_mcs2_dl = 1; - macstats->mcs1_ul = flexran_get_mcs1_ul(mod_id, UE_id, cc_id); - macstats->has_mcs1_ul = 1; - macstats->mcs2_ul = flexran_get_mcs2_ul(mod_id, UE_id, cc_id); - macstats->has_mcs2_ul = 1; - macstats->total_prb_dl = flexran_get_total_prb_dl_tx_per_ue(mod_id, UE_id, cc_id); - macstats->has_total_prb_dl = 1; - macstats->total_prb_ul = flexran_get_total_prb_ul_rx_per_ue(mod_id, UE_id, cc_id); - macstats->has_total_prb_ul = 1; - macstats->total_pdu_dl = flexran_get_total_num_pdu_dl(mod_id, UE_id, cc_id); - macstats->has_total_pdu_dl = 1; - macstats->total_pdu_ul = flexran_get_total_num_pdu_ul(mod_id, UE_id, cc_id); - macstats->has_total_pdu_ul = 1; - macstats->total_tbs_dl = flexran_get_total_TBS_dl(mod_id, UE_id, cc_id); - macstats->has_total_tbs_dl = 1; - macstats->total_tbs_ul = flexran_get_total_TBS_ul(mod_id, UE_id, cc_id); - macstats->has_total_tbs_ul = 1; - macstats->harq_round = flexran_get_harq_round(mod_id, cc_id, UE_id); - macstats->has_harq_round = 1; - - Protocol__FlexMacSdusDl ** mac_sdus; - mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id)); - if (mac_sdus == NULL) { - free(macstats); - goto error; - } - - macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, UE_id, cc_id); - for (int j = 0; j < macstats->n_mac_sdus_dl; j++) { - mac_sdus[j] = malloc(sizeof(Protocol__FlexMacSdusDl)); - protocol__flex_mac_sdus_dl__init(mac_sdus[j]); - mac_sdus[j]->lcid = flexran_get_mac_sdu_lcid_index(mod_id, UE_id, cc_id, j); - mac_sdus[j]->has_lcid = 1; - mac_sdus[j]->sdu_length = flexran_get_mac_sdu_size(mod_id, UE_id, cc_id, mac_sdus[j]->lcid); - mac_sdus[j]->has_sdu_length = 1; - } - macstats->mac_sdus_dl = mac_sdus; - ue_report[i]->mac_stats = macstats; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS; - } - } - return 0; - -error: - if (ue_report != NULL) { - if (n_ue > 0) { - for (int i = 0; i < n_ue; i++) { - if (ue_report[i]->bsr != NULL) { - free(ue_report[i]->bsr); - ue_report[i]->bsr = NULL; - } - if (ue_report[i]->rlc_report != NULL) { - for (int j = 0; j < ue_report[i]->n_rlc_report; j++) { - if (ue_report[i]->rlc_report[j] != NULL) { - free(ue_report[i]->rlc_report[j]); - ue_report[i]->rlc_report[j] = NULL; - } - } - free(ue_report[i]->rlc_report); - ue_report[i]->rlc_report = NULL; - } - if (ue_report[i]->dl_cqi_report != NULL) { - if (ue_report[i]->dl_cqi_report->csi_report != NULL) { - for (int j = 0; j < ue_report[i]->dl_cqi_report->n_csi_report; j++) { - if (ue_report[i]->dl_cqi_report->csi_report[j] != NULL) { - if (ue_report[i]->dl_cqi_report->csi_report[j]->p10csi != NULL) { - free(ue_report[i]->dl_cqi_report->csi_report[j]->p10csi); - ue_report[i]->dl_cqi_report->csi_report[j]->p10csi = NULL; - } - if (ue_report[i]->dl_cqi_report->csi_report[j]->p11csi != NULL) { - if (ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi != NULL) { - free(ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi); - ue_report[i]->dl_cqi_report->csi_report[j]->p11csi->wb_cqi = NULL; - } - free(ue_report[i]->dl_cqi_report->csi_report[j]->p11csi); - ue_report[i]->dl_cqi_report->csi_report[j]->p11csi = NULL; - } - if (ue_report[i]->dl_cqi_report->csi_report[j]->p20csi != NULL) { - free(ue_report[i]->dl_cqi_report->csi_report[j]->p20csi); - ue_report[i]->dl_cqi_report->csi_report[j]->p20csi = NULL; - } - free(ue_report[i]->dl_cqi_report->csi_report[j]); - ue_report[i]->dl_cqi_report->csi_report[j] = NULL; - } - } - free(ue_report[i]->dl_cqi_report->csi_report); - ue_report[i]->dl_cqi_report->csi_report = NULL; - } - free(ue_report[i]->dl_cqi_report); - ue_report[i]->dl_cqi_report = NULL; - } - if (ue_report[i]->pbr != NULL) { - if (ue_report[i]->pbr->paging_info != NULL) { - for (int j = 0; j < ue_report[i]->pbr->n_paging_info; j++) { - free(ue_report[i]->pbr->paging_info[j]); - ue_report[i]->pbr->paging_info[j] = NULL; - } - free(ue_report[i]->pbr->paging_info); - ue_report[i]->pbr->paging_info = NULL; - } - free(ue_report[i]->pbr); - ue_report[i]->pbr = NULL; - } - if (ue_report[i]->ul_cqi_report != NULL) { - if (ue_report[i]->ul_cqi_report->cqi_meas != NULL) { - for (int j = 0; j < ue_report[i]->ul_cqi_report->n_cqi_meas; j++) { - if (ue_report[i]->ul_cqi_report->cqi_meas[j] != NULL) { - if (ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr != NULL) { - free(ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr); - ue_report[i]->ul_cqi_report->cqi_meas[j]->sinr = NULL; - } - free(ue_report[i]->ul_cqi_report->cqi_meas[j]); - ue_report[i]->ul_cqi_report->cqi_meas[j] = NULL; - } - } - free(ue_report[i]->ul_cqi_report->cqi_meas); - ue_report[i]->ul_cqi_report->cqi_meas = NULL; - } - if (ue_report[i]->ul_cqi_report->pucch_dbm != NULL) { - for (int j = 0; j < MAX_NUM_CCs; j++) { - if (ue_report[i]->ul_cqi_report->pucch_dbm[j] != NULL) { - free(ue_report[i]->ul_cqi_report->pucch_dbm[j]); - ue_report[i]->ul_cqi_report->pucch_dbm[j] = NULL; - } - } - free(ue_report[i]->ul_cqi_report->pucch_dbm); - ue_report[i]->ul_cqi_report->pucch_dbm = NULL; - } - free(ue_report[i]->ul_cqi_report); - ue_report[i]->ul_cqi_report = NULL; - } - if (ue_report[i]->mac_stats != NULL) { - if (ue_report[i]->mac_stats->mac_sdus_dl != NULL) { - for (int j = 0; j < ue_report[i]->mac_stats->n_mac_sdus_dl; j++) { - if (ue_report[i]->mac_stats->mac_sdus_dl[j] != NULL) { - free(ue_report[i]->mac_stats->mac_sdus_dl[j]); - ue_report[i]->mac_stats->mac_sdus_dl[j] = NULL; - } - } - free(ue_report[i]->mac_stats->mac_sdus_dl); - ue_report[i]->mac_stats->mac_sdus_dl = NULL; - } - free(ue_report[i]->mac_stats); - ue_report[i]->mac_stats = NULL; - } - } - } - free(ue_report); - } - return -1; -} - -int flexran_agent_mac_stats_reply_cell(mid_t mod_id, - Protocol__FlexCellStatsReport **cell_report, - int n_cc, - uint32_t cc_flags) { - for (int i = 0; i < n_cc; i++) { - /* noise and interference report */ - if(cc_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { - // TODO: Fill in the actual noise and interference report for this cell - Protocol__FlexNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); - AssertFatal(ni_report, "cannot malloc() ni_report\n"); - protocol__flex_noise_interference_report__init(ni_report); - ni_report->sfn_sf = flexran_get_sfn_sf(mod_id); - ni_report->has_sfn_sf = 1; - ni_report->rip = 0; //TODO: Received interference power in dbm - ni_report->has_rip = 0; - ni_report->tnp = 0; //TODO: Thermal noise power in dbm - ni_report->has_tnp = 0; - ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(mod_id, 0); - ni_report->has_p0_nominal_pucch = 1; - cell_report[i]->noise_inter_report = ni_report; - cell_report[i]->flags |= PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE; - } - } - return 0; -} - -int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply) { - int i, j, k; - - Protocol__FlexDlCqiReport *dl_report; - Protocol__FlexUlCqiReport *ul_report; - Protocol__FlexPagingBufferReport *paging_report; - - // Free the memory for the UE reports - for (i = 0; i < reply->n_ue_report; i++) { - free(reply->ue_report[i]->bsr); - for (j = 0; j < reply->ue_report[i]->n_rlc_report; j++) { - free(reply->ue_report[i]->rlc_report[j]); - } - free(reply->ue_report[i]->rlc_report); - // If DL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { - dl_report = reply->ue_report[i]->dl_cqi_report; - // Delete all CSI reports - for (j = 0; j < dl_report->n_csi_report; j++) { - //Must free memory based on the type of report - switch(dl_report->csi_report[j]->report_case) { - case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: - free(dl_report->csi_report[j]->p10csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: - free(dl_report->csi_report[j]->p11csi->wb_cqi); - free(dl_report->csi_report[j]->p11csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: - free(dl_report->csi_report[j]->p20csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: - free(dl_report->csi_report[j]->p21csi->wb_cqi); - free(dl_report->csi_report[j]->p21csi->sb_cqi); - free(dl_report->csi_report[j]->p21csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: - free(dl_report->csi_report[j]->a12csi->wb_cqi); - free(dl_report->csi_report[j]->a12csi->sb_pmi); - free(dl_report->csi_report[j]->a12csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: - free(dl_report->csi_report[j]->a22csi->wb_cqi); - free(dl_report->csi_report[j]->a22csi->sb_cqi); - free(dl_report->csi_report[j]->a22csi->sb_list); - free(dl_report->csi_report[j]->a22csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: - free(dl_report->csi_report[j]->a20csi->sb_list); - free(dl_report->csi_report[j]->a20csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: - free(dl_report->csi_report[j]->a30csi->sb_cqi); - free(dl_report->csi_report[j]->a30csi); - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: - free(dl_report->csi_report[j]->a31csi->wb_cqi); - for (k = 0; k < dl_report->csi_report[j]->a31csi->n_sb_cqi; k++) { - free(dl_report->csi_report[j]->a31csi->sb_cqi[k]); - } - free(dl_report->csi_report[j]->a31csi->sb_cqi); - break; - default: - break; - } - - free(dl_report->csi_report[j]); - } - free(dl_report->csi_report); - free(dl_report); - } - // If Paging buffer report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { - paging_report = reply->ue_report[i]->pbr; - // Delete all paging buffer reports - for (j = 0; j < paging_report->n_paging_info; j++) { - free(paging_report->paging_info[j]); - } - free(paging_report->paging_info); - free(paging_report); - } - // If UL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { - ul_report = reply->ue_report[i]->ul_cqi_report; - for (j = 0; j < ul_report->n_cqi_meas; j++) { - free(ul_report->cqi_meas[j]->sinr); - free(ul_report->cqi_meas[j]); - } - free(ul_report->cqi_meas); - for (j = 0; j < ul_report->n_pucch_dbm; j++) { - free(ul_report->pucch_dbm[j]); - } - free(ul_report->pucch_dbm); - free(ul_report); - } - if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) { - for (j = 0; j < reply->ue_report[i]->mac_stats->n_mac_sdus_dl; j++) - free(reply->ue_report[i]->mac_stats->mac_sdus_dl[j]); - free(reply->ue_report[i]->mac_stats->mac_sdus_dl); - free(reply->ue_report[i]->mac_stats); - } - } - - // Free memory for all Cell reports - for (i = 0; i < reply->n_cell_report; i++) { - if (reply->cell_report[i]->flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { - free(reply->cell_report[i]->noise_inter_report); - } - } - - return 0; -} - -int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - int i; - const int xid = *((int *)params); - - Protocol__FlexUlSrInfo *ul_sr_info_msg; - ul_sr_info_msg = malloc(sizeof(Protocol__FlexUlSrInfo)); - if (ul_sr_info_msg == NULL) { - goto error; - } - protocol__flex_ul_sr_info__init(ul_sr_info_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) - goto error; - - ul_sr_info_msg->header = header; - ul_sr_info_msg->has_sfn_sf = 1; - ul_sr_info_msg->sfn_sf = flexran_get_sfn_sf(mod_id); - /*TODO: Set the number of UEs that sent an SR */ - ul_sr_info_msg->n_rnti = 1; - ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t)); - - if(ul_sr_info_msg->rnti == NULL) { - goto error; - } - /*TODO:Set the rnti of the UEs that sent an SR */ - for (i = 0; i < ul_sr_info_msg->n_rnti; i++) { - ul_sr_info_msg->rnti[i] = 1; - } - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) - goto error; - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->ul_sr_info_msg = ul_sr_info_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (ul_sr_info_msg != NULL) { - free(ul_sr_info_msg->rnti); - free(ul_sr_info_msg); - } - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG) - goto error; - - free(msg->ul_sr_info_msg->header); - free(msg->ul_sr_info_msg->rnti); - free(msg->ul_sr_info_msg); - free(msg); - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - int i, j, UE_id; - - int available_harq[MAX_MOBILES_PER_ENB]; - - const int xid = *((int *)params); - - - Protocol__FlexSfTrigger *sf_trigger_msg; - sf_trigger_msg = malloc(sizeof(Protocol__FlexSfTrigger)); - if (sf_trigger_msg == NULL) { - goto error; - } - protocol__flex_sf_trigger__init(sf_trigger_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) - goto error; - - frame_t frame; - sub_frame_t subframe; - - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - available_harq[i] = -1; - } - - int ahead_of_time = 0; - - frame = (frame_t) flexran_get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); - - subframe = ((subframe + ahead_of_time) % 10); - - if (subframe < flexran_get_current_subframe(mod_id)) { - frame = (frame + 1) % 1024; - } - - int additional_frames = ahead_of_time / 10; - frame = (frame + additional_frames) % 1024; - - sf_trigger_msg->header = header; - sf_trigger_msg->has_sfn_sf = 1; - sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 3); - - sf_trigger_msg->n_dl_info = 0; - - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - for (j = 0; j < 8; j++) { - if (RC.mac && RC.mac[mod_id] && RC.mac[mod_id]->UE_info.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid == 1) { - available_harq[i] = j; - break; - } - } - } - - - // LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10); - - sf_trigger_msg->n_dl_info = flexran_get_mac_num_ues(mod_id); - - Protocol__FlexDlInfo **dl_info = NULL; - - if (sf_trigger_msg->n_dl_info > 0) { - dl_info = malloc(sizeof(Protocol__FlexDlInfo *) * sf_trigger_msg->n_dl_info); - if(dl_info == NULL) - goto error; - i = -1; - //Fill the status of the current HARQ process for each UE - for(i = 0; i < sf_trigger_msg->n_dl_info; i++) { - if (available_harq[i] < 0) - continue; - dl_info[i] = malloc(sizeof(Protocol__FlexDlInfo)); - if(dl_info[i] == NULL) - goto error; - UE_id = flexran_get_mac_ue_id(mod_id, i); - protocol__flex_dl_info__init(dl_info[i]); - dl_info[i]->rnti = flexran_get_mac_ue_crnti(mod_id, UE_id); - dl_info[i]->has_rnti = 1; - /*Fill in the right id of this round's HARQ process for this UE*/ - // uint8_t harq_id; - //uint8_t harq_status; - // flexran_get_harq(mod_id, UE_PCCID(mod_id, UE_id), i, frame, subframe, &harq_id, &harq_status); - - - dl_info[i]->harq_process_id = available_harq[UE_id]; - if (RC.mac && RC.mac[mod_id]) - RC.mac[mod_id]->UE_info.eNB_UE_stats[UE_PCCID(mod_id, UE_id)][UE_id].harq_pid = 0; - dl_info[i]->has_harq_process_id = 1; - /* Fill in the status of the HARQ process (2 TBs)*/ - dl_info[i]->n_harq_status = 2; - dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); - for (j = 0; j < dl_info[i]->n_harq_status; j++) { - dl_info[i]->harq_status[j] = RC.mac[mod_id]->UE_info.UE_sched_ctrl[UE_id].round[UE_PCCID(mod_id, UE_id)][j]; - // TODO: This should be different per TB - } - // LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d and harq %d (round %d)\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10, dl_info[i]->harq_process_id, dl_info[i]->harq_status[0]); - if(dl_info[i]->harq_status[0] > 0) { - // LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d]Need to make a retransmission for harq %d (round %d)\n", flexran_get_current_frame(mod_id), flexran_get_current_subframe(mod_id), dl_info[i]->harq_process_id, dl_info[i]->harq_status[0]); - } - /*Fill in the serving cell index for this UE */ - dl_info[i]->serv_cell_index = UE_PCCID(mod_id, UE_id); - dl_info[i]->has_serv_cell_index = 1; - } - } - - sf_trigger_msg->dl_info = dl_info; - - /* Fill in the number of UL reception status related info, based on the number of currently - * transmitting UEs - */ - sf_trigger_msg->n_ul_info = flexran_get_mac_num_ues(mod_id); - - Protocol__FlexUlInfo **ul_info = NULL; - - if (sf_trigger_msg->n_ul_info > 0) { - ul_info = malloc(sizeof(Protocol__FlexUlInfo *) * sf_trigger_msg->n_ul_info); - if(ul_info == NULL) - goto error; - //Fill the reception info for each transmitting UE - for(i = 0; i < sf_trigger_msg->n_ul_info; i++) { - ul_info[i] = malloc(sizeof(Protocol__FlexUlInfo)); - if(ul_info[i] == NULL) - goto error; - protocol__flex_ul_info__init(ul_info[i]); - - UE_id = flexran_get_mac_ue_id(mod_id, i); - - ul_info[i]->rnti = flexran_get_mac_ue_crnti(mod_id, UE_id); - ul_info[i]->has_rnti = 1; - /* Fill in the Tx power control command for this UE (if available), - * primary carrier */ - if(flexran_get_tpc(mod_id, UE_id, 0) != 1){ - /* assume primary carrier */ - ul_info[i]->tpc = flexran_get_tpc(mod_id, UE_id, 0); - ul_info[i]->has_tpc = 1; - } - else{ - /* assume primary carrier */ - ul_info[i]->tpc = flexran_get_tpc(mod_id, UE_id, 0); - ul_info[i]->has_tpc = 0; - } - /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the - given logical channel*/ - ul_info[i]->n_ul_reception = 0; - ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); - for (j = 0; j < ul_info[i]->n_ul_reception; j++) { - ul_info[i]->ul_reception[j] = 100; - } - /*TODO: Fill in the reception status for each UEs data*/ - ul_info[i]->reception_status = PROTOCOL__FLEX_RECEPTION_STATUS__FLRS_OK; - ul_info[i]->has_reception_status = 1; - /*Fill in the serving cell index for this UE */ - ul_info[i]->serv_cell_index = UE_PCCID(mod_id, UE_id); - ul_info[i]->has_serv_cell_index = 1; - } - } - - sf_trigger_msg->ul_info = ul_info; - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) - goto error; - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->sf_trigger_msg = sf_trigger_msg; - return 0; - - error: - if (header != NULL) - free(header); - if (sf_trigger_msg != NULL) { - if (sf_trigger_msg->dl_info != NULL) { - for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { - if (sf_trigger_msg->dl_info[i] != NULL) { - if (sf_trigger_msg->dl_info[i]->harq_status != NULL) { - free(sf_trigger_msg->dl_info[i]->harq_status); - } - free(sf_trigger_msg->dl_info[i]); - } - } - free(sf_trigger_msg->dl_info); - } - if (sf_trigger_msg->ul_info != NULL) { - for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { - if (sf_trigger_msg->ul_info[i] != NULL) { - if (sf_trigger_msg->ul_info[i]->ul_reception != NULL) { - free(sf_trigger_msg->ul_info[i]->ul_reception); - } - free(sf_trigger_msg->ul_info[i]); - } - } - free(sf_trigger_msg->ul_info); - } - free(sf_trigger_msg); - } - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { - int i; - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG) - goto error; - - free(msg->sf_trigger_msg->header); - for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { - free(msg->sf_trigger_msg->dl_info[i]->harq_status); - free(msg->sf_trigger_msg->dl_info[i]); - } - free(msg->sf_trigger_msg->dl_info); - for (i = 0; i < msg->sf_trigger_msg->n_ul_info; i++) { - free(msg->sf_trigger_msg->ul_info[i]->ul_reception); - free(msg->sf_trigger_msg->ul_info[i]); - } - free(msg->sf_trigger_msg->ul_info); - free(msg->sf_trigger_msg); - free(msg); - - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { - - int xid = 0; - Protocol__FlexHeader *header = NULL; - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) - goto error; - - Protocol__FlexDlMacConfig *dl_mac_config_msg; - dl_mac_config_msg = malloc(sizeof(Protocol__FlexDlMacConfig)); - if (dl_mac_config_msg == NULL) { - free(header); - goto error; - } - protocol__flex_dl_mac_config__init(dl_mac_config_msg); - - dl_mac_config_msg->header = header; - dl_mac_config_msg->has_sfn_sf = 1; - dl_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) { - free(dl_mac_config_msg); - free(header); - goto error; - } - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->dl_mac_config_msg = dl_mac_config_msg; - - return 0; - - error: - return -1; -} - -int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { - int i,j, k; - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) - goto error; - - Protocol__FlexDlDci *dl_dci; - - free(msg->dl_mac_config_msg->header); - for (i = 0; i < msg->dl_mac_config_msg->n_dl_ue_data; i++) { - free(msg->dl_mac_config_msg->dl_ue_data[i]->ce_bitmap); - for (j = 0; j < msg->dl_mac_config_msg->dl_ue_data[i]->n_rlc_pdu; j++) { - for (k = 0; k < msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->n_rlc_pdu_tb; k++) { - free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb[k]); - } - free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb); - free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]); - } - free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu); - dl_dci = msg->dl_mac_config_msg->dl_ue_data[i]->dl_dci; - free(dl_dci->tbs_size); - free(dl_dci->mcs); - free(dl_dci->ndi); - free(dl_dci->rv); - free(dl_dci); - free(msg->dl_mac_config_msg->dl_ue_data[i]); - } - free(msg->dl_mac_config_msg->dl_ue_data); - - for (i = 0; i < msg->dl_mac_config_msg->n_dl_rar; i++) { - dl_dci = msg->dl_mac_config_msg->dl_rar[i]->rar_dci; - free(dl_dci->tbs_size); - free(dl_dci->mcs); - free(dl_dci->ndi); - free(dl_dci->rv); - free(dl_dci); - free(msg->dl_mac_config_msg->dl_rar[i]); - } - free(msg->dl_mac_config_msg->dl_rar); - - for (i = 0; i < msg->dl_mac_config_msg->n_dl_broadcast; i++) { - dl_dci = msg->dl_mac_config_msg->dl_broadcast[i]->broad_dci; - free(dl_dci->tbs_size); - free(dl_dci->mcs); - free(dl_dci->ndi); - free(dl_dci->rv); - free(dl_dci); - free(msg->dl_mac_config_msg->dl_broadcast[i]); - } - free(msg->dl_mac_config_msg->dl_broadcast); - - for ( i = 0; i < msg->dl_mac_config_msg->n_ofdm_sym; i++) { - free(msg->dl_mac_config_msg->ofdm_sym[i]); - } - free(msg->dl_mac_config_msg->ofdm_sym); - free(msg->dl_mac_config_msg); - free(msg); - - return 0; - - error: - return -1; -} - -int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg) { - - int xid = 0; - Protocol__FlexHeader *header = NULL; - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_MAC_CONFIG, &header) != 0) - goto error; - - Protocol__FlexUlMacConfig *ul_mac_config_msg; - ul_mac_config_msg = malloc(sizeof(Protocol__FlexUlMacConfig)); - if (ul_mac_config_msg == NULL) { - goto error; - } - protocol__flex_ul_mac_config__init(ul_mac_config_msg); - - ul_mac_config_msg->header = header; - ul_mac_config_msg->has_sfn_sf = 1; - ul_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) { - free(ul_mac_config_msg); - goto error; - } - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->ul_mac_config_msg = ul_mac_config_msg; - - return 0; - - error: - if(header){ - free(header); - header = NULL; - } - return -1; -} - - -int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg) { - int i; //,j, k; - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG) - goto error; - - // Protocol__FlexUlDci *ul_dci; - - free(msg->ul_mac_config_msg->header); - for (i = 0; i < msg->ul_mac_config_msg->n_ul_ue_data; i++) { - // TODO uplink rlc ... - // free(msg->ul_mac_config_msg->dl_ue_data[i]->ce_bitmap); - // for (j = 0; j < msg->ul_mac_config_msg->ul_ue_data[i]->n_rlc_pdu; j++) { - // for (k = 0; k < msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]->n_rlc_pdu_tb; k++) { - // free(msg->ul_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb[k]); - // } - // free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb); - // free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu[j]); - // } - // free(msg->ul_mac_config_msg->ul_ue_data[i]->rlc_pdu); - // ul_dci = msg->ul_mac_config_msg->ul_ue_data[i]->ul_dci; - // free(dl_dci->tbs_size); - // free(ul_dci->mcs); - // free(ul_dci->ndi); - // free(ul_dci->rv); - // free(ul_dci); - // free(msg->ul_mac_config_msg->ul_ue_data[i]); - } - free(msg->ul_mac_config_msg->ul_ue_data); - - free(msg->ul_mac_config_msg); - free(msg); - - return 0; - - error: - return -1; -} - - -void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { - - struct lfds700_misc_prng_state ls; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - if (lfds700_ringbuffer_read(&ringbuffer_state[mod_id], NULL, (void **) msg, &ls) == 0) { - *msg = NULL; - } -} - -int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - - struct lfds700_misc_prng_state ls; - enum lfds700_misc_flag overwrite_occurred_flag; - Protocol__FlexranMessage *overwritten_dl_config; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - lfds700_ringbuffer_write( &ringbuffer_state[mod_id], - NULL, - (void *) params, - &overwrite_occurred_flag, - NULL, - (void **)&overwritten_dl_config, - &ls); - - if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { - // Delete unmanaged dl_config - flexran_agent_mac_destroy_dl_config(overwritten_dl_config); - } - *msg = NULL; - return 2; - - // error: - //*msg = NULL; - //return -1; -} - -void flexran_agent_init_mac_agent(mid_t mod_id) { - int i, j; - lfds700_misc_library_init_valid_on_current_logical_core(); - lfds700_misc_prng_init(&ps[mod_id]); - int num_elements = RINGBUFFER_SIZE + 1; - //Allow RINGBUFFER_SIZE messages to be stored in the ringbuffer at any time - /* lfds700_ringbuffer_init_valid_on_current_logical_core()'s second argument - * must be aligned to LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES. From the - * documentation: "Heap allocated variables however will by no means be - * correctly aligned and an aligned malloc must be used." Therefore, we use - * posix_memalign */ - i = posix_memalign((void **)&dl_mac_config_array[mod_id], - LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES, - sizeof(struct lfds700_ringbuffer_element) * num_elements); - AssertFatal(i == 0, "posix_memalign(): could not allocate aligned memory for lfds library\n"); - lfds700_ringbuffer_init_valid_on_current_logical_core(&ringbuffer_state[mod_id], - dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL); - - struct lfds700_misc_prng_state scrng; - i = posix_memalign((void **) &slice_config_array[mod_id], - LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES, - sizeof(struct lfds700_ringbuffer_element) * num_elements); - AssertFatal(i == 0, - "posix_memalign(): could not allocate aligned memory\n"); - lfds700_ringbuffer_init_valid_on_current_logical_core( - &slice_config_ringbuffer_state[mod_id], - slice_config_array[mod_id], - num_elements, - &scrng, - NULL); - - struct lfds700_misc_prng_state sscrng; - i = posix_memalign((void **) &store_slice_config_array[mod_id], - LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES, - sizeof(struct lfds700_ringbuffer_element) * num_elements); - AssertFatal(i == 0, - "posix_memalign(): could not allocate aligned memory\n"); - lfds700_ringbuffer_init_valid_on_current_logical_core( - &store_slice_config_ringbuffer_state[mod_id], - store_slice_config_array[mod_id], - num_elements, - &sscrng, - NULL); - - struct lfds700_misc_prng_state uarng; - i = posix_memalign((void **) &ue_assoc_array[mod_id], - LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES, - sizeof(struct lfds700_ringbuffer_element) * num_elements); - AssertFatal(i == 0, - "posix_memalign(): could not allocate aligned memory\n"); - lfds700_ringbuffer_init_valid_on_current_logical_core( - &ue_assoc_ringbuffer_state[mod_id], - ue_assoc_array[mod_id], - num_elements, - &uarng, - NULL); - - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { - for (j = 0; j < 8; j++) { - if (RC.mac && RC.mac[mod_id]) - RC.mac[mod_id]->UE_info.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid = 0; - } - } - - SLIST_INIT(&flexran_handles[mod_id]); -} - -/*********************************************** - * FlexRAN agent - technology mac API implementation - ***********************************************/ - -void flexran_agent_send_sr_info(mid_t mod_id) { - int size; - Protocol__FlexranMessage *msg = NULL; - void *data; - int priority = 0; - err_code_t err_code; - - int xid = 0; - - /*TODO: Must use a proper xid*/ - err_code = flexran_agent_mac_sr_info(mod_id, (void *) &xid, &msg); - if (err_code < 0) { - goto error; - } - - if (msg != NULL){ - data=flexran_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - return; - } - error: - LOG_D(FLEXRAN_AGENT, "Could not send sr message\n"); -} - -void flexran_agent_send_sf_trigger(mid_t mod_id) { - int size; - Protocol__FlexranMessage *msg = NULL; - void *data; - int priority = 0; - err_code_t err_code; - - int xid = 0; - - /*TODO: Must use a proper xid*/ - err_code = flexran_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); - if (err_code < 0) { - goto error; - } - - if (msg != NULL){ - data=flexran_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - return; - } - error: - LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); -} - - - -int flexran_agent_register_mac_xface(mid_t mod_id) -{ - if (agent_mac_xface[mod_id]) { - LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); - return -1; - } - AGENT_MAC_xface *xface = malloc(sizeof(AGENT_MAC_xface)); - if (!xface) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for MAC agent xface %d\n", mod_id); - return -1; - } - - xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info; - xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger; - xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config; - xface->flexran_agent_notify_tick = flexran_agent_timer_signal; - - xface->dl_scheduler_loaded_lib = NULL; - xface->ul_scheduler_loaded_lib = NULL; - agent_mac_xface[mod_id] = xface; - - return 0; -} - -void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf) { - if (!conf->si_config) { - conf->si_config = malloc(sizeof(Protocol__FlexSiConfig)); - if (conf->si_config) - protocol__flex_si_config__init(conf->si_config); - } - - if (conf->si_config) { - conf->si_config->sfn = flexran_get_current_system_frame_num(mod_id); - conf->si_config->has_sfn = 1; - } - - conf->slice_config = malloc(sizeof(Protocol__FlexSliceConfig)); - if (conf->slice_config) { - protocol__flex_slice_config__init(conf->slice_config); - Protocol__FlexSliceConfig *sc = conf->slice_config; - - sc->dl = malloc(sizeof(Protocol__FlexSliceDlUlConfig)); - DevAssert(sc->dl); - protocol__flex_slice_dl_ul_config__init(sc->dl); - sc->dl->algorithm = flexran_get_dl_slice_algo(mod_id); - sc->dl->has_algorithm = 1; - sc->dl->n_slices = flexran_get_num_dl_slices(mod_id); - if (sc->dl->n_slices > 0) { - sc->dl->slices = calloc(sc->dl->n_slices, sizeof(Protocol__FlexSlice *)); - DevAssert(sc->dl->slices); - for (int i = 0; i < sc->dl->n_slices; ++i) { - sc->dl->slices[i] = malloc(sizeof(Protocol__FlexSlice)); - DevAssert(sc->dl->slices[i]); - protocol__flex_slice__init(sc->dl->slices[i]); - flexran_get_dl_slice(mod_id, i, sc->dl->slices[i], sc->dl->algorithm); - } - } else { - sc->dl->scheduler = flexran_get_dl_scheduler_name(mod_id); - } - - sc->ul = malloc(sizeof(Protocol__FlexSliceDlUlConfig)); - DevAssert(sc->ul); - protocol__flex_slice_dl_ul_config__init(sc->ul); - sc->ul->algorithm = flexran_get_ul_slice_algo(mod_id); - sc->ul->has_algorithm = 1; - sc->ul->n_slices = flexran_get_num_ul_slices(mod_id); - if (sc->ul->n_slices > 0) { - sc->ul->slices = calloc(sc->ul->n_slices, sizeof(Protocol__FlexSlice *)); - DevAssert(sc->ul->slices); - for (int i = 0; i < sc->ul->n_slices; ++i) { - sc->ul->slices[i] = malloc(sizeof(Protocol__FlexSlice)); - DevAssert(sc->ul->slices[i]); - protocol__flex_slice__init(sc->ul->slices[i]); - flexran_get_ul_slice(mod_id, i, sc->ul->slices[i], sc->ul->algorithm); - } - } else { - sc->ul->scheduler = flexran_get_ul_scheduler_name(mod_id); - } - } -} - -void flexran_agent_destroy_mac_slice_config(Protocol__FlexCellConfig *conf) { - Protocol__FlexSliceConfig *sc = conf->slice_config; - for (int i = 0; i < sc->dl->n_slices; ++i) { - free(sc->dl->slices[i]); - sc->dl->slices[i] = NULL; - /* scheduler names are not freed: we assume we read them directly from the - * underlying memory and do not dispose it */ - } - free(sc->dl->slices); - /* scheduler name is not freed */ - free(sc->dl); - sc->dl = NULL; - for (int i = 0; i < sc->ul->n_slices; ++i) { - free(sc->ul->slices[i]); - sc->ul->slices[i] = NULL; - /* scheduler names are not freed */ - } - free(sc->ul->slices); - /* scheduler name is not freed */ - free(sc->ul); - sc->ul = NULL; - free(conf->slice_config); - conf->slice_config = NULL; -} - -void flexran_agent_fill_mac_ue_config(mid_t mod_id, mid_t ue_id, - Protocol__FlexUeConfig *ue_conf) -{ - if (ue_conf->has_rnti && ue_conf->rnti != flexran_get_mac_ue_crnti(mod_id, ue_id)) { - LOG_E(FLEXRAN_AGENT, "ue_config existing RNTI %x does not match MAC RNTI %x\n", - ue_conf->rnti, flexran_get_mac_ue_crnti(mod_id, ue_id)); - return; - } - ue_conf->rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); - ue_conf->has_rnti = 1; - - int dl_id = flexran_get_ue_dl_slice_id(mod_id, ue_id); - ue_conf->dl_slice_id = dl_id; - ue_conf->has_dl_slice_id = dl_id >= 0; - int ul_id = flexran_get_ue_ul_slice_id(mod_id, ue_id); - ue_conf->ul_slice_id = ul_id; - ue_conf->has_ul_slice_id = ul_id >= 0; - - ue_conf->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id, ue_id); - ue_conf->has_ue_aggregated_max_bitrate_ul = 1; - - ue_conf->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id, ue_id); - ue_conf->has_ue_aggregated_max_bitrate_dl = 1; - - /* TODO update through RAN API */ - //config->has_pcell_carrier_index = 1; - //config->pcell_carrier_index = UE_PCCID(mod_id, i); - - //TODO: Set carrier aggregation support (boolean) -} - -void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, - Protocol__FlexLcUeConfig *lc_ue_conf) -{ - lc_ue_conf->rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); - lc_ue_conf->has_rnti = 1; - - lc_ue_conf->n_lc_config = flexran_get_num_ue_lcs(mod_id, ue_id); - if (lc_ue_conf->n_lc_config == 0) - return; - - Protocol__FlexLcConfig **lc_config = - calloc(lc_ue_conf->n_lc_config, sizeof(Protocol__FlexLcConfig *)); - if (!lc_config) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for lc_config of UE %x\n", lc_ue_conf->rnti); - lc_ue_conf->n_lc_config = 0; - return; // can not allocate memory, skip rest - } - for (int j = 0; j < lc_ue_conf->n_lc_config; j++) { - lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); - if (!lc_config[j]) continue; // go over this error, try entry - protocol__flex_lc_config__init(lc_config[j]); - - lc_config[j]->has_lcid = 1; - lc_config[j]->lcid = j+1; - - const int lcg = flexran_get_lcg(mod_id, ue_id, j+1); - if (lcg >= 0 && lcg <= 3) { - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = flexran_get_lcg(mod_id, ue_id, j+1); - } - - lc_config[j]->has_direction = 1; - lc_config[j]->direction = flexran_get_direction(ue_id, j+1); - //TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported - lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; - - //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 - // One less than the actual QCI value. Needs to be generalized - lc_config[j]->has_qci = 1; - lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { - /* TODO all of the need to be taken from API */ - //TODO: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 0; - lc_config[j]->e_rab_max_bitrate_ul = 0; - //TODO: Set the max bitrate (DL) - lc_config[j]->has_e_rab_max_bitrate_dl = 0; - lc_config[j]->e_rab_max_bitrate_dl = 0; - //TODO: Set the guaranteed bitrate (UL) - lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 0; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 0; - //TODO: Set the guaranteed bitrate (DL) - lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 0; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 0; - } - } - lc_ue_conf->lc_config = lc_config; -} - -int flexran_agent_unregister_mac_xface(mid_t mod_id) -{ - if (!agent_mac_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "MAC agent CM for eNB %d is not registered\n", mod_id); - return -1; - } - - lfds700_ringbuffer_cleanup(&ringbuffer_state[mod_id], NULL ); - free(dl_mac_config_array[mod_id]); - lfds700_ringbuffer_cleanup(&slice_config_ringbuffer_state[mod_id], NULL ); - free(slice_config_array[mod_id]); - lfds700_ringbuffer_cleanup(&store_slice_config_ringbuffer_state[mod_id], NULL ); - free(store_slice_config_array[mod_id]); - lfds700_ringbuffer_cleanup(&ue_assoc_ringbuffer_state[mod_id], NULL ); - free(ue_assoc_array[mod_id]); - lfds700_misc_library_cleanup(); - - AGENT_MAC_xface *xface = agent_mac_xface[mod_id]; - xface->flexran_agent_send_sr_info = NULL; - xface->flexran_agent_send_sf_trigger = NULL; - xface->flexran_agent_get_pending_dl_mac_config = NULL; - xface->flexran_agent_notify_tick = NULL; - - xface->dl_scheduler_loaded_lib = NULL; - xface->ul_scheduler_loaded_lib = NULL; - free(xface); - agent_mac_xface[mod_id] = NULL; - - return 0; -} - -void helper_destroy_mac_slice_config(Protocol__FlexSliceConfig *slice_config) { - if (slice_config->dl) { - if (slice_config->dl->scheduler) - free(slice_config->dl->scheduler); - for (int i = 0; i < slice_config->dl->n_slices; i++) - if (slice_config->dl->slices[i]->scheduler) - free(slice_config->dl->slices[i]->scheduler); - } - if (slice_config->ul) { - if (slice_config->ul->scheduler) - free(slice_config->ul->scheduler); - for (int i = 0; i < slice_config->ul->n_slices; i++) - if (slice_config->ul->slices[i]->scheduler) - free(slice_config->ul->slices[i]->scheduler); - } - - Protocol__FlexCellConfig helper; - helper.slice_config = slice_config; - flexran_agent_destroy_mac_slice_config(&helper); -} - -int check_scheduler(mid_t mod_id, char *s) { - if (!s) - return 1; - if (dlsym(NULL, s)) - return 1; - flexran_agent_so_handle_t *so = NULL; - SLIST_FOREACH(so, &flexran_handles[mod_id], entries) { - if (strcmp(so->name, s) == 0) - return 1; - } - return 0; -} - -void request_scheduler(mid_t mod_id, char *s, int xid) { - LOG_W(FLEXRAN_AGENT, - "unknown scheduler %s, requesting controller to send it\n", - s); - Protocol__FlexControlDelegationRequest *req = malloc(sizeof(Protocol__FlexControlDelegationRequest)); - DevAssert(req); - protocol__flex_control_delegation_request__init(req); - Protocol__FlexHeader *header = NULL; - int rc = flexran_create_header( - xid, PROTOCOL__FLEX_TYPE__FLPT_DELEGATE_REQUEST, &header); - AssertFatal(rc == 0, "%s(): cannot create header\n", __func__); - req->header = header; - req->delegation_type = PROTOCOL__FLEX_CONTROL_DELEGATION_TYPE__FLCDT_MAC_DL_UE_SCHEDULER; - req->name = strdup(s); - - Protocol__FlexranMessage *msg = malloc(sizeof(Protocol__FlexranMessage)); - DevAssert(msg); - protocol__flexran_message__init(msg); - msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DEL_REQ_MSG; - msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - msg->control_del_req_msg = req; - - int size = 0; - void *data = flexran_agent_pack_message(msg, &size); - if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, 0) < 0) - LOG_E(FLEXRAN_AGENT, "%s(): error while sending message\n", __func__); -} - -Protocol__FlexranMessage *request_scheduler_timeout( - mid_t mod_id, - const Protocol__FlexranMessage *msg) { - const Protocol__FlexEnbConfigReply *ecr = msg->enb_config_reply_msg; - - struct lfds700_misc_prng_state ls; - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - Protocol__FlexranMessage *smsg = NULL; - struct lfds700_ringbuffer_state *state = &store_slice_config_ringbuffer_state[mod_id]; - if (lfds700_ringbuffer_read(state, NULL, (void **) &smsg, &ls)) { - AssertFatal(msg == smsg, - "expected and returned enb_config_reply are not the same\n"); - AssertFatal(ecr->header->xid == smsg->enb_config_reply_msg->header->xid, - "expected and returned enb_config_reply are not the same\n"); - } else { - LOG_E(FLEXRAN_AGENT, "%s(): could not read config from ringbuffer\n", __func__); - } - /* call the helper so that scheduler names are correctly freed */ - helper_destroy_mac_slice_config(ecr->cell_config[0]->slice_config); - ecr->cell_config[0]->slice_config = NULL; - /* we should not call flexran_agent_destroy_enb_config_reply(smsg); since - * upon timer removal, this is automatically done */ - LOG_W(FLEXRAN_AGENT, - "remove stored slice config (xid %d) after timeout\n", - ecr->header->xid); - flexran_agent_destroy_timer(mod_id, ecr->header->xid); - return NULL; -} - -void prepare_update_slice_config(mid_t mod_id, - Protocol__FlexSliceConfig **slice_config, - int request_objects) { - if (!*slice_config) return; - /* just use the memory and set to NULL in original */ - Protocol__FlexSliceConfig *sc = *slice_config; - *slice_config = NULL; - - struct lfds700_misc_prng_state ls; - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - enum lfds700_misc_flag overwrite_occurred_flag; - - int put_on_hold = 0; - if (request_objects - && sc->dl->scheduler - && !check_scheduler(mod_id, sc->dl->scheduler)) { - request_scheduler(mod_id, sc->dl->scheduler, xid++); - put_on_hold = 1; - } - for (int i = 0; request_objects && i < sc->dl->n_slices; ++i) { - Protocol__FlexSlice *sl = sc->dl->slices[i]; - if (sl->scheduler && !check_scheduler(mod_id, sl->scheduler)) { - request_scheduler(mod_id, sl->scheduler, xid++); - put_on_hold = 1; - } - } - if (put_on_hold) { - Protocol__FlexEnbConfigReply *reply = malloc(sizeof(Protocol__FlexEnbConfigReply)); - DevAssert(reply); - protocol__flex_enb_config_reply__init(reply); - /* use the last used xid so we can correlate answer and waiting config */ - int rc = flexran_create_header( - xid - 1, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &reply->header); - AssertFatal(rc == 0, "%s(): cannot create header\n", __func__); - reply->n_cell_config = 1; - reply->cell_config = malloc(sizeof(Protocol__FlexCellConfig *)); - DevAssert(reply->cell_config); - reply->cell_config[0] = malloc(sizeof(Protocol__FlexCellConfig)); - DevAssert(reply->cell_config[0]); - protocol__flex_cell_config__init(reply->cell_config[0]); - reply->cell_config[0]->slice_config = sc; - - Protocol__FlexranMessage *msg = malloc(sizeof(Protocol__FlexranMessage)); - DevAssert(msg); - protocol__flexran_message__init(msg); - msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - msg->enb_config_reply_msg = reply; - - Protocol__FlexEnbConfigReply *o; - lfds700_ringbuffer_write(&store_slice_config_ringbuffer_state[mod_id], - NULL, - (void *)msg, - &overwrite_occurred_flag, - NULL, - (void **) &o, - &ls); - AssertFatal(overwrite_occurred_flag == LFDS700_MISC_FLAG_LOWERED, - "unhandled: stored slice config for controller has been overwritten\n"); - - flexran_agent_create_timer(mod_id, - 3000, - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, - xid - 1, - request_scheduler_timeout, - msg); /* need reply for xid */ - return; - } - - Protocol__FlexSliceConfig *overwritten_sc; - lfds700_ringbuffer_write(&slice_config_ringbuffer_state[mod_id], - NULL, - (void *)sc, - &overwrite_occurred_flag, - NULL, - (void **)&overwritten_sc, - &ls); - - if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { - helper_destroy_mac_slice_config(overwritten_sc); - LOG_E(FLEXRAN_AGENT, "lost slice config: too many reconfigurations at once\n"); - } -} - -void prepare_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig **ue_config) { - struct lfds700_misc_prng_state ls; - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - enum lfds700_misc_flag overwrite_occurred_flag; - - Protocol__FlexUeConfig *overwritten_ue_config; - lfds700_ringbuffer_write(&ue_assoc_ringbuffer_state[mod_id], - NULL, - (void *) *ue_config, - &overwrite_occurred_flag, - NULL, - (void **)&overwritten_ue_config, - &ls); - - if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { - free(overwritten_ue_config); - LOG_E(FLEXRAN_AGENT, "lost UE-slice association: too many UE-slice associations at once\n"); - } -} - -void flexran_agent_slice_update(mid_t mod_id) { - struct lfds700_misc_prng_state ls; - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - Protocol__FlexSliceConfig *sc = NULL; - struct lfds700_ringbuffer_state *state = &slice_config_ringbuffer_state[mod_id]; - if (lfds700_ringbuffer_read(state, NULL, (void **) &sc, &ls) != 0) { - apply_update_dl_slice_config(mod_id, sc->dl); - apply_update_ul_slice_config(mod_id, sc->ul); - helper_destroy_mac_slice_config(sc); - - flexran_agent_so_handle_t *so = NULL; - flexran_agent_so_handle_t *prev = NULL; // the previous to current element, if we delete in order to go back - //SLIST_FOREACH(so, &flexran_handles[mod_id], entries) - for(so = flexran_handles[mod_id].slh_first; so;) { - char *name = so->name; - int in_use = strcmp(flexran_get_dl_scheduler_name(mod_id), name) == 0 - || strcmp(flexran_get_ul_scheduler_name(mod_id), name) == 0; - Protocol__FlexSliceAlgorithm dl_algo = flexran_get_dl_slice_algo(mod_id); - if (!in_use && dl_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - int n = flexran_get_num_dl_slices(mod_id); - for (int i = 0; i < n; ++i) { - Protocol__FlexSlice s; - /* NONE so it won't do any allocations */ - flexran_get_dl_slice(mod_id, i, &s, PROTOCOL__FLEX_SLICE_ALGORITHM__None); - if (strcmp(s.scheduler, name) == 0) { - in_use = 1; - break; - } - } - } - Protocol__FlexSliceAlgorithm ul_algo = flexran_get_ul_slice_algo(mod_id); - if (!in_use && ul_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - int n = flexran_get_num_ul_slices(mod_id); - for (int i = 0; i < n; ++i) { - Protocol__FlexSlice s; - /* NONE so it won't do any allocations */ - flexran_get_ul_slice(mod_id, i, &s, PROTOCOL__FLEX_SLICE_ALGORITHM__None); - if (strcmp(s.scheduler, name) == 0) { - in_use = 1; - break; - } - } - } - if (!in_use) { - char s[512]; - int rc = flexran_agent_map_name_to_delegated_object(mod_id, so->name, s, 512); - LOG_W(FLEXRAN_AGENT, - "removing %s (library handle %p) since it is not used in the user " - "plane anymore\n", - s, - so->dl_handle); - dlclose(so->dl_handle); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", so->name); - } else { - int rc = remove(s); - if (rc < 0) - LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", s, strerror(errno)); - } - free (so->name); - if (!prev) { //it's the head, start over - SLIST_REMOVE_HEAD(&flexran_handles[mod_id], entries); - so = flexran_handles[mod_id].slh_first; - } else { - SLIST_REMOVE(&flexran_handles[mod_id], so, flexran_agent_so_handle_s, entries); - so = prev->entries.sle_next; - } - } else { - prev = so; - so = so->entries.sle_next; - } - } - } - - Protocol__FlexUeConfig *ue_config = NULL; - state = &ue_assoc_ringbuffer_state[mod_id]; - if (lfds700_ringbuffer_read(state, NULL, (void **) &ue_config, &ls) != 0) { - apply_ue_slice_assoc_update(mod_id, ue_config); - free(ue_config); - } -} - -void flexran_agent_mac_inform_delegation(mid_t mod_id, - Protocol__FlexControlDelegation *cdm) { - LOG_W(FLEXRAN_AGENT, - "received FlexControlDelegation message for object '%s' xid %d\n", - cdm->name, - cdm->header->xid); - if (cdm->header->xid < xid - 1) { - LOG_I(FLEXRAN_AGENT, - "waiting for %d more messages (up to xid %d)\n", - xid - 1 - cdm->header->xid, - xid - 1); - return; - } - /* should receive up to xid - 1, otherwise it means there was no request */ - AssertFatal(xid > cdm->header->xid, - "received control delegation with xid %d that we never requested " - "(last request %d)\n", - cdm->header->xid, - xid - 1); - - /* Load the library so the user plane can search it */ - char s[512]; - int rc = flexran_agent_map_name_to_delegated_object(mod_id, cdm->name, s, 512); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", cdm->name); - return; - } - /* TODO where to unload/save handle?? */ - void *h = dlopen(s, RTLD_NOW); - if (!h) { - LOG_E(FLEXRAN_AGENT, "dlopen(): %s\n", dlerror()); - return; - } - LOG_I(FLEXRAN_AGENT, "library handle %p\n", h); - - struct lfds700_misc_prng_state ls; - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - Protocol__FlexranMessage *msg = NULL; - struct lfds700_ringbuffer_state *state = &store_slice_config_ringbuffer_state[mod_id]; - if (lfds700_ringbuffer_read(state, NULL, (void **) &msg, &ls) == 0) { - LOG_E(FLEXRAN_AGENT, "%s(): could not read config from ringbuffer\n", __func__); - return; - } - AssertFatal(cdm->header->xid == msg->enb_config_reply_msg->header->xid, - "expected and retrieved xid of stored slice configuration does " - "not match (expected %d, retrieved %d)\n", - cdm->header->xid, - msg->enb_config_reply_msg->header->xid); - - /* Since we recover, stop the timeout */ - rc = flexran_agent_destroy_timer(mod_id, cdm->header->xid); - - prepare_update_slice_config( - mod_id, - &msg->enb_config_reply_msg->cell_config[0]->slice_config, - 0 /* don't do a request */); - /* we should not call flexran_agent_destroy_enb_config_reply(smsg); since - * upon timer removal, this is automatically done. - * prepare_update_slice_config() takes ownership of the slice config, it is - * freed inside */ - - flexran_agent_so_handle_t *so = malloc(sizeof(flexran_agent_so_handle_t)); - DevAssert(so); - so->name = strdup(cdm->name); - DevAssert(so->name); - so->dl_handle = h; - SLIST_INSERT_HEAD(&flexran_handles[mod_id], so, entries); -} - -void flexran_agent_mac_fill_loaded_mac_objects( - mid_t mod_id, - Protocol__FlexEnbConfigReply *reply) { - int n = 0; - flexran_agent_so_handle_t *so = NULL; - SLIST_FOREACH(so, &flexran_handles[mod_id], entries) - ++n; - reply->n_loadedmacobjects = n; - reply->loadedmacobjects = calloc(n, sizeof(char *)); - if (!reply->loadedmacobjects) { - reply->n_loadedmacobjects = 0; - return; - } - n = 0; - SLIST_FOREACH(so, &flexran_handles[mod_id], entries) - reply->loadedmacobjects[n++] = so->name; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h deleted file mode 100644 index 18e567c061..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac.h - * \brief FlexRAN agent message handler APIs for MAC layer - * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein - * \date 2016 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_MAC_H_ -#define FLEXRAN_AGENT_MAC_H_ - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" - -#include "flexran_agent_common.h" -#include "flexran_agent_extern.h" -// for flexran_agent_get_mac_xface() -#include "flexran_agent_extern.h" - -/* Type for a list of shared objects used in the user plane (schedulers) */ -typedef struct flexran_agent_so_handle_s { - char *name; // name of the object - void *dl_handle; // handle of associated objects - SLIST_ENTRY (flexran_agent_so_handle_s) entries; -} flexran_agent_so_handle_t; - -/* Initialization function for the agent structures etc */ -void flexran_agent_init_mac_agent(mid_t mod_id); - -/* Scheduling request information protocol message constructor and estructor */ -int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); - -/* Subframe trigger protocol msssage constructor and destructor */ -int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); - -/* Statistics reply protocol message constructors (for UE and cell stats) and destructor */ -int flexran_agent_mac_stats_reply_ue(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags); -int flexran_agent_mac_stats_reply_cell(mid_t mod_id, - Protocol__FlexCellStatsReport **cell_report, - int n_cc, - uint32_t cc_flags); -int flexran_agent_mac_destroy_stats_reply(Protocol__FlexStatsReply *reply); - -/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ -int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); - -/* UL MAC scheduling decision protocol message constructor (empty command) and destructor */ -int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg); - -int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - - -/********************************** - * FlexRAN agent - technology mac API - **********************************/ - -/*Inform controller about received scheduling requests during a subframe*/ -void flexran_agent_send_sr_info(mid_t mod_id); - -/*Inform the controller about the current UL/DL subframe*/ -void flexran_agent_send_sf_trigger(mid_t mod_id); - -/// Send to the controller all the mac stat updates that occured during this subframe -/// based on the stats request configuration -void flexran_agent_send_update_mac_stats(mid_t mod_id); - -/// Provide to the scheduler a pending dl_mac_config message -void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); - -/* Fill the MAC part of an cell_config message */ -void flexran_agent_fill_mac_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf); - -/* Fill the MAC part of a ue_config message */ -void flexran_agent_fill_mac_ue_config(mid_t mod_id, mid_t ue_id, - Protocol__FlexUeConfig *ue_conf); - -/* Fill the lc_ue_config->lc_config message */ -void flexran_agent_fill_mac_lc_ue_config(mid_t mod_id, mid_t ue_id, - Protocol__FlexLcUeConfig *lc_ue_conf); - -/*Register technology specific interface callbacks*/ -int flexran_agent_register_mac_xface(mid_t mod_id); - -/*Unregister technology specific callbacks*/ -int flexran_agent_unregister_mac_xface(mid_t mod_id); - -/*************************************** - * FlexRAN agent - slice configuration * - ***************************************/ - -/* Inform controller about possibility to update slice configuration */ -void flexran_agent_slice_update(mid_t mod_id); - -/* marks slice_config so that it can be applied later. Takes ownership of the - * FlexSliceConfig message */ -void prepare_update_slice_config(mid_t mod_id, - Protocol__FlexSliceConfig **slice, - int request_objects); - -/* inserts a new ue_config into the structure keeping ue to slice association - * updates and marks so it can be applied. Takes ownership of the FlexUeConfig message */ -void prepare_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig **ue_config); - -/* free slice_config part of flexCellConfig, filled in - * flexran_agent_fill_mac_cell_config() */ -void flexran_agent_destroy_mac_slice_config(Protocol__FlexCellConfig *conf); - -/* information about a new (potentially relevant) control delegation message */ -void flexran_agent_mac_inform_delegation(mid_t mod_id, - Protocol__FlexControlDelegation *cdm); - -/* fill the enb_config_reply with the shared objects in use by the MAC sublayer */ -void flexran_agent_mac_fill_loaded_mac_objects( - mid_t mod_id, - Protocol__FlexEnbConfigReply *reply); - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h deleted file mode 100644 index dfde583387..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac_defs.h - * \brief FlexRAN agent - mac interface primitives - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - * \mail x.foukas@sms.ed.ac.uk - */ - -#ifndef __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ -#define __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ - -#include "flexran_agent_defs.h" -#include "flexran.pb-c.h" -#include "header.pb-c.h" - -#define RINGBUFFER_SIZE 100 - -/* FLEXRAN AGENT-MAC Interface */ -typedef struct { - //msg_context_t *agent_ctxt; - - /// Inform the controller about the scheduling requests received during the subframe - void (*flexran_agent_send_sr_info)(mid_t mod_id); - - /// Inform the controller about the current UL/DL subframe - void (*flexran_agent_send_sf_trigger)(mid_t mod_id); - - /// Send to the controller all the mac stat updates that occured during this subframe - /// based on the stats request configuration - // void (*flexran_agent_send_update_mac_stats)(mid_t mod_id); - - /// Provide to the scheduler a pending dl_mac_config message - void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id, - Protocol__FlexranMessage **msg); - - /// Notify the controller of another (RU) tick, i.e. new subframe. Used to - /// synchronize the eNB and the agent. - void (*flexran_agent_notify_tick)(mid_t mod_id); - - - void *dl_scheduler_loaded_lib; - void *ul_scheduler_loaded_lib; - /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ - -} AGENT_MAC_xface; - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c deleted file mode 100644 index e05fa98854..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac_internal.c - * \brief Helper functions for the MAC agent - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#include -#include - -#include "flexran_agent_common_internal.h" -#include "flexran_agent_mac_internal.h" -#include "flexran_agent_mac_slice_verification.h" - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -extern SLIST_HEAD(flexran_so_handle, - flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB]; - -Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, - Protocol__FlexranMessage *old_message) { - - int i, j; - - Protocol__FlexStatsReply *old_report, *new_report; - - Protocol__FlexStatsReply *stats_reply_msg = NULL; - Protocol__FlexranMessage *msg = NULL; - - Protocol__FlexUeStatsReport **ue_report; - Protocol__FlexUeStatsReport *tmp_ue_report[NUM_MAX_UE]; - Protocol__FlexCellStatsReport **cell_report; - Protocol__FlexCellStatsReport *tmp_cell_report[NUM_MAX_UE]; - - old_report = old_message->stats_reply_msg; - new_report = new_message->stats_reply_msg; - - /*See how many and which UE reports should be included in the final stats message*/ - int n_ue_report = 0; - int ue_found = 0; - - /*Go through each RNTI of the new report and see if it exists in the old one*/ - for (i = 0; i < new_report->n_ue_report; i++) { - for (j = 0; j < old_report->n_ue_report; i++) { - if (new_report->ue_report[i]->rnti == old_report->ue_report[j]->rnti) { - ue_found = 1; - /*Need to check if something changed*/ - if (compare_ue_stats_reports(new_report->ue_report[i], old_report->ue_report[j]) != 0) { - tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); - n_ue_report++; - } - break; - } - } - if (!ue_found) { - tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); - n_ue_report++; - } - ue_found = 0; - } - - /*See how many and which cell reports should be included in the final stats message*/ - int n_cell_report = 0; - int cell_found = 0; - - /*Go through each cell of the new report and see if it exists in the old one*/ - for (i = 0; i < new_report->n_cell_report; i++) { - for (j = 0; j < old_report->n_cell_report; i++) { - if (new_report->cell_report[i]->carrier_index == old_report->cell_report[j]->carrier_index) { - cell_found = 1; - /*Need to check if something changed*/ - if (compare_cell_stats_reports(new_report->cell_report[i], old_report->cell_report[j]) != 0) { - tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); - n_cell_report++; - } - break; - } - } - if (!cell_found) { - tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); - n_cell_report++; - } - cell_found = 0; - } - - if (n_cell_report > 0 || n_ue_report > 0) { - /*Create header*/ - int xid = old_report->header->xid; - Protocol__FlexHeader *header = NULL; - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { - goto error; - } - stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); - protocol__flex_stats_reply__init(stats_reply_msg); - - stats_reply_msg->header = header; - - /*TODO: create the reply message based on the findings*/ - /*Create ue report list*/ - stats_reply_msg->n_ue_report = n_ue_report; - if (n_ue_report > 0) { - ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *)); - for (i = 0; iue_report = ue_report; - } - - /*Create cell report list*/ - stats_reply_msg->n_cell_report = n_cell_report; - if (n_cell_report > 0) { - cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *)); - for (i = 0; icell_report = cell_report; - } - - msg = malloc(sizeof(Protocol__FlexranMessage)); - if(msg == NULL) - goto error; - protocol__flexran_message__init(msg); - msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; - msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - msg->stats_reply_msg = stats_reply_msg; - } - return msg; - - error: - if (stats_reply_msg) { - if (stats_reply_msg->ue_report) { - free(stats_reply_msg->ue_report); - } - if (stats_reply_msg->cell_report) { - free(stats_reply_msg->cell_report); - } - free(stats_reply_msg); - } - return NULL; -} - -int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, - Protocol__FlexUeStatsReport *rep2) { - return 1; -} - -int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, - Protocol__FlexCellStatsReport *rep2) { - return 1; -} - -Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original) { - int i; - Protocol__FlexUeStatsReport *copy = malloc(sizeof(Protocol__FlexUeStatsReport)); - if (copy == NULL) - goto error; - protocol__flex_ue_stats_report__init(copy); - copy->rnti = original->rnti; - copy->has_rnti = original->has_rnti; - copy->flags = original->flags; - copy->has_flags = original->has_flags; - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { - copy->n_bsr = original->n_bsr; - if (copy->n_bsr > 0) { - uint32_t *elem; - elem = (uint32_t *) malloc(sizeof(uint32_t)*copy->n_bsr); - if (elem == NULL) - goto error; - for (i = 0; i < original->n_bsr; i++) { - elem[i] = original->bsr[i]; - } - copy->bsr = elem; - } - } - - - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) { - copy->has_phr = original->has_phr; - copy->phr = original->phr; - } - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { - copy->n_rlc_report = original->n_rlc_report; - if (copy->n_rlc_report > 0) { - Protocol__FlexRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr) * copy->n_rlc_report); - if (rlc_reports == NULL) - goto error; - for (i = 0; i < copy->n_rlc_report; i++) { - rlc_reports[i] = copy_rlc_report(original->rlc_report[i]); - } - copy->rlc_report = rlc_reports; - } - } - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { - copy->has_pending_mac_ces = original->has_pending_mac_ces; - copy->pending_mac_ces = original->pending_mac_ces; - - } - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { - copy->dl_cqi_report = copy_dl_cqi_report(original->dl_cqi_report); - } - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { - /*Copy the Paging Buffer report*/ - copy->pbr = copy_paging_buffer_report(original->pbr); - } - - if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { - /*TODO: Copy the UL report*/ - copy->ul_cqi_report = copy_ul_cqi_report(original->ul_cqi_report); - } - - return copy; - - error: - if (copy){ - if (copy->bsr){ - free(copy->bsr); - } - free(copy); - } - return NULL; -} - -Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original) { - Protocol__FlexRlcBsr * copy = malloc(sizeof(Protocol__FlexRlcBsr)); - if (copy == NULL) - goto error; - protocol__flex_rlc_bsr__init(copy); - copy->lc_id = original->lc_id; - copy->has_lc_id = original->has_lc_id; - copy->tx_queue_size = original->tx_queue_size; - copy->has_tx_queue_size = original->has_tx_queue_size; - copy->tx_queue_hol_delay = original->tx_queue_hol_delay; - copy->has_tx_queue_hol_delay = original->has_tx_queue_hol_delay; - copy->retransmission_queue_size = original->retransmission_queue_size; - copy->has_retransmission_queue_size = original->has_retransmission_queue_size; - copy->retransmission_queue_hol_delay = original->retransmission_queue_hol_delay; - copy->has_retransmission_queue_hol_delay = original->has_retransmission_queue_hol_delay; - copy->status_pdu_size = original->status_pdu_size; - copy->has_status_pdu_size = original->has_status_pdu_size; - - return copy; - - error: - return NULL; -} - -Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original) { - int i, j; - - //Fill in the full UL CQI report of the UE - Protocol__FlexUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); - if(full_ul_report == NULL) { - goto error; - } - protocol__flex_ul_cqi_report__init(full_ul_report); - //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = original->sfn_sn; - full_ul_report->has_sfn_sn = original->has_sfn_sn; - full_ul_report->n_cqi_meas = original->n_cqi_meas; - - Protocol__FlexUlCqi **ul_report=NULL; - ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); - if(ul_report == NULL) - goto error; - for(i = 0; i < full_ul_report->n_cqi_meas; i++) { - ul_report[i] = malloc(sizeof(Protocol__FlexUlCqi)); - if(ul_report[i] == NULL) - goto error; - protocol__flex_ul_cqi__init(ul_report[i]); - ul_report[i]->type = original->cqi_meas[i]->type; - ul_report[i]->has_type = original->cqi_meas[i]->has_type; - ul_report[i]->n_sinr = original->cqi_meas[i]->n_sinr; - uint32_t *sinr_meas; - sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[i]->n_sinr); - if (sinr_meas == NULL) - goto error; - for (j = 0; j < ul_report[i]->n_sinr; j++) { - sinr_meas[j] = original->cqi_meas[i]->sinr[j]; - } - ul_report[i]->sinr = sinr_meas; - ul_report[i]->serv_cell_index = original->cqi_meas[i]->serv_cell_index; - ul_report[i]->has_serv_cell_index = original->cqi_meas[i]->has_serv_cell_index; - } - full_ul_report->cqi_meas = ul_report; - - return full_ul_report; - - error: - if (full_ul_report){ - if (ul_report){ - for (i = 0; i < full_ul_report->n_cqi_meas; i++){ - if (ul_report[i]){ - if ( ul_report[i]->sinr ){ - free(ul_report[i]->sinr); - } - free(ul_report[i]); - } - } - free(ul_report); - } - free(full_ul_report); - } - return NULL; -} - -Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original) { - int i; - /*Copy the DL report*/ - Protocol__FlexDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); - if (dl_report == NULL) - goto error; - protocol__flex_dl_cqi_report__init(dl_report); - - dl_report->sfn_sn = original->sfn_sn; - dl_report->has_sfn_sn = original->has_sfn_sn; - dl_report->n_csi_report = original->n_csi_report; - - Protocol__FlexDlCsi **csi_reports=NULL; - csi_reports = malloc(sizeof(Protocol__FlexDlCsi *) * dl_report->n_csi_report); - if (csi_reports == NULL) - goto error; - - for (i = 0; i < dl_report->n_csi_report; i++) { - csi_reports[i] = copy_csi_report(original->csi_report[i]); - } - dl_report->csi_report = csi_reports; - return dl_report; - - error: - /*TODO: Must free memory properly*/ - if (dl_report != NULL) { - if (csi_reports != NULL) { - free(csi_reports); - csi_reports = NULL; - } - free(dl_report); - dl_report = NULL; - } - return NULL; -} - -Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original) { - - int i; - Protocol__FlexPagingBufferReport *copy; - copy = malloc(sizeof(Protocol__FlexPagingBufferReport)); - if (copy == NULL) - goto error; - - protocol__flex_paging_buffer_report__init(copy); - copy->n_paging_info = original->n_paging_info; - - Protocol__FlexPagingInfo **p_info=NULL; - p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * copy->n_paging_info); - if (p_info == NULL) - goto error; - for (i = 0; i < copy->n_paging_info; i++) { - p_info[i] = malloc(sizeof(Protocol__FlexPagingInfo)); - if(p_info[i] == NULL) - goto error; - protocol__flex_paging_info__init(p_info[i]); - p_info[i]->paging_index = original->paging_info[i]->paging_index; - p_info[i]->has_paging_index = original->paging_info[i]->has_paging_index;; - p_info[i]->paging_message_size = original->paging_info[i]->paging_message_size; - p_info[i]->has_paging_message_size = original->paging_info[i]->has_paging_message_size; - p_info[i]->paging_subframe = original->paging_info[i]->paging_subframe; - p_info[i]->has_paging_subframe = original->paging_info[i]->has_paging_subframe; - p_info[i]->carrier_index = original->paging_info[i]->carrier_index; - p_info[i]->has_carrier_index = original->paging_info[i]->has_carrier_index; - } - copy->paging_info = p_info; - return copy; - - error: - /*TODO: free memory properly*/ - if (copy){ - if (p_info){ - for (i = 0; i < copy->n_paging_info; i++){ - if (p_info[i]){ - free(p_info[i]); - } - } - free(p_info); - } - free(copy); - copy = NULL; - } - return NULL; -} - -Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original) { - int i, j; - Protocol__FlexDlCsi *copy = malloc(sizeof(Protocol__FlexDlCsi)); - if (copy == NULL) - goto error; - protocol__flex_dl_csi__init(copy); - copy->serv_cell_index = original->serv_cell_index; - copy->has_serv_cell_index = original->has_serv_cell_index; - copy->ri = original->ri; - copy->has_ri = original->ri; - - copy->type = original->type; - copy->has_type = original->has_type; - copy->report_case = original->report_case; - - switch (copy->report_case) { - case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: - copy->p10csi->wb_cqi = original->p10csi->wb_cqi; - copy->p10csi->has_wb_cqi = original->p10csi->has_wb_cqi; - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: - copy->p11csi->n_wb_cqi = original->p11csi->n_wb_cqi; - copy->p11csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p11csi->n_wb_cqi); - for (i = 0; i < copy->p11csi->n_wb_cqi; i++) { - copy->p11csi->wb_cqi[i] = original->p11csi->wb_cqi[i]; - } - copy->p11csi->has_wb_pmi = original->p11csi->has_wb_pmi; - copy->p11csi->wb_pmi = original->p11csi->wb_pmi; - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: - copy->p20csi->has_wb_cqi = original->p20csi->has_wb_cqi; - copy->p20csi->wb_cqi = original->p20csi->wb_cqi; - copy->p20csi->has_sb_cqi = original->p20csi->has_sb_cqi; - copy->p20csi->sb_cqi = original->p20csi->sb_cqi; - copy->p20csi->has_bandwidth_part_index = original->p20csi->has_bandwidth_part_index; - copy->p20csi->bandwidth_part_index = original->p20csi->bandwidth_part_index; - copy->p20csi->has_sb_index = original->p20csi->has_sb_index; - copy->p20csi->sb_index = original->p20csi->sb_index; - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: - copy->p21csi->n_wb_cqi = original->p21csi->n_wb_cqi; - copy->p21csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_wb_cqi); - for (i = 0; i < copy->p21csi->n_wb_cqi; i++) { - copy->p21csi->wb_cqi[i] = original->p21csi->wb_cqi[i]; - } - copy->p21csi->has_wb_pmi = original->p21csi->has_wb_pmi; - copy->p21csi->wb_pmi = original->p21csi->wb_pmi; - copy->p21csi->n_sb_cqi = original->p21csi->n_sb_cqi; - copy->p21csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_sb_cqi); - for (i = 0; i < copy->p21csi->n_sb_cqi; i++) { - copy->p21csi->sb_cqi[i] = original->p21csi->sb_cqi[i]; - } - copy->p21csi->has_badwidth_part_index = original->p21csi->has_badwidth_part_index; - copy->p21csi->badwidth_part_index = original->p21csi->badwidth_part_index; - copy->p21csi->has_sb_index = original->p21csi->has_sb_index; - copy->p21csi->sb_index = original->p21csi->sb_index; - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: - copy->a12csi->n_wb_cqi = original->a12csi->n_wb_cqi; - copy->a12csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_wb_cqi); - for (i = 0; i < copy->a12csi->n_wb_cqi; i++) { - copy->a12csi->wb_cqi[i] = original->a12csi->wb_cqi[i]; - } - copy->a12csi->n_sb_pmi = original->a12csi->n_sb_pmi; - copy->a12csi->sb_pmi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_sb_pmi); - for (i = 0; i < copy->a12csi->n_sb_pmi; i++) { - copy->a12csi->sb_pmi[i] = original->a12csi->sb_pmi[i]; - } - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: - copy->a22csi->n_wb_cqi = original->a22csi->n_wb_cqi; - copy->a22csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_wb_cqi); - for (i = 0; i < copy->a22csi->n_wb_cqi; i++) { - copy->a22csi->wb_cqi[i] = original->a22csi->wb_cqi[i]; - } - copy->a22csi->n_sb_cqi = original->a22csi->n_sb_cqi; - copy->a22csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_cqi); - for (i = 0; i < copy->a22csi->n_sb_cqi; i++) { - copy->a22csi->sb_cqi[i] = original->a22csi->sb_cqi[i]; - } - copy->a22csi->has_wb_pmi = original->a22csi->has_wb_pmi; - copy->a22csi->wb_pmi = original->a22csi->wb_pmi; - copy->a22csi->has_sb_pmi = original->a22csi->has_sb_pmi; - copy->a22csi->sb_pmi = original->a22csi->sb_pmi; - copy->a22csi->n_sb_list = original->a22csi->n_sb_list; - copy->a22csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_list); - for (i = 0; i < copy->a22csi->n_sb_list; i++) { - copy->a22csi->sb_list[i] = original->a22csi->sb_list[i]; - } - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: - copy->a20csi->has_wb_cqi = original->a20csi->has_wb_cqi; - copy->a20csi->wb_cqi = original->a20csi->wb_cqi; - copy->a20csi->has_sb_cqi = original->a20csi->has_sb_cqi; - copy->a20csi->sb_cqi = original->a20csi->sb_cqi; - copy->a20csi->n_sb_list = original->a20csi->n_sb_list; - copy->a20csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a20csi->n_sb_list); - for (i = 0; i < copy->a20csi->n_sb_list; i++) { - copy->a20csi->sb_list[i] = original->a20csi->sb_list[i]; - } - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: - copy->a30csi->has_wb_cqi = original->a30csi->has_wb_cqi; - copy->a30csi->wb_cqi = original->a30csi->wb_cqi; - copy->a30csi->n_sb_cqi = original->a30csi->n_sb_cqi; - copy->a30csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a30csi->n_sb_cqi); - for (i = 0; i < copy->a30csi->n_sb_cqi; i++) { - copy->a30csi->sb_cqi[i] = original->a30csi->sb_cqi[i]; - } - break; - case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: - copy->a31csi->n_wb_cqi = original->a31csi->n_wb_cqi; - copy->a31csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->n_wb_cqi); - for (i = 0; i < copy->a31csi->n_wb_cqi; i++) { - copy->a31csi->wb_cqi[i] = original->a31csi->wb_cqi[i]; - } - copy->a31csi->has_wb_pmi = original->a31csi->has_wb_pmi; - copy->a31csi->wb_pmi = original->a31csi->wb_pmi; - copy->a31csi->n_sb_cqi = original->a31csi->n_sb_cqi; - copy->a31csi->sb_cqi = malloc(sizeof(Protocol__FlexMsbCqi *) * copy->a31csi->n_sb_cqi); - if (copy->a31csi == NULL) { - goto error; - } - for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { - copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__FlexMsbCqi)); - if (copy->a31csi->sb_cqi[i] == NULL) { - goto error; - } - protocol__flex_msb_cqi__init(copy->a31csi->sb_cqi[i]); - copy->a31csi->sb_cqi[i]->n_sb_cqi = original->a31csi->sb_cqi[i]->n_sb_cqi; - copy->a31csi->sb_cqi[i]->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->sb_cqi[i]->n_sb_cqi); - for (j = 0; j < copy->a31csi->sb_cqi[i]->n_sb_cqi; j++) { - copy->a31csi->sb_cqi[i]->sb_cqi[j] = original->a31csi->sb_cqi[i]->sb_cqi[j]; - } - } - break; - default: - goto error; - } - return copy; - - error: - if (copy != NULL) { - if ((copy->p11csi != NULL) && (copy->p11csi->wb_cqi != NULL)) { - free(copy->p11csi->wb_cqi); - copy->p11csi->wb_cqi = NULL; - } - if (copy->p21csi != NULL) { - if (copy->p21csi->wb_cqi != NULL) { - free(copy->p21csi->wb_cqi); - copy->p21csi->wb_cqi = NULL; - } - if (copy->p21csi->sb_cqi != NULL) { - free(copy->p21csi->sb_cqi); - copy->p21csi->sb_cqi = NULL; - } - } - if (copy->a12csi != NULL) { - if (copy->a12csi->wb_cqi != NULL) { - free(copy->a12csi->wb_cqi); - copy->a12csi->wb_cqi = NULL; - } - if (copy->a12csi->sb_pmi != NULL) { - free(copy->a12csi->sb_pmi); - copy->a12csi->sb_pmi = NULL; - } - } - if (copy->a22csi != NULL) { - if (copy->a22csi->wb_cqi != NULL) { - free(copy->a22csi->wb_cqi); - copy->a22csi->wb_cqi = NULL; - } - if (copy->a22csi->sb_cqi != NULL) { - free(copy->a22csi->sb_cqi); - copy->a22csi->sb_cqi = NULL; - } - if (copy->a22csi->sb_list != NULL) { - free(copy->a22csi->sb_list); - copy->a22csi->sb_list = NULL; - } - } - if ((copy->a20csi != NULL) && (copy->a20csi->sb_list != NULL)) { - free(copy->a20csi->sb_list); - copy->a20csi->sb_list = NULL; - } - if ((copy->a30csi != NULL) && (copy->a30csi->sb_cqi != NULL)) { - free(copy->a30csi->sb_cqi); - copy->a30csi->sb_cqi = NULL; - } - if (copy->a31csi != NULL) { - if (copy->a31csi->wb_cqi != NULL) { - free(copy->a31csi->wb_cqi); - copy->a31csi->wb_cqi = NULL; - } - if (copy->a31csi->sb_cqi != NULL) { - for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { - if (copy->a31csi->sb_cqi[i] != NULL) { - if (copy->a31csi->sb_cqi[i]->sb_cqi != NULL) { - free(copy->a31csi->sb_cqi[i]->sb_cqi); - } - free(copy->a31csi->sb_cqi[i]); - } - } - free(copy->a31csi->sb_cqi); - copy->a31csi->sb_cqi = NULL; - } - } - free(copy); - copy = NULL; - } - return NULL; -} - -Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original) { - - Protocol__FlexCellStatsReport * copy = malloc(sizeof(Protocol__FlexCellStatsReport)); - - if(copy == NULL) { - goto error; - } - protocol__flex_cell_stats_report__init(copy); - copy->carrier_index = original->carrier_index; - copy->has_carrier_index = original->has_carrier_index; - copy->flags = original->flags; - copy->has_flags = original->has_flags; - - if(copy->flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { - copy->noise_inter_report = copy_noise_inter_report(original->noise_inter_report); - } - - return copy; - - error: - return NULL; -} - -Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original) { - Protocol__FlexNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); - if(ni_report == NULL) { - goto error; - } - protocol__flex_noise_interference_report__init(ni_report); - // Current frame and subframe number - ni_report->sfn_sf = original->sfn_sf; - ni_report->has_sfn_sf = original->sfn_sf; - // Received interference power in dbm - ni_report->rip = original->rip; - ni_report->has_rip = original->has_rip; - // Thermal noise power in dbm - ni_report->tnp = original->tnp; - ni_report->has_tnp = original->has_tnp; - - return ni_report; - - error: - return NULL; -} - - -int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { - - yaml_event_t event; - - int done = 0; - - int sequence_started = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - case YAML_SEQUENCE_START_EVENT: - LOG_D(ENB_APP, "A sequence just started as expected\n"); - sequence_started = 1; - break; - case YAML_SEQUENCE_END_EVENT: - LOG_D(ENB_APP, "A sequence ended\n"); - sequence_started = 0; - break; - case YAML_MAPPING_START_EVENT: - if (!sequence_started) { - goto error; - } - LOG_D(ENB_APP, "A mapping started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - if (!mapping_started) { - goto error; - } - LOG_D(ENB_APP, "A mapping ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check the types of subsystems offered and handle their values accordingly - if (strcmp((char *) event.data.scalar.value, "dl_scheduler") == 0) { - LOG_D(ENB_APP, "This is for the dl_scheduler subsystem\n"); - // Call the proper handler - if (parse_dl_scheduler_config(mod_id, parser) == -1) { - LOG_D(ENB_APP, "An error occured\n"); - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "ul_scheduler") == 0) { - // Call the proper handler - LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n"); - if (parse_ul_scheduler_config(mod_id, parser) == -1) { - LOG_D(ENB_APP, "An error occured\n"); - goto error; - } - // TODO - } else if (strcmp((char *) event.data.scalar.value, "ra_scheduler") == 0) { - // Call the proper handler - // TODO - } else if (strcmp((char *) event.data.scalar.value, "page_scheduler") == 0) { - // Call the proper handler - // TODO - } else { - // Unknown subsystem - goto error; - } - break; - default: // We expect nothing else at this level of the hierarchy - goto error; - } - - done = (event.type == YAML_SEQUENCE_END_EVENT); - - yaml_event_delete(&event); - - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; - -} - -int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { - - yaml_event_t event; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping (behavior and parameters) - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (strcmp((char *) event.data.scalar.value, "behavior") == 0) { - LOG_I(ENB_APP, "Time to set the behavior attribute\n"); - yaml_event_delete(&event); - if (!yaml_parser_parse(parser, &event)) { - goto error; - } - if (event.type == YAML_SCALAR_EVENT) { - if (load_dl_scheduler_function(mod_id, (char *) event.data.scalar.value) == -1) { - goto error; - } - } else { - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "parameters") == 0) { - LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n"); - if (parse_dl_scheduler_parameters(mod_id, parser) == -1) { - goto error; - } - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { - - yaml_event_t event; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping (behavior and parameters) - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (strcmp((char *) event.data.scalar.value, "parameters") == 0) { - LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n"); - if (parse_ul_scheduler_parameters(mod_id, parser) == -1) { - goto error; - } - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - - -int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { - yaml_event_t event; - - void *param; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping of parameters - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (flexran_agent_get_mac_xface(mod_id)) { - LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value); - param = dlsym(flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib, - (char *) event.data.scalar.value); - if (param == NULL) { - goto error; - } - apply_parameter_modification(param, parser); - } else { - goto error; - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { - yaml_event_t event; - - void *param; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping of parameters - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (flexran_agent_get_mac_xface(mod_id)) { - LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value); - param = dlsym(flexran_agent_get_mac_xface(mod_id)->ul_scheduler_loaded_lib, - (char *) event.data.scalar.value); - if (param == NULL) { - goto error; - } - apply_parameter_modification(param, parser); - } else { - goto error; - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { - void *lib; - - char lib_name[120]; - char target[512]; - snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); - strcpy(target, RC.flexran[mod_id]->cache_name); - strcat(target, lib_name); - - LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target); - lib = dlopen(target, RTLD_NOW); - if (lib == NULL) { - LOG_I(FLEXRAN_AGENT, "Could not load library\n"); - goto error; - } - - LOG_I(FLEXRAN_AGENT, "Loading function: %s\n", function_name); - void *loaded_scheduler = dlsym(lib, function_name); - if (loaded_scheduler) { - if (flexran_agent_get_mac_xface(mod_id)) { - if (flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib != NULL) { - dlclose(flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib); - } - flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib = lib; - LOG_I(FLEXRAN_AGENT, "New DL UE scheduler: %s\n", function_name); - } - } else { - LOG_I(FLEXRAN_AGENT, "Scheduler could not be loaded\n"); - } - - if (flexran_agent_get_mac_xface(mod_id)) { - if (flexran_agent_get_mac_xface(mod_id)->dl_scheduler_loaded_lib != lib) { - dlclose(lib); - } - } else { - dlclose(lib); - } - return 0; - - error: - return -1; - -} - -void *search_so(mid_t mod_id, char *name) { - if (!name) // no name -> nothing to return, so use NULL for executable - return NULL; - if (dlsym(NULL, name)) // found it in executable - return NULL; - flexran_agent_so_handle_t *so = NULL; - SLIST_FOREACH(so, &flexran_handles[mod_id], entries) { - if (strcmp(so->name, name) == 0) - return so->dl_handle; - } - return NULL; -} - -void update_or_remove_dl(mid_t mod_id, Protocol__FlexSlice *s) { - if (s->params_case == PROTOCOL__FLEX_SLICE__PARAMS__NOT_SET - && !s->label && !s->scheduler) { - LOG_I(FLEXRAN_AGENT, "remove DL slice ID %d\n", s->id); - const int rc = flexran_remove_dl_slice(mod_id, s); - if (!rc) - LOG_W(FLEXRAN_AGENT, "error while removing slice ID %d\n", s->id); - } else { - void *lib = search_so(mod_id, s->scheduler); - LOG_I(FLEXRAN_AGENT, - "updating DL slice ID %d (library handle %p)\n", - s->id, - lib); - const int rc = flexran_create_dl_slice(mod_id, s, lib); - if (rc < 0) - LOG_W(FLEXRAN_AGENT, - "error while update slice ID %d: flexran_create_dl_slice() -> %d\n", - s->id, rc); - } -} - -void update_or_remove_ul(mid_t mod_id, Protocol__FlexSlice *s) { - if (s->params_case == PROTOCOL__FLEX_SLICE__PARAMS__NOT_SET - && !s->label && !s->scheduler) { - LOG_I(FLEXRAN_AGENT, "remove UL slice ID %d\n", s->id); - const int rc = flexran_remove_ul_slice(mod_id, s); - if (!rc) - LOG_W(FLEXRAN_AGENT, "error while removing slice ID %d\n", s->id); - } else { - void *lib = search_so(mod_id, s->scheduler); - LOG_I(FLEXRAN_AGENT, - "updating UL slice ID %d (library handle %p)\n", - s->id, - lib); - const int rc = flexran_create_ul_slice(mod_id, s, lib); - if (rc < 0) - LOG_W(FLEXRAN_AGENT, - "error while updating slice ID %d: flexran_create_ul_slice() -> %d)\n", - s->id, rc); - } -} - -void apply_update_dl_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *dl) { - if (!dl) - return; - - Protocol__FlexSliceAlgorithm dl_algo = flexran_get_dl_slice_algo(mod_id); - if (dl->has_algorithm && dl_algo != dl->algorithm) { - LOG_I(FLEXRAN_AGENT, "loading new DL slice algorithm %d\n", dl->algorithm); - dl_algo = dl->algorithm; - flexran_set_dl_slice_algo(mod_id, dl_algo); - } - - /* first update existing slices, then create new. Thus, we go through the - * list twice. First round, if a slice exists, handle and mark as such. Then, - * apply all others in the second round */ - if (dl->n_slices > 0) { - if (dl_algo == PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "cannot update slices: no algorithm loaded\n"); - return; - } - int handled_dl[dl->n_slices]; - for (int i = 0; i < dl->n_slices; ++i) { - if (flexran_find_dl_slice(mod_id, dl->slices[i]->id) < 0) { - handled_dl[i] = 0; - continue; - } - update_or_remove_dl(mod_id, dl->slices[i]); - handled_dl[i] = 1; - } - for (int i = 0; i < dl->n_slices; ++i) { - if (handled_dl[i]) - continue; - update_or_remove_dl(mod_id, dl->slices[i]); - } - } - - if (dl->scheduler) { - if (dl_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "cannot update scheduling algorithm: slice algorithm loaded\n"); - return; - } - void *lib = search_so(mod_id, dl->scheduler); - LOG_I(FLEXRAN_AGENT, - "loading DL new scheduling algorithm '%s' (library handle %p)\n", - dl->scheduler, - lib); - const int rc = flexran_set_dl_scheduler(mod_id, dl->scheduler, lib); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, - "error while updating scheduling algorithm: " - "flexran_update_dl_sched_algo() -> %d)\n", - rc); - return; - } - } -} - -void apply_update_ul_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *ul) { - if (!ul) - return; - - Protocol__FlexSliceAlgorithm ul_algo = flexran_get_ul_slice_algo(mod_id); - if (ul->has_algorithm && ul_algo != ul->algorithm) { - LOG_I(FLEXRAN_AGENT, "loading new UL slice algorithm %d\n", ul->algorithm); - ul_algo = ul->algorithm; - flexran_set_ul_slice_algo(mod_id, ul_algo); - } - if (ul->n_slices > 0) { - if (ul_algo == PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "cannot update slices: no algorithm loaded\n"); - return; - } - int handled_ul[ul->n_slices]; - for (int i = 0; i < ul->n_slices; ++i) { - if (flexran_find_ul_slice(mod_id, ul->slices[i]->id) < 0) { - handled_ul[i] = 0; - continue; - } - update_or_remove_ul(mod_id, ul->slices[i]); - handled_ul[i] = 1; - } - for (int i = 0; i < ul->n_slices; ++i) { - if (handled_ul[i]) - continue; - update_or_remove_ul(mod_id, ul->slices[i]); - } - } - - if (ul->scheduler) { - if (ul_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "cannot update scheduling algorithm: slice algorithm loaded\n"); - return; - } - void *lib = search_so(mod_id, ul->scheduler); - LOG_I(FLEXRAN_AGENT, - "loading new UL scheduling algorithm '%s' (library handle %p)\n", - ul->scheduler, - lib); - const int rc = flexran_set_ul_scheduler(mod_id, ul->scheduler, lib); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, - "error while updating scheduling algorithm: " - "flexran_update_dl_sched_algo() -> %d)\n", - rc); - return; - } - } -} - -int apply_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig *ue_config) -{ - if (!ue_config->has_rnti) { - LOG_E(FLEXRAN_AGENT, - "[%d] cannot update UE to slice association, no RNTI in flex_ue_config message\n", - mod_id); - return 0; - } - int UE_id = flexran_get_mac_ue_id_rnti(mod_id, ue_config->rnti); - if (ue_config->has_dl_slice_id) { - if (flexran_get_dl_slice_algo(mod_id) == PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "no DL slice algorithm loaded\n"); - } else { - LOG_I(FLEXRAN_AGENT, "[%d] associating UE RNTI %04x - %d/UE %d to DL slice ID %d\n", - mod_id, ue_config->rnti, ue_config->rnti, UE_id, ue_config->dl_slice_id); - flexran_set_ue_dl_slice_id(mod_id, UE_id, ue_config->dl_slice_id); - } - } - if (ue_config->has_ul_slice_id) { - if (flexran_get_ul_slice_algo(mod_id) == PROTOCOL__FLEX_SLICE_ALGORITHM__None) { - LOG_E(FLEXRAN_AGENT, "no UL slice algorithm loaded\n"); - } else { - LOG_I(FLEXRAN_AGENT, "[%d] associating UE RNTI %04x - %d/UE %d to UL slice ID %d\n", - mod_id, ue_config->rnti, ue_config->rnti, UE_id, ue_config->ul_slice_id); - flexran_set_ue_ul_slice_id(mod_id, UE_id, ue_config->ul_slice_id); - } - } - return 0; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h deleted file mode 100644 index d6dd6e3b6f..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac_internal.h - * \brief Implementation specific definitions for the FlexRAN MAC agent - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_MAC_INTERNAL_H_ -#define FLEXRAN_AGENT_MAC_INTERNAL_H_ - -#include - -#include - -#include "flexran_agent_mac.h" -#include "flexran_agent_common.h" -#include "flexran_agent_defs.h" - -/*This will be used for producing continuous status updates for the MAC - *Needs to be thread-safe - */ -typedef struct { - /*Flag showing if continuous mac stats update is enabled*/ - uint8_t is_initialized; - volatile uint8_t cont_update; - xid_t xid; - Protocol__FlexranMessage *stats_req; - Protocol__FlexranMessage *prev_stats_reply; - - pthread_mutex_t *mutex; -} mac_stats_updates_context_t; - - -/*Functions to initialize and destroy the struct required for the - *continuous stats update report*/ -err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id); - -err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id); - - -Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, - Protocol__FlexranMessage *old_report); - -Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original); - -Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original); - -Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original); - -Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original); - -Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original); - -Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original); - -Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original); - -Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original); - -int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, - Protocol__FlexUeStatsReport *rep2); - -int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, - Protocol__FlexCellStatsReport *rep2); - - -/* Functions for parsing the MAC agent policy reconfiguration command */ - -int parse_mac_config(mid_t mod_id, yaml_parser_t *parser); - -int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser); - -int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); - -int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser); - -int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); - -int load_dl_scheduler_function(mid_t mod_id, const char *function_name); - -/*** Functions for handling a slice config ***/ - -/* Prepare the application of a slicing config */ -void apply_update_dl_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *slice); -void apply_update_ul_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *slice); - -/* apply a new association between a UE and a slice (both DL and UL) */ -int apply_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig *ue_config); - -#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/ diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c deleted file mode 100644 index 6e54e155c2..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac_slice_verification.c - * \brief MAC Agent slice verification helper functions - * \author Robert Schmidt - * \date 2018 - * \version 0.1 - */ - - -#include "flexran_agent_mac_slice_verification.h" diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.h deleted file mode 100644 index c9e66b6f88..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_mac_slice_verification.h - * \brief MAC Agent slice verification helper functions - * \author Robert Schmidt - * \date 2018 - * \version 0.1 - */ - -#include "flexran_agent_common_internal.h" -#include "flexran_agent_mac_internal.h" - diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c deleted file mode 100644 index 67da5fa452..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_pdcp.c - * \brief FlexRAN agent Control Module PDCP - * \author Navid Nikaein and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#include "flexran_agent_pdcp.h" - -/*Array containing the Agent-PDCP interfaces*/ -AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB]; - -// MAX_MOBILES_PER_ENB - -void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, - uint16_t uid, - Protocol__FlexPdcpStats *pdcp_aggr_stats){ - - int lcid=0; - /* only calculate the DRBs */ - //LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, uid); - - for (lcid=NUM_MAX_SRB ; lcid < NUM_MAX_SRB + NUM_MAX_DRB; lcid++){ - - pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id, uid, lcid); - - - pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id, uid, lcid); - pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id, uid, lcid); - - } - -} - - -int flexran_agent_pdcp_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags) { - if (n_ue > 0) { - - for (int i = 0; i < n_ue; i++) { - const rnti_t rnti = ue_report[i]->rnti; - const uint16_t uid = flexran_get_pdcp_uid_from_rnti(mod_id, rnti); - - /* Check flag for creation of buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) { - - Protocol__FlexPdcpStats *pdcp_aggr_stats; - pdcp_aggr_stats = malloc(sizeof(Protocol__FlexPdcpStats)); - if (pdcp_aggr_stats == NULL) - goto error; - protocol__flex_pdcp_stats__init(pdcp_aggr_stats); - - flexran_agent_pdcp_aggregate_stats(mod_id, uid, pdcp_aggr_stats); - - pdcp_aggr_stats->has_pkt_tx=1; - pdcp_aggr_stats->has_pkt_tx_bytes =1; - pdcp_aggr_stats->has_pkt_tx_w=1; - pdcp_aggr_stats->has_pkt_tx_bytes_w =1; - pdcp_aggr_stats->has_pkt_tx_aiat =1; - pdcp_aggr_stats->has_pkt_tx_aiat_w =1; - - pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, uid, DEFAULT_DRB); - pdcp_aggr_stats->has_pkt_tx_sn =1; - - pdcp_aggr_stats->has_pkt_rx =1; - pdcp_aggr_stats->has_pkt_rx_bytes =1; - pdcp_aggr_stats->has_pkt_rx_w =1; - pdcp_aggr_stats->has_pkt_rx_bytes_w =1; - pdcp_aggr_stats->has_pkt_rx_aiat =1; - pdcp_aggr_stats->has_pkt_rx_aiat_w =1; - pdcp_aggr_stats->has_pkt_rx_oo =1; - - pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, uid, DEFAULT_DRB); - pdcp_aggr_stats->has_pkt_rx_sn =1; - - pdcp_aggr_stats->sfn = flexran_get_pdcp_sfn(mod_id); - pdcp_aggr_stats->has_sfn =1; - - ue_report[i]->pdcp_stats = pdcp_aggr_stats; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS; - } - } - } else { - LOG_D(FLEXRAN_AGENT, "no UE\n"); - } - - return 0; - - error: - LOG_W(FLEXRAN_AGENT, "Can't allocate PDCP stats\n"); - return -1; -} - -int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply) -{ - for (int i = 0; i < reply->n_ue_report; ++i) { - if (reply->ue_report[i]->pdcp_stats) - free(reply->ue_report[i]->pdcp_stats); - } - return 0; -} - - -int flexran_agent_register_pdcp_xface(mid_t mod_id) -{ - if (agent_pdcp_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "PDCP agent CM for eNB %d is already registered\n", mod_id); - return -1; - } - AGENT_PDCP_xface *xface = malloc(sizeof(AGENT_PDCP_xface)); - if (!xface) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for PDCP agent xface %d\n", mod_id); - return -1; - } - - //xface->flexran_pdcp_stats_measurement = NULL; - - agent_pdcp_xface[mod_id] = xface; - - return 0; -} - -int flexran_agent_unregister_pdcp_xface(mid_t mod_id) -{ - if (!agent_pdcp_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "PDCP agent CM for eNB %d is not registered\n", mod_id); - return -1; - } - //xface->agent_ctxt = NULL; - //xface->flexran_pdcp_stats_measurement = NULL; - - free(agent_pdcp_xface[mod_id]); - agent_pdcp_xface[mod_id] = NULL; - - return 0; -} - -AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id) -{ - return agent_pdcp_xface[mod_id]; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h deleted file mode 100644 index 11decf0298..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_pdcp.h - * \brief FlexRAN agent Control Module PDCP header - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_PDCP_H_ -#define FLEXRAN_AGENT_PDCP_H_ - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" - - -#include "flexran_agent_common.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_pdcp_defs.h" -#include "flexran_agent_ran_api.h" -// for flexran_agent_get_pdcp_xface() -#include "flexran_agent_extern.h" - -/********************************** - * FlexRAN agent - technology PDCP API - **********************************/ - -/* Send to the controller all the pdcp stat updates that occured during this subframe*/ -int flexran_agent_pdcp_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags); -int flexran_agent_pdcp_destroy_stats_reply(Protocol__FlexStatsReply *reply); - -/* Get the stats from RAN API and aggregate them per USER*/ -void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id, - uint16_t uid, - Protocol__FlexPdcpStats *pdcp_aggr_stats); - -/*Register technology specific interface callbacks*/ -int flexran_agent_register_pdcp_xface(mid_t mod_id); - -/*Unregister technology specific callbacks*/ -int flexran_agent_unregister_pdcp_xface(mid_t mod_id); - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h b/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h deleted file mode 100644 index f2da72545a..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp_defs.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ -#ifndef __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__ -#define __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__ - -#include "flexran_agent_defs.h" -#include "flexran.pb-c.h" -#include "header.pb-c.h" - - /*PDCP aggregated Packet stats */ -/* -typedef struct pdcp_aggr_stats_s { - int32_t rnti; - - int32_t pkt_tx; - int32_t pkt_tx_bytes; - int32_t pkt_tx_sn; - int32_t pkt_tx_rate_s; - int32_t pkt_tx_throughput_s; - int32_t pkt_tx_aiat; - int32_t pkt_tx_aiat_s; - - int32_t pkt_rx; - int32_t pkt_rx_bytes; - int32_t pkt_rx_sn; - int32_t pkt_rx_rate_s; - int32_t pkt_rx_goodput_s; - int32_t pkt_rx_aiat; - int32_t pkt_rx_aiat_s; - int32_t pkt_rx_oo; - - -} pdcp_aggr_stats_t; -*/ - -/* FLEXRAN AGENT-PDCP Interface */ -typedef struct { - - - // PDCP statistics - void (*flexran_pdcp_stats_measurement)(mid_t mod_id, uint16_t rnti, uint16_t seq_num, uint32_t size); - -} AGENT_PDCP_xface; - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c deleted file mode 100644 index 2f87262938..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_phy.c - * \brief FlexRAN agent Control Module PHY - * \author Robert Schmidt - * \date Oct 2018 - */ - -#include "flexran_agent_phy.h" -#include "flexran_agent_ran_api.h" - -/* Array containing the Agent-PHY interfaces */ -AGENT_PHY_xface *agent_phy_xface[NUM_MAX_ENB]; - -void flexran_agent_fill_phy_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf) { - conf->phy_cell_id = flexran_get_cell_id(mod_id, cc_id); - conf->has_phy_cell_id = 1; - - conf->pusch_hopping_offset = flexran_get_hopping_offset(mod_id, cc_id); - conf->has_pusch_hopping_offset = 1; - - conf->hopping_mode = flexran_get_hopping_mode(mod_id, cc_id); - conf->has_hopping_mode = 1; - - conf->n_sb = flexran_get_n_SB(mod_id, cc_id); - conf->has_n_sb = 1; - - conf->phich_resource = flexran_get_phich_resource(mod_id, cc_id); - conf->has_phich_resource = 1; - - conf->phich_duration = flexran_get_phich_duration(mod_id, cc_id); - conf->has_phich_duration = 1; - - conf->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(mod_id, cc_id); - conf->has_init_nr_pdcch_ofdm_sym = 1; - - conf->dl_bandwidth = flexran_get_N_RB_DL(mod_id, cc_id); - conf->has_dl_bandwidth = 1; - - conf->ul_bandwidth = flexran_get_N_RB_UL(mod_id, cc_id); - conf->has_ul_bandwidth = 1; - - conf->ul_cyclic_prefix_length = flexran_get_ul_cyclic_prefix_length(mod_id, cc_id); - conf->has_ul_cyclic_prefix_length = 1; - - conf->dl_cyclic_prefix_length = flexran_get_dl_cyclic_prefix_length(mod_id, cc_id); - conf->has_dl_cyclic_prefix_length = 1; - - conf->antenna_ports_count = flexran_get_antenna_ports(mod_id, cc_id); - conf->has_antenna_ports_count = 1; - - conf->duplex_mode = flexran_get_duplex_mode(mod_id, cc_id); - conf->has_duplex_mode = 1; - - conf->subframe_assignment = flexran_get_subframe_assignment(mod_id, cc_id); - conf->has_subframe_assignment = 1; - - conf->special_subframe_patterns = flexran_get_special_subframe_assignment(mod_id, cc_id); - conf->has_special_subframe_patterns = 1; - - //TODO: Fill in with actual value, The MBSFN radio frame period - conf->n_mbsfn_subframe_config_rfperiod = 0; - uint32_t *elem_rfperiod = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_rfperiod); - if (elem_rfperiod) - for(int j = 0; j < conf->n_mbsfn_subframe_config_rfperiod; j++) - elem_rfperiod[j] = 1; - conf->mbsfn_subframe_config_rfperiod = elem_rfperiod; - - //TODO: Fill in with actual value, The MBSFN radio frame offset - conf->n_mbsfn_subframe_config_rfoffset = 0; - uint32_t *elem_rfoffset = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_rfoffset); - if (elem_rfoffset) - for(int j = 0; j < conf->n_mbsfn_subframe_config_rfoffset; j++) - elem_rfoffset[j] = 1; - conf->mbsfn_subframe_config_rfoffset = elem_rfoffset; - - //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes - conf->n_mbsfn_subframe_config_sfalloc = 0; - uint32_t *elem_sfalloc = malloc(sizeof(uint32_t) * conf->n_mbsfn_subframe_config_sfalloc); - if (elem_sfalloc) - for(int j = 0; j < conf->n_mbsfn_subframe_config_sfalloc; j++) - elem_sfalloc[j] = 1; - conf->mbsfn_subframe_config_sfalloc = elem_sfalloc; - - conf->prach_config_index = flexran_get_prach_ConfigIndex(mod_id, cc_id); - conf->has_prach_config_index = 1; - - conf->prach_freq_offset = flexran_get_prach_FreqOffset(mod_id, cc_id); - conf->has_prach_freq_offset = 1; - - conf->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(mod_id, cc_id); - conf->has_max_harq_msg3tx = 1; - - conf->n1pucch_an = flexran_get_n1pucch_an(mod_id, cc_id); - conf->has_n1pucch_an = 1; - - conf->deltapucch_shift = flexran_get_deltaPUCCH_Shift(mod_id, cc_id); - conf->has_deltapucch_shift = 1; - - conf->nrb_cqi = flexran_get_nRB_CQI(mod_id, cc_id); - conf->has_nrb_cqi = 1; - - conf->srs_subframe_config = flexran_get_srs_SubframeConfig(mod_id, cc_id); - conf->has_srs_subframe_config = 1; - - conf->srs_bw_config = flexran_get_srs_BandwidthConfig(mod_id, cc_id); - conf->has_srs_bw_config = 1; - - conf->srs_mac_up_pts = flexran_get_srs_MaxUpPts(mod_id, cc_id); - conf->has_srs_mac_up_pts = 1; - - conf->dl_freq = flexran_agent_get_operating_dl_freq (mod_id, cc_id); - conf->has_dl_freq = 1; - - conf->ul_freq = flexran_agent_get_operating_ul_freq (mod_id, cc_id); - conf->has_ul_freq = 1; - - conf->eutra_band = flexran_agent_get_operating_eutra_band (mod_id, cc_id); - conf->has_eutra_band = 1; - - conf->dl_pdsch_power = flexran_agent_get_operating_pdsch_refpower(mod_id, cc_id); - conf->has_dl_pdsch_power = 1; - - conf->enable_64qam = flexran_get_enable64QAM(mod_id, cc_id); - conf->has_enable_64qam = 1; -} - -int flexran_agent_register_phy_xface(mid_t mod_id) { - if (agent_phy_xface[mod_id]) { - LOG_E(PHY, "PHY agent for eNB %d is already registered\n", mod_id); - return -1; - } - - AGENT_PHY_xface *xface = malloc(sizeof(AGENT_PHY_xface)); - - if (!xface) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for PHY agent xface %d\n", mod_id); - return -1; - } - - agent_phy_xface[mod_id] = xface; - return 0; -} - -int flexran_agent_unregister_phy_xface(mid_t mod_id) -{ - if (!agent_phy_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "PHY agent for eNB %d is not registered\n", mod_id); - return -1; - } - free(agent_phy_xface[mod_id]); - agent_phy_xface[mod_id] = NULL; - return 0; -} - -AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id) -{ - return agent_phy_xface[mod_id]; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h deleted file mode 100644 index 25b3deac35..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_phy.h - * \brief FlexRAN agent Control Module PHY header - * \author Robert Schmidt - * \date Oct 2018 - */ - -#ifndef FLEXRAN_AGENT_PHY_H_ -#define FLEXRAN_AGENT_PHY_H_ - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" - - -#include "flexran_agent_common.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_phy_defs.h" -#include "flexran_agent_ran_api.h" -// for flexran_agent_get_phy_xface() -#include "flexran_agent_extern.h" - -/********************************** - * FlexRAN agent - technology PHY API - **********************************/ - -/* Fill the PHY part of an cell_config message */ -void flexran_agent_fill_phy_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf); - -/* Register technology specific interface callbacks */ -int flexran_agent_register_phy_xface(mid_t mod_id); - -/* Unregister technology specific callbacks */ -int flexran_agent_unregister_phy_xface(mid_t mod_id); - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h b/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h deleted file mode 100644 index 06c262ef7f..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/PHY/flexran_agent_phy_defs.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ -#ifndef __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ -#define __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ - -#include "flexran_agent_defs.h" -#include "flexran.pb-c.h" -#include "header.pb-c.h" - -/* FLEXRAN AGENT-PHY Interface */ -typedef struct { - - /* currently empty, will be used to control RU */ - -} AGENT_PHY_xface; - -#endif /* __FLEXRAN_AGENT_PHY_PRIMITIVES_H__ */ diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c deleted file mode 100644 index ec907a1956..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c +++ /dev/null @@ -1,924 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_rrc.c - * \brief FlexRAN agent Control Module RRC - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#include "flexran_agent_rrc.h" -#include "flexran_agent_ran_api.h" - -#include "liblfds700.h" - -#include "common/utils/LOG/log.h" - -/*Trigger boolean for RRC measurement*/ -bool triggered_rrc = false; - -/*Array containing the Agent-RRC interfaces*/ -AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; - - -void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { - int size; - Protocol__FlexranMessage *msg = NULL; - Protocol__FlexHeader *header = NULL; - Protocol__FlexUeStateChange *ue_state_change_msg = NULL; - Protocol__FlexUeConfig *config = NULL; - void *data; - int priority = 0; - err_code_t err_code=0; - - int xid = 0; - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) - goto error; - - ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange)); - if(ue_state_change_msg == NULL) { - goto error; - } - protocol__flex_ue_state_change__init(ue_state_change_msg); - ue_state_change_msg->has_type = 1; - ue_state_change_msg->type = state_change; - - config = malloc(sizeof(Protocol__FlexUeConfig)); - if (config == NULL) { - goto error; - } - protocol__flex_ue_config__init(config); - switch (state_change) { - case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED: - config->has_rnti = 1; - config->rnti = rnti; - break; - case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED: - case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED: - flexran_agent_fill_rrc_ue_config(mod_id, rnti, config); - /* we don't call into the MAC CM here; it will be called later through an - * ue_config_request */ - break; - case PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED: - default: - LOG_E(FLEXRAN_AGENT, "state change FLUESC_MOVED or unknown state occured for RNTI %x\n", - rnti); - } - - ue_state_change_msg->config = config; - msg = malloc(sizeof(Protocol__FlexranMessage)); - if (msg == NULL) { - goto error; - } - protocol__flexran_message__init(msg); - msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; - msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - msg->ue_state_change_msg = ue_state_change_msg; - - data = flexran_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - free(header); - return; - error: - if (err_code != 0) - LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d for RNTI %x\n", - err_code, rnti); - if (header){ - free(header); - } - if (ue_state_change_msg) { - free(ue_state_change_msg); - } - if (config) { - free(config); - } - if (msg) { - free(msg); - } -} - - -int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) - goto error; - free(msg->ue_state_change_msg->header); - if (msg->ue_state_change_msg->config->capabilities) - free(msg->ue_state_change_msg->config->capabilities); - if (msg->ue_state_change_msg->config->info) { - if (msg->ue_state_change_msg->config->info->cell_individual_offset) { - free(msg->ue_state_change_msg->config->info->cell_individual_offset); - } - if (msg->ue_state_change_msg->config->info->event) { - if (msg->ue_state_change_msg->config->info->event->a3) { - free(msg->ue_state_change_msg->config->info->event->a3); - } - free(msg->ue_state_change_msg->config->info->event); - } - free(msg->ue_state_change_msg->config->info); - } - free(msg->ue_state_change_msg->config); - free(msg->ue_state_change_msg); - free(msg); - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -/* this is called by RRC as a part of rrc xface . The controller previously requested this*/ -void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t* measResults) { - - // int priority = 0; // Warning Preventing - // void *data; - // int size; - // err_code_t err_code = -100; - triggered_rrc = true; - - /* TODO do we need this at the current state? meas_stats is never put into a - * protobuf message?! - int num = flexran_get_rrc_num_ues (mod_id); - rnti_t rntis[num]; - flexran_get_rrc_rnti_list(mod_id, rntis, num); - - meas_stats = malloc(sizeof(rrc_meas_stats) * num); - - for (int i = 0; i < num; i++){ - const rnti_t rnti = rntis[i]; - meas_stats[i].rnti = rnti; - meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id, rnti); - meas_stats[i].rsrp = flexran_get_rrc_pcell_rsrp(mod_id, rnti) - 140; - // measResults->measResultPCell.rsrpResult - 140; - meas_stats[i].rsrq = flexran_get_rrc_pcell_rsrq(mod_id, rnti)/2 - 20; - */ - // repl->neigh_meas = NULL; - - // if (meas->measResultNeighCells != NULL) { - // /* - // * Neighboring cells measurements performed by UE. - // */ - // NeighCellsMeasurements *neigh_meas; - // neigh_meas = malloc(sizeof(NeighCellsMeasurements)); - // if (neigh_meas == NULL) - // goto error; - // neigh_cells_measurements__init(neigh_meas); - - // /* EUTRAN RRC Measurements. */ - // if (meas->measResultNeighCells->present == - // MeasResults__measResultNeighCells_PR_measResultListEUTRA) { - - // MeasResultListEUTRA_t meas_list = meas->measResultNeighCells-> - // choice.measResultListEUTRA; - // /* Set the number of EUTRAN measurements present in report. */ - // neigh_meas->n_eutra_meas = meas_list.list.count; - // if (neigh_meas->n_eutra_meas > 0) { - // /* Initialize EUTRAN measurements. */ - // EUTRAMeasurements **eutra_meas; - // eutra_meas = malloc(sizeof(EUTRAMeasurements *) * - // neigh_meas->n_eutra_meas); - // for (i = 0; i < neigh_meas->n_eutra_meas; i++) { - // eutra_meas[i] = malloc(sizeof(EUTRAMeasurements)); - // eutra_measurements__init(eutra_meas[i]); - // /* Fill in the physical cell identifier. */ - // eutra_meas[i]->has_phys_cell_id = 1; - // eutra_meas[i]->phys_cell_id = meas_list.list.array[i]-> - // physCellId; - // // log_i(agent,"PCI of Target %d", eutra_meas[i]->phys_cell_id); - // /* Check for Reference signal measurements. */ - // if (&(meas_list.list.array[i]->measResult)) { - // /* Initialize Ref. signal measurements. */ - // EUTRARefSignalMeas *meas_result; - // meas_result = malloc(sizeof(EUTRARefSignalMeas)); - // eutra_ref_signal_meas__init(meas_result); - - // if (meas_list.list.array[i]->measResult.rsrpResult) { - // meas_result->has_rsrp = 1; - // meas_result->rsrp = RSRP_meas_mapping[*(meas_list. - // list.array[i]->measResult.rsrpResult)]; - // // log_i(agent,"RSRP of Target %d", meas_result->rsrp); - // } - - // if (meas_list.list.array[i]->measResult.rsrqResult) { - // meas_result->has_rsrq = 1; - // meas_result->rsrq = RSRQ_meas_mapping[*(meas_list. - // list.array[i]->measResult.rsrqResult)]; - // // log_i(agent,"RSRQ of Target %d", meas_result->rsrq); - // } - // eutra_meas[i]->meas_result = meas_result; - // } - // /* Check for CGI measurements. */ - // if (meas_list.list.array[i]->cgi_Info) { - // /* Initialize CGI measurements. */ - // EUTRACgiMeasurements *cgi_meas; - // cgi_meas = malloc(sizeof(EUTRACgiMeasurements)); - // eutra_cgi_measurements__init(cgi_meas); - - // /* EUTRA Cell Global Identity (CGI). */ - // CellGlobalIdEUTRA *cgi; - // cgi = malloc(sizeof(CellGlobalIdEUTRA)); - // cell_global_id__eutra__init(cgi); - - // cgi->has_cell_id = 1; - // CellIdentity_t cId = meas_list.list.array[i]-> - // cgi_Info->cellGlobalId.cellIdentity; - // cgi->cell_id = (cId.buf[0] << 20) + (cId.buf[1] << 12) + - // (cId.buf[2] << 4) + (cId.buf[3] >> 4); - - // /* Public land mobile network identifier of neighbor - // * cell. - // */ - // PlmnIdentity *plmn_id; - // plmn_id = malloc(sizeof(PlmnIdentity)); - // plmn_identity__init(plmn_id); - - // MNC_t mnc = meas_list.list.array[i]-> - // cgi_Info->cellGlobalId.plmn_Identity.mnc; - - // plmn_id->has_mnc = 1; - // plmn_id->mnc = 0; - // for (m = 0; m < mnc.list.count; m++) { - // plmn_id->mnc += *mnc.list.array[m] * - // ((uint32_t) pow(10, mnc.list.count - m - 1)); - // } - - // MCC_t *mcc = meas_list.list.array[i]-> - // cgi_Info->cellGlobalId.plmn_Identity.mcc; - - // plmn_id->has_mcc = 1; - // plmn_id->mcc = 0; - // for (m = 0; m < mcc->list.count; m++) { - // plmn_id->mcc += *mcc->list.array[m] * - // ((uint32_t) pow(10, mcc->list.count - m - 1)); - // } - - // TrackingAreaCode_t tac = meas_list.list.array[i]-> - // cgi_Info->trackingAreaCode; - - // cgi_meas->has_tracking_area_code = 1; - // cgi_meas->tracking_area_code = (tac.buf[0] << 8) + - // (tac.buf[1]); - - // PLMN_IdentityList2_t *plmn_l = meas_list.list.array[i]-> - // cgi_Info->plmn_IdentityList; - - // cgi_meas->n_plmn_id = plmn_l->list.count; - // /* Set the PLMN ID list in CGI measurements. */ - // PlmnIdentity **plmn_id_l; - // plmn_id_l = malloc(sizeof(PlmnIdentity *) * - // cgi_meas->n_plmn_id); - - // MNC_t mnc2; - // MCC_t *mcc2; - // for (m = 0; m < cgi_meas->n_plmn_id; m++) { - // plmn_id_l[m] = malloc(sizeof(PlmnIdentity)); - // plmn_identity__init(plmn_id_l[m]); - - // mnc2 = plmn_l->list.array[m]->mnc; - // plmn_id_l[m]->has_mnc = 1; - // plmn_id_l[m]->mnc = 0; - // for (k = 0; k < mnc2.list.count; k++) { - // plmn_id_l[m]->mnc += *mnc2.list.array[k] * - // ((uint32_t) pow(10, mnc2.list.count - k - 1)); - // } - - // mcc2 = plmn_l->list.array[m]->mcc; - // plmn_id_l[m]->has_mcc = 1; - // plmn_id_l[m]->mcc = 0; - // for (k = 0; k < mcc2->list.count; k++) { - // plmn_id_l[m]->mcc += *mcc2->list.array[k] * - // ((uint32_t) pow(10, mcc2->list.count - k - 1)); - // } - // } - // cgi_meas->plmn_id = plmn_id_l; - // eutra_meas[i]->cgi_meas = cgi_meas; - // } - // } - // neigh_meas->eutra_meas = eutra_meas; - // } - // } - // repl->neigh_meas = neigh_meas; - // } - /* Attach the RRC measurement reply message to RRC measurements message. */ - // mrrc_meas->repl = repl; - /* Attach RRC measurement message to triggered event message. */ - // te->mrrc_meas = mrrc_meas; - // te->has_action = 0; - /* Attach the triggered event message to main message. */ - // reply->te = te; - - /* Send the report to controller. */ - // if (flexran_agent_msg_send(b_id, reply) < 0) { - // goto error; - // } - - /* Free the measurement report received from UE. */ - // ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas); - /* Free the params. */ - // free(p); - - - // stats_reply_msg->cell_report = cell_report; - - // stats_reply_msg->ue_report = ue_report; - - // msg = malloc(sizeof(Protocol__FlexranMessage)); - // if(msg == NULL) - // goto error; - // protocol__flexran_message__init(msg); - // msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; - // msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - // msg->stats_reply_msg = stats_reply_msg; - - // data = flexran_agent_pack_message(msg, &size); - - - // if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { - - // err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - // goto error; - // } - - // LOG_I(FLEXRAN_AGENT,"RRC Trigger is done \n"); - - return; - - // error: - - // LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code); - /* Free the measurement report received from UE. */ - // ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas); - /* Free the params. */ - // free(p); - // return -1; -} - - -int flexran_agent_rrc_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags) { - if (n_ue > 0) { - for (int i = 0; i < n_ue; i++) { - const rnti_t rnti = ue_report[i]->rnti; - - /* Check flag for creation of buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) { - - /*Source cell EUTRA Measurements*/ - Protocol__FlexRrcMeasurements *rrc_measurements; - rrc_measurements = malloc(sizeof(Protocol__FlexRrcMeasurements)); - if (rrc_measurements == NULL) - goto error; - protocol__flex_rrc_measurements__init(rrc_measurements); - - rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id, rnti); - rrc_measurements->has_measid = 1; - - rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id, rnti); - rrc_measurements->has_pcell_rsrp = 1; - - rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id, rnti); - rrc_measurements->has_pcell_rsrq = 1 ; - - /* Neighbouring cells EUTRA Measurements*/ - Protocol__FlexNeighCellsMeasurements *neigh_meas; - neigh_meas = malloc(sizeof(Protocol__FlexNeighCellsMeasurements)); - if (neigh_meas == NULL) { - free(rrc_measurements); - rrc_measurements = NULL; - goto error; - } - protocol__flex_neigh_cells_measurements__init(neigh_meas); - - neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, rnti); - - Protocol__FlexEutraMeasurements **eutra_meas = NULL; - - if (neigh_meas->n_eutra_meas > 0) { - eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas); - if (eutra_meas == NULL) { - free(neigh_meas); - free(rrc_measurements); - rrc_measurements = NULL; - goto error; - } - - for (int j = 0; j < neigh_meas->n_eutra_meas; j++ ) { - eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements)); - if (eutra_meas[j] == NULL) { - for (int k = 0 ; k < j ; k++) - free(eutra_meas[k]); - free(eutra_meas); - free(neigh_meas); - free(rrc_measurements); - rrc_measurements = NULL; - goto error; - } - protocol__flex_eutra_measurements__init(eutra_meas[j]); - - /* Fill in the physical cell identifier. */ - eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, rnti, j); - eutra_meas[j]->has_phys_cell_id = 1; - - /* The following is not correctly implemented */ - //if (flexran_get_rrc_neigh_cgi(mod_id, rnti, j)) { - // /* Initialize CGI measurements. */ - // Protocol__FlexEutraCgiMeasurements *cgi_meas; - // cgi_meas = malloc(sizeof(Protocol__FlexEutraCgiMeasurements)); - - // if (cgi_meas) { - // protocol__flex_eutra_cgi_measurements__init(cgi_meas); - - // cgi_meas->tracking_area_code = flexran_get_rrc_neigh_cgi_tac(mod_id, rnti, j); - // cgi_meas->has_tracking_area_code = 1; - - // /* EUTRA Cell Global Identity (CGI) */ - // Protocol__FlexCellGlobalEutraId *cgi; - // cgi = malloc(sizeof(Protocol__FlexCellGlobalEutraId)); - - // if (cgi) { - // protocol__flex_cell_global_eutra_id__init(cgi); - - // cgi->cell_id = flexran_get_rrc_neigh_cgi_cell_id(mod_id, rnti, j); - // cgi->has_cell_id = 1; - - // /* PLMN for neighbouring cell */ - // Protocol__FlexPlmnIdentity *plmn_id; - // plmn_id = malloc(sizeof(Protocol__FlexPlmnIdentity)); - - // if (plmn_id) { - // protocol__flex_plmn_identity__init(plmn_id); - - // plmn_id->mcc = 0; - // plmn_id->n_mcc = flexran_get_rrc_neigh_cgi_num_mcc(mod_id, rnti, j); - - // for (int m = 0; m < plmn_id->n_mcc; m++) { - // plmn_id->mcc += flexran_get_rrc_neigh_cgi_mcc(mod_id, rnti, j, m); - // } - - // plmn_id->mnc = 0; - // plmn_id->n_mnc = flexran_get_rrc_neigh_cgi_num_mnc(mod_id, rnti, j); - - // for (int m = 0; m < plmn_id->n_mnc; m++) { - // plmn_id->mnc += flexran_get_rrc_neigh_cgi_mnc(mod_id, rnti, j, m); - // } - - // cgi->plmn_id = plmn_id; - // } - // cgi_meas->cgi = cgi; - // } - // eutra_meas[j]->cgi_meas = cgi_meas; - // } - //} - - /*RSRP/RSRQ of the neighbouring cell */ - Protocol__FlexEutraRefSignalMeas *meas_result; - meas_result = malloc(sizeof(Protocol__FlexEutraRefSignalMeas)); - - if (meas_result) { - protocol__flex_eutra_ref_signal_meas__init(meas_result); - - meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, rnti, j); - meas_result->has_rsrp = 1; - - meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, rnti, j); - meas_result->has_rsrq = 1; - - eutra_meas[j]->meas_result = meas_result; - } - } - - neigh_meas->eutra_meas = eutra_meas; - - rrc_measurements->neigh_meas = neigh_meas; - } else { - free(neigh_meas); - } - - ue_report[i]->rrc_measurements = rrc_measurements; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS; - } - } - } - return 0; - error: - for (int i = 0; i < n_ue; i++) { - if (ue_report[i]->rrc_measurements && ue_report[i]->rrc_measurements->neigh_meas != NULL) { - for (int j = 0; j < ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++) { - free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); - } - free(ue_report[i]->rrc_measurements->neigh_meas); - } - } - - if (ue_report != NULL) - free(ue_report); - return -1; -} - -int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply) -{ - for (int i = 0; i < reply->n_ue_report; i++){ - if (reply->ue_report[i]->rrc_measurements && reply->ue_report[i]->rrc_measurements->neigh_meas) { - for (int j = 0; j < reply->ue_report[i]->rrc_measurements->neigh_meas->n_eutra_meas; j++) { - //if (reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas) { - // if (reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas->cgi) { - // if (reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas->plmn_id) { - // free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas->cgi->plmn_id); - // } - // free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas->cgi); - // } - // free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->cgi_meas); - //} - if (reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->meas_result) { - free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]->meas_result); - } - free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]); - } - free(reply->ue_report[i]->rrc_measurements->neigh_meas->eutra_meas); - free(reply->ue_report[i]->rrc_measurements->neigh_meas); - free(reply->ue_report[i]->rrc_measurements); - } - } - return 0; -} - -int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags) { - /* This function fills the GTP part of the statistics. The necessary - * information is, for our purposes, completely maintained in the RRC layer. - * It would be possible to add a GTP module that handles this, though. */ - if (n_ue > 0) { - for (int i = 0; i < n_ue; i++) { - const rnti_t rnti = ue_report[i]->rnti; - - /* Check flag for creation of buffer status report */ - if (ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS) { - - /* get number of rabs for this UE */ - const int num_e_rab = flexran_agent_rrc_gtp_num_e_rab(mod_id, rnti); - Protocol__FlexGtpStats **gtp_stats = NULL; - if (num_e_rab > 0) { - gtp_stats = calloc(num_e_rab, sizeof(Protocol__FlexGtpStats *)); - if (!gtp_stats) goto error; - for (int r = 0; r < num_e_rab; ++r) { - gtp_stats[r] = malloc(sizeof(Protocol__FlexGtpStats)); - if (!gtp_stats[r]) goto error; - protocol__flex_gtp_stats__init(gtp_stats[r]); - gtp_stats[r]->e_rab_id = flexran_agent_rrc_gtp_get_e_rab_id(mod_id, rnti, r); - gtp_stats[r]->has_e_rab_id = 1; - gtp_stats[r]->teid_enb = flexran_agent_rrc_gtp_get_teid_enb(mod_id, rnti, r); - gtp_stats[r]->has_teid_enb = 1; - gtp_stats[r]->addr_enb = NULL; - gtp_stats[r]->teid_sgw = flexran_agent_rrc_gtp_get_teid_sgw(mod_id, rnti, r); - gtp_stats[r]->has_teid_sgw = 1; - gtp_stats[r]->addr_sgw = NULL; - } - } - ue_report[i]->n_gtp_stats = num_e_rab; - ue_report[i]->gtp_stats = gtp_stats; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_GTP_STATS; - } - } - } - return 0; -error: - for (int i = 0; i < n_ue; i++) { - if (!ue_report[i]->gtp_stats) continue; - for (int r = 0; r < ue_report[i]->n_gtp_stats; ++r) { - if (ue_report[i]->gtp_stats[r]) { - free(ue_report[i]->gtp_stats[r]); - ue_report[i]->gtp_stats[r] = NULL; - } - } - free(ue_report[i]->gtp_stats); - ue_report[i]->gtp_stats = NULL; - } - return -1; -} - -int flexran_agent_rrc_gtp_destroy_stats_reply(Protocol__FlexStatsReply *reply) { - for (int i = 0; i < reply->n_ue_report; ++i) { - if (!reply->ue_report[i]->n_gtp_stats == 0) continue; - - for (int r = 0; r < reply->ue_report[i]->n_gtp_stats; ++r) { - //if (reply->ue_report[i]->gtp_stats[r]->addr_enb) - // free(reply->ue_report[i]->gtp_stats[r]->addr_enb); - //if (reply->ue_report[i]->gtp_stats[r]->addr_sgw) - // free(reply->ue_report[i]->gtp_stats[r]->addr_sgw); - free(reply->ue_report[i]->gtp_stats[r]); - } - } - return 0; -} - -void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, - Protocol__FlexUeConfig *ue_conf) -{ - if (ue_conf->has_rnti && ue_conf->rnti != rnti) { - LOG_E(FLEXRAN_AGENT, "ue_config existing RNTI %x does not match RRC RNTI %x\n", - ue_conf->rnti, rnti); - return; - } - ue_conf->has_rnti = 1; - ue_conf->rnti = rnti; - ue_conf->imsi = flexran_get_ue_imsi(mod_id, rnti); - ue_conf->has_imsi = 1; - - //TODO: Set the DRX configuration (optional) - //Not supported for now, so we do not set it - - ue_conf->time_alignment_timer = flexran_get_time_alignment_timer(mod_id, rnti); - ue_conf->has_time_alignment_timer = 1; - - ue_conf->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id, rnti); - ue_conf->has_meas_gap_config_pattern = 1; - - if(ue_conf->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - ue_conf->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id, rnti); - ue_conf->has_meas_gap_config_sf_offset = 1; - } - - //TODO: Set the SPS configuration (Optional) - //Not supported for now, so we do not set it - - //TODO: Set the SR configuration (Optional) - //We do not set it for now - - //TODO: Set the CQI configuration (Optional) - //We do not set it for now - - ue_conf->transmission_mode = flexran_get_ue_transmission_mode(mod_id, rnti); - ue_conf->has_transmission_mode = 1; - - Protocol__FlexUeCapabilities *c_capabilities; - c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); - if (c_capabilities) { - protocol__flex_ue_capabilities__init(c_capabilities); - - c_capabilities->has_half_duplex = 1; - c_capabilities->half_duplex = flexran_get_half_duplex(mod_id, rnti); - - c_capabilities->has_intra_sf_hopping = 1; - c_capabilities->intra_sf_hopping = flexran_get_intra_sf_hopping(mod_id, rnti); - - c_capabilities->has_type2_sb_1 = 1; - c_capabilities->type2_sb_1 = flexran_get_type2_sb_1(mod_id, rnti); - - c_capabilities->has_ue_category = 1; - c_capabilities->ue_category = flexran_get_ue_category(mod_id, rnti); - - c_capabilities->has_res_alloc_type1 = 1; - c_capabilities->res_alloc_type1 = flexran_get_res_alloc_type1(mod_id, rnti); - - ue_conf->capabilities = c_capabilities; - } - - ue_conf->has_ue_transmission_antenna = 1; - ue_conf->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id, rnti); - - ue_conf->has_tti_bundling = 1; - ue_conf->tti_bundling = flexran_get_tti_bundling(mod_id, rnti); - - ue_conf->has_max_harq_tx = 1; - ue_conf->max_harq_tx = flexran_get_maxHARQ_TX(mod_id, rnti); - - ue_conf->has_beta_offset_ack_index = 1; - ue_conf->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id, rnti); - - ue_conf->has_beta_offset_ri_index = 1; - ue_conf->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id, rnti); - - ue_conf->has_beta_offset_cqi_index = 1; - ue_conf->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id, rnti); - - /* assume primary carrier */ - ue_conf->has_ack_nack_simultaneous_trans = 1; - ue_conf->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,0); - - ue_conf->has_simultaneous_ack_nack_cqi = 1; - ue_conf->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id, rnti); - - ue_conf->has_aperiodic_cqi_rep_mode = 1; - ue_conf->aperiodic_cqi_rep_mode = flexran_get_aperiodic_cqi_rep_mode(mod_id, rnti); - - ue_conf->has_tdd_ack_nack_feedback = 1; - ue_conf->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id, rnti); - - ue_conf->has_ack_nack_repetition_factor = 1; - ue_conf->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id, rnti); - - ue_conf->has_extended_bsr_size = 1; - ue_conf->extended_bsr_size = flexran_get_extended_bsr_size(mod_id, rnti); - - Protocol__FlexMeasurementInfo *meas_info; - meas_info = malloc(sizeof(Protocol__FlexMeasurementInfo)); - - if (meas_info) { - protocol__flex_measurement_info__init(meas_info); - - meas_info->has_offset_freq_serving = 1; - meas_info->offset_freq_serving = flexran_get_rrc_ofp(mod_id, rnti); - - meas_info->has_offset_freq_neighbouring = 1; - meas_info->offset_freq_neighbouring = flexran_get_rrc_ofn(mod_id, rnti); - - int num_adj_cells = flexran_get_rrc_num_adj_cells(mod_id); - meas_info->n_cell_individual_offset = num_adj_cells + 1; - - int64_t *cell_individual_offset; - if (num_adj_cells > 0) { - cell_individual_offset = malloc(sizeof(int64_t)*(num_adj_cells+1)); - if (cell_individual_offset) { - cell_individual_offset[0] = flexran_get_rrc_ocp(mod_id, rnti); - for (int i=0; i < num_adj_cells; i++) { - cell_individual_offset[i+1] = flexran_get_rrc_ocn(mod_id, rnti,i); - } - meas_info->cell_individual_offset = cell_individual_offset; - } - } - else { - cell_individual_offset = malloc(sizeof(int64_t)); - if (cell_individual_offset) { - *cell_individual_offset = flexran_get_rrc_ocp(mod_id, rnti); - meas_info->cell_individual_offset = cell_individual_offset; - } - } - - meas_info->has_filter_coefficient_rsrp = 1; - meas_info->filter_coefficient_rsrp = flexran_get_filter_coeff_rsrp(mod_id, rnti); - - meas_info->has_filter_coefficient_rsrq = 1; - meas_info->filter_coefficient_rsrq = flexran_get_filter_coeff_rsrq(mod_id, rnti); - - Protocol__FlexMeasurementEvent *event; - event = malloc(sizeof(Protocol__FlexMeasurementEvent)); - - if (event) { - protocol__flex_measurement_event__init(event); - Protocol__FlexA3Event *a3_event; - a3_event = malloc(sizeof(Protocol__FlexA3Event)); - if (a3_event) { - protocol__flex_a3_event__init(a3_event); - a3_event->has_a3_offset = 1; - a3_event->a3_offset = flexran_get_rrc_a3_event_a3_offset(mod_id, rnti); - - a3_event->has_report_on_leave = 1; - a3_event->report_on_leave = flexran_get_rrc_a3_event_reportOnLeave(mod_id, rnti); - - a3_event->has_hysteresis = 1; - a3_event->hysteresis = flexran_get_rrc_a3_event_hysteresis(mod_id, rnti); - - a3_event->has_time_to_trigger = 1; - a3_event->time_to_trigger = flexran_get_rrc_a3_event_timeToTrigger(mod_id, rnti); - - a3_event->has_max_report_cells = 1; - a3_event->max_report_cells = flexran_get_rrc_a3_event_maxReportCells(mod_id, rnti); - event->a3 = a3_event; - } - meas_info->event = event; - } - ue_conf->info = meas_info; - } -} - -int flexran_agent_register_rrc_xface(mid_t mod_id) -{ - if (agent_rrc_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "RRC agent for eNB %d is already registered\n", mod_id); - return -1; - } - AGENT_RRC_xface *xface = malloc(sizeof(AGENT_RRC_xface)); - if (!xface) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for RRC agent xface %d\n", mod_id); - return -1; - } - -// xface->flexran_agent_send_update_rrc_stats = flexran_agent_send_update_rrc_stats; - - xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change; - xface->flexran_trigger_rrc_measurements = flexran_trigger_rrc_measurements; - - agent_rrc_xface[mod_id] = xface; - - return 0; -} - -void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf) { - - if (!conf->si_config) { - conf->si_config = malloc(sizeof(Protocol__FlexSiConfig)); - if (conf->si_config) - protocol__flex_si_config__init(conf->si_config); - } - - if (conf->si_config) { - // TODO THIS IS DU RRC - conf->si_config->sib1_length = flexran_get_sib1_length(mod_id, cc_id); - conf->si_config->has_sib1_length = 1; - - conf->si_config->si_window_length = (uint32_t) flexran_get_si_window_length(mod_id, cc_id); - conf->si_config->has_si_window_length = 1; - - conf->si_config->n_si_message = 0; - - /* Protocol__FlexSiMessage **si_message; */ - /* si_message = malloc(sizeof(Protocol__FlexSiMessage *) * si_config->n_si_message); */ - /* if(si_message == NULL) */ - /* goto error; */ - /* for(j = 0; j < si_config->n_si_message; j++){ */ - /* si_message[j] = malloc(sizeof(Protocol__FlexSiMessage)); */ - /* if(si_message[j] == NULL) */ - /* goto error; */ - /* protocol__flex_si_message__init(si_message[j]); */ - /* //TODO: Fill in with actual value, Periodicity of SI msg in radio frames */ - /* si_message[j]->periodicity = 1; //SIPeriod */ - /* si_message[j]->has_periodicity = 1; */ - /* //TODO: Fill in with actual value, rhe length of the SI message in bytes */ - /* si_message[j]->length = 10; */ - /* si_message[j]->has_length = 1; */ - /* } */ - /* if(si_config->n_si_message > 0){ */ - /* si_config->si_message = si_message; */ - /* } */ - } - - conf->ra_response_window_size = flexran_get_ra_ResponseWindowSize(mod_id, cc_id); - conf->has_ra_response_window_size = 1; - - // belongs to MAC but is read in RRC - conf->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(mod_id, cc_id); - conf->has_mac_contention_resolution_timer = 1; - - conf->ul_pusch_power = flexran_agent_get_operating_pusch_p0 (mod_id, cc_id); - conf->has_ul_pusch_power = 1; - - conf->n_plmn_id = flexran_get_rrc_num_plmn_ids(mod_id); - conf->plmn_id = calloc(conf->n_plmn_id, sizeof(Protocol__FlexPlmn *)); - if (conf->plmn_id) { - for (int i = 0; i < conf->n_plmn_id; i++) { - conf->plmn_id[i] = malloc(sizeof(Protocol__FlexPlmn)); - if (!conf->plmn_id[i]) continue; - protocol__flex_plmn__init(conf->plmn_id[i]); - conf->plmn_id[i]->mcc = flexran_get_rrc_mcc(mod_id, i); - conf->plmn_id[i]->has_mcc = 1; - conf->plmn_id[i]->mnc = flexran_get_rrc_mnc(mod_id, i); - conf->plmn_id[i]->has_mnc = 1; - conf->plmn_id[i]->mnc_length = flexran_get_rrc_mnc_digit_length(mod_id, i); - conf->plmn_id[i]->has_mnc_length = 1; - } - } else { - conf->n_plmn_id = 0; - } - - conf->x2_ho_net_control = flexran_get_x2_ho_net_control(mod_id); - conf->has_x2_ho_net_control = 1; -} - -int flexran_agent_unregister_rrc_xface(mid_t mod_id) -{ - if (!agent_rrc_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "RRC agent for eNB %d is not registered\n", mod_id); - return -1; - } - //xface->agent_ctxt = NULL; -// xface->flexran_agent_send_update_rrc_stats = NULL; - - agent_rrc_xface[mod_id]->flexran_agent_notify_ue_state_change = NULL; - agent_rrc_xface[mod_id]->flexran_trigger_rrc_measurements = NULL; - free(agent_rrc_xface[mod_id]); - agent_rrc_xface[mod_id] = NULL; - - return 0; -} - - diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h deleted file mode 100644 index 1aa110a3e9..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_rrc.h - * \brief FlexRAN agent Control Module RRC header - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_RRC_H_ -#define FLEXRAN_AGENT_RRC_H_ - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" - - -#include "flexran_agent_common.h" -#include "flexran_agent_rrc_defs.h" -// for flexran_agent_get_rrc_xface() -#include "flexran_agent_extern.h" - - -/* UE state change message constructor and destructor */ -void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); -int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); - - -/********************************** - * FlexRAN agent - technology RRC API - **********************************/ - -/* Send to the controller all the rrc stat updates that occured during this subframe*/ -// void flexran_agent_send_update_rrc_stats(mid_t mod_id); - -/* this is called by RRC as a part of rrc xface . The controller previously requested this*/ -void flexran_trigger_rrc_measurements (mid_t mod_id, LTE_MeasResults_t *); - -/* Statistics reply protocol message constructor and destructor */ -int flexran_agent_rrc_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags); -int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexStatsReply *reply); - -/* Statistic reply for GTP statistics which OAI stores also in the RRC layer. - * This might be moved to a separate GTP module in the future */ -int flexran_agent_rrc_gtp_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags); -int flexran_agent_rrc_gtp_destroy_stats_reply(Protocol__FlexStatsReply *reply); - -/* Fill the RRC part of a ue_config message */ -void flexran_agent_fill_rrc_ue_config(mid_t mod_id, rnti_t rnti, - Protocol__FlexUeConfig *ue_conf); - -/* Fill the RRC part of an cell_config message */ -void flexran_agent_fill_rrc_cell_config(mid_t mod_id, uint8_t cc_id, - Protocol__FlexCellConfig *conf); - -/*Register technology specific interface callbacks*/ -int flexran_agent_register_rrc_xface(mid_t mod_id); - -/*Unregister technology specific callbacks*/ -int flexran_agent_unregister_rrc_xface(mid_t mod_id); - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h deleted file mode 100644 index a9236af80b..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - - -/*! \file flexran_agent_rrc_defs.h - * \brief FlexRAN agent - RRC interface primitives - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - * \mail - */ - -#ifndef __FLEXRAN_AGENT_RRC_PRIMITIVES_H__ -#define __FLEXRAN_AGENT_RRC_PRIMITIVES_H__ - -#include "flexran_agent_defs.h" -#include "flexran.pb-c.h" -#include "header.pb-c.h" -#include "LTE_MeasResults.h" - -#define RINGBUFFER_SIZE 100 - - -typedef struct -{ - int32_t rnti; - int32_t meas_id; - int32_t rsrp; - int32_t rsrq; - - /*To Be Extended*/ -}rrc_meas_stats; - - - -/* FLEXRAN AGENT-RRC Interface */ -typedef struct { - - - /// Notify the controller for a state change of a particular UE, by sending the proper - /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) - void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, - uint8_t state_change); - - void (*flexran_trigger_rrc_measurements)(mid_t mod_id, LTE_MeasResults_t* measResults); - -} AGENT_RRC_xface; - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.c b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.c deleted file mode 100644 index e8bbd13af4..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "flexran_agent_rrc_internal.h" -#include "flexran_agent_ran_api.h" - -int update_rrc_reconfig(mid_t mod_id, rnti_t rnti, Protocol__FlexRrcTriggering *trigg) { - - // Measurement info reconfiguration - - if (trigg->meas_info) { - - /* Set serving cell frequency offset */ - if (trigg->meas_info->has_offset_freq_serving) { - if (flexran_set_rrc_ofp(mod_id, rnti, trigg->meas_info->offset_freq_serving) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Serving cell frequency offset\n"); - return -1; - } - } - - /* Set neighbouring cell frequency offset */ - if (trigg->meas_info->has_offset_freq_neighbouring) { - if (flexran_set_rrc_ofn(mod_id, rnti, trigg->meas_info->offset_freq_neighbouring) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Neighbouring cell frequency offset\n"); - return -1; - } - } - - if (trigg->meas_info->n_cell_individual_offset > 0) { - /* Set the serving cell offset */ - if (flexran_set_rrc_ocp(mod_id, rnti, trigg->meas_info->cell_individual_offset[0]) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Serving cell offset\n"); - return -1; - } - - /* Set the neighbouring cell offset */ - for (int i=0; i<(trigg->meas_info->n_cell_individual_offset-1); i++) { - if (flexran_set_rrc_ocn(mod_id, rnti, i, trigg->meas_info->cell_individual_offset[i+1]) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Neighbouring cell offset\n"); - return -1; - } - } - } - - if (trigg->meas_info->has_offset_freq_neighbouring) { - if (flexran_set_rrc_ofn(mod_id, rnti, trigg->meas_info->offset_freq_neighbouring) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Neighbouring cell frequency offset\n"); - return -1; - } - } - - - /* Set rsrp filter coefficient */ - if (trigg->meas_info->has_filter_coefficient_rsrp) { - if (flexran_set_filter_coeff_rsrp(mod_id, rnti, trigg->meas_info->filter_coefficient_rsrp) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set RSRP filter coefficient\n"); - return -1; - } - } - - /* Set rsrq filter coefficient */ - if (trigg->meas_info->has_filter_coefficient_rsrq) { - if (flexran_set_filter_coeff_rsrq(mod_id, rnti, trigg->meas_info->filter_coefficient_rsrq) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set RSRQ filter coefficient\n"); - return -1; - } - } - - if (trigg->meas_info->event) { - - /* Set Periodic event parameters */ - if (trigg->meas_info->event->periodical) { - - /* Set Periodic event maximum number of reported cells */ - if (trigg->meas_info->event->periodical->has_max_report_cells) { - if (flexran_set_rrc_per_event_maxReportCells(mod_id, rnti, trigg->meas_info->event->periodical->max_report_cells) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set Periodic event max\n"); - return -1; - } - } - } - - /* Set A3 event parameters */ - if (trigg->meas_info->event->a3) { - - /* Set A3 event a3 offset */ - if (trigg->meas_info->event->a3->has_a3_offset) { - if (flexran_set_rrc_a3_event_a3_offset(mod_id, rnti, trigg->meas_info->event->a3->a3_offset) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set A3 event offset\n"); - return -1; - } - } - - /* Set A3 event report on leave */ - if (trigg->meas_info->event->a3->has_report_on_leave) { - if (flexran_set_rrc_a3_event_reportOnLeave(mod_id, rnti, trigg->meas_info->event->a3->report_on_leave) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set A3 event report on leave\n"); - return -1; - } - } - - /* Set A3 event hysteresis */ - if (trigg->meas_info->event->a3->has_hysteresis) { - if (flexran_set_rrc_a3_event_hysteresis(mod_id, rnti, trigg->meas_info->event->a3->hysteresis) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set A3 event hysteresis\n"); - return -1; - } - } - - /* Set A3 event time to trigger */ - if (trigg->meas_info->event->a3->has_time_to_trigger) { - if (flexran_set_rrc_a3_event_timeToTrigger(mod_id, rnti, trigg->meas_info->event->a3->time_to_trigger) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set A3 event time to trigger\n"); - return -1; - } - } - - /* Set A3 event maximum number of reported cells */ - if (trigg->meas_info->event->a3->has_max_report_cells) { - if (flexran_set_rrc_a3_event_maxReportCells(mod_id, rnti, trigg->meas_info->event->a3->max_report_cells) < 0) { - LOG_E(FLEXRAN_AGENT, "Cannot set A3 event max report cells\n"); - return -1; - } - } - } - } - } - return 0; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.h deleted file mode 100644 index 3987cb8f3f..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_internal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef FLEXRAN_AGENT_RRC_INTERNAL_H_ -#define FLEXRAN_AGENT_RRC_INTERNAL_H_ - -#include "flexran_agent_rrc_internal.h" -#include "flexran_agent_ran_api.h" - -int update_rrc_reconfig(mid_t mod_id, rnti_t rnti, Protocol__FlexRrcTriggering *trigg); - -#endif /*FLEXRAN_AGENT_RRC_INTERNAL_H_*/ - diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c deleted file mode 100644 index c2d7cb9e55..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_s1ap.c - * \brief FlexRAN agent Control Module S1AP - * \author Navid Nikaein - * \date 2019 - * \version 0.1 - */ - -#include "flexran_agent_s1ap.h" - - -/*Array containing the Agent-S1AP interfaces*/ -AGENT_S1AP_xface *agent_s1ap_xface[NUM_MAX_ENB]; - -void flexran_agent_fill_s1ap_cell_config(mid_t mod_id, - Protocol__FlexS1apConfig **s1ap_config) { - *s1ap_config = malloc(sizeof(Protocol__FlexS1apConfig)); - if (!*s1ap_config) return; - protocol__flex_s1ap_config__init(*s1ap_config); - LOG_D(FLEXRAN_AGENT, "flexran_agent_fill_s1ap_cell_config %d\n", mod_id); - - // S1AP status - (*s1ap_config)->has_pending = 1; - (*s1ap_config)->pending = flexran_get_s1ap_mme_pending(mod_id); - - (*s1ap_config)->has_connected = 1; - (*s1ap_config)->connected = flexran_get_s1ap_mme_connected(mod_id); - - (*s1ap_config)->enb_s1_ip = flexran_get_s1ap_enb_s1_ip(mod_id); - if (!(*s1ap_config)->enb_s1_ip) - (*s1ap_config)->enb_s1_ip = ""; - - (*s1ap_config)->enb_name = flexran_get_s1ap_enb_name(mod_id); - - (*s1ap_config)->mme = NULL; - (*s1ap_config)->n_mme = flexran_get_s1ap_nb_mme(mod_id); - if ((*s1ap_config)->n_mme > 0) { - Protocol__FlexS1apMme **mme_conf = calloc((*s1ap_config)->n_mme, - sizeof(Protocol__FlexS1apMme *)); - AssertFatal(mme_conf, "%s(): MME malloc failed\n", __func__); - for(int i = 0; i < (*s1ap_config)->n_mme; i++){ - mme_conf[i] = malloc(sizeof(Protocol__FlexS1apMme)); - AssertFatal(mme_conf[i], "%s(): MME malloc failed\n", __func__); - protocol__flex_s1ap_mme__init(mme_conf[i]); - if (flexran_get_s1ap_mme_conf(mod_id, i, mme_conf[i]) < 0) { - LOG_E(FLEXRAN_AGENT, - "error in flexran_get_s1ap_mme_conf(): cannot retrieve MME state\n"); - (*s1ap_config)->n_mme = 0; - break; - } - } - (*s1ap_config)->mme = mme_conf; - } -} - -int flexran_agent_s1ap_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags) { - if (n_ue <= 0) - return 0; - if (!(ue_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_S1AP_STATS)) - return 0; - - for (int i = 0; i < n_ue; i++) { - const rnti_t rnti = ue_report[i]->rnti; - Protocol__FlexS1apUe *ue = malloc(sizeof(Protocol__FlexS1apUe)); - AssertFatal(ue, "%s(): MME malloc failed\n", __func__); - protocol__flex_s1ap_ue__init(ue); - if (flexran_get_s1ap_ue(mod_id, rnti, ue) < 0) { - LOG_E(FLEXRAN_AGENT, "error in %s(): cannot retrieve UE conf\n", __func__); - break; - } - ue_report[i]->s1ap_stats = ue; - ue_report[i]->flags |= PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_S1AP_STATS; - } - return 0; -} - -void flexran_agent_free_s1ap_cell_config(Protocol__FlexS1apConfig **s1ap) { - for (int i = 0; i < (*s1ap)->n_mme; i++) { - /* following structures allocated in the RAN API */ - for(int j = 0; j < (*s1ap)->mme[i]->n_served_gummeis; j++) { - free((*s1ap)->mme[i]->served_gummeis[j]->plmn); - free((*s1ap)->mme[i]->served_gummeis[j]); - } - free((*s1ap)->mme[i]->served_gummeis); - for (int j = 0; j < (*s1ap)->mme[i]->n_requested_plmns; j++) - free((*s1ap)->mme[i]->requested_plmns[j]); - free((*s1ap)->mme[i]->requested_plmns); - free((*s1ap)->mme[i]); - } - free((*s1ap)->mme); - free(*s1ap); - *s1ap = NULL; -} - -void flexran_agent_s1ap_destroy_stats_reply(Protocol__FlexStatsReply *reply) { - for (int i = 0; i < reply->n_ue_report; ++i) { - if (!reply->ue_report[i]->s1ap_stats) - continue; - free(reply->ue_report[i]->s1ap_stats->selected_plmn); - free(reply->ue_report[i]->s1ap_stats); - reply->ue_report[i]->s1ap_stats = NULL; - } -} - -void flexran_agent_handle_mme_update(mid_t mod_id, - size_t n_mme, - Protocol__FlexS1apMme **mme) { - if (n_mme == 0 || n_mme > 1) { - LOG_E(FLEXRAN_AGENT, "cannot handle %lu MMEs yet\n", n_mme); - return; - } - - if (!mme[0]->s1_ip) { - LOG_E(FLEXRAN_AGENT, "no S1 IP present, cannot handle request\n"); - return; - } - - if (mme[0]->has_state - && mme[0]->state == PROTOCOL__FLEX_MME_STATE__FLMMES_DISCONNECTED) { - int rc = flexran_remove_s1ap_mme(mod_id, 1, &mme[0]->s1_ip); - if (rc == 0) - LOG_I(FLEXRAN_AGENT, "remove MME at IP %s\n", mme[0]->s1_ip); - else - LOG_W(FLEXRAN_AGENT, - "could not remove MME: flexran_remove_s1ap_mme() returned %d\n", - rc); - } else { - int rc = flexran_add_s1ap_mme(mod_id, 1, &mme[0]->s1_ip); - if (rc == 0) - LOG_I(FLEXRAN_AGENT, "add MME at IP %s\n", mme[0]->s1_ip); - else - LOG_W(FLEXRAN_AGENT, - "could not add MME: flexran_add_s1ap_mme() returned %d\n", - rc); - } -} - -void flexran_agent_handle_plmn_update(mid_t mod_id, - int CC_id, - size_t n_plmn, - Protocol__FlexPlmn **plmn_id) { - if (n_plmn < 1 || n_plmn > 6) { - LOG_E(FLEXRAN_AGENT, "cannot handle %lu PLMNs\n", n_plmn); - return; - } - - /* We assume the controller has checked all the parameters within each - * plmn_id */ - int rc = flexran_set_new_plmn_id(mod_id, CC_id, n_plmn, plmn_id); - if (rc == 0) { - LOG_I(FLEXRAN_AGENT, "set %lu new PLMNs:\n", n_plmn); - for (int i = 0; i < (int)n_plmn; ++i) - LOG_I(FLEXRAN_AGENT, " MCC %d MNC %d MNC length %d\n", - plmn_id[i]->mcc, plmn_id[i]->mnc, plmn_id[0]->mnc_length); - } else { - LOG_W(FLEXRAN_AGENT, - "could not set new PLMN configuration: flexran_set_new_plmn_id() returned %d\n", - rc); - } -} - -int flexran_agent_register_s1ap_xface(mid_t mod_id) { - if (agent_s1ap_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "S1AP agent CM for eNB %d is already registered\n", mod_id); - return -1; - } - - AGENT_S1AP_xface *xface = malloc(sizeof(AGENT_S1AP_xface)); - if (!xface) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for S1AP agent xface %d\n", mod_id); - return -1; - } - - // not implemented yet - xface->flexran_s1ap_notify_release_request=NULL; - - agent_s1ap_xface[mod_id] = xface; - - return 0; -} - -int flexran_agent_unregister_s1ap_xface(mid_t mod_id) { - if (!agent_s1ap_xface[mod_id]) { - LOG_E(FLEXRAN_AGENT, "S1AP agent for eNB %d is not registered\n", mod_id); - return -1; - } - agent_s1ap_xface[mod_id]->flexran_s1ap_notify_release_request=NULL; - free(agent_s1ap_xface[mod_id]); - agent_s1ap_xface[mod_id] = NULL; - return 0; -} - -AGENT_S1AP_xface *flexran_agent_get_s1ap_xface(mid_t mod_id) { - return agent_s1ap_xface[mod_id]; -} diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h deleted file mode 100644 index 006eaa1d3c..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_s1ap.h - * \brief FlexRAN agent S1AP Control Module - * \author navid nikaein - * \date 2017 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_S1AP_H_ -#define FLEXRAN_AGENT_S1AP_H_ - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" - - -#include "flexran_agent_common.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_s1ap_defs.h" -#include "flexran_agent_ran_api.h" - -/*************************************** - * FlexRAN agent - technology S1AP API * - ***************************************/ - -/* Send to the controller all the S1AP configs */ -void flexran_agent_fill_s1ap_cell_config(mid_t mod_id, - Protocol__FlexS1apConfig **s1ap_config); - -/* Free allocated S1AP cell configs */ -void flexran_agent_free_s1ap_cell_config(Protocol__FlexS1apConfig **s1ap); - -/* Fill the stats message for S1AP */ -int flexran_agent_s1ap_stats_reply(mid_t mod_id, - Protocol__FlexUeStatsReport **ue_report, - int n_ue, - uint32_t ue_flags); - -/* Free allocated S1AP stats message */ -void flexran_agent_s1ap_destroy_stats_reply(Protocol__FlexStatsReply *reply); - -/* Add or remove MME updates */ -void flexran_agent_handle_mme_update(mid_t mod_id, - size_t n_mme, - Protocol__FlexS1apMme **mme); - -/* Set a new PLMN configuration */ -void flexran_agent_handle_plmn_update(mid_t mod_id, - int CC_id, - size_t n_plmn, - Protocol__FlexPlmn **plmn_id); - -/* Register technology specific interface callbacks */ -int flexran_agent_register_s1ap_xface(mid_t mod_id); - -/* Unregister technology specific callbacks */ -int flexran_agent_unregister_s1ap_xface(mid_t mod_id); - -#endif diff --git a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h b/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h deleted file mode 100644 index bbbc75160d..0000000000 --- a/openair2/ENB_APP/CONTROL_MODULES/S1AP/flexran_agent_s1ap_defs.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ -#ifndef __FLEXRAN_AGENT_S1AP_PRIMITIVES_H__ -#define __FLEXRAN_AGENT_S1AP_PRIMITIVES_H__ - -#include "flexran_agent_defs.h" - -/* FLEXRAN AGENT-S1AP Interface */ -typedef struct { - // S1AP statistics - void (*flexran_s1ap_notify_release_request)(mid_t mod_id); -} AGENT_S1AP_xface; - -#endif diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto deleted file mode 100644 index 2f2267b628..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ /dev/null @@ -1,311 +0,0 @@ -syntax = "proto2"; -package protocol; - -// -// Cell config related structures and enums -// - -message flex_si_config { - optional uint32 sfn = 1; - optional uint32 sib1_length = 2; // The length of SIB1 in bytes - optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF - repeated flex_si_message si_message = 4; // List of SI messages to be sent. - // The index identifies the type of an SI message - // 0 - SIB1 - // 1..31 - SIx - // 32..63 - PCCH -} - -message flex_si_message { - optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames - optional uint32 length = 2; // The length of the SI message in bytes -} - -enum flex_hopping_mode { - FLHM_INTER = 0; - FLHM_INTERINTRA = 1; -} - -enum flex_phich_resource { - FLPR_ONE_SIXTH = 0; - FLPR_HALF = 1; - FLPR_ONE = 2; - FLPR_TWO = 3; -} - -enum flex_phich_duration { - FLPD_NORMAL = 0; - FLPD_EXTENDED = 1; -} - -enum flex_ul_cyclic_prefix_length { - FLUCPL_NORMAL = 0; - FLUCPL_EXTENDED = 1; -} - -enum flex_dl_cyclic_prefix_length { - FLDCPL_NORMAL = 0; - FLDCPL_EXTENDED = 1; -} - -enum flex_duplex_mode { - FLDM_TDD = 0; - FLDM_FDD = 1; -} - -enum flex_qam { - FLEQ_MOD_16QAM = 0; - FLEQ_MOD_64QAM = 1; -} - -// -// Slice config related structures and enums -// -enum flex_slice_algorithm { - None = 0; - Static = 1; - NVS = 2; -} - -message flex_slice_static { - optional uint32 posLow = 1; - optional uint32 posHigh = 2; -} - -message flex_slice { - optional uint32 id = 1; - optional string label = 2; - optional string scheduler = 3; - oneof params { - flex_slice_static static = 10; - } -} - -message flex_slice_dl_ul_config { - optional flex_slice_algorithm algorithm = 1; - repeated flex_slice slices = 2; - optional string scheduler = 3; // if no slicing -} - -// -// UE config related structures and enums -// - -message flex_drx_config { - optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321 - optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321 - optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321 - optional uint32 long_drx_cycle = 4; // In SF. See TS 36.321 - optional uint32 long_drx_cycle_start_offset = 5;// See TS 36.321 - optional uint32 short_drx_cycle = 6; // In SF - optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321 -} - -message flex_sps_config { - optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF - optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF - optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321 - repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used - // as part of FLPT_SET_UE_CONFIG - optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS -} - -message flex_sr_config { - optional uint32 sr_action = 1; // Indicates if SR config should be changed or released - // One of the FLSRA_* enum values - optional uint32 sched_interval = 2; // SR scheduling interval in SF - optional uint32 dsr_trans_max = 3; // See TS 36.213 -} - -message flex_cqi_config { - optional uint32 cqi_action = 1; // Indicats if CQI changed or released. - // One of the FLSRA_* enum values - optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF - optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF -} - -message flex_ue_capabilities { - optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation - optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value - optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1 - optional uint32 ue_category = 4; - optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1 -} - -message flex_scell_config { - optional uint32 carrier_index = 1; // Id of the carrier component - optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex) - optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling - // is used by this SCell - optional uint32 sched_cell_index = 4; // Index of the cell responsible for scheduling - // this SCell if cross-carrier scheduling is enabled - optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell -} - -enum flex_meas_gap_config_pattern { - FLMGCP_GP1 = 0; - FLMGCP_GP2 = 1; - FLMGCP_OFF = 2; -} - -enum flex_setup_release_action { - FLSRA_SETUP = 0; - FLSRA_RELEASE = 1; -} - -enum flex_ue_transmission_antenna { - FLUTA_NONE = 0; - FLUTA_OPEN_LOOP = 1; - FLUTA_CLOSED_LOOP = 2; -} - -enum flex_aperiodic_cqi_report_mode { - FLACRM_RM12 = 0; - FLACRM_RM20 = 1; - FLACRM_RM22 = 2; - FLACRM_RM30 = 3; - FLACRM_RM31 = 4; - FLACRM_NONE = 5; - FLACRM_RM32_v1250 = 6; - FLACRM_RM10_v1310 = 7; - FLACRM_RM11_v1310 = 8; -} - -enum flex_tdd_ack_nack_feedback_mode { - FLTANFM_BUNDLING = 0; - FLTANFM_MULTIPLEXING = 1; -} - -// -// Logical channel config related structures and enums -// - -message flex_lc_config { - optional uint32 lcid = 1; // The logical channel id - optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to - optional uint32 direction = 3; // The LC direction. One of the FLLCD_* enum values - optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the FLQBT_* enum values - optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413 - // One less than the actual QCI value - optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) - optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only) - optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only) - optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only) -} - -enum flex_lc_direction { - FLLCD_UL = 0; - FLLCD_DL = 1; - FLLCD_BOTH = 2; -} - -enum flex_qos_bearer_type { - FLQBT_NON_GBR = 0; - FLQBT_GBR = 1; -} - -enum flex_ue_state_change_type { - FLUESC_UPDATED = 0; - FLUESC_ACTIVATED = 1; - FLUESC_DEACTIVATED = 2; - FLUESC_MOVED = 3; -} - -message flex_plmn { - optional uint32 mcc = 1; - optional uint32 mnc = 2; - optional uint32 mnc_length = 3; -} - -// -// UE-related RRC configuration - -message flex_measurement_info { - // arbitrary offset OFS, from TS - optional int64 offset_freq_serving = 1; - // arbitrary offset OFN - optional int64 offset_freq_neighbouring = 2; - // arbitrary offset OCS + OCN - repeated int64 cell_individual_offset = 3; - // Parameter k for exponential moving average calculation coefficient - // a = 1/2^(k/4) of all measured RSRPs - optional int64 filter_coefficient_rsrp = 4; - // Parameter k for RSRQ filtering - optional int64 filter_coefficient_rsrq = 5; - optional flex_measurement_event event = 6; -} - -message flex_measurement_event { - optional flex_per_event periodical = 1; - optional flex_a1_event a1 = 2; - optional flex_a2_event a2 = 3; - optional flex_a3_event a3 = 4; - optional flex_a4_event a4 = 5; - optional flex_a5_event a5 = 6; -} - -message flex_per_event { - optional int64 max_report_cells = 1; -} - -message flex_a1_event { - optional int64 threshold_rsrp = 1; - optional int64 hysteresis = 2; - optional int64 time_to_trigger = 3; - optional int64 max_report_cells = 4; -} - -message flex_a2_event { - optional int64 threshold_rsrp = 1; - optional int64 hysteresis = 2; - optional int64 time_to_trigger = 3; - optional int64 max_report_cells = 4; -} - -message flex_a3_event { - optional int64 a3_offset = 1; - optional int32 report_on_leave = 2; - optional int64 hysteresis = 3; - optional int64 time_to_trigger = 4; - optional int64 max_report_cells = 5; -} - -message flex_a4_event { - optional int64 threshold_rsrp = 1; - optional int64 hysteresis = 2; - optional int64 time_to_trigger = 3; - optional int64 max_report_cells = 4; -} - -message flex_a5_event { - optional int64 threshold_rsrp_1 = 1; - optional int64 threshold_rsrp_2 = 2; - optional int64 hysteresis = 3; - optional int64 time_to_trigger = 4; - optional int64 max_report_cells = 5; -} - -// -// S1AP cell configuration -// -message flex_gummei { - optional flex_plmn plmn = 1; - optional uint32 mme_group_id = 2; - optional uint32 mme_code = 3; -} - -message flex_s1ap_mme { - optional string s1_ip = 1; // S1-MME IP of MME - optional string name = 2; // S1-MME name of MME - optional flex_mme_state state = 3; // State of the MME - repeated flex_gummei served_gummeis = 4; // GUMMEIs served by the MME - repeated flex_plmn requested_plmns = 5; // PLMNs communicated to MME - optional uint32 rel_capacity = 6; // Relative MME capacity, TS23.401 -} - -enum flex_mme_state { - FLMMES_DISCONNECTED = 0; - FLMMES_WAITING = 1; - FLMMES_CONNECTED = 2; - FLMMES_OVERLOAD = 3; -} diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto deleted file mode 100644 index 1a69deec71..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ /dev/null @@ -1,110 +0,0 @@ -syntax = "proto2"; -package protocol; - -import "config_common.proto"; - -message flex_cell_config { - optional uint32 phy_cell_id = 1; // The PCI of this cell - optional uint32 pusch_hopping_offset = 3; // PUSCH resources in RBs for hopping - optional uint32 hopping_mode = 4; // One of the FLHM_* enum values - optional uint32 n_sb = 5; // The number of subbands - optional uint32 phich_resource = 6; // The number of REGs used for PHICH - // One of the FLPR_* enum values - optional uint32 phich_duration = 7; // One of the FLPD_* enum values - optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9 - optional flex_si_config si_config = 9; // The SI configuration - optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs - optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs - optional uint32 ul_cyclic_prefix_length = 13; // One of the FLUCPL_* enum values - optional uint32 dl_cyclic_prefix_length = 14; // One of the FLDCPL_* enum values - optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports - optional uint32 duplex_mode = 16; // One of the FLDM_* enum values - optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only - optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1 - repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional) - repeated uint32 mbsfn_subframe_config_rfoffset = 20; // The radio frame offset (Optional) - repeated uint32 mbsfn_subframe_config_sfalloc = 21; // Bitmap indicating the MBSFN subframes (Optional) - optional uint32 prach_config_index = 22; // See TS 36.211, section 5.7.1 - optional uint32 prach_freq_offset = 23; // See TS 36.211, section 5.7.1 - optional uint32 ra_response_window_size = 24; // The duration of the RA response window in SF - optional uint32 mac_contention_resolution_timer = 25; // Timer for RA - optional uint32 max_HARQ_Msg3Tx = 26; // See TS 36.321 - optional uint32 n1PUCCH_AN = 27; // See TS 36.213, section 10.1 - optional uint32 deltaPUCCH_shift = 28; // See TS 36.211, section 5.4 - optional uint32 nRB_cqi = 29; // See TS 36.211, section 5.4 - optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2 - optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2 - optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only - optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values - optional uint32 carrier_index = 34; // Carrier component index - optional uint32 dl_freq = 35; // operating downlink frequency - optional uint32 ul_freq = 36; // operating uplink frequency - optional uint32 eutra_band= 37; // operating band - optional int32 dl_pdsch_power = 38; // operating downlink power - optional int32 ul_pusch_power = 39; // operating uplink power - repeated flex_plmn plmn_id = 40; // The PLMN cell id of this cell - - optional flex_slice_config slice_config = 42; - optional bool x2_ho_net_control = 43; -} - -message flex_slice_config { - optional flex_slice_dl_ul_config dl = 6; - optional flex_slice_dl_ul_config ul = 7; -} - -message flex_ue_config { - optional uint32 rnti = 1; - optional flex_drx_config drx_config = 2; // The DRX configuration (Optional) - optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization - // status of the UE, not the actual advance procedure - // See TS 36.321 - optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration. - // One of the FLMGCP_* enum values - // See TS 36.133 - optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable - optional flex_sps_config sps_config = 6; // The SPS configuration (Optional) - optional flex_sr_config sr_config = 7; // The SR configuration (Optional) - optional flex_cqi_config cqi_config = 8; // The CQI configuration (Optional) - optional uint32 transmission_mode = 9; // The UE transmission mode - optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer - // per UE. See TS 36.413 - optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer - // per UE. See TS 36.413 - optional flex_ue_capabilities capabilities = 12; - optional uint32 ue_transmission_antenna = 13; // One of the FLUTA_* enum values - optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321 - optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL - optional uint32 beta_offset_ACK_index = 16; // See TS 36.213 - optional uint32 beta_offset_RI_index = 17; // See TS 36.213 - optional uint32 beta_offset_CQI_index = 18; // See TS 36.213 - optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213 - optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213 - optional uint32 aperiodic_cqi_rep_mode = 21; // One of the FLACRM_* enum values - optional uint32 tdd_ack_nack_feedback = 22; // One of the FLTANFM_* enum values - optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1 - optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size - optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation - optional uint32 cross_carrier_sched_support = 26; // Boolean value - optional uint32 pcell_carrier_index = 27; // Index of primary cell - repeated flex_scell_config scell_config = 28; // Secondary cells configuration - optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell - optional uint64 imsi = 30; - optional uint32 dl_slice_id = 31; - optional uint32 ul_slice_id = 32; - // Configuration about RRC measurements - optional flex_measurement_info info = 33; -} - -message flex_lc_ue_config { - optional uint32 rnti = 1; - repeated flex_lc_config lc_config = 2; // A list of LC configurations for the given UE -} - -message flex_s1ap_config { - optional uint32 pending = 1; // number of pending (to be connected) MMEs - optional uint32 connected = 2; // number of connected MMEs - optional string enb_s1_ip = 3; // S1-MME IP of eNodeB - optional string enb_name = 4; // S1-MME name of eNodeB - repeated flex_s1ap_mme mme = 5; -} diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto deleted file mode 100644 index a646a978a9..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto2"; -package protocol; - -enum flex_control_delegation_type { - FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation - FLCDT_AGENT_CONTROL_APP = 2; // Generic control application -} - -message flex_agent_reconfiguration_system { - optional string system = 1; - repeated flex_agent_reconfiguration_subsystem subsystems = 2; -} - -message flex_agent_reconfiguration_subsystem { - optional string name = 1; // Name of the object (app name or user plane object) - optional string behavior = 2; // For an app: a callback in a shared library. For any other subsystem: an object name (shared library) with defined syntax. - map params = 3; // Param configurations depending on callback/shared library above. -} - -message flex_agent_reconfiguration_param { - oneof param { - int32 integer = 1; - float floating = 2; - bool boolean = 3; - string str = 4; - } -} diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto deleted file mode 100644 index 29e0723835..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto +++ /dev/null @@ -1,65 +0,0 @@ -syntax = "proto2"; -package protocol; - -import "mac_primitives.proto"; - -// -// Body of UE DL MAC scheduling configuration info -// - -message flex_dl_data { - optional uint32 rnti = 1; - optional flex_dl_dci dl_dci = 2; - repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB - repeated flex_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid - optional uint32 serv_cell_index = 5; - optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA -} - - -message flex_ul_data { - optional uint32 rnti = 1; - optional flex_ul_dci ul_dci = 2; -} - -// -// Body of the RAR scheduler configuration -// -message flex_dl_rar { - optional uint32 rnti = 1; - optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2 - optional flex_dl_dci rar_dci = 3; - optional uint32 carrier_index = 4; // The carrier index for the RAR -} - -// -// Body of the paging/broadcast configuration message -// - -message flex_dl_broadcast { - optional uint32 type = 1; // The FLBT_* values - optional uint32 index = 2; // Index of the broadcast message: - // 0 - SIB1, - // 1..31 - Six, - // 32..63 - PCCH (PCCH index obtained from flex_paging_info) - optional flex_dl_dci broad_dci = 3; - optional uint32 carrier_index = 4; // Index of the carrier for broadcast -} - -// -// Body of the OFDM symbol count message -// - -message flex_pdcch_ofdm_sym_count { - optional uint32 carrier_index = 1; - optional uint32 num_pdcch_ofdm_symbols = 2; -} - -// -// Types of commands related enums -// - -enum flex_broadcast_type { - FLBT_BCCH = 0; - FLBT_PCCH = 1; -} diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto deleted file mode 100644 index cec7f84b6e..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/flexran.proto +++ /dev/null @@ -1,269 +0,0 @@ -syntax = "proto2"; -package protocol; - -import "stats_messages.proto"; -import "header.proto"; -import "time_common.proto"; -import "config_messages.proto"; -import "controller_commands.proto"; -import "config_common.proto"; -import "control_delegation.proto"; - -message flexran_message { - optional flexran_direction msg_dir = 100; - oneof msg { - flex_hello hello_msg = 1; - flex_echo_request echo_request_msg = 2; - flex_echo_reply echo_reply_msg = 3; - flex_stats_request stats_request_msg = 4; - flex_stats_reply stats_reply_msg = 5; - flex_sf_trigger sf_trigger_msg = 6; - flex_ul_sr_info ul_sr_info_msg = 7; - flex_enb_config_request enb_config_request_msg = 8; - flex_enb_config_reply enb_config_reply_msg = 9; - flex_ue_config_request ue_config_request_msg = 10; - flex_ue_config_reply ue_config_reply_msg = 11; - flex_lc_config_request lc_config_request_msg = 12; - flex_lc_config_reply lc_config_reply_msg = 13; - flex_dl_mac_config dl_mac_config_msg = 14; - flex_ue_state_change ue_state_change_msg = 15; - flex_control_delegation control_delegation_msg = 16; - flex_agent_reconfiguration agent_reconfiguration_msg = 17; - flex_rrc_triggering rrc_triggering = 18; - flex_ul_mac_config ul_mac_config_msg = 19; - flex_disconnect disconnect_msg = 20; - flex_ho_command ho_command_msg = 21; - flex_control_delegation_request control_del_req_msg = 22; - } -} - -enum flexran_direction { - //option allow_alias = true; - NOT_SET = 0; - INITIATING_MESSAGE = 1; - SUCCESSFUL_OUTCOME=2; - UNSUCCESSFUL_OUTCOME=3; -} - -enum flexran_err { - //option allow_alias = true; - // message errors - NO_ERR = 0; - MSG_DEQUEUING = -1; - MSG_ENQUEUING = -2; - MSG_DECODING = -3; - MSG_ENCODING = -4; - MSG_BUILD = -5; - MSG_NOT_SUPPORTED = -6; - MSG_NOT_HANDLED = -7; - MSG_NOT_VALIDATED = -8; - MSG_OUT_DATED = -9; - - - // other erros - UNEXPECTED = -100; -} - -// -// Maintenance and discovery messages -// -enum flex_bs_capability { - LOPHY = 0; - HIPHY = 1; - LOMAC = 2; - HIMAC = 3; - RLC = 4; - PDCP = 5; - SDAP = 6; - RRC = 7; - S1AP = 8; -} - -enum flex_bs_split { - F1 = 0; - nFAPI = 1; - IF4 = 2; - IF4p5 = 3; - IF5 = 4; -} - -message flex_hello { - optional flex_header header = 1; - optional uint64 bs_id = 2; // Unique id to distinguish the eNB - repeated flex_bs_capability capabilities = 3; - repeated flex_bs_split splits = 4; -} - -message flex_echo_request { - optional flex_header header = 1; - extensions 100 to 199; -} - - -message flex_echo_reply { - optional flex_header header = 1; - extensions 100 to 199; -} - - -// -// Statistics request and reply message -// - -message flex_stats_request { - optional flex_header header = 1; - optional flex_stats_type type = 2; - oneof body { - flex_complete_stats_request complete_stats_request = 3; - flex_cell_stats_request cell_stats_request = 4; - flex_ue_stats_request ue_stats_request = 5; - } -} - -message flex_stats_reply { - optional flex_header header = 1; - repeated flex_ue_stats_report ue_report = 2; - repeated flex_cell_stats_report cell_report = 3; -} - -// -// Time indication messages -// - -message flex_sf_trigger { - optional flex_header header = 1; - optional uint32 sfn_sf = 2; - repeated flex_dl_info dl_info = 3; - repeated flex_ul_info ul_info = 4; -} - -// -// Asynchronous messages -// - -message flex_ul_sr_info { - optional flex_header header = 1; - optional uint32 sfn_sf = 2; - repeated uint32 rnti = 3; -} - -// -// eNB configuration messages -// -message flex_enb_config_request { - optional flex_header header = 1; -} - -message flex_enb_config_reply { - optional flex_header header = 1; - repeated flex_cell_config cell_config = 3; - optional uint32 device_spec = 4; - optional flex_s1ap_config s1ap = 5; - repeated string loadedApps = 6; - repeated string loadedMacObjects = 7; -} - -message flex_ue_config_request { - optional flex_header header = 1; -} - -message flex_ue_config_reply { - optional flex_header header = 1; - repeated flex_ue_config ue_config = 2; -} - -message flex_lc_config_request { - optional flex_header header = 1; -} - -message flex_lc_config_reply { - optional flex_header header = 1; - repeated flex_lc_ue_config lc_ue_config = 2; -} - -// -// Controller command messages -// - -message flex_dl_mac_config { - optional flex_header header = 1; - optional uint32 sfn_sf = 2; - repeated flex_dl_data dl_ue_data = 3; - repeated flex_dl_rar dl_rar = 4; - repeated flex_dl_broadcast dl_broadcast = 5; - repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC -} - -message flex_ul_mac_config { - optional flex_header header = 1; - optional uint32 sfn_sf = 2; - repeated flex_ul_data ul_ue_data = 3; -} - -message flex_rrc_triggering { - - optional flex_header header = 1; - optional string rrc_trigger = 2; - optional flex_measurement_info meas_info = 3; -} - -message flex_ho_command { - optional flex_header header = 1; - optional uint32 rnti = 2; - optional uint32 target_phy_cell_id = 3; -} - -// -// UE state change message -// - -message flex_ue_state_change { - optional flex_header header = 1; - optional uint32 type = 2; // One of the FLUESC_* values - optional flex_ue_config config = 3; // Body of the message (based on type) -} - -// -// Control delegation message -// - -message flex_control_delegation { - optional flex_header header = 1; - optional flex_control_delegation_type delegation_type = 2; // The delegated object type, decides about further processing - optional bytes payload = 3; // Byte array of shared lib containing the delegated functions - optional string name = 4; // The delegated functions names ordered based on bitmap flags -} - -message flex_control_delegation_request { - optional flex_header header = 1; - optional flex_control_delegation_type delegation_type = 2; - optional string name = 4; -} - -// -// Agent reconfiguration message -// - -message flex_agent_reconfiguration { - optional flex_header header = 1; - optional string policy = 2; // The policy changes using YAML syntax in string format - repeated flex_agent_reconfiguration_system systems = 3; // The policy changes. -} - -// Extensions of the echo request and reply -// messages for carrying a latency value in ms -message flex_echo_request_latency { - extend flex_echo_request { - optional uint32 latency = 100; - } -} - -message flex_echo_reply_latency { - extend flex_echo_reply { - optional uint32 latency = 100; - } -} - -message flex_disconnect { - optional flex_header header = 1; -} diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto deleted file mode 100644 index 5e224f64f7..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto2"; -package protocol; - -message flex_header { - optional uint32 version = 1; - optional uint32 type = 2; - optional uint32 xid = 4; -} - -enum flex_type { - // Discovery and maintenance messages - FLPT_HELLO = 0; - FLPT_ECHO_REQUEST = 1; - FLPT_ECHO_REPLY = 2; - FLPT_DISCONNECT = 20; - - // Statistics and measurement messages - FLPT_STATS_REQUEST = 3; - FLPT_STATS_REPLY = 4; - - // Time indication messages - FLPT_SF_TRIGGER = 5; - - // Asynchronous messages - FLPT_UL_SR_INFO = 6; - - // eNB configuration messages - FLPT_GET_ENB_CONFIG_REQUEST = 7; - FLPT_GET_ENB_CONFIG_REPLY = 8; - FLPT_GET_UE_CONFIG_REQUEST = 9; - FLPT_GET_UE_CONFIG_REPLY = 10; - FLPT_GET_LC_CONFIG_REQUEST = 11; - FLPT_GET_LC_CONFIG_REPLY = 12; - - //Controller command messages - FLPT_DL_MAC_CONFIG = 13; - FLPT_HO_COMMAND = 21; - - // UE state change messages - FLPT_UE_STATE_CHANGE = 14; - - // Control delegation messages - FLPT_DELEGATE_CONTROL = 15; - FLPT_RECONFIGURE_AGENT = 16; - FLPT_RRC_TRIGGERING = 17; - FLPT_UL_MAC_CONFIG = 18; - FLPT_DELEGATE_REQUEST = 22; -} - diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto deleted file mode 100644 index bd2b9cbe50..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto +++ /dev/null @@ -1,110 +0,0 @@ -syntax = "proto2"; -package protocol; - -// -// Message containing the DL DCI info -// - -message flex_dl_dci { - optional uint32 rnti = 1; - optional uint32 res_alloc = 2; // Type of resource allocation - optional uint32 rb_bitmap = 3; // Bitmap for RB allocation - optional uint32 rb_shift = 4; // See TS 36.214, section 7.1.6.2 - repeated uint32 tbs_size = 5; // The size of each TBS - repeated uint32 mcs = 6; // The MCS of each TB - repeated uint32 ndi = 7; // New data indicator of each TB - repeated uint32 rv = 8; // Redundancy version of each TB - optional uint32 cce_index = 9; // CCE index used to send the DCI - optional uint32 aggr_level = 10; - optional uint32 precoding_info = 11; // 2 antenna ports:0..6, - // 4 antenna ports:0..50 - optional uint32 format = 12; // DCI format. A FLDCIF_* value - optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1 - optional uint32 harq_process = 14; // HARQ process ID - optional uint32 dai = 15; // TDD only - optional uint32 vrb_format = 16; // One of the FLVRBF_* values - optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag - optional uint32 sps_release = 18; // Flag value - optional uint32 pdcch_order = 19; - optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 - optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 - optional uint32 n_gap = 22; // One of the FLNGV_* values - optional uint32 tbs_idx = 23; // The TBS index for Format 1A - optional uint32 dl_power_offset = 24; // For format 1D - optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB - optional uint32 cif_present = 26; // Boolean. Indication of CIF field - optional uint32 cif = 27; // CIF for cross-carrier scheduling -} - -message flex_ul_dci { - optional uint32 rnti = 1; - optional uint32 rb_start = 2; // The start RB allocated to the UE - optional uint32 rb_len = 3; // The number of RBs allocated to the UE - optional uint32 mcs = 4; // Modulation and coding scheme - optional uint32 cyclic_shift2 = 5; // match DCI format 0/4 PDU - optional uint32 freq_hop_flag = 6; // 0 no hopping, 1 hoppping - optional uint32 freq_hop_map = 7; // Frequency hopping bits (0..4) - optional uint32 ndi = 8; // New data indicator - optional uint32 rv = 9; // Redundancy version - optional uint32 harq_pid = 10; // The harq process id - optional uint32 ultx_mode = 11; // A FLULM_* value - optional uint32 tbs_size = 12; // The size of each TBS - optional uint32 n_srs = 13; // Overlap indication with srs - optional uint32 res_alloc = 14; // Type of resource allocation - optional uint32 size = 15; // Size of the ULSCH PDU in bytes for UL Grant. - - optional uint32 dai = 16; // TDD only - -// optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag - -// optional uint32 pdcch_order = 19; -// optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 -// optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 - -// optional uint32 tbs_idx = 23; // The TBS index for Format 1A - - - - -} - - -// -// Messages related to the creation of RLC PDUs -// - -message flex_rlc_pdu { - repeated flex_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB -} - -message flex_rlc_pdu_tb { - optional uint32 logical_channel_id = 1; - optional uint32 size = 2; // Maximum RLC PDU to be created in bytes -} - -// -// MAC content types related enums -// - -enum flex_dci_format { - FLDCIF_1 = 0; - FLDCIF_1A = 1; - FLDCIF_1B = 2; - FLDCIF_1C = 3; - FLDCIF_1D = 4; - FLDCIF_2 = 5; - FLDCIF_2A = 6; - FLDCIF_2B = 7; - FLDCIF_3 = 8; - FLDCIF_3A = 9; -} - -enum flex_vrb_format { - FLVRBF_LOCALIZED = 0; - FLVRBF_DISTRIBUTED = 1; -} - -enum flex_ngap_val { - FLNGV_1 = 0; - FLNGV_2 = 1; -} diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto deleted file mode 100644 index 62bd06d707..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ /dev/null @@ -1,324 +0,0 @@ -syntax = "proto2"; -package protocol; - -import "config_common.proto"; // for flex_plmn - -// -// UE related statistics -// - -// RLC buffer status for a specific logical channel of a UE -message flex_rlc_bsr { - optional uint32 lc_id = 1; - optional uint32 tx_queue_size = 2; - optional uint32 tx_queue_hol_delay = 3; - optional uint32 retransmission_queue_size = 4; - optional uint32 retransmission_queue_hol_delay = 5; - optional uint32 status_pdu_size = 6; -} - -// Flags for MAC Control Elements -enum flex_ce_type { - FLPCET_TA = 1; - FLPCET_DRX = 2; - FLPCET_CR = 4; - FLPCET_CA = 8; -} - -// Types of DL CSI reports -enum flex_csi_type { - FLCSIT_P10 = 0; - FLCSIT_P11 = 1; - FLCSIT_P20 = 2; - FLCSIT_P21 = 3; - FLCSIT_A12 = 4; - FLCSIT_A22 = 5; - FLCSIT_A20 = 6; - FLCSIT_A30 = 7; - FLCSIT_A31 = 8; -} - -// CSI type P10 -message flex_csi_p10 { - optional uint32 wb_cqi = 1; -} - -// CSI type P11 -message flex_csi_p11 { - repeated uint32 wb_cqi = 1; - optional uint32 wb_pmi = 2; -} - -// CSI type P20 -message flex_csi_p20 { - optional uint32 wb_cqi = 1; - optional uint32 sb_cqi = 2; - optional uint32 bandwidth_part_index = 3; - optional uint32 sb_index = 4; -} - -// CSI type P21 -message flex_csi_p21 { - repeated uint32 wb_cqi = 1; - optional uint32 wb_pmi = 2; - repeated uint32 sb_cqi = 3; - optional uint32 badwidth_part_index = 4; - optional uint32 sb_index = 5; -} - -// CSI type A12 -message flex_csi_a12 { - repeated uint32 wb_cqi = 1; - repeated uint32 sb_pmi = 2; -} - -// CSI type A22 -message flex_csi_a22 { - repeated uint32 wb_cqi = 1; - repeated uint32 sb_cqi = 2; - optional uint32 wb_pmi = 3; - optional uint32 sb_pmi = 4; - repeated uint32 sb_list = 5; -} - -// CSI type A20 -message flex_csi_a20 { - optional uint32 wb_cqi = 1; - optional uint32 sb_cqi = 2; - repeated uint32 sb_list = 3; -} - -// CSI type A30 -message flex_csi_a30 { - optional uint32 wb_cqi = 1; - repeated uint32 sb_cqi = 2; -} - -// CSI type A31 -message flex_csi_a31 { - repeated uint32 wb_cqi = 1; - repeated flex_msb_cqi sb_cqi = 2; - optional uint32 wb_pmi = 3; -} - -// The CQI for the M-preffered subband -message flex_msb_cqi { - repeated uint32 sb_cqi = 1; -} - -// The CSI report of the UE for a specific servCellIndex -message flex_dl_csi { - optional uint32 serv_cell_index = 1; - optional uint32 ri = 2; - optional flex_csi_type type = 3; - oneof report { - flex_csi_p10 p10csi = 4; - flex_csi_p11 p11csi = 5; - flex_csi_p20 p20csi = 6; - flex_csi_p21 p21csi = 7; - flex_csi_a12 a12csi = 8; - flex_csi_a22 a22csi = 9; - flex_csi_a20 a20csi = 10; - flex_csi_a30 a30csi = 11; - flex_csi_a31 a31csi = 12; - } -} - -// The full DL CQI report for all CC of a UE -message flex_dl_cqi_report { - optional uint32 sfn_sn = 1; - repeated flex_dl_csi csi_report = 2; -} - -// Paging message info -message flex_paging_info { - optional uint32 paging_index = 1; - optional uint32 paging_message_size = 2; - optional uint32 paging_subframe = 3; - optional uint32 carrier_index = 4; -} - -// Report for the paging buffer status -message flex_paging_buffer_report { - repeated flex_paging_info paging_info = 1; -} - -// The type of UL CQI -enum flex_ul_cqi_type { - FLUCT_SRS = 0; - FLUCT_PUSCH = 1; - FLUCT_PUCCH_1 = 2; - FLUCT_PUCCH_2 = 3; - FLUCT_PRACH = 4; -} - -// UL CQI report for a specific UE for a given report type -message flex_ul_cqi { - optional flex_ul_cqi_type type = 1; - repeated uint32 sinr = 2; - optional uint32 serv_cell_index = 3; -} - -// Full UL CQI report for a specific UE -message flex_ul_cqi_report { - optional uint32 sfn_sn = 1; - repeated flex_ul_cqi cqi_meas = 2; - repeated flex_pucch_dbm pucch_dbm = 3; -} - -message flex_pucch_dbm { - optional int32 p0_pucch_dbm = 1; - optional uint32 serv_cell_index = 2; - optional uint32 p0_pucch_updated = 3; -} - -// -// Cell related statistics -// - -// The UL noise and interference report for a UE -message flex_noise_interference_report { - optional uint32 sfn_sf = 1; - optional uint32 rip = 2; - optional uint32 tnp = 3; - optional int32 p0_nominal_pucch = 4; -} - -// -// RRC Measurements Primitives -// - - -message flex_rrc_measurements { - // Measurement identifier. - optional int32 measid = 1; - // Primary Cell Reference Signal Received Power (RSRP). - optional int32 pcell_rsrp = 2; - // Primary Cell Reference Signal Received Quality (RSRQ). - optional int32 pcell_rsrq = 3; - // Neighboring cells measurements performed by UE. - optional flex_neigh_cells_measurements neigh_meas = 4; -} - -message flex_neigh_cells_measurements { - // Neighboring EUTRA cells measurements. - repeated flex_eutra_measurements eutra_meas = 1; -} - -message flex_eutra_measurements { - // Physical Cell identifier. - optional int32 phys_cell_id = 1; - // EUTRA Cell Global Identity (CGI) measurement. - optional flex_eutra_cgi_measurements cgi_meas = 2; - // EUTRA nearby cell reference signal measurement. - optional flex_eutra_ref_signal_meas meas_result = 3; -} - -message flex_eutra_cgi_measurements { - // EUTRA Cell Global Identity (CGI). - optional flex_cell_global_eutra_id cgi = 1; - // Tracking area code of the neighbor cell. - optional uint32 tracking_area_code = 2; - // Public land mobile network identifiers of neighbor cell. - repeated flex_plmn plmn = 3; -} - -message flex_cell_global_eutra_id { - // Public land mobile network identifier of neighbor cell. - optional flex_plmn plmn = 1; - // Cell identifier of neighbor cell. - optional uint32 cell_id = 2; -} - -message flex_eutra_ref_signal_meas { - // Neighboring Cell RSRP - optional int32 rsrp = 1; - // Neighboring Cell RSRQ - optional int32 rsrq = 2; -} - -// -// PDCP Statistics -// - -message flex_pdcp_stats { - - optional uint32 pkt_tx = 1; - optional uint32 pkt_tx_bytes = 2; - optional uint32 pkt_tx_sn = 3; - optional uint32 pkt_tx_w = 4; - optional uint32 pkt_tx_bytes_w = 5; - optional uint32 pkt_tx_aiat = 7; - optional uint32 pkt_tx_aiat_w = 8; - - optional uint32 pkt_rx = 9; - optional uint32 pkt_rx_bytes = 10; - optional uint32 pkt_rx_sn = 11; - optional uint32 pkt_rx_w = 12; - optional uint32 pkt_rx_bytes_w = 13; - optional uint32 pkt_rx_aiat = 14; - optional uint32 pkt_rx_aiat_w = 15; - optional uint32 pkt_rx_oo = 16; - - optional uint64 sfn=17; -} - -// -// MAC Stats -// - -message flex_mac_stats { - - optional uint32 tbs_dl = 1; - optional uint32 tbs_ul = 2; - optional uint32 prb_retx_dl = 3; - optional uint32 prb_retx_ul = 4; - optional uint32 prb_dl = 5; - optional uint32 prb_ul = 6; - optional uint32 mcs1_dl = 7; - optional uint32 mcs2_dl = 8; - optional uint32 mcs1_ul = 9; - optional uint32 mcs2_ul = 10; - optional uint32 total_bytes_sdus_ul = 11; - optional uint32 total_bytes_sdus_dl = 12; - optional uint32 total_prb_retx_dl = 13; - optional uint32 total_prb_retx_ul = 14; - optional uint32 total_prb_dl = 15; - optional uint32 total_prb_ul = 16; - optional uint32 total_pdu_dl = 17; - optional uint32 total_pdu_ul = 18; - optional uint32 total_tbs_dl = 19; - optional uint32 total_tbs_ul = 20; - repeated flex_mac_sdus_dl mac_sdus_dl = 21; - optional uint32 harq_round = 22; -} - -message flex_mac_sdus_dl { - - optional uint32 sdu_length = 1; - optional uint32 lcid = 2; -} - -// -// GTP stats -// - -message flex_gtp_stats { - optional uint32 e_rab_id = 1; - optional uint32 teid_enb = 2; - optional string addr_enb = 3; - optional uint32 teid_sgw = 4; - optional string addr_sgw = 5; -} - -// -// S1AP stats -// - -message flex_s1ap_ue { - optional string mme_s1_ip = 1; // IP of MME to which UE is connected - optional uint32 enb_ue_s1ap_id = 2; // S1AP ID on eNodeB side for UE - optional uint32 mme_ue_s1ap_id = 3; // S1AP ID on MME side for UE - optional flex_plmn selected_plmn = 4; // UE-selected PLMN in RRC Conn Setup Cplt -} - diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto deleted file mode 100644 index 6f67648d82..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto +++ /dev/null @@ -1,100 +0,0 @@ -syntax = "proto2"; -package protocol; - -//import "header.proto"; -import "stats_common.proto"; - -// -// Bodies of statistics report requests -// - -message flex_complete_stats_request { - optional flex_stats_report_freq report_frequency = 1; - optional uint32 sf = 2; - optional uint32 cell_report_flags = 3; - optional uint32 ue_report_flags = 4; -} - -message flex_cell_stats_request { - repeated uint32 cell = 1; - optional uint32 flags = 2; -} - -message flex_ue_stats_request { - repeated uint32 rnti = 1; - optional uint32 flags = 2; -} - -// -// Bodies of statistics reports -// - -// The full statistics report for a specific cell -message flex_cell_stats_report { - optional uint32 carrier_index = 1; - optional uint32 flags = 2; - optional flex_noise_interference_report noise_inter_report = 3; -} - -// Statistics report for a specific UE -message flex_ue_stats_report { - optional uint32 rnti = 1; - optional uint32 flags = 2; - repeated uint32 bsr = 3; - optional uint32 phr = 4; - repeated flex_rlc_bsr rlc_report = 5; - optional uint32 pending_mac_ces = 6; - optional flex_dl_cqi_report dl_cqi_report = 7; - optional flex_paging_buffer_report pbr = 8; - optional flex_ul_cqi_report ul_cqi_report = 9; - optional flex_rrc_measurements rrc_measurements = 10; - optional flex_pdcp_stats pdcp_stats = 11; - optional flex_mac_stats mac_stats = 12; - repeated flex_gtp_stats gtp_stats = 13; - optional flex_s1ap_ue s1ap_stats = 14; -} - -// -// Types of statistics related enums -// - - -//Types of statistics requested by the controller -enum flex_stats_type { - FLST_COMPLETE_STATS = 0; - FLST_CELL_STATS = 1; - FLST_UE_STATS = 2; -} - -// Report frequency for the requested statistics -enum flex_stats_report_freq { - FLSRF_ONCE = 0; - FLSRF_PERIODICAL = 1; - FLSRF_CONTINUOUS = 2; - FLSRF_OFF = 3; -} - -// Flags for cell statistics -enum flex_cell_stats_type { - FLCST_NOISE_INTERFERENCE = 1; -} - -// Flags for UE-related statistics -enum flex_ue_stats_type { - FLUST_BSR = 1; - FLUST_PHR = 2; - FLUST_RLC_BS = 4; - FLUST_MAC_CE_BS = 8; - FLUST_DL_CQI = 16; - FLUST_PBS = 32; - FLUST_UL_CQI = 64; - FLUST_MAC_STATS = 128; - - FLUST_PDCP_STATS = 1024; - FLUST_GTP_STATS = 2048; - FLUST_S1AP_STATS = 4096; - FLUST_RRC_MEASUREMENTS = 65536; - // To be extended with more types of stats - - -} diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto deleted file mode 100644 index 6c0affbe51..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/time_common.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto2"; -package protocol; - -enum flex_harq_status { - FLHS_ACK = 0; - FLHS_NACK = 1; - FLHS_DTX = 2; -} - -enum flex_reception_status { - FLRS_OK = 0; - FLRS_NOT_OK = 1; - FLRS_NOT_VALID = 2; -} - -message flex_dl_info { - optional uint32 rnti = 1; - optional uint32 harq_process_id = 2; - repeated uint32 harq_status = 3; - optional uint32 serv_cell_index = 4; -} - -message flex_ul_info { - optional uint32 rnti = 1; - repeated uint32 ul_reception = 2; - optional uint32 reception_status = 3; - optional uint32 tpc = 4; - optional uint32 serv_cell_index = 5; - optional uint32 rssi = 6; -} - diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 2e6c94540d..c935e48c2d 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -42,7 +42,6 @@ # include "s1ap_eNB.h" # include "sctp_eNB_task.h" # include "gtpv1u_eNB_task.h" -# include "flexran_agent.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" @@ -260,10 +259,6 @@ void *eNB_app_task(void *args_p) { LOG_I(ENB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; - case SOFT_RESTART_MESSAGE: - handle_reconfiguration(instance); - break; - case S1AP_REGISTER_ENB_CNF: AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); if (EPC_MODE_ENABLED) { @@ -550,55 +545,3 @@ void *eNB_app_task(void *args_p) { return NULL; } - -void handle_reconfiguration(module_id_t mod_id) { - struct timespec start, end; - clock_gettime(CLOCK_MONOTONIC, &start); - flexran_agent_info_t *flexran = RC.flexran[mod_id]; - LOG_I(ENB_APP, "lte-softmodem soft-restart requested\n"); - - if (ENB_WAIT == flexran->node_ctrl_state) { - /* this is already waiting, just release */ - pthread_mutex_lock(&flexran->mutex_node_ctrl); - flexran->node_ctrl_state = ENB_NORMAL_OPERATION; - pthread_mutex_unlock(&flexran->mutex_node_ctrl); - pthread_cond_signal(&flexran->cond_node_ctrl); - return; - } - - if (stop_L1L2(mod_id) < 0) { - LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n"); - return; - } - - /* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not - * executed by the FlexRAN thread */ - if (ENB_MAKE_WAIT == flexran->node_ctrl_state) { - LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id); - pthread_mutex_lock(&flexran->mutex_node_ctrl); - flexran->node_ctrl_state = ENB_WAIT; - - while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state) - pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl); - - pthread_mutex_unlock(&flexran->mutex_node_ctrl); - } - - if (restart_L1L2(mod_id) < 0) { - LOG_E(ENB_APP, "can not restart, killing lte-softmodem\n"); - exit_fun("can not restart L1L2, killing lte-softmodem"); - return; - } - - clock_gettime(CLOCK_MONOTONIC, &end); - end.tv_sec -= start.tv_sec; - - if (end.tv_nsec >= start.tv_nsec) { - end.tv_nsec -= start.tv_nsec; - } else { - end.tv_sec -= 1; - end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000; - } - - LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000); -} diff --git a/openair2/ENB_APP/enb_app.h b/openair2/ENB_APP/enb_app.h index 9eb5ea2400..0154b12dbc 100644 --- a/openair2/ENB_APP/enb_app.h +++ b/openair2/ENB_APP/enb_app.h @@ -36,6 +36,4 @@ void *eNB_app_task(void *args_p); -void handle_reconfiguration(module_id_t mod_id); - #endif /* ENB_APP_H_ */ diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 92a2bb76dd..390700db58 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -65,45 +65,6 @@ extern char *worker_config; RAN_CONTEXT_t RC; -void RCconfig_flexran() { - /* get number of eNBs */ - paramdef_t ENBSParams[] = ENBSPARAMS_DESC; - config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL); - uint16_t num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt; - paramdef_t flexranParams[] = FLEXRANPARAMS_DESC; - config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); - - if (!RC.flexran) { - RC.flexran = calloc(num_enbs, sizeof(flexran_agent_info_t *)); - AssertFatal(RC.flexran, - "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n", - num_enbs * sizeof(flexran_agent_info_t *), - num_enbs, sizeof(flexran_agent_info_t *)); - } - - for (uint16_t i = 0; i < num_enbs; i++) { - RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t)); - AssertFatal(RC.flexran[i], - "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n", - sizeof(flexran_agent_info_t), i + 1, num_enbs); - /* if config says "yes", enable Agent, in all other cases it's like "no" */ - RC.flexran[i]->enabled = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0; - - /* if not enabled, simply skip the rest, it is not needed anyway */ - if (!RC.flexran[i]->enabled) - continue; - - RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr)); - //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN); - RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr)); - RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr); - RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr)); - RC.flexran[i]->node_ctrl_state = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION; - RC.flexran[i]->mod_id = i; - } -} - - void RCconfig_L1(void) { int i,j; paramdef_t L1_Params[] = L1PARAMS_DESC; @@ -3220,6 +3181,4 @@ void read_config_and_init(void) { memset((void *)RC.rrc[enb_id], 0, sizeof(eNB_RRC_INST)); RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } - - RCconfig_flexran(); } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index b95bf90f70..0ef31d42e6 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -100,7 +100,6 @@ typedef struct ru_config_s { uint8_t if_compress; } ru_config_t; -extern void RCconfig_flexran(void); extern void RCconfig_L1(void); extern void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]); extern void UE_config_stub_pnf(void); diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 20a5807616..1f2ca6392f 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -1153,34 +1153,6 @@ typedef struct srb1_params_s { #define CONFIG_STRING_L1_LIST "L1s" #define CONFIG_STRING_L1_CONFIG "l1_config" -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" - -#define CONFIG_STRING_FLEXRAN_ENABLED "FLEXRAN_ENABLED" -#define CONFIG_STRING_FLEXRAN_INTERFACE_NAME "FLEXRAN_INTERFACE_NAME" -#define CONFIG_STRING_FLEXRAN_IPV4_ADDRESS "FLEXRAN_IPV4_ADDRESS" -#define CONFIG_STRING_FLEXRAN_PORT "FLEXRAN_PORT" -#define CONFIG_STRING_FLEXRAN_CACHE "FLEXRAN_CACHE" -#define CONFIG_STRING_FLEXRAN_AWAIT_RECONF "FLEXRAN_AWAIT_RECONF" - -#define FLEXRAN_ENABLED 0 -#define FLEXRAN_INTERFACE_NAME_IDX 1 -#define FLEXRAN_IPV4_ADDRESS_IDX 2 -#define FLEXRAN_PORT_IDX 3 -#define FLEXRAN_CACHE_IDX 4 -#define FLEXRAN_AWAIT_RECONF_IDX 5 - -#define FLEXRANPARAMS_DESC { \ - {CONFIG_STRING_FLEXRAN_ENABLED, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ - {CONFIG_STRING_FLEXRAN_INTERFACE_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ - {CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ - {CONFIG_STRING_FLEXRAN_PORT, NULL, 0, uptr:NULL, defintval:2210, TYPE_UINT, 0}, \ - {CONFIG_STRING_FLEXRAN_CACHE, NULL, 0, strptr:NULL, defstrval:"/mnt/oai_agent_cache", TYPE_STRING, 0}, \ - {CONFIG_STRING_FLEXRAN_AWAIT_RECONF, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0} \ - } - /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* CU/DU configuration section names*/ diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c deleted file mode 100644 index af7ff6ff6f..0000000000 --- a/openair2/ENB_APP/flexran_agent.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent.h - * \brief top level flexran agent receive thread and itti task - * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#define _GNU_SOURCE -#include "flexran_agent.h" -#include - -#include -#include - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -int agent_task_created = 0; -/* - * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller - * and can interact with other itti tasks -*/ -void *flexran_agent_task(void *args){ - MessageDef *msg_p = NULL; - int result; - - itti_mark_task_ready(TASK_FLEXRAN_AGENT); - - do { - // Wait for a message - itti_receive_msg (TASK_FLEXRAN_AGENT, &msg_p); - DevAssert(msg_p != NULL); - - switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - LOG_W(FLEXRAN_AGENT, " *** Exiting FLEXRAN thread\n"); - itti_exit_task (); - break; - - case MESSAGE_TEST: - LOG_I(FLEXRAN_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); - break; - - default: - LOG_E(FLEXRAN_AGENT, "Received unexpected message %s\n", ITTI_MSG_NAME (msg_p)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } while (1); - - return NULL; -} - -void *receive_thread(void *args) { - - flexran_agent_info_t *d = args; - void *data; - int size; - int priority; - err_code_t err_code=0; - - Protocol__FlexranMessage *msg; - pthread_setname_np(pthread_self(), "flexran_rx_thr"); - - while (1) { - - while ((size = flexran_agent_msg_recv(d->mod_id, FLEXRAN_AGENT_DEFAULT, &data, &priority)) > 0) { - - LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size); - - // Invoke the message handler - msg=flexran_agent_handle_message(d->mod_id, data, size); - - free(data); - - // check if there is something to send back to the controller - if (msg != NULL){ - data=flexran_agent_pack_message(msg,&size); - - if (flexran_agent_msg_send(d->mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); - } - } - } - - return NULL; - -error: - if (err_code != 0) - LOG_E(FLEXRAN_AGENT,"receive_thread: error %d occured\n",err_code); - return NULL; -} - -int channel_container_init = 0; -int flexran_agent_start(mid_t mod_id) -{ - flexran_agent_info_t *flexran = RC.flexran[mod_id]; - int channel_id; - char *in_ip = flexran->remote_ipv4_addr; - uint16_t in_port = flexran->remote_port; - - /* if this agent is disabled, return and don't do anything */ - if (!flexran->enabled) { - LOG_I(FLEXRAN_AGENT, "FlexRAN Agent for eNB %d is DISABLED\n", mod_id); - return 100; - } - - /* - * Initialize the channel container - */ - if (!channel_container_init) { - flexran_agent_init_channel_container(); - channel_container_init = 1; - } - /*Create the async channel info*/ - flexran_agent_async_channel_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); - - if (!channel_info) { - LOG_E(FLEXRAN_AGENT, "could not create channel_info\n"); - exit(1); - } - - /*Create a channel using the async channel info*/ - channel_id = flexran_agent_create_channel((void *) channel_info, - flexran_agent_async_msg_send, - flexran_agent_async_msg_recv, - flexran_agent_async_release); - - - if (channel_id <= 0) { - LOG_E(FLEXRAN_AGENT, "could not create channel\n"); - goto error; - } - - flexran_agent_channel_t *channel = get_channel(channel_id); - - if (channel == NULL) { - LOG_E(FLEXRAN_AGENT, "could not get channel for channel_id %d\n", channel_id); - goto error; - } - - /*Register the channel for all underlying agents (use FLEXRAN_AGENT_MAX)*/ - flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAX); - - /*Example of registration for a specific agent(MAC): - *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC); - */ - - pthread_t t; - threadCreate(&t, receive_thread, flexran, "flexran", -1, OAI_PRIORITY_RT); - - /* Register and initialize the control modules depending on capabilities. - * After registering, calling flexran_agent_get_*_xface() tells whether a - * control module is operational */ - uint32_t caps = flexran_get_capabilities_mask(mod_id); - LOG_I(FLEXRAN_AGENT, "Agent handles BS ID %ld, capabilities=0x%x => handling%s%s%s%s%s%s%s%s%s\n", - flexran_get_bs_id(mod_id), caps, - FLEXRAN_CAP_LOPHY(caps) ? " LOPHY" : "", - FLEXRAN_CAP_HIPHY(caps) ? " HIPHY" : "", - FLEXRAN_CAP_LOMAC(caps) ? " LOMAC" : "", - FLEXRAN_CAP_HIMAC(caps) ? " HIMAC" : "", - FLEXRAN_CAP_RLC(caps) ? " RLC" : "", - FLEXRAN_CAP_PDCP(caps) ? " PDCP" : "", - FLEXRAN_CAP_SDAP(caps) ? " SDAP" : "", - FLEXRAN_CAP_RRC(caps) ? " RRC" : "", - FLEXRAN_CAP_S1AP(caps) ? " S1AP" : ""); - - if (FLEXRAN_CAP_LOPHY(caps) || FLEXRAN_CAP_HIPHY(caps)) { - flexran_agent_register_phy_xface(mod_id); - LOG_I(FLEXRAN_AGENT, "registered PHY interface/CM for eNB %d\n", mod_id); - } - - if (FLEXRAN_CAP_LOMAC(caps) || FLEXRAN_CAP_HIMAC(caps)) { - flexran_agent_register_mac_xface(mod_id); - flexran_agent_init_mac_agent(mod_id); - LOG_I(FLEXRAN_AGENT, "registered MAC interface/CM for eNB %d\n", mod_id); - } - - if (FLEXRAN_CAP_RRC(caps)) { - flexran_agent_register_rrc_xface(mod_id); - LOG_I(FLEXRAN_AGENT, "registered RRC interface/CM for eNB %d\n", mod_id); - } - - if (FLEXRAN_CAP_PDCP(caps)) { - flexran_agent_register_pdcp_xface(mod_id); - LOG_I(FLEXRAN_AGENT, "registered PDCP interface/CM for eNB %d\n", mod_id); - } - - if (FLEXRAN_CAP_S1AP(caps)) { - flexran_agent_register_s1ap_xface(mod_id); - LOG_I(FLEXRAN_AGENT, "registered S1AP interface/CM for eNB %d\n", mod_id); - } - - /* - * initilize a timer - */ - - flexran_agent_timer_init(mod_id); - - /* - * start the enb agent task for tx and interaction with the underlying network function - */ - if (!agent_task_created) { - if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, flexran) < 0) { - LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n"); - return -1; - } - agent_task_created = 1; - } - - /* Init the app sublayer */ - flexran_agent_app_init(mod_id); - - pthread_mutex_init(&flexran->mutex_node_ctrl, NULL); - pthread_cond_init(&flexran->cond_node_ctrl, NULL); - - if (flexran->node_ctrl_state == ENB_WAIT) { - /* wait three seconds before showing message and waiting "for real". - * This way, the message is (hopefully...) the last one and the user knows - * what is happening. If the controller sends a reconfiguration message in - * the meantime, the softmodem will never wait */ - sleep(3); - LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id); - pthread_mutex_lock(&flexran->mutex_node_ctrl); - while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state) - pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl); - pthread_mutex_unlock(&flexran->mutex_node_ctrl); - - /* reconfigure RRC again, the agent might have changed the configuration */ - MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); - RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[mod_id]->configuration; - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg_p); - } - - return 0; - -error: - LOG_E(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); - return 1; - -} diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h deleted file mode 100644 index 43e7d7210a..0000000000 --- a/openair2/ENB_APP/flexran_agent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent.h - * \brief top level flexran agent - * \author Navid Nikaein and Xenofon Foukas - * \date 2017 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_H_ -#define FLEXRAN_AGENT_H_ - -#include "flexran_agent_common.h" -#include "flexran_agent_async.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_phy.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_pdcp.h" -#include "flexran_agent_s1ap.h" -#include "flexran_agent_app.h" -#include "common/utils/LOG/log.h" -#include "assertions.h" - -/* Initiation of the eNodeB agent */ -int flexran_agent_start(mid_t mod_id); - -/* - * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller - * and can interact with other itti tasks -*/ -void *flexran_agent_task(void *args); - -#endif diff --git a/openair2/ENB_APP/flexran_agent_app.c b/openair2/ENB_APP/flexran_agent_app.c deleted file mode 100644 index 5bf06ca631..0000000000 --- a/openair2/ENB_APP/flexran_agent_app.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_app.c - * \brief CM for handling of applications - * \author Robert Schmidt - * \date 2020 - * \version 0.1 - */ - -#include "flexran_agent_app.h" -#include "queue.h" -#include - -/* app definition */ -typedef struct flexran_agent_app_internal_s { - char *name; - void *dl_handle; - flexran_agent_app_t *app; - - SLIST_ENTRY (flexran_agent_app_internal_s) entries; -} flexran_agent_app_internal_t; - -/* a list of all apps */ -SLIST_HEAD(flexran_apps_s, flexran_agent_app_internal_s) flexran_apps[NUM_MAX_ENB]; - -void flexran_agent_app_init(mid_t mod_id) { - //flexran_apps[mod_id] = SLIST_HEAD_INITIALIZER(flexran_apps[mod_id]); - SLIST_INIT(&flexran_apps[mod_id]); -} - -int flexran_agent_start_app_direct(mid_t mod_id, flexran_agent_app_t *app, char *name) { - app->start(mod_id, NULL, 0); - - flexran_agent_app_internal_t *so = malloc(sizeof(flexran_agent_app_internal_t)); - DevAssert(so); - so->name = strdup(name); - DevAssert(so->name); - so->dl_handle = NULL; - so->app = app; - SLIST_INSERT_HEAD(&flexran_apps[mod_id], so, entries); - return 0; -} - -int flexran_agent_start_app(mid_t mod_id, Protocol__FlexAgentReconfigurationSubsystem *sub) { - char s[512]; - int rc = flexran_agent_map_name_to_delegated_object(mod_id, sub->name, s, 512); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", sub->name); - return -1; - } - void *h = dlopen(s, RTLD_NOW); - if (!h) { - LOG_E(FLEXRAN_AGENT, "cannot open shared object %s\n", s); - return -1; - } - flexran_agent_app_t *app = dlsym(h, "app"); - if (!app) { - LOG_E(FLEXRAN_AGENT, "cannot locate app inside of shared object %s\n", s); - return -1; - } - app->start(mod_id, sub->params, sub->n_params); - - flexran_agent_app_internal_t *so = malloc(sizeof(flexran_agent_app_internal_t)); - DevAssert(so); - so->name = strdup(sub->name); - DevAssert(so->name); - so->dl_handle = h; - so->app = app; - SLIST_INSERT_HEAD(&flexran_apps[mod_id], so, entries); - - return 0; -} - -int flexran_agent_stop_app(mid_t mod_id, char *name) { - flexran_agent_app_internal_t *so = NULL; - SLIST_FOREACH(so, &flexran_apps[mod_id], entries) { - if (strcmp(so->name, name) == 0) { - LOG_I(FLEXRAN_AGENT, "application %s seems to be running\n", name); - break; - } - } - if (!so) { - LOG_E(FLEXRAN_AGENT, "no such application %s found\n", name); - return -1; - } - flexran_agent_app_t *app = so->app; - app->stop(mod_id); - - SLIST_REMOVE(&flexran_apps[mod_id], so, flexran_agent_app_internal_s, entries); - free(so->name); - if (so->dl_handle) - dlclose(so->dl_handle); - free(so); - so = NULL; - return 0; -} - -int flexran_agent_reconfig_app( - mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem *sub) -{ - flexran_agent_app_internal_t *so = NULL; - SLIST_FOREACH(so, &flexran_apps[mod_id], entries) { - if (strcmp(so->name, sub->name) == 0) { - LOG_I(FLEXRAN_AGENT, "application %s is running\n", sub->name); - break; - } - } - if (!so) { - LOG_E(FLEXRAN_AGENT, "no such application %s found\n", sub->name); - return -1; - } - flexran_agent_app_t *app = so->app; - LOG_I(FLEXRAN_AGENT, "reconfiguring app %s\n", so->name); - app->reconfig(mod_id, sub->params, sub->n_params); - return 0; -} - -int flexran_agent_custom_command_app( - mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem *sub) -{ - flexran_agent_app_internal_t *so = NULL; - SLIST_FOREACH(so, &flexran_apps[mod_id], entries) { - if (strcmp(so->name, sub->name) == 0) { - LOG_I(FLEXRAN_AGENT, "application %s is running\n", sub->name); - break; - } - } - if (!so) { - LOG_E(FLEXRAN_AGENT, "no such application %s found\n", sub->name); - return -1; - } - void (*cmd)(mid_t, Protocol__FlexAgentReconfigurationSubsystem *) = dlsym(so->dl_handle, sub->behavior); - if (!cmd) { - LOG_E(FLEXRAN_AGENT, - "cannot locate command %s inside of app %s\n", - sub->behavior, - so->name); - return -1; - } - - LOG_I(FLEXRAN_AGENT, - "calling command %s inside of app %s\n", - sub->behavior, - so->name); - (*cmd)(mod_id, sub); - return 0; -} - -void flexran_agent_handle_apps( - mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem **subs, - int n_subs) { - for (int i = 0; i < n_subs; ++i) { - Protocol__FlexAgentReconfigurationSubsystem *s = subs[i]; - if (strcmp(s->behavior, "start") == 0) { - int rc = flexran_agent_start_app(mod_id, s); - if (rc == 0) - LOG_I(FLEXRAN_AGENT, "application \"%s\" started\n", s->name); - } else if (strcmp(s->behavior, "stop") == 0) { - int rc = flexran_agent_stop_app(mod_id, s->name); - if (rc == 0) - LOG_I(FLEXRAN_AGENT, "application \"%s\" stopped\n", s->name); - } else if (strcmp(s->behavior, "reconfig") == 0) { - flexran_agent_reconfig_app(mod_id, s); - } else { - flexran_agent_custom_command_app(mod_id, s); - } - } -} - -void flexran_agent_fill_loaded_apps(mid_t mod_id, - Protocol__FlexEnbConfigReply *reply) { - int n = 0; - flexran_agent_app_internal_t *so = NULL; - SLIST_FOREACH(so, &flexran_apps[mod_id], entries) - ++n; - reply->n_loadedapps = n; - reply->loadedapps = calloc(n, sizeof(char *)); - if (!reply->loadedapps) { - reply->n_loadedapps = 0; - return; - } - n = 0; - SLIST_FOREACH(so, &flexran_apps[mod_id], entries) - reply->loadedapps[n++] = so->name; -} diff --git a/openair2/ENB_APP/flexran_agent_app.h b/openair2/ENB_APP/flexran_agent_app.h deleted file mode 100644 index 4723b344bf..0000000000 --- a/openair2/ENB_APP/flexran_agent_app.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_app.h - * \brief Common app definitions - * \author Robert Schmidt - * \date 2020 - * \version 0.1 - */ - -#ifndef BURST_ANALYSIS_LL_H_ -#define BURST_ANALYSIS_LL_H_ - -#include "flexran_agent_common.h" -#include "flexran_agent_async.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_phy.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_pdcp.h" -#include "flexran_agent_s1ap.h" -#include "common/utils/LOG/log.h" -#include "assertions.h" - -/* App type: to be implemented by shared libraries */ -typedef struct { - int (*start)(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p); - int (*reconfig)(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p); - int (* stop)(mid_t mod_id); -} flexran_agent_app_t; - -/* FlexRAN agent app handling init */ -void flexran_agent_app_init(mid_t mod_id); - -/* Start an app from within the agent */ -int flexran_agent_start_app_direct(mid_t mod_id, flexran_agent_app_t *app, char *name); - -/* FlexRAN agent handler to setup/teardown apps */ -void flexran_agent_handle_apps( - mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem **subs, - int n_subs); - -/* Fills the enb_config_reply with the currently loaded (started) apps */ -void flexran_agent_fill_loaded_apps(mid_t mod_id, - Protocol__FlexEnbConfigReply *reply); - -#endif diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c deleted file mode 100644 index 26c0d93259..0000000000 --- a/openair2/ENB_APP/flexran_agent_async.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_async.c - * \brief channel implementation for async interface - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#include "flexran_agent_async.h" -#include "flexran_agent_defs.h" - -#include "common/utils/LOG/log.h" - -flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { - - flexran_agent_async_channel_t *channel; - channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); - - if (channel == NULL) { - LOG_E(FLEXRAN_AGENT, "could not allocate memory for flexran_agent_async_channel_t\n"); - return NULL; - } - - channel->enb_id = mod_id; - /*Create a socket*/ - channel->link = new_link_client(dst_ip, dst_port); - if (channel->link == NULL) { - LOG_E(FLEXRAN_AGENT, "could not create new link client\n"); - goto error; - } - - LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - channel->enb_id, - dst_ip, - dst_port); - - /* - * create a message queue - */ - // Set size of queues statically for now -// channel->send_queue = new_message_queue(500); - // not using the circular buffer: affects the PDCP split - channel->send_queue = new_message_queue(); - if (channel->send_queue == NULL) { - LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); - goto error; - } - // not using the circular buffer: affects the PDCP split - //channel->receive_queue = new_message_queue(500); - channel->receive_queue = new_message_queue(); - if (channel->receive_queue == NULL) { - LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); - goto error; - } - - /* create a link manager */ - channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); - if (channel->manager == NULL) { - LOG_E(FLEXRAN_AGENT, "could not create link_manager\n"); - goto error; - } - - return channel; - - error: - LOG_I(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); - if (channel){ - free(channel); - } - return NULL; -} - -int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - flexran_agent_async_channel_t *channel; - channel = (flexran_agent_async_channel_t *)channel_info; - - return message_put(channel->send_queue, data, size, priority); -} - -int flexran_agent_async_msg_recv(void **data, int *priority, void *channel_info) { - flexran_agent_async_channel_t *channel; - channel = (flexran_agent_async_channel_t *)channel_info; - - return message_get(channel->receive_queue, data, priority); -} - -void flexran_agent_async_release(flexran_agent_channel_t *channel) { - flexran_agent_async_channel_t *channel_info; - channel_info = (flexran_agent_async_channel_t *) channel->channel_info; - - destroy_link_manager(channel_info->manager); - - destroy_message_queue(channel_info->send_queue); - destroy_message_queue(channel_info->receive_queue); - - close_link(channel_info->link); - free(channel_info); -} diff --git a/openair2/ENB_APP/flexran_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h deleted file mode 100644 index 1ebc565f62..0000000000 --- a/openair2/ENB_APP/flexran_agent_async.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_async.h - * \brief channel implementation for async interface - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_ASYNC_H_ -#define FLEXRAN_AGENT_ASYNC_H_ - -#include "flexran_agent_net_comm.h" - -typedef struct { - mid_t enb_id; - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; -} flexran_agent_async_channel_t; - -/* Create a new channel for a given destination ip and destination port */ -flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); - -/* Send a message to the given channel */ -int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info); - -/* Receive a message from a given channel */ -int flexran_agent_async_msg_recv(void **data, int *priority, void *channel_info); - -/* Release a channel */ -void flexran_agent_async_release(flexran_agent_channel_t *channel); - - -#endif /*FLEXRAN_AGENT_ASYNC_H_*/ diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c deleted file mode 100644 index 55a1c61b25..0000000000 --- a/openair2/ENB_APP/flexran_agent_common.c +++ /dev/null @@ -1,1042 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_common.c - * \brief common primitives for all agents - * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein - * \date 2017 - * \version 0.1 - */ - -#include -#include -#include -#include -#include -#include - -#include "flexran_agent_common.h" -#include "flexran_agent_common_internal.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_phy.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_s1ap.h" -#include "flexran_agent_app.h" -//#include "PHY/extern.h" -#include "common/utils/LOG/log.h" -#include "flexran_agent_mac_internal.h" -#include "flexran_agent_rrc_internal.h" - -//#include "SCHED/defs.h" -#include "RRC/LTE/rrc_extern.h" -#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "rrc_eNB_UE_context.h" - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -/* - * message primitives - */ - -int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { - *size = protocol__flexran_message__get_packed_size(msg); - - if (buf == NULL) - goto error; - - *buf = malloc(*size); - - if (*buf == NULL) - goto error; - - protocol__flexran_message__pack(msg, *buf); - return 0; -error: - LOG_E(FLEXRAN_AGENT, "an error occured\n"); // change the com - return -1; -} - - - -/* We assume that the buffer size is equal to the message size. - Should be chekced durint Tx/Rx */ -int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { - *msg = protocol__flexran_message__unpack(NULL, size, data); - - if (*msg == NULL) - goto error; - - return 0; -error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - - -int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { - *header = malloc(sizeof(Protocol__FlexHeader)); - - if(*header == NULL) - goto error; - - protocol__flex_header__init(*header); - (*header)->version = FLEXRAN_VERSION; - (*header)->has_version = 1; - // check if the type is set - (*header)->type = type; - (*header)->has_type = 1; - (*header)->xid = xid; - (*header)->has_xid = 1; - return 0; -error: - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - /*TODO: Need to set random xid or xid from received hello message*/ - xid_t xid = 1; - Protocol__FlexHello *hello_msg; - hello_msg = malloc(sizeof(Protocol__FlexHello)); - - if(hello_msg == NULL) - goto error; - - protocol__flex_hello__init(hello_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) - goto error; - - hello_msg->header = header; - hello_msg->bs_id = flexran_get_bs_id(mod_id); - hello_msg->has_bs_id = 1; - hello_msg->n_capabilities = flexran_get_capabilities(mod_id, &hello_msg->capabilities); - hello_msg->n_splits = flexran_get_splits(mod_id, &hello_msg->splits); - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - (*msg)->hello_msg = hello_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(hello_msg != NULL) - free(hello_msg); - - if(*msg != NULL) - free(*msg); - - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG) - goto error; - - free(msg->hello_msg->header); - free(msg->hello_msg->capabilities); - free(msg->hello_msg->splits); - free(msg->hello_msg); - free(msg); - return 0; -error: - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - /*TODO: Need to set a random xid*/ - xid_t xid = 1; - Protocol__FlexEchoRequest *echo_request_msg = NULL; - echo_request_msg = malloc(sizeof(Protocol__FlexEchoRequest)); - - if(echo_request_msg == NULL) - goto error; - - protocol__flex_echo_request__init(echo_request_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) - goto error; - - echo_request_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->echo_request_msg = echo_request_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(echo_request_msg != NULL) - free(echo_request_msg); - - if(*msg != NULL) - free(*msg); - - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) - goto error; - - free(msg->echo_request_msg->header); - free(msg->echo_request_msg); - free(msg); - return 0; -error: - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - - -int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - xid_t xid; - Protocol__FlexHeader *header = NULL; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexEchoRequest *echo_req = input->echo_request_msg; - xid = (echo_req->header)->xid; - Protocol__FlexEchoReply *echo_reply_msg = NULL; - echo_reply_msg = malloc(sizeof(Protocol__FlexEchoReply)); - - if(echo_reply_msg == NULL) - goto error; - - protocol__flex_echo_reply__init(echo_reply_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) - goto error; - - echo_reply_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->has_msg_dir = 1; - (*msg)->echo_reply_msg = echo_reply_msg; - return 0; -error: - - if(header != NULL) - free(header); - - if(echo_reply_msg != NULL) - free(echo_reply_msg); - - if(*msg != NULL) - free(*msg); - - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG) - goto error; - - free(msg->echo_reply_msg->header); - free(msg->echo_reply_msg); - free(msg); - return 0; -error: - LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) - goto error; - - free(msg->enb_config_reply_msg->header); - Protocol__FlexEnbConfigReply *reply = msg->enb_config_reply_msg; - - for (int i = 0; i < reply->n_cell_config; i++) { - if (reply->cell_config[i]->mbsfn_subframe_config_rfoffset) - free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); - - if (reply->cell_config[i]->mbsfn_subframe_config_rfperiod) - free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); - - if (reply->cell_config[i]->mbsfn_subframe_config_sfalloc) - free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); - - /* si_config is shared between MAC and RRC, free here */ - if (reply->cell_config[i]->si_config) { - for(int j = 0; j < reply->cell_config[i]->si_config->n_si_message; j++) { - free(reply->cell_config[i]->si_config->si_message[j]); - } - - free(reply->cell_config[i]->si_config->si_message); - free(reply->cell_config[i]->si_config); - } - - if (reply->cell_config[i]->slice_config) { - flexran_agent_destroy_mac_slice_config(reply->cell_config[i]); - } - - free(reply->cell_config[i]); - } - - if (reply->s1ap) - flexran_agent_free_s1ap_cell_config(&reply->s1ap); - - if (reply->loadedapps) - free(reply->loadedapps); - - if (reply->loadedmacobjects) - free(reply->loadedmacobjects); - - free(reply->cell_config); - free(reply); - free(msg); - return 0; -error: - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) - goto error; - - free(msg->ue_config_reply_msg->header); - int i; - Protocol__FlexUeConfigReply *reply = msg->ue_config_reply_msg; - - for(i = 0; i < reply->n_ue_config; i++) { - free(reply->ue_config[i]->capabilities); - free(reply->ue_config[i]); - } - - free(reply->ue_config); - free(reply); - free(msg); - return 0; -error: - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) - goto error; - - int i, j; - free(msg->lc_config_reply_msg->header); - - for (i = 0; i < msg->lc_config_reply_msg->n_lc_ue_config; i++) { - for (j = 0; j < msg->lc_config_reply_msg->lc_ue_config[i]->n_lc_config; j++) { - free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config[j]); - } - - free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config); - free(msg->lc_config_reply_msg->lc_ue_config[i]); - } - - free(msg->lc_config_reply_msg->lc_ue_config); - free(msg->lc_config_reply_msg); - free(msg); - return 0; -error: - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) - goto error; - - free(msg->enb_config_request_msg->header); - free(msg->enb_config_request_msg); - free(msg); - return 0; -error: - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated UE config message */ - return 0; -} - -int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated LC config message */ - return 0; -} - -// call this function to start a nanosecond-resolution timer -struct timespec timer_start(void) { - struct timespec start_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); - return start_time; -} - -// call this function to end a timer, returning nanoseconds elapsed as a long -long timer_end(struct timespec start_time) { - struct timespec end_time; - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); - long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; - return diffInNanos; -} - -int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg; - *msg = NULL; - - char target[512]; - int len = snprintf(target, sizeof(target), "%s/libflex.%s.so", - RC.flexran[mod_id]->cache_name, - control_delegation_msg->name); - if (len >= sizeof(target)) { - LOG_E(FLEXRAN_AGENT, "target has been truncated, cannot write file name\n"); - return 0; - } - - if (control_delegation_msg->has_payload) { - /* use low-level API: check whether exists while creating so we can abort if - * it exists to not overwrite anything */ - int fd = open(target, O_CREAT | O_WRONLY | O_EXCL, S_IRUSR | S_IWUSR); - if (fd >= 0) { - ssize_t l = write(fd, - control_delegation_msg->payload.data, - control_delegation_msg->payload.len); - close(fd); - if (l < control_delegation_msg->payload.len) { - LOG_E(FLEXRAN_AGENT, - "could not write complete control delegation to %s: only %ld out of " - "%ld bytes\n", - target, - l, - control_delegation_msg->payload.len); - return 0; - } else if (l < 0) { - LOG_E(FLEXRAN_AGENT, "can not write control delegation data to %s: %s\n", - target, strerror(errno)); - return 0; - } - LOG_I(FLEXRAN_AGENT, "wrote shared object %s\n", target); - } else { - if (errno == EEXIST) { - LOG_W(FLEXRAN_AGENT, "file %s already exists, remove it first\n", target); - } else { - LOG_E(FLEXRAN_AGENT, "can not write control delegation data to %s: %s\n", - target, strerror(errno)); - } - return 0; - } - } else { - LOG_W(FLEXRAN_AGENT, "remove file %s\n", target); - int rc = remove(target); - if (rc < 0) - LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", target, strerror(errno)); - } - - if (control_delegation_msg->has_delegation_type - && control_delegation_msg->delegation_type == PROTOCOL__FLEX_CONTROL_DELEGATION_TYPE__FLCDT_MAC_DL_UE_SCHEDULER - && control_delegation_msg->header - && control_delegation_msg->header->has_xid) { - /* Inform the MAC subsystem that a control delegation for it has arrived */ - /* TODO this should be triggered by an agent reconfiguration? */ - flexran_agent_mac_inform_delegation(mod_id, control_delegation_msg); - } - - return 0; -} - -int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { - /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ - return 0; -} - -int flexran_agent_map_name_to_delegated_object(mid_t mod_id, const char *name, - char *path, int maxlen) { - int len = snprintf(path, maxlen, "%s/libflex.%s.so", - RC.flexran[mod_id]->cache_name, name); - if (len >= maxlen) { - LOG_E(FLEXRAN_AGENT, "path has been truncated, cannot read object\n"); - return -1; - } - - struct stat buf; - int status = stat(path, &buf); - if (status < 0) { - LOG_E(FLEXRAN_AGENT, "Could not stat object %s: %s\n", path, strerror(errno)); - return -1; - } - return 0; -} - -int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; - if (agent_reconfiguration_msg->policy) { - /* for compatibility: call old YAML configuration code, although we don't - * use it anymore */ - apply_reconfiguration_policy(mod_id, - agent_reconfiguration_msg->policy, - strlen(agent_reconfiguration_msg->policy)); - } - for (int i = 0; i < agent_reconfiguration_msg->n_systems; ++i) { - const Protocol__FlexAgentReconfigurationSystem *sys = agent_reconfiguration_msg->systems[i]; - if (strcmp(sys->system, "app") == 0) { - flexran_agent_handle_apps(mod_id, sys->subsystems, sys->n_subsystems); - } else { - LOG_E(FLEXRAN_AGENT, - "unknown system name %s in flex_agent_reconfiguration message\n", - sys->system); - } - } - *msg = NULL; - return 0; -} - -int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { - /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ - return 0; -} - -int flexran_agent_destroy_control_delegation_request(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DEL_REQ_MSG) - return -1; - - free(msg->control_del_req_msg->header); - free(msg->control_del_req_msg->name); - free(msg); - return 0; -} - -int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - xid_t xid; - Protocol__FlexHeader *header = NULL; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; - xid = (lc_config_request_msg->header)->xid; - Protocol__FlexLcConfigReply *lc_config_reply_msg; - lc_config_reply_msg = malloc(sizeof(Protocol__FlexLcConfigReply)); - - if(lc_config_reply_msg == NULL) - goto error; - - protocol__flex_lc_config_reply__init(lc_config_reply_msg); - - if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) - goto error; - - lc_config_reply_msg->header = header; - /* the lc_config_reply entirely depends on MAC except for the - * mac_eNB_get_rrc_status() function (which in the current OAI implementation - * is reachable if F1 is present). Therefore we check here wether MAC CM is - * present and the message gets properly filled if it is or remains empty if - * not */ - lc_config_reply_msg->n_lc_ue_config = - flexran_agent_get_mac_xface(mod_id) ? flexran_get_mac_num_ues(mod_id) : 0; - Protocol__FlexLcUeConfig **lc_ue_config = NULL; - - if (lc_config_reply_msg->n_lc_ue_config > 0) { - lc_ue_config = malloc(sizeof(Protocol__FlexLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); - - if (lc_ue_config == NULL) { - goto error; - } - - // Fill the config for each UE - for (int i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { - lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); - if (!lc_ue_config[i]){ - for (int j = 0; j < i; j++){ - free(lc_ue_config[j]); - } - free(lc_ue_config); - goto error; - } - - protocol__flex_lc_ue_config__init(lc_ue_config[i]); - const int UE_id = flexran_get_mac_ue_id(mod_id, i); - flexran_agent_fill_mac_lc_ue_config(mod_id, UE_id, lc_ue_config[i]); - } // end for UE - - lc_config_reply_msg->lc_ue_config = lc_ue_config; - } // lc_config_reply_msg->n_lc_ue_config > 0 - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if (*msg == NULL){ - for (int k = 0; k < lc_config_reply_msg->n_lc_ue_config; k++){ - free(lc_ue_config[k]); - } - free(lc_ue_config); - goto error; - } - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->lc_config_reply_msg = lc_config_reply_msg; - return 0; -error: - - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - - if (lc_config_reply_msg != NULL) - free(lc_config_reply_msg); - - if(*msg != NULL) - free(*msg); - - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -/* - * ************************************ - * UE Configuration Reply - * ************************************ - */ - -int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - xid_t xid; - Protocol__FlexHeader *header = NULL; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; - xid = (ue_config_request_msg->header)->xid; - Protocol__FlexUeConfigReply *ue_config_reply_msg; - ue_config_reply_msg = malloc(sizeof(Protocol__FlexUeConfigReply)); - - if(ue_config_reply_msg == NULL) - goto error; - - protocol__flex_ue_config_reply__init(ue_config_reply_msg); - - if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) - goto error; - - ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = flexran_agent_get_num_ues(mod_id); - - Protocol__FlexUeConfig **ue_config; - - if (ue_config_reply_msg->n_ue_config > 0) { - ue_config = malloc(sizeof(Protocol__FlexUeConfig *) * ue_config_reply_msg->n_ue_config); - - if (ue_config == NULL) { - goto error; - } - - rnti_t rntis[ue_config_reply_msg->n_ue_config]; - flexran_get_rrc_rnti_list(mod_id, rntis, ue_config_reply_msg->n_ue_config); - - for (int i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - const rnti_t rnti = rntis[i]; - ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); - protocol__flex_ue_config__init(ue_config[i]); - - if (flexran_agent_get_rrc_xface(mod_id)) - flexran_agent_fill_rrc_ue_config(mod_id, rnti, ue_config[i]); - - if (flexran_agent_get_mac_xface(mod_id)) { - const int UE_id = flexran_get_mac_ue_id_rnti(mod_id, rnti); - flexran_agent_fill_mac_ue_config(mod_id, UE_id, ue_config[i]); - } - } - - ue_config_reply_msg->ue_config = ue_config; - } - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if (*msg == NULL) - goto error; - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->ue_config_reply_msg = ue_config_reply_msg; - return 0; -error: - - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - - if (ue_config_reply_msg != NULL) - free(ue_config_reply_msg); - - if(*msg != NULL) - free(*msg); - - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -/* - * ************************************ - * eNB Configuration Request and Reply - * ************************************ - */ - -int flexran_agent_enb_config_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - xid_t xid = 1; - Protocol__FlexEnbConfigRequest *enb_config_request_msg; - enb_config_request_msg = malloc(sizeof(Protocol__FlexEnbConfigRequest)); - - if(enb_config_request_msg == NULL) - goto error; - - protocol__flex_enb_config_request__init(enb_config_request_msg); - - if(flexran_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) - goto error; - - enb_config_request_msg->header = header; - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if(*msg == NULL) - goto error; - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->enb_config_request_msg = enb_config_request_msg; - return 0; -error: - - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - - if (enb_config_request_msg != NULL) - free(enb_config_request_msg); - - if(*msg != NULL) - free(*msg); - - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - xid_t xid; - Protocol__FlexHeader *header = NULL; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; - xid = (enb_config_req_msg->header)->xid; - Protocol__FlexEnbConfigReply *enb_config_reply_msg; - enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); - - if(enb_config_reply_msg == NULL) - goto error; - - protocol__flex_enb_config_reply__init(enb_config_reply_msg); - - if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) - goto error; - - enb_config_reply_msg->header = header; - enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; - Protocol__FlexCellConfig **cell_conf; - - if(enb_config_reply_msg->n_cell_config > 0) { - cell_conf = malloc(sizeof(Protocol__FlexCellConfig *) * enb_config_reply_msg->n_cell_config); - - if(cell_conf == NULL) - goto error; - - for(int i = 0; i < enb_config_reply_msg->n_cell_config; i++) { - cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); - - if (!cell_conf[i]) { - for (int j = 0; j < i; j++) { - free(cell_conf[j]); - } - free(cell_conf); - goto error; - } - - protocol__flex_cell_config__init(cell_conf[i]); - - if (flexran_agent_get_phy_xface(mod_id)) - flexran_agent_fill_phy_cell_config(mod_id, i, cell_conf[i]); - - if (flexran_agent_get_rrc_xface(mod_id)) - flexran_agent_fill_rrc_cell_config(mod_id, i, cell_conf[i]); - - if (flexran_agent_get_mac_xface(mod_id)) - flexran_agent_fill_mac_cell_config(mod_id, i, cell_conf[i]); - - cell_conf[i]->carrier_index = i; - cell_conf[i]->has_carrier_index = 1; - } - - enb_config_reply_msg->cell_config=cell_conf; - } - - if (flexran_agent_get_s1ap_xface(mod_id)) - flexran_agent_fill_s1ap_cell_config(mod_id, &enb_config_reply_msg->s1ap); - - flexran_agent_fill_loaded_apps(mod_id, enb_config_reply_msg); - - flexran_agent_mac_fill_loaded_mac_objects(mod_id, enb_config_reply_msg); - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - - if(*msg == NULL) { - for (int k = 0; k < enb_config_reply_msg->n_cell_config; k++) { - free(cell_conf[k]); - } - free(cell_conf); - goto error; - } - - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->enb_config_reply_msg = enb_config_reply_msg; - return 0; -error: - - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - - if (enb_config_reply_msg != NULL) - free(enb_config_reply_msg); - - if(*msg != NULL) - free(*msg); - - //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); - return -1; -} - - -int flexran_agent_rrc_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexRrcTriggering *triggering = input->rrc_triggering; - // Set the proper values using FlexRAN API (protected with mutex ?) - if (!flexran_agent_get_rrc_xface(mod_id)) { - LOG_E(FLEXRAN_AGENT, "%s(): no RRC present, aborting\n", __func__); - return -1; - } - - int num_ue = flexran_get_rrc_num_ues(mod_id); - if (num_ue == 0) - return 0; - - rnti_t rntis[num_ue]; - flexran_get_rrc_rnti_list(mod_id, rntis, num_ue); - for (int i = 0; i < num_ue; i++) { - const rnti_t rnti = rntis[i]; - const int error = update_rrc_reconfig(mod_id, rnti, triggering); - if (error < 0) { - LOG_E(FLEXRAN_AGENT, "Error in updating user %d\n", i); - continue; - } - // Call the proper wrapper in FlexRAN API - if (flexran_call_rrc_reconfiguration (mod_id, rnti) < 0) { - LOG_E(FLEXRAN_AGENT, "Error in reconfiguring user %d\n", i); - } - } - - *msg = NULL; - return 0; -} - -int flexran_agent_rrc_trigger_handover(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexHoCommand *ho_command = input->ho_command_msg; - - int rnti_found = 0; - - // Set the proper values using FlexRAN API (protected with mutex ?) - if (!flexran_agent_get_rrc_xface(mod_id)) { - LOG_E(FLEXRAN_AGENT, "%s(): no RRC present, aborting\n", __func__); - return -1; - } - - int num_ue = flexran_get_rrc_num_ues(mod_id); - if (num_ue == 0) - return 0; - - if (!ho_command->has_rnti) { - LOG_E(FLEXRAN_AGENT, "%s(): no UE rnti is present, aborting\n", __func__); - return -1; - } - - if (!ho_command->has_target_phy_cell_id) { - LOG_E(FLEXRAN_AGENT, "%s(): no target physical cell id is present, aborting\n", __func__); - return -1; - } - - rnti_t rntis[num_ue]; - flexran_get_rrc_rnti_list(mod_id, rntis, num_ue); - for (int i = 0; i < num_ue; i++) { - const rnti_t rnti = rntis[i]; - if (ho_command->rnti == rnti) { - rnti_found = 1; - // Call the proper wrapper in FlexRAN API - if (flexran_call_rrc_trigger_handover(mod_id, ho_command->rnti, ho_command->target_phy_cell_id) < 0) { - LOG_E(FLEXRAN_AGENT, "Error in handovering user %d/RNTI %x\n", i, rnti); - } - break; - } - } - - if (!rnti_found) - return -1; - - *msg = NULL; - return 0; -} - -int flexran_agent_destroy_rrc_reconfiguration(Protocol__FlexranMessage *msg) { - // TODO - return 0; -} - -int flexran_agent_destroy_rrc_trigger_handover(Protocol__FlexranMessage *msg) { - // TODO - return 0; -} - -int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexEnbConfigReply *enb_config = input->enb_config_reply_msg; - - if (enb_config->n_cell_config > 1) - LOG_W(FLEXRAN_AGENT, "ignoring slice configs for other cell except cell 0\n"); - - if (enb_config->n_cell_config > 0) { - if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) { - prepare_update_slice_config(mod_id, - &enb_config->cell_config[0]->slice_config, - 1 /* request objects if necessary */); - } - if (enb_config->cell_config[0]->has_eutra_band - && enb_config->cell_config[0]->has_dl_freq - && enb_config->cell_config[0]->has_ul_freq - && enb_config->cell_config[0]->has_dl_bandwidth) { - initiate_soft_restart(mod_id, enb_config->cell_config[0]); - } - if (flexran_agent_get_rrc_xface(mod_id) - && enb_config->cell_config[0]->has_x2_ho_net_control) { - LOG_I(FLEXRAN_AGENT, - "setting X2 HO NetControl to %d\n", - enb_config->cell_config[0]->x2_ho_net_control); - const int rc = flexran_set_x2_ho_net_control(mod_id, enb_config->cell_config[0]->x2_ho_net_control); - if (rc < 0) - LOG_E(FLEXRAN_AGENT, "Error in configuring X2 handover controlled by network"); - } - if (flexran_agent_get_rrc_xface(mod_id) && enb_config->cell_config[0]->n_plmn_id > 0) { - flexran_agent_handle_plmn_update(mod_id, - 0, - enb_config->cell_config[0]->n_plmn_id, - enb_config->cell_config[0]->plmn_id); - } - } - - if (flexran_agent_get_s1ap_xface(mod_id) && enb_config->s1ap) { - flexran_agent_handle_mme_update(mod_id, - enb_config->s1ap->n_mme, - enb_config->s1ap->mme); - } - - *msg = NULL; - return 0; -} - -int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - int i; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexUeConfigReply *ue_config_reply = input->ue_config_reply_msg; - - for (i = 0; flexran_agent_get_mac_xface(mod_id) && i < ue_config_reply->n_ue_config; i++) - prepare_ue_slice_assoc_update(mod_id, &ue_config_reply->ue_config[i]); - /* prepare_ue_slice_assoc_update takes ownership of the individual - * FlexUeConfig messages. Therefore, mark zero messages to not accidentally - * free them twice */ - ue_config_reply->n_ue_config = 0; - - *msg = NULL; - return 0; -} - -int flexran_agent_get_num_ues(mid_t mod_id) { - const int has_rrc = flexran_agent_get_rrc_xface(mod_id) != NULL; - const int has_mac = flexran_agent_get_mac_xface(mod_id) != NULL; - DevAssert(has_rrc || has_mac); - if (has_rrc && !has_mac) - return flexran_get_rrc_num_ues(mod_id); - if (!has_rrc && has_mac) - return flexran_get_mac_num_ues(mod_id); - - /* has both */ - const int nrrc = flexran_get_rrc_num_ues(mod_id); - const int nmac = flexran_get_mac_num_ues(mod_id); - if (nrrc != nmac) { - const int n_ue = nrrc < nmac ? nrrc : nmac; - LOG_E(FLEXRAN_AGENT, "%s(): different numbers of UEs in RRC (%d) and MAC (%d), reporting for %d UEs\n", - __func__, nrrc, nmac, n_ue); - return n_ue; - } - return nrrc; -} diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h deleted file mode 100644 index 18d32421dd..0000000000 --- a/openair2/ENB_APP/flexran_agent_common.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_common.h - * \brief common message primitves and utilities - * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - - - -#ifndef FLEXRAN_AGENT_COMMON_H_ -#define FLEXRAN_AGENT_COMMON_H_ - -#include - -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "stats_messages.pb-c.h" -#include "stats_common.pb-c.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_defs.h" -#include "enb_config.h" - -#include "LAYER2/RLC/rlc.h" - -# include "tree.h" -# include "intertask_interface.h" - -#define FLEXRAN_VERSION 0 - -typedef int (*flexran_agent_message_decoded_callback)( - mid_t mod_id, - const void *params, - Protocol__FlexranMessage **msg -); - -typedef int (*flexran_agent_message_destruction_callback)( - Protocol__FlexranMessage *msg -); - -typedef struct { - - uint8_t is_initialized; - volatile uint8_t cont_update; - xid_t xid; - Protocol__FlexranMessage *stats_req; - Protocol__FlexranMessage *prev_stats_reply; - - pthread_mutex_t *mutex; -} stats_updates_context_t; - - -/********************************** - * FlexRAN protocol messages helper - * functions and generic handlers - **********************************/ - -/* Helper functions for message (de)serialization */ -int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); -int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); - -/* Serialize message and then destroy the input flexran msg. Should be called when protocol - message is created dynamically */ -void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, - int * size); - -/* Calls destructor of the given message */ -err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); - -/* Function to create the header for any FlexRAN protocol message */ -int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); - -/* Hello protocol message constructor and destructor */ -int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg); - -/* Echo request protocol message constructor and destructor */ -int flexran_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg); - -/* Echo reply protocol message constructor and destructor */ -int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); - -/* eNodeB configuration reply message constructor and destructor */ -int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); - -/* UE configuration reply message constructor and destructor */ -int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); - -/* Logical channel reply configuration message constructor and destructor */ -int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); - -/* eNodeB configuration request message constructor and destructor */ -int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); - -/* UE configuration request message constructor */ -/* TODO: Need to define and implement destructor */ -int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); - -/* Logical channel configuration request message constructor */ -/* TODO: Need to define and implement destructor */ -int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); - -/* Control delegation message constructor and destructor */ -int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); -/* Map a name from a control_delegation message to a file name. The function - * stat()s the file to check existence and returns the complete path name in - * path. The length in path needs to be maxlen, the maximum length the path may - * have. */ -int flexran_agent_map_name_to_delegated_object(mid_t mod_id, const char *name, - char *path, int maxlen); - -/* Policy reconfiguration message constructor and destructor */ -int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); - -/* Policy reconfiguration request message destructor */ -int flexran_agent_destroy_control_delegation_request(Protocol__FlexranMessage *msg); - -/* rrc triggering measurement message constructor and destructor */ -int flexran_agent_rrc_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_rrc_reconfiguration(Protocol__FlexranMessage *msg); - -/* rrc triggering handover command message constructor and destructor */ -int flexran_agent_rrc_trigger_handover(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_rrc_trigger_handover(Protocol__FlexranMessage *msg); - -/* FlexRAN protocol message dispatcher function */ -Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, - uint8_t *data, - uint32_t size); - -/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ -Protocol__FlexranMessage *flexran_agent_handle_timed_task( - mid_t mod_id, - Protocol__FlexranMessage *msg); - -/*Top level Statistics hanlder*/ -Protocol__FlexranMessage *flexran_agent_send_stats_reply( - mid_t mod_id, - const Protocol__FlexranMessage *msg); - -int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - -/* Function to be used to handle reply message . */ -int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const Protocol__FlexStatsRequest *stats_req, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg); - -/* Top level Statistics request protocol message constructor and destructor */ -//int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); -int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg); - -/* Handle a received eNB config reply message as an "order" to reconfigure. It - * does not come as a reconfiguration message as this is a "structured" - * ProtoBuf message (as opposed to "unstructured" YAML). There is no destructor - * since we do not reply to this message (yet). Instead, the controller has to - * issue another eNB config request message. */ -int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); - -/* Handle a received UE config reply message as an "order" to reconfigure the - * association of a UE to a slice. It does not come as a reconfiguration - * message as this is a "structured" ProtoBuf message (as opposed to - * "unstructured" YAML). There is no destructor since we do not reply to this - * message (yet). Instead, the controller has to issue another eNB config - * request message. */ -int flexran_agent_handle_ue_config_reply(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); - -/* Return the number of UEs in the BS of this agent across RRC/MAC. If they - * disagree, prints an error and returns the minimum of both. */ -int flexran_agent_get_num_ues(mid_t mod_id); - -#endif diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c deleted file mode 100644 index a893982824..0000000000 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ /dev/null @@ -1,570 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_common_internal.c - * \brief internal functions for common message primitves and utilities - * \author Xenofon Foukas and N. Nikaein - * \date 2017 - * \version 0.1 - */ - -#include -#include - -#include "flexran_agent_common_internal.h" -#include "flexran_agent_mac_internal.h" -#include "enb_app.h" - -int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { - - yaml_parser_t parser; - yaml_event_t event; - - int done = 0; - - LOG_I(ENB_APP, "Time to apply a new policy \n"); - - yaml_parser_initialize(&parser); - - yaml_parser_set_input_string(&parser, (unsigned char *) policy, strlen(policy)); - - while (!done) { - if (!yaml_parser_parse(&parser, &event)) - goto error; - - switch (event.type) { - case YAML_STREAM_START_EVENT: - break; - case YAML_STREAM_END_EVENT: - break; - case YAML_DOCUMENT_START_EVENT: - break; - case YAML_DOCUMENT_END_EVENT: - break; - case YAML_MAPPING_START_EVENT: - break; - case YAML_MAPPING_END_EVENT: - break; - case YAML_SCALAR_EVENT: - // Check the system name and call the proper handler - // Check the system name and call the proper handler - if (strcmp((char *) event.data.scalar.value, "enb") == 0) { - LOG_I(ENB_APP, "This is intended for the enb system\n"); - // Call the enb handler - if (parse_enb_id(mod_id, &parser) == -1) { - LOG_E(ENB_APP, "cannot parse data for eNB\n"); - goto error; - } else { // succeful parse and setting - handle_reconfiguration(mod_id); - } - } else if (strcmp((char *) event.data.scalar.value, "mac") == 0) { - LOG_D(ENB_APP, "This is intended for the mac system\n"); - // Call the mac handler - if (parse_mac_config(mod_id, &parser) == -1) { - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "rlc") == 0) { - // Call the RLC handler - LOG_D(ENB_APP, "This is intended for the rlc system\n"); - // TODO : Just skip it for now - if (skip_system_section(&parser) == -1) { - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "pdcp") == 0) { - // Call the PDCP handler - LOG_D(ENB_APP, "This is intended for the pdcp system\n"); - // TODO : Just skip it for now - if (skip_system_section(&parser) == -1) { - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "rrc") == 0) { - // Call the RRC handler - LOG_D(ENB_APP, "This is intended for the rrc system\n"); - // TODO : Just skip it for now - if (skip_system_section(&parser) == -1) { - goto error; - } - } else { - goto error; - } - break; - default: - // We are not expecting to find any other type of event at this level - // of the hierarchy - yaml_event_delete(&event); - goto error; - } - - done = (event.type == YAML_STREAM_END_EVENT); - - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_parser_delete(&parser); - return -1; - -} - -int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) { - yaml_event_t event; - - char *endptr; - // int is_array; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping of parameters - case YAML_SEQUENCE_START_EVENT: - // is_array = 1; - break; - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - // use eNB egistered - if (flexran_agent_get_mac_xface(mod_id)) { - LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value); - if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int - if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured - if (parse_enb_config_parameters(mod_id, parser) == -1) { - goto error; - } - } - else{ - goto error; // not the expected type - } - } - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) { - yaml_event_t event; - - char *endptr; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping of parameters - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (strcmp((char *) event.data.scalar.value, "dl_freq") == 0) { - if (!yaml_parser_parse(parser, &event)) - goto error; - flexran_agent_set_operating_dl_freq(mod_id, - 0, - strtol((char *) event.data.scalar.value, &endptr, 10)); - LOG_I(ENB_APP, "Setting dl_freq to %s\n", event.data.scalar.value); - } else if (strcmp((char *) event.data.scalar.value, "ul_freq_offset") == 0) { - if (!yaml_parser_parse(parser, &event)) - goto error; - flexran_agent_set_operating_ul_freq(mod_id, - 0, - strtol((char *) event.data.scalar.value, &endptr, 10)); - LOG_I(ENB_APP, "Setting ul_freq_offset to %s\n", event.data.scalar.value); - } else if (strcmp((char *) event.data.scalar.value, "bandwidth") == 0) { - if (!yaml_parser_parse(parser, &event)) - goto error; - flexran_agent_set_operating_bandwidth(mod_id, - 0, - strtol((char *) event.data.scalar.value, &endptr, 10)); - LOG_I(ENB_APP, "Setting bandwidth to %s\n", event.data.scalar.value); - } else if (strcmp((char *) event.data.scalar.value, "frame_type") == 0) { - if (!yaml_parser_parse(parser, &event)) - goto error; - flexran_agent_set_operating_frame_type (mod_id, - 0, - strtol((char *) event.data.scalar.value, &endptr, 10)); - LOG_I(ENB_APP, "Setting frame_type to %s\n", event.data.scalar.value); - }else { // not supported tag - LOG_E(FLEXRAN_AGENT, "Unsupported tag %s\n", event.data.scalar.value); - goto error; - } - - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int skip_system_section(yaml_parser_t *parser) { - yaml_event_t event; - - int done = 0; - - int sequence_started = 0; - int mapping_started = 0; - - while (!done) { - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - - case YAML_SEQUENCE_START_EVENT: - LOG_D(ENB_APP, "A sequence just started as expected\n"); - sequence_started = 1; - break; - case YAML_SEQUENCE_END_EVENT: - LOG_D(ENB_APP, "A sequence ended\n"); - sequence_started = 0; - break; - case YAML_MAPPING_START_EVENT: - if (!sequence_started) { - goto error; - } - LOG_D(ENB_APP, "A mapping started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - if (!mapping_started) { - goto error; - } - LOG_D(ENB_APP, "A mapping ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Entered a subsystem section. Let's skip it - if (skip_subsystem_section(parser) == -1) { - goto error; - } - default: - break; - } - done = (event.type == YAML_SEQUENCE_END_EVENT); - - yaml_event_delete(&event); - - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int skip_subsystem_section(yaml_parser_t *parser) { - - yaml_event_t event; - - int done = 0; - int mapping_started = 0; - - while (!done) { - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - if (strcmp((char *) event.data.scalar.value, "behavior") == 0) { - LOG_D(ENB_APP, "Skipping the behavior attribute\n"); - yaml_event_delete(&event); - if (!yaml_parser_parse(parser, &event)) { - goto error; - } - if (event.type == YAML_SCALAR_EVENT) { - break; - } else { - goto error; - } - } else if (strcmp((char *) event.data.scalar.value, "parameters") == 0) { - LOG_D(ENB_APP, "Skipping the parameters for this subsystem\n"); - if (skip_subsystem_parameters_config(parser) == -1) { - goto error; - } - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int skip_subsystem_parameters_config(yaml_parser_t *parser) { - yaml_event_t event; - - int done = 0; - int mapping_started = 0; - - while (!done) { - - if (!yaml_parser_parse(parser, &event)) - goto error; - - switch (event.type) { - // We are expecting a mapping of parameters - case YAML_MAPPING_START_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters started\n"); - mapping_started = 1; - break; - case YAML_MAPPING_END_EVENT: - LOG_D(ENB_APP, "The mapping of the parameters ended\n"); - mapping_started = 0; - break; - case YAML_SCALAR_EVENT: - if (!mapping_started) { - goto error; - } - // Check what key needs to be set - LOG_D(ENB_APP, "Skipping parameter %s\n", event.data.scalar.value); - if (skip_parameter_modification(parser) == -1 ) { - goto error; - } - break; - default: - goto error; - } - - done = (event.type == YAML_MAPPING_END_EVENT); - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - - -int skip_parameter_modification(yaml_parser_t *parser) { - yaml_event_t event; - - int done = 0; - int is_array = 0; - int i = 0; - - while (!done) { - if (!yaml_parser_parse(parser, &event)) { - goto error; - } - - // Expecting either a scalar or a sequence - switch (event.type) { - case YAML_SEQUENCE_START_EVENT: - is_array = 1; - break; - case YAML_SCALAR_EVENT: - if ((strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) || - (strcmp((char *) event.data.scalar.tag, YAML_FLOAT_TAG) == 0) || - (strcmp((char *) event.data.scalar.tag, YAML_STR_TAG) == 0) || - (strcmp((char *) event.data.scalar.tag, YAML_BOOL_TAG) == 0)) { - // Do nothing - } else { - // No other type is supported at the moment, so it should be considered an error - // if we reach here - goto error; - } - if (is_array) { - i++; - } else { - done = 1; - } - break; - case YAML_SEQUENCE_END_EVENT: - done = 1; - break; - default: - goto error; - } - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; -} - -int apply_parameter_modification(void *parameter, yaml_parser_t *parser) { - yaml_event_t event; - - int done = 0; - int is_array = 0; - int i = 0; - - char *endptr; - - while (!done) { - if (!yaml_parser_parse(parser, &event)) { - goto error; - } - - // Expecting either a scalar or a sequence - switch (event.type) { - case YAML_SEQUENCE_START_EVENT: - is_array = 1; - break; - case YAML_SCALAR_EVENT: - if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { - ((int *) parameter)[i] = strtol((char *) event.data.scalar.value, &endptr, 10); - } else if (strcmp((char *) event.data.scalar.tag, YAML_FLOAT_TAG) == 0) { - ((float *) parameter)[i] = strtof((char *) event.data.scalar.value, &endptr); - } else if (strcmp((char *) event.data.scalar.tag, YAML_STR_TAG) == 0) { - strncpy(&((char *) parameter)[i], (char *) event.data.scalar.value, event.data.scalar.length); - } else if (strcmp((char *) event.data.scalar.tag, YAML_BOOL_TAG) == 0) { - if (strcmp((char *) event.data.scalar.value, "true") == 0) { - ((int *) parameter)[i] = 1; - } else { - ((int *) parameter)[i] = 0; - } - } else { - // No other type is supported at the moment, so it should be considered an error - // if we reach here - goto error; - } - if (is_array) { - i++; - } else { - done = 1; - } - break; - case YAML_SEQUENCE_END_EVENT: - done = 1; - break; - default: - goto error; - } - yaml_event_delete(&event); - } - - return 0; - - error: - yaml_event_delete(&event); - return -1; - -} - -void initiate_soft_restart(module_id_t mod_id, Protocol__FlexCellConfig *c) -{ - const uint8_t cc_id = 0; - if (c->has_eutra_band) { - flexran_agent_set_operating_eutra_band(mod_id, cc_id, c->eutra_band); - LOG_I(ENB_APP, "Setting eutra_band to %d\n", c->eutra_band); - } - if (c->has_dl_freq && c->has_ul_freq) { - flexran_agent_set_operating_dl_freq(mod_id, cc_id, c->dl_freq); - LOG_I(ENB_APP, "Setting dl_freq to %d\n", c->dl_freq); - int32_t ul_freq_offset = c->ul_freq - c->dl_freq; - flexran_agent_set_operating_ul_freq(mod_id, cc_id, ul_freq_offset); - LOG_I(ENB_APP, "Setting ul_freq to %d\n", c->ul_freq); - } - if (c->has_dl_bandwidth) { - flexran_agent_set_operating_bandwidth(mod_id, cc_id, c->dl_bandwidth); - LOG_I(ENB_APP, "Setting bandwidth to %d\n", c->dl_bandwidth); - if (c->has_ul_bandwidth && c->ul_bandwidth != c->dl_bandwidth) - LOG_W(ENB_APP, "UL/DL bandwidth mismatch, applied DL bandwidth\n"); - } else if (c->has_ul_bandwidth) { - flexran_agent_set_operating_bandwidth(mod_id, cc_id, c->ul_bandwidth); - LOG_I(ENB_APP, "Setting bandwidth to %d\n", c->ul_bandwidth); - } - - MessageDef *msg; - msg = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, SOFT_RESTART_MESSAGE); - itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); -} diff --git a/openair2/ENB_APP/flexran_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h deleted file mode 100644 index 544321e228..0000000000 --- a/openair2/ENB_APP/flexran_agent_common_internal.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_common_internal.h - * \brief internal agent functions for common message primitves and utilities - * \author Xenofon Foukas and N. Nikaein - * \date 2017 - * \version 0.1 - */ - -#ifndef FLEXRAN_AGENT_COMMON_INTERNAL_H_ -#define FLEXRAN_AGENT_COMMON_INTERNAL_H_ - -#include - -#include "flexran_agent_defs.h" -#include "flexran.pb-c.h" - -int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length); - -int apply_parameter_modification(void *parameter, yaml_parser_t *parser); - -int parse_enb_id(mid_t mod_id, yaml_parser_t *parser); -int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) ; - - -// This can be used when parsing for a specific system that is not yet implmeneted -// in order to skip its configuration, without affecting the rest -int skip_system_section(yaml_parser_t *parser); - -// This can be used when parsing for a specific subsystem that is not yet implmeneted -// in order to skip its configuration, without affecting the rest -int skip_subsystem_section(yaml_parser_t *parser); - -// This can be used when parsing for the parameters of a specific subsystem -//that is not yet implmeneted in order to skip its configuration, without affecting the rest -int skip_subsystem_parameters_config(yaml_parser_t *parser); - -// This can be used when configuring the parameters of a specific subsystem -//that is not yet implmeneted in order to skip its configuration, without affecting the rest -int skip_parameter_modification(yaml_parser_t *parser); - -// applies reconfiguration parameters and notifies ENB APP -void initiate_soft_restart(mid_t mod_id, Protocol__FlexCellConfig *c); - -#endif diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h deleted file mode 100644 index bc1976abd9..0000000000 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_defs.h - * \brief FlexRAN agent common definitions - * \author Navid Nikaein and Xenofon Foukas and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ -#ifndef FLEXRAN_AGENT_DEFS_H_ -#define FLEXRAN_AGENT_DEFS_H_ - -#include -#include -#include -#include -#include -#include - -#include "link_manager.h" - -#define NUM_MAX_ENB 2 -#define NUM_MAX_DRB 8 -#define NUM_MAX_SRB 3 -#define NUM_MAX_UE 2048 -#define DEFAULT_DRB 3 -#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1" -#define DEFAULT_FLEXRAN_AGENT_PORT 2210 -#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache" - -typedef enum { - - FLEXRAN_AGENT_DEFAULT=0, - - FLEXRAN_AGENT_PHY=1, - FLEXRAN_AGENT_MAC=2, - FLEXRAN_AGENT_RLC=3, - FLEXRAN_AGENT_PDCP=4, - FLEXRAN_AGENT_RRC=5, - FLEXRAN_AGENT_S1AP=6, - FLEXRAN_AGENT_GTP=7, - FLEXRAN_AGENT_X2AP=8, - - FLEXRAN_AGENT_MAX=9, - -} agent_id_t; - -typedef enum { - /* no action */ - FLEXRAN_AGENT_ACTION_NONE = 0x0, - - /* send action */ - FLEXRAN_AGENT_ACTION_SEND = 0x1, - - /* apply action */ - FLEXRAN_AGENT_ACTION_APPLY = 0x2, - - /* clear action */ - FLEXRAN_AGENT_ACTION_CLEAR = 0x4, - - /* write action */ - FLEXRAN_AGENT_ACTION_WRITE = 0x8, - - /* filter action */ - FLEXRAN_AGENT_ACTION_FILTER = 0x10, - - /* preprocess action */ - FLEXRAN_AGENT_ACTION_PREPROCESS = 0x20, - - /* meter action */ - FLEXRAN_AGENT_ACTION_METER = 0x40, - - /* Max number of states available */ - FLEXRAN_AGENT_ACTION_MAX = 0x7f, -} agent_action_t; - - -typedef enum { - - RAN_LTE_OAI= 0, - - /* Max number of states available */ - RAN_NAME_MAX = 0x7f, -} ran_name_t; - -typedef uint8_t xid_t; -typedef uint16_t mid_t; // module or enb id -typedef uint8_t lcid_t; -typedef int32_t err_code_t; - - - -#define FLEXRAN_CAP_LOPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY)) > 0) -#define FLEXRAN_CAP_HIPHY(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY)) > 0) -#define FLEXRAN_CAP_LOMAC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC)) > 0) -#define FLEXRAN_CAP_HIMAC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC)) > 0) -#define FLEXRAN_CAP_RLC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC)) > 0) -#define FLEXRAN_CAP_PDCP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP)) > 0) -#define FLEXRAN_CAP_SDAP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP)) > 0) -#define FLEXRAN_CAP_RRC(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC)) > 0) -#define FLEXRAN_CAP_S1AP(cApS) (((cApS) & (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP)) > 0) - -typedef enum { - ENB_NORMAL_OPERATION = 0x0, - ENB_WAIT = 0x1, - ENB_MAKE_WAIT = 0x2, -} flexran_enb_state_t; - -typedef struct { - /* general info */ - int enabled; - char *interface_name; - char *remote_ipv4_addr; - uint16_t remote_port; - char *cache_name; - - mid_t mod_id; - uint64_t agent_id; - uint16_t capability_mask; - - /* lock for waiting before starting or soft-restart */ - pthread_cond_t cond_node_ctrl; - pthread_mutex_t mutex_node_ctrl; - flexran_enb_state_t node_ctrl_state; - - /* stats */ - - uint32_t total_rx_msg; - uint32_t total_tx_msg; - - uint32_t rx_msg[NUM_MAX_ENB]; - uint32_t tx_msg[NUM_MAX_ENB]; - -} flexran_agent_info_t; - - -/* -rrc triggering - */ - - -typedef struct { - char * trigger_policy; - uint32_t report_interval; - uint32_t report_amount; - -} agent_reconf_rrc; - -#endif diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h deleted file mode 100644 index 2a5930e1a8..0000000000 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file ENB_APP/extern.h - * \brief FlexRAN agent - Extern VSF xfaces - * \author Xenofon Foukas and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - * \mail x.foukas@sms.ed.ac.uk - */ - -#ifndef __FLEXRAN_AGENT_EXTERN_H__ -#define __FLEXRAN_AGENT_EXTERN_H__ - -#include "flexran_agent_defs.h" -#include "flexran_agent_phy_defs.h" -#include "flexran_agent_mac_defs.h" -#include "flexran_agent_rrc_defs.h" -#include "flexran_agent_pdcp_defs.h" -#include "flexran_agent_s1ap_defs.h" - -/* Control module interface for the communication of the PHY control module with the agent */ -AGENT_PHY_xface *flexran_agent_get_phy_xface(mid_t mod_id); - -/* Control module interface for the communication of the MAC Control Module with the agent */ - -extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; -#define flexran_agent_get_mac_xface(mod_id) (agent_mac_xface[mod_id]) -/* Control module interface for the communication of the RRC Control Module with the agent */ -// AGENT_RRC_xface *flexran_agent_get_rrc_xface(mid_t mod_id); -extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; -#define flexran_agent_get_rrc_xface(mod_id) (agent_rrc_xface[mod_id]) - -/* Control module interface for the communication of the RRC Control Module with the agent */ -AGENT_PDCP_xface *flexran_agent_get_pdcp_xface(mid_t mod_id); - -/* Control module interface for the communication of the S1AP Control Module with the agent */ -AGENT_S1AP_xface *flexran_agent_get_s1ap_xface(mid_t mod_id); - -/* Requried to know which UEs had a harq updated over some subframe */ -extern int harq_pid_updated[NUM_MAX_UE][8]; -extern int harq_pid_round[NUM_MAX_UE][8]; - -#endif diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c deleted file mode 100644 index addcd6a142..0000000000 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_handler.c - * \brief FlexRAN agent tx and rx message handler - * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#include "flexran_agent_defs.h" -#include "flexran_agent_common.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_pdcp.h" -#include "flexran_agent_s1ap.h" -#include "flexran_agent_app.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_ran_api.h" -#include "common/utils/LOG/log.h" - -#include "assertions.h" - -flexran_agent_message_decoded_callback agent_messages_callback[][3] = { - {flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ - {flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {flexran_agent_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ - {flexran_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ - {flexran_agent_handle_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ - {flexran_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ - {flexran_agent_handle_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ - {flexran_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {flexran_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ - {flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - {flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ - {flexran_agent_rrc_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_RRC_TRIGGERING_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_MAC_CONFIG_MSG*/ - {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DISCONNECT_MSG*/ - {flexran_agent_rrc_trigger_handover, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HO_COMMAND_MSG*/ -}; - -flexran_agent_message_destruction_callback message_destruction_callback[] = { - flexran_agent_destroy_hello, - flexran_agent_destroy_echo_request, - flexran_agent_destroy_echo_reply, - flexran_agent_destroy_stats_request, - flexran_agent_destroy_stats_reply, - flexran_agent_mac_destroy_sf_trigger, - flexran_agent_mac_destroy_sr_info, - flexran_agent_destroy_enb_config_request, - flexran_agent_destroy_enb_config_reply, - flexran_agent_destroy_ue_config_request, - flexran_agent_destroy_ue_config_reply, - flexran_agent_destroy_lc_config_request, - flexran_agent_destroy_lc_config_reply, - flexran_agent_mac_destroy_dl_config, - flexran_agent_destroy_ue_state_change, - flexran_agent_destroy_control_delegation, - flexran_agent_destroy_agent_reconfiguration, - NULL, /* flex_rrc_triggering */ - NULL, /* flex_ul_mac_config */ - NULL, /* flex_disconnect */ - NULL, /* flex_ho_command */ - flexran_agent_destroy_control_delegation_request, -}; - -/* static const char *flexran_agent_direction2String[] = { */ -/* "", /\* not_set *\/ */ -/* "originating message", /\* originating message *\/ */ -/* "successfull outcome", /\* successfull outcome *\/ */ -/* "unsuccessfull outcome", /\* unsuccessfull outcome *\/ */ -/* }; */ - - -Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, - uint8_t *data, - uint32_t size){ - - Protocol__FlexranMessage *decoded_message = NULL; - Protocol__FlexranMessage *reply_message = NULL; - err_code_t err_code; - DevAssert(data != NULL); - - if (flexran_agent_deserialize_message(data, size, &decoded_message) < 0) { - err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; - goto error; - } - if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) || - (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ - err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; - goto error; - } - - if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { - err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_SUPPORTED; - goto error; - - } - - err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); - if ( err_code < 0 ){ - goto error; - } else if (err_code == 0) { //If err_code > 1, we do not want to dispose the message yet - protocol__flexran_message__free_unpacked(decoded_message, NULL); - } - return reply_message; - -error: - LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); - return NULL; - -} - - - -void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, - int * size){ - - void * buffer; - - if (flexran_agent_serialize_message(msg, &buffer, size) < 0 ) { - LOG_E(FLEXRAN_AGENT,"errno %d occured\n",PROTOCOL__FLEXRAN_ERR__MSG_ENCODING); - goto error; - } - - // free the msg --> later keep this in the data struct and just update the values - //TODO call proper destroy function - ((*message_destruction_callback[msg->msg_case-1])(msg)); - - DevAssert(buffer !=NULL); - - LOG_D(FLEXRAN_AGENT,"Serilized the eNB-UE stats reply (size %d)\n", *size); - - return buffer; - - error : - return NULL; -} - -Protocol__FlexranMessage *flexran_agent_handle_timed_task( - mid_t mod_id, - Protocol__FlexranMessage *msg) { - err_code_t err_code; - - Protocol__FlexranMessage *reply_message; - err_code = ((*agent_messages_callback[msg->msg_case-1][msg->msg_dir-1])( - mod_id, msg, &reply_message)); - if (err_code < 0) { - LOG_E(FLEXRAN_AGENT, "could not handle message: errno %d occured\n", err_code); - return NULL; - } - - return reply_message; -} - -err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { - return ((*message_destruction_callback[msg->msg_case-1])(msg)); -} - - -/* - Top Level Statistics Report -*/ - -int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - *msg = NULL; - Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; - const xid_t xid = stats_req->header->xid; - - if (stats_req->body_case != PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST) { - LOG_E(FLEXRAN_AGENT, "only complete stats are supported at the moment\n"); - return -1; - } - Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - - switch (comp_req->report_frequency) { - case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF: - flexran_agent_destroy_timer(mod_id, xid); - return 0; - case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE: - LOG_E(FLEXRAN_AGENT, "one-shot timer not implemented yet\n"); - return -1; - case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL: - /* Create a one off flexran message as an argument for the periodical task */ - LOG_I(FLEXRAN_AGENT, "periodical timer xid %d cell_flags %d ue_flags %d\n", - xid, comp_req->cell_report_flags, comp_req->ue_report_flags); - flexran_agent_create_timer(mod_id, comp_req->sf, - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, - flexran_agent_send_stats_reply, input); - /* return 1: do not dispose comp_req message we received, we still need it */ - return 1; - case PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS: - LOG_E(FLEXRAN_AGENT, "unsupported report frequency continuous\n"); - return -1; - default: - LOG_E(FLEXRAN_AGENT, "unknown report frequency\n"); - return -1; - } -} - -/* - Top level reply - */ -Protocol__FlexranMessage *flexran_agent_send_stats_reply( - mid_t mod_id, - const Protocol__FlexranMessage *msg) { - const Protocol__FlexStatsRequest *stats_req = msg->stats_request_msg; - const xid_t xid = stats_req->header->xid; - - Protocol__FlexranMessage *reply = NULL; - err_code_t rc = flexran_agent_stats_reply(mod_id, xid, stats_req, &reply); - if (rc < 0) { - LOG_E(FLEXRAN_AGENT, "%s(): errno %d occured, cannot send stats_reply\n", - __func__, rc); - return NULL; - } - return reply; -} - -int flexran_agent_stats_reply(mid_t enb_id, - xid_t xid, - const Protocol__FlexStatsRequest *stats_req, - Protocol__FlexranMessage **msg) { - - Protocol__FlexHeader *header = NULL; - Protocol__FlexUeStatsReport **ue_report = NULL; - Protocol__FlexCellStatsReport **cell_report = NULL; - Protocol__FlexStatsReply *stats_reply_msg = NULL; - err_code_t err_code = PROTOCOL__FLEXRAN_ERR__UNEXPECTED; - AssertFatal(stats_req->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST, - "%s() handles only complete stats requests\n", - __func__); - const uint32_t cell_flags = stats_req->complete_stats_request->cell_report_flags; - const uint32_t ue_flags = stats_req->complete_stats_request->ue_report_flags; - - int n_ue = flexran_agent_get_num_ues(enb_id); - - rnti_t rntis[n_ue]; - if (flexran_agent_get_rrc_xface(enb_id)) - flexran_get_rrc_rnti_list(enb_id, rntis, n_ue); - if (flexran_agent_get_mac_xface(enb_id) && !flexran_agent_get_rrc_xface(enb_id)) { - for (int i = 0; i < n_ue; i++) { - const int UE_id = flexran_get_mac_ue_id(enb_id, i); - rntis[i] = flexran_get_mac_ue_crnti(enb_id, UE_id); - } - } - - int n_cc = MAX_NUM_CCs; - - ue_report = calloc(n_ue, sizeof(Protocol__FlexUeStatsReport *)); - if (ue_report == NULL) { - goto error; - } - for (int i = 0; i < n_ue; i++) { - ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); - if (ue_report[i] == NULL) { - goto error; - } - protocol__flex_ue_stats_report__init(ue_report[i]); - ue_report[i]->rnti = rntis[i]; - ue_report[i]->has_rnti = 1; - ue_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ - } - - cell_report = calloc(n_cc, sizeof(Protocol__FlexCellStatsReport *)); - if (cell_report == NULL) { - goto error; - } - for (int i = 0; i < n_cc; i++) { - cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); - if(cell_report[i] == NULL) { - goto error; - } - protocol__flex_cell_stats_report__init(cell_report[i]); - cell_report[i]->carrier_index = i; - cell_report[i]->has_carrier_index = 1; - cell_report[i]->has_flags = 1; /* actual flags are filled in the CMs below */ - } - - /* MAC reply split */ - if (flexran_agent_get_mac_xface(enb_id) - && (flexran_agent_mac_stats_reply_ue(enb_id, ue_report, n_ue, ue_flags) < 0 - || flexran_agent_mac_stats_reply_cell(enb_id, cell_report, n_cc, cell_flags) < 0)) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - /* RRC reply split */ - if (flexran_agent_get_rrc_xface(enb_id) - && flexran_agent_rrc_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - /* PDCP reply split */ - if (flexran_agent_get_pdcp_xface(enb_id) - && flexran_agent_pdcp_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - /* GTP reply split, currently performed through RRC module */ - if (flexran_agent_get_rrc_xface(enb_id) - && flexran_agent_rrc_gtp_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - /* S1AP statistics, depends on RRC to find S1AP ID */ - if (flexran_agent_get_rrc_xface(enb_id) - && flexran_agent_get_s1ap_xface(enb_id) - && flexran_agent_s1ap_stats_reply(enb_id, ue_report, n_ue, ue_flags) < 0) { - err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; - goto error; - } - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { - goto error; - } - stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); - AssertFatal(stats_reply_msg, "no memory for stats_reply_msg\n"); - protocol__flex_stats_reply__init(stats_reply_msg); - stats_reply_msg->header = header; - stats_reply_msg->n_ue_report = n_ue; - stats_reply_msg->ue_report = ue_report; - stats_reply_msg->n_cell_report = n_cc; - stats_reply_msg->cell_report = cell_report; - - *msg = malloc(sizeof(Protocol__FlexranMessage)); - AssertFatal(*msg, "no memory for stats_reply container msg\n"); - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->stats_reply_msg = stats_reply_msg; - - return 0; - -error : - LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); - - if (header != NULL) { - free(header); - header = NULL; - } - - if (stats_reply_msg != NULL) { - free(stats_reply_msg); - stats_reply_msg = NULL; - } - - if (ue_report != NULL) { - for (int j = 0; j < n_ue; j++) { - if (ue_report[j] != NULL) { - free(ue_report[j]); - } - } - free(ue_report); - ue_report = NULL; - } - - if (cell_report != NULL) { - for (int j = 0; j < n_cc; j++) { - if (cell_report[j] != NULL) { - free(cell_report[j]); - } - } - free(cell_report); - cell_report = NULL; - } - - return err_code; -} - -/* - Top Level Request - */ - -/* -int flexran_agent_stats_request(mid_t mod_id, - xid_t xid, - const stats_request_config_t *report_config, - Protocol__FlexranMessage **msg) { - Protocol__FlexHeader *header = NULL; - int i; - - Protocol__FlexStatsRequest *stats_request_msg; - stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest)); - if(stats_request_msg == NULL) - goto error; - protocol__flex_stats_request__init(stats_request_msg); - - if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) - goto error; - - stats_request_msg->header = header; - - stats_request_msg->type = report_config->report_type; - stats_request_msg->has_type = 1; - - switch (report_config->report_type) { - case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS: - stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; - Protocol__FlexCompleteStatsRequest *complete_stats; - complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest)); - if(complete_stats == NULL) - goto error; - protocol__flex_complete_stats_request__init(complete_stats); - complete_stats->report_frequency = report_config->report_frequency; - complete_stats->has_report_frequency = 1; - complete_stats->sf = report_config->period; - complete_stats->has_sf = 1; - complete_stats->has_cell_report_flags = 1; - complete_stats->has_ue_report_flags = 1; - if (report_config->config->nr_cc > 0) { - complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags; - } - if (report_config->config->nr_ue > 0) { - complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags; - } - stats_request_msg->complete_stats_request = complete_stats; - break; - case PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS: - stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST; - Protocol__FlexCellStatsRequest *cell_stats; - cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest)); - if(cell_stats == NULL) - goto error; - protocol__flex_cell_stats_request__init(cell_stats); - cell_stats->n_cell = report_config->config->nr_cc; - cell_stats->has_flags = 1; - if (cell_stats->n_cell > 0) { - uint32_t *cells; - cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell); - for (i = 0; i < cell_stats->n_cell; i++) { - cells[i] = report_config->config->cc_report_type[i].cc_id; - } - cell_stats->cell = cells; - cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags; - } - stats_request_msg->cell_stats_request = cell_stats; - break; - case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS: - stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST; - Protocol__FlexUeStatsRequest *ue_stats; - ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest)); - if(ue_stats == NULL) - goto error; - protocol__flex_ue_stats_request__init(ue_stats); - ue_stats->n_rnti = report_config->config->nr_ue; - ue_stats->has_flags = 1; - if (ue_stats->n_rnti > 0) { - uint32_t *ues; - ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti); - for (i = 0; i < ue_stats->n_rnti; i++) { - ues[i] = report_config->config->ue_report_type[i].ue_rnti; - } - ue_stats->rnti = ues; - ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags; - } - stats_request_msg->ue_stats_request = ue_stats; - break; - default: - goto error; - } - *msg = malloc(sizeof(Protocol__FlexranMessage)); - if(*msg == NULL) - goto error; - protocol__flexran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->stats_request_msg = stats_request_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (stats_request_msg != NULL) - free(stats_request_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} -*/ - -int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) - goto error; - free(msg->stats_request_msg->header); - if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { - free(msg->stats_request_msg->cell_stats_request->cell); - } - if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) { - free(msg->stats_request_msg->ue_stats_request->rnti); - } - free(msg->stats_request_msg); - free(msg); - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int flexran_agent_destroy_stats_reply(Protocol__FlexranMessage *msg) -{ - if (msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) { - LOG_E(FLEXRAN_AGENT, "%s(): message is not a msg_stats_reply\n", __func__); - return -1; - } - - flexran_agent_mac_destroy_stats_reply(msg->stats_reply_msg); - flexran_agent_rrc_destroy_stats_reply(msg->stats_reply_msg); - flexran_agent_pdcp_destroy_stats_reply(msg->stats_reply_msg); - flexran_agent_rrc_gtp_destroy_stats_reply(msg->stats_reply_msg); - flexran_agent_s1ap_destroy_stats_reply(msg->stats_reply_msg); - for (int i = 0; i < msg->stats_reply_msg->n_cell_report; ++i) - free(msg->stats_reply_msg->cell_report[i]); - for (int i = 0; i < msg->stats_reply_msg->n_ue_report; ++i) - free(msg->stats_reply_msg->ue_report[i]); - free(msg->stats_reply_msg->cell_report); - free(msg->stats_reply_msg->ue_report); - free(msg->stats_reply_msg->header); - free(msg->stats_reply_msg); - free(msg); - return 0; -} diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c deleted file mode 100644 index 568a0e32cc..0000000000 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_net_comm.c - * \brief FlexRAN agent network interface abstraction - * \author Xenofon Foukas - * \date 2016 - * \version 0.1 - */ - -#include "flexran_agent_net_comm.h" -#include "common/utils/LOG/log.h" - -flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; -static flexran_agent_channel_instance_t channel_instance; -int flexran_agent_channel_id = 0; - -int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { - /*Check if agent id is valid*/ - if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { - goto error; - } - flexran_agent_channel_t *channel; - channel = agent_channel[mod_id][agent_id]; - - /*Check if agent has a channel registered*/ - if (channel == NULL) { - goto error; - } - - return channel->msg_send(data, size, priority, channel->channel_info); - - error: - LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); - return -1; -} - -int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *priority) { - /*Check if agent id is valid*/ - if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { - goto error; - } - flexran_agent_channel_t *channel; - channel = agent_channel[mod_id][agent_id]; - - /*Check if agent has a channel registered*/ - if (channel == NULL) { - goto error; - } - - return channel->msg_recv(data, priority, channel->channel_info); - - error: - LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); - return -1; -} - -int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id) { - int i; - - if (channel == NULL) { - return -1; - } - - if (agent_id == FLEXRAN_AGENT_MAX) { - for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { - agent_channel[mod_id][i] = channel; - } - } else { - agent_channel[mod_id][agent_id] = channel; - } - return 0; -} - -void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { - int i; - - if (agent_id == FLEXRAN_AGENT_MAX) { - for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { - agent_channel[mod_id][i] = NULL; - } - } else { - agent_channel[mod_id][agent_id] = NULL; - } -} - -int flexran_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *priority, void *channel_info), - void (*release)(flexran_agent_channel_t *channel)) { - - int channel_id = ++flexran_agent_channel_id; - flexran_agent_channel_t *channel = (flexran_agent_channel_t *) malloc(sizeof(flexran_agent_channel_t)); - channel->channel_id = channel_id; - channel->channel_info = channel_info; - channel->msg_send = msg_send; - channel->msg_recv = msg_recv; - channel->release = release; - - /*element should be a real pointer*/ - RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel); - - LOG_I(FLEXRAN_AGENT,"Created a new channel with id %d \n", channel->channel_id); - - return channel_id; -} - -int flexran_agent_destroy_channel(int channel_id) { - int i, j; - - /*Check to see if channel exists*/ - struct flexran_agent_channel_s *e = NULL; - struct flexran_agent_channel_s search; - memset(&search, 0, sizeof(struct flexran_agent_channel_s)); - - e = RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); - - if (e == NULL) { - return -1; - } - - /*Unregister the channel from all agents*/ - for (i = 0; i < NUM_MAX_ENB; i++) { - for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { - if (agent_channel[i][j] != NULL) { - if (agent_channel[i][j]->channel_id == e->channel_id) { - free(agent_channel[i][j]); - } - } - } - } - - /*Remove the channel from the tree and free memory*/ - RB_REMOVE(flexran_agent_channel_map, &channel_instance.flexran_agent_head, e); - e->release(e); - free(e); - - return 0; -} - -err_code_t flexran_agent_init_channel_container(void) { - int i, j; - LOG_I(FLEXRAN_AGENT, "init RB tree for channel container\n"); - - RB_INIT(&channel_instance.flexran_agent_head); - - for (i = 0; i < NUM_MAX_ENB; i++) { - for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { - agent_channel[i][j] = malloc(sizeof(flexran_agent_channel_t)); - if (!agent_channel[i][j]) - return -1; - } - } - - return 0; -} - -RB_GENERATE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); - -int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b) { - if (a->channel_id < b->channel_id) return -1; - if (a->channel_id > b->channel_id) return 1; - - // equal timers - return 0; -} - -flexran_agent_channel_t * get_channel(int channel_id) { - - struct flexran_agent_channel_s search; - memset(&search, 0, sizeof(struct flexran_agent_channel_s)); - search.channel_id = channel_id; - - return RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); - -} diff --git a/openair2/ENB_APP/flexran_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h deleted file mode 100644 index 4d012989fd..0000000000 --- a/openair2/ENB_APP/flexran_agent_net_comm.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_net_comm.h - * \brief FlexRAN agent network interface abstraction - * \autho Xenofon Foukas - * \date 2016 - * \version 0.1 - */ -#ifndef FLEXRAN_AGENT_NET_COMM_H_ -#define FLEXRAN_AGENT_NET_COMM_H_ - -#include "flexran_agent_defs.h" - -#include "tree.h" - -/*Channel related information used for Tx/Rx of protocol messages*/ -typedef struct flexran_agent_channel_s { - RB_ENTRY(flexran_agent_channel_s) entry; -int channel_id; -void *channel_info; -/*Callbacks for channel message Tx and Rx*/ -int (*msg_send)(void *data, int size, int priority, void *channel_info); -int (*msg_recv)(void **data, int *priority, void *channel_info); -void (*release)(struct flexran_agent_channel_s *channel); -} flexran_agent_channel_t; - -typedef struct flexran_agent_channel_instance_s{ - RB_HEAD(flexran_agent_channel_map, flexran_agent_channel_s) flexran_agent_head; -} flexran_agent_channel_instance_t; - -/*Send and receive messages using the channel registered for a specific agent*/ -int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *priority); - -/*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the - *same channel to all agents*/ -int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id); - -/*Unregister the current channel of an agent. Use FLEXRAN_AGENT_MAX to unregister all channels*/ -void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); - -/*Create a new channel. Returns the id of the new channel or negative number otherwise*/ -int flexran_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *priority, void *channel_info), - void (*release)(flexran_agent_channel_t *channel)); - -/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ -int flexran_agent_destroy_channel(int channel_id); - -/*Return an agent communication channel based on its id*/ -flexran_agent_channel_t * get_channel(int channel_id); - -/*Should be called before performing any channel operations*/ -err_code_t flexran_agent_init_channel_container(void); - -int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b); - -/* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); - -#endif /*FLEXRAN_AGENT_COMM_H_*/ diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c deleted file mode 100644 index 3113c07798..0000000000 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ /dev/null @@ -1,3793 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_ran_api.c - * \brief FlexRAN RAN API abstraction - * \author N. Nikaein, X. Foukas, S. SHARIAT BAGHERI and R. Schmidt - * \date 2017 - * \version 0.1 - */ - -#include -#include "flexran_agent_ran_api.h" -#include "s1ap_eNB_ue_context.h" -#include "s1ap_eNB_management_procedures.h" -#include "openair2/LAYER2/MAC/slicing/slicing.h" - -#include "common/ran_context.h" -extern RAN_CONTEXT_t RC; - -static inline int phy_is_present(mid_t mod_id, uint8_t cc_id) { - return RC.eNB && RC.eNB[mod_id] && RC.eNB[mod_id][cc_id]; -} - -static inline int mac_is_present(mid_t mod_id) { - return RC.mac && RC.mac[mod_id]; -} - -static inline int rrc_is_present(mid_t mod_id) { - return RC.rrc && RC.rrc[mod_id]; -} - -uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag) { - if (!mac_is_present(mod_id)) return 0; - - if (subframe_flag == 1) - return RC.mac[mod_id]->frame*10 + RC.mac[mod_id]->subframe; - else - return RC.mac[mod_id]->frame*10; -} - -frame_t flexran_get_current_frame(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - - // #warning "SFN will not be in [0-1023] when oaisim is used" - return RC.mac[mod_id]->frame; -} - -frame_t flexran_get_current_system_frame_num(mid_t mod_id) { - return flexran_get_current_frame(mod_id) % 1024; -} - -sub_frame_t flexran_get_current_subframe(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->subframe; -} - -uint32_t flexran_get_sfn_sf(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - - return flexran_get_current_frame(mod_id) * 10 + flexran_get_current_subframe(mod_id); -} - -uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time) { - if (!mac_is_present(mod_id)) return 0; - - frame_t frame = flexran_get_current_system_frame_num(mod_id); - sub_frame_t subframe = flexran_get_current_subframe(mod_id); - uint16_t sfn_sf, frame_mask, sf_mask; - int additional_frames; - subframe = (subframe + ahead_of_time) % 10; - - if (subframe < flexran_get_current_subframe(mod_id)) - frame = (frame + 1) % 1024; - - additional_frames = ahead_of_time / 10; - frame = (frame + additional_frames) % 1024; - frame_mask = (1 << 12) - 1; - sf_mask = (1 << 4) - 1; - sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); - return sfn_sf; -} - -int flexran_get_mac_num_ues(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.num_UEs; -} - -int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - // Not sure whether this is needed: if (!rrc_is_present(mod_id)) return 0; - const rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); - const int s = mac_eNB_get_rrc_status(mod_id, rnti); - - if (s < RRC_CONNECTED) - return 0; - else if (s == RRC_CONNECTED) - return 1; - else - return 3; -} - -int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti) { - int n; - - if (!mac_is_present(mod_id)) return 0; - - /* get the (active) UE with RNTI i */ - for (n = 0; n < MAX_MOBILES_PER_ENB; ++n) { - if (RC.mac[mod_id]->UE_info.active[n] == true - && rnti == UE_RNTI(mod_id, n)) { - return n; - } - } - - return 0; -} - -int flexran_get_mac_ue_id(mid_t mod_id, int i) { - int n; - - if (!mac_is_present(mod_id)) return 0; - - /* get the (i+1)'th active UE */ - for (n = 0; n < MAX_MOBILES_PER_ENB; ++n) { - if (RC.mac[mod_id]->UE_info.active[n] == true) { - if (i == 0) - return n; - - --i; - } - } - - return 0; -} - -rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return UE_RNTI(mod_id, ue_id); -} - -int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid) { - if (!mac_is_present(mod_id)) return -1; - - return RC.mac[mod_id]->UE_info.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].ul_buffer_info[lcid]; -} - -int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].phr_info; -} - -uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.UE_sched_ctrl[ue_id].dl_cqi[0]; -} - -rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { - if (!mac_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); - frame_t frame = flexran_get_current_frame(mod_id); - sub_frame_t subframe = flexran_get_current_subframe(mod_id); - mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0, 0 - ); - return rlc_status.bytes_in_buffer; -} - -rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { - if (!mac_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); - frame_t frame = flexran_get_current_frame(mod_id); - sub_frame_t subframe = flexran_get_current_subframe(mod_id); - mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id, frame, subframe, ENB_FLAG_YES,MBMS_FLAG_NO, channel_id, 0, 0 - ); - return rlc_status.pdus_in_buffer; -} - -frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { - if (!mac_is_present(mod_id)) return 0; - - rnti_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); - frame_t frame = flexran_get_current_frame(mod_id); - sub_frame_t subframe = flexran_get_current_subframe(mod_id); - mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, channel_id, 0, 0 - ); - return rlc_status.head_sdu_creation_time; -} - -int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - int32_t tau = RC.eNB[mod_id][cc_id]->UE_stats[ue_id].timing_advance_update; - - switch (flexran_get_N_RB_DL(mod_id, cc_id)) { - case 6: - return tau; - - case 15: - return tau / 2; - - case 25: - return tau / 4; - - case 50: - return tau / 8; - - case 75: - return tau / 12; - - case 100: - if (flexran_get_threequarter_fs(mod_id, cc_id) == 0) - return tau / 16; - else - return tau / 12; - - default: - return 0; - } -} - -uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_sdu_bytes; -} - -uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - uint64_t bytes = 0; - - for (int i = 0; i < NB_RB_MAX; ++i) { - bytes += RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].num_bytes_rx[i]; - } - - return bytes; -} - -uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].TBS; -} - -uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].ulsch_TBS; -} - -uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].rbs_used_retx; -} - -uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].rbs_used_retx_rx; -} - -uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].rbs_used; -} - -uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].rbs_used_rx; -} - -uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.UE_sched_ctrl[ue_id].periodic_wideband_pmi[cc_id]; -} - -uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].dlsch_mcs1; -} - -uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].dlsch_mcs2; -} - -uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].ulsch_mcs1; -} - -uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].ulsch_mcs2; -} - -uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_rbs_used; -} - -uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_rbs_used_rx; -} - -uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_num_pdus; -} - -uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_num_pdus_rx; -} - -uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_pdu_bytes; -} - -uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].total_ulsch_TBS; -} - -int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].harq_round; -} - -uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].num_mac_sdu_tx; -} - -unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].lcid_sdu[index]; -} - -uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.eNB_UE_stats[cc_id][ue_id].sdu_length_tx[lcid]; -} - - -/* TODO needs to be revised */ -void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - /* - UE_info_t *UE_info=&eNB_mac_inst[mod_id].UE_info; - UE_sched_ctrl *ue_sched_ctl = &UE_info->UE_sched_ctrl[ue_id]; - - if (ue_sched_ctl->ta_timer == 0) { - - // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ... - // LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); - //ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY - ue_sched_ctl->ta_update = flexran_get_TA(mod_id, ue_id, CC_id); - - // clear the update in case PHY does not have a new measurement after timer expiry - // eNB_UE_stats->timing_advance_update = 0; - } else { - ue_sched_ctl->ta_timer--; - ue_sched_ctl->ta_update = 0; // don't trigger a timing advance command - } - #warning "Implement flexran_update_TA() in RAN API" - */ -} - -/* TODO needs to be revised, looks suspicious: why do we need UE stats? */ -int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - /* - #warning "Implement flexran_get_MAC_CE_bitmap_TA() in RAN API" - */ - if (!phy_is_present(mod_id, cc_id)) return 0; - - /* UE_stats can not be null, they are an array in RC - LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); - - if (eNB_UE_stats == NULL) { - return 0; - } - */ - - if (flexran_get_TA(mod_id, ue_id, cc_id) != 0) { - return PROTOCOL__FLEX_CE_TYPE__FLPCET_TA; - } else { - return 0; - } -} - -int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.numactiveCCs[ue_id]; -} - -uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].rank; -} - -int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - /* before: tested that UL_rssi != NULL and set parameter ([0]), but it is a - * static array -> target_rx_power is useless in old ifs?! */ - int pCCid = UE_PCCID(mod_id,ue_id); - int32_t target_rx_power = RC.eNB[mod_id][pCCid]->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; - int32_t normalized_rx_power = RC.eNB[mod_id][cc_id]->UE_stats[ue_id].UL_rssi[0]; - int tpc; - - if (normalized_rx_power > target_rx_power + 1) - tpc = 0; //-1 - else if (normalized_rx_power < target_rx_power - 1) - tpc = 2; //+1 - else - tpc = 1; //0 - - return tpc; -} - -int flexran_get_harq(mid_t mod_id, - uint8_t cc_id, - mid_t ue_id, - frame_t frame, - sub_frame_t subframe, - uint8_t *pid, - uint8_t *round, - uint8_t harq_flag) { - /* TODO: Add int TB in function parameters to get the status of the second - * TB. This can be done to by editing in get_ue_active_harq_pid function in - * line 272 file: phy_procedures_lte_eNB.c to add DLSCH_ptr = - * PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ - /* TODO IMPLEMENT */ - /* - uint8_t harq_pid; - uint8_t harq_round; - - if (mac_xface_not_ready()) return 0 ; - - uint16_t rnti = flexran_get_mac_ue_crnti(mod_id,ue_id); - if (harq_flag == openair_harq_DL){ - - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL); - - } else if (harq_flag == openair_harq_UL){ - - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,round,openair_harq_UL); - } - else { - - LOG_W(FLEXRAN_AGENT,"harq_flag is not recongnized"); - } - - - *pid = harq_pid; - *round = harq_round;*/ - /* if (round > 0) { */ - /* *status = 1; */ - /* } else { */ - /* *status = 0; */ - /* } */ - /*return *round;*/ - /* - #warning "Implement flexran_get_harq() in RAN API" - */ - return 0; -} - -int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_dBm; -} - -int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.ul_power_control_config_common.p0_NominalPUCCH; -} - -int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_update; -} - -int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - RC.eNB[mod_id][cc_id]->UE_stats[ue_id].Po_PUCCH_update = 0; - return 0; -} - - -/* - * ************************************ - * Get Messages for eNB Configuration Reply - * ************************************ - */ -uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.threequarter_fs; -} - - -uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.pusch_HoppingOffset; -} - -Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return -1; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.hoppingMode) { - case interSubFrame: - return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; - - case intraAndInterSubFrame: - return PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; - } - - return -1; -} - -uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.n_SB; -} - -Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - if (RC.eNB[mod_id][cc_id]->frame_parms.pusch_config_common.enable64QAM == true) - return PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; - else - return PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; -} - -Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return -1; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_duration) { - case normal: - return PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; - - case extended: - return PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; - } - - return -1; -} - -Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return -1; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.phich_config_common.phich_resource) { - case oneSixth: - return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; - - case half: - return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; - - case one: - return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; - - case two: - return PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO; - } - - return -1; -} - -uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.n1PUCCH_AN; -} - -uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.nRB_CQI; -} - -uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pucch_config_common.deltaPUCCH_Shift; -} - -uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; -} - -uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset; -} - -uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.maxHARQ_Msg3Tx; -} - -Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return -1; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp_UL) { - case EXTENDED: - return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; - - case NORMAL: - return PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; - } - - return -1; -} - -Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return -1; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.Ncp) { - case EXTENDED: - return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; - - case NORMAL: - return PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; - } - - return -1; -} - -uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.Nid_cell; -} - -uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_BandwidthConfig; -} - -uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_SubframeConfig; -} - -uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.soundingrs_ul_config_common.srs_MaxUpPts; -} - -uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.N_RB_DL; -} - -uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.N_RB_UL; -} - -uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.N_RBG; -} - -uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.tdd_config; -} - -uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.tdd_config_S; -} - -long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.radioresourceconfig[cc_id].rach_raResponseWindowSize; -} - -long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.radioresourceconfig[cc_id].rach_macContentionResolutionTimer; -} - -Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - switch (RC.eNB[mod_id][cc_id]->frame_parms.frame_type) { - case TDD: - return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; - - case FDD: - return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; - - default: - return -1; - } -} - -long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id) || !RC.rrc[mod_id]->carrier[cc_id].sib1) return 0; - - return RC.rrc[mod_id]->carrier[cc_id].sib1->si_WindowLength; -} - -uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->carrier[cc_id].sizeof_SIB1; -} - -uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->pdcch_vars[0].num_pdcch_symbols; -} - - - -/* - * ************************************ - * Get Messages for UE Configuration Reply - * ************************************ - */ -int flexran_get_rrc_num_ues(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->Nb_ue; -} - -rnti_t flexran_get_rrc_rnti_nth_ue(mid_t mod_id, int index) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = NULL; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head) { - if (index == 0) return ue_context_p->ue_context.rnti; - - --index; - } - return 0; -} - -int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list) { - if (!rrc_is_present(mod_id)) return 0; - - int n = 0; - struct rrc_eNB_ue_context_s *ue_context_p = NULL; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head) { - if (n >= max_list) break; - - list[n] = ue_context_p->ue_context.rnti; - ++n; - } - return n; -} - -LTE_TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig) return -1; - - return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; -} - -Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measGapConfig) return -1; - - if (ue_context_p->ue_context.measGapConfig->present != LTE_MeasGapConfig_PR_setup) return -1; - - switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) { - case LTE_MeasGapConfig__setup__gapOffset_PR_gp0: - return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; - - case LTE_MeasGapConfig__setup__gapOffset_PR_gp1: - return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2; - - default: - return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF; - } -} - - -long flexran_get_meas_gap_config_offset(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measGapConfig) return -1; - - if (ue_context_p->ue_context.measGapConfig->present != LTE_MeasGapConfig_PR_setup) return -1; - - switch (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present) { - case LTE_MeasGapConfig__setup__gapOffset_PR_gp0: - return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; - - case LTE_MeasGapConfig__setup__gapOffset_PR_gp1: - return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp1; - - default: - return -1; - } -} - -uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return RRC_INACTIVE; - - return ue_context_p->ue_context.StatusRrc; -} - -uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return 0; //RC.mac[mod_id]->UE_info.UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; -} - -uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return 0; - - return 0; //RC.mac[mod_id]->UE_info.UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; -} - -int flexran_get_half_duplex(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.UE_Capability) return -1; - - LTE_SupportedBandListEUTRA_t *bands = &ue_context_p->ue_context.UE_Capability->rf_Parameters.supportedBandListEUTRA; - - for (int i = 0; i < bands->list.count; i++) { - if (bands->list.array[i]->halfDuplex > 0) return 1; - } - - return 0; -} - -int flexran_get_intra_sf_hopping(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.UE_Capability) return -1; - - if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; - - /* According to TS 36.331 Annex B.1, Intra SF Hopping is bit 1 (leftmost bit) - * in this bitmap, i.e. the eighth bit (from right) in the first bye (from - * left) */ - BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators; - uint8_t buf = fgi->buf[0]; - return (buf >> 7) & 1; -} - -int flexran_get_type2_sb_1(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.UE_Capability) return -1; - - if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; - - /* According to TS 36.331 Annex B.1, Predefined intra- and inter-sf or - * predfined inter-sf frequency hopping for PUSCH with N_sb>1 is bit 21 (bit - * 1 is leftmost bit) in this bitmap, i.e. the fourth bit (from right) in the - * third byte (from left) */ - BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators; - uint8_t buf = fgi->buf[2]; - return (buf >> 3) & 1; -} - -long flexran_get_ue_category(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.UE_Capability) return -1; - - return ue_context_p->ue_context.UE_Capability->ue_Category; -} - -int flexran_get_res_alloc_type1(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.UE_Capability) return -1; - - if (!ue_context_p->ue_context.UE_Capability->featureGroupIndicators) return -1; - - /* According to TS 36.331 Annex B.1, Resource allocation type 1 for PDSCH is - * bit 2 (bit 1 is leftmost bit) in this bitmap, i.e. the seventh bit (from - * right) in the first byte (from left) */ - BIT_STRING_t *fgi = ue_context_p->ue_context.UE_Capability->featureGroupIndicators; - uint8_t buf = fgi->buf[0]; - return (buf >> 6) & 1; -} - -long flexran_get_ue_transmission_mode(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; -} - -BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config) return -1; - - return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; -} - -long flexran_get_maxHARQ_TX(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config) return -1; - - return *(ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx); -} - -long flexran_get_beta_offset_ack_index(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; -} - -long flexran_get_beta_offset_ri_index(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; -} - -long flexran_get_beta_offset_cqi_index(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; -} - -BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI; -} - -BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id)) return -1; - - if (!RC.rrc[mod_id]->carrier[cc_id].sib2) return -1; - - return RC.rrc[mod_id]->carrier[cc_id].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; -} - -Protocol__FlexAperiodicCqiReportMode flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig) return -1; - - switch (*ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) { - case LTE_CQI_ReportModeAperiodic_rm12: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM12; - - case LTE_CQI_ReportModeAperiodic_rm20: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM20; - - case LTE_CQI_ReportModeAperiodic_rm22: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM22; - - case LTE_CQI_ReportModeAperiodic_rm30: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM30; - - case LTE_CQI_ReportModeAperiodic_rm31: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM31; - - case LTE_CQI_ReportModeAperiodic_rm32_v1250: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM32_v1250; - - case LTE_CQI_ReportModeAperiodic_rm10_v1310: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM10_v1310; - - case LTE_CQI_ReportModeAperiodic_rm11_v1310: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_RM11_v1310; - - default: - return PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; - } -} - -long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) return -1; - - return *(ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); -} - -long flexran_get_ack_nack_repetition_factor(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated) return -1; - - return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; -} - -long flexran_get_extended_bsr_size(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig->ext2) return -1; - - if (!ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020) return -1; - - return *(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); -} - -int flexran_get_ue_transmission_antenna(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated) return -1; - - if (!ue_context_p->ue_context.physicalConfigDedicated->antennaInfo) return -1; - - switch (ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup) { - case LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop: - return 2; - - case LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop: - return 1; - - default: - return 0; - } -} - -uint64_t flexran_get_ue_imsi(mid_t mod_id, rnti_t rnti) { - uint64_t imsi; - - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - imsi = ue_context_p->ue_context.imsi.digit15; - imsi += ue_context_p->ue_context.imsi.digit14 * 10; // pow(10, 1) - imsi += ue_context_p->ue_context.imsi.digit13 * 100; // pow(10, 2) - imsi += ue_context_p->ue_context.imsi.digit12 * 1000; // pow(10, 3) - imsi += ue_context_p->ue_context.imsi.digit11 * 10000; // pow(10, 4) - imsi += ue_context_p->ue_context.imsi.digit10 * 100000; // pow(10, 5) - imsi += ue_context_p->ue_context.imsi.digit9 * 1000000; // pow(10, 6) - imsi += ue_context_p->ue_context.imsi.digit8 * 10000000; // pow(10, 7) - imsi += ue_context_p->ue_context.imsi.digit7 * 100000000; // pow(10, 8) - imsi += ue_context_p->ue_context.imsi.digit6 * 1000000000; // pow(10, 9) - imsi += ue_context_p->ue_context.imsi.digit5 * 10000000000; // pow(10, 10) - imsi += ue_context_p->ue_context.imsi.digit4 * 100000000000; // pow(10, 11) - imsi += ue_context_p->ue_context.imsi.digit3 * 1000000000000; // pow(10, 12) - imsi += ue_context_p->ue_context.imsi.digit2 * 10000000000000; // pow(10, 13) - imsi += ue_context_p->ue_context.imsi.digit1 * 100000000000000; // pow(10, 14) - return imsi; -} - -long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id) { - if (!mac_is_present(mod_id)) return 0; - - return RC.mac[mod_id]->UE_info.UE_template[UE_PCCID(mod_id, ue_id)][ue_id].lcgidmap[lc_id]; -} - -/* TODO Navid: needs to be revised */ -int flexran_get_direction(mid_t ue_id, mid_t lc_id) { - switch (lc_id) { - case DCCH: - case DCCH1: - return 2; - - case DTCH: - return 1; - - default: - return -1; - } -} - -uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.nb_antenna_ports_eNB; -} - -uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.dl_CarrierFreq / 1000000; -} - -uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.ul_CarrierFreq / 1000000; -} - -uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.eutra_band; -} - -int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id) { - if (!phy_is_present(mod_id, cc_id)) return 0; - - return RC.eNB[mod_id][cc_id]->frame_parms.pdsch_config_common.referenceSignalPower; -} - -long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.radioresourceconfig[cc_id].pusch_p0_Nominal; -} - -void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz) { - if (phy_is_present(mod_id, cc_id)) { - RC.eNB[mod_id][cc_id]->frame_parms.dl_CarrierFreq = dl_freq_mhz * 1000000; - } else { - LOG_E(FLEXRAN_AGENT, "can not set dl_CarrierFreq to %d MHz in PHY: PHY is not present\n", dl_freq_mhz); - } - - if (rrc_is_present(mod_id)) { - RC.rrc[mod_id]->configuration.downlink_frequency[cc_id] = dl_freq_mhz * 1000000; - } else { - LOG_E(FLEXRAN_AGENT, "can not set downlink_frequency to %d MHz in RRC: RRC is not present\n", dl_freq_mhz); - } -} - -void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset) { - if (phy_is_present(mod_id, cc_id)) { - uint32_t new_ul_freq_mhz = flexran_agent_get_operating_dl_freq(mod_id, cc_id) + ul_freq_mhz_offset; - RC.eNB[mod_id][cc_id]->frame_parms.ul_CarrierFreq = new_ul_freq_mhz * 1000000; - } else { - LOG_E(FLEXRAN_AGENT, "can not set ul_CarrierFreq using offset %d MHz in PHY: PHY is not present\n", ul_freq_mhz_offset); - } - - if (rrc_is_present(mod_id)) { - RC.rrc[mod_id]->configuration.uplink_frequency_offset[cc_id] = ul_freq_mhz_offset; - } else { - LOG_E(FLEXRAN_AGENT, "can not set uplink_frequency_offset to %d MHz in RRC: RRC is not present\n", ul_freq_mhz_offset); - } -} - -void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band) { - if (phy_is_present(mod_id, cc_id)) { - RC.eNB[mod_id][cc_id]->frame_parms.eutra_band = eutra_band; - } else { - LOG_E(FLEXRAN_AGENT, "can not set eutra_band to %d in PHY: PHY is not present\n", eutra_band); - } - - if (rrc_is_present(mod_id)) { - RC.rrc[mod_id]->configuration.eutra_band[cc_id] = eutra_band; - } else { - LOG_E(FLEXRAN_AGENT, "can not set eutra_band to %d in RRC: RRC is not present\n", eutra_band); - } -} - -/* Sets both DL/UL */ -void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB) { - if (phy_is_present(mod_id, cc_id)) { - RC.eNB[mod_id][cc_id]->frame_parms.N_RB_DL = N_RB; - RC.eNB[mod_id][cc_id]->frame_parms.N_RB_UL = N_RB; - } else { - LOG_E(FLEXRAN_AGENT, "can not set N_RB_DL and N_RB_UL to %d in PHY: PHY is not present\n", N_RB); - } - - if (rrc_is_present(mod_id)) { - RC.rrc[mod_id]->configuration.N_RB_DL[cc_id] = N_RB; - } else { - LOG_E(FLEXRAN_AGENT, "can not set N_RB_DL to %d in RRC: RRC is not present\n", N_RB); - } -} - -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type) { - if (phy_is_present(mod_id, cc_id)) { - RC.eNB[mod_id][cc_id]->frame_parms.frame_type = frame_type; - } else { - LOG_E(FLEXRAN_AGENT, "can not set frame_type to %d in PHY: PHY is not present\n", frame_type); - } - - if (rrc_is_present(mod_id)) { - RC.rrc[mod_id]->configuration.frame_type[cc_id] = frame_type; - } else { - LOG_E(FLEXRAN_AGENT, "can not set frame_type to %d in RRC: RRC is not present\n", frame_type); - } -} - -/*********** PDCP *************/ - -uint16_t flexran_get_pdcp_uid_from_rnti(mid_t mod_id, rnti_t rnti) { - if (rnti == NOT_A_RNTI) return 0; - - if (mod_id < 0 || mod_id >= RC.nb_inst) - return 0; - - for (uint16_t pdcp_uid = 0; pdcp_uid < MAX_MOBILES_PER_ENB; ++pdcp_uid) { - if (pdcp_enb[mod_id].rnti[pdcp_uid] == rnti) - return pdcp_uid; - } - - return 0; -} - -/*PDCP super frame counter flexRAN*/ -uint32_t flexran_get_pdcp_sfn(mid_t mod_id) { - if (mod_id < 0 || mod_id >= RC.nb_inst) - return 0; - - return pdcp_enb[mod_id].sfn; -} - -/*PDCP super frame counter flexRAN*/ -void flexran_set_pdcp_tx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB) - return; - - Pdcp_stats_tx_window_ms[mod_id][uid] = obs_window > 0 ? obs_window : 1000; -} - -/*PDCP super frame counter flexRAN*/ -void flexran_set_pdcp_rx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB) - return; - - Pdcp_stats_rx_window_ms[mod_id][uid] = obs_window > 0 ? obs_window : 1000; -} - -/*PDCP num tx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_tx(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx[mod_id][uid][lcid]; -} - -/*PDCP num tx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_bytes[mod_id][uid][lcid]; -} - -/*PDCP number of transmit packet / second status flexRAN*/ -uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_w[mod_id][uid][lcid]; -} - -/*PDCP throughput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_bytes_w[mod_id][uid][lcid]; -} - -/*PDCP tx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_sn[mod_id][uid][lcid]; -} - -/*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_aiat[mod_id][uid][lcid]; -} - -/*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_tx_aiat_w[mod_id][uid][lcid]; -} - -/*PDCP num rx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx[mod_id][uid][lcid]; -} - -/*PDCP num rx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_bytes[mod_id][uid][lcid]; -} - -/*PDCP number of received packet / second flexRAN*/ -uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_w[mod_id][uid][lcid]; -} - -/*PDCP gootput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_bytes_w[mod_id][uid][lcid]; -} - -/*PDCP rx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_sn[mod_id][uid][lcid]; -} - -/*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_aiat[mod_id][uid][lcid]; -} - -/*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_aiat_w[mod_id][uid][lcid]; -} - -/*PDCP num of received outoforder pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, uint16_t uid, lcid_t lcid) { - if (mod_id < 0 || mod_id >= RC.nb_inst || uid < 0 - || uid >= MAX_MOBILES_PER_ENB || lcid < 0 || lcid >= NB_RB_MAX) - return 0; - - return Pdcp_stats_rx_outoforder[mod_id][uid][lcid]; -} - -/******************** RRC *****************************/ -/* RRC Wrappers */ -int flexran_call_rrc_reconfiguration (mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - protocol_ctxt_t ctxt; - memset(&ctxt, 0, sizeof(ctxt)); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, ue_context_p->ue_context.rnti, flexran_get_current_frame(mod_id), flexran_get_current_subframe (mod_id), mod_id); - flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt, ue_context_p, 0); - return 0; -} - -int flexran_call_rrc_trigger_handover (mid_t mod_id, rnti_t rnti, int target_cell_id) { - if (!rrc_is_present(mod_id)) return -1; - - protocol_ctxt_t ctxt; - memset(&ctxt, 0, sizeof(ctxt)); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, ue_context_p->ue_context.rnti, flexran_get_current_frame(mod_id), flexran_get_current_subframe (mod_id), mod_id); - return flexran_rrc_eNB_trigger_handover(mod_id, &ctxt, ue_context_p, target_cell_id); -} - -/* RRC Getters */ - -LTE_MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - return ue_context_p->ue_context.measResults->measId; -} - -float flexran_get_rrc_pcell_rsrp(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - return RSRP_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrpResult]; -} - -float flexran_get_rrc_pcell_rsrq(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - return RSRQ_meas_mapping[ue_context_p->ue_context.measResults->measResultPCell.rsrqResult]; -} - -/*Number of neighbouring cells for specific UE*/ -int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - if (!ue_context_p->ue_context.measResults) return 0; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells) return 0; - - //if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return 0; - return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count; -} - -long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - - //if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; - if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1; - - return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->physCellId; -} - -int flexran_get_rrc_neigh_cgi(mid_t mod_id, rnti_t rnti, long cell_id) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - if (!ue_context_p->ue_context.measResults) return 0; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells) return 0; - - //if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return 0; - if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return 0; - - return (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info)?0:1; -} - -uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - uint8_t *cId = ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.cellIdentity.buf; - return ((cId[0] << 20) + (cId[1] << 12) + (cId[2] << 4) + (cId[3] >> 4)); -} - -uint32_t flexran_get_rrc_neigh_cgi_tac(mid_t mod_id, rnti_t rnti, long cell_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - uint8_t *tac = ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->trackingAreaCode.buf; - return (tac[0] << 8) + (tac[1]); -} - -int flexran_get_rrc_neigh_cgi_num_mnc(mid_t mod_id, rnti_t rnti, long cell_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mnc.list.count; -} - -int flexran_get_rrc_neigh_cgi_num_mcc(mid_t mod_id, rnti_t rnti, long cell_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - return ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mcc->list.count; -} - -uint32_t flexran_get_rrc_neigh_cgi_mnc(mid_t mod_id, rnti_t rnti, long cell_id, int mnc_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - int num_mnc = ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mnc.list.count; - return *(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mnc.list.array[mnc_id]) * - ((uint32_t) pow(10, num_mnc - mnc_id - 1)); -} - -uint32_t flexran_get_rrc_neigh_cgi_mcc(mid_t mod_id, rnti_t rnti, long cell_id, int mcc_id) { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - int num_mcc = ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mcc->list.count; - return *(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->cgi_Info->cellGlobalId.plmn_Identity.mcc->list.array[mcc_id]) * - ((uint32_t) pow(10, num_mcc - mcc_id - 1)); -} - -float flexran_get_rrc_neigh_rsrp(mid_t mod_id, rnti_t rnti, long cell_id) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - - //if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; - if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]) return -1; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult) return -1; - - return RSRP_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrpResult)]; -} - -float flexran_get_rrc_neigh_rsrq(mid_t mod_id, rnti_t rnti, long cell_id) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measResults) return -1; - - if (!ue_context_p->ue_context.measResults->measResultNeighCells) return -1; - - //if (ue_context_p->ue_context.measResults->measResultNeighCells->present != LTE_MeasResults__measResultNeighCells_PR_measResultListEUTRA) return -1; - if (!ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult) return -1; - - return RSRQ_meas_mapping[*(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[cell_id]->measResult.rsrqResult)]; -} - -/* Measurement offsets */ - -long flexran_get_rrc_ofp(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - return ue_context_p->ue_context.measurement_info->offsetFreq; -} - -long flexran_get_rrc_ofn(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - return ue_context_p->ue_context.measurement_info->offsetFreq; -} - -long flexran_get_rrc_ocp(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - switch (ue_context_p->ue_context.measurement_info->cellIndividualOffset[0]) { - case LTE_Q_OffsetRange_dB_24: - return -24; - - case LTE_Q_OffsetRange_dB_22: - return -22; - - case LTE_Q_OffsetRange_dB_20: - return -20; - - case LTE_Q_OffsetRange_dB_18: - return -18; - - case LTE_Q_OffsetRange_dB_16: - return -16; - - case LTE_Q_OffsetRange_dB_14: - return -14; - - case LTE_Q_OffsetRange_dB_12: - return -12; - - case LTE_Q_OffsetRange_dB_10: - return -10; - - case LTE_Q_OffsetRange_dB_8: - return -8; - - case LTE_Q_OffsetRange_dB_6: - return -6; - - case LTE_Q_OffsetRange_dB_5: - return -5; - - case LTE_Q_OffsetRange_dB_4: - return -4; - - case LTE_Q_OffsetRange_dB_3: - return -3; - - case LTE_Q_OffsetRange_dB_2: - return -2; - - case LTE_Q_OffsetRange_dB_1: - return -1; - - case LTE_Q_OffsetRange_dB0: - return 0; - - case LTE_Q_OffsetRange_dB1: - return 1; - - case LTE_Q_OffsetRange_dB2: - return 2; - - case LTE_Q_OffsetRange_dB3: - return 3; - - case LTE_Q_OffsetRange_dB4: - return 4; - - case LTE_Q_OffsetRange_dB5: - return 5; - - case LTE_Q_OffsetRange_dB6: - return 6; - - case LTE_Q_OffsetRange_dB8: - return 8; - - case LTE_Q_OffsetRange_dB10: - return 10; - - case LTE_Q_OffsetRange_dB12: - return 12; - - case LTE_Q_OffsetRange_dB14: - return 14; - - case LTE_Q_OffsetRange_dB16: - return 16; - - case LTE_Q_OffsetRange_dB18: - return 18; - - case LTE_Q_OffsetRange_dB20: - return 20; - - case LTE_Q_OffsetRange_dB22: - return 22; - - case LTE_Q_OffsetRange_dB24: - return 24; - - default: - return -99; - } -} - -long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - switch (ue_context_p->ue_context.measurement_info->cellIndividualOffset[cell_id+1]) { - case LTE_Q_OffsetRange_dB_24: - return -24; - - case LTE_Q_OffsetRange_dB_22: - return -22; - - case LTE_Q_OffsetRange_dB_20: - return -20; - - case LTE_Q_OffsetRange_dB_18: - return -18; - - case LTE_Q_OffsetRange_dB_16: - return -16; - - case LTE_Q_OffsetRange_dB_14: - return -14; - - case LTE_Q_OffsetRange_dB_12: - return -12; - - case LTE_Q_OffsetRange_dB_10: - return -10; - - case LTE_Q_OffsetRange_dB_8: - return -8; - - case LTE_Q_OffsetRange_dB_6: - return -6; - - case LTE_Q_OffsetRange_dB_5: - return -5; - - case LTE_Q_OffsetRange_dB_4: - return -4; - - case LTE_Q_OffsetRange_dB_3: - return -3; - - case LTE_Q_OffsetRange_dB_2: - return -2; - - case LTE_Q_OffsetRange_dB_1: - return -1; - - case LTE_Q_OffsetRange_dB0: - return 0; - - case LTE_Q_OffsetRange_dB1: - return 1; - - case LTE_Q_OffsetRange_dB2: - return 2; - - case LTE_Q_OffsetRange_dB3: - return 3; - - case LTE_Q_OffsetRange_dB4: - return 4; - - case LTE_Q_OffsetRange_dB5: - return 5; - - case LTE_Q_OffsetRange_dB6: - return 6; - - case LTE_Q_OffsetRange_dB8: - return 8; - - case LTE_Q_OffsetRange_dB10: - return 10; - - case LTE_Q_OffsetRange_dB12: - return 12; - - case LTE_Q_OffsetRange_dB14: - return 14; - - case LTE_Q_OffsetRange_dB16: - return 16; - - case LTE_Q_OffsetRange_dB18: - return 18; - - case LTE_Q_OffsetRange_dB20: - return 20; - - case LTE_Q_OffsetRange_dB22: - return 22; - - case LTE_Q_OffsetRange_dB24: - return 24; - - default: - return -99; - } -} - -long flexran_get_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - switch (ue_context_p->ue_context.measurement_info->filterCoefficientRSRP) { - case LTE_FilterCoefficient_fc0: - return 0; - - case LTE_FilterCoefficient_fc1: - return 1; - - case LTE_FilterCoefficient_fc2: - return 2; - - case LTE_FilterCoefficient_fc3: - return 3; - - case LTE_FilterCoefficient_fc4: - return 4; - - case LTE_FilterCoefficient_fc5: - return 5; - - case LTE_FilterCoefficient_fc6: - return 6; - - case LTE_FilterCoefficient_fc7: - return 7; - - case LTE_FilterCoefficient_fc8: - return 8; - - case LTE_FilterCoefficient_fc9: - return 9; - - case LTE_FilterCoefficient_fc11: - return 11; - - case LTE_FilterCoefficient_fc13: - return 13; - - case LTE_FilterCoefficient_fc15: - return 15; - - case LTE_FilterCoefficient_fc17: - return 17; - - case LTE_FilterCoefficient_fc19: - return 19; - - case LTE_FilterCoefficient_spare1: - return -1; /* spare means no coefficient */ - - default: - return -1; - } -} - -long flexran_get_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - switch (ue_context_p->ue_context.measurement_info->filterCoefficientRSRQ) { - case LTE_FilterCoefficient_fc0: - return 0; - - case LTE_FilterCoefficient_fc1: - return 1; - - case LTE_FilterCoefficient_fc2: - return 2; - - case LTE_FilterCoefficient_fc3: - return 3; - - case LTE_FilterCoefficient_fc4: - return 4; - - case LTE_FilterCoefficient_fc5: - return 5; - - case LTE_FilterCoefficient_fc6: - return 6; - - case LTE_FilterCoefficient_fc7: - return 7; - - case LTE_FilterCoefficient_fc8: - return 8; - - case LTE_FilterCoefficient_fc9: - return 9; - - case LTE_FilterCoefficient_fc11: - return 11; - - case LTE_FilterCoefficient_fc13: - return 13; - - case LTE_FilterCoefficient_fc15: - return 15; - - case LTE_FilterCoefficient_fc17: - return 17; - - case LTE_FilterCoefficient_fc19: - return 19; - - case LTE_FilterCoefficient_spare1: - return -1; /* spare means no coefficient */ - - default: - return -1; - } -} - -/* Periodic event */ - -long flexran_get_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->per_event) return -1; - - return ue_context_p->ue_context.measurement_info->events->per_event->maxReportCells; -} - -/* A3 event */ - -long flexran_get_rrc_a3_event_hysteresis(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - return ue_context_p->ue_context.measurement_info->events->a3_event->hysteresis; -} - -long flexran_get_rrc_a3_event_timeToTrigger(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - switch (ue_context_p->ue_context.measurement_info->events->a3_event->timeToTrigger) { - case LTE_TimeToTrigger_ms0: - return 0; - - case LTE_TimeToTrigger_ms40: - return 40; - - case LTE_TimeToTrigger_ms64: - return 64; - - case LTE_TimeToTrigger_ms80: - return 80; - - case LTE_TimeToTrigger_ms100: - return 100; - - case LTE_TimeToTrigger_ms128: - return 128; - - case LTE_TimeToTrigger_ms160: - return 160; - - case LTE_TimeToTrigger_ms256: - return 256; - - case LTE_TimeToTrigger_ms320: - return 320; - - case LTE_TimeToTrigger_ms480: - return 480; - - case LTE_TimeToTrigger_ms512: - return 512; - - case LTE_TimeToTrigger_ms640: - return 640; - - case LTE_TimeToTrigger_ms1024: - return 1024; - - case LTE_TimeToTrigger_ms1280: - return 1280; - - case LTE_TimeToTrigger_ms2560: - return 2560; - - case LTE_TimeToTrigger_ms5120: - return 5120; - - default: - return -1; - } -} - -long flexran_get_rrc_a3_event_maxReportCells(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - return ue_context_p->ue_context.measurement_info->events->a3_event->maxReportCells; -} - -long flexran_get_rrc_a3_event_a3_offset(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - return ue_context_p->ue_context.measurement_info->events->a3_event->a3_offset; -} - -int flexran_get_rrc_a3_event_reportOnLeave(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - return ue_context_p->ue_context.measurement_info->events->a3_event->reportOnLeave; -} - -/* RRC Setters */ - -/* Measurement offsets */ - -int flexran_set_rrc_ofp(mid_t mod_id, rnti_t rnti, long offsetFreq) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!((offsetFreq >= -15) && (offsetFreq <= 15))) return -1; - - ue_context_p->ue_context.measurement_info->offsetFreq = offsetFreq; - return 0; -} - -int flexran_set_rrc_ofn(mid_t mod_id, rnti_t rnti, long offsetFreq) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!((offsetFreq >= -15) && (offsetFreq <= 15))) return -1; - - ue_context_p->ue_context.measurement_info->offsetFreq = offsetFreq; - return 0; -} - -int flexran_set_rrc_ocp(mid_t mod_id, rnti_t rnti, long cellIndividualOffset) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - LTE_Q_OffsetRange_t *cio = &ue_context_p->ue_context.measurement_info->cellIndividualOffset[0]; - - switch (cellIndividualOffset) { - case -24: - *cio = LTE_Q_OffsetRange_dB_24; - break; - - case -22: - *cio = LTE_Q_OffsetRange_dB_22; - break; - - case -20: - *cio = LTE_Q_OffsetRange_dB_20; - break; - - case -18: - *cio = LTE_Q_OffsetRange_dB_18; - break; - - case -16: - *cio = LTE_Q_OffsetRange_dB_16; - break; - - case -14: - *cio = LTE_Q_OffsetRange_dB_14; - break; - - case -12: - *cio = LTE_Q_OffsetRange_dB_12; - break; - - case -10: - *cio = LTE_Q_OffsetRange_dB_10; - break; - - case -8: - *cio = LTE_Q_OffsetRange_dB_8; - break; - - case -6: - *cio = LTE_Q_OffsetRange_dB_6; - break; - - case -5: - *cio = LTE_Q_OffsetRange_dB_5; - break; - - case -4: - *cio = LTE_Q_OffsetRange_dB_4; - break; - - case -3: - *cio = LTE_Q_OffsetRange_dB_3; - break; - - case -2: - *cio = LTE_Q_OffsetRange_dB_2; - break; - - case -1: - *cio = LTE_Q_OffsetRange_dB_1; - break; - - case 0: - *cio = LTE_Q_OffsetRange_dB0; - break; - - case 1: - *cio = LTE_Q_OffsetRange_dB1; - break; - - case 2: - *cio = LTE_Q_OffsetRange_dB2; - break; - - case 3: - *cio = LTE_Q_OffsetRange_dB3; - break; - - case 4: - *cio = LTE_Q_OffsetRange_dB4; - break; - - case 5: - *cio = LTE_Q_OffsetRange_dB5; - break; - - case 6: - *cio = LTE_Q_OffsetRange_dB6; - break; - - case 8: - *cio = LTE_Q_OffsetRange_dB8; - break; - - case 10: - *cio = LTE_Q_OffsetRange_dB10; - break; - - case 12: - *cio = LTE_Q_OffsetRange_dB12; - break; - - case 14: - *cio = LTE_Q_OffsetRange_dB14; - break; - - case 16: - *cio = LTE_Q_OffsetRange_dB16; - break; - - case 18: - *cio = LTE_Q_OffsetRange_dB18; - break; - - case 20: - *cio = LTE_Q_OffsetRange_dB20; - break; - - case 22: - *cio = LTE_Q_OffsetRange_dB22; - break; - - case 24: - *cio = LTE_Q_OffsetRange_dB24; - break; - - default: - return -1; - } - - return 0; -} - -int flexran_set_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id, long cellIndividualOffset) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - LTE_Q_OffsetRange_t *cio = &ue_context_p->ue_context.measurement_info->cellIndividualOffset[cell_id+1]; - - switch (cellIndividualOffset) { - case -24: - *cio = LTE_Q_OffsetRange_dB_24; - break; - - case -22: - *cio = LTE_Q_OffsetRange_dB_22; - break; - - case -20: - *cio = LTE_Q_OffsetRange_dB_20; - break; - - case -18: - *cio = LTE_Q_OffsetRange_dB_18; - break; - - case -16: - *cio = LTE_Q_OffsetRange_dB_16; - break; - - case -14: - *cio = LTE_Q_OffsetRange_dB_14; - break; - - case -12: - *cio = LTE_Q_OffsetRange_dB_12; - break; - - case -10: - *cio = LTE_Q_OffsetRange_dB_10; - break; - - case -8: - *cio = LTE_Q_OffsetRange_dB_8; - break; - - case -6: - *cio = LTE_Q_OffsetRange_dB_6; - break; - - case -5: - *cio = LTE_Q_OffsetRange_dB_5; - break; - - case -4: - *cio = LTE_Q_OffsetRange_dB_4; - break; - - case -3: - *cio = LTE_Q_OffsetRange_dB_3; - break; - - case -2: - *cio = LTE_Q_OffsetRange_dB_2; - break; - - case -1: - *cio = LTE_Q_OffsetRange_dB_1; - break; - - case 0: - *cio = LTE_Q_OffsetRange_dB0; - break; - - case 1: - *cio = LTE_Q_OffsetRange_dB1; - break; - - case 2: - *cio = LTE_Q_OffsetRange_dB2; - break; - - case 3: - *cio = LTE_Q_OffsetRange_dB3; - break; - - case 4: - *cio = LTE_Q_OffsetRange_dB4; - break; - - case 5: - *cio = LTE_Q_OffsetRange_dB5; - break; - - case 6: - *cio = LTE_Q_OffsetRange_dB6; - break; - - case 8: - *cio = LTE_Q_OffsetRange_dB8; - break; - - case 10: - *cio = LTE_Q_OffsetRange_dB10; - break; - - case 12: - *cio = LTE_Q_OffsetRange_dB12; - break; - - case 14: - *cio = LTE_Q_OffsetRange_dB14; - break; - - case 16: - *cio = LTE_Q_OffsetRange_dB16; - break; - - case 18: - *cio = LTE_Q_OffsetRange_dB18; - break; - - case 20: - *cio = LTE_Q_OffsetRange_dB20; - break; - - case 22: - *cio = LTE_Q_OffsetRange_dB22; - break; - - case 24: - *cio = LTE_Q_OffsetRange_dB24; - break; - - default: - return -1; - } - - return 0; -} - -int flexran_set_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti, long filterCoefficientRSRP) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - LTE_FilterCoefficient_t *fc = &ue_context_p->ue_context.measurement_info->filterCoefficientRSRP; - - switch (filterCoefficientRSRP) { - case 0: - *fc = LTE_FilterCoefficient_fc0; - break; - - case 1: - *fc = LTE_FilterCoefficient_fc1; - break; - - case 2: - *fc = LTE_FilterCoefficient_fc2; - break; - - case 3: - *fc = LTE_FilterCoefficient_fc3; - break; - - case 4: - *fc = LTE_FilterCoefficient_fc4; - break; - - case 5: - *fc = LTE_FilterCoefficient_fc5; - break; - - case 6: - *fc = LTE_FilterCoefficient_fc6; - break; - - case 7: - *fc = LTE_FilterCoefficient_fc7; - break; - - case 8: - *fc = LTE_FilterCoefficient_fc8; - break; - - case 9: - *fc = LTE_FilterCoefficient_fc9; - break; - - case 11: - *fc = LTE_FilterCoefficient_fc11; - break; - - case 13: - *fc = LTE_FilterCoefficient_fc13; - break; - - case 15: - *fc = LTE_FilterCoefficient_fc15; - break; - - case 17: - *fc = LTE_FilterCoefficient_fc17; - break; - - case 19: - *fc = LTE_FilterCoefficient_fc19; - break; - - case -1: - *fc = LTE_FilterCoefficient_spare1; - break; - - default: - return -1; - } - - return 0; -} - -int flexran_set_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti, long filterCoefficientRSRQ) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - LTE_FilterCoefficient_t *fc = &ue_context_p->ue_context.measurement_info->filterCoefficientRSRQ; - - switch (filterCoefficientRSRQ) { - case 0: - *fc = LTE_FilterCoefficient_fc0; - break; - - case 1: - *fc = LTE_FilterCoefficient_fc1; - break; - - case 2: - *fc = LTE_FilterCoefficient_fc2; - break; - - case 3: - *fc = LTE_FilterCoefficient_fc3; - break; - - case 4: - *fc = LTE_FilterCoefficient_fc4; - break; - - case 5: - *fc = LTE_FilterCoefficient_fc5; - break; - - case 6: - *fc = LTE_FilterCoefficient_fc6; - break; - - case 7: - *fc = LTE_FilterCoefficient_fc7; - break; - - case 8: - *fc = LTE_FilterCoefficient_fc8; - break; - - case 9: - *fc = LTE_FilterCoefficient_fc9; - break; - - case 11: - *fc = LTE_FilterCoefficient_fc11; - break; - - case 13: - *fc = LTE_FilterCoefficient_fc13; - break; - - case 15: - *fc = LTE_FilterCoefficient_fc15; - break; - - case 17: - *fc = LTE_FilterCoefficient_fc17; - break; - - case 19: - *fc = LTE_FilterCoefficient_fc19; - break; - - case -1: - *fc = LTE_FilterCoefficient_spare1; - break; - - default: - return -1; - } - - return 0; -} - -/* Periodic event */ - -int flexran_set_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti, long maxReportCells) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->per_event) return -1; - - if (!((maxReportCells >= 1) && (maxReportCells <= 8))) return -1; - - ue_context_p->ue_context.measurement_info->events->per_event->maxReportCells = maxReportCells; - return 0; -} - -/* A3 event */ - -int flexran_set_rrc_a3_event_hysteresis(mid_t mod_id, rnti_t rnti, long hysteresis) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - if (!((hysteresis >=0) && (hysteresis <= 30))) return -1; - - ue_context_p->ue_context.measurement_info->events->a3_event->hysteresis = hysteresis; - return 0; -} - -int flexran_set_rrc_a3_event_timeToTrigger(mid_t mod_id, rnti_t rnti, long timeToTrigger) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - LTE_TimeToTrigger_t *ttt = &ue_context_p->ue_context.measurement_info->events->a3_event->timeToTrigger; - - switch (timeToTrigger) { - case 0: - *ttt = LTE_TimeToTrigger_ms0; - break; - - case 40: - *ttt = LTE_TimeToTrigger_ms40; - break; - - case 64: - *ttt = LTE_TimeToTrigger_ms64; - break; - - case 80: - *ttt = LTE_TimeToTrigger_ms80; - break; - - case 100: - *ttt = LTE_TimeToTrigger_ms100; - break; - - case 128: - *ttt = LTE_TimeToTrigger_ms128; - break; - - case 160: - *ttt = LTE_TimeToTrigger_ms160; - break; - - case 256: - *ttt = LTE_TimeToTrigger_ms256; - break; - - case 320: - *ttt = LTE_TimeToTrigger_ms320; - break; - - case 480: - *ttt = LTE_TimeToTrigger_ms480; - break; - - case 512: - *ttt = LTE_TimeToTrigger_ms512; - break; - - case 640: - *ttt = LTE_TimeToTrigger_ms640; - break; - - case 1024: - *ttt = LTE_TimeToTrigger_ms1024; - break; - - case 1280: - *ttt = LTE_TimeToTrigger_ms1280; - break; - - case 2560: - *ttt = LTE_TimeToTrigger_ms2560; - break; - - case 5120: - *ttt = LTE_TimeToTrigger_ms5120; - break; - - default: - return -1; - } - - return 0; -} - -int flexran_set_rrc_a3_event_maxReportCells(mid_t mod_id, rnti_t rnti, long maxReportCells) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - if (!((maxReportCells >= 1) && (maxReportCells <= 8))) return -1; - - ue_context_p->ue_context.measurement_info->events->a3_event->maxReportCells = maxReportCells; - return 0; -} - -int flexran_set_rrc_a3_event_a3_offset(mid_t mod_id, rnti_t rnti, long a3_offset) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - if (!((a3_offset >= -30) && (a3_offset <= 30))) return -1; - - ue_context_p->ue_context.measurement_info->events->a3_event->a3_offset = a3_offset; - return 0; -} - -int flexran_set_rrc_a3_event_reportOnLeave(mid_t mod_id, rnti_t rnti, int reportOnLeave) { - if (!rrc_is_present(mod_id)) return -1; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return -1; - - if (!ue_context_p->ue_context.measurement_info) return -1; - - if (!ue_context_p->ue_context.measurement_info->events) return -1; - - if (!ue_context_p->ue_context.measurement_info->events->a3_event) return -1; - - if (!((reportOnLeave == 0) || (reportOnLeave == 1))) return -1; - - ue_context_p->ue_context.measurement_info->events->a3_event->reportOnLeave = reportOnLeave; - return 0; -} - -int flexran_set_x2_ho_net_control(mid_t mod_id, int x2_ho_net_control) { - if (!rrc_is_present(mod_id)) return -1; - - if (!((x2_ho_net_control == 0) || (x2_ho_net_control == 1))) return -1; - - RC.rrc[mod_id]->x2_ho_net_control = x2_ho_net_control; - return 0; -} - -int flexran_get_x2_ho_net_control(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return -1; - - return RC.rrc[mod_id]->x2_ho_net_control; -} - -uint8_t flexran_get_rrc_num_plmn_ids(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.num_plmn; -} - -uint16_t flexran_get_rrc_mcc(mid_t mod_id, uint8_t index) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.mcc[index]; -} - -uint16_t flexran_get_rrc_mnc(mid_t mod_id, uint8_t index) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.mnc[index]; -} - -uint8_t flexran_get_rrc_mnc_digit_length(mid_t mod_id, uint8_t index) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->configuration.mnc_digit_length[index]; -} - -int flexran_get_rrc_num_adj_cells(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->num_neigh_cells; -} - -int flexran_agent_rrc_gtp_num_e_rab(mid_t mod_id, rnti_t rnti) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - return ue_context_p->ue_context.setup_e_rabs; -} - -int flexran_agent_rrc_gtp_get_e_rab_id(mid_t mod_id, rnti_t rnti, int index) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - return ue_context_p->ue_context.e_rab[index].param.e_rab_id; -} - -int flexran_agent_rrc_gtp_get_teid_enb(mid_t mod_id, rnti_t rnti, int index) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - return ue_context_p->ue_context.enb_gtp_teid[index]; -} - -int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index) { - if (!rrc_is_present(mod_id)) return 0; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - - if (!ue_context_p) return 0; - - return ue_context_p->ue_context.e_rab[index].param.gtp_teid; -} - -uint32_t flexran_get_rrc_enb_ue_s1ap_id(mid_t mod_id, rnti_t rnti) -{ - if (!rrc_is_present(mod_id)) return 0; - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti); - if (!ue_context_p) return -1; - return ue_context_p->ue_context.eNB_ue_s1ap_id; -} - -/**************************** SLICING ****************************/ -Protocol__FlexSliceAlgorithm flexran_get_dl_slice_algo(mid_t mod_id) { - if (!mac_is_present(mod_id)) return PROTOCOL__FLEX_SLICE_ALGORITHM__None; - - switch (RC.mac[mod_id]->pre_processor_dl.algorithm) { - case STATIC_SLICING: - return PROTOCOL__FLEX_SLICE_ALGORITHM__Static; - default: - return PROTOCOL__FLEX_SLICE_ALGORITHM__None; - } -} - -int flexran_set_dl_slice_algo(mid_t mod_id, Protocol__FlexSliceAlgorithm algo) { - if (!mac_is_present(mod_id)) return 0; - eNB_MAC_INST *mac = RC.mac[mod_id]; - const int cc_id = 0; - - pp_impl_param_t dl = mac->pre_processor_dl; - switch (algo) { - case PROTOCOL__FLEX_SLICE_ALGORITHM__Static: - mac->pre_processor_dl = static_dl_init(mod_id, cc_id); - break; - default: - mac->pre_processor_dl.algorithm = 0; - mac->pre_processor_dl.dl = dlsch_scheduler_pre_processor; - mac->pre_processor_dl.dl_algo.data = mac->pre_processor_dl.dl_algo.setup(); - mac->pre_processor_dl.slices = NULL; - break; - } - if (dl.slices) - dl.destroy(&dl.slices); - if (dl.dl_algo.data) - dl.dl_algo.unset(&dl.dl_algo.data); - return 1; -} - -Protocol__FlexSliceAlgorithm flexran_get_ul_slice_algo(mid_t mod_id) { - if (!mac_is_present(mod_id)) return PROTOCOL__FLEX_SLICE_ALGORITHM__None; - - switch (RC.mac[mod_id]->pre_processor_ul.algorithm) { - case STATIC_SLICING: - return PROTOCOL__FLEX_SLICE_ALGORITHM__Static; - default: - return PROTOCOL__FLEX_SLICE_ALGORITHM__None; - } -} - -int flexran_set_ul_slice_algo(mid_t mod_id, Protocol__FlexSliceAlgorithm algo) { - if (!mac_is_present(mod_id)) return 0; - eNB_MAC_INST *mac = RC.mac[mod_id]; - const int cc_id = 0; - - pp_impl_param_t ul = mac->pre_processor_ul; - switch (algo) { - case PROTOCOL__FLEX_SLICE_ALGORITHM__Static: - mac->pre_processor_ul = static_ul_init(mod_id, cc_id); - break; - default: - mac->pre_processor_ul.algorithm = 0; - mac->pre_processor_ul.ul = ulsch_scheduler_pre_processor; - mac->pre_processor_ul.ul_algo.data = mac->pre_processor_ul.ul_algo.setup(); - mac->pre_processor_ul.slices = NULL; - break; - } - if (ul.slices) - ul.destroy(&ul.slices); - if (ul.ul_algo.data) - ul.ul_algo.unset(&ul.ul_algo.data); - return 1; -} - -int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return -1; - slice_info_t *slices = RC.mac[mod_id]->pre_processor_dl.slices; - if (!slices) return -1; - const int idx = slices->UE_assoc_slice[ue_id]; - return slices->s[idx]->id; -} - -int flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) { - if (!mac_is_present(mod_id)) return 0; - int idx = flexran_find_dl_slice(mod_id, slice_id); - if (idx < 0) return 0; - pp_impl_param_t *dl = &RC.mac[mod_id]->pre_processor_dl; - dl->move_UE(dl->slices, ue_id, idx); - return 1; -} - -int flexran_get_ue_ul_slice_id(mid_t mod_id, mid_t ue_id) { - if (!mac_is_present(mod_id)) return -1; - slice_info_t *slices = RC.mac[mod_id]->pre_processor_ul.slices; - if (!slices) return -1; - const int idx = slices->UE_assoc_slice[ue_id]; - return slices->s[idx]->id; -} - -int flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) { - if (!mac_is_present(mod_id)) return 0; - int idx = flexran_find_ul_slice(mod_id, slice_id); - if (idx < 0) return 0; - pp_impl_param_t *ul = &RC.mac[mod_id]->pre_processor_ul; - ul->move_UE(ul->slices, ue_id, idx); - return 1; -} - -int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object) { - if (!mac_is_present(mod_id)) return 0; - void *params = NULL; - switch (s->params_case) { - case PROTOCOL__FLEX_SLICE__PARAMS_STATIC: - params = malloc(sizeof(static_slice_param_t)); - if (!params) return 0; - ((static_slice_param_t *)params)->posLow = s->static_->poslow; - ((static_slice_param_t *)params)->posHigh = s->static_->poshigh; - break; - default: - break; - } - pp_impl_param_t *dl = &RC.mac[mod_id]->pre_processor_dl; - char *l = s->label ? strdup(s->label) : NULL; - void *algo = &dl->dl_algo; // default scheduler - if (s->scheduler) { - algo = dlsym(object, s->scheduler); - if (!algo) { - free(params); - LOG_E(FLEXRAN_AGENT, "cannot locate scheduler '%s'\n", s->scheduler); - return -15; - } - } - return dl->addmod_slice(dl->slices, s->id, l, algo, params); -} - -int flexran_remove_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) { - if (!mac_is_present(mod_id)) return 0; - const int idx = flexran_find_dl_slice(mod_id, s->id); - if (idx < 0) return 0; - pp_impl_param_t *dl = &RC.mac[mod_id]->pre_processor_dl; - return dl->remove_slice(dl->slices, idx); -} - -int flexran_find_dl_slice(mid_t mod_id, slice_id_t slice_id) { - if (!mac_is_present(mod_id)) return -1; - slice_info_t *si = RC.mac[mod_id]->pre_processor_dl.slices; - for (int i = 0; i < si->num; ++i) - if (si->s[i]->id == slice_id) - return i; - return -1; -} - -void flexran_get_dl_slice(mid_t mod_id, - int slice_idx, - Protocol__FlexSlice *slice, - Protocol__FlexSliceAlgorithm algo) { - if (!mac_is_present(mod_id)) return; - slice_t *s_ = RC.mac[mod_id]->pre_processor_dl.slices->s[slice_idx]; - slice->has_id = 1; - slice->id = s_->id; - slice->label = s_->label; - slice->scheduler = s_->dl_algo.name; - slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS__NOT_SET; - switch (algo) { - case PROTOCOL__FLEX_SLICE_ALGORITHM__Static: - slice->static_ = malloc(sizeof(Protocol__FlexSliceStatic)); - if (!slice->static_) return; - protocol__flex_slice_static__init(slice->static_); - slice->static_->has_poslow = 1; - slice->static_->poslow = ((static_slice_param_t *)s_->algo_data)->posLow; - slice->static_->has_poshigh = 1; - slice->static_->poshigh = ((static_slice_param_t *)s_->algo_data)->posHigh; - slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS_STATIC; - break; - default: - break; - } -} - -int flexran_get_num_dl_slices(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - if (!RC.mac[mod_id]->pre_processor_dl.slices) return 0; - return RC.mac[mod_id]->pre_processor_dl.slices->num; -} - -int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object) { - if (!mac_is_present(mod_id)) return -1; - void *params = NULL; - switch (s->params_case) { - case PROTOCOL__FLEX_SLICE__PARAMS_STATIC: - params = malloc(sizeof(static_slice_param_t)); - if (!params) return 0; - ((static_slice_param_t *)params)->posLow = s->static_->poslow; - ((static_slice_param_t *)params)->posHigh = s->static_->poshigh; - break; - default: - break; - } - pp_impl_param_t *ul = &RC.mac[mod_id]->pre_processor_ul; - char *l = s->label ? strdup(s->label) : NULL; - void *algo = &ul->ul_algo; // default scheduler - if (s->scheduler) { - algo = dlsym(object, s->scheduler); - if (!algo) { - free(params); - LOG_E(FLEXRAN_AGENT, "cannot locate scheduler '%s'\n", s->scheduler); - return -15; - } - } - return ul->addmod_slice(ul->slices, s->id, l, algo, params); -} - -int flexran_remove_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s) { - if (!mac_is_present(mod_id)) return 0; - const int idx = flexran_find_ul_slice(mod_id, s->id); - if (idx < 0) return 0; - pp_impl_param_t *ul = &RC.mac[mod_id]->pre_processor_ul; - return ul->remove_slice(ul->slices, idx); -} - -int flexran_find_ul_slice(mid_t mod_id, slice_id_t slice_id) { - if (!mac_is_present(mod_id)) return -1; - slice_info_t *si = RC.mac[mod_id]->pre_processor_ul.slices; - for (int i = 0; i < si->num; ++i) - if (si->s[i]->id == slice_id) - return i; - return -1; -} - -void flexran_get_ul_slice(mid_t mod_id, - int slice_idx, - Protocol__FlexSlice *slice, - Protocol__FlexSliceAlgorithm algo) { - if (!mac_is_present(mod_id)) return; - slice_t *s_ = RC.mac[mod_id]->pre_processor_ul.slices->s[slice_idx]; - slice->has_id = 1; - slice->id = s_->id; - slice->label = s_->label; - slice->scheduler = s_->ul_algo.name; - slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS__NOT_SET; - switch (algo) { - case PROTOCOL__FLEX_SLICE_ALGORITHM__Static: - slice->static_ = malloc(sizeof(Protocol__FlexSliceStatic)); - if (!slice->static_) return; - protocol__flex_slice_static__init(slice->static_); - slice->static_->has_poslow = 1; - slice->static_->poslow = ((static_slice_param_t *)s_->algo_data)->posLow; - slice->static_->has_poshigh = 1; - slice->static_->poshigh = ((static_slice_param_t *)s_->algo_data)->posHigh; - slice->params_case = PROTOCOL__FLEX_SLICE__PARAMS_STATIC; - break; - default: - break; - } - -} - -int flexran_get_num_ul_slices(mid_t mod_id) { - if (!mac_is_present(mod_id)) return 0; - if (!RC.mac[mod_id]->pre_processor_ul.slices) return 0; - return RC.mac[mod_id]->pre_processor_ul.slices->num; -} - -char *flexran_get_dl_scheduler_name(mid_t mod_id) { - if (!mac_is_present(mod_id)) return NULL; - return RC.mac[mod_id]->pre_processor_dl.dl_algo.name; -} - -int flexran_set_dl_scheduler(mid_t mod_id, char *sched, void *object) { - if (!mac_is_present(mod_id)) return -1; - void *d = dlsym(object, sched); - if (!d) return -2; - pp_impl_param_t *dl_pp = &RC.mac[mod_id]->pre_processor_dl; - dl_pp->dl_algo.unset(&dl_pp->dl_algo.data); - dl_pp->dl_algo = *(default_sched_dl_algo_t *) d; - dl_pp->dl_algo.data = dl_pp->dl_algo.setup(); - return 0; -} - -char *flexran_get_ul_scheduler_name(mid_t mod_id) { - if (!mac_is_present(mod_id)) return NULL; - return RC.mac[mod_id]->pre_processor_ul.ul_algo.name; -} - -int flexran_set_ul_scheduler(mid_t mod_id, char *sched, void *object) { - if (!mac_is_present(mod_id)) return -1; - void *d = dlsym(object, sched); - if (!d) return -2; - pp_impl_param_t *ul_pp = &RC.mac[mod_id]->pre_processor_ul; - ul_pp->ul_algo.unset(&ul_pp->ul_algo.data); - ul_pp->ul_algo = *(default_sched_ul_algo_t *) d; - ul_pp->ul_algo.data = ul_pp->ul_algo.setup(); - return 0; -} - -/************************** S1AP **************************/ -int flexran_get_s1ap_mme_pending(mid_t mod_id){ - if (!rrc_is_present(mod_id)) return -1; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - return s1ap->s1ap_mme_pending_nb; -} - -int flexran_get_s1ap_mme_connected(mid_t mod_id){ - if (!rrc_is_present(mod_id)) return -1; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - return s1ap->s1ap_mme_associated_nb; -} - -char* flexran_get_s1ap_enb_s1_ip(mid_t mod_id){ - if (!rrc_is_present(mod_id)) return NULL; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return NULL; - if (s1ap->eNB_s1_ip.ipv4) - return &s1ap->eNB_s1_ip.ipv4_address[0]; - if (s1ap->eNB_s1_ip.ipv6) - return &s1ap->eNB_s1_ip.ipv6_address[0]; - return NULL; -} - -char* flexran_get_s1ap_enb_name(mid_t mod_id){ - if (!rrc_is_present(mod_id)) return NULL; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return NULL; - return s1ap->eNB_name; -} - -int flexran_get_s1ap_nb_mme(mid_t mod_id) { - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return 0; - struct s1ap_eNB_mme_data_s *mme = NULL; - int count = 0; - RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head) { - count++; - } - return count; -} - -int flexran_get_s1ap_nb_ue(mid_t mod_id) { - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return 0; - struct s1ap_eNB_ue_context_s *ue = NULL; - int count = 0; - RB_FOREACH(ue, s1ap_ue_map, &s1ap->s1ap_ue_head) { - count++; - } - return count; -} - -int flexran_get_s1ap_mme_conf(mid_t mod_id, mid_t mme_index, Protocol__FlexS1apMme * mme_conf){ - if (!rrc_is_present(mod_id)) return -1; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - - struct served_gummei_s *gummei_p = NULL; - struct plmn_identity_s *served_plmn_p = NULL; - struct served_group_id_s *group_id_p = NULL; - struct mme_code_s *mme_code_p = NULL; - int i = 0; - Protocol__FlexGummei **served_gummeis; - Protocol__FlexPlmn **requested_plmns; - - struct s1ap_eNB_mme_data_s *mme = NULL; - - RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head){ - if (mme_index == 0) break; - mme_index--; - } - if (mme_index > 0) return -1; - - if (mme->mme_s1_ip.ipv4) { - mme_conf->s1_ip = (char*) &mme->mme_s1_ip.ipv4_address[0]; - } else if (mme->mme_s1_ip.ipv6) { - mme_conf->s1_ip = (char*) &mme->mme_s1_ip.ipv6_address[0]; - } - mme_conf->name = mme->mme_name; - mme_conf->has_state = 1; - mme_conf->state = mme->state; - - mme_conf->n_served_gummeis = 0; - STAILQ_FOREACH(gummei_p, &mme->served_gummei, next) { - mme_conf->n_served_gummeis++; - } - if (mme_conf->n_served_gummeis > 0) { - served_gummeis = calloc(mme_conf->n_served_gummeis, sizeof(Protocol__FlexGummei*)); - if(served_gummeis == NULL) return -1; - - STAILQ_FOREACH(gummei_p, &mme->served_gummei, next) { - served_plmn_p = STAILQ_FIRST(&gummei_p->served_plmns); - group_id_p = STAILQ_FIRST(&gummei_p->served_group_ids); - mme_code_p = STAILQ_FIRST(&gummei_p->mme_codes); - - served_gummeis[i] = malloc(sizeof(Protocol__FlexGummei)); - if (!served_gummeis[i]) return -1; - protocol__flex_gummei__init(served_gummeis[i]); - served_gummeis[i]->plmn = malloc(sizeof(Protocol__FlexPlmn)); - if (!served_gummeis[i]->plmn) return -1; - protocol__flex_plmn__init(served_gummeis[i]->plmn); - - if (served_plmn_p) { - served_gummeis[i]->plmn->has_mcc = 1; - served_gummeis[i]->plmn->mcc = served_plmn_p->mcc; - served_gummeis[i]->plmn->has_mnc = 1; - served_gummeis[i]->plmn->mnc = served_plmn_p->mnc; - served_gummeis[i]->plmn->has_mnc_length = 1; - served_gummeis[i]->plmn->mnc_length = served_plmn_p-> mnc_digit_length; - STAILQ_NEXT(served_plmn_p, next); - } - if (group_id_p) { - served_gummeis[i]->has_mme_group_id = 1; - served_gummeis[i]->mme_group_id = group_id_p->mme_group_id; - STAILQ_NEXT(group_id_p, next); - } - if (mme_code_p){ - served_gummeis[i]->has_mme_code = 1; - served_gummeis[i]->mme_code = mme_code_p->mme_code; - STAILQ_NEXT(mme_code_p, next); - } - i++; - } - - mme_conf->served_gummeis = served_gummeis; - } - - // requested PLMNS - mme_conf->n_requested_plmns = mme->broadcast_plmn_num; - if (mme_conf->n_requested_plmns > 0){ - requested_plmns = calloc(mme_conf->n_requested_plmns, sizeof(Protocol__FlexPlmn*)); - if(requested_plmns == NULL) return -1; - for(int i = 0; i < mme_conf->n_requested_plmns; i++) { - requested_plmns[i] = malloc(sizeof(Protocol__FlexPlmn)); - if (!requested_plmns[i]) return -1; - protocol__flex_plmn__init(requested_plmns[i]); - requested_plmns[i]->mcc = s1ap->mcc[mme->broadcast_plmn_index[i]]; - requested_plmns[i]->has_mcc = 1; - requested_plmns[i]->mnc = s1ap->mnc[mme->broadcast_plmn_index[i]]; - requested_plmns[i]->has_mnc = 1; - requested_plmns[i]->mnc_length = s1ap->mnc_digit_length[mme->broadcast_plmn_index[i]]; - requested_plmns[i]->has_mnc_length = 1; - } - mme_conf->requested_plmns = requested_plmns; - } - - mme_conf->has_rel_capacity = 1; - mme_conf->rel_capacity = mme->relative_mme_capacity; - return 0; -} - -int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - if (!rrc_is_present(mod_id)) return -2; - - /* Reconstruct S1AP_REGISTER_ENB_REQ */ - MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, S1AP_REGISTER_ENB_REQ); - RCconfig_S1(m, mod_id); - - const int CC_id = 0; - eNB_RRC_INST *rrc = RC.rrc[CC_id]; - RrcConfigurationReq *conf = &rrc->configuration; - S1AP_REGISTER_ENB_REQ(m).num_plmn = conf->num_plmn; - for (int i = 0; i < conf->num_plmn; ++i) { - S1AP_REGISTER_ENB_REQ(m).mcc[i] = conf->mcc[i]; - S1AP_REGISTER_ENB_REQ(m).mnc[i] = conf->mnc[i]; - S1AP_REGISTER_ENB_REQ(m).mnc_digit_length[i] = conf->mnc_digit_length[i]; - } - - /* reconstruct MME list, it might have been updated since initial - * configuration */ - S1AP_REGISTER_ENB_REQ(m).nb_mme = 0; - struct s1ap_eNB_mme_data_s *mme = NULL; - RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head) { - const int n = S1AP_REGISTER_ENB_REQ(m).nb_mme; - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4 = mme->mme_s1_ip.ipv4; - strcpy(S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4_address, mme->mme_s1_ip.ipv4_address); - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv6 = mme->mme_s1_ip.ipv6; - strcpy(S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv6_address, mme->mme_s1_ip.ipv6_address); - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = mme->broadcast_plmn_num; - for (int i = 0; i < mme->broadcast_plmn_num; ++i) - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = mme->broadcast_plmn_index[i]; - S1AP_REGISTER_ENB_REQ(m).mme_port[n] = mme->mme_port; - S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; - } - - if (S1AP_REGISTER_ENB_REQ(m).nb_mme + n_mme > S1AP_MAX_NB_MME_IP_ADDRESS) - return -1; - - const int n = S1AP_REGISTER_ENB_REQ(m).nb_mme; - strcpy(S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4_address, mme_ipv4[0]); - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4 = 1; - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv6 = 0; - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = S1AP_REGISTER_ENB_REQ(m).num_plmn; - for (int i = 0; i < S1AP_REGISTER_ENB_REQ(m).num_plmn; ++i) - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = i; - S1AP_REGISTER_ENB_REQ(m).mme_port[n] = S1AP_PORT_NUMBER; - S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; - - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(mod_id), m); - - return 0; -} - -int flexran_remove_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - struct s1ap_eNB_mme_data_s *mme = NULL; - RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head) { - if (mme->mme_s1_ip.ipv4 - && strncmp(mme->mme_s1_ip.ipv4_address, mme_ipv4[0], 16) == 0) - break; - } - if (!mme) - return -2; - - MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, SCTP_CLOSE_ASSOCIATION); - SCTP_CLOSE_ASSOCIATION(m).assoc_id = mme->assoc_id; - itti_send_msg_to_task (TASK_SCTP, ENB_MODULE_ID_TO_INSTANCE(mod_id), m); - - switch (mme->state) { - case S1AP_ENB_STATE_WAITING: - s1ap->s1ap_mme_nb -= 1; - if (s1ap->s1ap_mme_pending_nb > 0) - s1ap->s1ap_mme_pending_nb -= 1; - break; - case S1AP_ENB_STATE_CONNECTED: - case S1AP_ENB_OVERLOAD: /* I am not sure the decrements are right here */ - s1ap->s1ap_mme_nb -= 1; - s1ap->s1ap_mme_associated_nb -= 1; - break; - case S1AP_ENB_STATE_DISCONNECTED: - default: - break; - } - RB_REMOVE(s1ap_mme_map, &s1ap->s1ap_mme_head, mme); - - return 0; -} - -int flexran_set_new_plmn_id(mid_t mod_id, int CC_id, size_t n_plmn, Protocol__FlexPlmn **plmn_id) { - if (!rrc_is_present(mod_id)) - return -1; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) - return -2; - - eNB_RRC_INST *rrc = RC.rrc[CC_id]; - RrcConfigurationReq *conf = &rrc->configuration; - - uint8_t num_plmn_old = conf->num_plmn; - uint16_t mcc[PLMN_LIST_MAX_SIZE]; - uint16_t mnc[PLMN_LIST_MAX_SIZE]; - uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; - for (int i = 0; i < num_plmn_old; ++i) { - mcc[i] = conf->mcc[i]; - mnc[i] = conf->mnc[i]; - mnc_digit_length[i] = conf->mnc_digit_length[i]; - } - - conf->num_plmn = (uint8_t) n_plmn; - for (int i = 0; i < conf->num_plmn; ++i) { - conf->mcc[i] = plmn_id[i]->mcc; - conf->mnc[i] = plmn_id[i]->mnc; - conf->mnc_digit_length[i] = plmn_id[i]->mnc_length; - } - - rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id]; - extern uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, - int Mod_id, - int CC_id, - BOOLEAN_t brOption, - RrcConfigurationReq *configuration); - carrier->sizeof_SIB1 = do_SIB1(carrier, mod_id, CC_id, false, conf); - if (carrier->sizeof_SIB1 < 0) - return -1337; /* SIB1 encoding failed, hell will probably break loose */ - - s1ap->num_plmn = (uint8_t) n_plmn; - for (int i = 0; i < conf->num_plmn; ++i) { - s1ap->mcc[i] = plmn_id[i]->mcc; - s1ap->mnc[i] = plmn_id[i]->mnc; - s1ap->mnc_digit_length[i] = plmn_id[i]->mnc_length; - } - - int bpn_failed = 0; - struct s1ap_eNB_mme_data_s *mme = NULL; - RB_FOREACH(mme, s1ap_mme_map, &s1ap->s1ap_mme_head) { - for (int i = 0; i < mme->broadcast_plmn_num; ++i) { - /* search the new index and update. If we don't find, we count this using - * bpn_failed to now how many broadcast_plmns could not be updated */ - int idx = mme->broadcast_plmn_index[i]; - int omcc = mcc[idx]; - int omnc = mnc[idx]; - int omncl = mnc_digit_length[idx]; - int j = 0; - for (j = 0; j < s1ap->num_plmn; ++j) { - if (s1ap->mcc[j] == omcc - && s1ap->mnc[j] == omnc - && s1ap->mnc_digit_length[j] == omncl) { - mme->broadcast_plmn_index[i] = j; - break; - } - } - if (j == s1ap->num_plmn) /* could not find the old PLMN in the new ones */ - bpn_failed++; - } - } - if (bpn_failed > 0) - return -10000 - bpn_failed; - return 0; -} - -int flexran_get_s1ap_ue(mid_t mod_id, rnti_t rnti, Protocol__FlexS1apUe * ue_conf){ - if (!rrc_is_present(mod_id)) return -1; - s1ap_eNB_instance_t *s1ap = s1ap_eNB_get_instance(mod_id); - if (!s1ap) return -1; - - uint32_t enb_ue_s1ap_id = flexran_get_rrc_enb_ue_s1ap_id(mod_id, rnti); - struct s1ap_eNB_ue_context_s *ue = NULL; - RB_FOREACH(ue, s1ap_ue_map, &s1ap->s1ap_ue_head){ - if (ue->eNB_ue_s1ap_id == enb_ue_s1ap_id) break; - } - if (!ue) return 0; // UE does not exist: it might be connected but CN did not answer - - if (ue->mme_ref->mme_s1_ip.ipv4) - ue_conf->mme_s1_ip = (char*) &ue->mme_ref->mme_s1_ip.ipv4_address[0]; - else if (ue->mme_ref->mme_s1_ip.ipv6) - ue_conf->mme_s1_ip = (char*) &ue->mme_ref->mme_s1_ip.ipv6_address[0]; - - ue_conf->has_enb_ue_s1ap_id = 1; - ue_conf->enb_ue_s1ap_id = ue->eNB_ue_s1ap_id; - ue_conf->has_mme_ue_s1ap_id = 1; - ue_conf->mme_ue_s1ap_id = ue->mme_ue_s1ap_id; - - ue_conf->selected_plmn = malloc(sizeof(Protocol__FlexPlmn)); - if (!ue_conf->selected_plmn) return -1; - protocol__flex_plmn__init(ue_conf->selected_plmn); - - ue_conf->selected_plmn->has_mcc = 1; - ue_conf->selected_plmn->mcc = s1ap->mcc[ue->selected_plmn_identity]; - ue_conf->selected_plmn->has_mnc = 1; - ue_conf->selected_plmn->mnc = s1ap->mnc[ue->selected_plmn_identity]; - ue_conf->selected_plmn->has_mnc_length = 1; - ue_conf->selected_plmn->mnc_length = s1ap->mnc_digit_length[ue->selected_plmn_identity]; - return 0; -} - -/**************************** General BS info ****************************/ -uint64_t flexran_get_bs_id(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return 0; - - return RC.rrc[mod_id]->nr_cellid; -} - -size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps) { - if (!caps) return 0; - - if (!rrc_is_present(mod_id)) return 0; - - size_t n_caps = 0; - - switch (RC.rrc[mod_id]->node_type) { - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: - n_caps = 4; - *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); - AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", - n_caps * sizeof(Protocol__FlexBsCapability)); - (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; - (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; - (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; - (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__S1AP; - break; - case ngran_eNB_DU: - case ngran_gNB_DU: - n_caps = 5; - *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); - AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", - n_caps * sizeof(Protocol__FlexBsCapability)); - (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; - (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; - (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; - (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; - (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; - break; - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - n_caps = 9; - *caps = calloc(n_caps, sizeof(Protocol__FlexBsCapability)); - AssertFatal(*caps, "could not allocate %zu bytes for Protocol__FlexBsCapability array\n", - n_caps * sizeof(Protocol__FlexBsCapability)); - (*caps)[0] = PROTOCOL__FLEX_BS_CAPABILITY__LOPHY; - (*caps)[1] = PROTOCOL__FLEX_BS_CAPABILITY__HIPHY; - (*caps)[2] = PROTOCOL__FLEX_BS_CAPABILITY__LOMAC; - (*caps)[3] = PROTOCOL__FLEX_BS_CAPABILITY__HIMAC; - (*caps)[4] = PROTOCOL__FLEX_BS_CAPABILITY__RLC; - (*caps)[5] = PROTOCOL__FLEX_BS_CAPABILITY__PDCP; - (*caps)[6] = PROTOCOL__FLEX_BS_CAPABILITY__SDAP; - (*caps)[7] = PROTOCOL__FLEX_BS_CAPABILITY__RRC; - (*caps)[8] = PROTOCOL__FLEX_BS_CAPABILITY__S1AP; - break; - case ngran_eNB_MBMS_STA: - AssertFatal(0, "MBMS STA not supported by FlexRAN!\n"); - break; - } - - return n_caps; -} - -uint32_t flexran_get_capabilities_mask(mid_t mod_id) { - if (!rrc_is_present(mod_id)) return 0; - uint32_t mask = 0; - switch (RC.rrc[mod_id]->node_type) { - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: - mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP); - break; - case ngran_eNB_DU: - case ngran_gNB_DU: - mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC); - break; - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__S1AP); - break; - case ngran_eNB_MBMS_STA: - AssertFatal(0, "MBMS STA not supported by FlexRAN!\n"); - break; - } - - return mask; -} - -size_t flexran_get_splits(mid_t mod_id, Protocol__FlexBsSplit **splits) { - size_t n_splits = 0; - *splits = NULL; - if (rrc_is_present(mod_id) && !NODE_IS_MONOLITHIC(RC.rrc[mod_id]->node_type)) - n_splits++; - if (NFAPI_MODE != NFAPI_MONOLITHIC) - n_splits++; - if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south != LOCAL_RF) - n_splits++; - if (n_splits == 0) - return 0; - - AssertFatal(n_splits < 3, "illegal number of splits (%lu)\n", n_splits); - *splits = calloc(n_splits, sizeof(Protocol__FlexBsSplit)); - AssertFatal(*splits, "could not allocate Protocol__FlexBsSplit array\n"); - int n = 0; - if (rrc_is_present(mod_id) && !NODE_IS_MONOLITHIC(RC.rrc[mod_id]->node_type)) - (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__F1; - if (NFAPI_MODE != NFAPI_MONOLITHIC) - (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__nFAPI; - if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south == REMOTE_IF4p5) - (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__IF4p5; - if (RC.ru && RC.ru[mod_id] && RC.ru[mod_id]->if_south == REMOTE_IF5) - (*splits)[n++] = PROTOCOL__FLEX_BS_SPLIT__IF5; - DevAssert(n == n_splits); - return n_splits; -} diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h deleted file mode 100644 index c15865ccfd..0000000000 --- a/openair2/ENB_APP/flexran_agent_ran_api.h +++ /dev/null @@ -1,772 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_ran_api.h - * \brief FlexRAN RAN API abstraction header - * \author N. Nikaein, X. Foukas and S. SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#include -#include - -#include "flexran_agent_common.h" -#include "flexran_agent_common_internal.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_defs.h" - - -#include "enb_config.h" -#include "LAYER2/RLC/rlc.h" -#include "SCHED/sched_eNB.h" -#include "pdcp.h" -#include "RRC/LTE/rrc_extern.h" -#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "RRC/LTE/rrc_eNB_UE_context.h" -#include "PHY/phy_extern.h" -#include "common/utils/LOG/log.h" -#include "nfapi/oai_integration/vendor_ext.h" - -/**************************** - * get generic info from RAN - ****************************/ - -uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag); - -/*Return the current frame number - *Could be using implementation specific numbering of frames - */ -frame_t flexran_get_current_frame(mid_t mod_id); - -/*Return the current SFN (0-1023)*/ -frame_t flexran_get_current_system_frame_num(mid_t mod_id); - -sub_frame_t flexran_get_current_subframe(mid_t mod_id); - -/*Return the frame and subframe number in compact 16-bit format. - Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ -uint32_t flexran_get_sfn_sf(mid_t mod_id); - -/* Return a future frame and subframe number that is ahead_of_time - subframes later in compact 16-bit format. Bits 0-3 subframe, - rest for frame */ -uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time); - -/* Return the number of attached UEs for the MAC */ -int flexran_get_mac_num_ues(mid_t mod_id); - -/* Get the number of logical channels per UE. This function does not consider - * dedicated bearers yet */ -int flexran_get_num_ue_lcs(mid_t mod_id, mid_t ue_id); - -/* Get the rnti of a UE with id ue_id from MAC */ -rnti_t flexran_get_mac_ue_crnti(mid_t mod_id, mid_t ue_id); - -int flexran_get_mac_ue_id_rnti(mid_t mod_id, rnti_t rnti); - -/* Return the UE id of attached UE as opposed to the index [0,NUM UEs] (i.e., - * the i'th active UE). Returns 0 if the i'th active UE could not be found. */ -int flexran_get_mac_ue_id(mid_t mod_id, int i); - -/* Get the RLC buffer status report in bytes of a ue for a designated - * logical channel id */ -int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid); - -/* Get power headroom of UE with id ue_id */ -int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id); - -/* Get the UE wideband CQI */ -uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id); - -/* Get the transmission queue size for a UE with a channel_id logical channel id */ -rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); - -/*Get number of pdus in RLC buffer*/ -rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); - -/* Get the head of line delay for a UE with a channel_id logical channel id */ -frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); - -/* Check the status of the timing advance for a UE */ -int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -/* Update the timing advance status(find out whether a timing advance command is required) */ -/* currently broken -void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); */ - -/* Return timing advance MAC control element for a designated cell and UE */ -/* this function is broken */ -int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -/*Get number of mac SDU DL*/ -uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Return the MAC sdu size got from logical channel lcid */ -uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid); - -/*Return number of MAC SDUs obtained in MAC layer*/ -uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get mac sdu lcid index*/ -unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index); - -/*Get MAC size sdus length dl*/ -uint32_t flexran_get_size_dl_mac_sdus(mid_t mod_id, int cc_id); - -/*Get MAC size sdus length ul */ -uint32_t flexran_get_size_ul_mac_sdus(mid_t mod_id, int cc_id); - -/*Get total size DL MAC SDUS*/ -uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total size of UL mac SDUS*/ -uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total number of PDU DL*/ -uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total number of PDU UL*/ -uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total PRB dl TODO Should be changed*/ -uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total PRB ul TODO Should be changed*/ -uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get number of prb for tx per UE DL*/ -uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get number of prb for rx per UE UL*/ -uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get number of prb for retx per UE UL*/ -uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get number of prb for retx per UE*/ -uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id); - -/*MCS before rate adaptation DL*/ -uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id); - -/*MCS after rate adaptation DL*/ -uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id); - -/*MCS before rate adaptation UL*/ -uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id); - -/*MCS after rate adaptation UL*/ -uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get downlink TBS*/ -uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get uplink TBS */ -uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total TBS DL*/ -uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id); - -/*Get total TBS DL*/ -uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id); - -/* Get the current HARQ round for UE ue_id */ -int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id); - -/* Get the number of active component carriers for a specific UE */ -int flexran_get_active_CC(mid_t mod_id, mid_t ue_id); - -/* Get the rank indicator for a designated cell and UE */ -uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -/* See TS 36.213, section 10.1 */ -uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, section 5.4 */ -uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, section 5.4 */ -uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, section 5.7.1 */ -uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, section 5.7.1 */ -uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.321 */ -uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id); - -/* Get the length of the UL cyclic prefix */ -Protocol__FlexUlCyclicPrefixLength flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); - -/* Get the length of the DL cyclic prefix */ -Protocol__FlexDlCyclicPrefixLength flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id); - -/* Get the physical cell id of a cell */ -uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, section 5.5.3.2 */ -uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.211, table 5.5.3.3-1 and 2 */ -uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id); - -/* Boolean value. See TS 36.211, - section 5.5.3.2. TDD only */ -uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id); - -/* Get number of DL resource blocks */ -uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id); - -/* Get number of UL resource blocks */ -uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id); - -/* Get number of resource block groups */ -uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id); - -/* Get DL/UL subframe assignment. TDD only */ -uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id); - -/* TDD only. See TS 36.211, table 4.2.1 */ -uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id); - -/* Get the duration of the random access response window in subframes */ -long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id); - -/* Get timer used for random access */ -long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id); - -/* Get type of duplex mode(FDD/TDD) */ -Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id); - -/* Get the SI window length */ -long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id); - -/* Get length of SystemInformationBlock1 */ -uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id); - -/* Get the number of PDCCH symbols configured for the cell */ -uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id); - -uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id); - -/* See TS 36.213, sec 5.1.1.1 */ -int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -/* Get the first available HARQ process for a specific cell and UE during - a designated frame and subframe. Returns 0 for success. The id and the - status of the HARQ process are stored in id and status respectively */ -/* currently broken -int flexran_get_harq(mid_t mod_id, uint8_t cc_id, mid_t ue_id, frame_t frame, - sub_frame_t subframe, unsigned char *id, unsigned char *round, - uint8_t harq_flag); */ - -/* Uplink power control management*/ -int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id); - -int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id); - -uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id); - -Protocol__FlexHoppingMode flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id); - -uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id); - -uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id); - -Protocol__FlexPhichResource flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id); - -Protocol__FlexQam flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id); - -Protocol__FlexPhichDuration flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id); - -/* - * ************************************ - * Get Messages for UE Configuration Reply - * ************************************ - */ -/* Get the number of attached UEs for the RRC */ -int flexran_get_rrc_num_ues(mid_t mod_id); - -/* Get the RNTI of UE at index 'index' in RRC list */ -rnti_t flexran_get_rrc_rnti_nth_ue(mid_t mod_id, int index); - -/* Get the list of RNTIs of up to max_list entries. When max_list >= - * flexran_get_rrc_num_ues(), gets a list of all UEs registered in the RRC. UE - * RNTIs are saved in list, returns number of saved RNTIs */ -int flexran_get_rrc_rnti_list(mid_t mod_id, rnti_t *list, int max_list); - -/* Get timer in subframes. Controls the synchronization - status of the UE, not the actual timing - advance procedure. See TS 36.321 */ -LTE_TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, rnti_t rnti); - -/* Get measurement gap configuration. See TS 36.133 */ -Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, rnti_t rnti); - -/* Get measurement gap configuration offset if applicable */ -long flexran_get_meas_gap_config_offset(mid_t mod_id, rnti_t rnti); - -/* DL aggregated bit-rate of non-gbr bearer - per UE. See TS 36.413 */ -uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id); - -/* UL aggregated bit-rate of non-gbr bearer - per UE. See TS 36.413 */ -uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id); - -/* Only half-duplex support. FDD operation. Boolean value */ -int flexran_get_half_duplex(mid_t mod_id, rnti_t rnti); - -/* Support of intra-subframe hopping. Boolean value */ -int flexran_get_intra_sf_hopping(mid_t mod_id, rnti_t rnti); - -/* UE support for type 2 hopping with n_sb>1 */ -int flexran_get_type2_sb_1(mid_t mod_id, rnti_t rnti); - -/* Get the UE category */ -long flexran_get_ue_category(mid_t mod_id, rnti_t rnti); - -/* UE support for resource allocation type 1 */ -int flexran_get_res_alloc_type1(mid_t mod_id, rnti_t rnti); - -/* Get UE transmission mode */ -long flexran_get_ue_transmission_mode(mid_t mod_id, rnti_t rnti); - -/* Boolean value. See TS 36.321 */ -BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, rnti_t rnti); - -/* The max HARQ retransmission for UL. - See TS 36.321 */ -long flexran_get_maxHARQ_TX(mid_t mod_id, rnti_t rnti); - -/* See TS 36.213 */ -long flexran_get_beta_offset_ack_index(mid_t mod_id, rnti_t rnti); - -/* See TS 36.213 */ -long flexran_get_beta_offset_ri_index(mid_t mod_id, rnti_t rnti); - -/* See TS 36.213 */ -long flexran_get_beta_offset_cqi_index(mid_t mod_id, rnti_t rnti); - -/* Boolean. See TS36.213, Section 10.1 */ -BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, rnti_t rnti); - -/* Boolean. See TS 36.213, Section 8.2 */ -BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, uint8_t cc_id); - -/* Get aperiodic CQI report mode */ -Protocol__FlexAperiodicCqiReportMode flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id, rnti_t rnti); - -/* Get ACK/NACK feedback mode. TDD only */ -long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, rnti_t rnti); - -/* See TS36.213, section 10.1 */ -long flexran_get_ack_nack_repetition_factor(mid_t mod_id, rnti_t rnti); - -/* Boolean. Extended buffer status report size */ -long flexran_get_extended_bsr_size(mid_t mod_id, rnti_t rnti); - -/* Get number of UE transmission antennas */ -int flexran_get_ue_transmission_antenna(mid_t mod_id, rnti_t rnti); - -/* Get the IMSI of UE */ -uint64_t flexran_get_ue_imsi(mid_t mod_id, rnti_t rnti); - -/* Get logical channel group of a channel with id lc_id */ -long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id); - -/* Get direction of logical channel with id lc_id */ -int flexran_get_direction(mid_t ue_id, mid_t lc_id); - -/*Get downlink frequency*/ -uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id); - -/*Get uplink frequency*/ -uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id); - -/*Get eutra band*/ -uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id); - -/*Get downlink ref signal power*/ -int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id); - -/*Get uplink power*/ -long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id); - -/*set the dl freq */ -void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz); - -/* set the ul freq */ -void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset); - -/*set the the band */ -void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band); - -/* set the bandwidth (in RB) */ -void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB); - -/*set frame type*/ -void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type); - -/*RRC status flexRAN*/ -uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti); - - -/***************************** PDCP ***********************/ -/* PDCP uid obtained through the RNTI */ -uint16_t flexran_get_pdcp_uid_from_rnti(mid_t mod_id, rnti_t rnti); - -/*PDCP superframe numberflexRAN*/ -uint32_t flexran_get_pdcp_sfn(mid_t mod_id); - -/*PDCP pdcp tx stats window*/ -void flexran_set_pdcp_tx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window); - -/*PDCP pdcp rx stats window*/ -void flexran_set_pdcp_rx_stat_window(mid_t mod_id, uint16_t uid, uint16_t obs_window); - -/*PDCP num tx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_tx(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP num tx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP number of transmit packet / second status flexRAN*/ -uint32_t flexran_get_pdcp_tx_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP pdcp tx bytes in a given window flexRAN*/ -uint32_t flexran_get_pdcp_tx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP tx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_tx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP tx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP tx aggregated packet arrival per second flexRAN*/ -uint32_t flexran_get_pdcp_tx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - - -/*PDCP num rx pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP num rx bytes status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP number of received packet / second flexRAN*/ -uint32_t flexran_get_pdcp_rx_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP gootput (bit/s) status flexRAN*/ -uint32_t flexran_get_pdcp_rx_bytes_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP rx sequence number flexRAN*/ -uint32_t flexran_get_pdcp_rx_sn(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP rx aggregated packet arrival flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP rx aggregated packet arrival per second flexRAN*/ -uint32_t flexran_get_pdcp_rx_aiat_w(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*PDCP num of received outoforder pdu status flexRAN*/ -uint32_t flexran_get_pdcp_rx_oo(mid_t mod_id, uint16_t uid, lcid_t lcid); - -/*********************RRC**********************/ -/* Call RRC Reconfiguration wrapper function */ -int flexran_call_rrc_reconfiguration (mid_t mod_id, rnti_t rnti); - -/* Call RRC to trigger handover wrapper function */ -int flexran_call_rrc_trigger_handover (mid_t mod_id, rnti_t rnti, int target_cell_id); - -/*Get primary cell measuremeant id flexRAN*/ -LTE_MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, rnti_t rnti); - -/*Get primary cell RSRP measurement flexRAN*/ -float flexran_get_rrc_pcell_rsrp(mid_t mod_id, rnti_t rnti); - -/*Get primary cell RSRQ measurement flexRAN*/ -float flexran_get_rrc_pcell_rsrq(mid_t mod_id, rnti_t rnti); - -/* Get RRC neighbouring measurement */ -int flexran_get_rrc_num_ncell(mid_t mod_id, rnti_t rnti); - -/* Get neighbouring physical cell id */ -long flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get neighbouring cgi */ -int flexran_get_rrc_neigh_cgi(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get neighbouring cgi info cell id */ -uint32_t flexran_get_rrc_neigh_cgi_cell_id(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get neighbouring cgi info tac */ -uint32_t flexran_get_rrc_neigh_cgi_tac(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get the number of neighbouring cgi mnc */ -int flexran_get_rrc_neigh_cgi_num_mnc(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get the number of neighbouring cgi mcc */ -int flexran_get_rrc_neigh_cgi_num_mcc(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get neighbouring cgi mnc */ -uint32_t flexran_get_rrc_neigh_cgi_mnc(mid_t mod_id, rnti_t rnti, long cell_id, int mnc_id); - -/* Get neighbouring cgi mcc */ -uint32_t flexran_get_rrc_neigh_cgi_mcc(mid_t mod_id, rnti_t rnti, long cell_id, int mcc_id); - -/* Get RSRP of neighbouring Cell */ -float flexran_get_rrc_neigh_rsrp(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get RSRQ of neighbouring Cell */ -float flexran_get_rrc_neigh_rsrq(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get ofp offset */ -long flexran_get_rrc_ofp(mid_t mod_id, rnti_t rnti); - -/* Get ofn offset */ -long flexran_get_rrc_ofn(mid_t mod_id, rnti_t rnti); - -/* Get ocp offset */ -long flexran_get_rrc_ocp(mid_t mod_id, rnti_t rnti); - -/* Get ocn offset */ -long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id); - -/* Get Periodic Event max reported cells */ -long flexran_get_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti); - -/* Get A3 Event hysteresis */ -long flexran_get_rrc_a3_event_hysteresis(mid_t mod_id, rnti_t rnti); - -/* Get A3 Event time to trigger */ -long flexran_get_rrc_a3_event_timeToTrigger(mid_t mod_id, rnti_t rnti); - -/* Get A3 Event max reported cells */ -long flexran_get_rrc_a3_event_maxReportCells(mid_t mod_id, rnti_t rnti); - -/* Get A3 Event a3 offset */ -long flexran_get_rrc_a3_event_a3_offset(mid_t mod_id, rnti_t rnti); - -/* Get A3 Event report on leave */ -int flexran_get_rrc_a3_event_reportOnLeave(mid_t mod_id, rnti_t rnti); - -/* Get filter coefficient for rsrp */ -long flexran_get_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti); - -/* Get filter coefficient for rsrq */ -long flexran_get_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti); - -/* Set ofp offset */ -int flexran_set_rrc_ofp(mid_t mod_id, rnti_t rnti, long offsetFreq); - -/* Set ofn offset */ -int flexran_set_rrc_ofn(mid_t mod_id, rnti_t rnti, long offsetFreq); - -/* Set ocp offset */ -int flexran_set_rrc_ocp(mid_t mod_id, rnti_t rnti, long cellIndividualOffset); - -/* Set ocn offset */ -int flexran_set_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id, long cellIndividualOffset); - -/* Set Periodic Event max reported cells */ -int flexran_set_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti, long maxReportCells); - -/* Set A3 Event hysteresis */ -int flexran_set_rrc_a3_event_hysteresis(mid_t mod_id, rnti_t rnti, long hysteresis); - -/* Set A3 Event time to trigger */ -int flexran_set_rrc_a3_event_timeToTrigger(mid_t mod_id, rnti_t rnti, long timeToTrigger); - -/* Set A3 Event max reported cells */ -int flexran_set_rrc_a3_event_maxReportCells(mid_t mod_id, rnti_t rnti, long maxReportCells); - -/* Set A3 Event a3 offset */ -int flexran_set_rrc_a3_event_a3_offset(mid_t mod_id, rnti_t rnti, long a3_offset); - -/* Set A3 Event report on leave */ -int flexran_set_rrc_a3_event_reportOnLeave(mid_t mod_id, rnti_t rnti, int reportOnLeave); - -/* Set filter coefficient for rsrp */ -int flexran_set_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti, long filterCoefficientRSRP); - -/* Set filter coefficient for rsrq */ -int flexran_set_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti, long filterCoefficientRSRQ); - -/* Get number of PLMNs that is broadcasted in SIB1 */ -uint8_t flexran_get_rrc_num_plmn_ids(mid_t mod_id); - -/* Get index'th MCC broadcasted in SIB1 */ -uint16_t flexran_get_rrc_mcc(mid_t mod_id, uint8_t index); - -/* Get index'th MNC broadcasted in SIB1 */ -uint16_t flexran_get_rrc_mnc(mid_t mod_id, uint8_t index); - -/* Get index'th MNC's digit length broadcasted in SIB1 */ -uint8_t flexran_get_rrc_mnc_digit_length(mid_t mod_id, uint8_t index); - -/* Get X2 handover controlled by network */ -int flexran_get_x2_ho_net_control(mid_t mod_id); - -/* Set X2 handover controlled by network */ -int flexran_set_x2_ho_net_control(mid_t mod_id, int x2_ho_net_control); - -/* Get number of adjacent cells via X2 interface */ -int flexran_get_rrc_num_adj_cells(mid_t mod_id); - -/* Get the number of E-RABs for UE */ -int flexran_agent_rrc_gtp_num_e_rab(mid_t mod_id, rnti_t rnti); - -/* Get the e-RAB ID for UE */ -int flexran_agent_rrc_gtp_get_e_rab_id(mid_t mod_id, rnti_t rnti, int index); - -/* Get the TEID at the eNB for UE */ -int flexran_agent_rrc_gtp_get_teid_enb(mid_t mod_id, rnti_t rnti, int index); - -/* Get the TEID at the SGW for UE */ -int flexran_agent_rrc_gtp_get_teid_sgw(mid_t mod_id, rnti_t rnti, int index); - -/* gets the UEs S1AP ID at eNodeB, stored in RRC */ -uint32_t flexran_get_rrc_enb_ue_s1ap_id(mid_t mod_id, rnti_t rnti); - -/************************** Slice configuration **************************/ -/* Get the currently active DL slicing algorithm */ -Protocol__FlexSliceAlgorithm flexran_get_dl_slice_algo(mid_t mod_id); -/* Set the active DL slicing algorithm */ -int flexran_set_dl_slice_algo(mid_t mod_id, Protocol__FlexSliceAlgorithm algo); - -/* Get the currently active UL slicing algorithm */ -Protocol__FlexSliceAlgorithm flexran_get_ul_slice_algo(mid_t mod_id); -/* Set the active UL slicing algorithm */ -int flexran_set_ul_slice_algo(mid_t mod_id, Protocol__FlexSliceAlgorithm algo); - -/* Get the DL slice ID for a UE */ -int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id); -/* Set the DL slice for a UE */ -int flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id); - -/* Get the UL slice ID for a UE */ -int flexran_get_ue_ul_slice_id(mid_t mod_id, mid_t ue_id); -/* Set the UL slice for a UE */ -int flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id); - -/* Create slice in DL, returns the new slice index, object can be shared - * library for the scheduler or NULL */ -int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object); -/* Remove slice in DL, returns new number of slices or -1 on error */ -int flexran_remove_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s); - -/* Finds slice in DL with given slice_id and returns slice index */ -int flexran_find_dl_slice(mid_t mod_id, slice_id_t slice_id); -/* Return the parameters of slice at index slice_idx */ -void flexran_get_dl_slice(mid_t mod_id, - int slice_idx, - Protocol__FlexSlice *slice, - Protocol__FlexSliceAlgorithm algo); -/* Get the number of slices in DL */ -int flexran_get_num_dl_slices(mid_t mod_id); - -/* Create slice in UL, returns the new slice index, object can be shared library - * for the scheduler or NULL */ -int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object); -/* Remove slice in UL */ -int flexran_remove_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s); - -/* Finds slice in DL with given slice_id and returns slice index */ -int flexran_find_ul_slice(mid_t mod_id, slice_id_t slice_id); -/* Return the parameters of slice at index slice_idx */ -void flexran_get_ul_slice(mid_t mod_id, - int slice_idx, - Protocol__FlexSlice *slice, - Protocol__FlexSliceAlgorithm algo); -/* Get the number of slices in UL */ -int flexran_get_num_ul_slices(mid_t mod_id); - -/* Get the name of/Set the DL scheduling algorithm. If slicing is active, this - * corresponds to the default algorithm for slices, otherwise the currently - * used one. object is a shared object in which to find the scheduler */ -char *flexran_get_dl_scheduler_name(mid_t mod_id); -int flexran_set_dl_scheduler(mid_t mod_id, char *sched, void *object); - -/* Get the name of/Set the UL scheduler algorithm. Same applies as for the DL - * case. object is a shared object in which to find the scheduler */ -char *flexran_get_ul_scheduler_name(mid_t mod_id); -int flexran_set_ul_scheduler(mid_t mod_id, char *sched, void *object); - -/************************** S1AP **************************/ -/* Get the number of MMEs to be connected */ -int flexran_get_s1ap_mme_pending(mid_t mod_id); - -/* Get the number of connected MMEs */ -int flexran_get_s1ap_mme_connected(mid_t mod_id); - -/* Get the eNB S1AP IP address */ -char* flexran_get_s1ap_enb_s1_ip(mid_t mod_id); - -/* Get the name of the eNB */ -char* flexran_get_s1ap_enb_name(mid_t mod_id); - -/* Get the number of connected MMEs to this eNB */ -int flexran_get_s1ap_nb_mme(mid_t mod_id); - -/* Get the number of connected UEs to this eNB */ -int flexran_get_s1ap_nb_ue(mid_t mod_id); - -/* Get the S1AP MME conf */ -int flexran_get_s1ap_mme_conf(mid_t mod_id, mid_t mme_index, Protocol__FlexS1apMme * mme_conf); - -/* Get the S1AP UE conf */ -int flexran_get_s1ap_ue(mid_t mod_id, rnti_t rnti, Protocol__FlexS1apUe * ue_conf); - -/* Add MMEs and re-issue S1AP Registration Request */ -int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4); - -/* Remove MMEs and and cut SCTP to MME */ -int flexran_remove_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4); - -/* Set a new PLMN configuration */ -int flexran_set_new_plmn_id(mid_t mod_id, int CC_id, size_t n_plmn, Protocol__FlexPlmn **plmn_id); - -/********************* general information *****************/ -/* get an ID for this BS (or part of a BS) */ -uint64_t flexran_get_bs_id(mid_t mod_id); - -/* get the capabilities supported by the underlying network function, - * returns the number and stores list of this length in caps. If there are zero - * capabilities, *caps will be NULL */ -size_t flexran_get_capabilities(mid_t mod_id, Protocol__FlexBsCapability **caps); - -/* get the capabilities supported by the underlying network function as a bit - * mask. */ -uint32_t flexran_get_capabilities_mask(mid_t mod_id); - -/* get the splits used by the underlying network function, - * return the number and stores list of this length in splits. If there are - * zero capabilities, splits will be NULL */ -size_t flexran_get_splits(mid_t mod_id, Protocol__FlexBsSplit **splits); diff --git a/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c deleted file mode 100644 index a5eb850712..0000000000 --- a/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; -uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; - -uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; - diff --git a/openair2/ENB_APP/flexran_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c deleted file mode 100644 index f20e6c8969..0000000000 --- a/openair2/ENB_APP/flexran_agent_task_manager.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the FlexRAN agent - * \author Xenofon Foukas - * \date January 2016 - * \version 0.1 - * \email: x.foukas@sms.ed.ac.uk - * @ingroup _mac - */ - -#include -#include -#include - -#include "flexran_agent_task_manager.h" -#include "flexran_agent_common.h" - - -/* Util macros */ -#define LEFT(x) (2 * (x) + 1) -#define RIGHT(x) (2 * (x) + 2) -#define PARENT(x) ((x - 1) / 2) - -flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num) { - flexran_agent_task_t *task = NULL; - task = malloc(sizeof(flexran_agent_task_t)); - - if (task == NULL) - goto error; - - task->frame_num = frame_num; - task->subframe_num = subframe_num; - task->task = msg; - - return task; - - error: - return NULL; -} - -void flexran_agent_task_destroy(flexran_agent_task_t *task) { - if (task == NULL) - return; - - /* TODO: must free the task properly */ - free(task->task); - free(task); -} - -flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, - const flexran_agent_task_t *t2)) { - flexran_agent_task_queue_t *queue = NULL; - - queue = malloc(sizeof(flexran_agent_task_queue_t)); - if (queue == NULL) - goto error; - - queue->mutex = NULL; - /* If no comparator was given, use the default one */ - if (cmp == NULL) - queue->cmp = _flexran_agent_task_queue_cmp; - else - queue->cmp = cmp; - - queue->mod_id = mod_id; - - queue->first_frame = 0; - queue->first_subframe = 0; - - queue->task = malloc(capacity * sizeof(flexran_agent_task_t *)); - if (queue->task == NULL) - goto error; - - queue->count = 0; - queue->capacity = capacity; - - queue->mutex = malloc(sizeof(pthread_mutex_t)); - if (queue->mutex == NULL) - goto error; - if (pthread_mutex_init(queue->mutex, NULL)) - goto error; - - return queue; - - error: - if (queue != NULL) { - free(queue->mutex); - free(queue->task); - free(queue); - } - return NULL; -} - -flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id) { - return flexran_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); -} - -void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue) { - int i; - - if (queue == NULL) - return; - - for (i = 0; i < queue->count; i++) { - flexran_agent_task_destroy(queue->task[i]); - } - free(queue->task); - free(queue->mutex); - free(queue); -} - -int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task) { - size_t i; - flexran_agent_task_t *tmp = NULL; - int realloc_status, err_code; - - if (pthread_mutex_lock(queue->mutex)) { - /*TODO*/ - err_code = -1; - goto error; - } - - if (queue->count >= queue->capacity) { - /*TODO: need to call realloc heap*/ - realloc_status = _flexran_agent_task_queue_realloc_heap(queue); - if (realloc_status != HEAP_OK) { - err_code = realloc_status; - goto error; - } - } - - queue->task[queue->count] = task; - i = queue->count; - queue->count++; - /*Swap elements to maintain heap properties*/ - while(i > 0 && queue->cmp(queue->mod_id, queue->task[i], queue->task[PARENT(i)]) > 0) { - tmp = queue->task[i]; - queue->task[i] = queue->task[PARENT(i)]; - queue->task[PARENT(i)] = tmp; - i = PARENT(i); - } - - if (pthread_mutex_unlock(queue->mutex)) { - // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - return 0; - - error: - /*TODO*/ - return err_code; -} - - -int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task) { - int err_code; - - if (pthread_mutex_lock(queue->mutex)) { - /*TODO*/ - err_code = -1; - goto error; - } - - if (queue->count < 1) { - /* Priority Queue is empty */ - err_code = HEAP_EMPTY; - goto error; - } - - /* Find current frame and subframe number */ - uint16_t curr_frame = flexran_get_current_frame(queue->mod_id); - uint8_t curr_subframe = flexran_get_current_subframe(queue->mod_id); - - /* If no task is scheduled for the current subframe, return without any task */ - if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { - *task = NULL; - return 0; - } - /* Otherwise, the first task should be returned */ - *task = queue->task[0]; - queue->task[0] = queue->task[queue->count-1]; - queue->count--; - /* Restore heap property */ - _flexran_agent_task_queue_heapify(queue, 0); - - /*If queue has no element*/ - if (queue->count < 1) { - queue->first_frame = 0; - queue->first_subframe = 0; - } else { - queue->first_frame = queue->task[0]->frame_num; - queue->first_subframe = queue->task[0]->subframe_num; - } - - if (pthread_mutex_unlock(queue->mutex)) { - // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - return HEAP_OK; - - error: - /*TODO*/ - return err_code; -} - -/*Warning: Internal function. Should not be called as API function. Not thread safe*/ -void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx) { - /* left index, right index, largest */ - flexran_agent_task_t *tmp = NULL; - size_t l_idx, r_idx, lrg_idx; - - l_idx = LEFT(idx); - r_idx = RIGHT(idx); - - /* Left child exists, compare left child with its parent */ - if (l_idx < queue->count && queue->cmp(queue->mod_id, queue->task[l_idx], queue->task[idx]) > 0) { - lrg_idx = l_idx; - } else { - lrg_idx = idx; - } - - /* Right child exists, compare right child with the largest element */ - if (r_idx < queue->count && queue->cmp(queue->mod_id, queue->task[r_idx], queue->task[lrg_idx]) > 0) { - lrg_idx = r_idx; - } - - /* At this point largest element was determined */ - if (lrg_idx != idx) { - /* Swap between the index at the largest element */ - tmp = queue->task[lrg_idx]; - queue->task[lrg_idx] = queue->task[idx]; - queue->task[idx] = tmp; - /* Heapify again */ - _flexran_agent_task_queue_heapify(queue, lrg_idx); - } -} - -/*Warning: Internal function. Should not be called as API function. Not thread safe*/ -int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue) { - flexran_agent_task_t **resized_task_heap; - if (queue->count >= queue->capacity) { - size_t task_size = sizeof(flexran_agent_task_t); - - resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size); - if (resized_task_heap != NULL) { - queue->capacity *= 2; - queue->task = (flexran_agent_task_t **) resized_task_heap; - return HEAP_OK; - } else return HEAP_REALLOCERROR; - } - return HEAP_NOREALLOC; -} - -int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2) { - if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) - return 0; - - uint16_t curr_frame = flexran_get_current_frame(mod_id); - uint8_t curr_subframe = flexran_get_current_subframe(mod_id); - - int f_offset, sf_offset, tmp1, tmp2; - - /*Check if the offsets have the same sign and compare the tasks position frame-wise*/ - tmp1 = t1->frame_num - curr_frame; - tmp2 = t2->frame_num - curr_frame; - if ((tmp1 >= 0) ^ (tmp2 < 0)) { - f_offset = tmp2 - tmp1; - } - else { - f_offset = tmp1 - tmp2; - } - /*Do the same for the subframe*/ - tmp1 = t1->subframe_num - curr_subframe; - tmp2 = t2->subframe_num - curr_subframe; - if ((tmp1 >= 0) ^ (tmp2 < 0)) - sf_offset = tmp2 - tmp1; - else - sf_offset = tmp1 - tmp2; - - /*Subframe position matters only if f_offset is 0. Multiply f_offset by 100 - to be the only comparisson parameter in all other cases */ - return f_offset*100 + sf_offset; -} diff --git a/openair2/ENB_APP/flexran_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h deleted file mode 100644 index 165b9dda1c..0000000000 --- a/openair2/ENB_APP/flexran_agent_task_manager.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the FlexRAN agent - * \author Xenofon Foukas - * \date January 2016 - * \version 0.1 - * \email: x.foukas@sms.ed.ac.uk - * @ingroup _mac - */ - -#ifndef FLEXRAN_AGENT_TASK_MANAGER_ -#define FLEXRAN_AGENT_TASK_MANAGER_ - -#include -#include - -#include "flexran.pb-c.h" - -#include "flexran_agent_common.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define DEFAULT_CAPACITY 512 - -/** - * The structure containing the enb agent task to be executed - */ -typedef struct flexran_agent_task_s { - /* The frame in which the task needs to be executed */ - uint16_t frame_num; - /* The subframe in which the task needs to be executed */ - uint8_t subframe_num; - /* The task to be executed in the form of a Protocol__FlexranMessage */ - Protocol__FlexranMessage *task; -} flexran_agent_task_t; - -/** - * Priority Queue Structure for tasks - */ -typedef struct flexran_agent_task_queue_s { - mid_t mod_id; - /* The amount of allocated memory for agent tasks in the heap*/ - volatile size_t capacity; - /* The actual size of the tasks heap at a certain time */ - volatile size_t count; - /* The earliest frame that has a pending task */ - volatile uint16_t first_frame; - /* The earliest subframe within the frame that has a pending task */ - volatile uint8_t first_subframe; - /* An array of prioritized tasks stored in a heap */ - flexran_agent_task_t **task; - /* A pointer to a comparator function, used to prioritize elements */ - int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); - pthread_mutex_t *mutex; -} flexran_agent_task_queue_t; - -typedef enum { - HEAP_OK = 0, - HEAP_EMPTY, - HEAP_FAILED, - HEAP_REALLOCERROR, - HEAP_NOREALLOC, - HEAP_FATAL, -} heapstatus_e; - -/** - * Allocate memory for a task in the queue - */ -flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num); - -/** - * Free memory for a task of the queue - */ -void flexran_agent_task_destroy(flexran_agent_task_t *task); - -/** - * Allocate initial memory for storing the tasks - */ - flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, - const flexran_agent_task_t *t2)); - -/** - * Allocate initial memory for storing the tasks using default parameters - */ -flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id); - -/** - * De-allocate memory for the tasks queue - */ -void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue); - -/** - * Insert task into the queue - */ -int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task); - -/** - * Remove the task with the highest priority from the queue - * task becomes NULL if there is no task for the current frame and subframe - */ -int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task); - -/** - * Check if the top priority task is for a specific frame and subframe - */ -int flexran_agent_task_queue_has_upcoming_task (flexran_agent_task_queue_t *queue, - const uint16_t frame, const uint8_t subframe); - -/** - * Restructure heap after modifications - */ -void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx); - -/** - * Reallocate memory once the heap reaches max size - */ -int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue); - -/** - * Compare two agent tasks based on frame and subframe - * returns 0 if tasks t1, t2 have the same priority - * return negative value if t1 needs to be executed after t2 - * return positive value if t1 preceeds t2 - * Need to give eNB id for the comparisson based on the current frame-subframe - */ - int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); - -#ifdef __cplusplus -} -#endif - -#endif /*FLEXRAN_AGENT_TASK_MANAGER_*/ diff --git a/openair2/ENB_APP/flexran_agent_timer.c b/openair2/ENB_APP/flexran_agent_timer.c deleted file mode 100644 index 3a613ca8e5..0000000000 --- a/openair2/ENB_APP/flexran_agent_timer.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_timer.c - * \brief FlexRAN Timer - * \author Robert Schmidt - * \date 2019 - * \version 0.2 - */ - -#include "flexran_agent_timer.h" -#include "flexran_agent_extern.h" -#include -#include - -#define MAX_NUM_TIMERS 10 - -typedef struct flexran_agent_timer_element_s { - mid_t mod_id; - xid_t xid; /* The id of the task as received by the controller message*/ - uint32_t sf; - uint64_t next; - flexran_agent_timer_callback_t cb; - Protocol__FlexranMessage *msg; -} flexran_agent_timer_element_t; - -typedef struct flexran_agent_timer_extern_source_s { - pthread_mutex_t mutex_sync; - pthread_cond_t cond; - int wait; -} flexran_agent_timer_extern_source_t; - -struct timesync { - void *param_sync; - void (*fsync)(void *); - pthread_t thread; - - uint64_t current; - uint64_t next; - - int timer_num; - flexran_agent_timer_element_t *timer[MAX_NUM_TIMERS]; - - int add_num; - flexran_agent_timer_element_t *add_list[MAX_NUM_TIMERS]; - int remove_num; - int remove_list[MAX_NUM_TIMERS]; - pthread_mutex_t mutex_timer; - - int exit; -}; -struct timesync timesync[NUM_MAX_ENB]; - -int flexran_agent_timer_signal_init(struct timesync *sync); -int flexran_agent_timer_source_setup(struct timesync *sync); -void *flexran_agent_timer_thread(void *args); -void flexran_agent_timer_remove_internal(struct timesync *sync, int index); -void flexran_agent_timer_process(flexran_agent_timer_element_t *t); - - -err_code_t flexran_agent_timer_init(mid_t mod_id) { - struct timesync *sync = ×ync[mod_id]; - sync->current = 0; - sync->next = 0; - sync->timer_num = 0; - sync->add_num = 0; - sync->remove_num = 0; - for (int i = 0; i < MAX_NUM_TIMERS; ++i) { - sync->timer[i] = NULL; - sync->add_list[i] = NULL; - } - pthread_mutex_init(&sync->mutex_timer, NULL); - sync->exit = 0; - - /* if there is a MAC, we assume we can have a tick from the MAC interface - * (external tick source). Otherwise, generate a tick internally via the - * timerfd linux library. The init functions set everything up and the thread - * will use whatever is available. */ - int (*init)(struct timesync *) = flexran_agent_get_mac_xface(mod_id) ? - flexran_agent_timer_signal_init : flexran_agent_timer_source_setup; - if (init(timesync) < 0 - || pthread_create(&sync->thread, NULL, flexran_agent_timer_thread, sync) != 0) { - sync->thread = 0; - if (sync->param_sync) - free(sync->param_sync); - LOG_E(FLEXRAN_AGENT, "could not start timer thread\n"); - return TIMER_SETUP_FAILED; - } - return PROTOCOL__FLEXRAN_ERR__NO_ERR; -} - -void flexran_agent_timer_exit(mid_t mod_id) { - timesync[mod_id].exit = 1; -} - -void flexran_agent_timer_source_sync(void *sync) { - int fd = *(int *)sync; - uint64_t occ; - int rc __attribute__((unused)) = read(fd, &occ, sizeof(occ)); -} - -int flexran_agent_timer_source_setup(struct timesync *sync) { - sync->param_sync = malloc(sizeof(int)); - if (!sync->param_sync) - return -1; - int fd = timerfd_create(CLOCK_MONOTONIC, 0); - if (fd < 0) - return fd; - - const uint64_t period_ns = 1000000; // 1ms - struct itimerspec t; - t.it_interval.tv_sec = period_ns / 1000000000; - t.it_interval.tv_nsec = period_ns % 1000000000; - t.it_value.tv_sec = period_ns / 1000000000; - t.it_value.tv_nsec = period_ns % 1000000000; - int rc = timerfd_settime(fd, 0, &t, NULL); - if (rc != 0) - return -1; - *(int *)sync->param_sync = fd; - sync->fsync = flexran_agent_timer_source_sync; - return 0; -} - -void flexran_agent_timer_signal_sync(void *param_sync) { - flexran_agent_timer_extern_source_t *sync = param_sync; - pthread_mutex_lock(&sync->mutex_sync); - while (sync->wait) { - pthread_cond_wait(&sync->cond, &sync->mutex_sync); - } - sync->wait = 1; - pthread_mutex_unlock(&sync->mutex_sync); -} - -int flexran_agent_timer_signal_init(struct timesync *sync) { - flexran_agent_timer_extern_source_t *s = malloc(sizeof(flexran_agent_timer_extern_source_t)); - if (!s) - return TIMER_SETUP_FAILED; - if (pthread_mutex_init(&s->mutex_sync, NULL) < 0) - return TIMER_SETUP_FAILED; - if (pthread_cond_init(&s->cond, NULL) < 0) - return TIMER_SETUP_FAILED; - s->wait = 1; - sync->param_sync = s; - sync->fsync = flexran_agent_timer_signal_sync; - return 0; -} - -void flexran_agent_timer_signal(mid_t mod_id) { - flexran_agent_timer_extern_source_t *sync = timesync[mod_id].param_sync; - pthread_mutex_lock(&sync->mutex_sync); - sync->wait = 0; - pthread_mutex_unlock(&sync->mutex_sync); - pthread_cond_signal(&sync->cond); -} - -void *flexran_agent_timer_thread(void *args) { - struct timesync *sync = args; - while (1) { - sync->fsync(sync->param_sync); - if (sync->exit) - break; - - pthread_mutex_lock(&sync->mutex_timer); - for (int i = 0; i < sync->add_num; ++i) { - sync->timer[sync->timer_num] = sync->add_list[i]; - sync->timer_num++; - } - sync->add_num = 0; - for (int i = 0; i < sync->remove_num; ++i) - flexran_agent_timer_remove_internal(sync, sync->remove_list[i]); - sync->remove_num = 0; - pthread_mutex_unlock(&sync->mutex_timer); - - sync->current++; - if (sync->current < sync->next) - continue; - - for (int i = 0; i < sync->timer_num; ++i) { - flexran_agent_timer_element_t *t = sync->timer[i]; - if (sync->current == t->next) { - flexran_agent_timer_process(t); - t->next += t->sf; - } - if (sync->next == sync->current || t->next < sync->next) - sync->next = t->next; - } - } - LOG_W(FLEXRAN_AGENT, "terminated timer thread\n"); - return NULL; -} - -void flexran_agent_timer_process(flexran_agent_timer_element_t *t) { - Protocol__FlexranMessage *msg = t->cb(t->mod_id, t->msg); - if (!msg) - return; - - int size = 0; - void *data = flexran_agent_pack_message(msg, &size); - if (flexran_agent_msg_send(t->mod_id, FLEXRAN_AGENT_DEFAULT, data, size, 0) < 0) - LOG_E(FLEXRAN_AGENT, "error while sending message for timer xid %d\n", t->xid); -} - - -err_code_t flexran_agent_create_timer(mid_t mod_id, - uint32_t sf, - flexran_agent_timer_type_t timer_type, - xid_t xid, - flexran_agent_timer_callback_t cb, - Protocol__FlexranMessage *msg) { - if (sf == 0) - return TIMER_NULL; - if (cb == NULL) - return TIMER_SETUP_FAILED; - AssertFatal(timer_type != FLEXRAN_AGENT_TIMER_TYPE_ONESHOT, - "one shot timer not yet implemented\n"); - - flexran_agent_timer_element_t *t = malloc(sizeof(flexran_agent_timer_element_t)); - if (!t) { - LOG_E(FLEXRAN_AGENT, "no memory for new timer %d\n", xid); - return TIMER_SETUP_FAILED; - } - t->mod_id = mod_id; - t->xid = xid; - t->sf = sf; - t->cb = cb; - t->msg = msg; - - struct timesync *sync = ×ync[mod_id]; - pthread_mutex_lock(&sync->mutex_timer); - if (sync->timer_num + sync->add_num >= MAX_NUM_TIMERS) { - pthread_mutex_unlock(&sync->mutex_timer); - LOG_E(FLEXRAN_AGENT, "maximum number of timers (%d) reached while adding timer %d\n", - sync->timer_num + sync->add_num, xid); - free(t); - return TIMER_SETUP_FAILED; - } - /* TODO check that xid does not exist? */ - t->next = sync->current + sf; - if (sync->next <= sync->current || t->next < sync->next) - sync->next = t->next; - sync->add_list[sync->add_num] = t; - sync->add_num++; - pthread_mutex_unlock(&sync->mutex_timer); - LOG_I(FLEXRAN_AGENT, "added new timer xid %d for agent %d\n", xid, mod_id); - return 0; -} - -err_code_t flexran_agent_destroy_timer(mid_t mod_id, xid_t xid) { - struct timesync *sync = ×ync[mod_id]; - for (int i = 0; i < sync->timer_num; ++i) { - if (sync->timer[i]->xid == xid) { - pthread_mutex_lock(&sync->mutex_timer); - sync->remove_list[sync->remove_num] = i; - sync->remove_num++; - pthread_mutex_unlock(&sync->mutex_timer); - return 0; - } - } - LOG_E(FLEXRAN_AGENT, "could not find timer %d\n", xid); - return TIMER_ELEMENT_NOT_FOUND; -} - -/* this function assumes that the timer lock is held */ -void flexran_agent_timer_remove_internal(struct timesync *sync, int index) { - LOG_I(FLEXRAN_AGENT, "remove timer xid %d (index %d) for agent %d\n", - sync->timer[index]->xid, index, sync->timer[index]->mod_id); - if (sync->timer[index]->msg) - flexran_agent_destroy_flexran_message(sync->timer[index]->msg); - free(sync->timer[index]); - for (int i = index + 1; i < sync->timer_num; ++i) - sync->timer[i - 1] = sync->timer[i]; - sync->timer_num--; - sync->timer[sync->timer_num] = NULL; -} diff --git a/openair2/ENB_APP/flexran_agent_timer.h b/openair2/ENB_APP/flexran_agent_timer.h deleted file mode 100644 index c61f2543a3..0000000000 --- a/openair2/ENB_APP/flexran_agent_timer.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file flexran_agent_timer.h - * \brief FlexRAN Timer header - * \author shahab SHARIAT BAGHERI - * \date 2017 - * \version 0.1 - */ - -#ifndef _FLEXRAN_AGENT_TIMER_ -#define _FLEXRAN_AGENT_TIMER_ - -#include "flexran_agent_common.h" -#include "flexran_agent_defs.h" - -#define TIMER_NULL -1 -#define TIMER_TYPE_INVALIDE -2 -#define TIMER_SETUP_FAILED -3 -#define TIMER_REMOVED_FAILED -4 -#define TIMER_ELEMENT_NOT_FOUND -5 - -typedef enum { - FLEXRAN_AGENT_TIMER_TYPE_ONESHOT, - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, -} flexran_agent_timer_type_t; - -/* Type of the callback executed when the timer expired */ -typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)( - mid_t mod_id, const Protocol__FlexranMessage *msg); - -err_code_t flexran_agent_timer_init(mid_t mod_id); -void flexran_agent_timer_exit(mid_t mod_id); - -/* Signals next subframe for FlexRAN timers */ -void flexran_agent_timer_signal(mid_t mod_id); - -/* Create a timer for some agent related event with id xid. */ -err_code_t flexran_agent_create_timer(mid_t mod_id, - uint32_t sf, - flexran_agent_timer_type_t timer_type, - xid_t xid, - flexran_agent_timer_callback_t cb, - Protocol__FlexranMessage *msg); - -/* Destroy the timer for task with id xid */ -err_code_t flexran_agent_destroy_timer(mid_t mod_id, xid_t xid); - -#endif /* _FLEXRAN_AGENT_TIMER_ */ diff --git a/openair2/ENB_APP/flexran_apps/imsi.c b/openair2/ENB_APP/flexran_apps/imsi.c deleted file mode 100644 index 6f75033f38..0000000000 --- a/openair2/ENB_APP/flexran_apps/imsi.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file imsi.c - * \brief flexran IMSI UE-slice association app - * \author Robert Schmidt, Firas Abdeljelil - * \date 2020 - * \version 0.1 - */ - -#include -#include -#include -#include "flexran_agent_common.h" -#include "flexran_agent_async.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_phy.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_pdcp.h" -#include "flexran_agent_s1ap.h" -#include "flexran_agent_app.h" -#include "common/utils/LOG/log.h" -#include "assertions.h" -#include "queue.h" -typedef struct Map_regex_slice slist_data_t; -struct Map_regex_slice { - char regex_[30] ; - int slice_dl; - int slice_ul; - regex_t regex; - SLIST_ENTRY (Map_regex_slice) entries; -}; -bool reconfig = false; -int ue[MAX_MOBILES_PER_ENB]={ [0 ... MAX_MOBILES_PER_ENB - 1] = -1 }; - -SLIST_HEAD(slisthead, Map_regex_slice) head; - -int dump_list(void) { - int len = 1; - slist_data_t *datap = NULL; - SLIST_FOREACH(datap, &head, entries) { - LOG_W(FLEXRAN_AGENT, "%d: regex %s DL %d UL %d\n", len++, datap->regex_, - datap->slice_dl, datap->slice_ul); - } - return len; -} - -void add(char *regex, int dl, int ul) { - slist_data_t *datap = malloc(sizeof(slist_data_t)); - if (!datap) { - LOG_E(FLEXRAN_AGENT, "cannot allocate memory for slist_data_t\n"); - return; - } - strcpy(datap->regex_, regex); - datap->slice_dl = dl; - datap->slice_ul = ul; - regcomp(&datap->regex, datap->regex_, 0); - SLIST_INSERT_HEAD(&head, datap, entries); - if (ul==-1) - LOG_I(FLEXRAN_AGENT, "added new element to list: regex %s slice DL %d\n" ,regex, dl); - else if (dl==-1) - LOG_I(FLEXRAN_AGENT, "added new element to list: regex %s slice UL %d\n" ,regex, ul); - else - LOG_I(FLEXRAN_AGENT, "added new element to list: regex %s slice DL %d UL %d\n", - regex, dl, ul); -} -void remove_(char *regex) { - slist_data_t *datap = NULL; - SLIST_FOREACH(datap, &head, entries) { - if (strcmp(datap->regex_, regex) == 0) { - SLIST_REMOVE(&head, datap, Map_regex_slice, entries); - if (datap->slice_dl==-1) - LOG_I(FLEXRAN_AGENT, "removed element from list: regex %s slice UL %d\n",datap->regex_, datap->slice_ul); - else if (datap->slice_ul==-1) - LOG_I(FLEXRAN_AGENT, "removed element from list: regex %s slice DL %d\n",datap->regex_, datap->slice_dl); - else - LOG_I(FLEXRAN_AGENT, "removed element from list: regex %s slice DL %d UL %d\n", - datap->regex_, datap->slice_dl, datap->slice_ul); - regfree(&datap->regex); - free(datap); - return; - } - } - LOG_E(FLEXRAN_AGENT, "no regex %s found in list\n", regex); -} - -Protocol__FlexranMessage *matching_tick( - mid_t mod_id, - const Protocol__FlexranMessage *msg) { - const int num = flexran_get_mac_num_ues(mod_id); - for (int i = 0; i < num; i++) { - int ue_id = flexran_get_mac_ue_id(mod_id, i); - if (ue[ue_id] >= 0 && !reconfig) - continue; - rnti_t rnti = flexran_get_mac_ue_crnti(mod_id, ue_id); - uint64_t imsi = flexran_get_ue_imsi(mod_id, rnti); - char snum[20]; - sprintf(snum, "%" PRIu64, imsi); - slist_data_t *datap = NULL; - SLIST_FOREACH(datap, &head, entries) { - if (regexec(&datap->regex, snum, 0, NULL, 0) == 0) { - - int dl = datap->slice_dl; - if (dl >= 0 && dl != flexran_get_ue_dl_slice_id(mod_id, ue_id)) { - int ra = flexran_set_ue_dl_slice_id(mod_id, ue_id, dl); - if (ra) - LOG_I(FLEXRAN_AGENT, - "RNTI %04x/IMSI %s in the slice_dl %d\n", - rnti, - snum, - dl); - else - LOG_W(FLEXRAN_AGENT, "No such DL slice %d\n", dl); - } - - int ul = datap->slice_ul; - if (ul >= 0 && ul != flexran_get_ue_ul_slice_id(mod_id, ue_id)) { - int rb = flexran_set_ue_ul_slice_id(mod_id, ue_id, ul); - if (rb) - LOG_I(FLEXRAN_AGENT, - "RNTI %04x/IMSI %s in the slice_ul %d\n", - rnti, - snum, - ul); - else - LOG_W(FLEXRAN_AGENT, "No such DL slice %d\n", dl); - } - } - } - ue[ue_id] = ue_id; - } - reconfig = false; - return NULL; -} -void add_param(Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, int n_p) { - char s[30]; - reconfig = true; - bool supp=false; - bool sl_E=false; - int dl=-1; - int ul=-1; - slist_data_t *datap = NULL; - for (int i = 0; i < n_p; ++i) { - switch (p[i]->value->param_case) { - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM__NOT_SET: - LOG_I(FLEXRAN_AGENT, " param %s is not set\n", p[i]->key); - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_INTEGER: - if( strcmp(p[i]->key, "slice_dl")==0) - dl= p[i]->value->integer; - else - ul= p[i]->value->integer; - sl_E=true; - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_STR: - strcpy(s,p[i]->value->str); - break; - default: - LOG_W(FLEXRAN_AGENT, " type of param %s is unknown\n", p[i]->key); - break; - }; - } - if (!SLIST_EMPTY(&head)){ - SLIST_FOREACH(datap, &head, entries) { - if (strcmp(datap->regex_, s) == 0) { - if (datap->slice_dl!=dl || datap->slice_ul!=ul) - supp=true; - } - } - } - if (sl_E==false) - remove_(s); - else { - if (supp==true) - remove_(s); - add(s,dl,ul); - } - /* re-verify all UEs again */ - for (int i = 0; i < MAX_MOBILES_PER_ENB; ++i) - ue[i] = -1; -} -/* imsi_start: entry point for imsi app. Installs a callback using the timer - * API to have function imsi_tick() called every 5s */ -#define TIMER 32 -int imsi_start(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p) -{ - LOG_W(FLEXRAN_AGENT, "%s(): enable IMSI app timer\n", __func__); - flexran_agent_create_timer(mod_id, - 500, - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, - TIMER, - matching_tick, - NULL); - SLIST_INIT(&head); - return 0; -} - -int imsi_reconfig(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p) -{ - add_param(p, n_p); - return 0; -} - -/* stop function: cleans up before app can be unloaded. Here: stop the timer */ -int imsi_stop(mid_t mod_id) { - LOG_W(FLEXRAN_AGENT, "%s(): disable IMSI app timer\n", __func__); - flexran_agent_destroy_timer(mod_id, TIMER); - - return 0; -} - -/* app definition. visibility should be set to default so this symbol is - * reachable from outside */ -flexran_agent_app_t __attribute__ ((visibility ("default"))) app = { - .start = imsi_start, - .reconfig = imsi_reconfig, - .stop = imsi_stop -}; diff --git a/openair2/ENB_APP/flexran_apps/sample.c b/openair2/ENB_APP/flexran_apps/sample.c deleted file mode 100644 index 65be2a43df..0000000000 --- a/openair2/ENB_APP/flexran_apps/sample.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file sample.c - * \brief flexran sample app - * \author Robert Schmidt - * \date 2020 - * \version 0.1 - */ - -#include "flexran_agent_common.h" -#include "flexran_agent_async.h" -#include "flexran_agent_extern.h" -#include "flexran_agent_timer.h" -#include "flexran_agent_defs.h" -#include "flexran_agent_net_comm.h" -#include "flexran_agent_ran_api.h" -#include "flexran_agent_phy.h" -#include "flexran_agent_mac.h" -#include "flexran_agent_rrc.h" -#include "flexran_agent_pdcp.h" -#include "flexran_agent_s1ap.h" -#include "flexran_agent_app.h" -#include "common/utils/LOG/log.h" -#include "assertions.h" - -/* callback to be called for event: shows exemplary variable use and use of RAN - * API */ -int tick; -Protocol__FlexranMessage *sample_tick( - mid_t mod_id, - const Protocol__FlexranMessage *msg) { - tick++; - const int num = flexran_get_mac_num_ues(mod_id); - LOG_I(FLEXRAN_AGENT, "%s(): tick %d number UEs %d\n", __func__, tick, num); - return NULL; -} - -void print_param(Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, int n_p) { - LOG_I(FLEXRAN_AGENT, "%s(): received %d parameters\n", __func__, n_p); - for (int i = 0; i < n_p; ++i) { - switch (p[i]->value->param_case) { - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM__NOT_SET: - LOG_I(FLEXRAN_AGENT, " param %s is not set\n", p[i]->key); - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_INTEGER: - LOG_I(FLEXRAN_AGENT, " param %s is %d\n", p[i]->key, p[i]->value->integer); - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_FLOATING: - LOG_I(FLEXRAN_AGENT, " param %s is %f\n", p[i]->key, p[i]->value->floating); - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_BOOLEAN: - LOG_I(FLEXRAN_AGENT, " param %s is %s\n", p[i]->key, p[i]->value->boolean ? "true" : "false"); - break; - case PROTOCOL__FLEX_AGENT_RECONFIGURATION_PARAM__PARAM_STR: - LOG_I(FLEXRAN_AGENT, " param %s is %s\n", p[i]->key, p[i]->value->str); - break; - default: - LOG_W(FLEXRAN_AGENT, " type of param %s is unknown\n", p[i]->key); - break; - }; - } -} - -/* sa_start: entry point for sample app. Installs a callback using the timer - * API to have function sample_tick() called every 5s */ -#define TIMER 22 -int sa_start(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p) { - LOG_W(FLEXRAN_AGENT, "%s(): enable sample app timer\n", __func__); - flexran_agent_create_timer(mod_id, - 5000, - FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, - TIMER, - sample_tick, - NULL); - print_param(p, n_p); - return 0; -} - -int sa_reconfig(mid_t mod_id, - Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p, - int n_p) -{ - print_param(p, n_p); - return 0; -} - -/* stop function: cleans up before app can be unloaded. Here: stop the timer */ -int sa_stop(mid_t mod_id) { - LOG_W(FLEXRAN_AGENT, "%s(): disable sample app timer\n", __func__); - flexran_agent_destroy_timer(mod_id, TIMER); - return 0; -} - -/* app definition. visibility should be set to default so this symbol is - * reachable from outside */ -flexran_agent_app_t __attribute__ ((visibility ("default"))) app = { - .start = sa_start, - .reconfig = sa_reconfig, - .stop = sa_stop -}; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index cf8d4ce260..b8f1d7d84e 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -1007,11 +1007,6 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, pdcp_remove_UE(&ctxt); - /* notify the agent */ - if (flexran_agent_get_rrc_xface(instance)) - flexran_agent_get_rrc_xface(instance)->flexran_agent_notify_ue_state_change( - instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - LOG_I(F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti); f1ap_remove_ue(CUtype, instance, rnti); return 0; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 92255f065a..a33bbd0741 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -589,90 +589,6 @@ void fix_scd(NR_ServingCellConfig_t *scd) { } } -void RCconfig_nr_flexran() -{ - uint16_t i; - uint16_t num_gnbs; - char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - /* this will possibly truncate the cell id (RRC assumes int32_t). - * Both Nid_cell and gnb_id are signed in RRC case, but we use unsigned for - * the bitshifting to work properly */ - uint16_t Nid_cell_tr = 0; - uint32_t gnb_id = 0; - - - /* get number of gNBs */ - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - config_get(GNBSParams, sizeof(GNBSParams)/sizeof(paramdef_t), NULL); - num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - - /* for gNB ID */ - paramdef_t GNBParams[] = GNBPARAMS_DESC; - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; - - paramdef_t flexranParams[] = FLEXRANPARAMS_DESC; - config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); - - if (!RC.flexran) { - RC.flexran = calloc(num_gnbs, sizeof(flexran_agent_info_t*)); - AssertFatal(RC.flexran, - "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n", - num_gnbs * sizeof(flexran_agent_info_t*), - num_gnbs, sizeof(flexran_agent_info_t*)); - } - - for (i = 0; i < num_gnbs; i++) { - RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t)); - AssertFatal(RC.flexran[i], - "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n", - sizeof(flexran_agent_info_t), i + 1, num_gnbs); - /* if config says "yes", enable Agent, in all other cases it's like "no" */ - RC.flexran[i]->enabled = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0; - /* if not enabled, simply skip the rest, it is not needed anyway */ - if (!RC.flexran[i]->enabled) - continue; - RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr)); - //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN); - RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr)); - RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr); - RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr)); - RC.flexran[i]->node_ctrl_state = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION; - - config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams)/sizeof(paramdef_t),NULL); - /* gNB ID from configuration, as read in by RCconfig_RRC() */ - if (!GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr) { - // Calculate a default gNB ID - if (get_softmodem_params()->sa) - gnb_id = i + (ngap_generate_gNB_id () & 0xFFFFFF8); - else - gnb_id = i; - } else { - gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); - } - - /* cell ID */ - sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, i); - - RC.flexran[i]->mod_id = i; - RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)gnb_id) << 16) | ((uint64_t)Nid_cell_tr); - - /* - * Assume for the moment the monolithic case, i.e. agent can provide information for all layers - * Consider using uint16_t flexran_get_capabilities_mask(mid_t mod_id), - * with RC.rrc[mod_id]->node_type = ngran_gNB - */ - RC.flexran[i]->capability_mask = (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIPHY) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__LOMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__HIMAC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RLC) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__PDCP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__SDAP) - | (1 << PROTOCOL__FLEX_BS_CAPABILITY__RRC); - - } -} - void RCconfig_nr_prs(void) { uint16_t j = 0, k = 0; diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index b75277545c..889a8dfb7b 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -91,7 +91,6 @@ typedef struct ru_config_s { } ru_config_t; */ extern void NRRCconfig_RU(void); -extern void RCconfig_nr_flexran(void); extern void RCconfig_nr_prs(void); extern void RCconfig_NR_L1(void); extern void RCconfig_nr_macrlc(void); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 4378042979..bf5e9f9660 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -374,35 +374,6 @@ typedef enum { #define CONFIG_STRING_L1_CONFIG "l1_config" - -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" - -#define CONFIG_STRING_FLEXRAN_ENABLED "FLEXRAN_ENABLED" -#define CONFIG_STRING_FLEXRAN_INTERFACE_NAME "FLEXRAN_INTERFACE_NAME" -#define CONFIG_STRING_FLEXRAN_IPV4_ADDRESS "FLEXRAN_IPV4_ADDRESS" -#define CONFIG_STRING_FLEXRAN_PORT "FLEXRAN_PORT" -#define CONFIG_STRING_FLEXRAN_CACHE "FLEXRAN_CACHE" -#define CONFIG_STRING_FLEXRAN_AWAIT_RECONF "FLEXRAN_AWAIT_RECONF" - -#define FLEXRAN_ENABLED 0 -#define FLEXRAN_INTERFACE_NAME_IDX 1 -#define FLEXRAN_IPV4_ADDRESS_IDX 2 -#define FLEXRAN_PORT_IDX 3 -#define FLEXRAN_CACHE_IDX 4 -#define FLEXRAN_AWAIT_RECONF_IDX 5 - -#define FLEXRANPARAMS_DESC { \ -{CONFIG_STRING_FLEXRAN_ENABLED, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ -{CONFIG_STRING_FLEXRAN_INTERFACE_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ -{CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{CONFIG_STRING_FLEXRAN_PORT, NULL, 0, uptr:NULL, defintval:2210, TYPE_UINT, 0}, \ -{CONFIG_STRING_FLEXRAN_CACHE, NULL, 0, strptr:NULL, defstrval:"/mnt/oai_agent_cache", TYPE_STRING, 0}, \ -{CONFIG_STRING_FLEXRAN_AWAIT_RECONF, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0} \ -} - /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MACRLC configuration section names */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 53ab98a33f..354d54f74f 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -49,10 +49,6 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -//Agent-related headers -#include "flexran_agent_extern.h" -#include "flexran_agent_mac.h" - /* for fair round robin SCHED */ #include "eNB_scheduler_fairRR.h" @@ -1087,12 +1083,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, } } - if (flexran_agent_get_mac_xface(module_idP) && subframeP == 9) { - flexran_agent_slice_update(module_idP); - } - if (flexran_agent_get_mac_xface(module_idP)) - flexran_agent_get_mac_xface(module_idP)->flexran_agent_notify_tick(module_idP); - stop_meas(&(eNB->eNB_scheduler)); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_OUT); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index f9218d8511..efef339702 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -43,6 +43,7 @@ #include "PHY/LTE_TRANSPORT/transport_common_proto.h" #include "RRC/LTE/rrc_extern.h" +#include "RRC/LTE/rrc_eNB_UE_context.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "assertions.h" @@ -50,11 +51,6 @@ #include "intertask_interface.h" -#include "ENB_APP/flexran_agent_defs.h" -#include "flexran_agent_ran_api.h" -#include "header.pb-c.h" -#include "flexran.pb-c.h" -#include "flexran_agent_mac.h" #include #include #include "common/utils/lte/prach_utils.h" diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index f5d694d98f..75bf738446 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2424,7 +2424,7 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slot){ // no UL-SCH resources available for this tti && UE has a valid PUCCH resources for SR configuration for this tti - DevCheck(module_idP < (int) NB_UE_INST, module_idP, NB_NR_UE_MAC_INST, 0); + DevCheck(module_idP < NB_NR_UE_MAC_INST, module_idP, NB_NR_UE_MAC_INST, 0); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); DSR_TRANSMAX_t dsr_TransMax = sr_n64; // todo LOG_D(NR_MAC, "[UE %d] Frame %d slot %d send SR indication (SR_COUNTER/dsr_TransMax %d/%d), SR_pending %d\n", diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 2699a07c04..ccee837403 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -138,7 +138,6 @@ extern int oai_exit; pthread_t pdcp_stats_thread_desc; -// will be called when 4G F1 implementation will use GTP-U instead of protobuf bool cu_f1u_data_req( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/MCE_APP/mce_app.c b/openair2/MCE_APP/mce_app.c index 4ac12ab5b4..dcc79ca2a6 100644 --- a/openair2/MCE_APP/mce_app.c +++ b/openair2/MCE_APP/mce_app.c @@ -42,7 +42,6 @@ # include "s1ap_eNB.h" # include "sctp_eNB_task.h" # include "gtpv1u_eNB_task.h" -# include "flexran_agent.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" @@ -390,10 +389,6 @@ void *MCE_app_task(void *args_p) { LOG_I(MCE_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; - case SOFT_RESTART_MESSAGE: - //handle_reconfiguration(instance); - break; - case M3AP_REGISTER_MCE_CNF: //AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); LOG_I(MCE_APP, "[MCE %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), @@ -700,57 +695,3 @@ void *MCE_app_task(void *args_p) { return NULL; } - -//void handle_reconfiguration(module_id_t mod_id) { -// struct timespec start, end; -// clock_gettime(CLOCK_MONOTONIC, &start); -// flexran_agent_info_t *flexran = RC.flexran[mod_id]; -// LOG_I(ENB_APP, "lte-softmodem soft-restart requested\n"); -// -// if (ENB_WAIT == flexran->node_ctrl_state) { -// /* this is already waiting, just release */ -// pthread_mutex_lock(&flexran->mutex_node_ctrl); -// flexran->node_ctrl_state = ENB_NORMAL_OPERATION; -// pthread_mutex_unlock(&flexran->mutex_node_ctrl); -// pthread_cond_signal(&flexran->cond_node_ctrl); -// return; -// } -// -// if (stop_L1L2(mod_id) < 0) { -// LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n"); -// return; -// } -// -// /* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not -// * executed by the FlexRAN thread */ -// if (ENB_MAKE_WAIT == flexran->node_ctrl_state) { -// LOG_I(ENB_APP, " * MCE %d: Waiting for FlexRAN RTController command *\n", mod_id); -// pthread_mutex_lock(&flexran->mutex_node_ctrl); -// flexran->node_ctrl_state = ENB_WAIT; -// -// while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state) -// pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl); -// -// pthread_mutex_unlock(&flexran->mutex_node_ctrl); -// } -// -// if (restart_L1L2(mod_id) < 0) { -// LOG_E(ENB_APP, "can not restart, killing lte-softmodem\n"); -// exit_fun("can not restart L1L2, killing lte-softmodem"); -// return; -// } -// -// clock_gettime(CLOCK_MONOTONIC, &end); -// end.tv_sec -= start.tv_sec; -// -// if (end.tv_nsec >= start.tv_nsec) { -// end.tv_nsec -= start.tv_nsec; -// } else { -// end.tv_sec -= 1; -// end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000; -// } -// -// LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000); -//} - - diff --git a/openair2/MCE_APP/mce_app.h b/openair2/MCE_APP/mce_app.h index 59146b9d0d..fc55c10f1c 100644 --- a/openair2/MCE_APP/mce_app.h +++ b/openair2/MCE_APP/mce_app.h @@ -36,6 +36,4 @@ void *MCE_app_task(void *args_p); -//void handle_reconfiguration(module_id_t mod_id); - #endif /* ENB_APP_H_ */ diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index c12d2aa873..c6d2d1ae68 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -47,7 +47,6 @@ #include "intertask_interface.h" -#include "flexran_agent_extern.h" #include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" extern RAN_CONTEXT_t RC; @@ -405,11 +404,6 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); } - if (flexran_agent_get_rrc_xface(Mod_instP)) { - flexran_agent_get_rrc_xface(Mod_instP)->flexran_agent_notify_ue_state_change(Mod_instP, - rntiP, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - //rrc_mac_remove_ue(Mod_instP,rntiP); } diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index f0a81d9821..ebd0ed7f5b 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -32,6 +32,8 @@ #define RRC_UE_C #define _GNU_SOURCE +#include + #include "assertions.h" #include "hashtable.h" #include "asn1_conversions.h" diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 57f775f0f7..e227a3e75b 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1035,10 +1035,6 @@ void release_UE_in_freeList(module_id_t mod_id) { } } - if (flexran_agent_get_rrc_xface(mod_id)) { - flexran_agent_get_rrc_xface(mod_id)->flexran_agent_notify_ue_state_change( mod_id, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - for(int j = 0; j < 10; j++) { nfapi_ul_config_request_body_t *ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; @@ -3477,684 +3473,6 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t quantityConfig = NULL; } -//----------------------------------------------------------------------------- -void -flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, - rrc_eNB_ue_context_t *const ue_context_pP, - const uint8_t ho_state) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i; - MessageDef *message_p = NULL; - /* Configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE */ - eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct LTE_PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - struct LTE_SRB_ToAddMod *SRB2_config = NULL; - struct LTE_SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; - struct LTE_SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; - struct LTE_LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; - LTE_SRB_ToAddModList_t **SRB_configList2 = NULL; - struct LTE_DRB_ToAddMod *DRB_config = NULL; - struct LTE_RLC_Config *DRB_rlc_config = NULL; - struct LTE_PDCP_Config *DRB_pdcp_config = NULL; - struct LTE_PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL; - struct LTE_LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - LTE_DRB_ToAddModList_t **DRB_configList = &ue_context_pP->ue_context.DRB_configList; - LTE_DRB_ToAddModList_t **DRB_configList2 = NULL; - LTE_MAC_MainConfig_t *mac_MainConfig = NULL; - LTE_MeasObjectToAddModList_t *MeasObj_list = NULL; - LTE_MeasObjectToAddMod_t *MeasObj = NULL; - LTE_ReportConfigToAddModList_t *ReportConfig_list = NULL; - LTE_ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - LTE_MeasIdToAddModList_t *MeasId_list = NULL; - LTE_MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; - long *sr_ProhibitTimer_r9 = NULL; - long *logicalchannelgroup = NULL; - long *logicalchannelgroup_drb = NULL; - long *maxHARQ_Tx = NULL; - long *periodicBSR_Timer = NULL; - LTE_RSRP_Range_t *rsrp = NULL; - struct LTE_MeasConfig__speedStatePars *Sparams = NULL; - LTE_QuantityConfig_t *quantityConfig = NULL; - LTE_CellsToAddMod_t *CellToAdd = NULL; - LTE_CellsToAddModList_t *CellsToAddModList = NULL; - struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - LTE_DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* For no gcc warnings */ - (void) dedicatedInfoNas; - LTE_C_RNTI_t *cba_RNTI = NULL; - int measurements_enabled; - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, -#ifdef CBA // Contention Based Access - uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(LTE_C_RNTI_t)); - cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); - cba_RNTI->buf = cba_RNTI_buf; - cba_RNTI->size = 2; - cba_RNTI->bits_unused = 0; - - /* Associate UEs to the CBA groups as a function of their UE id */ - if (rrc_inst->num_active_cba_groups) { - cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; - cba_RNTI->buf[1] = 0xff; - LOG_D(RRC, "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", - enb_mod_idP, - frameP, - rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], - ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); - } else { - cba_RNTI->buf[0] = 0x0; - cba_RNTI->buf[1] = 0x0; - LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", - enb_mod_idP, - frameP, - ue_mod_idP); - } - -#endif - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, - T_INT(ctxt_pP->module_id), - T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), - T_INT(ctxt_pP->rnti)); - /* Configure SRB2 */ - SRB_configList2 = &(ue_context_pP->ue_context.SRB_configList2[xid]); - - if (*SRB_configList2) { - free(*SRB_configList2); - } - - *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); - memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); - SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; - SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); - SRB2_config->rlc_Config = SRB2_rlc_config; - SRB2_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms10; - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); - SRB2_config->logicalChannelConfig = SRB2_lchan_config; - SRB2_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs - SRB2_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - SRB2_ul_SpecificParameters->bucketSizeDuration = LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - /* LCG for CCCH and DCCH is 0 as defined in 36331 */ - logicalchannelgroup = CALLOC(1, sizeof(long)); - *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); // this list has the configuration for SRB1 and SRB2 - ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); // this list has only the configuration for SRB2 - - /* Configure DRB */ - // list for all the configured DRB - if (*DRB_configList) { - free(*DRB_configList); - } - - *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); - memset(*DRB_configList, 0, sizeof(**DRB_configList)); - DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; // list for the configured DRB for a this xid - - if (*DRB_configList2) { - free(*DRB_configList2); - } - - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); - memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 - // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (LTE_DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; -#ifdef RRC_DEFAULT_RAB_IS_AM - DRB_rlc_config->present = LTE_RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25; -#else - DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35; -#endif - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity; - DRB_pdcp_config->rlc_AM = NULL; - DRB_pdcp_config->rlc_UM = NULL; - /* Avoid gcc warnings */ - (void)PDCP_rlc_AM; - (void)PDCP_rlc_UM; -#ifdef RRC_DEFAULT_RAB_IS_AM - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = 0; // FALSE -#else - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; -#endif - DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); - DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; // LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration = LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - *logicalchannelgroup_drb = 1; - DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - /* MAC Main Config */ - // The different parts of MAC main config are set below - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - /* BSR reconfiguration */ - periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = LTE_PeriodicBSR_Timer_r12_sf64; //LTE_PeriodicBSR_Timer_r12_infinity; // LTE_PeriodicBSR_Timer_r12_sf64; // LTE_PeriodicBSR_Timer_r12_sf20 - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = LTE_RetxBSR_Timer_r12_sf320; // LTE_RetxBSR_Timer_r12_sf320; // LTE_RetxBSR_Timer_r12_sf5120 - mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - mac_MainConfig->timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_infinity; - /* PHR reconfiguration */ - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - mac_MainConfig->phr_Config->present = LTE_MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = - LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf500; // sf20 = 20 subframes // LTE_MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_infinity - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = - LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf200; // sf20 = 20 subframes // LTE_MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf1000 - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = LTE_MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB3; // Value dB1 =1 dB, dB3 = 3 dB - /* CDRX Configuration */ - mac_MainConfig->drx_Config = NULL; - rnti_t rnti = ue_context_pP->ue_id_rnti; - module_id_t module_id = ctxt_pP->module_id; - uint8_t cc_id = ue_context_pP->ue_context.primaryCC_id; - LTE_UE_EUTRA_Capability_t *UEcap = ue_context_pP->ue_context.UE_Capability; - LOG_D(RRC, "Processing the DRX configuration in RRC Connection Reconfiguration\n"); - - /* Process the IE drx_Config */ - if (NODE_IS_MONOLITHIC(rrc_inst->node_type)) { - mac_MainConfig->drx_Config = do_DrxConfig(cc_id, &rrc_inst->configuration, UEcap); // drx_Config IE - - if (mac_MainConfig->drx_Config == NULL) { - LOG_W(RRC, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); - } else { - /* Send DRX configuration to MAC task to configure timers of local UE context */ - message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, RRC_MAC_DRX_CONFIG_REQ); - RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = rnti; - RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; - itti_send_msg_to_task(TASK_MAC_ENB, module_id, message_p); - LOG_D(RRC, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); - } - } - - /* End of CDRX configuration */ - sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); - *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2 = 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct LTE_MAC_MainConfig__ext1)); - mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; - // free the old LTE_MAC_MainConfig_t: get a pointer to "old" memory, assign - // the new values in the ue_context, then free it - // Note: can not completely avoid race condition with FlexRAN - LTE_MAC_MainConfig_t *old_mac_MainConfig = ue_context_pP->ue_context.mac_MainConfig; - ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - free(old_mac_MainConfig->ul_SCH_Config->periodicBSR_Timer); - free(old_mac_MainConfig->ul_SCH_Config->maxHARQ_Tx); - free(old_mac_MainConfig->ul_SCH_Config); - free(old_mac_MainConfig->phr_Config); - free(old_mac_MainConfig->ext1->sr_ProhibitTimer_r9); - free(old_mac_MainConfig->ext1); - free(old_mac_MainConfig); - - // change the transmission mode for the primary component carrier - // TODO: add codebook subset restriction here - // TODO: change TM for secondary CC in SCelltoaddmodlist - if (*physicalConfigDedicated) { - if ((*physicalConfigDedicated)->antennaInfo) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode; - LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode); - - if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - } else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; - } else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; - } else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; - } - } else { - LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); - } - - /* CSI RRC Reconfiguration */ - if ((*physicalConfigDedicated)->cqi_ReportConfig != NULL) { - if ((rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode == LTE_AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode == LTE_AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode == LTE_AntennaInfoDedicated__transmissionMode_tm6)) { - // feedback mode needs to be set as well - // TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - LOG_I(RRC, "Setting cqi reporting mode to rm31 (hardcoded)\n"); - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic) = LTE_CQI_ReportModeAperiodic_rm31; // HLC CQI, single PMI - } - } else { - LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); - } - } else { - LOG_E(RRC,"physical_config_dedicated not present in LTE_RRCConnectionReconfiguration. Not reconfiguring!\n"); - } - - // Measurement ID list - MeasId_list = CALLOC(1, sizeof(*MeasId_list)); - memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); - MeasId0->measId = 1; - MeasId0->measObjectId = 1; - MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); - MeasId1->measId = 2; - MeasId1->measObjectId = 1; - MeasId1->reportConfigId = 2; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); - MeasId2->measId = 3; - MeasId2->measObjectId = 1; - MeasId2->reportConfigId = 3; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); - MeasId3->measId = 4; - MeasId3->measObjectId = 1; - MeasId3->reportConfigId = 4; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); - MeasId4->measId = 5; - MeasId4->measObjectId = 1; - MeasId4->reportConfigId = 5; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); - MeasId5->measId = 6; - MeasId5->measObjectId = 1; - MeasId5->reportConfigId = 6; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - // Add one EUTRA Measurement Object - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); - memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); - memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; - MeasObj->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = - to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0], - RC.rrc[ctxt_pP->module_id]->configuration.downlink_frequency[0], - RC.rrc[ctxt_pP->module_id]->configuration.N_RB_DL[0]); - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = LTE_AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - - if (rrc_inst->carrier[0].sib1->tdd_Config!=NULL) { - MeasObj->measObject.choice.measObjectEUTRA.ext1 = CALLOC(1, sizeof(struct LTE_MeasObjectEUTRA__ext1)); - MeasObj->measObject.choice.measObjectEUTRA.ext1->measCycleSCell_r10 = NULL; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10 = CALLOC(1, sizeof(struct LTE_MeasSubframePatternConfigNeigh_r10)); - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->present=LTE_MeasSubframePatternConfigNeigh_r10_PR_setup; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.present=LTE_MeasSubframePattern_r10_PR_subframePatternTDD_r10; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.present= - LTE_MeasSubframePattern_r10__subframePatternTDD_r10_PR_subframeConfig1_5_r10; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf=CALLOC(3, - sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.size=3; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.bits_unused=4; - - switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) { - case 1: //subframe 0,4,5,9 - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[0]=0x8C; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[1]=0x63; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[2]=0x10; - break; - - default: //subframe 0 , 5 - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[0]=0x84; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[1]=0x21; - MeasObj->measObject.choice.measObjectEUTRA.ext1->measSubframePatternConfigNeigh_r10->choice.setup.measSubframePatternNeigh_r10.choice.subframePatternTDD_r10.choice.subframeConfig1_5_r10.buf[2]=0x00; - break; - } - } - - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - //======= - // MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = (LTE_Q_OffsetRange_t *) CALLOC(1,sizeof(LTE_Q_OffsetRange_t)); - // *(MeasObj->measObject.choice.measObjectEUTRA.offsetFreq) = ue_context_pP->ue_context.measurement_info->offsetFreq; // Default is 15 or 0dB - //>>>>>>> origin/OAI_develop - - if (RC.rrc[ctxt_pP->module_id]->num_neigh_cells > 0) { - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (LTE_CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - } - - /* TODO: Extend to multiple carriers */ - // Add adjacent cell lists (max 6 per eNB) - for (i = 0; i < RC.rrc[ctxt_pP->module_id]->num_neigh_cells; i++) { - CellToAdd = (LTE_CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); - CellToAdd->cellIndex = i + 1; - CellToAdd->physCellId = RC.rrc[ctxt_pP->module_id]->neigh_cells_id[i][0];//get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = ue_context_pP->ue_context.measurement_info->cellIndividualOffset[i+1]; - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); - } - - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - // Report Configurations for periodical, A1-A5 events - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_periodical; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - LTE_ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - //if (ho_state == 1 /*HO_MEASURMENT */ ) { - LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, and A5 event reporting\n", - ctxt_pP->module_id, ctxt_pP->frame); - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = ue_context_pP->ue_context.measurement_info->events->a3_event->a3_offset;//10; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA3.reportOnLeave = ue_context_pP->ue_context.measurement_info->events->a3_event->reportOnLeave; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = ue_context_pP->ue_context.measurement_info->events->a3_event->maxReportCells; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = ue_context_pP->ue_context.measurement_info->events->a3_event->hysteresis; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = - ue_context_pP->ue_context.measurement_info->events->a3_event->timeToTrigger; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - LTE_ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = LTE_ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - LTE_ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = LTE_ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = LTE_ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = LTE_ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - // LTE_RRCConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; -#if 0 - /* TODO: set a proper value. - * 20 means: UE does not report if RSRP of serving cell is higher - * than -120 dB (see 36.331 5.5.3.1). - * This is too low for the X2 handover experiment. - */ - rsrp = CALLOC(1, sizeof(LTE_RSRP_Range_t)); - *rsrp = 20; -#endif - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = LTE_MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = LTE_SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = LTE_SpeedStateScaleFactors__sf_High_oDot5; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = LTE_MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = LTE_MobilityStateParameters__t_HystNormal_s120; - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct LTE_QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = ue_context_pP->ue_context.measurement_info->filterCoefficientRSRP; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = ue_context_pP->ue_context.measurement_info->filterCoefficientRSRQ; - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - /* Add all NAS PDUs to the list */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(LTE_DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - } - - /* TODO parameters yet to process ... */ - { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - } - /* TODO should test if e RAB are OK before! */ - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - } - - measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 || - RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports; - memset(buffer, 0, sizeof(buffer)); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - sizeof(buffer), - xid, // Transaction_id, - (LTE_SRB_ToAddModList_t *) *SRB_configList2, // SRB_configList - (LTE_DRB_ToAddModList_t *) *DRB_configList, - (LTE_DRB_ToReleaseList_t *) NULL, // DRB2_list, - (struct LTE_SPS_Config *) NULL, // *sps_Config, - (struct LTE_PhysicalConfigDedicated *) *physicalConfigDedicated, - measurements_enabled ? (LTE_MeasObjectToAddModList_t *) MeasObj_list : NULL, - measurements_enabled ? (LTE_ReportConfigToAddModList_t *) ReportConfig_list : NULL, - measurements_enabled ? (LTE_QuantityConfig_t *) quantityConfig : NULL, - measurements_enabled ? (LTE_MeasIdToAddModList_t *) MeasId_list : NULL, - (LTE_MAC_MainConfig_t *) mac_MainConfig, - (LTE_MeasGapConfig_t *) NULL, - (LTE_MobilityControlInfo_t *) NULL, - (LTE_SecurityConfigHO_t *) NULL, - (struct LTE_MeasConfig__speedStatePars *) Sparams, - (LTE_RSRP_Range_t *) rsrp, - (LTE_C_RNTI_t *) cba_RNTI, - (struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *) dedicatedInfoNASList, - (LTE_SL_CommConfig_r12_t *) NULL, - (LTE_SL_DiscConfig_r12_t *) NULL, - (LTE_SCellToAddMod_r10_t *) NULL - ); - LOG_DUMPMSG(RRC, DEBUG_RRC,(char *)buffer, size, "[MSG] RRC Connection Reconfiguration\n"); - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - } - } - - LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate LTE_RRCConnectionReconfiguration (bytes %d, UE id %x)\n", - ctxt_pP->module_id, - ctxt_pP->frame, - size, - ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, - ctxt_pP->module_id, - size, - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - ctxt_pP->module_id, - DCCH); - rrc_data_req(ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = NULL; - free(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = NULL; - free(quantityConfig->quantityConfigEUTRA); - quantityConfig->quantityConfigEUTRA = NULL; - free(quantityConfig); - quantityConfig = NULL; -} - //----------------------------------------------------------------------------- int rrc_eNB_generate_RRCConnectionReconfiguration_SCell( @@ -4830,99 +4148,6 @@ void rrc_eNB_handover_cancel( S1AP_CAUSE_RADIO_NETWORK, s1_cause); } - -int -flexran_rrc_eNB_trigger_handover (int mod_id, - const protocol_ctxt_t *const ctxt_pP, - rrc_eNB_ue_context_t *ue_context_pP, - int target_cell_id) { - uint32_t earfcn_dl; - uint8_t KeNB_star[32] = { 0 }; - int cell_found = 0; - - /* if X2AP is disabled, do nothing */ - if (!is_x2ap_enabled()) { - LOG_E(RRC, "X2 is disabled\n"); - return -1; - } - - /* Check if eNB id belongs to the supported ones-Extend for multiple carrieres */ - for (int i=0; i < RC.rrc[mod_id]->num_neigh_cells; i++) { - if (RC.rrc[mod_id]->neigh_cells_id[i][0] == target_cell_id) { - cell_found = 1; - break; - } - } - - /* Check if eNB id was found */ - if (!cell_found) { - LOG_E(RRC, "%s(): cannot find target eNB with phyCellId %d\n", __func__, target_cell_id); - return -1; - } - - /* Handover process is following */ - LOG_D(RRC, "Handover is triggered by FlexRAN controller...\n"); - - /* if the UE is not in handover mode, start handover procedure */ - if (ue_context_pP->ue_context.StatusRrc != RRC_HO_EXECUTION) { - MessageDef *msg; - LOG_I(RRC, "Send HO preparation message at frame %d and subframe %d \n", ctxt_pP->frame, ctxt_pP->subframe); - /* Check memory leakage for handover info */ - //if (ue_context_pP->ue_context.handover_info) { - //free(ue_context_pP->ue_context.handover_info); - //} - ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - ue_context_pP->ue_context.StatusRrc = RRC_HO_EXECUTION; - ue_context_pP->ue_context.handover_info->state = HO_REQUEST; - /* HO Preparation message */ - msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ); - rrc_eNB_generate_HandoverPreparationInformation( - ue_context_pP, - X2AP_HANDOVER_REQ(msg).rrc_buffer, - &X2AP_HANDOVER_REQ(msg).rrc_buffer_size); - X2AP_HANDOVER_REQ(msg).rnti = ctxt_pP->rnti; - X2AP_HANDOVER_REQ(msg).target_physCellId = target_cell_id; - X2AP_HANDOVER_REQ(msg).ue_gummei.mcc = ue_context_pP->ue_context.ue_gummei.mcc; - X2AP_HANDOVER_REQ(msg).ue_gummei.mnc = ue_context_pP->ue_context.ue_gummei.mnc; - X2AP_HANDOVER_REQ(msg).ue_gummei.mnc_len = ue_context_pP->ue_context.ue_gummei.mnc_len; - X2AP_HANDOVER_REQ(msg).ue_gummei.mme_code = ue_context_pP->ue_context.ue_gummei.mme_code; - X2AP_HANDOVER_REQ(msg).ue_gummei.mme_group_id = ue_context_pP->ue_context.ue_gummei.mme_group_id; - // Don't know how to get this ID? - X2AP_HANDOVER_REQ(msg).mme_ue_s1ap_id = ue_context_pP->ue_context.mme_ue_s1ap_id; - X2AP_HANDOVER_REQ(msg).security_capabilities = ue_context_pP->ue_context.security_capabilities; - // compute keNB* - earfcn_dl = (uint32_t)to_earfcn_DL(RC.rrc[ctxt_pP->module_id]->carrier[0].eutra_band, RC.rrc[ctxt_pP->module_id]->carrier[0].dl_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[0].N_RB_DL); - derive_keNB_star(ue_context_pP->ue_context.kenb, X2AP_HANDOVER_REQ(msg).target_physCellId, earfcn_dl, true, KeNB_star); - memcpy(X2AP_HANDOVER_REQ(msg).kenb, KeNB_star, 32); - X2AP_HANDOVER_REQ(msg).kenb_ncc = ue_context_pP->ue_context.kenb_ncc; - //X2AP_HANDOVER_REQ(msg).ue_ambr=ue_context_pP->ue_context.ue_ambr; - X2AP_HANDOVER_REQ(msg).nb_e_rabs_tobesetup = ue_context_pP->ue_context.setup_e_rabs; - - for (int i=0; iue_context.setup_e_rabs; i++) { - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].eNB_addr = ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - X2AP_HANDOVER_REQ(msg).e_rabs_tobesetup[i].gtp_teid = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.qci = ue_context_pP->ue_context.e_rab[i].param.qos.qci; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.priority_level = ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability; - X2AP_HANDOVER_REQ(msg).e_rab_param[i].qos.allocation_retention_priority.pre_emp_vulnerability = ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability; - } - - /* TODO: don't do that, X2AP should find the target by itself */ - //X2AP_HANDOVER_REQ(msg).target_mod_id = 0; - LOG_I(RRC, - "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", - ctxt_pP->module_id, ctxt_pP->frame); - itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), msg); - } else { - LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, - ctxt_pP->rnti); - } - - return 0; -} - void check_handovers( protocol_ctxt_t *const ctxt_pP @@ -7263,12 +6488,6 @@ rrc_eNB_decode_ccch( RC.rrc[ctxt_pP->module_id]->Nb_ue++; } else { // no context available - if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { - flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ctxt_pP->rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), random_value); @@ -7700,7 +6919,6 @@ rrc_eNB_decode_dcch( LTE_RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { /*NN: revise the condition */ /*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 (EPC_MODE_ENABLED || get_softmodem_params()->emulate_l1) { if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { @@ -7738,7 +6956,6 @@ rrc_eNB_decode_dcch( break; } - flexran_agent_handover = 1; RC.rrc[ctxt_pP->module_id]->Nb_ue++; dedicated_DRB = 3; RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; @@ -7804,13 +7021,6 @@ rrc_eNB_decode_dcch( ctxt_pP, ue_context_p, ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { - flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - flexran_agent_handover?PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED:PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); - } } if (EPC_MODE_ENABLED) { @@ -7949,13 +7159,6 @@ rrc_eNB_decode_dcch( rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { - flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } } //ue_context_p->ue_context.ue_release_timer = 0; @@ -7995,13 +7198,6 @@ rrc_eNB_decode_dcch( &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (flexran_agent_get_rrc_xface(ctxt_pP->module_id)) { - flexran_agent_get_rrc_xface(ctxt_pP->module_id)->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } } } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index e017083fcc..e50868d4af 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -56,7 +56,6 @@ #include "TLVDecoder.h" #include "S1AP_NAS-PDU.h" -#include "flexran_agent_common_internal.h" #include "executables/softmodem-common.h" extern RAN_CONTEXT_t RC; diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h index 7bd3fbf758..fa469503af 100644 --- a/openair2/RRC/LTE/rrc_proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -35,7 +35,6 @@ #include "RRC/LTE/rrc_defs.h" #include "x2ap_messages_types.h" -#include "flexran_agent_extern.h" //main.c int rrc_init_global_param(void); @@ -303,12 +302,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration( ); -void -flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - rrc_eNB_ue_context_t *const ue_context_pP, - const uint8_t ho_state -); void rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, @@ -624,11 +617,6 @@ rrc_eNB_generate_HandoverPreparationInformation( //LTE_PhysCellId_t targetPhyId ); -int -flexran_rrc_eNB_trigger_handover (int mod_id, - const protocol_ctxt_t *const ctxt_pP, - rrc_eNB_ue_context_t *ue_context_pP, - int target_cell_id); void check_handovers( diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c index 3bd30d2670..bf4d0ec129 100644 --- a/openair2/RRC/NAS/nas_config.c +++ b/openair2/RRC/NAS/nas_config.c @@ -46,6 +46,7 @@ #include "common/utils/LOG/log.h" #include "targets/RT/USER/lte-softmodem.h" #include "common/config/config_userapi.h" +#include "pdcp.h" //default values according to the examples, diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index b90cf4dfa4..a86fb6f8df 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -32,7 +32,6 @@ */ #include "RRC/NR/nr_rrc_defs.h" -#include "flexran_agent_extern.h" #include "NR_RRCReconfiguration.h" #include "NR_UE-NR-Capability.h" #include "NR_UE-CapabilityRAT-ContainerList.h" diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c deleted file mode 100644 index b98dc3bad7..0000000000 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file link_manager.c - * \brief this is the implementation of a link manager - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#include "link_manager.h" -#include "common/utils/LOG/log.h" -#include -#include - -#include -#include -#include - -/* that thread reads messages in the queue and sends them to the link */ -static void *link_manager_sender_thread(void *_manager) -{ - link_manager_t *manager = _manager; - void *data; - int size; - int priority; - - LOG_D(MAC, "starting link manager sender thread\n"); - - while (manager->run) { - while ((size = message_get(manager->send_queue, &data, &priority)) > 0) { - link_send_packet(manager->socket_link, data, size, manager->peer_addr, manager->peer_port); - free(data); - } - } - - LOG_D(MAC, "link manager sender thread quits\n"); - - return NULL; - - //error: - //LOG_E(MAC, "%s: error\n", __FUNCTION__); - //return NULL; -} - -/* that thread receives messages from the link and puts them in the queue */ -static void *link_manager_receiver_thread(void *_manager) -{ - link_manager_t *manager = _manager; - void *data; - int size; - - LOG_D(MAC, "starting link manager receiver thread\n"); - - while (manager->run) { - if (link_receive_packet(manager->socket_link, &data, &size)) - goto error; - /* todo: priority */ - if (message_put(manager->receive_queue, data, size, 0)) - goto error; - } - - LOG_D(MAC, "link manager receiver thread quits\n"); - - return NULL; - -error: - LOG_E(MAC, "%s: error\n", __FUNCTION__); - return NULL; -} - -link_manager_t *create_link_manager( - message_queue_t *send_queue, - message_queue_t *receive_queue, - socket_link_t *link) -{ - link_manager_t *ret = NULL; - //pthread_attr_t attr; - pthread_t t; - - LOG_D(MAC, "create new link manager\n"); - - AssertFatal( (ret=calloc(1, sizeof(link_manager_t))) != NULL,""); - - ret->send_queue = send_queue; - ret->receive_queue = receive_queue; - ret->socket_link = link; - ret->run = 1; - - threadCreate(&t, link_manager_sender_thread, ret, "flexranSender", -1, OAI_PRIORITY_RT_LOW); - ret->sender = t; - - threadCreate(&t, link_manager_receiver_thread, ret, "flexranReceiver", -1, OAI_PRIORITY_RT_LOW); - ret->receiver = t; - - return ret; - -} - -void destroy_link_manager(link_manager_t *manager) -{ - manager->run = 0; - message_get_unlock(manager->send_queue); - pthread_join(manager->sender, NULL); - /* cancel aborts the read performed in the receiver, then cancels the thread */ - pthread_cancel(manager->receiver); -} - -#ifdef SERVER_TEST - -#include - -int main(void) -{ - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; - void *data; - int size; - int priority; - - printf("starting server\n"); - - link = new_link_server(2210); - if (link == NULL) goto error; - - send_queue = new_message_queue(); - if (send_queue == NULL) goto error; - receive_queue = new_message_queue(); - if (receive_queue == NULL) goto error; - - manager = create_link_manager(send_queue, receive_queue, link); - if (manager == NULL) goto error; - - data = strdup("hello"); if (data == NULL) goto error; - if (message_put(send_queue, data, 6, 100)) goto error; - - if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error; - printf("received message:\n"); - printf(" data: %s\n", (char *)data); - printf(" size: %d\n", size); - printf(" priority: %d\n", priority); - - printf("server ends\n"); - return 0; - -error: - printf("there was an error\n"); - return 1; -} - -#endif - -#ifdef CLIENT_TEST - -#include -#include - -int main(void) -{ - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; - void *data; - int size; - int priority; - - printf("starting client\n"); - - link = new_link_client("127.0.0.1", 2210); - if (link == NULL) goto error; - - send_queue = new_message_queue(); - if (send_queue == NULL) goto error; - receive_queue = new_message_queue(); - if (receive_queue == NULL) goto error; - - manager = create_link_manager(send_queue, receive_queue, link); - if (manager == NULL) goto error; - - if ((size = message_get(receive_queue, &data, &priority)) <= 0) goto error; - printf("received message:\n"); - printf(" data: %s\n", (char *)data); - printf(" size: %d\n", size); - printf(" priority: %d\n", priority); - - data = strdup("world"); if (data == NULL) goto error; - if (message_put(send_queue, data, 6, 200)) goto error; - - /* let's wait for the message to be sent (unreliable sleep, but does it for the test) */ - sleep(1); - - printf("client ends\n"); - return 0; - -error: - printf("there was an error\n"); - return 1; -} - -#endif diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h deleted file mode 100644 index 4148392eec..0000000000 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file link_manager.h - * \brief this is the implementation of a link manager - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#ifndef LINK_MANAGER_H -#define LINK_MANAGER_H - -#include "message_queue.h" -//#include "ringbuffer_queue.h" -#include "socket_link.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - message_queue_t *send_queue; - message_queue_t *receive_queue; - socket_link_t *socket_link; - const char *peer_addr; /* for UDP server remote IP */ - int peer_port; /* for UDP server remote address */ - pthread_t sender; - pthread_t receiver; - volatile int run; -} link_manager_t; - -link_manager_t *create_link_manager( - message_queue_t *send_queue, - message_queue_t *receive_queue, - socket_link_t *link); - -void destroy_link_manager(link_manager_t *); - -#ifdef __cplusplus -} -#endif - -#endif /* LINK_MANAGER_H */ diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c deleted file mode 100644 index 2279a067b4..0000000000 --- a/openair2/UTIL/ASYNC_IF/message_queue.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file message_queue.c - * \brief this is the implementation of a message queue - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#include "message_queue.h" -#include "common/utils/LOG/log.h" - -#include -#include -#include -#include - -message_queue_t *new_message_queue(void) -{ - message_queue_t *ret = NULL; - - ret = calloc(1, sizeof(message_queue_t)); - if (ret == NULL) - goto error; - - ret->mutex = calloc(1, sizeof(pthread_mutex_t)); - if (ret->mutex == NULL) - goto error; - if (pthread_mutex_init(ret->mutex, NULL)) - goto error; - - ret->cond = calloc(1, sizeof(pthread_cond_t)); - if (ret->cond == NULL) - goto error; - if (pthread_cond_init(ret->cond, NULL)) - goto error; - - ret->head = NULL; - ret->tail = NULL; - ret->exit = 0; - - return ret; - -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - if (ret != NULL) { - free(ret->mutex); - free(ret->cond); - memset(ret, 0, sizeof(message_queue_t)); - free(ret); - } - return NULL; -} - -int message_put(message_queue_t *queue, void *data, int size, int priority) -{ - message_t *m = NULL; - if (size <= 0) - goto error; - - m = calloc(1, sizeof(message_t)); - if (m == NULL) - goto error; - - m->data = data; - m->size = size; - m->priority = priority; - m->next = NULL; - - if (pthread_mutex_lock(queue->mutex)) - goto error; - - if (queue->count == 0) - queue->head = m; - else - queue->tail->next = m; - queue->tail = m; - - queue->count++; - - if (pthread_cond_signal(queue->cond)) { - LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); - pthread_mutex_unlock(queue->mutex); - exit(1); - } - if (pthread_mutex_unlock(queue->mutex)) { - LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - - return 0; - -error: - if (m) free(m); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int message_get(message_queue_t *queue, void **data, int *priority) -{ - message_t *m; - - if (pthread_mutex_lock(queue->mutex)) - goto error; - - while (queue->count == 0) { - int rc = pthread_cond_wait(queue->cond, queue->mutex); - if (rc != 0) { - pthread_mutex_unlock(queue->mutex); - goto error; - } - if (queue->exit) { - pthread_mutex_unlock(queue->mutex); - return 0; - } - } - - m = queue->head; - queue->head = queue->head->next; - if (queue->head == NULL) - queue->tail = NULL; - - queue->count--; - - if (pthread_mutex_unlock(queue->mutex)) - goto error; - - *data = m->data; - const int size = m->size; - *priority = m->priority; - free(m); - - return size; -error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -void message_get_unlock(message_queue_t *queue) -{ - pthread_mutex_lock(queue->mutex); - queue->exit = 1; - pthread_mutex_unlock(queue->mutex); - pthread_cond_signal(queue->cond); -} - -/* when calling this function, the queue must not be used anymore (we don't lock it) */ -/* we suppose that the data pointer in messages was allocated by malloc/calloc/realloc */ -void destroy_message_queue(message_queue_t *queue) -{ - while (queue->head) { - message_t *m = queue->head; - queue->head = queue->head->next; - free(m->data); - memset(m, 0, sizeof(message_t)); - free(m); - } - free(queue->mutex); - free(queue->cond); - memset(queue, 0, sizeof(message_queue_t)); - free(queue); -} - -#ifdef TEST - -/* some very basic tests */ -int main(void) -{ - void *data; - int size; - int priority; - message_queue_t *q; - char *s; - - q = new_message_queue(); - if (q == NULL) goto error; - - if (message_put(q, "hello", 6, 0)) goto error; - if (message_put(q, "world", 6, 1)) goto error; - - if ((size = message_get(q, &data, &priority)) <= 0) goto error; - printf("message:\n data: '%s'\n size: %d\n priority: %d\n", - (char *)data, size, priority); - if ((size = message_get(q, &data, &priority)) <= 0) goto error; - printf("message:\n data: '%s'\n size: %d\n priority: %d\n", - (char *)data, size, priority); - - /* let's put a message before destroying the queue */ - s = malloc(10); if (s == NULL) goto error; - sprintf(s, "hello"); - if (message_put(q, s, 6, 0)) goto error; - destroy_message_queue(q); - free(s); - return 0; - -error: - free(s); - printf("error\n"); - return 1; -} - -#endif diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h deleted file mode 100644 index 656f3db28e..0000000000 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file message_queue.h - * \brief this is the implementation of a message queue - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#ifndef MESSAGE_QUEUE_H -#define MESSAGE_QUEUE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct message_t { - void *data; - int size; - int priority; - - struct message_t *next; -} message_t; - -typedef struct { - message_t *head; - message_t *tail; - volatile int count; - pthread_mutex_t *mutex; - pthread_cond_t *cond; - int exit; -} message_queue_t; - -message_queue_t *new_message_queue(void); -int message_put(message_queue_t *queue, void *data, int size, int priority); -int message_get(message_queue_t *queue, void **data, int *priority); -void message_get_unlock(message_queue_t *queue); -void destroy_message_queue(message_queue_t *queue); - -#ifdef __cplusplus -} -#endif - -#endif /* MESSAGE_QUEUE_H */ diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c deleted file mode 100644 index 7bcd3b5647..0000000000 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file ringbuffer_queue.c - * \brief Lock-free ringbuffer used for async message passing of agent - * \author Xenofon Foukas - * \date March 2016 - * \version 1.0 - * \email: x.foukas@sms.ed.ac.uk - * @ingroup _mac - */ - -#include "ringbuffer_queue.h" -#include "common/utils/LOG/log.h" - -message_queue_t * new_message_queue(int size) { - - message_queue_t *ret = NULL; - - ret = calloc(1, sizeof(message_queue_t)); - if (ret == NULL) - goto error; - - lfds700_misc_library_init_valid_on_current_logical_core(); - lfds700_misc_prng_init(&(ret->ps)); - ret->ringbuffer_array = malloc(sizeof(struct lfds700_ringbuffer_element) * size); - lfds700_ringbuffer_init_valid_on_current_logical_core(&(ret->ringbuffer_state), - ret->ringbuffer_array, - size, - &(ret->ps), - NULL); - - return ret; - - error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - if (ret != NULL) { - free(ret->ringbuffer_array); - memset(ret, 0, sizeof(message_queue_t)); - free(ret); - } - return NULL; -} - -int message_put(message_queue_t *queue, void *data, int size, int priority) { - - struct lfds700_misc_prng_state ls; - enum lfds700_misc_flag overwrite_occurred_flag; - message_t *overwritten_msg; - message_t *m = NULL; - - if (size <= 0) - goto error; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - m = calloc(1, sizeof(message_t)); - if (m == NULL) - goto error; - - m->data = data; - m->size = size; - m->priority = priority; - - lfds700_ringbuffer_write(&(queue->ringbuffer_state), - NULL, - (void *) m, - &overwrite_occurred_flag, - NULL, - (void **) &overwritten_msg, - &ls); - - if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { - free(overwritten_msg->data); - free(overwritten_msg); - } - - return 0; - - error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int message_get(message_queue_t *queue, void **data, int *priority) { - message_t *m; - struct lfds700_misc_prng_state ls; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - if (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) == 0) { - return -1; - } - - *data = m->data; - const int size = m->size; - *priority = m->priority; - free(m); - return size; -} - -void message_get_unlock(message_queue_t *queue) { - /* don't do anything, this function exists to unlock a message_queue but is - * not needed in the case of the ringbuffer_queue */ -} - -void destroy_message_queue(message_queue_t *queue) { - struct lfds700_misc_prng_state ls; - - message_t *m; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - lfds700_misc_prng_init(&ls); - - while (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) != 0) { - free(m->data); - memset(m, 0, sizeof(message_t)); - free(m); - } - free(queue->ringbuffer_array); - memset(queue, 0, sizeof(message_queue_t)); - free(queue); -} diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h deleted file mode 100644 index bb65612e6b..0000000000 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file ringbuffer_queue.h - * \brief Lock-free ringbuffer used for async message passing of agent - * \author Xenofon Foukas - * \date March 2016 - * \version 1.0 - * \email: x.foukas@sms.ed.ac.uk - * @ingroup _mac - */ - -#ifndef RINGBUFFER_QUEUE_H -#define RINGBUFFER_QUEUE_H - -#include "liblfds700.h" - -typedef struct message_s { - void *data; - int size; - int priority; -} message_t; - -typedef struct { - struct lfds700_misc_prng_state ps; - struct lfds700_ringbuffer_element *ringbuffer_array; - struct lfds700_ringbuffer_state ringbuffer_state; -} message_queue_t; - -message_queue_t * new_message_queue(int size); -int message_put(message_queue_t *queue, void *data, int size, int priority); -int message_get(message_queue_t *queue, void **data, int *priority); -void message_get_unlock(message_queue_t *queue); -void destroy_message_queue(message_queue_t *queue); - -#endif /* RINGBUFFER_QUEUE_H */ diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c deleted file mode 100644 index eac0b91069..0000000000 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file socket_link.c - * \brief this is the implementation of a TCP socket ASYNC IF - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#include "socket_link.h" -#include "common/utils/LOG/log.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -socket_link_t *new_link_server(int port) -{ - socket_link_t *ret = NULL; - int reuse; - struct sockaddr_in addr; - socklen_t addrlen; - int socket_server = -1; - int no_delay; - - - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - - //printf("MAC create a new link server socket at port %d\n", port); - - socket_server = socket(AF_INET, SOCK_STREAM, 0); - if (socket_server == -1) { - LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - ret->type = SOCK_STREAM; - - reuse = 1; - if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) { - - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - no_delay = 1; - if (setsockopt(socket_server, IPPROTO_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { - - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - addr.sin_addr.s_addr = INADDR_ANY; - if (bind(socket_server, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - LOG_E(MAC, "%s:%d: bind: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - if (listen(socket_server, 5)) { - LOG_E(MAC, "%s:%d: listen: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - addrlen = sizeof(addr); - ret->socket_fd = accept(socket_server, (struct sockaddr *)&addr, &addrlen); - if (ret->socket_fd == -1) { - LOG_E(MAC, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - //printf("MAC connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); - return ret; - -error: - close(socket_server); - if (ret != NULL) close(ret->socket_fd); - free(ret); - - LOG_E(MAC, "ERROR in new_link_server (see above), returning NULL\n"); - return NULL; -} - -socket_link_t *new_link_client(const char *server, int port) -{ - socket_link_t *ret = NULL; - struct sockaddr_in addr; - int no_delay; - - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - LOG_D(MAC, "create a new link client socket connecting to %s:%d\n", server, port); - - ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); - if (ret->socket_fd == -1) { - LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - ret->type = SOCK_STREAM; - - no_delay = 1; - if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { - LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - if (inet_aton(server, &addr.sin_addr) == 0) { - LOG_E(MAC, "invalid IP address '%s', use a.b.c.d notation\n", server); - goto error; - } - if (connect(ret->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { - LOG_E(MAC, "%s:%d: connect: %s\n", __FILE__, __LINE__, strerror(errno)); - goto error; - } - - LOG_D(MAC, "connection to %s:%d established\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); - return ret; - -error: - if (ret != NULL) close(ret->socket_fd); - free(ret); - LOG_E(MAC, "ERROR in new_link_client (see above), returning NULL\n"); - return NULL; -} - -socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port) -{ - socket_link_t *ret = NULL; - - struct sockaddr_in si_me; - int socket_server = -1; - - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - //printf("PROTO_AGENT: create a new udp link server socket at port %d\n", port); - - //create a UDP socket - if ((socket_server=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { - goto error; - } - ret->type = SOCK_DGRAM; - - // zero out the structure - memset((char *) &si_me, 0, sizeof(si_me)); - - si_me.sin_family = AF_INET; - si_me.sin_port = htons(bind_port); - if (bind_addr) { - if (!inet_aton(bind_addr, &si_me.sin_addr)) - goto error; - } else { - si_me.sin_addr.s_addr = INADDR_ANY; - } - - //bind socket to port - if( bind(socket_server , (struct sockaddr*)&si_me, sizeof(si_me) ) == -1) { - fprintf(stderr, "could not bind to address %s: %s\n", bind_addr, strerror(errno)); - goto error; - } - ret->socket_fd = socket_server; - return ret; - -error: - if (socket_server != -1) close(socket_server); - if (ret != NULL) close(ret->socket_fd); - free(ret); - //printf("\n\n\nERROR PROTO_AGENT: ERROR in new_link_udp_server (see above), returning NULL\n"); - return NULL; -} - - -socket_link_t *new_link_udp_client(const char *server, int port){ - - int s = -1; - socket_link_t *ret = NULL; - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - struct sockaddr_in si_other; - socklen_t slen = sizeof(si_other); - - if ( (s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1){ - goto error; - } - ret->type = SOCK_DGRAM; - - memset((char *) &si_other, 0, sizeof(si_other)); - si_other.sin_family = AF_INET; - si_other.sin_port = 0; //htons(port); - - - - if (inet_aton(server, &si_other.sin_addr) == 0){ - fprintf(stderr, "inet_aton() failed\n"); - goto error; - } - connect(s, (struct sockaddr *)&si_other, sizeof(si_other)); - - getsockname(s, (struct sockaddr *)&si_other, &slen); - - ret->socket_fd = s; - - return ret; -error: - if (ret != NULL) { - free(ret); - ret = NULL; - } - if (s != -1) { - close(s); - s = -1; - } - LOG_E(MAC, "ERROR in new_link_udp_client (see above), returning NULL\n"); - return NULL; -} - - -socket_link_t *new_link_sctp_server(int port) -{ - - socket_link_t *ret = NULL; - - int listenSock = -1, temp; - struct sockaddr_in servaddr; - - listenSock = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP); - if(listenSock == -1) - { - perror("socket()"); - exit(1); - } - - bzero ((void *) &servaddr, sizeof (servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = INADDR_ANY; - servaddr.sin_port = htons(port); - - temp = bind (listenSock, (struct sockaddr *) &servaddr, sizeof (servaddr)); - - if(temp == -1 ) - { - perror("bind()"); - close(listenSock); - exit(1); - } - - temp = listen (listenSock, 5); - if(temp == -1 ) - { - perror("listen()"); - close(listenSock); - exit(1); - } - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - ret->socket_fd = accept (listenSock, NULL, NULL); - ret->type = SOCK_STREAM; - - return ret; - -error: - if (listenSock != -1) close(listenSock); - if (ret != NULL) close(ret->socket_fd); - free(ret); - LOG_E(MAC,"ERROR in new_link_sctp_server (see above), returning NULL\n"); - return NULL; -} - -socket_link_t *new_link_sctp_client(const char *server, int port) -{ - - socket_link_t *ret = NULL; - ret = calloc(1, sizeof(socket_link_t)); - if (ret == NULL) { - LOG_D(PROTO_AGENT, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - ret->socket_fd = -1; - - int temp; - struct sockaddr_in servaddr; - - ret->socket_fd = socket (AF_INET, SOCK_STREAM, IPPROTO_SCTP); - - if (ret->socket_fd == -1) - { - perror("socket()"); - exit(1); - } - ret->type = SOCK_STREAM; - - bzero ((void *) &servaddr, sizeof (servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons (port); - - if (inet_aton(server, &servaddr.sin_addr) == 0) { - LOG_E(MAC,"invalid IP address '%s', use a.b.c.d notation\n", server); - goto error; - } - - temp = connect (ret->socket_fd, (struct sockaddr *) &servaddr, sizeof (servaddr)); - - if (temp == -1) - { - perror("connect()"); - close(ret->socket_fd); - exit(1); - } - - return ret; - -error: - if (ret != NULL) close(ret->socket_fd); - free(ret); - LOG_E(MAC, "ERROR in new_link_sctp_client (see above), returning NULL\n"); - return NULL; -} - -static int socket_udp_send(int socket_fd, void *buf, int size, const char *peer_addr, int port) -{ - struct sockaddr_in si_other; - int slen = sizeof(si_other); - int l; - int my_socket; - - LOG_D(PROTO_AGENT,"UDP send\n"); - - my_socket = socket_fd; - memset((char *) &si_other, 0, sizeof(si_other)); - si_other.sin_family = AF_INET; - si_other.sin_port = htons(port); - - if (inet_aton(peer_addr , &si_other.sin_addr) == 0) - { - fprintf(stderr, "inet_aton() failed\n"); - exit(1); - } - - l = sendto(my_socket, buf, size, 0, (struct sockaddr *) &si_other, slen); - if (l == -1) goto error; - - return l; -error: - LOG_E(MAC,"socket_udp_send: ERROR: %s\n", strerror(errno)); - return -1; -} - -static int socket_udp_receive(int socket_fd, void *buf, int size) -{ - LOG_D(PROTO_AGENT,"UDP RECEIVE\n"); - - struct sockaddr_in client; - socklen_t slen = sizeof(client); - int l; - - l = recvfrom(socket_fd, buf, size, MSG_TRUNC, (struct sockaddr *) &client, &slen); - //getsockname(socket_fd, (struct sockaddr *)&client, &slen); - if (l == -1) goto error; - if (l == 0) goto socket_closed; - if (l > size) { - LOG_E(MAC, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, l); - return -1; - } - - return l; - -error: - LOG_E(MAC, "socket_udp_receive: ERROR: %s\n", strerror(errno)); - return -1; - -socket_closed: - LOG_E(MAC, "socket_udp_receive: socket closed\n"); - return -1; -} - - -/* - * return -1 on error and 0 if the sending was fine - */ -static int socket_send(int socket_fd, void *buf, int size) -{ - char *s = buf; - int l; - - while (size) { - l = send(socket_fd, s, size, MSG_NOSIGNAL); - if (l == -1) goto error; - if (l == 0) { LOG_E(MAC, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } - size -= l; - s += l; - } - - return 0; - -error: - LOG_E(MAC, "socket_send: ERROR: %s\n", strerror(errno)); - return -1; -} - -/* - * return -1 on error and 0 if the receiving was fine - */ -static int socket_receive(int socket_fd, void *buf, int size) -{ - char *s = buf; - int l; - - while (size) { - l = read(socket_fd, s, size); - if (l == -1) goto error; - if (l == 0) goto socket_closed; - size -= l; - s += l; - } - - return 0; - -error: - LOG_E(MAC, "socket_receive: ERROR: %s\n", strerror(errno)); - return -1; - -socket_closed: - LOG_E(MAC, "socket_receive: socket closed\n"); - return -1; -} - -/* - * return -1 on error and 0 if the sending was fine - */ -int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int peer_port) -{ - char sizebuf[4]; - int32_t s = size; - switch (link->type) { - case SOCK_STREAM: - /* send the size first, maximum is 2^31 bytes */ - sizebuf[0] = (s >> 24) & 255; - sizebuf[1] = (s >> 16) & 255; - sizebuf[2] = (s >> 8) & 255; - sizebuf[3] = s & 255; - if (socket_send(link->socket_fd, sizebuf, 4) == -1) - return -1; - - link->bytes_sent += 4; - - if (socket_send(link->socket_fd, data, size) == -1) - return -1; - break; - case SOCK_DGRAM: - /* UDP is connectionless -> only send the data */ - if (socket_udp_send(link->socket_fd, data, size, peer_addr, peer_port) == -1) - return -1; - break; - default: - LOG_E(MAC, "unknown socket type %d\n", link->type); - return -1; - } - - link->bytes_sent += size; - link->packets_sent++; - - return 0; -} - -/* - * return -1 on error and 0 if the sending was fine - */ - -int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) -{ - unsigned char sizebuf[4]; - int32_t size = 0; - void *data = NULL; - - /* received the size first, maximum is 2^31 bytes */ - switch (link->type) { - case SOCK_STREAM: - if (socket_receive(link->socket_fd, sizebuf, 4) == -1) - goto error; - - size = (sizebuf[0] << 24) | - (sizebuf[1] << 16) | - (sizebuf[2] << 8) | - sizebuf[3]; - - link->bytes_received += 4; - - data = malloc(size); - if (data == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - - if (socket_receive(link->socket_fd, data, size) == -1) - goto error; - break; - case SOCK_DGRAM: - /* we get a single packet (no size, UDP could lose it). Therefore, prepare - * for the maximum UDP packet size */ - size = 65535; - data = malloc(size); - if (data == NULL) { - LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); - goto error; - } - - size = socket_udp_receive(link->socket_fd, data, size); - if (size < 0) - goto error; - break; - default: - LOG_E(MAC, "unknown socket type %d\n", link->type); - goto error; - } - - link->bytes_received += size; - link->packets_received++; - - *ret_data = data; - *ret_size = size; - return 0; - -error: - free(data); - *ret_data = NULL; - *ret_size = 0; - return -1; -} - -/* - * return -1 on error, 0 if all is fine - */ -int close_link(socket_link_t *link) -{ - close(link->socket_fd); - memset(link, 0, sizeof(socket_link_t)); - free(link); - return 0; -} - -#ifdef SERVER_TEST - -#include - -int main(void) -{ - void *data; - int size; - socket_link_t *l = new_link_server(2210); - if (l == NULL) { printf("no link created\n"); return 1; } - printf("link is up\n"); - printf("server starts sleeping...\n"); - /* this sleep is here to test for broken pipe. You can run "nc localhost 2210" - * and interrupt it quickly so that the server gets a 'broken' pipe on the - * following link_send_packet. - */ - sleep(1); - printf("... done\n"); - if (link_send_packet(l, "hello\n", 6+1, NULL, 0) || - link_send_packet(l, "world\n", 6+1, NULL, 0)) return 1; - if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); - if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); - printf("stats:\n"); - printf(" sent packets %"PRIu64"\n", l->packets_sent); - printf(" sent bytes %"PRIu64"\n", l->bytes_sent); - printf(" received packets %"PRIu64"\n", l->packets_received); - printf(" received bytes %"PRIu64"\n", l->bytes_received); - if (close_link(l)) return 1; - printf("link is down\n"); - return 0; -} - -#endif - -#ifdef CLIENT_TEST - -#include - -int main(void) -{ - void *data; - int size; - socket_link_t *l = new_link_client("127.0.0.1", 2210); - if (l == NULL) { printf("no link created\n"); return 1; } - printf("link is up\n"); - if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); - if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); - if (link_send_packet(l, "bye\n", 4+1, NULL, 0) || - link_send_packet(l, "server\n", 7+1, NULL, 0)) return 1; - printf("stats:\n"); - printf(" sent packets %"PRIu64"\n", l->packets_sent); - printf(" sent bytes %"PRIu64"\n", l->bytes_sent); - printf(" received packets %"PRIu64"\n", l->packets_received); - printf(" received bytes %"PRIu64"\n", l->bytes_received); - if (close_link(l)) return 1; - printf("link is down\n"); - return 0; -} - -#endif diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h deleted file mode 100644 index b466721e08..0000000000 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file socket_link.h - * \brief this is the implementation of a TCP socket ASYNC IF - * \author Cedric Roux - * \date November 2015 - * \version 1.0 - * \email: cedric.roux@eurecom.fr - * @ingroup _mac - */ - -#ifndef SOCKET_LINK_H -#define SOCKET_LINK_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct { - int socket_fd; - int type; - uint64_t bytes_sent; - uint64_t packets_sent; - uint64_t bytes_received; - uint64_t packets_received; -} socket_link_t; - -socket_link_t *new_link_server(int port); -socket_link_t *new_link_client(const char *server, int port); -/* setting bind_addr to NULL binds server to INADDR_ANY */ -socket_link_t *new_link_udp_server(const char *bind_addr, int bind_port); -socket_link_t *new_link_udp_client(const char *server, int port); -socket_link_t *new_link_sctp_server(int port); -socket_link_t *new_link_sctp_client(const char *server, int port); -int link_send_packet(socket_link_t *link, void *data, int size, const char *peer_addr, int port); -int link_receive_packet(socket_link_t *link, void **data, int *size); -int close_link(socket_link_t *link); - - -#ifdef __cplusplus -} -#endif - -#endif /* SOCKET_LINK_H */ diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile deleted file mode 100644 index 27e4d91df3..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile +++ /dev/null @@ -1,168 +0,0 @@ -##### paths ##### -BINDIR := ../../bin -INCDIR := ../../inc -OBJDIR := ../../obj -SRCDIR := ../../src - -##### misc ##### -QUIETLY := 1>/dev/null 2>/dev/null -VERSION_NUMBER := 1 -MINOR_NUMBER := 0 -RELEASE_NUMBER := 0 - -##### sources, objects and libraries ##### -BINNAME := liblfds700 -ARFILENAME := $(BINNAME).a -ARPATHNAME := $(BINDIR)/$(ARFILENAME) -SOBASENAME := $(BINNAME).so -SONAME := $(SOBASENAME).$(VERSION_NUMBER) -SOFILENAME := $(SONAME).$(MINOR_NUMBER).$(RELEASE_NUMBER) -SOPATHNAME := $(BINDIR)/$(SOFILENAME) -INCNAME := $(INCDIR)/$(BINNAME).h -SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack -SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ - lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ - lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ - lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ - lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ - lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ - lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ - lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ - lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c -OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) -SYSLIBS := - -##### default paths fix up ##### -CPATH := $(subst : ,:,$(SRCDIR):$(INCDIR)) - -##### tools ##### -MAKE := make -MFLAGS := - -DG := gcc -DGFLAGS := -MM -std=gnu89 - -CC := gcc -CFBASE := -c -fno-strict-aliasing -std=gnu89 -Wall -Werror -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-variable -CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage -CFDBG := -O0 -ggdb -D_DEBUG -CFPROF := -O0 -ggdb -DPROF -pg -CFREL := -O2 -DNDEBUG -finline-functions -CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIC -CFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib - -AR := ar -AFLAGS := -rcs - -LD := gcc -LFBASE := -pthread -shared -std=gnu89 -Wl,-soname,$(SONAME) -o $(SOPATHNAME) -Wall -Werror -LFCOV := -O0 -fprofile-arcs -ftest-coverage -LFDBG := -O0 -ggdb -LFPROF := -O0 -pg -LFREL := -O2 -s -finline-functions -LFTSAN := -O0 -fsanitize=thread -fPIC -LFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib - -##### CPU variants ##### -GCCARCH := native -CFBASE += -march=$(GCCARCH) - -##### build variants ##### -ifeq ($(findstring so,$(MAKECMDGOALS)),so) - CFBASE += -fPIC -endif - -CFLAGS += $(CFBASE) -LFLAGS += $(LFBASE) - -ifeq ($(MAKECMDGOALS),) - CFLAGS += $(CFDBG) - LFLAGS += $(LFDBG) -endif - -ifeq ($(findstring cov,$(MAKECMDGOALS)),cov) - CFLAGS += $(CFCOV) - LFLAGS += $(LFCOV) - SYSLIBS += -lgcov -endif - -ifeq ($(findstring dbg,$(MAKECMDGOALS)),dbg) - CFLAGS += $(CFDBG) - LFLAGS += $(LFDBG) -endif - -ifeq ($(findstring prof,$(MAKECMDGOALS)),prof) - CFLAGS += $(CFPROF) - LFLAGS += $(LFPROF) -endif - -ifeq ($(findstring rel,$(MAKECMDGOALS)),rel) - CFLAGS += $(CFREL) - LFLAGS += $(LFREL) -endif - -ifeq ($(findstring tsan,$(MAKECMDGOALS)),tsan) - CFLAGS += $(CFTSAN) - LFLAGS += $(LFTSAN) -endif - -ifeq ($(findstring b_,$(MAKECMDGOALS)),b_) - CFLAGS += $(CFBARE) - LFLAGS += $(CFBARE) -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.o : %.c - $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d - $(CC) $(CFLAGS) -o $@ $< - -##### explicit rules ##### -$(ARPATHNAME) : $(OBJECTS) - $(AR) $(AFLAGS) $(ARPATHNAME) $(OBJECTS) - -$(SOPATHNAME) : $(OBJECTS) - $(LD) $(LFLAGS) $(OBJECTS) -o $(SOPATHNAME) - @ln -fs $(SOFILENAME) $(BINDIR)/$(SONAME) - @ln -fs $(SOFILENAME) $(BINDIR)/$(SOBASENAME) - -##### phony ##### -.PHONY : clean bare_ar_cov bare_ar_dbg bare_ar_prof bare_ar_rel bare_ar_tsan bare_so_cov bare_so_dbg bare_so_prof bare_so_rel bare_so_tsan hosted_ar_cov hosted_ar_dbg hosted_ar_prof hosted_ar_rel hosted_ar_tsan hosted_so_cov hosted_so_dbg hosted_so_prof hosted_so_rel hosted_so_tsan - -clean : - @rm -f $(BINDIR)/* $(OBJDIR)/* - -bare_ar_cov : $(ARPATHNAME) # bare, archive (.a), coverage -bare_ar_dbg : $(ARPATHNAME) # bare, archive (.a), debug -bare_ar_prof : $(ARPATHNAME) # bare, archive (.a), profiling -bare_ar_rel : $(ARPATHNAME) # bare, archive (.a), release -bare_ar_tsan : $(ARPATHNAME) # bare, archive (.a), thread sanitizer - -bare_so_cov : $(SOPATHNAME) # bare, shared (.so), coverage -bare_so_dbg : $(SOPATHNAME) # bare, shared (.so), debug -bare_so_prof : $(SOPATHNAME) # bare, shared (.so), profiling -bare_so_rel : $(SOPATHNAME) # bare, shared (.so), release -bare_so_tsan : $(SOPATHNAME) # bare, shared (.so), thread sanitizer - -hosted_ar_cov : $(ARPATHNAME) # hosted implementation, archive (.a), coverage -hosted_ar_dbg : $(ARPATHNAME) # hosted implementation, archive (.a), debug -hosted_ar_prof : $(ARPATHNAME) # hosted implementation, archive (.a), profiling -hosted_ar_rel : $(ARPATHNAME) # hosted implementation, archive (.a), release -hosted_ar_tsan : $(ARPATHNAME) # hosted implementation, archive (.a), thread sanitizer - -hosted_so_cov : $(SOPATHNAME) # hosted implementation, shared (.so), coverage -hosted_so_dbg : $(SOPATHNAME) # hosted implementation, shared (.so), debug -hosted_so_prof : $(SOPATHNAME) # hosted implementation, shared (.so), profiling -hosted_so_rel : $(SOPATHNAME) # hosted implementation, shared (.so), release -hosted_so_tsan : $(SOPATHNAME) # hosted implementation, shared (.so), thread sanitizer - -##### dependencies ##### --include $(DEPENDS) - -##### notes ##### -# TRD : we use -std=gnu89 for C++ style comments -# hosted implementation differs from bare simply in that ends up being included - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild deleted file mode 100644 index 1ae6b36240..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild +++ /dev/null @@ -1,76 +0,0 @@ -lib-y := - -lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.o -lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.o -lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.o -lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.o -lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.o - -lib-y += ../../src/lfds700_freelist/lfds700_freelist_cleanup.o -lib-y += ../../src/lfds700_freelist/lfds700_freelist_init.o -lib-y += ../../src/lfds700_freelist/lfds700_freelist_pop.o -lib-y += ../../src/lfds700_freelist/lfds700_freelist_push.o -lib-y += ../../src/lfds700_freelist/lfds700_freelist_query.o - -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.o -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_get.o -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_init.o -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_insert.o -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.o -lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_query.o - -lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.o -lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.o -lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.o -lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.o -lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.o - -lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.o -lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.o -lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.o -lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.o -lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.o - -lib-y += ../../src/lfds700_misc/lfds700_misc_cleanup.o -lib-y += ../../src/lfds700_misc/lfds700_misc_globals.o -lib-y += ../../src/lfds700_misc/lfds700_misc_init.o -lib-y += ../../src/lfds700_misc/lfds700_misc_prng.o -lib-y += ../../src/lfds700_misc/lfds700_misc_query.o - -lib-y += ../../src/lfds700_queue/lfds700_queue_cleanup.o -lib-y += ../../src/lfds700_queue/lfds700_queue_dequeue.o -lib-y += ../../src/lfds700_queue/lfds700_queue_enqueue.o -lib-y += ../../src/lfds700_queue/lfds700_queue_init.o -lib-y += ../../src/lfds700_queue/lfds700_queue_query.o - -lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.o -lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.o -lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.o -lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.o -lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.o - -lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.o -lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_init.o -lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_query.o -lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_read.o -lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_write.o - -lib-y += ../../src/lfds700_stack/lfds700_stack_cleanup.o -lib-y += ../../src/lfds700_stack/lfds700_stack_init.o -lib-y += ../../src/lfds700_stack/lfds700_stack_pop.o -lib-y += ../../src/lfds700_stack/lfds700_stack_push.o -lib-y += ../../src/lfds700_stack/lfds700_stack_query.o - -libs-y := ../../bin/ - -ccflags-y := -I$(src)/../../inc -ccflags-y += -I$(src)/../../inc/liblfds700 -ccflags-y += -D_KERNEL_MODE -ccflags-y += -fno-strict-aliasing -ccflags-y += -std=gnu89 -ccflags-y += -Wall -ccflags-y += -Werror -ccflags-y += -Wno-unknown-pragmas -ccflags-y += -Wno-unused-but-set-variable -ccflags-y += -Wno-unused-variable - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile deleted file mode 100644 index d6de5f4b5d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -default: - $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) - -clean: - $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) clean - find ../../src/ -name "*.o" -type f -delete - -help: - $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) help - -modules: - $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) modules - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def deleted file mode 100644 index 583ce35dbd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def +++ /dev/null @@ -1,69 +0,0 @@ -EXPORTS - -lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core -lfds700_btree_au_cleanup = lfds700_btree_au_cleanup -lfds700_btree_au_insert = lfds700_btree_au_insert -lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position -lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position -lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position -lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key -lfds700_btree_au_query = lfds700_btree_au_query - -lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core -lfds700_freelist_cleanup = lfds700_freelist_cleanup -lfds700_freelist_push = lfds700_freelist_push -lfds700_freelist_pop = lfds700_freelist_pop -lfds700_freelist_query = lfds700_freelist_query - -lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core -lfds700_hash_a_cleanup = lfds700_hash_a_cleanup -lfds700_hash_a_insert = lfds700_hash_a_insert -lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key -lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init -lfds700_hash_a_iterate = lfds700_hash_a_iterate -lfds700_hash_a_query = lfds700_hash_a_query - -lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core -lfds700_list_aos_cleanup = lfds700_list_aos_cleanup -lfds700_list_aos_insert = lfds700_list_aos_insert -lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key -lfds700_list_aos_query = lfds700_list_aos_query - -lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core -lfds700_list_asu_cleanup = lfds700_list_asu_cleanup -lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position -lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start -lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end -lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element -lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key -lfds700_list_asu_query = lfds700_list_asu_query - -lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core -lfds700_misc_library_cleanup = lfds700_misc_library_cleanup -lfds700_misc_prng_init = lfds700_misc_prng_init -lfds700_misc_query = lfds700_misc_query - -lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core -lfds700_queue_cleanup = lfds700_queue_cleanup -lfds700_queue_enqueue = lfds700_queue_enqueue -lfds700_queue_dequeue = lfds700_queue_dequeue -lfds700_queue_query = lfds700_queue_query - -lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core -lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup -lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue -lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue -lfds700_queue_bss_query = lfds700_queue_bss_query - -lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core -lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup -lfds700_ringbuffer_read = lfds700_ringbuffer_read -lfds700_ringbuffer_write = lfds700_ringbuffer_write -lfds700_ringbuffer_query = lfds700_ringbuffer_query - -lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core -lfds700_stack_cleanup = lfds700_stack_cleanup -lfds700_stack_push = lfds700_stack_push -lfds700_stack_pop = lfds700_stack_pop -lfds700_stack_query = lfds700_stack_query - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile deleted file mode 100644 index 7b257c9277..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile +++ /dev/null @@ -1,114 +0,0 @@ -##### paths ##### -BINDIR := ..\..\bin -INCDIR := ..\..\inc -OBJDIR := ..\..\obj -SRCDIR := ..\..\src - -##### misc ##### -QUIETLY := 1>nul 2>nul -NULL := -SPACE := $(NULL) # TRD : with a trailing space - -##### sources, objects and libraries ##### -BINNAME := liblfds700 -LIB_BINARY := $(BINDIR)\$(BINNAME).lib -DLL_BINARY := $(BINDIR)\$(BINNAME).dll -SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack -SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ - lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ - lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ - lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ - lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ - lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ - lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ - lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ - lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c -OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) -SYSLIBS := kernel32.lib - -##### default paths fix up ##### -INCDIRS := $(patsubst %,%;,$(INCDIR)) -INCLUDE += $(subst $(SPACE),,$(INCDIRS)) - -##### tools ##### -MAKE := make -MFLAGS := - -CC := cl -CBASE := /c "-I$(SRCDIR)" "/Fd$(BINDIR)\$(BINNAME).pdb" /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE /nologo /W4 /wd 4068 /WX -CFREL := /DNDEBUG /Ox -CFDBG := /D_DEBUG /Gm /Od /Zi - -AR := lib -AFLAGS := /nologo /subsystem:console /verbose /wx - -LD := link -LFBASE := /def:$(BINNAME).def /dll /nodefaultlib /nologo /nxcompat /subsystem:console /wx -LFREL := /incremental:no -LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" - -##### variants ##### -CFLAGS := $(CBASE) $(CFDBG) /MTd -ASFLAGS := $(ASBASE) $(ASDBG) -LFLAGS := $(LFBASE) $(LFDBG) -CLIB := libcmtd.lib - -ifeq ($(MAKECMDGOALS),librel) - CFLAGS := $(CBASE) $(CFREL) /MT - ASFLAGS := $(ASBASE) $(ASREL) - LFLAGS := $(LFBASE) $(LFREL) - CLIB := libcmt.lib -endif - -ifeq ($(MAKECMDGOALS),libdbg) - CFLAGS := $(CBASE) $(CFDBG) /MTd - ASFLAGS := $(ASBASE) $(ASDBG) - LFLAGS := $(LFBASE) $(LFDBG) - CLIB := libcmtd.lib -endif - -ifeq ($(MAKECMDGOALS),dllrel) - CFLAGS := $(CBASE) $(CFREL) /MD - ASFLAGS := $(ASBASE) $(ASREL) - LFLAGS := $(LFBASE) $(LFREL) - CLIB := msvcrt.lib -endif - -ifeq ($(MAKECMDGOALS),dlldbg) - CFLAGS := $(CBASE) $(CFDBG) /MDd - ASFLAGS := $(ASBASE) $(ASDBG) - LFLAGS := $(LFBASE) $(LFDBG) - CLIB := msvcrtd.lib -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.obj : %.c - $(CC) $(CFLAGS) "/Fo$@" $< - -##### explicit rules ##### -$(LIB_BINARY) : $(OBJECTS) - $(AR) $(AFLAGS) $(OBJECTS) /out:$(LIB_BINARY) - -$(DLL_BINARY) : $(OBJECTS) - $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(OBJECTS) /out:$(DLL_BINARY) - -##### phony ##### -.PHONY : clean librel libdbg dllrel dlldbg - -clean : - @erase /Q $(BINDIR)\$(BINNAME).* $(OBJDIR)\*.obj $(QUIETLY) - -dlldbg : $(DLL_BINARY) -dllrel : $(DLL_BINARY) - -libdbg : $(LIB_BINARY) -librel : $(LIB_BINARY) - -##### notes ##### -# /wd 4068 : turn off "unknown pragma" warning - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def deleted file mode 100644 index 583ce35dbd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def +++ /dev/null @@ -1,69 +0,0 @@ -EXPORTS - -lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core -lfds700_btree_au_cleanup = lfds700_btree_au_cleanup -lfds700_btree_au_insert = lfds700_btree_au_insert -lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position -lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position -lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position -lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key -lfds700_btree_au_query = lfds700_btree_au_query - -lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core -lfds700_freelist_cleanup = lfds700_freelist_cleanup -lfds700_freelist_push = lfds700_freelist_push -lfds700_freelist_pop = lfds700_freelist_pop -lfds700_freelist_query = lfds700_freelist_query - -lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core -lfds700_hash_a_cleanup = lfds700_hash_a_cleanup -lfds700_hash_a_insert = lfds700_hash_a_insert -lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key -lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init -lfds700_hash_a_iterate = lfds700_hash_a_iterate -lfds700_hash_a_query = lfds700_hash_a_query - -lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core -lfds700_list_aos_cleanup = lfds700_list_aos_cleanup -lfds700_list_aos_insert = lfds700_list_aos_insert -lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key -lfds700_list_aos_query = lfds700_list_aos_query - -lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core -lfds700_list_asu_cleanup = lfds700_list_asu_cleanup -lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position -lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start -lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end -lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element -lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key -lfds700_list_asu_query = lfds700_list_asu_query - -lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core -lfds700_misc_library_cleanup = lfds700_misc_library_cleanup -lfds700_misc_prng_init = lfds700_misc_prng_init -lfds700_misc_query = lfds700_misc_query - -lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core -lfds700_queue_cleanup = lfds700_queue_cleanup -lfds700_queue_enqueue = lfds700_queue_enqueue -lfds700_queue_dequeue = lfds700_queue_dequeue -lfds700_queue_query = lfds700_queue_query - -lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core -lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup -lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue -lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue -lfds700_queue_bss_query = lfds700_queue_bss_query - -lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core -lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup -lfds700_ringbuffer_read = lfds700_ringbuffer_read -lfds700_ringbuffer_write = lfds700_ringbuffer_write -lfds700_ringbuffer_query = lfds700_ringbuffer_query - -lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core -lfds700_stack_cleanup = lfds700_stack_cleanup -lfds700_stack_push = lfds700_stack_push -lfds700_stack_pop = lfds700_stack_pop -lfds700_stack_query = lfds700_stack_query - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln deleted file mode 100644 index b52c44e46f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug LIB|Win32 = Debug LIB|Win32 - Debug LIB|x64 = Debug LIB|x64 - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release LIB|Win32 = Release LIB|Win32 - Release LIB|x64 = Release LIB|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj deleted file mode 100644 index 3d4bf6364f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj +++ /dev/null @@ -1,705 +0,0 @@ - - - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug LIB - Win32 - - - Debug LIB - x64 - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release LIB - Win32 - - - Release LIB - x64 - - - - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} - Win32Proj - - - - StaticLibrary - true - v110 - - - DynamicLibrary - true - v110 - - - StaticLibrary - true - v110 - - - DynamicLibrary - true - v110 - - - StaticLibrary - false - v110 - true - - - DynamicLibrary - false - v110 - true - - - StaticLibrary - false - v110 - true - - - DynamicLibrary - false - v110 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - - - MachineX86 - true - Windows - - - true - - - MachineX86 - - - Console - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - - - MachineX86 - true - Console - kernel32.lib;msvcrtd.lib - - - true - true - liblfds700.def - true - NoErrorReport - true - - - true - - - MachineX86 - - - Console - - - false - true - - - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - - - true - Windows - - - true - - - MachineX64 - - - Console - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - - - true - Console - true - true - liblfds700.def - true - false - NoErrorReport - kernel32.lib;msvcrtd.lib - true - - - true - - - MachineX64 - - - Console - - - false - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - - - MachineX86 - true - Windows - true - true - - - true - - - MachineX86 - - - Console - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - - - MachineX86 - false - Console - true - true - kernel32.lib;msvcrt.lib - - - true - true - liblfds700.def - NoErrorReport - - - true - - - MachineX86 - - - Console - true - - - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - - - true - Windows - true - true - - - true - - - MachineX64 - - - Console - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - - - false - Console - true - true - true - true - liblfds700.def - NoErrorReport - kernel32.lib;msvcrt.lib - - - true - - - MachineX64 - - - Console - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters deleted file mode 100644 index 5ec0bea579..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters +++ /dev/null @@ -1,279 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {258be429-7dac-4999-b995-753aa2f0c505} - - - {469abf8e-47d8-4678-bd66-7c7e65c5f52e} - - - {62ee141b-2acb-4555-b016-7be20a57f2bf} - - - {19c73b0f-25e0-4166-9093-427f1dfb4f70} - - - {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} - - - {400ae4e9-2281-4549-b918-59d1a27a2d07} - - - {0b1fafc3-817b-4c18-8eb1-121884e3a29b} - - - {bcbadc74-1748-4696-aad7-7fdbe5614624} - - - {c45194af-7b41-4c28-bc0e-1095ec347664} - - - {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} - - - {3ac93721-1d81-49e4-9581-dbc12ace5c0c} - - - - - Header Files - - - Source Files\lfds700_freelist - - - Source Files\lfds700_queue - - - Source Files\lfds700_stack - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_misc - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user deleted file mode 100644 index 7cbb3216ad..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c deleted file mode 100644 index 9ea5612e54..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def deleted file mode 100644 index 583ce35dbd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def +++ /dev/null @@ -1,69 +0,0 @@ -EXPORTS - -lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core -lfds700_btree_au_cleanup = lfds700_btree_au_cleanup -lfds700_btree_au_insert = lfds700_btree_au_insert -lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position -lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position -lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position -lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key -lfds700_btree_au_query = lfds700_btree_au_query - -lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core -lfds700_freelist_cleanup = lfds700_freelist_cleanup -lfds700_freelist_push = lfds700_freelist_push -lfds700_freelist_pop = lfds700_freelist_pop -lfds700_freelist_query = lfds700_freelist_query - -lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core -lfds700_hash_a_cleanup = lfds700_hash_a_cleanup -lfds700_hash_a_insert = lfds700_hash_a_insert -lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key -lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init -lfds700_hash_a_iterate = lfds700_hash_a_iterate -lfds700_hash_a_query = lfds700_hash_a_query - -lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core -lfds700_list_aos_cleanup = lfds700_list_aos_cleanup -lfds700_list_aos_insert = lfds700_list_aos_insert -lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key -lfds700_list_aos_query = lfds700_list_aos_query - -lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core -lfds700_list_asu_cleanup = lfds700_list_asu_cleanup -lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position -lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start -lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end -lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element -lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key -lfds700_list_asu_query = lfds700_list_asu_query - -lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core -lfds700_misc_library_cleanup = lfds700_misc_library_cleanup -lfds700_misc_prng_init = lfds700_misc_prng_init -lfds700_misc_query = lfds700_misc_query - -lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core -lfds700_queue_cleanup = lfds700_queue_cleanup -lfds700_queue_enqueue = lfds700_queue_enqueue -lfds700_queue_dequeue = lfds700_queue_dequeue -lfds700_queue_query = lfds700_queue_query - -lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core -lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup -lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue -lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue -lfds700_queue_bss_query = lfds700_queue_bss_query - -lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core -lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup -lfds700_ringbuffer_read = lfds700_ringbuffer_read -lfds700_ringbuffer_write = lfds700_ringbuffer_write -lfds700_ringbuffer_query = lfds700_ringbuffer_query - -lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core -lfds700_stack_cleanup = lfds700_stack_cleanup -lfds700_stack_push = lfds700_stack_push -lfds700_stack_pop = lfds700_stack_pop -lfds700_stack_query = lfds700_stack_query - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln deleted file mode 100644 index b52c44e46f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug LIB|Win32 = Debug LIB|Win32 - Debug LIB|x64 = Debug LIB|x64 - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release LIB|Win32 = Release LIB|Win32 - Release LIB|x64 = Release LIB|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj deleted file mode 100644 index f19ead0c18..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj +++ /dev/null @@ -1,733 +0,0 @@ - - - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug LIB - Win32 - - - Debug LIB - x64 - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release LIB - Win32 - - - Release LIB - x64 - - - - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} - Win32Proj - - - - StaticLibrary - true - WindowsKernelModeDriver8.0 - - - DynamicLibrary - true - WindowsKernelModeDriver8.0 - - - StaticLibrary - true - WindowsKernelModeDriver8.0 - - - DynamicLibrary - true - WindowsKernelModeDriver8.0 - - - StaticLibrary - false - WindowsKernelModeDriver8.0 - true - - - DynamicLibrary - false - WindowsKernelModeDriver8.0 - true - - - StaticLibrary - false - WindowsKernelModeDriver8.0 - true - - - DynamicLibrary - false - WindowsKernelModeDriver8.0 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath); - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - MachineX86 - true - Windows - - - true - - - MachineX86 - - - Native - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - MachineX86 - true - Native - kernel32.lib;msvcrtd.lib - - - true - true - liblfds700.def - true - NoErrorReport - true - WDM - - - true - - - MachineX86 - - - Console - - - false - true - - - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - /kernel %(AdditionalOptions) - - - true - Windows - - - true - - - MachineX64 - - - Native - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - /kernel %(AdditionalOptions) - - - true - Native - true - true - liblfds700.def - true - false - NoErrorReport - kernel32.lib;msvcrtd.lib - true - WDM - - - true - - - MachineX64 - - - Console - - - false - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - MachineX86 - true - Windows - true - true - - - true - - - MachineX86 - - - Native - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - MachineX86 - false - Native - true - true - kernel32.lib;msvcrt.lib - - - true - true - liblfds700.def - NoErrorReport - WDM - - - true - - - MachineX86 - - - Console - true - - - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - true - Windows - true - true - - - true - - - MachineX64 - - - Native - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - false - Native - true - true - true - true - liblfds700.def - NoErrorReport - kernel32.lib;msvcrt.lib - WDM - - - true - - - MachineX64 - - - Console - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters deleted file mode 100644 index 978f8ec1c9..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters +++ /dev/null @@ -1,279 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {258be429-7dac-4999-b995-753aa2f0c505} - - - {469abf8e-47d8-4678-bd66-7c7e65c5f52e} - - - {62ee141b-2acb-4555-b016-7be20a57f2bf} - - - {19c73b0f-25e0-4166-9093-427f1dfb4f70} - - - {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} - - - {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} - - - {400ae4e9-2281-4549-b918-59d1a27a2d07} - - - {c45194af-7b41-4c28-bc0e-1095ec347664} - - - {8b3cbb5c-7436-429f-9b72-bae1f4721746} - - - {bcbadc74-1748-4696-aad7-7fdbe5614624} - - - {0b1fafc3-817b-4c18-8eb1-121884e3a29b} - - - - - Header Files - - - Source Files\lfds700_freelist - - - Source Files\lfds700_stack - - - Source Files\lfds700_queue - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_misc - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_ringbuffer - - - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user deleted file mode 100644 index 7cbb3216ad..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c deleted file mode 100644 index 9ea5612e54..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def deleted file mode 100644 index 583ce35dbd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def +++ /dev/null @@ -1,69 +0,0 @@ -EXPORTS - -lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core -lfds700_btree_au_cleanup = lfds700_btree_au_cleanup -lfds700_btree_au_insert = lfds700_btree_au_insert -lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position -lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position -lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position -lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key -lfds700_btree_au_query = lfds700_btree_au_query - -lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core -lfds700_freelist_cleanup = lfds700_freelist_cleanup -lfds700_freelist_push = lfds700_freelist_push -lfds700_freelist_pop = lfds700_freelist_pop -lfds700_freelist_query = lfds700_freelist_query - -lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core -lfds700_hash_a_cleanup = lfds700_hash_a_cleanup -lfds700_hash_a_insert = lfds700_hash_a_insert -lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key -lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init -lfds700_hash_a_iterate = lfds700_hash_a_iterate -lfds700_hash_a_query = lfds700_hash_a_query - -lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core -lfds700_list_aos_cleanup = lfds700_list_aos_cleanup -lfds700_list_aos_insert = lfds700_list_aos_insert -lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key -lfds700_list_aos_query = lfds700_list_aos_query - -lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core -lfds700_list_asu_cleanup = lfds700_list_asu_cleanup -lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position -lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start -lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end -lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element -lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key -lfds700_list_asu_query = lfds700_list_asu_query - -lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core -lfds700_misc_library_cleanup = lfds700_misc_library_cleanup -lfds700_misc_prng_init = lfds700_misc_prng_init -lfds700_misc_query = lfds700_misc_query - -lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core -lfds700_queue_cleanup = lfds700_queue_cleanup -lfds700_queue_enqueue = lfds700_queue_enqueue -lfds700_queue_dequeue = lfds700_queue_dequeue -lfds700_queue_query = lfds700_queue_query - -lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core -lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup -lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue -lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue -lfds700_queue_bss_query = lfds700_queue_bss_query - -lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core -lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup -lfds700_ringbuffer_read = lfds700_ringbuffer_read -lfds700_ringbuffer_write = lfds700_ringbuffer_write -lfds700_ringbuffer_query = lfds700_ringbuffer_query - -lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core -lfds700_stack_cleanup = lfds700_stack_cleanup -lfds700_stack_push = lfds700_stack_push -lfds700_stack_pop = lfds700_stack_pop -lfds700_stack_query = lfds700_stack_query - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln deleted file mode 100644 index 1cc19a8e23..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln +++ /dev/null @@ -1,59 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|ARM = Debug DLL|ARM - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug LIB|ARM = Debug LIB|ARM - Debug LIB|Win32 = Debug LIB|Win32 - Debug LIB|x64 = Debug LIB|x64 - Release DLL|ARM = Release DLL|ARM - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release LIB|ARM = Release LIB|ARM - Release LIB|Win32 = Release LIB|Win32 - Release LIB|x64 = Release LIB|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.ActiveCfg = Debug DLL|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.Build.0 = Debug DLL|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.ActiveCfg = Debug LIB|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.Build.0 = Debug LIB|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.ActiveCfg = Release DLL|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.Build.0 = Release DLL|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.ActiveCfg = Release LIB|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.Build.0 = Release LIB|ARM - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj deleted file mode 100644 index e67a540e37..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj +++ /dev/null @@ -1,1054 +0,0 @@ - - - - - Debug DLL - ARM - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug LIB - ARM - - - Debug LIB - Win32 - - - Debug LIB - x64 - - - Release DLL - ARM - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release LIB - ARM - - - Release LIB - Win32 - - - Release LIB - x64 - - - - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} - Win32Proj - - - - StaticLibrary - true - WindowsKernelModeDriver8.1 - - - StaticLibrary - true - WindowsKernelModeDriver8.1 - - - DynamicLibrary - true - WindowsKernelModeDriver8.1 - - - DynamicLibrary - true - WindowsKernelModeDriver8.1 - - - StaticLibrary - true - WindowsKernelModeDriver8.1 - - - DynamicLibrary - true - WindowsKernelModeDriver8.1 - - - StaticLibrary - false - WindowsKernelModeDriver8.1 - true - - - StaticLibrary - false - WindowsKernelModeDriver8.1 - true - - - DynamicLibrary - false - WindowsKernelModeDriver8.1 - true - - - DynamicLibrary - false - WindowsKernelModeDriver8.1 - true - - - StaticLibrary - false - WindowsKernelModeDriver8.1 - true - - - DynamicLibrary - false - WindowsKernelModeDriver8.1 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath) - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath) - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuildToolsPath);$(MSBuildFrameworkToolsPath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_ARM); - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath) - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath) - $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) - - - true - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ - - - - - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ - $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - MachineX86 - true - Windows - - - true - - - MachineX86 - - - Native - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - true - Windows - - - true - - - MachineARM - - - Native - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - MachineX86 - true - Native - kernel32.lib;msvcrtd.lib - - - true - true - liblfds700.def - true - NoErrorReport - true - WDM - - - true - - - MachineX86 - - - Console - - - false - true - - - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - /kernel %(AdditionalOptions) - - - true - Native - kernel32.lib;msvcrtd.lib - - - true - true - liblfds700.def - true - NoErrorReport - true - WDM - - - - true - - - MachineX86 - - - Console - - - false - true - - - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - /kernel %(AdditionalOptions) - - - true - Windows - - - true - - - MachineX64 - - - Native - - - false - true - - - - - WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) - - - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - false - true - - - - - - - true - false - false - false - true - CompileAsC - true - None - true - false - 4068 - false - /kernel %(AdditionalOptions) - - - true - Native - true - true - liblfds700.def - true - false - NoErrorReport - kernel32.lib;msvcrtd.lib - true - WDM - - - true - - - MachineX64 - - - Console - - - false - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - MachineX86 - true - Windows - true - true - - - true - - - MachineX86 - - - Native - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - true - Windows - true - true - - - true - - - MachineARM - - - Native - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - MachineX86 - false - Native - true - true - kernel32.lib;msvcrt.lib - - - true - true - liblfds700.def - NoErrorReport - WDM - - - true - - - MachineX86 - - - Console - true - - - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - false - Native - true - true - kernel32.lib;msvcrt.lib - - - true - true - liblfds700.def - NoErrorReport - WDM - - - - true - - - MachineX86 - - - Console - true - - - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreaded - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - true - Windows - true - true - - - true - - - MachineX64 - - - Native - true - - - - - WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) - - - MultiThreadedDLL - Level4 - None - false - false - true - true - AnySuitable - true - Speed - true - false - false - - - - - - - false - - - false - false - CompileAsC - true - None - true - 4068 - true - /kernel %(AdditionalOptions) - - - false - Native - true - true - true - true - liblfds700.def - NoErrorReport - kernel32.lib;msvcrt.lib - WDM - - - true - - - MachineX64 - - - Console - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters deleted file mode 100644 index 978f8ec1c9..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters +++ /dev/null @@ -1,279 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {258be429-7dac-4999-b995-753aa2f0c505} - - - {469abf8e-47d8-4678-bd66-7c7e65c5f52e} - - - {62ee141b-2acb-4555-b016-7be20a57f2bf} - - - {19c73b0f-25e0-4166-9093-427f1dfb4f70} - - - {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} - - - {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} - - - {400ae4e9-2281-4549-b918-59d1a27a2d07} - - - {c45194af-7b41-4c28-bc0e-1095ec347664} - - - {8b3cbb5c-7436-429f-9b72-bae1f4721746} - - - {bcbadc74-1748-4696-aad7-7fdbe5614624} - - - {0b1fafc3-817b-4c18-8eb1-121884e3a29b} - - - - - Header Files - - - Source Files\lfds700_freelist - - - Source Files\lfds700_stack - - - Source Files\lfds700_queue - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Header Files\liblfds700 - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_misc - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_ringbuffer - - - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_freelist - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_stack - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_queue - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_hash_addonly - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_list_addonly_ordered_singlylinked - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_btree_addonly_unbalanced - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_misc - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_queue_bounded_singleconsumer_singleproducer - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_list_addonly_singlylinked_unordered - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - Source Files\lfds700_ringbuffer - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user deleted file mode 100644 index 7cbb3216ad..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs deleted file mode 100644 index 64e002cc57..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs +++ /dev/null @@ -1,3 +0,0 @@ -DIRS = single_dir_for_windows_kernel - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c deleted file mode 100644 index 09d7acb7fc..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "liblfds700_internal.h" - - - - - -/****************************************************************************/ -DRIVER_INITIALIZE DriverEntry; - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -NTSTATUS DriverEntry( struct _DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath ) -{ - return( STATUS_SUCCESS ); -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def deleted file mode 100644 index 583ce35dbd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def +++ /dev/null @@ -1,69 +0,0 @@ -EXPORTS - -lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core -lfds700_btree_au_cleanup = lfds700_btree_au_cleanup -lfds700_btree_au_insert = lfds700_btree_au_insert -lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position -lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position -lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position -lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key -lfds700_btree_au_query = lfds700_btree_au_query - -lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core -lfds700_freelist_cleanup = lfds700_freelist_cleanup -lfds700_freelist_push = lfds700_freelist_push -lfds700_freelist_pop = lfds700_freelist_pop -lfds700_freelist_query = lfds700_freelist_query - -lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core -lfds700_hash_a_cleanup = lfds700_hash_a_cleanup -lfds700_hash_a_insert = lfds700_hash_a_insert -lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key -lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init -lfds700_hash_a_iterate = lfds700_hash_a_iterate -lfds700_hash_a_query = lfds700_hash_a_query - -lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core -lfds700_list_aos_cleanup = lfds700_list_aos_cleanup -lfds700_list_aos_insert = lfds700_list_aos_insert -lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key -lfds700_list_aos_query = lfds700_list_aos_query - -lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core -lfds700_list_asu_cleanup = lfds700_list_asu_cleanup -lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position -lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start -lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end -lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element -lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key -lfds700_list_asu_query = lfds700_list_asu_query - -lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core -lfds700_misc_library_cleanup = lfds700_misc_library_cleanup -lfds700_misc_prng_init = lfds700_misc_prng_init -lfds700_misc_query = lfds700_misc_query - -lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core -lfds700_queue_cleanup = lfds700_queue_cleanup -lfds700_queue_enqueue = lfds700_queue_enqueue -lfds700_queue_dequeue = lfds700_queue_dequeue -lfds700_queue_query = lfds700_queue_query - -lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core -lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup -lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue -lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue -lfds700_queue_bss_query = lfds700_queue_bss_query - -lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core -lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup -lfds700_ringbuffer_read = lfds700_ringbuffer_read -lfds700_ringbuffer_write = lfds700_ringbuffer_write -lfds700_ringbuffer_query = lfds700_ringbuffer_query - -lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core -lfds700_stack_cleanup = lfds700_stack_cleanup -lfds700_stack_push = lfds700_stack_push -lfds700_stack_pop = lfds700_stack_pop -lfds700_stack_query = lfds700_stack_query - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt deleted file mode 100644 index 1481c8d08a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt +++ /dev/null @@ -1,32 +0,0 @@ -The Windows kernel build environment is primitive and has a number -of severe limitations; in particular, all source files must be in -one directory and it is not possible to choose the output binary type -(static or dynamic library) from the build command line; rather, -a string has to be modified in a text file used by the build (!) - -To deal with these limitations, it is necessary for a Windows kernel -build to run a batch file prior to building. - -There are two batch files, one for static library builds and the other -for dynamic library builds. - -They are both idempotent; you can run them as often as you like and -switch between them as often as you want. It's all fine; whenever -you run one of them, it will take you from whatever state you were -previously in, into the state you want to be in. - -Both batch files copy all the sources file into a single directory, -"/src/single_dir_for_windows_kernel/". - -The static library batch file will then copy "/sources.static" into -"/src/single_dir_for_windows_kernel/", which will cause a static -library to be built. - -The dynamic library batch file will then copy "/sources.dynamic" into -"/src/single_dir_for_windows_kernel/", which will cause a dynamic -library to be built. It will also copy "src/driver_entry.c" into -"/src/single_dir_for_windows_kernel/", since the linker requires -the DriverEntry function to exist for dynamic libraries, even -though it's not used. - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat deleted file mode 100644 index ff6fc8a1f3..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off -rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul -mkdir single_dir_for_windows_kernel 1>nul 2>nul - -copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul - -copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y driver_entry_renamed_to_avoid_compiler_warning.c single_dir_for_windows_kernel\driver_entry.c 1>nul 2>nul -copy /y sources.dynamic single_dir_for_windows_kernel\sources 1>nul 2>nul - -echo Windows kernel dynamic library build directory structure created. -echo (Note the effects of this batch file are idempotent). - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat deleted file mode 100644 index 81c35e99c8..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul -mkdir single_dir_for_windows_kernel 1>nul 2>nul - -copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul - -copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul -copy /y sources.static single_dir_for_windows_kernel\sources 1>nul 2>nul - -echo Windows kernel static library build directory structure created. -echo (Note the effects of this batch file are idempotent). - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic deleted file mode 100644 index b0d241f85f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic +++ /dev/null @@ -1,62 +0,0 @@ -MSC_WARNING_LEVEL = /WX /wd4127 /W4 -DLLDEF = ../liblfds700.def -TARGETNAME = liblfds700 -TARGETPATH = ../../../bin/ -TARGETTYPE = EXPORT_DRIVER -UMTYPE = nt -USER_C_FLAGS = /D_KERNEL_MODE - -INCLUDES = ../../../inc/ -SOURCES = lfds700_hash_addonly_cleanup.c \ - lfds700_hash_addonly_get.c \ - lfds700_hash_addonly_init.c \ - lfds700_hash_addonly_insert.c \ - lfds700_hash_addonly_iterate.c \ - lfds700_hash_addonly_query.c \ - lfds700_list_addonly_ordered_singlylinked_cleanup.c \ - lfds700_list_addonly_ordered_singlylinked_get.c \ - lfds700_list_addonly_ordered_singlylinked_init.c \ - lfds700_list_addonly_ordered_singlylinked_insert.c \ - lfds700_list_addonly_ordered_singlylinked_query.c \ - lfds700_list_addonly_singlylinked_unordered_cleanup.c \ - lfds700_list_addonly_singlylinked_unordered_get.c \ - lfds700_list_addonly_singlylinked_unordered_init.c \ - lfds700_list_addonly_singlylinked_unordered_insert.c \ - lfds700_list_addonly_singlylinked_unordered_query.c \ - lfds700_btree_addonly_unbalanced_cleanup.c \ - lfds700_btree_addonly_unbalanced_get.c \ - lfds700_btree_addonly_unbalanced_init.c \ - lfds700_btree_addonly_unbalanced_insert.c \ - lfds700_btree_addonly_unbalanced_query.c \ - lfds700_freelist_cleanup.c \ - lfds700_freelist_init.c \ - lfds700_freelist_pop.c \ - lfds700_freelist_push.c \ - lfds700_freelist_query.c \ - lfds700_misc_cleanup.c \ - lfds700_misc_globals.c \ - lfds700_misc_init.c \ - lfds700_misc_prng.c \ - lfds700_misc_query.c \ - lfds700_queue_cleanup.c \ - lfds700_queue_dequeue.c \ - lfds700_queue_enqueue.c \ - lfds700_queue_init.c \ - lfds700_queue_query.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ - lfds700_ringbuffer_cleanup.c \ - lfds700_ringbuffer_init.c \ - lfds700_ringbuffer_query.c \ - lfds700_ringbuffer_read.c \ - lfds700_ringbuffer_write.c \ - lfds700_stack_cleanup.c \ - lfds700_stack_init.c \ - lfds700_stack_pop.c \ - lfds700_stack_push.c \ - lfds700_stack_query.c \ - driver_entry.c - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static deleted file mode 100644 index 401b381c7d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static +++ /dev/null @@ -1,60 +0,0 @@ -MSC_WARNING_LEVEL = /WX /wd4127 /W4 -TARGETNAME = liblfds700 -TARGETPATH = ../../../bin/ -TARGETTYPE = DRIVER_LIBRARY -UMTYPE = nt -USER_C_FLAGS = /D_KERNEL_MODE - -INCLUDES = ../../../inc/ -SOURCES = lfds700_hash_addonly_cleanup.c \ - lfds700_hash_addonly_get.c \ - lfds700_hash_addonly_init.c \ - lfds700_hash_addonly_insert.c \ - lfds700_hash_addonly_iterate.c \ - lfds700_hash_addonly_query.c \ - lfds700_list_addonly_ordered_singlylinked_cleanup.c \ - lfds700_list_addonly_ordered_singlylinked_get.c \ - lfds700_list_addonly_ordered_singlylinked_init.c \ - lfds700_list_addonly_ordered_singlylinked_insert.c \ - lfds700_list_addonly_ordered_singlylinked_query.c \ - lfds700_list_addonly_singlylinked_unordered_cleanup.c \ - lfds700_list_addonly_singlylinked_unordered_get.c \ - lfds700_list_addonly_singlylinked_unordered_init.c \ - lfds700_list_addonly_singlylinked_unordered_insert.c \ - lfds700_list_addonly_singlylinked_unordered_query.c \ - lfds700_btree_addonly_unbalanced_cleanup.c \ - lfds700_btree_addonly_unbalanced_get.c \ - lfds700_btree_addonly_unbalanced_init.c \ - lfds700_btree_addonly_unbalanced_insert.c \ - lfds700_btree_addonly_unbalanced_query.c \ - lfds700_freelist_cleanup.c \ - lfds700_freelist_init.c \ - lfds700_freelist_pop.c \ - lfds700_freelist_push.c \ - lfds700_freelist_query.c \ - lfds700_misc_cleanup.c \ - lfds700_misc_globals.c \ - lfds700_misc_init.c \ - lfds700_misc_prng.c \ - lfds700_misc_query.c \ - lfds700_queue_cleanup.c \ - lfds700_queue_dequeue.c \ - lfds700_queue_enqueue.c \ - lfds700_queue_init.c \ - lfds700_queue_query.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ - lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ - lfds700_ringbuffer_cleanup.c \ - lfds700_ringbuffer_init.c \ - lfds700_ringbuffer_query.c \ - lfds700_ringbuffer_read.c \ - lfds700_ringbuffer_write.c \ - lfds700_stack_cleanup.c \ - lfds700_stack_init.c \ - lfds700_stack_pop.c \ - lfds700_stack_push.c \ - lfds700_stack_query.c - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h deleted file mode 100644 index 4f83d8d9a0..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef LIBLFDS700_H - - /***** defines *****/ - #define LIBLFDS700_H - - /***** pragmas on *****/ -// #pragma warning( disable : 4324 ) // TRD : 4324 disables MSVC warnings for structure alignment padding due to alignment specifiers - -// #pragma prefast( disable : 28113 28182 28183, "blah" ) - - /***** includes *****/ - #include "liblfds700/lfds700_porting_abstraction_layer_compiler.h" - #include "liblfds700/lfds700_porting_abstraction_layer_operating_system.h" - #include "liblfds700/lfds700_porting_abstraction_layer_processor.h" - - #include "liblfds700/lfds700_misc.h" // TRD : everything after depends on misc - #include "liblfds700/lfds700_btree_addonly_unbalanced.h" // TRD : hash_addonly depends on btree_addonly_unbalanced - #include "liblfds700/lfds700_freelist.h" - #include "liblfds700/lfds700_hash_addonly.h" - #include "liblfds700/lfds700_list_addonly_ordered_singlylinked.h" - #include "liblfds700/lfds700_list_addonly_singlylinked_unordered.h" - #include "liblfds700/lfds700_queue.h" - #include "liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h" - #include "liblfds700/lfds700_ringbuffer.h" - #include "liblfds700/lfds700_stack.h" - - /***** pragmas off *****/ -// #pragma warning( default : 4324 ) - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h deleted file mode 100644 index bdc63a4273..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h +++ /dev/null @@ -1,113 +0,0 @@ -/***** defines *****/ -#define LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( btree_au_element ) ( (btree_au_element).key ) -#define LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( btree_au_element, new_key ) ( (btree_au_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( btree_au_element ) ( LFDS700_MISC_BARRIER_LOAD, (btree_au_element).value ) -#define LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( btree_au_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(btree_au_element).value, &local_new_value ); } -#define LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( btree_au_state ) ( (btree_au_state).user_state ) - -/***** enums *****/ -enum lfds700_btree_au_absolute_position -{ - LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT, - LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, - LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE -}; - -enum lfds700_btree_au_existing_key -{ - LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, - LFDS700_BTREE_AU_EXISTING_KEY_FAIL -}; - -enum lfds700_btree_au_insert_result -{ - LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY, - LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE, - LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS -}; - -enum lfds700_btree_au_relative_position -{ - LFDS700_BTREE_AU_RELATIVE_POSITION_UP, - LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT, - LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT, - LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT, - LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT, - LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE, - LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE -}; - -enum lfds700_btree_au_query -{ - LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, - LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structs *****/ -struct lfds700_btree_au_element -{ - struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile left, - *volatile right, - *volatile up; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile value; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *key; -}; - -struct lfds700_btree_au_state -{ - struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile root; - - int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - (*key_compare_function)( void const *new_key, void const *existing_key ); - - enum lfds700_btree_au_existing_key - existing_key; - - void - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, - int (*key_compare_function)(void const *new_key, void const *existing_key), - enum lfds700_btree_au_existing_key existing_key, - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, - void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ); - -enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, - struct lfds700_btree_au_element *baue, - struct lfds700_btree_au_element **existing_baue, - struct lfds700_misc_prng_state *ps ); - // TRD : if a link collides with an existing key and existing_baue is non-NULL, existing_baue is set to the existing element - -int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, - void *key, - struct lfds700_btree_au_element **baue ); - -int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, - struct lfds700_btree_au_element **baue, - enum lfds700_btree_au_absolute_position absolute_position, - enum lfds700_btree_au_relative_position relative_position ); - // TRD : if *baue is NULL, we get the element at position, otherwise we move from *baue according to direction - -int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, - struct lfds700_btree_au_element **baue, - enum lfds700_btree_au_absolute_position absolute_position ); - -int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, - enum lfds700_btree_au_relative_position relative_position ); - -void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, - enum lfds700_btree_au_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h deleted file mode 100644 index 6a89386c5d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h +++ /dev/null @@ -1,54 +0,0 @@ -/***** defines *****/ -#define LFDS700_FREELIST_GET_KEY_FROM_ELEMENT( freelist_element ) ( (freelist_element).key ) -#define LFDS700_FREELIST_SET_KEY_IN_ELEMENT( freelist_element, new_key ) ( (freelist_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( freelist_element ) ( (freelist_element).value ) -#define LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( freelist_element, new_value ) ( (freelist_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) -#define LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( freelist_state ) ( (freelist_state).user_state ) - -/***** enums *****/ -enum lfds700_freelist_query -{ - LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, - LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_freelist_element -{ - struct lfds700_freelist_element - *volatile next; - - void - *key, - *value; -}; - -struct lfds700_freelist_state -{ - struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile top[PAC_SIZE]; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, - void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ); - -void lfds700_freelist_push( struct lfds700_freelist_state *fs, - struct lfds700_freelist_element *fe, - struct lfds700_misc_prng_state *ps ); - -int lfds700_freelist_pop( struct lfds700_freelist_state *fs, - struct lfds700_freelist_element **fe, - struct lfds700_misc_prng_state *ps ); - -void lfds700_freelist_query( struct lfds700_freelist_state *fs, - enum lfds700_freelist_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h deleted file mode 100644 index f7962db9e0..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h +++ /dev/null @@ -1,127 +0,0 @@ -/***** defines *****/ -#define LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( hash_a_element ) ( (hash_a_element).key ) -#define LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hash_a_element, new_key ) ( (hash_a_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( hash_a_element ) ( LFDS700_MISC_BARRIER_LOAD, (hash_a_element).value ) -#define LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hash_a_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(hash_a_element).value, &local_new_value ); } -#define LFDS700_HASH_A_GET_USER_STATE_FROM_STATE( hash_a_state ) ( (hash_a_state).user_state ) - -#define LFDS700_HASH_A_32BIT_HASH_FUNCTION( data, data_length_in_bytes, hash ) { \ - lfds700_pal_uint_t \ - loop; \ - \ - for( loop = 0 ; loop < (data_length_in_bytes) ; loop++ ) \ - { \ - (hash) += *( (char unsigned *) (data) + loop ); \ - (hash) += ((hash) << 10); \ - (hash) ^= ((hash) >> 6); \ - } \ - \ - (hash) += ((hash) << 3); \ - (hash) ^= ((hash) >> 11); \ - (hash) += ((hash) << 15); \ - } - /* TRD : this is the Jenkins one-at-a-time hash - it produces a 32 bit hash - http://en.wikipedia.org/wiki/Jenkins_hash_function - - we ourselves do *not* initialize the value of *hash, so that - our caller has the option to call us multiple times, each - time with for example a different member of a struct, which is - then hashed into the existing, built-up-so-far hash value, and - so build up a quality hash - */ - -/***** enums *****/ -enum lfds700_hash_a_existing_key -{ - LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, - LFDS700_HASH_A_EXISTING_KEY_FAIL -}; - -enum lfds700_hash_a_insert_result -{ - LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY, - LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE, - LFDS700_HASH_A_PUT_RESULT_SUCCESS -}; - -enum lfds700_hash_a_query -{ - LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, - LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structs *****/ -struct lfds700_hash_a_element -{ - struct lfds700_btree_au_element - baue; - - void - *key; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile value; -}; - -struct lfds700_hash_a_iterate -{ - struct lfds700_btree_au_element - *baue; - - struct lfds700_btree_au_state - *baus, - *baus_end; -}; - -struct lfds700_hash_a_state -{ - enum lfds700_hash_a_existing_key - existing_key; - - int - (*key_compare_function)( void const *new_key, void const *existing_key ); - - lfds700_pal_uint_t - array_size; - - struct lfds700_btree_au_state - *baus_array; - - void - (*element_cleanup_callback)( struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae ), - (*key_hash_function)( void const *key, lfds700_pal_uint_t *hash ), - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, - struct lfds700_btree_au_state *baus_array, - lfds700_pal_uint_t array_size, - int (*key_compare_function)(void const *new_key, void const *existing_key), - void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), - enum lfds700_hash_a_existing_key existing_key, - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, - void (*element_cleanup_function)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ); - -enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, - struct lfds700_hash_a_element *hae, - struct lfds700_hash_a_element **existing_hae, - struct lfds700_misc_prng_state *ps ); - // TRD : if existing_value is not NULL and the key exists, existing_value is set to the value of the existing key - -int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, - void *key, - struct lfds700_hash_a_element **hae ); - -void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ); -int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ); - -void lfds700_hash_a_query( struct lfds700_hash_a_state *has, - enum lfds700_hash_a_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h deleted file mode 100644 index dffab0aa6b..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h +++ /dev/null @@ -1,85 +0,0 @@ -/***** defines *****/ -#define LFDS700_LIST_AOS_GET_START( list_aos_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_state).start->next ) -#define LFDS700_LIST_AOS_GET_NEXT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).next ) -#define LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT( list_aos_state, pointer_to_list_aos_element ) ( (pointer_to_list_aos_element) == NULL ? ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_START(list_aos_state) ) : ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_NEXT(*(pointer_to_list_aos_element)) ) ) -#define LFDS700_LIST_AOS_GET_KEY_FROM_ELEMENT( list_aos_element ) ( (list_aos_element).key ) -#define LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( list_aos_element, new_key ) ( (list_aos_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).value ) -#define LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( list_aos_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_aos_element).value, &local_new_value ); } -#define LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE( list_aos_state ) ( (list_aos_state).user_state ) - -/***** enums *****/ -enum lfds700_list_aos_existing_key -{ - LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE, - LFDS700_LIST_AOS_EXISTING_KEY_FAIL -}; - -enum lfds700_list_aos_insert_result -{ - LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, - LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE, - LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS -}; - -enum lfds700_list_aos_query -{ - LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, - LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_list_aos_element -{ - struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile next; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile value; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *key; -}; - -struct lfds700_list_aos_state -{ - struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile start; - - struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - dummy_element; - - int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - (*key_compare_function)( void const *new_key, void const *existing_key ); - - enum lfds700_list_aos_existing_key - existing_key; - - void - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, - int (*key_compare_function)(void const *new_key, void const *existing_key), - enum lfds700_list_aos_existing_key existing_key, - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, - void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ); - -enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, - struct lfds700_list_aos_element *laose, - struct lfds700_list_aos_element **existing_laose, - struct lfds700_misc_prng_state *ps ); - -int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, - void *key, - struct lfds700_list_aos_element **laose ); - -void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, - enum lfds700_list_aos_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h deleted file mode 100644 index 38d21511a1..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h +++ /dev/null @@ -1,90 +0,0 @@ -/***** defines *****/ -#define LFDS700_LIST_ASU_GET_START( list_asu_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_state).start->next ) -#define LFDS700_LIST_ASU_GET_NEXT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).next ) -#define LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT( list_asu_state, pointer_to_list_asu_element ) ( (pointer_to_list_asu_element) == NULL ? ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_START(list_asu_state) ) : ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_NEXT(*(pointer_to_list_asu_element)) ) ) -#define LFDS700_LIST_ASU_GET_KEY_FROM_ELEMENT( list_asu_element ) ( (list_asu_element).key ) -#define LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( list_asu_element, new_key ) ( (list_asu_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).value ) -#define LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( list_asu_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_asu_element).value, &local_new_value ); } -#define LFDS700_LIST_ASU_GET_USER_STATE_FROM_STATE( list_asu_state ) ( (list_asu_state).user_state ) - -/***** enums *****/ -enum lfds700_list_asu_position -{ - LFDS700_LIST_ASU_POSITION_START, - LFDS700_LIST_ASU_POSITION_END, - LFDS700_LIST_ASU_POSITION_AFTER -}; - -enum lfds700_list_asu_query -{ - LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, - LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_list_asu_element -{ - struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile next; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile value; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *key; -}; - -struct lfds700_list_asu_state -{ - struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile end, - *volatile start; - - struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - dummy_element; - - int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - (*key_compare_function)( void const *new_key, void const *existing_key ); - - void - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, - int (*key_compare_function)(void const *new_key, void const *existing_key), - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, - void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ); - -void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_list_asu_element *lasue_predecessor, - enum lfds700_list_asu_position position, - struct lfds700_misc_prng_state *ps ); - -void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_misc_prng_state *ps ); - -void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_misc_prng_state *ps ); - -void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_list_asu_element *lasue_predecessor, - struct lfds700_misc_prng_state *ps ); - -int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, - void *key, - struct lfds700_list_asu_element **lasue ); - -void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, - enum lfds700_list_asu_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h deleted file mode 100644 index 79eb3e7e5a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h +++ /dev/null @@ -1,192 +0,0 @@ -/***** defines *****/ -#define LFDS700_MISC_VERSION_STRING "7.0.0" -#define LFDS700_MISC_VERSION_INTEGER 700 - -#ifndef NULL - #define NULL ( (void *) 0 ) -#endif - -#define POINTER 0 -#define COUNTER 1 -#define PAC_SIZE 2 - -#define LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE 0 -#define LFDS700_MISC_PRNG_MAX ( (lfds700_pal_uint_t) -1 ) -#define LFDS700_MISC_DELIBERATELY_CRASH { char *c = 0; *c = 0; } -#define LFDS700_MISC_PRNG_SEED 0x0a34655d34c092feULL - /* TRD : from an on-line hardware RNG, using atmospheric noise - the URL eblow will generate another 16 random hex digits (e.g. a 64-bit number) and is - the RNG used to generate the number above (0x0a34655d34c092fe) - http://www.random.org/integers/?num=16&min=0&max=15&col=1&base=16&format=plain&rnd=new - - this seed is a fixed seed which is used for the slow, high quality PRNG, - which in turn is used when thread start to generate a single high quality seed - for the fast, low quality PRNG used for the CAS exponential backoff - */ - -#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 4 ) // TRD : any 32-bit platform - // TRD : PRNG is a 32-bit xorshift, numbers suggested by George Marsaglia, in his paper http://www.jstatsoft.org/v08/i14/paper - #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 13, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 17, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 5 ) -#endif - -#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 8 ) // TRD : any 64-bit platform - // TRD : PRNG is 64-bit xorshift (xorshift64*), from Sebastiano Vigna (vigna at acm dot org), http://creativecommons.org/publicdomain/zero/1.0/ - #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 12, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 25, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 27, (pointer_to_lfds700_misc_prng_state)->prng_state *= 2685821657736338717LL ) -#endif - -#if( !defined LFDS700_PAL_ATOMIC_CAS ) - #define LFDS700_PAL_NO_ATOMIC_CAS - - // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_CAS not implemented for this platform." ); \ - LFDS700_MISC_DELIBERATELY_CRASH; \ - (result) = (char unsigned) 1; \ - } -#endif - -#if( !defined LFDS700_PAL_ATOMIC_DWCAS ) - #define LFDS700_PAL_NO_ATOMIC_DWCAS - - // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, unsigned char result - - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_DWCAS not implemented for this platform." ); \ - LFDS700_MISC_DELIBERATELY_CRASH; \ - (result) = (char unsigned) 1; \ - } -#endif - -#if( !defined LFDS700_PAL_ATOMIC_EXCHANGE ) - #define LFDS700_PAL_NO_ATOMIC_EXCHANGE - // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *exchange - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_EXCHANGE not implemented for this platform." ); \ - LFDS700_MISC_DELIBERATELY_CRASH; \ - } -#endif - -#if( defined LFDS700_PAL_NO_COMPILER_BARRIERS ) - #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_PROCESSOR_LOAD ) - #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_PROCESSOR_STORE ) - #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_PROCESSOR_FULL ) -#else - #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_COMPILER_LOAD, LFDS700_PAL_BARRIER_PROCESSOR_LOAD, LFDS700_PAL_BARRIER_COMPILER_LOAD ) - #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_COMPILER_STORE, LFDS700_PAL_BARRIER_PROCESSOR_STORE, LFDS700_PAL_BARRIER_COMPILER_STORE ) - #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_COMPILER_FULL, LFDS700_PAL_BARRIER_PROCESSOR_FULL, LFDS700_PAL_BARRIER_COMPILER_FULL ) -#endif - -#define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE LFDS700_MISC_BARRIER_LOAD - -#if( defined LFDS700_PAL_NO_ATOMIC_CAS ) - #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 0 -#else - #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 1 -#endif - -#if( defined LFDS700_PAL_NO_ATOMIC_DWCAS ) - #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 0 -#else - #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 1 -#endif - -#if( defined LFDS700_PAL_NO_ATOMIC_EXCHANGE ) - #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 0 -#else - #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 1 -#endif - -/***** enums *****/ -enum lfds700_misc_cas_strength -{ - // TRD : yes, weak is 1 (one) - blame GCC! - LFDS700_MISC_CAS_STRENGTH_WEAK = 1, - LFDS700_MISC_CAS_STRENGTH_STRONG = 0 -}; - -enum lfds700_misc_validity -{ - LFDS700_MISC_VALIDITY_VALID, - LFDS700_MISC_VALIDITY_INVALID_LOOP, - LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS, - LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS, - LFDS700_MISC_VALIDITY_INVALID_TEST_DATA, - LFDS700_MISC_VALIDITY_INVALID_ORDER -}; - -enum lfds700_misc_flag -{ - LFDS700_MISC_FLAG_LOWERED, - LFDS700_MISC_FLAG_RAISED -}; - -enum lfds700_misc_query -{ - LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, - LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, - LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, - LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, - LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING -}; - -/***** struct *****/ -struct lfds700_misc_globals -{ - lfds700_pal_atom_t - exponential_backoff_timeslot_length_in_loop_iterations_for_cas, - exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; -}; - -struct lfds700_misc_prng_state -{ - lfds700_pal_uint_t - prng_state; - - // TRD : here to be on the same cache-line as prng_state, and so all are obtained from one cache-line read - lfds700_pal_atom_t - local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas, - local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; -}; - -struct lfds700_misc_validation_info -{ - lfds700_pal_uint_t - min_elements, - max_elements; -}; - -/***** externs *****/ -extern struct lfds700_misc_globals - lfds700_misc_globals; - -/***** public prototypes *****/ -void lfds700_misc_library_init_valid_on_current_logical_core( void ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE -void lfds700_misc_library_cleanup( void ); - -static LFDS700_PAL_INLINE void lfds700_misc_force_store( void ); - -void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ); - -void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ); - -/***** public in-line functions *****/ -// #pragma prefast( disable : 28112, "blah" ) - -static LFDS700_PAL_INLINE void lfds700_misc_force_store() -{ - lfds700_pal_uint_t - exchange = 0; - - lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - destination; - - LFDS700_PAL_ATOMIC_EXCHANGE( &destination, &exchange ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h deleted file mode 100644 index c628ddd03a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h +++ /dev/null @@ -1,478 +0,0 @@ -/****************************************************************************/ -#if( defined __GNUC__ ) - // TRD : makes checking GCC versions much tidier - #define LFDS700_PAL_GCC_VERSION ( __GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ ) -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 ) - - /* TRD : MSVC 8.0 and greater - - _MSC_VER indicates Microsoft C compiler and version - - __declspec(align) requires 7.1 (1310) - - __nop requires 8.0 (1400) - - _ReadBarrier requires 8.0 (1400) - - _WriteBarrier requires 8.0 (1400) - - _ReadWriteBarrier requires 7.1 (1310) - - _InterlockedCompareExchangePointer requires 8.0 (1400) - - _InterlockedExchange requires 7.1 (1310) - - _InterlockedExchangePointer requires 8.0 (1400) - - _InterlockedCompareExchange64 requires 8.0 (1400) (seems to, docs unclear) - - _InterlockedCompareExchange128 requires 9.0 (1500) - - load/store barriers are mandatory for liblfds, which means the earliest viable version of MSCV is 1400 - strictly we could get away with 1310 and use _ReadWriteBarrier, but the difference between 1310 and 1400 is small, so WTH - - _InterlockedCompareExchange128 is needed on 64-bit platforms to provide DWCAS, but DWCAS is not mandatory, - so we check against the compiler version - remember, any unimplemented atomic will be masked by its dummy define, - so everything will compile - it just means you can't use data structures which require that atomic - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - - #define LFDS700_PAL_COMPILER_STRING "MSVC" - - #define LFDS700_PAL_ALIGN(alignment) __declspec( align(alignment) ) - #define LFDS700_PAL_INLINE __forceinline - - #define LFDS700_PAL_BARRIER_COMPILER_LOAD _ReadBarrier() - #define LFDS700_PAL_BARRIER_COMPILER_STORE _WriteBarrier() - #define LFDS700_PAL_BARRIER_COMPILER_FULL _ReadWriteBarrier() - - /* TRD : there are four processors to consider; - - . ARM32 (32 bit, CAS, DWCAS) (defined _M_ARM) - . Itanium (64 bit, CAS) (defined _M_IA64) - . x64 (64 bit, CAS, DWCAS) (defined _M_X64 || defined _M_AMD64) - . x86 (32 bit, CAS, DWCAS) (defined _M_IX86) - - can't find any indications of 64-bit ARM support yet - - ARM has better intrinsics than the others, as there are no-fence variants - - in theory we also have to deal with 32-bit Windows on a 64-bit platform, - and I presume we'd see the compiler properly indicate this in its macros, - but this would require that we use 32-bit atomics on the 64-bit platforms, - while keeping 64-bit cache line lengths and so on, and this is just so - wierd a thing to do these days that it's not supported - - note that _InterlockedCompareExchangePointer performs CAS on all processors - however, it is documented as being available for x86 when in fact it is not - so we have to #if for processor type and use the length specific intrinsics - */ - - #if( defined _M_ARM ) - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __dmb( _ARM_BARRIER_ISH ) - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __dmb( _ARM_BARRIER_ISHST ) - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __dmb( _ARM_BARRIER_ISH ) - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - lfds700_pal_atom_t \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange_nf( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ - } - - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - __int64 \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = *(__int64 *) (pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64_nf( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ - } - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange_nf( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - #endif - - #if( defined _M_IA64 ) - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __mf() - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __mf() - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __mf() - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - lfds700_pal_atom_t \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ - } - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) *(pointer_to_exchange) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - #endif - - #if( defined _M_X64 || defined _M_AMD64 ) - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD _mm_lfence() - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE _mm_sfence() - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL _mm_mfence() - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - lfds700_pal_atom_t \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ - } - - #if( _MSC_VER >= 1500 ) - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - result = (char unsigned) _InterlockedCompareExchange128( (__int64 volatile *) (pointer_to_destination), (__int64) (pointer_to_new_destination[1]), (__int64) (pointer_to_new_destination[0]), (__int64 *) (pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - #endif - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchangePointer( (void * volatile *) (pointer_to_destination), (void *) *(pointer_to_exchange) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - #endif - - #if( defined _M_IX86 ) - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD lfds700_misc_force_store() - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE lfds700_misc_force_store() - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL lfds700_misc_force_store() - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - lfds700_pal_atom_t \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ - } - - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - __int64 \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = *(__int64 *) (pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ - } - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - #endif - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 412 && LFDS700_PAL_GCC_VERSION < 473 ) - - /* TRD : GCC 4.1.2 up to 4.7.3 - - __GNUC__ indicates GCC - LFDS700_PAL_GCC_VERSION indicates which version - - __sync_synchronize requires 4.1.2 - - GCC 4.1.2 introduced the __sync_*() atomic intrinsics - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - - #define LFDS700_PAL_COMPILER_STRING "GCC < 4.7.3" - - #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) - #define LFDS700_PAL_INLINE inline - - static LFDS700_PAL_INLINE void lfds700_pal_barrier_compiler( void ) - { - __asm__ __volatile__ ( "" : : : "memory" ); - } - - #define LFDS700_PAL_BARRIER_COMPILER_LOAD lfds700_pal_barrier_compiler() - #define LFDS700_PAL_BARRIER_COMPILER_STORE lfds700_pal_barrier_compiler() - #define LFDS700_PAL_BARRIER_COMPILER_FULL lfds700_pal_barrier_compiler() - - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __sync_synchronize() - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __sync_synchronize() - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __sync_synchronize() - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - lfds700_pal_atom_t \ - original_compare; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *(pointer_to_compare) = __sync_val_compare_and_swap( pointer_to_destination, *(pointer_to_compare), new_destination ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (unsigned char) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ - } - - // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics - #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - int long long unsigned \ - original_destination; \ - \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - original_destination = __sync_val_compare_and_swap( (int long long unsigned volatile *) (pointer_to_destination), *(int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - \ - result = (char unsigned) ( original_destination == *(int long long unsigned *) (pointer_to_compare) ); \ - \ - *(int long long unsigned *) (pointer_to_compare) = original_destination; \ - } - #endif - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - *( (lfds700_pal_atom_t *) pointer_to_exchange) = (lfds700_pal_atom_t) __sync_lock_test_and_set( pointer_to_destination, *(pointer_to_exchange) ); \ - LFDS700_PAL_BARRIER_COMPILER_FULL; \ - } - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 473 ) - - /* TRD : GCC 4.7.3 and greater - - __GNUC__ indicates GCC - LFDS700_PAL_GCC_VERSION indicates which version - - __atomic_thread_fence requires 4.7.3 - - GCC 4.7.3 introduced the better __atomic*() atomic intrinsics - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER - - #define LFDS700_PAL_COMPILER_STRING "GCC >= 4.7.3" - - #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) - #define LFDS700_PAL_INLINE inline - - // TRD : GCC >= 4.7.3 compiler barriers are built into the intrinsics - #define LFDS700_PAL_NO_COMPILER_BARRIERS - - #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __atomic_thread_fence( __ATOMIC_ACQUIRE ) - #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __atomic_thread_fence( __ATOMIC_RELEASE ) - #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __atomic_thread_fence( __ATOMIC_ACQ_REL ) - - #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* TRD : new_destination can be any value in its range */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - result = (char unsigned) __atomic_compare_exchange_n( pointer_to_destination, (void *) (pointer_to_compare), (new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ - } - - // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics - #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - (result) = (char unsigned) __atomic_compare_exchange_n( (int long long unsigned volatile *) (pointer_to_destination), (int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ - } - #endif - - #if( defined __x86_64__ ) - /* TRD : __GNUC__ indicates GCC - - __asm__ requires GCC - - __volatile__ requires GCC - __x86_64__ indicates x64 - - cmpxchg16b requires x64 - - On 64 bit platforms, unsigned long long int is 64 bit, so we must manually use cmpxchg16b, - as __sync_val_compare_and_swap() will only emit cmpxchg8b - */ - - // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result - - #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ - /* TRD : cas_strength can be any value in its range */ \ - /* TRD : result can be any value in its range */ \ - \ - (result) = 0; \ - \ - __asm__ __volatile__ \ - ( \ - "lock;" /* make cmpxchg16b atomic */ \ - "cmpxchg16b %0;" /* cmpxchg16b sets ZF on success */ \ - "setz %3;" /* if ZF set, set result to 1 */ \ - \ - /* output */ \ - : "+m" (*pointer_to_destination), "+a" ((pointer_to_compare)[0]), "+d" ((pointer_to_compare)[1]), "=q" (result) \ - \ - /* input */ \ - : "b" ((pointer_to_new_destination)[0]), "c" ((pointer_to_new_destination)[1]) \ - \ - /* clobbered */ \ - : "cc", "memory" \ - ); \ - } - #endif - - #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ - { \ - /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ - /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ - \ - *(pointer_to_exchange) = __atomic_exchange_n( (pointer_to_destination), *(pointer_to_exchange), __ATOMIC_RELAXED ); \ - } - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h deleted file mode 100644 index 0c1eba628a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h +++ /dev/null @@ -1,133 +0,0 @@ -/****************************************************************************/ -#if( defined _MSC_VER ) - /* TRD : MSVC compiler - - an unfortunately necessary hack for MSVC - MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - - which prevents Windows header files from compiling. - */ - - #define __STDC__ 1 - #define __STDC_HOSTED__ 1 -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && __STDC_HOSTED__ == 1 && !defined _KERNEL_MODE ) - - // TRD : MSVC - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - - #include - - #define LFDS700_PAL_OS_STRING "Windows" - #define LFDS700_PAL_ASSERT( expression ) assert( expression ) - -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && defined __STDC_HOSTED__ && __STDC_HOSTED__ == 1 && defined _WIN32 && defined _KERNEL_MODE ) - - // TRD : MSVC, Windows kernel-mode - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - - #include - #include - - #define LFDS700_PAL_OS_STRING "Windows" - #define LFDS700_PAL_ASSERT( expression ) assert( expression ) - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && __STDC_HOSTED__ == 1 && !(defined __linux__ && defined _KERNEL_MODE) ) - - // TRD : GCC, hosted implementation (except for Linux kernel mode) - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - - #include - - #define LFDS700_PAL_OS_STRING "Embedded (hosted)" - #define LFDS700_PAL_ASSERT( expression ) assert( expression ) - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && __STDC_HOSTED__ == 0 ) - - // TRD : GCC, freestanding or bare implementation - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - - #define LFDS700_PAL_OS_STRING "Embedded (freestanding/bare)" - #define LFDS700_PAL_ASSERT( expression ) - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __linux__ && defined _KERNEL_MODE ) - - // TRD : GCC, Linux kernel-mode - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM - - #include - - #define LFDS700_PAL_OS_STRING "Linux" - #define LFDS700_PAL_ASSERT( expression ) BUG_ON( expression ) - -#endif - - - - - -/****************************************************************************/ -#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM ) - - #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_operating_system.h - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h deleted file mode 100644 index 1e81c0eae2..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h +++ /dev/null @@ -1,544 +0,0 @@ -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IX86 ) - - /* TRD : MSVC, x86 - x86 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "x86" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 - -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && (defined _M_X64 || defined _M_AMD64) ) - - /* TRD : MSVC, x64 - x64 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "x64" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IA64 ) - - /* TRD : MSVC, Itanium - IA64 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "IA64" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - - /****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_ARM ) - - /* TRD : MSVC, 32-bit ARM - - ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes - so the isolation value used here is worst-case - be sure to set - this correctly, otherwise structures are painfully large - */ - -#ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR -#error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h -#endif - -#define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - -#define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" - -#define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 -#define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - -#define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 -#define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __arm__ ) - - /* TRD : GCC, 32-bit ARM - - ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes - so the isolation value used here is worst-case - be sure to set - this correctly, otherwise structures are painfully large - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __aarch64__ ) - - /* TRD : GCC, 64-bit ARM - - ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes - so the isolation value used here is worst-case - be sure to set - this correctly, otherwise structures are painfully large - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "ARM (64-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && (defined __i686__ || defined __i586__ || defined __i486__) ) - - /* TRD : GCC, x86 - - x86 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "x86" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __x86_64__ ) - - /* TRD : GCC, x86 - - x64 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "x64" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __alpha__ ) - - /* TRD : GCC, alpha - - alpha is LL/SC, but there is only one reservation per processor, - so the isolation value used here is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "alpha" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __ia64__ ) - - /* TRD : GCC, Itanium - - Itanium is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "IA64" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __mips__ ) - - /* TRD : GCC, MIPS (32-bit) - - MIPS is LL/SC, but there is only one reservation per processor, - so the isolation value used here is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "MIPS (32-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __mips64 ) - - /* TRD : GCC, MIPS (64-bit) - - MIPS is LL/SC, but there is only one reservation per processor, - so the isolation value used here is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "MIPS (64-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __ppc__ ) - - /* TRD : GCC, POWERPC (32-bit) - - POWERPC is LL/SC and uses a reservation granule but I can't find - canonical documentation for its size - 128 bytes seems to be the - largest value I've found - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (32-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __ppc64__ ) - - /* TRD : GCC, POWERPC (64-bit) - - POWERPC is LL/SC and uses a reservation granule but I can't find - canonical documentation for its size - 128 bytes seems to be the - largest value I've found - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (64-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __sparc__ && !defined __sparc_v9__ ) - - /* TRD : GCC, SPARC (32-bit) - - SPARC is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "SPARC (32-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __sparc__ && defined __sparc_v9__ ) - - /* TRD : GCC, SPARC (64-bit) - - SPARC is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long long unsigned lfds700_pal_atom_t; - typedef int long long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "SPARC (64-bit)" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __m68k__ ) - - /* TRD : GCC, 680x0 - - 680x0 is CAS, so isolation is cache-line length - */ - - #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h - #endif - - #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR - - typedef int long unsigned lfds700_pal_atom_t; - typedef int long unsigned lfds700_pal_uint_t; - - #define LFDS700_PAL_PROCESSOR_STRING "680x0" - - #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 - #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 - - #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 - #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 - -#endif - - - - - -/****************************************************************************/ -#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR ) - - #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_processor.h - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h deleted file mode 100644 index 025b0673e9..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h +++ /dev/null @@ -1,60 +0,0 @@ -/***** defines *****/ -#define LFDS700_QUEUE_GET_KEY_FROM_ELEMENT( queue_element ) ( (queue_element).key ) -#define LFDS700_QUEUE_SET_KEY_IN_ELEMENT( queue_element, new_key ) ( (queue_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( queue_element ) ( (queue_element).value ) -#define LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( queue_element, new_value ) ( (queue_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) -#define LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( queue_state ) ( (queue_state).user_state ) - -/***** enums *****/ -enum lfds700_queue_query -{ - LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, - LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_queue_element -{ - struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile next[PAC_SIZE]; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *key; - - void - *value; -}; - -struct lfds700_queue_state -{ - struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile enqueue[PAC_SIZE], - *volatile dequeue[PAC_SIZE]; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, - struct lfds700_queue_element *qe_dummy, - struct lfds700_misc_prng_state *ps, - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_queue_cleanup( struct lfds700_queue_state *qs, - void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ); - -void lfds700_queue_enqueue( struct lfds700_queue_state *qs, - struct lfds700_queue_element *qe, - struct lfds700_misc_prng_state *ps ); - -int lfds700_queue_dequeue( struct lfds700_queue_state *qs, - struct lfds700_queue_element **qe, - struct lfds700_misc_prng_state *ps ); - -void lfds700_queue_query( struct lfds700_queue_state *qs, - enum lfds700_queue_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h deleted file mode 100644 index 3b090e1d45..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h +++ /dev/null @@ -1,59 +0,0 @@ -/***** defines *****/ -#define LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state ) ( (queue_bss_state).user_state ) - -/***** enums *****/ -enum lfds700_queue_bss_query -{ - LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, - LFDS700_QUEUE_BSS_QUERY_VALIDATE -}; - -/***** structures *****/ -struct lfds700_queue_bss_element -{ - void - *volatile key, - *volatile value; -}; - -struct lfds700_queue_bss_state -{ - lfds700_pal_uint_t - number_elements, - mask; - - lfds700_pal_uint_t volatile - read_index, - write_index; - - struct lfds700_queue_bss_element - *element_array; - - void - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, - struct lfds700_queue_bss_element *element_array, - lfds700_pal_uint_t number_elements, - void *user_state ); - // TRD : number_elements must be a positive integer power of 2 - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, - void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ); - -int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, - void *key, - void *value ); - -int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, - void **key, - void **value ); - -void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, - enum lfds700_queue_bss_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h deleted file mode 100644 index fbb21d2be4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h +++ /dev/null @@ -1,69 +0,0 @@ -/***** enums *****/ -#define LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE( ringbuffer_state ) ( (ringbuffer_state).user_state ) - -/***** enums *****/ -enum lfds700_ringbuffer_query -{ - LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT, - LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_ringbuffer_element -{ - struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - fe; - - struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - qe; - - struct lfds700_queue_element - *qe_use; // TRD : hack for 7.0.0; we need a new queue with no dummy element - - void - *key, - *value; -}; - -struct lfds700_ringbuffer_state -{ - struct lfds700_freelist_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - fs; - - struct lfds700_queue_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - qs; - - void - (*element_cleanup_callback)( struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag ), - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, - struct lfds700_ringbuffer_element *re_array_inc_dummy, - lfds700_pal_uint_t number_elements, - struct lfds700_misc_prng_state *ps, - void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, - void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ); - -int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, - void **key, - void **value, - struct lfds700_misc_prng_state *ps ); - -void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, - void *key, - void *value, - enum lfds700_misc_flag *overwrite_occurred_flag, - void **overwritten_key, - void **overwritten_value, - struct lfds700_misc_prng_state *ps ); - -void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, - enum lfds700_ringbuffer_query query_type, - void *query_input, - void *query_output ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h deleted file mode 100644 index 3faed80308..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h +++ /dev/null @@ -1,55 +0,0 @@ -/***** defines *****/ -#define LFDS700_STACK_GET_KEY_FROM_ELEMENT( stack_element ) ( (stack_element).key ) -#define LFDS700_STACK_SET_KEY_IN_ELEMENT( stack_element, new_key ) ( (stack_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) -#define LFDS700_STACK_GET_VALUE_FROM_ELEMENT( stack_element ) ( (stack_element).value ) -#define LFDS700_STACK_SET_VALUE_IN_ELEMENT( stack_element, new_value ) ( (stack_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) -#define LFDS700_STACK_GET_USER_STATE_FROM_STATE( stack_state ) ( (stack_state).user_state ) - -/***** enums *****/ -enum lfds700_stack_query -{ - LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, - LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE -}; - -/***** structures *****/ -struct lfds700_stack_element -{ - struct lfds700_stack_element - *volatile next; - - void - *key, - *value; -}; - -struct lfds700_stack_state -{ - struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *volatile top[PAC_SIZE]; - - void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - *user_state; -}; - -/***** public prototypes *****/ -void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ); - // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE - -void lfds700_stack_cleanup( struct lfds700_stack_state *ss, - void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ); - -void lfds700_stack_push( struct lfds700_stack_state *ss, - struct lfds700_stack_element *se, - struct lfds700_misc_prng_state *ps ); - -int lfds700_stack_pop( struct lfds700_stack_state *ss, - struct lfds700_stack_element **se, - struct lfds700_misc_prng_state *ps ); - -void lfds700_stack_query( struct lfds700_stack_state *ss, - enum lfds700_stack_query query_type, - void *query_input, - void *query_output ); - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c deleted file mode 100644 index 2927c98628..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c +++ /dev/null @@ -1,117 +0,0 @@ -/***** includes *****/ -#include "lfds700_btree_addonly_unbalanced_internal.h" - - - - - -/****************************************************************************/ -void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, - void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ) -{ - enum lfds700_btree_au_delete_action - delete_action = LFDS700_BTREE_AU_DELETE_SELF; // TRD : to remove compiler warning - - struct lfds700_btree_au_element - *baue; - - struct lfds700_btree_au_element - *temp; - - LFDS700_PAL_ASSERT( baus != NULL ); - // TRD : element_delete_function can be NULL - - /* TRD : we're not lock-free now, so delete at will - but be iterative, so can be used in kernels (where there's little stack) - and be performant, since the user may be - creating/destroying many of these trees - also remember the user may be deallocating user data - so we cannot visit an element twice - - we start at the root and iterate till we go to NULL - if the element has zero children, we delete it and move up to its parent - if the element has one child, we delete it, move its child into its place, and continue from its child - if the element has two children, we move left - - the purpose of this is to minimize walking around the tree - to prevent visiting an element twice - while also minimizing code complexity - */ - - if( element_cleanup_callback == NULL ) - return; - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_btree_au_get_by_absolute_position( baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT ); - - while( baue != NULL ) - { - if( baue->left == NULL and baue->right == NULL ) - delete_action = LFDS700_BTREE_AU_DELETE_SELF; - - if( baue->left != NULL and baue->right == NULL ) - delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD; - - if( baue->left == NULL and baue->right != NULL ) - delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD; - - if( baue->left != NULL and baue->right != NULL ) - delete_action = LFDS700_BTREE_AU_DELETE_MOVE_LEFT; - - switch( delete_action ) - { - case LFDS700_BTREE_AU_DELETE_SELF: - // TRD : if we have a parent (we could be root) set his point to us to NULL - if( baue->up != NULL ) - { - if( baue->up->left == baue ) - baue->up->left = NULL; - if( baue->up->right == baue ) - baue->up->right = NULL; - } - - temp = baue; - lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_UP ); - element_cleanup_callback( baus, temp ); - break; - - case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD: - baue->left->up = baue->up; - if( baue->up != NULL ) - { - if( baue->up->left == baue ) - baue->up->left = baue->left; - if( baue->up->right == baue ) - baue->up->right = baue->left; - } - - temp = baue; - lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); - element_cleanup_callback( baus, temp ); - break; - - case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD: - baue->right->up = baue->up; - if( baue->up != NULL ) - { - if( baue->up->left == baue ) - baue->up->left = baue->right; - if( baue->up->right == baue ) - baue->up->right = baue->right; - } - - temp = baue; - lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT ); - element_cleanup_callback( baus, temp ); - break; - - case LFDS700_BTREE_AU_DELETE_MOVE_LEFT: - lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); - break; - } - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c deleted file mode 100644 index 8a2cdf93e8..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c +++ /dev/null @@ -1,467 +0,0 @@ -/***** includes *****/ -#include "lfds700_btree_addonly_unbalanced_internal.h" - -/***** private prototypes *****/ -static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ); -static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ); - - - - - -/****************************************************************************/ -int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, - void *key, - struct lfds700_btree_au_element **baue ) -{ - int - compare_result = !0, - rv = 1; - - LFDS700_PAL_ASSERT( baus != NULL ); - // TRD : key can be NULL - LFDS700_PAL_ASSERT( baue != NULL ); - - LFDS700_MISC_BARRIER_LOAD; - - *baue = baus->root; - - LFDS700_MISC_BARRIER_LOAD; - - while( *baue != NULL and compare_result != 0 ) - { - compare_result = baus->key_compare_function( key, (*baue)->key ); - - if( compare_result < 0 ) - { - *baue = (*baue)->left; - LFDS700_MISC_BARRIER_LOAD; - } - - if( compare_result > 0 ) - { - *baue = (*baue)->right; - LFDS700_MISC_BARRIER_LOAD; - } - } - - if( *baue == NULL ) - rv = 0; - - return( rv ); -} - - - - - -/****************************************************************************/ -int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position ) -{ - int - rv = 1; - - LFDS700_PAL_ASSERT( baus != NULL ); - LFDS700_PAL_ASSERT( baue != NULL ); - // TRD : absolute_position can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - *baue = baus->root; - - LFDS700_MISC_BARRIER_LOAD; - - switch( absolute_position ) - { - case LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT: - break; - - case LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE: - if( *baue != NULL ) - while( (*baue)->right != NULL ) - { - *baue = (*baue)->right; - LFDS700_MISC_BARRIER_LOAD; - } - break; - - case LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE: - if( *baue != NULL ) - while( (*baue)->left != NULL ) - { - *baue = (*baue)->left; - LFDS700_MISC_BARRIER_LOAD; - } - break; - } - - if( *baue == NULL ) - rv = 0; - - return( rv ); -} - - - - - -/****************************************************************************/ -int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, enum lfds700_btree_au_relative_position relative_position ) -{ - int - rv = 1; - - LFDS700_PAL_ASSERT( baue != NULL ); - // TRD : relative_position can baue any value in its range - - if( *baue == NULL ) - return( 0 ); - - LFDS700_MISC_BARRIER_LOAD; - - switch( relative_position ) - { - case LFDS700_BTREE_AU_RELATIVE_POSITION_UP: - *baue = (*baue)->up; - // TRD : no load barrier - up already existed, so is known to be safely propagated - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT: - *baue = (*baue)->left; - LFDS700_MISC_BARRIER_LOAD; - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT: - *baue = (*baue)->right; - LFDS700_MISC_BARRIER_LOAD; - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT: - *baue = (*baue)->left; - if( *baue != NULL ) - { - LFDS700_MISC_BARRIER_LOAD; - while( (*baue)->right != NULL ) - { - *baue = (*baue)->right; - LFDS700_MISC_BARRIER_LOAD; - } - } - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT: - *baue = (*baue)->right; - if( *baue != NULL ) - { - LFDS700_MISC_BARRIER_LOAD; - while( (*baue)->left != NULL ) - { - *baue = (*baue)->left; - LFDS700_MISC_BARRIER_LOAD; - } - } - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE: - lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( baue ); - break; - - case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE: - lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( baue ); - break; - } - - if( *baue == NULL ) - rv = 0; - - return( rv ); -} - - - - - -/****************************************************************************/ -static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ) -{ - enum lfds700_btree_au_move - action = LFDS700_BTREE_AU_MOVE_INVALID; - - enum lfds700_misc_flag - finished_flag = LFDS700_MISC_FLAG_LOWERED, - load_finished_flag = LFDS700_MISC_FLAG_LOWERED; - - struct lfds700_btree_au_element - *left = NULL, - *right = NULL, - *up = NULL, - *up_left = NULL, - *up_right = NULL; - - LFDS700_PAL_ASSERT( baue != NULL ); - - /* TRD : from any given element, the next smallest element is; - 1. if we have a left, it's the largest element on the right branch of our left child - 2. if we don't have a left, and we're on the right of our parent, then it's our parent - 3. if we don't have a left, and we're on the left of our parent or we have no parent, - iterative up the tree until we find the first child who is on the right of its parent; then it's the parent - */ - - /* TRD : we need to ensure the variables we use to decide our action are self-consistent - to do this, we make local copies of them all - then, if they are all not NULL, we can know they cannot change and we can continue - if however any of them are NULL, they could have changed while we were reading - and so our variables could be non-self-consistent - to check for this, we issue another processor read barrier - and then compare our local variables with the values in the tree - if they all match, then we know our variable set is self-consistent - (even though it may now be wrong - but we will discover this when we try the atomic operation) - */ - - LFDS700_MISC_BARRIER_LOAD; - - while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - left = (*baue)->left; - right = (*baue)->right; - up = (*baue)->up; - if( up != NULL ) - { - up_left = (*baue)->up->left; - up_right = (*baue)->up->right; - } - - if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) - break; - - LFDS700_MISC_BARRIER_LOAD; - - if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) - load_finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - if( left != NULL ) - action = LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD; - - if( left == NULL and up != NULL and up_right == *baue ) - action = LFDS700_BTREE_AU_MOVE_GET_PARENT; - - if( (left == NULL and up == NULL) or (up != NULL and up_left == *baue and left == NULL) ) - action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; - - switch( action ) - { - case LFDS700_BTREE_AU_MOVE_INVALID: - case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: - // TRD : eliminates a compiler warning - break; - - case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: - *baue = left; - if( *baue != NULL ) - { - LFDS700_MISC_BARRIER_LOAD; - while( (*baue)->right != NULL ) - { - *baue = (*baue)->right; - LFDS700_MISC_BARRIER_LOAD; - } - } - break; - - case LFDS700_BTREE_AU_MOVE_GET_PARENT: - *baue = up; - break; - - case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - load_finished_flag = LFDS700_MISC_FLAG_LOWERED; - - while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - up = (*baue)->up; - if( up != NULL ) - up_left = (*baue)->up->left; - - if( up == NULL or (up != NULL and up_left != NULL) ) - break; - - LFDS700_MISC_BARRIER_LOAD; - - if( up == (*baue)->up and up_left == (*baue)->up->left ) - load_finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - if( *baue != NULL and up != NULL and *baue == up_left ) - *baue = up; - else - finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - *baue = up; - - /* - - while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->left ) - *baue = (*baue)->up; - - *baue = (*baue)->up; - - */ - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ) -{ - enum lfds700_btree_au_move - action = LFDS700_BTREE_AU_MOVE_INVALID; - - enum lfds700_misc_flag - finished_flag = LFDS700_MISC_FLAG_LOWERED, - load_finished_flag = LFDS700_MISC_FLAG_LOWERED; - - struct lfds700_btree_au_element - *left = NULL, - *right = NULL, - *up = NULL, - *up_left = NULL, - *up_right = NULL; - - LFDS700_PAL_ASSERT( baue != NULL ); - - /* TRD : from any given element, the next largest element is; - 1. if we have a right, it's the smallest element on the left branch of our right child - 2. if we don't have a right, and we're on the left of our parent, then it's our parent - 3. if we don't have a right, and we're on the right of our parent or we have no parent, - iterate up the tree until we find the first child who is on the left of its parent; then it's the parent - */ - - LFDS700_MISC_BARRIER_LOAD; - - while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - left = (*baue)->left; - right = (*baue)->right; - up = (*baue)->up; - if( up != NULL ) - { - up_left = (*baue)->up->left; - up_right = (*baue)->up->right; - } - - if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) - break; - - LFDS700_MISC_BARRIER_LOAD; - - if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) - load_finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - if( right != NULL ) - action = LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD; - - if( right == NULL and up != NULL and up_left == *baue ) - action = LFDS700_BTREE_AU_MOVE_GET_PARENT; - - if( (right == NULL and up == NULL) or (up != NULL and up_right == *baue and right == NULL) ) - action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; - - switch( action ) - { - case LFDS700_BTREE_AU_MOVE_INVALID: - case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: - // TRD : remove compiler warning - break; - - case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: - *baue = right; - if( *baue != NULL ) - { - LFDS700_MISC_BARRIER_LOAD; - while( (*baue)->left != NULL ) - { - *baue = (*baue)->left; - LFDS700_MISC_BARRIER_LOAD; - } - } - break; - - case LFDS700_BTREE_AU_MOVE_GET_PARENT: - *baue = up; - break; - - case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - load_finished_flag = LFDS700_MISC_FLAG_LOWERED; - - while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - up = (*baue)->up; - if( up != NULL ) - up_right = (*baue)->up->right; - - if( up == NULL or (up != NULL and up_right != NULL) ) - break; - - LFDS700_MISC_BARRIER_LOAD; - - if( up == (*baue)->up and up_right == (*baue)->up->right ) - load_finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - if( *baue != NULL and up != NULL and *baue == up_right ) - *baue = up; - else - finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - *baue = up; - - /* - - while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->right ) - *baue = (*baue)->up; - - *baue = (*baue)->up; - - */ - break; - } - - return; -} - - - - - -/****************************************************************************/ -int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position, enum lfds700_btree_au_relative_position relative_position ) -{ - int - rv; - - LFDS700_PAL_ASSERT( baus != NULL ); - LFDS700_PAL_ASSERT( baue != NULL ); - // TRD: absolute_position can be any value in its range - // TRD: relative_position can be any value in its range - - if( *baue == NULL ) - rv = lfds700_btree_au_get_by_absolute_position( baus, baue, absolute_position ); - else - rv = lfds700_btree_au_get_by_relative_position( baue, relative_position ); - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c deleted file mode 100644 index 7dd0efd6c0..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c +++ /dev/null @@ -1,32 +0,0 @@ -/***** includes *****/ -#include "lfds700_btree_addonly_unbalanced_internal.h" - - - - - -/****************************************************************************/ -void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, - int (*key_compare_function)(void const *new_key, void const *existing_key), - enum lfds700_btree_au_existing_key existing_key, - void *user_state ) -{ - LFDS700_PAL_ASSERT( baus != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->root % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( key_compare_function != NULL ); - // TRD : existing_key can be any value in its range - // TRD : user_state can be NULL - - baus->root = NULL; - baus->key_compare_function = key_compare_function; - baus->existing_key = existing_key; - baus->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c deleted file mode 100644 index 8808177a4c..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c +++ /dev/null @@ -1,156 +0,0 @@ -/***** includes *****/ -#include "lfds700_btree_addonly_unbalanced_internal.h" - - - - - -/****************************************************************************/ -enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, - struct lfds700_btree_au_element *baue, - struct lfds700_btree_au_element **existing_baue, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result = 0; - - int - compare_result = 0; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_btree_au_element - *volatile compare = NULL, - *volatile baue_next = NULL, - *volatile baue_parent = NULL, - *volatile baue_temp; - - LFDS700_PAL_ASSERT( baus != NULL ); - LFDS700_PAL_ASSERT( baue != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->left % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->right % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->up % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : existing_baue can be NULL - LFDS700_PAL_ASSERT( ps != NULL ); - - /* TRD : we follow a normal search for the insert node and which side to insert - - the difference is that insertion may fail because someone else inserts - there before we do - - in this case, we resume searching for the insert node from the node - we were attempting to insert upon - - (if we attempted to insert the root node and this failed, i.e. we thought - the tree was empty but then it wasn't, then we start searching from the - new root) - */ - - baue->up = baue->left = baue->right = NULL; - - LFDS700_MISC_BARRIER_LOAD; - - baue_temp = baus->root; - - LFDS700_MISC_BARRIER_LOAD; - - while( result == 0 ) - { - // TRD : first we find where to insert - while( baue_temp != NULL ) - { - compare_result = baus->key_compare_function( baue->key, baue_temp->key ); - - if( compare_result == 0 ) - { - if( existing_baue != NULL ) - *existing_baue = baue_temp; - - switch( baus->existing_key ) - { - case LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE: - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( *baue_temp, baue->value ); - return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ); - break; - - case LFDS700_BTREE_AU_EXISTING_KEY_FAIL: - return( LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ); - break; - } - } - - if( compare_result < 0 ) - baue_next = baue_temp->left; - - if( compare_result > 0 ) - baue_next = baue_temp->right; - - baue_parent = baue_temp; - baue_temp = baue_next; - if( baue_temp != NULL ) - LFDS700_MISC_BARRIER_LOAD; - } - - /* TRD : second, we actually insert - - at this point baue_temp has come to NULL - and baue_parent is the element to insert at - and result of the last compare indicates - the direction of insertion - - it may be that another tree has already inserted an element with - the same key as ourselves, or other elements which mean our position - is now wrong - - in this case, it is either inserted in the position we're trying - to insert in now, in which case our insert will fail - - or, similarly, other elements will have come in where we are, - and our insert will fail - */ - - if( baue_parent == NULL ) - { - compare = NULL; - baue->up = baus->root; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baus->root, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - - if( result == 0 ) - baue_temp = baus->root; - } - - if( baue_parent != NULL ) - { - if( compare_result <= 0 ) - { - compare = NULL; - baue->up = baue_parent; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->left, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - - if( compare_result > 0 ) - { - compare = NULL; - baue->up = baue_parent; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->right, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - - // TRD : if the insert fails, resume searching at the insert node - if( result == 0 ) - baue_temp = baue_parent; - } - } - - // TRD : if we get to here, we added (not failed or overwrite on exist) a new element - if( existing_baue != NULL ) - *existing_baue = NULL; - - return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h deleted file mode 100644 index 54149bac99..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h +++ /dev/null @@ -1,23 +0,0 @@ -/***** the library-wide header file *****/ -#include "../liblfds700_internal.h" - -/***** enums *****/ -enum lfds700_btree_au_move -{ - LFDS700_BTREE_AU_MOVE_INVALID, - LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD, - LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD, - LFDS700_BTREE_AU_MOVE_GET_PARENT, - LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE -}; - -enum lfds700_btree_au_delete_action -{ - LFDS700_BTREE_AU_DELETE_SELF, - LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD, - LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD, - LFDS700_BTREE_AU_DELETE_MOVE_LEFT -}; - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c deleted file mode 100644 index dce9587929..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c +++ /dev/null @@ -1,121 +0,0 @@ -/***** includes *****/ -#include "lfds700_btree_addonly_unbalanced_internal.h" - -/***** private prototypes *****/ -static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *abs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ); - - - - - -/****************************************************************************/ -void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, enum lfds700_btree_au_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( baus != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: - { - struct lfds700_btree_au_element - *baue = NULL; - - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) - ( *(lfds700_pal_uint_t *) query_output )++; - } - break; - - case LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_btree_au_internal_validate( baus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *baus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ) -{ - lfds700_pal_uint_t - number_elements_from_query_tree = 0, - number_elements_from_walk = 0; - - struct lfds700_btree_au_element - *baue = NULL, - *baue_prev = NULL; - - LFDS700_PAL_ASSERT( baus!= NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_btree_au_validity != NULL ); - - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : validation is performed by; - - performing an in-order walk - we should see every element is larger than the preceeding element - we count elements as we go along (visited elements, that is) - and check our tally equals the expected count - */ - - LFDS700_MISC_BARRIER_LOAD; - - while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) - { - // TRD : baue_prev should always be smaller than or equal to baue - if( baue_prev != NULL ) - if( baus->key_compare_function(baue_prev->key, baue->key) > 0 ) - { - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ORDER; - return; - } - - baue_prev = baue; - number_elements_from_walk++; - } - - if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID ) - { - lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); - - if( number_elements_from_walk > number_elements_from_query_tree ) - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( number_elements_from_walk < number_elements_from_query_tree ) - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - } - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); - - if( number_elements_from_query_tree < vi->min_elements ) - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements_from_query_tree > vi->max_elements ) - *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c deleted file mode 100644 index f7a088a39a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c +++ /dev/null @@ -1,36 +0,0 @@ -/***** includes *****/ -#include "lfds700_freelist_internal.h" - - - - - -/****************************************************************************/ -void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, - void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ) -{ - struct lfds700_freelist_element - *fe, - *fe_temp; - - LFDS700_PAL_ASSERT( fs != NULL ); - // TRD : element_cleanup_callback can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( element_cleanup_callback != NULL ) - { - fe = fs->top[POINTER]; - - while( fe != NULL ) - { - fe_temp = fe; - fe = fe->next; - - element_cleanup_callback( fs, fe_temp ); - } - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c deleted file mode 100644 index fcacd1b32f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c +++ /dev/null @@ -1,27 +0,0 @@ -/***** includes *****/ -#include "lfds700_freelist_internal.h" - - - - - -/****************************************************************************/ -void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ) -{ - LFDS700_PAL_ASSERT( fs != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) fs->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &fs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : user_state can be NULL - - fs->top[POINTER] = NULL; - fs->top[COUNTER] = 0; - - fs->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c deleted file mode 100644 index c0a3545d91..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c +++ /dev/null @@ -1,52 +0,0 @@ -/***** includes *****/ -#include "lfds700_freelist_internal.h" - - - - - -/****************************************************************************/ -int lfds700_freelist_pop( struct lfds700_freelist_state *fs, struct lfds700_freelist_element **fe, struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *new_top[PAC_SIZE], - *volatile original_top[PAC_SIZE]; - - LFDS700_PAL_ASSERT( fs != NULL ); - LFDS700_PAL_ASSERT( fe != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - LFDS700_PAL_BARRIER_PROCESSOR_LOAD; - - original_top[COUNTER] = fs->top[COUNTER]; - original_top[POINTER] = fs->top[POINTER]; - - do - { - if( original_top[POINTER] == NULL ) - { - *fe = NULL; - return( 0 ); - } - - new_top[COUNTER] = original_top[COUNTER] + 1; - new_top[POINTER] = original_top[POINTER]->next; - - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - - if( result != 1 ) - LFDS700_PAL_BARRIER_PROCESSOR_LOAD; - } - while( result != 1 ); - - *fe = original_top[POINTER]; - - return( 1 ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c deleted file mode 100644 index 67fe38dadb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c +++ /dev/null @@ -1,42 +0,0 @@ -/***** includes *****/ -#include "lfds700_freelist_internal.h" - - - - - -/****************************************************************************/ -void lfds700_freelist_push( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe, struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *new_top[PAC_SIZE], - *volatile original_top[PAC_SIZE]; - - LFDS700_PAL_ASSERT( fs != NULL ); - LFDS700_PAL_ASSERT( fe != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - new_top[POINTER] = fe; - - original_top[COUNTER] = fs->top[COUNTER]; - original_top[POINTER] = fs->top[POINTER]; - - do - { - new_top[COUNTER] = original_top[COUNTER] + 1; - fe->next = original_top[POINTER]; - - LFDS700_PAL_BARRIER_PROCESSOR_STORE; - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - while( result != 1 ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c deleted file mode 100644 index 43b8bc263d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c +++ /dev/null @@ -1,123 +0,0 @@ -/***** includes *****/ -#include "lfds700_freelist_internal.h" - -/***** private prototypes *****/ -static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ); - - - - - -/****************************************************************************/ -void lfds700_freelist_query( struct lfds700_freelist_state *fs, enum lfds700_freelist_query query_type, void *query_input, void *query_output ) -{ - struct lfds700_freelist_element - *fe; - - LFDS700_PAL_ASSERT( fs != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT: - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - fe = (struct lfds700_freelist_element *) fs->top[POINTER]; - - while( fe != NULL ) - { - ( *(lfds700_pal_uint_t *) query_output )++; - fe = (struct lfds700_freelist_element *) fe->next; - } - break; - - case LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_freelist_internal_freelist_validate( fs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ) -{ - lfds700_pal_uint_t - number_elements = 0; - - struct lfds700_freelist_element - *fe_slow, - *fe_fast; - - LFDS700_PAL_ASSERT( fs != NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); - - *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_VALID; - - fe_slow = fe_fast = (struct lfds700_freelist_element *) fs->top[POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the top of the freelist - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the freelist) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( fe_slow != NULL ) - do - { - fe_slow = fe_slow->next; - - if( fe_fast != NULL ) - fe_fast = fe_fast->next; - - if( fe_fast != NULL ) - fe_fast = fe_fast->next; - } - while( fe_slow != NULL and fe_fast != fe_slow ); - - if( fe_fast != NULL and fe_slow != NULL and fe_fast == fe_slow ) - *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_freelist_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_freelist_query( fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c deleted file mode 100644 index e57fab74c4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c +++ /dev/null @@ -1,59 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - -/***** private prototypes*****/ -static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ); - - - - - -/****************************************************************************/ -void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, - void (*element_cleanup_callback)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ) -{ - lfds700_pal_uint_t - loop; - - LFDS700_PAL_ASSERT( has != NULL ); - // TRD : element_cleanup_callback can be NULL - - if( element_cleanup_callback == NULL ) - return; - - LFDS700_MISC_BARRIER_LOAD; - - has->element_cleanup_callback = element_cleanup_callback; - - for( loop = 0 ; loop < has->array_size ; loop++ ) - lfds700_btree_au_cleanup( has->baus_array+loop, btree_au_element_cleanup_function ); - - return; -} - - - - - -/****************************************************************************/ - -static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ) -{ - struct lfds700_hash_a_state - *has; - - struct lfds700_hash_a_element - *hae; - - LFDS700_PAL_ASSERT( baus != NULL ); - LFDS700_PAL_ASSERT( baue != NULL ); - - hae = (struct lfds700_hash_a_element *) LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); - has = (struct lfds700_hash_a_state *) LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( *baus ); - - has->element_cleanup_callback( has, hae ); - - return; -} - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c deleted file mode 100644 index 8d010664ab..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c +++ /dev/null @@ -1,37 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - - - - - -/****************************************************************************/ -int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, - void *key, - struct lfds700_hash_a_element **hae ) -{ - int - rv; - - lfds700_pal_uint_t - hash = 0; - - struct lfds700_btree_au_element - *baue; - - LFDS700_PAL_ASSERT( has != NULL ); - // TRD : key can be NULL - LFDS700_PAL_ASSERT( hae != NULL ); - - has->key_hash_function( key, &hash ); - - rv = lfds700_btree_au_get_by_key( has->baus_array + (hash % has->array_size), key, &baue ); - - if( rv == 1 ) - *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); - else - *hae = NULL; - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c deleted file mode 100644 index 022024ce27..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c +++ /dev/null @@ -1,54 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - - - - - -/****************************************************************************/ -void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, - struct lfds700_btree_au_state *baus_array, - lfds700_pal_uint_t array_size, - int (*key_compare_function)(void const *new_key, void const *existing_key), - void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), - enum lfds700_hash_a_existing_key existing_key, - void *user_state ) -{ - enum lfds700_btree_au_existing_key - btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; // TRD : for compiler warning - - lfds700_pal_uint_t - loop; - - LFDS700_PAL_ASSERT( has != NULL ); - LFDS700_PAL_ASSERT( baus_array != NULL ); - LFDS700_PAL_ASSERT( array_size > 0 ); - LFDS700_PAL_ASSERT( key_compare_function != NULL ); - LFDS700_PAL_ASSERT( key_hash_function != NULL ); - // TRD : existing_key can be any value in its range - // TRD : user_state can be NULL - - has->array_size = array_size; - has->key_compare_function = key_compare_function; - has->key_hash_function = key_hash_function; - has->existing_key = existing_key; - has->baus_array = baus_array; - has->user_state = user_state; - - if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_OVERWRITE ) - btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; - - if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_FAIL ) - btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_FAIL; - - // TRD : since the addonly_hash atomic counts, if that flag is set, the btree_addonly_unbalanceds don't have to - for( loop = 0 ; loop < array_size ; loop++ ) - lfds700_btree_au_init_valid_on_current_logical_core( has->baus_array+loop, key_compare_function, btree_au_existing_key, user_state ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c deleted file mode 100644 index 25df3e7f93..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c +++ /dev/null @@ -1,62 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - - - - - -/****************************************************************************/ -enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, - struct lfds700_hash_a_element *hae, - struct lfds700_hash_a_element **existing_hae, - struct lfds700_misc_prng_state *ps ) -{ - enum lfds700_hash_a_insert_result - apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; - - enum lfds700_btree_au_insert_result - alr; - - lfds700_pal_uint_t - hash = 0; - - struct lfds700_btree_au_element - *existing_baue; - - LFDS700_PAL_ASSERT( has != NULL ); - LFDS700_PAL_ASSERT( hae != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : existing_hae can be NULL - LFDS700_PAL_ASSERT( ps != NULL ); - - // TRD : alignment checks - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->baue % LFDS700_PAL_ALIGN_SINGLE_POINTER == 0 ); - - has->key_hash_function( hae->key, &hash ); - - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( hae->baue, hae->key ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( hae->baue, hae ); - - alr = lfds700_btree_au_insert( has->baus_array + (hash % has->array_size), &hae->baue, &existing_baue, ps ); - - switch( alr ) - { - case LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY: - if( existing_hae != NULL ) - *existing_hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); - - apr = LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY; - break; - - case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE: - apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE; - break; - - case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS: - apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; - break; - } - - return( apr ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c deleted file mode 100644 index 3e06be3f90..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c +++ /dev/null @@ -1,58 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - - - - - -/****************************************************************************/ -void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ) -{ - LFDS700_PAL_ASSERT( has != NULL ); - LFDS700_PAL_ASSERT( hai != NULL ); - - hai->baus = has->baus_array; - hai->baus_end = has->baus_array + has->array_size; - hai->baue = NULL; - - return; -} - - - - - -/****************************************************************************/ -int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ) -{ - enum lfds700_misc_flag - finished_flag = LFDS700_MISC_FLAG_LOWERED; - - int - rv = 0; - - LFDS700_PAL_ASSERT( hai != NULL ); - LFDS700_PAL_ASSERT( hae != NULL ); - - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( hai->baus, &hai->baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE ); - - if( hai->baue != NULL ) - { - *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *hai->baue ); - finished_flag = LFDS700_MISC_FLAG_RAISED; - rv = 1; - } - - if( hai->baue == NULL ) - if( ++hai->baus == hai->baus_end ) - { - *hae = NULL; - finished_flag = LFDS700_MISC_FLAG_RAISED; - } - } - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c deleted file mode 100644 index 9d89a8838d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c +++ /dev/null @@ -1,112 +0,0 @@ -/***** includes *****/ -#include "lfds700_hash_addonly_internal.h" - -/***** private prototypes *****/ -static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ); - - - - - -/****************************************************************************/ -void lfds700_hash_a_query( struct lfds700_hash_a_state *has, enum lfds700_hash_a_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( has != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: - { - struct lfds700_hash_a_iterate - ai; - - struct lfds700_hash_a_element - *hae; - - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - lfds700_hash_a_iterate_init( has, &ai ); - - while( lfds700_hash_a_iterate(&ai, &hae) ) - ( *(lfds700_pal_uint_t *) query_output )++; - } - break; - - case LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE: - // TRD: query_input can be any value in its range - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_hash_a_internal_validate( has, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ) -{ - lfds700_pal_uint_t - lfds700_hash_a_total_number_elements = 0, - lfds700_btree_au_total_number_elements = 0, - number_elements; - - lfds700_pal_uint_t - loop; - - LFDS700_PAL_ASSERT( has!= NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_hash_a_validity != NULL ); - - /* TRD : validate every btree_addonly_unbalanced in the addonly_hash - sum elements in each btree_addonly_unbalanced - check matches expected element counts (if vi is provided) - */ - - *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_VALID; - - for( loop = 0 ; *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and loop < has->array_size ; loop++ ) - lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, NULL, (void *) lfds700_hash_a_validity ); - - if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID ) - { - for( loop = 0 ; loop < has->array_size ; loop++ ) - { - lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); - lfds700_btree_au_total_number_elements += number_elements; - } - - // TRD : first, check btree_addonly_unbalanced total vs the addonly_hash total - lfds700_hash_a_query( has, LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &lfds700_hash_a_total_number_elements ); - - // TRD : the btree_addonly_unbalanceds are assumed to speak the truth - if( lfds700_hash_a_total_number_elements < lfds700_btree_au_total_number_elements ) - *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( lfds700_hash_a_total_number_elements > lfds700_btree_au_total_number_elements ) - *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - // TRD : second, if we're still valid and vi is provided, check the btree_addonly_unbalanced total against vi - if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - if( lfds700_btree_au_total_number_elements < vi->min_elements ) - *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( lfds700_btree_au_total_number_elements > vi->max_elements ) - *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c deleted file mode 100644 index 580fa9b3ac..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c +++ /dev/null @@ -1,37 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_ordered_singlylinked_internal.h" - - - - - -/****************************************************************************/ -void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, - void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ) -{ - struct lfds700_list_aos_element - *laose, - *temp; - - LFDS700_PAL_ASSERT( laoss != NULL ); - // TRD : element_cleanup_callback can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( element_cleanup_callback == NULL ) - return; - - laose = LFDS700_LIST_AOS_GET_START( *laoss ); - - while( laose != NULL ) - { - temp = laose; - - laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); - - element_cleanup_callback( laoss, temp ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c deleted file mode 100644 index 9d4cab5e53..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c +++ /dev/null @@ -1,29 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_ordered_singlylinked_internal.h" - - - - - -/****************************************************************************/ -int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, - void *key, - struct lfds700_list_aos_element **laose ) -{ - int - cr = !0, - rv = 1; - - LFDS700_PAL_ASSERT( laoss != NULL ); - LFDS700_PAL_ASSERT( key != NULL ); - LFDS700_PAL_ASSERT( laose != NULL ); - - while( cr != 0 and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, *laose) ) - cr = laoss->key_compare_function( key, (*laose)->key ); - - if( *laose == NULL ) - rv = 0; - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c deleted file mode 100644 index 4c92835ce5..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c +++ /dev/null @@ -1,37 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_ordered_singlylinked_internal.h" - - - - - -/****************************************************************************/ -void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, - int (*key_compare_function)(void const *new_key, void const *existing_key), - enum lfds700_list_aos_existing_key existing_key, - void *user_state ) -{ - LFDS700_PAL_ASSERT( laoss != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( key_compare_function != NULL ); - // TRD : existing_key can be any value in its range - // TRD : user_state can be NULL - - // TRD : dummy start element - makes code easier when you can always use ->next - laoss->start = &laoss->dummy_element; - - laoss->start->next = NULL; - laoss->start->value = NULL; - laoss->key_compare_function = key_compare_function; - laoss->existing_key = existing_key; - laoss->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c deleted file mode 100644 index 9beead4e1d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c +++ /dev/null @@ -1,134 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_ordered_singlylinked_internal.h" - - - - - -/****************************************************************************/ -enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, - struct lfds700_list_aos_element *laose, - struct lfds700_list_aos_element **existing_laose, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - enum lfds700_misc_flag - finished_flag = LFDS700_MISC_FLAG_LOWERED; - - int - compare_result = 0; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_list_aos_element - *volatile laose_temp = NULL, - *volatile laose_trailing; - - LFDS700_PAL_ASSERT( laoss != NULL ); - LFDS700_PAL_ASSERT( laose != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : existing_laose can be NULL - LFDS700_PAL_ASSERT( ps != NULL ); - - /* TRD : imagine a list, sorted small to large - - we arrive at an element - we obtain its next pointer - we check we are greater than the current element and smaller than the next element - this means we have found the correct location to insert - we try to CAS ourselves in; in the meantime, - someone else has *aready* swapped in an element which is smaller than we are - - e.g. - - the list is { 1, 10 } and we are the value 5 - - we arrive at 1; we check the next element and see it is 10 - so we are larger than the current element and smaller than the next - we are in the correct location to insert and we go to insert... - - in the meantime, someone else with the value 3 comes along - he too finds this is the correct location and inserts before we do - the list is now { 1, 3, 10 } and we are trying to insert now after - 1 and before 3! - - our insert CAS fails, because the next pointer of 1 has changed aready; - but we see we are in the wrong location - we need to move forward an - element - */ - - LFDS700_MISC_BARRIER_LOAD; - - /* TRD : we need to begin with the leading dummy element - as the element to be inserted - may be smaller than all elements in the list - */ - - laose_trailing = laoss->start; - laose_temp = laoss->start->next; - - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - if( laose_temp == NULL ) - compare_result = -1; - - if( laose_temp != NULL ) - { - LFDS700_MISC_BARRIER_LOAD; - compare_result = laoss->key_compare_function( laose->key, laose_temp->key ); - } - - if( compare_result == 0 ) - { - if( existing_laose != NULL ) - *existing_laose = laose_temp; - - switch( laoss->existing_key ) - { - case LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE: - LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( *laose_temp, laose->value ); - return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE ); - break; - - case LFDS700_LIST_AOS_EXISTING_KEY_FAIL: - return( LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY ); - break; - } - - finished_flag = LFDS700_MISC_FLAG_RAISED; - } - - if( compare_result < 0 ) - { - laose->next = laose_temp; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &laose_trailing->next, &laose->next, laose, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - - if( result == 1 ) - finished_flag = LFDS700_MISC_FLAG_RAISED; - else - // TRD : if we fail to link, someone else has linked and so we need to redetermine our position is correct - laose_temp = laose_trailing->next; - } - - if( compare_result > 0 ) - { - // TRD : move trailing along by one element - laose_trailing = laose_trailing->next; - - /* TRD : set temp as the element after trailing - if the new element we're linking is larger than all elements in the list, - laose_temp will now go to NULL and we'll link at the end - */ - laose_temp = laose_trailing->next; - } - } - - return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c deleted file mode 100644 index a1d990ab79..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c +++ /dev/null @@ -1,121 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_ordered_singlylinked_internal.h" - -/***** private prototypes *****/ -static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ); - - - - - -/****************************************************************************/ -void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, enum lfds700_list_aos_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( laoss != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: - { - struct lfds700_list_aos_element - *laose = NULL; - - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - while( LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, laose) ) - ( *(lfds700_pal_uint_t *) query_output )++; - } - break; - - case LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_list_aos_internal_validate( laoss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - - -/****************************************************************************/ -static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ) -{ - lfds700_pal_uint_t - number_elements = 0; - - struct lfds700_list_aos_element - *laose_fast, - *laose_slow; - - LFDS700_PAL_ASSERT( laoss!= NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_list_aos_validity != NULL ); - - *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_VALID; - - laose_slow = laose_fast = laoss->start->next; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the start of the list - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the queue) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( laose_slow != NULL ) - do - { - laose_slow = laose_slow->next; - - if( laose_fast != NULL ) - laose_fast = laose_fast->next; - - if( laose_fast != NULL ) - laose_fast = laose_fast->next; - } - while( laose_slow != NULL and laose_fast != laose_slow ); - - if( laose_fast != NULL and laose_slow != NULL and laose_fast == laose_slow ) - *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_list_aos_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_list_aos_query( laoss, LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c deleted file mode 100644 index ef19ce1f86..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c +++ /dev/null @@ -1,37 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_singlylinked_unordered_internal.h" - - - - - -/****************************************************************************/ -void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, - void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ) -{ - struct lfds700_list_asu_element - *lasue, - *temp; - - LFDS700_PAL_ASSERT( lasus != NULL ); - // TRD : element_cleanup_callback can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( element_cleanup_callback == NULL ) - return; - - lasue = LFDS700_LIST_ASU_GET_START( *lasus ); - - while( lasue != NULL ) - { - temp = lasue; - - lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); - - element_cleanup_callback( lasus, temp ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c deleted file mode 100644 index ae99ebfca4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c +++ /dev/null @@ -1,29 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_singlylinked_unordered_internal.h" - - - - - -/****************************************************************************/ -int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, - void *key, - struct lfds700_list_asu_element **lasue ) -{ - int - cr = !0, - rv = 1; - - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( key != NULL ); - LFDS700_PAL_ASSERT( lasue != NULL ); - - while( cr != 0 and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, *lasue) ) - cr = lasus->key_compare_function( key, (*lasue)->key ); - - if( *lasue == NULL ) - rv = 0; - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c deleted file mode 100644 index 78b0d8eae6..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c +++ /dev/null @@ -1,35 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_singlylinked_unordered_internal.h" - - - - - -/****************************************************************************/ -void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, - int (*key_compare_function)(void const *new_key, void const *existing_key), - void *user_state ) -{ - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->end % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : key_compare_function can be NULL - // TRD : user_state can be NULL - - // TRD : dummy start element - makes code easier when you can always use ->next - lasus->start = lasus->end = &lasus->dummy_element; - - lasus->start->next = NULL; - lasus->start->value = NULL; - lasus->key_compare_function = key_compare_function; - lasus->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c deleted file mode 100644 index 86472b004e..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c +++ /dev/null @@ -1,191 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_singlylinked_unordered_internal.h" - - - - - -/****************************************************************************/ -void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_list_asu_element *lasue_predecessor, - enum lfds700_list_asu_position position, - struct lfds700_misc_prng_state *ps ) -{ - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( lasue != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : lasue_predecessor asserted in the switch - // TRD : position can be any value in its range - LFDS700_PAL_ASSERT( ps != NULL ); - - switch( position ) - { - case LFDS700_LIST_ASU_POSITION_START: - lfds700_list_asu_insert_at_start( lasus, lasue, ps ); - break; - - case LFDS700_LIST_ASU_POSITION_END: - lfds700_list_asu_insert_at_end( lasus, lasue, ps ); - break; - - case LFDS700_LIST_ASU_POSITION_AFTER: - lfds700_list_asu_insert_after_element( lasus, lasue, lasue_predecessor, ps ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( lasue != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( ps != NULL ); - - LFDS700_MISC_BARRIER_LOAD; - - lasue->next = lasus->start->next; - - do - { - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasus->start->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - while( result != 1 ); - - return; -} - - - - - -/****************************************************************************/ -void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - enum lfds700_misc_flag - finished_flag = LFDS700_MISC_FLAG_LOWERED; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) - *compare; - - struct lfds700_list_asu_element - *volatile lasue_next, - *volatile lasue_end; - - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( lasue != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( ps != NULL ); - - /* TRD : begin by assuming end is correctly pointing to the final element - try to link (comparing for next being NULL) - if we fail, move down list till we find last element - and retry - when successful, update end to ourselves - - note there's a leading dummy element - so lasus->end always points to an element - */ - - LFDS700_MISC_BARRIER_LOAD; - - lasue->next = NULL; - lasue_end = lasus->end; - - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) - { - compare = NULL; - - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_end->next, &compare, lasue, LFDS700_MISC_CAS_STRENGTH_STRONG, result, backoff_iteration, ps ); - - if( result == 1 ) - finished_flag = LFDS700_MISC_FLAG_RAISED; - else - { - lasue_end = compare; - lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); - - while( lasue_next != NULL ) - { - lasue_end = lasue_next; - lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); - } - } - } - - lasus->end = lasue; - - return; -} - - - - - -/****************************************************************************/ - -void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, - struct lfds700_list_asu_element *lasue, - struct lfds700_list_asu_element *lasue_predecessor, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - LFDS700_PAL_ASSERT( lasus != NULL ); - LFDS700_PAL_ASSERT( lasue != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( lasue_predecessor != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - LFDS700_MISC_BARRIER_LOAD; - - lasue->next = lasue_predecessor->next; - - do - { - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_predecessor->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - while( result != 1 ); - - return; -} - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c deleted file mode 100644 index 0adf5a8032..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c +++ /dev/null @@ -1,121 +0,0 @@ -/***** includes *****/ -#include "lfds700_list_addonly_singlylinked_unordered_internal.h" - -/***** private prototypes *****/ -static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ); - - - - - -/****************************************************************************/ -void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, enum lfds700_list_asu_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( lasus != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: - { - struct lfds700_list_asu_element - *lasue = NULL; - - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, lasue) ) - ( *(lfds700_pal_uint_t *) query_output )++; - } - break; - - case LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_list_asu_internal_validate( lasus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - - -/****************************************************************************/ -static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ) -{ - lfds700_pal_uint_t - number_elements = 0; - - struct lfds700_list_asu_element - *lasue_fast, - *lasue_slow; - - LFDS700_PAL_ASSERT( lasus!= NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_list_asu_validity != NULL ); - - *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_VALID; - - lasue_slow = lasue_fast = lasus->start->next; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the start of the list - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the queue) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( lasue_slow != NULL ) - do - { - lasue_slow = lasue_slow->next; - - if( lasue_fast != NULL ) - lasue_fast = lasue_fast->next; - - if( lasue_fast != NULL ) - lasue_fast = lasue_fast->next; - } - while( lasue_slow != NULL and lasue_fast != lasue_slow ); - - if( lasue_fast != NULL and lasue_slow != NULL and lasue_fast == lasue_slow ) - *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_list_asu_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_list_asu_query( lasus, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c deleted file mode 100644 index d93c95db0f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c +++ /dev/null @@ -1,15 +0,0 @@ -/***** includes *****/ -#include "lfds700_misc_internal.h" - - - - - -/****************************************************************************/ -void lfds700_misc_library_cleanup( void ) -{ - // TRD : we do nuuuuuuthin' - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c deleted file mode 100644 index af2826675a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c +++ /dev/null @@ -1,11 +0,0 @@ -/***** includes *****/ -#include "lfds700_misc_internal.h" - - - - - -/****************************************************************************/ -struct lfds700_misc_globals - lfds700_misc_globals; - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c deleted file mode 100644 index 32685077bf..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c +++ /dev/null @@ -1,53 +0,0 @@ -/***** includes *****/ -#include "lfds700_misc_internal.h" - - - - - -/****************************************************************************/ -void lfds700_misc_library_init_valid_on_current_logical_core() -{ - /* TRD : the PRNG arrangement is that each thread has its own state, for a maximum-speed PRNG, where output - quality is second consideration to performance - - on 64-bit platforms this is xorshift64*, on 32-bit platforms, an unadorned xorshift32 - - the seed for each thread however comes from a single, global, maximum-quality PRNG, where quality of - output is the primary consideration - - for this, I'm using a xorshift1024* - - since the generation from this global PRNG state is not thread safe, but is still quick in - thread start-up terms, I run a little spin-lock around it - - regarding the seed for this high quality PRNG; it is customary to use time(), but this has a number of - drawbacks; - - 1. liblfds would depend on time() (currently it does not depend on a hosted implementation of standard library) - 2. the output from time may only be 32 bit, and even when it isn't, the top 32 bits are currently all zero... - 3. many threads can begin in the same second; I'd need to add in their thread number, - which means I'd need to *get* their thread number... - - as such, I've decided to use a *fixed* 64-bit seed for the high-quality PRNG; this seed is run - through the MurmerHash3 avalanche phase to generate successive 64-bit values, which populate - the 1024 state of xorshift1024* - - if you have access to a high-frequency clock (often 64-bit), you can use this for the seed - (don't use it for the per-thread PRNG, unless you know the clock can be read without a context switch) - - murmurhash3 code from here; http://xorshift.di.unimi.it/murmurhash3.c - */ - - lfds700_misc_prng_internal_big_slow_high_quality_init( LFDS700_MISC_PRNG_SEED ); - - lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS; - lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h deleted file mode 100644 index 9ed927efc9..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h +++ /dev/null @@ -1,10 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** defines *****/ -#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS 8 -#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS 16 - -/***** private prototypes *****/ -void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c deleted file mode 100644 index 84ae25fe71..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c +++ /dev/null @@ -1,144 +0,0 @@ -/***** includes *****/ -#include "lfds700_misc_internal.h" - -/***** defines *****/ -#define LFDS700_PRNG_STATE_SIZE 16 - -/***** struct *****/ -struct lfds700_misc_prng_big_slow_high_quality_state -{ - lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - xorshift1024star_spinlock; - - // TRD : must be a 32 bit signed int - int - xorshift1024star_index; - - int long long unsigned - xorshift1024star_state[LFDS700_PRNG_STATE_SIZE]; -}; - -/***** locals *****/ -struct lfds700_misc_prng_big_slow_high_quality_state - pbshqs; - -/***** private prototypes *****/ -static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ); -static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ); - - - - - -/****************************************************************************/ -void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ) -{ - LFDS700_PAL_ASSERT( ps != NULL ); - - /* TRD : we use the big, slow, high quality PRNG to generate the initial value - for the small, fast, low qulity PRNG, which is used in exponential backoff - - we need the load barrier to catch any changes to the backoff periods - */ - - lfds700_misc_prng_internal_big_slow_high_quality_generate( &pbshqs, &ps->prng_state ); - - LFDS700_MISC_BARRIER_LOAD; - - ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; - ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; - - return; -} - - - - - -/****************************************************************************/ -void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ) -{ - lfds700_pal_uint_t - loop; - - LFDS700_PAL_ASSERT( seed != 0 ); // TRD : a 0 seed causes all zeros in the entropy state, so is forbidden - - pbshqs.xorshift1024star_spinlock = LFDS700_MISC_FLAG_LOWERED; - - for( loop = 0 ; loop < LFDS700_PRNG_STATE_SIZE ; loop++ ) - { - lfds700_misc_prng_internal_hash_murmurhash3( &seed ); - pbshqs.xorshift1024star_state[loop] = seed; - } - - pbshqs.xorshift1024star_index = 0; - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ) -{ - LFDS700_PAL_ASSERT( murmurhash3_state != NULL ); - - *murmurhash3_state ^= *murmurhash3_state >> 33; - *murmurhash3_state *= 0xff51afd7ed558ccdULL; - *murmurhash3_state ^= *murmurhash3_state >> 33; - *murmurhash3_state *= 0xc4ceb9fe1a85ec53ULL; - *murmurhash3_state ^= *murmurhash3_state >> 33; - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ) -{ - char unsigned - result; - - int long long unsigned - xs_temp_one, - xs_temp_two; - - lfds700_pal_atom_t - compare = LFDS700_MISC_FLAG_LOWERED, - exchange = LFDS700_MISC_FLAG_LOWERED; - - LFDS700_PAL_ASSERT( ps != NULL ); - LFDS700_PAL_ASSERT( random_value != NULL ); - - // TRD : this is single-threaded code, on a per-state basis - do - { - compare = LFDS700_MISC_FLAG_LOWERED; - LFDS700_PAL_ATOMIC_CAS( &ps->xorshift1024star_spinlock, &compare, (lfds700_pal_atom_t) LFDS700_MISC_FLAG_RAISED, LFDS700_MISC_CAS_STRENGTH_STRONG, result ); - } - while( result == 0 ); - - // TRD : xorshift1024* code from here; http://xorshift.di.unimi.it/xorshift1024star.c - - xs_temp_one = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; - ps->xorshift1024star_index = ( ps->xorshift1024star_index + 1 ) & 15; - xs_temp_two = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; - - xs_temp_two ^= xs_temp_two << 31; - xs_temp_two ^= xs_temp_two >> 11; - xs_temp_one ^= xs_temp_one >> 30; - - ps->xorshift1024star_state[ ps->xorshift1024star_index ] = xs_temp_one ^ xs_temp_two; - - *random_value = (lfds700_pal_uint_t) ( ps->xorshift1024star_state[ ps->xorshift1024star_index ] * 1181783497276652981LL ); - - LFDS700_PAL_ATOMIC_EXCHANGE( &ps->xorshift1024star_spinlock, &exchange ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c deleted file mode 100644 index fd3595d86a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c +++ /dev/null @@ -1,48 +0,0 @@ -/***** includes *****/ -#include "lfds700_misc_internal.h" - - - - - -/****************************************************************************/ -void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ) -{ - // TRD : query type can be any value in its range - // TRD : query_input can be NULL in some cases - // TRD : query_outputput can be NULL in some cases - - switch( query_type ) - { - case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: - *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; - break; - - case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: - LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas, (lfds700_pal_atom_t *) query_input ); - break; - - case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: - *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; - break; - - case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: - LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas, (lfds700_pal_atom_t *) query_input ); - break; - - case LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING: - { - char static const - * const build_and_version_string = "liblfds " LFDS700_MISC_VERSION_STRING " (" BUILD_TYPE_STRING ", " LFDS700_PAL_OS_STRING ", " MODE_TYPE_STRING ", " LFDS700_PAL_PROCESSOR_STRING ", " LFDS700_PAL_COMPILER_STRING ")"; - - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(char const **) query_output = build_and_version_string; - } - break; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c deleted file mode 100644 index f2da905dbe..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c +++ /dev/null @@ -1,48 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_internal.h" - - - - - -/****************************************************************************/ -void lfds700_queue_cleanup( struct lfds700_queue_state *qs, - void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ) -{ - struct lfds700_queue_element - *qe; - - void - *value; - - LFDS700_PAL_ASSERT( qs != NULL ); - // TRD : element_cleanup_callback can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( element_cleanup_callback != NULL ) - { - while( qs->dequeue[POINTER] != qs->enqueue[POINTER] ) - { - // TRD : trailing dummy element, so the first real value is in the next element - value = qs->dequeue[POINTER]->next[POINTER]->value; - - // TRD : user is given back *an* element, but not the one his user data was in - qe = qs->dequeue[POINTER]; - - // TRD : remove the element from queue - qs->dequeue[POINTER] = qs->dequeue[POINTER]->next[POINTER]; - - // TRD : write value into the qe we're going to give the user - qe->value = value; - - element_cleanup_callback( qs, qe, LFDS700_MISC_FLAG_LOWERED ); - } - - // TRD : and now the final element - element_cleanup_callback( qs, (struct lfds700_queue_element *) qs->dequeue[POINTER], LFDS700_MISC_FLAG_RAISED ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c deleted file mode 100644 index 853c585039..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c +++ /dev/null @@ -1,109 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_internal.h" - - - - - -/****************************************************************************/ -int lfds700_queue_dequeue( struct lfds700_queue_state *qs, - struct lfds700_queue_element **qe, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result = 0, - unwanted_result; - - enum lfds700_queue_queue_state - state = LFDS700_QUEUE_QUEUE_STATE_UNKNOWN; - - int - rv = 1, - finished_flag = LFDS700_MISC_FLAG_LOWERED; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *dequeue[PAC_SIZE], - *enqueue[PAC_SIZE], - *next[PAC_SIZE]; - - void - *key = NULL, - *value = NULL; - - LFDS700_PAL_ASSERT( qs != NULL ); - LFDS700_PAL_ASSERT( qe != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - LFDS700_MISC_BARRIER_LOAD; - - do - { - dequeue[COUNTER] = qs->dequeue[COUNTER]; - dequeue[POINTER] = qs->dequeue[POINTER]; - - enqueue[COUNTER] = qs->enqueue[COUNTER]; - enqueue[POINTER] = qs->enqueue[POINTER]; - - next[COUNTER] = qs->dequeue[POINTER]->next[COUNTER]; - next[POINTER] = qs->dequeue[POINTER]->next[POINTER]; - - LFDS700_MISC_BARRIER_LOAD; - - if( dequeue[COUNTER] == qs->dequeue[COUNTER] and dequeue[POINTER] == qs->dequeue[POINTER] ) - { - if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] == NULL ) - state = LFDS700_QUEUE_QUEUE_STATE_EMPTY; - - if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] != NULL ) - state = LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE; - - if( enqueue[POINTER] != dequeue[POINTER] ) - state = LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE; - - switch( state ) - { - case LFDS700_QUEUE_QUEUE_STATE_UNKNOWN: - // TRD : eliminates compiler warning - break; - - case LFDS700_QUEUE_QUEUE_STATE_EMPTY: - rv = 0; - *qe = NULL; - finished_flag = LFDS700_MISC_FLAG_RAISED; - break; - - case LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE: - next[COUNTER] = enqueue[COUNTER] + 1; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); - break; - - case LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE: - key = next[POINTER]->key; - value = next[POINTER]->value; - - next[COUNTER] = dequeue[COUNTER] + 1; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( qs->dequeue, dequeue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - - if( result == 1 ) - finished_flag = LFDS700_MISC_FLAG_RAISED; - break; - } - } - } - while( finished_flag == LFDS700_MISC_FLAG_LOWERED ); - - if( result == 1 ) - { - *qe = dequeue[POINTER]; - (*qe)->key = key; - (*qe)->value = value; - } - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c deleted file mode 100644 index 07df84d851..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c +++ /dev/null @@ -1,74 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_internal.h" - - - - - -/****************************************************************************/ -void lfds700_queue_enqueue( struct lfds700_queue_state *qs, - struct lfds700_queue_element *qe, - struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result = 0, - unwanted_result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *volatile enqueue[PAC_SIZE], - *new_enqueue[PAC_SIZE], - *volatile next[PAC_SIZE]; - - LFDS700_PAL_ASSERT( qs != NULL ); - LFDS700_PAL_ASSERT( qe != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( ps != NULL ); - - qe->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); - qe->next[POINTER] = NULL; - - new_enqueue[POINTER] = qe; - - LFDS700_MISC_BARRIER_LOAD; - - do - { - enqueue[COUNTER] = qs->enqueue[COUNTER]; - enqueue[POINTER] = qs->enqueue[POINTER]; - - next[COUNTER] = qs->enqueue[POINTER]->next[COUNTER]; - next[POINTER] = qs->enqueue[POINTER]->next[POINTER]; - - LFDS700_MISC_BARRIER_LOAD; - - if( qs->enqueue[COUNTER] == enqueue[COUNTER] and qs->enqueue[POINTER] == enqueue[POINTER] ) - { - if( next[POINTER] == NULL ) - { - new_enqueue[COUNTER] = next[COUNTER] + 1; - LFDS700_MISC_BARRIER_STORE; - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( enqueue[POINTER]->next, next, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - else - { - next[COUNTER] = enqueue[COUNTER] + 1; - LFDS700_MISC_BARRIER_STORE; - // TRD : strictly, this is a weak CAS, but we do an extra iteration of the main loop on a fake failure, so we set it to be strong - LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_STRONG, unwanted_result ); - } - } - } - while( result != 1 ); - - new_enqueue[COUNTER] = enqueue[COUNTER] + 1; - LFDS700_MISC_BARRIER_STORE; - // TRD : move enqueue along; only a weak CAS as the dequeue will solve this if its out of place - LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c deleted file mode 100644 index 15f4e64d8d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c +++ /dev/null @@ -1,43 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_internal.h" - - - - - -/****************************************************************************/ -void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe_dummy, struct lfds700_misc_prng_state *ps, void *user_state ) -{ - LFDS700_PAL_ASSERT( qs != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->enqueue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->dequeue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( qe_dummy != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe_dummy->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe_dummy->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( ps != NULL ); - // TRD : user_state can be UNLL - - /* TRD : qe_dummy is a dummy element, needed for init - the qs->enqueue and qs->dequeue counters do not need to be initialized - but it does no harm to do so, and stops a valgrind complaint - */ - - qs->enqueue[POINTER] = qe_dummy; - qs->enqueue[COUNTER] = (struct lfds700_queue_element *) 0; - qs->dequeue[POINTER] = qe_dummy; - qs->dequeue[COUNTER] = (struct lfds700_queue_element *) 0; - - qe_dummy->next[POINTER] = NULL; - qe_dummy->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); - qe_dummy->value = NULL; - - qs->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h deleted file mode 100644 index 81c9b69f48..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h +++ /dev/null @@ -1,14 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** enums *****/ -enum lfds700_queue_queue_state -{ - LFDS700_QUEUE_QUEUE_STATE_UNKNOWN, - LFDS700_QUEUE_QUEUE_STATE_EMPTY, - LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE, - LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE -}; - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c deleted file mode 100644 index 15b4307ff2..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c +++ /dev/null @@ -1,126 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_internal.h" - -/***** private prototypes *****/ -static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ); - - - - - -/****************************************************************************/ -void lfds700_queue_query( struct lfds700_queue_state *qs, enum lfds700_queue_query query_type, void *query_input, void *query_output ) -{ - struct lfds700_queue_element - *qe; - - LFDS700_MISC_BARRIER_LOAD; - - LFDS700_PAL_ASSERT( qs != NULL ); - // TRD : query_type can be any value in its range - - switch( query_type ) - { - case LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT: - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - qe = (struct lfds700_queue_element *) qs->dequeue[POINTER]; - - while( qe != NULL ) - { - ( *(lfds700_pal_uint_t *) query_output )++; - qe = (struct lfds700_queue_element *) qe->next[POINTER]; - } - - // TRD : remember there is a dummy element in the queue - ( *(lfds700_pal_uint_t *) query_output )--; - break; - - case LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_queue_internal_validate( qs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ) -{ - lfds700_pal_uint_t - number_elements = 0; - - struct lfds700_queue_element - *qe_fast, - *qe_slow; - - LFDS700_PAL_ASSERT( qs != NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); - - *lfds700_queue_validity = LFDS700_MISC_VALIDITY_VALID; - - qe_slow = qe_fast = (struct lfds700_queue_element *) qs->dequeue[POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the dequeue end of the queue - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the queue) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( qe_slow != NULL ) - do - { - qe_slow = qe_slow->next[POINTER]; - - if( qe_fast != NULL ) - qe_fast = qe_fast->next[POINTER]; - - if( qe_fast != NULL ) - qe_fast = qe_fast->next[POINTER]; - } - while( qe_slow != NULL and qe_fast != qe_slow ); - - if( qe_fast != NULL and qe_slow != NULL and qe_fast == qe_slow ) - *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_queue_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_queue_query( qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c deleted file mode 100644 index 2b157bd973..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c +++ /dev/null @@ -1,30 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" - - - - - -/****************************************************************************/ -void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, - void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ) -{ - int long long unsigned - loop; - - struct lfds700_queue_bss_element - *qbsse; - - LFDS700_PAL_ASSERT( qbsss != NULL ); - // TRD : element_cleanup_callback can be NULL - - if( element_cleanup_callback != NULL ) - for( loop = qbsss->read_index ; loop < qbsss->read_index + qbsss->number_elements ; loop++ ) - { - qbsse = qbsss->element_array + (loop % qbsss->number_elements); - element_cleanup_callback( qbsss, qbsse->key, qbsse->value ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c deleted file mode 100644 index 28f735f610..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c +++ /dev/null @@ -1,42 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" - - - - - -/****************************************************************************/ -int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, void **key, void **value ) -{ - int - rv = 0; - - struct lfds700_queue_bss_element - *qbsse; - - LFDS700_PAL_ASSERT( qbsss != NULL ); - // TRD : key can be NULL - // TRD : value can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( qbsss->read_index != qbsss->write_index ) - { - qbsse = qbsss->element_array + qbsss->read_index; - - if( key != NULL ) - *key = qbsse->key; - - if( value != NULL ) - *value = qbsse->value; - - qbsss->read_index = (qbsss->read_index + 1) & qbsss->mask; - - LFDS700_MISC_BARRIER_STORE; - - rv = 1; - } - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c deleted file mode 100644 index c74091a23e..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c +++ /dev/null @@ -1,39 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" - - - - - -/****************************************************************************/ -int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, void *key, void *value ) -{ - int - rv = 0; - - struct lfds700_queue_bss_element - *qbsse; - - LFDS700_PAL_ASSERT( qbsss != NULL ); - // TRD : key can be NULL - // TRD : value can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( ( (qbsss->write_index+1) & qbsss->mask ) != qbsss->read_index ) - { - qbsse = qbsss->element_array + qbsss->write_index; - - qbsse->key = key; - qbsse->value = value; - - LFDS700_MISC_BARRIER_STORE; - - qbsss->write_index = (qbsss->write_index + 1) & qbsss->mask; - - rv = 1; - } - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c deleted file mode 100644 index 9127fef443..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c +++ /dev/null @@ -1,63 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" - - - - - -/****************************************************************************/ -void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, - struct lfds700_queue_bss_element *element_array, - lfds700_pal_uint_t number_elements, - void *user_state ) -{ - LFDS700_PAL_ASSERT( qbsss != NULL ); - LFDS700_PAL_ASSERT( element_array != NULL ); - LFDS700_PAL_ASSERT( number_elements >= 2 ); - LFDS700_PAL_ASSERT( ( number_elements & (number_elements-1) ) == 0 ); // TRD : number_elements must be a positive integer power of 2 - // TRD : user_state can be NULL - - /* TRD : the use of mask and the restriction on a power of two - upon the number of elements bears some remark - - in this queue, there are a fixed number of elements - we have a read index and a write index - when we write, and thre is space to write, we increment the write index - (if no space to write, we just return) - when we read, and there are elements to be read, we after reading increment the read index - (if no elements to read, we just return) - the problem is - how do we handle wrap around? - e.g. when I write, but my write index is now equal to the number of elements - the usual solution is to modulus the write index by the nunmber of elements - problem is modulus is slow - there is a better way - first, we restrict the number of elements to be a power of two - so imagine we have a 64-bit system and we set the number of elements to be 2^64 - this gives us a bit pattern of 1000 0000 0000 0000 (...etc, lots of zeros) - now (just roll with this for a bit) subtract one from this - this gives us a mask (on a two's compliment machine) - 0111 1111 1111 1111 (...etc, lots of ones) - so what we do now, when we increment an index (think of the write index as the example) - we bitwise and it with the mask - now think about thwt happens - all the numbers up to 2^64 will be unchanged - their MSB is never set, and we and with all the other bits - but when we finally hit 2^64 and need to roll over... bingo! - we drop MSB (which we finally have) and have the value 0! - this is exactly what we want - bitwise and is much faster than modulus - */ - - qbsss->number_elements = number_elements; - qbsss->mask = qbsss->number_elements - 1; - qbsss->read_index = 0; - qbsss->write_index = 0; - qbsss->element_array = element_array; - qbsss->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c deleted file mode 100644 index aabcae23f3..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c +++ /dev/null @@ -1,70 +0,0 @@ -/***** includes *****/ -#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" - -/***** private prototypes *****/ -static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ); - - - - - -/****************************************************************************/ -void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, enum lfds700_queue_bss_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( qbsss != NULL ); - // TRD : query_type can be any value in its range - - switch( query_type ) - { - case LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - LFDS700_MISC_BARRIER_LOAD; - - *(lfds700_pal_uint_t *) query_output = +( qbsss->write_index - qbsss->read_index ); - if( qbsss->read_index > qbsss->write_index ) - *(lfds700_pal_uint_t *) query_output = qbsss->number_elements - *(lfds700_pal_uint_t *) query_output; - break; - - case LFDS700_QUEUE_BSS_QUERY_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_queue_bss_internal_validate( qbsss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ) -{ - LFDS700_PAL_ASSERT( qbsss != NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_validity != NULL ); - - *lfds700_validity = LFDS700_MISC_VALIDITY_VALID; - - if( vi != NULL ) - { - lfds700_pal_uint_t - number_elements; - - lfds700_queue_bss_query( qbsss, LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c deleted file mode 100644 index 11852859e8..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c +++ /dev/null @@ -1,81 +0,0 @@ -/***** includes *****/ -#include "lfds700_ringbuffer_internal.h" - -/***** private prototypes *****/ -static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); -static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ); - - - - - -/****************************************************************************/ -void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, - void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ) -{ - LFDS700_PAL_ASSERT( rs != NULL ); - // TRD : element_cleanup_callback can be NULL - - if( element_cleanup_callback != NULL ) - { - rs->element_cleanup_callback = element_cleanup_callback; - lfds700_queue_cleanup( &rs->qs, lfds700_ringbuffer_internal_queue_element_cleanup_callback ); - lfds700_freelist_cleanup( &rs->fs, lfds700_ringbuffer_internal_freelist_element_cleanup_callback ); - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) -{ - struct lfds700_ringbuffer_element - *re; - - struct lfds700_ringbuffer_state - *rs; - - LFDS700_PAL_ASSERT( qs != NULL ); - LFDS700_PAL_ASSERT( qe != NULL ); - // TRD : dummy_element can be any value in its range - - rs = (struct lfds700_ringbuffer_state *) LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( *qs ); - re = (struct lfds700_ringbuffer_element *) LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - if( dummy_element_flag == LFDS700_MISC_FLAG_LOWERED ) - rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_RAISED ); - - return; -} - -//#pragma warning( default : 4100 ) - - -/****************************************************************************/ -//#pragma warning( disable : 4100 ) - -static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ) -{ - struct lfds700_ringbuffer_element - *re; - - struct lfds700_ringbuffer_state - *rs; - - LFDS700_PAL_ASSERT( fs != NULL ); - LFDS700_PAL_ASSERT( fe != NULL ); - - rs = (struct lfds700_ringbuffer_state *) LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( *fs ); - re = (struct lfds700_ringbuffer_element *) LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); - - rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_LOWERED ); - - return; -} - -//#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c deleted file mode 100644 index a6cd1e3616..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c +++ /dev/null @@ -1,51 +0,0 @@ -/***** includes *****/ -#include "lfds700_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, - struct lfds700_ringbuffer_element *re_array_inc_dummy, - lfds700_pal_uint_t number_elements, - struct lfds700_misc_prng_state *ps, - void *user_state ) -{ - lfds700_pal_uint_t - loop; - - LFDS700_PAL_ASSERT( rs != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->fs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->qs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( re_array_inc_dummy != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( number_elements >= 2 ); - LFDS700_PAL_ASSERT( ps != NULL ); - // TRD : user_state can be NULL - - rs->user_state = user_state; - - re_array_inc_dummy[0].qe_use = &re_array_inc_dummy[0].qe; - - lfds700_freelist_init_valid_on_current_logical_core( &rs->fs, rs ); - lfds700_queue_init_valid_on_current_logical_core( &rs->qs, &re_array_inc_dummy[0].qe, ps, rs ); - - for( loop = 1 ; loop < number_elements ; loop++ ) - { - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - - re_array_inc_dummy[loop].qe_use = &re_array_inc_dummy[loop].qe; - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re_array_inc_dummy[loop].fe, &re_array_inc_dummy[loop] ); - lfds700_freelist_push( &rs->fs, &re_array_inc_dummy[loop].fe, ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c deleted file mode 100644 index 58b7b3a9cb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c +++ /dev/null @@ -1,72 +0,0 @@ -/***** includes *****/ -#include "lfds700_ringbuffer_internal.h" - -/***** private prototypes *****/ -static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ); - - - -/****************************************************************************/ -void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, enum lfds700_ringbuffer_query query_type, void *query_input, void *query_output ) -{ - LFDS700_PAL_ASSERT( rs != NULL ); - // TRD : query_type can be any value in its range - - LFDS700_MISC_BARRIER_LOAD; - - switch( query_type ) - { - case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT: - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, query_output ); - break; - - case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_ringbuffer_internal_validate( rs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output, ((enum lfds700_misc_validity *) query_output)+1 ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ) -{ - LFDS700_PAL_ASSERT( rs != NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); - LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); - - if( vi == NULL ) - { - lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_queue_validity ); - lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_freelist_validity ); - } - - if( vi != NULL ) - { - struct lfds700_misc_validation_info - freelist_vi, - queue_vi; - - queue_vi.min_elements = 0; - freelist_vi.min_elements = 0; - queue_vi.max_elements = vi->max_elements; - freelist_vi.max_elements = vi->max_elements; - - lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &queue_vi, lfds700_queue_validity ); - lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &freelist_vi, lfds700_freelist_validity ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c deleted file mode 100644 index 42dbe189e2..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c +++ /dev/null @@ -1,44 +0,0 @@ -/***** includes *****/ -#include "lfds700_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, - void **key, - void **value, - struct lfds700_misc_prng_state *ps ) -{ - int - rv; - - struct lfds700_queue_element - *qe; - - struct lfds700_ringbuffer_element - *re; - - LFDS700_PAL_ASSERT( rs != NULL ); - // TRD : key can be NULL - // TRD : value can be NULL - LFDS700_PAL_ASSERT( ps != NULL ); - - rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); - - if( rv == 1 ) - { - re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - re->qe_use = (struct lfds700_queue_element *) qe; - if( key != NULL ) - *key = re->key; - if( value != NULL ) - *value = re->value; - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re->fe, re ); - lfds700_freelist_push( &rs->fs, &re->fe, ps ); - } - - return( rv ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c deleted file mode 100644 index a16a8686c1..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c +++ /dev/null @@ -1,78 +0,0 @@ -/***** includes *****/ -#include "lfds700_ringbuffer_internal.h" - - - - - -/****************************************************************************/ -void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, - void *key, - void *value, - enum lfds700_misc_flag *overwrite_occurred_flag, - void **overwritten_key, - void **overwritten_value, - struct lfds700_misc_prng_state *ps ) -{ - int - rv = 0; - - struct lfds700_freelist_element - *fe; - - struct lfds700_queue_element - *qe; - - struct lfds700_ringbuffer_element - *re = NULL; - - LFDS700_PAL_ASSERT( rs != NULL ); - // TRD : key can be NULL - // TRD : value can be NULL - // TRD : overwrite_occurred_flag can be NULL - // TRD : overwritten_key can be NULL - // TRD : overwritten_value can be NULL - LFDS700_PAL_ASSERT( ps != NULL ); - - if( overwrite_occurred_flag != NULL ) - *overwrite_occurred_flag = LFDS700_MISC_FLAG_LOWERED; - - do - { - rv = lfds700_freelist_pop( &rs->fs, &fe, ps ); - - if( rv == 1 ) - re = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); - - if( rv == 0 ) - { - // TRD : the queue can return empty as well - remember, we're lock-free; anything could have happened since the previous instruction - rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); - - if( rv == 1 ) - { - re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - re->qe_use = (struct lfds700_queue_element *) qe; - - if( overwrite_occurred_flag != NULL ) - *overwrite_occurred_flag = LFDS700_MISC_FLAG_RAISED; - - if( overwritten_key != NULL ) - *overwritten_key = re->key; - - if( overwritten_value != NULL ) - *overwritten_value = re->value; - } - } - } - while( rv == 0 ); - - re->key = key; - re->value = value; - - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *re->qe_use, re ); - lfds700_queue_enqueue( &rs->qs, re->qe_use, ps ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c deleted file mode 100644 index efcebf3543..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c +++ /dev/null @@ -1,36 +0,0 @@ -/***** includes *****/ -#include "lfds700_stack_internal.h" - - - - - -/****************************************************************************/ -void lfds700_stack_cleanup( struct lfds700_stack_state *ss, - void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ) -{ - struct lfds700_stack_element - *se, - *se_temp; - - LFDS700_PAL_ASSERT( ss != NULL ); - // TRD : element_cleanup_callback can be NULL - - LFDS700_MISC_BARRIER_LOAD; - - if( element_cleanup_callback != NULL ) - { - se = ss->top[POINTER]; - - while( se != NULL ) - { - se_temp = se; - se = se->next; - - element_cleanup_callback( ss, se_temp ); - } - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c deleted file mode 100644 index 745017c029..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c +++ /dev/null @@ -1,27 +0,0 @@ -/***** includes *****/ -#include "lfds700_stack_internal.h" - - - - - -/****************************************************************************/ -void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ) -{ - LFDS700_PAL_ASSERT( ss != NULL ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) ss->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &ss->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); - // TRD : user_state can be NULL - - ss->top[POINTER] = NULL; - ss->top[COUNTER] = 0; - - ss->user_state = user_state; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h deleted file mode 100644 index 7a7d541804..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** the library wide include file *****/ -#include "../liblfds700_internal.h" - -/***** private prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c deleted file mode 100644 index 3cae2e563e..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c +++ /dev/null @@ -1,52 +0,0 @@ -/***** includes *****/ -#include "lfds700_stack_internal.h" - - - - - -/****************************************************************************/ -int lfds700_stack_pop( struct lfds700_stack_state *ss, struct lfds700_stack_element **se, struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *new_top[PAC_SIZE], - *volatile original_top[PAC_SIZE]; - - LFDS700_PAL_ASSERT( ss != NULL ); - LFDS700_PAL_ASSERT( se != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - LFDS700_PAL_BARRIER_PROCESSOR_LOAD; - - original_top[COUNTER] = ss->top[COUNTER]; - original_top[POINTER] = ss->top[POINTER]; - - do - { - if( original_top[POINTER] == NULL ) - { - *se = NULL; - return( 0 ); - } - - new_top[COUNTER] = original_top[COUNTER] + 1; - new_top[POINTER] = original_top[POINTER]->next; - - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - - if( result != 1 ) - LFDS700_PAL_BARRIER_PROCESSOR_LOAD; - } - while( result != 1 ); - - *se = original_top[POINTER]; - - return( 1 ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c deleted file mode 100644 index ff84c5ed55..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c +++ /dev/null @@ -1,42 +0,0 @@ -/***** includes *****/ -#include "lfds700_stack_internal.h" - - - - - -/****************************************************************************/ -void lfds700_stack_push( struct lfds700_stack_state *ss, struct lfds700_stack_element *se, struct lfds700_misc_prng_state *ps ) -{ - char unsigned - result; - - lfds700_pal_uint_t - backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; - - struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - *new_top[PAC_SIZE], - *volatile original_top[PAC_SIZE]; - - LFDS700_PAL_ASSERT( ss != NULL ); - LFDS700_PAL_ASSERT( se != NULL ); - LFDS700_PAL_ASSERT( ps != NULL ); - - new_top[POINTER] = se; - - original_top[COUNTER] = ss->top[COUNTER]; - original_top[POINTER] = ss->top[POINTER]; - - do - { - new_top[COUNTER] = original_top[COUNTER] + 1; - se->next = original_top[POINTER]; - - LFDS700_PAL_BARRIER_PROCESSOR_STORE; - LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); - } - while( result != 1 ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c deleted file mode 100644 index b9abdf9f2d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c +++ /dev/null @@ -1,123 +0,0 @@ -/***** includes *****/ -#include "lfds700_stack_internal.h" - -/***** private prototypes *****/ -static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ); - - - - - -/****************************************************************************/ -void lfds700_stack_query( struct lfds700_stack_state *ss, enum lfds700_stack_query query_type, void *query_input, void *query_output ) -{ - struct lfds700_stack_element - *se; - - LFDS700_MISC_BARRIER_LOAD; - - LFDS700_PAL_ASSERT( ss != NULL ); - // TRD : query_type can be any value in its range - - switch( query_type ) - { - case LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT: - LFDS700_PAL_ASSERT( query_input == NULL ); - LFDS700_PAL_ASSERT( query_output != NULL ); - - *(lfds700_pal_uint_t *) query_output = 0; - - se = (struct lfds700_stack_element *) ss->top[POINTER]; - - while( se != NULL ) - { - ( *(lfds700_pal_uint_t *) query_output )++; - se = (struct lfds700_stack_element *) se->next; - } - break; - - case LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE: - // TRD : query_input can be NULL - LFDS700_PAL_ASSERT( query_output != NULL ); - - lfds700_stack_internal_stack_validate( ss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); - break; - } - - return; -} - - - - - -/****************************************************************************/ -static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ) -{ - lfds700_pal_uint_t - number_elements = 0; - - struct lfds700_stack_element - *se_fast, - *se_slow; - - LFDS700_PAL_ASSERT( ss != NULL ); - // TRD : vi can be NULL - LFDS700_PAL_ASSERT( lfds700_stack_validity != NULL ); - - *lfds700_stack_validity = LFDS700_MISC_VALIDITY_VALID; - - se_slow = se_fast = (struct lfds700_stack_element *) ss->top[POINTER]; - - /* TRD : first, check for a loop - we have two pointers - both of which start at the top of the stack - we enter a loop - and on each iteration - we advance one pointer by one element - and the other by two - - we exit the loop when both pointers are NULL - (have reached the end of the stack) - - or - - if we fast pointer 'sees' the slow pointer - which means we have a loop - */ - - if( se_slow != NULL ) - do - { - se_slow = se_slow->next; - - if( se_fast != NULL ) - se_fast = se_fast->next; - - if( se_fast != NULL ) - se_fast = se_fast->next; - } - while( se_slow != NULL and se_fast != se_slow ); - - if( se_fast != NULL and se_slow != NULL and se_fast == se_slow ) - *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; - - /* TRD : now check for expected number of elements - vi can be NULL, in which case we do not check - we know we don't have a loop from our earlier check - */ - - if( *lfds700_stack_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) - { - lfds700_stack_query( ss, LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); - - if( number_elements < vi->min_elements ) - *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( number_elements > vi->max_elements ) - *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h deleted file mode 100644 index fdd8c363eb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h +++ /dev/null @@ -1,93 +0,0 @@ -/***** public prototypes *****/ -#include "../inc/liblfds700.h" - -/***** defines *****/ -#define and && -#define or || - -#define NO_FLAGS 0x0 - -#define LFDS700_ABSTRACTION_BACKOFF_LIMIT (0x1 << 10) - -#if( defined _KERNEL_MODE ) - #define MODE_TYPE_STRING "kernel-mode" -#endif - -#if( !defined _KERNEL_MODE ) - #define MODE_TYPE_STRING "user-mode" -#endif - -#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "release" -#endif - -#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "debug" -#endif - -#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "coverage" -#endif - -#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) - #define BUILD_TYPE_STRING "threadsanitizer" -#endif - -// TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration -#define LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result, backoff_iteration, ps ) \ -{ \ - LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ); \ - \ - if( result == 0 ) \ - { \ - lfds700_pal_uint_t \ - endloop; \ - \ - lfds700_pal_uint_t volatile \ - loop; \ - \ - if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ - (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ - \ - if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ - (backoff_iteration) = 1; \ - else \ - { \ - endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas; \ - for( loop = 0 ; loop < endloop ; loop++ ); \ - } \ - \ - (backoff_iteration) <<= 1; \ - } \ -} - -// TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration -#define LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result, backoff_iteration, ps ) \ -{ \ - LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ); \ - \ - if( result == 0 ) \ - { \ - lfds700_pal_uint_t \ - endloop; \ - \ - lfds700_pal_uint_t volatile \ - loop; \ - \ - if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ - (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ - \ - if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ - (backoff_iteration) = 1; \ - else \ - { \ - endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; \ - for( loop = 0 ; loop < endloop ; loop++ ); \ - } \ - \ - (backoff_iteration) <<= 1; \ - } \ -} - -/***** library-wide prototypes *****/ - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile deleted file mode 100644 index 489e5b19e5..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile +++ /dev/null @@ -1,129 +0,0 @@ -##### paths ##### -BINDIR := ../../bin -OBJDIR := ../../obj -SRCDIR := ../../src -LIBINCDIRS := ../../../liblfds700/inc/ -LIBBINDIRS := ../../../liblfds700/bin/ - -##### misc ##### -QUIETLY := 1>nul 2>nul - -##### sources, objects and libraries ##### -BINNAME := test -BINARY := $(BINDIR)/$(BINNAME) -SRCDIRS := . -SOURCES := main.c misc.c \ - test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ - test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ - test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ - test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ - test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ - test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ - test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ - test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ - test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ - test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ - test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ - util_cmdline.c util_memory_helpers.c util_thread_starter.c -OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) -SYSLIBS := -lm -lpthread -lrt -USRLIBS := -llfds700 - -##### default paths ##### -CPATH += $(LIBINCDIRS) -LIBRARY_PATH += $(LIBBINDIRS) -export CPATH -export LIBRARY_PATH - -##### tools ##### -MAKE := make -MFLAGS := - -DG := gcc -DGFLAGS := -MM -std=gnu89 - -CC := gcc -CFBASE := -c -pthread -std=gnu89 -Wall -Wno-unknown-pragmas -CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage -CFDBG := -O0 -ggdb -D_DEBUG -CFPROF := -O0 -ggdb -DPROF -pg -CFREL := -O2 -DNDEBUG -finline-functions -Wno-strict-aliasing -CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIE - -LD := gcc -LFBASE := -pthread -std=gnu89 -Wall -Werror -LFCOV := -O0 -fprofile-arcs -ftest-coverage -LFDBG := -O0 -ggdb -LFPROF := -O0 -pg -LFREL := -O2 -s -finline-functions -LFTSAN := -O0 -fsanitize=thread -pie - -PROF := gprof -PFBASE := -b -p -Q $(BINARY) gmon.out - -##### variants and libnuma check ##### -CFLAGS += $(CFBASE) -LFLAGS += $(LFBASE) - -ifeq ($(MAKECMDGOALS),) - CFLAGS += $(CFDBG) - LFLAGS += $(LFDBG) -endif - -ifeq ($(MAKECMDGOALS),cov) - CFLAGS += $(CFCOV) - LFLAGS += $(LFCOV) - SYSLIBS += -lgcov -endif - -ifeq ($(MAKECMDGOALS),dbg) - CFLAGS += $(CFDBG) - LFLAGS += $(LFDBG) -endif - -ifeq ($(MAKECMDGOALS),prof) - CFLAGS += $(CFPROF) - LFLAGS += $(LFPROF) -endif - -ifeq ($(MAKECMDGOALS),rel) - CFLAGS += $(CFREL) - LFLAGS += $(LFREL) -endif - -ifeq ($(MAKECMDGOALS),tsan) - CFLAGS += $(CFTSAN) - LFLAGS += $(LFTSAN) -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.o : %.c - $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d - $(CC) $(CFLAGS) -o $@ $< - -##### explicit rules ##### -$(BINARY) : $(OBJECTS) - $(LD) -o $(BINARY) $(LFLAGS) $(OBJECTS) $(USRLIBS) $(SYSLIBS) - chmod +x $(BINARY) - -##### phony ##### -.PHONY : clean cov dbg prof rel tsan - -clean : - @rm -f $(BINDIR)/$(BINNAME) $(OBJDIR)/*.o $(OBJDIR)/*.d $(OBJDIR)/*.gcno - -cov : $(BINARY) -dbg : $(BINARY) -prof : $(BINARY) -rel : $(BINARY) -tsan : $(BINARY) - -genprof : - @$(PROF) $(PFBASE) - -##### dependencies ##### --include $(DEPENDS) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile deleted file mode 100644 index c54d16635b..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile +++ /dev/null @@ -1,106 +0,0 @@ -##### paths ##### -BINDIR := ..\..\bin -OBJDIR := ..\..\obj -SRCDIR := ..\..\src - -##### misc ##### -QUIETLY := 1>nul 2>nul -NULL := -SPACE := $(NULL) # TRD : necessary trailing space after the close bracket - -##### sources, objects and libraries ##### -BINNAME := test -BINARY := $(BINDIR)\$(BINNAME).exe -SRCDIRS := . -SOURCES := main.c misc.c \ - test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ - test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ - test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ - test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ - test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ - test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ - test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ - test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ - test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ - test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ - test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ - util_cmdline.c util_memory_helpers.c util_thread_starter.c -OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) -RESFILE := $(patsubst %.rc,$(OBJDIR)/%.res,$(notdir $(RCFILE))) -SYSLIBS := kernel32.lib -EXTLIBS := -USRLIBS := ../../../liblfds700/bin/liblfds700.lib - -##### default paths fix up ##### -INCLUDE += ;../../../../liblfds700/inc/ -LIB += ;../../../../liblfds700/bin/ - -##### tools ##### -MAKE := make -MFLAGS := - -CC := cl -CFBASE := /c /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE "/Fd$(BINDIR)\$(BINNAME).pdb" /nologo /W4 /WX -CFREL := /DNDEBUG /Ox -CFDBG := /D_DEBUG /Od /Gm /Zi - -LD := link -LFBASE := /nologo /subsystem:console /nodefaultlib /nxcompat /wx -LFREL := /incremental:no -LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" - -##### variants ##### -CFLAGS := $(CFBASE) $(CFDBG) /MTd -LFLAGS := $(LFBASE) $(LFDBG) -CLIB := libcmtd.lib - -ifeq ($(MAKECMDGOALS),librel) - CFLAGS := $(CFBASE) $(CFREL) /MT - LFLAGS := $(LFBASE) $(LFREL) - CLIB := libcmt.lib -endif - -ifeq ($(MAKECMDGOALS),libdbg) - CFLAGS := $(CFBASE) $(CFDBG) /MTd - LFLAGS := $(LFBASE) $(LFDBG) - CLIB := libcmtd.lib -endif - -ifeq ($(MAKECMDGOALS),dllrel) - CFLAGS := $(CFBASE) $(CFREL) /MD - LFLAGS := $(LFBASE) $(LFREL) - CLIB := msvcrt.lib -endif - -ifeq ($(MAKECMDGOALS),dlldbg) - CFLAGS := $(CFBASE) $(CFDBG) /MDd - LFLAGS := $(LFBASE) $(LFDBG) - CLIB := msvcrtd.lib -endif - -##### search paths ##### -vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) - -##### implicit rules ##### -$(OBJDIR)/%.obj : %.c - $(CC) $(CFLAGS) "/Fo$@" $< - -##### explicit rules ##### -$(BINARY) : $(OBJECTS) $(USRLIBS) - $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(EXTLIBS) $(USRLIBS) $(OBJECTS) /out:$(BINARY) - -##### phony ##### -.PHONY : clean librel libdbg dllrel dlldbg - -clean : - @erase /Q $(OBJDIR)\*.obj $(OBJDIR)\*.res $(BINDIR)\$(BINNAME).* $(QUIETLY) - -dlldbg : $(BINARY) -dllrel : $(BINARY) - -libdbg : $(BINARY) -librel : $(BINARY) - -##### notes ##### -# TRD : we fix up the default paths because cl and link require an extra argument per additional path, which is ugly as hell - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln deleted file mode 100644 index cc8727482f..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln +++ /dev/null @@ -1,67 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}" - ProjectSection(ProjectDependencies) = postProject - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} = {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "..\..\..\liblfds700\build\visual_studio_professional_2012\liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug DLL|Win32 = Debug DLL|Win32 - Debug DLL|x64 = Debug DLL|x64 - Debug LIB|Win32 = Debug LIB|Win32 - Debug LIB|x64 = Debug LIB|x64 - Release DLL|Win32 = Release DLL|Win32 - Release DLL|x64 = Release DLL|x64 - Release LIB|Win32 = Release LIB|Win32 - Release LIB|x64 = Release LIB|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Build.0 = Debug LIB|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Build.0 = Release DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Deploy.0 = Release DLL|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Build.0 = Release LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.ActiveCfg = Release LIB|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Build.0 = Release LIB|x64 - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Deploy.0 = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 - {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj deleted file mode 100644 index 3fbf8d78ee..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj +++ /dev/null @@ -1,554 +0,0 @@ - - - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug LIB - Win32 - - - Debug LIB - x64 - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release LIB - Win32 - - - Release LIB - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {1e5d7d09-94f2-455d-ae5e-6c7f4c96bce0} - - - - {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43} - Win32Proj - - - - Application - true - v110 - - - Application - true - v110 - - - Application - true - v110 - - - Application - true - v110 - - - Application - false - v110 - - - Application - false - v110 - - - Application - false - v110 - - - Application - false - v110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - false - $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ - $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ - - - - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - true - false - false - false - false - NoExtensions - false - false - false - true - CompileAsC - None - ..\liblfds700\inc;%(AdditionalIncludeDirectories) - true - - - MachineX86 - true - Console - true - - - - - kernel32.lib;%(AdditionalDependencies) - - - - - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - true - false - false - false - false - NoExtensions - false - false - false - true - CompileAsC - None - ..\liblfds700\inc;%(AdditionalIncludeDirectories) - true - - - MachineX86 - true - Console - true - - - - - kernel32.lib;%(AdditionalDependencies) - - - - - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - true - false - false - false - false - NotSet - false - false - false - true - CompileAsC - None - true - false - - - true - Console - true - - - kernel32.lib;%(AdditionalDependencies) - - - - - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDebug - Level4 - ProgramDatabase - Disabled - false - false - true - true - true - true - true - false - false - false - false - NotSet - false - false - false - true - CompileAsC - None - true - false - - - true - Console - true - - - kernel32.lib;%(AdditionalDependencies) - - - true - - - - - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - Level4 - None - false - false - false - false - CompileAsC - true - - - true - AnySuitable - true - Speed - true - true - true - true - false - true - true - false - false - false - None - - - MachineX86 - false - Console - true - true - true - true - NoErrorReport - kernel32.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - Level4 - None - false - false - false - false - CompileAsC - true - - - true - AnySuitable - true - Speed - true - true - true - true - false - true - true - false - false - false - None - - - MachineX86 - false - Console - true - true - true - true - NoErrorReport - kernel32.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - Level4 - None - false - false - false - false - CompileAsC - true - - - true - AnySuitable - true - Speed - true - true - true - true - false - true - true - false - false - false - None - - - false - Console - true - true - true - true - NoErrorReport - kernel32.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - Level4 - None - false - false - false - false - CompileAsC - true - - - true - AnySuitable - true - Speed - true - true - true - true - false - true - true - false - false - false - None - - - false - Console - true - true - true - true - NoErrorReport - kernel32.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters deleted file mode 100644 index 69da4b9836..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters +++ /dev/null @@ -1,216 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user deleted file mode 100644 index 7cbb3216ad..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h deleted file mode 100644 index 14bf02c74c..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h +++ /dev/null @@ -1,157 +0,0 @@ -/***** includes *****/ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../liblfds700/inc/liblfds700.h" -#include "test_porting_abstraction_layer_operating_system.h" - -/***** defines *****/ -#define and && -#define or || - -#define NO_FLAGS 0x0 - -#define BITS_PER_BYTE 8 - -#define TEST_DURATION_IN_SECONDS 5 -#define TIME_LOOP_COUNT 10000 -#define REDUCED_TIME_LOOP_COUNT 1000 -#define NUMBER_OF_NANOSECONDS_IN_ONE_SECOND 1000000000LLU -#define ONE_MEGABYTE_IN_BYTES (1024 * 1024) -#define DEFAULT_TEST_MEMORY_IN_MEGABYTES 512U -#define TEST_PAL_DEFAULT_NUMA_NODE_ID 0 -#define LFDS700_TEST_VERSION_STRING "7.0.0" -#define LFDS700_TEST_VERSION_INTEGER 700 - -#if( defined _KERNEL_MODE ) - #define MODE_TYPE_STRING "kernel-mode" -#endif - -#if( !defined _KERNEL_MODE ) - #define MODE_TYPE_STRING "user-mode" -#endif - -#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "release" -#endif - -#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "debug" -#endif - -#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) - #define BUILD_TYPE_STRING "coverage" -#endif - -#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) - #define BUILD_TYPE_STRING "threadsanitizer" -#endif - -/***** enums *****/ -enum flag -{ - LOWERED, - RAISED -}; - -/***** structs *****/ -struct test_pal_logical_processor -{ - lfds700_pal_uint_t - logical_processor_number, - windows_logical_processor_group_number; - - struct lfds700_list_asu_element - lasue; -}; - -/***** prototypes *****/ -int main( int argc, char **argv ); - -void internal_display_test_name( char *format_string, ... ); -void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ); -void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ); -void internal_show_version( void ); -void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ); - -int test_pal_thread_start( test_pal_thread_state_t *thread_state, struct test_pal_logical_processor *lp, test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), void *thread_user_state ); -void test_pal_thread_wait( test_pal_thread_state_t thread_state ); -void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ); - -void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - -void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_hash_a_alignment( void ); - void test_lfds700_hash_a_fail_and_overwrite_on_existing_key( void ); - void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_hash_a_iterate( void ); - -void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_list_aos_alignment( void ); - void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - -void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_list_asu_alignment( void ); - void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - -void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_btree_au_alignment( void ); - void test_lfds700_btree_au_fail_and_overwrite_on_existing_key( void ); - void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - -void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_freelist_alignment( void ); - void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_freelist_pushing_array( void ); - -void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_queue_alignment( void ); - void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ); - -void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_queue_bss_enqueuing( void ); - void test_lfds700_queue_bss_dequeuing( void ); - void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); - -void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - -void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_stack_alignment( void ); - void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); - void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); - void test_lfds700_stack_pushing_array( void ); - -/***** late includes *****/ -#include "util_cmdline.h" -#include "util_memory_helpers.h" -#include "util_thread_starter.h" - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c deleted file mode 100644 index fa6afc8747..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c +++ /dev/null @@ -1,135 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -int main( int argc, char **argv ) -{ - enum flag - run_flag = LOWERED, - show_error_flag = LOWERED, - show_help_flag = LOWERED, - show_version_flag = LOWERED; - - int - rv; - - lfds700_pal_uint_t - loop, - iterations = 1, - memory_in_megabytes = DEFAULT_TEST_MEMORY_IN_MEGABYTES; - - struct lfds700_list_asu_state - list_of_logical_processors; - - struct util_cmdline_state - cs; - - union util_cmdline_arg_data - *arg_data; - - assert( argc >= 1 ); - assert( argv != NULL ); - - lfds700_misc_library_init_valid_on_current_logical_core(); - - util_cmdline_init( &cs ); - - util_cmdline_add_arg( &cs, 'h', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); - util_cmdline_add_arg( &cs, 'i', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); - util_cmdline_add_arg( &cs, 'm', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); - util_cmdline_add_arg( &cs, 'r', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); - util_cmdline_add_arg( &cs, 'v', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); - - rv = util_cmdline_process_args( &cs, argc, argv ); - - if( rv == 0 ) - show_error_flag = RAISED; - - if( rv == 1 ) - { - util_cmdline_get_arg_data( &cs, 'h', &arg_data ); - if( arg_data != NULL ) - show_help_flag = RAISED; - - util_cmdline_get_arg_data( &cs, 'i', &arg_data ); - if( arg_data != NULL ) - iterations = (lfds700_pal_uint_t) arg_data->integer.integer; - - util_cmdline_get_arg_data( &cs, 'm', &arg_data ); - if( arg_data != NULL ) - memory_in_megabytes = (lfds700_pal_uint_t) arg_data->integer.integer; - - util_cmdline_get_arg_data( &cs, 'r', &arg_data ); - if( arg_data != NULL ) - run_flag = RAISED; - - util_cmdline_get_arg_data( &cs, 'v', &arg_data ); - if( arg_data != NULL ) - show_version_flag = RAISED; - } - - util_cmdline_cleanup( &cs ); - - if( argc == 1 or (run_flag == LOWERED and show_version_flag == LOWERED) ) - show_help_flag = RAISED; - - if( show_error_flag == RAISED ) - { - printf( "\nInvalid arguments. Sorry - it's a simple parser, so no clues.\n" - "-h or run with no args to see the help text.\n" ); - - return( EXIT_SUCCESS ); - } - - if( show_help_flag == RAISED ) - { - printf( "test -h -i [n] -m [n] -r -v\n" - " -h : help\n" - " -i [n] : number of iterations (default : 1)\n" - " -m [n] : memory for tests, in mb (default : %u)\n" - " -r : run (causes test to run; present so no args gives help)\n" - " -v : version\n", DEFAULT_TEST_MEMORY_IN_MEGABYTES ); - - return( EXIT_SUCCESS ); - } - - if( show_version_flag == RAISED ) - { - internal_show_version(); - return( EXIT_SUCCESS ); - } - - if( run_flag == RAISED ) - { - test_pal_get_logical_core_ids( &list_of_logical_processors ); - - for( loop = 0 ; loop < (lfds700_pal_uint_t) iterations ; loop++ ) - { - printf( "\n" - "Test Iteration %02llu\n" - "=================\n", (int long long unsigned) (loop+1) ); - - test_lfds700_pal_atomic( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_btree_au( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_freelist( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_hash_a( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_list_aos( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_list_asu( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue_bss( &list_of_logical_processors ); - test_lfds700_ringbuffer( &list_of_logical_processors, memory_in_megabytes ); - test_lfds700_stack( &list_of_logical_processors, memory_in_megabytes ); - } - - lfds700_list_asu_cleanup( &list_of_logical_processors, internal_logical_core_id_element_cleanup_callback ); - } - - lfds700_misc_library_cleanup(); - - return( EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c deleted file mode 100644 index 4fa794f68d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c +++ /dev/null @@ -1,191 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void internal_display_test_name( char *format_string, ... ) -{ - va_list - va; - - assert( format_string != NULL ); - - va_start( va, format_string ); - - vprintf( format_string, va ); - - printf( "..." ); - - va_end( va ); - - fflush( stdout ); - - return; -} - - - - - -/****************************************************************************/ -void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ) -{ - char - *name; - - enum flag - passed_flag = RAISED; - - enum lfds700_misc_validity - dvs; - - lfds700_pal_uint_t - loop; - - va_list - va; - - // TRD : number_name_dvs_pairs can be any value in its range - - va_start( va, number_name_dvs_pairs ); - - for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) - { - name = va_arg( va, char * ); - dvs = va_arg( va, enum lfds700_misc_validity ); - - if( dvs != LFDS700_MISC_VALIDITY_VALID ) - { - passed_flag = LOWERED; - break; - } - } - - va_end( va ); - - if( passed_flag == RAISED ) - puts( "passed" ); - - if( passed_flag == LOWERED ) - { - printf( "failed (" ); - - va_start( va, number_name_dvs_pairs ); - - for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) - { - name = va_arg( va, char * ); - dvs = va_arg( va, enum lfds700_misc_validity ); - - printf( "%s ", name ); - internal_display_data_structure_validity( dvs ); - - if( loop+1 < number_name_dvs_pairs ) - printf( ", " ); - } - - va_end( va ); - - printf( ")\n" ); - - /* TRD : quick hack - the whole test programme needs rewriting - and for now I just want to make it so we - exit with failure upon any test failing - */ - - exit( EXIT_FAILURE ); - } - - return; -} - - - - - -/****************************************************************************/ -void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ) -{ - char - *string = NULL; - - switch( dvs ) - { - case LFDS700_MISC_VALIDITY_VALID: - string = "valid"; - break; - - case LFDS700_MISC_VALIDITY_INVALID_LOOP: - string = "invalid - loop detected"; - break; - - case LFDS700_MISC_VALIDITY_INVALID_ORDER: - string = "invalid - invalid order detected"; - break; - - case LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS: - string = "invalid - missing elements"; - break; - - case LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS: - string = "invalid - additional elements"; - break; - - case LFDS700_MISC_VALIDITY_INVALID_TEST_DATA: - string = "invalid - invalid test data"; - break; - } - - printf( "%s", string ); - - return; -} - - - - - -/****************************************************************************/ -void internal_show_version() -{ - char const - *version_and_build_string; - - printf( "test %s (%s, %s) (" __DATE__ " " __TIME__ ")\n", LFDS700_TEST_VERSION_STRING, BUILD_TYPE_STRING, MODE_TYPE_STRING ); - - lfds700_misc_query( LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING, NULL, (void **) &version_and_build_string ); - - printf( "%s\n", version_and_build_string ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ) -{ - struct test_pal_logical_processor - *lp; - - assert( lasus != NULL ); - assert( lasue != NULL ); - - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - util_aligned_free( lp ); - - return; -} - -#pragma warning( default : 4100 ) - - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c deleted file mode 100644 index 55b94ca5bb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c +++ /dev/null @@ -1,32 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_CAS and LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) - { - printf( "\n" - "Binary Tree (add-only, unbalanced) Tests\n" - "========================================\n" ); - - test_lfds700_btree_au_alignment(); - test_lfds700_btree_au_fail_and_overwrite_on_existing_key(); - test_lfds700_btree_au_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_btree_au_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c deleted file mode 100644 index ecdaf29adb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c +++ /dev/null @@ -1,64 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_btree_au_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_btree_au_element - if( offsetof(struct lfds700_btree_au_element,up) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_element,left) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_element,right) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : struct lfds700_btree_au_state - if( offsetof(struct lfds700_btree_au_state,root) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_btree_au_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "btree_au", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c deleted file mode 100644 index ae043a0669..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c +++ /dev/null @@ -1,319 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_btree_au_element - baue; - - lfds700_pal_uint_t - key; -}; - -struct test_state -{ - lfds700_pal_uint_t - insert_fail_count, - number_elements; - - struct lfds700_btree_au_state - *baus; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static int key_compare_function( void const *new_value, void const *value_in_tree ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - actual_sum_insert_failure_count, - expected_sum_insert_failure_count, - index = 0, - *key_count_array, - loop, - number_elements, - number_logical_processors, - random_value, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_btree_au_element - *baue = NULL; - - struct lfds700_btree_au_state - baus; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - void - *key; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single btree_au - we generate 10k elements per thread (one per logical processor) in an array - we set a random number in each element, which is the key - random numbers are generated are from 0 to 5000, so we must have some duplicates - (we don't use value, so we always pass in a NULL for that when we insert) - - each thread loops, adds those elements into the btree, and counts the total number of insert fails - (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) - this test has the btree_au set to fail on add, so duplicates should be eliminated - - we then merge the per-thread arrays - - we should find in the tree one of every value, and the sum of the counts of each value (beyond the - first value, which was inserted) in the merged arrays should equal the sum of the insert fails from - each thread - - we check the count of unique values in the merged array and use that when calling the btree_au validation function - - we in-order walk and check that what we have in the tree matches what we have in the merged array - and then check the fail counts - */ - - internal_display_test_name( "Random adds and walking (fail on existing key)" ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->baus = &baus; - (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - (ts+loop)->number_elements = number_elements; - (ts+loop)->insert_fail_count = 0; - - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); - ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); - } - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - /* TRD : now for validation - make an array equal to number_elements, set all to 0 - iterate over every per-thread array, counting the number of each value into this array - so we can know how many elements ought to have failed to be inserted - as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call - */ - - key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); - for( loop = 0 ; loop < number_elements ; loop++ ) - *(key_count_array+loop) = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; - - // TRD : first, btree validation function - vi.min_elements = number_elements; - - for( loop = 0 ; loop < number_elements ; loop++ ) - if( *(key_count_array+loop) == 0 ) - vi.min_elements--; - - vi.max_elements = vi.min_elements; - - lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); - - /* TRD : now check the sum of per-thread insert failures - is what it should be, which is the sum of key_count_array, - but with every count minus one (for the single succesful insert) - and where elements of 0 are ignored (i.e. do not have -1 applied) - */ - - expected_sum_insert_failure_count = 0; - - for( loop = 0 ; loop < number_elements ; loop++ ) - if( *(key_count_array+loop) != 0 ) - expected_sum_insert_failure_count += *(key_count_array+loop) - 1; - - actual_sum_insert_failure_count = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - actual_sum_insert_failure_count += (ts+loop)->insert_fail_count; - - if( expected_sum_insert_failure_count != actual_sum_insert_failure_count ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - /* TRD : now compared the combined array and an in-order walk of the tree - ignoring array elements with the value 0, we should find an exact match - */ - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - { - // TRD : in-order walk over btree_au and check key_count_array matches - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) - { - key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); - - while( *(key_count_array+index) == 0 ) - index++; - - if( index++ != (lfds700_pal_uint_t) key ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - } - - // TRD : cleanup - free( key_count_array ); - - lfds700_btree_au_cleanup( &baus, NULL ); - - // TRD : cleanup - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - util_aligned_free( (ts+loop)->element_array ); - - free( ts ); - - // TRD : print the test result - internal_display_test_result( 1, "btree_au", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *key_in_tree ) -{ - int - cr = 0; - - // TRD : key_new can be any value in its range - // TRD : key_in_tree can be any value in its range - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) -{ - enum lfds700_btree_au_insert_result - alr; - - lfds700_pal_uint_t - index = 0; - - struct test_state - *ts; - - struct lfds700_misc_prng_state - ps; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( index < ts->number_elements ) - { - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); - alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, NULL, &ps ); - - if( alr == LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) - ts->insert_fail_count++; - - index++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c deleted file mode 100644 index 4c638c8600..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c +++ /dev/null @@ -1,140 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** private prototypes *****/ -static int key_compare_function( void const *new_value, void const *value_in_tree ); - - - - - -/****************************************************************************/ -void test_lfds700_btree_au_fail_and_overwrite_on_existing_key() -{ - enum lfds700_btree_au_insert_result - alr; - - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - struct lfds700_btree_au_element - baue_one, - baue_two, - *existing_baue; - - struct lfds700_btree_au_state - baus; - - struct lfds700_misc_prng_state - ps; - - void - *value; - - /* TRD : the random_adds tests with fail and overwrite don't (can't, not in a performant manner) - test that the fail and/or overwrite of user data has *actually* happened - they use the - return value from the link function call, rather than empirically observing the final - state of the tree - - as such, we now have a couple of single threaded tests where we check that the user data - value really is being modified (or not modified, as the case may be) - */ - - internal_display_test_name( "Fail and overwrite on existing key" ); - - lfds700_misc_prng_init( &ps ); - - /* TRD : so, we make a tree which is fail on existing - add one element, with a known user data - we then try to add the same key again, with a different user data - the call should fail, and then we get the element by its key - and check its user data is unchanged - (and confirm the failed link returned the correct existing_baue) - that's the first test done - */ - - lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); - - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); - alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); - - if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); - alr = lfds700_btree_au_insert( &baus, &baue_two, &existing_baue, &ps ); - - if( alr != LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( existing_baue != &baue_one ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - value = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); - - if( (void *) (lfds700_pal_uint_t) value != (void *) (lfds700_pal_uint_t) 1 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - lfds700_btree_au_cleanup( &baus, NULL ); - - /* TRD : second test, make a tree which is overwrite on existing - add one element, with a known user data - we then try to add the same key again, with a different user data - the call should succeed, and then we get the element by its key - and check its user data is changed - (and confirm the failed link returned the correct existing_baue) - that's the secondtest done - */ - - lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); - - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); - alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); - - if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); - alr = lfds700_btree_au_insert( &baus, &baue_two, NULL, &ps ); - - if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - lfds700_btree_au_cleanup( &baus, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "btree_au", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *key_in_tree ) -{ - int - cr = 0; - - // TRD : key_new can be any value in its range - // TRD : key_in_tree can be any value in its range - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c deleted file mode 100644 index c9b162128b..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c +++ /dev/null @@ -1,322 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_btree_au_element - baue; - - lfds700_pal_uint_t - key; -}; - -struct test_state -{ - lfds700_pal_uint_t - insert_existing_count, - number_elements; - - struct lfds700_btree_au_state - *baus; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static int key_compare_function( void const *new_value, void const *value_in_tree ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - actual_sum_insert_existing_count, - expected_sum_insert_existing_count, - index = 0, - *key_count_array, - loop, - number_elements, - number_logical_processors, - random_value, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_btree_au_element - *baue = NULL; - - struct lfds700_btree_au_state - baus; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - void - *key; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single btree_au - we generate 10k elements per thread (one per logical processor) in an array - we set a random number in each element, which is the key - random numbers are generated are from 0 to 5000, so we must have some duplicates - (we don't use value, so we always pass in a NULL for that when we insert) - - each thread loops, adds those elements into the btree, and counts the total number of insert fails - (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) - this test has the btree_au set to overwrite on add, so duplicates should be eliminated - - we then merge the per-thread arrays - - we should find in the tree one of every value, and the sum of the counts of each value (beyond the - first value, which was inserted) in the merged arrays should equal the sum of the existing_baues returned - from each thread when they inserted and found an existing element - - we check the count of unique values in the merged array and use that when calling the btree_au validation function - - we in-order walk and check that what we have in the tree matches what we have in the merged array - and then check the fail counts - */ - - internal_display_test_name( "Random adds and walking (overwrite on existing key)" ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->baus = &baus; - (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - (ts+loop)->number_elements = number_elements; - (ts+loop)->insert_existing_count = 0; - - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); - ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); - } - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - /* TRD : now for validation - make an array equal to number_elements, set all to 0 - iterate over every per-thread array, counting the number of each value into this array - so we can know how many elements ought to have failed to be inserted - as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call - */ - - key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); - for( loop = 0 ; loop < number_elements ; loop++ ) - *(key_count_array+loop) = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; - - // TRD : first, btree validation function - vi.min_elements = number_elements; - - for( loop = 0 ; loop < number_elements ; loop++ ) - if( *(key_count_array+loop) == 0 ) - vi.min_elements--; - - vi.max_elements = vi.min_elements; - - lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); - - /* TRD : now check the sum of per-thread insert failures - is what it should be, which is the sum of key_count_array, - but with every count minus one (for the single succesful insert) - and where elements of 0 are ignored (i.e. do not have -1 applied) - */ - - expected_sum_insert_existing_count = 0; - - for( loop = 0 ; loop < number_elements ; loop++ ) - if( *(key_count_array+loop) != 0 ) - expected_sum_insert_existing_count += *(key_count_array+loop) - 1; - - actual_sum_insert_existing_count = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - actual_sum_insert_existing_count += (ts+loop)->insert_existing_count; - - if( expected_sum_insert_existing_count != actual_sum_insert_existing_count ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - /* TRD : now compared the combined array and an in-order walk of the tree - ignoring array elements with the value 0, we should find an exact match - */ - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - { - // TRD : in-order walk over btree_au and check key_count_array matches - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) - { - key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); - - while( *(key_count_array+index) == 0 ) - index++; - - if( index++ != (lfds700_pal_uint_t) key ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - } - - // TRD : cleanup - free( key_count_array ); - - lfds700_btree_au_cleanup( &baus, NULL ); - - // TRD : cleanup - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - util_aligned_free( (ts+loop)->element_array ); - - free( ts ); - - // TRD : print the test result - internal_display_test_result( 1, "btree_au", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *key_in_tree ) -{ - int - cr = 0; - - // TRD : key_new can be any value in its range - // TRD : key_in_tree can be any value in its range - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) -{ - enum lfds700_btree_au_insert_result - alr; - - lfds700_pal_uint_t - index = 0; - - struct test_state - *ts; - - struct lfds700_btree_au_element - *existing_baue; - - struct lfds700_misc_prng_state - ps; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( index < ts->number_elements ) - { - LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); - LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); - alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, &existing_baue, &ps ); - - if( alr == LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) - ts->insert_existing_count++; - - index++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c deleted file mode 100644 index 1968ae7167..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c +++ /dev/null @@ -1,33 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) - { - printf( "\n" - "Freelist Tests\n" - "==============\n" ); - - test_lfds700_freelist_alignment(); - test_lfds700_freelist_popping( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_freelist_pushing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_freelist_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_freelist_rapid_popping_and_pushing( list_of_logical_processors ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c deleted file mode 100644 index 885ecbf8c4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c +++ /dev/null @@ -1,43 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_freelist_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_freelist_state - if( offsetof(struct lfds700_freelist_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_freelist_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c deleted file mode 100644 index 6dcbd0847a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c +++ /dev/null @@ -1,205 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - struct lfds700_freelist_state - *fs; -}; - -struct test_element -{ - struct lfds700_freelist_element - fe; - - enum flag - popped_flag; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_freelist_state - fs; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi = { 0, 0 }; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a freelist with 1,000,000 elements - - the creation function runs in a single thread and creates - and pushes those elements onto the freelist - - each element contains a void pointer to the container test element - - we then run one thread per CPU - where each thread loops, popping as quickly as possible - each test element has a flag which indicates it has been popped - - the threads run till the source freelist is empty - - we then check the test elements - every element should have been popped - - then tidy up - - we have no extra code for CAS/GC as we're only popping - */ - - internal_display_test_name( "Popping" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); - - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements ; loop++ ) - { - (te_array+loop)->popped_flag = LOWERED; - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); - lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); - } - - ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - (ts+loop)->fs = &fs; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - // TRD : now we check each element has popped_flag set to RAISED - for( loop = 0 ; loop < number_elements ; loop++ ) - if( (te_array+loop)->popped_flag == LOWERED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : cleanup - lfds700_freelist_cleanup( &fs, NULL ); - util_aligned_free( ts ); - util_aligned_free( te_array ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) -{ - struct lfds700_freelist_element - *fe; - - struct lfds700_misc_prng_state - ps; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( lfds700_freelist_pop(ts->fs, &fe, &ps) ) - { - te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); - te->popped_flag = RAISED; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c deleted file mode 100644 index 8c411151d3..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c +++ /dev/null @@ -1,319 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element; - -struct test_state -{ - struct lfds700_freelist_state - fs_thread_local, - *fs; - - lfds700_pal_uint_t - number_elements; - - struct test_element - *fs_thread_local_te_array; -}; - -struct test_element -{ - struct lfds700_freelist_element - fe, - thread_local_fe; - - lfds700_pal_uint_t - datum; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_freelist_state - fs; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we have two threads per CPU - the threads loop for ten seconds - the first thread pushes 10000 elements then pops 10000 elements - the second thread pops 10000 elements then pushes 10000 elements - all pushes and pops go onto the single main freelist - with a per-thread local freelist to store the pops - - after time is up, all threads push what they have remaining onto - the main freelist - - we then validate the main freelist - */ - - internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); - - lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); - - // TRD : we allocate half the total elements here, and half again later, which is why *2 above, but not here - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - // TRD : initial elements in the main freelist so the popping threads can start immediately - for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) - { - (te_array+loop)->datum = loop; - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); - lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); - } - - ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - // TRD : first set of threads (poppers) - (ts+loop)->fs = &fs; - (ts+loop)->number_elements = number_elements; - lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop)->fs_thread_local, NULL ); - - // TRD : second set of threads (pushers - who need elements in their per-thread freelists) - (ts+loop+number_logical_processors)->fs = &fs; - (ts+loop+number_logical_processors)->number_elements = number_elements; - lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); - - // TRD : fill the pushing thread freelists - (ts+loop+number_logical_processors)->fs_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->datum = loop; - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, (ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop ); - lfds700_freelist_push( &(ts+loop+number_logical_processors)->fs_thread_local, &((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, &ps ); - } - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); - - util_thread_starter_new( &tts, number_logical_processors * 2 ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); - util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; - - lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); - - lfds700_freelist_cleanup( &fs, NULL ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - lfds700_freelist_cleanup( &(ts+loop)->fs_thread_local, NULL ); - lfds700_freelist_cleanup( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); - util_aligned_free( (ts+loop+number_logical_processors)->fs_thread_local_te_array ); - } - - util_aligned_free( ts ); - - util_aligned_free( te_array ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - count; - - struct lfds700_freelist_element - *fe; - - struct lfds700_misc_prng_state - ps; - - struct util_thread_starter_thread_state - *tsts; - - struct test_state - *ts; - - time_t - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - start_time = time( NULL ); - - while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) - { - count = 0; - - while( count < ts->number_elements ) - if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) - { - // TRD : we do nothing with the test data, so there'ss no GET or SET here - lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); - count++; - } - - // TRD : return our local freelist to the main freelist - while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) - lfds700_freelist_push( ts->fs, fe, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - count; - - struct lfds700_freelist_element - *fe; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - start_time = time( NULL ); - - while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) - { - // TRD : return our local freelist to the main freelist - while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) - lfds700_freelist_push( ts->fs, fe, &ps ); - - count = 0; - - while( count < ts->number_elements ) - if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) - { - lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); - count++; - } - } - - // TRD : now push whatever we have in our local freelist - while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) - lfds700_freelist_push( ts->fs, fe, &ps ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c deleted file mode 100644 index 0e756c5e2d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c +++ /dev/null @@ -1,246 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - number_elements, - thread_number; - - struct lfds700_freelist_state - *fs; - - struct test_element - *te_array; -}; - -struct test_element -{ - struct lfds700_freelist_element - fe; - - lfds700_pal_uint_t - datum, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - *per_thread_counters; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_freelist_element - *fe; - - struct lfds700_freelist_state - fs; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te, - *first_te = NULL; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create an empty freelist - - we then create one thread per CPU, where each thread - pushes 100,000 elements each as quickly as possible to the freelist - - the data pushed is a counter and a thread ID - - the threads exit when the freelist is full - - we then validate the freelist; - - checking that the counts increment on a per unique ID basis - and that the number of elements we pop equals 100,000 per thread - (since each element has an incrementing counter which is - unique on a per unique ID basis, we can know we didn't lose - any elements) - */ - - internal_display_test_name( "Pushing" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - // TRD : the main freelist - lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->fs = &fs; - (ts+loop)->thread_number = loop; - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = number_elements - 1; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors; - - lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_freelist_pop(&fs, &fe, &ps) ) - { - te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); - - if( first_te == NULL ) - first_te = te; - - if( te->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( te->datum > per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( te->datum < per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( te->datum == per_thread_counters[te->thread_number] ) - per_thread_counters[te->thread_number]--; - } - - // TRD : clean up - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - util_aligned_free( (ts+loop)->te_array ); - - free( per_thread_counters ); - - free( ts ); - - lfds700_freelist_cleanup( &fs, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - (ts->te_array+loop)->thread_number = ts->thread_number; - (ts->te_array+loop)->datum = loop; - } - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->fe, ts->te_array+loop ); - lfds700_freelist_push( ts->fs, &(ts->te_array+loop)->fe, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c deleted file mode 100644 index 15a0f9fd69..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c +++ /dev/null @@ -1,216 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - struct lfds700_freelist_state - *fs; -}; - -struct test_element -{ - struct lfds700_freelist_element - fe; - - lfds700_pal_uint_t - datum; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_freelist_state - fs; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi = { 0, 0 }; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - - /* TRD : in these tests there is a fundamental antagonism between - how much checking/memory clean up that we do and the - likelyhood of collisions between threads in their lock-free - operations - - the lock-free operations are very quick; if we do anything - much at all between operations, we greatly reduce the chance - of threads colliding - - so we have some tests which do enough checking/clean up that - they can tell the freelist is valid and don't leak memory - and here, this test now is one of those which does minimal - checking - in fact, the nature of the test is that you can't - do any real checking - but goes very quickly - - what we do is create a small freelist and then run one thread - per CPU, where each thread simply pushes and then immediately - pops - - the test runs for ten seconds - - after the test is done, the only check we do is to traverse - the freelist, checking for loops and ensuring the number of - elements is correct - */ - - internal_display_test_name( "Rapid popping and pushing (10 seconds)" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - (ts+loop)->fs = &fs; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - // TRD : we need one element per thread - te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); - lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); - } - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_logical_processors; - - lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - lfds700_freelist_cleanup( &fs, NULL ); - - util_aligned_free( te_array ); - - free( ts ); - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_freelist_element - *fe; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - lfds700_freelist_pop( ts->fs, &fe, &ps ); - lfds700_freelist_push( ts->fs, fe, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c deleted file mode 100644 index eeb98727c5..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c +++ /dev/null @@ -1,33 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) - { - printf( "\n" - "Hash (add-only) Tests\n" - "=====================\n" ); - - test_lfds700_hash_a_alignment(); - test_lfds700_hash_a_fail_and_overwrite_on_existing_key(); - test_lfds700_hash_a_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_hash_a_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_hash_a_iterate(); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c deleted file mode 100644 index 2d0a0a5b8e..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c +++ /dev/null @@ -1,40 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_hash_a_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_hash_a_element - if( offsetof(struct lfds700_hash_a_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "freelist", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c deleted file mode 100644 index cf4899e31b..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c +++ /dev/null @@ -1,224 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_btree_au_element - baue; - - lfds700_pal_uint_t - datum; -}; - -struct test_state -{ - enum lfds700_misc_flag - error_flag; - - struct lfds700_hash_a_state - *has; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static int key_compare_function( void const *new_key, void const *existing_key ); -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); - - - - - -/****************************************************************************/ -void test_lfds700_hash_a_iterate( void ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - *counter_array, - loop; - - struct lfds700_hash_a_element - *hae; - - struct lfds700_hash_a_iterate - hai; - - struct lfds700_hash_a_state - has; - - struct lfds700_hash_a_element - *element_array; - - struct lfds700_btree_au_state - *baus; - - struct lfds700_misc_prng_state - ps; - - void - *value; - - /* TRD : single-threaded test - we create a single hash_a - we populate with 1000 elements - where key and value is the number of the element (e.g. 0 to 999) - we then allocate 1000 counters, init to 0 - we then iterate - we increment each element as we see it in the iterate - if any are missing or seen more than once, problemo! - - we do this once with a table of 10, to ensure each table has (or almost certainly has) something in - and then a second tiem with a table of 10000, to ensure some empty tables exist - */ - - internal_display_test_name( "Iterate" ); - - lfds700_misc_prng_init( &ps ); - - element_array = util_aligned_malloc( sizeof(struct lfds700_hash_a_element) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * 1000 ); - - // TRD : first time around - baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); - - for( loop = 0 ; loop < 1000 ; loop++ ) - { - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); - lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); - } - - for( loop = 0 ; loop < 1000 ; loop++ ) - *(counter_array+loop) = 0; - - lfds700_hash_a_iterate_init( &has, &hai ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) - { - value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); - ( *(counter_array + (lfds700_pal_uint_t) value) )++; - } - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - for( loop = 0 ; loop < 1000 ; loop++ ) - { - if( *(counter_array+loop) > 1 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( *(counter_array+loop) == 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - } - - lfds700_hash_a_cleanup( &has, NULL ); - - util_aligned_free( baus ); - - // TRD : second time around - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - { - baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); - - for( loop = 0 ; loop < 1000 ; loop++ ) - { - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); - lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); - } - - for( loop = 0 ; loop < 1000 ; loop++ ) - *(counter_array+loop) = 0; - - lfds700_hash_a_iterate_init( &has, &hai ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) - { - value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); - ( *(counter_array + (lfds700_pal_uint_t) value ) )++; - } - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - for( loop = 0 ; loop < 1000 ; loop++ ) - { - if( *(counter_array+loop) > 1 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( *(counter_array+loop) == 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - } - - lfds700_hash_a_cleanup( &has, NULL ); - - util_aligned_free( baus ); - } - - // TRD : cleanup - util_aligned_free( element_array ); - free( counter_array ); - - // TRD : print the test result - internal_display_test_result( 1, "hash_a", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *existing_key ) -{ - int - cr = 0; - - // TRD : new_key can be NULL (i.e. 0) - // TRD : existing_key can be NULL (i.e. 0) - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) -{ - // TRD : key can be NULL - assert( hash != NULL ); - - *hash = 0; - - /* TRD : this function iterates over the user data - and we are using the void pointer AS user data - so here we need to pass in the addy of value - */ - - LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); - - return; -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c deleted file mode 100644 index 5d36e47a31..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c +++ /dev/null @@ -1,314 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_hash_a_element - hae; - - lfds700_pal_uint_t - datum, - key; -}; - -struct test_state -{ - enum flag - error_flag; - - lfds700_pal_uint_t - number_elements_per_thread; - - struct lfds700_hash_a_state - *has; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); -static int key_compare_function( void const *new_key, void const *existing_key ); -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); - - - - - -/****************************************************************************/ -void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements_per_thread, - number_elements_total, - number_logical_processors, - offset, - temp, - value; - - struct lfds700_hash_a_element - *hae; - - struct lfds700_hash_a_state - has; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_btree_au_state - *baus; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *element_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single hash_a - we generate 100k elements per thread (with one thread per logical processor) in an array - each element is unique - we randomly sort the elements - then each thread loops, adds those elements into the hash_a - we check that each datum inserts okay - failure will occur on non-unique data, i.e. two identical keys - we should have no failures - we then call the hash_a validation function - then using the hash_a get() we check all the elements we added are present - */ - - internal_display_test_name( "Random adds and get (fail on existing key)" ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); - - number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - number_elements_total = number_elements_per_thread * number_logical_processors; - - // TRD : created an ordered list of unique numbers - element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - { - (element_array+loop)->key = loop; - // TRD : + number_elements just to make it different to the key - (element_array+loop)->datum = loop + number_elements_total; - } - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - { - offset = LFDS700_MISC_PRNG_GENERATE( &ps ); - offset %= number_elements_total; - temp = (element_array + offset)->key; - (element_array + offset)->key = (element_array + loop)->key; - (element_array + loop)->key = temp; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->has = &has; - (ts+loop)->element_array = element_array + number_elements_per_thread*loop; - (ts+loop)->error_flag = LOWERED; - (ts+loop)->number_elements_per_thread = number_elements_per_thread; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - // TRD : now for validation - vi.min_elements = vi.max_elements = number_elements_total; - lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); - - /* TRD : now we attempt to lfds700_hash_a_get_by_key() for every element in number_array - any failure to find is an error - we also check we've obtained the correct element - */ - - for( loop = 0 ; dvs == LFDS700_MISC_VALIDITY_VALID and loop < number_elements_total ; loop++ ) - if( 0 == lfds700_hash_a_get_by_key(&has, (void *) (ts->element_array+loop)->key, &hae) ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - else - { - value = (lfds700_pal_uint_t) LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); - if( (ts->element_array+loop)->datum != value ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - - // TRD : just check error_flags weren't raised - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : cleanup - lfds700_hash_a_cleanup( &has, NULL ); - - util_aligned_free( baus ); - - free( ts ); - - util_aligned_free( element_array ); - - // TRD : print the test result - internal_display_test_result( 1, "hash_a", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) -{ - enum lfds700_hash_a_insert_result - apr; - - lfds700_pal_uint_t - index = 0; - - struct test_state - *ts; - - struct lfds700_misc_prng_state - ps; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( index < ts->number_elements_per_thread ) - { - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->datum ); - apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); - - if( apr == LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) - ts->error_flag = RAISED; - - index++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *existing_key ) -{ - int - cr = 0; - - // TRD : new_key can be NULL (i.e. 0) - // TRD : existing_key can be NULL (i.e. 0) - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) -{ - // TRD : key can be NULL - assert( hash != NULL ); - - *hash = 0; - - /* TRD : this function iterates over the user data - and we are using the void pointer *as* key data - so here we need to pass in the addy of key - */ - - LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); - - return; -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c deleted file mode 100644 index cc18900273..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c +++ /dev/null @@ -1,137 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** private prototypes *****/ -static int key_compare_function( void const *new_value, void const *value_in_tree ); -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); - - - - - -/****************************************************************************/ -void test_lfds700_hash_a_fail_and_overwrite_on_existing_key() -{ - enum lfds700_hash_a_insert_result - apr; - - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - struct lfds700_hash_a_element - hae_one, - hae_two; - - struct lfds700_hash_a_state - has; - - struct lfds700_btree_au_state - *baus; - - struct lfds700_misc_prng_state - ps; - - internal_display_test_name( "Fail and overwrite on existing key" ); - - lfds700_misc_prng_init( &ps ); - - baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - // TRD : fail on overwrite - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); - - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 0 ); - apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); - - if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); - apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); - - if( apr != LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - lfds700_hash_a_cleanup( &has, NULL ); - - // TRD : success on overwrite - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); - - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 1 ); - apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); - - if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); - apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); - - if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - lfds700_hash_a_cleanup( &has, NULL ); - - util_aligned_free( baus ); - - // TRD : print the test result - internal_display_test_result( 1, "hash_a", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *key_in_tree ) -{ - int - cr = 0; - - // TRD : key_new can be any value in its range - // TRD : key_in_tree can be any value in its range - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) -{ - // TRD : key can be NULL - assert( hash != NULL ); - - *hash = 0; - - /* TRD : this function iterates over the user data - and we are using the void pointer *as* key data - so here we need to pass in the addy of key - */ - - LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); - - return; -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c deleted file mode 100644 index 29c5fae865..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c +++ /dev/null @@ -1,388 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_hash_a_element - hae; - - lfds700_pal_uint_t - key; -}; - -struct test_state -{ - lfds700_pal_uint_t - number_elements_per_thread, - overwrite_count; - - struct lfds700_hash_a_state - *has; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); -static int key_compare_function( void const *new_key, void const *existing_key ); -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); -static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ); - - - - - -/****************************************************************************/ -void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - int - rv; - - lfds700_pal_uint_t - actual_sum_overwrite_existing_count, - expected_sum_overwrite_existing_count, - *key_count_array, - loop, - number_elements_per_thread, - number_elements_total, - number_logical_processors, - random_value; - - struct lfds700_hash_a_iterate - hai; - - struct lfds700_hash_a_element - *hae; - - struct lfds700_hash_a_state - has; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_btree_au_state - *baus; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *element_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - void - *key_pointer, - *key; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single hash_a - we generate n elements per thread - each element contains a key value, which is set to a random value - (we don't use value, so it's just set to 0) - the threads then run, putting - the threads count their number of overwrite hits - once the threads are done, then we - count the number of each key - from this we figure out the min/max element for hash_a validation, so we call validation - we check the sum of overwrites for each thread is what it should be - then using the hash_a get() we check all the elements we expect are present - and then we iterate over the hash_a - checking we see each key once - */ - - internal_display_test_name( "Random adds, get and iterate (overwrite on existing key)" ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); - - // TRD : we divide by 2 beccause we have to allocate a second array of this size later - number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ) / 2; - number_elements_total = number_elements_per_thread * number_logical_processors; - - // TRD : created an ordered list of unique numbers - element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - { - random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); - (element_array+loop)->key = (lfds700_pal_uint_t) floor( (number_elements_total/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->has = &has; - (ts+loop)->element_array = element_array + number_elements_per_thread*loop; - (ts+loop)->overwrite_count = 0; - (ts+loop)->number_elements_per_thread = number_elements_per_thread; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - // TRD : now for validation - key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements_total ); - for( loop = 0 ; loop < number_elements_total ; loop++ ) - *(key_count_array+loop) = 0; - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - ( *(key_count_array + (element_array+loop)->key) )++; - - vi.min_elements = number_elements_total; - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - if( *(key_count_array+loop) == 0 ) - vi.min_elements--; - - vi.max_elements = vi.min_elements; - - lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); - - expected_sum_overwrite_existing_count = 0; - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - if( *(key_count_array+loop) != 0 ) - expected_sum_overwrite_existing_count += *(key_count_array+loop) - 1; - - actual_sum_overwrite_existing_count = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - actual_sum_overwrite_existing_count += (ts+loop)->overwrite_count; - - if( expected_sum_overwrite_existing_count != actual_sum_overwrite_existing_count ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : now loop over the expected array and check we can get() every element - for( loop = 0 ; loop < number_elements_total ; loop++ ) - if( *(key_count_array+loop) > 0 ) - { - rv = lfds700_hash_a_get_by_key( &has, (void *) loop, &hae ); - - if( rv != 1 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - - /* TRD : now iterate, checking we find every element and no others - to do this in a timely manner, we need to qsort() the key values - and use bsearch() to check for items in the array - */ - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - if( *(key_count_array+loop) != 0 ) - *(key_count_array+loop) = loop; - else - *(key_count_array+loop) = 0; - - qsort( key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); - - lfds700_hash_a_iterate_init( &has, &hai ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) - { - key = LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( *hae ); - - key_pointer = bsearch( &key, key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); - - if( key_pointer == NULL ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - - // TRD : cleanup - lfds700_hash_a_cleanup( &has, NULL ); - - util_aligned_free( baus ); - - free( ts ); - - util_aligned_free( element_array ); - - free( key_count_array ); - - // TRD : print the test result - internal_display_test_result( 1, "hash_a", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) -{ - enum lfds700_hash_a_insert_result - apr; - - lfds700_pal_uint_t - index = 0; - - struct test_state - *ts; - - struct lfds700_misc_prng_state - ps; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( index < ts->number_elements_per_thread ) - { - LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); - LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, 0 ); - apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); - - if( apr == LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) - ts->overwrite_count++; - - index++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int key_compare_function( void const *new_key, void const *existing_key ) -{ - int - cr = 0; - - // TRD : new_key can be NULL (i.e. 0) - // TRD : existing_key can be NULL (i.e. 0) - - if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) - cr = -1; - - if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) -{ - // TRD : key can be NULL - assert( hash != NULL ); - - *hash = 0; - - /* TRD : this function iterates over the user data - and we are using the void pointer *as* key data - so here we need to pass in the addy of key - */ - - LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); - - return; -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ) -{ - int - cr = 0; - - lfds700_pal_uint_t - s1, - s2; - - s1 = *(lfds700_pal_uint_t *) e1; - s2 = *(lfds700_pal_uint_t *) e2; - - if( s1 > s2 ) - cr = 1; - - if( s1 < s2 ) - cr = -1; - - return( cr ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c deleted file mode 100644 index 5720aa2428..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c +++ /dev/null @@ -1,31 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) - { - printf( "\n" - "List (add-only, ordered, singly-linked) Tests\n" - "=============================================\n" ); - - test_lfds700_list_aos_alignment(); - test_lfds700_list_aos_new_ordered( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_list_aos_new_ordered_with_cursor( list_of_logical_processors, memory_in_megabytes ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c deleted file mode 100644 index 7726346366..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c +++ /dev/null @@ -1,58 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_list_aos_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_list_aos_element - if( offsetof(struct lfds700_list_aos_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_aos_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_aos_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : struct lfds700_list_asu_state - if( offsetof(struct lfds700_list_aos_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_aos_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_aos_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "list_aos", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c deleted file mode 100644 index 3a392b33bd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c +++ /dev/null @@ -1,278 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_list_aos_element - laose; - - lfds700_pal_uint_t - element_number, - thread_number; -}; - -struct test_state -{ - lfds700_pal_uint_t - number_elements_per_thread; - - struct lfds700_list_aos_state - *laoss; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static int new_ordered_compare_function( void const *value_new, void const *value_in_list ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - expected_element_number, - number_elements_per_thread, - number_elements_total, - number_logical_processors, - offset, - temp; - - struct lfds700_list_aos_element - *laose = NULL; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_list_aos_state - laoss; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct test_element - *element_array, - *element; - - struct test_state - *ts; - - struct util_thread_starter_state - *tts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : run one thread per logical processor - we have a single array of 10k elements per thread - this is set to be randomly ordered (but with contigious numbers from 0 to n) - we give 10k to each thread (a pointer into the array at the correct point) - which then loops through that array - calling lfds700_list_aos_insert_element_by_position( LFDS700_LIST_AOS_POSITION_ORDERED ) - verification should show list is sorted - */ - - internal_display_test_name( "New ordered" ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); - - /* TRD : create randomly ordered number array with unique elements - - unique isn't necessary - the list will sort anyway - but - it permits slightly better validation - */ - - number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - // TRD : or the test takes a looooooong time... - if( number_elements_per_thread > 10000 ) - number_elements_per_thread = 10000; - - number_elements_total = number_elements_per_thread * number_logical_processors; - - element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - (element_array+loop)->element_number = loop; - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - { - offset = LFDS700_MISC_PRNG_GENERATE( &ps ); - offset %= number_elements_total; - temp = (element_array + offset)->element_number; - (element_array + offset)->element_number = (element_array + loop)->element_number; - (element_array + loop)->element_number = temp; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->laoss = &laoss; - (ts+loop)->element_array = element_array + (loop*number_elements_per_thread); - (ts+loop)->number_elements_per_thread = number_elements_per_thread; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_thread, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - free( ts ); - - /* TRD : validate the resultant list - iterate over the list - we expect to find the list is sorted, - which means that element_number will - increment from zero - */ - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements_total; - - lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - { - expected_element_number = 0; - - // TRD : traverse the list and check combined_data_array matches - while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(laoss, laose) ) - { - element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); - - if( element->element_number != expected_element_number++ ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - } - - lfds700_list_aos_cleanup( &laoss, NULL ); - - util_aligned_free( element_array ); - - internal_display_test_result( 1, "list_aos", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int new_ordered_compare_function( void const *value_new, void const *value_in_list ) -{ - int - cr = 0; - - struct test_element - *e1, - *e2; - - // TRD : value_new can be any value in its range - // TRD : value_in_list can be any value in its range - - e1 = (struct test_element *) value_new; - e2 = (struct test_element *) value_in_list; - - if( e1->element_number < e2->element_number ) - cr = -1; - - if( e1->element_number > e2->element_number ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) - { - LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); - LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); - lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c deleted file mode 100644 index 42e0ebc7a5..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c +++ /dev/null @@ -1,366 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_list_aos_element - laose; - - lfds700_pal_uint_t - element_number, - thread_number; -}; - -struct test_state -{ - enum flag - error_flag; - - lfds700_pal_uint_t - number_elements_per_thread; - - struct lfds700_list_aos_state - *laoss; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements_per_thread, - number_elements_total, - number_logical_processors, - offset, - temp; - - struct lfds700_list_aos_state - laoss; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *element_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : run two threads per logical processor - - the test runs for 10 seconds - - the first thread loops over a pre-set list of random numbers - continually adding them using ordered insert - - the second thread keeps iterating over the list, checking that - each element is larger than its predecessor - */ - - internal_display_test_name( "New ordered with cursor (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_with_cursor_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); - - /* TRD : create randomly ordered number array with unique elements - - unique isn't necessary - the list will sort anyway - but - it permits slightly better validation - */ - - number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - // TRD : or the test takes a looooooong time... - if( number_elements_per_thread > 1000 ) - number_elements_per_thread = 1000; - - number_elements_total = number_elements_per_thread * number_logical_processors; - - element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - (element_array+loop)->element_number = loop; - - for( loop = 0 ; loop < number_elements_total ; loop++ ) - { - offset = LFDS700_MISC_PRNG_GENERATE( &ps ); - offset %= number_elements_total; - temp = (element_array + offset)->element_number; - (element_array + offset)->element_number = (element_array + loop)->element_number; - (element_array + loop)->element_number = temp; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors * 2 ); - - // TRD : the insert threads - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->laoss = &laoss; - (ts+loop)->element_array = element_array + number_elements_per_thread*loop; - (ts+loop)->error_flag = LOWERED; - (ts+loop)->number_elements_per_thread = number_elements_per_thread; - } - - // TRD : the cursor threads - for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) - { - (ts+loop)->laoss = &laoss; - (ts+loop)->element_array = NULL; - (ts+loop)->error_flag = LOWERED; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); - - util_thread_starter_new( &tts, number_logical_processors * 2 ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_with_cursor_insert_thread, ts+loop ); - util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, new_ordered_with_cursor_cursor_thread, ts+loop+number_logical_processors ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - /* TRD : validate the resultant list - - the cursor threads were checking for orderedness - if that failed, they raise their error_flag - so validate the list, then check error_flags - */ - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements_total; - - lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - if( dvs == LFDS700_MISC_VALIDITY_VALID ) - for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ORDER; - - lfds700_list_aos_cleanup( &laoss, NULL ); - - util_aligned_free( element_array ); - - free( ts ); - - internal_display_test_result( 1, "list_aos", dvs ); - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ) -{ - int - cr = 0; - - struct test_element - *e1, - *e2; - - // TRD : value_new can be any value in its range - // TRD : value_in_list can be any value in its range - - e1 = (struct test_element *) value_new; - e2 = (struct test_element *) value_in_list; - - if( e1->element_number < e2->element_number ) - cr = -1; - - if( e1->element_number > e2->element_number ) - cr = 1; - - return( cr ); -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) - { - LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); - LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); - lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - prev_element_number; - - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_list_aos_element - *laose; - - struct test_element - *element; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - prev_element_number = 0; - - laose = LFDS700_LIST_AOS_GET_START( *ts->laoss ); - - // TRD : we may get start before any element has been added to the list - if( laose == NULL ) - continue; - - element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); - - if( element->element_number < prev_element_number ) - ts->error_flag = RAISED; - - prev_element_number = element->element_number; - - laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); - - while( laose != NULL ) - { - element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); - - if( element->element_number <= prev_element_number ) - ts->error_flag = RAISED; - - prev_element_number = element->element_number; - - laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); - } - - if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c deleted file mode 100644 index 37c37f2529..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c +++ /dev/null @@ -1,32 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) - { - printf( "\n" - "List (add-only, singly-linked, unordered) Tests\n" - "===============================================\n" ); - - test_lfds700_list_asu_alignment(); - test_lfds700_list_asu_new_start( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_list_asu_new_end( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_list_asu_new_after( list_of_logical_processors, memory_in_megabytes ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c deleted file mode 100644 index 43f451d4bf..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c +++ /dev/null @@ -1,61 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_list_asu_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_list_asu_element - if( offsetof(struct lfds700_list_asu_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_asu_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_asu_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : struct lfds700_list_asu_state - if( offsetof(struct lfds700_list_asu_state,end) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_asu_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_asu_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_list_asu_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "list_asu", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c deleted file mode 100644 index 5dcd6954aa..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c +++ /dev/null @@ -1,254 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_list_asu_element - lasue; - - lfds700_pal_uint_t - element_number, - thread_number; -}; - -struct test_state -{ - lfds700_pal_uint_t - number_elements; - - struct lfds700_list_asu_state - *lasus; - - struct test_element - *element_array; - - struct lfds700_list_asu_element - *first_element; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - *per_thread_counters, - subloop; - - struct lfds700_list_asu_element - *lasue, - first_element; - - struct lfds700_list_asu_state - lasus; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *element_array, - *element; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : run one thread per logical processor - run for 250k elements - we put a single first element into the list and - each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_AFTER ), - inserting after the single first element - data element contain s thread_number and element_number - verification should show element_number decreasing on a per thread basis - */ - - internal_display_test_name( "New after" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); - - LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( first_element, NULL ); - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( first_element, NULL ); - lfds700_list_asu_insert_at_position( &lasus, &first_element, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - (element_array+(loop*number_elements)+subloop)->thread_number = loop; - (element_array+(loop*number_elements)+subloop)->element_number = subloop; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - {\ - (ts+loop)->lasus = &lasus; - (ts+loop)->element_array = element_array + (loop*number_elements); - (ts+loop)->first_element = &first_element; - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_after_thread, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - free( ts ); - - /* TRD : validate the resultant list - iterate over each element - we expect to find element numbers increment on a per thread basis - */ - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors + 1; - - lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = number_elements - 1; - - /* TRD : we have a leading element, after which all inserts occurred - we need to get past that element for validation - this is why we're not using lfds700_list_asu_get_start_and_then_next() - */ - - lasue = LFDS700_LIST_ASU_GET_START( lasus ); - - lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lasue != NULL ) - { - element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - if( element->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( element->element_number < per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element->element_number > per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( element->element_number == per_thread_counters[element->thread_number] ) - per_thread_counters[element->thread_number]--; - - lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); - } - - free( per_thread_counters ); - - lfds700_list_asu_cleanup( &lasus, NULL ); - - util_aligned_free( element_array ); - - internal_display_test_result( 1, "list_asu", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, ts->first_element, LFDS700_LIST_ASU_POSITION_AFTER, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c deleted file mode 100644 index c6c66d007c..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c +++ /dev/null @@ -1,229 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_list_asu_element - lasue; - - lfds700_pal_uint_t - element_number, - thread_number; -}; - -struct test_state -{ - lfds700_pal_uint_t - number_elements; - - struct lfds700_list_asu_state - *lasus; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - *per_thread_counters, - subloop; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_list_asu_state - lasus; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *element_array, - *element; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : run one thread per logical processor - run for 250k elements - each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_END ) - data element contain a thread_number and element_number - verification should show element_number increasing on a per thread basis - */ - - internal_display_test_name( "New end" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - (element_array+(loop*number_elements)+subloop)->thread_number = loop; - (element_array+(loop*number_elements)+subloop)->element_number = subloop; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->lasus = &lasus; - (ts+loop)->element_array = element_array + (loop*number_elements); - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_end_thread, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - free( ts ); - - /* TRD : validate the resultant list - iterate over each element - we expect to find element numbers increment on a per thread basis - */ - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors; - - lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = 0; - - lasue = NULL; - - while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) - { - element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - if( element->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( element->element_number > per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element->element_number < per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( element->element_number == per_thread_counters[element->thread_number] ) - per_thread_counters[element->thread_number]++; - } - - free( per_thread_counters ); - - lfds700_list_asu_cleanup( &lasus, NULL ); - - util_aligned_free( element_array ); - - internal_display_test_result( 1, "list_asu", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_END, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c deleted file mode 100644 index f4244e2a12..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c +++ /dev/null @@ -1,229 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - struct lfds700_list_asu_element - lasue; - - lfds700_pal_uint_t - element_number, - thread_number; -}; - -struct test_state -{ - lfds700_pal_uint_t - number_elements; - - struct lfds700_list_asu_state - *lasus; - - struct test_element - *element_array; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - *per_thread_counters, - subloop; - - struct lfds700_list_asu_element - *lasue = NULL; - - struct lfds700_list_asu_state - lasus; - - struct lfds700_misc_validation_info - vi; - - struct test_element - *element_array, - *element; - - struct test_state - *ts; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : run one thread per logical processor - run for 250k elements - each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_START ) - data element contain s thread_number and element_number - verification should show element_number decreasing on a per thread basis - */ - - internal_display_test_name( "New start" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - (element_array+(loop*number_elements)+subloop)->thread_number = loop; - (element_array+(loop*number_elements)+subloop)->element_number = subloop; - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->lasus = &lasus; - (ts+loop)->element_array = element_array + (loop*number_elements); - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_start_thread, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - free( ts ); - - LFDS700_MISC_BARRIER_LOAD; - - /* TRD : validate the resultant list - iterate over each element - we expect to find element numbers increment on a per thread basis - */ - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors; - - lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = number_elements - 1; - - lasue = NULL; - - while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) - { - element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - if( element->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( element->element_number < per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( element->element_number > per_thread_counters[element->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( element->element_number == per_thread_counters[element->thread_number] ) - per_thread_counters[element->thread_number]--; - } - - free( per_thread_counters ); - - lfds700_list_asu_cleanup( &lasus, NULL ); - - util_aligned_free( element_array ); - - internal_display_test_result( 1, "list_asu", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); - lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c deleted file mode 100644 index 2f733909a7..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c +++ /dev/null @@ -1,33 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - printf( "\n" - "Abstraction Atomic Tests\n" - "========================\n" ); - - if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) - test_lfds700_pal_atomic_cas( list_of_logical_processors ); - - if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) - test_lfds700_pal_atomic_dwcas( list_of_logical_processors ); - - if( LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) - test_lfds700_pal_atomic_exchange( list_of_logical_processors, memory_in_megabytes ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c deleted file mode 100644 index 543528d99c..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c +++ /dev/null @@ -1,176 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_lfds700_pal_atomic_cas_state -{ - lfds700_pal_uint_t - local_counter; - - lfds700_pal_atom_t volatile - *shared_counter; -}; - -/***** private prototyps *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - shared_counter; - - lfds700_pal_uint_t - local_total = 0; - - lfds700_pal_uint_t - loop, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_lfds700_pal_atomic_cas_state - *atcs; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - - /* TRD : here we test pal_cas - - we run one thread per CPU - we use pal_cas() to increment a shared counter - every time a thread successfully increments the counter, - it increments a thread local counter - the threads run for ten seconds - after the threads finish, we total the local counters - they should equal the shared counter - */ - - internal_display_test_name( "Atomic CAS" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - shared_counter = 0; - - atcs = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_cas_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (atcs+loop)->shared_counter = &shared_counter; - (atcs+loop)->local_counter = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_cas, atcs+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - // TRD : results - LFDS700_MISC_BARRIER_LOAD; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - local_total += (atcs+loop)->local_counter; - - if( local_total == shared_counter ) - puts( "passed" ); - - if( local_total != shared_counter ) - { - puts( "failed" ); - exit( EXIT_FAILURE ); - } - - // TRD : cleanup - free( atcs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ) -{ - char unsigned - result; - - lfds700_pal_uint_t - loop = 0; - - lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) - exchange, - compare; - - struct test_lfds700_pal_atomic_cas_state - *atcs; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - atcs = (struct test_lfds700_pal_atomic_cas_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - while( loop++ < 10000000 ) - { - compare = *atcs->shared_counter; - - do - { - exchange = compare + 1; - LFDS700_PAL_ATOMIC_CAS( atcs->shared_counter, &compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); - } - while( result == 0 ); - - atcs->local_counter++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c deleted file mode 100644 index 4973e73770..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c +++ /dev/null @@ -1,177 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_lfds700_pal_atomic_dwcas_state -{ - lfds700_pal_uint_t - local_counter; - - lfds700_pal_atom_t volatile - (*shared_counter)[2]; -}; - -/***** private prototyps *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - lfds700_pal_uint_t - local_total = 0, - loop, - number_logical_processors; - - lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - shared_counter[2] = { 0, 0 }; - - struct lfds700_list_asu_element - *lasue; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_lfds700_pal_atomic_dwcas_state - *atds; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - - /* TRD : here we test pal_dwcas - - we run one thread per CPU - we use pal_dwcas() to increment a shared counter - every time a thread successfully increments the counter, - it increments a thread local counter - the threads run for ten seconds - after the threads finish, we total the local counters - they should equal the shared counter - */ - - internal_display_test_name( "Atomic DWCAS" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - atds = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_dwcas_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (atds+loop)->shared_counter = &shared_counter; - (atds+loop)->local_counter = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_dwcas, atds+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - // TRD : results - LFDS700_MISC_BARRIER_LOAD; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - local_total += (atds+loop)->local_counter; - - if( local_total == shared_counter[0] ) - puts( "passed" ); - - if( local_total != shared_counter[0] ) - { - printf( "%llu != %llu\n", (int long long unsigned) local_total, (int long long unsigned) shared_counter[0] ); - puts( "failed" ); - exit( EXIT_FAILURE ); - } - - // TRD : cleanup - free( atds ); - - return; -} - -#pragma warning( disable : 4702 ) - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ) -{ - char unsigned - result; - - lfds700_pal_uint_t - loop = 0; - - lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) - exchange[2], - compare[2]; - - struct test_lfds700_pal_atomic_dwcas_state - *atds; - - struct util_thread_starter_thread_state - *tsts; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - atds = (struct test_lfds700_pal_atomic_dwcas_state *) tsts->thread_user_state; - - LFDS700_MISC_BARRIER_LOAD; - - util_thread_starter_ready_and_wait( tsts ); - - while( loop++ < 10000000 ) - { - compare[0] = (*atds->shared_counter)[0]; - compare[1] = (*atds->shared_counter)[1]; - - do - { - exchange[0] = compare[0] + 1; - exchange[1] = compare[1]; - LFDS700_PAL_ATOMIC_DWCAS( atds->shared_counter, compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); - } - while( result == 0 ); - - atds->local_counter++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c deleted file mode 100644 index ba6366e524..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c +++ /dev/null @@ -1,333 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - counter, - *counter_array, - number_elements, - number_logical_processors; - - lfds700_pal_uint_t volatile - *shared_exchange; -}; - -/***** private prototyps *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum flag - atomic_exchange_success_flag = RAISED, - exchange_success_flag = RAISED; - - lfds700_pal_uint_t - loop, - *merged_counter_arrays, - number_elements, - number_logical_processors, - subloop; - - lfds700_pal_uint_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) - exchange; - - struct lfds700_list_asu_element - *lasue; - - struct test_state - *ts; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : here we test pal_atomic_exchange - - we have one thread per logical core - there is one variable which every thread will exchange to/from - we know the number of logical cores - the threads have a counter each, which begins with their logical core number plus one - (plus one because the exchange counter begins with 0 already in place) - (e.g. thread 0 begins with its counter at 1, thread 1 begins with its counter at 2, etc) - - there is an array per thread of 1 million elements, each a counter, set to 0 - - when running, each thread increments its counter by the number of threads - the threads busy loop, exchanging - every time aa thread pulls a number off the central, shared exchange variable, - it increments the counter for that variable in its thread-local counter array - - (we're not using a global array, because we'd have to be atomic in our increments, - which is a slow-down we don't want) - - at the end, we merge all the counter arrays and if the frequency for a counter is a value - other than 1, the exchange was not atomic - - we perform the test twice, once with pal_atomic_exchange, once with a non-atomic exchange - - we expect the atomic to pass and the non-atomic to fail - */ - - internal_display_test_name( "Atomic exchange" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(lfds700_pal_uint_t) * (number_logical_processors + 1) ); - - merged_counter_arrays = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); - - for( loop = 0 ; loop < number_elements ; loop++ ) - *(merged_counter_arrays+loop) = 0; - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->counter = loop + 1; - (ts+loop)->counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - *((ts+loop)->counter_array+subloop) = 0; - (ts+loop)->number_logical_processors = number_logical_processors; - (ts+loop)->shared_exchange = &exchange; - (ts+loop)->number_elements = number_elements; - } - - exchange = 0; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - // TRD : non-atomic - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_exchange, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - LFDS700_MISC_BARRIER_LOAD; - - for( loop = 0 ; loop < number_elements ; loop++ ) - for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) - *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); - - /* TRD : the worker threads exit when their per-thread counter exceeds 1,000,000 - as such the final number_logical_processors numbers are not read - we could change the threads to exit when the number they read exceeds 1,000,000 - but then we'd need an if() in their work-loop, - and we need to go as fast as possible - */ - - for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) - if( *(merged_counter_arrays+loop) != 1 ) - exchange_success_flag = LOWERED; - - // TRD : now for atomic exchange - we need to re-init the data structures - - for( loop = 0 ; loop < number_elements ; loop++ ) - *(merged_counter_arrays+loop) = 0; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - *((ts+loop)->counter_array+subloop) = 0; - - exchange = 0; - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_atomic_exchange, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - for( loop = 0 ; loop < number_elements ; loop++ ) - for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) - *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); - - for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) - if( *(merged_counter_arrays+loop) != 1 ) - atomic_exchange_success_flag = LOWERED; - - // TRD : cleanup - free( merged_counter_arrays ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - free( (ts+loop)->counter_array ); - - util_thread_starter_delete( tts ); - free( thread_handles ); - free( ts ); - - /* TRD : results - - on a single core, atomic and non-atomic exchange should both work - - if we find our non-atomic test passes, then we can't really say anything - about whether or not the atomic test is really working - */ - - LFDS700_MISC_BARRIER_LOAD; - - if( number_logical_processors == 1 ) - { - if( exchange_success_flag == RAISED and atomic_exchange_success_flag == RAISED ) - puts( "passed" ); - - if( exchange_success_flag != RAISED or atomic_exchange_success_flag != RAISED ) - puts( "failed (atomic and non-atomic both failed)" ); - } - - if( number_logical_processors >= 2 ) - { - if( atomic_exchange_success_flag == RAISED and exchange_success_flag == LOWERED ) - puts( "passed" ); - - if( atomic_exchange_success_flag == RAISED and exchange_success_flag == RAISED ) - puts( "indeterminate (atomic and non-atomic both passed)" ); - - if( atomic_exchange_success_flag == LOWERED ) - { - puts( "failed (atomic failed)" ); - exit( EXIT_FAILURE ); - } - } - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - local_counter, - exchange; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - local_counter = ts->counter; - - while( local_counter < ts->number_elements ) - { - exchange = *ts->shared_exchange; - *ts->shared_exchange = local_counter; - - ( *(ts->counter_array + exchange) )++; - - local_counter += ts->number_logical_processors; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - local_counter, - exchange; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - local_counter = ts->counter; - - while( local_counter < ts->number_elements ) - { - exchange = local_counter; - - LFDS700_PAL_ATOMIC_EXCHANGE( ts->shared_exchange, &exchange ); - - ( *(ts->counter_array + exchange) )++; - - local_counter += ts->number_logical_processors; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c deleted file mode 100644 index 8e41b01b5d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c +++ /dev/null @@ -1,35 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) - { - printf( "\n" - "Queue Tests\n" - "===========\n" ); - - test_lfds700_queue_alignment(); - test_lfds700_queue_enqueuing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue_dequeuing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue_enqueuing_and_dequeuing( list_of_logical_processors ); - test_lfds700_queue_rapid_enqueuing_and_dequeuing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue_enqueuing_and_dequeuing_with_free( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( list_of_logical_processors ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c deleted file mode 100644 index 6f723825ea..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c +++ /dev/null @@ -1,55 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_queue_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_queue_element - if( offsetof(struct lfds700_queue_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_queue_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : struct lfds700_queue_state - if( offsetof(struct lfds700_queue_state,enqueue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_queue_state,dequeue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_queue_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "queue", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c deleted file mode 100644 index 4c660ab3e1..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c +++ /dev/null @@ -1,25 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - printf( "\n" - "Queue (bounded, single consumer, single producer) Tests\n" - "=======================================================\n" ); - - // TRD : no alignment checks are required for queue_bss - test_lfds700_queue_bss_enqueuing(); - test_lfds700_queue_bss_dequeuing(); - test_lfds700_queue_bss_enqueuing_and_dequeuing( list_of_logical_processors ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c deleted file mode 100644 index 971555c443..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c +++ /dev/null @@ -1,61 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds700_queue_bss_dequeuing() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop; - - struct lfds700_queue_bss_element - element_array[128]; - - struct lfds700_queue_bss_state - qs; - - struct lfds700_misc_validation_info - vi; - - void - *value; - - /* TRD : create an empty queue - enqueue 128 elements - then dequeue the elements, in the same thread - we're API testing - it's a single producer queue, so we just do this in our current thread - since we're enqueuing and dequeuing in the same thread, - - */ - - internal_display_test_name( "Dequeuing" ); - - lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); - - for( loop = 0 ; loop < 127 ; loop++ ) - lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); - - for( loop = 0 ; loop < 127 ; loop++ ) - { - lfds700_queue_bss_dequeue( &qs, NULL, &value ); - if( (lfds700_pal_uint_t) value != 127 - loop ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - } - - vi.min_elements = vi.max_elements = 0; - - lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); - - lfds700_queue_bss_cleanup( &qs, NULL ); - - internal_display_test_result( 1, "queue_bss", dvs ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c deleted file mode 100644 index 807337864a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c +++ /dev/null @@ -1,59 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void test_lfds700_queue_bss_enqueuing() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - int - rv; - - lfds700_pal_uint_t - loop; - - struct lfds700_queue_bss_element - element_array[128]; - - struct lfds700_queue_bss_state - qs; - - struct lfds700_misc_validation_info - vi; - - /* TRD : create an empty queue - enqueue 128 elements - it's a single producer queue, so we just do this in our current thread - it's an API test - */ - - internal_display_test_name( "Enqueuing" ); - - lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); - - for( loop = 0 ; loop < 127 ; loop++ ) - if( 1 != lfds700_queue_bss_enqueue(&qs, NULL, (void *) loop) ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : at this point enqueuing one more should return 0 - rv = lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); - - if( rv != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - vi.min_elements = vi.max_elements = 127; - - lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); - - lfds700_queue_bss_cleanup( &qs, NULL ); - - internal_display_test_result( 1, "queue_bss", dvs ); - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c deleted file mode 100644 index ad218609fd..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c +++ /dev/null @@ -1,260 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - enum flag - error_flag; - - struct lfds700_queue_bss_state - *qs; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_logical_processors, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_queue_bss_element - element_array[4]; - - struct lfds700_queue_bss_state - qs; - - struct test_pal_logical_processor - *lp, - *lp_first; - - struct util_thread_starter_state - *tts; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - - /* TRD : so, this is the real test - problem is, because we use memory barriers only - and we only support one producer and one consumer - we need to ensure these threads are on different physical cores - if they're on the same core, the code would work even without memory barriers - - problem is, in the test application, we only know the *number* of logical cores - obtaining topology information adds a great deal of complexity to the test app - and makes porting much harder - - so, we know how many logical cores there are; my thought is to partially - permutate over them - we always run the producer on core 0, but we iterate - over the other logical cores, running the test once each time, with the - consumer being run on core 0, then core 1, then core 2, etc - - (we run on core 0 for the single-cpu case; it's redundent, since a single - logical core running both producer and consumer will work, but otherwise - we have to skip the test, which is confusing for the user) - - the test is one thread enqueuing and one thread dequeuing for two seconds - */ - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", number_logical_processors * 2 ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * 2 ); - - for( loop = 0 ; loop < 2 ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->error_flag = LOWERED; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * 2 ); - - /* TRD : producer always on core 0 - iterate over the other cores with consumer - */ - - lasue = LFDS700_LIST_ASU_GET_START( *list_of_logical_processors ); - lp_first = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - while( lasue != NULL ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - - lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 4, NULL ); - - util_thread_starter_new( &tts, 2 ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - util_thread_starter_start( tts, &thread_handles[0], 0, lp_first, thread_enqueuer, ts ); - util_thread_starter_start( tts, &thread_handles[1], 1, lp, thread_dequeuer, ts+1 ); - - util_thread_starter_run( tts ); - - for( subloop = 0 ; subloop < 2 ; subloop++ ) - test_pal_thread_wait( thread_handles[subloop] ); - - util_thread_starter_delete( tts ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_queue_bss_cleanup( &qs, NULL ); - - lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); - } - - if( (ts+1)->error_flag == RAISED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - free( thread_handles ); - - free( ts ); - - internal_display_test_result( 1, "queue_bss", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ) -{ - int - rv; - - lfds700_pal_uint_t - datum = 0, - time_loop = 0; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + 2 ) - { - rv = lfds700_queue_bss_enqueue( ts->qs, NULL, (void *) datum ); - - if( rv == 1 ) - if( ++datum == 4 ) - datum = 0; - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ) -{ - int - rv; - - lfds700_pal_uint_t - datum, - expected_datum = 0, - time_loop = 0; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_BARRIER_LOAD; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + 2 ) - { - rv = lfds700_queue_bss_dequeue( ts->qs, NULL, (void *) &datum ); - - if( rv == 1 ) - { - if( datum != expected_datum ) - ts->error_flag = RAISED; - - if( ++expected_datum == 4 ) - expected_datum = 0; - } - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c deleted file mode 100644 index 74f271d320..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c +++ /dev/null @@ -1,215 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - enum flag - error_flag; - - struct lfds700_queue_state - *qs; -}; - -struct test_element -{ - struct lfds700_queue_element - qe; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements_with_dummy_element, - number_elements_without_dummy_element, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_state - qs; - - struct lfds700_misc_validation_info - vi = { 0, 0 }; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : create a queue, add 1,000,000 elements - - use a single thread to enqueue every element - each elements user data is an incrementing counter - - then run one thread per CPU - where each busy-works dequeuing - - when an element is dequeued, we check (on a per-thread basis) the - value dequeued is greater than the element previously dequeued - - note we have no variation in the test for CAS+GC vs DWCAS - this is because all we do is dequeue - what we actually want to stress test is the queue - not CAS - so it's better to let the dequeue run as fast as possible - */ - - internal_display_test_name( "Dequeuing" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); - number_elements_without_dummy_element = number_elements_with_dummy_element - 1; - - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array + number_elements_without_dummy_element)->qe, &ps, NULL ); - - for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) - { - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, loop ); - lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->error_flag = LOWERED; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_dequeuer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - // TRD : check queue is empty - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - // TRD : check for raised error flags - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - free( ts ); - - util_aligned_free( te_array ); - - lfds700_queue_cleanup( &qs, NULL ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - *prev_value, - *value; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - lfds700_queue_dequeue( ts->qs, &qe, &ps ); - prev_value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - util_thread_starter_ready_and_wait( tsts ); - - while( lfds700_queue_dequeue(ts->qs, &qe, &ps) ) - { - value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - if( value <= prev_value ) - ts->error_flag = RAISED; - - prev_value = value; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c deleted file mode 100644 index 89ccf30fcb..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c +++ /dev/null @@ -1,239 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - number_elements, - thread_number; - - struct lfds700_queue_state - *qs; - - struct test_element - *te_array; -}; - -struct test_element -{ - struct lfds700_queue_element - qe; - - lfds700_pal_uint_t - counter, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - *per_thread_counters, - loop, - number_elements, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - dummy_qe, - *qe; - - struct lfds700_queue_state - qs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : create an empty queue - then run one thread per CPU - where each thread busy-works, enqueuing elements from a freelist (one local freelist per thread) - until 100000 elements are enqueued, per thread - each element's void pointer of user data is a struct containing thread number and element number - where element_number is a thread-local counter starting at 0 - - when we're done, we check that all the elements are present - and increment on a per-thread basis - */ - - internal_display_test_name( "Enqueuing" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - lfds700_queue_init_valid_on_current_logical_core( &qs, &dummy_qe, &ps, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->thread_number = loop; - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_enqueuer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - /* TRD : first, validate the queue - - then dequeue - we expect to find element numbers increment on a per thread basis - */ - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors; - - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = 0; - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) - { - te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - if( te->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( te->counter > per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( te->counter < per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( te->counter == per_thread_counters[te->thread_number] ) - per_thread_counters[te->thread_number]++; - } - - free( per_thread_counters ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - util_aligned_free( (ts+loop)->te_array ); - - free( ts ); - - lfds700_queue_cleanup( &qs, NULL ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - (ts->te_array+loop)->thread_number = ts->thread_number; - (ts->te_array+loop)->counter = loop; - } - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->qe, ts->te_array+loop ); - lfds700_queue_enqueue( ts->qs, &(ts->te_array+loop)->qe, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c deleted file mode 100644 index 1469635fd4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c +++ /dev/null @@ -1,250 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - enum flag - error_flag; - - lfds700_pal_uint_t - counter, - number_logical_processors, - *per_thread_counters, - thread_number; - - struct lfds700_queue_state - *qs; -}; - -struct test_element -{ - struct lfds700_queue_element - qe, - *qe_use; - - lfds700_pal_uint_t - counter, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_logical_processors, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_state - qs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : qt can be any value in its range - - /* TRD : create a queue with one element per thread - each thread constly dequeues and enqueues from that one queue - where when enqueuing sets in the element - its thread number and counter - and when dequeuing, checks the thread number and counter - against previously seen counter for that thread - where it should always see a higher number - */ - - internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - te_array = util_aligned_malloc( sizeof(struct test_element) * (number_logical_processors+1), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_logical_processors)->qe, &ps, NULL ); - - // TRD : we assume the test will iterate at least once (or we'll have a false negative) - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (te_array+loop)->thread_number = loop; - (te_array+loop)->counter = 0; - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); - lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->thread_number = loop; - (ts+loop)->counter = 0; - (ts+loop)->error_flag = LOWERED; - (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - (ts+loop)->number_logical_processors = number_logical_processors; - - for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) - *((ts+loop)->per_thread_counters+subloop) = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_and_dequeuer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_logical_processors; - - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - free( (ts+loop)->per_thread_counters ); - - util_aligned_free( te_array ); - - free( ts ); - - lfds700_queue_cleanup( &qs, NULL ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - lfds700_queue_dequeue( ts->qs, &qe, &ps ); - te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - if( te->thread_number >= ts->number_logical_processors ) - ts->error_flag = RAISED; - else - { - if( te->counter < ts->per_thread_counters[te->thread_number] ) - ts->error_flag = RAISED; - - if( te->counter >= ts->per_thread_counters[te->thread_number] ) - ts->per_thread_counters[te->thread_number] = te->counter+1; - } - - te->thread_number = ts->thread_number; - te->counter = ++ts->counter; - - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); - lfds700_queue_enqueue( ts->qs, qe, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c deleted file mode 100644 index 21be07052d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c +++ /dev/null @@ -1,241 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - number_of_elements_per_thread; - - struct lfds700_queue_state - *qs; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ); -static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - number_of_elements_per_thread; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct lfds700_queue_state - qs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct test_state - *ts; - - struct util_thread_starter_state - *tts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : the M&Q queue supports free()ing queue elements after they've been dequeued - we need to test this - we spawn one thread per logical core - there's one master queue which all threads work on - we create one freelist per thread - and allocate as many queue elements as we can (no payload) - - but note each allocate is its own malloc() - each freelist receives an equal share (i.e. we get the mallocs out of the way) - each thread enqueues as rapidly as possible - and dequeues as rapidly as possible - (i.e. each thread loops, doing an enqueue and a dequeue) - when the dequeue is done, the element is free()ed - */ - - internal_display_test_name( "Enqueuing and dequeuing with free" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct lfds700_freelist_element) + sizeof(struct lfds700_queue_element) ); - number_of_elements_per_thread = number_elements / number_logical_processors; - qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), (lfds700_pal_uint_t) LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->number_of_elements_per_thread = number_of_elements_per_thread; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueue_dequeuer_with_free, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = 0; - vi.max_elements = 0; - - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); - - free( ts ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ) -{ - enum flag - finished_flag = LOWERED; - - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_freelist_element - *fe, - *fe_array; - - struct lfds700_freelist_state - fs; - - struct lfds700_queue_element - *qe; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); - - fe_array = util_malloc_wrapper( sizeof(struct lfds700_freelist_element) * ts->number_of_elements_per_thread ); - - for( loop = 0 ; loop < ts->number_of_elements_per_thread ; loop++ ) - { - qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( fe_array[loop], qe ); - lfds700_freelist_push( &fs, &fe_array[loop], &ps ); - } - - util_thread_starter_ready_and_wait( tsts ); - - while( finished_flag == LOWERED ) - { - loop = 0; - while( loop++ < 1000 and lfds700_freelist_pop(&fs, &fe, &ps) ) - { - qe = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); - lfds700_queue_enqueue( ts->qs, qe, &ps ); - } - - if( loop < 1000 ) - finished_flag = RAISED; - - loop = 0; - while( loop++ < 1000 and lfds700_queue_dequeue(ts->qs, &qe, &ps) ) - util_aligned_free( qe ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - lfds700_freelist_cleanup( &fs, NULL ); - - free( fe_array ); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) -{ - assert( qs != NULL ); - assert( qe != NULL ); - // TRD : dummy_element_flag can be any value in its range - - util_aligned_free( qe ); - - return; -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c deleted file mode 100644 index 0f0fa7f081..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c +++ /dev/null @@ -1,208 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - struct lfds700_queue_state - *qs; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ); -static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_logical_processors; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct lfds700_queue_state - qs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : qt can be any value in its range - - /* TRD : one thread per logical core - each thread loops for ten seconds - mallocs and enqueues 1k elements, then dequeues and frees 1k elements - */ - - internal_display_test_name( "Enqueuing with malloc dequeuing with free (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - (ts+loop)->qs = &qs; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_with_malloc_and_dequeuer_with_free, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = 0; - - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - free( ts ); - - lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop, - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - for( loop = 0 ; loop < 1000 ; loop++ ) - { - qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - lfds700_queue_enqueue( ts->qs, qe, &ps ); - } - - for( loop = 0 ; loop < 1000 ; loop++ ) - { - lfds700_queue_dequeue( ts->qs, &qe, &ps ); - util_aligned_free( qe ); - } - - if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) -{ - assert( qs != NULL ); - assert( qe != NULL ); - // TRD : dummy_element_flag can be any value in its range - - util_aligned_free( qe ); - - return; -} - -#pragma warning( default : 4100 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c deleted file mode 100644 index ec3963a336..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c +++ /dev/null @@ -1,264 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - counter, - thread_number; - - struct lfds700_queue_state - *qs; -}; - -struct test_element -{ - struct lfds700_queue_element - qe, - *qe_use; - - lfds700_pal_uint_t - counter, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements_with_dummy_element, - number_elements_without_dummy_element, - number_logical_processors, - *per_thread_counters; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct lfds700_misc_validation_info - vi; - - struct lfds700_queue_state - qs; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array, - *te; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single queue with 50,000 elements - we don't want too many elements, so we ensure plenty of element re-use - each thread simply loops dequeuing and enqueuing - where the user data indicates thread number and an increment counter - vertification is that the counter increments on a per-thread basis - */ - - internal_display_test_name( "Rapid enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); - - if( number_elements_with_dummy_element > (10000 * number_logical_processors) + 1 ) - number_elements_with_dummy_element = (10000 * number_logical_processors) + 1; - - number_elements_without_dummy_element = number_elements_with_dummy_element - 1; - - vi.min_elements = number_elements_without_dummy_element; - vi.max_elements = number_elements_without_dummy_element; - - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_elements_without_dummy_element)->qe, &ps, NULL ); - - // TRD : we assume the test will iterate at least once (or we'll have a false negative) - for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) - { - (te_array+loop)->thread_number = loop; - (te_array+loop)->counter = 0; - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); - lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->qs = &qs; - (ts+loop)->thread_number = loop; - (ts+loop)->counter = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_enqueuer_and_dequeuer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - // TRD : now check results - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = 0; - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) - { - te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - if( te->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( per_thread_counters[te->thread_number] == 0 ) - per_thread_counters[te->thread_number] = te->counter; - - if( te->counter > per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( te->counter < per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( te->counter == per_thread_counters[te->thread_number] ) - per_thread_counters[te->thread_number]++; - } - - free( per_thread_counters ); - - lfds700_queue_cleanup( &qs, NULL ); - - util_aligned_free( te_array ); - - free( ts ); - - internal_display_test_result( 1, "queue", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_queue_element - *qe; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - lfds700_queue_dequeue( ts->qs, &qe, &ps ); - te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); - - te->thread_number = ts->thread_number; - te->counter = ts->counter++; - - LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); - lfds700_queue_enqueue( ts->qs, qe, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c deleted file mode 100644 index 0a7de0761b..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c +++ /dev/null @@ -1,31 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) - { - printf( "\n" - "Ringbuffer Tests\n" - "================\n" ); - - test_lfds700_ringbuffer_reading( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_ringbuffer_reading_and_writing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_ringbuffer_writing( list_of_logical_processors, memory_in_megabytes ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c deleted file mode 100644 index 00d378992e..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c +++ /dev/null @@ -1,217 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - enum flag - error_flag; - - lfds700_pal_uint_t - read_count; - - struct lfds700_ringbuffer_state - *rs; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; - - lfds700_pal_uint_t - loop, - number_elements_with_dummy_element, - number_elements_without_dummy_element, - number_logical_processors, - total_read = 0; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_ringbuffer_element - *re_array; - - struct lfds700_ringbuffer_state - rs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single ringbuffer - with 1,000,000 elements - we populate the ringbuffer, where the - user data is an incrementing counter - - we create one thread per CPU - where each thread busy-works, - reading until the ringbuffer is empty - - each thread keep track of the number of reads it manages - and that each user data it reads is greater than the - previous user data that was read - */ - - internal_display_test_name( "Reading" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct lfds700_ringbuffer_element); - number_elements_without_dummy_element = number_elements_with_dummy_element - 1; - - vi.min_elements = 0; - vi.max_elements = number_elements_without_dummy_element; - - re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); - - // TRD : init the ringbuffer contents for the test - for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) - lfds700_ringbuffer_write( &rs, NULL, (void *) (size_t) loop, NULL, NULL, NULL, &ps ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->rs = &rs; - (ts+loop)->read_count = 0; - (ts+loop)->error_flag = LOWERED; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_reader, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); - - // TRD : check for raised error flags - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : check thread reads total to 1,000,000 - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - total_read += (ts+loop)->read_count; - - if( total_read < number_elements_without_dummy_element ) - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( total_read > number_elements_without_dummy_element ) - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - free( ts ); - - lfds700_ringbuffer_cleanup( &rs, NULL ); - - util_aligned_free( re_array ); - - internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - *prev_value, - *value; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - lfds700_ringbuffer_read( ts->rs, NULL, (void **) &prev_value, &ps ); - ts->read_count++; - - util_thread_starter_ready_and_wait( tsts ); - - while( lfds700_ringbuffer_read(ts->rs, NULL, (void **) &value, &ps) ) - { - if( value <= prev_value ) - ts->error_flag = RAISED; - - prev_value = value; - - ts->read_count++; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c deleted file mode 100644 index 152c331892..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c +++ /dev/null @@ -1,261 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - enum flag - error_flag; - - lfds700_pal_uint_t - counter, - number_logical_processors, - *per_thread_counters, - thread_number; - - struct lfds700_ringbuffer_state - *rs; -}; - -struct test_element -{ - lfds700_pal_uint_t - datum, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; - - lfds700_pal_uint_t - loop, - number_elements_with_dummy_element, - number_elements_without_dummy_element, - number_logical_processors, - subloop; - - test_pal_thread_state_t - *thread_handles; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_ringbuffer_element - *re_array; - - struct lfds700_ringbuffer_state - rs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single ringbuffer - with 100,000 elements - the ringbuffers starts empty - - we create one thread per CPU - where each thread busy-works writing - and then immediately reading - for ten seconds - - the user data in each written element is a combination - of the thread number and the counter - - while a thread runs, it keeps track of the - counters for the other threads and throws an error - if it sees the number stay the same or decrease - */ - - internal_display_test_name( "Reading and writing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); - number_elements_without_dummy_element = number_elements_with_dummy_element - 1; - - vi.min_elements = 0; - vi.max_elements = number_elements_without_dummy_element; - - re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); - - te_array = util_malloc_wrapper( sizeof(struct test_element) * number_elements_without_dummy_element ); - - // TRD : populate the ringbuffer - for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) - { - te_array[loop].thread_number = 0; - te_array[loop].datum = (lfds700_pal_uint_t) -1 ; - lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->rs = &rs; - (ts+loop)->thread_number = loop; - (ts+loop)->counter = 0; - (ts+loop)->number_logical_processors = number_logical_processors; - (ts+loop)->error_flag = LOWERED; - (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) - *((ts+loop)->per_thread_counters+subloop) = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_reader_writer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - if( (ts+loop)->error_flag == RAISED ) - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - free( (ts+loop)->per_thread_counters ); - - free( ts ); - - lfds700_ringbuffer_cleanup( &rs, NULL ); - - util_aligned_free( re_array ); - - free( te_array ); - - internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - lfds700_ringbuffer_read( ts->rs, NULL, (void **) &te, &ps ); - - if( te->thread_number >= ts->number_logical_processors ) - ts->error_flag = RAISED; - else - { - if( te->datum < ts->per_thread_counters[te->thread_number] ) - ts->error_flag = RAISED; - - if( te->datum >= ts->per_thread_counters[te->thread_number] ) - ts->per_thread_counters[te->thread_number] = te->datum+1; - } - - te->thread_number = ts->thread_number; - te->datum = ts->counter++; - - lfds700_ringbuffer_write( ts->rs, NULL, te, NULL, NULL, NULL, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c deleted file mode 100644 index 702aabc58d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c +++ /dev/null @@ -1,272 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element -{ - lfds700_pal_uint_t - thread_number, - datum; -}; - -struct test_state -{ - lfds700_pal_uint_t - thread_number, - write_count; - - struct test_element - te; - - struct lfds700_ringbuffer_state - *rs; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; - - lfds700_pal_uint_t - loop, - number_elements_with_dummy_element, - number_elements_without_dummy_element, - number_logical_processors, - *per_thread_counters; - - test_pal_thread_state_t - *thread_handles; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_ringbuffer_element - *re_array; - - struct lfds700_ringbuffer_state - rs; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te, - *te_array; - - struct test_state - *ts; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a single ringbuffer - with n elements - we create n test elements - which are thread_number/counter pairs - init them to safe values - and fully populate the ringbuffer - - we create one thread per CPU - where each thread busy-works writing - for ten seconds; each thread has one extra element - which it uses for the first write and after that - it uses the element it picks up from overwriting - - the user data in each written element is a combination - of the thread number and the counter - - after the threads are complete, we validate by - checking the user data counters increment on a per thread - basis - */ - - internal_display_test_name( "Writing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); - number_elements_without_dummy_element = number_elements_with_dummy_element - 1; - - vi.min_elements = number_elements_without_dummy_element; - vi.max_elements = number_elements_without_dummy_element; - - re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); - - te_array = util_malloc_wrapper( sizeof(struct lfds700_ringbuffer_element) * number_elements_without_dummy_element ); - - // TRD : init the test elements and write them into the ringbuffer - for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) - { - te_array[loop].thread_number = 0; - te_array[loop].datum = 0; - lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); - } - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->rs = &rs; - (ts+loop)->thread_number = loop; - (ts+loop)->write_count = 0; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_writer, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - // TRD : now check results - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = 0; - - lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, &vi, dvs ); - - while( dvs[0] == LFDS700_MISC_VALIDITY_VALID and dvs[1] == LFDS700_MISC_VALIDITY_VALID and lfds700_ringbuffer_read(&rs, NULL, (void **) &te, &ps) ) - { - if( te->thread_number >= number_logical_processors ) - { - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( per_thread_counters[te->thread_number] == 0 ) - per_thread_counters[te->thread_number] = te->datum; - - if( te->datum < per_thread_counters[te->thread_number] ) - dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( te->datum >= per_thread_counters[te->thread_number] ) - per_thread_counters[te->thread_number] = te->datum+1; - } - - free( per_thread_counters ); - - lfds700_ringbuffer_cleanup( &rs, NULL ); - - free( ts ); - - util_aligned_free( re_array ); - - free( te_array ); - - internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ) -{ - enum lfds700_misc_flag - overwrite_occurred_flag; - - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - ts->te.thread_number = 0; - ts->te.datum = 0; - - lfds700_ringbuffer_write( ts->rs, NULL, &ts->te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - te->thread_number = ts->thread_number; - te->datum = ts->write_count++; - - lfds700_ringbuffer_write( ts->rs, NULL, te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c deleted file mode 100644 index af3a37512a..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c +++ /dev/null @@ -1,33 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) - { - printf( "\n" - "Stack Tests\n" - "===========\n" ); - - test_lfds700_stack_alignment(); - test_lfds700_stack_popping( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_stack_pushing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_stack_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); - test_lfds700_stack_rapid_popping_and_pushing( list_of_logical_processors ); - } - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c deleted file mode 100644 index 7add41bd48..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c +++ /dev/null @@ -1,43 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const - -void test_lfds700_stack_alignment() -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - /* TRD : these are compile time checks - but we do them here because this is a test programme - and it should indicate issues to users when it is *run*, - not when it is compiled, because a compile error normally - indicates a problem with the code itself and so is misleading - */ - - internal_display_test_name( "Alignment" ); - - - - // TRD : struct lfds700_stack_state - if( offsetof(struct lfds700_stack_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - if( offsetof(struct lfds700_stack_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - -#pragma warning( default : 4127 ) - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c deleted file mode 100644 index 461730604c..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c +++ /dev/null @@ -1,202 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - struct lfds700_stack_state - *ss; -}; - -struct test_element -{ - struct lfds700_stack_element - se; - - enum flag - popped_flag; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_stack_state - ss; - - struct lfds700_misc_validation_info - vi = { 0, 0 }; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create a stack - - we then populate the stack with 1,000,000 elements - each void pointer of data points to the containing test element - - we then run one thread per CPU - where each thread loops, popping as quickly as possible - upon popping, a flag is set in the containing test element - - the threads run till the source stack is empty - - we then check the poppged flag, all should be raised - - then tidy up - - no CAS+GC code, as we only pop - */ - - internal_display_test_name( "Popping" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element) ; - - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_elements ; loop++ ) - { - (te_array+loop)->popped_flag = LOWERED; - LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); - lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); - } - - ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - (ts+loop)->ss = &ss; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, (void *) &dvs ); - - // TRD : now we check each element has popped_flag set to RAISED - for( loop = 0 ; loop < number_elements ; loop++ ) - if( (te_array+loop)->popped_flag == LOWERED ) - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - - // TRD : cleanup - lfds700_stack_cleanup( &ss, NULL ); - util_aligned_free( te_array ); - util_aligned_free( ts ); - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) -{ - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_element - *se; - - struct test_element - *te; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - while( lfds700_stack_pop(ts->ss, &se, &ps) ) - { - te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); - te->popped_flag = RAISED; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c deleted file mode 100644 index 03c3254c77..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c +++ /dev/null @@ -1,316 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_element; - -struct test_state -{ - lfds700_pal_uint_t - number_elements; - - struct lfds700_stack_state - *ss, - ss_thread_local; - - struct test_element - *ss_thread_local_te_array; -}; - -struct test_element -{ - struct lfds700_stack_element - se, - thread_local_se; - - lfds700_pal_uint_t - datum; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - subloop; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_state - ss; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we have two threads per CPU - the threads loop for ten seconds - the first thread pushes 10000 elements then pops 10000 elements - the second thread pops 10000 elements then pushes 10000 elements - all pushes and pops go onto the single main stack - - after time is up, all threads push what they have remaining onto - the main stack - - we then validate the main stack - */ - - internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); - - lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); - - te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - // TRD : some initial elements so the pushing threads can start immediately - for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) - { - (te_array+loop)->datum = loop; - LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); - lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); - } - - ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - // TRD : first set of threads - (ts+loop)->ss = &ss; - (ts+loop)->number_elements = number_elements; - lfds700_stack_init_valid_on_current_logical_core( &(ts+loop)->ss_thread_local, NULL ); - - // TRD : second set of threads - (ts+loop+number_logical_processors)->ss = &ss; - (ts+loop+number_logical_processors)->number_elements = number_elements; - lfds700_stack_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); - - // TRD : fill the pushing thread stacks - (ts+loop+number_logical_processors)->ss_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( subloop = 0 ; subloop < number_elements ; subloop++ ) - { - ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->datum = loop; - LFDS700_STACK_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, (ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop ); - lfds700_stack_push( &(ts+loop+number_logical_processors)->ss_thread_local, &((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, &ps ); - } - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); - - util_thread_starter_new( &tts, number_logical_processors * 2 ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); - util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; - - lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - lfds700_stack_cleanup( &ss, NULL ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - lfds700_stack_cleanup( &(ts+loop)->ss_thread_local, NULL ); - lfds700_stack_cleanup( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); - util_aligned_free( (ts+loop+number_logical_processors)->ss_thread_local_te_array ); - } - - util_aligned_free( ts ); - - util_aligned_free( te_array ); - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - count; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_element - *se; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - start_time = time( NULL ); - - while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) - { - count = 0; - - while( count < ts->number_elements ) - if( lfds700_stack_pop(ts->ss, &se, &ps) ) - { - lfds700_stack_push( &ts->ss_thread_local, se, &ps ); - count++; - } - - // TRD : return our local stack to the main stack - while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) - lfds700_stack_push( ts->ss, se, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - count; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_element - *se; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - start_time = time( NULL ); - - while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) - { - // TRD : return our local stack to the main stack - while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) - lfds700_stack_push( ts->ss, se, &ps ); - - count = 0; - - while( count < ts->number_elements ) - if( lfds700_stack_pop(ts->ss, &se, &ps) ) - { - lfds700_stack_push( &ts->ss_thread_local, se, &ps ); - count++; - } - } - - // TRD : now push whatever we have in our local stack - while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) - lfds700_stack_push( ts->ss, se, &ps ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c deleted file mode 100644 index bdf2b9b640..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c +++ /dev/null @@ -1,251 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - lfds700_pal_uint_t - number_elements, - thread_number; - - struct lfds700_stack_state - *ss; - - struct test_element - *te_array; -}; - -struct test_element -{ - struct lfds700_stack_element - se; - - lfds700_pal_uint_t - datum, - thread_number; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_elements, - number_logical_processors, - *per_thread_counters; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_element - *se; - - struct lfds700_stack_state - ss; - - struct lfds700_misc_validation_info - vi; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te, - *first_te = NULL; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : memory_in_megabytes can be any value in its range - - /* TRD : we create an empty stack - - we then create one thread per CPU, where each thread - pushes 100,000 elements each as quickly as possible to the stack - (the threads themselves alloc these elements, to obtain NUMA closeness) - - the data pushed is a counter and a thread ID - - the threads exit when the stack is full - - we then validate the stack; - - checking that the counts increment on a per unique ID basis - and that the number of elements we pop equals 100,000 per thread - (since each element has an incrementing counter which is - unique on a per unique ID basis, we can know we didn't lose - any elements) - - there's no CAS+GC code, as we only push - */ - - internal_display_test_name( "Pushing" ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - // TRD : the main stack - lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - (ts+loop)->ss = &ss; - (ts+loop)->thread_number = loop; - (ts+loop)->number_elements = number_elements; - } - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - // TRD : the stack is now fully pushed; time to verify - per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - *(per_thread_counters+loop) = number_elements - 1; - - vi.min_elements = vi.max_elements = number_elements * number_logical_processors; - - lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_stack_pop(&ss, &se, &ps) ) - { - te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); - - if( first_te == NULL ) - first_te = te; - - if( te->thread_number >= number_logical_processors ) - { - dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; - break; - } - - if( te->datum > per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; - - if( te->datum < per_thread_counters[te->thread_number] ) - dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; - - if( te->datum == per_thread_counters[te->thread_number] ) - per_thread_counters[te->thread_number]--; - } - - // TRD : clean up - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - util_aligned_free( (ts+loop)->te_array ); - - free( per_thread_counters ); - - free( ts ); - - lfds700_stack_cleanup( &ss, NULL ); - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - // TRD : alloc local 100,000 elements - ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - (ts->te_array+loop)->thread_number = ts->thread_number; - (ts->te_array+loop)->datum = loop; - } - - util_thread_starter_ready_and_wait( tsts ); - - for( loop = 0 ; loop < ts->number_elements ; loop++ ) - { - LFDS700_STACK_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->se, ts->te_array+loop ); - lfds700_stack_push( ts->ss, &(ts->te_array+loop)->se, &ps ); - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c deleted file mode 100644 index d771457c86..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c +++ /dev/null @@ -1,217 +0,0 @@ -/***** includes *****/ -#include "internal.h" - -/***** structs *****/ -struct test_state -{ - struct lfds700_stack_state - *ss; -}; - -struct test_element -{ - struct lfds700_stack_element - se; - - lfds700_pal_uint_t - datum; -}; - -/***** private prototypes *****/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); - - - - - -/****************************************************************************/ -void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) -{ - enum lfds700_misc_validity - dvs = LFDS700_MISC_VALIDITY_VALID; - - lfds700_pal_uint_t - loop, - number_logical_processors; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_list_asu_element - *lasue; - - struct lfds700_stack_state - ss; - - struct lfds700_misc_validation_info - vi = { 0, 0 }; - - struct test_pal_logical_processor - *lp; - - struct util_thread_starter_state - *tts; - - struct test_element - *te_array; - - struct test_state - *ts; - - test_pal_thread_state_t - *thread_handles; - - assert( list_of_logical_processors != NULL ); - // TRD : st can be any value in its range - - /* TRD : in these tests there is a fundamental antagonism between - how much checking/memory clean up that we do and the - likelyhood of collisions between threads in their lock-free - operations - - the lock-free operations are very quick; if we do anything - much at all between operations, we greatly reduce the chance - of threads colliding - - so we have some tests which do enough checking/clean up that - they can tell the stack is valid and don't leak memory - and here, this test now is one of those which does minimal - checking - in fact, the nature of the test is that you can't - do any real checking - but goes very quickly - - what we do is create a small stack and then run one thread - per CPU, where each thread simply pushes and then immediately - pops - - the test runs for ten seconds - - after the test is done, the only check we do is to traverse - the stack, checking for loops and ensuring the number of - elements is correct - */ - - internal_display_test_name( "Rapid popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); - - lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); - - lfds700_misc_prng_init( &ps ); - - ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); - - lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - (ts+loop)->ss = &ss; - - thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); - - // TRD : we need one element per thread - te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - { - LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); - lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); - } - - util_thread_starter_new( &tts, number_logical_processors ); - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - loop = 0; - lasue = NULL; - - while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) - { - lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); - util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); - loop++; - } - - util_thread_starter_run( tts ); - - for( loop = 0 ; loop < number_logical_processors ; loop++ ) - test_pal_thread_wait( thread_handles[loop] ); - - util_thread_starter_delete( tts ); - - free( thread_handles ); - - LFDS700_MISC_BARRIER_LOAD; - - vi.min_elements = vi.max_elements = number_logical_processors; - - lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); - - lfds700_stack_cleanup( &ss, NULL ); - - util_aligned_free( te_array ); - - free( ts ); - - // TRD : print the test result - internal_display_test_result( 1, "stack", dvs ); - - return; -} - - - - - -/****************************************************************************/ -static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) -{ - lfds700_pal_uint_t - time_loop = 0; - - struct lfds700_misc_prng_state - ps; - - struct lfds700_stack_element - *se; - - struct test_state - *ts; - - struct util_thread_starter_thread_state - *tsts; - - time_t - current_time, - start_time; - - LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; - - assert( util_thread_starter_thread_state != NULL ); - - tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; - ts = (struct test_state *) tsts->thread_user_state; - - lfds700_misc_prng_init( &ps ); - - util_thread_starter_ready_and_wait( tsts ); - - current_time = start_time = time( NULL ); - - while( current_time < start_time + TEST_DURATION_IN_SECONDS ) - { - lfds700_stack_pop( ts->ss, &se, &ps ); - lfds700_stack_push( ts->ss, se, &ps ); - - if( time_loop++ == TIME_LOOP_COUNT ) - { - time_loop = 0; - time( ¤t_time ); - } - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return( (test_pal_thread_return_t) EXIT_SUCCESS ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c deleted file mode 100644 index eb62c5b4cc..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c +++ /dev/null @@ -1,245 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) - - /* TRD : _WIN32 indicates 64-bit or 32-bit Windows - !_KERNEL_MODE indicates Windows user-mode - NTDDI_VERSION indicates Windows version - - GetLogicalProcessorInformationEx requires Windows 7 - */ - - #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS - #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c - #endif - - #define TEST_PAL_GET_LOGICAL_CORE_IDS - - void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) - { - BOOL - rv; - - DWORD - loop, - number_slpie, - slpie_length = 0; - - lfds700_pal_uint_t - bitmask, - logical_processor_number, - windows_logical_processor_group_number; - - struct lfds700_misc_prng_state - ps; - - struct test_pal_logical_processor - *lp; - - SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX - *slpie = NULL; - - assert( lasus != NULL ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); - - rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); - slpie = malloc( slpie_length ); - rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); - number_slpie = slpie_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); - - for( loop = 0 ; loop < number_slpie ; loop++ ) - if( (slpie+loop)->Relationship == RelationGroup ) - for( windows_logical_processor_group_number = 0 ; windows_logical_processor_group_number < (slpie+loop)->Group.ActiveGroupCount ; windows_logical_processor_group_number++ ) - for( logical_processor_number = 0 ; logical_processor_number < sizeof(KAFFINITY) * BITS_PER_BYTE ; logical_processor_number++ ) - { - bitmask = (lfds700_pal_uint_t) 1 << logical_processor_number; - - // TRD : if we've found a processor for this group, add it to the list - if( (slpie+loop)->Group.GroupInfo[windows_logical_processor_group_number].ActiveProcessorMask & bitmask ) - { - lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lp->logical_processor_number = logical_processor_number; - lp->windows_logical_processor_group_number = windows_logical_processor_group_number; - - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); - lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); - } - } - - free( slpie ); - - return; - } - -#endif - - - - - -/****************************************************************************/ -#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) - - /* TRD : _WIN32 indicates 64-bit or 32-bit Windows - !_KERNEL_MODE indicates Windows user-mode - NTDDI_VERSION indicates Windows version - - GetLogicalProcessorInformation requires XP SP3 - */ - - #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS - #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c - #endif - - #define TEST_PAL_GET_LOGICAL_CORE_IDS - - void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) - { - DWORD - slpi_length = 0; - - lfds700_pal_uint_t - number_slpi, - loop; - - struct lfds700_misc_prng_state - ps; - - struct test_pal_logical_processor - *lp; - - SYSTEM_LOGICAL_PROCESSOR_INFORMATION - *slpi = NULL; - - ULONG_PTR - mask; - - assert( lasus != NULL ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); - - *number_logical_processors = 0; - - GetLogicalProcessorInformation( slpi, &slpi_length ); - slpi = malloc( slpi_length ); - GetLogicalProcessorInformation( slpi, &slpi_length ); - number_slpi = slpi_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); - - for( loop = 0 ; loop < number_slpi ; loop++ ) - if( (slpi+loop)->Relationship == RelationProcessorCore ) - for( logical_processor_number = 0 ; logical_processor_number < sizeof(ULONG_PTR) * BITS_PER_BYTE ; logical_processor_number++ ) - { - bitmask = 1 << logical_processor_number; - - if( (slpi+loop)->ProcessorMask & bitmask ) - { - lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lp->logical_processor_number = logical_processor_number; - lp->windows_logical_processor_group_number = 0; - - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); - lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); - } - - free( slpi ); - - return; - } - -#endif - - - - - -/****************************************************************************/ -#if( defined __linux__ ) - - /* TRD : __linux__ indicates Linux - __STDC__ indicates Standard Library - __STDC_HOSTED__ indicates Standard Library hosted implementation - - fopen requires a Standard Library hosted environment - - setbuf requires a Standard Library hosted environment - - fgets requires a Standard Library hosted environment - - sscanf requires a Standard Library hosted environment - - fclose requires a Standard Library hosted environment - */ - - #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS - #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c - #endif - - #define TEST_PAL_GET_LOGICAL_CORE_IDS - - void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) - { - char - diskbuffer[BUFSIZ], - string[1024]; - - FILE - *diskfile; - - int long long unsigned - logical_processor_number; - - struct lfds700_misc_prng_state - ps; - - struct test_pal_logical_processor - *lp; - - assert( lasus != NULL ); - - lfds700_misc_prng_init( &ps ); - - lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); - - diskfile = fopen( "/proc/cpuinfo", "r" ); - - if( diskfile != NULL ) - { - setbuf( diskfile, diskbuffer ); - - while( NULL != fgets(string, 1024, diskfile) ) - if( 1 == sscanf(string, "processor : %llu", &logical_processor_number) ) - { - lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); - - lp->logical_processor_number = (lfds700_pal_uint_t) logical_processor_number; - lp->windows_logical_processor_group_number = 0; - - LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); - lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); - } - - fclose( diskfile ); - } - - return; - } - -#endif - - - - - -/****************************************************************************/ -#if( !defined TEST_PAL_GET_LOGICAL_CORE_IDS ) - - #error test_pal_get_logical_core_ids() not implemented for this platform. - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h deleted file mode 100644 index 1c0ab03eee..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h +++ /dev/null @@ -1,82 +0,0 @@ -/****************************************************************************/ -#if( defined _MSC_VER ) - /* TRD : MSVC compiler - - an unfortunately necessary hack for MSVC - MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - - which prevents Windows header files from compiling. - */ - - #define __STDC__ 1 - #define __STDC_HOSTED__ 1 -#endif - -#if( defined __linux__ ) - #define _GNU_SOURCE - #include -#endif - - - - - -/****************************************************************************/ -#if( defined _MSC_VER && _MSC_VER >= 1310 && NTDDI_VERSION >= NTDDI_WINXP && defined _WIN32 ) - - #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER - #error More than one porting abstraction layer matches current platform. - #endif - - #define TEST_PAL_PORTING_ABSTRACTION_LAYER - - #define TEST_PAL_OS_STRING "Windows" - - #include - - typedef HANDLE test_pal_thread_state_t; - typedef DWORD test_pal_thread_return_t; - - #define TEST_PAL_CALLING_CONVENTION WINAPI - -#endif - - - - - -/****************************************************************************/ -#if( defined __GNUC__ && defined __linux__ && _POSIX_THREADS > 0 ) - - #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER - #error More than one porting abstraction layer matches current platform. - #endif - - #define TEST_PAL_PORTING_ABSTRACTION_LAYER - - #define TEST_PAL_OS_STRING "Linux" - - #define _GNU_SOURCE - - #include - #include - #include - #include - - typedef pthread_t test_pal_thread_state_t; - typedef void * test_pal_thread_return_t; - - #define TEST_PAL_CALLING_CONVENTION - -#endif - - - - - -/****************************************************************************/ -#if( !defined TEST_PAL_PORTING_ABSTRACTION_LAYER ) - - #error No matching porting abstraction layer in test_porting_abstraction_layer_operating_system.h - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c deleted file mode 100644 index 83a09814aa..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c +++ /dev/null @@ -1,336 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) - - /* TRD : _WIN32 indicates 32-bit or 64-bit Windows - !_KERNEL_MODE indicates Windows user-mode - NTDDI_VERSION indicates Windows version - - GetCurrentProcess requires XP - - InitializeProcThreadAttributeList requires Windows 7 - - CreateRemoteThreadEx requires Windows 7 - */ - - #ifdef TEST_PAL_THREAD_START - #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c - #endif - - #define TEST_PAL_THREAD_START - - int test_pal_thread_start( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ) - { - BOOL - brv; - - DWORD - thread_id; - - GROUP_AFFINITY - ga; - - int - rv = 0; - - LPPROC_THREAD_ATTRIBUTE_LIST - attribute_list; - - SIZE_T - attribute_list_length; - - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - /* TRD : here we're using CreateRemoteThreadEx() to start a thread in our own process - we do this because as a function, it allows us to specify processor and processor group affinity in the create call - */ - - brv = InitializeProcThreadAttributeList( NULL, 1, 0, &attribute_list_length ); - attribute_list = malloc( attribute_list_length ); - brv = InitializeProcThreadAttributeList( attribute_list, 1, 0, &attribute_list_length ); - - ga.Mask = ( (KAFFINITY) 1 << lp->logical_processor_number ); - ga.Group = (WORD) lp->windows_logical_processor_group_number; - memset( ga.Reserved, 0, sizeof(WORD) * 3 ); - - brv = UpdateProcThreadAttribute( attribute_list, 0, PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY, &ga, sizeof(GROUP_AFFINITY), NULL, NULL ); - *thread_state = CreateRemoteThreadEx( GetCurrentProcess(), NULL, 0, thread_function, thread_user_state, NO_FLAGS, attribute_list, &thread_id ); - - DeleteProcThreadAttributeList( attribute_list ); - free( attribute_list ); - - if( *thread_state != NULL ) - rv = 1; - - return( rv ); - } - -#endif - - - - - -/****************************************************************************/ -#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) - - /* TRD : _WIN32 indicates 64-bit or 32-bit Windows - NTDDI_VERSION indicates Windows version - - CreateThread requires XP - - SetThreadAffinityMask requires XP - - ResumeThread requires XP - */ - - #ifdef TEST_PAL_THREAD_START - #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c - #endif - - #define TEST_PAL_THREAD_START - - int test_pal_thread_start( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ) - { - int - rv = 0; - - DWORD - thread_id; - - DWORD_PTR - affinity_mask, - result; - - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - /* TRD : Vista and earlier do not support processor groups - as such, there is a single implicit processor group - also, there's no support for actually starting a thread in its correct NUMA node / logical processor - so we make the best of it; we start suspended, set the affinity, and then resume - the thread itself internally is expected to be making allocs from the correct NUMA node - */ - - *thread_state = CreateThread( NULL, 0, thread_function, thread_user_state, CREATE_SUSPENDED, &thread_id ); - - affinity_mask = (DWORD_PTR) (1 << lp->logical_processor_number); - - SetThreadAffinityMask( *thread_state, affinity_mask ); - - ResumeThread( *thread_state ); - - if( *thread_state != NULL ) - rv = 1; - - return( rv ); - } - -#endif - - - - - -/****************************************************************************/ -#if( defined __linux__ && _POSIX_THREADS > 0 ) - - /* TRD : __linux__ indicates Linux - - gettid requires Linux - - sched_setaffinity requires Linux - _POSIX_THREADS indicates POSIX threads - - pthread_create requires POSIX - */ - - #ifdef TEST_PAL_THREAD_START - #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c - #endif - - #define TEST_PAL_THREAD_START - - /***** structs *****/ - struct test_pal_internal_thread_state - { - struct test_pal_logical_processor - lp; - - test_pal_thread_return_t - (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ); - - void - *thread_user_state; - }; - - /***** prototypes *****/ - test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ); - - /****************************************************************************/ - int test_pal_thread_start( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ) - { - int - rv; - - struct test_pal_internal_thread_state - *its; - - /* TRD : this implementation works on Linux only as it uses sched_setaffinity(), which is Linux specific - although I cannot currently test, I believe this function also works on Android - - this implementation exists because the pthreads function for setting thread affinity, - pthread_attr_setaffinity_np(), works on Linux, but not Android - */ - - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - its = malloc( sizeof(struct test_pal_internal_thread_state) ); - - its->lp = *lp; - its->thread_function = thread_function; - its->thread_user_state = thread_user_state; - - rv = pthread_create( thread_state, NULL, test_pal_internal_thread_function, its ); - - if( rv == 0 ) - rv = 1; - - return( rv ); - } - - /****************************************************************************/ - test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ) - { - cpu_set_t - cpuset; - - pid_t - tid; - - struct test_pal_internal_thread_state - *its; - - test_pal_thread_return_t - rv; - - assert( thread_user_state != NULL ); - - /* TRD : the APIs under Linux/POSIX for setting thread affinity are in a mess - pthreads offers pthread_attr_setaffinity_np(), which glibc supports, - but which is not supported by Android - Linux offers sched_setaffinity(), but this needs a *thread pid*, - and the only API to get a thread pid is gettid(), which works for - and only for *the calling thread* - - so we come to this - a wrapper thread function, which is the function used - when starting a thread; this calls gettid() and then sched_setaffinity(), - and then calls into the actual thread function - - generally shaking my head in disbelief at this point - */ - - assert( thread_user_state != NULL ); - - its = (struct test_pal_internal_thread_state *) thread_user_state; - - CPU_ZERO( &cpuset ); - CPU_SET( its->lp.logical_processor_number, &cpuset ); - - tid = syscall( SYS_gettid ); - - sched_setaffinity( tid, sizeof(cpu_set_t), &cpuset ); - - rv = its->thread_function( its->thread_user_state ); - - free( its ); - - return( rv ); - } - -#endif - - - - - -/****************************************************************************/ -#if( !defined __linux__ && _POSIX_THREADS > 0 ) - - /* TRD : !__linux__ indicates not Linux - _POSIX_THREADS indicates POSIX threads - - pthread_attr_init requires POSIX - - pthread_attr_setaffinity_np requires POSIX - - pthread_create requires POSIX - - pthread_attr_destroy requires POSIX - */ - - #ifdef TEST_PAL_THREAD_START - #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c - #endif - - #define TEST_PAL_THREAD_START - - int test_pal_thread_start( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ) - { - int - rv = 0, - rv_create; - - cpu_set_t - cpuset; - - pthread_attr_t - attr; - - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - pthread_attr_init( &attr ); - - CPU_ZERO( &cpuset ); - CPU_SET( lp->logical_processor_number, &cpuset ); - pthread_attr_setaffinity_np( &attr, sizeof(cpuset), &cpuset ); - - rv_create = pthread_create( thread_state, &attr, thread_function, thread_user_state ); - - if( rv_create == 0 ) - rv = 1; - - pthread_attr_destroy( &attr ); - - return( rv ); - } - -#endif - - - - - -/****************************************************************************/ -#if( !defined TEST_PAL_THREAD_START ) - - #error test_pal_thread_start() not implemented for this platform. - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c deleted file mode 100644 index bd4a8c01f7..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c +++ /dev/null @@ -1,69 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -#if( defined _WIN32 && NTDDI_VERSION >= NTDDI_WINXP ) - - /* TRD : _WIN32 indicates 32-bit or 64-bit Windows - NTDDI_VERSION indicates Windows version - - WaitForSingleObject requires XP - */ - - #ifdef TEST_PAL_THREAD_WAIT - #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c - #endif - - #define TEST_PAL_THREAD_WAIT - - void test_pal_thread_wait( test_pal_thread_state_t thread_state ) - { - WaitForSingleObject( thread_state, INFINITE ); - - return; - } - -#endif - - - - - -/****************************************************************************/ -#if( _POSIX_THREADS > 0 ) - - /* TRD : POSIX threads - - _POSIX_THREADS indicates POSIX threads - - pthread_join requires POSIX - */ - - #ifdef TEST_PAL_THREAD_WAIT - #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c - #endif - - #define TEST_PAL_THREAD_WAIT - - void test_pal_thread_wait( test_pal_thread_state_t thread_state ) - { - pthread_join( thread_state, NULL ); - - return; - } - -#endif - - - - - -/****************************************************************************/ -#if( !defined TEST_PAL_THREAD_WAIT ) - - #error test_pal_thread_wait() not implemented for this platform. - -#endif - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c deleted file mode 100644 index 9173d607c9..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c +++ /dev/null @@ -1,184 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void util_cmdline_init( struct util_cmdline_state *cs ) -{ - lfds700_pal_uint_t - loop; - - assert( cs != NULL ); - - for( loop = 0 ; loop < NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET ; loop++ ) - { - cs->args[loop].arg_type = LIBCOMMON_CMDLINE_ARG_TYPE_UNSET; - cs->args[loop].processed_flag = LOWERED; - } - - return; -} - - - - - -/****************************************************************************/ -#pragma warning( disable : 4100 ) - -void util_cmdline_cleanup( struct util_cmdline_state *cs ) -{ - assert( cs != NULL ); - - return; -} - -#pragma warning( default : 4100 ) - - - - - -/****************************************************************************/ -void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ) -{ - lfds700_pal_uint_t - index; - - assert( cs != NULL ); - assert( arg_letter >= 'a' and arg_letter <= 'z' ); - // TRD : arg_type can be any value in its range - - index = arg_letter - 'a'; - - cs->args[index].arg_type = arg_type; - - if( arg_type == LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ) - cs->args[index].arg_data.flag.flag = LOWERED; - - return; -} - - - - - -/****************************************************************************/ -int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ) -{ - char - *arg; - - int - arg_letter, - cc, - loop, - rv = 1; - - lfds700_pal_uint_t - index; - - assert( cs != NULL ); - assert( argc >= 1 ); - assert( argv != NULL ); - - for( loop = 1 ; loop < argc ; loop++ ) - { - arg = *(argv+loop); - - switch( *arg ) - { - case '-': - arg_letter = tolower( *(arg+1) ); - - if( arg_letter >= 'a' and arg_letter <= 'z' ) - { - index = arg_letter - 'a'; - - switch( cs->args[index].arg_type ) - { - case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE: - if( loop+1 >= argc ) - rv = 0; - - if( loop+1 < argc ) - { - cc = sscanf( *(argv+loop+1), "%llu-%llu", &cs->args[index].arg_data.integer_range.integer_start, &cs->args[index].arg_data.integer_range.integer_end ); - - if( cc != 2 ) - rv = 0; - - if( cc == 2 ) - { - cs->args[index].processed_flag = RAISED; - loop++; - } - } - break; - - case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER: - if( loop+1 >= argc ) - rv = 0; - - if( loop+1 < argc ) - { - cc = sscanf( *(argv+loop+1), "%llu", &cs->args[index].arg_data.integer.integer ); - - if( cc != 1 ) - rv = 0; - - if( cc == 1 ) - { - cs->args[index].processed_flag = RAISED; - loop++; - } - } - break; - - case LIBCOMMON_CMDLINE_ARG_TYPE_FLAG: - cs->args[index].arg_data.flag.flag = RAISED; - cs->args[index].processed_flag = RAISED; - break; - - case LIBCOMMON_CMDLINE_ARG_TYPE_UNSET: - break; - } - } - break; - - default: - rv = 0; - break; - } - } - - return( rv ); -} - - - - - -/****************************************************************************/ -void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ) -{ - lfds700_pal_uint_t - index; - - assert( cs != NULL ); - assert( arg_letter >= 'a' and arg_letter <= 'z' ); - assert( arg_data != NULL ); - - index = arg_letter - 'a'; - - if( cs->args[index].processed_flag == RAISED ) - *arg_data = &cs->args[index].arg_data; - else - *arg_data = NULL; - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h deleted file mode 100644 index a19b073499..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h +++ /dev/null @@ -1,69 +0,0 @@ -/***** defines *****/ -#define NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET 26 - -/***** enums *****/ -enum util_cmdline_arg_type -{ - LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE, - LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER, - LIBCOMMON_CMDLINE_ARG_TYPE_FLAG, - LIBCOMMON_CMDLINE_ARG_TYPE_UNSET -}; - -/***** structs *****/ -struct util_cmdline_arg_integer_range -{ - int long long unsigned - integer_start, - integer_end; -}; - -struct util_cmdline_arg_integer -{ - int long long unsigned - integer; -}; - -struct util_cmdline_arg_flag -{ - enum flag - flag; -}; - -union util_cmdline_arg_data -{ - struct util_cmdline_arg_integer_range - integer_range; - - struct util_cmdline_arg_integer - integer; - - struct util_cmdline_arg_flag - flag; -}; - -struct util_cmdline_arg_letter_and_data -{ - enum util_cmdline_arg_type - arg_type; - - enum flag - processed_flag; - - union util_cmdline_arg_data - arg_data; -}; - -struct util_cmdline_state -{ - struct util_cmdline_arg_letter_and_data - args[NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET]; -}; - -/***** public protoypes *****/ -void util_cmdline_init( struct util_cmdline_state *cs ); -void util_cmdline_cleanup( struct util_cmdline_state *cs ); -void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ); -int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ); -void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c deleted file mode 100644 index 3d4c0e79f4..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c +++ /dev/null @@ -1,75 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ) -{ - lfds700_pal_uint_t - offset; - - void - *memory, - *original_memory; - - // TRD : size can be any value in its range - // TRD : align_in_bytes can be any value in its range - - /* TRD : helper function to provide aligned allocations - no porting required - */ - - original_memory = memory = util_malloc_wrapper( size + sizeof(void *) + align_in_bytes ); - - if( memory != NULL ) - { - memory = (void **) memory + 1; - offset = align_in_bytes - (lfds700_pal_uint_t) memory % align_in_bytes; - memory = (char unsigned *) memory + offset; - *( (void **) memory - 1 ) = original_memory; - } - - return( memory ); -} - - - - - -/****************************************************************************/ -void util_aligned_free( void *memory ) -{ - assert( memory != NULL ); - - // TRD : the "void *" stored above memory points to the root of the allocation - free( *( (void **) memory - 1 ) ); - - return; -} - - - - - -/****************************************************************************/ -void *util_malloc_wrapper( lfds700_pal_uint_t size ) -{ - void - *memory; - - // TRD : size can be any value in its range - - memory = malloc( size ); - - if( memory == NULL ) - { - puts( "malloc() failed, exiting." ); - exit( EXIT_FAILURE ); - } - - return( memory ); -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h deleted file mode 100644 index 8341a1f2e3..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h +++ /dev/null @@ -1,5 +0,0 @@ -/***** public prototypes *****/ -void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ); -void util_aligned_free( void *memory ); -void *util_malloc_wrapper( lfds700_pal_uint_t size ); - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c deleted file mode 100644 index c008fa2c5d..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c +++ /dev/null @@ -1,151 +0,0 @@ -/***** includes *****/ -#include "internal.h" - - - - - -/****************************************************************************/ -void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ) -{ - lfds700_pal_uint_t - loop; - - assert( tts != NULL ); - // TRD : number_threads cam be any value in its range - - *tts = util_malloc_wrapper( sizeof(struct util_thread_starter_state) ); - - (*tts)->tsts = util_malloc_wrapper( sizeof(struct util_thread_starter_thread_state) * number_threads ); - (*tts)->thread_start_flag = LOWERED; - (*tts)->number_thread_states = number_threads; - - for( loop = 0 ; loop < number_threads ; loop++ ) - { - ((*tts)->tsts+loop)->thread_ready_flag = LOWERED; - ((*tts)->tsts+loop)->thread_start_flag = &(*tts)->thread_start_flag; - } - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - - - - - -/****************************************************************************/ -void util_thread_starter_start( struct util_thread_starter_state *tts, - test_pal_thread_state_t *thread_state, - lfds700_pal_uint_t thread_number, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), - void *thread_user_state ) -{ - assert( tts != NULL ); - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - (tts->tsts+thread_number)->thread_user_state = thread_user_state; - - util_thread_start_wrapper( thread_state, lp, thread_function, tts->tsts+thread_number ); - - // TRD : wait for the thread to indicate it is ready and waiting - while( (tts->tsts+thread_number)->thread_ready_flag == LOWERED ); - - return; -} - - - - - -/****************************************************************************/ -void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ) -{ - assert( tsts != NULL ); - - tsts->thread_ready_flag = RAISED; - - LFDS700_MISC_BARRIER_FULL; - - // TRD : threads here are all looping, so we don't need to force a store - - while( *tsts->thread_start_flag == LOWERED ) - LFDS700_MISC_BARRIER_LOAD; - - return; -} - - - - - -/****************************************************************************/ -void util_thread_starter_run( struct util_thread_starter_state *tts ) -{ - assert( tts != NULL ); - - /* TRD : all threads at this point are ready to go - as we wait for their ready flag immediately after their spawn - */ - - tts->thread_start_flag = RAISED; - - LFDS700_MISC_BARRIER_STORE; - - lfds700_misc_force_store(); - - return; -} - - - - - -/****************************************************************************/ -void util_thread_starter_delete( struct util_thread_starter_state *tts ) -{ - assert( tts != NULL ); - - free( tts->tsts ); - - free( tts ); - - return; -} - - - - - -/****************************************************************************/ -void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ) -{ - int - rv; - - assert( thread_state != NULL ); - assert( lp != NULL ); - assert( thread_function != NULL ); - // TRD : thread_user_state can be NULL - - rv = test_pal_thread_start( thread_state, lp, thread_function, thread_user_state ); - - if( rv == 0 ) - { - puts( "test_pal_thread_start() failed." ); - exit( EXIT_FAILURE ); - } - - return; -} - diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h deleted file mode 100644 index 5587edf1c0..0000000000 --- a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h +++ /dev/null @@ -1,41 +0,0 @@ -/***** structs *****/ -struct util_thread_starter_thread_state -{ - // TRD : must be volatile or the compiler optimizes it away into a single load - enum flag volatile - thread_ready_flag, - *thread_start_flag; - - void - *thread_user_state; -}; - -struct util_thread_starter_state -{ - enum flag volatile - thread_start_flag; - - lfds700_pal_uint_t - number_thread_states; - - struct util_thread_starter_thread_state - *tsts; -}; - -/***** prototypes *****/ -void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ); -void util_thread_starter_start( struct util_thread_starter_state *tts, - test_pal_thread_state_t *thread_state, - lfds700_pal_uint_t thread_number, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), - void *thread_user_state ); -void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ); -void util_thread_starter_run( struct util_thread_starter_state *tts ); -void util_thread_starter_delete( struct util_thread_starter_state *tts ); - -void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, - struct test_pal_logical_processor *lp, - test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), - void *thread_user_state ); - diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index e682dc0484..da078e12ed 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -266,7 +266,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) { return -1; } - threadCreate(&opt_listener.thread, opt_listener_thread, NULL, "flexran", -1, OAI_PRIORITY_RT_LOW); + threadCreate(&opt_listener.thread, opt_listener_thread, NULL, "optListener", -1, OAI_PRIORITY_RT_LOW); return 0; } diff --git a/openair3/MME_APP/mme_app.c b/openair3/MME_APP/mme_app.c index 57f1b4c9d2..fce9f6ba57 100644 --- a/openair3/MME_APP/mme_app.c +++ b/openair3/MME_APP/mme_app.c @@ -42,7 +42,6 @@ # include "s1ap_eNB.h" # include "sctp_eNB_task.h" # include "gtpv1u_eNB_task.h" -# include "flexran_agent.h" # include "x2ap_eNB.h" # include "x2ap_messages_types.h" @@ -274,10 +273,6 @@ void *MME_app_task(void *args_p) { LOG_I(MME_APP, "MME_APP Received %s\n", ITTI_MSG_NAME(msg_p)); break; - case SOFT_RESTART_MESSAGE: - //handle_reconfiguration(instance); - break; - case M3AP_REGISTER_MCE_CNF: //M3AP_REGISTER_MCE_CNF debería //AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); // if (EPC_MODE_ENABLED) { @@ -523,57 +518,3 @@ void *MME_app_task(void *args_p) { return NULL; } - -//void handle_reconfiguration(module_id_t mod_id) { -// struct timespec start, end; -// clock_gettime(CLOCK_MONOTONIC, &start); -// flexran_agent_info_t *flexran = RC.flexran[mod_id]; -// LOG_I(ENB_APP, "lte-softmodem soft-restart requested\n"); -// -// if (ENB_WAIT == flexran->node_ctrl_state) { -// /* this is already waiting, just release */ -// pthread_mutex_lock(&flexran->mutex_node_ctrl); -// flexran->node_ctrl_state = ENB_NORMAL_OPERATION; -// pthread_mutex_unlock(&flexran->mutex_node_ctrl); -// pthread_cond_signal(&flexran->cond_node_ctrl); -// return; -// } -// -// if (stop_L1L2(mod_id) < 0) { -// LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n"); -// return; -// } -// -// /* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not -// * executed by the FlexRAN thread */ -// if (ENB_MAKE_WAIT == flexran->node_ctrl_state) { -// LOG_I(ENB_APP, " * MCE %d: Waiting for FlexRAN RTController command *\n", mod_id); -// pthread_mutex_lock(&flexran->mutex_node_ctrl); -// flexran->node_ctrl_state = ENB_WAIT; -// -// while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state) -// pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl); -// -// pthread_mutex_unlock(&flexran->mutex_node_ctrl); -// } -// -// if (restart_L1L2(mod_id) < 0) { -// LOG_E(ENB_APP, "can not restart, killing lte-softmodem\n"); -// exit_fun("can not restart L1L2, killing lte-softmodem"); -// return; -// } -// -// clock_gettime(CLOCK_MONOTONIC, &end); -// end.tv_sec -= start.tv_sec; -// -// if (end.tv_nsec >= start.tv_nsec) { -// end.tv_nsec -= start.tv_nsec; -// } else { -// end.tv_sec -= 1; -// end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000; -// } -// -// LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000); -//} - - diff --git a/openair3/MME_APP/mme_app.h b/openair3/MME_APP/mme_app.h index 796bfa796c..01a9ec615f 100644 --- a/openair3/MME_APP/mme_app.h +++ b/openair3/MME_APP/mme_app.h @@ -36,6 +36,4 @@ void *MME_app_task(void *args_p); -//void handle_reconfiguration(module_id_t mod_id); - #endif /* MME_APP_H_ */ diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto deleted file mode 100644 index 39f1656980..0000000000 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ /dev/null @@ -1,163 +0,0 @@ -package protocol; - - -message fsp_header { - optional uint32 version = 1; - optional uint32 type = 2; - optional uint32 xid = 4; -} - -enum fsp_type { - // Discovery and maintenance messages - FSPT_HELLO = 0; - FSPT_ECHO_REQUEST = 1; - FSPT_ECHO_REPLY = 2; - FSPT_RLC_DATA_REQ = 3; - FSPT_RLC_DATA_REQ_ACK = 4; - FSPT_PDCP_DATA_IND = 5; - FSPT_PDCP_DATA_IND_ACK = 6; -} - -enum f1u_type { - // Discovery and maintenance messages - F1U_DL_DATA = 0; - F1U_DL_STATUS = 1; -} - - -message f1u_message{ - optional flexsplit_direction msg_dir = 100; - oneof msg{ - dl_user_data dl_data = 1; - dl_data_delivery_status dl_status = 2; - } -} - - - -message flexsplit_message { - optional flexsplit_direction msg_dir = 100; - oneof msg { - fsp_hello hello_msg = 1; - fsp_echo_request echo_request_msg = 2; - fsp_echo_reply echo_reply_msg = 3; - fspRlcDataReq data_req_msg = 4; - fspRlcDataReqAck data_req_ack = 5; - fspPdcpDataInd data_ind_msg = 6; - fspPdcpDataIndAck data_ind_ack = 7; - } -} - -enum flexsplit_direction { - //option allow_alias = true; - NOT_SET = 0; - INITIATING_MESSAGE = 1; - SUCCESSFUL_OUTCOME=2; - UNSUCCESSFUL_OUTCOME=3; -} - -enum flexsplit_err { - // message errors - NO_ERR = 0; - MSG_DEQUEUING = -1; - MSG_ENQUEUING = -2; - MSG_DECODING = -3; - MSG_ENCODING = -4; - MSG_BUILD = -5; - MSG_NOT_SUPPORTED = -6; - MSG_NOT_HANDLED = -7; - MSG_NOT_VALIDATED = -8; - MSG_OUT_DATED = -9; - - // other erros - UNEXPECTED = -100; -} - -message fsp_ctxt { - optional uint32 fsp_mod_id = 1; - optional bool fsp_enb_flag = 2; - optional uint32 fsp_instance = 3; - optional uint32 fsp_rnti = 4; - optional uint32 fsp_frame = 5; - optional uint32 fsp_subframe = 6; - optional uint32 fsp_eNB_index = 7; - -} - -message fspRlcPdu { - optional bytes fsp_pdu_data = 1; // Maximum PDU to be transfered -} - -message fspRlcData { - optional fsp_ctxt fsp_ctxt = 1; - optional bool fsp_srb_flag = 2; - optional bool fsp_mbms_flag = 3; - optional uint32 fsp_rb_id = 4; - optional uint32 fsp_muip = 5; - optional uint32 fsp_confirm = 6; - optional int32 fsp_sdu_buffer_size = 7; - optional fspRlcPdu fsp_pdu = 8; -} - -// -// Maintenance and discovery messages -// - -message fsp_hello { - optional fsp_header header = 1; -} - -message fsp_echo_request { - optional fsp_header header = 1; -// extensions 100 to 199; -} - - -message fsp_echo_reply { - optional fsp_header header = 1; -// extensions 100 to 199; -} - - -message fspRlcDataReq { - optional fsp_header header = 1; - optional uint32 eNB_id = 2; - optional fspRlcData pdcp_data = 3; -} - -message fspRlcDataReqAck { - optional fsp_header header = 1; - optional uint32 result = 2; -} - -message fspPdcpDataInd { - optional fsp_header header = 1; - optional uint32 eNB_id = 2; - optional fspRlcData rlc_data = 3; -} - -message fspPdcpDataIndAck { - optional fsp_header header = 1; - optional uint32 result = 2; -} - -message dl_data_header { - required uint32 fields = 1; -} - -message dl_user_data { - required dl_data_header header = 1; - required bytes pdu = 2; - required uint32 frame = 3; - required uint32 subframe = 4; - required uint32 rnti = 5; -} - - -message dl_data_delivery_status { - required dl_data_header header = 1; - required bytes pdu = 2; - required uint32 frame = 3; - required uint32 subframe = 4; - required uint32 rnti = 5; -} diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf index 0561c563dd..d52aa0ba0b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-4g.conf @@ -256,16 +256,6 @@ THREAD_STRUCT = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - log_config : { global_log_level ="info"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf index 0e1080043a..45f157e0f5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/cu.lte.conf @@ -202,15 +202,5 @@ log_config = { global_log_level = "info"; pdcp_log_level = "info"; rrc_log_level = "info"; - flexran_agent_log_level = "info"; gtp_log_level = "info"; }; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "yes"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf index 0485957a8a..17202fde04 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/du.lte.band7.10MHz.if4p5.conf @@ -100,14 +100,4 @@ log_config = { phy_log_level = "info"; mac_log_level = "info"; rlc_log_level = "info"; - flexran_agent_log_level = "info"; -}; - -NETWORK_CONTROLLER : { - FLEXRAN_ENABLED = "yes"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf index d811fb068e..b8ca6c1365 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.25PRB.iris030.conf @@ -234,16 +234,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf index 1b4224da08..4e59f48ca5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band42.tm1.25PRB.iris030.conf @@ -234,16 +234,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf index ad95557bb9..1770e77199 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf @@ -262,16 +262,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf index 506966d167..0a1c494f0a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.iris030.conf @@ -234,16 +234,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf index 177cddec12..8a91db7e02 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.25PRB.usrpb210.replay.conf @@ -233,16 +233,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index 07cebbe75b..4628ee54fe 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -264,16 +264,6 @@ RUs = ( } ); -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf index 6a76028d25..8bfa97e11b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc_b38_if5_ENDC.conf @@ -224,13 +224,3 @@ THREAD_STRUCT = ( worker_config = "WORKER_ENABLE"; } ); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 8f9145010a..ccfea1ba42 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -388,92 +388,6 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) { extern void free_transport(PHY_VARS_eNB *); extern void phy_free_RU(RU_t *); -int stop_L1L2(module_id_t enb_id) { - LOG_W(ENB_APP, "stopping lte-softmodem\n"); - - if (!RC.ru) { - LOG_UI(ENB_APP, "no RU configured\n"); - return -1; - } - - /* these tasks need to pick up new configuration */ - terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB); - oai_exit = 1; - LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id); - kill_RU_proc(RC.ru[enb_id]); - LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id); - kill_eNB_proc(enb_id); - oai_exit = 0; - - for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) { - free_transport(RC.eNB[enb_id][cc_id]); - phy_free_lte_eNB(RC.eNB[enb_id][cc_id]); - } - - phy_free_RU(RC.ru[enb_id]); - free_lte_top(); - return 0; -} - -/* - * Restart the lte-softmodem after it has been soft-stopped with stop_L1L2() - */ -int restart_L1L2(module_id_t enb_id) { - int cc_id; - MessageDef *msg_p = NULL; - LOG_W(ENB_APP, "restarting lte-softmodem\n"); - /* block threads */ - pthread_mutex_lock(&sync_mutex); - sync_var = -1; - pthread_mutex_unlock(&sync_mutex); - - for (cc_id = 0; cc_id < RC.nb_L1_CC[enb_id]; cc_id++) { - RC.eNB[enb_id][cc_id]->configured = 0; - for (int ru_id=0;ru_idnum_RU;ru_id++) { - int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx; - RC.ru_mask |= (1 << ru_idx); - set_function_spec_param(RC.ru[ru_idx]); - } - } - /* reset the list of connected UEs in the MAC, since in this process with - * loose all UEs (have to reconnect) */ - init_UE_info(&RC.mac[enb_id]->UE_info); - LOG_I(ENB_APP, "attempting to create ITTI tasks\n"); - - if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { - LOG_E(RRC, "Create task for RRC eNB failed\n"); - return -1; - } else { - LOG_I(RRC, "Re-created task for RRC eNB successfully\n"); - } - - /* pass a reconfiguration request which will configure everything down to - * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); - RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; - itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); - /* TODO XForms might need to be restarted, but it is currently (09/02/18) - * broken, so we cannot test it */ - wait_eNBs(); - for (int cc_id=0;cc_idnum_RU;ru_id++) { - int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx; - - init_RU_proc(RC.ru[ru_idx]); - RC.ru[ru_idx]->rf_map.card = 0; - RC.ru[ru_idx]->rf_map.chain = 0; /* CC_id + chain_offset;*/ - } - } - wait_RUs(); - init_eNB_afterRU(); - printf("Sending sync to all threads\n"); - pthread_mutex_lock(&sync_mutex); - sync_var=0; - pthread_cond_broadcast(&sync_cond); - pthread_mutex_unlock(&sync_mutex); - return 0; -} - static void init_pdcp(void) { if (!NODE_IS_DU(RC.rrc[0]->node_type)) { pdcp_layer_init(); @@ -509,7 +423,6 @@ static void wait_nfapi_init(char *thread_name) { int main ( int argc, char **argv ) { - int i; int CC_id = 0; int ru_id; int node_type = ngran_eNB; @@ -564,22 +477,7 @@ int main ( int argc, char **argv ) RCconfig_L1(); } - /* We need to read RU configuration before FlexRAN starts so it knows what - * splits to report. Actual RU start comes later. */ - if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) { - RC.ru = RCconfig_RU(RC.nb_RU,RC.nb_L1_inst,RC.eNB,&RC.ru_mask,&RC.ru_mutex,&RC.ru_cond); - LOG_I(PHY, - "number of L1 instances %d, number of RU %d, number of CPU cores %d\n", - RC.nb_L1_inst, RC.nb_RU, get_nprocs()); - } - if (RC.nb_inst > 0) { - /* Start the agent. If it is turned off in the configuration, it won't start */ - for (i = 0; i < RC.nb_inst; i++) { - if(NFAPI_MODE != NFAPI_MODE_PNF) - flexran_agent_start(i); - } - /* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks * for monolithic/F1 modes */ init_pdcp(); @@ -665,8 +563,11 @@ int main ( int argc, char **argv ) // RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator. // but RU thread deals with pre_scd and this is necessary in VNF and simulator. // some initialization is necessary and init_ru_vnf do this. - if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) { - printf("Initializing RU threads\n"); + if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) { + RC.ru = RCconfig_RU(RC.nb_RU, RC.nb_L1_inst, RC.eNB, &RC.ru_mask, &RC.ru_mutex, &RC.ru_cond); + LOG_I(PHY, + "number of L1 instances %d, number of RU %d, number of CPU cores %d: Initializing RU threads\n", + RC.nb_L1_inst, RC.nb_RU, get_nprocs()); init_RU(RC.ru,RC.nb_RU,RC.eNB,RC.nb_L1_inst,RC.nb_L1_CC,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync); for (ru_id=0; ru_id