From 63b64d4fcee6ed35a016f489a342e3f278241ba7 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS <laurent.thomas@open-cells.com> Date: Tue, 5 Dec 2023 19:22:18 +0100 Subject: [PATCH] move common code file in common directory remove several unused files remove mem_block_t that is never used in a different way than a simple heap buffer move up IP address type and remove duplications of the same struct declaration --- CMakeLists.txt | 7 +- cmake_targets/at_commands/CMakeLists.txt | 214 +------------- cmake_targets/nas_sim_tools/CMakeLists.txt | 20 +- common/config/config_cmdline.c | 2 +- common/config/config_common.c | 2 +- common/config/config_load_configmodule.c | 2 +- common/config/config_userapi.c | 2 +- common/platform_constants.h | 4 +- {openair2/COMMON => common}/platform_types.h | 262 +++++++++--------- common/utils/assertions.h | 2 +- common/utils/config.h | 4 +- .../COMMON/UTIL => common/utils/mem}/memory.c | 53 +--- .../memory.h => common/utils/mem/oai_memory.h | 44 +-- common/utils/ocp_itti/intertask_interface.cpp | 23 -- common/utils/ocp_itti/intertask_interface.h | 5 +- doc/Doxyfile | 7 +- executables/nr-cuup.c | 2 +- .../nfapi/public_inc/fapi_nr_ue_interface.h | 2 +- nfapi/open-nFAPI/pnf/src/pnf.c | 2 +- openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h | 2 +- openair1/PHY/NBIoT_TRANSPORT/README | 1 - openair1/PHY/defs_L1_NB_IoT.h | 2 +- openair1/PHY/defs_UE.h | 2 +- openair1/PHY/defs_common.h | 2 +- openair1/PHY/defs_eNB.h | 2 +- openair1/PHY/defs_nr_UE.h | 2 +- openair1/SCHED_NBIOT/README | 1 - openair1/SCHED_NR/README | 1 - openair1/SCHED_NR_UE/README | 1 - openair1/SIMULATION/Makefile.inc | 12 - openair2/COMMON/commonDef.h | 29 +- openair2/COMMON/e1ap_messages_types.h | 2 +- openair2/COMMON/f1ap_messages_def.h | 1 + openair2/COMMON/f1ap_messages_types.h | 8 +- openair2/COMMON/mac_rrc_primitives.h | 2 +- openair2/COMMON/ngap_messages_types.h | 2 + openair2/COMMON/ral_messages_types.h | 2 +- openair2/COMMON/rrc_messages_types.h | 5 +- openair2/COMMON/s1ap_messages_types.h | 8 +- openair2/ENB_APP/enb_app.h | 3 +- openair2/ENB_APP/enb_config.h | 2 +- openair2/F1AP/f1ap_common.h | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 4 +- openair2/F1AP/f1ap_cu_task.c | 1 - openair2/F1AP/f1ap_du_ue_context_management.c | 5 +- openair2/GNB_APP/gnb_config.h | 2 +- openair2/LAYER2/MAC/config.c | 2 +- openair2/LAYER2/MAC/config_ue.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- openair2/LAYER2/MAC/proto_NB_IoT.h | 2 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 1 + openair2/LAYER2/NR_MAC_gNB/config.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 1 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 147 +++++----- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 55 ++-- .../LAYER2/PDCP_v10.1.0/pdcp_primitives.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h | 2 +- openair2/LAYER2/RLC/rlc.h | 87 ++---- openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp.h | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 85 +++--- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 20 +- openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 15 +- openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h | 2 +- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 54 ++-- openair2/M2AP/m2ap_timers.h | 2 +- openair2/MCE_APP/mce_app.h | 3 +- openair2/MCE_APP/mce_config.h | 2 +- openair2/NETWORK_DRIVER/LITE/local.h | 2 +- openair2/NETWORK_DRIVER/MESH/local.h | 2 +- openair2/NETWORK_DRIVER/UE_IP/local.h | 2 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.h | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h | 2 +- openair2/PHY_INTERFACE/IF_Module.h | 65 +++-- openair2/PHY_INTERFACE/IF_Module_NB_IoT.h | 2 +- .../L2_INTERFACE/openair_rrc_L2_interface.h | 2 +- openair2/RRC/LTE/L2_interface.c | 2 +- openair2/RRC/LTE/L2_interface_common.c | 2 +- openair2/RRC/LTE/L2_interface_ue.c | 2 +- openair2/RRC/LTE/defs_NB_IoT.h | 2 +- openair2/RRC/LTE/rrc_common.c | 2 +- openair2/RRC/LTE/rrc_defs.h | 2 +- openair2/RRC/LTE/rrc_eNB.c | 2 +- openair2/RRC/LTE/rrc_eNB_UE_context.h | 2 +- openair2/RRC/NR/cucp_cuup_if.h | 2 +- openair2/RRC/NR/mac_rrc_dl.h | 2 +- openair2/RRC/NR/nr_rrc_common.c | 2 +- openair2/RRC/NR/nr_rrc_defs.h | 2 +- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR/rrc_gNB_UE_context.h | 2 +- openair2/RRC/NR_UE/rrc_defs.h | 2 +- openair2/SDAP/nr_sdap/nr_sdap.h | 2 +- openair2/SDAP/nr_sdap/nr_sdap_entity.h | 2 +- openair2/UTIL/MEM/mem_block.h | 79 ------ openair2/X2AP/x2ap_timers.h | 2 +- openair3/M3AP/m3ap_timers.h | 2 +- openair3/MME_APP/mme_app.h | 3 +- openair3/MME_APP/mme_config.h | 2 +- openair3/NAS/TOOLS/conf_emm.c | 2 +- openair3/NAS/TOOLS/conf_user_data.c | 2 +- openair3/NAS/TOOLS/display.c | 2 +- openair3/NAS/UE/API/USIM/usim_api.c | 10 +- openair3/NAS/UE/EMM/emm_main.c | 9 +- openair3/NAS/UE/nas_ue_task.c | 2 +- openair3/NAS/UE/nas_user.c | 2 +- openair3/UTILS/CONF/COPYING | 0 openair3/ocp-gtpu/gtp_itf.cpp | 2 +- openair3/ocp-gtpu/gtp_itf.h | 2 + targets/TEST/PDCP/test_pdcp.c | 14 +- targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c | 8 +- 120 files changed, 532 insertions(+), 1001 deletions(-) rename {openair2/COMMON => common}/platform_types.h (53%) rename {openair3/NAS/COMMON/UTIL => common/utils/mem}/memory.c (77%) rename openair3/NAS/COMMON/UTIL/memory.h => common/utils/mem/oai_memory.h (52%) delete mode 100644 openair1/PHY/NBIoT_TRANSPORT/README delete mode 100644 openair1/SCHED_NBIOT/README delete mode 100644 openair1/SCHED_NR/README delete mode 100644 openair1/SCHED_NR_UE/README delete mode 100644 openair1/SIMULATION/Makefile.inc delete mode 100644 openair2/UTIL/MEM/mem_block.h delete mode 100644 openair3/UTILS/CONF/COPYING diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aefd12b547..9cd36d625b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1687,7 +1687,7 @@ set(libnas_ies_OBJS set (libnas_utils_OBJS ${NAS_SRC}COMMON/UTIL/device.c - ${NAS_SRC}COMMON/UTIL/memory.c + common/utils/mem/memory.c ${NAS_SRC}COMMON/UTIL/nas_timer.c ${NAS_SRC}COMMON/UTIL/socket.c ${NAS_SRC}COMMON/UTIL/stty.c @@ -2052,7 +2052,6 @@ add_executable(nr-softmodem ${rrc_h} ${nr_rrc_h} ${s1ap_h} -# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_DIR}/executables/nr-gnb.c ${OPENAIR_DIR}/executables/nr-ru.c ${OPENAIR_DIR}/executables/nr-softmodem.c @@ -2121,7 +2120,6 @@ target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) add_executable(nr-uesoftmodem ${rrc_h} ${s1ap_h} -# ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_DIR}/executables/nr-uesoftmodem.c ${OPENAIR_DIR}/executables/nr-ue.c ${OPENAIR_DIR}/executables/softmodem-common.c @@ -2439,9 +2437,6 @@ make_driver(nasmesh ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH ${nasmesh_src}) # user space tool for configuring MESH IP driver ################ add_executable(rb_tool - ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/constant.h - ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/ioctl.h - ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/rrc_nas_primitives.h ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c ) target_include_directories(rb_tool PRIVATE ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 3891af37abc..13067562fe1 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -139,7 +139,7 @@ target_include_directories(secu_cn PRIVATE ################################################################################ set(util_SRC ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.c - ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.c + ${OPENAIR_DIR}/common/utils/mem/memory.c ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.c ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.c ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.c @@ -149,19 +149,8 @@ set(util_SRC ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.c ${OPENAIR_NAS_DIR}/COMMON/UTIL/stty.c ) -set(util_HDR - ${OPENAIR_NAS_DIR}/COMMON/UTIL/device.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/memory.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_log.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/nas_timer.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/OctetString.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/parser.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVDecoder.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/TLVEncoder.h - ${OPENAIR_NAS_DIR}/COMMON/UTIL/socket.h -) -add_library(util ${util_SRC} ${util_HDR}) +add_library(util ${util_SRC}) target_include_directories(util PRIVATE ${OPENAIR_NAS_DIR}/COMMON/UTIL ${OPENAIR_NAS_DIR}/COMMON ) @@ -178,15 +167,7 @@ set(api_user_SRC ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.c ) -set(api_user_HDR - ${OPENAIR_NAS_DIR}/UE/API/USER/at_command.h - ${OPENAIR_NAS_DIR}/UE/API/USER/at_error.h - ${OPENAIR_NAS_DIR}/UE/API/USER/at_response.h - ${OPENAIR_NAS_DIR}/UE/API/USER/user_api.h - ${OPENAIR_NAS_DIR}/UE/API/USER/user_indication.h -) - -add_library(api_user ${api_user_SRC} ${api_user_HDR}) +add_library(api_user ${api_user_SRC}) target_include_directories(api_user PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USER ${OPENAIR_NAS_DIR}/COMMON ${OPENAIR_NAS_DIR}/UE @@ -200,13 +181,7 @@ set(api_usim_SRC ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.c ) -set(api_usim_HDR - ${OPENAIR_NAS_DIR}/UE/API/USIM/aka_functions.h - ${OPENAIR_NAS_DIR}/UE/API/USIM/usim_api.h - -) - -add_library(api_usim ${api_usim_SRC} ${api_usim_HDR}) +add_library(api_usim ${api_usim_SRC}) target_include_directories(api_usim PRIVATE ${OPENAIR_NAS_DIR}/UE/API/USIM) ################################################################################ @@ -217,13 +192,8 @@ set(api_network_SRC ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.c ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.c ) -set(api_network_HDR - ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/as_message.h - ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/nas_message.h - ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK/network_api.h -) -add_library(api_network ${api_network_SRC} ${api_network_HDR}) +add_library(api_network ${api_network_SRC}) target_include_directories(api_network PRIVATE ${OPENAIR_NAS_DIR}/COMMON/API/NETWORK ${OPENAIR_NAS_DIR}/COMMON ) @@ -311,60 +281,7 @@ set(emm_SRC ) -set(emm_HDR - ${OPENAIR_NAS_DIR}/UE/EMM/emmData.h - ${OPENAIR_NAS_DIR}/UE/EMM/emm_main.h - ${OPENAIR_NAS_DIR}/UE/EMM/emm_proc.h - ${OPENAIR_NAS_DIR}/UE/EMM/IdleMode.h - ${OPENAIR_NAS_DIR}/UE/EMM/LowerLayer.h - - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachAccept.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachComplete.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachReject.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AttachRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationFailure.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationReject.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/AuthenticationResponse.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/CsServiceNotification.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachAccept.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DetachRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/DownlinkNasTransport.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_cause.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmInformation.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msgDef.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/emm_msg.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/EmmStatus.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ExtendedServiceRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationCommand.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/GutiReallocationComplete.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/IdentityResponse.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/NASSecurityModeCommand.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/NASSecurityModeComplete.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/SecurityModeReject.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceReject.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/ServiceRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateAccept.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateComplete.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateReject.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/TrackingAreaUpdateRequest.h - ${OPENAIR_NAS_DIR}/COMMON/EMM/MSG/UplinkNasTransport.h - - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_asDef.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_as.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_esmDef.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_esm.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_fsm.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_recv.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_regDef.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_reg.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_sap.h - ${OPENAIR_NAS_DIR}/UE/EMM/SAP/emm_send.h - -) - -add_library(emm ${emm_SRC} ${emm_HDR}) +add_library(emm ${emm_SRC}) target_include_directories(emm PRIVATE ${OPENAIR_DIR}/common/utils @@ -423,41 +340,7 @@ set(esm_SRC ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_send.c ) -set(esm_HDR - ${OPENAIR_TARGETS}/COMMON/openairinterface5g_limits.h - ${OPENAIR_NAS_DIR}/UE/ESM/esm_main.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceAllocationRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/BearerResourceModificationRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_cause.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmInformationResponse.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_msgDef.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/esm_msg.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/EsmStatus.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextAccept.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/ModifyEpsBearerContextRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnConnectivityRequest.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectReject.h - ${OPENAIR_NAS_DIR}/COMMON/ESM/MSG/PdnDisconnectRequest.h - ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_recv.h - ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_sap.h - ${OPENAIR_NAS_DIR}/UE/ESM/SAP/esm_send.h - ${OPENAIR_DIR}/common/utils/utils.h -) - -add_library(esm ${esm_SRC} ${esm_HDR}) +add_library(esm ${esm_SRC}) target_include_directories(esm PRIVATE ${OPENAIR_DIR}/common/utils @@ -553,89 +436,8 @@ set(ies_SRC ${OPENAIR_NAS_DIR}/COMMON/IES/UeSecurityCapability.c ${OPENAIR_NAS_DIR}/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c ) -set(ies_HDR - ${OPENAIR_NAS_DIR}/COMMON/IES/AccessPointName.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateResult.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AdditionalUpdateType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ApnAggregateMaximumBitRate.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationFailureParameter.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterAutn.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationParameterRand.h - ${OPENAIR_NAS_DIR}/COMMON/IES/AuthenticationResponseParameter.h - ${OPENAIR_NAS_DIR}/COMMON/IES/CipheringKeySequenceNumber.h - ${OPENAIR_NAS_DIR}/COMMON/IES/Cli.h - ${OPENAIR_NAS_DIR}/COMMON/IES/CsfbResponse.h - ${OPENAIR_NAS_DIR}/COMMON/IES/DaylightSavingTime.h - ${OPENAIR_NAS_DIR}/COMMON/IES/DetachType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/DrxParameter.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EmergencyNumberList.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EmmCause.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachResult.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsAttachType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerContextStatus.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsBearerIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsMobileIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsNetworkFeatureSupport.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsQualityOfService.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateResult.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EpsUpdateType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EsmCause.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EsmInformationTransferFlag.h - ${OPENAIR_NAS_DIR}/COMMON/IES/EsmMessageContainer.h - ${OPENAIR_NAS_DIR}/COMMON/IES/GprsTimer.h - ${OPENAIR_NAS_DIR}/COMMON/IES/GutiType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/IdentityType2.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ImeisvRequest.h - ${OPENAIR_NAS_DIR}/COMMON/IES/KsiAndSequenceNumber.h - ${OPENAIR_NAS_DIR}/COMMON/IES/LcsClientIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/LcsIndicator.h - ${OPENAIR_NAS_DIR}/COMMON/IES/LinkedEpsBearerIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/LlcServiceAccessPointIdentifier.h - ${OPENAIR_NAS_DIR}/COMMON/IES/LocationAreaIdentification.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MessageType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MobileIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark2.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MobileStationClassmark3.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkCapability.h - ${OPENAIR_NAS_DIR}/COMMON/IES/MsNetworkFeatureSupport.h - ${OPENAIR_NAS_DIR}/COMMON/IES/NasKeySetIdentifier.h - ${OPENAIR_NAS_DIR}/COMMON/IES/NasMessageContainer.h - ${OPENAIR_NAS_DIR}/COMMON/IES/NasRequestType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/NasSecurityAlgorithms.h - ${OPENAIR_NAS_DIR}/COMMON/IES/NetworkName.h - ${OPENAIR_NAS_DIR}/COMMON/IES/Nonce.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PacketFlowIdentifier.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PagingIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PdnAddress.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PdnType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PlmnList.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ProcedureTransactionIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolConfigurationOptions.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ProtocolDiscriminator.h - ${OPENAIR_NAS_DIR}/COMMON/IES/PTmsiSignature.h - ${OPENAIR_NAS_DIR}/COMMON/IES/QualityOfService.h - ${OPENAIR_NAS_DIR}/COMMON/IES/RadioPriority.h - ${OPENAIR_NAS_DIR}/COMMON/IES/SecurityHeaderType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ServiceType.h - ${OPENAIR_NAS_DIR}/COMMON/IES/ShortMac.h - ${OPENAIR_NAS_DIR}/COMMON/IES/SsCode.h - ${OPENAIR_NAS_DIR}/COMMON/IES/SupportedCodecList.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZoneAndTime.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TimeZone.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TmsiStatus.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentity.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TrackingAreaIdentityList.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowAggregateDescription.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TrafficFlowTemplate.h - ${OPENAIR_NAS_DIR}/COMMON/IES/TransactionIdentifier.h - ${OPENAIR_NAS_DIR}/COMMON/IES/UeNetworkCapability.h - ${OPENAIR_NAS_DIR}/COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.h - ${OPENAIR_NAS_DIR}/COMMON/IES/UeSecurityCapability.h - ${OPENAIR_NAS_DIR}/COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.h - -) -add_library(ies ${ies_SRC} ${ies_HDR}) +add_library(ies ${ies_SRC}) target_include_directories(ies PRIVATE ${OPENAIR_NAS_DIR}/COMMON/IES diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt index 05d7a427128..55c981701b7 100755 --- a/cmake_targets/nas_sim_tools/CMakeLists.txt +++ b/cmake_targets/nas_sim_tools/CMakeLists.txt @@ -28,24 +28,12 @@ set(CONF2UEDATA_LIB_SRC ${OPENAIR_DIR}/openair3/NAS/TOOLS/display.c ${OPENAIR_DIR}/openair3/NAS/UE/API/USIM/usim_api.c ${OPENAIR_DIR}/openair3/NAS/UE/API/USIM/aka_functions.c - ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/memory.c + ${OPENAIR_DIR}/common/utils/mem/memory.c ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/OctetString.c ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/TLVEncoder.c ${OPENAIR_DIR}/common/utils/utils.c ) -set(conf2uedata_HDR - ${OPENAIR_DIR}/openair3/NAS/TOOLS/conf2uedata.h - ${OPENAIR_DIR}/openair3/NAS/TOOLS/conf_emm.h - ${OPENAIR_DIR}/openair3/NAS/UE/API/USIM/usim_api.h - ${OPENAIR_DIR}/openair3/NAS/UE/API/USIM/aka_functions.h - ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/memory.h - ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/nas_log.h - ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/OctetString.h - ${OPENAIR_DIR}/openair3/NAS/COMMON/UTIL/TLVEncoder.h - ${OPENAIR_DIR}/common/utils/utils.h -) - include_directories( ${OPENAIR_DIR}/common/utils ${OPENAIR_DIR}/openair3/NAS/UE @@ -65,7 +53,7 @@ set(conf2uedata_SRC ${CONF2UEDATA_LIB_SRC} ) -add_executable(conf2uedata ${conf2uedata_SRC} ${conf2uedata_HDR} ) +add_executable(conf2uedata ${conf2uedata_SRC} ) target_link_libraries(conf2uedata ${CONFIG_LIBRARIES}) # usim binary @@ -76,7 +64,7 @@ set(usim_SRC ) -add_executable(usim ${usim_SRC} ${conf2uedata_HDR} ) +add_executable(usim ${usim_SRC} ) target_link_libraries(usim ${CONFIG_LIBRARIES}) # nvram binary @@ -87,5 +75,5 @@ set(nvram_SRC ) -add_executable(nvram ${nvram_SRC} ${conf2uedata_HDR} ) +add_executable(nvram ${nvram_SRC}) target_link_libraries(nvram ${CONFIG_LIBRARIES}) diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index a24c82d96f7..c3f3d5ae21f 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -35,7 +35,7 @@ #include <stdio.h> #include <ctype.h> #include <errno.h> -#include <platform_types.h> +#include "common/platform_types.h" #include "config_userapi.h" #include "config_common.h" #include "../utils/LOG/log.h" diff --git a/common/config/config_common.c b/common/config/config_common.c index 6c3ddf3b8e1..5559cc20766 100644 --- a/common/config/config_common.c +++ b/common/config/config_common.c @@ -28,7 +28,7 @@ #include <errno.h> #include <dlfcn.h> #include <arpa/inet.h> -#include <platform_types.h> +#include "common/platform_types.h" #include "config_common.h" #include "../utils/LOG/log.h" static int managed_ptr_sz(configmodule_interface_t *cfg, void *ptr) diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 41d6aad376c..dd86aaf42a5 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -36,7 +36,7 @@ #include <unistd.h> #include <errno.h> #include <dlfcn.h> -#include <platform_types.h> +#include "common/platform_types.h" #define CONFIG_LOADCONFIG_MAIN #include "config_load_configmodule.h" diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index aeb4e8a726d..9f7477f5cd0 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -39,7 +39,7 @@ #include <errno.h> #include <dlfcn.h> #include <arpa/inet.h> -#include <platform_types.h> +#include "common/platform_types.h" #include "config_userapi.h" #include "config_common.h" #include "../utils/LOG/log.h" diff --git a/common/platform_constants.h b/common/platform_constants.h index 454c24657b5..2f542083063 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -89,7 +89,9 @@ #define NUM_MAX_CBA_GROUP 4 #define printk printf - +#define RETURNok (0) +#define RETURNerror (-1) +#define DEFAULT_NAS_PATH "PWD" #define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE) #endif /* __PLATFORM_CONSTANTS_H__ */ diff --git a/openair2/COMMON/platform_types.h b/common/platform_types.h similarity index 53% rename from openair2/COMMON/platform_types.h rename to common/platform_types.h index 6c388c3cd05..888a812465f 100644 --- a/openair2/COMMON/platform_types.h +++ b/common/platform_types.h @@ -36,152 +36,153 @@ //----------------------------------------------------------------------------- // GENERIC ACCESS STRATUM TYPES //----------------------------------------------------------------------------- -typedef int32_t sdu_size_t; -typedef uint32_t frame_t; -typedef int32_t sframe_t; -typedef uint32_t sub_frame_t; -typedef uint32_t slot_t; -typedef uint16_t module_id_t; -typedef uint8_t slice_id_t; -typedef uint8_t eNB_index_t; -typedef uint64_t ue_id_t; -typedef int16_t smodule_id_t; -typedef long rb_id_t; -typedef long srb_id_t; +typedef int32_t sdu_size_t; +typedef uint32_t frame_t; +typedef int32_t sframe_t; +typedef uint32_t sub_frame_t; +typedef uint32_t slot_t; +typedef uint16_t module_id_t; +typedef uint8_t slice_id_t; +typedef uint8_t eNB_index_t; +typedef uint64_t ue_id_t; +typedef int16_t smodule_id_t; +typedef long rb_id_t; +typedef long srb_id_t; typedef bool MBMS_flag_t; -#define MBMS_FLAG_NO false +#define MBMS_FLAG_NO false #define MBMS_FLAG_YES true typedef bool eNB_flag_t; -#define ENB_FLAG_NO false +#define ENB_FLAG_NO false #define ENB_FLAG_YES true typedef bool gNB_flag_t; -#define GNB_FLAG_NO false +#define GNB_FLAG_NO false #define GNB_FLAG_YES true typedef bool srb_flag_t; -#define SRB_FLAG_NO false +#define SRB_FLAG_NO false #define SRB_FLAG_YES true typedef bool sl_discovery_flag_t; -#define SL_DISCOVERY_FLAG_NO false +#define SL_DISCOVERY_FLAG_NO false #define SL_DISCOVERY_FLAG_YES true -typedef enum link_direction_e { - UNKNOWN_DIR = 0, - DIR_UPLINK = 1, - DIR_DOWNLINK = 2 -} link_direction_t; - -typedef enum rb_type_e { - UNKNOWN_RADIO_BEARER = 0, - SIGNALLING_RADIO_BEARER = 1, - RADIO_ACCESS_BEARER = 2 -} rb_type_t; - -typedef enum { - CR_ROUND = 0, - CR_SRB12 = 1, - CR_HOL = 2, - CR_LC = 3, - CR_CQI = 4, - CR_LCP = 5, - CR_NUM = 6 -} sorting_criterion_t; - -typedef enum { - POL_FAIR = 0, - POL_GREEDY = 1, - POL_NUM = 2 -} accounting_policy_t; +typedef enum link_direction_e { UNKNOWN_DIR = 0, DIR_UPLINK = 1, DIR_DOWNLINK = 2 } link_direction_t; + +typedef enum rb_type_e { UNKNOWN_RADIO_BEARER = 0, SIGNALLING_RADIO_BEARER = 1, RADIO_ACCESS_BEARER = 2 } rb_type_t; + +typedef enum { CR_ROUND = 0, CR_SRB12 = 1, CR_HOL = 2, CR_LC = 3, CR_CQI = 4, CR_LCP = 5, CR_NUM = 6 } sorting_criterion_t; + +typedef enum { POL_FAIR = 0, POL_GREEDY = 1, POL_NUM = 2 } accounting_policy_t; //----------------------------------------------------------------------------- // PHY TYPES //----------------------------------------------------------------------------- -typedef uint8_t crc8_t; -typedef uint16_t crc16_t; -typedef uint32_t crc32_t; -typedef unsigned int crc_t; +typedef uint8_t crc8_t; +typedef uint16_t crc16_t; +typedef uint32_t crc32_t; +typedef unsigned int crc_t; //----------------------------------------------------------------------------- // MAC TYPES //----------------------------------------------------------------------------- -typedef sdu_size_t tbs_size_t; -typedef sdu_size_t tb_size_t; -typedef unsigned int logical_chan_id_t; -typedef unsigned int num_tb_t; -typedef uint8_t mac_enb_index_t; +typedef sdu_size_t tbs_size_t; +typedef sdu_size_t tb_size_t; +typedef unsigned int logical_chan_id_t; +typedef unsigned int num_tb_t; +typedef uint8_t mac_enb_index_t; //----------------------------------------------------------------------------- // RLC TYPES //----------------------------------------------------------------------------- -typedef unsigned int mui_t; -typedef unsigned int confirm_t; -typedef unsigned int rlc_tx_status_t; -typedef int16_t rlc_sn_t; -typedef uint16_t rlc_usn_t; -typedef int32_t rlc_buffer_occupancy_t; -typedef signed int rlc_op_status_t; - -#define SDU_CONFIRM_NO false -#define SDU_CONFIRM_YES true +typedef unsigned int mui_t; +typedef unsigned int confirm_t; +typedef unsigned int rlc_tx_status_t; +typedef int16_t rlc_sn_t; +typedef uint16_t rlc_usn_t; +typedef int32_t rlc_buffer_occupancy_t; +typedef signed int rlc_op_status_t; + +typedef enum rlc_mode_e { RLC_MODE_NONE = 0, RLC_MODE_AM = 1, RLC_MODE_UM = 2, RLC_MODE_TM = 4 } rlc_mode_t; + +/*! \struct mac_rlc_status_resp_t + * \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance. + */ +typedef struct { + rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */ + rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ + frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ + sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of + already segmented sdu */ + bool head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */ +} mac_rlc_status_resp_t; + +#define SDU_CONFIRM_NO false +#define SDU_CONFIRM_YES true //----------------------------------------------------------------------------- // PDCP TYPES //----------------------------------------------------------------------------- -typedef uint16_t pdcp_sn_t; -typedef uint32_t pdcp_hfn_t; -typedef int16_t pdcp_hfn_offset_t; +typedef uint16_t pdcp_sn_t; +typedef uint32_t pdcp_hfn_t; +typedef int16_t pdcp_hfn_offset_t; typedef enum pdcp_transmission_mode_e { - PDCP_TRANSMISSION_MODE_UNKNOWN = 0, - PDCP_TRANSMISSION_MODE_CONTROL = 1, - PDCP_TRANSMISSION_MODE_DATA = 2, + PDCP_TRANSMISSION_MODE_UNKNOWN = 0, + PDCP_TRANSMISSION_MODE_CONTROL = 1, + PDCP_TRANSMISSION_MODE_DATA = 2, PDCP_TRANSMISSION_MODE_TRANSPARENT = 3 } pdcp_transmission_mode_t; //----------------------------------------------------------------------------- // IP DRIVER / PDCP TYPES //----------------------------------------------------------------------------- -typedef uint16_t tcp_udp_port_t; -typedef enum ip_traffic_type_e { - TRAFFIC_IPVX_TYPE_UNKNOWN = 0, - TRAFFIC_IPV6_TYPE_UNICAST = 1, - TRAFFIC_IPV6_TYPE_MULTICAST = 2, - TRAFFIC_IPV6_TYPE_UNKNOWN = 3, - TRAFFIC_IPV4_TYPE_UNICAST = 5, - TRAFFIC_IPV4_TYPE_MULTICAST = 6, - TRAFFIC_IPV4_TYPE_BROADCAST = 7, - TRAFFIC_IPV4_TYPE_UNKNOWN = 8, - TRAFFIC_PC5S_SIGNALLING = 9, - TRAFFIC_PC5S_SESSION_INIT = 10 +typedef uint16_t tcp_udp_port_t; +typedef enum ip_traffic_type_e { + TRAFFIC_IPVX_TYPE_UNKNOWN = 0, + TRAFFIC_IPV6_TYPE_UNICAST = 1, + TRAFFIC_IPV6_TYPE_MULTICAST = 2, + TRAFFIC_IPV6_TYPE_UNKNOWN = 3, + TRAFFIC_IPV4_TYPE_UNICAST = 5, + TRAFFIC_IPV4_TYPE_MULTICAST = 6, + TRAFFIC_IPV4_TYPE_BROADCAST = 7, + TRAFFIC_IPV4_TYPE_UNKNOWN = 8, + TRAFFIC_PC5S_SIGNALLING = 9, + TRAFFIC_PC5S_SESSION_INIT = 10 } ip_traffic_type_t; +typedef struct net_ip_address_s { + unsigned ipv4: 1; + unsigned ipv6: 1; + char ipv4_address[16]; + char ipv6_address[46]; +} net_ip_address_t; + //----------------------------------------------------------------------------- // RRC TYPES //----------------------------------------------------------------------------- -typedef uint32_t mbms_session_id_t; -typedef uint16_t mbms_service_id_t; -typedef uint16_t rnti_t; -typedef uint8_t rrc_enb_index_t; -typedef uint8_t mme_code_t; -typedef uint32_t m_tmsi_t; - -//Random UE identity length = 40 bits - #define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF - #define NOT_A_RNTI (rnti_t)0 - #define M_RNTI (rnti_t)0xFFFD - #define P_RNTI (rnti_t)0xFFFE - #define SI_RNTI (rnti_t)0xFFFF -#define CBA_RNTI (rnti_t)0xfff4 +typedef uint32_t mbms_session_id_t; +typedef uint16_t mbms_service_id_t; +typedef uint16_t rnti_t; +typedef uint8_t rrc_enb_index_t; +typedef uint8_t mme_code_t; +typedef uint32_t m_tmsi_t; + +// Random UE identity length = 40 bits +#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF +#define NOT_A_RNTI (rnti_t)0 +#define M_RNTI (rnti_t)0xFFFD +#define P_RNTI (rnti_t)0xFFFE +#define SI_RNTI (rnti_t)0xFFFF +#define CBA_RNTI (rnti_t)0xfff4 #define OAI_C_RNTI (rnti_t)0x1234 typedef enum config_action_e { - CONFIG_ACTION_NULL = 0, - CONFIG_ACTION_ADD = 1, - CONFIG_ACTION_REMOVE = 2, - CONFIG_ACTION_MODIFY = 3, + CONFIG_ACTION_NULL = 0, + CONFIG_ACTION_ADD = 1, + CONFIG_ACTION_REMOVE = 2, + CONFIG_ACTION_MODIFY = 3, CONFIG_ACTION_SET_SECURITY_MODE = 4, - CONFIG_ACTION_MBMS_ADD = 10, - CONFIG_ACTION_MBMS_MODIFY = 11 + CONFIG_ACTION_MBMS_ADD = 10, + CONFIG_ACTION_MBMS_MODIFY = 11 } config_action_t; /* Maximum size of any message we might send or receive (e.g., via a socket) */ @@ -195,10 +196,9 @@ typedef struct nsa_msg_t { //----------------------------------------------------------------------------- // GTPV1U TYPES //----------------------------------------------------------------------------- -typedef uint32_t teid_t; // tunnel endpoint identifier -typedef uint8_t ebi_t; // eps bearer id -typedef uint8_t pdusessionid_t; - +typedef uint32_t teid_t; // tunnel endpoint identifier +typedef uint8_t ebi_t; // eps bearer id +typedef uint8_t pdusessionid_t; //----------------------------------------------------------------------------- // @@ -207,42 +207,39 @@ typedef uint8_t pdusessionid_t; typedef intptr_t instance_t; typedef struct protocol_ctxt_s { - module_id_t module_id; /*!< \brief Virtualized module identifier */ - eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ - instance_t instance; /*!< \brief ITTI or OTG module identifier */ + module_id_t module_id; /*!< \brief Virtualized module identifier */ + eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ + instance_t instance; /*!< \brief ITTI or OTG module identifier */ ue_id_t rntiMaybeUEid; - frame_t frame; /*!< \brief LTE frame number.*/ - sub_frame_t subframe; /*!< \brief LTE sub frame number.*/ - eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */ - bool brOption; + frame_t frame; /*!< \brief LTE frame number.*/ + sub_frame_t subframe; /*!< \brief LTE sub frame number.*/ + eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */ + bool brOption; } protocol_ctxt_t; // warning time hardcoded -#define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame*10+(CtXt_h)->subframe) +#define PROTOCOL_CTXT_TIME_MILLI_SECONDS(CtXt_h) ((CtXt_h)->frame * 10 + (CtXt_h)->subframe) #define UE_MODULE_ID_TO_INSTANCE(mODULE_iD) mODULE_iD + RC.nb_inst -#define ENB_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD +#define ENB_MODULE_ID_TO_INSTANCE(mODULE_iD) mODULE_iD #define UE_INSTANCE_TO_MODULE_ID(iNSTANCE) iNSTANCE - RC.nb_inst -#define ENB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE +#define ENB_INSTANCE_TO_MODULE_ID(iNSTANCE) iNSTANCE -//NR +// NR #define GNB_MODULE_ID_TO_INSTANCE(mODULE_iD) mODULE_iD -#define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \ - do { \ +#define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \ + do { \ iNSTANCE = eNB_fLAG == ENB_FLAG_YES ? ENB_MODULE_ID_TO_INSTANCE(mODULE_iD) : UE_MODULE_ID_TO_INSTANCE(mODULE_iD); \ } while (0) -#define INSTANCE_TO_MODULE_ID(iNSTANCE, mODULE_iD, eNB_fLAG) \ - do { \ +#define INSTANCE_TO_MODULE_ID(iNSTANCE, mODULE_iD, eNB_fLAG) \ + do { \ mODULE_iD = eNB_fLAG == ENB_FLAG_YES ? ENB_INSTANCE_TO_MODULE_ID(iNSTANCE) : UE_INSTANCE_TO_MODULE_ID(iNSTANCE); \ } while (0) -#define PROTOCOL_CTXT_COMPUTE_MODULE_ID(CtXt_h) \ - INSTANCE_TO_MODULE_ID( (CtXt_h)->instance , (CtXt_h)->module_id , (CtXt_h)->enb_flag ) - +#define PROTOCOL_CTXT_COMPUTE_MODULE_ID(CtXt_h) INSTANCE_TO_MODULE_ID((CtXt_h)->instance, (CtXt_h)->module_id, (CtXt_h)->enb_flag) -#define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) \ - MODULE_ID_TO_INSTANCE( (CtXt_h)->module_id , (CtXt_h)->instance , (CtXt_h)->enb_flag ) +#define PROTOCOL_CTXT_COMPUTE_INSTANCE(CtXt_h) MODULE_ID_TO_INSTANCE((CtXt_h)->module_id, (CtXt_h)->instance, (CtXt_h)->enb_flag) #define PROTOCOL_CTXT_SET_BY_MODULE_ID(Ctxt_Pp, mODULE_iD, eNB_fLAG, rNTI, fRAME, sUBfRAME, eNB_iNDEX) \ do { \ @@ -252,7 +249,7 @@ typedef struct protocol_ctxt_s { (Ctxt_Pp)->frame = fRAME; \ (Ctxt_Pp)->subframe = sUBfRAME; \ (Ctxt_Pp)->eNB_index = eNB_iNDEX; \ - (Ctxt_Pp)->brOption = false; /* set a default value */ \ + (Ctxt_Pp)->brOption = false; /* set a default value */ \ PROTOCOL_CTXT_COMPUTE_INSTANCE(Ctxt_Pp); \ } while (0) @@ -263,22 +260,23 @@ typedef struct protocol_ctxt_s { (Ctxt_Pp)->rntiMaybeUEid = rNTI; \ (Ctxt_Pp)->frame = fRAME; \ (Ctxt_Pp)->subframe = sUBfRAME; \ - (Ctxt_Pp)->eNB_index = 0; /* set a default value */ \ - (Ctxt_Pp)->brOption = false; /* set a default value */ \ + (Ctxt_Pp)->eNB_index = 0; /* set a default value */ \ + (Ctxt_Pp)->brOption = false; /* set a default value */ \ PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp); \ } while (0) #define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02d][RNTI %" PRIx64 "]" -#define PROTOCOL_CTXT_ARGS(CTXT_Pp) (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid +#define PROTOCOL_CTXT_ARGS(CTXT_Pp) \ + (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid -#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid +#define PROTOCOL_NR_CTXT_ARGS(CTXT_Pp) \ + (CTXT_Pp)->frame, ((CTXT_Pp)->enb_flag == GNB_FLAG_YES) ? "gNB" : " UE", (CTXT_Pp)->module_id, (CTXT_Pp)->rntiMaybeUEid #define CHECK_CTXT_ARGS(CTXT_Pp) #define exit_fun(msg) exit_function(__FILE__, __FUNCTION__, __LINE__, "exit_fun", OAI_EXIT_NORMAL) #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif void exit_function(const char *file, const char *function, const int line, const char *s, const int assert); #ifdef __cplusplus diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 453e853aecd..d7d92b8ec4c 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -27,7 +27,7 @@ #include <inttypes.h> #include <sys/types.h> #include <unistd.h> -#include <platform_types.h> +#include "common/platform_types.h" #define OAI_EXIT_NORMAL 0 #define OAI_EXIT_ASSERT 1 diff --git a/common/utils/config.h b/common/utils/config.h index 0cd783fe5ed..1494f17de11 100644 --- a/common/utils/config.h +++ b/common/utils/config.h @@ -37,9 +37,9 @@ * * In code: * ``` - * set_log(ASN1, OAI_INFO); // enable logging + * set_log(ASN1, OAILOG_INFO); // enable logging * // do your encoding here - * set_log(ASN1, OAI_ERR); // disable logging + * set_log(ASN1, OAILOG_ERR); // disable logging * ``` * * in gdb: diff --git a/openair3/NAS/COMMON/UTIL/memory.c b/common/utils/mem/memory.c similarity index 77% rename from openair3/NAS/COMMON/UTIL/memory.c rename to common/utils/mem/memory.c index 334cdc5eb62..d4f09279aae 100644 --- a/openair3/NAS/COMMON/UTIL/memory.c +++ b/common/utils/mem/memory.c @@ -19,42 +19,11 @@ * contact@openairinterface.org */ -/***************************************************************************** -Source memory.c - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Memory access utilities - -*****************************************************************************/ - -#include "memory.h" -#include "commonDef.h" -#include "nas_log.h" - -#include <stdio.h> // fopen, fread, fclose -#include <stdlib.h> // getenv, malloc, free -#include <string.h> // strlen - -/****************************************************************************/ -/**************** E X T E R N A L D E F I N I T I O N S ****************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************* L O C A L D E F I N I T I O N S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "common/utils/mem/oai_memory.h" +#include "common/utils/LOG/log.h" /**************************************************************************** ** ** @@ -85,13 +54,12 @@ char* memory_get_path(const char* dirname, const char* filename) } if (path == NULL) { - LOG_TRACE(WARNING, "MEMORY - %s and %s environment variables are not defined trying local directory", dirname, DEFAULT_NAS_PATH); path = "."; } /* Append non-volatile data file name */ size_t size = strlen(path) + strlen(filename) + 1; - char* data_filename = (char*)malloc(size+1); + char* data_filename = (char*)malloc(size + 1); if (data_filename != NULL) { if (size != sprintf(data_filename, "%s/%s", path, filename)) { @@ -114,19 +82,17 @@ char* memory_get_path_from_ueid(const char* dirname, const char* filename, int u } if (path == NULL) { - LOG_TRACE(WARNING, "MEMORY - %s and %s environment variables are not defined trying local directory", dirname, DEFAULT_NAS_PATH); path = "."; } /* Append non-volatile data file name */ - if ( snprintf(buffer, sizeof(buffer), "%s/%s%d", path, filename, ueid) < 0 ) { + if (snprintf(buffer, sizeof(buffer), "%s/%s%d", path, filename, ueid) < 0) { return NULL; } return strdup(buffer); } - /**************************************************************************** ** ** ** Name: memory_read() ** @@ -201,8 +167,3 @@ int memory_write(const char* datafile, const void* data, size_t size) return (rc); } - -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - diff --git a/openair3/NAS/COMMON/UTIL/memory.h b/common/utils/mem/oai_memory.h similarity index 52% rename from openair3/NAS/COMMON/UTIL/memory.h rename to common/utils/mem/oai_memory.h index ec8406c9328..311ad6f4d06 100644 --- a/openair3/NAS/COMMON/UTIL/memory.h +++ b/common/utils/mem/oai_memory.h @@ -19,42 +19,21 @@ * contact@openairinterface.org */ -/***************************************************************************** -Source memory.h - -Version 0.1 - -Date 2012/10/09 - -Product NAS stack - -Subsystem Utilities - -Author Frederic Maurel - -Description Memory access utilities - -*****************************************************************************/ #ifndef __MEMORY_H__ #define __MEMORY_H__ -#include <stddef.h> // size_t - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ +#include <stddef.h> +#include <stdint.h> +#include <stddef.h> +#ifdef __cplusplus +extern "C" { +#endif +#include "common/platform_constants.h" +//----------------------------------------------------------------------------- -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ +typedef unsigned char uint8_t; -/****************************************************************************/ -/****************** E X P O R T E D F U N C T I O N S ******************/ -/****************************************************************************/ +//----------------------------------------------------------------------------- char* memory_get_path(const char* dirname, const char* filename); @@ -64,4 +43,7 @@ int memory_read(const char* datafile, void* data, size_t size); int memory_write(const char* datafile, const void* data, size_t size); +#ifdef __cplusplus +} +#endif #endif /* __MEMORY_H__*/ diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 8c4da1d92ce..56781f79a4d 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -59,29 +59,6 @@ typedef struct timer_elm_s { static int nb_queues=0; static pthread_mutex_t lock_nb_queues; - void *pool_buffer_init (void) { - return 0; - } - - void *pool_buffer_clean (void *arg) { - //----------------------------------------------------------------------------- - return 0; - } - - void free_mem_block (mem_block_t *leP, const char *caller) { - AssertFatal(leP!=NULL,""); - free(leP); - } - - mem_block_t *get_free_mem_block (uint32_t sizeP, const char *caller) { - mem_block_t *ptr=(mem_block_t *)malloc(sizeP+sizeof(mem_block_t)); - ptr->next = NULL; - ptr->previous = NULL; - ptr->data=((unsigned char *)ptr)+sizeof(mem_block_t); - ptr->size=sizeP; - return ptr; - } - void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size) { void *ptr = NULL; AssertFatal ((ptr=calloc (size, 1)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n", diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index bca3f9a56be..f8f33a9c82f 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -26,9 +26,8 @@ #include <stdint.h> #include <sys/epoll.h> -#include <mem_block.h> #include <assertions.h> - +#include "common/utils/mem/oai_memory.h" typedef enum timer_type_s { TIMER_PERIODIC, @@ -62,7 +61,6 @@ typedef struct itti_lte_time_s { uint8_t slot; } itti_lte_time_t; - typedef struct IttiMsgEmpty_s { // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ // To be removed if the structure is filled @@ -552,7 +550,6 @@ void itti_set_task_real_time(task_id_t task_id); void itti_send_terminate_message(task_id_t task_id); void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size); -int memory_read(const char *datafile, void *data, size_t size); int itti_free(task_id_t task_id, void *ptr); int itti_init(task_id_t task_max, const task_info_t *tasks_info); diff --git a/doc/Doxyfile b/doc/Doxyfile index 2cef6f94786..c92e9fb3367 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -1337,9 +1337,9 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/nas_timer.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/TLVDecoder.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/nas_timer.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/memory.c \ +@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/mem/memory.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/OctetString.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/memory.h \ +@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/mem/oai_memory.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/TLVDecoder.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/nas_log.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair3/NAS/COMMON/UTIL/TLVEncoder.h \ @@ -1771,7 +1771,6 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/OTG/otg_models.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/OTG/otg_externs.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/OTG/otg_config.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/MEM/mem_block.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/MATH/oml.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/UTIL/MATH/oml.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/F1AP/f1ap_cu_ue_context_management.c \ @@ -1836,7 +1835,7 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/udp_messages_def.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/nas_messages_types.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/sctp_messages_types.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/platform_types.h \ +@CMAKE_CURRENT_SOURCE_DIR@/../common/platform_types.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/ngap_messages_types.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/gtpv1_u_messages_types.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair2/COMMON/rlc_messages_types.h \ diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 5fb66bc73a7..558e450d330 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -71,7 +71,7 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const pc, const mui_t mui, const confirm_t c, const sdu_size_t size, - mem_block_t *const buf, + uint8_t *const buf, const uint32_t *const a, const uint32_t *const b) { diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 3dc6e930b79..239c1423a36 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -19,7 +19,7 @@ #include <pthread.h> #include "stddef.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "fapi_nr_ue_constants.h" #include "PHY/impl_defs_top.h" #include "PHY/impl_defs_nr.h" diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 11bc86e42eb..a4ff93b5e8e 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -31,7 +31,7 @@ #include "pnf.h" # if 1 // for hard-code (remove later) -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "common/ran_context.h" diff --git a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h index d90216c3e6a..7ee3be67018 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h +++ b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h @@ -17,7 +17,7 @@ //#include "PHY/defs_nb_iot.h" #include "PHY/LTE_TRANSPORT/dci_NB_IoT.h" #include "PHY/impl_defs_lte_NB_IoT.h" -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" //#include "dci.h" #include "PHY/LTE_TRANSPORT/uci_NB_IoT.h" //#include "dci.h" diff --git a/openair1/PHY/NBIoT_TRANSPORT/README b/openair1/PHY/NBIoT_TRANSPORT/README deleted file mode 100644 index 938b70815c5..00000000000 --- a/openair1/PHY/NBIoT_TRANSPORT/README +++ /dev/null @@ -1 +0,0 @@ -NB-IoT transport channel procedures for NB-IoT are here diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index ab55b678643..01143ccf472 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -119,7 +119,7 @@ static inline void* malloc16_clear( size_t size ) #include "PHY/CODING/defs_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" //#include "PHY/TOOLS/defs.h" -//#include "platform_types.h" +#include "common/platform_types.h" ///#include "openair1/PHY/LTE_TRANSPORT/defs_nb_iot.h" ////////////////////////////////////////////////////////////////////#ifdef OPENAIR_LTE (check if this is required) diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 7ee8017a45c..7f1858b2c46 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -62,7 +62,7 @@ #include "time_meas.h" #include "PHY/CODING/coding_defs.h" #include "PHY/TOOLS/tools_defs.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "PHY/LTE_UE_TRANSPORT/transport_ue.h" #include "PHY/LTE_TRANSPORT/transport_eNB.h" // for SIC #include <pthread.h> diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index e021f7ce683..7098bd8c6fa 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -59,7 +59,7 @@ //#include <complex.h> #include "time_meas.h" -#include "platform_types.h" +#include "common/platform_types.h" #define MAX_NUM_RU_PER_eNB 64 #include <pthread.h> diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 668716e1f9a..45abb05c2fe 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -61,7 +61,7 @@ #include "time_meas.h" //#include "PHY/CODING/coding_defs.h" #include "PHY/TOOLS/tools_defs.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "PHY/LTE_TRANSPORT/transport_common.h" #include "PHY/LTE_TRANSPORT/transport_eNB.h" #include "openair2/PHY_INTERFACE/IF_Module.h" diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index f9934348c7f..0eb824406bf 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -97,7 +97,7 @@ #include "time_meas.h" #include "PHY/CODING/coding_defs.h" #include "PHY/TOOLS/tools_defs.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "NR_UE_TRANSPORT/nr_transport_ue.h" #if defined(UPGRADE_RAT_NR) diff --git a/openair1/SCHED_NBIOT/README b/openair1/SCHED_NBIOT/README deleted file mode 100644 index 319372ee93a..00000000000 --- a/openair1/SCHED_NBIOT/README +++ /dev/null @@ -1 +0,0 @@ -213 procedures for NB-IoT eNB diff --git a/openair1/SCHED_NR/README b/openair1/SCHED_NR/README deleted file mode 100644 index 8814a972b0e..00000000000 --- a/openair1/SCHED_NR/README +++ /dev/null @@ -1 +0,0 @@ -213/214 procedures for NR gNB diff --git a/openair1/SCHED_NR_UE/README b/openair1/SCHED_NR_UE/README deleted file mode 100644 index b2bc9d09b8a..00000000000 --- a/openair1/SCHED_NR_UE/README +++ /dev/null @@ -1 +0,0 @@ -213/214 procedures for NR UE diff --git a/openair1/SIMULATION/Makefile.inc b/openair1/SIMULATION/Makefile.inc deleted file mode 100644 index 848a6cf5560..00000000000 --- a/openair1/SIMULATION/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -SIMULATION_OBJS = $(TOP_DIR)/SIMULATION/TOOLS/gauss.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/random_channel.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/rangen_double.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/taus.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_channel.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/multipath_tv_channel.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/TOOLS/abstraction.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/rf.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/adc.o -SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/RF/dac.o -#SIMULATION_OBJS += $(TOP_DIR)/SIMULATION/LTE_PHY/openair_hw.o - diff --git a/openair2/COMMON/commonDef.h b/openair2/COMMON/commonDef.h index e18db881f04..f5a24494a79 100644 --- a/openair2/COMMON/commonDef.h +++ b/openair2/COMMON/commonDef.h @@ -42,36 +42,9 @@ Description Contains global common definitions #include <stdint.h> #include <stddef.h> #include <stdbool.h> - -#define NAS_UE_ID_FMT "0x%06x" - -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ - -#define RETURNok (0) -#define RETURNerror (-1) - -/* - * Name of the environment variable which defines the default directory - * where the NAS application is executed and where are located files - * where non-volatile data are stored - */ -#define DEFAULT_NAS_PATH "PWD" - -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/* ------------------------------------------------------------------------------ - Standard data type definitions ------------------------------------------------------------------------------ -*/ -typedef int8_t SByte_t; /* 8 bit signed integer */ +#include "common/platform_constants.h" typedef uint8_t Byte_t; /* 8 bit unsigned integer */ - /* ----------------------------------------------------------------------------- Common NAS data type definitions diff --git a/openair2/COMMON/e1ap_messages_types.h b/openair2/COMMON/e1ap_messages_types.h index 212c4009881..b6400b53b55 100644 --- a/openair2/COMMON/e1ap_messages_types.h +++ b/openair2/COMMON/e1ap_messages_types.h @@ -51,7 +51,7 @@ #define E1AP_BEARER_CONTEXT_RELEASE_CMD(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_release_cmd #define E1AP_BEARER_CONTEXT_RELEASE_CPLT(mSGpTR) (mSGpTR)->ittiMsg.e1ap_bearer_release_cplt -typedef f1ap_net_ip_address_t e1ap_net_ip_address_t; +typedef net_ip_address_t e1ap_net_ip_address_t; typedef struct PLMN_ID_s { int mcc; diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 0689dd52ac3..a5e10b01f90 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,6 +19,7 @@ * contact@openairinterface.org */ +#include "openair2/COMMON/f1ap_messages_types.h" /* To setup F1 at DU */ MESSAGE_DEF(F1AP_DU_REGISTER_REQ, MESSAGE_PRIORITY_MED, f1ap_du_register_req_t, f1ap_du_register_req) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index c0d5c1b437c..cb4c65e9e22 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -24,7 +24,6 @@ #include <netinet/in.h> #include <netinet/sctp.h> -#include "rlc.h" #include "s1ap_messages_types.h" #include "ngap_messages_types.h" @@ -75,12 +74,7 @@ #define F1AP_MAX_NO_OF_TNL_ASSOCIATIONS 32 #define F1AP_MAX_NO_UE_ID 1024 -typedef struct f1ap_net_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - char ipv4_address[16]; - char ipv6_address[46]; -} f1ap_net_ip_address_t; +typedef net_ip_address_t f1ap_net_ip_address_t; typedef struct f1ap_net_config_t { f1ap_net_ip_address_t CU_f1_ip_address; diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index b159b3e11b0..d65b31b1452 100644 --- a/openair2/COMMON/mac_rrc_primitives.h +++ b/openair2/COMMON/mac_rrc_primitives.h @@ -23,7 +23,7 @@ #define __MAC_RRC_PRIMITIVES_H__ #include "LAYER2/RLC/rlc.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "openair2/RRC/LTE/rrc_defs.h" diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 66b8719cc86..caf0bff683c 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -29,6 +29,8 @@ #ifndef NGAP_MESSAGES_TYPES_H_ #define NGAP_MESSAGES_TYPES_H_ +#include "common/platform_constants.h" +#include "common/platform_types.h" #include "common/ngran_types.h" #include "LTE_asn_constant.h" //-------------------------------------------------------------------------------------------// diff --git a/openair2/COMMON/ral_messages_types.h b/openair2/COMMON/ral_messages_types.h index fa90c4a3b28..9858d420ca8 100644 --- a/openair2/COMMON/ral_messages_types.h +++ b/openair2/COMMON/ral_messages_types.h @@ -22,7 +22,7 @@ #ifndef RAL_MESSAGES_TYPES_H_ #define RAL_MESSAGES_TYPES_H_ #include "asn_constant.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "commonDef.h" /* 802.21 mappings with the RRC protocol : (Research Report RR-12-265 Mapping of IEEE 802.21 MIH primitives to EPS/LTE protocols March 13 th, 2012, Michelle WETTERWALD, Prof. Christian BONNET ) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 2810dcfdd65..84ecf56a8de 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -28,7 +28,7 @@ #ifndef RRC_MESSAGES_TYPES_H_ #define RRC_MESSAGES_TYPES_H_ - +#include "common/utils/mem/oai_memory.h" #include "as_message.h" #include "rrc_types.h" #include "s1ap_messages_types.h" @@ -43,6 +43,7 @@ #include "NR_RACH-ConfigCommon.h" #include "NR_ServingCellConfigCommon.h" #include "NR_ServingCellConfig.h" + //-------------------------------------------------------------------------------------------// // Messages for RRC logging #if defined(DISABLE_ITTI_XER_PRINT) @@ -417,7 +418,7 @@ typedef struct NRRrcConfigurationReq_s { typedef struct NRDuDlReq_s { rnti_t rnti; - mem_block_t * buf; + uint8_t *buf; uint64_t srb_id; } NRDuDlReq_t; diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index 3dd8fc8213a..7537d7c6d79 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -24,6 +24,7 @@ #include <netinet/in.h> #include <netinet/sctp.h> +#include "common/platform_types.h" #include "LTE_asn_constant.h" //-------------------------------------------------------------------------------------------// // Defines to access message fields. @@ -113,13 +114,6 @@ typedef enum cn_domain_s { CN_DOMAIN_CS = 2 } cn_domain_t; -typedef struct net_ip_address_s { - unsigned ipv4:1; - unsigned ipv6:1; - char ipv4_address[16]; - char ipv6_address[46]; -} net_ip_address_t; - typedef uint64_t bitrate_t; typedef struct ambr_s { diff --git a/openair2/ENB_APP/enb_app.h b/openair2/ENB_APP/enb_app.h index 0154b12dbc2..04f413b3c65 100644 --- a/openair2/ENB_APP/enb_app.h +++ b/openair2/ENB_APP/enb_app.h @@ -31,8 +31,7 @@ #define ENB_APP_H_ #include <stdint.h> -#include "platform_types.h" - +#include "common/platform_types.h" void *eNB_app_task(void *args_p); diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 5abb7df2c97..dc182faf4b8 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -35,7 +35,7 @@ #include <libconfig.h> #include "commonDef.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 2071234be09..13f1d8f53b6 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -343,7 +343,7 @@ #include "f1ap_default_values.h" #include "conversions.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/utils/LOG/log.h" #include "intertask_interface.h" #include "sctp_messages_types.h" diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 03c210c9728..aaa330ecb2b 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -270,8 +270,8 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id ctxt.rntiMaybeUEid = cu_ue_f1ap_id; ctxt.enb_flag = 1; ctxt.eNB_index = 0; - mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); - memcpy((void *)mb->data,(void *)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); + uint8_t *mb = malloc16(ie->value.choice.RRCContainer.size); + memcpy(mb, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); LOG_D(F1AP, "Calling pdcp_data_ind for UE RNTI %lx srb_id %lu with size %ld (DCCH) \n", ctxt.rntiMaybeUEid, srb_id, ie->value.choice.RRCContainer.size); //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) // printf("%02x ", mb->data[i]); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 1c2b727237c..8401b44ecac 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -123,7 +123,6 @@ void *F1AP_CU_task(void *arg) { int result; LOG_I(F1AP, "Starting F1AP at CU\n"); // no RLC in CU, initialize mem pool for PDCP - pool_buffer_init(); itti_mark_task_ready(TASK_CU_F1); eth_params_t *IPaddrs; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4eee1ba6b15..cc0214a47d3 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -38,6 +38,7 @@ #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include <openair3/ocp-gtpu/gtp_itf.h> +#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" bool DURecvCb(protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, @@ -51,8 +52,8 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, const uint32_t *destinationL2Id) { // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue - mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); - memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); + uint8_t *sdu = malloc16(sdu_buffer_sizeP); + memcpy(sdu, sdu_buffer_pP, sdu_buffer_sizeP); du_rlc_data_req(ctxt_pP, srb_flagP, false, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index d02b5eb4f5f..235a7582d56 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -35,7 +35,7 @@ #include <libconfig.h> #include "commonDef.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "PHY/defs_eNB.h" #include "s1ap_messages_types.h" diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index b4d1b307b29..9b965420d69 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -28,7 +28,7 @@ * @ingroup _mac */ -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "LTE_SystemInformationBlockType2.h" //#include "RadioResourceConfigCommonSIB.h" diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index 4ede02d330c..99ffd7ac073 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -31,8 +31,7 @@ */ - -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "nfapi/oai_integration/vendor_ext.h" #include "SCHED_UE/sched_UE.h" diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index dadd019241c..12984f299d9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -33,7 +33,7 @@ #include "assertions.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "LAYER2/MAC/mac.h" #include "LAYER2/MAC/mac_extern.h" diff --git a/openair2/LAYER2/MAC/proto_NB_IoT.h b/openair2/LAYER2/MAC/proto_NB_IoT.h index 913e3ebcce3..219c5e441d5 100644 --- a/openair2/LAYER2/MAC/proto_NB_IoT.h +++ b/openair2/LAYER2/MAC/proto_NB_IoT.h @@ -32,7 +32,7 @@ #include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h" #include "LAYER2/MAC/defs_NB_IoT.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "openair2/RRC/LTE/defs_NB_IoT.h" /** \addtogroup _mac * @{ diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 0e57098d7b9..f1d498e4702 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -36,7 +36,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "platform_types.h" +#include "common/platform_types.h" /* IF */ #include "NR_IF_Module.h" diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 9371c8c7df0..24819452dfc 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -39,7 +39,7 @@ #include "nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/rrc_proto.h" #include <pthread.h> - +#include "openair2/LAYER2/RLC/rlc.h" static NR_UE_MAC_INST_t *nr_ue_mac_inst; void send_srb0_rrc(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index ebcb0e601bf..7b7db63606b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -39,6 +39,7 @@ #include "LAYER2/NR_MAC_UE/mac_proto.h" #include <executables/softmodem-common.h> +#include "openair2/LAYER2/RLC/rlc.h" int16_t get_prach_tx_power(module_id_t mod_id) { diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 9710a905180..3b738eed288 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -30,7 +30,7 @@ */ -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "common/ran_context.h" #include "common/utils/nr/nr_common.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 04a374a4f63..287b7716490 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -27,7 +27,7 @@ * \version */ -#include "platform_types.h" +#include "common/platform_types.h" #include "uper_decoder.h" /* MAC */ @@ -44,6 +44,7 @@ /* rlc */ #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include "openair2/LAYER2/RLC/rlc.h" #include <executables/softmodem-common.h> extern RAN_CONTEXT_t RC; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 230ac310e56..31dfcf82b26 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -35,6 +35,7 @@ #include "NR_MAC_gNB/nr_mac_gNB.h" #include "NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "LAYER2/RLC/rlc.h" /*NFAPI*/ #include "nfapi_nr_interface.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index d59efafdc24..34b99118475 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -33,6 +33,7 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "executables/nr-softmodem.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h" +#include "LAYER2/RLC/rlc.h" #include "executables/softmodem-common.h" #include "common/utils/nr/nr_common.h" diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 448c4e94f0a..b2a935c430f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -36,6 +36,7 @@ #include <openair2/UTIL/OPT/opt.h> #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include "LAYER2/RLC/rlc.h" //#define SRS_IND_DEBUG diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h index 32759b304f1..96f3ad42d5c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h @@ -22,7 +22,7 @@ #ifndef MAC_RRC_DL_HANDLER_H #define MAC_RRC_DL_HANDLER_H -#include "platform_types.h" +#include "common/platform_types.h" #include "f1ap_messages_types.h" void f1_setup_response(const f1ap_setup_resp_t *resp); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h index 62a4ae0248d..7519691334a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h @@ -22,7 +22,7 @@ #ifndef MAC_RRC_UL_H #define MAC_RRC_UL_H -#include "platform_types.h" +#include "common/platform_types.h" #include "f1ap_messages_types.h" typedef void (*f1_setup_request_func_t)(const f1ap_setup_req_t* req); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 2dcc3e429d9..99081a5ffc4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -208,7 +208,7 @@ uint64_t get_pdcp_optmask(void) { * If PDCP_UNIT_TEST is set here then data flow between PDCP and RLC is broken * and PDCP has no longer anything to do with RLC. In this case, after it's handed * an SDU it appends PDCP header and returns (by filling in incoming pointer parameters) - * this mem_block_t to be dissected for testing purposes. For further details see test + * this uint8_t to be dissected for testing purposes. For further details see test * code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req() */ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, @@ -229,7 +229,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, uint8_t pdcp_tailer_len = 0; uint16_t pdcp_pdu_size = 0; uint16_t current_sn = 0; - mem_block_t *pdcp_pdu_p = NULL; + uint8_t *pdcp_pdu_p = NULL; rlc_op_status_t rlc_status; bool ret = true; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; @@ -288,16 +288,14 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP); - pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP, __func__); + pdcp_pdu_p = malloc16(sdu_buffer_sizeP); if (pdcp_pdu_p != NULL) { - memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP); + memcpy(pdcp_pdu_p, sdu_buffer_pP, sdu_buffer_sizeP); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { - rlc_util_print_hex_octets(PDCP, - (unsigned char *)&pdcp_pdu_p->data[0], - sdu_buffer_sizeP); - LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %ld \n", srb_flagP, rb_idP); + rlc_util_print_hex_octets(PDCP, pdcp_pdu_p, sdu_buffer_sizeP); + LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %ld \n", srb_flagP, rb_idP); } rlc_status = pdcp_params.send_rlc_data_req_func(ctxt_pP, srb_flagP, MBMS_FLAG_YES, rb_idP, muiP, @@ -326,7 +324,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, /* * Allocate a new block for the new PDU (i.e. PDU header and SDU payload) */ - pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__); + pdcp_pdu_p = malloc16(pdcp_pdu_size); if (pdcp_pdu_p != NULL) { /* @@ -339,9 +337,9 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, pdu_header.sn = pdcp_get_next_tx_seq_number(pdcp_p); current_sn = pdu_header.sn; memset(&pdu_header.mac_i[0],0,PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE); - memset(&pdcp_pdu_p->data[sdu_buffer_sizeP + pdcp_header_len],0,PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE); + memset(&pdcp_pdu_p[sdu_buffer_sizeP + pdcp_header_len], 0, PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE); - if (pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer((unsigned char *)pdcp_pdu_p->data, &pdu_header) == false) { + if (pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(pdcp_pdu_p, &pdu_header) == false) { LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p)); @@ -360,7 +358,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, pdu_header.sn = pdcp_get_next_tx_seq_number(pdcp_p); current_sn = pdu_header.sn ; - if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char *)pdcp_pdu_p->data, &pdu_header) == false) { + if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(pdcp_pdu_p, &pdu_header) == false) { LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p)); @@ -383,7 +381,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, "There must be a problem with PDCP initialization, ignoring this PDU...\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), current_sn); - free_mem_block(pdcp_pdu_p, __func__); + free(pdcp_pdu_p); if (ctxt_pP->enb_flag == ENB_FLAG_YES) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); @@ -397,13 +395,13 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, LOG_D(PDCP, "Sequence number %d is assigned to current PDU\n", current_sn); /* Then append data... */ - memcpy(&pdcp_pdu_p->data[pdcp_header_len], sdu_buffer_pP, sdu_buffer_sizeP); + memcpy(&pdcp_pdu_p[pdcp_header_len], sdu_buffer_pP, sdu_buffer_sizeP); //For control plane data that are not integrity protected, // the MAC-I field is still present and should be padded with padding bits set to 0. // NOTE: user-plane data are never integrity protected for (i=0; i<pdcp_tailer_len; i++) { - pdcp_pdu_p->data[pdcp_header_len + sdu_buffer_sizeP + i] = 0x00;// pdu_header.mac_i[i]; + pdcp_pdu_p[pdcp_header_len + sdu_buffer_sizeP + i] = 0x00; // pdu_header.mac_i[i]; } if ((pdcp_p->security_activated != 0) && @@ -421,7 +419,7 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, rb_idP % LTE_maxDRB, pdcp_header_len, current_sn, - pdcp_pdu_p->data, + pdcp_pdu_p, sdu_buffer_sizeP); if (ctxt_pP->enb_flag == ENB_FLAG_NO) { @@ -434,8 +432,8 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, /* Print octets of outgoing data in hexadecimal form */ LOG_D(PDCP, "Following content with size %d will be sent over RLC (PDCP PDU header is the first two bytes)\n", pdcp_pdu_size); - //util_print_hex_octets(PDCP, (unsigned char*)pdcp_pdu_p->data, pdcp_pdu_size); - //util_flush_hex_octets(PDCP, (unsigned char*)pdcp_pdu->data, pdcp_pdu_size); + // util_print_hex_octets(PDCP, (unsigned char*)pdcp_pdu_p, pdcp_pdu_size); + // util_flush_hex_octets(PDCP, (unsigned char*)pdcp_pdu, pdcp_pdu_size); } else { LOG_E(PDCP, "Cannot create a mem_block for a PDU!\n"); @@ -458,8 +456,13 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, * Ask sublayer to transmit data and check return value * to see if RLC succeeded */ - LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size, - "[MSG] PDCP DL %s PDU on rb_id %ld\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP); + LOG_DUMPMSG(PDCP, + DEBUG_PDCP, + (char *)pdcp_pdu_p, + pdcp_pdu_size, + "[MSG] PDCP DL %s PDU on rb_id %ld\n", + (srb_flagP) ? "CONTROL" : "DATA", + rb_idP); if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) { LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %lx\n", rb_idP, pdcp_pdu_size, ctxt_pP->rntiMaybeUEid); @@ -563,17 +566,14 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, //----------------------------------------------------------------------------- -bool -pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const sdu_size_t sdu_buffer_sizeP, - mem_block_t *const sdu_buffer_pP, - const uint32_t *const srcID, - const uint32_t *const dstID -) +bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const sdu_size_t sdu_buffer_sizeP, + uint8_t *const sdu_buffer_pP, + const uint32_t *const srcID, + const uint32_t *const dstID) //----------------------------------------------------------------------------- { pdcp_t *pdcp_p = NULL; @@ -593,8 +593,13 @@ pdcp_data_ind( int pdcp_sn_for_count; int security_ok; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN); - LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP, - "[MSG] PDCP UL %s PDU on rb_id %ld\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP); + LOG_DUMPMSG(PDCP, + DEBUG_PDCP, + (char *)sdu_buffer_pP, + sdu_buffer_sizeP, + "[MSG] PDCP UL %s PDU on rb_id %ld\n", + (srb_flagP) ? "CONTROL" : "DATA", + rb_idP); if (MBMS_flagP) { AssertError(rb_idP < NB_RB_MBMS_MAX, return false, "RB id is too high (%ld/%d) %u rnti %lx!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid); @@ -630,7 +635,7 @@ pdcp_data_ind( PROTOCOL_CTXT_FMT"Could not get PDCP instance key 0x%"PRIx64"\n", PROTOCOL_CTXT_ARGS(ctxt_pP), key); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); return false; } @@ -657,16 +662,16 @@ pdcp_data_ind( if (srb_flagP) { //SRB1/2 pdcp_header_len = PDCP_CONTROL_PLANE_DATA_PDU_SN_SIZE; pdcp_tailer_len = PDCP_CONTROL_PLANE_DATA_PDU_MAC_I_SIZE; - sequence_number = pdcp_get_sequence_number_of_pdu_with_SRB_sn((unsigned char *)sdu_buffer_pP->data); + sequence_number = pdcp_get_sequence_number_of_pdu_with_SRB_sn((unsigned char *)sdu_buffer_pP); } else { // DRB pdcp_tailer_len = 0; if (pdcp_p->seq_num_size == 7) { pdcp_header_len = PDCP_USER_PLANE_DATA_PDU_SHORT_SN_HEADER_SIZE; - sequence_number = pdcp_get_sequence_number_of_pdu_with_short_sn((unsigned char *)sdu_buffer_pP->data); + sequence_number = pdcp_get_sequence_number_of_pdu_with_short_sn((unsigned char *)sdu_buffer_pP); } else if (pdcp_p->seq_num_size == 12) { pdcp_header_len = PDCP_USER_PLANE_DATA_PDU_LONG_SN_HEADER_SIZE; - sequence_number = pdcp_get_sequence_number_of_pdu_with_long_sn((unsigned char *)sdu_buffer_pP->data); + sequence_number = pdcp_get_sequence_number_of_pdu_with_long_sn((unsigned char *)sdu_buffer_pP); } else { //sequence_number = 4095; LOG_E(PDCP, @@ -686,7 +691,7 @@ pdcp_data_ind( PROTOCOL_PDCP_CTXT_FMT"Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), sdu_buffer_sizeP); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); if (ctxt_pP->enb_flag) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); @@ -718,7 +723,7 @@ pdcp_data_ind( * mechanism all out-of-order packets will be delivered to RRC/IP */ LOG_W(PDCP, "Ignoring PDU...\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); return false; } @@ -749,8 +754,9 @@ pdcp_data_ind( pdcp_header_len, rx_hfn_for_count, pdcp_sn_for_count, - sdu_buffer_pP->data, - sdu_buffer_sizeP - pdcp_tailer_len) == 0; + sdu_buffer_pP, + sdu_buffer_sizeP - pdcp_tailer_len) + == 0; if (ctxt_pP->enb_flag == ENB_FLAG_NO) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security); @@ -766,7 +772,7 @@ pdcp_data_ind( PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDCP SRB PDU\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); LOG_W(PDCP, "Ignoring PDU...\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); /* TODO: indicate integrity verification failure to upper layer */ return false; } @@ -784,10 +790,9 @@ pdcp_data_ind( rrc_data_ind(ctxt_pP, rb_id, sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len, - (uint8_t *)&sdu_buffer_pP->data[pdcp_header_len]); - free_mem_block(sdu_buffer_pP, __func__); + (uint8_t *)&sdu_buffer_pP[pdcp_header_len]); + free(sdu_buffer_pP); - // free_mem_block(new_sdu, __func__); if (ctxt_pP->enb_flag) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); } else { @@ -821,7 +826,7 @@ pdcp_data_ind( PROTOCOL_PDCP_CTXT_FMT"discard PDU, out of\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); LOG_W(PDCP, "Ignoring PDU...\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); /* TODO: indicate integrity verification failure to upper layer */ return false; } else if (pdcp_p->next_pdcp_rx_sn - sequence_number > reordering_window) { @@ -860,8 +865,9 @@ pdcp_data_ind( pdcp_header_len, rx_hfn_for_count, pdcp_sn_for_count, - sdu_buffer_pP->data, - sdu_buffer_sizeP - pdcp_tailer_len) == 0; + sdu_buffer_pP, + sdu_buffer_sizeP - pdcp_tailer_len) + == 0; if (ctxt_pP->enb_flag == ENB_FLAG_NO) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security); @@ -877,7 +883,7 @@ pdcp_data_ind( PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/AM PDU\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); LOG_W(PDCP, "Ignoring PDU...\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); /* TODO: indicate integrity verification failure to upper layer */ return false; } @@ -927,8 +933,9 @@ pdcp_data_ind( pdcp_header_len, rx_hfn_for_count, pdcp_sn_for_count, - sdu_buffer_pP->data, - sdu_buffer_sizeP - pdcp_tailer_len) == 0; + sdu_buffer_pP, + sdu_buffer_sizeP - pdcp_tailer_len) + == 0; if (ctxt_pP->enb_flag == ENB_FLAG_NO) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].validate_security); @@ -944,7 +951,7 @@ pdcp_data_ind( PROTOCOL_PDCP_CTXT_FMT"security not validated for incoming PDPC DRB RLC/UM PDU\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); LOG_W(PDCP, "Ignoring PDU...\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); /* TODO: indicate integrity verification failure to upper layer */ return false; } @@ -961,7 +968,7 @@ pdcp_data_ind( if (otg_enabled==1) { LOG_D(OTG,"Discarding received packed\n"); - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); if (ctxt_pP->enb_flag) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); @@ -990,7 +997,7 @@ pdcp_data_ind( AssertFatal(message_p != NULL, "OUT OF MEMORY"); gtpv1u_tunnel_data_req_t *req=>PV1U_TUNNEL_DATA_REQ(message_p); req->buffer = (uint8_t*)(req+1); - memcpy(req->buffer + GTPU_HEADER_OVERHEAD_MAX, sdu_buffer_pP->data + payload_offset, sdu_buffer_sizeP - payload_offset); + memcpy(req->buffer + GTPU_HEADER_OVERHEAD_MAX, sdu_buffer_pP + payload_offset, sdu_buffer_sizeP - payload_offset); req->length = sdu_buffer_sizeP - payload_offset; req->offset = GTPU_HEADER_OVERHEAD_MAX; req->ue_id = ctxt_pP->rntiMaybeUEid; @@ -1005,16 +1012,16 @@ pdcp_data_ind( #ifdef MBMS_MULTICAST_OUT if ((MBMS_flagP != 0) && (mbms_socket != -1)) { - // struct iphdr *ip_header = (struct iphdr *)&sdu_buffer_pP->data[payload_offset]; - // struct udphdr *udp_header = (struct udphdr *)&sdu_buffer_pP->data[payload_offset + sizeof(struct iphdr)]; - // struct sockaddr_in dest_addr; - // dest_addr.sin_family = AF_INET; - // dest_addr.sin_port = udp_header->dest; - // dest_addr.sin_addr.s_addr = ip_header->daddr; - - // sendto(mbms_socket, &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset, MSG_DONTWAIT, (struct sockaddr*)&dest_addr, sizeof(dest_addr)); - // //packet_forwarded = true; - + // struct iphdr *ip_header = (struct iphdr *)&sdu_buffer_pP[payload_offset]; + // struct udphdr *udp_header = (struct udphdr *)&sdu_buffer_pP[payload_offset + sizeof(struct iphdr)]; + // struct sockaddr_in dest_addr; + // dest_addr.sin_family = AF_INET; + // dest_addr.sin_port = udp_header->dest; + // dest_addr.sin_addr.s_addr = ip_header->daddr; + + // sendto(mbms_socket, &sdu_buffer_pP[payload_offset], sdu_buffer_sizeP - payload_offset, MSG_DONTWAIT, (struct + // sockaddr*)&dest_addr, sizeof(dest_addr)); + // //packet_forwarded = true; } #endif @@ -1035,7 +1042,7 @@ pdcp_data_ind( AssertFatal((sdu_buffer_sizeP - payload_offset >= 0), "invalid PDCP SDU size!"); // Here there is no virtualization possible - // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here + // set ((pdcp_data_ind_header_t *) new_sdu_p)->inst for IP layer here if (ctxt_pP->enb_flag == ENB_FLAG_NO) { pdcpHead->rb_id = rb_id; @@ -1071,9 +1078,7 @@ pdcp_data_ind( LOG_D(PDCP, "inst=%d size=%d\n", pdcpHead->inst, pdcpHead->data_size); } - memcpy(pdcpHead+1, - &sdu_buffer_pP->data[payload_offset], - sdu_buffer_sizeP - payload_offset); + memcpy(pdcpHead + 1, &sdu_buffer_pP[payload_offset], sdu_buffer_sizeP - payload_offset); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) log_dump(PDCP, pdcpHead+1, min(sdu_buffer_sizeP - payload_offset,30) , LOG_DUMP_CHAR, "Printing first bytes of PDCP SDU before adding it to the list: \n"); @@ -1083,8 +1088,8 @@ pdcp_data_ind( LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n", sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t), sdu_buffer_sizeP - payload_offset); - //util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); - //util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); + // util_print_hex_octets(PDCP, &new_sdu_p[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); + // util_flush_hex_octets(PDCP, &new_sdu_p[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset); } /* Update PDCP statistics */ @@ -1103,7 +1108,7 @@ pdcp_data_ind( Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]); Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn; - free_mem_block(sdu_buffer_pP, __func__); + free(sdu_buffer_pP); if (ctxt_pP->enb_flag) { stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 35bcd063089..6b0e2499fe4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -37,7 +37,7 @@ //----------------------------------------------------------------------------- #include "RRC/LTE/rrc_defs.h" #include "common/platform_constants.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "LTE_DRB-ToAddMod.h" #include "LTE_DRB-ToAddModList.h" #include "LTE_SRB-ToAddMod.h" @@ -47,14 +47,25 @@ #include "openair3/SECU/secu_defs.h" -typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const, - const srb_flag_t, const MBMS_flag_t, - const rb_id_t, const mui_t, - confirm_t, sdu_size_t, mem_block_t *,const uint32_t *const, const uint32_t *const); - -typedef bool (pdcp_data_ind_t)( const protocol_ctxt_t *, const srb_flag_t, - const MBMS_flag_t, const rb_id_t, const sdu_size_t, - mem_block_t *,const uint32_t *const, const uint32_t *const); +typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const, + const srb_flag_t, + const MBMS_flag_t, + const rb_id_t, + const mui_t, + confirm_t, + sdu_size_t, + uint8_t *, + const uint32_t *const, + const uint32_t *const); + +typedef bool(pdcp_data_ind_t)(const protocol_ctxt_t *, + const srb_flag_t, + const MBMS_flag_t, + const rb_id_t, + const sdu_size_t, + uint8_t *, + const uint32_t *const, + const uint32_t *const); typedef pdcp_data_ind_t* pdcp_data_ind_func_t; #define MAX_NUMBER_NETIF 1 //16 @@ -265,19 +276,19 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, const uint32_t *const sourceL2Id, const uint32_t *const destinationL2Id); -/*! \fn bool pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, bool) -* \brief This functions handles data transfer indications coming from RLC -* \param[in] ctxt_pP Running context. -* \param[in] Shows if rb is SRB -* \param[in] Tells if MBMS traffic -* \param[in] rab_id Radio Bearer ID -* \param[in] sdu_buffer_size Size of incoming SDU in bytes -* \param[in] sdu_buffer Buffer carrying SDU -* \param[in] is_data_plane flag to indicate whether the userplane data belong to the control plane or data plane -* \return TRUE on success, false otherwise -* \note None -* @ingroup _pdcp -*/ +/*! \fn bool pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, uint8_t*, bool) + * \brief This functions handles data transfer indications coming from RLC + * \param[in] ctxt_pP Running context. + * \param[in] Shows if rb is SRB + * \param[in] Tells if MBMS traffic + * \param[in] rab_id Radio Bearer ID + * \param[in] sdu_buffer_size Size of incoming SDU in bytes + * \param[in] sdu_buffer Buffer carrying SDU + * \param[in] is_data_plane flag to indicate whether the userplane data belong to the control plane or data plane + * \return TRUE on success, false otherwise + * \note None + * @ingroup _pdcp + */ pdcp_data_ind_t pdcp_data_ind; /*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c index c1ba2481783..c27eef4e674 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c @@ -27,7 +27,7 @@ */ #include "common/utils/LOG/log.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "pdcp.h" #include "pdcp_primitives.h" diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h index 89b8ff672f7..64fa3041655 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.h @@ -29,7 +29,7 @@ #define PDCP_UTIL_H #include "common/utils/LOG/log.h" -#include "../../COMMON/platform_types.h" +#include "common/platform_types.h" #include "pdcp.h" /* diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index f61f9ca6c78..39471ebbee6 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -35,12 +35,12 @@ #ifndef __RLC_H__ # define __RLC_H__ -# include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" # include "hashtable.h" # include "LTE_asn_constant.h" # include "common/utils/LOG/log.h" -# include "mem_block.h" +#include "intertask_interface.h" //# include "PHY/defs.h" # include "LTE_RLC-Config.h" # include "LTE_DRB-ToAddMod.h" @@ -71,26 +71,6 @@ typedef enum rlc_confirm_e { RLC_SDU_CONFIRM_YES = 1, } rlc_confirm_t; -typedef enum rlc_mode_e { - RLC_MODE_NONE = 0, - RLC_MODE_AM = 1, - RLC_MODE_UM = 2, - RLC_MODE_TM = 4 -} rlc_mode_t; - -/*! \struct mac_rlc_status_resp_t -* \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance. -*/ -typedef struct { - rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */ - rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */ - frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */ - sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */ - bool head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */ -} mac_rlc_status_resp_t; - - - //----------------------------------------------------------------------------- // PRIVATE INTERNALS OF RLC //----------------------------------------------------------------------------- @@ -284,39 +264,35 @@ void rlc_util_print_hex_octets( * \param[in] muiP Message Unit identifier. * \param[in] confirmP Boolean, is confirmation requested. * \param[in] sdu_sizeP Size of SDU in bytes. -* \param[in] sduP SDU. -* \return A status about the processing, OK or error code. -*/ -rlc_op_status_t rlc_data_req ( - const protocol_ctxt_t *const, - const srb_flag_t, - const MBMS_flag_t, - const rb_id_t, - const mui_t, - const confirm_t, - const sdu_size_t, - mem_block_t *const, - const uint32_t *const, - const uint32_t *const -); + * \param[in] sduP SDU. + * \return A status about the processing, OK or error code. + */ +rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const, + const srb_flag_t, + const MBMS_flag_t, + const rb_id_t, + const mui_t, + const confirm_t, + const sdu_size_t, + uint8_t *const, + const uint32_t *const, + const uint32_t *const); /*! \fn void rlc_data_ind (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, mem_block_t* sduP) { * \brief Interface with higher layers, route SDUs coming from RLC protocol instances to upper layer instance. * \param[in] ctxtP Running context. * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] MBMS_flagP Flag to indicate whether this is the MBMS service (1) or not (0) -* \param[in] rb_idP Radio bearer identifier. -* \param[in] sdu_sizeP Size of SDU in bytes. -* \param[in] sduP SDU. -*/ -void rlc_data_ind( - const protocol_ctxt_t *const, - const srb_flag_t, - const MBMS_flag_t, - const rb_id_t, - const sdu_size_t, - mem_block_t *const); - + * \param[in] rb_idP Radio bearer identifier. + * \param[in] sdu_sizeP Size of SDU in bytes. + * \param[in] sduP SDU. + */ +void rlc_data_ind(const protocol_ctxt_t *const, + const srb_flag_t, + const MBMS_flag_t, + const rb_id_t, + const sdu_size_t, + uint8_t *const); /*! \fn void rlc_data_conf (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const mui_t muiP, const rlc_tx_status_t statusP) * \brief Interface with higher layers, confirm to upper layer the transmission status for a SDU stamped with a MUI, scheduled for transmission. @@ -435,18 +411,9 @@ rlc_op_status_t rlc_stat_req ( unsigned int *const stat_timer_status_prohibit_timed_out); /*! \fn int rlc_module_init(int enb_flag) -* \brief RAZ the memory of the RLC layer, initialize the memory pool manager (mem_block_t structures mainly used in RLC module). -*/ + * \brief RAZ the memory of the RLC layer, initialize the memory pool manager (uint8_t structures mainly used in RLC module). + */ int rlc_module_init(int enb_flag); - -void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP); /** @} */ #define RLC_FG_COLOR_BLACK "\e[0;30m" diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c index 412a974406f..e90a5a4309a 100644 --- a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -23,7 +23,7 @@ #include "NR_DRB-ToAddModList.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "intertask_interface.h" #include "openair2/COMMON/e1ap_messages_types.h" #include "openair3/ocp-gtpu/gtp_itf.h" diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp.h b/openair2/LAYER2/nr_pdcp/nr_pdcp.h index 4a8966e1002..183a982ed7e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp.h @@ -20,7 +20,7 @@ */ #include <stdint.h> -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" #ifndef _NR_PDCP_H_ #define _NR_PDCP_H_ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 1657f3c4bb7..8d342a8206a 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -24,7 +24,7 @@ #include <stdbool.h> #include <stdint.h> -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" #include "nr_pdcp_sdu.h" #include "openair2/RRC/NR/rrc_gNB_radio_bearers.h" diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 96444e5b105..6efdf00d993 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -30,6 +30,7 @@ #include "NR_RLC-Config.h" #include "NR_CellGroupConfig.h" #include "openair2/RRC/NR/nr_rrc_proto.h" +#include "common/utils/mem/oai_memory.h" #include <stdint.h> /* from OAI */ @@ -111,7 +112,7 @@ typedef struct { mui_t muiP; confirm_t confirmP; sdu_size_t sdu_sizeP; - mem_block_t *sdu_pP; + uint8_t *sdu_pP; } rlc_data_req_queue_item; #define RLC_DATA_REQ_QUEUE_SIZE 10000 @@ -173,13 +174,13 @@ static void init_nr_rlc_data_req_queue(void) } static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP) + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { int i; int logged = 0; @@ -210,13 +211,13 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, } void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP) + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { enqueue_rlc_data_req(ctxt_pP, srb_flagP, @@ -241,7 +242,7 @@ typedef struct { MBMS_flag_t MBMS_flagP; rb_id_t rb_id; sdu_size_t sdu_buffer_size; - mem_block_t *sdu_buffer; + uint8_t *sdu_buffer; } pdcp_data_ind_queue_item; #define PDCP_DATA_IND_QUEUE_SIZE 10000 @@ -256,13 +257,12 @@ typedef struct { static pdcp_data_ind_queue pq; -static void do_pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_id, - const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer) +static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_id, + const sdu_size_t sdu_buffer_size, + uint8_t *const sdu_buffer) { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; @@ -285,14 +285,14 @@ static void do_pdcp_data_ind( rb = nr_pdcp_get_rb(ue, rb_id, srb_flagP); if (rb != NULL) { - rb->recv_pdu(rb, (char *)sdu_buffer->data, sdu_buffer_size); + rb->recv_pdu(rb, (char *)sdu_buffer, sdu_buffer_size); } else { LOG_E(PDCP, "pdcp_data_ind: no RB found (rb_id %ld, srb_flag %d)\n", rb_id, srb_flagP); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); - free_mem_block(sdu_buffer, __FUNCTION__); + free(sdu_buffer); } static void *pdcp_data_ind_thread(void *_) @@ -337,13 +337,12 @@ static void init_nr_pdcp_data_ind_queue(void) } } -static void enqueue_pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_id, - const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer) +static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_id, + const sdu_size_t sdu_buffer_size, + uint8_t *const sdu_buffer) { int i; int logged = 0; @@ -371,12 +370,12 @@ static void enqueue_pdcp_data_ind( if (pthread_mutex_unlock(&pq.m) != 0) abort(); } -bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, +bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer, + uint8_t *const sdu_buffer, const uint32_t *const srcID, const uint32_t *const dstID) { @@ -670,8 +669,8 @@ static void deliver_pdu_drb_ue(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, DevAssert(deliver_pdu_data == NULL); protocol_ctxt_t ctxt = { .enb_flag = 0, .rntiMaybeUEid = ue_id }; - mem_block_t *memblock = get_free_mem_block(size, __FUNCTION__); - memcpy(memblock->data, buf, size); + uint8_t *memblock = malloc16(size); + memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d UE %ld/%04lx\n", __func__, rb_id, size, ctxt.rntiMaybeUEid, ctxt.rntiMaybeUEid); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); } @@ -702,8 +701,8 @@ static void deliver_pdu_drb_gnb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id extern instance_t CUuniqInstance; itti_send_msg_to_task(TASK_GTPV1_U, CUuniqInstance, message_p); } else { - mem_block_t *memblock = get_free_mem_block(size, __FUNCTION__); - memcpy(memblock->data, buf, size); + uint8_t *memblock = malloc16(size); + memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); } @@ -760,8 +759,8 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, char *buf, int size, int sdu_id) { protocol_ctxt_t ctxt = { .enb_flag = 1, .rntiMaybeUEid = ue_id }; - mem_block_t *memblock = get_free_mem_block(size, __FUNCTION__); - memcpy(memblock->data, buf, size); + uint8_t *memblock = malloc16(size); + memcpy(memblock, buf, size); enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock); } @@ -1246,12 +1245,12 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, const uint32_t *const destinationL2Id) { //Force instance id to 0, OAI incoherent instance management ctxt_pP->instance=0; - mem_block_t *memblock = get_free_mem_block(sdu_buffer_size, __func__); + uint8_t *memblock = malloc16(sdu_buffer_size); if (memblock == NULL) { - LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(RLC, "%s:%d:%s: ERROR: malloc16 failed\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - memcpy(memblock->data,sdu_buffer, sdu_buffer_size); + memcpy(memblock, sdu_buffer, sdu_buffer_size); int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index ea88fbfb184..61d14031048 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -29,20 +29,20 @@ void nr_pdcp_layer_init(bool uses_e1); uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id); void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP); - -bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP); + +bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer, + uint8_t *const sdu_buffer, const uint32_t *const srcID, const uint32_t *const dstID); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index 0d26e1f3ec3..dc6adc5e9fa 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -24,7 +24,7 @@ #include "nr_pdcp_entity.h" -#include "platform_types.h" +#include "common/platform_types.h" typedef void nr_pdcp_ue_manager_t; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 383ae37d35a..6b4eecf46e2 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -293,7 +293,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module return ret; } - rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, @@ -301,7 +300,7 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, + uint8_t *sdu_pP, const uint32_t *const sourceL2Id, const uint32_t *const destinationL2Id) { @@ -331,14 +330,14 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, if (rb != NULL) { rb->set_time(rb, nr_rlc_current_time); - rb->recv_sdu(rb, (char *)sdu_pP->data, sdu_sizeP, muiP); + rb->recv_sdu(rb, (char *)sdu_pP, sdu_sizeP, muiP); } else { LOG_E(RLC, "%s:%d:%s: fatal: SDU sent to unknown RB\n", __FILE__, __LINE__, __FUNCTION__); } nr_rlc_manager_unlock(nr_rlc_ue_manager); - free_mem_block(sdu_pP, __func__); + free(sdu_pP); return RLC_OP_STATUS_OK; } @@ -402,7 +401,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) int is_srb; int rb_id; protocol_ctxt_t ctx; - mem_block_t *memblock; + uint8_t *memblock; int i; int is_enb; @@ -500,12 +499,12 @@ rb_found: } /* UE or monolithic gNB */ - memblock = get_free_mem_block(size, __func__); + memblock = malloc16(size); if (memblock == NULL) { - LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(RLC, "%s:%d:%s: ERROR: malloc16 failed\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - memcpy(memblock->data, buf, size); + memcpy(memblock, buf, size); LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index ed29c5458b5..aa499cfab62 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -21,7 +21,7 @@ #ifndef _NR_RLC_UE_MANAGER_H_ #define _NR_RLC_UE_MANAGER_H_ -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" #include "nr_rlc_entity.h" #include "common/platform_constants.h" diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 3e191595dd1..d9798f6138a 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -265,18 +265,16 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } - -rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id - ) +rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id) { int rnti = ctxt_pP->rntiMaybeUEid; rlc_ue_t *ue; @@ -312,7 +310,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, if (rb != NULL) { rb->set_time(rb, rlc_current_time); - rb->recv_sdu(rb, (char *)sdu_pP->data, sdu_sizeP, muiP); + rb->recv_sdu(rb, (char *)sdu_pP, sdu_sizeP, muiP); } else { LOG_E(RLC, "%s:%d:%s: fatal: SDU sent to unknown RB\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -320,7 +318,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, rlc_manager_unlock(rlc_ue_manager); - free_mem_block(sdu_pP, __func__); + free(sdu_pP); return RLC_OP_STATUS_OK; } @@ -359,7 +357,7 @@ static void deliver_sdu(void *_ue, rlc_entity_t *entity, char *buf, int size) int is_srb; int rb_id; protocol_ctxt_t ctx; - mem_block_t *memblock; + uint8_t *memblock; int i; int is_enb; int is_mbms; @@ -413,13 +411,13 @@ rb_found: T_INT(0 /*ctxt_pP->module_id*/), T_INT(ue->rnti), T_INT(rb_id), T_INT(size)); } - - memblock = get_free_mem_block(size, __func__); + + memblock = malloc16(size); if (memblock == NULL) { - LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(RLC, "%s:%d:%s: ERROR: malloc16 failed\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - memcpy(memblock->data, buf, size); + memcpy(memblock, buf, size); if (!get_pdcp_data_ind_func()(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %d)\n", __FILE__, __LINE__, __FUNCTION__, @@ -1010,24 +1008,6 @@ void rlc_tick(int frame, int subframe) } } -void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP){ - rlc_data_req (ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - muiP, - confirmP, - sdu_sizeP, - sdu_pP, NULL, NULL); -} - /* HACK to be removed: nr_rlc_get_available_tx_space is needed by * openair3/ocp-gtpu/gtp_itf.cpp which is compiled in lte-softmodem * so let's put a dummy nr_rlc_get_available_tx_space here diff --git a/openair2/M2AP/m2ap_timers.h b/openair2/M2AP/m2ap_timers.h index d2875d92af6..b41ba35f3b2 100644 --- a/openair2/M2AP/m2ap_timers.h +++ b/openair2/M2AP/m2ap_timers.h @@ -23,7 +23,7 @@ #define M2AP_TIMERS_H_ #include <stdint.h> -#include "platform_types.h" +#include "common/platform_types.h" typedef struct { /* incremented every TTI (every millisecond when in realtime). diff --git a/openair2/MCE_APP/mce_app.h b/openair2/MCE_APP/mce_app.h index fc55c10f1c6..0f4be6ccd84 100644 --- a/openair2/MCE_APP/mce_app.h +++ b/openair2/MCE_APP/mce_app.h @@ -31,8 +31,7 @@ #define MCE_APP_H_ #include <stdint.h> -#include "platform_types.h" - +#include "common/platform_types.h" void *MCE_app_task(void *args_p); diff --git a/openair2/MCE_APP/mce_config.h b/openair2/MCE_APP/mce_config.h index 1fbe81a6271..01a19b3a5c2 100644 --- a/openair2/MCE_APP/mce_config.h +++ b/openair2/MCE_APP/mce_config.h @@ -35,7 +35,7 @@ #include <libconfig.h> #include "commonDef.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "PHY/impl_defs_top.h" #include "PHY/defs_eNB.h" diff --git a/openair2/NETWORK_DRIVER/LITE/local.h b/openair2/NETWORK_DRIVER/LITE/local.h index ea82dd9b858..4ceae1b9297 100644 --- a/openair2/NETWORK_DRIVER/LITE/local.h +++ b/openair2/NETWORK_DRIVER/LITE/local.h @@ -56,7 +56,7 @@ #define IP2PDCP_FIFO 22 #include "constant.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "sap.h" struct cx_entity { diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h index aa55c076125..ef4cfde8acc 100644 --- a/openair2/NETWORK_DRIVER/MESH/local.h +++ b/openair2/NETWORK_DRIVER/MESH/local.h @@ -62,7 +62,7 @@ #include "constant.h" #include "sap.h" #include "rrc_nas_primitives.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" struct rb_entity { nasRadioBearerId_t rab_id; diff --git a/openair2/NETWORK_DRIVER/UE_IP/local.h b/openair2/NETWORK_DRIVER/UE_IP/local.h index 46e44f00408..8a89d7a9def 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/local.h +++ b/openair2/NETWORK_DRIVER/UE_IP/local.h @@ -52,7 +52,7 @@ #include <net/ndisc.h> #include "constant.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "sap.h" typedef struct ue_ip_priv_s { diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h index f85d44398fa..dd4e7e970b8 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h @@ -38,7 +38,7 @@ #include "nfapi_nr_interface.h" #include "nfapi_nr_interface_scf.h" #include "common/platform_constants.h" -#include "platform_types.h" +#include "common/platform_types.h" #define MAX_NUM_DL_PDU 100 #define MAX_NUM_UL_PDU 100 diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 3560fc49eea..5be2d3c03cd 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -33,7 +33,7 @@ #ifndef __NR_IF_MODULE_H__ #define __NR_IF_MODULE_H__ -#include "platform_types.h" +#include "common/platform_types.h" #include <semaphore.h> #include "fapi_nr_ue_interface.h" #include "openair2/PHY_INTERFACE/queue_t.h" diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h b/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h index cff783739e2..c395ff95e78 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_Packet_Drop.h @@ -21,7 +21,7 @@ #ifndef __NR_CHAN_MODEL_H__ #define __NR_CHAN_MODEL_H__ -#include <platform_types.h> +#include "common/platform_types.h" #include <nfapi_nr_interface_scf.h> #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h index f306903f5fa..3fe38a27314 100644 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -36,11 +36,10 @@ #include <sched.h> //#include "openair1/PHY/LTE_TRANSPORT/transport_eNB.h" #include "nfapi_interface.h" -#include "platform_types.h" +#include "common/platform_types.h" #include <common/utils/threadPool/thread-pool.h> #include <radio/COMMON/common_lib.h> - #define MAX_NUM_DL_PDU 100 #define MAX_NUM_UL_PDU 100 #define MAX_NUM_HI_DCI0_PDU 100 @@ -53,37 +52,37 @@ #define MAX_NUM_RACH_IND 100 #define MAX_NUM_SRS_IND 100 -typedef struct { - /// Module ID - module_id_t module_id; - /// CC ID - int CC_id; - /// frame - frame_t frame; - /// subframe - sub_frame_t subframe; - - /// harq indication list - nfapi_harq_indication_t harq_ind; - - /// crc indication list - nfapi_crc_indication_t crc_ind; - - /// SR indication list - nfapi_sr_indication_t sr_ind; - - /// CQI indication list - nfapi_cqi_indication_t cqi_ind; - - /// RACH indication list - nfapi_rach_indication_t rach_ind; - /// RACH indication list for BR UEs - nfapi_rach_indication_t rach_ind_br; - /// SRS indication list - nfapi_srs_indication_body_t srs_ind; - - /// RX indication - nfapi_rx_indication_t rx_ind; + typedef struct { + /// Module ID + module_id_t module_id; + /// CC ID + int CC_id; + /// frame + frame_t frame; + /// subframe + sub_frame_t subframe; + + /// harq indication list + nfapi_harq_indication_t harq_ind; + + /// crc indication list + nfapi_crc_indication_t crc_ind; + + /// SR indication list + nfapi_sr_indication_t sr_ind; + + /// CQI indication list + nfapi_cqi_indication_t cqi_ind; + + /// RACH indication list + nfapi_rach_indication_t rach_ind; + /// RACH indication list for BR UEs + nfapi_rach_indication_t rach_ind_br; + /// SRS indication list + nfapi_srs_indication_body_t srs_ind; + + /// RX indication + nfapi_rx_indication_t rx_ind; } UL_IND_t; diff --git a/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h index 954eaaa2813..8aec51d85d5 100644 --- a/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h +++ b/openair2/PHY_INTERFACE/IF_Module_NB_IoT.h @@ -12,7 +12,7 @@ //#include "openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h" #include "LTE_PhysicalConfigDedicated-NB-r13.h" //#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" //#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h" //#define SCH_PAYLOAD_SIZE_MAX 4096 diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index 82108118620..3ed4428db6a 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -31,7 +31,7 @@ #define __OPENAIR_RRC_L2_INTERFACE_H__ #include "COMMON/mac_rrc_primitives.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" int8_t mac_rrc_data_req( diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index bc333bdcd69..f8c30698b1e 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -36,7 +36,7 @@ * \email: javier.morgade@ieee.org */ -#include "platform_types.h" +#include "common/platform_types.h" #include "rrc_defs.h" #include "rrc_extern.h" #include "common/utils/LOG/log.h" diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index 86fccddcf6b..e84b015b67d 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -28,7 +28,7 @@ * \email: raymond.knopp@eurecom.fr */ -#include "platform_types.h" +#include "common/platform_types.h" #include "rrc_defs.h" #include "rrc_extern.h" #include "common/utils/LOG/log.h" diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index d1128c66ee7..91fade8b500 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -36,7 +36,7 @@ * \email: javier.morgade@ieee.org */ -#include "platform_types.h" +#include "common/platform_types.h" #include "rrc_defs.h" #include "rrc_extern.h" #include "common/utils/LOG/log.h" diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h index 656f5334a69..fe9dca84a97 100644 --- a/openair2/RRC/LTE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -41,7 +41,7 @@ #include "collection/tree.h" #include "rrc_types_NB_IoT.h" #include "common/platform_constants.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/openairinterface5g_limits.h" #include "COMMON/mac_rrc_primitives.h" diff --git a/openair2/RRC/LTE/rrc_common.c b/openair2/RRC/LTE/rrc_common.c index 7654b56922d..230e0d409b0 100644 --- a/openair2/RRC/LTE/rrc_common.c +++ b/openair2/RRC/LTE/rrc_common.c @@ -32,7 +32,7 @@ #include "rrc_extern.h" #include "LAYER2/MAC/mac_extern.h" #include "COMMON/openair_defs.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "LAYER2/RLC/rlc.h" #include "COMMON/mac_rrc_primitives.h" diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 35303cd4f8d..3191c487c24 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -45,7 +45,7 @@ #include "NR_UE-NR-Capability.h" #include "common/platform_constants.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "LAYER2/MAC/mac.h" #include "openair2/RRC/common.h" diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 15b4914a65e..a5ad82b61ec 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -55,7 +55,7 @@ #include "LTE_HandoverCommand.h" #include "rlc.h" #include "rrc_eNB_UE_context.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "LTE_SL-CommConfig-r12.h" #include "LTE_PeriodicBSR-Timer-r12.h" #include "LTE_RetxBSR-Timer-r12.h" diff --git a/openair2/RRC/LTE/rrc_eNB_UE_context.h b/openair2/RRC/LTE/rrc_eNB_UE_context.h index 89469529dff..7d699216583 100644 --- a/openair2/RRC/LTE/rrc_eNB_UE_context.h +++ b/openair2/RRC/LTE/rrc_eNB_UE_context.h @@ -31,7 +31,7 @@ #define __RRC_ENB_UE_CONTEXT_H__ #include "collection/tree.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "rrc_defs.h" int rrc_eNB_compare_ue_rnti_id( diff --git a/openair2/RRC/NR/cucp_cuup_if.h b/openair2/RRC/NR/cucp_cuup_if.h index cbf84a289e5..86b3a2435ec 100644 --- a/openair2/RRC/NR/cucp_cuup_if.h +++ b/openair2/RRC/NR/cucp_cuup_if.h @@ -26,7 +26,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/sctp.h> -#include "platform_types.h" +#include "common/platform_types.h" struct e1ap_bearer_setup_req_s; struct e1ap_bearer_setup_resp_s; diff --git a/openair2/RRC/NR/mac_rrc_dl.h b/openair2/RRC/NR/mac_rrc_dl.h index 36c6af4396d..0899bca06ac 100644 --- a/openair2/RRC/NR/mac_rrc_dl.h +++ b/openair2/RRC/NR/mac_rrc_dl.h @@ -22,7 +22,7 @@ #ifndef MAC_RRC_DL_H #define MAC_RRC_DL_H -#include "platform_types.h" +#include "common/platform_types.h" #include "f1ap_messages_types.h" typedef void (*f1_setup_response_func_t)(sctp_assoc_t assoc_id, const f1ap_setup_resp_t *resp); diff --git a/openair2/RRC/NR/nr_rrc_common.c b/openair2/RRC/NR/nr_rrc_common.c index b64ea7d13f3..7aa281c3437 100644 --- a/openair2/RRC/NR/nr_rrc_common.c +++ b/openair2/RRC/NR/nr_rrc_common.c @@ -31,7 +31,7 @@ #include "nr_rrc_extern.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "COMMON/openair_defs.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "LAYER2/RLC/rlc.h" #include "COMMON/mac_rrc_primitives.h" diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 892873638a0..17be416c12e 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -42,7 +42,7 @@ #include "common/ngran_types.h" #include "common/platform_constants.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "mac_rrc_dl.h" #include "cucp_cuup_if.h" diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d967d3623f2..b797af80a77 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -67,7 +67,7 @@ #include "uper_encoder.h" #include "uper_decoder.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "T.h" diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.h b/openair2/RRC/NR/rrc_gNB_UE_context.h index af40b33981f..37d71f9c290 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.h +++ b/openair2/RRC/NR/rrc_gNB_UE_context.h @@ -31,7 +31,7 @@ #define __RRC_GNB_UE_CONTEXT_H__ #include "collection/tree.h" -#include "COMMON/platform_types.h" +#include "common/platform_types.h" #include "nr_rrc_defs.h" int rrc_gNB_compare_ue_rnti_id(rrc_gNB_ue_context_t* c1_pP, rrc_gNB_ue_context_t* c2_pP); diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 998f83e75c6..daf709999b1 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -37,7 +37,7 @@ #include <stdlib.h> #include <string.h> -#include "platform_types.h" +#include "common/platform_types.h" #include "commonDef.h" #include "common/platform_constants.h" diff --git a/openair2/SDAP/nr_sdap/nr_sdap.h b/openair2/SDAP/nr_sdap/nr_sdap.h index 5d4d907a8c3..8fb313a340a 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap.h +++ b/openair2/SDAP/nr_sdap/nr_sdap.h @@ -22,7 +22,7 @@ #ifndef _NR_SDAP_GNB_H_ #define _NR_SDAP_GNB_H_ -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" #include "common/utils/LOG/log.h" #include "nr_sdap_entity.h" diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.h b/openair2/SDAP/nr_sdap/nr_sdap_entity.h index 07d62a4746b..0b4ae82bcbf 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h @@ -24,7 +24,7 @@ #include <stdint.h> #include <stdbool.h> -#include "openair2/COMMON/platform_types.h" +#include "common/platform_types.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "NR_RadioBearerConfig.h" diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h deleted file mode 100644 index 31422d5e280..00000000000 --- a/openair2/UTIL/MEM/mem_block.h +++ /dev/null @@ -1,79 +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 - */ - -/*************************************************************************** - mem_block.h - description - ------------------- - AUTHOR : Lionel GAUTHIER - COMPANY : EURECOM - EMAIL : Lionel.Gauthier@eurecom.fr - - - ***************************************************************************/ -#ifndef __MEM_BLOCK_H__ -# define __MEM_BLOCK_H__ - -#include <stdint.h> -#include <stddef.h> -#ifdef __cplusplus -extern "C" { -#endif -#include "common/platform_constants.h" -//----------------------------------------------------------------------------- - -typedef struct mem_block_t { - struct mem_block_t *next; - struct mem_block_t *previous; - size_t size; - unsigned char pool_id; - unsigned char *data; -} mem_block_t; - -//----------------------------------------------------------------------------- - -void *pool_buffer_init (void); -void *pool_buffer_clean (void *arg); -void free_mem_block (mem_block_t * leP, const char* caller); -mem_block_t* get_free_mem_block (uint32_t sizeP, const char* caller); -mem_block_t *get_free_copy_mem_block (void); -mem_block_t *get_free_copy_mem_block_up (void); -mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP); -void display_mem_load (void); -#define LIST_NAME_MAX_CHAR 32 - -typedef struct { - struct mem_block_t *head; - struct mem_block_t *tail; - int nb_elements; - char name[LIST_NAME_MAX_CHAR]; -} list2_t; -//----------------------------------------------------------------------------- -typedef struct { - struct mem_block_t *head; - struct mem_block_t *tail; - int nb_elements; - char name[LIST_NAME_MAX_CHAR]; -} list_t; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/openair2/X2AP/x2ap_timers.h b/openair2/X2AP/x2ap_timers.h index f32b73e87ba..167beaa29ab 100644 --- a/openair2/X2AP/x2ap_timers.h +++ b/openair2/X2AP/x2ap_timers.h @@ -23,7 +23,7 @@ #define X2AP_TIMERS_H_ #include <stdint.h> -#include "platform_types.h" +#include "common/platform_types.h" typedef struct { /* incremented every TTI (every millisecond when in realtime). diff --git a/openair3/M3AP/m3ap_timers.h b/openair3/M3AP/m3ap_timers.h index 95dcbfc9d96..cd0ac5d85fc 100644 --- a/openair3/M3AP/m3ap_timers.h +++ b/openair3/M3AP/m3ap_timers.h @@ -23,7 +23,7 @@ #define M3AP_TIMERS_H_ #include <stdint.h> -#include "platform_types.h" +#include "common/platform_types.h" typedef struct { /* incremented every TTI (every millisecond when in realtime). diff --git a/openair3/MME_APP/mme_app.h b/openair3/MME_APP/mme_app.h index 01a9ec615fe..6e432f3cd0a 100644 --- a/openair3/MME_APP/mme_app.h +++ b/openair3/MME_APP/mme_app.h @@ -31,8 +31,7 @@ #define MME_APP_H_ #include <stdint.h> -#include "platform_types.h" - +#include "common/platform_types.h" void *MME_app_task(void *args_p); diff --git a/openair3/MME_APP/mme_config.h b/openair3/MME_APP/mme_config.h index 1afe619008b..f7856b07557 100644 --- a/openair3/MME_APP/mme_config.h +++ b/openair3/MME_APP/mme_config.h @@ -35,7 +35,7 @@ #include <libconfig.h> #include "commonDef.h" -#include "platform_types.h" +#include "common/platform_types.h" #include "common/platform_constants.h" #include "PHY/impl_defs_top.h" #include "PHY/defs_eNB.h" diff --git a/openair3/NAS/TOOLS/conf_emm.c b/openair3/NAS/TOOLS/conf_emm.c index 668b90a0ae0..894cd2d1eca 100644 --- a/openair3/NAS/TOOLS/conf_emm.c +++ b/openair3/NAS/TOOLS/conf_emm.c @@ -1,6 +1,6 @@ #include <string.h> -#include "memory.h" +#include "common/utils/mem/oai_memory.h" #include "conf_emm.h" #include "fs.h" diff --git a/openair3/NAS/TOOLS/conf_user_data.c b/openair3/NAS/TOOLS/conf_user_data.c index 5e14797e166..621fe6c6013 100644 --- a/openair3/NAS/TOOLS/conf_user_data.c +++ b/openair3/NAS/TOOLS/conf_user_data.c @@ -2,7 +2,7 @@ #include <stdlib.h> #include "commonDef.h" -#include "memory.h" +#include "common/utils/mem/oai_memory.h" #include "fs.h" #include "conf_user_data.h" diff --git a/openair3/NAS/TOOLS/display.c b/openair3/NAS/TOOLS/display.c index 0828eeb6738..d5396f87f97 100644 --- a/openair3/NAS/TOOLS/display.c +++ b/openair3/NAS/TOOLS/display.c @@ -5,7 +5,7 @@ #include "usim_api.h" #include "emmData.h" #include "display.h" -#include "memory.h" +#include "common/utils/mem/oai_memory.h" #include "fs.h" #define PRINT_PLMN_DIGIT(d) if ((d) != 0xf) printf("%u", (d)) diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c index 7facdaba792..be66e4a8108 100644 --- a/openair3/NAS/UE/API/USIM/usim_api.c +++ b/openair3/NAS/UE/API/USIM/usim_api.c @@ -38,16 +38,14 @@ Description Implements the API used by the NAS layer to read/write *****************************************************************************/ - +#include <stdio.h> +#include <string.h> // memcpy, memset +#include <stdlib.h> // malloc, free #include "usim_api.h" #include "nas_log.h" #include "utils.h" -#include "memory.h" -#include <stdio.h> +#include "common/utils/mem/oai_memory.h" #include "aka_functions.h" -#include <string.h> // memcpy, memset -#include <stdlib.h> // malloc, free -#include <stdio.h> /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c index ec5babc540c..3deabbe9be7 100644 --- a/openair3/NAS/UE/EMM/emm_main.c +++ b/openair3/NAS/UE/EMM/emm_main.c @@ -37,6 +37,9 @@ Description Defines the EPS Mobility Management procedure call manager, *****************************************************************************/ +#include <string.h> // memset, memcpy, strlen +#include <stdio.h> // sprintf +#include <stdlib.h> // malloc, free #include "emm_main.h" #include "nas_log.h" #include "utils.h" @@ -44,13 +47,9 @@ Description Defines the EPS Mobility Management procedure call manager, #include "MobileIdentity.h" #include "emm_proc_defs.h" -#include "memory.h" #include "usim_api.h" #include "IdleMode.h" - -#include <string.h> // memset, memcpy, strlen -#include <stdio.h> // sprintf -#include <stdlib.h> // malloc, free +#include "common/utils/mem/oai_memory.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index fbd7a1365e4..33c585bcc3b 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -29,7 +29,7 @@ # include "user_api.h" # include "nas_parser.h" # include "nas_proc.h" -# include "memory.h" +#include "common/utils/mem/oai_memory.h" #include "nas_user.h" #include "common/ran_context.h" diff --git a/openair3/NAS/UE/nas_user.c b/openair3/NAS/UE/nas_user.c index fba70e1db4c..57327802f31 100644 --- a/openair3/NAS/UE/nas_user.c +++ b/openair3/NAS/UE/nas_user.c @@ -39,7 +39,7 @@ Description NAS procedure functions triggered by the user #include "user_defs.h" #include "nas_log.h" -#include "memory.h" +#include "common/utils/mem/oai_memory.h" #include "at_command.h" #include "at_response.h" diff --git a/openair3/UTILS/CONF/COPYING b/openair3/UTILS/CONF/COPYING deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 69db8caa4ad..904ca6548cd 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -10,7 +10,7 @@ extern "C" { #include <sys/types.h> #include <netdb.h> -#include <openair2/COMMON/platform_types.h> +#include "common/platform_types.h" #include <openair3/UTILS/conversions.h> #include "common/utils/LOG/log.h" #include <common/utils/ocp_itti/intertask_interface.h> diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 7ac025f14a0..ce806f0bfc6 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -4,6 +4,8 @@ #define GTPNOK -1 # define GTPU_HEADER_OVERHEAD_MAX 64 + +#include "common/utils/hashtable/hashtable.h" #ifdef __cplusplus extern "C" { #endif diff --git a/targets/TEST/PDCP/test_pdcp.c b/targets/TEST/PDCP/test_pdcp.c index f5f34daec67..fb8259bbde7 100644 --- a/targets/TEST/PDCP/test_pdcp.c +++ b/targets/TEST/PDCP/test_pdcp.c @@ -217,7 +217,7 @@ bool test_pdcp_data_req(void) unsigned int index = 0; /* - * Create an unsigned char buffer out of mem_block_t + * Create an unsigned char buffer out of uint8_t */ pdcp_test_pdu_buffer = (unsigned char*) calloc(1, pdcp_test_pdu_buffer_size); @@ -244,8 +244,8 @@ bool test_pdcp_data_req(void) msg("[TEST] Starting to dissect PDU created by PDCP...\n"); /* - * XXX mem_block_t doesn't hold buffer size, how do we keep the size - * information if we pass mem_block_ts via a linked list? + * XXX uint8_t doesn't hold buffer size, how do we keep the size + * information if we pass uint8_ts via a linked list? */ if (pdcp_test_pdu_buffer_size == 0 ) { @@ -254,11 +254,11 @@ bool test_pdcp_data_req(void) } /* - * Serialize incoming mem_block_t into an unsigned character array + * Serialize incoming uint8_t into an unsigned character array * and add removed PDU to RX list in order to use it in the next test * (test_pdcp_data_ind()) */ - mem_block_t* pdcp_test_pdu = list_remove_head(&test_pdu_tx_list); + uint8_t* pdcp_test_pdu = list_remove_head(&test_pdu_tx_list); memcpy(pdcp_test_pdu_buffer, pdcp_test_pdu->data, pdcp_test_pdu_buffer_size); list_add_tail_eurecom(pdcp_test_pdu, &test_pdu_rx_list); @@ -314,7 +314,7 @@ bool test_pdcp_data_ind(void) * every single element in the list */ list_t test_pdu_indication_list; - mem_block_t* test_sdu = NULL; + uint8_t* test_sdu = NULL; /* * pdcp_data_req() method prepended PDU header in front of DUMMY_BUFFER so * the size should be 12 bytes @@ -354,7 +354,7 @@ bool test_pdcp_data_ind(void) /* * Get pdcp_data_ind_header_t added by pdcp_data_ind() */ - mem_block_t* test_data_ind_header = list_remove_head(&test_pdu_indication_list); + uint8_t* test_data_ind_header = list_remove_head(&test_pdu_indication_list); if (test_data_ind_header == NULL) { msg("[TEST] Data indication header is not valid!\n"); diff --git a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c index d2a0d4c6dc4..7116f696dc0 100644 --- a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c +++ b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c @@ -112,8 +112,8 @@ bool init_pdcp_entity(pdcp_t *pdcp_entity); //----------------------------------------------------------------------------- void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_data_req *data_requestP, int* drop_countP, int *tx_packetsP, int* dropped_tx_packetsP) //----------------------------------------------------------------------------- { - mem_block_t* tb_src; - mem_block_t* tb_dst; + uint8_t *tb_src; + uint8_t *tb_dst; unsigned int tb_size; data_indP->no_tb = 0; @@ -130,7 +130,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat *tx_packetsP = *tx_packetsP + 1; if (*drop_countP == 0) { - tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__); + tb_dst = malloc16(sizeof(mac_rlc_max_rx_header_size_t) + tb_size); if (tb_dst != NULL) { ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0; @@ -154,7 +154,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat *dropped_tx_packetsP = *dropped_tx_packetsP + 1; } - free_mem_block(tb_src, __func__); + free(tb_src); if (data_indP->no_tb > 0) { printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb); -- GitLab