From d96a2522a69658d0c6347e2cb96d78cac465023f Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 15 Dec 2023 13:57:01 +0100 Subject: [PATCH 01/32] Enable 2 UL layers for AW2S gNB --- ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf | 4 ++-- ci-scripts/xml_files/container_sa_aw2s_asue.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf b/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf index 5f6d6a4937..802d2b2290 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf @@ -22,9 +22,9 @@ gNBs = ////////// Physical parameters: pdsch_AntennaPorts_XP = 2; - pusch_AntennaPorts = 1; + pusch_AntennaPorts = 2; do_CSIRS = 1; - do_SRS = 0; + do_SRS = 1; servingCellConfigCommon = ( { diff --git a/ci-scripts/xml_files/container_sa_aw2s_asue.xml b/ci-scripts/xml_files/container_sa_aw2s_asue.xml index a7e1dc25df..b918b6a797 100644 --- a/ci-scripts/xml_files/container_sa_aw2s_asue.xml +++ b/ci-scripts/xml_files/container_sa_aw2s_asue.xml @@ -145,8 +145,8 @@ Iperf - iperf (UL/2Mbps/UDP)(30 sec)(multi-ue profile) - -u -b 20M -t 30 -i 1 + iperf (UL/4Mbps/UDP)(30 sec)(multi-ue profile) + -u -b 40M -t 30 -i 1 IPERF3 amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10 25 From 63b64d4fcee6ed35a016f489a342e3f278241ba7 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 5 Dec 2023 19:22:18 +0100 Subject: [PATCH 02/32] 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 | 252 +++++++++--------- 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 | 145 +++++----- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 53 ++-- .../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 | 18 +- 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 | 53 ++-- 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, 518 insertions(+), 987 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 4aefd12b54..9cd36d625b 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 3891af37ab..13067562fe 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 05d7a42712..55c981701b 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 a24c82d96f..c3f3d5ae21 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -35,7 +35,7 @@ #include #include #include -#include +#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 6c3ddf3b8e..5559cc2076 100644 --- a/common/config/config_common.c +++ b/common/config/config_common.c @@ -28,7 +28,7 @@ #include #include #include -#include +#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 41d6aad376..dd86aaf42a 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -36,7 +36,7 @@ #include #include #include -#include +#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 aeb4e8a726..9f7477f5cd 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -39,7 +39,7 @@ #include #include #include -#include +#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 454c24657b..2f54208306 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 6c388c3cd0..888a812465 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 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 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 { 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 { 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; +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 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; +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 +// 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 453e853aec..d7d92b8ec4 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -27,7 +27,7 @@ #include #include #include -#include +#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 0cd783fe5e..1494f17de1 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 334cdc5eb6..d4f09279aa 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 // fopen, fread, fclose -#include // getenv, malloc, free -#include // 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 +#include +#include +#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 ec8406c932..311ad6f4d0 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 // size_t +#include +#include +#include +#ifdef __cplusplus +extern "C" { +#endif +#include "common/platform_constants.h" +//----------------------------------------------------------------------------- -/****************************************************************************/ -/********************* G L O B A L C O N S T A N T S *******************/ -/****************************************************************************/ +typedef unsigned char uint8_t; -/****************************************************************************/ -/************************ G L O B A L T Y P E S ************************/ -/****************************************************************************/ - -/****************************************************************************/ -/******************** G L O B A L V A R I A B L E S ********************/ -/****************************************************************************/ - -/****************************************************************************/ -/****************** 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 8c4da1d92c..56781f79a4 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 bca3f9a56b..f8f33a9c82 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -26,9 +26,8 @@ #include #include -#include #include - +#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 2cef6f9478..c92e9fb336 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 5fb66bc73a..558e450d33 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 3dc6e930b7..239c1423a3 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 #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 11bc86e42e..a4ff93b5e8 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 d90216c3e6..7ee3be6701 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 938b70815c..0000000000 --- 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 ab55b67864..01143ccf47 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 7ee8017a45..7f1858b2c4 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 diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index e021f7ce68..7098bd8c6f 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -59,7 +59,7 @@ //#include #include "time_meas.h" -#include "platform_types.h" +#include "common/platform_types.h" #define MAX_NUM_RU_PER_eNB 64 #include diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 668716e1f9..45abb05c2f 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 f9934348c7..0eb824406b 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 319372ee93..0000000000 --- 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 8814a972b0..0000000000 --- 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 b2bc9d09b8..0000000000 --- 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 848a6cf556..0000000000 --- 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 e18db881f0..f5a24494a7 100644 --- a/openair2/COMMON/commonDef.h +++ b/openair2/COMMON/commonDef.h @@ -42,36 +42,9 @@ Description Contains global common definitions #include #include #include - -#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 212c400988..b6400b53b5 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 0689dd52ac..a5e10b01f9 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 c0d5c1b437..cb4c65e9e2 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -24,7 +24,6 @@ #include #include -#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 b159b3e11b..d65b31b145 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 66b8719cc8..caf0bff683 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 fa90c4a3b2..9858d420ca 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 2810dcfdd6..84ecf56a8d 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 3dd8fc8213..7537d7c6d7 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -24,6 +24,7 @@ #include #include +#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 0154b12dbc..04f413b3c6 100644 --- a/openair2/ENB_APP/enb_app.h +++ b/openair2/ENB_APP/enb_app.h @@ -31,8 +31,7 @@ #define ENB_APP_H_ #include -#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 5abb7df2c9..dc182faf4b 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -35,7 +35,7 @@ #include #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 2071234be0..13f1d8f53b 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 03c210c972..aaa330ecb2 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 1c2b727237..8401b44eca 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 4eee1ba6b1..cc0214a47d 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 +#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 d02b5eb4f5..235a7582d5 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -35,7 +35,7 @@ #include #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 b4d1b307b2..9b965420d6 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 4ede02d330..99ffd7ac07 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 dadd019241..12984f299d 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 913e3ebcce..219c5e441d 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 0e57098d7b..f1d498e470 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -36,7 +36,7 @@ #include #include #include -#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 9371c8c7df..24819452df 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 - +#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 ebcb0e601b..7b7db63606 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 +#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 9710a90518..3b738eed28 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 04a374a4f6..287b771649 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 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 230ac310e5..31dfcf82b2 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 d59efafdc2..34b9911847 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 448c4e94f0..b2a935c430 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 #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 32759b304f..96f3ad42d5 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 62a4ae0248..7519691334 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 2dcc3e429d..99081a5ffc 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; idata[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 35bcd06308..6b0e2499fe 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 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, - 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, + 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 c1ba248178..c27eef4e67 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 89b8ff672f..64fa304165 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 f61f9ca6c7..39471ebbee 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 412a974406..e90a5a4309 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 4a8966e100..183a982ed7 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp.h @@ -20,7 +20,7 @@ */ #include -#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 1657f3c4bb..8d342a8206 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -24,7 +24,7 @@ #include #include -#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 96444e5b10..6efdf00d99 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 /* 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 ea88fbfb18..61d1403104 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); + 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, +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 0d26e1f3ec..dc6adc5e9f 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 383ae37d35..6b4eecf46e 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 ed29c5458b..aa499cfab6 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 3e191595dd..d9798f6138 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 d2875d92af..b41ba35f3b 100644 --- a/openair2/M2AP/m2ap_timers.h +++ b/openair2/M2AP/m2ap_timers.h @@ -23,7 +23,7 @@ #define M2AP_TIMERS_H_ #include -#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 fc55c10f1c..0f4be6ccd8 100644 --- a/openair2/MCE_APP/mce_app.h +++ b/openair2/MCE_APP/mce_app.h @@ -31,8 +31,7 @@ #define MCE_APP_H_ #include -#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 1fbe81a627..01a19b3a5c 100644 --- a/openair2/MCE_APP/mce_config.h +++ b/openair2/MCE_APP/mce_config.h @@ -35,7 +35,7 @@ #include #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 ea82dd9b85..4ceae1b929 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 aa55c07612..ef4cfde8ac 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 46e44f0040..8a89d7a9de 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/local.h +++ b/openair2/NETWORK_DRIVER/UE_IP/local.h @@ -52,7 +52,7 @@ #include #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 f85d44398f..dd4e7e970b 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 3560fc49ee..5be2d3c03c 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 #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 cff783739e..c395ff95e7 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 +#include "common/platform_types.h" #include #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 f306903f5f..3fe38a2731 100644 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -36,11 +36,10 @@ #include //#include "openair1/PHY/LTE_TRANSPORT/transport_eNB.h" #include "nfapi_interface.h" -#include "platform_types.h" +#include "common/platform_types.h" #include #include - #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; + 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; + /// harq indication list + nfapi_harq_indication_t harq_ind; - /// crc indication list - nfapi_crc_indication_t crc_ind; + /// crc indication list + nfapi_crc_indication_t crc_ind; - /// SR indication list - nfapi_sr_indication_t sr_ind; + /// SR indication list + nfapi_sr_indication_t sr_ind; - /// CQI indication list - nfapi_cqi_indication_t cqi_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; + /// 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; + /// 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 954eaaa281..8aec51d85d 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 8210811862..3ed4428db6 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 bc333bdcd6..f8c30698b1 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 86fccddcf6..e84b015b67 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 d1128c66ee..91fade8b50 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 656f5334a6..fe9dca84a9 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 7654b56922..230e0d409b 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 35303cd4f8..3191c487c2 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 15b4914a65..a5ad82b61e 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 89469529df..7d69921658 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 cbf84a289e..86b3a2435e 100644 --- a/openair2/RRC/NR/cucp_cuup_if.h +++ b/openair2/RRC/NR/cucp_cuup_if.h @@ -26,7 +26,7 @@ #include #include #include -#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 36c6af4396..0899bca06a 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 b64ea7d13f..7aa281c343 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 892873638a..17be416c12 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 d967d3623f..b797af80a7 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 af40b33981..37d71f9c29 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 998f83e75c..daf709999b 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -37,7 +37,7 @@ #include #include -#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 5d4d907a8c..8fb313a340 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 07d62a4746..0b4ae82bcb 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.h +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.h @@ -24,7 +24,7 @@ #include #include -#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 31422d5e28..0000000000 --- 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 -#include -#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 f32b73e87b..167beaa29a 100644 --- a/openair2/X2AP/x2ap_timers.h +++ b/openair2/X2AP/x2ap_timers.h @@ -23,7 +23,7 @@ #define X2AP_TIMERS_H_ #include -#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 95dcbfc9d9..cd0ac5d85f 100644 --- a/openair3/M3AP/m3ap_timers.h +++ b/openair3/M3AP/m3ap_timers.h @@ -23,7 +23,7 @@ #define M3AP_TIMERS_H_ #include -#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 01a9ec615f..6e432f3cd0 100644 --- a/openair3/MME_APP/mme_app.h +++ b/openair3/MME_APP/mme_app.h @@ -31,8 +31,7 @@ #define MME_APP_H_ #include -#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 1afe619008..f7856b0755 100644 --- a/openair3/MME_APP/mme_config.h +++ b/openair3/MME_APP/mme_config.h @@ -35,7 +35,7 @@ #include #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 668b90a0ae..894cd2d1ec 100644 --- a/openair3/NAS/TOOLS/conf_emm.c +++ b/openair3/NAS/TOOLS/conf_emm.c @@ -1,6 +1,6 @@ #include -#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 5e14797e16..621fe6c601 100644 --- a/openair3/NAS/TOOLS/conf_user_data.c +++ b/openair3/NAS/TOOLS/conf_user_data.c @@ -2,7 +2,7 @@ #include #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 0828eeb673..d5396f87f9 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 7facdaba79..be66e4a810 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 +#include // memcpy, memset +#include // malloc, free #include "usim_api.h" #include "nas_log.h" #include "utils.h" -#include "memory.h" -#include +#include "common/utils/mem/oai_memory.h" #include "aka_functions.h" -#include // memcpy, memset -#include // malloc, free -#include /****************************************************************************/ /**************** 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 ec5babc540..3deabbe9be 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 // memset, memcpy, strlen +#include // sprintf +#include // 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 // memset, memcpy, strlen -#include // sprintf -#include // 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 fbd7a1365e..33c585bcc3 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 fba70e1db4..57327802f3 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 e69de29bb2..0000000000 diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 69db8caa4a..904ca6548c 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -10,7 +10,7 @@ extern "C" { #include #include -#include +#include "common/platform_types.h" #include #include "common/utils/LOG/log.h" #include diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 7ac025f14a..ce806f0bfc 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 f5f34daec6..fb8259bbde 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 d2a0d4c6dc..7116f696dc 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); From 4b019293c6004efccef18fc2b5f2818dc37230fd Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 12 Jun 2023 17:53:41 +0200 Subject: [PATCH 03/32] reset MAC --- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 + openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 54 +++++++++++++++++++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 3 -- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index f30e700614..7d200b9a22 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -175,6 +175,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(); \param module_id index of MAC instance(s)*/ NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id); +void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac); + /**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures. \param dl_info DL indication diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 9371c8c7df..6b2f439823 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -78,6 +78,58 @@ NR_UE_MAC_INST_t * nr_l2_init_ue() return (nr_ue_mac_inst); } -NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id){ +NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id) +{ return &nr_ue_mac_inst[(int)module_id]; } + +void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) +{ + // MAC reset according to 38.321 Section 5.12 + + nr_ue_mac_default_configs(nr_mac); + // initialize Bj for each logical channel to zero + // Done in default config but to -1 (is that correct?) + + // stop all running timers + // TODO + + // consider all timeAlignmentTimers as expired and perform the corresponding actions in clause 5.2 + // TODO + + // set the NDIs for all uplink HARQ processes to the value 0 + for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) + nr_mac->UL_ndi[k] = -1; // initialize to invalid value + + // stop any ongoing RACH procedure + if (nr_mac->ra.ra_state < RA_SUCCEEDED) + nr_mac->ra.ra_state = RA_UE_IDLE; + + // discard explicitly signalled contention-free Random Access Resources + // TODO not sure what needs to be done here + + // flush Msg3 buffer + // TODO we don't have a Msg3 buffer + + // cancel any triggered Scheduling Request procedure + // Done in default config + + // cancel any triggered Buffer Status Reporting procedure + // Done in default config + + // cancel any triggered Power Headroom Reporting procedure + // TODO PHR not implemented yet + + // flush the soft buffers for all DL HARQ processes + for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) + memset(&nr_mac->dl_harq_info[k], 0, sizeof(NR_UE_HARQ_STATUS_t)); + + // for each DL HARQ process, consider the next received transmission for a TB as the very first transmission + // TODO there is nothing in the MAC indicating first transmission + + // release, if any, Temporary C-RNTI + nr_mac->ra.t_crnti = 0; + + // reset BFI_COUNTER + // TODO beam failure procedure not implemented +} diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c5e8b9d95a..2eee621ace 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -179,6 +179,7 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) mac->scheduling_info.retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf10240; mac->scheduling_info.periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_infinity; mac->scheduling_info.SR_COUNTER = 0; + mac->scheduling_info.SR_pending = 0; mac->scheduling_info.sr_ProhibitTimer = 0; mac->scheduling_info.sr_ProhibitTimer_Running = 0; mac->scheduling_info.sr_id = -1; // invalid init value diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 5874f8fec9..8107f97abc 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1043,16 +1043,13 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info) } mac_pdu_exist = 1; } else { - if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator && (mac->state == UE_CONNECTED || (ra->ra_state == WAIT_RAR && ra->cfra))){ - // Getting IP traffic to be transmitted nr_ue_get_sdu(mod_id, cc_id,frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes); mac_pdu_exist = 1; } - } // Config UL TX PDU From e3e158a77a8779e2012615fd8669c6a904ba850b Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 13 Jun 2023 14:09:56 +0200 Subject: [PATCH 04/32] RRC go to IDLE --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 27 --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 26 +++ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 7 - openair2/LAYER2/NR_MAC_UE/mac_proto.h | 7 + openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 104 ++++++++++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 47 ------ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 158 +++++++++++++++++- openair2/RRC/NR_UE/rrc_defs.h | 14 +- 10 files changed, 292 insertions(+), 104 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index e0bc7ccb2a..018cfcb406 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4277,33 +4277,6 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD AssertFatal(type0_PDCCH_CSS_config->num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); AssertFatal(type0_PDCCH_CSS_config->rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); - - //uint32_t cell_id = 0; // obtain from L1 later - - //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; - //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; - -// uint64_t mask = 0x0; -// uint8_t i; -// for(i=0; i<(type0_PDCCH_CSS_config->num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs -// mask = mask >> 1; -// mask = mask | 0x100000000000; -// } - - //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); - -// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; -// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset -// -// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; -// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; -// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; -// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - - // type0-pdcch search space float big_o = 0.0f; float big_m = 0.0f; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index b7bfcb501e..ed2afb80f3 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -1351,6 +1351,32 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up } } +void nr_rrc_mac_config_req_reset(module_id_t module_id) +{ + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + reset_mac_inst(mac); +} + +void nr_rrc_mac_config_req_release(module_id_t module_id) +{ + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + + reset_ra(&mac->ra); + release_mac_configuration(mac); + + mac->first_sync_frame = -1; + mac->get_sib1 = false; + mac->phy_config_request_sent = false; + mac->state = UE_NOT_SYNC; + + // Sending to PHY a request to resync + // with no target cell ID + mac->synch_request.Mod_id = module_id; + mac->synch_request.CC_id = 0; + mac->synch_request.synch_req.target_Nid_cell = -1; + mac->if_module->synch_request(&mac->synch_request); +} + void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SI_SchedulingInfo_t *si_SchedulingInfo, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 1fdeb06e09..d687ecf70e 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -472,13 +472,6 @@ typedef struct { bool phy_config_request_sent; frame_type_t frame_type; - /// Type0-PDCCH seach space - fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config; - uint32_t type0_pdcch_ss_mux_pattern; - int type0_pdcch_ss_sfn_c; - uint32_t type0_pdcch_ss_n_c; - uint32_t type0_pdcch_consecutive_slots; - /* PDUs */ /// Outgoing CCCH pdu for PHY CCCH_PDU CCCH_pdu; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 7d200b9a22..599d90d54e 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -136,6 +136,8 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac); void nr_ue_decode_mib(module_id_t module_id, int cc_id); +void release_common_ss_cset(NR_BWP_PDCCH_t *pdcch); + /**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind \param module_id module id \param cc_id component carrier id @@ -168,6 +170,9 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, NR_SI_SchedulingInfo_t *si_SchedulingInfo, NR_ServingCellConfigCommonSIB_t *scc); +void nr_rrc_mac_config_req_reset(module_id_t module_id); +void nr_rrc_mac_config_req_release(module_id_t module_id); + /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ NR_UE_MAC_INST_t * nr_l2_init_ue(); @@ -176,6 +181,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(); NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id); void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac); +void reset_ra(RA_config_t *ra); +void release_mac_configuration(NR_UE_MAC_INST_t *mac); /**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures. diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 6b2f439823..89394200a3 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -60,27 +60,72 @@ void send_msg3_rrc_request(module_id_t mod_id, int rnti) nr_mac_rrc_msg3_ind(mod_id, rnti); } -NR_UE_MAC_INST_t * nr_l2_init_ue() +void nr_ue_init_mac(module_id_t module_idP) { - LOG_I(NR_MAC, "MAIN: init UE MAC functions \n"); - //init mac here - nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t)); - - for (int j = 0; j < NB_NR_UE_MAC_INST; j++) - nr_ue_init_mac(j); - - if (get_softmodem_params()->sa) - ue_init_config_request(nr_ue_mac_inst, get_softmodem_params()->numerology); - - int rc = rlc_module_init(0); - AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); - - return (nr_ue_mac_inst); + LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP); + NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); + nr_ue_mac_default_configs(mac); + mac->first_sync_frame = -1; + mac->get_sib1 = false; + mac->get_otherSI = false; + mac->phy_config_request_sent = false; + memset(&mac->phy_config, 0, sizeof(mac->phy_config)); + mac->state = UE_NOT_SYNC; + mac->si_window_start = -1; + mac->servCellIndex = 0; } -NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id) +void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) { - return &nr_ue_mac_inst[(int)module_id]; + // default values as defined in 38.331 sec 9.2.2 + mac->scheduling_info.retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf10240; + mac->scheduling_info.periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_infinity; + mac->scheduling_info.SR_COUNTER = 0; + mac->scheduling_info.SR_pending = 0; + mac->scheduling_info.sr_ProhibitTimer = 0; + mac->scheduling_info.sr_ProhibitTimer_Running = 0; + mac->scheduling_info.sr_id = -1; // invalid init value + + // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value + // configured by the NW. + mac->scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + mac->BSR_reporting_active = BSR_TRIGGER_NONE; + + for (int i = 0; i < NR_MAX_NUM_LCID; i++) { + LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i); + mac->scheduling_info.lc_sched_info[i].Bj = -1; + mac->scheduling_info.lc_sched_info[i].bucket_size = -1; + mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB + mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY; + mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; + for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) + mac->UL_ndi[k] = -1; // initialize to invalid value + } + + memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); + memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); +} + +NR_UE_MAC_INST_t *nr_l2_init_ue() +{ + //init mac here + nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t)); + + for (int j = 0; j < NB_NR_UE_MAC_INST; j++) + nr_ue_init_mac(j); + + if (get_softmodem_params()->sa) + ue_init_config_request(nr_ue_mac_inst, get_softmodem_params()->numerology); + + int rc = rlc_module_init(0); + AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); + + return (nr_ue_mac_inst); +} + +NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id) { + return &nr_ue_mac_inst[(int)module_id]; } void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) @@ -133,3 +178,28 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) // reset BFI_COUNTER // TODO beam failure procedure not implemented } + +void release_mac_configuration(NR_UE_MAC_INST_t *mac) +{ + if(mac->mib) + ASN_STRUCT_FREE(asn_DEF_NR_MIB, mac->mib); + for (int i = 0; i < 5; i++) { + NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5]; + release_common_ss_cset(pdcch); + for (int j = 0; j < pdcch->list_Coreset.count; j++) + asn_sequence_del(&pdcch->list_Coreset, j, 1); + for (int j = 0; j < pdcch->list_SS.count; j++) + asn_sequence_del(&pdcch->list_SS, j, 1); + } + + memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); + memset(&mac->csirs_measurements, 0, sizeof(mac->csirs_measurements)); + memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); +} + +void reset_ra(RA_config_t *ra) +{ + if(ra->rach_ConfigDedicated) + ASN_STRUCT_FREE(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated); + memset(ra, 0, sizeof(RA_config_t)); +} diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2eee621ace..91cc805d22 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -158,53 +158,6 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, dci_pdu_rel15_t *dci_pdu_rel15, int slot); -void nr_ue_init_mac(module_id_t module_idP) -{ - LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP); - NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); - nr_ue_mac_default_configs(mac); - mac->first_sync_frame = -1; - mac->get_sib1 = false; - mac->get_otherSI = false; - mac->phy_config_request_sent = false; - memset(&mac->phy_config, 0, sizeof(mac->phy_config)); - mac->state = UE_NOT_SYNC; - mac->si_window_start = -1; - mac->servCellIndex = 0; -} - -void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) -{ - // default values as defined in 38.331 sec 9.2.2 - mac->scheduling_info.retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf10240; - mac->scheduling_info.periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_infinity; - mac->scheduling_info.SR_COUNTER = 0; - mac->scheduling_info.SR_pending = 0; - mac->scheduling_info.sr_ProhibitTimer = 0; - mac->scheduling_info.sr_ProhibitTimer_Running = 0; - mac->scheduling_info.sr_id = -1; // invalid init value - - // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value - // configured by the NW. - mac->scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; - mac->scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; - mac->BSR_reporting_active = BSR_TRIGGER_NONE; - - for (int i = 0; i < NR_MAX_NUM_LCID; i++) { - LOG_D(NR_MAC, "Applying default logical channel config for LCGID %d\n", i); - mac->scheduling_info.lc_sched_info[i].Bj = -1; - mac->scheduling_info.lc_sched_info[i].bucket_size = -1; - mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB - mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY; - mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; - for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) - mac->UL_ndi[k] = -1; // initialize to invalid value - } - - memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); - memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); -} - int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti) { diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 96444e5b10..2e96428dfb 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -958,13 +958,11 @@ bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) abort(); } -bool nr_pdcp_remove_UE(ue_id_t ue_id) +void nr_pdcp_remove_UE(ue_id_t ue_id) { nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager, ue_id); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); - - return 1; } /* hack: dummy function needed due to LTE dependencies */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index ea88fbfb18..f3a89a2e43 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -63,7 +63,7 @@ void add_drb(int is_gnb, void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid); -bool nr_pdcp_remove_UE(ue_id_t ue_id); +void nr_pdcp_remove_UE(ue_id_t ue_id); void nr_pdcp_reestablishment(ue_id_t ue_id, int rb_id, bool srb_flag); void nr_pdcp_suspend_srb(ue_id_t ue_id, int srb_id); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 389f849b20..258510c29c 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -707,7 +707,6 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, nr_rrc_configure_default_SI(SI_info, sib1); // configure timers and constant nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1); - // take ServingCellConfigCommon and configure L1/L2 nr_rrc_mac_config_req_sib1(instance, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon); break; case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: @@ -1847,6 +1846,163 @@ static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_l } } +void nr_rrc_going_to_IDLE(instance_t instance, + NR_RRCRelease_t *RRCRelease) +{ + NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; + NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; + // reset MAC + nr_rrc_mac_config_req_reset(instance); + // if going to RRC_IDLE was triggered by reception + // of the RRCRelease message including a waitTime + NR_RejectWaitTime_t *waitTime = NULL; + if (RRCRelease) { + struct NR_RRCRelease_IEs *rrcReleaseIEs = RRCRelease->criticalExtensions.choice.rrcRelease; + if(rrcReleaseIEs) { + waitTime = rrcReleaseIEs->nonCriticalExtension ? + rrcReleaseIEs->nonCriticalExtension->waitTime : NULL; + if (waitTime) { + if (tac->T302_active) + tac->T302_cnt = 0; // stop 302 + // start timer T302 with the value set to the waitTime + tac->T302_active = true; + tac->T302_k = *waitTime * 1000; // waitTime is in seconds + // inform upper layers that access barring is applicable + // for all access categories except categories '0' and '2'. + // TODO no idea what that means + LOG_E(NR_RRC,"Go to IDLE. Handling RRCRelease message including a waitTime not implemented\n"); + } + } + } + if (!waitTime) { + if (tac->T302_active) { + tac->T302_cnt = 0; + tac->T302_active = false; + // TODO barring alleviation as in 5.3.14.4 + // not implemented + LOG_E(NR_RRC,"Go to IDLE. Barring alleviation not implemented\n"); + } + } + if (tac->T390_active) { + tac->T390_cnt = 0; + tac->T390_active = false; + // TODO barring alleviation as in 5.3.14.4 + // not implemented + LOG_E(NR_RRC,"Go to IDLE. Barring alleviation not implemented\n"); + } + if (!RRCRelease && rrc->nrRrcState == RRC_STATE_INACTIVE_NR) { + // TODO discard the cell reselection priority information provided by the cellReselectionPriorities + // cell reselection priorities not implemented yet + if (tac->T320_active) { + tac->T320_cnt = 0; + tac->T320_active = false; + } + } + // Stop all the timers except T302, T320 and T325 + tac->T300_active = false; + tac->T300_cnt = 0; + tac->T301_active = false; + tac->T301_cnt = 0; + tac->T304_active = false; + tac->T304_cnt = 0; + tac->T310_active = false; + tac->T310_cnt = 0; + tac->T311_active = false; + tac->T311_cnt = 0; + tac->T319_active = false; + tac->T319_cnt = 0; + + // discard the UE Inactive AS context + // TODO there is no inactive AS context + + // release the suspendConfig + // TODO suspendConfig not handled yet + + // discard the keys (only kgnb is stored) + memset(rrc->kgnb, 0, sizeof(rrc->kgnb)); + + // TODO release all radio resources, including release of the RLC entity, + // the MAC configuration and the associated PDCP entity + // and SDAP for all established RBs + nr_pdcp_remove_UE(rrc->rnti); + nr_rlc_remove_ue(rrc->rnti); + + if(rrc->meas_config) { + ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, rrc->meas_config); + rrc->meas_config = NULL; + } + + for (int i = 0; i < NB_CNX_UE; i++) { + rrcPerNB_t *nb = &rrc->perNB[i]; + NR_UE_RRC_SI_INFO *SI_info = &nb->SInfo; + if(SI_info->sib1) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); + SI_info->sib1 = NULL; + } + if(SI_info->sib2) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB2, SI_info->sib2); + SI_info->sib2 = NULL; + } + if(SI_info->sib3) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB3, SI_info->sib3); + SI_info->sib3 = NULL; + } + if(SI_info->sib4) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB4, SI_info->sib4); + SI_info->sib4 = NULL; + } + if(SI_info->sib5) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB5, SI_info->sib5); + SI_info->sib5 = NULL; + } + if(SI_info->sib6) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB6, SI_info->sib6); + SI_info->sib6 = NULL; + } + if(SI_info->sib7) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB7, SI_info->sib7); + SI_info->sib7 = NULL; + } + if(SI_info->sib8) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB8, SI_info->sib8); + SI_info->sib8 = NULL; + } + if(SI_info->sib9) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB9, SI_info->sib9); + SI_info->sib9 = NULL; + } + if(SI_info->sib10) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB10_r16, SI_info->sib10); + SI_info->sib10 = NULL; + } + if(SI_info->sib11) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB11_r16, SI_info->sib11); + SI_info->sib11 = NULL; + } + if(SI_info->sib12) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB12_r16, SI_info->sib12); + SI_info->sib12 = NULL; + } + if(SI_info->sib13) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB13_r16, SI_info->sib13); + SI_info->sib13 = NULL; + } + if(SI_info->sib14) { + ASN_STRUCT_FREE(asn_DEF_NR_SIB14_r16, SI_info->sib14); + SI_info->sib14 = NULL; + } + } + + nr_rrc_mac_config_req_release(instance); + + // TODO indicate the release of the RRC connection to upper layers + // together with the release cause + + // enter RRC_IDLE + rrc->nrRrcState = RRC_STATE_IDLE_NR; + rrc->rnti = 0; +} + void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) { MessageDef *message_p; diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 998f83e75c..6037d3f1b0 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -148,17 +148,25 @@ typedef struct NR_UE_Timers_Constants_s { // timers status bool T300_active; bool T301_active; + bool T302_active; bool T304_active; bool T310_active; bool T311_active; bool T319_active; + bool T320_active; + bool T325_active; + bool T390_active; // timers uint32_t T300_cnt; uint32_t T301_cnt; + uint32_t T302_cnt; uint32_t T304_cnt; uint32_t T310_cnt; uint32_t T311_cnt; uint32_t T319_cnt; + uint32_t T320_cnt; + uint32_t T325_cnt; + uint32_t T390_cnt; // counters uint32_t N310_cnt; uint32_t N311_cnt; @@ -167,10 +175,14 @@ typedef struct NR_UE_Timers_Constants_s { uint32_t N311_k; uint32_t T300_k; uint32_t T301_k; + uint32_t T302_k; uint32_t T304_k; uint32_t T310_k; uint32_t T311_k; uint32_t T319_k; + uint32_t T320_k; + uint32_t T325_k; + uint32_t T390_k; } NR_UE_Timers_Constants_t; typedef enum { @@ -210,7 +222,7 @@ typedef struct NR_UE_RRC_INST_s { NR_BWP_Id_t dl_bwp_id; NR_BWP_Id_t ul_bwp_id; - /* KeNB as computed from parameters within USIM card */ + /* KgNB as computed from parameters within USIM card */ uint8_t kgnb[32]; /* Used integrity/ciphering algorithms */ //RRC_LIST_TYPE(NR_SecurityAlgorithmConfig_t, NR_SecurityAlgorithmConfig) SecurityAlgorithmConfig_list; From 284b072184f5568868da9769fdde2d3fd5a83f2f Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 11 Aug 2023 18:56:02 +0200 Subject: [PATCH 05/32] procedure to indicate the release of the RRC connection to upper layers --- executables/nr-uesoftmodem.c | 1 + openair2/COMMON/as_message.h | 13 ++++------- openair2/COMMON/rrc_messages_def.h | 1 + openair2/COMMON/rrc_messages_types.h | 11 ++++++++++ openair2/RRC/NR_UE/rrc_UE.c | 32 ++++++++++++---------------- openair2/RRC/NR_UE/rrc_proto.h | 5 +++++ openair3/NAS/NR_UE/nr_nas_msg_sim.c | 23 +++++++++++++------- openair3/NAS/NR_UE/nr_nas_msg_sim.h | 1 + 8 files changed, 52 insertions(+), 35 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 3a5532af43..753738923f 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -402,6 +402,7 @@ static void trigger_deregistration(int sig) { if (!stop_immediately) { MessageDef *msg = itti_alloc_new_message(TASK_RRC_UE_SIM, 0, NAS_DEREGISTRATION_REQ); + NAS_DEREGISTRATION_REQ(msg).cause = AS_DETACH; itti_send_msg_to_task(TASK_NAS_NRUE, 0, msg); stop_immediately = true; static const char m[] = "Press ^C again to trigger immediate shutdown\n"; diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index c4724b5458..4973939976 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -327,15 +327,6 @@ typedef struct nas_establish_req_s { as_nas_info_t initialNasMsg; /* Initial NAS message to transfer */ } nas_establish_req_t; -/* - * fill me - */ -typedef struct nas_deregistration_req_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 - uint32_t dummy; -} nas_deregistration_req_t; - /* * AS->NAS - NAS signalling connection establishment indication * AS transfers the initial NAS message to the NAS. @@ -406,6 +397,10 @@ typedef struct nas_release_ind_s { release_cause_t cause; /* Release cause */ } nas_release_ind_t; +typedef struct nas_deregistration_req_s { + release_cause_t cause; +} nas_deregistration_req_t; + /* * -------------------------------------------------------------------------- * NAS information transfer diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index e1e9fce355..f43d7a8dc5 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -73,6 +73,7 @@ MESSAGE_DEF(NAS_CELL_SELECTION_IND, MESSAGE_PRIORITY_MED, NasCellSelec MESSAGE_DEF(NAS_PAGING_IND, MESSAGE_PRIORITY_MED, NasPagingInd, nas_paging_ind) MESSAGE_DEF(NAS_CONN_ESTABLI_CNF, MESSAGE_PRIORITY_MED, NasConnEstabCnf, nas_conn_establi_cnf) MESSAGE_DEF(NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NasConnReleaseInd, nas_conn_release_ind) +MESSAGE_DEF(NR_NAS_CONN_RELEASE_IND, MESSAGE_PRIORITY_MED, NRNasConnReleaseInd, nr_nas_conn_release_ind) MESSAGE_DEF(NAS_UPLINK_DATA_CNF, MESSAGE_PRIORITY_MED, NasUlDataCnf, nas_ul_data_cnf) MESSAGE_DEF(NAS_DOWNLINK_DATA_IND, MESSAGE_PRIORITY_MED, NasDlDataInd, nas_dl_data_ind) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 2810dcfdd6..b57db907d7 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -82,6 +82,7 @@ #define NAS_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_paging_ind #define NAS_CONN_ESTABLI_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_cnf #define NAS_CONN_RELEASE_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_release_ind +#define NR_NAS_CONN_RELEASE_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_nas_conn_release_ind #define NAS_UPLINK_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_cnf #define NAS_DOWNLINK_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_ind @@ -452,6 +453,16 @@ typedef struct nrrrc_frame_process_s { int gnb_id; } NRRrcFrameProcess; +typedef enum NR_Release_Cause_e { + RRC_CONNECTION_FAILURE, + RRC_RESUME_FAILURE, + OTHER, +} NR_Release_Cause_t; + +typedef struct nr_nas_conn_release_ind { + NR_Release_Cause_t cause; +} NRNasConnReleaseInd; + // eNB: RLC -> RRC messages typedef struct rlc_sdu_indication_s { int rnti; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 258510c29c..84e5de5099 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1334,19 +1334,13 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, case NR_DL_DCCH_MessageType__c1_PR_rrcResume: LOG_I(NR_RRC, "Received rrcResume on DL-DCCH-Message\n"); break; - case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: { - struct NR_RRCRelease__criticalExtensions *ext = &c1->choice.rrcRelease->criticalExtensions; - LOG_I(NR_RRC, "Received RRC Release (gNB %d)\n", gNB_indexP); - MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); - // FixMe: this code do nothing !!!! - if (ext->present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) { - ext->choice.rrcRelease->deprioritisationReq->deprioritisationTimer = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; - ext->choice.rrcRelease->deprioritisationReq->deprioritisationType = - NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; - } - itti_send_msg_to_task(TASK_NAS_NRUE, instance, msg_p); - } break; + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + LOG_I(NR_RRC, "[UE %ld] Received RRC Release (gNB %d)\n", + instance, gNB_indexP); + // TODO properly implement procedures in 5.3.8.3 of 38.331 + NR_Release_Cause_t cause = OTHER; + nr_rrc_going_to_IDLE(instance, cause, dl_dcch_msg->message.choice.c1->choice.rrcRelease); + break; case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: LOG_I(NR_RRC, "Received Capability Enquiry (gNB %d)\n", gNB_indexP); @@ -1847,6 +1841,7 @@ static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_l } void nr_rrc_going_to_IDLE(instance_t instance, + NR_Release_Cause_t release_cause, NR_RRCRelease_t *RRCRelease) { NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; @@ -1867,9 +1862,8 @@ void nr_rrc_going_to_IDLE(instance_t instance, // start timer T302 with the value set to the waitTime tac->T302_active = true; tac->T302_k = *waitTime * 1000; // waitTime is in seconds - // inform upper layers that access barring is applicable + // TODO inform upper layers that access barring is applicable // for all access categories except categories '0' and '2'. - // TODO no idea what that means LOG_E(NR_RRC,"Go to IDLE. Handling RRCRelease message including a waitTime not implemented\n"); } } @@ -1995,12 +1989,14 @@ void nr_rrc_going_to_IDLE(instance_t instance, nr_rrc_mac_config_req_release(instance); - // TODO indicate the release of the RRC connection to upper layers - // together with the release cause - // enter RRC_IDLE rrc->nrRrcState = RRC_STATE_IDLE_NR; rrc->rnti = 0; + + // Indicate the release of the RRC connection to upper layers + MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_NAS_CONN_RELEASE_IND); + NR_NAS_CONN_RELEASE_IND(msg_p).cause = release_cause; + itti_send_msg_to_task(TASK_NAS_NRUE, instance, msg_p); } void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 2d9d19423c..4c2e43ee68 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -92,6 +92,11 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const bool in_sync); + +void nr_rrc_going_to_IDLE(instance_t instance, + NR_Release_Cause_t release_cause, + NR_RRCRelease_t *RRCRelease); + void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success); void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti); diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index f83f1138b6..4b7c4cc45c 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -1137,14 +1137,19 @@ void *nas_nrue(void *args_p) break; } - case NAS_CONN_RELEASE_IND: - LOG_I(NAS, "[UE %ld] Received %s: cause %u\n", instance, ITTI_MSG_NAME(msg_p), NAS_CONN_RELEASE_IND(msg_p).cause); - /* the following is not clean, but probably necessary: we need to give - * time to RLC to Ack the SRB1 PDU which contained the RRC release - * message. Hence, we just below wait some time, before finally - * unblocking the nr-uesoftmodem, which will terminate the process. */ - usleep(100000); - itti_wait_tasks_unblock(); /* will unblock ITTI to stop nr-uesoftmodem */ + case NR_NAS_CONN_RELEASE_IND: + LOG_I(NAS, "[UE %ld] Received %s: cause %u\n", + instance, ITTI_MSG_NAME (msg_p), NR_NAS_CONN_RELEASE_IND (msg_p).cause); + nr_ue_nas_t *nas = get_ue_nas_info(0); + // TODO handle connection release + if (nas->termination_procedure) { + /* the following is not clean, but probably necessary: we need to give + * time to RLC to Ack the SRB1 PDU which contained the RRC release + * message. Hence, we just below wait some time, before finally + * unblocking the nr-uesoftmodem, which will terminate the process. */ + usleep(100000); + itti_wait_tasks_unblock(); /* will unblock ITTI to stop nr-uesoftmodem */ + } break; case NAS_UPLINK_DATA_CNF: @@ -1162,6 +1167,8 @@ void *nas_nrue(void *args_p) nr_ue_nas_t *nas = get_ue_nas_info(0); if (nas->guti) { nas_deregistration_req_t *req = &NAS_DEREGISTRATION_REQ(msg_p); + if (req->cause == AS_DETACH) + nas->termination_procedure = true; as_nas_info_t initialNasMsg = {0}; generateDeregistrationRequest(nas, &initialNasMsg, req); send_nas_uplink_data_req(instance, &initialNasMsg); diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index b1a1d25d1e..b5bb026c0b 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -98,6 +98,7 @@ typedef struct { uicc_t *uicc; ue_sa_security_key_t security; Guti5GSMobileIdentity_t *guti; + bool termination_procedure; } nr_ue_nas_t; typedef enum fgs_protocol_discriminator_e { From 6dc9ec773316e1b6360d0279e741a4f4ac476f51 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 25 Sep 2023 15:49:41 +0200 Subject: [PATCH 06/32] various improvements and fixes --- .../nfapi/public_inc/fapi_nr_ue_interface.h | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 21 ++++++------ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 5 +++ openair2/LAYER2/NR_MAC_UE/mac_proto.h | 3 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 8 +++-- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 33 +++++++++++++++---- openair2/SDAP/nr_sdap/nr_sdap_entity.c | 4 +-- 8 files changed, 53 insertions(+), 25 deletions(-) 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 67dd5d19b7..b28e45ae2d 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 @@ -673,7 +673,7 @@ typedef struct } fapi_nr_prach_config_t; typedef struct { - uint16_t target_Nid_cell; + int16_t target_Nid_cell; } fapi_nr_synch_request_t; typedef struct { diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index ed2afb80f3..234533099c 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -675,9 +675,8 @@ static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst) return (lc_config[id1 - 1]->ul_SpecificParameters->priority - lc_config[id2 - 1]->ul_SpecificParameters->priority); } -void nr_release_mac_config_logicalChannelBearer(module_id_t module_id, long channel_identity) +void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity) { - NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); if (mac->logicalChannelConfig[channel_identity - 1] != NULL) { ASN_STRUCT_FREE(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]); mac->logicalChannelConfig[channel_identity - 1] = NULL; @@ -750,7 +749,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, for (int i = 0; i < rlc_torelease_list->list.count; i++) { if (rlc_torelease_list->list.array[i]) { int lc_identity = *rlc_torelease_list->list.array[i]; - nr_release_mac_config_logicalChannelBearer(module_id, lc_identity); + nr_release_mac_config_logicalChannelBearer(mac, lc_identity); } } } @@ -1351,19 +1350,20 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up } } -void nr_rrc_mac_config_req_reset(module_id_t module_id) +void nr_rrc_mac_config_req_reset(module_id_t module_id, + NR_UE_MAC_reset_cause_t reset_cause) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); reset_mac_inst(mac); -} - -void nr_rrc_mac_config_req_release(module_id_t module_id) -{ - NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - reset_ra(&mac->ra); + release_mac_configuration(mac); + for (int i = 0; i < NR_MAX_NUM_LCID; i++) { + nr_release_mac_config_logicalChannelBearer(mac, i + 1); + memset(&mac->lc_ordered_info[i], 0, sizeof(nr_lcordered_info_t)); + } + mac->first_sync_frame = -1; mac->get_sib1 = false; mac->phy_config_request_sent = false; @@ -1375,6 +1375,7 @@ void nr_rrc_mac_config_req_release(module_id_t module_id) mac->synch_request.CC_id = 0; mac->synch_request.synch_req.target_Nid_cell = -1; mac->if_module->synch_request(&mac->synch_request); + } void nr_rrc_mac_config_req_sib1(module_id_t module_id, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index d687ecf70e..1263f12b5d 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -165,6 +165,11 @@ typedef enum { UE_CONNECTED } NR_UE_L2_STATE_t; +typedef enum { + GO_TO_IDLE, + RE_ESTABLISHMENT +} NR_UE_MAC_reset_cause_t; + typedef enum { RA_2STEP = 0, RA_4STEP diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 599d90d54e..6ba88e6f95 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -170,8 +170,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, NR_SI_SchedulingInfo_t *si_SchedulingInfo, NR_ServingCellConfigCommonSIB_t *scc); -void nr_rrc_mac_config_req_reset(module_id_t module_id); -void nr_rrc_mac_config_req_release(module_id_t module_id); +void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause); /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ NR_UE_MAC_INST_t * nr_l2_init_ue(); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 89394200a3..8ebde18cc7 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -181,17 +181,21 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) void release_mac_configuration(NR_UE_MAC_INST_t *mac) { - if(mac->mib) + if(mac->mib) { ASN_STRUCT_FREE(asn_DEF_NR_MIB, mac->mib); + mac->mib = NULL; + } for (int i = 0; i < 5; i++) { NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5]; release_common_ss_cset(pdcch); for (int j = 0; j < pdcch->list_Coreset.count; j++) asn_sequence_del(&pdcch->list_Coreset, j, 1); for (int j = 0; j < pdcch->list_SS.count; j++) - asn_sequence_del(&pdcch->list_SS, j, 1); + asn_sequence_del(&pdcch->list_SS, j, 1); } + memset(&mac->current_DL_BWP, 0, sizeof(mac->current_DL_BWP)); + memset(&mac->current_UL_BWP, 0, sizeof(mac->current_UL_BWP)); memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); memset(&mac->csirs_measurements, 0, sizeof(mac->csirs_measurements)); memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 383ae37d35..9d5602479a 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -62,7 +62,7 @@ static void release_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t chan return; if (rb->type == NR_RLC_SRB) { int id = rb->choice.srb_id - 1; - AssertFatal(id > 0, "logic bug: impossible to have srb0 here\n"); + AssertFatal(id >= 0, "logic bug: impossible to have srb0 here\n"); if (ue->srb[id]) { ue->srb[id]->delete_entity(ue->srb[id]); ue->srb[id] = NULL; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 84e5de5099..6e85dfef12 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -49,7 +49,6 @@ #include "rrc_defs.h" #include "rrc_proto.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" -#include "COMMON/mac_rrc_primitives.h" #include "intertask_interface.h" @@ -1846,8 +1845,7 @@ void nr_rrc_going_to_IDLE(instance_t instance, { NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; - // reset MAC - nr_rrc_mac_config_req_reset(instance); + // if going to RRC_IDLE was triggered by reception // of the RRCRelease message including a waitTime NR_RejectWaitTime_t *waitTime = NULL; @@ -1915,11 +1913,30 @@ void nr_rrc_going_to_IDLE(instance_t instance, // discard the keys (only kgnb is stored) memset(rrc->kgnb, 0, sizeof(rrc->kgnb)); - // TODO release all radio resources, including release of the RLC entity, + // release all radio resources, including release of the RLC entity, // the MAC configuration and the associated PDCP entity // and SDAP for all established RBs - nr_pdcp_remove_UE(rrc->rnti); - nr_rlc_remove_ue(rrc->rnti); + for (int j = 0; j < NB_CNX_UE; j++) { + rrcPerNB_t *nb = &rrc->perNB[j]; + for (int i = 0; i < MAX_DRBS_PER_UE; i++) { + if (nb->status_DRBs[i] != RB_NOT_PRESENT) { + nb->status_DRBs[i] = RB_NOT_PRESENT; + nr_pdcp_release_drb(rrc->rnti, i); + } + } + for (int i = 1; i < NR_NUM_SRB; i++) { + if (nb->Srb[i] != RB_NOT_PRESENT) { + nb->Srb[i] = RB_NOT_PRESENT; + nr_pdcp_release_srb(rrc->rnti, i); + } + } + for (int i = 0; i < NR_MAX_NUM_LCID; i++) { + if (nb->active_RLC_entity[i]) { + nb->active_RLC_entity[i] = false; + nr_rlc_release_entity(rrc->rnti, i); + } + } + } if(rrc->meas_config) { ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, rrc->meas_config); @@ -1987,7 +2004,9 @@ void nr_rrc_going_to_IDLE(instance_t instance, } } - nr_rrc_mac_config_req_release(instance); + // reset MAC + NR_UE_MAC_reset_cause_t cause = GO_TO_IDLE; + nr_rrc_mac_config_req_reset(instance, cause); // enter RRC_IDLE rrc->nrRrcState = RRC_STATE_IDLE_NR; diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.c b/openair2/SDAP/nr_sdap/nr_sdap_entity.c index f3f8315839..d030eca60e 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c @@ -491,7 +491,7 @@ bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id) int upperBound = 0; if (entityPtr == NULL && (pdusession_id) * (pdusession_id - NGAP_MAX_PDU_SESSION) > 0) { - LOG_W(SDAP, "SDAP entities not established or Invalid range of pdusession_id [0, 256].\n"); + LOG_E(SDAP, "SDAP entities not established or Invalid range of pdusession_id [0, 256].\n"); return ret; } LOG_D(SDAP, "Deleting SDAP entity for UE %lx and PDU Session id %d\n", ue_id, entityPtr->pdusession_id); @@ -516,7 +516,7 @@ bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id) ret = true; } } - LOG_W(SDAP, "Entity does not exist or it was not found.\n"); + LOG_E(SDAP, "Entity does not exist or it was not found.\n"); return ret; } From 0f720d3969b313fb5ce23d30b5d77ed7bfc6b3b9 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 11 Dec 2023 11:40:31 +0100 Subject: [PATCH 07/32] macro based on ASN_STRUCT_RESET to replace ASN_STRUCT_FREE because the latter does not reset to NULL pointers inside the structure --- common/utils/oai_asn1.h | 6 ++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 130 +++++++++---------------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 8 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 7 +- openair2/RRC/NR_UE/rrc_UE.c | 79 ++++----------- 5 files changed, 73 insertions(+), 157 deletions(-) diff --git a/common/utils/oai_asn1.h b/common/utils/oai_asn1.h index f76f75c84c..60a5b39ac5 100644 --- a/common/utils/oai_asn1.h +++ b/common/utils/oai_asn1.h @@ -117,5 +117,11 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) { #define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ asn1cSeqAdd(&VaR,lOcPtr) +#define asn1cFreeStruc(ASN_DEF, STRUCT) \ + do { \ + ASN_STRUCT_RESET(ASN_DEF, STRUCT); \ + free(STRUCT); \ + STRUCT = NULL; \ + } while (0) #endif diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 234533099c..da1930f1b7 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -445,22 +445,12 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, void release_common_ss_cset(NR_BWP_PDCCH_t *pdcch) { - if (pdcch->otherSI_SS) { - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); - pdcch->otherSI_SS = NULL; - } - if (pdcch->ra_SS) { - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->ra_SS); - pdcch->otherSI_SS = NULL; - } - if (pdcch->paging_SS) { - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->paging_SS); - pdcch->paging_SS = NULL; - } - if (pdcch->commonControlResourceSet) { - ASN_STRUCT_FREE(asn_DEF_NR_ControlResourceSet, pdcch->commonControlResourceSet); - pdcch->commonControlResourceSet = NULL; - } + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->ra_SS); + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->paging_SS); + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->search_space_zero); + asn1cFreeStruc(asn_DEF_NR_ControlResourceSet, pdcch->commonControlResourceSet); + asn1cFreeStruc(asn_DEF_NR_ControlResourceSet, pdcch->coreset0); } static void modlist_ss(NR_SearchSpace_t *source, NR_SearchSpace_t *target) @@ -503,15 +493,13 @@ static NR_SearchSpace_t *get_common_search_space(const struct NR_PDCCH_ConfigCom static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCommon_t *pdcch_ConfigCommon) { if (pdcch_ConfigCommon) { - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); - pdcch->otherSI_SS = NULL; + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->otherSI_SS); if (pdcch_ConfigCommon->searchSpaceOtherSystemInformation) pdcch->otherSI_SS = get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, pdcch, *pdcch_ConfigCommon->searchSpaceOtherSystemInformation); - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->ra_SS); - pdcch->ra_SS = NULL; + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->ra_SS); if (pdcch_ConfigCommon->ra_SearchSpace) { if (pdcch->otherSI_SS && *pdcch_ConfigCommon->ra_SearchSpace == pdcch->otherSI_SS->searchSpaceId) pdcch->ra_SS = pdcch->otherSI_SS; @@ -520,8 +508,7 @@ static void configure_common_ss_coreset(NR_BWP_PDCCH_t *pdcch, NR_PDCCH_ConfigCo get_common_search_space(pdcch_ConfigCommon->commonSearchSpaceList, pdcch, *pdcch_ConfigCommon->ra_SearchSpace); } - ASN_STRUCT_FREE(asn_DEF_NR_SearchSpace, pdcch->paging_SS); - pdcch->paging_SS = NULL; + asn1cFreeStruc(asn_DEF_NR_SearchSpace, pdcch->paging_SS); if (pdcch_ConfigCommon->pagingSearchSpace) { if (pdcch->otherSI_SS && *pdcch_ConfigCommon->pagingSearchSpace == pdcch->otherSI_SS->searchSpaceId) pdcch->paging_SS = pdcch->otherSI_SS; @@ -678,9 +665,9 @@ static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst) void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity) { if (mac->logicalChannelConfig[channel_identity - 1] != NULL) { - ASN_STRUCT_FREE(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]); - mac->logicalChannelConfig[channel_identity - 1] = NULL; - } else { + asn1cFreeStruc(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]); + } + else { LOG_E(NR_MAC, "Trying to release a non configured logical channel bearer %li\n", channel_identity); } } @@ -907,10 +894,8 @@ static void setup_puschconfig(NR_PUSCH_Config_t *source, NR_PUSCH_Config_t *targ UPDATE_MAC_IE(target->rbg_Size, source->rbg_Size, long); UPDATE_MAC_IE(target->tp_pi2BPSK, source->tp_pi2BPSK, long); if (source->uci_OnPUSCH) { - if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_UCI_OnPUSCH, target->uci_OnPUSCH); - target->uci_OnPUSCH = NULL; - } + if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_release) + asn1cFreeStruc(asn_DEF_NR_UCI_OnPUSCH, target->uci_OnPUSCH); if (source->uci_OnPUSCH->present == NR_SetupRelease_UCI_OnPUSCH_PR_setup) { if (target->uci_OnPUSCH) { target->uci_OnPUSCH->choice.setup->scaling = source->uci_OnPUSCH->choice.setup->scaling; @@ -1208,11 +1193,9 @@ static void configure_dedicated_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP NR_UE_DL_BWP_t *bwp = get_dl_bwp_structure(mac, bwp_id, true); bwp->bwp_id = bwp_id; NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; - if (dl_dedicated->pdsch_Config) { - if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); - bwp->pdsch_Config = NULL; - } + if(dl_dedicated->pdsch_Config) { + if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_release) + asn1cFreeStruc(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); if (dl_dedicated->pdsch_Config->present == NR_SetupRelease_PDSCH_Config_PR_setup) { if (!bwp->pdsch_Config) bwp->pdsch_Config = calloc(1, sizeof(*bwp->pdsch_Config)); @@ -1237,33 +1220,27 @@ static void configure_dedicated_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP if (ul_dedicated) { NR_UE_UL_BWP_t *bwp = get_ul_bwp_structure(mac, bwp_id, true); bwp->bwp_id = bwp_id; - if (ul_dedicated->pucch_Config) { - if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config); - bwp->pucch_Config = NULL; - } + if(ul_dedicated->pucch_Config) { + if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_release) + asn1cFreeStruc(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config); if (ul_dedicated->pucch_Config->present == NR_SetupRelease_PUCCH_Config_PR_setup) { if (!bwp->pucch_Config) bwp->pucch_Config = calloc(1, sizeof(*bwp->pucch_Config)); setup_pucchconfig(ul_dedicated->pucch_Config->choice.setup, bwp->pucch_Config); } } - if (ul_dedicated->pusch_Config) { - if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); - bwp->pusch_Config = NULL; - } + if(ul_dedicated->pusch_Config) { + if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_release) + asn1cFreeStruc(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); if (ul_dedicated->pusch_Config->present == NR_SetupRelease_PUSCH_Config_PR_setup) { if (!bwp->pusch_Config) bwp->pusch_Config = calloc(1, sizeof(*bwp->pusch_Config)); setup_puschconfig(ul_dedicated->pusch_Config->choice.setup, bwp->pusch_Config); } } - if (ul_dedicated->srs_Config) { - if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, bwp->srs_Config); - bwp->srs_Config = NULL; - } + if(ul_dedicated->srs_Config) { + if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_release) + asn1cFreeStruc(asn_DEF_NR_SRS_Config, bwp->srs_Config); if (ul_dedicated->srs_Config->present == NR_SetupRelease_SRS_Config_PR_setup) { if (!bwp->srs_Config) bwp->srs_Config = calloc(1, sizeof(*bwp->srs_Config)); @@ -1293,10 +1270,8 @@ static void configure_common_BWP_dl(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Do UPDATE_MAC_IE(bwp->tdaList_Common, dl_common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList, NR_PDSCH_TimeDomainResourceAllocationList_t); - if (dl_common->pdsch_ConfigCommon->present == NR_SetupRelease_PDSCH_ConfigCommon_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); - bwp->tdaList_Common = NULL; - } + if (dl_common->pdsch_ConfigCommon->present == NR_SetupRelease_PDSCH_ConfigCommon_PR_release) + asn1cFreeStruc(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); } NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; if (dl_common->pdcch_ConfigCommon) { @@ -1341,8 +1316,7 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up UPDATE_MAC_IE(bwp->msg3_DeltaPreamble, ul_common->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble, long); } if (ul_common->pusch_ConfigCommon->present == NR_SetupRelease_PUSCH_ConfigCommon_PR_release) { - ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); - bwp->tdaList_Common = NULL; + asn1cFreeStruc(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); free(bwp->msg3_DeltaPreamble); bwp->msg3_DeltaPreamble = NULL; } @@ -1613,9 +1587,8 @@ static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, struct NR_Set switch (csi_MeasConfig_sr->present) { case NR_SetupRelease_CSI_MeasConfig_PR_NOTHING: break; - case NR_SetupRelease_CSI_MeasConfig_PR_release: - ASN_STRUCT_FREE(asn_DEF_NR_CSI_MeasConfig, sc_info->csi_MeasConfig); - sc_info->csi_MeasConfig = NULL; + case NR_SetupRelease_CSI_MeasConfig_PR_release : + asn1cFreeStruc(asn_DEF_NR_CSI_MeasConfig, sc_info->csi_MeasConfig); break; case NR_SetupRelease_CSI_MeasConfig_PR_setup: if (!sc_info->csi_MeasConfig) { // setup @@ -1757,10 +1730,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser break; case NR_SetupRelease_PDSCH_ServingCellConfig_PR_release: // release all configurations - if (sc_info->pdsch_CGB_Transmission) { - ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_CodeBlockGroupTransmission, sc_info->pdsch_CGB_Transmission); - sc_info->pdsch_CGB_Transmission = NULL; - } + if (sc_info->pdsch_CGB_Transmission) + asn1cFreeStruc(asn_DEF_NR_PDSCH_CodeBlockGroupTransmission, sc_info->pdsch_CGB_Transmission); if (sc_info->xOverhead_PDSCH) { free(sc_info->xOverhead_PDSCH); sc_info->xOverhead_PDSCH = NULL; @@ -1792,10 +1763,8 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser break; case NR_SetupRelease_PUSCH_ServingCellConfig_PR_release: // release all configurations - if (sc_info->pusch_CGB_Transmission) { - ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_CodeBlockGroupTransmission, sc_info->pusch_CGB_Transmission); - sc_info->pdsch_CGB_Transmission = NULL; - } + if (sc_info->pusch_CGB_Transmission) + asn1cFreeStruc(asn_DEF_NR_PUSCH_CodeBlockGroupTransmission, sc_info->pusch_CGB_Transmission); if (sc_info->rateMatching_PUSCH) { free(sc_info->rateMatching_PUSCH); sc_info->rateMatching_PUSCH = NULL; @@ -1840,10 +1809,8 @@ void release_dl_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) } AssertFatal(bwp, "No DL-BWP %d to release\n", bwp_id); free(bwp->cyclicprefix); - ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); - bwp->tdaList_Common = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); - bwp->pdsch_Config = NULL; + asn1cFreeStruc(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); + asn1cFreeStruc(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); free(bwp); NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[bwp_id]; @@ -1866,20 +1833,13 @@ void release_ul_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) } AssertFatal(bwp, "No UL-BWP %d to release\n", bwp_id); free(bwp->cyclicprefix); - ASN_STRUCT_FREE(asn_DEF_NR_RACH_ConfigCommon, bwp->rach_ConfigCommon); - bwp->rach_ConfigCommon = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); - bwp->tdaList_Common = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_ConfiguredGrantConfig, bwp->configuredGrantConfig); - bwp->configuredGrantConfig = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); - bwp->pusch_Config = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config); - bwp->pucch_Config = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_PUCCH_ConfigCommon, bwp->pucch_ConfigCommon); - bwp->pucch_ConfigCommon = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, bwp->srs_Config); - bwp->srs_Config = NULL; + asn1cFreeStruc(asn_DEF_NR_RACH_ConfigCommon, bwp->rach_ConfigCommon); + asn1cFreeStruc(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); + asn1cFreeStruc(asn_DEF_NR_ConfiguredGrantConfig, bwp->configuredGrantConfig); + asn1cFreeStruc(asn_DEF_NR_PUSCH_Config, bwp->pusch_Config); + asn1cFreeStruc(asn_DEF_NR_PUCCH_Config, bwp->pucch_Config); + asn1cFreeStruc(asn_DEF_NR_PUCCH_ConfigCommon, bwp->pucch_ConfigCommon); + asn1cFreeStruc(asn_DEF_NR_SRS_Config, bwp->srs_Config); free(bwp->msg3_DeltaPreamble); free(bwp); } @@ -1957,5 +1917,5 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, if (!mac->dl_config_request || !mac->ul_config_request) ue_init_config_request(mac, mac->current_DL_BWP->scs); - ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, cell_group_config); + asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, cell_group_config); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 6ba88e6f95..ab1d4a3d4f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -34,6 +34,7 @@ #define __LAYER2_MAC_UE_PROTO_H__ #include "mac_defs.h" +#include "oai_asn1.h" #include "RRC/NR_UE/rrc_defs.h" #define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */ @@ -49,8 +50,7 @@ #define HANDLE_SETUPRELEASE_DIRECT(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ do { \ if (ORIGIN->present == 1) { \ - ASN_STRUCT_FREE(ASN_DEF, DESTINATION); \ - DESTINATION = NULL; \ + asn1cFreeStruc(ASN_DEF, DESTINATION); \ } \ if (ORIGIN->present == 2) \ UPDATE_MAC_IE(DESTINATION, ORIGIN->choice.setup, TYPE); \ @@ -59,8 +59,7 @@ #define HANDLE_SETUPRELEASE_IE(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ do { \ if (ORIGIN->present == 1) { \ - ASN_STRUCT_FREE(ASN_DEF, DESTINATION); \ - DESTINATION = NULL; \ + asn1cFreeStruc(ASN_DEF, DESTINATION); \ } \ if (ORIGIN->present == 2) { \ if (!DESTINATION) \ @@ -123,7 +122,6 @@ } \ } while (0) - /**\brief initialize the field in nr_mac instance \param module_id module id */ void nr_ue_init_mac(module_id_t module_idP); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 8ebde18cc7..ac6539820f 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -181,10 +181,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) void release_mac_configuration(NR_UE_MAC_INST_t *mac) { - if(mac->mib) { - ASN_STRUCT_FREE(asn_DEF_NR_MIB, mac->mib); - mac->mib = NULL; - } + asn1cFreeStruc(asn_DEF_NR_MIB, mac->mib); for (int i = 0; i < 5; i++) { NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5]; release_common_ss_cset(pdcch); @@ -204,6 +201,6 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac) void reset_ra(RA_config_t *ra) { if(ra->rach_ConfigDedicated) - ASN_STRUCT_FREE(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated); + asn1cFreeStruc(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated); memset(ra, 0, sizeof(RA_config_t)); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 6e85dfef12..53fbfb3d37 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -688,8 +688,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, switch (bcch_message->message.choice.c1->present) { case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: LOG_D(NR_RRC, "[UE %ld] Decoding SIB1\n", instance); - ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); - SI_info->sib1 = NULL; + asn1cFreeStruc(asn_DEF_NR_SIB1, SI_info->sib1); NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if(!SI_info->sib1) SI_info->sib1 = calloc(1, sizeof(*SI_info->sib1)); @@ -1938,70 +1937,26 @@ void nr_rrc_going_to_IDLE(instance_t instance, } } - if(rrc->meas_config) { - ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, rrc->meas_config); - rrc->meas_config = NULL; - } + asn1cFreeStruc(asn_DEF_NR_MeasConfig, rrc->meas_config); + rrc->meas_config = NULL; for (int i = 0; i < NB_CNX_UE; i++) { rrcPerNB_t *nb = &rrc->perNB[i]; NR_UE_RRC_SI_INFO *SI_info = &nb->SInfo; - if(SI_info->sib1) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); - SI_info->sib1 = NULL; - } - if(SI_info->sib2) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB2, SI_info->sib2); - SI_info->sib2 = NULL; - } - if(SI_info->sib3) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB3, SI_info->sib3); - SI_info->sib3 = NULL; - } - if(SI_info->sib4) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB4, SI_info->sib4); - SI_info->sib4 = NULL; - } - if(SI_info->sib5) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB5, SI_info->sib5); - SI_info->sib5 = NULL; - } - if(SI_info->sib6) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB6, SI_info->sib6); - SI_info->sib6 = NULL; - } - if(SI_info->sib7) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB7, SI_info->sib7); - SI_info->sib7 = NULL; - } - if(SI_info->sib8) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB8, SI_info->sib8); - SI_info->sib8 = NULL; - } - if(SI_info->sib9) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB9, SI_info->sib9); - SI_info->sib9 = NULL; - } - if(SI_info->sib10) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB10_r16, SI_info->sib10); - SI_info->sib10 = NULL; - } - if(SI_info->sib11) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB11_r16, SI_info->sib11); - SI_info->sib11 = NULL; - } - if(SI_info->sib12) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB12_r16, SI_info->sib12); - SI_info->sib12 = NULL; - } - if(SI_info->sib13) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB13_r16, SI_info->sib13); - SI_info->sib13 = NULL; - } - if(SI_info->sib14) { - ASN_STRUCT_FREE(asn_DEF_NR_SIB14_r16, SI_info->sib14); - SI_info->sib14 = NULL; - } + asn1cFreeStruc(asn_DEF_NR_SIB1, SI_info->sib1); + asn1cFreeStruc(asn_DEF_NR_SIB2, SI_info->sib2); + asn1cFreeStruc(asn_DEF_NR_SIB3, SI_info->sib3); + asn1cFreeStruc(asn_DEF_NR_SIB4, SI_info->sib4); + asn1cFreeStruc(asn_DEF_NR_SIB5, SI_info->sib5); + asn1cFreeStruc(asn_DEF_NR_SIB6, SI_info->sib6); + asn1cFreeStruc(asn_DEF_NR_SIB7, SI_info->sib7); + asn1cFreeStruc(asn_DEF_NR_SIB8, SI_info->sib8); + asn1cFreeStruc(asn_DEF_NR_SIB9, SI_info->sib9); + asn1cFreeStruc(asn_DEF_NR_SIB10_r16, SI_info->sib10); + asn1cFreeStruc(asn_DEF_NR_SIB11_r16, SI_info->sib11); + asn1cFreeStruc(asn_DEF_NR_SIB12_r16, SI_info->sib12); + asn1cFreeStruc(asn_DEF_NR_SIB13_r16, SI_info->sib13); + asn1cFreeStruc(asn_DEF_NR_SIB14_r16, SI_info->sib14); } // reset MAC From c18d5931f00c120e1873aa992254e7d710e02cc7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 11 Dec 2023 13:38:30 +0100 Subject: [PATCH 08/32] using new macros and functions in releasing the MAC configuration and fixes after testing resync --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 98 +++++++++++++++----------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 4 ++ openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 50 +++++++++---- 3 files changed, 97 insertions(+), 55 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index da1930f1b7..146e7a6f4f 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -667,9 +667,6 @@ void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long chan if (mac->logicalChannelConfig[channel_identity - 1] != NULL) { asn1cFreeStruc(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]); } - else { - LOG_E(NR_MAC, "Trying to release a non configured logical channel bearer %li\n", channel_identity); - } } static uint16_t nr_get_ms_bucketsizeduration(uint8_t bucketsizeduration) @@ -964,7 +961,21 @@ static void setup_pdschconfig(NR_PDSCH_Config_t *source, NR_PDSCH_Config_t *targ target->rbg_Size = source->rbg_Size; UPDATE_MAC_IE(target->mcs_Table, source->mcs_Table, long); UPDATE_MAC_IE(target->maxNrofCodeWordsScheduledByDCI, source->maxNrofCodeWordsScheduledByDCI, long); - target->prb_BundlingType = source->prb_BundlingType; + target->prb_BundlingType.present = source->prb_BundlingType.present; + switch (source->prb_BundlingType.present) { + case NR_PDSCH_Config__prb_BundlingType_PR_staticBundling: + UPDATE_MAC_IE(target->prb_BundlingType.choice.staticBundling, + source->prb_BundlingType.choice.staticBundling, + struct NR_PDSCH_Config__prb_BundlingType__staticBundling); + break; + case NR_PDSCH_Config__prb_BundlingType_PR_dynamicBundling: + UPDATE_MAC_IE(target->prb_BundlingType.choice.dynamicBundling, + source->prb_BundlingType.choice.dynamicBundling, + struct NR_PDSCH_Config__prb_BundlingType__dynamicBundling); + break; + default: + break; + } AssertFatal(source->zp_CSI_RS_ResourceToAddModList == NULL, "Not handled\n"); AssertFatal(source->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n"); AssertFatal(source->sp_ZP_CSI_RS_ResourceSetsToAddModList == NULL, "Not handled\n"); @@ -1095,7 +1106,26 @@ static void setup_srsresourceset(NR_SRS_ResourceSet_t *target, NR_SRS_ResourceSe target->srs_ResourceSetId = source->srs_ResourceSetId; if (source->srs_ResourceIdList) UPDATE_MAC_IE(target->srs_ResourceIdList, source->srs_ResourceIdList, struct NR_SRS_ResourceSet__srs_ResourceIdList); - target->resourceType = source->resourceType; + target->resourceType.present = source->resourceType.present; + switch (source->resourceType.present) { + case NR_SRS_ResourceSet__resourceType_PR_aperiodic: + UPDATE_MAC_IE(target->resourceType.choice.aperiodic, + source->resourceType.choice.aperiodic, + struct NR_SRS_ResourceSet__resourceType__aperiodic); + break; + case NR_SRS_ResourceSet__resourceType_PR_periodic: + UPDATE_MAC_IE(target->resourceType.choice.periodic, + source->resourceType.choice.periodic, + struct NR_SRS_ResourceSet__resourceType__periodic); + break; + case NR_SRS_ResourceSet__resourceType_PR_semi_persistent: + UPDATE_MAC_IE(target->resourceType.choice.semi_persistent, + source->resourceType.choice.semi_persistent, + struct NR_SRS_ResourceSet__resourceType__semi_persistent); + break; + default: + break; + } target->usage = source->usage; UPDATE_MAC_IE(target->alpha, source->alpha, NR_Alpha_t); if (source->p0) @@ -1330,18 +1360,8 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); reset_mac_inst(mac); reset_ra(&mac->ra); - release_mac_configuration(mac); - - for (int i = 0; i < NR_MAX_NUM_LCID; i++) { - nr_release_mac_config_logicalChannelBearer(mac, i + 1); - memset(&mac->lc_ordered_info[i], 0, sizeof(nr_lcordered_info_t)); - } - - mac->first_sync_frame = -1; - mac->get_sib1 = false; - mac->phy_config_request_sent = false; - mac->state = UE_NOT_SYNC; + nr_ue_init_mac(module_id); // Sending to PHY a request to resync // with no target cell ID @@ -1797,17 +1817,12 @@ static void configure_servingcell_info(NR_UE_ServingCell_Info_t *sc_info, NR_Ser } } -void release_dl_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) +void release_dl_BWP(NR_UE_MAC_INST_t *mac, int index) { - NR_UE_DL_BWP_t *bwp = NULL; - for (int i = 0; i < mac->dl_BWPs.count; i++) { - if (bwp_id == mac->dl_BWPs.array[i]->bwp_id) { - bwp = mac->dl_BWPs.array[i]; - asn_sequence_del(&mac->dl_BWPs, i, 0); - break; - } - } - AssertFatal(bwp, "No DL-BWP %d to release\n", bwp_id); + NR_UE_DL_BWP_t *bwp = mac->dl_BWPs.array[index]; + int bwp_id = bwp->bwp_id; + asn_sequence_del(&mac->dl_BWPs, index, 0); + free(bwp->cyclicprefix); asn1cFreeStruc(asn_DEF_NR_PDSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); asn1cFreeStruc(asn_DEF_NR_PDSCH_Config, bwp->pdsch_Config); @@ -1821,17 +1836,11 @@ void release_dl_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) asn_sequence_del(&pdcch->list_SS, i, 1); } -void release_ul_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) +void release_ul_BWP(NR_UE_MAC_INST_t *mac, int index) { - NR_UE_UL_BWP_t *bwp = NULL; - for (int i = 0; i < mac->ul_BWPs.count; i++) { - if (bwp_id == mac->ul_BWPs.array[i]->bwp_id) { - bwp = mac->ul_BWPs.array[i]; - asn_sequence_del(&mac->ul_BWPs, i, 0); - break; - } - } - AssertFatal(bwp, "No UL-BWP %d to release\n", bwp_id); + NR_UE_UL_BWP_t *bwp = mac->ul_BWPs.array[index]; + asn_sequence_del(&mac->ul_BWPs, index, 0); + free(bwp->cyclicprefix); asn1cFreeStruc(asn_DEF_NR_RACH_ConfigCommon, bwp->rach_ConfigCommon); asn1cFreeStruc(asn_DEF_NR_PUSCH_TimeDomainResourceAllocationList, bwp->tdaList_Common); @@ -1841,6 +1850,7 @@ void release_ul_BWP(NR_UE_MAC_INST_t *mac, int bwp_id) asn1cFreeStruc(asn_DEF_NR_PUCCH_ConfigCommon, bwp->pucch_ConfigCommon); asn1cFreeStruc(asn_DEF_NR_SRS_Config, bwp->srs_Config); free(bwp->msg3_DeltaPreamble); + bwp->msg3_DeltaPreamble = NULL; free(bwp); } @@ -1848,8 +1858,12 @@ static void configure_BWPs(NR_UE_MAC_INST_t *mac, NR_ServingCellConfig_t *scd) { configure_dedicated_BWP_dl(mac, 0, scd->initialDownlinkBWP); if (scd->downlinkBWP_ToReleaseList) { - for (int i = 0; i < scd->downlinkBWP_ToReleaseList->list.count; i++) - release_dl_BWP(mac, *scd->downlinkBWP_ToReleaseList->list.array[i]); + for (int i = 0; i < scd->downlinkBWP_ToReleaseList->list.count; i++) { + for (int j = 0; j < mac->dl_BWPs.count; j++) { + if (*scd->downlinkBWP_ToReleaseList->list.array[i] == mac->dl_BWPs.array[i]->bwp_id) + release_dl_BWP(mac, i); + } + } } if (scd->downlinkBWP_ToAddModList) { for (int i = 0; i < scd->downlinkBWP_ToAddModList->list.count; i++) { @@ -1866,8 +1880,12 @@ static void configure_BWPs(NR_UE_MAC_INST_t *mac, NR_ServingCellConfig_t *scd) if (scd->uplinkConfig) { configure_dedicated_BWP_ul(mac, 0, scd->uplinkConfig->initialUplinkBWP); if (scd->uplinkConfig->uplinkBWP_ToReleaseList) { - for (int i = 0; i < scd->uplinkConfig->uplinkBWP_ToReleaseList->list.count; i++) - release_ul_BWP(mac, *scd->uplinkConfig->uplinkBWP_ToReleaseList->list.array[i]); + for (int i = 0; i < scd->uplinkConfig->uplinkBWP_ToReleaseList->list.count; i++) { + for (int j = 0; j < mac->ul_BWPs.count; j++) { + if (*scd->uplinkConfig->uplinkBWP_ToReleaseList->list.array[i] == mac->ul_BWPs.array[i]->bwp_id) + release_ul_BWP(mac, i); + } + } } if (scd->uplinkConfig->uplinkBWP_ToAddModList) { for (int i = 0; i < scd->uplinkConfig->uplinkBWP_ToAddModList->list.count; i++) { diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index ab1d4a3d4f..6c8bc81582 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -150,6 +150,10 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, uint8_t *pduP, uint32_t pdu_len); +void release_dl_BWP(NR_UE_MAC_INST_t *mac, int index); +void release_ul_BWP(NR_UE_MAC_INST_t *mac, int index); +void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity); + void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_toadd_list, struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index ac6539820f..9df80f8abf 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -64,7 +64,6 @@ void nr_ue_init_mac(module_id_t module_idP) { LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); - nr_ue_mac_default_configs(mac); mac->first_sync_frame = -1; mac->get_sib1 = false; mac->get_otherSI = false; @@ -73,6 +72,8 @@ void nr_ue_init_mac(module_id_t module_idP) mac->state = UE_NOT_SYNC; mac->si_window_start = -1; mac->servCellIndex = 0; + mac->harq_ACK_SpatialBundlingPUCCH = false; + mac->harq_ACK_SpatialBundlingPUSCH = false; } void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) @@ -112,12 +113,13 @@ NR_UE_MAC_INST_t *nr_l2_init_ue() //init mac here nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t)); - for (int j = 0; j < NB_NR_UE_MAC_INST; j++) + for (int j = 0; j < NB_NR_UE_MAC_INST; j++) { nr_ue_init_mac(j); - - if (get_softmodem_params()->sa) - ue_init_config_request(nr_ue_mac_inst, get_softmodem_params()->numerology); - + NR_UE_MAC_INST_t *mac = get_mac_inst(j); + nr_ue_mac_default_configs(mac); + if (get_softmodem_params()->sa) + ue_init_config_request(mac, get_softmodem_params()->numerology); + } int rc = rlc_module_init(0); AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); @@ -182,17 +184,35 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) void release_mac_configuration(NR_UE_MAC_INST_t *mac) { asn1cFreeStruc(asn_DEF_NR_MIB, mac->mib); - for (int i = 0; i < 5; i++) { - NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5]; - release_common_ss_cset(pdcch); - for (int j = 0; j < pdcch->list_Coreset.count; j++) - asn_sequence_del(&pdcch->list_Coreset, j, 1); - for (int j = 0; j < pdcch->list_SS.count; j++) - asn_sequence_del(&pdcch->list_SS, j, 1); + asn1cFreeStruc(asn_DEF_NR_SI_SchedulingInfo, mac->si_SchedulingInfo); + asn1cFreeStruc(asn_DEF_NR_TDD_UL_DL_ConfigCommon, mac->tdd_UL_DL_ConfigurationCommon); + NR_UE_ServingCell_Info_t *sc = &mac->sc_info; + asn1cFreeStruc(asn_DEF_NR_CrossCarrierSchedulingConfig, sc->crossCarrierSchedulingConfig); + asn1cFreeStruc(asn_DEF_NR_SRS_CarrierSwitching, sc->carrierSwitching); + asn1cFreeStruc(asn_DEF_NR_UplinkConfig, sc->supplementaryUplink); + asn1cFreeStruc(asn_DEF_NR_PDSCH_CodeBlockGroupTransmission, sc->pdsch_CGB_Transmission); + asn1cFreeStruc(asn_DEF_NR_PUSCH_CodeBlockGroupTransmission, sc->pusch_CGB_Transmission); + asn1cFreeStruc(asn_DEF_NR_CSI_MeasConfig, sc->csi_MeasConfig); + asn1cFreeStruc(asn_DEF_NR_CSI_AperiodicTriggerStateList, sc->aperiodicTriggerStateList); + free(sc->xOverhead_PDSCH); + free(sc->nrofHARQ_ProcessesForPDSCH); + free(sc->rateMatching_PUSCH); + free(sc->xOverhead_PUSCH); + free(sc->maxMIMO_Layers_PUSCH); + memset(&mac->sc_info, 0, sizeof(mac->sc_info)); + + for (int i = 0; i < mac->dl_BWPs.count; i++) + release_dl_BWP(mac, i); + for (int i = 0; i < mac->ul_BWPs.count; i++) + release_ul_BWP(mac, i); + mac->current_DL_BWP = NULL; + mac->current_UL_BWP = NULL; + + for (int i = 0; i < NR_MAX_NUM_LCID; i++) { + nr_release_mac_config_logicalChannelBearer(mac, i + 1); + memset(&mac->lc_ordered_info[i], 0, sizeof(nr_lcordered_info_t)); } - memset(&mac->current_DL_BWP, 0, sizeof(mac->current_DL_BWP)); - memset(&mac->current_UL_BWP, 0, sizeof(mac->current_UL_BWP)); memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); memset(&mac->csirs_measurements, 0, sizeof(mac->csirs_measurements)); memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); From 52c68dbec727a44abc15761099ba82b92cc68638 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 19 Dec 2023 19:55:19 +0100 Subject: [PATCH 09/32] adding macro descriptions --- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 6c8bc81582..f762665711 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -40,6 +40,8 @@ #define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */ #define NR_DL_MAX_NB_CW (2) /* number of downlink code word */ +// Macro updates DESTINATION with configuration from ORIGIN by swapping pointers +// Old configuration is freed after completing configuration #define UPDATE_MAC_IE(DESTINATION, ORIGIN, TYPE) \ do { \ TYPE *tmp = ORIGIN; \ @@ -47,6 +49,10 @@ DESTINATION = tmp; \ } while(0); \ +// Macro handles reception of SetupRelease element ORIGIN (see NR_SetupRelease.h) +// If release (NR_SetupRelease_xxx_PR_release equivalent to 1), removing structure from DESTINATION +// If setup (NR_SetupRelease_xxx_PR_setup equivalent to 2), add or modify structure in DESTINATION +// Destination is not a SetupRelease structure #define HANDLE_SETUPRELEASE_DIRECT(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ do { \ if (ORIGIN->present == 1) { \ @@ -56,6 +62,10 @@ UPDATE_MAC_IE(DESTINATION, ORIGIN->choice.setup, TYPE); \ } while(0); \ +// Macro handles reception of SetupRelease element ORIGIN (see NR_SetupRelease.h) +// If release (NR_SetupRelease_xxx_PR_release equivalent to 1), removing structure from DESTINATION +// If setup (NR_SetupRelease_xxx_PR_setup equivalent to 2), add or modify structure in DESTINATION +// Destination is a SetupRelease structure #define HANDLE_SETUPRELEASE_IE(DESTINATION, ORIGIN, TYPE, ASN_DEF) \ do { \ if (ORIGIN->present == 1) { \ @@ -69,6 +79,8 @@ } \ } while(0); \ +// Macro releases entries in list TARGET if the corresponding ID is found in list SOURCE. +// Prints an error if ID not found in list. #define RELEASE_IE_FROMLIST(SOURCE, TARGET, FIELD) \ do { \ for (int iI = 0; iI < SOURCE->list.count; iI++) { \ @@ -85,6 +97,7 @@ } \ } while (0) \ +// Macro adds or modifies entries of type TYPE in list TARGET with elements received in list SOURCE #define ADDMOD_IE_FROMLIST(SOURCE, TARGET, FIELD, TYPE) \ do { \ for (int iI = 0; iI < SOURCE->list.count; iI++) { \ @@ -104,6 +117,8 @@ } \ } while (0) \ +// Macro adds or modifies entries of type TYPE in list TARGET with elements received in list SOURCE +// Action performed by function FUNC #define ADDMOD_IE_FROMLIST_WFUNCTION(SOURCE, TARGET, FIELD, TYPE, FUNC) \ do { \ for (int iI = 0; iI < SOURCE->list.count; iI++) { \ From 693f668d450022cca82be201f308a9656ad5d0d1 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 20 Dec 2023 12:57:24 +0100 Subject: [PATCH 10/32] Change AmariUE conf file - use 2 UL antennas --- ci-scripts/ci_ueinfra.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index 9d70d9f1c0..f5aabf9167 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -49,7 +49,7 @@ adb_ue_2: amarisoft_ue: Host: amariue - InitScript: /root/lteue-linux-2023-10-27/ue/lteue /root/oaicicd/ran_sa_aw2s_asue/aw2s-multi-20897-2x2.cfg & + InitScript: /root/lteue-linux-2023-10-27/ue/lteue /root/oaicicd/ran_sa_aw2s_asue_2x2/aw2s-multi-20897-2x2.cfg & TermScript: /root/2023-10-27/libs/ws.js -t 10 127.0.0.1:9002 '{"message":"quit"}' || killall -KILL lteue-avx2 amarisoft_ue_1: Host: amariue From 5b17519e706256adeb31cca94d82cf3a5bc4db07 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 20 Dec 2023 13:14:09 +0100 Subject: [PATCH 11/32] Add new Amariue conf file --- ci-scripts/as_ue/aw2s-multi-20897-2x2.cfg | 281 ++++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 ci-scripts/as_ue/aw2s-multi-20897-2x2.cfg diff --git a/ci-scripts/as_ue/aw2s-multi-20897-2x2.cfg b/ci-scripts/as_ue/aw2s-multi-20897-2x2.cfg new file mode 100644 index 0000000000..b9707b801e --- /dev/null +++ b/ci-scripts/as_ue/aw2s-multi-20897-2x2.cfg @@ -0,0 +1,281 @@ +/* UE simulator configuration file version 2021-06-17 + * LTE / 5G Non StandAlone + * Copyright (C) 2019-2021 Amarisoft + */ +{ +#define N_ANTENNA_DL 2 +#define N_ANTENNA_UL 2 +#define TDD 1 + +log_options: "all.level=warn,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", +log_filename: "/tmp/ue.log", + +/* Enable remote API and Web interface */ +com_addr: "0.0.0.0:9002", + +include "rf_driver/1chan.cfg", + +/* If true, allow the simulation of several UEs at the same time and +allow dynamic UE creation from remote API */ + + cell_groups: [{ + group_type: "nr", + multi_ue: true, + cells: [{ + rf_port: 0, + bandwidth: 20, + band: 78, + dl_nr_arfcn:627360, + ssb_nr_arfcn:627360, + subcarrier_spacing: 30, + n_antenna_dl: N_ANTENNA_DL, + n_antenna_ul: N_ANTENNA_UL, + rx_to_tx_latency:2, + }], + }], + + /* UE capabilities */ + /* USIM data */ + ue_list: [ + { + "ue_id" : 1, + "imsi": "208970000000111", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 2, + "imsi": "208970000000112", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 3, + "imsi": "208970000000113", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 4, + "imsi": "208970000000114", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 5, + "imsi": "208970000000115", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 6, + "imsi": "208970000000116", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 7, + "imsi": "208970000000100", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 8, + "imsi": "208970000000102", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 9, + "imsi": "208970000000103", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 10, + "imsi": "208970000000104", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 11, + "imsi": "208970000000110", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 12, + "imsi": "208970000000105", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 13, + "imsi": "208970000000106", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 14, + "imsi": "208970000000107", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 15, + "imsi": "208970000000108", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + { + "ue_id" : 16, + "imsi": "208970000000109", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + tun_setup_script: "ue-ifup", + }, + ], +} From 642fd9996b67689159c9922bf3849c760624ecea Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 08:48:14 +0100 Subject: [PATCH 12/32] CU-CP/UP: release UE at PDCP in CU-CP We reuse RRC UE IDs at the RRC. Previous to this commit, we did not release a UE at the CU-CP's PDCP (for SRBs). Thus, when reconnecting a UE, the PDCP might not be in a good state, since we did not release the previous PDCP UE context. --- openair2/RRC/NR/rrc_gNB.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d967d3623f..ee5afbce48 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1904,6 +1904,10 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) } gNB_RRC_UE_t *UE = &ue_context_p->ue_context; + /* we call nr_pdcp_remove_UE() in the handler of E1 bearer release, but if we + * are in E1, we also need to free the UE in the CU-CP, so call it twice to + * cover all cases */ + nr_pdcp_remove_UE(UE->rrc_ue_id); rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance, UE->rrc_ue_id); LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti); rrc_delete_ue_data(UE); From 8c8971258e00ff2b2c06158e7053b767ae45656d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 08:50:56 +0100 Subject: [PATCH 13/32] NGAP: read correct PDU session NSSAI The allowed NSSAIs is NOT the NSSAI to be used for a UE. Fix it to use the correct one. --- openair2/RRC/NR/rrc_gNB_NGAP.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index b659ccc2f8..00497d6d1b 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -788,9 +788,7 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins pdu_session_to_setup_t *pdu = bearer_req.pduSession + bearer_req.numPDUSessions; bearer_req.numPDUSessions++; pdu->sessionId = session->pdusession_id; - nssai_t *nssai = &msg->allowed_nssai[i]; - pdu->nssai.sst = nssai->sst; - pdu->nssai.sd = nssai->sd; + pdu->nssai = msg->pdusession_setup_params[i].nssai; if (cuup_nssai.sst == 0) cuup_nssai = pdu->nssai; /* for CU-UP selection below */ pdu->integrityProtectionIndication = rrc->security.do_drb_integrity ? E1AP_IntegrityProtectionIndication_required : E1AP_IntegrityProtectionIndication_not_needed; From 51f0c245aa095bd6a8431b3e69665e3ada776489 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 08:52:06 +0100 Subject: [PATCH 14/32] GTP: clarify GTP Error Ind error message --- openair3/ocp-gtpu/gtp_itf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 69db8caa4a..0028236a34 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -940,7 +940,7 @@ static int Gtpv1uHandleError(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU, "Handle error to be dev\n"); + LOG_E(GTPU, "Received GTP error indication (error handling is missing/not implemented)\n"); int rc = GTPNOK; return rc; } From 8daf1edbc634cd3afe03429991896366576657bc Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 08:52:43 +0100 Subject: [PATCH 15/32] RRC: bearer context setup: correctly store DRB QoS params When setting up bearer(s) through F1, the corresponding F1 message has QoS fields for the DRB(s) to be set up, as well as for all flows associated to this DRB. In this commit, set the DRB QoS field to be equal to the first flow (it is unclear/unspecified how it should be set up, based on the flows), which was not set before and therefore contained unitialized data. The F1 module uses this data, and in split mode, F1 message generation failed due to uninitialized data. --- openair2/RRC/NR/rrc_gNB.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index ee5afbce48..680b89fbde 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2093,6 +2093,7 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp /* pass QoS info to MAC */ int nb_qos_flows = drb_config->numQosFlowSetup; + AssertFatal(nb_qos_flows > 0, "must map at least one flow to a DRB\n"); drbs[i].drb_info.flows_to_be_setup_length = nb_qos_flows; drbs[i].drb_info.flows_mapped_to_drb = (f1ap_flows_mapped_to_drb_t *)calloc(nb_qos_flows, sizeof(f1ap_flows_mapped_to_drb_t)); AssertFatal(drbs[i].drb_info.flows_mapped_to_drb, "could not allocate memory\n"); @@ -2111,6 +2112,9 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp qos_char->non_dynamic.qos_priority_level = in_qos_char->qos_priority; } } + /* the DRB QoS parameters: we just reuse the ones from the first flow */ + drbs[i].drb_info.drb_qos = drbs[i].drb_info.flows_mapped_to_drb[0].qos_params; + /* pass NSSAI info to MAC */ drbs[i].nssai = RRC_pduSession->param.nssai; } From 25a290ed0bce7de001ad38e22e98f1c157e19f06 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 08:55:12 +0100 Subject: [PATCH 16/32] F1AP: fixup: use correct DRB array index --- openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 08090a1395..cc29a92ebb 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -1227,7 +1227,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_conte else{ /* 12.1.2 DRB_Information */ - f1ap_drb_information_t *drb_info_in = &f1ap_ue_context_modification_req->drbs_to_be_setup->drb_info; + f1ap_drb_information_t *drb_info_in = &f1ap_ue_context_modification_req->drbs_to_be_setup[i].drb_info; drbs_toBeSetupMod_item->qoSInformation.present = F1AP_QoSInformation_PR_choice_extension; F1AP_QoSInformation_ExtIEs_t *ie = (F1AP_QoSInformation_ExtIEs_t *)calloc(1, sizeof(*ie)); ie->id = F1AP_ProtocolIE_ID_id_DRB_Information; From 63f3b123aefc830d423e8900b9a259af7ef891de Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 11:27:09 +0100 Subject: [PATCH 17/32] Print F1AP UE Release Request message after UL failure Additionally, initialize the F1AP PDU to zeros --- openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4eee1ba6b1..3ce64bb351 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -554,7 +554,7 @@ int DU_send_UE_CONTEXT_SETUP_FAILURE(sctp_assoc_t assoc_id) int DU_send_UE_CONTEXT_RELEASE_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_context_release_req_t *req) { - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu = {0}; F1AP_UEContextReleaseRequest_t *out; uint8_t *buffer=NULL; uint32_t len=0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 1a5439e292..2022f46a5b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -3097,6 +3097,7 @@ void nr_mac_check_ul_failure(const gNB_MAC_INST *nrmac, int rnti, NR_UE_sched_ct /* to trigger only once: trigger when ul_failure_timer == 1, but timer will * stop at 0 and we wait for a UE release command from upper layers */ if (sched_ctrl->ul_failure_timer == 1) { + LOG_W(MAC, "request release after UL failure timer expiry\n"); f1_ue_data_t ue_data = du_get_f1_ue_data(rnti); f1ap_ue_context_release_req_t request = { .gNB_CU_ue_id = ue_data.secondary_ue, From 61cc505f5cd33d6111cc9e13deecc067ad2a3ef2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 11:31:08 +0100 Subject: [PATCH 18/32] Remove commented code --- openair2/F1AP/f1ap_encoder.c | 286 ----------------------------------- 1 file changed, 286 deletions(-) diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index b249f23cfe..870dfd73fc 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -21,13 +21,6 @@ /*! \file f1ap_encoder.c * \brief f1ap pdu encode procedures - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning */ #include "f1ap_common.h" @@ -66,282 +59,3 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { *length = encoded; return encoded; } - -/* -static inline -int f1ap_encode_initiating(f1ap_message *f1ap_message_p, - uint8_t **buffer, uint32_t *len) -{ - int ret = -1; - MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; - MessagesIds message_id; - - DevAssert(f1ap_message_p != NULL); - - message_string = calloc(10000, sizeof(char)); - - f1ap_string_total_size = 0; - - switch(f1ap_message_p->procedureCode) { - case F1ap_ProcedureCode_id_F1Setup: - ret = f1ap_encode_f1_setup_request( - &f1ap_message_p->msg.f1ap_F1SetupRequestIEs, buffer, len); - //f1ap_xer_print_f1ap_f1setuprequest(f1ap_xer__print2sp, message_string, f1ap_message_p); - message_id = F1AP_F1_SETUP_LOG; - break; - - case F1ap_ProcedureCode_id_UEContextReleaseRequest: - ret = f1ap_encode_ue_context_release_request( - &f1ap_message_p->msg.f1ap_UEContextReleaseRequestIEs, buffer, len); - //f1ap_xer_print_f1ap_uecontextreleaserequest(f1ap_xer__print2sp, - // message_string, f1ap_message_p); - message_id = F1AP_UE_CONTEXT_RELEASE_REQ_LOG; - break; - - - default: - F1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n", - (int)f1ap_message_p->procedureCode); - return ret; - break; - } - - message_string_size = strlen(message_string); - - message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; -} - -static inline -int f1ap_encode_successfull_outcome(f1ap_message *f1ap_message_p, - uint8_t **buffer, uint32_t *len) -{ - int ret = -1; - MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; - MessagesIds message_id; - - DevAssert(f1ap_message_p != NULL); - - message_string = calloc(10000, sizeof(char)); - - f1ap_string_total_size = 0; - message_string_size = strlen(message_string); - - - switch(f1ap_message_p->procedureCode) { - case F1ap_ProcedureCode_id_InitialContextSetup: - ret = f1ap_encode_initial_context_setup_response( - &f1ap_message_p->msg.f1ap_InitialContextSetupResponseIEs, buffer, len); - - f1ap_xer_print_f1ap_initialcontextsetupresponse(f1ap_xer__print2sp, message_string, f1ap_message_p); - message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; - message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - case F1ap_ProcedureCode_id_UEContextRelease: - ret = f1ap_encode_ue_context_release_complete( - &f1ap_message_p->msg.f1ap_UEContextReleaseCompleteIEs, buffer, len); - f1ap_xer_print_f1ap_uecontextreleasecomplete(f1ap_xer__print2sp, message_string, f1ap_message_p); - message_id = F1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; - message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_ue_context_release_complete_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_ue_context_release_complete_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - default: - F1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n", - (int)f1ap_message_p->procedureCode); - return ret; - break; - } - - - return ret; -} - -static inline -int f1ap_encode_unsuccessfull_outcome(f1ap_message *f1ap_message_p, - uint8_t **buffer, uint32_t *len) -{ - int ret = -1; - MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; - MessagesIds message_id; - - DevAssert(f1ap_message_p != NULL); - - message_string = calloc(10000, sizeof(char)); - - f1ap_string_total_size = 0; - - switch(f1ap_message_p->procedureCode) { - case F1ap_ProcedureCode_id_InitialContextSetup: - // ret = f1ap_encode_f1ap_initialcontextsetupfailureies( - // &f1ap_message_p->ittiMsg.f1ap_InitialContextSetupFailureIEs, buffer, len); - f1ap_xer_print_f1ap_initialcontextsetupfailure(f1ap_xer__print2sp, message_string, f1ap_message_p); - message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; - break; - - default: - F1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)f1ap_message_p->procedureCode); - return ret; - break; - } - - message_string_size = strlen(message_string); - - message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; -} - -static inline -int f1ap_encode_f1_setup_request( - F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs, - uint8_t **buffer, - uint32_t *length) -{ - F1ap_F1SetupRequest_t f1SetupRequest; - F1ap_F1SetupRequest_t *f1SetupRequest_p = &f1SetupRequest; - - memset((void *)f1SetupRequest_p, 0, sizeof(f1SetupRequest)); - - if (f1ap_encode_f1ap_f1setuprequesties(f1SetupRequest_p, f1SetupRequestIEs) < 0) { - return -1; - } - - return f1ap_generate_initiating_message(buffer, - length, - F1ap_ProcedureCode_id_F1Setup, - F1ap_Criticality_reject, - &asn_DEF_F1ap_F1SetupRequest, - f1SetupRequest_p); -} - -static inline -int f1ap_encode_trace_failure( - F1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p, - uint8_t **buffer, - uint32_t *length) -{ - F1ap_TraceFailureIndication_t trace_failure; - F1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure; - - memset((void *)trace_failure_p, 0, sizeof(trace_failure)); - - if (f1ap_encode_f1ap_tracefailureindicationies( - trace_failure_p, trace_failure_ies_p) < 0) { - return -1; - } - - return f1ap_generate_initiating_message(buffer, - length, - F1ap_ProcedureCode_id_TraceFailureIndication, - F1ap_Criticality_reject, - &asn_DEF_F1ap_TraceFailureIndication, - trace_failure_p); -} - -static inline -int f1ap_encode_initial_context_setup_response( - F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, - uint8_t **buffer, - uint32_t *length) -{ - F1ap_InitialContextSetupResponse_t initial_context_setup_response; - F1ap_InitialContextSetupResponse_t *initial_context_setup_response_p = - &initial_context_setup_response; - - memset((void *)initial_context_setup_response_p, 0, - sizeof(initial_context_setup_response)); - - if (f1ap_encode_f1ap_initialcontextsetupresponseies( - initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) { - return -1; - } - - return f1ap_generate_successfull_outcome(buffer, - length, - F1ap_ProcedureCode_id_InitialContextSetup, - F1ap_Criticality_reject, - &asn_DEF_F1ap_InitialContextSetupResponse, - initial_context_setup_response_p); -} - -static inline -int f1ap_encode_ue_context_release_complete( - F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs, - uint8_t **buffer, - uint32_t *length) -{ - F1ap_UEContextReleaseComplete_t ue_context_release_complete; - F1ap_UEContextReleaseComplete_t *ue_context_release_complete_p = - &ue_context_release_complete; - - memset((void *)ue_context_release_complete_p, 0, - sizeof(ue_context_release_complete)); - - if (f1ap_encode_f1ap_uecontextreleasecompleteies( - ue_context_release_complete_p, f1ap_UEContextReleaseCompleteIEs) < 0) { - return -1; - } - - return f1ap_generate_successfull_outcome(buffer, - length, - F1ap_ProcedureCode_id_UEContextRelease, - F1ap_Criticality_reject, - &asn_DEF_F1ap_UEContextReleaseComplete, - ue_context_release_complete_p); -} - -static inline -int f1ap_encode_ue_context_release_request( - F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, - uint8_t **buffer, - uint32_t *length) -{ - F1ap_UEContextReleaseRequest_t ue_context_release_request; - F1ap_UEContextReleaseRequest_t *ue_context_release_request_p = - &ue_context_release_request; - - memset((void *)ue_context_release_request_p, 0, - sizeof(ue_context_release_request)); - - if (f1ap_encode_f1ap_uecontextreleaserequesties( - ue_context_release_request_p, f1ap_UEContextReleaseRequestIEs) < 0) { - return -1; - } - - return f1ap_generate_initiating_message(buffer, - length, - F1ap_ProcedureCode_id_UEContextReleaseRequest, - F1ap_Criticality_reject, - &asn_DEF_F1ap_UEContextReleaseRequest, - ue_context_release_request_p); -} -*/ From 09652061bb93ee1eb88656322146a0a95b058062 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 19 Dec 2023 17:17:41 +0100 Subject: [PATCH 19/32] Lower RFsim EAGAIN error message to debug message We set the RFsim TCP socket to non-blocking. Thus, it may happen that we cannot write() to the socket when the kernel cannot handle the request, in which case we wait some time before trying again. This is the correct/expected behavior. Since this is *normal*, an error message is not justified; we did not even print a message in this case before commit 21790f9c4fc introduced it. --- radio/rfsimulator/simulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/rfsimulator/simulator.c b/radio/rfsimulator/simulator.c index 1111e48e6b..5dea88edd5 100644 --- a/radio/rfsimulator/simulator.c +++ b/radio/rfsimulator/simulator.c @@ -314,7 +314,7 @@ static void fullwrite(int fd, void *_buf, ssize_t count, rfsimulator_state_t *t) continue; if (errno == EAGAIN) { - LOG_E(HW, "write() failed, errno(%d)\n", errno); + LOG_D(HW, "write() failed, errno(%d)\n", errno); usleep(250); continue; } else From db2e27e6533e49a239d47e35f0221a4ffcffd02d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 20 Dec 2023 10:44:04 +0100 Subject: [PATCH 20/32] Increase log level for CU-UP selection to improve visibility --- openair2/RRC/NR/rrc_gNB_cuup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_cuup.c b/openair2/RRC/NR/rrc_gNB_cuup.c index 3ab6dfe7bb..6c5ea8aef5 100644 --- a/openair2/RRC/NR/rrc_gNB_cuup.c +++ b/openair2/RRC/NR/rrc_gNB_cuup.c @@ -46,7 +46,7 @@ static const nr_rrc_cuup_container_t *select_cuup_slice(const struct rrc_cuup_tr for (int s = 0; s < sr->plmn[p].supported_slices; ++s) { e1ap_nssai_t *nssai = &sr->plmn[p].slice[s]; if (nssai->sst == sst && nssai->sd == sd) { - LOG_I(RRC, "selecting CU-UP ID %ld based on exact NSSAI match (%d:0x%06x)\n", sr->gNB_cu_up_id, sst, sd); + LOG_A(RRC, "selecting CU-UP ID %ld based on exact NSSAI match (%d:0x%06x)\n", sr->gNB_cu_up_id, sst, sd); return cuup; /* exact match */ } else if (nssai->sst == sst && second_best_match == NULL) { LOG_I(RRC, "second best match: CU-UP ID %ld matches SST %d\n", sr->gNB_cu_up_id, sst); @@ -66,7 +66,7 @@ static const nr_rrc_cuup_container_t *select_cuup_round_robin(size_t n_t, const nr_rrc_cuup_container_t *cuup = NULL; RB_FOREACH(cuup, rrc_cuup_tree, (struct rrc_cuup_tree *)&t) { if (m == 0) { - LOG_I(RRC, "round-robin match: select CU-UP ID %ld (no NSSAI match)\n", cuup->setup_req->gNB_cu_up_id); + LOG_W(RRC, "round-robin match: select CU-UP ID %ld (no NSSAI match)\n", cuup->setup_req->gNB_cu_up_id); return cuup; } m--; From b476d839ffced99873d4176305fcc174975a462a Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 20 Dec 2023 14:47:54 +0000 Subject: [PATCH 21/32] Enabling multi-ue support in the open-source L2 proxy. MR-2401 changed the argument to the init_nrUE_standalone_thread to be zero instead of the ue_id_g. This causes every port to be opened for multiple UEs to have the same value, therefore only allowing one UE to be connected to the proxy. If the ue_id_g global is an issue, we should open a new ticket for a proper fix. --- openair2/RRC/NR_UE/rrc_UE.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 389f849b20..1c6264bb32 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1674,8 +1674,8 @@ void start_oai_nrue_threads() LOG_E(MAC, "sem_init() error\n"); abort(); } - - init_nrUE_standalone_thread(0); + extern uint16_t ue_id_g; + init_nrUE_standalone_thread(ue_id_g); } static void nsa_rrc_ue_process_ueCapabilityEnquiry(void) From 3f94ecf65a45a59a6c4e435d74ce03c1fe50e51d Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 20 Dec 2023 16:27:34 +0100 Subject: [PATCH 22/32] Reduce tested UL bitrate in AW2S pipeline --- ci-scripts/xml_files/container_sa_aw2s_asue.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/container_sa_aw2s_asue.xml b/ci-scripts/xml_files/container_sa_aw2s_asue.xml index b918b6a797..4d81b123e6 100644 --- a/ci-scripts/xml_files/container_sa_aw2s_asue.xml +++ b/ci-scripts/xml_files/container_sa_aw2s_asue.xml @@ -145,8 +145,8 @@ Iperf - iperf (UL/4Mbps/UDP)(30 sec)(multi-ue profile) - -u -b 40M -t 30 -i 1 + iperf (UL/3.6Mbps/UDP)(30 sec)(multi-ue profile) + -u -b 36M -t 30 -i 1 IPERF3 amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10 25 From c4c1daeb163a83558d90114c2ea62cde1051bebd Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 20 Dec 2023 21:58:01 +0000 Subject: [PATCH 23/32] Moving init of NRUE threads to nr-uesoftmodem.c --- executables/nr-uesoftmodem.c | 22 ++++++++++++++++++++++ executables/nr-uesoftmodem.h | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 22 ---------------------- openair2/RRC/NR_UE/rrc_proto.h | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 3a5532af43..34047ed806 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -425,6 +425,28 @@ static void get_channel_model_mode(configmodule_interface_t *cfg) init_bler_table("NR_AWGN_RESULTS_DIR"); } +void start_oai_nrue_threads() +{ + init_queue(&nr_rach_ind_queue); + init_queue(&nr_rx_ind_queue); + init_queue(&nr_crc_ind_queue); + init_queue(&nr_uci_ind_queue); + init_queue(&nr_sfn_slot_queue); + init_queue(&nr_chan_param_queue); + init_queue(&nr_dl_tti_req_queue); + init_queue(&nr_tx_req_queue); + init_queue(&nr_ul_dci_req_queue); + init_queue(&nr_ul_tti_req_queue); + + if (sem_init(&sfn_slot_semaphore, 0, 0) != 0) + { + LOG_E(MAC, "sem_init() error\n"); + abort(); + } + + init_nrUE_standalone_thread(ue_id_g); +} + int NB_UE_INST = 1; configmodule_interface_t *uniqCfg = NULL; diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 3549a7fae1..7adba3fa97 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -97,7 +97,7 @@ extern void init_NR_UE(int, char *, char *, char *); extern void init_NR_UE_threads(int); extern void reset_opp_meas(void); extern void print_opp_meas(void); -extern void start_oai_nrue_threads(void); +void start_oai_nrue_threads(void); void *UE_thread(void *arg); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag); void init_nrUE_standalone_thread(int ue_idx); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1c6264bb32..77c2347c89 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1656,28 +1656,6 @@ void *recv_msgs_from_lte_ue(void *args_p) return NULL; } -void start_oai_nrue_threads() -{ - init_queue(&nr_rach_ind_queue); - init_queue(&nr_rx_ind_queue); - init_queue(&nr_crc_ind_queue); - init_queue(&nr_uci_ind_queue); - init_queue(&nr_sfn_slot_queue); - init_queue(&nr_chan_param_queue); - init_queue(&nr_dl_tti_req_queue); - init_queue(&nr_tx_req_queue); - init_queue(&nr_ul_dci_req_queue); - init_queue(&nr_ul_tti_req_queue); - - if (sem_init(&sfn_slot_semaphore, 0, 0) != 0) - { - LOG_E(MAC, "sem_init() error\n"); - abort(); - } - extern uint16_t ue_id_g; - init_nrUE_standalone_thread(ue_id_g); -} - static void nsa_rrc_ue_process_ueCapabilityEnquiry(void) { NR_UE_NR_Capability_t *UE_Capability_nr = NR_UE_rrc_inst[0].UECap.UE_NR_Capability = CALLOC(1, sizeof(NR_UE_NR_Capability_t)); diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 2d9d19423c..35fe67ec46 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -110,7 +110,7 @@ void init_connections_with_lte_ue(void); void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type); -void start_oai_nrue_threads(void); +extern void start_oai_nrue_threads(void); int get_from_lte_ue_fd(); From c66b09c8a3d5d14ca47e527bb9307b1b7694f9d5 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 6 Dec 2023 08:39:25 +0100 Subject: [PATCH 24/32] T2: Fix buffer overflow and HARQ codeblock ID out of range - set size of buffers to max E - change HARQ codeblock offset calculation for T2 - add constant for maximum code block size - max E --- openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c | 6 +++--- openair1/PHY/CODING/nrLDPC_extern.h | 3 ++- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c index a77fdfc2f7..1f2163ca5e 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c @@ -543,8 +543,8 @@ set_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n, } LOG_D(PHY,"ULSCH %02d HARQPID %02d R %02d COMBIN %d RV %d NCB %05d \n", ulsch_id, harq_pid, r, p_offloadParams->setCombIn, p_offloadParams->rv, p_offloadParams->n_cb); ops[i]->ldpc_dec.code_block_mode = 1; // ldpc_dec->code_block_mode; - ops[i]->ldpc_dec.harq_combined_input.offset = ulsch_id * (32 * 1024 * 1024) + harq_pid * (2 * 1024 * 1024) + r * (1024 * 32); - ops[i]->ldpc_dec.harq_combined_output.offset = ulsch_id * (32 * 1024 * 1024) + harq_pid * (2 * 1024 * 1024) + r * (1024 * 32); + ops[i]->ldpc_dec.harq_combined_input.offset = ulsch_id * 64 * LDPC_MAX_CB_SIZE + r * LDPC_MAX_CB_SIZE; + ops[i]->ldpc_dec.harq_combined_output.offset = ulsch_id * 64 * LDPC_MAX_CB_SIZE + r * LDPC_MAX_CB_SIZE; if (bufs->hard_outputs != NULL) ops[i]->ldpc_dec.hard_output = bufs->hard_outputs[start_idx + i]; if (bufs->inputs != NULL) @@ -968,7 +968,7 @@ int32_t LDPCinit() int socket_id = GET_SOCKET(info.socket_id); int out_max_sz = 8448; // max code block size (for BG1), 22 * 384 - int in_max_sz = 25344; // max number of encoded bits (for BG1), 66 * 384 + int in_max_sz = LDPC_MAX_CB_SIZE; // max number of encoded bits (for BG2 and MCS0) int num_ops = 1; int f_ret = create_mempools(ad, socket_id, num_ops, out_max_sz, in_max_sz); if (f_ret != TEST_SUCCESS) { diff --git a/openair1/PHY/CODING/nrLDPC_extern.h b/openair1/PHY/CODING/nrLDPC_extern.h index dbfdae21b2..f93e7eb9aa 100644 --- a/openair1/PHY/CODING/nrLDPC_extern.h +++ b/openair1/PHY/CODING/nrLDPC_extern.h @@ -21,7 +21,8 @@ #ifndef _NRLDPC_EXTERN_H__ #define _NRLDPC_EXTERN_H__ #include "openair1/PHY/CODING/nrLDPC_defs.h" - +/* LDPC maximum code block size - maximum E */ +#define LDPC_MAX_CB_SIZE 32768 /* ldpc coder/decoder API*/ typedef struct ldpc_interface_s { LDPC_initfunc_t *LDPCinit; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index a3041838b9..e04d8fc41a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -232,8 +232,8 @@ int decode_offload(PHY_VARS_gNB *phy_vars_gNB, { NR_gNB_ULSCH_t *ulsch = &phy_vars_gNB->ulsch[ULSCH_id]; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process; - int16_t z_ol[68 * 384 + 16] __attribute__((aligned(16))); - int8_t l_ol[68 * 384 + 16] __attribute__((aligned(16))); + int16_t z_ol[LDPC_MAX_CB_SIZE] __attribute__((aligned(16))); + int8_t l_ol[LDPC_MAX_CB_SIZE] __attribute__((aligned(16))); uint8_t Qm = pusch_pdu->qam_mod_order; uint8_t n_layers = pusch_pdu->nrOfLayers; const int Kr = harq_process->K; From 32f7f475e44e2383fddd64b5dd43fac0a43ccb5c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 6 Dec 2023 09:51:45 +0000 Subject: [PATCH 25/32] T2: update documentation and refactor ldpc-offload-enable --- CMakeLists.txt | 6 +++--- doc/BUILD.md | 1 + doc/LDPC_T2_OFFLOAD_SETUP.md | 33 ++++++++++++++++--------------- executables/nr-gnb.c | 2 +- executables/nr-softmodem-common.h | 1 - executables/nr-softmodem.h | 2 -- executables/softmodem-common.c | 1 - executables/softmodem-common.h | 10 +++++++--- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aefd12b54..82f158bbd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -500,10 +500,10 @@ target_link_libraries(shlib_loader PRIVATE CONFIG_LIB) add_boolean_option(ENABLE_LDPC_T2 OFF "Build support for LDPC Offload to T2 library" OFF) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/x86_64-linux-gnu/pkgconfig") if (ENABLE_LDPC_T2) - pkg_check_modules(LIBDPDK_T2 REQUIRED libdpdk=20.11.7) - find_library(PMD_T2 NAMES rte_baseband_accl_ldpc HINTS "/opt/dpdk-t2/lib/x86_64-linux-gnu/") + pkg_check_modules(LIBDPDK_T2 REQUIRED libdpdk=20.11.9) + find_library(PMD_T2 NAMES rte_baseband_accl_ldpc HINTS ${LIBDPDK_T2_LIBRARY_DIRS}) if (NOT PMD_T2) - message(FATAL_ERROR "could not find PMD T2") + message(FATAL_ERROR "could not find poll-mode driver for AccelerComm T2 LDPC Offload (rte_baseband_accl_ldpc.so)") endif() message(STATUS "T2 build: use ${PMD_T2}") add_library(ldpc_t2 MODULE ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c) diff --git a/doc/BUILD.md b/doc/BUILD.md index 6fd6d76e3a..87b6dcca89 100644 --- a/doc/BUILD.md +++ b/doc/BUILD.md @@ -184,6 +184,7 @@ Some libraries have further dependencies and might not build on every system: - `nrqtscope`: Qt5 - `ldpc_cuda`: CUDA - `websrv`: npm and others +- `ldpc_t2`: DPDK with patch # Running `cmake` directly diff --git a/doc/LDPC_T2_OFFLOAD_SETUP.md b/doc/LDPC_T2_OFFLOAD_SETUP.md index 551ddcc1df..485ad4c4a4 100644 --- a/doc/LDPC_T2_OFFLOAD_SETUP.md +++ b/doc/LDPC_T2_OFFLOAD_SETUP.md @@ -21,19 +21,21 @@ This documentation aims to provide a tutorial for AMD Xilinx T2 Telco card integ # Requirements - bitstream image and PMD driver for the T2 card provided by AccelerComm - - DPDK 20.11.7 with patch from Accelercomm (also tested with DPDK 20.11.3) - - tested on RHEL7.9, RHEL9.2, Ubuntu 20.04, Ubuntu 22.04 + - DPDK 20.11.9 with patch from Accelercomm: version ACCL_BBDEV_DPDK20.11.3_ldpc_3.1.918.patch + - tested on RHEL7.9, RHEL9.2, Ubuntu 22.04 # DPDK setup ## DPDK installation +*Note: Following instructions are valid for ACCL_BBDEV_DPDK20.11.3_ldpc_3.1.918.patch version, which is compatible with DPDK 20.11.9. Installation steps, which should be followed for older versions of the patch file (for example ACL_BBDEV_DPDK20.11.3_BL_1006_build_1105_dev_branch_MCT_optimisations_1106_physical_std.patch) are present in older version of this documentation, under the tag 2023.w48.* + ``` # Get DPDK source code git clone https://github.com/DPDK/dpdk-stable.git ~/dpdk-stable cd ~/dpdk-stable -git checkout v20.11.7 -git apply ~/ACL_BBDEV_DPDK20.11.3_xxx.patch +git checkout v20.11.9 +git apply ~/ACL_BBDEV_DPDK20.11.3_ldpc_3.1.918.patch ``` -Replace `~/ACL_BBDEV_DPDK20.11.3_xxx.patch` by patch file provided by +Replace `~/ACL_BBDEV_DPDK20.11.3_ldpc_3.1.918.patch` by patch file provided by Accelercomm. ``` cd ~/dpdk-stable @@ -47,16 +49,15 @@ sudo ldconfig ## DPDK configuration - load required kernel module ``` -sudo modprobe igb_uio -sudo insmod ~/dpdk-stable/kernel/linux/igb_uio/igb_uio.ko +sudo modprobe vfio-pci ``` - check presence of the card and its PCI addres on the host machine ``` lspci | grep "Xilinx" ``` - - bind the card with igb_uio driver + - bind the card with vfio-pci driver ``` -sudo python3 ~/dpdk-stable/usertools/dpdk-devbind.py -b igb_uio 41:00.0 +sudo python3 ~/dpdk-stable/usertools/dpdk-devbind.py --bind=vfio-pci 41:00.0 ``` Replace PCI address of the card *41:00.0* by address detected by *lspci | grep "Xilinx"* command - hugepages setup (10 x 1GB hugepages) @@ -68,12 +69,12 @@ sudo python3 ~/dpdk-stable/usertools/dpdk-hugepages.py -p 1G --setup 10G` the host machine* # Modifications in the OAI code -## PMD path specification -Path to the PMD for operating the card is specified in `CMakeLists.txt` file in +## DPDK lib and PMD path specification +Path to the DPDK lib and Accelercomm PMD for operating the card is specified in the `CMakeLists.txt` file, in *LDPC OFFLOAD library* section. Modify following line based on the location of -the PMD on your system. By deafult, path to the PMD is set to `/opt/dpdk-t2/lib/x86_64-linux-gnu/`. +`libdpdk.pc` file associated with the target DPDK library on your system. By default, the path is set to `/usr/local/lib/x86_64-linux-gnu/pkgconfig`. ``` -find_library(PMD_T2 NAMES rte_baseband_accl_ldpc HINTS "/opt/dpdk-t2/lib/x86_64-linux-gnu/") +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/x86_64-linux-gnu/pkgconfig") ``` ## T2 card DPDK initialization @@ -106,7 +107,7 @@ cd ~/openairinterface5g/cmake_targets cd ~/openairinterface5g source oaienv cd cmake_targets -./build_oai -w USRP --ninja --gNB -P -C --build-lib "ldpc_t2" +./build_oai -w USRP --ninja --gNB -P --build-lib "ldpc_t2" -C ``` Shared object file *libldpc_t2.so* is created during the compilation. This object is conditionally compiled. Selection of the library to compile is done using *--build-lib ldpc_t2*. @@ -131,14 +132,14 @@ sudo ./nr_dlsim -n300 -s30 -R 106 -e 27 -c ``` # OTA test -Offload of the channel encoding and decoding to the AMD Xilinx T2 card is enabled by *--ldpc-offload-enable 1* option. +Offload of the channel encoding and decoding to the AMD Xilinx T2 card is enabled by *--ldpc-offload-enable* option. ## Run OAI gNB with USRP B210 ``` cd ~/openairinterface5g source oaienv cd cmake_targets/ran_build/build -sudo ./nr-softmodem --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --ldpc-offload-enable 1 +sudo ./nr-softmodem --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --ldpc-offload-enable ``` # Limitations diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 3738fa3f28..ef38a8ee1f 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -593,7 +593,7 @@ void init_eNB_afterRU(void) { LOG_I(PHY,"RC.nb_nr_CC[inst:%d]:%p\n", inst, RC.gNB[inst]); gNB = RC.gNB[inst]; - gNB->ldpc_offload_flag = ldpc_offload_flag; + gNB->ldpc_offload_flag = get_softmodem_params()->ldpc_offload_flag; gNB->reorder_thread_disable = get_softmodem_params()->reorder_thread_disable; phy_init_nr_gNB(gNB); diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index da743e4342..19760bdd26 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -98,7 +98,6 @@ #define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" -#define CONFIG_HLP_LDPC_OFFLOAD "enable LDPC offload to AMD Xilinx T2 card\n" #define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n" #define CONFIG_HLP_TX_SUBDEV "set the arguments to select tx_subdev (same syntax as in UHD)\n" #define CONFIG_HLP_RX_SUBDEV "set the arguments to select rx_subdev (same syntax as in UHD)\n" diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index d4414291df..e7eed10cff 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -29,7 +29,6 @@ {"D" , CONFIG_HLP_DLBM_PHYTEST, 0, .u64ptr=&dlsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \ {"U" , CONFIG_HLP_ULBM_PHYTEST, 0, .u64ptr=&ulsch_slot_bitmap, .defintval=0, TYPE_UINT64, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, .iptr=&usrp_tx_thread, .defstrval=0, TYPE_INT, 0}, \ - {"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, 0, .iptr=&ldpc_offload_flag, .defstrval=0, TYPE_INT, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, .strptr=&uecap_file, .defstrval="./uecap_ports1.xml", TYPE_STRING, 0}, \ {"s" , CONFIG_HLP_SNR, 0, .dblptr=&snr_dB, .defdblval=25, TYPE_DOUBLE, 0}, \ } @@ -44,7 +43,6 @@ extern uint32_t target_ul_bw; extern uint64_t dlsch_slot_bitmap; extern uint64_t ulsch_slot_bitmap; extern char *uecap_file; -extern int ldpc_offload_flag; // In nr-gnb.c extern void init_gNB(int single_thread_flag,int wait_for_sync); diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index f72d201622..316a5b14c9 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -47,7 +47,6 @@ char *parallel_config=NULL; char *worker_config=NULL; int usrp_tx_thread = 0; char *nfapi_str=NULL; -int ldpc_offload_flag=0; uint8_t nfapi_mode=0; static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index e72e4dd824..b856bf252c 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -109,7 +109,8 @@ extern "C" #define CONFIG_HLP_SYNC_REF "Sync Reference in Sidelink\n" #define CONFIG_HLP_NID1 "Set NID1 value in Sidelink\n" #define CONFIG_HLP_NID2 "Set NID2 value in Sidelink\n" -#define CONFIG_HLP_NOITTI "Do not start itti threads, call queue processing in place, inside the caller thread" +#define CONFIG_HLP_NOITTI "Do not start itti threads, call queue processing in place, inside the caller thread" +#define CONFIG_HLP_LDPC_OFFLOAD "Enable LDPC offload to AMD Xilinx T2 telco card\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to eNodeB and UE */ @@ -144,6 +145,7 @@ extern "C" #define SYNC_REF softmodem_params.sync_ref #define NID1 softmodem_params.nid1 #define NID2 softmodem_params.nid2 +#define LDPC_OFFLOAD_FLAG softmodem_params.ldpc_offload_flag #define REORDER_THREAD_DISABLE softmodem_params.reorder_thread_disable #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; @@ -191,7 +193,8 @@ extern int usrp_tx_thread; {"disable-stats", CONFIG_HLP_STATS_DISABLE, PARAMFLAG_BOOL, .iptr=&stats_disabled, .defintval=0, TYPE_INT, 0}, \ {"nid1", CONFIG_HLP_NID1, 0, .iptr=&NID1, .defintval=10, TYPE_INT, 0}, \ {"nid2", CONFIG_HLP_NID2, 0, .iptr=&NID2, .defintval=1, TYPE_INT, 0}, \ - {"no-itti-threads", CONFIG_HLP_NOITTI, PARAMFLAG_BOOL, .iptr=&softmodem_params.no_itti, .defintval=0, TYPE_INT, 0}, \ + {"no-itti-threads", CONFIG_HLP_NOITTI, PARAMFLAG_BOOL, .iptr=&softmodem_params.no_itti, .defintval=0, TYPE_INT, 0}, \ + {"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, PARAMFLAG_BOOL, .iptr=&LDPC_OFFLOAD_FLAG, .defstrval=0, TYPE_INT, 0}, \ } // clang-format on @@ -241,6 +244,7 @@ extern int usrp_tx_thread; { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ } // clang-format on @@ -353,6 +357,7 @@ typedef struct { int nid1; int nid2; int no_itti; + int ldpc_offload_flag; } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); @@ -368,7 +373,6 @@ extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int usrp_tx_thread; extern uint16_t sl_ahead; extern uint16_t sf_ahead; -extern int ldpc_offload_flag; extern int oai_exit; void tx_func(void *param); From 284116522b7d90d9dfb08d7b72397b3c8fde207e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 13:22:18 +0100 Subject: [PATCH 26/32] F1AP SCTP: don't bind local address binding the local address for SCTP is pointless, because we don't really care through which interface SCTP traffic goes. Actually, we even might want to set the DU remote_n_addr and the the local_n_addr to addresses in different networks, because we might want to have GTP traffic go through a different interface than SCTP, as done in the CI test for E1. --- openair2/F1AP/f1ap_du_task.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 7ba479e1f9..d823a35092 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -54,8 +54,6 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *n sctp_new_association_req_p->out_streams = 2; //du_inst->sctp_out_streams; // remote memcpy(&sctp_new_association_req_p->remote_address, &nc->CU_f1_ip_address, sizeof(nc->CU_f1_ip_address)); - // local - memcpy(&sctp_new_association_req_p->local_address, &nc->DU_f1_ip_address, sizeof(nc->DU_f1_ip_address)); // du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); } From 6c830a488d1a510416e77b4d6e36f7613b297568 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 14:29:23 +0100 Subject: [PATCH 27/32] Simplify F1 test and harmonize with complex F1+E1 test - Test only one DU at the CU (3 DUs is tested in F1+E1) - Harmonize IP configuration to make it simpler to reuse in the F1+E1 test - Speed up the test by reducing the number of steps to deploy core/RAN - Add traffic test --- .../conf_files/gnb-cu.sa.band78.106prb.conf | 8 +- .../gnb-du.sa.band78.106prb.rfsim.conf | 7 +- .../xml_files/container_5g_f1_rfsim.xml | 54 ++------- .../5g_f1_rfsimulator/docker-compose.yaml | 109 ++++-------------- 4 files changed, 42 insertions(+), 136 deletions(-) diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf index 8a33b6dd96..7f975cbcd4 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf @@ -23,8 +23,8 @@ gNBs = tr_s_preference = "f1"; local_s_if_name = "eth0"; - local_s_address = "192.168.71.140"; - remote_s_address = "192.168.71.142"; + local_s_address = "192.168.71.150"; + remote_s_address = "192.168.71.171"; local_s_portc = 501; local_s_portd = 2153; remote_s_portc = 500; @@ -51,9 +51,9 @@ gNBs = { GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.140"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.150"; GNB_INTERFACE_NAME_FOR_NGU = "eth0"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.140"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.150"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf index 75d2beed6d..9d8a3cb57b 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0xffffff }) }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }, { sst = 2 }, { sst = 3 } ) }); nr_cellid = 12345678L; @@ -23,7 +23,6 @@ gNBs = ////////// Physical parameters: min_rxtxtime = 6; - force_256qam_off = 1; servingCellConfigCommon = ( { @@ -170,8 +169,8 @@ MACRLCs = ( tr_s_preference = "local_L1"; tr_n_preference = "f1"; local_n_if_name = "eth0"; - local_n_address = "192.168.71.142"; - remote_n_address = "192.168.71.140"; + local_n_address = "192.168.71.171"; + remote_n_address = "192.168.71.150"; local_n_portc = 500; local_n_portd = 2153; remote_n_portc = 501; diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 6f8f71095c..c6eb681a58 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -27,13 +27,11 @@ 111111 100021 - 000020 000021 000022 - 000023 - 000024 - 000025 020021 + 030021 + 030022 100021 @@ -42,61 +40,29 @@ Pull_Local_Registry Pull Images from Local Registry 0 - oai-gnb-asan oai-nr-ue-asan - - - - DeployGenObject - Deploy MySql Database - yaml_files/5g_f1_rfsimulator - mysql - 1 + oai-gnb-asan oai-nr-cuup-asan oai-nr-ue-asan DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_f1_rfsimulator - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 DeployGenObject - Deploy OAI 5G CU RF sim SA + Deploy OAI 5G CU+DU+UE RF sim SA yaml_files/5g_f1_rfsimulator - oai-cu - 7 - - - - DeployGenObject - Deploy 3 OAI 5G DUs RF sim SA - yaml_files/5g_f1_rfsimulator - oai-du oai-du2 oai-du3 - 10 - - - - DeployGenObject - Deploy OAI 5G NR-UE RF sim SA - yaml_files/5g_f1_rfsimulator - oai-nr-ue oai-nr-ue2 - 12 - - - - DeployGenObject - Deploy OAI 5G NR-UE RF sim SA - yaml_files/5g_f1_rfsimulator - oai-nr-ue3 - 13 + oai-cu oai-du oai-nr-ue + 9 Ping Ping ext-dn from all NR-UEs - rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 + rfsim5g_ue -c 20 192.168.72.135 -i0.25 5 @@ -107,7 +73,7 @@ rfsim5g-oai-nr-ue rfsim5g-oai-ext-dn -B 12.1.1.2 -u -i 1 -s - -c 12.1.1.2 -u -i 1 -t 30 -b 3M + -c 12.1.1.2 -u -i 1 -t 10 -b 20M @@ -116,7 +82,7 @@ rfsim5g-oai-ext-dn rfsim5g-oai-nr-ue -u -i 1 -s - -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 1M + -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 10 -b 5M diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 8d62746300..308efdc33b 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -49,8 +49,10 @@ services: - PLMN_SUPPORT_MCC=208 - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). + # Three slices are defined - SST_0=1 + - SST_1=2 + - SST_2=3 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 # One single SMF instance @@ -101,6 +103,8 @@ services: - TYPE0=IPv4 - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - NSSAI_SST0=1 + - NSSAI_SST1=2 + - NSSAI_SST2=3 - SESSION_AMBR_UL0=200Mbps - SESSION_AMBR_DL0=400Mbps - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 @@ -127,10 +131,16 @@ services: - UPF_FQDN_5G=oai-spgwu - NRF_IPV4_ADDRESS=192.168.71.130 - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) + # Three slices are defined - NSSAI_SST_0=1 - NSSAI_SD_0=0xffffff - DNN_0=oai + - NSSAI_SST_1=2 + - NSSAI_SD_1=0xffffff + - DNN_1=oai + - NSSAI_SST_2=3 + - NSSAI_SD_2=0xffffff + - DNN_2=oai depends_on: - oai-nrf - oai-smf @@ -145,6 +155,7 @@ services: ipv4_address: 192.168.71.134 traffic_net: ipv4_address: 192.168.72.134 + oai-ext-dn: privileged: true container_name: rfsim5g-oai-ext-dn @@ -162,6 +173,7 @@ services: interval: 10s timeout: 5s retries: 5 + oai-cu: image: oaisoftwarealliance/oai-gnb:develop privileged: true @@ -173,7 +185,7 @@ services: - oai-ext-dn networks: public_net: - ipv4_address: 192.168.71.140 + ipv4_address: 192.168.71.150 volumes: - ../../conf_files/gnb-cu.sa.band78.106prb.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -181,56 +193,19 @@ services: interval: 10s timeout: 5s retries: 5 + oai-du: image: oaisoftwarealliance/oai-gnb:develop privileged: true container_name: rfsim5g-oai-du - environment: + environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cu networks: public_net: - ipv4_address: 192.168.71.142 - volumes: - - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf - healthcheck: - test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s - timeout: 5s - retries: 5 - oai-du2: - image: oaisoftwarealliance/oai-gnb:develop - privileged: true - container_name: rfsim5g-oai-du2 - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --gNBs.[0].gNB_DU_ID 0xe01 --gNBs.[0].nr_cellid 87654321 --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 --MACRLCs.[0].local_n_address 192.168.71.143 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 - depends_on: - - oai-cu - networks: - public_net: - ipv4_address: 192.168.71.143 - volumes: - - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf - healthcheck: - test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s - timeout: 5s - retries: 5 - oai-du3: - image: oaisoftwarealliance/oai-gnb:develop - privileged: true - container_name: rfsim5g-oai-du3 - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim --gNBs.[0].gNB_DU_ID 0xe02 --gNBs.[0].nr_cellid 11111111 --gNBs.[0].servingCellConfigCommon.[0].physCellId 2 --MACRLCs.[0].local_n_address 192.168.71.144 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 - depends_on: - - oai-cu - networks: - public_net: - ipv4_address: 192.168.71.144 + ipv4_address: 192.168.71.171 volumes: - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -238,56 +213,22 @@ services: interval: 10s timeout: 5s retries: 5 + oai-nr-ue: image: oaisoftwarealliance/oai-nr-ue:develop privileged: true container_name: rfsim5g-oai-nr-ue - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.142 --log_config.global_log_options level,nocolor,time + environment: + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + -r 106 --numerology 1 -C 3619200000 + --uicc0.imsi 208990100001100 + --rfsimulator.serveraddr 192.168.71.171 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du networks: public_net: - ipv4_address: 192.168.71.150 - volumes: - - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf - healthcheck: - test: /bin/bash -c "pgrep nr-uesoftmodem" - interval: 10s - timeout: 5s - retries: 5 - oai-nr-ue2: - image: oaisoftwarealliance/oai-nr-ue:develop - privileged: true - container_name: rfsim5g-oai-nr-ue2 - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3619200000 --rfsimulator.serveraddr 192.168.71.143 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 - depends_on: - - oai-du2 - networks: - public_net: - ipv4_address: 192.168.71.151 - volumes: - - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf - healthcheck: - test: /bin/bash -c "pgrep nr-uesoftmodem" - interval: 10s - timeout: 5s - retries: 5 - oai-nr-ue3: - image: oaisoftwarealliance/oai-nr-ue:develop - privileged: true - container_name: rfsim5g-oai-nr-ue3 - environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3619200000 --rfsimulator.serveraddr 192.168.71.144 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 - depends_on: - - oai-du3 - networks: - public_net: - ipv4_address: 192.168.71.152 + ipv4_address: 192.168.71.181 volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: From 63e2ca15bc404b18b3d655a2e2657132b5ee0657 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 14:29:32 +0100 Subject: [PATCH 28/32] Extend F1+E1 test for multiple CU-UPs The 5G-RFsim F1 test tested multiple DUs at one CU. This functionality is retained in the new F1+E1 test. The 5G-RFsim E1 test tested a single CU-UP at a single CU-CP. Here, we extend to use multiple CU-UPs, one for each DU. The associated is ensured by using three different F1-U transport networks, one for each DU/CU-UP pair. --- ci-scripts/conf_files/gnb-cucp.sa.f1.conf | 10 +- ci-scripts/conf_files/gnb-cuup.sa.f1.conf | 16 +- .../xml_files/container_5g_e1_rfsim.xml | 64 +---- .../xml_files/container_5g_e1_rfsim_down.xml | 2 +- .../yaml_files/5g_rfsimulator_e1/README.md | 136 ++++++++++ .../5g_rfsimulator_e1/docker-compose.yaml | 247 ++++++++++++++++-- 6 files changed, 377 insertions(+), 98 deletions(-) create mode 100644 ci-scripts/yaml_files/5g_rfsimulator_e1/README.md diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf index 469ab8d187..94200b8189 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf @@ -16,7 +16,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0xffffff }) }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }, { sst = 2 }, { sst = 3 }) }); nr_cellid = 12345678L; @@ -24,8 +24,8 @@ gNBs = tr_s_preference = "f1"; local_s_if_name = "lo"; - local_s_address = "192.168.72.140"; - remote_s_address = "192.168.72.143"; + local_s_address = "192.168.71.150"; + remote_s_address = "0.0.0.0"; # multiple DUs local_s_portc = 501; local_s_portd = 2152; remote_s_portc = 500; @@ -52,9 +52,9 @@ gNBs = ( { type = "cp"; - ipv4_cucp = "192.168.72.140"; + ipv4_cucp = "192.168.71.150"; port_cucp = 38462; - ipv4_cuup = "192.168.72.141"; + ipv4_cuup = "0.0.0.0"; # multiple CU-UPs port_cuup = 38462; } ) diff --git a/ci-scripts/conf_files/gnb-cuup.sa.f1.conf b/ci-scripts/conf_files/gnb-cuup.sa.f1.conf index d6c54f0b9a..07e3701749 100644 --- a/ci-scripts/conf_files/gnb-cuup.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cuup.sa.f1.conf @@ -22,12 +22,12 @@ gNBs = tr_s_preference = "f1"; local_s_if_name = "lo"; - local_s_address = "192.168.72.141"; - remote_s_address = "192.168.72.142"; + local_s_address = "192.168.72.161"; + remote_s_address = "192.168.72.171"; local_s_portc = 501; - local_s_portd = 2152; + local_s_portd = 2153; remote_s_portc = 500; - remote_s_portd = 2152; + remote_s_portd = 2153; # ------- SCTP definitions SCTP : @@ -41,17 +41,17 @@ gNBs = ( { type = "up"; - ipv4_cucp = "192.168.72.140"; - ipv4_cuup = "192.168.72.141"; + ipv4_cucp = "192.168.71.150"; + ipv4_cuup = "192.168.71.161"; } ) NETWORK_INTERFACES : { GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.141/24"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.161/24"; GNB_INTERFACE_NAME_FOR_NGU = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.141/24"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.161/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/xml_files/container_5g_e1_rfsim.xml b/ci-scripts/xml_files/container_5g_e1_rfsim.xml index b89b8a2bd2..8ccb7bdd15 100644 --- a/ci-scripts/xml_files/container_5g_e1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_e1_rfsim.xml @@ -27,14 +27,10 @@ 111111 100021 - 000020 000021 000022 000023 - 000024 020021 - 020022 - 030021 100021 @@ -46,80 +42,38 @@ oai-gnb-asan oai-nr-cuup-asan oai-nr-ue-asan - - DeployGenObject - Deploy MySql Database - yaml_files/5g_rfsimulator_e1 - mysql - 1 - - DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_e1 - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 DeployGenObject - Deploy OAI 5G CU-CP RF sim SA + Deploy OAI 5G RAN RF sim SA (1 CU-CP, 3 CU-UPs, 3 DUs) yaml_files/5g_rfsimulator_e1 - oai-cucp - 7 + oai-cucp oai-cuup oai-cuup2 oai-cuup3 oai-du oai-du2 oai-du3 + 13 - DeployGenObject - Deploy OAI 5G CU-UP and DU RF sim SA - yaml_files/5g_rfsimulator_e1 - oai-cuup oai-du - 9 - - - DeployGenObject Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_e1 - oai-nr-ue - 10 + oai-nr-ue oai-nr-ue2 oai-nr-ue3 + 16 Ping - Ping ext-dn from NR-UE - rfsim5g_ue - -c 20 192.168.73.135 + Ping ext-dn from all NR-UEs + rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 + -c 20 12.1.1.1 -i0.25 5 - - Ping - Ping NR-UE from ext-dn - rfsim5g_ext_dn - -c 20 12.1.1.2 - 5 - - - - IperfFromContainer - Iperf UDP Downlink - rfsim5g-oai-nr-ue - rfsim5g-oai-ext-dn - -B 12.1.1.2 -u -i 1 -s - -c 12.1.1.2 -u -i 1 -t 30 -b 3M - - - - IperfFromContainer - Iperf UDP Uplink - rfsim5g-oai-ext-dn - rfsim5g-oai-nr-ue - -u -i 1 -s - -B 12.1.1.2 -c 192.168.73.135 -u -i 1 -t 30 -b 1M - - UndeployGenObject Undeploy all OAI 5G stack diff --git a/ci-scripts/xml_files/container_5g_e1_rfsim_down.xml b/ci-scripts/xml_files/container_5g_e1_rfsim_down.xml index a1213c9b9b..4ccf180fd0 100644 --- a/ci-scripts/xml_files/container_5g_e1_rfsim_down.xml +++ b/ci-scripts/xml_files/container_5g_e1_rfsim_down.xml @@ -22,7 +22,7 @@ --> rfsim-5gnr-down-e1 - CleanUp CUCP-CUUP-DU E1+F1 split + CleanUp E1+F1 split trash 100022 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md new file mode 100644 index 0000000000..b59440e958 --- /dev/null +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md @@ -0,0 +1,136 @@ +# CI test for 5G F1+E1 splits with RFsimulator + +## General + +This docker-compose file deploys a core, RAN, and 3 UEs. Specifically: + +- 5GC mini deployment, +- 1 CU-CP, +- 3 CU-UPs, one for slices SST=1,2,3, +- 3 DUs, +- 3 UEs connecting to each DU, each requesting slice SST=1,2,3. + +The CU-CP associates each UE X connecting through DU X to CU-UP X, X=1,2,3. To +this end, the docker-compose file deliberately employs the three `ran_netX` +networks to route the user-plane traffic of each DU X/CU-UP X pair, through the +`ran_netX` network in order to effectively test that the correct CU-UP is +associated. Basically, the traffic test will only succeed if the correct pair +of DU/CU-UP has been established; if not, the DU/CU-UP cannot communicate, as +the traffic cannot be routed. + +For all other (CP, RFsim) traffic, all entities use the `public_net` network. + +## How to run + +You should be able to deploy the [basic 5G RFsim deployment](../5g_rfsimulator/README.md). + +First, start the MySQL server and 5GC: +```bash +$ docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn +$ docker-compose ps -a +``` + +Wait till everything is healthy. + +Next, start the RAN: +```bash +$ docker-compose up -d oai-cucp oai-cuup{,2,3} oai-du{,2,3} +``` + +You can verify that the DUs and CU-UPs connected successfully: +```bash +$ docker logs rfsim5g-oai-cucp +[...] +18535.139811 [RRC] I Accepting new CU-UP ID 3585 name gNB-OAI (assoc_id 257) +18535.425744 [RRC] I Accepting new CU-UP ID 3584 name gNB-OAI (assoc_id 260) +18535.425757 [RRC] I Accepting new CU-UP ID 3586 name gNB-OAI (assoc_id 261) +18535.669733 [NR_RRC] I Received F1 Setup Request from gNB_DU 3585 (du-rfsim) on assoc_id 263 +18535.669814 [RRC] I Accepting DU 3585 (du-rfsim), sending F1 Setup Response +18536.066417 [NR_RRC] I Received F1 Setup Request from gNB_DU 3586 (du-rfsim) on assoc_id 265 +18536.066476 [RRC] I Accepting DU 3586 (du-rfsim), sending F1 Setup Response +18536.135581 [NR_RRC] I Received F1 Setup Request from gNB_DU 3584 (du-rfsim) on assoc_id 267 +18536.135650 [RRC] I Accepting DU 3584 (du-rfsim), sending F1 Setup Response +``` + +You should see that the CU-UP initialized two GTP instances (one for NG-U, the +other for F1-U): +``` +$ docker logs -f rfsim5g-oai-cuup +[...] +18535.425535 [GTPU] I Initializing UDP for local address 192.168.72.161 with port 2152 +18535.425571 [GTPU] I Created gtpu instance id: 96 +18535.425577 [GTPU] I Configuring GTPu address : 192.168.71.161, port : 2152 +18535.425581 [GTPU] I Initializing UDP for local address 192.168.71.161 with port 2152 +18535.425604 [GTPU] I Created gtpu instance id: 97 +``` + +You should see the typical periodical output at the DUs: +``` +$ docker logs rfsim5g-oai-du +[...] +18626.446953 [NR_MAC] I Frame.Slot 128.0 + +18629.151076 [NR_MAC] I Frame.Slot 256.0 +``` + +Next, connect the UEs. They are configured to connect to each DU by setting the +RFsimulator server address to the `public_net` IP address of each DU. For each, +you should see that they get an IP address +```bash +$ docker compose up -d oai-nr-ue{,2,3} +$ docker logs oai-nr-ue +[...] +18758.176149 [NR_RRC] I rrcReconfigurationComplete Encoded 10 bits (2 bytes) +18758.176153 [NR_RRC] I Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes 2) +18758.176154 [NAS] I [UE 0] Received NAS_CONN_ESTABLI_CNF: errCode 1, length 87 +18758.176455 [OIP] I Interface oaitun_ue1 successfully configured, ip address 12.1.1.3, mask 255.255.255.0 broadcast address 12.1.1.255 +``` + +Alternatively, check that they all received an IP address (the associated IP +addresses might be different): +```bash +$ docker exec -it rfsim5g-oai-nr-ue3 ip a show oaitun_ue1 +[...] + inet 12.1.1.2/24 brd 12.1.1.255 scope global oaitun_ue1 +[...] +$ docker exec -it rfsim5g-oai-nr-ue2 ip a show oaitun_ue1 +[...] + inet 12.1.1.4/24 brd 12.1.1.255 scope global oaitun_ue1 +[...] +$ docker exec -it rfsim5g-oai-nr-ue ip a show oaitun_ue1 +[...] + inet 12.1.1.3/24 brd 12.1.1.255 scope global oaitun_ue1 +[...] +``` + +Also, note that each DU sees only one UE! At the CU-CP, you should see that +each DU has been associated to a different CU-UP, based on the NSSAI (`exact +NSSAI match`): +```bash +$ docker logs rfsim5g-oai-cucp | grep CU-U +[...] +18757.531423 [RRC] I selecting CU-UP ID 3586 based on exact NSSAI match (3:0xffffff) +18757.531434 [RRC] I UE 1 associating to CU-UP assoc_id 261 out of 3 CU-UPs +18758.171502 [RRC] I selecting CU-UP ID 3584 based on exact NSSAI match (1:0xffffff) +18758.171510 [RRC] I UE 2 associating to CU-UP assoc_id 260 out of 3 CU-UPs +18758.772320 [RRC] I selecting CU-UP ID 3585 based on exact NSSAI match (2:0xffffff) +18758.772327 [RRC] I UE 3 associating to CU-UP assoc_id 257 out of 3 CU-UPs +``` + +Also, each UE should be able to ping the core network. For instance, with UE 1: +```bash +$ docker exec -it rfsim5g-oai-nr-ue ping -c1 12.1.1.1 +PING 12.1.1.1 (12.1.1.1) 56(84) bytes of data. +64 bytes from 12.1.1.1: icmp_seq=1 ttl=64 time=15.2 ms + +--- 12.1.1.1 ping statistics --- +1 packets transmitted, 1 received, 0% packet loss, time 0ms +rtt min/avg/max/mdev = 15.155/15.155/15.155/0.000 ms +``` + +Finally, undeploy the UEs (to give them time to do deregistration), and then +the rest of the network: +```bash +$ docker compose stop oai-nr-ue{,2,3} +$ docker compose down +``` diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index 4eaa942824..8479e32723 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -7,14 +7,14 @@ services: - NRF_INTERFACE_NAME_FOR_SBI=eth0 - TZ=Europe/Paris networks: - core_net: + public_net: ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 volumes: - - ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - - ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh + - ../5g_f1_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql + - ../5g_f1_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh environment: - TZ=Europe/Paris - MYSQL_DATABASE=oai_db @@ -27,7 +27,7 @@ services: timeout: 5s retries: 30 networks: - core_net: + public_net: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" @@ -49,8 +49,10 @@ services: - PLMN_SUPPORT_MCC=208 - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). + # Three slices are defined - SST_0=1 + - SST_1=2 + - SST_2=3 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 # One single SMF instance @@ -74,7 +76,7 @@ services: - oai-nrf - mysql networks: - core_net: + public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" @@ -101,6 +103,8 @@ services: - TYPE0=IPv4 - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - NSSAI_SST0=1 + - NSSAI_SST1=2 + - NSSAI_SST2=3 - SESSION_AMBR_UL0=200Mbps - SESSION_AMBR_DL0=400Mbps - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 @@ -109,7 +113,7 @@ services: - oai-nrf - oai-amf networks: - core_net: + public_net: ipv4_address: 192.168.71.133 oai-spgwu: container_name: "rfsim5g-oai-spgwu" @@ -127,10 +131,16 @@ services: - UPF_FQDN_5G=oai-spgwu - NRF_IPV4_ADDRESS=192.168.71.130 - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) + # Three slices are defined - NSSAI_SST_0=1 - NSSAI_SD_0=0xffffff - DNN_0=oai + - NSSAI_SST_1=2 + - NSSAI_SD_1=0xffffff + - DNN_1=oai + - NSSAI_SST_2=3 + - NSSAI_SD_2=0xffffff + - DNN_2=oai depends_on: - oai-nrf - oai-smf @@ -141,10 +151,10 @@ services: - ALL privileged: true networks: - core_net: + public_net: ipv4_address: 192.168.71.134 traffic_net: - ipv4_address: 192.168.73.134 + ipv4_address: 192.168.75.134 oai-ext-dn: privileged: true @@ -152,14 +162,14 @@ services: image: oaisoftwarealliance/trf-gen-cn5g:focal entrypoint: /bin/bash -c \ "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ - "ip route add 12.1.1.0/24 via 192.168.73.134 dev eth0; sleep infinity" + "ip route add 12.1.1.0/24 via 192.168.75.134 dev eth0; sleep infinity" depends_on: - oai-spgwu networks: traffic_net: - ipv4_address: 192.168.73.135 + ipv4_address: 192.168.75.135 healthcheck: - test: /bin/bash -c "ping -c 2 192.168.73.134" + test: /bin/bash -c "ping -c 2 192.168.75.134" interval: 10s timeout: 5s retries: 5 @@ -174,10 +184,8 @@ services: depends_on: - oai-ext-dn networks: - core_net: - ipv4_address: 192.168.71.140 - ran_net: - ipv4_address: 192.168.72.140 + public_net: + ipv4_address: 192.168.71.150 volumes: - ../../conf_files/gnb-cucp.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -196,10 +204,66 @@ services: depends_on: - oai-cucp networks: - core_net: - ipv4_address: 192.168.71.141 + public_net: + ipv4_address: 192.168.71.161 ran_net: - ipv4_address: 192.168.72.141 + ipv4_address: 192.168.72.161 + volumes: + - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-cuup" + interval: 10s + timeout: 5s + retries: 5 + + oai-cuup2: + image: oaisoftwarealliance/oai-nr-cuup:develop + privileged: true + container_name: rfsim5g-oai-cuup2 + environment: + USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + --gNBs.[0].gNB_CU_UP_ID 0xe01 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.71.162 + --gNBs.[0].local_s_address 192.168.73.162 + --gNBs.[0].remote_s_address 192.168.73.172 + --gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NGU 192.168.71.162 + --gNBs.[0].plmn_list.[0].snssaiList.[0].sst 2 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-cucp + networks: + public_net: + ipv4_address: 192.168.71.162 + ran_net2: + ipv4_address: 192.168.73.162 + volumes: + - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-cuup" + interval: 10s + timeout: 5s + retries: 5 + + oai-cuup3: + image: oaisoftwarealliance/oai-nr-cuup:develop + privileged: true + container_name: rfsim5g-oai-cuup3 + environment: + USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + --gNBs.[0].gNB_CU_UP_ID 0xe02 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.71.163 + --gNBs.[0].local_s_address 192.168.74.163 + --gNBs.[0].remote_s_address 192.168.74.173 + --gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NGU 192.168.71.163 + --gNBs.[0].plmn_list.[0].snssaiList.[0].sst 3 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-cucp + networks: + public_net: + ipv4_address: 192.168.71.163 + ran_net3: + ipv4_address: 192.168.74.163 volumes: - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -214,12 +278,72 @@ services: container_name: rfsim5g-oai-du environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + --MACRLCs.[0].local_n_address 192.168.72.171 ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-cucp + - oai-cuup networks: + public_net: + ipv4_address: 192.168.71.171 ran_net: - ipv4_address: 192.168.72.142 + ipv4_address: 192.168.72.171 volumes: - - ../../conf_files/gnb-du.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf + - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai-du2: + image: oaisoftwarealliance/oai-gnb:develop + privileged: true + container_name: rfsim5g-oai-du2 + environment: + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + --gNBs.[0].gNB_DU_ID 0xe01 + --gNBs.[0].nr_cellid 87654321 + --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 + --MACRLCs.[0].local_n_address 192.168.73.172 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-cucp + - oai-cuup2 + networks: + public_net: + ipv4_address: 192.168.71.172 + ran_net2: + ipv4_address: 192.168.73.172 + volumes: + - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai-du3: + image: oaisoftwarealliance/oai-gnb:develop + privileged: true + container_name: rfsim5g-oai-du3 + environment: + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + --gNBs.[0].gNB_DU_ID 0xe02 + --gNBs.[0].nr_cellid 11111111 + --gNBs.[0].servingCellConfigCommon.[0].physCellId 2 + --MACRLCs.[0].local_n_address 192.168.74.173 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-cucp + - oai-cuup3 + networks: + public_net: + ipv4_address: 192.168.71.173 + ran_net3: + ipv4_address: 192.168.74.173 + volumes: + - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: test: /bin/bash -c "pgrep nr-softmodem" interval: 10s @@ -231,13 +355,62 @@ services: privileged: true container_name: rfsim5g-oai-nr-ue environment: - USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 -C 3619200000 --rfsimulator.serveraddr 192.168.72.142 --log_config.global_log_options level,nocolor,time + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + -r 106 --numerology 1 -C 3619200000 + --uicc0.imsi 208990100001100 + --rfsimulator.serveraddr 192.168.71.171 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du networks: - ran_net: - ipv4_address: 192.168.72.150 + public_net: + ipv4_address: 192.168.71.181 + volumes: + - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai-nr-ue2: + image: oaisoftwarealliance/oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue2 + environment: + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + -r 106 --numerology 1 -C 3619200000 + --uicc0.imsi 208990100001101 --uicc0.nssai_sst 2 + --rfsimulator.serveraddr 192.168.71.172 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-du2 + networks: + public_net: + ipv4_address: 192.168.71.182 + volumes: + - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + + oai-nr-ue3: + image: oaisoftwarealliance/oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue3 + environment: + USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time + -r 106 --numerology 1 -C 3619200000 + --uicc0.imsi 208990100001102 --uicc0.nssai_sst 3 + --rfsimulator.serveraddr 192.168.71.173 + ASAN_OPTIONS: detect_leaks=0 + depends_on: + - oai-du3 + networks: + public_net: + ipv4_address: 192.168.71.183 volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: @@ -247,14 +420,14 @@ services: retries: 5 networks: - core_net: + public_net: driver: bridge - name: rfsim5g-oai-core-net + name: rfsim5g-oai-public-net ipam: config: - subnet: 192.168.71.128/26 driver_opts: - com.docker.network.bridge.name: "rfsim5g-core" + com.docker.network.bridge.name: "rfsim5g-public" ran_net: driver: bridge name: rfsim5g-oai-ran-net @@ -263,11 +436,27 @@ networks: - subnet: 192.168.72.128/26 driver_opts: com.docker.network.bridge.name: "rfsim5g-ran" + ran_net2: + driver: bridge + name: rfsim5g-oai-ran-net2 + ipam: + config: + - subnet: 192.168.73.128/26 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-ran2" + ran_net3: + driver: bridge + name: rfsim5g-oai-ran-net3 + ipam: + config: + - subnet: 192.168.74.128/26 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-ran3" traffic_net: driver: bridge name: rfsim5g-oai-traffic_net-net ipam: config: - - subnet: 192.168.73.128/26 + - subnet: 192.168.75.128/26 driver_opts: com.docker.network.bridge.name: "rfsim5g-traffic" From 4e56e15ee38b0ab92f38b901d3e1ff4dc2630aa0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 15:30:08 +0100 Subject: [PATCH 29/32] 5G RFsim test: speed up core start, verify UE attached --- ci-scripts/xml_files/container_5g_rfsim.xml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 1bca25027f..dd18ee7132 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -28,7 +28,6 @@ 111111 100001 - 000000 000001 000002 000003 @@ -36,6 +35,7 @@ 000005 000006 000007 + 000008 020001 020002 020003 @@ -61,19 +61,11 @@ oai-gnb-asan oai-nr-ue - - DeployGenObject - Deploy MySql Database - yaml_files/5g_rfsimulator - mysql - 1 - - DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 @@ -125,6 +117,12 @@ 17 + + Attach_UE + Attach OAI UE (Wait for IP) + rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10 + + Ping Ping ext-dn from NR-UE From fe21ae719983b752c4ddf0e11a9f9ee1717cb2c4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 13:36:16 +0100 Subject: [PATCH 30/32] Improve 5G RFsim README: link to F1+E1 --- ci-scripts/yaml_files/5g_rfsimulator/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 72756b1441..4efd2714b4 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -65,7 +65,8 @@ $ docker logout All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_rfsimulator` folder for a deployment with monolithic gNB. -For a deployment with the gNB split in CU and DU components, the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_f1_rfsimulator` folder. +For a deployment with the gNB split in CU and DU components, please refer to the `../5g_f1_rfsimulator` folder. +For a deployment with the gNB split in CU-CP, CU-UP, and DU components, please refer to the ../5g_rfsimulator_e1` folder. ## 2.1. Deploy OAI 5G Core Network ## From f078373107ed27704cd6a728fad9a433520d0c37 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 21 Dec 2023 16:25:40 +0100 Subject: [PATCH 31/32] F1: better document DU F1 IP address config --- doc/F1-design.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/F1-design.md b/doc/F1-design.md index 916c1a2edf..ee45128ebb 100644 --- a/doc/F1-design.md +++ b/doc/F1-design.md @@ -152,9 +152,11 @@ In the CU file: In the DU file: - Set `MACRLCs.[0].tr_n_preference` to `f1` - Update `MACRLCs.[0].local_n_address` (local north-bound address of the DU) to - `127.0.0.4` + `127.0.0.4`. This IP address is used to bind the GTP socket (F1-U user plane + traffic). - Update `MACRLCs.[].remote_n_address` (remote north-bound address of the CU) - to `127.0.0.3` + to `127.0.0.3`. This IP address is used as the CU destination IP address for + F1AP communication. Note: all `local_*_if_name` parameters are ignored. From 027f7d9f2e7bd9d11c245bddff47909d318e497c Mon Sep 17 00:00:00 2001 From: Sagar Arora Date: Fri, 22 Dec 2023 12:38:36 +0100 Subject: [PATCH 32/32] F1+E1 RFsim test: eparate subnets, remove oai-ext-dn, update description - for F1U, F1C, E1, UE and Core - update README with subnets - better document sample output --- .../xml_files/container_5g_e1_rfsim.xml | 8 +- .../yaml_files/5g_rfsimulator_e1/README.md | 158 +++++++++++--- .../5g_rfsimulator_e1/docker-compose.yaml | 203 ++++++++++-------- 3 files changed, 243 insertions(+), 126 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_e1_rfsim.xml b/ci-scripts/xml_files/container_5g_e1_rfsim.xml index 8ccb7bdd15..b53a01da13 100644 --- a/ci-scripts/xml_files/container_5g_e1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_e1_rfsim.xml @@ -46,8 +46,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_e1 - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + mysql oai-nrf oai-amf oai-smf oai-spgwu + 5 @@ -55,7 +55,7 @@ Deploy OAI 5G RAN RF sim SA (1 CU-CP, 3 CU-UPs, 3 DUs) yaml_files/5g_rfsimulator_e1 oai-cucp oai-cuup oai-cuup2 oai-cuup3 oai-du oai-du2 oai-du3 - 13 + 12 @@ -63,7 +63,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_e1 oai-nr-ue oai-nr-ue2 oai-nr-ue3 - 16 + 15 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md index b59440e958..2cc0ec88ab 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md @@ -10,36 +10,58 @@ This docker-compose file deploys a core, RAN, and 3 UEs. Specifically: - 3 DUs, - 3 UEs connecting to each DU, each requesting slice SST=1,2,3. -The CU-CP associates each UE X connecting through DU X to CU-UP X, X=1,2,3. To -this end, the docker-compose file deliberately employs the three `ran_netX` -networks to route the user-plane traffic of each DU X/CU-UP X pair, through the -`ran_netX` network in order to effectively test that the correct CU-UP is -associated. Basically, the traffic test will only succeed if the correct pair -of DU/CU-UP has been established; if not, the DU/CU-UP cannot communicate, as -the traffic cannot be routed. +The CU-CP associates each UE X connecting through DU X to CU-UP X, X=1,2,3. To this end, the docker-compose file deliberately employs the three `f1u_netX` networks to route the user-plane traffic of each DU X/CU-UP X pair, through the `f1u_netX` network in order to effectively test that the correct CU-UP is associated. Basically, the traffic test will only succeed if the correct pair of DU/CU-UP has been established; if not, the DU/CU-UP cannot communicate, as the traffic cannot be routed. -For all other (CP, RFsim) traffic, all entities use the `public_net` network. +Core network components are on `core_net` network, CU-CP <--> CU-UP X communicate via `e1_net` network, CU-CP <--> DU X communicate via `f1c_net` network and DU X <--> NR_UE X communicate via `ue_net` network. + + +## Connectivity + +``` +AMF --> 192.168.71.132 (N2,Namf) +SMF --> 192.168.71.133 (N4,Nsmf) +NRF --> 192.168.71.130 (Nnrf) +SPGWU --> 192.168.71.134 (N3) +CU-CP --> 192.168.71.X (N2), 192.168.72.2 (F1C), 192.168.77.2 (E1) +CU-UP1 --> 192.168.71.X (N3), 192.168.73.2 (F1U), 192.168.77.3 (E1) +CU-UP2 --> 192.168.71.X (N3), 192.168.74.2 (F1U), 192.168.77.4 (E1) +CU-UP3 --> 192.168.71.X (N3), 192.168.76.2 (F1U), 192.168.77.5 (E1) +DU1 --> 192.168.72.2 (F1C), 192.168.73.3 (F1U), 192.168.78.2 (RFSIM) +DU2 --> 192.168.72.3 (F1C), 192.168.74.3 (F1U), 192.168.78.3 (RFSIM) +DU3 --> 192.168.72.4 (F1C), 192.168.76.3 (F1U), 192.168.78.4 (RFSIM) +UE1 --> 192.168.78.5 (RFSIM) +UE2 --> 192.168.78.6 (RFSIM) +UE3 --> 192.168.78.7 (RFSIM) +``` ## How to run You should be able to deploy the [basic 5G RFsim deployment](../5g_rfsimulator/README.md). First, start the MySQL server and 5GC: + ```bash -$ docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn -$ docker-compose ps -a +docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu +docker-compose ps -a ``` Wait till everything is healthy. Next, start the RAN: + ```bash -$ docker-compose up -d oai-cucp oai-cuup{,2,3} oai-du{,2,3} +docker-compose up -d oai-cucp oai-cuup{,2,3} oai-du{,2,3} ``` You can verify that the DUs and CU-UPs connected successfully: ```bash -$ docker logs rfsim5g-oai-cucp +docker logs rfsim5g-oai-cucp +``` + +
+The output is similar to: + +```console [...] 18535.139811 [RRC] I Accepting new CU-UP ID 3585 name gNB-OAI (assoc_id 257) 18535.425744 [RRC] I Accepting new CU-UP ID 3584 name gNB-OAI (assoc_id 260) @@ -51,63 +73,126 @@ $ docker logs rfsim5g-oai-cucp 18536.135581 [NR_RRC] I Received F1 Setup Request from gNB_DU 3584 (du-rfsim) on assoc_id 267 18536.135650 [RRC] I Accepting DU 3584 (du-rfsim), sending F1 Setup Response ``` +
-You should see that the CU-UP initialized two GTP instances (one for NG-U, the -other for F1-U): +You should see that the CU-UP initialized two GTP instances (one for NG-U, the other for F1-U): + +```bash +docker logs -f rfsim5g-oai-cuup ``` -$ docker logs -f rfsim5g-oai-cuup + +
+The output is similar to: + +```console [...] -18535.425535 [GTPU] I Initializing UDP for local address 192.168.72.161 with port 2152 -18535.425571 [GTPU] I Created gtpu instance id: 96 -18535.425577 [GTPU] I Configuring GTPu address : 192.168.71.161, port : 2152 -18535.425581 [GTPU] I Initializing UDP for local address 192.168.71.161 with port 2152 -18535.425604 [GTPU] I Created gtpu instance id: 97 +122690.500374 [GTPU] I Initializing UDP for local address 192.168.73.2 with port 2153 +122690.500406 [GTPU] I Created gtpu instance id: 96 +122690.500413 [GTPU] I Configuring GTPu address : 192.168.71.161, port : 2152 +122690.500414 [GTPU] I Initializing UDP for local address 192.168.71.161 with port 2152 +122690.500420 [GTPU] I Created gtpu instance id: 97 ``` +
+ + You should see the typical periodical output at the DUs: + +```bash +docker logs rfsim5g-oai-du ``` -$ docker logs rfsim5g-oai-du +
+The output is similar to: + +```console [...] 18626.446953 [NR_MAC] I Frame.Slot 128.0 18629.151076 [NR_MAC] I Frame.Slot 256.0 +``` +
+ ``` Next, connect the UEs. They are configured to connect to each DU by setting the RFsimulator server address to the `public_net` IP address of each DU. For each, you should see that they get an IP address + ```bash -$ docker compose up -d oai-nr-ue{,2,3} -$ docker logs oai-nr-ue +docker compose up -d oai-nr-ue{,2,3} +``` + +```bash +docker logs rfsim5g-oai-nr-ue +``` + +
+The output is similar to: + +```console [...] 18758.176149 [NR_RRC] I rrcReconfigurationComplete Encoded 10 bits (2 bytes) 18758.176153 [NR_RRC] I Logical Channel UL-DCCH (SRB1), Generating RRCReconfigurationComplete (bytes 2) 18758.176154 [NAS] I [UE 0] Received NAS_CONN_ESTABLI_CNF: errCode 1, length 87 18758.176455 [OIP] I Interface oaitun_ue1 successfully configured, ip address 12.1.1.3, mask 255.255.255.0 broadcast address 12.1.1.255 ``` +
+ + +Alternatively, check that they all received an IP address (the associated IP addresses might be different): -Alternatively, check that they all received an IP address (the associated IP -addresses might be different): ```bash -$ docker exec -it rfsim5g-oai-nr-ue3 ip a show oaitun_ue1 +docker exec -it rfsim5g-oai-nr-ue3 ip a show oaitun_ue1 +``` +
+The output is similar to: + +```console [...] inet 12.1.1.2/24 brd 12.1.1.255 scope global oaitun_ue1 [...] -$ docker exec -it rfsim5g-oai-nr-ue2 ip a show oaitun_ue1 +``` +
+ +```bash +docker exec -it rfsim5g-oai-nr-ue2 ip a show oaitun_ue1 +``` +
+The output is similar to: + +```console [...] inet 12.1.1.4/24 brd 12.1.1.255 scope global oaitun_ue1 [...] -$ docker exec -it rfsim5g-oai-nr-ue ip a show oaitun_ue1 +``` +
+ +```bash +docker exec -it rfsim5g-oai-nr-ue ip a show oaitun_ue1 +``` +
+The output is similar to: + +```console [...] inet 12.1.1.3/24 brd 12.1.1.255 scope global oaitun_ue1 [...] ``` +
+ + Also, note that each DU sees only one UE! At the CU-CP, you should see that each DU has been associated to a different CU-UP, based on the NSSAI (`exact NSSAI match`): ```bash -$ docker logs rfsim5g-oai-cucp | grep CU-U +docker logs rfsim5g-oai-cucp | grep CU-U +``` + +
+The output is similar to: + +```console [...] 18757.531423 [RRC] I selecting CU-UP ID 3586 based on exact NSSAI match (3:0xffffff) 18757.531434 [RRC] I UE 1 associating to CU-UP assoc_id 261 out of 3 CU-UPs @@ -116,10 +201,17 @@ $ docker logs rfsim5g-oai-cucp | grep CU-U 18758.772320 [RRC] I selecting CU-UP ID 3585 based on exact NSSAI match (2:0xffffff) 18758.772327 [RRC] I UE 3 associating to CU-UP assoc_id 257 out of 3 CU-UPs ``` +
+ Also, each UE should be able to ping the core network. For instance, with UE 1: ```bash -$ docker exec -it rfsim5g-oai-nr-ue ping -c1 12.1.1.1 +docker exec -it rfsim5g-oai-nr-ue ping -c1 12.1.1.1 +``` +
+The output is similar to: + +```console PING 12.1.1.1 (12.1.1.1) 56(84) bytes of data. 64 bytes from 12.1.1.1: icmp_seq=1 ttl=64 time=15.2 ms @@ -127,10 +219,12 @@ PING 12.1.1.1 (12.1.1.1) 56(84) bytes of data. 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 15.155/15.155/15.155/0.000 ms ``` +
+ Finally, undeploy the UEs (to give them time to do deregistration), and then the rest of the network: ```bash -$ docker compose stop oai-nr-ue{,2,3} -$ docker compose down +docker compose stop oai-nr-ue{,2,3} +docker compose down ``` diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index 8479e32723..adfdefbccf 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -5,9 +5,9 @@ services: image: oaisoftwarealliance/oai-nrf:v1.5.0 environment: - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris + - TZ=Europe/1 networks: - public_net: + core_net: ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" @@ -16,7 +16,7 @@ services: - ../5g_f1_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - ../5g_f1_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh environment: - - TZ=Europe/Paris + - TZ=Europe/1 - MYSQL_DATABASE=oai_db - MYSQL_USER=test - MYSQL_PASSWORD=test @@ -27,13 +27,13 @@ services: timeout: 5s retries: 30 networks: - public_net: + core_net: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" image: oaisoftwarealliance/oai-amf:v1.5.0 environment: - - TZ=Europe/paris + - TZ=Europe/1 - MCC=208 - MNC=99 - REGION_ID=128 @@ -76,13 +76,13 @@ services: - oai-nrf - mysql networks: - public_net: + core_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" image: oaisoftwarealliance/oai-smf:v1.5.0 environment: - - TZ=Europe/Paris + - TZ=Europe/1 - SMF_INTERFACE_NAME_FOR_N4=eth0 - SMF_INTERFACE_NAME_FOR_SBI=eth0 - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 @@ -113,13 +113,13 @@ services: - oai-nrf - oai-amf networks: - public_net: + core_net: ipv4_address: 192.168.71.133 oai-spgwu: container_name: "rfsim5g-oai-spgwu" image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 environment: - - TZ=Europe/Paris + - TZ=Europe/1 - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - SGW_INTERFACE_NAME_FOR_SX=eth0 - PGW_INTERFACE_NAME_FOR_SGI=eth0 @@ -151,28 +151,8 @@ services: - ALL privileged: true networks: - public_net: + core_net: ipv4_address: 192.168.71.134 - traffic_net: - ipv4_address: 192.168.75.134 - - oai-ext-dn: - privileged: true - container_name: rfsim5g-oai-ext-dn - image: oaisoftwarealliance/trf-gen-cn5g:focal - entrypoint: /bin/bash -c \ - "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ - "ip route add 12.1.1.0/24 via 192.168.75.134 dev eth0; sleep infinity" - depends_on: - - oai-spgwu - networks: - traffic_net: - ipv4_address: 192.168.75.135 - healthcheck: - test: /bin/bash -c "ping -c 2 192.168.75.134" - interval: 10s - timeout: 5s - retries: 5 oai-cucp: image: oaisoftwarealliance/oai-gnb:develop @@ -180,12 +160,18 @@ services: container_name: rfsim5g-oai-cucp environment: USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 + --gNBs.[0].local_s_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - - oai-ext-dn + - oai-spgwu networks: - public_net: + core_net: ipv4_address: 192.168.71.150 + f1c_net: + ipv4_address: 192.168.72.2 + e1_net: + ipv4_address: 192.168.77.2 volumes: - ../../conf_files/gnb-cucp.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -200,14 +186,20 @@ services: container_name: rfsim5g-oai-cuup environment: USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time + --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.3 + --gNBs.[0].local_s_address 192.168.73.2 + --gNBs.[0].remote_s_address 127.0.0.1 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp networks: - public_net: + core_net: ipv4_address: 192.168.71.161 - ran_net: - ipv4_address: 192.168.72.161 + f1u_1_net: + ipv4_address: 192.168.73.2 + e1_net: + ipv4_address: 192.168.77.3 volumes: - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -223,19 +215,22 @@ services: environment: USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_CU_UP_ID 0xe01 - --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.71.162 - --gNBs.[0].local_s_address 192.168.73.162 - --gNBs.[0].remote_s_address 192.168.73.172 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.4 + --gNBs.[0].local_s_address 192.168.74.2 + --gNBs.[0].remote_s_address 127.0.0.1 --gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NGU 192.168.71.162 --gNBs.[0].plmn_list.[0].snssaiList.[0].sst 2 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp networks: - public_net: + core_net: ipv4_address: 192.168.71.162 - ran_net2: - ipv4_address: 192.168.73.162 + f1u_2_net: + ipv4_address: 192.168.74.2 + e1_net: + ipv4_address: 192.168.77.4 volumes: - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -251,19 +246,22 @@ services: environment: USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time --gNBs.[0].gNB_CU_UP_ID 0xe02 - --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.71.163 - --gNBs.[0].local_s_address 192.168.74.163 - --gNBs.[0].remote_s_address 192.168.74.173 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cucp 192.168.77.2 + --gNBs.[0].E1_INTERFACE.[0].ipv4_cuup 192.168.77.5 + --gNBs.[0].local_s_address 192.168.76.2 + --gNBs.[0].remote_s_address 127.0.0.1 --gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NGU 192.168.71.163 --gNBs.[0].plmn_list.[0].snssaiList.[0].sst 3 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp networks: - public_net: + core_net: ipv4_address: 192.168.71.163 - ran_net3: - ipv4_address: 192.168.74.163 + f1u_3_net: + ipv4_address: 192.168.76.2 + e1_net: + ipv4_address: 192.168.77.5 volumes: - ../../conf_files/gnb-cuup.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -278,16 +276,19 @@ services: container_name: rfsim5g-oai-du environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time - --MACRLCs.[0].local_n_address 192.168.72.171 + --MACRLCs.[0].local_n_address 192.168.73.3 + --MACRLCs.[0].remote_n_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp - oai-cuup networks: - public_net: - ipv4_address: 192.168.71.171 - ran_net: - ipv4_address: 192.168.72.171 + f1c_net: + ipv4_address: 192.168.72.3 + f1u_1_net: + ipv4_address: 192.168.73.3 + ue_net: + ipv4_address: 192.168.78.2 volumes: - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -305,16 +306,19 @@ services: --gNBs.[0].gNB_DU_ID 0xe01 --gNBs.[0].nr_cellid 87654321 --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 - --MACRLCs.[0].local_n_address 192.168.73.172 + --MACRLCs.[0].local_n_address 192.168.74.3 + --MACRLCs.[0].remote_n_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp - oai-cuup2 networks: - public_net: - ipv4_address: 192.168.71.172 - ran_net2: - ipv4_address: 192.168.73.172 + f1c_net: + ipv4_address: 192.168.72.4 + f1u_2_net: + ipv4_address: 192.168.74.3 + ue_net: + ipv4_address: 192.168.78.3 volumes: - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -332,16 +336,19 @@ services: --gNBs.[0].gNB_DU_ID 0xe02 --gNBs.[0].nr_cellid 11111111 --gNBs.[0].servingCellConfigCommon.[0].physCellId 2 - --MACRLCs.[0].local_n_address 192.168.74.173 + --MACRLCs.[0].local_n_address 192.168.76.3 + --MACRLCs.[0].remote_n_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-cucp - oai-cuup3 networks: - public_net: - ipv4_address: 192.168.71.173 - ran_net3: - ipv4_address: 192.168.74.173 + f1c_net: + ipv4_address: 192.168.72.5 + f1u_3_net: + ipv4_address: 192.168.76.3 + ue_net: + ipv4_address: 192.168.78.4 volumes: - ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: @@ -358,13 +365,13 @@ services: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 - --rfsimulator.serveraddr 192.168.71.171 + --rfsimulator.serveraddr 192.168.78.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du networks: - public_net: - ipv4_address: 192.168.71.181 + ue_net: + ipv4_address: 192.168.78.5 volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: @@ -381,13 +388,13 @@ services: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001101 --uicc0.nssai_sst 2 - --rfsimulator.serveraddr 192.168.71.172 + --rfsimulator.serveraddr 192.168.78.3 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du2 networks: - public_net: - ipv4_address: 192.168.71.182 + ue_net: + ipv4_address: 192.168.78.6 volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: @@ -404,13 +411,13 @@ services: USE_ADDITIONAL_OPTIONS: --sa --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001102 --uicc0.nssai_sst 3 - --rfsimulator.serveraddr 192.168.71.173 + --rfsimulator.serveraddr 192.168.78.4 ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du3 networks: - public_net: - ipv4_address: 192.168.71.183 + ue_net: + ipv4_address: 192.168.78.7 volumes: - ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf healthcheck: @@ -420,43 +427,59 @@ services: retries: 5 networks: - public_net: + core_net: driver: bridge - name: rfsim5g-oai-public-net + name: rfsim5g-oai-core-net ipam: config: - subnet: 192.168.71.128/26 driver_opts: - com.docker.network.bridge.name: "rfsim5g-public" - ran_net: + com.docker.network.bridge.name: "rfsim5g-core" + f1c_net: driver: bridge - name: rfsim5g-oai-ran-net + name: rfsim5g-oai-f1c-net ipam: config: - - subnet: 192.168.72.128/26 + - subnet: 192.168.72.0/28 driver_opts: - com.docker.network.bridge.name: "rfsim5g-ran" - ran_net2: + com.docker.network.bridge.name: "rfsim5g-f1c" + f1u_1_net: driver: bridge - name: rfsim5g-oai-ran-net2 + name: rfsim5g-oai-f1u-1-net ipam: config: - - subnet: 192.168.73.128/26 + - subnet: 192.168.73.0/28 driver_opts: - com.docker.network.bridge.name: "rfsim5g-ran2" - ran_net3: + com.docker.network.bridge.name: "rfsim5g-f1u_1" + f1u_2_net: driver: bridge - name: rfsim5g-oai-ran-net3 + name: rfsim5g-oai-f1u-2-net ipam: config: - - subnet: 192.168.74.128/26 + - subnet: 192.168.74.0/28 driver_opts: - com.docker.network.bridge.name: "rfsim5g-ran3" - traffic_net: + com.docker.network.bridge.name: "rfsim5g-f1u_2" + f1u_3_net: driver: bridge - name: rfsim5g-oai-traffic_net-net + name: rfsim5g-oai-f1u-3-net ipam: config: - - subnet: 192.168.75.128/26 + - subnet: 192.168.76.0/28 driver_opts: - com.docker.network.bridge.name: "rfsim5g-traffic" + com.docker.network.bridge.name: "rfsim5g-f1u_3" + e1_net: + driver: bridge + name: rfsim5g-oai-e1-net + ipam: + config: + - subnet: 192.168.77.1/28 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-e1" + ue_net: + driver: bridge + name: rfsim5g-oai-ue-net + ipam: + config: + - subnet: 192.168.78.1/28 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-ue"