Merge with nr-rrc-additions

This commit is contained in:
Guy De Souza
2018-05-30 15:33:25 +02:00
95 changed files with 59963 additions and 11513 deletions
+136 -143
View File
@@ -281,6 +281,7 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
# RRC
######
add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
@@ -293,23 +294,37 @@ else()
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call})
execute_process(COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
RESULT_VARIABLE ret)
message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
execute_process(COMMAND ${asn1c_call}
${RRC_FULL_DIR}
${RRC_GRAMMAR}
RRC
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
if(NOT EXISTS ${fix_asn1c_call})
message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
endif(NOT EXISTS ${fix_asn1c_call})
execute_process(COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
RESULT_VARIABLE ret)
execute_process(COMMAND ${fix_asn1c_call}
${RRC_FULL_DIR}
RRC
${RRC_ASN1_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
@@ -328,14 +343,78 @@ add_custom_command (
DEPENDS ${RRC_GRAMMAR}
)
#NR RRC
######
add_list2_option(NR_RRC_ASN1_VERSION "NR_Rel15" "ASN.1 version of NR_RRC interface")
if (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15")
set (NR_RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn)
endif (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15")
set (NR_RRC_FULL_DIR ${asn1_generated_dir}/${NR_RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call})
message("calling ASN1C_PREFIX=NR_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
execute_process(COMMAND ${asn1c_call}
${NR_RRC_FULL_DIR}
${NR_RRC_GRAMMAR}
NR_RRC
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
if(NOT EXISTS ${fix_asn1c_call})
message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
endif(NOT EXISTS ${fix_asn1c_call})
execute_process(COMMAND ${fix_asn1c_call}
${NR_RRC_FULL_DIR}
NR_RRC
${NR_RRC_ASN1_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c)
file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h)
set(nr_rrc_h ${nr_rrc_h} ${NR_RRC_FULL_DIR}/asn1_constants.h)
set_source_files_properties(${nr_rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c)
include_directories ("${NR_RRC_FULL_DIR}")
# add the command to generate the source code
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
add_custom_command (
OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h
COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} RRC
COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} RRC ${NR_RRC_ASN1_VERSION}
DEPENDS ${RRC_GRAMMAR}
)
# S1AP
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10)
add_list1_option(S1AP_VERSION R14 "S1AP Asn.1 grammar version" R8 R9 R10 R14)
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
if (${S1AP_VERSION} STREQUAL "R10")
if (${S1AP_VERSION} STREQUAL "R14")
set (ASN1RELDIR R14.4)
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10 -DUPDATE_RELEASE_14")
set(S1AP_ASN_FILES s1ap-14.4.0.asn1)
elseif (${S1AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R10.5)
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10")
elseif (${S1AP_VERSION} STREQUAL "R9")
@@ -343,52 +422,33 @@ elseif (${S1AP_VERSION} STREQUAL "R9")
add_definitions("-DUPDATE_RELEASE_9")
else(${S1AP_VERSION} STREQUAL "R8")
set (ASN1RELDIR R8.10)
endif(${S1AP_VERSION} STREQUAL "R10")
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
${S1AP_ASN_DIR}/S1AP-Constants.asn
${S1AP_ASN_DIR}/S1AP-IEs.asn
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
endif(${S1AP_VERSION} STREQUAL "R14")
set(S1AP_OAI_generated
${S1AP_C_DIR}/s1ap_decoder.c
${S1AP_C_DIR}/s1ap_encoder.c
${S1AP_C_DIR}/s1ap_xer_print.c
${S1AP_C_DIR}/s1ap_compare.c
${S1AP_C_DIR}/s1ap_ies_defs.h
)
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR})
message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}")
execute_process(COMMAND mkdir -p ${S1AP_C_DIR}
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
set(s1ap_h ${s1ap_h} )
add_custom_command (
OUTPUT ${S1AP_OAI_generated}
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
DEPENDS ${S1AP_ASN_FILES}
)
OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h
COMMAND mkdir -p ${S1AP_C_DIR}
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
)
add_library(S1AP_LIB
${S1AP_OAI_generated}
${S1AP_source}
${S1AP_DIR}/s1ap_common.c
)
@@ -397,10 +457,9 @@ include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}")
add_library(S1AP_ENB
${S1AP_C_DIR}/s1ap_ies_defs.h
# ${S1AP_C_DIR}/s1ap_ies_defs.h
${S1AP_DIR}/s1ap_eNB.c
${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c
${S1AP_DIR}/s1ap_eNB_encoder.c
${S1AP_DIR}/s1ap_eNB_handlers.c
${S1AP_DIR}/s1ap_eNB_itti_messaging.c
@@ -410,6 +469,7 @@ add_library(S1AP_ENB
${S1AP_DIR}/s1ap_eNB_overload.c
${S1AP_DIR}/s1ap_eNB_trace.c
${S1AP_DIR}/s1ap_eNB_ue_context.c
${S1AP_DIR}/s1ap_eNB_decoder.c
)
@@ -418,61 +478,39 @@ add_library(S1AP_ENB
# Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11)
add_list1_option(X2AP_VERSION R14 "X2AP Asn.1 grammar version" R10 R11 R14)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11")
if (${X2AP_VERSION} STREQUAL "R14")
set (ASN1RELDIR R14.5)
set (X2AP_ASN_FILES x2ap-14.5.0.asn1)
elseif (${X2AP_VERSION} STREQUAL "R11")
set (ASN1RELDIR R11.2)
elseif (${X2AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R.UNKNOWN)
endif(${X2AP_VERSION} STREQUAL "R11")
endif(${X2AP_VERSION} STREQUAL "R14")
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
${X2AP_ASN_DIR}/X2AP-Constants.asn
${X2AP_ASN_DIR}/X2AP-IEs.asn
${X2AP_ASN_DIR}/X2AP-PDU.asn
${X2AP_ASN_DIR}/X2AP-Containers.asn
)
set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR})
message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}")
execute_process(COMMAND mkdir -p ${X2AP_C_DIR}
COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
set(X2AP_OAI_generated
${X2AP_C_DIR}/x2ap_decoder.c
${X2AP_C_DIR}/x2ap_encoder.c
${X2AP_C_DIR}/x2ap_xer_print.c
${X2AP_C_DIR}/x2ap_ies_defs.h
)
file(GLOB x2ap_h ${X2AP_C_DIR}/*.h)
set(x2ap_h ${x2ap_h} )
#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}")
add_custom_command (
OUTPUT ${X2AP_OAI_generated}
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
DEPENDS ${X2AP_ASN_FILES}
OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h
COMMAND mkdir -p ${X2AP_C_DIR}
COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
)
add_library(X2AP_LIB
${X2AP_OAI_generated}
${X2AP_source}
${X2AP_DIR}/x2ap_common.c
)
@@ -485,7 +523,7 @@ include_directories ("${X2AP_DIR}")
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR" "OAI_ADRV9371_ZC706")
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
#NOKIA config enhancement
@@ -508,11 +546,6 @@ set (SHLIB_LOADER_SOURCES
)
# include RF devices / transport protocols library modules
######################################################################
if (HWLAT)
add_definitions(-DHWLAT )
endif()
include_directories("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/")
@@ -758,9 +791,6 @@ include_directories("${OPENAIR3_DIR}/UDP")
include_directories("${OPENAIR3_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/ADRV9371_ZC706/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/ADRV9371_ZC706/USERSPACE/libini/")
include_directories("${OPENAIR_DIR}/targets/ARCH/ADRV9371_ZC706/DEFS/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
include_directories("${OPENAIR2_DIR}/ENB_APP")
@@ -1054,12 +1084,6 @@ set(PHY_TURBOSRC
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
)
set(PHY_LDPCSRC
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder2.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_generate_coefficient.c
)
set(PHY_POLARSRC
${OPENAIR1_DIR}/PHY/CODING/nrPolar_init.c
@@ -1202,7 +1226,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz_ue.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
@@ -1263,6 +1287,7 @@ if (${SMBV})
endif (${SMBV})
if (${COMPILATION_AVX2} STREQUAL "True")
#set(PHY_SRC ${PHY_SRC} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c)
set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c)
endif ()
@@ -1373,12 +1398,12 @@ set(L2_SRC_UE
set (MAC_SRC
${PHY_INTERFACE_DIR}/IF_Module.c
${MAC_DIR}/main.c
#${MAC_DIR}/main_ue.c
#${MAC_DIR}/ue_procedures.c
#${MAC_DIR}/ra_procedures.c
${MAC_DIR}/main_ue.c
${MAC_DIR}/ue_procedures.c
${MAC_DIR}/ra_procedures.c
${MAC_DIR}/l1_helpers.c
${MAC_DIR}/rar_tools.c
#${MAC_DIR}/rar_tools_ue.c
${MAC_DIR}/rar_tools_ue.c
${MAC_DIR}/eNB_scheduler.c
${MAC_DIR}/eNB_scheduler_dlsch.c
${MAC_DIR}/eNB_scheduler_ulsch.c
@@ -1389,7 +1414,7 @@ set (MAC_SRC
${MAC_DIR}/eNB_scheduler_phytest.c
${MAC_DIR}/pre_processor.c
${MAC_DIR}/config.c
#${MAC_DIR}/config_ue.c
${MAC_DIR}/config_ue.c
)
set (MAC_SRC_UE
@@ -1945,7 +1970,7 @@ add_definitions(-DASN1_MINIMUM_VERSION=924)
# add executables for operation
#################################
# lte-softmodem is eNB implementation
# lte-softmodem is both eNB and UE implementation
###################################################
add_executable(lte-softmodem
@@ -1984,7 +2009,7 @@ target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CR
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem ${T_LIB})
# lte-softmodem-nos1 is eNB implementation
# lte-softmodem-nos1 is both eNB and UE implementation
###################################################
add_executable(lte-softmodem-nos1
${rrc_h}
@@ -2020,38 +2045,6 @@ target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt
target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-softmodem-nos1 ${T_LIB})
# lte-hwlat
###################################################
add_executable(lte-hwlat
${HW_SOURCE}
${OPENAIR_TARGETS}/RT/USER/lte-hwlat.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
)
target_link_libraries (lte-hwlat
-Wl,--start-group
-Wl,--end-group )
target_link_libraries (lte-hwlat rt pthread m )
target_link_libraries (lte-hwlat ${CMAKE_DL_LIBS} )
target_link_libraries (lte-hwlat ${OPENAIR_TARGETS}/ARCH/ADRV9371_ZC706/slib/libadrv9371_zc706.so )
# lte-hwlat-test
###################################################
add_executable(lte-hwlat-test
${HW_SOURCE}
${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR_TARGETS}/RT/USER/lte-hwlat2.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
)
target_link_libraries (lte-hwlat-test
-Wl,--start-group
-Wl,--end-group )
target_link_libraries (lte-hwlat-test rt pthread m )
target_link_libraries (lte-hwlat-test ${CMAKE_DL_LIBS} )
# lte-uesoftmodem is UE implementation
#######################################
@@ -2087,7 +2080,7 @@ target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${
target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES})
target_link_libraries (lte-uesoftmodem ${T_LIB})
# lte-softmodem-nos1 is UE implementation
# lte-softmodem-nos1 is both eNB and UE implementation
###################################################
add_executable(lte-uesoftmodem-nos1
${rrc_h}
@@ -2379,10 +2372,10 @@ if (${T_TRACER})
#all "add_executable" definitions (except tests, rb_tool, updatefw)
lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
pdcchsim pucchsim prachsim syncsim lte-hwlat
pdcchsim pucchsim prachsim syncsim
#all "add_library" definitions
ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB
oai_adrv9371_zc706devif oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
+2
View File
@@ -48,6 +48,7 @@ DEADLINE_SCHEDULER_FLAG_USER="False"
FORCE_DEADLINE_SCHEDULER_FLAG_USER=""
CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False
REL="Rel14"
NR_REL="NR_Rel15"
HW="None"
TP="None"
NOS1=0
@@ -582,6 +583,7 @@ function main() {
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( NR_RRC_ASN1_VERSION \"${NR_REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
+5 -32
View File
@@ -147,7 +147,7 @@ clean_all_files() {
set_openair_env
dir=$OPENAIR_DIR/cmake_targets
rm -rf $dir/log $OPENAIR_DIR/targets/bin/*
rm -rf $dir/build_oai $dir/lte-simulators/build
rm -rf $dir/lte_build_oai $dir/lte-simulators/build
rm -rf $dir/oaisim_build_oai/build $dir/oaisim_build_oai/CMakeLists.txt
rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build
}
@@ -242,36 +242,6 @@ install_protobuf_c_from_source(){
) >& $protobuf_c_install_log
}
install_libiio_driver_from_source(){
libiio_install_log=$OPENAIR_DIR/cmake_targets/log/libiio_install_log.txt
echo_info "\nInstalling LibIIO driver from sources. The log file for LibIIO driver installation is here: $libiio_install_log "
(
cd /tmp
echo "Downloading LibIIO driver"
rm -rf /tmp/libiio
git clone https://github.com/analogdevicesinc/libiio.git
cd libiio
git checkout 2016_R2
cmake ./
make all
$SUDO make install
) >& $libiio_install_log
}
check_install_libiio_driver(){
if [[ "$OS_DISTRO" == "ubuntu" ]]; then
$SUDO apt-get install -y --allow-unauthenticated libxml2
$SUDO apt-get install -y --allow-unauthenticated libxml2-dev
$SUDO apt-get install -y --allow-unauthenticated bison
$SUDO apt-get install -y --allow-unauthenticated flex
$SUDO apt-get install -y --allow-unauthenticated libcdk5-dev
$SUDO apt-get install -y --allow-unauthenticated cmake
$SUDO apt-get install -y --allow-unauthenticated libaio-dev
$SUDO apt-get install -y --allow-unauthenticated libavahi-client-dev
install_libiio_driver_from_source
fi
}
install_usrp_uhd_driver_from_source(){
uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt
echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log "
@@ -689,8 +659,11 @@ install_asn1c_from_source(){
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
(
$SUDO rm -rf /tmp/asn1c
GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
# GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
git clone https://github.com/velichkov/asn1c /tmp/asn1c
cd /tmp/asn1c
git checkout s1ap
test -f configure || autoreconf -iv
./configure
make -j`nproc`
$SUDO make install
+25 -1
View File
@@ -94,7 +94,7 @@ function patch_rrc()
case "$version" in
Rel14 )
echo "patching RRC files release 14"
apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]}
#apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]}
;;
Rel10 )
echo "patching RRC files release 10"
@@ -109,12 +109,31 @@ function patch_rrc()
esac
}
function patch_nr_rrc()
{
local directory="$1"
local version="$2"
case "$version" in
NR_Rel15 )
echo "patching NR_RRC files release 15"
apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]}
;;
* )
error unknwon/unhandled NR_RRC version \'"$version"\'
;;
esac
}
function patch_x2ap()
{
local directory="$1"
local version="$2"
case "$version" in
R14 )
;;
R11 )
echo "patching X2AP files release 11.2"
apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]}
@@ -131,6 +150,8 @@ function patch_s1ap()
local version="$2"
case "$version" in
R14 )
;;
R10 )
#nothing to do anymore (fixes went to asn1c)
;;
@@ -161,6 +182,9 @@ function main()
RRC )
patch_rrc "$directory" "$version"
;;
NR_RRC )
patch_nr_rrc "$directory" "$version"
;;
X2AP )
patch_x2ap "$directory" "$version"
;;
+31 -3
View File
@@ -6,9 +6,11 @@ mkdir -p $1
cd $1
shift
local module="$2"
#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
#(there may be a better way...)
if [ $# -eq 1 ]; then
if [ $# -eq 2 ]; then
#asn1c does not work well with extension groups, we need the following fix:
# replace [[ by '<name> SEQUENCE {'
@@ -99,7 +101,21 @@ echo done with asnfix
echo running asn1c
asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
case "$module" in
RRC )
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
NR_RRC )
export ASN1C_PREFIX=NR_
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
S1AP )
export ASN1C_PREFIX=S1AP_
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
esac
rm -f fixed_grammar.asn
@@ -107,7 +123,19 @@ echo asn1c done
else
asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
case "$module" in
RRC )
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
NR_RRC )
export ASN1C_PREFIX=NR_
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
S1AP )
export ASN1C_PREFIX=S1AP_
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
esac
fi
+10 -2
View File
@@ -49,15 +49,21 @@
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
#include "RRC/NR/defs_NR.h"
typedef struct {
/// RAN context config file name
char *config_file_name;
/// Number of RRC instances in this node
int nb_inst;
/// Number of NB_IoT RRC instances in this node
int nb_nb_iot_rrc_inst;
/// Number of NR RRC instances in this node
int nb_nr_inst;
/// Number of Component Carriers per instance in this node
int *nb_CC;
/// Number of NB_IoT instances in this node
int nb_nb_iot_rrc_inst;
/// Number of NR Component Carriers per instance in this node
int *nb_nr_CC;
/// Number of MACRLC instances in this node
int nb_macrlc_inst;
/// Number of NB_IoT MACRLC instances in this node
@@ -84,6 +90,8 @@ typedef struct {
struct eNB_RRC_INST_s **rrc;
/// NB_IoT RRC context variables
//struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
/// NR RRC context variables
struct gNB_RRC_INST_s **nrrrc;
/// MAC context variables
struct eNB_MAC_INST_s **mac;
/// NB_IoT MAC context variables
File diff suppressed because it is too large Load Diff
+748
View File
@@ -0,0 +1,748 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/dlsch_decoding.c
* \brief Top-level routines for decoding Turbo-coded (DLSCH) transport channels from 36-212, V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
//#include "defs.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/CODING/extern.h"
#include "SCHED/extern.h"
#include "SIMULATION/TOOLS/defs.h"
//#define DEBUG_DLSCH_DECODING
//#define UE_DEBUG_TRACE 1
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
{
int i,r;
if (dlsch) {
for (i=0; i<dlsch->Mdlharq; i++) {
if (dlsch->harq_processes[i]) {
if (dlsch->harq_processes[i]->b) {
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
dlsch->harq_processes[i]->b = NULL;
}
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
dlsch->harq_processes[i]->c[r] = NULL;
}
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
if (dlsch->harq_processes[i]->d[r]) {
free16(dlsch->harq_processes[i]->d[r],((3*8*6144)+12+96)*sizeof(short));
dlsch->harq_processes[i]->d[r] = NULL;
}
free16(dlsch->harq_processes[i],sizeof(LTE_DL_UE_HARQ_t));
dlsch->harq_processes[i] = NULL;
}
}
free16(dlsch,sizeof(LTE_UE_DLSCH_t));
dlsch = NULL;
}
}
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
{
LTE_UE_DLSCH_t *dlsch;
uint8_t exit_flag = 0,i,r;
unsigned char bw_scaling =1;
switch (N_RB_DL) {
case 6:
bw_scaling =16;
break;
case 25:
bw_scaling =4;
break;
case 50:
bw_scaling =2;
break;
default:
bw_scaling =1;
break;
}
dlsch = (LTE_UE_DLSCH_t *)malloc16(sizeof(LTE_UE_DLSCH_t));
if (dlsch) {
memset(dlsch,0,sizeof(LTE_UE_DLSCH_t));
dlsch->Kmimo = Kmimo;
dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
dlsch->max_turbo_iterations = max_turbo_iterations;
for (i=0; i<Mdlharq; i++) {
// printf("new_ue_dlsch: Harq process %d\n",i);
dlsch->harq_processes[i] = (LTE_DL_UE_HARQ_t *)malloc16(sizeof(LTE_DL_UE_HARQ_t));
if (dlsch->harq_processes[i]) {
memset(dlsch->harq_processes[i],0,sizeof(LTE_DL_UE_HARQ_t));
dlsch->harq_processes[i]->first_tx=1;
dlsch->harq_processes[i]->b = (uint8_t*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
if (dlsch->harq_processes[i]->b)
memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
else
exit_flag=3;
if (abstraction_flag == 0) {
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
if (dlsch->harq_processes[i]->c[r])
memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768);
else
exit_flag=2;
dlsch->harq_processes[i]->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short));
if (dlsch->harq_processes[i]->d[r])
memset(dlsch->harq_processes[i]->d[r],0,((3*8*6144)+12+96)*sizeof(short));
else
exit_flag=2;
}
}
} else {
exit_flag=1;
}
}
if (exit_flag==0)
return(dlsch);
}
printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag);
free_ue_dlsch(dlsch);
return(NULL);
}
uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
short *dlsch_llr,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_DLSCH_t *dlsch,
LTE_DL_UE_HARQ_t *harq_process,
uint32_t frame,
uint8_t subframe,
uint8_t harq_pid,
uint8_t is_crnti,
uint8_t llr8_flag)
{
#if UE_TIMING_TRACE
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats;
#endif
uint32_t A,E;
uint32_t G;
uint32_t ret,offset;
uint16_t iind;
// uint8_t dummy_channel_output[(3*8*block_length)+12];
short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)];
uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0;
uint8_t crc_type;
#ifdef DEBUG_DLSCH_DECODING
uint16_t i;
#endif
//#ifdef __AVX2__
#if 0
int Kr_last,skipped_last=0;
uint8_t (*tc_2cw)(int16_t *y,
int16_t *y2,
uint8_t *,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
#endif
decoder_if_t tc;
if (!dlsch_llr) {
printf("dlsch_decoding.c: NULL dlsch_llr pointer\n");
return(dlsch->max_turbo_iterations);
}
if (!harq_process) {
printf("dlsch_decoding.c: NULL harq_process pointer\n");
return(dlsch->max_turbo_iterations);
}
if (!frame_parms) {
printf("dlsch_decoding.c: NULL frame_parms pointer\n");
return(dlsch->max_turbo_iterations);
}
if (subframe>9) {
printf("dlsch_decoding.c: Illegal subframe index %d\n",subframe);
return(dlsch->max_turbo_iterations);
}
if (dlsch->harq_ack[subframe].ack != 2) {
LOG_D(PHY, "[UE %d] DLSCH @ SF%d : ACK bit is %d instead of DTX even before PDSCH is decoded!\n",
phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack);
}
if (llr8_flag == 0) {
//#ifdef __AVX2__
#if 0
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
#endif
tc = decoder16;
}
else
{
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
tc = decoder8;
}
// nb_rb = dlsch->nb_rb;
/*
if (nb_rb > frame_parms->N_RB_DL) {
printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
return(max_turbo_iterations);
}*/
/*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]];
if (harq_pid >= 8) {
printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
return(max_turbo_iterations);
}
*/
harq_process->trials[harq_process->round]++;
A = harq_process->TBS; //2072 for QPSK 1/3
ret = dlsch->max_turbo_iterations;
G = harq_process->G;
//get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe);
// printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi);
if (harq_process->round == 0) {
// This is a new packet, so compute quantities regarding segmentation
harq_process->B = A+24;
lte_segmentation(NULL,
NULL,
harq_process->B,
&harq_process->C,
&harq_process->Cplus,
&harq_process->Cminus,
&harq_process->Kplus,
&harq_process->Kminus,
&harq_process->F);
// CLEAR LLR's HERE for first packet in process
}
/*
else {
printf("dlsch_decoding.c: Ndi>0 not checked yet!!\n");
return(max_turbo_iterations);
}
*/
err_flag = 0;
r_offset = 0;
unsigned char bw_scaling =1;
switch (frame_parms->N_RB_DL) {
case 6:
bw_scaling =16;
break;
case 25:
bw_scaling =4;
break;
case 50:
bw_scaling =2;
break;
default:
bw_scaling =1;
break;
}
if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) {
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling);
return((1+dlsch->max_turbo_iterations));
}
#ifdef DEBUG_DLSCH_DECODING
printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus);
#endif
opp_enabled=1;
for (r=0; r<harq_process->C; r++) {
// Get Turbo interleaver parameters
if (r<harq_process->Cminus)
Kr = harq_process->Kminus;
else
Kr = harq_process->Kplus;
Kr_bytes = Kr>>3;
if (Kr_bytes<=64)
iind = (Kr_bytes-5);
else if (Kr_bytes <=128)
iind = 59 + ((Kr_bytes-64)>>1);
else if (Kr_bytes <= 256)
iind = 91 + ((Kr_bytes-128)>>2);
else if (Kr_bytes <= 768)
iind = 123 + ((Kr_bytes-256)>>3);
else {
printf("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes);
return(dlsch->max_turbo_iterations);
}
#ifdef DEBUG_DLSCH_DECODING
printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0);
#endif
#if UE_TIMING_TRACE
start_meas(dlsch_rate_unmatching_stats);
#endif
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
harq_process->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
(uint8_t*) &dummy_w[r][0],
(r==0) ? harq_process->F : 0);
#ifdef DEBUG_DLSCH_DECODING
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
harq_pid,r, G,
Kr*3,
harq_process->TBS,
harq_process->Qm,
harq_process->nb_rb,
harq_process->Nl,
harq_process->rvidx,
harq_process->round);
#endif
#ifdef DEBUG_DLSCH_DECODING
printf(" in decoding dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#endif
if (lte_rate_matching_turbo_rx(harq_process->RTC[r],
G,
harq_process->w[r],
(uint8_t*)&dummy_w[r][0],
dlsch_llr+r_offset,
harq_process->C,
dlsch->Nsoft,
dlsch->Mdlharq,
dlsch->Kmimo,
harq_process->rvidx,
(harq_process->round==0)?1:0,
harq_process->Qm,
harq_process->Nl,
r,
&E)==-1) {
#if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats);
#endif
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
return(dlsch->max_turbo_iterations);
} else
{
#if UE_TIMING_TRACE
stop_meas(dlsch_rate_unmatching_stats);
#endif
}
r_offset += E;
/*
printf("Subblock deinterleaving, d %p w %p\n",
harq_process->d[r],
harq_process->w);
*/
#if UE_TIMING_TRACE
start_meas(dlsch_deinterleaving_stats);
#endif
sub_block_deinterleaving_turbo(4+Kr,
&harq_process->d[r][96],
harq_process->w[r]);
#if UE_TIMING_TRACE
stop_meas(dlsch_deinterleaving_stats);
#endif
#ifdef DEBUG_DLSCH_DECODING
/*
if (r==0) {
write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0);
write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0);
}
printf("decoder input(segment %d) :",r);
int i; for (i=0;i<(3*8*Kr_bytes)+12;i++)
printf("%d : %d\n",i,harq_process->d[r][96+i]);
printf("\n");*/
#endif
// printf("Clearing c, %p\n",harq_process->c[r]);
memset(harq_process->c[r],0,Kr_bytes);
// printf("done\n");
if (harq_process->C == 1)
crc_type = CRC24_A;
else
crc_type = CRC24_B;
/*
printf("decoder input(segment %d)\n",r);
for (i=0;i<(3*8*Kr_bytes)+12;i++)
if ((harq_process->d[r][96+i]>7) ||
(harq_process->d[r][96+i] < -8))
printf("%d : %d\n",i,harq_process->d[r][96+i]);
printf("\n");
*/
//#ifndef __AVX2__
#if 1
if (err_flag == 0) {
/*
LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n",
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations);
*/
if (llr8_flag) {
AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n",
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
}
#if UE_TIMING_TRACE
start_meas(dlsch_turbo_decoding_stats);
#endif
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
ret = tc
(&harq_process->d[r][96],
NULL,
harq_process->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
#if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats);
#endif
}
#else
if ((harq_process->C == 1) ||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
#if UE_TIMING_TRACE
start_meas(dlsch_turbo_decoding_stats);
#endif
ret = tc
(&harq_process->d[r][96],
harq_process->c[r],
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
#if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats);
#endif
// printf("single decode, exit\n");
// exit(-1);
}
else {
// we can merge code segments
if ((skipped_last == 0) && (r<harq_process->C-1)) {
skipped_last = 1;
Kr_last = Kr;
}
else {
skipped_last=0;
if (Kr_last == Kr) { // decode 2 code segments with AVX2 version
#ifdef DEBUG_DLSCH_DECODING
printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]);
#endif
#if UE_TIMING_TRACE
start_meas(dlsch_turbo_decoding_stats);
#endif
#ifdef DEBUG_DLSCH_DECODING
printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]);
#endif
ret = tc_2cw
(&harq_process->d[r-1][96],
&harq_process->d[r][96],
harq_process->c[r-1],
harq_process->c[r],
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
/*
ret = tc
(&harq_process->d[r-1][96],
harq_process->c[r-1],
Kr_last,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
exit(-1);*/
#if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats);
#endif
}
else { // Kr_last != Kr
#if UE_TIMING_TRACE
start_meas(dlsch_turbo_decoding_stats);
#endif
ret = tc
(&harq_process->d[r-1][96],
harq_process->c[r-1],
Kr_last,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
#if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats);
start_meas(dlsch_turbo_decoding_stats);
#endif
ret = tc
(&harq_process->d[r][96],
harq_process->c[r],
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
dlsch->max_turbo_iterations,
crc_type,
(r==0) ? harq_process->F : 0,
&phy_vars_ue->dlsch_tc_init_stats,
&phy_vars_ue->dlsch_tc_alpha_stats,
&phy_vars_ue->dlsch_tc_beta_stats,
&phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
#if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats);
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
harq_process->C,
r,
dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0),
dlsch_deinterleaving_stats->p_time/(cpuf*1000.0),
dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/
#endif
}
}
}
#endif
if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break;
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
err_flag = 1;
}
}
int32_t frame_rx_prev = frame;
int32_t subframe_rx_prev = subframe - 1;
if (subframe_rx_prev < 0) {
frame_rx_prev--;
subframe_rx_prev += 10;
}
frame_rx_prev = frame_rx_prev%1024;
if (err_flag == 1) {
#if UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
#endif
dlsch->harq_ack[subframe].ack = 0;
dlsch->harq_ack[subframe].harq_id = harq_pid;
dlsch->harq_ack[subframe].send_harq_status = 1;
harq_process->errors[harq_process->round]++;
harq_process->round++;
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
if (harq_process->round >= dlsch->Mdlharq) {
harq_process->status = SCH_IDLE;
harq_process->round = 0;
}
if(is_crnti)
{
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
}
return((1+dlsch->max_turbo_iterations));
} else {
#if UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n",
phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb);
#endif
harq_process->status = SCH_IDLE;
harq_process->round = 0;
dlsch->harq_ack[subframe].ack = 1;
dlsch->harq_ack[subframe].harq_id = harq_pid;
dlsch->harq_ack[subframe].send_harq_status = 1;
//LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n",
// phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs);
if(is_crnti)
{
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
}
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
}
// Reassembly of Transport block here
offset = 0;
/*
printf("harq_pid %d\n",harq_pid);
printf("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3);
printf("C %d\n",harq_process->C);
*/
for (r=0; r<harq_process->C; r++) {
if (r<harq_process->Cminus)
Kr = harq_process->Kminus;
else
Kr = harq_process->Kplus;
Kr_bytes = Kr>>3;
// printf("Segment %d : Kr= %d bytes\n",r,Kr_bytes);
if (r==0) {
memcpy(harq_process->b,
&harq_process->c[0][(harq_process->F>>3)],
Kr_bytes - (harq_process->F>>3)- ((harq_process->C>1)?3:0));
offset = Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0);
// printf("copied %d bytes to b sequence (harq_pid %d)\n",
// Kr_bytes - (harq_process->F>>3),harq_pid);
// printf("b[0] = %x,c[%d] = %x\n",
// harq_process->b[0],
// harq_process->F>>3,
// harq_process->c[0][(harq_process->F>>3)]);
} else {
memcpy(harq_process->b+offset,
harq_process->c[r],
Kr_bytes- ((harq_process->C>1)?3:0));
offset += (Kr_bytes - ((harq_process->C>1)?3:0));
}
}
dlsch->last_iteration_cnt = ret;
return(ret);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+173
View File
@@ -0,0 +1,173 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/drs_modulation.c
* \brief Top-level routines for generating the Demodulation Reference Signals from 36-211, V8.6 2009-03
* \author R. Knopp, F. Kaltenberger, A. Bhamri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_DRS
int generate_drs_pusch(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
uint8_t eNB_id,
short amp,
unsigned int subframe,
unsigned int first_rb,
unsigned int nb_rb,
uint8_t ant)
{
uint16_t k,l,Msc_RS,Msc_RS_idx,rb,drs_offset;
uint16_t * Msc_idx_ptr;
int subframe_offset,re_offset,symbol_offset;
//uint32_t phase_shift; // phase shift for cyclic delay in DM RS
//uint8_t alpha_ind;
int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377};
int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384};
uint8_t cyclic_shift,cyclic_shift0,cyclic_shift1;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int32_t *txdataF = ue->common_vars.txdataF[ant];
uint32_t u,v,alpha_ind;
uint32_t u0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1];
uint32_t u1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)];
uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
int32_t ref_re,ref_im;
uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe);
cyclic_shift0 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]+
((ue->ulsch[0]->cooperation_flag==2)?10:0)+
ant*6) % 12;
// printf("PUSCH.cyclicShift %d, n_DMRS2 %d, nPRS %d\n",frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,ue->ulsch[eNB_id]->n_DMRS2,ue->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]);
cyclic_shift1 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+1]+
((ue->ulsch[0]->cooperation_flag==2)?10:0)+
ant*6) % 12;
// cyclic_shift0 = 0;
// cyclic_shift1 = 0;
Msc_RS = 12*nb_rb;
Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints);
if (Msc_idx_ptr)
Msc_RS_idx = Msc_idx_ptr - dftsizes;
else {
LOG_I(PHY,"generate_drs_pusch: index for Msc_RS=%d not found\n",Msc_RS);
return(-1);
}
for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0;
l<frame_parms->symbols_per_tti;
l += (7 - frame_parms->Ncp),u=u1,v=v1,cyclic_shift=cyclic_shift1) {
drs_offset = 0;
#ifdef DEBUG_DRS
printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",Msc_RS, Msc_RS_idx,u,v);
#endif
re_offset = frame_parms->first_carrier_offset;
subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;
symbol_offset = subframe_offset + frame_parms->ofdm_symbol_size*l;
#ifdef DEBUG_DRS
printf("generate_drs_pusch: symbol_offset %d, subframe offset %d, cyclic shift %d\n",symbol_offset,subframe_offset,cyclic_shift);
#endif
alpha_ind = 0;
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
if ((rb >= first_rb) && (rb<(first_rb+nb_rb))) {
#ifdef DEBUG_DRS
printf("generate_drs_pusch: doing RB %d, re_offset=%d, drs_offset=%d,cyclic shift %d\n",rb,re_offset,drs_offset,cyclic_shift);
#endif
for (k=0; k<12; k++) {
ref_re = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][drs_offset<<1];
ref_im = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(drs_offset<<1)+1];
((int16_t*) txdataF)[2*(symbol_offset + re_offset)] = (int16_t) (((ref_re*alpha_re[alpha_ind]) -
(ref_im*alpha_im[alpha_ind]))>>15);
((int16_t*) txdataF)[2*(symbol_offset + re_offset)+1] = (int16_t) (((ref_re*alpha_im[alpha_ind]) +
(ref_im*alpha_re[alpha_ind]))>>15);
((short*) txdataF)[2*(symbol_offset + re_offset)] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)]*(int32_t)amp)>>15);
((short*) txdataF)[2*(symbol_offset + re_offset)+1] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)+1]*(int32_t)amp)>>15);
alpha_ind = (alpha_ind + cyclic_shift);
if (alpha_ind > 11)
alpha_ind-=12;
#ifdef DEBUG_DRS
printf("symbol_offset %d, alpha_ind %d , re_offset %d : (%d,%d)\n",
symbol_offset,
alpha_ind,
re_offset,
((short*) txdataF)[2*(symbol_offset + re_offset)],
((short*) txdataF)[2*(symbol_offset + re_offset)+1]);
#endif // DEBUG_DRS
re_offset++;
drs_offset++;
if (re_offset >= frame_parms->ofdm_symbol_size)
re_offset = 0;
}
} else {
re_offset+=12; // go to next RB
// check if we crossed the symbol boundary and skip DC
if (re_offset >= frame_parms->ofdm_symbol_size) {
if (frame_parms->N_RB_DL&1) // odd number of RBs
re_offset=6;
else // even number of RBs (doesn't straddle DC)
re_offset=0;
}
}
}
}
return(0);
}
+933
View File
@@ -0,0 +1,933 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/ulsch_coding.c
* \brief Top-level routines for coding the ULSCH transport channel as described in 36.212 V8.6 2009-03
* \author R. Knopp
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/CODING/defs.h"
#include "PHY/CODING/extern.h"
#include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs.h"
#include "defs.h"
#include "extern.h"
#include "SIMULATION/ETH_TRANSPORT/extern.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_ULSCH_CODING
//#define DEBUG_ULSCH_FREE 1
/*
#define is_not_pilot(pilots,first_pilot,re) (pilots==0) || \
((pilots==1)&&(first_pilot==1)&&(((re>2)&&(re<6))||((re>8)&&(re<12)))) || \
((pilots==1)&&(first_pilot==0)&&(((re<3))||((re>5)&&(re<9)))) \
*/
#define is_not_pilot(pilots,first_pilot,re) (1)
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
{
int i;
int r;
if (ulsch) {
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch %p\n",ulsch);
#endif
for (i=0; i<8; i++) {
if (ulsch->harq_processes[i]) {
if (ulsch->harq_processes[i]->b) {
free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES);
ulsch->harq_processes[i]->b = NULL;
}
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
if (ulsch->harq_processes[i]->c[r]) {
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
ulsch->harq_processes[i]->c[r] = NULL;
}
}
free16(ulsch->harq_processes[i],sizeof(LTE_UL_UE_HARQ_t));
ulsch->harq_processes[i] = NULL;
}
}
free16(ulsch,sizeof(LTE_UE_ULSCH_t));
ulsch = NULL;
}
}
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag)
{
LTE_UE_ULSCH_t *ulsch;
unsigned char exit_flag = 0,i,j,r;
unsigned char bw_scaling =1;
switch (N_RB_UL) {
case 6:
bw_scaling =16;
break;
case 25:
bw_scaling =4;
break;
case 50:
bw_scaling =2;
break;
default:
bw_scaling =1;
break;
}
ulsch = (LTE_UE_ULSCH_t *)malloc16(sizeof(LTE_UE_ULSCH_t));
if (ulsch) {
memset(ulsch,0,sizeof(LTE_UE_ULSCH_t));
ulsch->Mlimit = 4;
for (i=0; i<8; i++) {
ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t));
// printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]);
if (ulsch->harq_processes[i]) {
memset(ulsch->harq_processes[i], 0, sizeof(LTE_UL_UE_HARQ_t));
ulsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
if (ulsch->harq_processes[i]->b)
memset(ulsch->harq_processes[i]->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling);
else {
LOG_E(PHY,"Can't get b\n");
exit_flag=1;
}
if (abstraction_flag==0) {
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
ulsch->harq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case
if (ulsch->harq_processes[i]->c[r])
memset(ulsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+768);
else {
LOG_E(PHY,"Can't get c\n");
exit_flag=2;
}
}
}
ulsch->harq_processes[i]->subframe_scheduling_flag = 0;
ulsch->harq_processes[i]->first_tx = 1;
} else {
LOG_E(PHY,"Can't get harq_p %d\n",i);
exit_flag=3;
}
}
if ((abstraction_flag == 0) && (exit_flag==0)) {
for (i=0; i<8; i++)
for (j=0; j<96; j++)
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++)
ulsch->harq_processes[i]->d[r][j] = LTE_NULL;
return(ulsch);
} else if (abstraction_flag==1)
return(ulsch);
}
LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t));
free_ue_ulsch(ulsch);
return(NULL);
}
uint32_t ulsch_encoding(uint8_t *a,
PHY_VARS_UE *ue,
uint8_t harq_pid,
uint8_t eNB_id,
uint8_t subframe_rx,
uint8_t tmode,
uint8_t control_only_flag,
uint8_t Nbundled)
{
time_stats_t *seg_stats=&ue->ulsch_segmentation_stats;
time_stats_t *rm_stats=&ue->ulsch_rate_matching_stats;
time_stats_t *te_stats=&ue->ulsch_turbo_encoding_stats;
time_stats_t *i_stats=&ue->ulsch_interleaving_stats;
time_stats_t *m_stats=&ue->ulsch_multiplexing_stats;
// uint16_t offset;
uint32_t crc=1;
uint16_t iind;
uint32_t A;
uint8_t Q_m=0;
uint32_t Kr=0,Kr_bytes,r,r_offset=0;
uint8_t y[6*14*1200],*yptr;;
uint8_t *columnset;
uint32_t sumKr=0;
uint32_t Qprime,L,G,Q_CQI=0,Q_RI=0,Q_ACK=0,H=0,Hprime=0,Hpp=0,Cmux=0,Rmux=0,Rmux_prime=0;
uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0;
// uint32_t E;
uint8_t ack_parity;
uint32_t i,q,j,iprime,j2;
uint16_t o_RCC;
uint8_t o_flip[8];
uint32_t wACK_idx;
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
PHY_MEASUREMENTS *meas = &ue->measurements;
LTE_UE_ULSCH_t *ulsch=ue->ulsch[eNB_id];
LTE_UE_DLSCH_t **dlsch = ue->dlsch[0][eNB_id];
uint16_t rnti = 0xffff;
if (!ulsch) {
LOG_E(PHY,"Null ulsch ptr %p\n",ulsch);
return(-1);
}
if (harq_pid >= 8) {
LOG_E(PHY,"Illegal harq_pid %d\n",harq_pid);
return(-1);
}
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) {
LOG_E(PHY,"Illegal O_ACK %d\n",ulsch->harq_processes[harq_pid]->O_ACK);
return(-1);
}
if (ulsch->O_RI > 1) {
LOG_E(PHY,"Illegal O_RI %d\n",ulsch->O_RI);
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
// fill CQI/PMI information
if (ulsch->O>0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN);
rnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti;
fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff);
LOG_D(PHY,"ULSCH Encoding rnti %x \n", rnti);
print_CQI(ulsch->o,ulsch->uci_format,0,ue->frame_parms.N_RB_DL);
// save PUSCH pmi for later (transmission modes 4,5,6)
if (dlsch[0]) {
//LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi));
dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_OUT);
}
if (ulsch->O<=32) {
o_flip[0] = ulsch->o[3];
o_flip[1] = ulsch->o[2];
o_flip[2] = ulsch->o[1];
o_flip[3] = ulsch->o[0];
} else {
o_flip[0] = ulsch->o[7];
o_flip[1] = ulsch->o[6];
o_flip[2] = ulsch->o[5];
o_flip[3] = ulsch->o[4];
o_flip[4] = ulsch->o[3];
o_flip[5] = ulsch->o[2];
o_flip[6] = ulsch->o[1];
o_flip[7] = ulsch->o[0];
}
if (control_only_flag == 0) {
A=ulsch->harq_processes[harq_pid]->TBS;
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
ulsch->harq_processes[harq_pid]->control_only = 0;
#ifdef DEBUG_ULSCH_CODING
printf("[PHY][UE] ULSCH coding : A %d, Qm %d, mcs %d, harq_pid %d, round %d, RV %d\n",
ulsch->harq_processes[harq_pid]->TBS,
Q_m,
ulsch->harq_processes[harq_pid]->mcs,
harq_pid,
ulsch->harq_processes[harq_pid]->round,
ulsch->harq_processes[harq_pid]->rvidx);
for (i=0; i<ulsch->harq_processes[harq_pid]->O_ACK; i++)
printf("ulsch_coding: o_ACK[%d] %d\n",i,ulsch->o_ACK[i]);
for (i=0; i<ulsch->O_RI; i++)
printf("ulsch_coding: o_RI[%d] %d\n",i,ulsch->o_RI[i]);
printf("ulsch_coding: O=%d\n",ulsch->O);
for (i=0; i<1+((8+ulsch->O)/8); i++) {
// ulsch->o[i] = i;
printf("ulsch_coding: O[%d] %d\n",i,ulsch->o[i]);
}
if ((tmode != 4))
print_CQI(ulsch->o,wideband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL);
else
print_CQI(ulsch->o,HLC_subband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL);
#endif
if (ulsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
start_meas(seg_stats);
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,
A)>>8;
a[A>>3] = ((uint8_t*)&crc)[2];
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
ulsch->harq_processes[harq_pid]->B = A+24;
ulsch->harq_processes[harq_pid]->b = a;
lte_segmentation(ulsch->harq_processes[harq_pid]->b,
ulsch->harq_processes[harq_pid]->c,
ulsch->harq_processes[harq_pid]->B,
&ulsch->harq_processes[harq_pid]->C,
&ulsch->harq_processes[harq_pid]->Cplus,
&ulsch->harq_processes[harq_pid]->Cminus,
&ulsch->harq_processes[harq_pid]->Kplus,
&ulsch->harq_processes[harq_pid]->Kminus,
&ulsch->harq_processes[harq_pid]->F);
stop_meas(seg_stats);
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
if (r<ulsch->harq_processes[harq_pid]->Cminus)
Kr = ulsch->harq_processes[harq_pid]->Kminus;
else
Kr = ulsch->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr>>3;
// get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14)
if (Kr_bytes<=64)
iind = (Kr_bytes-5);
else if (Kr_bytes <=128)
iind = 59 + ((Kr_bytes-64)>>1);
else if (Kr_bytes <= 256)
iind = 91 + ((Kr_bytes-128)>>2);
else if (Kr_bytes <= 768)
iind = 123 + ((Kr_bytes-256)>>3);
else {
LOG_E(PHY,"ulsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
#ifdef DEBUG_ULSCH_CODING
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
// generate codewords
printf("bits_per_codeword (Kr)= %d\n",Kr);
printf("N_RB = %d\n",ulsch->harq_processes[harq_pid]->nb_rb);
printf("Ncp %d\n",frame_parms->Ncp);
printf("Qm %d\n",Q_m);
#endif
// offset=0;
#ifdef DEBUG_ULSCH_CODING
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_ULSCH_CODING
if (r==0)
write_output("enc_output0.m","enc0",&ulsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
#endif
start_meas(i_stats);
ulsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo(4+(Kr_bytes*8),
&ulsch->harq_processes[harq_pid]->d[r][96],
ulsch->harq_processes[harq_pid]->w[r]);
stop_meas(i_stats);
}
}
if (ulsch->harq_processes[harq_pid]->C == 0) {
LOG_E(PHY,"null segment\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
sumKr = 0;
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
if (r<ulsch->harq_processes[harq_pid]->Cminus)
Kr = ulsch->harq_processes[harq_pid]->Kminus;
else
Kr = ulsch->harq_processes[harq_pid]->Kplus;
sumKr += Kr;
}
} else { // This is a control-only PUSCH, set sumKr to O_CQI-MIN
ulsch->harq_processes[harq_pid]->control_only = 1;
sumKr = ulsch->O_CQI_MIN;
}
ulsch->harq_processes[harq_pid]->sumKr = sumKr;
// Compute Q_ri (p. 23 36-212)
Qprime = ulsch->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8;
if (Qprime > 0) {
if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr));
else
Qprime = Qprime/(8*sumKr);
if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12)
Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12;
}
Q_RI = Q_m*Qprime;
Qprime_RI = Qprime;
// Compute Q_ack (p. 23 36-212)
Qprime = ulsch->harq_processes[harq_pid]->O_ACK*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_harqack_times8;
if (Qprime > 0) {
if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr));
else
Qprime = Qprime/(8*sumKr);
if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12)
Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12;
}
Q_ACK = Qprime * Q_m;
Qprime_ACK = Qprime;
LOG_D(PHY,"UE (%x/%d) O_ACK %d, Mcs_initial %d, Nsymb_initial %d, beta_offset_harqack*8 %d, sum Kr %d, Qprime_ACK %d, Q_ACK %d\n",
rnti, harq_pid,
ulsch->harq_processes[harq_pid]->O_ACK,
ulsch->harq_processes[harq_pid]->Msc_initial,
ulsch->harq_processes[harq_pid]->Nsymb_initial,
ulsch->beta_offset_harqack_times8,
sumKr,
Qprime_ACK,
Q_ACK);
// Compute Q_cqi, assume O>11, p. 26 36-212
if (control_only_flag == 0) {
if (ulsch->O < 12)
L=0;
else
L=8;
if (ulsch->O > 0)
Qprime = (ulsch->O + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8;
else
Qprime = 0;
if (Qprime > 0) {
if ((Qprime % (8*sumKr)) > 0)
Qprime = 1+(Qprime/(8*sumKr));
else
Qprime = Qprime/(8*sumKr);
}
G = ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
if (Qprime > (G - ulsch->O_RI))
Qprime = G - ulsch->O_RI;
Q_CQI = Q_m * Qprime;
Qprime_CQI = Qprime;
G = G - Q_RI - Q_CQI;
ulsch->harq_processes[harq_pid]->G = G;
/*
LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK);
LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n",
frame_parms->Nid_cell,ulsch->rnti,
harq_pid,
ulsch->harq_processes[harq_pid]->round,
ulsch->harq_processes[harq_pid]->rvidx,
ulsch->harq_processes[harq_pid]->mcs,
ulsch->O_RI,
ulsch->harq_processes[harq_pid]->O_ACK,
G);
*/
if ((int)G < 0) {
LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
// Data and control multiplexing (5.2.2.7 36-212)
H = G + Q_CQI;
Hprime = H/Q_m;
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
// outputs for each code segment, see Section 5.1.5 p.20
for (r=0; r<ulsch->harq_processes[harq_pid]->C; r++) {
#ifdef DEBUG_ULSCH_CODING
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
r,
G,
Kr*3,
Q_m,ulsch->harq_processes[harq_pid]->nb_rb);
#endif
start_meas(rm_stats);
r_offset += lte_rate_matching_turbo(ulsch->harq_processes[harq_pid]->RTC[r],
G,
ulsch->harq_processes[harq_pid]->w[r],
ulsch->e+r_offset,
ulsch->harq_processes[harq_pid]->C, // C
NSOFT, // Nsoft,
0, // this means UL
1,
ulsch->harq_processes[harq_pid]->rvidx,
get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs),
1,
r,
ulsch->harq_processes[harq_pid]->nb_rb);
//ulsch->harq_processes[harq_pid]->mcs); // r
stop_meas(rm_stats);
#ifdef DEBUG_ULSCH_CODING
if (r==ulsch->harq_processes[harq_pid]->C-1)
write_output("enc_output.m","enc",ulsch->e,r_offset,1,4);
#endif
}
} else { //control-only PUSCH
Q_CQI = (ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch)) - Q_RI;
H = Q_CQI;
Hprime = H/Q_m;
}
// Do CQI coding
if ((ulsch->O>1) && (ulsch->O < 12)) {
LOG_E(PHY,"short CQI sizes not supported yet\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
} else {
// add 8-bit CRC
crc = crc8(o_flip,
ulsch->O)>>24;
#ifdef DEBUG_ULSCH_CODING
printf("crc(cqi) tx : %x\n",crc);
#endif
memset((void *)&ulsch->o_d[0],LTE_NULL,96);
ccodelte_encode(ulsch->O,
1,
o_flip,
&ulsch->o_d[96],
0);
o_RCC = sub_block_interleaving_cc(8+ulsch->O,
&ulsch->o_d[96],
ulsch->o_w);
lte_rate_matching_cc(o_RCC,
Q_CQI,
ulsch->o_w,
ulsch->q);
}
i=0;
// Do RI coding
if (ulsch->O_RI == 1) {
switch (Q_m) {
case 2:
ulsch->q_RI[0] = ulsch->o_RI[0];
ulsch->q_RI[1] = PUSCH_y;//ulsch->o_RI[0];
len_RI=2;
break;
case 4:
ulsch->q_RI[0] = ulsch->o_RI[0];
ulsch->q_RI[1] = PUSCH_y;//1;
ulsch->q_RI[2] = PUSCH_x;//ulsch->o_RI[0];
ulsch->q_RI[3] = PUSCH_x;//1;
len_RI=4;
break;
case 6:
ulsch->q_RI[0] = ulsch->o_RI[0];
ulsch->q_RI[1] = PUSCH_y;//1;
ulsch->q_RI[2] = PUSCH_x;//1;
ulsch->q_RI[3] = PUSCH_x;//ulsch->o_RI[0];
ulsch->q_RI[4] = PUSCH_x;//1;
ulsch->q_RI[5] = PUSCH_x;//1;
len_RI=6;
break;
}
} else if (ulsch->O_RI>1) {
LOG_E(PHY,"RI cannot be more than 1 bit yet\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
// Do ACK coding, Section 5.2.2.6 36.213 (p.23-24 in v8.6)
wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3);
#ifdef DEBUG_ULSCH_CODING
printf("ulsch_coding.c: Bundling %d, Nbundled %d, wACK_idx %d\n",
ulsch->bundling,Nbundled,wACK_idx);
#endif
// 1-bit ACK/NAK
if (ulsch->harq_processes[harq_pid]->O_ACK == 1) {
switch (Q_m) {
case 2:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);//ulsch->o_ACK[0];
len_ACK = 2;
break;
case 4:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);
ulsch->q_ACK[2] = PUSCH_x;
ulsch->q_ACK[3] = PUSCH_x;
len_ACK = 4;
break;
case 6:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);
ulsch->q_ACK[2] = PUSCH_x;
ulsch->q_ACK[3] = PUSCH_x;
ulsch->q_ACK[4] = PUSCH_x;
ulsch->q_ACK[6] = PUSCH_x;
len_ACK = 6;
break;
}
}
// two-bit ACK/NAK
if (ulsch->harq_processes[harq_pid]->O_ACK == 2) {
ack_parity = (ulsch->o_ACK[0]+ulsch->o_ACK[1])&1;
switch (Q_m) {
case 2:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[2] = (ack_parity+wACK[wACK_idx][0])&1;
ulsch->q_ACK[3] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[4] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[5] = (ack_parity+wACK[wACK_idx][1])&1;
len_ACK = 6;
break;
case 4:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[2] = PUSCH_x;
ulsch->q_ACK[3] = PUSCH_x;//1;
ulsch->q_ACK[4] = (ack_parity+wACK[wACK_idx][0])&1;
ulsch->q_ACK[5] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[6] = PUSCH_x;
ulsch->q_ACK[7] = PUSCH_x;//1;
ulsch->q_ACK[8] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[9] = (ack_parity+wACK[wACK_idx][1])&1;
ulsch->q_ACK[10] = PUSCH_x;
ulsch->q_ACK[11] = PUSCH_x;//1;
len_ACK = 12;
break;
case 6:
ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1;
ulsch->q_ACK[2] = PUSCH_x;
ulsch->q_ACK[3] = PUSCH_x;
ulsch->q_ACK[4] = PUSCH_x;
ulsch->q_ACK[5] = PUSCH_x;
ulsch->q_ACK[6] = (ack_parity+wACK[wACK_idx][0])&1;
ulsch->q_ACK[7] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[8] = PUSCH_x;
ulsch->q_ACK[9] = PUSCH_x;
ulsch->q_ACK[10] = PUSCH_x;
ulsch->q_ACK[11] = PUSCH_x;
ulsch->q_ACK[12] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1;
ulsch->q_ACK[13] = (ack_parity+wACK[wACK_idx][1])&1;
ulsch->q_ACK[14] = PUSCH_x;
ulsch->q_ACK[15] = PUSCH_x;
ulsch->q_ACK[16] = PUSCH_x;
ulsch->q_ACK[17] = PUSCH_x;
len_ACK = 18;
break;
}
}
if (ulsch->harq_processes[harq_pid]->O_ACK > 2) {
LOG_E(PHY,"ACK cannot be more than 2 bits yet\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
// channel multiplexing/interleaving
start_meas(m_stats);
Hpp = Hprime + Q_RI;
Cmux = ulsch->Nsymb_pusch;
Rmux = Hpp*Q_m/Cmux;
Rmux_prime = Rmux/Q_m;
Qprime_RI = Q_RI / Q_m;
Qprime_ACK = Q_ACK / Q_m;
Qprime_CQI = Q_CQI / Q_m;
// printf("Qprime_CQI = %d\n",Qprime_CQI);
// RI BITS
memset(y,LTE_NULL,Q_m*Hpp);
if (frame_parms->Ncp == 0)
columnset = cs_ri_normal;
else
columnset = cs_ri_extended;
j=0;
for (i=0; i<Qprime_RI; i++) {
r = Rmux_prime - 1 - (i>>2);
for (q=0; q<Q_m; q++) {
y[q+(Q_m*((r*Cmux) + columnset[j]))] = ulsch->q_RI[(q+(Q_m*i))%len_RI];
// printf("ri[%d] %d => y[%d]\n",q+(Q_m*i)%len_RI,ulsch->q_RI[(q+(Q_m*i))%len_RI],q+(Q_m*((r*Cmux) + columnset[j])),y[q+(Q_m*((r*Cmux) + columnset[j]))]);
}
j=(j+3)&3;
}
// CQI and Data bits
j=0;
/*
for (i=0,iprime=-Qprime_CQI;i<Hprime;i++,iprime++) {
while (y[Q_m*j] != LTE_NULL) j++;
if (i<Qprime_CQI) {
for (q=0;q<Q_m;q++) {
y[q+(Q_m*j)] = ulsch->q[q+(Q_m*i)];
//printf("cqi[%d] %d => y[%d]\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j));
}
}
else {
for (q=0;q<Q_m;q++) {
y[q+(Q_m*j)] = ulsch->e[q+(Q_m*iprime)];
// printf("e[%d] %d => y[%d]\n",q+(Q_m*iprime),ulsch->e[q+(Q_m*iprime)],q+(Q_m*j));
}
}
j++;
}
*/
for (i=0; i<Qprime_CQI; i++) {
while (y[Q_m*j] != LTE_NULL) j++;
for (q=0; q<Q_m; q++) {
y[q+(Q_m*j)] = ulsch->q[q+(Q_m*i)];
// printf("cqi[%d] %d => y[%d] (j %d)\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j),j);
}
j++;
}
j2 = j*Q_m;
switch (Q_m) {
case 2:
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<1; iprime+=2) {
while (y[j2] != LTE_NULL) j2+=2;
y[j2] = ulsch->e[iprime];
y[1+j2] = ulsch->e[1+iprime];
j2+=2;
}
break;
case 4:
for (iprime=0; iprime<(Hprime-Qprime_CQI)<<2; iprime+=4) {
while (y[j2] != LTE_NULL) j2+=4;
y[j2] = ulsch->e[iprime];
y[1+j2] = ulsch->e[1+iprime];
y[2+j2] = ulsch->e[2+iprime];
y[3+j2] = ulsch->e[3+iprime];
j2+=4;
}
break;
case 6:
for (iprime=0; iprime<(Hprime-Qprime_CQI)*6; iprime+=6) {
while (y[j2] != LTE_NULL) j2+=6;
y[j2] = ulsch->e[iprime];
y[1+j2] = ulsch->e[1+iprime];
y[2+j2] = ulsch->e[2+iprime];
y[3+j2] = ulsch->e[3+iprime];
y[4+j2] = ulsch->e[4+iprime];
y[5+j2] = ulsch->e[5+iprime];
j2+=6;
}
break;
}
// HARQ-ACK Bits (Note these overwrite some bits)
if (frame_parms->Ncp == 0)
columnset = cs_ack_normal;
else
columnset = cs_ack_extended;
j=0;
for (i=0; i<Qprime_ACK; i++) {
r = Rmux_prime - 1 - (i>>2);
for (q=0; q<Q_m; q++) {
y[q+(Q_m*((r*Cmux) + columnset[j]))] = ulsch->q_ACK[(q+(Q_m*i))%len_ACK];
#ifdef DEBUG_ULSCH_CODING
printf("ulsch_coding.c: ACK %d => y[%d]=%d (i %d, r*Cmux %d, columnset %d)\n",q+(Q_m*i),
q+(Q_m*((r*Cmux) + columnset[j])),ulsch->q_ACK[(q+(Q_m*i))%len_ACK],
i,r*Cmux,columnset[j]);
#endif
}
j=(j+3)&3;
}
// write out buffer
j=0;
switch (Q_m) {
case 2:
for (i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) {
yptr=&y[((r*Cmux)+i)<<1];
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
}
break;
case 4:
for (i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) {
yptr = &y[((r*Cmux)+i)<<2];
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
}
break;
case 6:
for (i=0; i<Cmux; i++)
for (r=0; r<Rmux_prime; r++) {
yptr = &y[((r*Cmux)+i)*6];
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
ulsch->h[j++] = *yptr++;
}
break;
default:
break;
}
stop_meas(m_stats);
if (j!=(H+Q_RI)) {
LOG_E(PHY,"Error in output buffer length (j %d, H+Q_RI %d)\n",j,H+Q_RI);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
@@ -0,0 +1,777 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY/LTE_TRANSPORT/ulsch_modulation.c
* \brief Top-level routines for generating PUSCH physical channel from 36.211 V8.6 2009-03
* \author R. Knopp, F. Kaltenberger, A. Bhamri
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr
* \note
* \warning
*/
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "PHY/CODING/defs.h"
#include "PHY/CODING/extern.h"
#include "PHY/LTE_TRANSPORT/defs.h"
#include "defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_ULSCH_MODULATION
#ifndef OFDMA_ULSCH
void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
{
#if defined(__x86_64__) || defined(__i386__)
__m128i dft_in128[4][1200],dft_out128[4][1200];
#elif defined(__arm__)
int16x8_t dft_in128[4][1200],dft_out128[4][1200];
#endif
uint32_t *dft_in0=(uint32_t*)dft_in128[0],*dft_out0=(uint32_t*)dft_out128[0];
uint32_t *dft_in1=(uint32_t*)dft_in128[1],*dft_out1=(uint32_t*)dft_out128[1];
uint32_t *dft_in2=(uint32_t*)dft_in128[2],*dft_out2=(uint32_t*)dft_out128[2];
// uint32_t *dft_in3=(uint32_t*)dft_in128[3],*dft_out3=(uint32_t*)dft_out128[3];
uint32_t *d0,*d1,*d2,*d3,*d4,*d5,*d6,*d7,*d8,*d9,*d10,*d11;
uint32_t *z0,*z1,*z2,*z3,*z4,*z5,*z6,*z7,*z8,*z9,*z10,*z11;
uint32_t i,ip;
#if defined(__x86_64__) || defined(__i386__)
__m128i norm128;
#elif defined(__arm__)
int16x8_t norm128;
#endif
// printf("Doing lte_dft for Msc_PUSCH %d\n",Msc_PUSCH);
d0 = (uint32_t *)d;
d1 = d0+Msc_PUSCH;
d2 = d1+Msc_PUSCH;
d3 = d2+Msc_PUSCH;
d4 = d3+Msc_PUSCH;
d5 = d4+Msc_PUSCH;
d6 = d5+Msc_PUSCH;
d7 = d6+Msc_PUSCH;
d8 = d7+Msc_PUSCH;
d9 = d8+Msc_PUSCH;
d10 = d9+Msc_PUSCH;
d11 = d10+Msc_PUSCH;
// printf("symbol 0 (d0 %p, d %p)\n",d0,d);
for (i=0,ip=0; i<Msc_PUSCH; i++,ip+=4) {
dft_in0[ip] = d0[i];
dft_in0[ip+1] = d1[i];
dft_in0[ip+2] = d2[i];
dft_in0[ip+3] = d3[i];
dft_in1[ip] = d4[i];
dft_in1[ip+1] = d5[i];
dft_in1[ip+2] = d6[i];
dft_in1[ip+3] = d7[i];
dft_in2[ip] = d8[i];
dft_in2[ip+1] = d9[i];
dft_in2[ip+2] = d10[i];
dft_in2[ip+3] = d11[i];
// printf("dft%d %d: %d,%d,%d,%d\n",Msc_PUSCH,ip,d0[i],d1[i],d2[i],d3[i]);
// dft_in_re2[ip+1] = d9[i];
// dft_in_re2[ip+2] = d10[i];
}
// printf("\n");
switch (Msc_PUSCH) {
case 12:
dft12((int16_t *)dft_in0,(int16_t *)dft_out0);
dft12((int16_t *)dft_in1,(int16_t *)dft_out1);
dft12((int16_t *)dft_in2,(int16_t *)dft_out2);
/*
dft12f(&((__m128i *)dft_in0)[0],&((__m128i *)dft_in0)[1],&((__m128i *)dft_in0)[2],&((__m128i *)dft_in0)[3],&((__m128i *)dft_in0)[4],&((__m128i *)dft_in0)[5],&((__m128i *)dft_in0)[6],&((__m128i *)dft_in0)[7],&((__m128i *)dft_in0)[8],&((__m128i *)dft_in0)[9],&((__m128i *)dft_in0)[10],&((__m128i *)dft_in0)[11],
&((__m128i *)dft_out0)[0],&((__m128i *)dft_out0)[1],&((__m128i *)dft_out0)[2],&((__m128i *)dft_out0)[3],&((__m128i *)dft_out0)[4],&((__m128i *)dft_out0)[5],&((__m128i *)dft_out0)[6],&((__m128i *)dft_out0)[7],&((__m128i *)dft_out0)[8],&((__m128i *)dft_out0)[9],&((__m128i *)dft_out0)[10],&((__m128i *)dft_out0)[11]);
dft12f(&((__m128i *)dft_in1)[0],&((__m128i *)dft_in1)[1],&((__m128i *)dft_in1)[2],&((__m128i *)dft_in1)[3],&((__m128i *)dft_in1)[4],&((__m128i *)dft_in1)[5],&((__m128i *)dft_in1)[6],&((__m128i *)dft_in1)[7],&((__m128i *)dft_in1)[8],&((__m128i *)dft_in1)[9],&((__m128i *)dft_in1)[10],&((__m128i *)dft_in1)[11],
&((__m128i *)dft_out1)[0],&((__m128i *)dft_out1)[1],&((__m128i *)dft_out1)[2],&((__m128i *)dft_out1)[3],&((__m128i *)dft_out1)[4],&((__m128i *)dft_out1)[5],&((__m128i *)dft_out1)[6],&((__m128i *)dft_out1)[7],&((__m128i *)dft_out1)[8],&((__m128i *)dft_out1)[9],&((__m128i *)dft_out1)[10],&((__m128i *)dft_out1)[11]);
dft12f(&((__m128i *)dft_in2)[0],&((__m128i *)dft_in2)[1],&((__m128i *)dft_in2)[2],&((__m128i *)dft_in2)[3],&((__m128i *)dft_in2)[4],&((__m128i *)dft_in2)[5],&((__m128i *)dft_in2)[6],&((__m128i *)dft_in2)[7],&((__m128i *)dft_in2)[8],&((__m128i *)dft_in2)[9],&((__m128i *)dft_in2)[10],&((__m128i *)dft_in2)[11],
&((__m128i *)dft_out2)[0],&((__m128i *)dft_out2)[1],&((__m128i *)dft_out2)[2],&((__m128i *)dft_out2)[3],&((__m128i *)dft_out2)[4],&((__m128i *)dft_out2)[5],&((__m128i *)dft_out2)[6],&((__m128i *)dft_out2)[7],&((__m128i *)dft_out2)[8],&((__m128i *)dft_out2)[9],&((__m128i *)dft_out2)[10],&((__m128i *)dft_out2)[11]);
*/
#if defined(__x86_64__) || defined(__i386__)
norm128 = _mm_set1_epi16(9459);
#elif defined(__arm__)
norm128 = vdupq_n_s16(9459);
#endif
for (i=0; i<12; i++) {
#if defined(__x86_64__) || defined(__i386__)
((__m128i*)dft_out0)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out0)[i],norm128),1);
((__m128i*)dft_out1)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out1)[i],norm128),1);
((__m128i*)dft_out2)[i] = _mm_slli_epi16(_mm_mulhi_epi16(((__m128i*)dft_out2)[i],norm128),1);
#elif defined(__arm__)
((int16x8_t*)dft_out0)[i] = vqdmulhq_s16(((int16x8_t*)dft_out0)[i],norm128);
((int16x8_t*)dft_out1)[i] = vqdmulhq_s16(((int16x8_t*)dft_out1)[i],norm128);
((int16x8_t*)dft_out2)[i] = vqdmulhq_s16(((int16x8_t*)dft_out2)[i],norm128);
#endif
}
break;
case 24:
dft24((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft24((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft24((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 36:
dft36((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft36((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft36((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 48:
dft48((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft48((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft48((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 60:
dft60((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft60((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft60((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 72:
dft72((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft72((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft72((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 96:
dft96((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft96((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft96((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 108:
dft108((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft108((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft108((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 120:
dft120((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft120((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft120((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 144:
dft144((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft144((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft144((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 180:
dft180((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft180((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft180((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 192:
dft192((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft192((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft192((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 216:
dft216((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft216((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft216((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 240:
dft240((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft240((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft240((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 288:
dft288((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft288((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft288((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 300:
dft300((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft300((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft300((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 324:
dft324((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft324((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft324((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 360:
dft360((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft360((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft360((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 384:
dft384((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft384((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft384((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 432:
dft432((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft432((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft432((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 480:
dft480((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft480((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft480((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 540:
dft540((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft540((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft540((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 576:
dft576((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft576((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft576((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 600:
dft600((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft600((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft600((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 648:
dft648((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft648((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft648((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 720:
dft720((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft720((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft720((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 864:
dft864((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft864((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft864((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 900:
dft900((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft900((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft900((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 960:
dft960((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft960((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft960((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 972:
dft972((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft972((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft972((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 1080:
dft1080((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft1080((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft1080((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 1152:
dft1152((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft1152((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft1152((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
case 1200:
dft1200((int16_t*)dft_in0,(int16_t*)dft_out0,1);
dft1200((int16_t*)dft_in1,(int16_t*)dft_out1,1);
dft1200((int16_t*)dft_in2,(int16_t*)dft_out2,1);
break;
}
z0 = (uint32_t *)z;
z1 = z0+Msc_PUSCH;
z2 = z1+Msc_PUSCH;
z3 = z2+Msc_PUSCH;
z4 = z3+Msc_PUSCH;
z5 = z4+Msc_PUSCH;
z6 = z5+Msc_PUSCH;
z7 = z6+Msc_PUSCH;
z8 = z7+Msc_PUSCH;
z9 = z8+Msc_PUSCH;
z10 = z9+Msc_PUSCH;
z11 = z10+Msc_PUSCH;
// printf("symbol0 (dft)\n");
for (i=0,ip=0; i<Msc_PUSCH; i++,ip+=4) {
z0[i] = dft_out0[ip];
// printf("%d,%d,",((short*)&z0[i])[0],((short*)&z0[i])[1]);
z1[i] = dft_out0[ip+1];
z2[i] = dft_out0[ip+2];
z3[i] = dft_out0[ip+3];
z4[i] = dft_out1[ip+0];
z5[i] = dft_out1[ip+1];
z6[i] = dft_out1[ip+2];
z7[i] = dft_out1[ip+3];
z8[i] = dft_out2[ip];
z9[i] = dft_out2[ip+1];
z10[i] = dft_out2[ip+2];
z11[i] = dft_out2[ip+3];
// printf("out dft%d %d: %d,%d,%d,%d,%d,%d,%d,%d\n",Msc_PUSCH,ip,z0[i],z1[i],z2[i],z3[i],z4[i],z5[i],z6[i],z7[i]);
}
// printf("\n");
}
#endif
void ulsch_modulation(int32_t **txdataF,
short amp,
uint32_t frame,
uint32_t subframe,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_ULSCH_t *ulsch)
{
uint8_t qam64_table_offset_re = 0;
uint8_t qam64_table_offset_im = 0;
uint8_t qam16_table_offset_re = 0;
uint8_t qam16_table_offset_im = 0;
short gain_lin_QPSK;
DevAssert(frame_parms);
int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l;
// uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe);
uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
uint8_t Q_m;
int32_t *txptr;
uint32_t symbol_offset;
uint16_t first_rb;
uint16_t nb_rb;
int G;
uint32_t x1, x2, s=0;
uint8_t c;
if (!ulsch) {
printf("ulsch_modulation.c: Null ulsch\n");
return;
}
// x1 is set in lte_gold_generic
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
if (harq_pid>=8) {
printf("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid);
return;
}
first_rb = ulsch->harq_processes[harq_pid]->first_rb;
nb_rb = ulsch->harq_processes[harq_pid]->nb_rb;
if (nb_rb == 0) {
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal nb_rb %d\n",frame,subframe,nb_rb);
return;
}
if (first_rb > frame_parms->N_RB_UL) {
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal first_rb %d\n",frame,subframe,first_rb);
return;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_IN);
Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs);
G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch);
// Mapping
nsymb = (frame_parms->Ncp==0) ? 14:12;
Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12;
#ifdef DEBUG_ULSCH_MODULATION
LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe);
#endif
// scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!)
//printf("ulsch bits: ");
s = lte_gold_generic(&x1, &x2, 1);
k=0;
//printf("G %d\n",G);
for (i=0; i<(1+(G>>5)); i++) {
for (j=0; j<32; j++,k++) {
c = (uint8_t)((s>>j)&1);
if (ulsch->h[k] == PUSCH_x) {
// printf("i %d: PUSCH_x\n",i);
ulsch->b_tilde[k] = 1;
} else if (ulsch->h[k] == PUSCH_y) {
// printf("i %d: PUSCH_y\n",i);
ulsch->b_tilde[k] = ulsch->b_tilde[k-1];
} else {
ulsch->b_tilde[k] = (ulsch->h[k]+c)&1;
// printf("i %d : %d (h %d c %d)\n", (i<<5)+j,ulsch->b_tilde[k],ulsch->h[k],c);
}
}
s = lte_gold_generic(&x1, &x2, 0);
}
//printf("\n");
gain_lin_QPSK = (short)((amp*ONE_OVER_SQRT2_Q15)>>15);
// Modulation
Msymb = G/Q_m;
if(ulsch->cooperation_flag == 2)
// For Distributed Alamouti Scheme in Collabrative Communication
{
for (i=0,j=Q_m; i<Msymb; i+=2,j+=2*Q_m) {
switch (Q_m) {
case 2:
//UE1, -x1*
((int16_t*)&ulsch->d[i])[0] = (ulsch->b_tilde[j] == 1) ? (gain_lin_QPSK) : -gain_lin_QPSK;
((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK;
// if (i<Msc_PUSCH)
// printf("input %d (%p): %d,%d\n", i,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
// UE1, x0*
((int16_t*)&ulsch->d[i+1])[0] = (ulsch->b_tilde[j-2] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&ulsch->d[i+1])[1] = (ulsch->b_tilde[j-1] == 1)? (gain_lin_QPSK) : -gain_lin_QPSK;
break;
case 4:
//UE1,-x1*
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
if (ulsch->b_tilde[j] == 1)
qam16_table_offset_re+=2;
if (ulsch->b_tilde[j+1] == 1)
qam16_table_offset_im+=2;
if (ulsch->b_tilde[j+2] == 1)
qam16_table_offset_re+=1;
if (ulsch->b_tilde[j+3] == 1)
qam16_table_offset_im+=1;
((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
//UE1,x0*
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
if (ulsch->b_tilde[j-4] == 1)
qam16_table_offset_re+=2;
if (ulsch->b_tilde[j-3] == 1)
qam16_table_offset_im+=2;
if (ulsch->b_tilde[j-2] == 1)
qam16_table_offset_re+=1;
if (ulsch->b_tilde[j-1] == 1)
qam16_table_offset_im+=1;
// ((int16_t*)&ulsch->d[i+1])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
// ((int16_t*)&ulsch->d[i+1])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
break;
case 6:
//UE1,-x1*FPGA_UE
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
if (ulsch->b_tilde[j] == 1)
qam64_table_offset_re+=4;
if (ulsch->b_tilde[j+1] == 1)
qam64_table_offset_im+=4;
if (ulsch->b_tilde[j+2] == 1)
qam64_table_offset_re+=2;
if (ulsch->b_tilde[j+3] == 1)
qam64_table_offset_im+=2;
if (ulsch->b_tilde[j+4] == 1)
qam64_table_offset_re+=1;
if (ulsch->b_tilde[j+5] == 1)
qam64_table_offset_im+=1;
((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
//UE1,x0*
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
if (ulsch->b_tilde[j-6] == 1)
qam64_table_offset_re+=4;
if (ulsch->b_tilde[j-5] == 1)
qam64_table_offset_im+=4;
if (ulsch->b_tilde[j-4] == 1)
qam64_table_offset_re+=2;
if (ulsch->b_tilde[j-3] == 1)
qam64_table_offset_im+=2;
if (ulsch->b_tilde[j-2] == 1)
qam64_table_offset_re+=1;
if (ulsch->b_tilde[j-1] == 1)
qam64_table_offset_im+=1;
((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
break;
}//switch
}//for
}//cooperation_flag == 2
else {
for (i=0,j=0; i<Msymb; i++,j+=Q_m) {
switch (Q_m) {
case 2:
// TODO: this has to be updated!!!
((int16_t*)&ulsch->d[i])[0] = (ulsch->b_tilde[j] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK;
// if (i<Msc_PUSCH)
// printf("input %d/%d Msc_PUSCH %d (%p): %d,%d\n", i,Msymb,Msc_PUSCH,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
break;
case 4:
qam16_table_offset_re = 0;
qam16_table_offset_im = 0;
if (ulsch->b_tilde[j] == 1)
qam16_table_offset_re+=2;
if (ulsch->b_tilde[j+1] == 1)
qam16_table_offset_im+=2;
if (ulsch->b_tilde[j+2] == 1)
qam16_table_offset_re+=1;
if (ulsch->b_tilde[j+3] == 1)
qam16_table_offset_im+=1;
((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15);
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15);
// printf("input(16qam) %d (%p): %d,%d\n", i,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
break;
case 6:
qam64_table_offset_re = 0;
qam64_table_offset_im = 0;
if (ulsch->b_tilde[j] == 1)
qam64_table_offset_re+=4;
if (ulsch->b_tilde[j+1] == 1)
qam64_table_offset_im+=4;
if (ulsch->b_tilde[j+2] == 1)
qam64_table_offset_re+=2;
if (ulsch->b_tilde[j+3] == 1)
qam64_table_offset_im+=2;
if (ulsch->b_tilde[j+4] == 1)
qam64_table_offset_re+=1;
if (ulsch->b_tilde[j+5] == 1)
qam64_table_offset_im+=1;
((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15);
((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
break;
}
}
}// normal symbols
// Transform Precoding
#ifdef OFDMA_ULSCH
for (i=0; i<Msymb; i++) {
ulsch->z[i] = ulsch->d[i];
}
#else
dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch);
#endif
DevAssert(txdataF);
#ifdef OFDMA_ULSCH
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
if (re_offset0>frame_parms->ofdm_symbol_size) {
re_offset0 -= frame_parms->ofdm_symbol_size;
// re_offset0++;
}
// printf("re_offset0 %d\n",re_offset0);
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
re_offset = re_offset0;
symbol_offset = (int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
#ifdef DEBUG_ULSCH_MODULATION
printf("symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
#endif
txptr = &txdataF[0][symbol_offset];
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
}
// Skip reference symbols
else {
// printf("copying %d REs\n",Msc_PUSCH);
for (i=0; i<Msc_PUSCH; i++,j++) {
#ifdef DEBUG_ULSCH_MODULATION
printf("re_offset %d (%p): %d,%d\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1]);
#endif
txptr[re_offset++] = ulsch->z[j];
if (re_offset==frame_parms->ofdm_symbol_size)
re_offset = 0;
}
}
}
# else // OFDMA_ULSCH = 0
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
if (re_offset0>frame_parms->ofdm_symbol_size) {
re_offset0 -= frame_parms->ofdm_symbol_size;
// re_offset0++;
}
// printf("re_offset0 %d\n",re_offset0);
// printf("txdataF %p\n",&txdataF[0][0]);
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
re_offset = re_offset0;
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
#ifdef DEBUG_ULSCH_MODULATION
printf("ulsch_mod (SC-FDMA) symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
#endif
txptr = &txdataF[0][symbol_offset];
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
}
// Skip reference symbols
else {
// printf("copying %d REs\n",Msc_PUSCH);
for (i=0; i<Msc_PUSCH; i++,j++) {
#ifdef DEBUG_ULSCH_MODULATION
printf("re_offset %d (%p): %d,%d => %p\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1],&txptr[re_offset]);
#endif //DEBUG_ULSCH_MODULATION
txptr[re_offset++] = ulsch->z[j];
if (re_offset==frame_parms->ofdm_symbol_size)
re_offset = 0;
}
}
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_OUT);
}
@@ -32,8 +32,8 @@
#include "PHY/defs_UE.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/phy_extern_ue.h"
#include "transport_ue.h"
#include "PHY/extern_ue.h"
#include "tools_defs.h"
#include "PHY/sse_intrin.h"
int16_t ones256[16] __attribute__ ((aligned(32))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
File diff suppressed because one or more lines are too long
+7
View File
@@ -84,6 +84,10 @@ typedef boolean_t eNB_flag_t;
#define ENB_FLAG_NO FALSE
#define ENB_FLAG_YES TRUE
typedef boolean_t gNB_flag_t;
#define GNB_FLAG_NO FALSE
#define GNB_FLAG_YES TRUE
typedef boolean_t srb_flag_t;
#define SRB_FLAG_NO FALSE
#define SRB_FLAG_YES TRUE
@@ -236,6 +240,9 @@ typedef struct protocol_ctxt_s {
#define UE_INSTANCE_TO_MODULE_ID( iNSTANCE ) iNSTANCE - NB_eNB_INST
#define ENB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE
//NR
#define GNB_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD
#define GNB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE
#define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \
if(eNB_fLAG == ENB_FLAG_YES) \
+254 -52
View File
@@ -64,6 +64,8 @@ typedef UL_DCCH_Message_t RrcUlDcchMessage;
#define NBIOTRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nbiotrrc_configuration_req
#define NRRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nrrrc_configuration_req
#define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req
#define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req
#define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req
@@ -87,13 +89,13 @@ typedef struct RrcStateInd_s {
// eNB: ENB_APP -> RRC messages
typedef struct RrcConfigurationReq_s {
uint32_t cell_identity;
uint32_t cell_identity;
uint16_t tac;
uint16_t tac;
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
paging_drx_t default_drx;
@@ -171,75 +173,275 @@ typedef struct RrcConfigurationReq_s {
} RrcConfigurationReq;
#define MAX_NUM_NBIOT_CELEVELS 3
typedef struct NbIoTRrcConfigurationReq_s {
uint32_t cell_identity;
uint32_t cell_identity;
uint16_t tac;
uint16_t tac;
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
lte_frame_type_t frame_type;
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
lte_frame_type_t frame_type;
uint8_t tdd_config;
uint8_t tdd_config_s;
lte_prefix_type_t prefix_type;
lte_prefix_type_t prefix_type_UL;
lte_prefix_type_t prefix_type_UL;
int16_t eutra_band;
uint32_t downlink_frequency;
int32_t uplink_frequency_offset;
int16_t Nid_cell;// for testing, change later
int16_t N_RB_DL;// for testing, change later
//RACH
long rach_raResponseWindowSize_NB;
long rach_macContentionResolutionTimer_NB;
long rach_powerRampingStep_NB;
long rach_preambleInitialReceivedTargetPower_NB;
long rach_preambleTransMax_CE_NB;
long rach_raResponseWindowSize_NB;
long rach_macContentionResolutionTimer_NB;
long rach_powerRampingStep_NB;
long rach_preambleInitialReceivedTargetPower_NB;
long rach_preambleTransMax_CE_NB;
//BCCH
long bcch_modificationPeriodCoeff_NB;
long bcch_modificationPeriodCoeff_NB;
//PCCH
long pcch_defaultPagingCycle_NB;
long pcch_nB_NB;
long pcch_npdcch_NumRepetitionPaging_NB;
long pcch_defaultPagingCycle_NB;
long pcch_nB_NB;
long pcch_npdcch_NumRepetitionPaging_NB;
//NPRACH
long nprach_CP_Length;
long nprach_rsrp_range;
long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS];
long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS];
long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS];
long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS];
long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS];
long nprach_SubcarrierMSG3_RangeStart;
long maxNumPreambleAttemptCE_NB;
long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS];
long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS];
long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS];
long nprach_CP_Length;
long nprach_rsrp_range;
long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS];
long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS];
long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS];
long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS];
long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS];
long nprach_SubcarrierMSG3_RangeStart;
long maxNumPreambleAttemptCE_NB;
long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS];
long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS];
long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS];
//NPDSCH
long npdsch_nrs_Power;
long npdsch_nrs_Power;
//NPUSCH
long npusch_ack_nack_numRepetitions_NB;
long npusch_srs_SubframeConfig_NB;
long npusch_threeTone_CyclicShift_r13;
long npusch_sixTone_CyclicShift_r13;
BOOLEAN_t npusch_groupHoppingEnabled;
long npusch_groupAssignmentNPUSCH_r13;
long npusch_ack_nack_numRepetitions_NB;
long npusch_srs_SubframeConfig_NB;
long npusch_threeTone_CyclicShift_r13;
long npusch_sixTone_CyclicShift_r13;
BOOLEAN_t npusch_groupHoppingEnabled;
long npusch_groupAssignmentNPUSCH_r13;
//DL_GapConfig
long dl_GapThreshold_NB;
long dl_GapPeriodicity_NB;
long dl_GapDurationCoeff_NB;
long dl_GapThreshold_NB;
long dl_GapPeriodicity_NB;
long dl_GapDurationCoeff_NB;
//Uplink power control Common
long npusch_p0_NominalNPUSCH;
long npusch_alpha;
long deltaPreambleMsg3;
long npusch_p0_NominalNPUSCH;
long npusch_alpha;
long deltaPreambleMsg3;
//UE timers and constants
long ue_TimersAndConstants_t300_NB;
long ue_TimersAndConstants_t301_NB;
long ue_TimersAndConstants_t310_NB;
long ue_TimersAndConstants_t311_NB;
long ue_TimersAndConstants_n310_NB;
long ue_TimersAndConstants_n311_NB;
long ue_TimersAndConstants_t300_NB;
long ue_TimersAndConstants_t301_NB;
long ue_TimersAndConstants_t310_NB;
long ue_TimersAndConstants_t311_NB;
long ue_TimersAndConstants_n310_NB;
long ue_TimersAndConstants_n311_NB;
} NbIoTRrcConfigurationReq;
// gNB: GNB_APP -> RRC messages
typedef struct NRRrcConfigurationReq_s {
uint32_t cell_identity;
uint16_t tac;
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
int16_t nb_cc;
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint8_t tdd_config[MAX_NUM_CCs];
uint8_t tdd_config_s[MAX_NUM_CCs];
lte_prefix_type_t DL_prefix_type[MAX_NUM_CCs];
lte_prefix_type_t UL_prefix_type[MAX_NUM_CCs];
int16_t eutra_band[MAX_NUM_CCs];
uint32_t downlink_frequency[MAX_NUM_CCs];
int32_t uplink_frequency_offset[MAX_NUM_CCs];
int16_t Nid_cell[MAX_NUM_CCs];// for testing, change later
int16_t N_RB_DL[MAX_NUM_CCs];// for testing, change later
int nb_antenna_ports[MAX_NUM_CCs];
///NR
//MIB
long MIB_subCarrierSpacingCommon[MAX_NUM_CCs];
uint32_t MIB_ssb_SubcarrierOffset[MAX_NUM_CCs];
long MIB_dmrs_TypeA_Position[MAX_NUM_CCs];
uint32_t pdcch_ConfigSIB1[MAX_NUM_CCs];
//SIB1
long SIB1_frequencyOffsetSSB[MAX_NUM_CCs];
long SIB1_ssb_PeriodicityServingCell[MAX_NUM_CCs];
long SIB1_ss_PBCH_BlockPower[MAX_NUM_CCs];
//NR FrequencyInfoDL
long absoluteFrequencySSB[MAX_NUM_CCs];
uint32_t ssb_SubcarrierOffset[MAX_NUM_CCs];
long DL_FreqBandIndicatorNR[MAX_NUM_CCs];
long DL_absoluteFrequencyPointA[MAX_NUM_CCs];
//NR DL SCS-SpecificCarrier
uint32_t DL_offsetToCarrier[MAX_NUM_CCs];
long DL_SCS_SubcarrierSpacing[MAX_NUM_CCs];
long DL_SCS_SpecificCarrier_k0[MAX_NUM_CCs];
uint32_t DL_carrierBandwidth[MAX_NUM_CCs];
//NR BWP-DownlinkCommon
uint32_t DL_locationAndBandwidth[MAX_NUM_CCs];
long DL_BWP_SubcarrierSpacing[MAX_NUM_CCs];
lte_prefix_type_t DL_BWP_prefix_type[MAX_NUM_CCs];
//NR FrequencyInfoUL
long UL_FreqBandIndicatorNR[MAX_NUM_CCs];
long UL_absoluteFrequencyPointA[MAX_NUM_CCs];
lte_prefix_type_t UL_additionalSpectrumEmission[MAX_NUM_CCs];
long UL_p_Max[MAX_NUM_CCs];
long ULfrequencyShift7p5khz[MAX_NUM_CCs];
//NR UL SCS-SpecificCarrier
uint32_t UL_offsetToCarrier[MAX_NUM_CCs];
long UL_SCS_SubcarrierSpacing[MAX_NUM_CCs];
long UL_SCS_SpecificCarrier_k0[MAX_NUM_CCs];
uint32_t UL_carrierBandwidth[MAX_NUM_CCs];
// NR BWP-UplinkCommon
uint32_t UL_locationAndBandwidth[MAX_NUM_CCs];
long UL_BWP_SubcarrierSpacing[MAX_NUM_CCs];
lte_prefix_type_t UL_BWP_prefix_type[MAX_NUM_CCs];
long ServingCellConfigCommon_ssb_PositionsInBurst_PR[MAX_NUM_CCs];
long ServingCellConfigCommon_ssb_periodicityServingCell[MAX_NUM_CCs]; //ServingCellConfigCommon
long ServingCellConfigCommon_dmrs_TypeA_Position[MAX_NUM_CCs]; //ServingCellConfigCommon
long NIA_SubcarrierSpacing[MAX_NUM_CCs]; //ServingCellConfigCommon Used only for non-initial access
long ServingCellConfigCommon_ss_PBCH_BlockPower[MAX_NUM_CCs]; //ServingCellConfigCommon
//NR TDD-UL-DL-ConfigCommon
long referenceSubcarrierSpacing[MAX_NUM_CCs];
long dl_UL_TransmissionPeriodicity[MAX_NUM_CCs];
long nrofDownlinkSlots[MAX_NUM_CCs];
long nrofDownlinkSymbols[MAX_NUM_CCs];
long nrofUplinkSlots[MAX_NUM_CCs];
long nrofUplinkSymbols[MAX_NUM_CCs];
//NR RACH-ConfigCommon
long rach_totalNumberOfRA_Preambles[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[MAX_NUM_CCs];
long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[MAX_NUM_CCs];
uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four[MAX_NUM_CCs];
uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight[MAX_NUM_CCs];
uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen[MAX_NUM_CCs];
BOOLEAN_t rach_groupBconfigured[MAX_NUM_CCs];
long rach_ra_Msg3SizeGroupA[MAX_NUM_CCs];
long rach_messagePowerOffsetGroupB[MAX_NUM_CCs];
long rach_numberOfRA_PreamblesGroupA[MAX_NUM_CCs];
long rach_ra_ContentionResolutionTimer[MAX_NUM_CCs];
long rsrp_ThresholdSSB[MAX_NUM_CCs];
long rsrp_ThresholdSSB_SUL[MAX_NUM_CCs];
long prach_RootSequenceIndex_choice[MAX_NUM_CCs];
uint32_t prach_RootSequenceIndex_l839[MAX_NUM_CCs];
uint32_t prach_RootSequenceIndex_l139[MAX_NUM_CCs];
long prach_msg1_SubcarrierSpacing[MAX_NUM_CCs];
long restrictedSetConfig[MAX_NUM_CCs];
long msg3_transformPrecoding[MAX_NUM_CCs];
//ssb-perRACH-OccasionAndCB-PreamblesPerSSB not sure
//NR RACH-ConfigGeneric
uint32_t prach_ConfigurationIndex[MAX_NUM_CCs];
long prach_msg1_FDM[MAX_NUM_CCs];
long prach_msg1_FrequencyStart[MAX_NUM_CCs];
uint32_t zeroCorrelationZoneConfig[MAX_NUM_CCs];
long preambleReceivedTargetPower[MAX_NUM_CCs];
long preambleTransMax[MAX_NUM_CCs];
long powerRampingStep[MAX_NUM_CCs];
long ra_ResponseWindow[MAX_NUM_CCs];
//NR PUSCH-ConfigCommon
BOOLEAN_t groupHoppingEnabledTransformPrecoding[MAX_NUM_CCs];
long msg3_DeltaPreamble[MAX_NUM_CCs];
long p0_NominalWithGrant[MAX_NUM_CCs];
///NR PUSCH-TimeDomainResourceAllocation
uint32_t PUSCH_TimeDomainResourceAllocation_k2[MAX_NUM_CCs];
long PUSCH_TimeDomainResourceAllocation_mappingType[MAX_NUM_CCs];
//NR PUCCH-ConfigCommon
long pucch_GroupHopping[MAX_NUM_CCs];
long p0_nominal[MAX_NUM_CCs];
//NR PDSCH-ConfigCOmmon
//NR PDSCH-TimeDomainResourceAllocation
uint32_t PDSCH_TimeDomainResourceAllocation_k0[MAX_NUM_CCs];
long PDSCH_TimeDomainResourceAllocation_mappingType[MAX_NUM_CCs];
//NR RateMatchPattern is used to configure one rate matching pattern for PDSCH
long rateMatchPatternId[MAX_NUM_CCs];
long RateMatchPattern_patternType[MAX_NUM_CCs];
long symbolsInResourceBlock[MAX_NUM_CCs];
long periodicityAndPattern[MAX_NUM_CCs];
long RateMatchPattern_controlResourceSet[MAX_NUM_CCs]; ///ControlResourceSetId
long RateMatchPattern_subcarrierSpacing[MAX_NUM_CCs];
long RateMatchPattern_mode[MAX_NUM_CCs];
//NR PDCCH-ConfigCommon
long searchSpaceSIB1[MAX_NUM_CCs];
long searchSpaceOtherSystemInformation[MAX_NUM_CCs];
long pagingSearchSpace[MAX_NUM_CCs];
long ra_SearchSpace[MAX_NUM_CCs];
long rach_ra_ControlResourceSet[MAX_NUM_CCs];
//NR PDCCH-ConfigCommon commonControlResourcesSets
long PDCCH_common_controlResourceSetId[MAX_NUM_CCs];
long PDCCH_common_ControlResourceSet_duration[MAX_NUM_CCs];
long PDCCH_cce_REG_MappingType[MAX_NUM_CCs];
long PDCCH_reg_BundleSize[MAX_NUM_CCs];
long PDCCH_interleaverSize[MAX_NUM_CCs];
long PDCCH_shiftIndex[MAX_NUM_CCs];
long PDCCH_precoderGranularity[MAX_NUM_CCs]; //Corresponds to L1 parameter 'CORESET-precoder-granuality'
long PDCCH_TCI_StateId[MAX_NUM_CCs];
BOOLEAN_t tci_PresentInDCI[MAX_NUM_CCs];
//NR PDCCH-ConfigCommon commonSearchSpaces
long SearchSpaceId[MAX_NUM_CCs];
long commonSearchSpaces_controlResourceSetId[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_choice[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl1[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl2[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl4[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl5[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl8[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl10[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl16[MAX_NUM_CCs];
long SearchSpace_monitoringSlotPeriodicityAndOffset_sl20[MAX_NUM_CCs];
long SearchSpace_nrofCandidates_aggregationLevel1[MAX_NUM_CCs];
long SearchSpace_nrofCandidates_aggregationLevel2[MAX_NUM_CCs];
long SearchSpace_nrofCandidates_aggregationLevel4[MAX_NUM_CCs];
long SearchSpace_nrofCandidates_aggregationLevel8[MAX_NUM_CCs];
long SearchSpace_nrofCandidates_aggregationLevel16[MAX_NUM_CCs];
long SearchSpace_searchSpaceType[MAX_NUM_CCs];
long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1[MAX_NUM_CCs];
long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2[MAX_NUM_CCs];
long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4[MAX_NUM_CCs];
long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8[MAX_NUM_CCs];
long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16[MAX_NUM_CCs];
long Common_dci_Format2_3_monitoringPeriodicity[MAX_NUM_CCs];
long Common_dci_Format2_3_nrofPDCCH_Candidates[MAX_NUM_CCs];
long ue_Specific__dci_Formats[MAX_NUM_CCs];
//RateMatchPatternLTE-CRS
uint32_t RateMatchPatternLTE_CRS_carrierFreqDL[MAX_NUM_CCs];
long RateMatchPatternLTE_CRS_carrierBandwidthDL[MAX_NUM_CCs];
long RateMatchPatternLTE_CRS_nrofCRS_Ports[MAX_NUM_CCs];
long RateMatchPatternLTE_CRS_v_Shift[MAX_NUM_CCs];
long RateMatchPatternLTE_CRS_radioframeAllocationPeriod[MAX_NUM_CCs];
uint32_t RateMatchPatternLTE_CRS_radioframeAllocationOffset[MAX_NUM_CCs];
long RateMatchPatternLTE_CRS_subframeAllocation_choice[MAX_NUM_CCs];
} gNB_RrcConfigurationReq;
// UE: NAS -> RRC messages
typedef kenb_refresh_req_t NasKenbRefreshReq;
+91
View File
@@ -0,0 +1,91 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/GNB_APP/RRC_paramsvalues.h
* \brief macro definitions for RRC authorized and asn1 parameters values, to be used in paramdef_t/chechedparam_t structure initializations
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#ifndef __NRRRC_PARAMSVALUES__H__
#define __NRRRC_PARAMSVALUES__H__
/* cell configuration section name */
#define GNB_CONFIG_STRING_GNB_LIST "gNBs"
/* component carriers configuration section name */
#define GNB_CONFIG_STRING_COMPONENT_CARRIERS "component_carriers"
#define GNB_CONFIG_STRING_FRAME_TYPE "frame_type"
#define GNB_CONFIG_STRING_DL_PREFIX_TYPE "DL_prefix_type"
#define GNB_CONFIG_STRING_UL_PREFIX_TYPE "UL_prefix_type"
#define GNB_CONFIG_STRING_EUTRA_BAND "eutra_band"
#define GNB_CONFIG_STRING_DOWNLINK_FREQUENCY "downlink_frequency"
#define GNB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET "uplink_frequency_offset"
#define GNB_CONFIG_STRING_NID_CELL "Nid_cell"
#define GNB_CONFIG_STRING_N_RB_DL "N_RB_DL"
#define GNB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn"
#define FRAMETYPE_OKVALUES {"FDD","TDD"}
#define FRAMETYPE_MODVALUES { FDD, TDD}
#define TDDCFG(A) TDD_Config__subframeAssignment_ ## A
#define TDDCONFIG_OKRANGE { TDDCFG(sa0), TDDCFG(sa6)}
#define TDDCFGS(A) TDD_Config__specialSubframePatterns_ ## A
#define TDDCONFIGS_OKRANGE { TDDCFGS(ssp0), TDDCFGS(ssp8)}
#define PREFIX_OKVALUES {"NORMAL","EXTENDED"}
#define PREFIX_MODVALUES { NORMAL, EXTENDED}
#define PREFIXUL_OKVALUES {"NORMAL","EXTENDED"}
#define PREFIXUL_MODVALUES { NORMAL, EXTENDED}
#define NRBDL_OKVALUES {6,15,25,50,75,100}
#define UETIMER_T300_OKVALUES {100,200,300,400,600,1000,1500,2000}
#define UETT300(A) UE_TimersAndConstants__t300_ ## A
#define UETIMER_T300_MODVALUES { UETT300(ms100), UETT300(ms200),UETT300(ms300),UETT300(ms400),UETT300(ms600),UETT300(ms1000),UETT300(ms1500),UETT300(ms2000)}
#define UETIMER_T301_OKVALUES {100,200,300,400,600,1000,1500,2000}
#define UETT301(A) UE_TimersAndConstants__t301_ ## A
#define UETIMER_T301_MODVALUES { UETT301(ms100), UETT301(ms200),UETT301(ms300),UETT301(ms400),UETT301(ms600),UETT301(ms1000),UETT301(ms1500),UETT301(ms2000)}
#define UETIMER_T310_OKVALUES {0,50,100,200,500,1000,2000}
#define UETT310(A) UE_TimersAndConstants__t310_ ## A
#define UETIMER_T310_MODVALUES { UETT310(ms0), UETT310(ms50),UETT310(ms100),UETT310(ms200),UETT310(ms500),UETT310(ms1000),UETT310(ms2000)}
#define UETIMER_T311_OKVALUES {1000,3110,5000,10000,15000,20000,31100}
#define UETT311(A) UE_TimersAndConstants__t311_ ## A
#define UETIMER_T311_MODVALUES { UETT311(ms1000), UETT311(ms3000),UETT311(ms5000),UETT311(ms10000),UETT311(ms15000),UETT311(ms20000),UETT311(ms30000)}
#define UETIMER_N310_OKVALUES {1,2,3,4,6,8,10,20}
#define UETN310(A) UE_TimersAndConstants__n310_ ## A
#define UETIMER_N310_MODVALUES { UETN310(n1), UETN310(n2),UETN310(n3),UETN310(n4),UETN310(n6),UETN310(n8),UETN310(n10),UETN310(n20)}
#define UETIMER_N311_OKVALUES {1,2,3,4,5,6,8,10}
#define UETN311(A) UE_TimersAndConstants__n311_ ## A
#define UETIMER_N311_MODVALUES { UETN311(n1), UETN311(n2),UETN311(n3),UETN311(n4),UETN311(n5),UETN311(n6),UETN311(n8),UETN311(n10)}
#endif
+291
View File
@@ -0,0 +1,291 @@
/*
* 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
*/
/*
gnb_app.c
-------------------
AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr and Navid Nikaein
*/
#include <string.h>
#include <stdio.h>
#include "gnb_app.h"
#include "gnb_config.h"
#include "assertions.h"
#include "common/ran_context.h"
#include "log.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
# include "timer.h"
# if defined(ENABLE_USE_MME)
# include "s1ap_eNB.h"
# include "sctp_eNB_task.h"
# include "gtpv1u_eNB_task.h"
# endif
extern unsigned char NB_gNB_INST;
#endif
extern RAN_CONTEXT_t RC;
#if defined(ENABLE_ITTI)
/*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_MME)
# define GNB_REGISTER_RETRY_DELAY 10
# endif
/*------------------------------------------------------------------------------*/
/*
static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties)
{
MessageDef *msg_p;
int CC_id;
msg_p = itti_alloc_new_message (TASK_ENB_APP, PHY_CONFIGURATION_REQ);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_CONFIGURATION_REQ (msg_p).frame_type[CC_id] = enb_properties->properties[enb_id]->frame_type[CC_id];
PHY_CONFIGURATION_REQ (msg_p).prefix_type[CC_id] = enb_properties->properties[enb_id]->prefix_type[CC_id];
PHY_CONFIGURATION_REQ (msg_p).downlink_frequency[CC_id] = enb_properties->properties[enb_id]->downlink_frequency[CC_id];
PHY_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[CC_id] = enb_properties->properties[enb_id]->uplink_frequency_offset[CC_id];
PHY_CONFIGURATION_REQ (msg_p).nb_antennas_tx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_tx[CC_id];
PHY_CONFIGURATION_REQ (msg_p).nb_antennas_rx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_rx[CC_id];
PHY_CONFIGURATION_REQ (msg_p).tx_gain[CC_id] = enb_properties->properties[enb_id]->tx_gain[CC_id];
PHY_CONFIGURATION_REQ (msg_p).rx_gain[CC_id] = enb_properties->properties[enb_id]->rx_gain[CC_id];
}
itti_send_msg_to_task (TASK_PHY_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
}
*/
/*------------------------------------------------------------------------------*/
static void configure_nrrrc(uint32_t gnb_id)
{
MessageDef *msg_p = NULL;
// int CC_id;
msg_p = itti_alloc_new_message (TASK_GNB_APP, NRRRC_CONFIGURATION_REQ);
if (RC.nr_rrc[gnb_id]) {
RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]);
LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n");
itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
}
else AssertFatal(0,"NRRRC context for gNB %d not allocated\n",gnb_id);
}
/*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_MME)
static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties)
{
uint32_t gnb_id;
MessageDef *msg_p;
uint32_t register_gnb_pending = 0;
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
{
s1ap_register_gnb_req_t *s1ap_register_gNB;
/* note: there is an implicit relationship between the data structure and the message name */
msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_GNB_REQ);
RCconfig_S1(msg_p, gnb_id);
if (gnb_id == 0) RCconfig_gtpu();
s1ap_register_gNB = &S1AP_REGISTER_GNB_REQ(msg_p);
LOG_I(GNB_APP,"default drx %d\n",s1ap_register_gNB->default_drx);
LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id));
itti_send_msg_to_task (TASK_S1AP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p);
register_gnb_pending++;
}
}
return register_gnb_pending;
}
# endif
#endif
/*------------------------------------------------------------------------------*/
void *gNB_app_task(void *args_p)
{
#if defined(ENABLE_ITTI)
uint32_t gnb_nb = RC.nb_nr_inst;
uint32_t gnb_id_start = 0;
uint32_t gnb_id_end = gnb_id_start + gnb_nb;
# if defined(ENABLE_USE_MME)
uint32_t register_gnb_pending;
uint32_t registered_gnb;
long gnb_register_retry_timer_id;
# endif
uint32_t gnb_id;
MessageDef *msg_p = NULL;
const char *msg_name = NULL;
instance_t instance;
int result;
/* for no gcc warnings */
(void)instance;
itti_mark_task_ready (TASK_GNB_APP);
LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__);
//RCconfig_L1();
//RCconfig_macrlc();
LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n");
AssertFatal (gnb_nb <= RC.nb_nr_inst,
"Number of gNB is greater than gNB defined in configuration file (%d/%d)!",
gnb_nb, RC.nb_nr_inst);
LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst);
RC.rrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.rrc);
for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) {
RC.rrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.rrc[gnb_id], gnb_id+1, gnb_id_end);
memset((void *)RC.rrc[gnb_id],0,sizeof(gNB_RRC_INST));
configure_nrrrc(gnb_id);
}
# if defined(ENABLE_USE_MME)
/* Try to register each gNB */
registered_gnb = 0;
register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
# else
/* Start L2L1 task */
msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE);
itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p);
# endif
do {
// Wait for a message
itti_receive_msg (TASK_GNB_APP, &msg_p);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(GNB_APP, " *** Exiting GNB_APP thread\n");
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_I(GNB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
# if defined(ENABLE_USE_MME)
case S1AP_REGISTER_ENB_CNF:
LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
S1AP_REGISTER_ENB_CNF(msg_p).nb_mme);
DevAssert(register_gnb_pending > 0);
register_gnb_pending--;
/* Check if at least gNB is registered with one MME */
if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) {
registered_gnb++;
}
/* Check if all register gNB requests have been processed */
if (register_gnb_pending == 0) {
if (registered_gnb == gnb_nb) {
/* If all gNB are registered, start L2L1 task */
MessageDef *msg_init_p;
msg_init_p = itti_alloc_new_message (TASK_GNB_APP, INITIALIZE_MESSAGE);
itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p);
} else {
uint32_t not_associated = gnb_nb - registered_gnb;
LOG_W(GNB_APP, " %d gNB %s not associated with a MME, retrying registration in %d seconds ...\n",
not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY);
/* Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds */
if (timer_setup (GNB_REGISTER_RETRY_DELAY, 0, TASK_GNB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
NULL, &gnb_register_retry_timer_id) < 0) {
LOG_E(GNB_APP, " Can not start gNB register retry timer, use \"sleep\" instead!\n");
sleep(GNB_REGISTER_RETRY_DELAY);
/* Restart the registration process */
registered_gnb = 0;
register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p);
}
}
}
break;
case S1AP_DEREGISTERED_ENB_IND:
LOG_W(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name,
S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme);
/* TODO handle recovering of registration */
break;
case TIMER_HAS_EXPIRED:
LOG_I(GNB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id);
if (TIMER_HAS_EXPIRED (msg_p).timer_id == gnb_register_retry_timer_id) {
/* Restart the registration process */
registered_gnb = 0;
register_gnb_pending = gNB_app_register(gnb_id_start, gnb_id_end);//, gnb_properties_p);
}
break;
# endif
default:
LOG_E(GNB_APP, "Received unexpected message %s\n", msg_name);
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
} while (1);
#endif
return NULL;
}
+38
View File
@@ -0,0 +1,38 @@
/*
* 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
*/
/*
gnb_app.h
-------------------
AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr
*/
#ifndef GNB_APP_H_
#define GNB_APP_H_
#include <stdint.h>
void *gNB_app_task(void *args_p);
#endif /* GNB_APP_H_ */
File diff suppressed because it is too large Load Diff
+110
View File
@@ -0,0 +1,110 @@
/*
* 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
*/
/*
gnb_config.h
-------------------
AUTHOR : Lionel GAUTHIER, Navid Nikaein, Laurent Winckel
COMPANY : EURECOM
EMAIL : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
*/
#ifndef GNB_CONFIG_H_
#define GNB_CONFIG_H_
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <libconfig.h>
#include "commonDef.h"
#include "platform_types.h"
#include "platform_constants.h"
#include "PHY/impl_defs_lte.h"
#include "PHY/defs.h"
#include "s1ap_messages_types.h"
//#ifdef CMAKER
//#include "SystemInformationBlockType2.h"
//#include "rrc_messages_types.h"
//#else
//#include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
//#endif
#include "intertask_interface_types.h"
#include "RRC/NR/defs_NR.h"
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
struct in_addr inp;\
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
AssertFatal (0, MeSsAgE);\
} else {\
NwBo = inp.s_addr;\
}\
} while (0);
/** @defgroup _enb_app ENB APP
* @ingroup _oai2
* @{
*/
// Hard to find a defined value for max enb...
#define MAX_ENB 16
/*
typedef struct mme_ip_address_s {
unsigned ipv4:1;
unsigned ipv6:1;
unsigned active:1;
char *ipv4_address;
char *ipv6_address;
} mme_ip_address_t;
typedef struct ru_config_s {
// indicates if local or remote rf is used (1 == LOCAL)
unsigned local_rf:1;
// indicates if UDP socket is used
unsigned udp:1;
// indicates if RAW socket is used
unsigned raw:1;
char *ru_if_name;
char *local_address;
char *remote_address;
uint16_t local_port;
uint16_t remote_port;
uint8_t udpif4p5;
uint8_t rawif4p5;
uint8_t rawif5_mobipass;
uint8_t if_compress;
} ru_config_t;
*/
//extern void RCconfig_RU(void);
//extern void RCconfig_flexran(void);
//extern void RCconfig_L1(void);
//extern void RCconfig_macrlc(void);
//extern int RCconfig_gtpu(void );
extern void NRRCConfig(void);
//void enb_config_display(void);
//void ru_config_display(void);
int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc);
//int RCconfig_S1(MessageDef *msg_p, uint32_t i);
#endif /* GNB_CONFIG_H_ */
/** @} */
+705
View File
@@ -0,0 +1,705 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/GNB_APP/gnb_paramdef.f
* \brief definition of configuration parameters for all eNodeB modules
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#include "common/config/config_paramdesc.h"
#include "NRRRC_paramsvalues.h"
#define GNB_CONFIG_STRING_CC_NODE_FUNCTION "node_function"
#define GNB_CONFIG_STRING_CC_NODE_TIMING "node_timing"
#define GNB_CONFIG_STRING_CC_NODE_SYNCH_REF "node_synch_ref"
// OTG config per GNB-UE DL
#define GNB_CONF_STRING_OTG_CONFIG "otg_config"
#define GNB_CONF_STRING_OTG_UE_ID "ue_id"
#define GNB_CONF_STRING_OTG_APP_TYPE "app_type"
#define GNB_CONF_STRING_OTG_BG_TRAFFIC "bg_traffic"
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
extern int asn_debug;
extern int asn1_xer_print;
#endif
#ifdef LIBCONFIG_LONG
#define libconfig_int long
#else
#define libconfig_int int
#endif
typedef enum {
RU = 0,
L1 = 1,
L2 = 2,
L3 = 3,
S1 = 4,
lastel = 5
} NRRC_config_functions_t;
#define CONFIG_STRING_ACTIVE_RUS "Active_RUs"
/*------------------------------------------------------------------------------------------------------------------------------------------*/
/* RUs configuration section name */
#define CONFIG_STRING_RU_LIST "RUs"
#define CONFIG_STRING_RU_CONFIG "ru_config"
/* RUs configuration parameters name */
#define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name"
#define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address"
#define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address"
#define CONFIG_STRING_RU_LOCAL_PORTC "local_portc"
#define CONFIG_STRING_RU_REMOTE_PORTC "remote_portc"
#define CONFIG_STRING_RU_LOCAL_PORTD "local_portd"
#define CONFIG_STRING_RU_REMOTE_PORTD "remote_portd"
#define CONFIG_STRING_RU_LOCAL_RF "local_rf"
#define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference"
#define CONFIG_STRING_RU_BAND_LIST "bands"
#define CONFIG_STRING_RU_GNB_LIST "gNB_instances"
#define CONFIG_STRING_RU_NB_TX "nb_tx"
#define CONFIG_STRING_RU_NB_RX "nb_rx"
#define CONFIG_STRING_RU_ATT_TX "att_tx"
#define CONFIG_STRING_RU_ATT_RX "att_rx"
#define CONFIG_STRING_RU_MAX_RS_EPRE "max_pdschReferenceSignalPower"
#define CONFIG_STRING_RU_MAX_RXGAIN "max_rxgain"
#define CONFIG_STRING_RU_IF_COMPRESSION "if_compression"
#define CONFIG_STRING_RU_NBIOTRRC_LIST "NbIoT_RRC_instances"
#define RU_LOCAL_IF_NAME_IDX 0
#define RU_LOCAL_ADDRESS_IDX 1
#define RU_REMOTE_ADDRESS_IDX 2
#define RU_LOCAL_PORTC_IDX 3
#define RU_REMOTE_PORTC_IDX 4
#define RU_LOCAL_PORTD_IDX 5
#define RU_REMOTE_PORTD_IDX 6
#define RU_TRANSPORT_PREFERENCE_IDX 7
#define RU_LOCAL_RF_IDX 8
#define RU_NB_TX_IDX 9
#define RU_NB_RX_IDX 10
#define RU_MAX_RS_EPRE_IDX 11
#define RU_MAX_RXGAIN_IDX 12
#define RU_BAND_LIST_IDX 13
#define RU_GNB_LIST_IDX 14
#define RU_ATT_TX_IDX 15
#define RU_ATT_RX_IDX 16
#define RU_NBIOTRRC_LIST_IDX 17
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* RU configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
#define RUPARAMS_DESC { \
{CONFIG_STRING_RU_LOCAL_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_LOCAL_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_REMOTE_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_LOCAL_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_REMOTE_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_LOCAL_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_REMOTE_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_TRANSPORT_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"udp_if5", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_LOCAL_RF, NULL, 0, strptr:NULL, defstrval:"yes", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_NB_TX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_NB_RX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_MAX_RS_EPRE, NULL, 0, iptr:NULL, defintval:-29, TYPE_INT, 0}, \
{CONFIG_STRING_RU_MAX_RXGAIN, NULL, 0, iptr:NULL, defintval:120, TYPE_INT, 0}, \
{CONFIG_STRING_RU_BAND_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFBANDS, TYPE_INTARRAY, 1}, \
{CONFIG_STRING_RU_GNB_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \
{CONFIG_STRING_RU_ATT_TX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_ATT_RX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \
}
/*---------------------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------------------*/
/* value definitions for ASN1 verbosity parameter */
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none"
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying"
#define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info"
/* global parameters, not under a specific section */
#define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity"
#define GNB_CONFIG_STRING_ACTIVE_GNBS "Active_gNBs"
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* global configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define GNBSPARAMS_DESC { \
{GNB_CONFIG_STRING_ASN1_VERBOSITY, NULL, 0, uptr:NULL, defstrval:GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_ACTIVE_GNBS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRINGLIST, 0} \
}
#define GNB_ASN1_VERBOSITY_IDX 0
#define GNB_ACTIVE_GNBS_IDX 1
/*------------------------------------------------------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------------------------------------------------*/
/* cell configuration parameters names */
#define GNB_CONFIG_STRING_GNB_ID "gNB_ID"
#define GNB_CONFIG_STRING_CELL_TYPE "cell_type"
#define GNB_CONFIG_STRING_GNB_NAME "gNB_name"
#define GNB_CONFIG_STRING_TRACKING_AREA_CODE "tracking_area_code"
#define GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE "mobile_country_code"
#define GNB_CONFIG_STRING_MOBILE_NETWORK_CODE "mobile_network_code"
#define GNB_CONFIG_STRING_TRANSPORT_S_PREFERENCE "tr_s_preference"
#define GNB_CONFIG_STRING_LOCAL_S_IF_NAME "local_s_if_name"
#define GNB_CONFIG_STRING_LOCAL_S_ADDRESS "local_s_address"
#define GNB_CONFIG_STRING_REMOTE_S_ADDRESS "remote_s_address"
#define GNB_CONFIG_STRING_LOCAL_S_PORTC "local_s_portc"
#define GNB_CONFIG_STRING_REMOTE_S_PORTC "remote_s_portc"
#define GNB_CONFIG_STRING_LOCAL_S_PORTD "local_s_portd"
#define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd"
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* cell configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
#define GNBPARAMS_DESC {\
{GNB_CONFIG_STRING_GNB_ID, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_CELL_TYPE, NULL, 0, strptr:NULL, defstrval:"CELL_MACRO_GNB", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_GNB_NAME, NULL, 0, strptr:NULL, defstrval:"OAIgNodeB", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_TRACKING_AREA_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_MOBILE_NETWORK_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_TRANSPORT_S_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_mac", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_LOCAL_S_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_LOCAL_S_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_REMOTE_S_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_LOCAL_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \
}
#define GNB_GNB_ID_IDX 0
#define GNB_CELL_TYPE_IDX 1
#define GNB_GNB_NAME_IDX 2
#define GNB_TRACKING_AREA_CODE_IDX 3
#define GNB_MOBILE_COUNTRY_CODE_IDX 4
#define GNB_MOBILE_NETWORK_CODE_IDX 5
#define GNB_TRANSPORT_S_PREFERENCE_IDX 6
#define GNB_LOCAL_S_IF_NAME_IDX 7
#define GNB_LOCAL_S_ADDRESS_IDX 8
#define GNB_REMOTE_S_ADDRESS_IDX 9
#define GNB_LOCAL_S_PORTC_IDX 10
#define GNB_REMOTE_S_PORTC_IDX 11
#define GNB_LOCAL_S_PORTD_IDX 12
#define GNB_REMOTE_S_PORTD_IDX 13
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/* component carries configuration parameters name */
#define GNB_CONFIG_STRING_NB_ANT_PORTS "nb_antenna_ports"
#define GNB_CONFIG_STRING_NB_ANT_TX "nb_antennas_tx"
#define GNB_CONFIG_STRING_NB_ANT_RX "nb_antennas_rx"
#define GNB_CONFIG_STRING_TX_GAIN "tx_gain"
#define GNB_CONFIG_STRING_RX_GAIN "rx_gain"
///NR
//MIB
#define GNB_CONFIG_STRING_MIB_SUBCARRIERSPACINGCOMMON "MIB_subCarrierSpacingCommon"
#define GNB_CONFIG_STRING_MIB_SSB_SUBCARRIEROFFSET "MIB_ssb_SubcarrierOffset"
#define GNB_CONFIG_STRING_MIB_DMRS_TYPEA_POSITION "MIB_dmrs_TypeA_Position"
#define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1"
//SIB1
#define GNB_CONFIG_STRING_SIB1_FREQUENCYOFFSETSSB "SIB1_frequencyOffsetSSB"
#define GNB_CONFIG_STRING_SIB1_SSB_PERIODICITYSERVINGCELL "SIB1_ssb_PeriodicityServingCell"
#define GNB_CONFIG_STRING_SIB1_SS_PBCH_BLOCKPOWER "SIB1_ss_PBCH_BlockPower"
//NR FREQUENCYINFODL
#define GNB_CONFIG_STRING_ABSOLUTEFREQUENCYSSB "absoluteFrequencySSB"
#define GNB_CONFIG_STRING_SSB_SUBCARRIEROFFSET "SubcarrierSpacing"
#define GNB_CONFIG_STRING_DL_FREQBANDINDICATORNR "DL_FreqBandIndicatorNR"
#define GNB_CONFIG_STRING_DL_ABSOLUTEFREQUENCYPOINTA "DL_absoluteFrequencyPointA"
//NR DL SCS-SPECIFICCARRIER
#define GNB_CONFIG_STRING_DL_OFFSETTOCARRIER "DL_offsetToCarrier"
#define GNB_CONFIG_STRING_DL_SCS_SUBCARRIERSPACING "DL_SCS_SubcarrierSpacing"
#define GNB_CONFIG_STRING_DL_SCS_SPECIFICCARRIER_K0 "DL_SCS_SpecificCarrier_k0"
#define GNB_CONFIG_STRING_DL_CARRIERBANDWIDTH "DL_carrierBandwidth"
// NR BWP-DOWNLINKCOMMON
#define GNB_CONFIG_STRING_DL_LOCATIONANDBANDWIDTH "DL_locationAndBandwidth"
#define GNB_CONFIG_STRING_DL_BWP_SUBCARRIERSPACING "DL_BWP_SubcarrierSpacing"
#define GNB_CONFIG_STRING_DL_BWP_PREFIX_TYPE "DL_BWP_prefix_type"
//NR FREQUENCYINFOUL
#define GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR "UL_FreqBandIndicatorNR"
#define GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA "UL_absoluteFrequencyPointA"
#define GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION "UL_additionalSpectrumEmission"
#define GNB_CONFIG_STRING_UL_P_MAX "UL_p_Max"
#define GNB_CONFIG_STRING_UL_FREQUENCYSHIFT7P5KHZ "UL_frequencyShift7p5khz"
//NR UL SCS-SPECIFICCARRIER
#define GNB_CONFIG_STRING_UL_OFFSETTOCARRIER "UL_offsetToCarrier"
#define GNB_CONFIG_STRING_UL_SCS_SUBCARRIERSPACING "UL_SCS_SubcarrierSpacing"
#define GNB_CONFIG_STRING_UL_SCS_SPECIFICCARRIER_K0 "UL_SCS_SpecificCarrier_k0"
#define GNB_CONFIG_STRING_UL_CARRIERBANDWIDTH "UL_carrierBandwidth"
// NR BWP-UPLINKCOMMON
#define GNB_CONFIG_STRING_UL_LOCATIONANDBANDWIDTH "UL_locationAndBandwidth"
#define GNB_CONFIG_STRING_UL_BWP_SUBCARRIERSPACING "UL_BWP_SubcarrierSpacing"
#define GNB_CONFIG_STRING_UL_BWP_PREFIX_TYPE "UL_BWP_prefix_type"
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR "ServingCellConfigCommon_ssb_PositionsInBurst_PR"
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL "ServingCellConfigCommon_ssb_periodicityServingCell"
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION "ServingCellConfigCommon_dmrs_TypeA_Position"
#define GNB_CONFIG_STRING_NIA_SUBCARRIERSPACING "NIA_SubcarrierSpacing"
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SS_PBCH_BLOCKPOWER "ServingCellConfigCommon_ss_PBCH_BlockPower"
//NR TDD-UL-DL-CONFIGCOMMON
#define GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING "referenceSubcarrierSpacing"
#define GNB_CONFIG_STRING_DL_UL_TRANSMISSIONPERIODICITY "dl_UL_TransmissionPeriodicity"
#define GNB_CONFIG_STRING_NROFDOWNLINKSLOTS "nrofDownlinkSlots"
#define GNB_CONFIG_STRING_NROFDOWNLINKSYMBOLS "nrofDownlinkSymbols"
#define GNB_CONFIG_STRING_NROFUPLINKSLOTS "nrofUplinkSlots"
#define GNB_CONFIG_STRING_NROFUPLINKSYMBOLS "nrofUplinkSymbols"
//NR RACH-CONFIGCOMMON
#define GNB_CONFIG_STRING_RACH_TOTALNUMBEROFRA_PREAMBLES "rach_totalNumberOfRA_Preambles"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_CHOICE "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEEIGHTH "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEFOURTH "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEHALF "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONE "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_TWO "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_FOUR "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_EIGHT "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight"
#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_SIXTEEN "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen"
#define GNB_CONFIG_STRING_RACH_GROUPBCONFIGURED "rach_groupBconfigured"
#define GNB_CONFIG_STRING_RACH_RA_MSG3SIZEGROUPA "rach_ra_Msg3SizeGroupA"
#define GNB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB "rach_messagePowerOffsetGroupB"
#define GNB_CONFIG_STRING_RACH_NUMBEROFRA_PREAMBLESGROUPA "rach_numberOfRA_PreamblesGroupA"
#define GNB_CONFIG_STRING_RACH_RA_CONTENTIONRESOLUTIONTIMER "rach_ra_ContentionResolutionTimer"
#define GNB_CONFIG_STRING_RSRP_THRESHOLDSSB "rsrp_ThresholdSSB"
#define GNB_CONFIG_STRING_RSRP_THRESHOLDSSB_SUL "rsrp_ThresholdSSB_SUL"
#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_CHOICE "prach_RootSequenceIndex_choice"
#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L839 "prach_RootSequenceIndex_l839"
#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L139 "prach_RootSequenceIndex_l139"
#define GNB_CONFIG_STRING_PRACH_MSG1_SUBCARRIERSPACING "prach_msg1_SubcarrierSpacing"
#define GNB_CONFIG_STRING_RESTRICTEDSETCONFIG "restrictedSetConfig"
#define GNB_CONFIG_STRING_MSG3_TRANSFORMPRECODING "msg3_transformPrecoding"
//SSB-PERRACH-OCCASIONANDCB-PREAMBLESPERSSB NOT SURE
//NR RACH-CONFIGGENERIC
#define GNB_CONFIG_STRING_PRACH_CONFIGURATIONINDEX "prach_ConfigurationIndex"
#define GNB_CONFIG_STRING_PRACH_MSG1_FDM "prach_msg1_FDM"
#define GNB_CONFIG_STRING_PRACH_MSG1_FREQUENCYSTART "prach_msg1_FrequencyStart"
#define GNB_CONFIG_STRING_ZEROCORRELATIONZONECONFIG "zeroCorrelationZoneConfig"
#define GNB_CONFIG_STRING_PREAMBLERECEIVEDTARGETPOWER "preambleReceivedTargetPower"
#define GNB_CONFIG_STRING_PREAMBLETRANSMAX "preambleTransMax"
#define GNB_CONFIG_STRING_POWERRAMPINGSTEP "powerRampingStep"
#define GNB_CONFIG_STRING_RA_RESPONSEWINDOW "ra_ResponseWindow"
//PUSCH-CONFIGCOMMON
#define GNB_CONFIG_STRING_GROUPHOPPINGENABLEDTRANSFORMPRECODING "groupHoppingEnabledTransformPrecoding"
#define GNB_CONFIG_STRING_MSG3_DELTAPREAMBLE "msg3_DeltaPreamble"
#define GNB_CONFIG_STRING_P0_NOMINALWITHGRANT "p0_NominalWithGrant"
///PUSCH-TIMEDOMAINRESOURCEALLOCATION
#define GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_K2 "PUSCH_TimeDomainResourceAllocation_k2"
#define GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE "PUSCH_TimeDomainResourceAllocation_mappingType"
//PUCCH-CONFIGCOMMON
#define GNB_CONFIG_STRING_PUCCH_GROUPHOPPING "pucch_GroupHopping"
#define GNB_CONFIG_STRING_P0_NOMINAL "p0_nominal"
//PDSCH-CONFIGCOMMON
//PDSCH-TIMEDOMAINRESOURCEALLOCATION
#define GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_K0 "PDSCH_TimeDomainResourceAllocation_k0"
#define GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE "PDSCH_TimeDomainResourceAllocation_mappingType"
//RATEMATCHPATTERN IS USED TO CONFIGURE ONE RATE MATCHING PATTERN FOR PDSCH
#define GNB_CONFIG_STRING_RATEMATCHPATTERNID "rateMatchPatternId"
#define GNB_CONFIG_STRING_RATEMATCHPATTERN_PATTERNTYPE "RateMatchPattern_patternType"
#define GNB_CONFIG_STRING_SYMBOLSINRESOURCEBLOCK "symbolsInResourceBlock"
#define GNB_CONFIG_STRING_PERIODICITYANDPATTERN "periodicityAndPattern"
#define GNB_CONFIG_STRING_RATEMATCHPATTERN_CONTROLRESOURCESET "RateMatchPattern_controlResourceSet"
#define GNB_CONFIG_STRING_RATEMATCHPATTERN_SUBCARRIERSPACING "RateMatchPattern_subcarrierSpacing"
#define GNB_CONFIG_STRING_RATEMATCHPATTERN_MODE "RateMatchPattern_mode"
//PDCCH-CONFIGCOMMON
#define GNB_CONFIG_STRING_SEARCHSPACESIB1 "searchSpaceSIB1"
#define GNB_CONFIG_STRING_SEARCHSPACEOTHERSYSTEMINFORMATION "searchSpaceOtherSystemInformation"
#define GNB_CONFIG_STRING_PAGINGSEARCHSPACE "pagingSearchSpace"
#define GNB_CONFIG_STRING_RA_SEARCHSPACE "ra_SearchSpace"
#define GNB_CONFIG_STRING_RACH_RA_CONTROLRESOURCESET "rach_ra_ControlResourceSet"
//NR PDCCH-CONFIGCOMMON COMMONCONTROLRESOURCESSETS
#define GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESETID "PDCCH_common_controlResourceSetId"
#define GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESET_DURATION "PDCCH_common_ControlResourceSet_duration"
#define GNB_CONFIG_STRING_PDCCH_CCE_REG_MAPPINGTYPE "PDCCH_cce_REG_MappingType"
#define GNB_CONFIG_STRING_PDCCH_REG_BUNDLESIZE "PDCCH_reg_BundleSize"
#define GNB_CONFIG_STRING_PDCCH_INTERLEAVERSIZE "PDCCH_interleaverSize"
#define GNB_CONFIG_STRING_PDCCH_SHIFTINDEX "PDCCH_shiftIndex"
#define GNB_CONFIG_STRING_PDCCH_PRECODERGRANULARITY "PDCCH_precoderGranularity"
#define GNB_CONFIG_STRING_PDCCH_TCI_STATEID "PDCCH_TCI_StateId"
#define GNB_CONFIG_STRING_TCI_PRESENTINDCI "tci_PresentInDCI"
//NR PDCCH-ConfigCommon commonSearchSpaces
#define GNB_CONFIG_STRING_SEARCHSPACEID "SearchSpaceId"
#define GNB_CONFIG_STRING_COMMONSEARCHSPACES_CONTROLRESOURCESETID "commonSearchSpaces_controlResourceSetId"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_CHOICE "SearchSpace_monitoringSlotPeriodicityAndOffset_choice"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL1 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl1"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL2 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl2"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL4 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl4"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL5 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl5"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL8 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl8"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL10 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl10"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL16 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl16"
#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL20 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl20"
#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL1 "SearchSpace_nrofCandidates_aggregationLevel1"
#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL2 "SearchSpace_nrofCandidates_aggregationLevel2"
#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL4 "SearchSpace_nrofCandidates_aggregationLevel4"
#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL8 "SearchSpace_nrofCandidates_aggregationLevel8"
#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL16 "SearchSpace_nrofCandidates_aggregationLevel16"
#define GNB_CONFIG_STRING_SEARCHSPACE_SEARCHSPACETYPE "SearchSpace_searchSpaceType"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL1 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL2 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL4 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL8 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL16 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY "Common_dci_Format2_3_monitoringPeriodicity"
#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES "Common_dci_Format2_3_nrofPDCCH_Candidates"
#define GNB_CONFIG_STRING_UE_SPECIFIC__DCI_FORMATS "ue_Specific__dci_Formats"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL "RateMatchPatternLTE_CRS_carrierFreqDL"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL "RateMatchPatternLTE_CRS_carrierBandwidthDL"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS "RateMatchPatternLTE_CRS_nrofCRS_Ports"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_V_SHIFT "RateMatchPatternLTE_CRS_v_Shift"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD "RateMatchPatternLTE_CRS_radioframeAllocationPeriod"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET "RateMatchPatternLTE_CRS_radioframeAllocationOffset"
#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE "RateMatchPatternLTE_CRS_subframeAllocation_choice"
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* component carriers configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt checked_param */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define NRCCPARAMS_DESC { \
{GNB_CONFIG_STRING_FRAME_TYPE, NULL, 0, strptr:&frame_type, defstrval:"FDD", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_DL_prefix_type, NULL, 0, strptr:&DL_prefix_type, defstrval:"NORMAL", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_UL_prefix_type, NULL, 0, strptr:&UL_prefix_type, defstrval:"NORMAL", TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_EUTRA_BAND, NULL, 0, iptr:&eutra_band, defintval:7, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DOWNLINK_FREQUENCY, NULL, 0, i64ptr:(int64_t *)&downlink_frequency, defint64val:2680000000, TYPE_UINT64, 0}, \
{GNB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, NULL, 0, iptr:&uplink_frequency_offset, defintval:-120000000, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_NID_CELL, NULL, 0, iptr:&Nid_cell, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_N_RB_DL, NULL, 0, iptr:&N_RB_DL, defintval:25, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NB_ANT_PORTS, NULL, 0, iptr:&nb_antenna_ports, defintval:1, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_MIB_SUBCARRIERSPACINGCOMMON, NULL, 0, iptr:&MIB_subCarrierSpacingCommon, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_MIB_SSB_SUBCARRIEROFFSET, NULL, 0, iptr:&MIB_ssb_SubcarrierOffset, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_MIB_DMRS_TYPEA_POSITION, NULL, 0, iptr:&MIB_dmrs_TypeA_Position, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0, iptr:&pdcch_ConfigSIB1, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SIB1_FREQUENCYOFFSETSSB, NULL, 0, iptr:&SIB1_frequencyOffsetSSB, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SIB1_SSB_PERIODICITYSERVINGCELL, NULL, 0, iptr:&SIB1_ssb_PeriodicityServingCell, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SIB1_SS_PBCH_BLOCKPOWER, NULL, 0, iptr:&SIB1_ss_PBCH_BlockPower, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_ABSOLUTEFREQUENCYSSB, NULL, 0, iptr:&absoluteFrequencySSB, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SSB_SUBCARRIEROFFSET, NULL, 0, iptr:&ssb_SubcarrierOffset, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_FREQBANDINDICATORNR, NULL, 0, iptr:&DL_FreqBandIndicatorNR, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_ABSOLUTEFREQUENCYPOINTA, NULL, 0, iptr:&DL_absoluteFrequencyPointA, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_OFFSETTOCARRIER, NULL, 0, iptr:&DL_offsetToCarrier, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_SCS_SUBCARRIERSPACING, NULL, 0, iptr:&DL_SCS_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_SCS_SPECIFICCARRIER_K0, NULL, 0, iptr:&DL_SCS_SpecificCarrier_k0, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_CARRIERBANDWIDTH, NULL, 0, iptr:&DL_carrierBandwidth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_LOCATIONANDBANDWIDTH, NULL, 0, iptr:&DL_locationAndBandwidth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_BWP_SUBCARRIERSPACING, NULL, 0, iptr:&DL_BWP_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_BWP_PREFIX_TYPE, NULL, 0, iptr:&DL_BWP_prefix_type, defintval:0, TYPE_STRING, 0}, \
{GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR, NULL, 0, iptr:&UL_FreqBandIndicatorNR, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA, NULL, 0, iptr:&UL_absoluteFrequencyPointA, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION, NULL, 0, iptr:&UL_additionalSpectrumEmission, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_P_MAX, NULL, 0, iptr:&UL_p_Max, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_FREQUENCYSHIFT7P5KHZ, NULL, 0, iptr:&UL_frequencyShift7p5khz, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_OFFSETTOCARRIER, NULL, 0, iptr:&UL_offsetToCarrier, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_SCS_SUBCARRIERSPACING, NULL, 0, iptr:&UL_SCS_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_SCS_SPECIFICCARRIER_K0, NULL, 0, iptr:&UL_SCS_SpecificCarrier_k0, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_CARRIERBANDWIDTH, NULL, 0, iptr:&UL_carrierBandwidth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_LOCATIONANDBANDWIDTH, NULL, 0, iptr:&UL_locationAndBandwidth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_BWP_SUBCARRIERSPACING, NULL, 0, iptr:&UL_BWP_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UL_BWP_PREFIX_TYPE, NULL, 0, iptr:&UL_BWP_prefix_type, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR, NULL, 0, iptr:&ServingCellConfigCommon_ssb_PositionsInBurst_PR, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL, NULL, 0, iptr:&ServingCellConfigCommon_ssb_periodicityServingCell, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION, NULL, 0, iptr:&ServingCellConfigCommon_dmrs_TypeA_Position, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NIA_SUBCARRIERSPACING, NULL, 0, iptr:&NIA_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SS_PBCH_BLOCKPOWER, NULL, 0, iptr:&ServingCellConfigCommon_ss_PBCH_BlockPower, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING, NULL, 0, iptr:&referenceSubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_DL_UL_TRANSMISSIONPERIODICITY, NULL, 0, iptr:&dl_UL_TransmissionPeriodicity, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NROFDOWNLINKSLOTS, NULL, 0, iptr:&nrofDownlinkSlots, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NROFDOWNLINKSYMBOLS, NULL, 0, iptr:&nrofDownlinkSymbols, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NROFUPLINKSLOTS, NULL, 0, iptr:&nrofUplinkSlots, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_NROFUPLINKSYMBOLS, NULL, 0, iptr:&nrofUplinkSymbols, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_TOTALNUMBEROFRA_PREAMBLES, NULL, 0, iptr:&rach_totalNumberOfRA_Preambles, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_CHOICE, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEEIGHTH, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEFOURTH, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEHALF, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONE, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_TWO, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_FOUR, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_EIGHT, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_SIXTEEN, NULL, 0, iptr:&rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_GROUPBCONFIGURED, NULL, 0, iptr:&rach_groupBconfigured, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_RA_MSG3SIZEGROUPA, NULL, 0, iptr:&rach_ra_Msg3SizeGroupA, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB, NULL, 0, iptr:&rach_messagePowerOffsetGroupB, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_NUMBEROFRA_PREAMBLESGROUPA, NULL, 0, iptr:&rach_numberOfRA_PreamblesGroupA, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_RA_CONTENTIONRESOLUTIONTIMER, NULL, 0, iptr:&rach_ra_ContentionResolutionTimer, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RSRP_THRESHOLDSSB, NULL, 0, iptr:&rsrp_ThresholdSSB, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RSRP_THRESHOLDSSB_SUL, NULL, 0, iptr:&rsrp_ThresholdSSB_SUL, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_CHOICE, NULL, 0, iptr:&prach_RootSequenceIndex_choice, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L839, NULL, 0, iptr:&prach_RootSequenceIndex_l839, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L139, NULL, 0, iptr:&prach_RootSequenceIndex_l139, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_MSG1_SUBCARRIERSPACING, NULL, 0, iptr:&prach_msg1_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RESTRICTEDSETCONFIG, NULL, 0, iptr:&restrictedSetConfig, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_MSG3_TRANSFORMPRECODING, NULL, 0, iptr:&msg3_transformPrecoding, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_CONFIGURATIONINDEX, NULL, 0, iptr:&prach_ConfigurationIndex, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_MSG1_FDM, NULL, 0, iptr:&prach_msg1_FDM, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PRACH_MSG1_FREQUENCYSTART, NULL, 0, iptr:&prach_msg1_FrequencyStart, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_ZEROCORRELATIONZONECONFIG, NULL, 0, iptr:&zeroCorrelationZoneConfig, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PREAMBLERECEIVEDTARGETPOWER, NULL, 0, iptr:&preambleReceivedTargetPower, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PREAMBLETRANSMAX, NULL, 0, iptr:&preambleTransMax, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_POWERRAMPINGSTEP, NULL, 0, iptr:&powerRampingStep, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RA_RESPONSEWINDOW, NULL, 0, iptr:&ra_ResponseWindow, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_GROUPHOPPINGENABLEDTRANSFORMPRECODING, NULL, 0, iptr:&groupHoppingEnabledTransformPrecoding, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_MSG3_DELTAPREAMBLE, NULL, 0, iptr:&msg3_DeltaPreamble, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_P0_NOMINALWITHGRANT, NULL, 0, iptr:&p0_NominalWithGrant, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_K2, NULL, 0, iptr:&PUSCH_TimeDomainResourceAllocation_k2, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE, NULL, 0, iptr:&PUSCH_TimeDomainResourceAllocation_mappingType, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PUCCH_GROUPHOPPING, NULL, 0, iptr:&pucch_GroupHopping, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_P0_NOMINAL, NULL, 0, iptr:&p0_nominal, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_K0, NULL, 0, iptr:&PDSCH_TimeDomainResourceAllocation_k0, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE, NULL, 0, iptr:&PDSCH_TimeDomainResourceAllocation_mappingType, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNID, NULL, 0, iptr:&rateMatchPatternId, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERN_PATTERNTYPE, NULL, 0, iptr:&RateMatchPattern_patternType, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SYMBOLSINRESOURCEBLOCK, NULL, 0, iptr:&symbolsInResourceBlock, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PERIODICITYANDPATTERN, NULL, 0, iptr:&periodicityAndPattern, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERN_CONTROLRESOURCESET, NULL, 0, iptr:&RateMatchPattern_controlResourceSet, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERN_SUBCARRIERSPACING, NULL, 0, iptr:&RateMatchPattern_subcarrierSpacing, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERN_MODE, NULL, 0, iptr:&RateMatchPattern_mode, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACESIB1, NULL, 0, iptr:&searchSpaceSIB1, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACEOTHERSYSTEMINFORMATION, NULL, 0, iptr:&searchSpaceOtherSystemInformation, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PAGINGSEARCHSPACE, NULL, 0, iptr:&pagingSearchSpace, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RA_SEARCHSPACE, NULL, 0, iptr:&ra_SearchSpace, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RACH_RA_CONTROLRESOURCESET, NULL, 0, iptr:&rach_ra_ControlResourceSet, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESETID, NULL, 0, iptr:&PDCCH_common_controlResourceSetId, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESET_DURATION, NULL, 0, iptr:&PDCCH_common_ControlResourceSet_duration, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_CCE_REG_MAPPINGTYPE, NULL, 0, iptr:&PDCCH_cce_REG_MappingType, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_REG_BUNDLESIZE, NULL, 0, iptr:&PDCCH_reg_BundleSize, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_INTERLEAVERSIZE, NULL, 0, iptr:&PDCCH_interleaverSize, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_SHIFTINDEX, NULL, 0, iptr:&PDCCH_shiftIndex, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_PRECODERGRANULARITY, NULL, 0, iptr:&PDCCH_precoderGranularity, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_PDCCH_TCI_STATEID, NULL, 0, iptr:&PDCCH_TCI_StateId, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_TCI_PRESENTINDCI, NULL, 0, iptr:&tci_PresentInDCI, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACEID, NULL, 0, iptr:&SearchSpaceId, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMONSEARCHSPACES_CONTROLRESOURCESETID, NULL, 0, iptr:&commonSearchSpaces_controlResourceSetId, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_CHOICE, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_choice, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL1, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl1, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL2, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl2, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL4, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl4, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL5, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl5, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL8, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl8, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL10, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl10, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL16, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl16, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL20, NULL, 0, iptr:&SearchSpace_monitoringSlotPeriodicityAndOffset_sl20, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL1, NULL, 0, iptr:&SearchSpace_nrofCandidates_aggregationLevel1, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL2, NULL, 0, iptr:&SearchSpace_nrofCandidates_aggregationLevel2, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL4, NULL, 0, iptr:&SearchSpace_nrofCandidates_aggregationLevel4, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL8, NULL, 0, iptr:&SearchSpace_nrofCandidates_aggregationLevel8, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL16, NULL, 0, iptr:&SearchSpace_nrofCandidates_aggregationLevel16, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_SEARCHSPACE_SEARCHSPACETYPE, NULL, 0, iptr:&SearchSpace_searchSpaceType, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL1, NULL, 0, iptr:&Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL2, NULL, 0, iptr:&Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL4, NULL, 0, iptr:&Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL8, NULL, 0, iptr:&Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL16, NULL, 0, iptr:&Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY, NULL, 0, iptr:&Common_dci_Format2_3_monitoringPeriodicity, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES, NULL, 0, iptr:&Common_dci_Format2_3_nrofPDCCH_Candidates, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_UE_SPECIFIC__DCI_FORMATS, NULL, 0, iptr:&ue_Specific__dci_Formats, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL, NULL, 0, iptr:&RateMatchPatternLTE_CRS_carrierFreqDL, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL, NULL, 0, iptr:&RateMatchPatternLTE_CRS_carrierBandwidthDL, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS, NULL, 0, iptr:&RateMatchPatternLTE_CRS_nrofCRS_Ports, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_V_SHIFT, NULL, 0, iptr:&RateMatchPatternLTE_CRS_v_Shift, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD, NULL, 0, iptr:&RateMatchPatternLTE_CRS_radioframeAllocationPeriod, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET, NULL, 0, iptr:&RateMatchPatternLTE_CRS_radioframeAllocationOffset, defintval:0, TYPE_UINT, 0}, \
{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE, NULL, 0, iptr:&RateMatchPatternLTE_CRS_subframeAllocation_choice, defintval:0, TYPE_UINT, 0}, \
}
/* component carries configuration parameters name */
#define ENB_CONFIG_FRAME_TYPE_IDX 0
#define ENB_CONFIG_DL_PREFIX_TYPE_IDX 1
#define ENB_CONFIG_UL_PREFIX_TYPE_IDX 1
#define ENB_CONFIG_EUTRA_BAND_IDX 2
#define ENB_CONFIG_DOWNLINK_FREQUENCY_IDX 3
#define ENB_CONFIG_UPLINK_FREQUENCY_OFFSET_IDX 4
#define ENB_CONFIG_NID_CELL_IDX 5
#define ENB_CONFIG_N_RB_DL_IDX 6
#define GNB_CONFIG_NB_ANT_PORTS_IDX
#define GNB_CONFIG_NB_ANT_TX_IDX
#define GNB_CONFIG_NB_ANT_RX_IDX
#define GNB_CONFIG_TX_GAIN_IDX
#define GNB_CONFIG_RX_GAIN_IDX
#define GNB_CONFIG_MIB_SUBCARRIERSPACINGCOMMON_IDX
#define GNB_CONFIG_MIB_SSB_SUBCARRIEROFFSET_IDX
#define GNB_CONFIG_MIB_DMRS_TYPEA_POSITION_IDX
#define GNB_CONFIG_PDCCH_CONFIGSIB1_IDX
#define GNB_CONFIG_SIB1_FREQUENCYOFFSETSSB_IDX
#define GNB_CONFIG_SIB1_SSB_PERIODICITYSERVINGCELL_IDX
#define GNB_CONFIG_SIB1_SS_PBCH_BLOCKPOWER_IDX
#define GNB_CONFIG_ABSOLUTEFREQUENCYSSB_IDX
#define GNB_CONFIG_SSB_SUBCARRIEROFFSET_IDX
#define GNB_CONFIG_DL_FREQBANDINDICATORNR_IDX
#define GNB_CONFIG_DL_ABSOLUTEFREQUENCYPOINTA_IDX
#define GNB_CONFIG_DL_OFFSETTOCARRIER_IDX
#define GNB_CONFIG_DL_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_DL_SCS_SPECIFICCARRIER_K0_IDX
#define GNB_CONFIG_DL_CARRIERBANDWIDTH_IDX
#define GNB_CONFIG_DL_LOCATIONANDBANDWIDTH_IDX
#define GNB_CONFIG_DL_BWP_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_DL_BWP_PREFIX_TYPE_IDX
#define GNB_CONFIG_UL_FREQBANDINDICATORNR_IDX
#define GNB_CONFIG_UL_ABSOLUTEFREQUENCYPOINTA_IDX
#define GNB_CONFIG_UL_ADDITIONALSPECTRUMEMISSION_IDX;
#define GNB_CONFIG_UL_P_MAX_IDX
#define GNB_CONFIG_UL_FREQUENCYSHIFT7P5KHZ_IDX
#define GNB_CONFIG_UL_OFFSETTOCARRIER_IDX
#define GNB_CONFIG_UL_SCS_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_UL_SCS_SPECIFICCARRIER_K0_IDX
#define GNB_CONFIG_UL_CARRIERBANDWIDTH_IDX
#define GNB_CONFIG_UL_LOCATIONANDBANDWIDTH_IDX
#define GNB_CONFIG_UL_BWP_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_UL_BWP_PREFIX_TYPE_IDX
#define GNB_CONFIG_SUBCARRIERSPACINGCOMMON_IDX
#define GNB_CONFIG_PDCCH_CONFIGSIB1_IDX
#define GNB_CONFIG_FREQUENCYOFFSETSSB_IDX
#define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR_IDX
#define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL_IDX
#define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION_IDX
#define GNB_CONFIG_NIA_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_SS_PBCH_BLOCKPOWER_IDX
#define GNB_CONFIG_REFERENCESUBCARRIERSPACING_IDX
#define GNB_CONFIG_DL_UL_TRANSMISSIONPERIODICITY_IDX
#define GNB_CONFIG_NROFDOWNLINKSLOTS_IDX
#define GNB_CONFIG_NROFDOWNLINKSYMBOLS_IDX
#define GNB_CONFIG_NROFUPLINKSLOTS_IDX
#define GNB_CONFIG_NROFUPLINKSYMBOLS_IDX
#define GNB_CONFIG_RACH_TOTALNUMBEROFRA_PREAMBLES_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_CHOICE_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEEIGHTH_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEFOURTH_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEHALF_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONE_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_TWO_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_FOUR_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_EIGHT_IDX
#define GNB_CONFIG_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_SIXTEEN_IDX
#define GNB_CONFIG_RACH_GROUPBCONFIGURED_IDX
#define GNB_CONFIG_RACH_RA_MSG3SIZEGROUPA_IDX
#define GNB_CONFIG_RACH_MESSAGEPOWEROFFSETGROUPB_IDX
#define GNB_CONFIG_RACH_NUMBEROFRA_PREAMBLESGROUPA_IDX
#define GNB_CONFIG_RACH_RA_CONTENTIONRESOLUTIONTIMER_IDX
#define GNB_CONFIG_RSRP_THRESHOLDSSB_IDX
#define GNB_CONFIG_RSRP_THRESHOLDSSB_SUL_IDX
#define GNB_CONFIG_PRACH_ROOTSEQUENCEINDEX_CHOICE_IDX
#define GNB_CONFIG_PRACH_ROOTSEQUENCEINDEX_L839_IDX
#define GNB_CONFIG_PRACH_ROOTSEQUENCEINDEX_L139_IDX
#define GNB_CONFIG_PRACH_MSG1_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_RESTRICTEDSETCONFIG_IDX
#define GNB_CONFIG_MSG3_TRANSFORMPRECODING_IDX
#define GNB_CONFIG_PRACH_CONFIGURATIONINDEX_IDX
#define GNB_CONFIG_PRACH_MSG1_FDM_IDX
#define GNB_CONFIG_PRACH_MSG1_FREQUENCYSTART_IDX
#define GNB_CONFIG_ZEROCORRELATIONZONECONFIG_IDX
#define GNB_CONFIG_PREAMBLERECEIVEDTARGETPOWER_IDX
#define GNB_CONFIG_PREAMBLETRANSMAX_IDX
#define GNB_CONFIG_POWERRAMPINGSTEP_IDX
#define GNB_CONFIG_RA_RESPONSEWINDOW_IDX
#define GNB_CONFIG_GROUPHOPPINGENABLEDTRANSFORMPRECODING_IDX
#define GNB_CONFIG_MSG3_DELTAPREAMBLE_IDX
#define GNB_CONFIG_P0_NOMINALWITHGRANT_IDX
#define GNB_CONFIG_PUSCH_TIMEDOMAINRESOURCEALLOCATION_K2_IDX
#define GNB_CONFIG_PUSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE_IDX
#define GNB_CONFIG_PUCCH_GROUPHOPPING_IDX
#define GNB_CONFIG_P0_NOMINAL_IDX
#define GNB_CONFIG_PDSCH_TIMEDOMAINRESOURCEALLOCATION_K0_IDX
#define GNB_CONFIG_PDSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE_IDX
#define GNB_CONFIG_RATEMATCHPATTERNID_IDX
#define GNB_CONFIG_RATEMATCHPATTERN_PATTERNTYPE_IDX
#define GNB_CONFIG_SYMBOLSINRESOURCEBLOCK_IDX
#define GNB_CONFIG_PERIODICITYANDPATTERN_IDX
#define GNB_CONFIG_RATEMATCHPATTERN_CONTROLRESOURCESET_IDX
#define GNB_CONFIG_RATEMATCHPATTERN_SUBCARRIERSPACING_IDX
#define GNB_CONFIG_RATEMATCHPATTERN_MODE_IDX
#define GNB_CONFIG_SEARCHSPACESIB1_IDX
#define GNB_CONFIG_SEARCHSPACEOTHERSYSTEMINFORMATION_IDX
#define GNB_CONFIG_PAGINGSEARCHSPACE_IDX
#define GNB_CONFIG_RA_SEARCHSPACE_IDX
#define GNB_CONFIG_RACH_RA_CONTROLRESOURCESET_IDX
#define GNB_CONFIG_PDCCH_COMMON_CONTROLRESOURCESETID_IDX
#define GNB_CONFIG_PDCCH_COMMON_CONTROLRESOURCESET_DURATION_IDX
#define GNB_CONFIG_PDCCH_CCE_REG_MAPPINGTYPE_IDX
#define GNB_CONFIG_PDCCH_REG_BUNDLESIZE_IDX
#define GNB_CONFIG_PDCCH_INTERLEAVERSIZE_IDX
#define GNB_CONFIG_PDCCH_SHIFTINDEX_IDX
#define GNB_CONFIG_PDCCH_PRECODERGRANULARITY_IDX
#define GNB_CONFIG_PDCCH_TCI_STATEID_IDX
#define GNB_CONFIG_TCI_PRESENTINDCI_IDX
#define GNB_CONFIG_SEARCHSPACEID_IDX
#define GNB_CONFIG_COMMONSEARCHSPACES_CONTROLRESOURCESETID_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_CHOICE_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL1_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL2_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL4_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL5_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL8_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL10_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL16_IDX
#define GNB_CONFIG_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL20_IDX
#define GNB_CONFIG_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL1_IDX
#define GNB_CONFIG_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL2_IDX
#define GNB_CONFIG_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL4_IDX
#define GNB_CONFIG_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL8_IDX
#define GNB_CONFIG_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL16_IDX
#define GNB_CONFIG_SEARCHSPACE_SEARCHSPACETYPE_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL1_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL2_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL4_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL8_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL16_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY_IDX
#define GNB_CONFIG_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES_IDX
#define GNB_CONFIG_UE_SPECIFIC__DCI_FORMATS_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_V_SHIFT_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET_IDX
#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE_IDX
+126
View File
@@ -0,0 +1,126 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file config.c
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 0.1
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
*/
int
nr_rrc_mac_config_req_ue(
module_id_t Mod_idP,
int CC_idP,
uint8_t eNB_index,
MAC_CellGroupConfig_t *mac_cell_group_config,
PhysicalCellGroupConfig_t *phy_cell_group_config,
SpCellConfig_t *spcell_config){
NR_UE_MAC_INST *mac = get_mac_inst(Mod_idP);
ServingCellConfig_t *serving_cell_config = spcell_config->spCellConfigDedicated;
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
if(mac_cell_group_config != (MAC_CellGroupConfig_t *)0){
if(mac_cell_group_config->drx_Config != (drx_Config_t *)0 ){
mac->drx_Config = mac_cell_group_config->drx_Config;
}
if(mac_cell_group_config->SchedulingRequestConfig != (SchedulingRequestConfig_t *)0 ){
mac->SchedulingRequestConfig = mac_cell_group_config->SchedulingRequestConfig;
}
if(mac_cell_group_config->BSR_Config != (BSR_Config_t *)0 ){
mac->BSR_Config = mac_cell_group_config->BSR_Config;
}
if(mac_cell_group_config->TAG_Config != (TAG_Config_t *)0 ){
mac->TAG_Config = mac_cell_group_config->TAG_Config;
}
if(mac_cell_group_config->phr_Config != (phr_Config_t *)0 ){
mac->phr_Config = mac_cell_group_config->phr_Config;
}
if(mac_cell_group_config->cs_RNTI != (cs_RNTI_t *)0 ){
mac->cs_RNTI = mac_cell_group_config->cs_RNTI;
}
}
if(phy_cell_group_config != (PhysicalCellGroupConfig_t *)0){
config_phy(phy_cell_group_config, NULL);
}
if(serving_cell_config_config != (SpCellConfig_t *)0){
config_phy(NULL, spcell_config);
mac->servCellIndex = spcell_config->servCellIndex;
}
if(serving_cell_config != (spCellConfigDedicated_t *)0){
if(serving_cell_config->tdd_UL_DL_ConfigurationDedicated != (TDD_UL_DL_ConfigDedicated_t *)0){
mac->tdd_UL_DL_ConfigurationDedicated = serving_cell_config->tdd_UL_DL_ConfigurationDedicated;
}
if(spcell_config->initialDownlinkBWP != (BWP_DownlinkDedicated_t *)0){
mac->init_DL_BWP = spcell_config->initialDownlinkBWP;
}
// storage list of DL BWP config. TODO should be modify to maintain(add/release) a list inside MAC instance, this implementation just use for one-shot RRC configuration setting.
if(spcell_config->downlinkBWP_ToAddModList != (struct ServingCellConfig__downlinkBWP_ToAddModList *)0){
mac->BWP_Downlink_list = spcell_config->downlinkBWP_ToAddModList->list;
mac->BWP_Downlink_count = spcell_config->downlinkBWP_ToAddModList->count;
}
if(spcell_config->bwp_InactivityTimer != (long *)0){
mac->bwp_InactivityTimer = spcell_config->bwp_InactivityTimer;
}
if(spcell_config->defaultDownlinkBWP_Id != (BWP_Id_t *)0){
mac->defaultDownlinkBWP_Id = spcell_config->defaultDownlinkBWP_Id;
}
if(spcell_config->pdsch_ServingCellConfig != (PDSCH_ServingCellConfig_t *)0){
mac->pdsch_ServingCellConfig = spcell_config->pdsch_ServingCellConfig;
}
if(spcell_config->csi_MeasConfig != (CSI_MeasConfig_t *)0){
mac->csi_MeasConfig = spcell_config->csi_MeasConfig;
}
spcell_config->tag_Id = spcell_config.tag_Id;
}
//scell config not yet
return (0);
}
+108
View File
@@ -0,0 +1,108 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file LAYER2/MAC/defs.h
* \brief MAC data structures, constant, and function prototype
* \author Navid Nikaein and Raymond Knopp
* \date 2011
* \version 0.5
* \email navid.nikaein@eurecom.fr
*/
/** @defgroup _oai2 openair2 Reference Implementation
* @ingroup _ref_implementation_
* @{
*/
/*@}*/
#ifndef __LAYER2_MAC_DEFS_H__
#define __LAYER2_MAC_DEFS_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/defs.h"
#include "COMMON/platform_constants.h"
#include "BCCH-BCH-Message.h"
#include "RadioResourceConfigCommon.h"
#include "RadioResourceConfigDedicated.h"
#include "MeasGapConfig.h"
#include "SchedulingInfoList.h"
#include "TDD-Config.h"
#include "RACH-ConfigCommon.h"
#include "MeasObjectToAddModList.h"
#include "MobilityControlInfo.h"
#if defined(Rel10) || defined(Rel14)
#include "MBSFN-AreaInfoList-r9.h"
#include "MBSFN-SubframeConfigList.h"
#include "PMCH-InfoList-r9.h"
#include "SCellToAddMod-r10.h"
#endif
#ifdef Rel14
#include "SystemInformationBlockType1-v1310-IEs.h"
#endif
#include "nfapi_interface.h"
#include "PHY_INTERFACE/IF_Module.h"
/*!\brief Top level UE MAC structure */
typedef struct {
//// MAC config
drx_Config_t *drx_config;
SchedulingRequestConfig_t *SchedulingRequestConfig;
BSR_Config_t *BSR_Config;
TAG_Config_t *TAG_Config;
phr_Config_t *phr_Config;
cs_RNTI_t *cs_RNTI;
ServCellIndex_t *servCellIndex;
//// Serving cell config
TDD_UL_DL_ConfigDedicated_t *tdd_UL_DL_ConfigurationDedicated;
// init DL BWP
BWP_DownlinkDedicated_t *init_DL_BWP;
// DL BWP list, not default one
BWP_Downlink_t **BWP_Downlink_list;
int BWP_Downlink_count;
//BWP_Id_t *firstActiveDownlinkBWP_Id;
long *bwp_InactivityTimer;
BWP_Id_t *defaultDownlinkBWP_Id;
//struct UplinkConfig *uplinkConfig;
//struct UplinkConfig *supplementaryUplink;
PDSCH_ServingCellConfig_t *pdsch_ServingCellConfig;
CSI_MeasConfig_t *csi_MeasConfig;
//SRS_CarrierSwitching_t *carrierSwitching;
//long *sCellDeactivationTimer /* OPTIONAL */;
//struct CrossCarrierSchedulingConfig *crossCarrierSchedulingConfig /* OPTIONAL */;
TAG_Id_t tag_Id;
//long *ue_BeamLockFunction /* OPTIONAL */;
//long *pathlossReferenceLinking /* OPTIONAL */;
} UE_MAC_INST;
#include "proto.h"
/*@}*/
#endif /*__LAYER2_MAC_DEFS_H__ */
+55
View File
@@ -0,0 +1,55 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file main.c
* \brief top init of Layer 2
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1.0
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#include "defs.h"
#include "proto.h"
#include "extern.h"
#include "assertions.h"
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
int
nr_l2_init_ue(void)
{
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
LOG_I(MAC, "[MAIN] init UE MAC functions \n");
//init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST);
return (1);
}
NR_UE_MAC_INST_t *get_mac_inst(Module_id_t Mod_idP){
return &nr_ue_mac_inst[(int)Mod_idP];
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars.h
* \brief mac vars
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1.0
* \email navid.nikaein@eurecom.fr
* @ingroup _mac
*/
UE_MAC_INST_t UE_mac_inst; //[NB_MODULE_MAX];
View File
+647
View File
@@ -0,0 +1,647 @@
#include "openair1/PHY/defs.h"
#include "openair2/PHY_INTERFACE/IF_Module.h"
#include "openair1/PHY/extern.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/proto.h"
#include "common/ran_context.h"
#define MAX_IF_MODULES 100
IF_Module_t *if_inst[MAX_IF_MODULES];
Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs];
extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind);
extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind);
extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind);
extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint8_t nfapi_mode;
extern uint16_t sf_ahead;
void handle_rach(UL_IND_t *UL_info) {
int i;
if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_info->rach_ind.sfn_sf));
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf),
NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti
#ifdef Rel14
,0
#endif
);
}
#ifdef Rel14
if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n");
for (i=0;i<UL_info->rach_ind_br.rach_indication_body.number_of_preambles;i++) {
AssertFatal(UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type>0,
"Got regular PRACH preamble, not BL/CE\n");
LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc (CE_level %d)\n",UL_info->frame,UL_info->subframe,
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type-1);
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->frame,
UL_info->subframe,
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.preamble,
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.timing_advance,
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.rnti,
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type);
}
UL_info->rach_ind_br.rach_indication_body.number_of_preambles=0;
}
#endif
}
void handle_sr(UL_IND_t *UL_info) {
int i;
if (nfapi_mode == 1) // PNF
{
if (UL_info->sr_ind.sr_indication_body.number_of_srs>0)
{
oai_nfapi_sr_indication(&UL_info->sr_ind);
}
}
else
{
for (i=0;i<UL_info->sr_ind.sr_indication_body.number_of_srs;i++)
SR_indication(UL_info->module_id,
UL_info->CC_id,
UL_info->frame,
UL_info->subframe,
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti,
UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi);
}
UL_info->sr_ind.sr_indication_body.number_of_srs=0;
}
void handle_cqi(UL_IND_t *UL_info) {
int i;
if (nfapi_mode == 1)
{
if (UL_info->cqi_ind.number_of_cqis>0)
{
LOG_D(PHY,"UL_info->cqi_ind.number_of_cqis:%d\n", UL_info->cqi_ind.number_of_cqis);
nfapi_cqi_indication_t ind;
ind.header.message_id = NFAPI_RX_CQI_INDICATION;
ind.sfn_sf = UL_info->frame<<4 | UL_info->subframe;
ind.cqi_indication_body = UL_info->cqi_ind;
oai_nfapi_cqi_indication(&ind);
UL_info->cqi_ind.number_of_cqis=0;
}
}
else
{
for (i=0;i<UL_info->cqi_ind.number_of_cqis;i++)
cqi_indication(UL_info->module_id,
UL_info->CC_id,
UL_info->frame,
UL_info->subframe,
UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti,
&UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9,
UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu,
&UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information);
UL_info->cqi_ind.number_of_cqis=0;
}
}
void handle_harq(UL_IND_t *UL_info) {
int i;
if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) // PNF
{
//LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
int retval = oai_nfapi_harq_indication(&UL_info->harq_ind);
if (retval!=0)
{
LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval);
}
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
}
else
{
for (i=0;i<UL_info->harq_ind.harq_indication_body.number_of_harqs;i++)
harq_indication(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf),
NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf),
&UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]);
UL_info->harq_ind.harq_indication_body.number_of_harqs=0;
}
}
void handle_ulsch(UL_IND_t *UL_info) {
int i,j;
if(nfapi_mode == 1)
{
if (UL_info->crc_ind.crc_indication_body.number_of_crcs>0)
{
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
oai_nfapi_crc_indication(&UL_info->crc_ind);
UL_info->crc_ind.crc_indication_body.number_of_crcs = 0;
}
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0)
{
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
oai_nfapi_rx_ind(&UL_info->rx_ind);
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
}
}
else
{
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) {
for (i=0;i<UL_info->rx_ind.rx_indication_body.number_of_pdus;i++) {
for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++) {
// find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti ==
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) {
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
(uint8_t *)NULL,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
else {
LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe);
rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
break;
} //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti ==
// UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti)
} // for (j=0;j<UL_info->crc_ind.crc_indication_body.number_of_crcs;j++)
} // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
UL_info->crc_ind.crc_indication_body.number_of_crcs=0;
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
} // UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0
else if (UL_info->rx_ind.rx_indication_body.number_of_pdus!=0 || UL_info->crc_ind.crc_indication_body.number_of_crcs!=0) {
LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SF:%05d) crc_ind:%d(SFN/SF:%05d) UL_info(SFN/SF):%04d%d\n",
UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf),
UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf),
UL_info->frame, UL_info->subframe);
}
}
}
/****************************************************************************/
/* debug utility functions begin */
/****************************************************************************/
//#define DUMP_FAPI
#ifdef DUMP_FAPI
#define C do { size = 0; put(0); } while (0)
#define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0)
#if 0
/* eats lots of ms at startup, disrupts realtime */
static char *s;
static int size;
static int maxsize;
static void put(char x)
{
if (size == maxsize) {
maxsize += 32768;
s = realloc(s, maxsize); if (s == NULL) abort();
}
s[size++] = x;
}
#else
/* eats nothing at startup, but fixed size */
#define SMAX 65536
static char s[SMAX];
static int size;
static int maxsize = SMAX;
static void put(char x)
{
if (size == maxsize) { printf("incrase SMAX\n"); exit(1); }
s[size++] = x;
}
#endif
static void append_string(char *t)
{
size--;
while (*t) put(*t++);
put(0);
}
static void dump_ul(UL_IND_t *u)
{
int i;
C;
A("XXXX UL mod %d CC %d f.sf %d.%d\n",
u->module_id, u->CC_id, u->frame, u->subframe);
A("XXXX harq_ind %d\n", u->harq_ind.harq_indication_body.number_of_harqs);
for (i = 0; i < u->harq_ind.harq_indication_body.number_of_harqs; i++) {
nfapi_harq_indication_pdu_t *v = &u->harq_ind.harq_indication_body.harq_pdu_list[i];
A("XXXX harq ind %d\n", i);
A("XXXX rnti %d\n", v->rx_ue_information.rnti);
A("XXXX tb1 %d tb2 %d\n", v->harq_indication_fdd_rel8.harq_tb1,
v->harq_indication_fdd_rel8.harq_tb2);
A("XXXX number_of_ack_nack %d\n",
v->harq_indication_fdd_rel9.number_of_ack_nack);
A("XXXX harq[0] = %d\n",
v->harq_indication_fdd_rel9.harq_tb_n[0]);
A("XXXX harq ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi,
v->ul_cqi_information.channel);
}
A("XXXX crc_ind %d\n", u->crc_ind.crc_indication_body.number_of_crcs);
A("XXXX sr_ind %d\n", u->sr_ind.sr_indication_body.number_of_srs);
A("XXXX cqi_ind %d\n", u->cqi_ind.number_of_cqis);
for (i = 0; i < u->cqi_ind.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_pdu_list[i];
A("XXXX cqi ind %d\n", i);
A("XXXX cqi ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi,
v->ul_cqi_information.channel);
}
A("XXXX rach_ind %d\n", u->rach_ind.rach_indication_body.number_of_preambles);
A("XXXX rx_ind %d\n", u->rx_ind.rx_indication_body.number_of_pdus);
for (i = 0; i < u->rx_ind.rx_indication_body.number_of_pdus; i++) {
nfapi_rx_indication_pdu_t *v = &u->rx_ind.rx_indication_body.rx_pdu_list[i];
A("XXXX rx ind %d\n", i);
A("XXXX timing_advance %d\n",
v->rx_indication_rel8.timing_advance);
A("XXXX rx ul_cqi %d\n", v->rx_indication_rel8.ul_cqi);
}
LOG_I(PHY, "XXXX UL\nXXXX UL\n%s", s);
}
static char *DL_PDU_TYPE(int x)
{
switch (x) {
case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: return "NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE";
case NFAPI_DL_CONFIG_BCH_PDU_TYPE: return "NFAPI_DL_CONFIG_BCH_PDU_TYPE";
case NFAPI_DL_CONFIG_MCH_PDU_TYPE: return "NFAPI_DL_CONFIG_MCH_PDU_TYPE";
case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: return "NFAPI_DL_CONFIG_DLSCH_PDU_TYPE";
case NFAPI_DL_CONFIG_PCH_PDU_TYPE: return "NFAPI_DL_CONFIG_PCH_PDU_TYPE";
case NFAPI_DL_CONFIG_PRS_PDU_TYPE: return "NFAPI_DL_CONFIG_PRS_PDU_TYPE";
case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: return "NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE";
case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: return "NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE";
case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: return "NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NBCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE";
}
return "UNKNOWN";
}
static char *UL_PDU_TYPE(int x)
{
switch (x) {
case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_SRS_PDU_TYPE: return "NFAPI_UL_CONFIG_SRS_PDU_TYPE";
case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: return "NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: return "NFAPI_UL_CONFIG_NULSCH_PDU_TYPE";
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: return "NFAPI_UL_CONFIG_NRACH_PDU_TYPE";
}
return "UNKNOWN";
}
static char *HI_DCI0_PDU_TYPE(int x)
{
switch (x) {
case NFAPI_HI_DCI0_HI_PDU_TYPE: return "NFAPI_HI_DCI0_HI_PDU_TYPE";
case NFAPI_HI_DCI0_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_DCI_PDU_TYPE";
case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE";
case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE";
case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE";
}
return "UNKNOWN";
}
static void dump_dl(Sched_Rsp_t *d)
{
int i;
C;
A("XXXX DL mod %d CC %d f.sf %d.%d\n",
d->module_id, d->CC_id, d->frame, d->subframe);
if (d->DL_req != NULL) {
nfapi_dl_config_request_body_t *v=&d->DL_req->dl_config_request_body;
nfapi_dl_config_request_pdu_t *p = v->dl_config_pdu_list;
A("XXXX DL_req sfnsf %d\n", d->DL_req->sfn_sf);
A("XXXX PDCCH size %d\n", v->number_pdcch_ofdm_symbols);
A("XXXX DCIs %d\n", v->number_dci);
A("XXXX PDUs %d\n", v->number_pdu);
A("XXXX rntis %d\n", v->number_pdsch_rnti);
A("XXXX pcfich power %d\n", v->transmission_power_pcfich);
for (i = 0; i < v->number_pdu; i++) {
A("XXXX pdu %d\n", i);
A("XXXX type %d %s\n", p[i].pdu_type, DL_PDU_TYPE(p[i].pdu_type));
switch (p[i].pdu_type) {
case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: {
nfapi_dl_config_dci_dl_pdu_rel8_t *q =
&p[i].dci_dl_pdu.dci_dl_pdu_rel8;
A("XXXX dci format %d\n", q->dci_format);
A("XXXX cce idx %d\n", q->cce_idx);
A("XXXX agg lvl %d\n", q->aggregation_level);
A("XXXX rnti %d\n", q->rnti);
A("XXXX rb coding %8.8x\n", q->resource_block_coding);
A("XXXX mcs_1 %d\n", q->mcs_1);
A("XXXX rv_1 %d\n", q->redundancy_version_1);
A("XXXX ndi_1 %d\n", q->new_data_indicator_1);
A("XXXX harq pid %d\n", q->harq_process);
A("XXXX tpc %d\n", q->tpc);
A("XXXX tbs idx %d\n", q->transport_block_size_index);
A("XXXX dl pow off %d\n", q->downlink_power_offset);
A("XXXX rnti type %d\n", q->rnti_type);
A("XXXX xmit pow %d\n", q->transmission_power);
break;
}
case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: {
nfapi_dl_config_dlsch_pdu_rel8_t *q =
&p[i].dlsch_pdu.dlsch_pdu_rel8;
A("XXXX pdu_index %d\n", q->pdu_index);
A("XXXX rnti %d\n", q->rnti);
A("XXXX rv %d\n", q->redundancy_version);
A("XXXX mcs %d\n", q->modulation);
A("XXXX pa %d\n", q->pa);
break;
}}
}
}
if (d->HI_DCI0_req != NULL) {
nfapi_hi_dci0_request_body_t *v=&d->HI_DCI0_req->hi_dci0_request_body;
A("XXXX up HI_DCI0_req sfnsf %d (%d.%d)\n", d->HI_DCI0_req->sfn_sf,
d->HI_DCI0_req->sfn_sf/16, d->HI_DCI0_req->sfn_sf%16);
A("XXXX up sfnsf %d\n", v->sfnsf);
A("XXXX up DCIs %d\n", v->number_of_dci);
A("XXXX up HIs %d\n", v->number_of_hi);
for (i = 0; i < v->number_of_dci + v->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t *p = &v->hi_dci0_pdu_list[i];
A("XXXX up pdu %d\n", i);
A("XXXX up type %d %s\n",p->pdu_type,HI_DCI0_PDU_TYPE(p->pdu_type));
if (p->pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) {
nfapi_hi_dci0_dci_pdu_rel8_t *q = &p->dci_pdu.dci_pdu_rel8;
A("XXXX up dci_format %d\n", q->dci_format);
A("XXXX up cce_index %d\n", q->cce_index);
A("XXXX up aggregation_level %d\n", q->aggregation_level);
A("XXXX up rnti %d\n", q->rnti);
A("XXXX up rb start %d\n", q->resource_block_start);
A("XXXX up # rb %d\n", q->number_of_resource_block);
A("XXXX up mcs_1 %d\n", q->mcs_1);
A("XXXX up cshift_2_for_drms %d\n", q->cyclic_shift_2_for_drms);
A("XXXX up freq hop enabled %d\n", q->frequency_hopping_enabled_flag);
A("XXXX up fre hop bits %d\n", q->frequency_hopping_bits);
A("XXXX up NDI_1 %d\n", q->new_data_indication_1);
A("XXXX up tx_antenna_seleciton %d\n", q->ue_tx_antenna_seleciton);
A("XXXX up tpc %d\n", q->tpc);
A("XXXX up cqi_csi_request %d\n", q->cqi_csi_request);
A("XXXX up ul_index %d\n", q->ul_index);
A("XXXX up dl_assignment_index %d\n", q->dl_assignment_index);
A("XXXX up tpc_bitmap %d\n", q->tpc_bitmap);
A("XXXX up transmission_power %d\n", q->transmission_power);
}
if (p->pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE) {
nfapi_hi_dci0_hi_pdu_rel8_t *q = &p->hi_pdu.hi_pdu_rel8;
A("XXXX up rb start %d\n", q->resource_block_start);
A("XXXX up cs2_drms %d\n", q->cyclic_shift_2_for_drms);
A("XXXX up ack %d\n", q->hi_value);
A("XXXX up i_phich %d\n", q->i_phich);
A("XXXX up power %d\n", q->transmission_power);
}
}
}
if (d->UL_req != NULL) {
nfapi_ul_config_request_body_t *v=&d->UL_req->ul_config_request_body;
A("XXXX UL_req sfnsf %d (%d.%d)\n", d->UL_req->sfn_sf,
d->UL_req->sfn_sf/16, d->UL_req->sfn_sf%16);
A("XXXX PDUs %d\n", v->number_of_pdus);
A("XXXX ra freq %d\n", v->rach_prach_frequency_resources);
A("XXXX srs? %d\n", v->srs_present);
for (i = 0; i < v->number_of_pdus; i++) {
nfapi_ul_config_request_pdu_t *p = &v->ul_config_pdu_list[i];
A("XXXX pdu %d\n", i);
A("XXXX type %d %s\n", p->pdu_type, UL_PDU_TYPE(p->pdu_type));
switch(p->pdu_type) {
case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: {
nfapi_ul_config_uci_harq_pdu *q = &p->uci_harq_pdu;
nfapi_ul_config_harq_information_rel9_fdd_t *h =
&q->harq_information.harq_information_rel9_fdd;
A("XXXX rnti %d\n",
q->ue_information.ue_information_rel8.rnti);
A("XXXX harq size %d\n", h->harq_size);
A("XXXX ack_nack_mode %d\n", h->ack_nack_mode);
A("XXXX # pucch res %d\n", h->number_of_pucch_resources);
A("XXXX n_pucch_1_0 %d\n", h->n_pucch_1_0);
A("XXXX n_pucch_1_1 %d\n", h->n_pucch_1_1);
A("XXXX n_pucch_1_2 %d\n", h->n_pucch_1_2);
A("XXXX n_pucch_1_3 %d\n", h->n_pucch_1_3);
break;
}
case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: {
nfapi_ul_config_uci_sr_pdu *q = &p->uci_sr_pdu;
nfapi_ul_config_sr_information_rel8_t *h =
&q->sr_information.sr_information_rel8;
A("XXXX rnti %d\n",
q->ue_information.ue_information_rel8.rnti);
A("XXXX pucch_index %d\n", h->pucch_index);
}}
}
}
LOG_I(PHY, "XXXX DL\nXXXX DL\n%s", s);
}
#undef C
#undef A
#endif /* DUMP_FAPI */
/****************************************************************************/
/* debug utility functions end */
/****************************************************************************/
void UL_indication(UL_IND_t *UL_info)
{
AssertFatal(UL_info!=NULL,"UL_INFO is null\n");
#ifdef DUMP_FAPI
dump_ul(UL_info);
#endif
module_id_t module_id = UL_info->module_id;
int CC_id = UL_info->CC_id;
Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
IF_Module_t *ifi = if_inst[module_id];
eNB_MAC_INST *mac = RC.mac[module_id];
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n",
UL_info->frame,UL_info->subframe,
module_id,CC_id,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs);
if (nfapi_mode != 1)
{
if (ifi->CC_mask==0) {
ifi->current_frame = UL_info->frame;
ifi->current_subframe = UL_info->subframe;
}
else {
AssertFatal(UL_info->frame != ifi->current_frame,"CC_mask %x is not full and frame has changed\n",ifi->CC_mask);
AssertFatal(UL_info->subframe != ifi->current_subframe,"CC_mask %x is not full and subframe has changed\n",ifi->CC_mask);
}
ifi->CC_mask |= (1<<CC_id);
}
// clear DL/UL info for new scheduling round
clear_nfapi_information(RC.mac[module_id],CC_id,
UL_info->frame,UL_info->subframe);
handle_rach(UL_info);
handle_sr(UL_info);
handle_cqi(UL_info);
handle_harq(UL_info);
// clear HI prior to handling ULSCH
mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi = 0;
handle_ulsch(UL_info);
if (nfapi_mode != 1)
{
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
eNB_dlsch_ulsch_scheduler(module_id,
(UL_info->frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024,
(UL_info->subframe+sf_ahead)%10);
ifi->CC_mask = 0;
sched_info->module_id = module_id;
sched_info->CC_id = CC_id;
sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024;
sched_info->subframe = (UL_info->subframe+sf_ahead)%10;
sched_info->DL_req = &mac->DL_req[CC_id];
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id];
if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0))
sched_info->UL_req = &mac->UL_req[CC_id];
else
sched_info->UL_req = NULL;
sched_info->TX_req = &mac->TX_req[CC_id];
#ifdef DUMP_FAPI
dump_dl(sched_info);
#endif
if (ifi->schedule_response)
{
AssertFatal(ifi->schedule_response!=NULL,
"schedule_response is null (mod %d, cc %d)\n",
module_id,
CC_id);
ifi->schedule_response(sched_info);
}
LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu);
}
}
}
IF_Module_t *IF_Module_init(int Mod_id){
AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES);
LOG_D(PHY,"Installing callbacks for IF_Module - UL_indication\n");
if (if_inst[Mod_id]==NULL) {
if_inst[Mod_id] = (IF_Module_t*)malloc(sizeof(IF_Module_t));
memset((void*)if_inst[Mod_id],0,sizeof(IF_Module_t));
if_inst[Mod_id]->CC_mask=0;
if_inst[Mod_id]->UL_indication = UL_indication;
AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0,
"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);
}
return if_inst[Mod_id];
}
void IF_Module_kill(int Mod_id) {
AssertFatal(Mod_id>MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES);
if (if_inst[Mod_id]!=NULL) free(if_inst[Mod_id]);
}
+142
View File
@@ -0,0 +1,142 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/PHY_INTERFACE/IF_Module.h
* \brief data structures for PHY/MAC interface modules
* \author EURECOM/NTUST
* \date 2017
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __IF_MODULE__H__
#define __IF_MODULE__H__
#include <stdint.h>
#include "openair1/PHY/LTE_TRANSPORT/defs.h"
#include "nfapi_interface.h"
#define MAX_NUM_DL_PDU 100
#define MAX_NUM_UL_PDU 100
#define MAX_NUM_HI_DCI0_PDU 100
#define MAX_NUM_TX_REQUEST_PDU 100
#define MAX_NUM_HARQ_IND 100
#define MAX_NUM_CRC_IND 100
#define MAX_NUM_SR_IND 100
#define MAX_NUM_CQI_IND 100
#define MAX_NUM_RACH_IND 100
#define MAX_NUM_SRS_IND 100
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
int CC_id;
/// frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// harq indication list
nfapi_harq_indication_t harq_ind;
/// crc indication list
nfapi_crc_indication_t crc_ind;
/// SR indication list
nfapi_sr_indication_t sr_ind;
/// CQI indication list
nfapi_cqi_indication_body_t cqi_ind;
/// RACH indication list
nfapi_rach_indication_t rach_ind;
#ifdef Rel14
/// RACH indication list for BR UEs
nfapi_rach_indication_t rach_ind_br;
#endif
/// SRS indication list
nfapi_srs_indication_body_t srs_ind;
/// RX indication
nfapi_rx_indication_t rx_ind;
} UL_IND_t;
// Downlink subframe P7
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
uint8_t CC_id;
/// frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// nFAPI DL Config Request
nfapi_dl_config_request_t *DL_req;
/// nFAPI UL Config Request
nfapi_ul_config_request_t *UL_req;
/// nFAPI HI_DCI Request
nfapi_hi_dci0_request_t *HI_DCI0_req;
/// Pointers to DL SDUs
nfapi_tx_request_t *TX_req;
}Sched_Rsp_t;
typedef struct {
uint8_t Mod_id;
int CC_id;
nfapi_config_request_t *cfg;
}PHY_Config_t;
typedef struct IF_Module_s{
//define the function pointer
void (*UL_indication)(UL_IND_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_t* config_INFO);
uint32_t CC_mask;
uint16_t current_frame;
uint8_t current_subframe;
pthread_mutex_t if_mutex;
}IF_Module_t;
/*Initial */
IF_Module_t *IF_Module_init(int Mod_id);
void IF_Module_kill(int Mod_id);
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication(UL_IND_t *UL_INFO);
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void Schedule_Response(Sched_Rsp_t *Sched_INFO);
#endif
+373
View File
@@ -0,0 +1,373 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file PHY_INTERFACE/defs.h
* \brief mac phy interface primitives
* \author Raymond Knopp and Navid Nikaein
* \date 2011
* \version 0.5
* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr
*/
#ifndef __MAC_PHY_PRIMITIVES_H__
# define __MAC_PHY_PRIMITIVES_H__
#include "LAYER2/MAC/defs.h"
#define MAX_NUMBER_OF_MAC_INSTANCES 16
#define NULL_PDU 255
#define DCI 0
#define DLSCH 1
#define ULSCH 2
#define mac_exit_wrapper(sTRING) \
do { \
char temp[300]; \
snprintf(temp, sizeof(temp), "%s in file "__FILE__" at line %d\n", sTRING, __LINE__); \
mac_xface->macphy_exit(temp); \
} while(0)
/** @defgroup _phy_if MAC-PHY interface
* @ingroup _oai2
* @{
*/
/*! \brief MACPHY Interface */
/*
typedef struct {
/// Pointer function that initializes L2
int (*macphy_init)(int eMBMS_active, char *uecap_xer, uint8_t CBA_active,uint8_t HO_active);
/// Pointer function that stops the low-level scheduler due an exit condition
void (*macphy_exit)(const char *);
// eNB functions
/// Invoke dlsch/ulsch scheduling procedure for new subframe
void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
/// Fill random access response sdu, passing timing advance
uint16_t (*fill_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length);
/// Initiate the RA procedure upon reception (hypothetical) of a valid preamble
void (*initiate_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframe,uint8_t f_id);
/// cancel an ongoing RA procedure
void (*cancel_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble);
/// Inform MAC layer that an uplink is scheduled for Msg3 in given subframe.
/// This is used so that the MAC scheduler marks as busy the RBs used by the Msg3.
void (*set_msg3_subframe)(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe);
/// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe);
/// Get DLSCH sdu for particular RNTI and Transport block index
uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TB_index);
/// Send ULSCH sdu to MAC for given rnti
void (*rx_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP, sub_frame_t sub_frameP,rnti_t rnti, uint8_t *sdu,uint16_t sdu_len, int harq_pid,uint8_t *msg3_flag);
/// Indicate failure to synch to external source
void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index);
/// Indicate Scheduling Request from UE
void (*SR_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
/// Indicate UL Failure to eNodeB MAC
void (*UL_failure_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
/// Configure Common PHY parameters from SIB1
void (*phy_config_mib_eNB)(module_id_t Mod_id,int CC_id,
int eutra_band,
int N_RB_DL,
PHICH_Config_t *phich_Config,
int Nid_cell,
int Ncp,
int p_eNB,
uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq);
/// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_eNB)(module_id_t Mod_id,int CC_id,
TDD_Config_t *tdd_config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/// Configure Common PHY parameters from SIB2
void (*phy_config_sib2_eNB)(module_id_t Mod_id, int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
#if defined(Rel10) || defined(Rel14)
/// Configure Common PHY parameters from SIB13
void (*phy_config_sib13_eNB)(module_id_t Mod_id,int CC_id, int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
void (*phy_config_dedicated_scell_eNB)(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
#endif
/// PHY-Config-Dedicated eNB
void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated);
#if defined(Rel10) || defined(Rel14)
/// Get MCH sdu and corresponding MCS for particular MBSFN subframe
MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id, int CC_id, frame_t frameP,sub_frame_t subframe);
#endif
// configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
/// get delta mcs for fast UL AMC
int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP);
/// UE functions
/// reset the ue phy
void (*phy_reset_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Indicate loss of synchronization of PBCH for this eNB to MAC layer
void (*out_of_sync_ind)(module_id_t Mod_id,frame_t frameP,uint16_t eNB_index);
/// Send a received SI sdu
void (*ue_decode_si)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len);
/// Send a received Paging sdu
void (*ue_decode_p)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len);
/// Send a received DLSCH sdu to MAC
void (*ue_send_sdu)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index);
#if defined(Rel10) || defined(Rel14)
/// Send a received MCH sdu to MAC
void (*ue_send_mch_sdu)(module_id_t Mod_id,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area);
/// Function to check if UE PHY needs to decode MCH for MAC
/// get the sync area id, and return MCS value if need to decode, otherwise -1
int (*ue_query_mch)(module_id_t Mod_id, uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
#endif
/// Retrieve ULSCH sdu from MAC
void (*ue_get_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
/// Retrieve RRCConnectionReq from MAC
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
/// Process Random-Access Response
uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer);
/// Get SR payload (0,1) from UE MAC
uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
/// Indicate synchronization with valid PBCH
void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
/// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/// PHY-Config-harq UE
void (*phy_config_harq_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
uint16_t max_harq_tx);
/// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
TDD_Config_t *tdd_config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/// Configure Common PHY parameters from SIB2
void (*phy_config_sib2_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
#if defined(Rel10) || defined(Rel14)
/// Configure Common PHY parameters from SIB13
void (*phy_config_sib13_ue)(uint8_t Mod_id,int CC_id, uint8_t eNB_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
void (*phy_config_dedicated_scell_ue)(uint8_t Mod_id,
uint8_t eNB_index,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id);
#endif
/// Configure Common PHY parameters from mobilityControlInfo
void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
MobilityControlInfo_t *mobilityControlInfo,
uint8_t ho_failed);
/// Function to indicate failure of contention resolution or RA procedure
void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function to indicate success of contention resolution or RA procedure
void (*ra_succeeded)(module_id_t Mod_id,uint8_t CC_id, uint8_t eNB_index);
/// Function to indicate the transmission of msg1/rach to MAC
void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
/// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
/// Function to pass inter-cell measurement parameters to PHY (cell Ids)
void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id);
// PHY Helper Functions
/// RIV computation from PHY
uint16_t (*computeRIV)(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
/// Downlink TBS table lookup from PHY
uint32_t (*get_TBS_DL)(uint8_t mcs, uint16_t nb_rb);
/// Uplink TBS table lookup from PHY
uint32_t (*get_TBS_UL)(uint8_t mcs, uint16_t nb_rb);
/// Function to retrieve the HARQ round index for a particular UL/DLSCH and harq_pid
int (*get_ue_active_harq_pid)(module_id_t Mod_id, uint8_t CC_id,rnti_t rnti, int frame, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag);
/// Function to retrieve number of CCE
uint16_t (*get_nCCE_max)(module_id_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe);
int (*get_nCCE_offset)(int *CCE_table,
const unsigned char L,
const int nCCE,
const int common_dci,
const unsigned short rnti,
const unsigned char subframe);
/// Function to retrieve number of PRB in an rb_alloc
uint32_t (*get_nb_rb)(uint8_t ra_header, uint32_t rb_alloc, int n_rb_dl);
/// Function to convert VRB to PRB for distributed allocation
uint32_t (*get_prb)(int N_RB_DL,int odd_slot,int vrb,int Ngap);
/// Function to retrieve transmission mode for UE
uint8_t (*get_transmission_mode)(module_id_t Mod_id,uint8_t CC_id,rnti_t rnti);
/// Function to retrieve rb_alloc bitmap from dci rballoc field and VRB type
uint32_t (*get_rballoc)(vrb_t vrb_type, uint16_t rb_alloc_dci);
/// Function for UE MAC to retrieve current PHY connectivity mode (PRACH,RA_RESPONSE,PUSCH)
UE_MODE_t (*get_ue_mode)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve measured Path Loss
int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve the rssi
uint32_t (*get_RSSI)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the total gain
uint32_t (*get_rx_total_gain_dB)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve the number of adjustent cells
uint8_t (*get_n_adj_cells)(uint8_t Mod_id,uint8_t CC_id);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint32_t (*get_RSRP)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
uint32_t (*get_RSRQ)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRP_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
/// Function for UE/eNB MAC to retrieve number of PRACH in TDD
uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms);
/// Function for UE/eNB MAC to retrieve f_id of particular PRACH resource in TDD
uint8_t (*get_fid_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index);
/// Function for eNB MAC to retrieve subframe direction
lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t CC_id, uint8_t subframe);
// MAC Helper functions
/// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (Po_NOMINAL_PUSCH parameter)
int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,uint8_t CC_id);
/// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (deltaP_rampup parameter)
int8_t (*get_deltaP_rampup)(module_id_t Mod_id,uint8_t CC_id);
/// Function for UE/PHY to compute PHR
int8_t (*get_PHR)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
/// Function for UE to process the timing advance command
void (*process_timing_advance)(module_id_t Mod_id,uint8_t CC_id, int16_t timing_advance);
/// Function for MAC to get the UE stats from the PHY
LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
/// get the frame parameters from the PHY
LTE_DL_FRAME_PARMS* (*get_lte_frame_parms)(module_id_t Mod_id, uint8_t CC_id);
/// get the Multiuser mimo mode
MU_MIMO_mode* (*get_mu_mimo_mode) (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
/// get the delta TF for Uplink Power Control Calculation
int16_t (*get_hundred_times_delta_TF) (module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid);
/// get target PUSCH received power
int16_t (*get_target_pusch_rx_power) (module_id_t module_idP, uint8_t CC_id);
/// get target PUSCH received power
int16_t (*get_target_pucch_rx_power) (module_id_t module_idP, uint8_t CC_id);
unsigned char is_cluster_head;
unsigned char is_primary_cluster_head;
unsigned char is_secondary_cluster_head;
unsigned char cluster_head_index;
/// PHY Frame Configuration
LTE_DL_FRAME_PARMS *frame_parms;
uint8_t (*get_prach_prb_offset)(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf);
int (*is_prach_subframe)(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe);
/// ICIC algos
uint8_t (*get_SB_size)(uint8_t n_rb_dl);
///end ALU's algo
} MAC_xface;
*/
#endif
/** @} */
+27
View File
@@ -0,0 +1,27 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __PHY_INTERFACE_EXTERN_H__
#define __PHY_INTERFACE_EXTERN_H__
#endif
@@ -0,0 +1,283 @@
/*
* 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
*/
/*________________________mac_phy_primitives.c________________________
Authors : Hicham Anouar, Raymond Knopp
Company : EURECOM
Emails : anouar@eurecom.fr, knopp@eurecom.fr
________________________________________________________________*/
//#include "openair_extern.h"
#ifdef MAC_CONTEXT
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
//#include "extern.h"
#include "defs.h"
#endif //MAC_CONTEXT
//#define DEBUG_UE_DECODE_SACH
//#define DEBUG_NODEB_DECODE_SACH
#ifdef PHY_CONTEXT
#ifdef PHY_EMUL
#include "extern.h"
#include "SIMULATION/simulation_defs.h"
#else //PHY_EMUL
#include "MAC_INTERFACE/extern.h"
#endif //PHY_EMUL
void clear_macphy_data_req(unsigned char Mod_id)
{
//msg("CLEAR DATA_REQ\n");
unsigned char i;
Macphy_req_table[Mod_id].Macphy_req_cnt = 0;
for (i=0; i<NB_REQ_MAX; i++)
Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active = 0;
}
/*
unsigned char phy_resources_compare(PHY_RESOURCES *Phy1,PHY_RESOURCES* Phy2 ){
if(Phy1->Time_alloc==Phy2->Time_alloc && Phy1->Freq_alloc==Phy2->Freq_alloc)// && Phy1->Coding_fmt==Phy2->Coding_fmt && Phy1->Seq_index==Phy2->Seq_index)
return 1;
else
return 0;
}
*/
MACPHY_DATA_REQ_TABLE_ENTRY* find_data_req_entry(unsigned char Mod_id,MACPHY_REQ_ENTRY_KEY *Search_key)
{
unsigned char i;
//msg("[MAC_PHY]MAC_PHY_REQUEST_CNT=%d\n",Macphy_req_table.Macphy_req_cnt);
if (Macphy_req_table[Mod_id].Macphy_req_cnt > 0) {
#ifdef DEBUG_PHY
// msg("[MACPHY_FIND_REQ] SEARCH KEY=%d\n",Search_key->Key_type);
#endif //DEBUG_PHY
//msg("[MACPHY_FIND_REQ] SEARCH KEY=%d, NB_REQ_MAX=%d\n",Search_key->Key_type,NB_REQ_MAX);
switch(Search_key->Key_type) {
case PDU_TYPE_KEY:
for(i=0; i<NB_REQ_MAX; i++) {
if ( (Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Pdu_type==Search_key->Key.Pdu_type) &&
(Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1) ) {
//msg("[MACPHY_FIND] MACPHY_req_table_entry=%p,idx=%d,Phy_resources %p", &Macphy_req_table.Macphy_req_table_entry[i],i,Macphy_req_table.Macphy_req_table_entry[i].Macphy_data_req.Phy_Resources_Entry);
return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]);
}
}
break;
/*
case LCHAN_KEY:
for(i=0;i<NB_REQ_MAX;i++){
if ((Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Lchan_id.Index==Search_key->Key.Lchan_id->Index) &&
(Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1) )
return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]);
}
break;
case PHY_RESOURCES_KEY:
for(i=0;i<NB_REQ_MAX;i++){
if(Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1)
if ( ( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Time_alloc ==
Search_key->Key.Phy_resources.Time_alloc )
&&( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Freq_alloc ==
Search_key->Key.Phy_resources.Freq_alloc )
&&( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.CH_index ==
Search_key->CH_index )
&& ( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Direction == RX))
return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]);
}
break;
*/
}
}
#ifndef PHY_EMUL
// msg("[PHY][PHY_MAC] Frame %d : No data request\n",mac_xface->frame);
#endif //PHY_EMUL
return (MACPHY_DATA_REQ_TABLE_ENTRY*)0;
}
void print_active_requests(unsigned char Mod_id)
{
int i;
msg("_________________________INST %d , FRAME %d ACTIVE_REQUESTS_________________\n",Mod_id,mac_xface->frame);
for (i=0; i<NB_REQ_MAX; i++) {
if (Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1) {
msg("[MACPHY][DATA][REQ] Request %d: Direction %d, Pdu_type %d\n",
i,
Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Direction,
Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Pdu_type);
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Lchan_id.Index);
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources,
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Time_alloc,
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Freq_alloc);
//if(Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Pdu_type==RACH)
//msg("[RACH_REQ] Rach_pdu %p, Payload %p\n",Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Dir.Req_rx.Pdu.Rach_pdu,
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Dir.Req_rx.Pdu.Rach_pdu->Rach_payload);
}
}
}
/*___________________________________________________________________________________________________*/
#define RCNT Macphy_req_table[Mod_id].Macphy_req_cnt
MACPHY_DATA_REQ *new_macphy_data_req(unsigned char Mod_id)
{
/*___________________________________________________________________________________________________*/
unsigned char i;
for (i=0; i<NB_REQ_MAX; i++) {
if (Macphy_req_table[Mod_id].Macphy_req_table_entry[(i)%NB_REQ_MAX].Active == 0) {
Macphy_req_table[Mod_id].Macphy_req_table_entry[(i)%NB_REQ_MAX].Active = 1;
RCNT = (RCNT + 1)%NB_REQ_MAX;
// msg("[MAC_PHY]NEW MAC_REQUEST_CNT=%d,frame %d, Module %d, entry %d \n",Macphy_req_table[Mod_id].Macphy_req_cnt,mac_xface->frame,Mod_id,i);
// Macphy_req_table[Mod_id].Macphy_req_table_entry[i%NB_REQ_MAX].Macphy_data_req.Phy_resources=(PHY_RESOURCES*)malloc16(sizeof(PHY_RESOURCES));
return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i%NB_REQ_MAX].Macphy_data_req);
}
}
msg("[OPENAIR][MAC][ERROR] frame %d: No more DATA_REQ !!!!\n",mac_xface->frame);
print_active_requests(Mod_id);
mac_xface->macphy_exit("new_macphy_data_req: no more DATA_REQ");
//rt_sleep(nano2count(2000));
return((MACPHY_DATA_REQ*)0);
}
#endif //PHY_CONTEXT
#ifdef MAC_CONTEXT
#include "LAYER2/MAC/extern.h"
// Function called by PHY to indicate available data/measurements for MAC
/*___________________________________________________________________________________________________*/
void macphy_data_ind(unsigned char Mod_id,unsigned char Pdu_type,void *pdu,unsigned short rnti)
{
/*___________________________________________________________________________________________________*/
//msg("[OPENAIR][MACPHY] Calling mac_resp In\n");
int i;
// if (Req_rx->crc_status[0]!= -1) { //CRC_STATUS
// msg("[OPENAIR][MACPHY] Calling mac_indicate In\n");
// Req_rx->Meas.UL_meas=&UL_meas[Mod_id];
// Req_rx->Meas.DL_meas=&DL_meas[Mod_id];
switch (Pdu_type) {
case ULSCH:
// msg("[OPENAIR][MACPHY] Received RACH, Sending to MAC\n");
nodeb_decode_ulsch(Mod_id,(ULSCH_PDU *)pdu,rnti);
break;
case DLSCH:
#ifdef DEBUG_UE_DECODE_SACH
msg("[MAC][UE][MAC_PHY] TTI %d Inst %d\n",mac_xface->frame,Mod_id);
#endif
// ue_decode_dlsch(Mod_id-NB_CH_INST,
// (DLSCH_PDU *)pdu,rnti);
break;
default:
break;
}
// msg("Freeing Req %p\n",Macphy_data_req_table_entry);
// }
}
/*PHY_RESOURCES_TABLE_ENTRY *new_phy_resources() {
unsigned char i;
//msg("[OPENAIR][PHY][MAC Interface] New Phy Resource, cnt %d\n",Phy_resources_table.Phy_resources_cnt);
for (i=0;i<NB_PHY_RESOURCES_MAX;i++){
if (Phy_resources_table.Phy_resources_table_entry[(i+Phy_resources_table.Phy_resources_cnt+1)%NB_PHY_RESOURCES_MAX].Active == 0) {
Phy_resources_table.Phy_resources_table_entry[(i+Phy_resources_table.Phy_resources_cnt+1)%NB_PHY_RESOURCES_MAX].Active = 1;
Phy_resources_table.Phy_resources_cnt = (Phy_resources_table.Phy_resources_cnt + 1)%NB_PHY_RESOURCES_MAX;
// msg("[OPENAIR][PHY][MAC Interface] NEW PHY_RESOURCES: Taking index %d\n\n",(i+Phy_resources_table.Phy_resources_cnt+1)%NB_PHY_RESOURCES_MAX);
return(&Phy_resources_table.Phy_resources_table_entry[(i+Phy_resources_table.Phy_resources_cnt)%NB_PHY_RESOURCES_MAX]);
}
}
msg("[OPENAIR][MAC][ERROR] No more PHY_RESOURCES !!!!\n");
exit(-1);
}
*/
#endif //MAC_CONTEXT
// Measurements, etc ..
//short phy_resource_cnt = 0, macphy_data_req_cnt = 0, macphy_data_ind_cnt = 0;
@@ -0,0 +1,232 @@
/*
* 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
*/
/*________________________mac_phy_primitives.h________________________
Authors : Hicham Anouar, Raymond Knopp
Company : EURECOM
Emails : anouar@eurecom.fr, knopp@eurecom.fr
________________________________________________________________*/
#ifndef __MAC_PHY_PRIMITIVES_H__
# define __MAC_PHY_PRIMITIVES_H__
#include "../LAYER2/MAC/defs.h"
/**@defgroup _mac_phy_primitives_ MAC Layer Primitives for Communications with PHY
*@ingroup w3g4f_mac_layer_
*@{
This subclause describes the primitives for communications between the MAC and PHY sub-layers.
The primitives for dynamic MAC-PHY PDU exchange (Transport channel interface) are:
- MACPHY_DATA_REQ: transfers or requests a PDU from PHY. The data is passed along with the dynamic PHY transmission
format (coding and modulation, time/freq/space resource allocation)
- MACPHY_DATA_IND: Function call (by PHY) to deliver a new PDU and corresponding measurements to MAC. This implicitly confirms the MACPHY_DATA_REQ by
filling the fields of the request (TX or RX) with the data and measurements.
One primitive is used for semi-static configuration (during logical channel establishment)
relaying the puncturing/repetition patterns for HARQ:
- MACPHY_CONFIG_SACH_HARQ_REQ (still to be defined...)
The primitive for static (re)configuration is:
- MACPHY_CONFIG_REQ : This primitive transports the initial configuration during the setup phase of equipment, both for CH and UE.
Static configuration is used during the initialization phase of the equipment. For a CH, it is done prior to any communication. For a UE, some
structures may be set after receiving configuration information from the network via the BCCH/CCCH.
*/
/*! \brief MACPHY-DATA-REQ_RX structure is used to request transfer a new PDU from PHY corresponding to a particular transport channel*/
typedef struct {
int crc_status[MAX_NUMBER_TB_PER_LCHAN]; /*!< This field indicates the CRC status of the PDU upon reception from PHY*/
unsigned char num_tb; /*!< This field indicates the number of transport blocks to be received*/
unsigned short tb_size_bytes; /*!< This field indicates the number of bytes per transpor block*/
unsigned int Active_process_map; /*!< HARQ indicator for active processes*/
union {
CHBCH_PDU *Chbch_pdu; /*!< This is a pointer to CHBCH data*/
DL_SACH_PDU *DL_sach_pdu; /*!< This is a pointer to DL_SACH data*/
UL_SACH_PDU *UL_sach_pdu; /*!< This is a pointer to UL_SACH data*/
RACH_PDU *Rach_pdu; /*!< This is a pointer to RACH data*/
MRBCH_PDU *Mrbch_pdu; /*!< This is a pointer to MRBCH data*/
} Pdu;
union {
DL_MEAS *DL_meas; /*!< This is an array of pointers to the current measurements of DL quality at UE (indexed by CH_id) */
UL_MEAS *UL_meas; /*!< This is an array of pointers to the current measurements of UL quality at Node-B (indexed by user_id) */
} Meas;
} MACPHY_DATA_REQ_RX;
/*! \brief MACPHY-DATA-REQ_TX structure is used to transfer a new PDU to PHY corresponding to a particular transport channel*/
typedef struct {
unsigned char num_tb; /*!< This field indicates the number of transport blocks to be received*/
unsigned short tb_size_bytes; /*!< This field indicates the number of bytes per transpor block*/
unsigned int Active_process_map; /*!< HARQ indicator for active processes*/
unsigned int New_process_map; /*!< HARQ indicator for new processes*/
// unsigned char round_indices_tx;
union {
CHBCH_PDU *Chbch_pdu; /*!< pointer to CHBCH data */
DL_SACH_PDU DL_sach_pdu; /*!< pointer to DL_SACH data*/
UL_SACH_PDU UL_sach_pdu; /*!< pointer to UL_SACH data*/
RACH_PDU Rach_pdu; //H.A /*!< pointer to RACH data */
MRBCH_PDU *Mrbch_pdu; /*!< pointer to MRBCH data */
} Pdu;
} MACPHY_DATA_REQ_TX;
/*! \brief MACPHY-DATA-REQ primitive is used to transfer a new PDU to PHY corresponding to a particular transport channel*/
typedef struct {
unsigned char Direction;
unsigned char Pdu_type; /*!< This field indicates the type of PDU requested */
LCHAN_ID Lchan_id; /*!< This field indicates the flow id of the PDU */
PHY_RESOURCES *Phy_resources; /*!< This field indicates to PHY the physical resources */
unsigned int format_flag; /*!< This field indicates to PHY something about a SACH, e.g. presense of SACCH*/
union {
MACPHY_DATA_REQ_RX Req_rx; /*!< This field contains the request corresponding to an RX resource*/
MACPHY_DATA_REQ_TX Req_tx; /*!< This field contains the request corresponding to a TX resource*/
} Dir;
} MACPHY_DATA_REQ;
/*!\fn void macphy_data_ind(unsigned char Mod_id,MACPHY_DATA_REQ_RX *Req_rx,unsigned char Pdu_type,unsigned short Index);
\brief MACPHY_DATA_IND function call. Called by PHY to upload PDU and measurements in response to a MACPHY_DATA_REQ_RX.
@param Mod_id MAC instance ID (only useful if multiple MAC instances run in the same machine)
@param Req_rx Pointer to MACPHY_DTA_REQ_RX received previously
@param Pdu_type Type of PDU (redundant!)
@param Index CH Index for CH, UEid for UE
*/
void macphy_data_ind(unsigned char Mod_id,
MACPHY_DATA_REQ_RX *Req_rx,
unsigned char Pdu_type,
unsigned short Index);
/*! \brief MACPHY-CONFIG-REQ primitive is used to configure a new instance of OpenAirInterface (static configuration) during initialization*/
typedef struct {
PHY_FRAMING Phy_framing; /*!< Framing Configuration*/
PHY_CHSCH Phy_chsch[8]; /*!< CHSCH Static Configuration*/
PHY_CHBCH Phy_chbch; /*!< CHBCH Static Configuration*/
PHY_SCH Phy_sch[8]; /*!< SCH Static Configuration*/
PHY_SACH Phy_sach; /*!< SACH Statuc Configuration*/
} MACPHY_CONFIG_REQ;
/*! \brief MACPHY-CONFIG-SACH-HARQ-REQ primitive is used to configure a new SACH transport channel (dynamic configuration) during logical channel establishment*/
//typedef struct {
// LCHAN_ID Lchan_id; /*!< This is the identifier of the SACH, which should simply be the logical channel id*/
// HARQ_PARAMS Harq_params; /*!< This is the set of HARQ parameters corresponding to the QoS description of the logical channel*/
//} MACPHY_CONFIG_SACH_HARQ_REQ;
/** @} */
#define MAX_NUMBER_OF_MAC_INSTANCES 16
#define NULL_PDU 255
#define CHBCH 0
#define DL_SACH 1
#define UL_SACH 2
#define UL_SACCH_SACH 3
#define RACH 4
#define MRBCH 5
#define NUMBER_OF_SUBBANDS 64
#define LCHAN_KEY 0
#define PDU_TYPE_KEY 1
#define PHY_RESOURCES_KEY 2
typedef struct Macphy_req_entry_key {
unsigned char Key_type;
union {
LCHAN_ID *Lchan_id; //SACH, EMULATION
unsigned char Pdu_type;//CHBCH, RACH, EMULATION
PHY_RESOURCES Phy_resources;//REAL PHY
} Key;
} MACPHY_REQ_ENTRY_KEY;
/** @ingroup _PHY_TRANSPORT_CHANNEL_PROCEDURES_
* @{
\var typedef struct Macphy_data_req_table_entry {
MACPHY_DATA_REQ Macphy_data_req;
unsigned char Active;
} MACPHY_DATA_REQ_TABLE_ENTRY;
\brief An entry in the MACPHY_DATA_REQ Table.
*/
typedef struct Macphy_data_req_table_entry {
/// The MACPHY_DATA_REQ Structure itself
MACPHY_DATA_REQ Macphy_data_req;
/// Active flag. Active=1 means that the REQ is pending.
unsigned char Active;
} MACPHY_DATA_REQ_TABLE_ENTRY;
/*!\var typedef struct {
MACPHY_DATA_REQ_TABLE_ENTRY *Macphy_req_table_entry;
unsigned int Macphy_req_cnt;
} MACPHY_DATA_REQ_TABLE
\brief The MACPHY_DATA_REQ interface between MAC and PHY. This table stores the pending requests from MAC which are serviced by PHY. The pointer Macphy_req_table_entry points
to an array of idle reqests allocated during initialization of the MAC-layer.
*/
typedef struct {
/// Pointer to a MACPHY_DATA_REQ
MACPHY_DATA_REQ_TABLE_ENTRY *Macphy_req_table_entry;
/// Number of active requests
unsigned int Macphy_req_cnt;
} MACPHY_DATA_REQ_TABLE;
/** @} */
/*typedef struct Tx_Phy_Pdu{ //H.A
PHY_RESOURCES *Phy_resources;
MACPHY_DATA_IND *Macphy_data_ind;
}T_PHY_PDU;
typedef struct Rx_Phy_Pdu{ //H.A
PHY_RESOURCES *Phy_resources;
char *Phy_payload;
}RX_PHY_PDU;*/
typedef struct GRANTED_LCHAN_TABLE_ENTRY {
PHY_RESOURCES *Phy_resources;
LCHAN_ID Lchan_id;
} GRANTED_LCHAN_TABLE_ENTRY;
void clear_macphy_data_req(uint8_t);
//void clean_macphy_interface(void);
unsigned char phy_resources_compare(PHY_RESOURCES *,PHY_RESOURCES*);
MACPHY_DATA_REQ_TABLE_ENTRY* find_data_req_entry(uint8_t,MACPHY_REQ_ENTRY_KEY*);
void print_active_requests(uint8_t);
void mac_process_meas_ul(uint8_t Mod_id,UL_MEAS *UL_meas, uint16_t Index);
void mac_process_meas_dl(uint8_t Mod_id,DL_MEAS *DL_meas, uint16_t Index);
MACPHY_DATA_REQ *new_macphy_data_req(uint8_t);
//PHY_RESOURCES_TABLE_ENTRY *new_phy_resources(void);
//MACPHY_DATA_IND *new_macphy_data_ind(void);
#endif
+44
View File
@@ -0,0 +1,44 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __PHY_INTERFACE_VARS_H__
#define __PHY_INTERFACE_VARS_H__
//#include "SIMULATION/PHY_EMULATION/spec_defs.h"
#include "defs.h"
#ifdef PHY_EMUL
#include "SIMULATION/PHY_EMULATION/DEVICE_DRIVER/defs.h"
#include "SIMULATION/simulation_defs.h"
#endif
unsigned int mac_debug;
//MAC_xface *mac_xface;
//MACPHY_PARAMS MACPHY_params;
unsigned int mac_registered;
#endif
+287 -313
View File
@@ -57,7 +57,7 @@ mac_rrc_data_req(
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t* const buffer_pP,
uint8_t *const buffer_pP,
const uint8_t mbsfn_sync_area
)
//--------------------------------------------------------------------------
@@ -66,286 +66,262 @@ mac_rrc_data_req(
SRB_INFO *Srb_info;
uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
#ifdef DEBUG_RRC
int i;
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif
eNB_RRC_INST *rrc;
rrc_eNB_carrier_data_t *carrier;
BCCH_BCH_Message_t *mib;
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
if((Srb_id & RAB_OFFSET) == BCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
return 0;
}
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
if((Srb_id & RAB_OFFSET) == BCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
return 0;
}
// All even frames transmit SIB in SF 5
AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
// All even frames transmit SIB in SF 5
AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib1_size > sdu_size) {
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib23_size > sdu_size) {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
sib23_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
} else {
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
(void*)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1;
}
Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
}
return (Sdu_size);
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);
}
#if defined(Rel10) || defined(Rel14)
if((Srb_id & RAB_OFFSET) == MCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size;
if (sib1_size > sdu_size) {
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
#ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
// }
//else
//return(0);
if (sib23_size > sdu_size) {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
sib23_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
} else {
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
NULL,
(void *)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1;
}
Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
}
return (Sdu_size);
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);
}
#if defined(Rel10) || defined(Rel14)
if((Srb_id & RAB_OFFSET) == MCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
#ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
// }
//else
//return(0);
}
#endif //Rel10 || Rel14
#ifdef Rel14
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR) { // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
#endif
return(0);
}
@@ -358,7 +334,7 @@ mac_rrc_data_ind(
const sub_frame_t sub_frameP,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t* sduP,
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
)
@@ -367,54 +343,48 @@ mac_rrc_data_ind(
SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
(void)sdu_size;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_lenP > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = sdu_lenP;
}
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
if (sdu_lenP > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = sdu_lenP;
}
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
}
#else
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}
#endif
return(0);
}
//------------------------------------------------------------------------------
@@ -425,7 +395,7 @@ mac_eNB_get_rrc_status(
)
//------------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_idP],
rntiP);
@@ -438,60 +408,64 @@ mac_eNB_get_rrc_status(
}
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=1;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (rrc_agent_registered[Mod_instP]) {
agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
// rrc_mac_remove_ue(Mod_instP,rntiP);
// rrc_mac_remove_ue(Mod_instP,rntiP);
}
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=19999;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=19999;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1838 -2033
View File
File diff suppressed because it is too large Load Diff
+2357 -2868
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+519
View File
@@ -0,0 +1,519 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file l2_interface.c
* \brief layer 2 interface, used to support different RRC sublayer
* \author Raymond Knopp and Navid Nikaein
* \date 2010-2014
* \version 1.0
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
*/
#include "platform_types.h"
//#include "openair_defs.h"
//#include "openair_proto.h"
#include "defs.h"
#include "extern.h"
//#include "mac_lchan_interface.h"
//#include "openair_rrc_utils.h"
//#include "openair_rrc_main.h"
#include "UTIL/LOG/log.h"
#include "rrc_eNB_UE_context.h"
#include "pdcp.h"
#include "msc.h"
#include "common/ran_context.h"
#ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h"
extern EMULATION_VARS *Emul_vars;
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
#endif
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "flexran_agent_extern.h"
//#define RRC_DATA_REQ_DEBUG
//#define DEBUG_RRC 1
extern RAN_CONTEXT_t RC;
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_req(
const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t* const buffer_pP,
const uint8_t mbsfn_sync_area
)
//--------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
SRB_INFO *Srb_info;
uint8_t Sdu_size = 0;
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
#ifdef DEBUG_RRC
int i;
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif
eNB_RRC_INST *rrc;
rrc_eNB_carrier_data_t *carrier;
BCCH_BCH_Message_t *mib;
rrc = RC.rrc[Mod_idP];
carrier = &rrc->carrier[0];
mib = &carrier->mib;
if((Srb_id & RAB_OFFSET) == BCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) {
return 0;
}
// All even frames transmit SIB in SF 5
AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255,
"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib1_size > sdu_size) {
LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB1,
sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1) {
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib23_size > sdu_size) {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size);
sib23_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ);
RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE);
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].SIB23,
sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
#ifdef DEBUG_RRC
LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23);
} else {
return(0);
}
}
if( (Srb_id & RAB_OFFSET ) == MIBCH) {
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
(void*)mib,
carrier->MIB,
24);
LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded);
buffer_pP[0]=carrier->MIB[0];
buffer_pP[1]=carrier->MIB[1];
buffer_pP[2]=carrier->MIB[2];
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
return(3);
}
if( (Srb_id & RAB_OFFSET ) == CCCH) {
LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1;
}
Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0;
// check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer
LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload);
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0;
}
return (Sdu_size);
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);
}
#if defined(Rel10) || defined(Rel14)
if((Srb_id & RAB_OFFSET) == MCCH) {
if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) {
return 0; // this parameter is set in function init_mcch in rrc_eNB.c
}
#if 0 // defined(ENABLE_ITTI)
{
MessageDef *message_p;
int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ);
RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE);
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu,
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
mcch_size);
RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
#ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
for (i=0; i<RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) {
LOG_T(RRC,"%x.",buffer_pP[i]);
}
LOG_T(RRC,"\n");
#endif
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
// }
//else
//return(0);
}
#endif //Rel10 || Rel14
#ifdef Rel14
if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR);
}
if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3
memcpy(&buffer_pP[0],
RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR,
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR);
}
#endif
return(0);
}
//------------------------------------------------------------------------------
int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const rnti_t rntiP,
const rb_id_t srb_idP,
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
)
//--------------------------------------------------------------------------
{
SRB_INFO *Srb_info;
protocol_ctxt_t ctxt;
sdu_size_t sdu_size = 0;
/* for no gcc warnings */
(void)sdu_size;
/*
int si_window;
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_lenP > msg_sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
sdu_size = msg_sdu_size;
} else {
sdu_size = sdu_lenP;
}
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP);
itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p);
}
#else
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id);
}
#endif
return(0);
}
//------------------------------------------------------------------------------
int
mac_eNB_get_rrc_status(
const module_id_t Mod_idP,
const rnti_t rntiP
)
//------------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_idP],
rntiP);
if (ue_context_p != NULL) {
return(ue_context_p->ue_context.Status);
} else {
return RRC_INACTIVE;
}
}
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=1;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
if (rrc_agent_registered[Mod_instP]) {
agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP,
rntiP,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
// rrc_mac_remove_ue(Mod_instP,rntiP);
}
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP);
if(ue_context_p->ue_context.ul_failure_timer == 0)
ue_context_p->ue_context.ul_failure_timer=19999;
}
else {
LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP);
}
}
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP)
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[Mod_instP],
rntiP);
if (ue_context_p != NULL) {
LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n",
frameP, subframeP, rntiP);
ue_context_p->ue_context.ul_failure_timer = 0;
} else {
LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n",
frameP, subframeP, rntiP);
}
}
File diff suppressed because it is too large Load Diff
+274
View File
@@ -0,0 +1,274 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file asn1_msg.h
* \brief primitives to build the asn1 messages
* \author Raymond Knopp and Navid Nikaein
* \date 2011
* \version 1.0
* \company Eurecom
* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr
*/
#ifdef USER_MODE
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h> /* for atoi(3) */
#include <unistd.h> /* for getopt(3) */
#include <string.h> /* for strerror(3) */
#include <sysexits.h> /* for EX_* exit codes */
#include <errno.h> /* for errno */
#else
#include <linux/module.h> /* Needed by all modules */
#endif
#include <asn_application.h>
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
#include "RRC/NR/defs_NR.h"
/*
* The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
* output into the chosen string buffer.
* RETURN VALUES:
* 0: The structure is printed.
* -1: Problem printing the structure.
* WARNING: No sensible errno value is returned.
*/
int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
uint16_t get_adjacent_cell_id_NR(uint8_t Mod_id,uint8_t index);
uint8_t get_adjacent_cell_mod_id_NR(uint16_t phyCellId);
/**
\brief Generate configuration for SIB1 (eNB).
@param carrier pointer to Carrier information
@param N_RB_DL Number of downlink PRBs
@param phich_Resource PHICH resoure parameter
@param phich_duration PHICH duration parameter
@param frame radio frame number
@return size of encoded bit stream in bytes*/
uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
uint32_t frame,
uint32_t ssb_SubcarrierOffset,
uint32_t pdcch_ConfigSIB1,
uint32_t subCarrierSpacingCommon,
uint32_t dmrs_TypeA_Position);
/**
\brief Generate configuration for SIB1 (eNB).
@param carrier pointer to Carrier information
@param Mod_id Instance of eNB
@param Component carrier Component carrier to configure
@param configuration Pointer Configuration Request structure
@return size of encoded bit stream in bytes*/
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,int Mod_id,int CC_id, gNB_RrcConfigurationReq *configuration
);
/**
\brief Generate a default configuration for SIB2/SIB3 in one System Information PDU (eNB).
@param Mod_id Index of eNB (used to derive some parameters)
@param buffer Pointer to PER-encoded ASN.1 description of SI PDU
@param systemInformation Pointer to asn1c C representation of SI PDU
@param sib2 Pointer (returned) to sib2 component withing SI PDU
@param sib3 Pointer (returned) to sib3 component withing SI PDU
@param sib13 Pointer (returned) to sib13 component withing SI PDU
@param MBMS_flag Indicates presence of MBMS system information (when 1)
@return size of encoded bit stream in bytes*/
/*uint8_t do_SIB23(uint8_t Mod_id,
int CC_id
#if defined(ENABLE_ITTI)
, RrcConfigurationReq *configuration
#endif
);
/**
\brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This
routine only generates an mo-data establishment cause.
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@param rv 5 byte random string or S-TMSI
@returns Size of encoded bit stream in bytes*/
/*uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv);
/** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
/*uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t* buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength,
const char* dedicatedInfoNAS);
/** \brief Generate an RRCConnectionReconfigurationComplete UL-DCCH-Message (UE)
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
/*uint8_t
do_RRCConnectionReconfigurationComplete(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* buffer,
const uint8_t Transaction_id
);
/**
\brief Generate an RRCConnectionSetup DL-CCCH-Message (eNB). This routine configures SRB_ToAddMod (SRB1/SRB2) and
PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS.
@param ctxt_pP Running context
@param ue_context_pP UE context
@param CC_id Component Carrier ID
@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
@param transmission_mode Transmission mode for UE (1-9)
@param UE_id UE index for this message
@param Transaction_id Transaction_ID for this message
@param SRB_configList Pointer (returned) to SRB1_config/SRB2_config(later) IEs for this UE
@param physicalConfigDedicated Pointer (returned) to PhysicalConfigDedicated IE for this UE
@returns Size of encoded bit stream in bytes*/
/*uint8_t
do_RRCConnectionSetup(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
int CC_id,
uint8_t* const buffer,
const uint8_t transmission_mode,
const uint8_t Transaction_id,
SRB_ToAddModList_t** SRB_configList,
struct PhysicalConfigDedicated** physicalConfigDedicated
);
/**
\brief Generate an RRCConnectionReconfiguration DL-DCCH-Message (eNB). This routine configures SRBToAddMod (SRB2) and one DRBToAddMod
(DRB3). PhysicalConfigDedicated is not updated.
@param ctxt_pP Running context
@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
@param Transaction_id Transaction_ID for this message
@param SRB_list Pointer to SRB List to be added/modified (NULL if no additions/modifications)
@param DRB_list Pointer to DRB List to be added/modified (NULL if no additions/modifications)
@param DRB_list2 Pointer to DRB List to be released (NULL if none to be released)
@param sps_Config Pointer to sps_Config to be modified (NULL if no modifications, or default if initial configuration)
@param physicalConfigDedicated Pointer to PhysicalConfigDedicated to be modified (NULL if no modifications)
@param MeasObj_list Pointer to MeasObj List to be added/modified (NULL if no additions/modifications)
@param ReportConfig_list Pointer to ReportConfig List (NULL if no additions/modifications)
@param QuantityConfig Pointer to QuantityConfig to be modified (NULL if no modifications)
@param MeasId_list Pointer to MeasID List (NULL if no additions/modifications)
@param mobilityInfo mobility control information for handover
@param speedStatePars speed state parameteres for handover
@param mac_MainConfig Pointer to Mac_MainConfig(NULL if no modifications)
@param measGapConfig Pointer to MeasGapConfig (NULL if no modifications)
@param cba_rnti RNTI for the cba transmission
@returns Size of encoded bit stream in bytes*/
/*uint16_t
do_RRCConnectionReconfiguration(
const protocol_ctxt_t* const ctxt_pP,
uint8_t *buffer,
uint8_t Transaction_id,
SRB_ToAddModList_t *SRB_list,
DRB_ToAddModList_t *DRB_list,
DRB_ToReleaseList_t *DRB_list2,
struct SPS_Config *sps_Config,
struct PhysicalConfigDedicated *physicalConfigDedicated,
MeasObjectToAddModList_t *MeasObj_list,
ReportConfigToAddModList_t *ReportConfig_list,
QuantityConfig_t *quantityConfig,
MeasIdToAddModList_t *MeasId_list,
MAC_MainConfig_t *mac_MainConfig,
MeasGapConfig_t *measGapConfig,
MobilityControlInfo_t *mobilityInfo,
struct MeasConfig__speedStatePars *speedStatePars,
RSRP_Range_t *rsrp,
C_RNTI_t *cba_rnti,
struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList
#if defined(Rel10) || defined(Rel14)
, SCellToAddMod_r10_t *SCell_config
#endif
);
/**
\brief Generate an RRCConnectionReestablishmentReject DL-CCCH-Message (eNB).
@param Mod_id Module ID of eNB
@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
/*uint8_t
do_RRCConnectionReestablishmentReject(
uint8_t Mod_id,
uint8_t* const buffer);
/**
\brief Generate an RRCConnectionReject DL-CCCH-Message (eNB).
@param Mod_id Module ID of eNB
@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU
@returns Size of encoded bit stream in bytes*/
/*uint8_t
do_RRCConnectionReject(
uint8_t Mod_id,
uint8_t* const buffer);
/**
\brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This
routine only generates an mo-data establishment cause.
@param Mod_id Module ID of eNB
@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU
@param transaction_id Transaction index
@returns Size of encoded bit stream in bytes*/
/*uint8_t do_RRCConnectionRelease(uint8_t Mod_id, uint8_t *buffer,int Transaction_id);
/***
* \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data)
* @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU
* @returns Size of encoded bit stream in bytes
*/
/*uint8_t do_MCCHMessage(uint8_t *buffer);
#if defined(Rel10) || defined(Rel14)
/***
* \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data)
* @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU
* @returns Size of encoded bit stream in bytes
*/
/*uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
uint8_t sync_area,
uint8_t *buffer,
MCCH_Message_t *mcch_message,
MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration);
#endif
uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t);
uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer);
uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer);
OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer);
uint8_t
do_UECapabilityEnquiry(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* const buffer,
const uint8_t Transaction_id
);
uint8_t do_SecurityModeCommand(
const protocol_ctxt_t* const ctxt_pP,
uint8_t* const buffer,
const uint8_t Transaction_id,
const uint8_t cipheringAlgorithm,
const uint8_t integrityProtAlgorithm);
@@ -0,0 +1,282 @@
NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
-- TAG-HANDOVER-COMMAND-START
HandoverCommand ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverCommand HandoverCommand-IEs,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverCommand-IEs ::= SEQUENCE {
handoverCommandMessage OCTET STRING (CONTAINING RRCReconfiguration),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
-- TAG-HANDOVER-COMMAND-STOP
-- TAG-HANDOVER-PREPARATION-INFORMATION-START
HandoverPreparationInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverPreparationInformation HandoverPreparationInformation-IEs,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverPreparationInformation-IEs ::= SEQUENCE {
ue-CapabilityRAT-List UE-CapabilityRAT-ContainerList,
sourceConfig OCTET STRING (CONTAINING RRCReconfiguration),
rrm-Config RRM-Config OPTIONAL,
as-Context AS-Context OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
AS-Context ::= SEQUENCE {
reestablishmentInfo SEQUENCE {
sourcePhysCellId PhysCellId,
targetCellShortMAC-I ShortMAC-I,
additionalReestabInfoList ReestabNCellInfoList OPTIONAL
} OPTIONAL,
-- FFS Whether to change e.g. move all re-establishment info to Xx
configRestrictInfo ConfigRestrictInfoSCG OPTIONAL,
...
}
ReestabNCellInfoList ::= SEQUENCE ( SIZE (1..maxCellPrep) ) OF ReestabNCellInfo
ReestabNCellInfo::= SEQUENCE{
cellIdentity CellIdentity,
key-gNodeB-Star BIT STRING (SIZE (256)),
shortMAC-I ShortMAC-I
}
RRM-Config ::= SEQUENCE {
ue-InactiveTime ENUMERATED {
s1, s2, s3, s5, s7, s10, s15, s20,
s25, s30, s40, s50, min1, min1s20c, min1s40,
min2, min2s30, min3, min3s30, min4, min5, min6,
min7, min8, min9, min10, min12, min14, min17, min20,
min24, min28, min33, min38, min44, min50, hr1,
hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
day2hr12, day3, day4, day5, day7, day10, day14, day19,
day24, day30, dayMoreThan30} OPTIONAL ,
candidateCellInfoList CandidateCellInfoList OPTIONAL,
...
}
-- TAG-HANDOVER-PREPARATION-INFORMATION-STOP
-- TAG-CG-CONFIG-START
CG-Config ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
cg-Config CG-Config-IEs,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
CG-Config-IEs ::= SEQUENCE {
scg-CellGroupConfig OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL,
scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL,
configRestrictModReq ConfigRestrictModReqSCG OPTIONAL,
drx-InfoSCG DRX-Info OPTIONAL,
candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL,
measConfigSN MeasConfigSN OPTIONAL,
selectedBandCombinationNR BandCombinationIndex OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
MeasConfigSN ::= SEQUENCE {
measuredFrequenciesFR1 SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL,
...
}
NR-FreqInfo ::= SEQUENCE {
measuredFrequency ARFCN-ValueNR OPTIONAL,
...
}
ConfigRestrictModReqSCG ::= SEQUENCE {
requestedBC-MRDC BandCombinationIndex OPTIONAL,
requestedBPC-ListMRDC BPC-IndexList OPTIONAL,
requestedP-MaxFR1 P-Max OPTIONAL,
...
}
BandCombinationIndex ::= INTEGER (1..maxBandComb)
-- TAG-CG-CONFIG-STOP
-- TAG-CG-CONFIG-INFO-START
CG-ConfigInfo ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
cg-ConfigInfo CG-ConfigInfo-IEs,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
CG-ConfigInfo-IEs ::= SEQUENCE {
ue-CapabilityInfo OCTET STRING (CONTAINING UE-CapabilityRAT-ContainerList) OPTIONAL,-- Cond SN-Addition
candidateCellInfoListMN CandidateCellInfoList OPTIONAL,
candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL,
measResultCellListSFTD MeasResultCellListSFTD OPTIONAL,
scgFailureInfo SEQUENCE {
failureType ENUMERATED { t310-Expiry, randomAccessProblem,
rlc-MaxNumRetx, scg-ChangeFailure,
scg-reconfigFailure,
srb3-IntegrityFailure},
measResultSCG OCTET STRING (CONTAINING MeasResultSCG-Failure)
} OPTIONAL,
configRestrictInfo ConfigRestrictInfoSCG OPTIONAL,
drx-InfoMCG DRX-Info OPTIONAL,
measConfigMN MeasConfigMN OPTIONAL,
sourceConfigSCG OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL,
scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL,
mcg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
ConfigRestrictInfoSCG ::= SEQUENCE {
allowedBC-ListMRDC BandCombinationIndexList OPTIONAL,
allowedBPC-ListMRDC BPC-IndexList OPTIONAL,
powerCoordination-FR1 SEQUENCE {
p-maxNR P-Max OPTIONAL,
p-maxEUTRA P-Max OPTIONAL
} OPTIONAL,
servCellIndexRangeSCG SEQUENCE {
lowBound ServCellIndex,
upBound ServCellIndex
} OPTIONAL, -- Cond SN-Addition
maxMeasFreqsSCG-NR INTEGER(1..maxMeasFreqsMN) OPTIONAL,
...
}
BandCombinationIndexList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationIndex
BPC-IndexList ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BPC-Index
BPC-Index ::= INTEGER (1..maxBasebandProcComb)
DRX-Info ::= SEQUENCE {
drx-LongCycleStartOffset CHOICE {
ms10 INTEGER(0..9),
ms20 INTEGER(0..19),
ms32 INTEGER(0..31),
ms40 INTEGER(0..39),
ms60 INTEGER(0..59),
ms64 INTEGER(0..63),
ms70 INTEGER(0..69),
ms80 INTEGER(0..79),
ms128 INTEGER(0..127),
ms160 INTEGER(0..159),
ms256 INTEGER(0..255),
ms320 INTEGER(0..319),
ms512 INTEGER(0..511),
ms640 INTEGER(0..639),
ms1024 INTEGER(0..1023),
ms1280 INTEGER(0..1279),
ms2048 INTEGER(0..2047),
ms2560 INTEGER(0..2559),
ms5120 INTEGER(0..5119),
ms10240 INTEGER(0..10239)
},
shortDRX SEQUENCE {
drx-ShortCycle ENUMERATED {
ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32,
ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9,
spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 },
drx-ShortCycleTimer INTEGER (1..16)
} OPTIONAL
}
MeasConfigMN ::= SEQUENCE {
measuredFrequenciesMN SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL,
measGapConfigFR1 GapConfig OPTIONAL,
gapPurpose ENUMERATED {perUE, perFR1} OPTIONAL,
...
}
-- TAG-CG-CONFIG-INFO-STOP
-- TAG-MEASUREMENT-TIMING-CONFIGURATION-START
MeasurementTimingConfiguration ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
measTimingConf MeasurementTimingConfiguration-IEs,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
MeasurementTimingConfiguration-IEs ::= SEQUENCE {
measTiming MeasTimingList OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
MeasTimingList ::= SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF MeasTiming
MeasTiming ::= SEQUENCE {
carrierFreq ARFCN-ValueNR OPTIONAL,
ssb-MeasurementTimingConfiguration ENUMERATED {ffsTypeAndValue} OPTIONAL,
...
}
-- TAG-MEASUREMENT-TIMING-CONFIGURATION-STOP
-- TAG-CANDIDATE-CELL-INFO-LIST-START
CandidateCellInfoList ::= SEQUENCE (SIZE (1.. maxNrofSCells)) OF CandidateCellInfo
CandidateCellInfo ::= SEQUENCE {
cellIdentification SEQUENCE {
physCellId PhysCellId,
dl-CarrierFreq ARFCN-ValueNR
},
measResultCell MeasQuantityResults OPTIONAL,
candidateRS-IndexListSSB CandidateRS-IndexInfoListSSB OPTIONAL,
candidateRS-IndexListCSI-RS CandidateRS-IndexInfoListCSI-RS OPTIONAL,
...
}
CandidateRS-IndexInfoListSSB ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoSSB
CandidateRS-IndexInfoSSB ::= SEQUENCE {
ssb-Index SSB-Index,
measResultSSB MeasQuantityResults OPTIONAL,
...
}
CandidateRS-IndexInfoListCSI-RS ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoCSI-RS
CandidateRS-IndexInfoCSI-RS ::= SEQUENCE {
csi-RS-Index CSI-RS-Index,
measResultCSI-RS MeasQuantityResults OPTIONAL,
...
}
-- TAG-CANDIDATE-CELL-INFO-LIST-STOP
-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-START
maxMeasFreqsMN INTEGER ::= 32 -- Maximum number of MN-configured measurement frequencies
maxCellPrep INTEGER ::= 32 -- Maximum number of cells prepared for handover
-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-STOP
-- TAG_NR-INTER-NODE-DEFINITIONS-END-START
END
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,46 @@
NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
-- TAG-VAR-MEAS-CONFIG-START
VarMeasConfig ::= SEQUENCE {
-- Measurement identities
measIdList MeasIdToAddModList OPTIONAL,
-- Measurement objects
measObjectList MeasObjectToAddModList OPTIONAL,
-- Reporting configurations
reportConfigList ReportConfigToAddModList OPTIONAL,
-- Other parameters
quantityConfig QuantityConfig OPTIONAL,
s-MeasureConfig CHOICE {
ssb-RSRP RSRP-Range,
csi-RSRP RSRP-Range
} OPTIONAL
}
-- TAG-VAR-MEAS-CONFIG-STOP
-- TAG-VAR-MEAS-REPORT-START
VarMeasReportList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF VarMeasReport
VarMeasReport ::= SEQUENCE {
-- List of measurement that have been triggered
measId MeasId,
cellsTriggeredList CellsTriggeredList OPTIONAL,
numberOfReportsSent INTEGER
}
CellsTriggeredList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CHOICE {
physCellId PhysCellId,
-- Not needed for EN-DC.
physCellIdEUTRA ENUMERATED {ffsTypeAndValue}
}
-- TAG-VAR-MEAS-REPORT-STOP
END
@@ -0,0 +1,82 @@
#!/usr/bin/perl
# This script extracts the ASN1 definition from and TS 38.331 and generates 3 output files that can be processed by asn2wrs
# First download the specification from 3gpp.org as a word document and open it
# Then in "view" menu, select normal or web layout (needed to removed page header and footers)
# Finally save the document as a text file
# Call the script: "perl extract_asn1_from_spec.pl 38331-xxx.txt"
# It should generate: NR-RRC-Definitions.asn, NR-UE-Variables.asn and NR-InterNodeDefinitions
use warnings;
$input_file = $ARGV[0];
$NR_def_output_file = "NR-RRC-Definitions.asn";
$NR_var_output_file = "NR-UE-Variables.asn";
$NR_internode_output_file = "NR-InterNodeDefinitions.asn";
sub extract_asn1;
open(INPUT_FILE, "< $input_file") or die "Can not open file $input_file";
while (<INPUT_FILE>) {
# Process the NR-RRC-Definitions section
if( m/NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=/){
open(OUTPUT_FILE, "> $NR_def_output_file") or die "Can not open file $def_output_file";
syswrite OUTPUT_FILE,"$_ \n";
syswrite OUTPUT_FILE,"BEGIN\n\n";
# Get all the text delimited by -- ASN1START and -- ASN1STOP
extract_asn1();
syswrite OUTPUT_FILE,"END\n\n";
close(OUTPUT_FILE);
}
# Process the NR-UE-Variables section
if( m/NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=/){
open(OUTPUT_FILE, "> $NR_var_output_file") or die "Can not open file $def_output_file";
syswrite OUTPUT_FILE,"$_ \n";
syswrite OUTPUT_FILE,"BEGIN\n\n";
# Get all the text delimited by -- ASN1START and -- ASN1STOP
extract_asn1();
syswrite OUTPUT_FILE,"END\n\n";
close(OUTPUT_FILE);
}
# Process the NR-InterNodeDefinitions section
if( m/NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=/){
open(OUTPUT_FILE, "> $NR_internode_output_file") or die "Can not open file $def_output_file";
syswrite OUTPUT_FILE,"$_ \n";
syswrite OUTPUT_FILE,"BEGIN\n\n";
# Get all the text delimited by -- ASN1START and -- ASN1STOP
extract_asn1();
syswrite OUTPUT_FILE,"END\n\n";
close(OUTPUT_FILE);
}
}
close(INPUT_FILE);
# This subroutine copies the text delimited by -- ASN1START and -- ASN1STOP in INPUT_FILE
# and copies it into OUTPUT_FILE.
# It stops when it meets the keyword "END"
sub extract_asn1 {
my $line = <INPUT_FILE>;
my $is_asn1 = 0;
while(($line ne "END\n") && ($line ne "END\r\n")){
if ($line =~ m/-- ASN1STOP/) {
$is_asn1 = 0;
}
if ($is_asn1 == 1){
syswrite OUTPUT_FILE,"$line";
}
if ($line =~ m/-- ASN1START/) {
$is_asn1 = 1;
}
$line = <INPUT_FILE>;
}
}
+573
View File
@@ -0,0 +1,573 @@
/* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file RRC/LITE/defs_NR.h
* \brief NR RRC struct definitions and function prototypes
* \author Navid Nikaein, Raymond Knopp
* \date 2010 - 2014, 2018
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
*/
#ifndef __OPENAIR_RRC_DEFS_NR_H__
#define __OPENAIR_RRC_DEFS_NR_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "collection/tree.h"
#include "rrc_types_NR.h"
#include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h"
//#include "COMMON/mac_rrc_primitives.h"
#if defined(NR_Rel15)
#include "NR_SIB1.h"
//#include "SystemInformation.h"
//#include "RRCConnectionReconfiguration.h"
#include "NR_RRCReconfigurationComplete.h"
#include "NR_RRCReconfiguration.h"
//#include "RRCConnectionReconfigurationComplete.h"
//#include "RRCConnectionSetup.h"
//#include "RRCConnectionSetupComplete.h"
//#include "RRCConnectionRequest.h"
//#include "RRCConnectionReestablishmentRequest.h"
//#include "BCCH-DL-SCH-Message.h"
#include "NR_BCCH-BCH-Message.h"
//#include "MCCH-Message.h"
//#include "MBSFNAreaConfiguration-r9.h"
//#include "SCellToAddMod-r10.h"
//#include "AS-Config.h"
//#include "AS-Context.h"
#include "NR_UE-NR-Capability.h"
#include "NR_MeasResults.h"
#include "NR_ServingCellConfigCommon.h"
#endif
//-------------------
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
/* TODO: be sure this include is correct.
* It solves a problem of compilation of the RRH GW,
* issue #186.
*/
#if !defined(ENABLE_ITTI)
# include "as_message.h"
#endif
#if defined(ENABLE_USE_MME)
# include "commonDef.h"
#endif
#if ENABLE_RAL
# include "collection/hashtable/obj_hashtable.h"
#endif
/*I will change the name of the structure for compile purposes--> hope not to undo this process*/
typedef unsigned int uid_NR_t;
#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR (((NUMBER_OF_NR_UE_MAX/8)/sizeof(unsigned int)) + 1)
typedef struct uid_linear_allocator_NR_s {
unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR];
} uid_allocator_NR_t;
#define PROTOCOL_NRRRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT
#define PROTOCOL_NRRRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
#define PROTOCOL_NRRRC_CTXT_FMT PROTOCOL_CTXT_FMT
#define PROTOCOL_NRRRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp)
#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
#define UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
typedef enum {
NR_RRC_OK=0,
NR_RRC_ConnSetup_failed,
NR_RRC_PHY_RESYNCH,
NR_RRC_Handover_failed,
NR_RRC_HO_STARTED
} NR_RRC_status_t;
typedef enum UE_STATE_NR_e {
NR_RRC_INACTIVE=0,
NR_RRC_IDLE,
NR_RRC_SI_RECEIVED,
NR_RRC_CONNECTED,
NR_RRC_RECONFIGURED,
NR_RRC_HO_EXECUTION
} NR_UE_STATE_t;
typedef enum HO_STATE_NR_e {
NR_HO_IDLE=0,
NR_HO_MEASURMENT,
NR_HO_PREPARE,
NR_HO_CMD, // initiated by the src eNB
NR_HO_COMPLETE // initiated by the target eNB
} NR_HO_STATE_t;
//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG
#define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; }
#define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n )
#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n)
#define RRM_CALLOC2(t,s) (t *) malloc16( s )
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 255
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20
/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */
#define RRC_TRANSACTION_IDENTIFIER_NUMBER 3
typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/
uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
} __attribute__ ((__packed__)) LCHAN_DESC_NR;
typedef struct UE_RRC_INFO_NR_s {
NR_UE_STATE_t State;
uint8_t SIB1systemInfoValueTag;
uint32_t SIStatus;
uint32_t SIcnt;
#if defined(Rel10) || defined(Rel14)
uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA
#endif
uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40
uint8_t handoverTarget;
//HO_STATE_t ho_state;
uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120
unsigned short UE_index;
uint32_t T300_active;
uint32_t T300_cnt;
uint32_t T304_active;
uint32_t T304_cnt;
uint32_t T310_active;
uint32_t T310_cnt;
uint32_t N310_cnt;
uint32_t N311_cnt;
rnti_t rnti;
} __attribute__ ((__packed__)) UE_RRC_INFO_NR;
typedef struct UE_S_TMSI_NR_s {
boolean_t presence;
mme_code_t mme_code;
m_tmsi_t m_tmsi;
} __attribute__ ((__packed__)) UE_S_TMSI_NR;
typedef enum e_rab_satus_NR_e {
E_RAB_STATUS_NEW_NR,
E_RAB_STATUS_DONE_NR, // from the eNB perspective
E_RAB_STATUS_ESTABLISHED_NR, // get the reconfigurationcomplete form UE
E_RAB_STATUS_FAILED_NR,
} e_rab_status_NR_t;
typedef struct e_rab_param_NR_s {
e_rab_t param;
uint8_t status;
uint8_t xid; // transaction_id
} __attribute__ ((__packed__)) e_rab_param_NR_t;
typedef struct HANDOVER_INFO_NR_s {
uint8_t ho_prepare;
uint8_t ho_complete;
uint8_t modid_s; //module_idP of serving cell
uint8_t modid_t; //module_idP of target cell
uint8_t ueid_s; //UE index in serving cell
uint8_t ueid_t; //UE index in target cell
// NR not define at this moment
//AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */
//AS_Context_t as_context; /* They are mandatory for HO */
uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */
int size; /* size of above message in bytes */
} HANDOVER_INFO_NR;
#define RRC_HEADER_SIZE_MAX 64
#define RRC_BUFFER_SIZE_MAX 1024
typedef struct {
char Payload[RRC_BUFFER_SIZE_MAX];
char Header[RRC_HEADER_SIZE_MAX];
char payload_size;
} RRC_BUFFER_NR;
#define RRC_BUFFER_SIZE_NR sizeof(RRC_BUFFER_NR)
typedef struct RB_INFO_NR_s {
uint16_t Rb_id; //=Lchan_id
LCHAN_DESC Lchan_desc[2];
//MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
} RB_INFO_NR;
typedef struct SRB_INFO_NR_s {
uint16_t Srb_id; //=Lchan_id
RRC_BUFFER Rx_buffer;
RRC_BUFFER Tx_buffer;
LCHAN_DESC Lchan_desc[2];
unsigned int Trans_id;
uint8_t Active;
} SRB_INFO_NR;
typedef struct RB_INFO_TABLE_ENTRY_NR_s {
RB_INFO_NR Rb_info;
uint8_t Active;
uint32_t Next_check_frame;
uint8_t Status;
} RB_INFO_TABLE_ENTRY_NR;
typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
SRB_INFO_NR Srb_info;
uint8_t Active;
uint8_t Status;
uint32_t Next_check_frame;
} SRB_INFO_TABLE_ENTRY_NR;
typedef struct MEAS_REPORT_LIST_NR_s {
MeasId_t measId;
//CellsTriggeredList cellsTriggeredList;//OPTIONAL
uint32_t numberOfReportsSent;
} MEAS_REPORT_LIST_NR;
typedef struct HANDOVER_INFO_UE_NR_s {
PhysCellId_t targetCellId;
uint8_t measFlag;
} HANDOVER_INFO_UE_NR;
//NB-IoT eNB_RRC_UE_NB_IoT_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------
typedef struct gNB_RRC_UE_s {
uint8_t primaryCC_id;
//SCellToAddMod_t sCell_config[2];
SRB_ToAddModList_t* SRB_configList;//for SRB1 and SRB1bis
SRB_ToAddModList_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
DRB_ToAddModList_t* DRB_configList; //for all the DRBs
DRB_ToAddModList_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid
uint8_t DRB_active[8];//in LTE was 8
// NR not define at this moment
//struct PhysicalConfigDedicated* physicalConfigDedicated_NR;
struct SPS_Config* sps_Config;
MeasObjectToAddMod_t* MeasObj[MAX_MEAS_OBJ];
struct ReportConfigToAddMod* ReportConfig[MAX_MEAS_CONFIG];
struct QuantityConfig* QuantityConfig;
struct MeasIdToAddMod* MeasId[MAX_MEAS_ID];
// NR not define at this moment
//MAC_MainConfig_t* mac_MainConfig_NR;
MeasGapConfig_t* measGapConfig;
SRB_INFO_NR SI;
SRB_INFO_NR Srb0;
SRB_INFO_TABLE_ENTRY_NR Srb1;
SRB_INFO_TABLE_ENTRY_NR Srb2;
MeasConfig_t* measConfig;
HANDOVER_INFO_NR* handover_info;
#if defined(ENABLE_SECURITY)
/* KeNB as derived from KASME received from EPC */
uint8_t kenb[32];
#endif
/* Used integrity/ciphering algorithms */
//Specs. TS 38.331 V15.1.0 pag 432 Change position of chipering enumerative w.r.t previous version
e_NR_CipheringAlgorithm ciphering_algorithm;
e_NR_IntegrityProtAlgorithm integrity_algorithm;
uint8_t Status;
rnti_t rnti;
uint64_t random_ue_identity;
/* Information from UE RRC ConnectionRequest */
UE_S_TMSI_NR Initialue_identity_s_TMSI;
/* NR not define at this moment
EstablishmentCause_t establishment_cause_NR; //different set for NB-IoT
*/
/* NR not define at this moment*/
/* Information from UE RRC ConnectionReestablishmentRequest */
//ReestablishmentCause_t reestablishment_cause_NR; //different set for NB_IoT
/* UE id for initial connection to S1AP */
uint16_t ue_initial_id;
/* Information from S1AP initial_context_setup_req */
uint32_t eNB_ue_s1ap_id :24;
security_capabilities_t security_capabilities;
/* Total number of e_rab already setup in the list */ //NAS list?
uint8_t setup_e_rabs;
/* Number of e_rab to be setup in the list */ //NAS list?
uint8_t nb_of_e_rabs;
/* list of e_rab to be setup by RRC layers */
e_rab_param_NR_t e_rab[NB_RB_MAX_NB_IOT];//[S1AP_MAX_E_RAB];
// LG: For GTPV1 TUNNELS
uint32_t enb_gtp_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
//Which timers are referring to?
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
//threshold of the release timer--> set in RRCConnectionRelease
uint32_t ue_release_timer_thres;
} gNB_RRC_UE_t;
//--------------------------------------------------------------------------------
typedef uid_NR_t ue_uid_t;
//generally variable called: ue_context_pP
typedef struct rrc_gNB_ue_context_s {
/* Tree related data */
RB_ENTRY(rrc_gNB_ue_context_s) entries;
/* Uniquely identifies the UE between MME and eNB within the eNB.
* This id is encoded on 24bits.
*/
rnti_t ue_id_rnti;
// another key for protocol layers but should not be used as a key for RB tree
ue_uid_t local_uid;
/* UE id for initial connection to S1AP */
struct gNB_RRC_UE_s ue_context; //context of ue in the e-nB
} rrc_gNB_ue_context_t;
//called "carrier"--> data from PHY layer
typedef struct {
// buffer that contains the encoded messages
uint8_t *MIB;
uint8_t sizeof_MIB;
uint8_t *SIB1;
uint8_t sizeof_SIB1;
//implicit parameters needed
int Ncp; //cyclic prefix for DL
int Ncp_UL; //cyclic prefix for UL
int p_gNB; //number of tx antenna port
int p_rx_gNB; //number of receiving antenna ports
uint32_t dl_CarrierFreq; //detected by the UE
uint32_t ul_CarrierFreq; //detected by the UE
uint16_t physCellId;
//are the only static one (memory has been already allocated)
BCCH_BCH_Message_t mib;
NR_SIB1_t *sib1;
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
SRB_INFO_NR SI;
SRB_INFO_NR Srb0;
} rrc_gNB_carrier_data_t;
//---------------------------------------------------
//---NR---(completely change)---------------------
typedef struct gNB_RRC_INST_s {
eth_params_t eth_params_s;
rrc_gNB_carrier_data_t carrier[MAX_NUM_CCs];
uid_allocator_NR_t uid_allocator; // for rrc_ue_head
RB_HEAD(rrc_ue_tree_NR_s, rrc_gNB_ue_context_s) rrc_ue_head; // ue_context tree key search by rnti
uint8_t HO_flag;
uint8_t Nb_ue;
hash_table_t *initial_id2_s1ap_ids; // key is content is rrc_ue_s1ap_ids_t
hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t
//RRC configuration
#if defined(ENABLE_ITTI)
gNB_RrcConfigurationReq configuration;//rrc_messages_types.h
#endif
// other PLMN parameters
/// Mobile country code
int mcc;
/// Mobile network code
int mnc;
/// number of mnc digits
int mnc_digit_length;
// other RAN parameters
int srb1_timer_poll_retransmit;
int srb1_poll_pdu;
int srb1_poll_byte;
int srb1_max_retx_threshold;
int srb1_timer_reordering;
int srb1_timer_status_prohibit;
int srs_enable[MAX_NUM_CCs];
} gNB_RRC_INST;
//#define RRC_HEADER_SIZE_MAX_NR 64
#define MAX_UE_CAPABILITY_SIZE_NR 255
//not needed for the moment
typedef struct OAI_UECapability_NR_s {
uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NR];
uint8_t sdu_size;
////NR------
NR_UE_NR_Capability_t UE_Capability_NR; //replace the UE_EUTRA_Capability of LTE
} OAI_UECapability_NR_t;
typedef struct UE_RRC_INST_NR_s {
Rrc_State_NR_t RrcState;
Rrc_Sub_State_NR_t RrcSubState;
# if defined(ENABLE_USE_MME)
plmn_t plmnID;
Byte_t rat;
as_nas_info_t initialNasMsg;
# endif
OAI_UECapability_NR_t *UECap;
uint8_t *UECapability;
uint8_t UECapability_size;
UE_RRC_INFO_NR Info[NB_SIG_CNX_UE];
SRB_INFO_NR Srb0[NB_SIG_CNX_UE];
SRB_INFO_TABLE_ENTRY_NR Srb1[NB_CNX_UE];
SRB_INFO_TABLE_ENTRY_NR Srb2[NB_CNX_UE];
HANDOVER_INFO_UE_NR HandoverInfoUe;
/*
uint8_t *SIB1[NB_CNX_UE];
uint8_t sizeof_SIB1[NB_CNX_UE];
uint8_t *SI[NB_CNX_UE];
uint8_t sizeof_SI[NB_CNX_UE];
uint8_t SIB1Status[NB_CNX_UE];
uint8_t SIStatus[NB_CNX_UE];
SIB1_t *sib1[NB_CNX_UE];
SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI().
SystemInformationBlockType2_t *sib2[NB_CNX_UE];
SystemInformationBlockType3_t *sib3[NB_CNX_UE];
SystemInformationBlockType4_t *sib4[NB_CNX_UE];
SystemInformationBlockType5_t *sib5[NB_CNX_UE];
SystemInformationBlockType6_t *sib6[NB_CNX_UE];
SystemInformationBlockType7_t *sib7[NB_CNX_UE];
SystemInformationBlockType8_t *sib8[NB_CNX_UE];
SystemInformationBlockType9_t *sib9[NB_CNX_UE];
SystemInformationBlockType10_t *sib10[NB_CNX_UE];
SystemInformationBlockType11_t *sib11[NB_CNX_UE];
#if defined(Rel10) || defined(Rel14)
uint8_t MBMS_flag;
uint8_t *MCCH_MESSAGE[NB_CNX_UE];
uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE];
uint8_t MCCH_MESSAGEStatus[NB_CNX_UE];
MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE];
SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE];
SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE];
#endif
#ifdef CBA
uint8_t num_active_cba_groups;
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
#endif
uint8_t num_srb;
struct SRB_ToAddMod *SRB1_config[NB_CNX_UE];
struct SRB_ToAddMod *SRB2_config[NB_CNX_UE];
struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB
MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
*/
struct QuantityConfig *QuantityConfig[NB_CNX_UE];
/*
struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID];
MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID];
uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells
RSRP_Range_t s_measure;
struct MeasConfig__speedStatePars *speedStatePars;
struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE];
struct SPS_Config *sps_Config[NB_CNX_UE];
MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE];
MeasGapConfig_t *measGapConfig[NB_CNX_UE];
double filter_coeff_rsrp; // [7] ???
double filter_coeff_rsrq; // [7] ???
float rsrp_db[7];
float rsrq_db[7];
float rsrp_db_filtered[7];
float rsrq_db_filtered[7];
#if ENABLE_RAL
obj_hash_table_t *ral_meas_thresholds;
ral_transaction_id_t scan_transaction_id;
#endif
#if defined(ENABLE_SECURITY)
// KeNB as computed from parameters within USIM card //
uint8_t kenb[32];
#endif
// Used integrity/ciphering algorithms //
CipheringAlgorithm_r12_t ciphering_algorithm;
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
*/
}UE_RRC_INST_NR;
#include "proto_NR.h" //should be put here otherwise compilation error
#endif
/** @} */
+87
View File
@@ -0,0 +1,87 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars.h
* \brief rrc external vars
* \author Navid Nikaein and Raymond Knopp
* \date 2011
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#ifndef __OPENAIR_RRC_EXTERN_H__
#define __OPENAIR_RRC_EXTERN_H__
#include "defs.h"
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/RLC/rlc.h"
extern UE_RRC_INST *UE_rrc_inst;
#include "LAYER2/MAC/extern.h"
extern uint8_t DRB2LCHAN[8];
extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue;
extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue;
#ifndef PHY_EMUL
#ifndef PHYSIM
//#define NB_INST 1
#else
extern unsigned char NB_INST;
#endif
extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST;
extern unsigned short NODE_ID[1];
extern void* bigphys_malloc(int);
#endif
//CONSTANTS
extern rlc_info_t Rlc_info_um,Rlc_info_am_config;
//uint8_t RACH_TIME_ALLOC;
extern uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
extern MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
extern MAC_AVG_T BCCH_MEAS_AVG,CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
extern uint16_t T300[8];
extern uint16_t T310[8];
extern uint16_t N310[8];
extern uint16_t N311[8];
extern uint32_t T304[8];
extern uint32_t timeToTrigger_ms[16];
extern float RSRP_meas_mapping[98];
extern float RSRQ_meas_mapping[35];
extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern pthread_mutex_t ue_pf_po_mutex;
extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2];
#endif
View File
+457
View File
@@ -0,0 +1,457 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_gNB.c
* \brief rrc procedures for gNB
* \author Navid Nikaein and Raymond Knopp , WEI-TAI CHEN
* \date 2011 - 2014 , 2018
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
*/
#define RRC_GNB
#define RRC_GNB_C
#include "defs_NR.h"
#include "extern.h"
#include "assertions.h"
#include "common/ran_context.h"
#include "asn1_conversions.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "LAYER2/RLC/rlc.h"
#include "LAYER2/MAC/proto.h"
#include "UTIL/LOG/log.h"
#include "COMMON/mac_rrc_primitives.h"
#include "RRC/NR/asn1_msg.h"
///ASN.1 header files
//#include "RRCConnectionRequest.h"
//#include "RRCConnectionReestablishmentRequest.h"
//#include "ReestablishmentCause.h"
#include "BCCH-BCH-Message.h"
//#include "UL-CCCH-Message.h"
//#include "DL-CCCH-Message.h"
#include "UL-DCCH-Message.h"
#include "DL-DCCH-Message.h"
//#include "TDD-Config.h"
//#include "HandoverCommand.h"
#include "MeasResults.h"
#include "pdcp.h"
#include "rlc.h"
#include "SIMULATION/ETH_TRANSPORT/extern.h"
#include "rrc_eNB_UE_context.h"
#include "platform_types.h"
#include "msc.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "T.h"
#include "RRC/NAS/nas_config.h"
#include "RRC/NAS/rb_config.h"
#include "OCG.h"
#include "OCG_extern.h"
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
#if defined(ENABLE_USE_MME)
# include "rrc_eNB_S1AP.h"
# include "rrc_eNB_GTPV1U.h"
# if defined(ENABLE_ITTI)
# else
# include "../../S1AP/s1ap_eNB.h"
# endif
#endif
#include "gtpv1u_eNB_task.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#if ENABLE_RAL
# include "rrc_eNB_ral.h"
#endif
#include "SIMULATION/TOOLS/defs.h" // for taus
//#define XER_PRINT
extern RAN_CONTEXT_t RC;
#ifdef PHY_EMUL
extern EMULATION_VARS *Emul_vars;
#endif
//extern eNB_MAC_INST *eNB_mac_inst;
//extern UE_MAC_INST *UE_mac_inst;
#ifdef BIGPHYSAREA
extern void* bigphys_malloc(int);
#endif
extern uint16_t two_tier_hexagonal_cellIds[7];
mui_t rrc_gNB_mui = 0;
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
void
openair_nrrrc_on(
const protocol_ctxt_t* const ctxt_pP
)
//-----------------------------------------------------------------------------
{
int CC_id;
LOG_I(NR_RRC, PROTOCOL_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
rrc_config_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
rrc_config_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
}
}
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
static void
init_NR_SI(
const protocol_ctxt_t* const ctxt_pP,
const int CC_id
#if defined(ENABLE_ITTI)
,
gNB_RrcConfigurationReq * configuration
#endif
)
//-----------------------------------------------------------------------------
{
int i;
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
// copy basic parameters
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id];
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id];
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id];
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
///MIB
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = 0;
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4);
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = do_MIB_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],0,
#ifdef ENABLE_ITTI
configuration->MIB_ssb_SubcarrierOffset[CC_id],
configuration->pdcch_ConfigSIB1[CC_id],
configuration->MIB_subCarrierSpacingCommon[CC_id],
configuration->MIB_dmrs_TypeA_Position[CC_id]
#else
0,0,15,2
#endif
);
///SIB1
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0;
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32);
AssertFatal(RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!
= NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for NR SIB1 allocated\n",PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],
ctxt_pP->module_id,
CC_id
#if defined(ENABLE_ITTI)
,configuration
#endif
);
AssertFatal(RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nrrrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id,
CC_id
#if defined(ENABLE_ITTI)
,configuration
#endif
);
rrc_mac_config_req_gNB(ctxt_pP->module_id, CC_id,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].physCellId,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].p_gNB,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Ncp,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq,
0, // rnti
(BCCH_BCH_Message_t *)&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].mib,
(ServingCellConfigCommon_t *)&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id]servingcellconfigcommon
);
}
char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigurationReq* configuration){
protocol_ctxt_t ctxt;
int CC_id;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, GNB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP);
LOG_I(NR_RRC,PROTOCOL_NRRRC_CTXT_FMT" Init...\n",PROTOCOL_NRRRC_CTXT_ARGS(&ctxt));
#if OCP_FRAMEWORK
while ( RC.nrrrc[gnb_mod_idP] == NULL ) {
LOG_E(NR_RRC, "RC.nrrrc not yet initialized, waiting 1 second\n");
sleep(1);
}
#endif
AssertFatal(RC.nrrrc[gnb_mod_idP] != NULL, "RC.nrrrc not initialized!");
AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow");
#ifdef ENABLE_ITTI
AssertFatal(configuration!=NULL,"configuration input is null\n");
#endif
RC.nrrrc[ctxt.module_id]->Nb_ue = 0;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
RC.nrrrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0;
}
uid_linear_allocator_init(&nrrrc.nrrrc[ctxt.module_id]->uid_allocator);
RB_INIT(&RC.nrrrc[ctxt.module_id]->rrc_ue_head);
RC.nrrrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
RC.nrrrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
memcpy(&RC.nrrrc[ctxt.module_id]->configuration,configuration,sizeof(gNB_RrcConfigurationReq));
/// System Information INIT
LOG_I(NR_RRC, PROTOCOL_NRRRC_CTXT_FMT" Checking release \n",PROTOCOL_NRRRC_CTXT_ARGS(&ctxt));
#ifdef CBA
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
for (j = 0; j < NUM_MAX_CBA_GROUP; j++) {
RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j;
}
if (RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) {
RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP;
}
LOG_D(NR_RRC,
PROTOCOL_NRRRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n",
PROTOCOL_NRRRC_CTXT_ARGS(&ctxt),
gnb_mod_idP, RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0],
RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1],
RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2],
RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3],
RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups);
}
#endif
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
init_NR_SI(&ctxt,
CC_id
#if defined(ENABLE_ITTI)
,configuration
#endif
);
for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++){
RC.nrrrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0;
RC.nrrrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256);
}
}//END for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
//rrc_init_NR_global_param();
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
openair_rrc_top_init_gNB(RC.nrrrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0);
}
openair_nrrrc_on(&ctxt);
return 0;
}//END openair_rrc_gNB_configuration
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
#if defined(ENABLE_ITTI)
void* rrc_gnb_task(void* args_p){
MessageDef *msg_p;
const char *msg_name_p;
instance_t instance;
int result;
SRB_INFO *srb_info_p;
int CC_id;
protocol_ctxt_t ctxt;
itti_mark_task_ready(TASK_RRC_GNB);
LOG_I(NR_RRC,"Entering main loop of NR_RRC message task\n");
while (1) {
// Wait for a message
itti_receive_msg(TASK_RRC_GNB, &msg_p);
msg_name_p = ITTI_MSG_NAME(msg_p);
instance = ITTI_MSG_INSTANCE(msg_p);
LOG_I(RRC,"Received message %s\n",msg_name_p);
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting NR_RRC thread\n");
itti_exit_task();
break;
case MESSAGE_TEST:
LOG_I(RRC, "[gNB %d] Received %s\n", instance, msg_name_p);
break;
/* Messages from MAC */
/* Messages from PDCP */
#if defined(ENABLE_USE_MME)
/* Messages from S1AP */
case S1AP_DOWNLINK_NAS:
rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui);
break;
case S1AP_INITIAL_CONTEXT_SETUP_REQ:
rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance);
break;
case S1AP_UE_CTXT_MODIFICATION_REQ:
rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance);
break;
case S1AP_PAGING_IND:
LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p);
rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance);
break;
case S1AP_E_RAB_SETUP_REQ:
rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance);
LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p);
break;
case S1AP_E_RAB_MODIFY_REQ:
rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance);
break;
case S1AP_E_RAB_RELEASE_COMMAND:
rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
case S1AP_UE_CONTEXT_RELEASE_REQ:
rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance);
break;
case S1AP_UE_CONTEXT_RELEASE_COMMAND:
rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
case GTPV1U_ENB_DELETE_TUNNEL_RESP:
/* Nothing to do. Apparently everything is done in S1AP processing */
//LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n",
//instance, msg_name_p);
if (rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)
&& rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) {
rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc =
rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc;
}
break;
#endif
/* Messages from gNB app */
case NRRRC_CONFIGURATION_REQ:
LOG_I(NR_RRC, "[gNB %d] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p));
openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(instance), &NRRRC_CONFIGURATION_REQ(msg_p));
break;
default:
LOG_E(NR_RRC, "[gNB %d] Received unexpected message %s\n", instance, msg_name_p);
break;
}
result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
msg_p = NULL;
}
}
#endif //END #if defined(ENABLE_ITTI)
/*------------------------------------------------------------------------------*/
void
openair_rrc_top_init_gNB(int eMBMS_active,uint8_t HO_active)
//-----------------------------------------------------------------------------
{
module_id_t module_id;
int CC_id;
/* for no gcc warnings */
(void)CC_id;
LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_gNB_INST=%d\n", RC.nb_nr_inst);
if (RC.nb_nr_inst > 0) {
LOG_I(RRC,"[gNB] handover active state is %d \n", HO_active);
for (module_id=0; module_id<NB_gNB_INST; module_id++) {
RC.nrrrc[module_id]->HO_flag = (uint8_t)HO_active;
}
#if defined(Rel10) || defined(Rel14)
LOG_I(RRC,"[gNB] eMBMS active state is %d \n", eMBMS_active);
for (module_id=0; module_id<NB_gNB_INST; module_id++) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
RC.nrrrc[module_id]->carrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active;
}
}
#endif
#ifdef CBA
for (module_id=0; module_id<RC.nb_nr_inst; module_id++) {
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
RC.nrrrc[module_id]->carrier[CC_id].num_active_cba_groups = cba_group_active;
}
}
#endif
}//END if (RC.nb_nr_inst > 0)
}
+64
View File
@@ -0,0 +1,64 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_types.h
* \brief rrc types and subtypes
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014, 2018
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
*/
#ifndef RRC_TYPES_NR_H_
#define RRC_TYPES_NR_H_
typedef enum Rrc_State_NR_e {
RRC_STATE_INACTIVE_NR=0,
RRC_STATE_IDLE_NR,
RRC_STATE_CONNECTED_NR,
RRC_STATE_FIRST_NR = RRC_STATE_INACTIVE_NR,
RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR,
} Rrc_State_NR_t;
typedef enum Rrc_Sub_State_NR_e {
RRC_SUB_STATE_INACTIVE_NR=0,
RRC_SUB_STATE_IDLE_SEARCHING_NR,
RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR,
RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR,
RRC_SUB_STATE_IDLE_CONNECTING_NR,
RRC_SUB_STATE_IDLE_NR,
RRC_SUB_STATE_CONNECTED_NR,
RRC_SUB_STATE_INACTIVE_FIRST_NR = RRC_SUB_STATE_INACTIVE_NR,
RRC_SUB_STATE_INACTIVE_LAST_NR = RRC_SUB_STATE_INACTIVE_NR,
RRC_SUB_STATE_IDLE_FIRST_NR = RRC_SUB_STATE_IDLE_SEARCHING_NR,
RRC_SUB_STATE_IDLE_LAST_NR = RRC_SUB_STATE_IDLE_NR,
RRC_SUB_STATE_CONNECTED_FIRST_NR = RRC_SUB_STATE_CONNECTED_NR,
RRC_SUB_STATE_CONNECTED_LAST_NR = RRC_SUB_STATE_CONNECTED_NR,
} Rrc_Sub_State_NR_t;
#endif /* RRC_TYPES_H_ */
+160
View File
@@ -0,0 +1,160 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file RRC/LITE/defs.h
* \brief RRC struct definitions and function prototypes
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
*/
#ifndef __OPENAIR_NR_RRC_DEFS_H__
#define __OPENAIR_NR_RRC_DEFS_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "collection/tree.h"
#include "rrc_types.h"
#include "PHY/defs.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h"
#include "LAYER2/MAC/defs.h"
#include "SystemInformationBlockType1.h"
#include "SystemInformation.h"
#include "RRCConnectionReconfiguration.h"
#include "RRCConnectionReconfigurationComplete.h"
#include "RRCConnectionSetup.h"
#include "RRCConnectionSetupComplete.h"
#include "RRCConnectionRequest.h"
#include "RRCConnectionReestablishmentRequest.h"
#include "BCCH-DL-SCH-Message.h"
#include "BCCH-BCH-Message.h"
#if defined(Rel10) || defined(Rel14)
#include "MCCH-Message.h"
#include "MBSFNAreaConfiguration-r9.h"
#include "SCellToAddMod-r10.h"
#endif
#include "AS-Config.h"
#include "AS-Context.h"
#include "UE-EUTRA-Capability.h"
#include "MeasResults.h"
/* for ImsiMobileIdentity_t */
#include "MobileIdentity.h"
typedef struct NR_UE_RRC_INST_s {
nr_rrc_state_t rrc_state;
nr_rrc_sub_state_t rrc_sub_state;
#if 0
OAI_UECapability_t *UECap;
uint8_t *UECapability;
uint8_t UECapability_size;
UE_RRC_INFO Info[NB_SIG_CNX_UE];
SRB_INFO Srb0[NB_SIG_CNX_UE];
SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE];
SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE];
HANDOVER_INFO_UE HandoverInfoUe;
uint8_t *SIB1[NB_CNX_UE];
uint8_t sizeof_SIB1[NB_CNX_UE];
uint8_t *SI[NB_CNX_UE];
uint8_t sizeof_SI[NB_CNX_UE];
uint8_t SIB1Status[NB_CNX_UE];
uint8_t SIStatus[NB_CNX_UE];
SystemInformationBlockType1_t *sib1[NB_CNX_UE];
SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI().
SystemInformationBlockType2_t *sib2[NB_CNX_UE];
SystemInformationBlockType3_t *sib3[NB_CNX_UE];
SystemInformationBlockType4_t *sib4[NB_CNX_UE];
SystemInformationBlockType5_t *sib5[NB_CNX_UE];
SystemInformationBlockType6_t *sib6[NB_CNX_UE];
SystemInformationBlockType7_t *sib7[NB_CNX_UE];
SystemInformationBlockType8_t *sib8[NB_CNX_UE];
SystemInformationBlockType9_t *sib9[NB_CNX_UE];
SystemInformationBlockType10_t *sib10[NB_CNX_UE];
SystemInformationBlockType11_t *sib11[NB_CNX_UE];
#if defined(Rel10) || defined(Rel14)
uint8_t MBMS_flag;
uint8_t *MCCH_MESSAGE[NB_CNX_UE];
uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE];
uint8_t MCCH_MESSAGEStatus[NB_CNX_UE];
MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE];
SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE];
SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE];
#endif
#ifdef CBA
uint8_t num_active_cba_groups;
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
#endif
uint8_t num_srb;
struct SRB_ToAddMod *SRB1_config[NB_CNX_UE];
struct SRB_ToAddMod *SRB2_config[NB_CNX_UE];
struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8];
rb_id_t *defaultDRB; // remember the ID of the default DRB
MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ];
struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG];
struct QuantityConfig *QuantityConfig[NB_CNX_UE];
struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID];
MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID];
uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells
RSRP_Range_t s_measure;
struct MeasConfig__speedStatePars *speedStatePars;
struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE];
struct SPS_Config *sps_Config[NB_CNX_UE];
MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE];
MeasGapConfig_t *measGapConfig[NB_CNX_UE];
double filter_coeff_rsrp; // [7] ???
double filter_coeff_rsrq; // [7] ???
float rsrp_db[7];
float rsrq_db[7];
float rsrp_db_filtered[7];
float rsrq_db_filtered[7];
#if defined(ENABLE_SECURITY)
/* KeNB as computed from parameters within USIM card */
uint8_t kenb[32];
uint8_t nh[32];
int8_t nh_ncc;
#endif
/* Used integrity/ciphering algorithms */
CipheringAlgorithm_r12_t ciphering_algorithm;
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
#endif
MeasConfig_t *meas_config;
CellGroupConfig_t *cell_group_config;
RadioBearerConfig_t *radio_bearer_config;
} NR_UE_RRC_INST_t;
#include "proto.h"
#endif
/** @} */
+19
View File
@@ -0,0 +1,19 @@
#include "defs.h"
#include "proto.h"
#include "extern.h"
#include "assertions.h"
int nr_l3_init_ue(void){
LOG_I(RRC, "[MAIN] NR UE MAC initialization...\n");
openair_rrc_top_init_ue_nr();
return 1;
}
+79
View File
@@ -0,0 +1,79 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file proto.h
* \brief RRC functions prototypes for eNB and UE
* \author Navid Nikaein and Raymond Knopp
* \date 2010 - 2014
* \email navid.nikaein@eurecom.fr
* \version 1.0
*/
/** \addtogroup _rrc
* @{
*/
#include "defs.h"
//
// main_rrc.c
//
/**\brief Layer 3 initialization*/
int nr_l3_init_ue(void);
//
// UE_rrc.c
//
/**\brief Initial the top level RRC structure instance*/
uint8_t openair_rrc_top_init_ue_nr(void);
/**\brief Decode DCCH from gNB, sent from lower layer through SRB3
\param buffer encoded DCCH bytes stream message
\param size length of buffer*/
int8_t nr_rrc_ue_decode_dcch(const uint8_t *buffer, const uint32_t size);
/**\brief Decode RRC Connection Reconfiguration, sent from E-UTRA RRC Connection Reconfiguration v1510 carring EN-DC config
\param buffer encoded NR-RRC-Connection-Reconfiguration/Secondary-Cell-Group-Config message.
\param size length of buffer*/
//TODO check to use which one
int8_t nr_rrc_ue_decode_rrcReconfiguration(const uint8_t *buffer, const uint32_t size);
int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const uint8_t *buffer, const uint32_t size);
/**\brief Process NR RRC connection reconfiguration via SRB3
\param rrcReconfiguration decoded rrc connection reconfiguration*/
int8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfiguration);
/**\prief Process measurement config from NR RRC connection reconfiguration message
\param meas_config measurement configuration*/
int8_t nr_rrc_ue_process_meas_config(MeasConfig_t *meas_config);
/**\prief Process secondary cell group config from NR RRC connection reconfiguration message or EN-DC primitives
\param cell_group_config secondary cell group configuration*/
//TODO check EN-DC function call flow.
int8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config);
/**\prief Process radio bearer config from NR RRC connection reconfiguration message
\param radio_bearer_config radio bearer configuration*/
int8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config);
/** @}*/
+276
View File
@@ -0,0 +1,276 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_UE.c
* \brief rrc procedures for UE
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
*/
#define RRC_UE
#define RRC_UE_C
// header files for RRC message for NR might be change to add prefix in from of the file name.
#include "assertions.h"
#include "hashtable.h"
#include "asn1_conversions.h"
#include "defs.h"
#include "PHY/TOOLS/dB_routines.h"
#include "extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#ifndef CELLULAR
#include "RRC/LITE/MESSAGES/asn1_msg.h"
#endif
#include "RRCConnectionRequest.h"
#include "RRCConnectionReconfiguration.h"
#include "UL-CCCH-Message.h"
#include "DL-CCCH-Message.h"
#include "UL-DCCH-Message.h"
#include "DL-DCCH-Message.h"
#include "BCCH-DL-SCH-Message.h"
#include "PCCH-Message.h"
#if defined(Rel10) || defined(Rel14)
#include "MCCH-Message.h"
#endif
#include "MeasConfig.h"
#include "MeasGapConfig.h"
#include "MeasObjectEUTRA.h"
#include "TDD-Config.h"
#include "UECapabilityEnquiry.h"
#include "UE-CapabilityRequest.h"
#include "RRC/NAS/nas_config.h"
#include "RRC/NAS/rb_config.h"
#if ENABLE_RAL
#include "rrc_UE_ral.h"
#endif
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
// from NR SRB3
uint8_t nr_rrc_ue_decode_dcch(
const uint8_t *buffer,
const uint32_t size
){
// uper_decode by nr R15 rrc_connection_reconfiguration
NR_RRC_DL_DCCH_Message_t *nr_dl_dcch_msg = (NR_RRC_DL_DCCH_Message_t *)0;
uper_decode(NULL,
&asn_DEF_NR_RRC_DL_DCCH_Message, //might be added prefix later
(void**)&nr_dl_dcch_msg,
(uint8_t *)buffer,
size, 0, 0);
if(nr_dl_dcch_msg != NULL){
switch(nr_dl_dcch_msg->message.present){
case DL_DCCH_MessageType_PR_c1:
switch(nr_dl_dcch_msg->message.choice.c1.present){
case DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
nr_rrc_ue_process_rrcReconfiguration(&nr_dl_dcch_msg->message.choice.c1.choice.rrcReconfiguration);
break;
case DL_DCCH_MessageType__c1_PR_NOTHING:
case DL_DCCH_MessageType__c1_PR_spare15:
case DL_DCCH_MessageType__c1_PR_spare14:
case DL_DCCH_MessageType__c1_PR_spare13:
case DL_DCCH_MessageType__c1_PR_spare12:
case DL_DCCH_MessageType__c1_PR_spare11:
case DL_DCCH_MessageType__c1_PR_spare10:
case DL_DCCH_MessageType__c1_PR_spare9:
case DL_DCCH_MessageType__c1_PR_spare8:
case DL_DCCH_MessageType__c1_PR_spare7:
case DL_DCCH_MessageType__c1_PR_spare6:
case DL_DCCH_MessageType__c1_PR_spare5:
case DL_DCCH_MessageType__c1_PR_spare4:
case DL_DCCH_MessageType__c1_PR_spare3:
case DL_DCCH_MessageType__c1_PR_spare2:
case DL_DCCH_MessageType__c1_PR_spare1:
default:
// not support or unuse
break;
}
break;
case DL_DCCH_MessageType_PR_NOTHING:
case DL_DCCH_MessageType_PR_messageClassExtension:
default:
// not support or unuse
break;
}
// release memory allocation
free(nr_dl_dcch_msg);
}else{
// log..
}
return 0;
}
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded)
uint8_t nr_rrc_ue_decode_secondary_cellgroup_config(
const uint8_t *buffer,
const uint32_t size
){
CellGroupConfig_t *cellGroupConfig = (CellGroupConfig_t *)0;
uper_decode(NULL,
&asn_DEF_CellGroupConfig, //might be added prefix later
(void **)&cellGroupConfig,
(uint8_t *)buffer,
size, 0, 0);
if(NR_UE_rrc_inst->cell_group_config == (CellGroupConfig_t *)0){
NR_UE_rrc_inst->cell_group_config = cellGroupConfig;
nr_rrc_ue_process_scg_config(cellGroupConfig);
}else{
nr_rrc_ue_process_scg_config(cellGroupConfig);
asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
}
nr_rrc_mac_config_req_ue();
}
// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded)
// RRCReconfiguration
uint8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfiguration){
switch(rrcReconfiguration.criticalExtensions.present){
case RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration:
if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->radioBearerConfig != (RadioBearerConfig_t *)0){
if(NR_UE_rrc_inst->radio_bearer_config == (RadioBearerConfig_t *)0){
NR_UE_rrc_inst->radio_bearer_config = rrcReconfiguration->radioBearerConfig;
}else{
nr_rrc_ue_process_radio_bearer_config(rrcReconfiguration->radioBearerConfig);
}
}
if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->secondaryCellGroup != (OCTET_STRING_t *)0){
CellGroupConfig_t *cellGroupConfig = (CellGroupConfig_t *)0;
uper_decode(NULL,
&asn_DEF_CellGroupConfig, //might be added prefix later
(void **)&cellGroupConfig,
(uint8_t *)rrcReconfiguration->secondaryCellGroup->buffer,
rrcReconfiguration->secondaryCellGroup.size, 0, 0);
if(NR_UE_rrc_inst->cell_group_config == (CellGroupConfig_t *)0){
// first time receive the configuration, just use the memory allocated from uper_decoder. TODO this is not good implementation, need to maintain RRC_INST own structure every time.
NR_UE_rrc_inst->cell_group_config = cellGroupConfig;
nr_rrc_ue_process_scg_config(cellGroupConfig);
}else{
// after first time, update it and free the memory after.
nr_rrc_ue_process_scg_config(cellGroupConfig);
asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0);
}
}
if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->measConfig != (MeasConfig *)0){
if(NR_UE_rrc_inst->meas_config == (MeasConfig_t *)0){
NR_UE_rrc_inst->meas_config = rrcReconfiguration->measConfig;
}else{
// if some element need to be updated
nr_rrc_ue_process_meas_config(rrcReconfiguration->measConfig);
}
}
if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->lateNonCriticalExtension != (OCTET_STRING_t *)0){
// unuse now
}
if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->nonCriticalExtension != (RRCReconfiguration_IEs__nonCriticalExtension *)0){
// unuse now
}
break;
case RRCReconfiguration__criticalExtensions_PR_NOTHING:
case RRCReconfiguration__criticalExtensions_PR_criticalExtensionsFuture:
default:
break;
}
nr_rrc_mac_config_req_ue();
}
uint8_t nr_rrc_ue_process_meas_config(MeasConfig_t *meas_config){
}
uint8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config){
}
uint8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config){
}
uint8_t openair_rrc_top_init_ue_nr(void){
if(NB_NR_UE_INST > 0){
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
memset(NR_UE_rrc_inst, 0, NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
// fill UE-NR-Capability @ UE-CapabilityRAT-Container here.
}else{
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)0;
}
}
uint8_t nr_ue_process_rlc_bearer_list(CellGroupConfig_t *cell_group_config){
};
uint8_t nr_ue_process_secondary_cell_list(CellGroupConfig_t *cell_group_config){
};
uint8_t nr_ue_process_mac_cell_group_config(MAC_CellGroupConfig_t *mac_cell_group_config){
};
uint8_t nr_ue_process_physical_cell_group_config(PhysicalCellGroupConfig_t *phy_cell_group_config){
};
uint8_t nr_ue_process_spcell_config(SpCellConfig_t *spcell_config){
};
+71
View File
@@ -0,0 +1,71 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_types.h
* \brief rrc types and subtypes
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr
*/
#ifndef NR_RRC_TYPES_H_
#define NR_RRC_TYPES_H_
typedef enum nr_rrc_state_e {
//RRC_STATE_INACTIVE=0,
//RRC_STATE_IDLE,
//RRC_STATE_CONNECTED,
//RRC_STATE_FIRST = RRC_STATE_INACTIVE,
//RRC_STATE_LAST = RRC_STATE_CONNECTED,
RRC_STATE_IDLE = 0,
RRC_STATE_INACTIVE,
RRC_STATE_CONNECTED,
RRC_STATE_FIRST = RRC_STATE_IDLE,
RRC_STATE_LAST = RRC_STATE_CONNECTED
} nr_rrc_state_t;
typedef enum nr_rrc_sub_state_e {
//RRC_SUB_STATE_INACTIVE=0,
//RRC_SUB_STATE_IDLE_SEARCHING,
//RRC_SUB_STATE_IDLE_RECEIVING_SIB,
//RRC_SUB_STATE_IDLE_SIB_COMPLETE,
//RRC_SUB_STATE_IDLE_CONNECTING,
//RRC_SUB_STATE_IDLE,
//RRC_SUB_STATE_CONNECTED,
//RRC_SUB_STATE_INACTIVE_FIRST = RRC_SUB_STATE_INACTIVE,
//RRC_SUB_STATE_INACTIVE_LAST = RRC_SUB_STATE_INACTIVE,
//RRC_SUB_STATE_IDLE_FIRST = RRC_SUB_STATE_IDLE_SEARCHING,
//RRC_SUB_STATE_IDLE_LAST = RRC_SUB_STATE_IDLE,
//RRC_SUB_STATE_CONNECTED_FIRST = RRC_SUB_STATE_CONNECTED,
//RRC_SUB_STATE_CONNECTED_LAST = RRC_SUB_STATE_CONNECTED,
} nr_rrc_sub_state_t;
#endif /* RRC_TYPES_H_ */
+41
View File
@@ -0,0 +1,41 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars.hles
* \brief rrc variables
* \author Raymond Knopp and Navid Nikaein
* \date 2013
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#ifndef __OPENAIR_NR_RRC_VARS_H__
#define __OPENAIR_NR_RRC_VARS_H__
#include "defs.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs.h"
NR_UE_RRC_INST_t *NR_UE_rrc_inst;
#endif
File diff suppressed because it is too large Load Diff
+23 -65
View File
@@ -29,7 +29,7 @@
#include <stdint.h>
#include "x2ap_common.h"
#include "X2AP-PDU.h"
#include "X2AP_X2AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
@@ -55,29 +55,27 @@ inline void ASN_DEBUG(const char *fmt, ...)
ssize_t x2ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_initiatingMessage;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
@@ -89,107 +87,67 @@ ssize_t x2ap_generate_initiating_message(
ssize_t x2ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_successfulOutcome;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t x2ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
X2AP_PDU_t pdu;
X2AP_X2AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_PDU_t));
pdu.present = X2AP_PDU_PR_unsuccessfulOutcome;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
pdu.present = X2AP_X2AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu);
xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu,
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
X2ap_IE_t *x2ap_new_ie(
X2ap_ProtocolIE_ID_t id,
X2ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr)
void x2ap_handle_criticality(X2AP_Criticality_t criticality)
{
X2ap_IE_t *buff;
if ((buff = malloc(sizeof(X2ap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset((void *)buff, 0, sizeof(X2ap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType_aper(&buff->value, type, sptr) < 0) {
fprintf(stderr, "Encoding of %s failed\n", type->name);
free(buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_X2ap_IE, buff) < 0) {
free(buff);
return NULL;
}
return buff;
}
void x2ap_handle_criticality(X2ap_Criticality_t criticality)
{
}
+18 -261
View File
@@ -23,247 +23,17 @@
# include "config.h"
#endif
#include "X2ap-ABSInformationFDD.h"
#include "X2ap-ABSInformation.h"
#include "X2ap-ABSInformationTDD.h"
#include "X2ap-ABS-Status.h"
#include "X2ap-ActivatedCellList.h"
#include "X2ap-AllocationAndRetentionPriority.h"
#include "X2ap-AreaScopeOfMDT.h"
#include "X2ap-AS-SecurityInformation.h"
#include "X2ap-BandInfo.h"
#include "X2ap-BitRate.h"
#include "X2ap-BroadcastPLMNs-Item.h"
#include "X2ap-CapacityValue.h"
#include "X2ap-Cause.h"
#include "X2ap-CauseMisc.h"
#include "X2ap-CauseProtocol.h"
#include "X2ap-CauseRadioNetwork.h"
#include "X2ap-CauseTransport.h"
#include "X2ap-CellActivationFailure.h"
#include "X2ap-CellActivationRequest.h"
#include "X2ap-CellActivationResponse.h"
#include "X2ap-CellBasedMDT.h"
#include "X2ap-CellCapacityClassValue.h"
#include "X2ap-CellIdListforMDT.h"
#include "X2ap-CellInformation-Item.h"
#include "X2ap-CellInformation-List.h"
#include "X2ap-Cell-Size.h"
#include "X2ap-CellToReport-Item.h"
#include "X2ap-CellToReport-List.h"
#include "X2ap-CellType.h"
#include "X2ap-CellMeasurementResult-Item.h"
#include "X2ap-CellMeasurementResult-List.h"
#include "X2ap-CompleteFailureCauseInformation-Item.h"
#include "X2ap-CompleteFailureCauseInformation-List.h"
#include "X2ap-CompositeAvailableCapacityGroup.h"
#include "X2ap-CompositeAvailableCapacity.h"
#include "X2ap-COUNTvalue.h"
#include "X2ap-CriticalityDiagnostics.h"
#include "X2ap-CriticalityDiagnostics-IE-List.h"
#include "X2ap-Criticality.h"
#include "X2ap-CRNTI.h"
#include "X2ap-CSG-Id.h"
#include "X2ap-CSGMembershipStatus.h"
#include "X2ap-CyclicPrefixDL.h"
#include "X2ap-CyclicPrefixUL.h"
#include "X2ap-DeactivationIndication.h"
#include "X2ap-DL-ABS-status.h"
#include "X2ap-DL-Forwarding.h"
#include "X2ap-DL-GBR-PRB-usage.h"
#include "X2ap-DL-non-GBR-PRB-usage.h"
#include "X2ap-DL-Total-PRB-usage.h"
#include "X2ap-EARFCN.h"
#include "X2ap-ECGI.h"
#include "X2ap-ENB-ID.h"
#include "X2ap-ENBConfigurationUpdateFailure.h"
#include "X2ap-ENBConfigurationUpdateAcknowledge.h"
#include "X2ap-ENBConfigurationUpdate.h"
#include "X2ap-EncryptionAlgorithms.h"
#include "X2ap-EPLMNs.h"
#include "X2ap-E-RAB-ID.h"
#include "X2ap-E-RAB-Item.h"
#include "X2ap-E-RABs-Admitted-List.h"
#include "X2ap-E-RAB-Level-QoS-Parameters.h"
#include "X2ap-E-RAB-List.h"
#include "X2ap-E-RABs-SubjectToStatusTransfer-Item.h"
#include "X2ap-E-RABs-Admitted-Item.h"
#include "X2ap-E-RABs-SubjectToStatusTransfer-List.h"
#include "X2ap-ErrorIndication.h"
#include "X2ap-EUTRA-Mode-Info.h"
#include "X2ap-EUTRANCellIdentifier.h"
#include "X2ap-EUTRANTraceID.h"
#include "X2ap-EventType.h"
#include "X2ap-FDD-Info.h"
#include "X2ap-ForbiddenInterRATs.h"
#include "X2ap-ForbiddenLACs.h"
#include "X2ap-ForbiddenLAs.h"
#include "X2ap-ForbiddenLAs-Item.h"
#include "X2ap-ForbiddenTACs.h"
#include "X2ap-ForbiddenTAs.h"
#include "X2ap-ForbiddenTAs-Item.h"
#include "X2ap-Fourframes.h"
#include "X2ap-FreqBandIndicator.h"
#include "X2ap-GBR-QosInformation.h"
#include "X2ap-GlobalENB-ID.h"
#include "X2ap-GTP-TEI.h"
#include "X2ap-GTPtunnelEndpoint.h"
#include "X2ap-GU-Group-ID.h"
#include "X2ap-GUGroupIDList.h"
#include "X2ap-GUMMEI.h"
#include "X2ap-HandoverCancel.h"
#include "X2ap-HandoverReportType.h"
#include "X2ap-HandoverRequest.h"
#include "X2ap-HandoverReport.h"
#include "X2ap-HandoverRestrictionList.h"
#include "X2ap-HandoverPreparationFailure.h"
#include "X2ap-HandoverRequestAcknowledge.h"
#include "X2ap-HFN.h"
#include "X2ap-HWLoadIndicator.h"
#include "X2ap-IE-Extensions.h"
#include "X2ap-IE.h"
#include "X2ap-IntegrityProtectionAlgorithms.h"
#include "X2ap-InterfacesToTrace.h"
#include "X2ap-InvokeIndication.h"
#include "X2ap-Key-eNodeB-Star.h"
#include "X2ap-LAC.h"
#include "X2ap-LastVisitedCell-Item.h"
#include "X2ap-LastVisitedEUTRANCellInformation.h"
#include "X2ap-LastVisitedGERANCellInformation.h"
#include "X2ap-LastVisitedUTRANCellInformation.h"
#include "X2ap-LoadIndicator.h"
#include "X2ap-LoadInformation.h"
#include "X2ap-LocationReportingInformation.h"
#include "X2ap-ManagementBasedMDTallowed.h"
#include "X2ap-MBMS-Service-Area-Identity.h"
#include "X2ap-MBMS-Service-Area-Identity-List.h"
#include "X2ap-MBSFN-Subframe-Info.h"
#include "X2ap-MBSFN-Subframe-Infolist.h"
#include "X2ap-MDT-Activation.h"
#include "X2ap-MDT-Configuration.h"
#include "X2ap-Measurement-ID.h"
#include "X2ap-MeasurementsToActivate.h"
#include "X2ap-MeasurementThresholdA2.h"
#include "X2ap-MeasurementInitiationResult-Item.h"
#include "X2ap-MeasurementInitiationResult-List.h"
#include "X2ap-MeasurementFailureCause-Item.h"
#include "X2ap-MME-Code.h"
#include "X2ap-MME-Group-ID.h"
#include "X2ap-MobilityChangeAcknowledge.h"
#include "X2ap-MobilityChangeFailure.h"
#include "X2ap-MobilityChangeRequest.h"
#include "X2ap-MobilityParametersInformation.h"
#include "X2ap-MobilityParametersModificationRange.h"
#include "X2ap-MultibandInfoList.h"
#include "X2ap-Neighbour-Information.h"
#include "X2ap-NextHopChainingCount.h"
#include "X2ap-Number-of-Antennaports.h"
#include "X2ap-Oneframe.h"
#include "X2ap-Old-ECGIs.h"
#include "X2ap-PartialSuccessIndicator.h"
#include "X2ap-PCI.h"
#include "X2ap-PDCP-SN.h"
#include "X2AP-PDU.h"
#include "X2ap-PeriodicReportingMDT.h"
#include "X2ap-PLMN-Identity.h"
#include "X2ap-PRACH-Configuration.h"
#include "X2ap-Pre-emptionCapability.h"
#include "X2ap-Pre-emptionVulnerability.h"
#include "X2ap-Presence.h"
#include "X2ap-PriorityLevel.h"
#include "X2ap-PrivateIE-ID.h"
#include "X2ap-ProcedureCode.h"
#include "X2ap-ProtocolIE-ID.h"
#include "X2ap-QCI.h"
#include "X2ap-RadioframeAllocationOffset.h"
#include "X2ap-RadioframeAllocationPeriod.h"
#include "X2ap-RadioResourceStatus.h"
#include "X2ap-ReceiveStatusofULPDCPSDUs.h"
#include "X2ap-Registration-Request.h"
#include "X2ap-RelativeNarrowbandTxPower.h"
#include "X2ap-ReportAmountMDT.h"
#include "X2ap-ReportArea.h"
#include "X2ap-ReportCharacteristics.h"
#include "X2ap-ReportingTriggerMDT.h"
#include "X2ap-ReportIntervalMDT.h"
#include "X2ap-ReportingPeriodicity.h"
#include "X2ap-ResourceStatusFailure.h"
#include "X2ap-ResourceStatusResponse.h"
#include "X2ap-ResourceStatusUpdate.h"
#include "X2ap-RNTP-Threshold.h"
#include "X2ap-RRCConnReestabIndicator.h"
#include "X2ap-RRCConnSetupIndicator.h"
#include "X2ap-RRC-Context.h"
#include "X2ap-RLFIndication.h"
#include "X2ap-ResourceStatusRequest.h"
#include "X2ap-S1TNLLoadIndicator.h"
//nclude "X2ap-ServedCellInformation.h"
#include "X2ap-ServedCells.h"
#include "X2ap-ServedCellsToModify.h"
#include "X2ap-ServedCellsToActivate.h"
#include "X2ap-ShortMAC-I.h"
#include "X2ap-SpecialSubframe-Info.h"
#include "X2ap-SpecialSubframePatterns.h"
#include "X2ap-SRVCCOperationPossible.h"
#include "X2ap-SubframeAllocation.h"
#include "X2ap-SubframeAssignment.h"
#include "X2ap-SubscriberProfileIDforRFP.h"
#include "X2ap-SNStatusTransfer.h"
#include "X2ap-TABasedMDT.h"
#include "X2ap-TAC.h"
#include "X2ap-TAListforMDT.h"
#include "X2ap-TargetCellInUTRAN.h"
#include "X2ap-TargeteNBtoSource-eNBTransparentContainer.h"
#include "X2ap-TDD-Info.h"
#include "X2ap-ThresholdEventA2.h"
#include "X2ap-Threshold-RSRP.h"
#include "X2ap-Threshold-RSRQ.h"
#include "X2ap-TimeToWait.h"
#include "X2ap-Time-UE-StayedInCell-EnhancedGranularity.h"
#include "X2ap-Time-UE-StayedInCell.h"
#include "X2ap-E-RABs-ToBeSetup-Item.h"
#include "X2ap-TraceActivation.h"
#include "X2ap-TraceCollectionEntityIPAddress.h"
#include "X2ap-TraceDepth.h"
#include "X2ap-Transmission-Bandwidth.h"
#include "X2ap-TransportLayerAddress.h"
#include "X2ap-TriggeringMessage.h"
#include "X2ap-TypeOfError.h"
#include "X2ap-UEAggregateMaximumBitRate.h"
#include "X2ap-UE-ContextInformation.h"
#include "X2ap-UE-HistoryInformation.h"
#include "X2ap-UE-RLF-Report-Container.h"
#include "X2ap-UE-S1AP-ID.h"
#include "X2ap-UE-X2AP-ID.h"
#include "X2ap-UEContextRelease.h"
#include "X2ap-UESecurityCapabilities.h"
#include "X2ap-UL-GBR-PRB-usage.h"
#include "X2ap-UL-HighInterferenceIndication.h"
#include "X2ap-UL-HighInterferenceIndicationInfo.h"
#include "X2ap-UL-HighInterferenceIndicationInfo-Item.h"
#include "X2ap-UL-InterferenceOverloadIndication.h"
#include "X2ap-UL-InterferenceOverloadIndication-Item.h"
#include "X2ap-UL-non-GBR-PRB-usage.h"
#include "X2ap-UL-Total-PRB-usage.h"
#include "X2ap-UsableABSInformationFDD.h"
#include "X2ap-UsableABSInformation.h"
#include "X2ap-UsableABSInformationTDD.h"
#include "X2ap-ResetResponse.h"
#include "X2ap-ResetRequest.h"
#include "X2SetupFailure.h"
#include "X2SetupRequest.h"
#include "X2SetupResponse.h"
#include "X2ap-Old-ECGIs.h"
#include "X2ap-Criticality.h"
#include "X2ap-ProcedureCode.h"
#include "X2AP_ProtocolIE-Field.h"
#include "X2AP_X2AP-PDU.h"
#include "X2AP_InitiatingMessage.h"
#include "X2AP_SuccessfulOutcome.h"
#include "X2AP_UnsuccessfulOutcome.h"
#include "X2AP_ProtocolIE-Field.h"
#include "X2AP_ProtocolIE-FieldPair.h"
#include "X2AP_ProtocolIE-ContainerPair.h"
#include "X2AP_ProtocolExtensionField.h"
#include "X2AP_ProtocolExtensionContainer.h"
#include "X2AP_asn_constant.h"
#ifndef X2AP_COMMON_H_
#define X2AP_COMMON_H_
@@ -323,8 +93,8 @@ typedef int (*x2ap_message_decoded_callback)(
ssize_t x2ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
@@ -340,8 +110,8 @@ ssize_t x2ap_generate_successfull_outcome(
ssize_t x2ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
@@ -357,28 +127,15 @@ ssize_t x2ap_generate_initiating_message(
ssize_t x2ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
X2ap_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality,
X2AP_ProcedureCode_t procedureCode,
X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
/** \brief Generate a new IE
\param id Protocol ie id of the IE
\param criticality Criticality of the IE
\param type ASN1 type descriptor of the IE value
\param sptr Structure to be encoded in the value field
@returns a pointer to the newly created IE structure or NULL in case of failure
**/
X2ap_IE_t *x2ap_new_ie(
X2ap_ProtocolIE_ID_t id,
X2ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr);
/** \brief Handle criticality
\param criticality Criticality of the IE
@returns void
**/
void x2ap_handle_criticality(X2ap_Criticality_t criticality);
void x2ap_handle_criticality(X2AP_Criticality_t criticality);
#endif /* X2AP_COMMON_H_ */
File diff suppressed because it is too large Load Diff
+3 -141
View File
@@ -22,7 +22,7 @@
/*! \file s1ap_common.c
* \brief s1ap procedures for both eNB and MME
* \author Sebastien ROUX and Navid Nikaein
* \email navid.nikaein@eurecom.fr
* \email navid.nikaein@eurecom.fr
* \date 2012-2015
* \version 0.1
*/
@@ -30,7 +30,7 @@
#include <stdint.h>
#include "s1ap_common.h"
#include "S1AP-PDU.h"
#include "S1AP_S1AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
@@ -53,144 +53,6 @@ inline void ASN_DEBUG(const char *fmt, ...)
}
#endif
ssize_t s1ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
void s1ap_handle_criticality(S1AP_Criticality_t criticality)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t s1ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
ssize_t s1ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr)
{
S1AP_PDU_t pdu;
ssize_t encoded;
memset(&pdu, 0, sizeof(S1AP_PDU_t));
pdu.present = S1AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu);
}
/* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu,
(void **)buffer)) < 0) {
return -1;
}
*length = encoded;
return encoded;
}
S1ap_IE_t *s1ap_new_ie(
S1ap_ProtocolIE_ID_t id,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr)
{
S1ap_IE_t *buff;
if ((buff = malloc(sizeof(S1ap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset((void *)buff, 0, sizeof(S1ap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType_aper(&buff->value, type, sptr) < 0) {
fprintf(stderr, "Encoding of %s failed\n", type->name);
free(buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_S1ap_IE, buff) < 0) {
free(buff);
return NULL;
}
return buff;
}
void s1ap_handle_criticality(S1ap_Criticality_t criticality)
{
}
+32 -406
View File
@@ -39,343 +39,19 @@ extern int asn_debug;
inline void ASN_DEBUG(const char *fmt, ...);
#endif
#include "S1ap-Criticality.h"
#include "S1ap-Presence.h"
#include "S1ap-PrivateIE-ID.h"
#include "S1ap-ProcedureCode.h"
#include "S1ap-ProtocolExtensionID.h"
#include "S1ap-ProtocolIE-ID.h"
#include "S1ap-TriggeringMessage.h"
#include "S1ap-AllocationAndRetentionPriority.h"
#include "S1ap-Bearers-SubjectToStatusTransfer-List.h"
#include "S1ap-Bearers-SubjectToStatusTransfer-Item.h"
#include "S1ap-BitRate.h"
#include "S1ap-BPLMNs.h"
#include "S1ap-BroadcastCompletedAreaList.h"
#include "S1ap-Cause.h"
#include "S1ap-CauseMisc.h"
#include "S1ap-CauseProtocol.h"
#include "S1ap-CauseRadioNetwork.h"
#include "S1ap-CauseTransport.h"
#include "S1ap-CauseNas.h"
#include "S1ap-CellIdentity.h"
#include "S1ap-CellID-Broadcast.h"
#include "S1ap-CellID-Broadcast-Item.h"
#include "S1ap-Cdma2000PDU.h"
#include "S1ap-Cdma2000RATType.h"
#include "S1ap-Cdma2000SectorID.h"
#include "S1ap-Cdma2000HOStatus.h"
#include "S1ap-Cdma2000HORequiredIndication.h"
#include "S1ap-Cdma2000OneXSRVCCInfo.h"
#include "S1ap-Cdma2000OneXMEID.h"
#include "S1ap-Cdma2000OneXMSI.h"
#include "S1ap-Cdma2000OneXPilot.h"
#include "S1ap-Cdma2000OneXRAND.h"
#include "S1ap-Cell-Size.h"
#include "S1ap-CellType.h"
#include "S1ap-CGI.h"
#include "S1ap-CI.h"
#include "S1ap-CNDomain.h"
#include "S1ap-CSFallbackIndicator.h"
#include "S1ap-CSG-Id.h"
#include "S1ap-CSG-IdList.h"
#include "S1ap-CSG-IdList-Item.h"
#include "S1ap-COUNTvalue.h"
#include "S1ap-DataCodingScheme.h"
#include "S1ap-DL-Forwarding.h"
#include "S1ap-Direct-Forwarding-Path-Availability.h"
#include "S1ap-ECGIList.h"
#include "S1ap-EmergencyAreaIDList.h"
#include "S1ap-EmergencyAreaID.h"
#include "S1ap-EmergencyAreaID-Broadcast.h"
#include "S1ap-EmergencyAreaID-Broadcast-Item.h"
#include "S1ap-CompletedCellinEAI.h"
#include "S1ap-CompletedCellinEAI-Item.h"
#include "S1ap-ENB-ID.h"
#include "S1ap-GERAN-Cell-ID.h"
#include "S1ap-Global-ENB-ID.h"
#include "S1ap-ENB-StatusTransfer-TransparentContainer.h"
#include "S1ap-ENBname.h"
#include "S1ap-ENBX2TLAs.h"
#include "S1ap-EncryptionAlgorithms.h"
#include "S1ap-EPLMNs.h"
#include "S1ap-EventType.h"
#include "S1ap-E-RAB-ID.h"
#include "S1ap-E-RABInformationList.h"
#include "S1ap-E-RABInformationListItem.h"
#include "S1ap-E-RABList.h"
#include "S1ap-E-RABItem.h"
#include "S1ap-E-RABLevelQoSParameters.h"
#include "S1ap-EUTRAN-CGI.h"
#include "S1ap-ExtendedRNC-ID.h"
#include "S1ap-ForbiddenInterRATs.h"
#include "S1ap-ForbiddenTAs.h"
#include "S1ap-ForbiddenTAs-Item.h"
#include "S1ap-ForbiddenTACs.h"
#include "S1ap-ForbiddenLAs.h"
#include "S1ap-ForbiddenLAs-Item.h"
#include "S1ap-ForbiddenLACs.h"
#include "S1ap-GBR-QosInformation.h"
#include "S1ap-GTP-TEID.h"
#include "S1ap-GUMMEI.h"
#include "S1ap-HandoverRestrictionList.h"
#include "S1ap-HandoverType.h"
#include "S1ap-HFN.h"
#include "S1ap-IMSI.h"
#include "S1ap-IntegrityProtectionAlgorithms.h"
#include "S1ap-InterfacesToTrace.h"
#include "S1ap-LAC.h"
#include "S1ap-LAI.h"
#include "S1ap-LastVisitedCell-Item.h"
#include "S1ap-LastVisitedEUTRANCellInformation.h"
#include "S1ap-LastVisitedUTRANCellInformation.h"
#include "S1ap-LastVisitedGERANCellInformation.h"
#include "S1ap-L3-Information.h"
#include "S1ap-MessageIdentifier.h"
#include "S1ap-MMEname.h"
#include "S1ap-MME-Group-ID.h"
#include "S1ap-MME-Code.h"
#include "S1ap-M-TMSI.h"
#include "S1ap-MSClassmark2.h"
#include "S1ap-MSClassmark3.h"
#include "S1ap-NAS-PDU.h"
#include "S1ap-NASSecurityParametersfromE-UTRAN.h"
#include "S1ap-NASSecurityParameterstoE-UTRAN.h"
#include "S1ap-NumberofBroadcastRequest.h"
#include "S1ap-NumberOfBroadcasts.h"
#include "S1ap-OldBSS-ToNewBSS-Information.h"
#include "S1ap-OverloadAction.h"
#include "S1ap-OverloadResponse.h"
#include "S1ap-PagingDRX.h"
#include "S1ap-PDCP-SN.h"
#include "S1ap-PLMNidentity.h"
#include "S1ap-Pre-emptionCapability.h"
#include "S1ap-Pre-emptionVulnerability.h"
#include "S1ap-PriorityLevel.h"
#include "S1ap-QCI.h"
#include "S1ap-ReceiveStatusofULPDCPSDUs.h"
#include "S1ap-RelativeMMECapacity.h"
#include "S1ap-RAC.h"
#include "S1ap-RequestType.h"
#include "S1ap-RIMTransfer.h"
#include "S1ap-RIMInformation.h"
#include "S1ap-RIMRoutingAddress.h"
#include "S1ap-ReportArea.h"
#include "S1ap-RepetitionPeriod.h"
#include "S1ap-RNC-ID.h"
#include "S1ap-RRC-Container.h"
#include "S1ap-RRC-Establishment-Cause.h"
#include "S1ap-SecurityKey.h"
#include "S1ap-SecurityContext.h"
#include "S1ap-SerialNumber.h"
#include "S1ap-SONInformation.h"
#include "S1ap-SONInformationRequest.h"
#include "S1ap-SONInformationReply.h"
#include "S1ap-SONConfigurationTransfer.h"
#include "S1ap-Source-ToTarget-TransparentContainer.h"
#include "S1ap-SourceBSS-ToTargetBSS-TransparentContainer.h"
#include "S1ap-SourceeNB-ID.h"
#include "S1ap-SRVCCOperationPossible.h"
#include "S1ap-SRVCCHOIndication.h"
#include "S1ap-SourceeNB-ToTargeteNB-TransparentContainer.h"
#include "S1ap-SourceRNC-ToTargetRNC-TransparentContainer.h"
#include "S1ap-ServedGUMMEIs.h"
#include "S1ap-ServedGUMMEIsItem.h"
#include "S1ap-ServedGroupIDs.h"
#include "S1ap-ServedMMECs.h"
#include "S1ap-ServedPLMNs.h"
#include "S1ap-SubscriberProfileIDforRFP.h"
#include "S1ap-SupportedTAs.h"
#include "S1ap-SupportedTAs-Item.h"
#include "S1ap-S-TMSI.h"
#include "S1ap-TAC.h"
#include "S1ap-TAIItem.h"
#include "S1ap-TAIList.h"
#include "S1ap-TAIListforWarning.h"
#include "S1ap-TAI.h"
#include "S1ap-TAI-Broadcast.h"
#include "S1ap-TAI-Broadcast-Item.h"
#include "S1ap-CompletedCellinTAI.h"
#include "S1ap-CompletedCellinTAI-Item.h"
#include "S1ap-TargetID.h"
#include "S1ap-TargeteNB-ID.h"
#include "S1ap-TargetRNC-ID.h"
#include "S1ap-TargeteNB-ToSourceeNB-TransparentContainer.h"
#include "S1ap-Target-ToSource-TransparentContainer.h"
#include "S1ap-TargetRNC-ToSourceRNC-TransparentContainer.h"
#include "S1ap-TargetBSS-ToSourceBSS-TransparentContainer.h"
#include "S1ap-TimeToWait.h"
#include "S1ap-Time-UE-StayedInCell.h"
#include "S1ap-TransportLayerAddress.h"
#include "S1ap-TraceActivation.h"
#include "S1ap-TraceDepth.h"
#include "S1ap-E-UTRAN-Trace-ID.h"
#include "S1ap-TypeOfError.h"
#include "S1ap-UEAggregateMaximumBitrate.h"
#include "S1ap-UE-associatedLogicalS1-ConnectionItem.h"
#include "S1ap-UEIdentityIndexValue.h"
#include "S1ap-UE-HistoryInformation.h"
#include "S1ap-UEPagingID.h"
#include "S1ap-UERadioCapability.h"
#include "S1ap-UESecurityCapabilities.h"
#include "S1ap-WarningAreaList.h"
#include "S1ap-WarningType.h"
#include "S1ap-WarningSecurityInfo.h"
#include "S1ap-WarningMessageContents.h"
#include "S1ap-X2TNLConfigurationInfo.h"
#include "S1ap-CriticalityDiagnostics.h"
#include "S1ap-CriticalityDiagnostics-IE-List.h"
#include "S1ap-CriticalityDiagnostics-IE-Item.h"
#include "S1ap-ResetType.h"
#include "S1ap-Inter-SystemInformationTransferType.h"
#include "S1ap-UE-S1AP-IDs.h"
#include "S1ap-UE-S1AP-ID-pair.h"
#include "S1ap-MME-UE-S1AP-ID.h"
#include "S1ap-ENB-UE-S1AP-ID.h"
#include "S1ap-TBCD-STRING.h"
#include "S1ap-InitiatingMessage.h"
#include "S1ap-SuccessfulOutcome.h"
#include "S1ap-UnsuccessfulOutcome.h"
#include "S1ap-HandoverRequired.h"
#include "S1ap-HandoverCommand.h"
#include "S1ap-HandoverNotify.h"
#include "S1ap-HandoverPreparationFailure.h"
#include "S1ap-HandoverRequest.h"
#include "S1ap-HandoverRequestAcknowledge.h"
#include "S1ap-HandoverFailure.h"
#include "S1ap-PathSwitchRequest.h"
#include "S1ap-PathSwitchRequestAcknowledge.h"
#include "S1ap-PathSwitchRequestFailure.h"
#include "S1ap-E-RABSetupRequest.h"
#include "S1ap-E-RABSetupResponse.h"
#include "S1ap-E-RABModifyRequest.h"
#include "S1ap-E-RABModifyResponse.h"
#include "S1ap-E-RABReleaseIndication.h"
#include "S1ap-E-RABReleaseCommand.h"
#include "S1ap-E-RABReleaseResponse.h"
#include "S1ap-InitialContextSetupRequest.h"
#include "S1ap-InitialContextSetupResponse.h"
#include "S1ap-InitialContextSetupFailure.h"
#include "S1ap-UEContextReleaseRequest.h"
#include "S1ap-Paging.h"
#include "S1ap-DownlinkNASTransport.h"
#include "S1ap-InitialUEMessage.h"
#include "S1ap-UplinkNASTransport.h"
#include "S1ap-NASNonDeliveryIndication.h"
#include "S1ap-HandoverCancel.h"
#include "S1ap-HandoverCancelAcknowledge.h"
#include "S1ap-Reset.h"
#include "S1ap-ResetAcknowledge.h"
#include "S1ap-S1SetupResponse.h"
#include "S1ap-S1SetupRequest.h"
#include "S1ap-S1SetupFailure.h"
#include "S1ap-ErrorIndication.h"
#include "S1ap-ENBConfigurationUpdate.h"
#include "S1ap-ENBConfigurationUpdateAcknowledge.h"
#include "S1ap-ENBConfigurationUpdateFailure.h"
#include "S1ap-MMEConfigurationUpdate.h"
#include "S1ap-MMEConfigurationUpdateAcknowledge.h"
#include "S1ap-MMEConfigurationUpdateFailure.h"
#include "S1ap-DownlinkS1cdma2000tunneling.h"
#include "S1ap-UplinkS1cdma2000tunneling.h"
#include "S1ap-UEContextModificationRequest.h"
#include "S1ap-UEContextModificationResponse.h"
#include "S1ap-UEContextModificationFailure.h"
#include "S1ap-UECapabilityInfoIndication.h"
#include "S1ap-UEContextReleaseCommand.h"
#include "S1ap-UEContextReleaseComplete.h"
#include "S1ap-ENBStatusTransfer.h"
#include "S1ap-MMEStatusTransfer.h"
#include "S1ap-DeactivateTrace.h"
#include "S1ap-TraceStart.h"
#include "S1ap-TraceFailureIndication.h"
#include "S1ap-CellTrafficTrace.h"
#include "S1ap-LocationReportingControl.h"
#include "S1ap-LocationReportingFailureIndication.h"
#include "S1ap-LocationReport.h"
#include "S1ap-OverloadStart.h"
#include "S1ap-OverloadStop.h"
#include "S1ap-WriteReplaceWarningRequest.h"
#include "S1ap-WriteReplaceWarningResponse.h"
#include "S1ap-ENBDirectInformationTransfer.h"
#include "S1ap-MMEDirectInformationTransfer.h"
#include "S1ap-ENBConfigurationTransfer.h"
#include "S1ap-MMEConfigurationTransfer.h"
#include "S1ap-PrivateMessage.h"
#include "S1ap-E-RABReleaseItemBearerRelComp.h"
#include "S1ap-E-RABToBeSwitchedDLList.h"
#include "S1ap-E-RABToBeSwitchedDLItem.h"
#include "S1ap-E-RABToBeSwitchedULList.h"
#include "S1ap-E-RABToBeSwitchedULItem.h"
#include "S1ap-E-RABToBeSetupListBearerSUReq.h"
#include "S1ap-E-RABToBeSetupItemBearerSUReq.h"
#include "S1ap-E-RABDataForwardingList.h"
#include "S1ap-E-RABDataForwardingItem.h"
#include "S1ap-E-RABToBeSetupListHOReq.h"
#include "S1ap-E-RABToBeSetupItemHOReq.h"
#include "S1ap-E-RABAdmittedList.h"
#include "S1ap-E-RABAdmittedItem.h"
#include "S1ap-E-RABFailedToSetupListHOReqAck.h"
#include "S1ap-E-RABToBeSetupItemCtxtSUReq.h"
#include "S1ap-E-RABToBeSetupListCtxtSUReq.h"
#include "S1ap-E-RABSetupItemBearerSURes.h"
#include "S1ap-E-RABSetupListBearerSURes.h"
#include "S1ap-E-RABSetupItemCtxtSURes.h"
#include "S1ap-E-RABSetupListCtxtSURes.h"
#include "S1ap-E-RABReleaseListBearerRelComp.h"
#include "S1ap-E-RABModifyItemBearerModRes.h"
#include "S1ap-E-RABModifyListBearerModRes.h"
#include "S1ap-E-RABFailedToSetupItemHOReqAck.h"
#include "S1ap-E-RABFailedToSetupListHOReqAck.h"
#include "S1ap-E-RABToBeModifiedItemBearerModReq.h"
#include "S1ap-E-RABToBeModifiedListBearerModReq.h"
#include "S1ap-UE-associatedLogicalS1-ConnectionListResAck.h"
#include "S1ap-IE.h"
#include "S1AP-PDU.h"
#if defined (UPDATE_RELEASE_9)
# include "S1ap-BroadcastCancelledAreaList.h"
# include "S1ap-CancelledCellinEAI.h"
# include "S1ap-CancelledCellinEAI-Item.h"
# include "S1ap-CancelledCellinTAI.h"
# include "S1ap-CancelledCellinTAI-Item.h"
# include "S1ap-CellAccessMode.h"
# include "S1ap-CellID-Cancelled.h"
# include "S1ap-CellID-Cancelled-Item.h"
# include "S1ap-ConcurrentWarningMessageIndicator.h"
# include "S1ap-CSGMembershipStatus.h"
# include "S1ap-Data-Forwarding-Not-Possible.h"
# include "S1ap-EmergencyAreaID-Cancelled.h"
# include "S1ap-EmergencyAreaID-Cancelled-Item.h"
# include "S1ap-E-RABList.h"
# include "S1ap-EUTRANRoundTripDelayEstimationInfo.h"
# include "S1ap-ExtendedRepetitionPeriod.h"
# include "S1ap-LPPa-PDU.h"
# include "S1ap-PS-ServiceNotAvailable.h"
# include "S1ap-Routing-ID.h"
# include "S1ap-StratumLevel.h"
# include "S1ap-SynchronizationStatus.h"
# include "S1ap-TimeSynchronizationInfo.h"
# include "S1ap-TAI-Cancelled.h"
# include "S1ap-TAI-Cancelled-Item.h"
# include "S1ap-KillRequest.h"
# include "S1ap-KillResponse.h"
# include "S1ap-DownlinkUEAssociatedLPPaTransport.h"
# include "S1ap-UplinkUEAssociatedLPPaTransport.h"
# include "S1ap-DownlinkNonUEAssociatedLPPaTransport.h"
# include "S1ap-UplinkNonUEAssociatedLPPaTransport.h"
#endif /* (UPDATE_RELEASE_9) */
#if defined(UPDATE_RELEASE_10)
# include "S1ap-PagingPriority.h"
# include "S1ap-RelayNode-Indicator.h"
# include "S1ap-GWContextReleaseIndication.h"
# include "S1ap-MMERelaySupportIndicator.h"
# include "S1ap-ManagementBasedMDTAllowed.h"
# include "S1ap-PrivacyIndicator.h"
# include "S1ap-TrafficLoadReductionIndication.h"
# include "S1ap-GUMMEIList.h"
#endif /* (UPDATE_RELEASE_10) */
#include "S1AP_ProtocolIE-Field.h"
#include "S1AP_S1AP-PDU.h"
#include "S1AP_InitiatingMessage.h"
#include "S1AP_SuccessfulOutcome.h"
#include "S1AP_UnsuccessfulOutcome.h"
#include "S1AP_ProtocolIE-Field.h"
#include "S1AP_ProtocolIE-FieldPair.h"
#include "S1AP_ProtocolIE-ContainerPair.h"
#include "S1AP_ProtocolExtensionField.h"
#include "S1AP_ProtocolExtensionContainer.h"
#include "S1AP_asn_constant.h"
#include "S1AP_SupportedTAs-Item.h"
#include "S1AP_ServedGUMMEIsItem.h"
/* Checking version of ASN1C compiler */
#if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION)
@@ -411,84 +87,34 @@ extern int asn1_xer_print;
# define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0)
#endif
//Forward declaration
struct s1ap_message_s;
#define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do {\
IE_TYPE **ptr; \
ie = NULL; \
for (ptr = container->protocolIEs.list.array; \
ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \
ptr++) { \
if((*ptr)->id == IE_ID) { \
ie = *ptr; \
break; \
} \
} \
if (mandatory) DevAssert(ie != NULL); \
} while(0)
/** \brief Function callback prototype.
**/
typedef int (*s1ap_message_decoded_callback)(
uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p
uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu
);
/** \brief Encode a successfull outcome message
\param buffer pointer to buffer in which data will be encoded
\param length pointer to the length of buffer
\param procedureCode Procedure code for the message
\param criticality Criticality of the message
\param td ASN1C type descriptor of the sptr
\param sptr Deferenced pointer to the structure to encode
@returns size in bytes encded on success or 0 on failure
**/
ssize_t s1ap_generate_successfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
/** \brief Encode an initiating message
\param buffer pointer to buffer in which data will be encoded
\param length pointer to the length of buffer
\param procedureCode Procedure code for the message
\param criticality Criticality of the message
\param td ASN1C type descriptor of the sptr
\param sptr Deferenced pointer to the structure to encode
@returns size in bytes encded on success or 0 on failure
**/
ssize_t s1ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
/** \brief Encode an unsuccessfull outcome message
\param buffer pointer to buffer in which data will be encoded
\param length pointer to the length of buffer
\param procedureCode Procedure code for the message
\param criticality Criticality of the message
\param td ASN1C type descriptor of the sptr
\param sptr Deferenced pointer to the structure to encode
@returns size in bytes encded on success or 0 on failure
**/
ssize_t s1ap_generate_unsuccessfull_outcome(
uint8_t **buffer,
uint32_t *length,
e_S1ap_ProcedureCode procedureCode,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *td,
void *sptr);
/** \brief Generate a new IE
\param id Protocol ie id of the IE
\param criticality Criticality of the IE
\param type ASN1 type descriptor of the IE value
\param sptr Structure to be encoded in the value field
@returns a pointer to the newly created IE structure or NULL in case of failure
**/
S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id,
S1ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr);
/** \brief Handle criticality
\param criticality Criticality of the IE
@returns void
**/
void s1ap_handle_criticality(S1ap_Criticality_t criticality);
void s1ap_handle_criticality(S1AP_Criticality_t criticality);
#endif /* S1AP_COMMON_H_ */
+185 -189
View File
@@ -20,8 +20,8 @@
*/
/*! \file s1ap_eNB.c
* \brief S1AP eNB task
* \author S. Roux and Navid Nikaein
* \brief S1AP eNB task
* \author S. Roux and Navid Nikaein
* \date 2010 - 2015
* \email: navid.nikaein@eurecom.fr
* \version 1.0
@@ -42,7 +42,6 @@
#include "s1ap_eNB_default_values.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB.h"
@@ -81,16 +80,12 @@ uint32_t s1ap_generate_eNB_id(void)
char hostname[50];
int ret;
uint32_t eNB_id;
/* Retrieve the host name */
ret = gethostname(hostname, sizeof(hostname));
DevAssert(ret == 0);
out = crypt(hostname, "eurecom");
DevAssert(out != NULL);
eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]);
return eNB_id;
}
@@ -104,46 +99,32 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
struct s1ap_eNB_mme_data_s *mme = NULL;
DevAssert(instance_p != NULL);
DevAssert(mme_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
sctp_new_association_req_p->in_streams = in_streams;
sctp_new_association_req_p->out_streams = out_streams;
memcpy(&sctp_new_association_req_p->remote_address,
mme_ip_address,
sizeof(*mme_ip_address));
memcpy(&sctp_new_association_req_p->local_address,
local_ip_addr,
sizeof(*local_ip_addr));
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
mme = s1ap_eNB_get_MME_from_instance(instance_p);
if ( mme == NULL ) {
/* Create new MME descriptor */
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
DevAssert(s1ap_mme_data_p != NULL);
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
s1ap_mme_data_p->assoc_id = -1;
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
/* Insert the new descriptor in list of known MME
* but not yet associated.
*/
@@ -154,27 +135,23 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
} else if (mme->state == S1AP_ENB_STATE_WAITING) {
instance_p->s1ap_mme_pending_nb ++;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
instance_p->instance,
mme->state, mme->cnx_id,
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
instance_p->instance,
mme->state, mme->cnx_id,
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
/*s1ap_mme_data_p->cnx_id = mme->cnx_id;
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
s1ap_mme_data_p->assoc_id = -1;
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
*/
*/
} else {
S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
instance_p->instance,
mme->state, mme->cnx_id,
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
instance_p->instance,
mme->state, mme->cnx_id,
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
}
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
}
@@ -183,14 +160,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
{
s1ap_eNB_instance_t *new_instance;
uint8_t index;
DevAssert(s1ap_register_eNB != NULL);
/* Look if the provided instance already exists */
new_instance = s1ap_eNB_get_instance(instance);
if (new_instance != NULL) {
if (new_instance != NULL) {
/* Checks if it is a retry on the same eNB */
DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0);
DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
@@ -202,10 +176,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
} else {
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
DevAssert(new_instance != NULL);
RB_INIT(&new_instance->s1ap_ue_head);
RB_INIT(&new_instance->s1ap_mme_head);
/* Copy usefull parameters */
new_instance->instance = instance;
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
@@ -216,14 +188,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
new_instance->mnc = s1ap_register_eNB->mnc;
new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
new_instance->default_drx = s1ap_register_eNB->default_drx;
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
s1ap_eNB_insert_new_instance(new_instance);
S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
instance,
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
s1ap_register_eNB->eNB_id);
instance,
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
s1ap_register_eNB->eNB_id);
}
DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS,
@@ -232,7 +202,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
/* Trying to connect to provided list of MME ip address */
for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
s1ap_eNB_register_mme(new_instance,
&s1ap_register_eNB->mme_ip_address[index],
&s1ap_register_eNB->mme_ip_address[index],
&s1ap_register_eNB->enb_ip_address,
s1ap_register_eNB->sctp_in_streams,
s1ap_register_eNB->sctp_out_streams);
@@ -243,12 +213,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
{
s1ap_eNB_instance_t *instance_p;
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
DevAssert(sctp_new_association_resp != NULL);
instance_p = s1ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
sctp_new_association_resp->ulp_cnx_id);
DevAssert(s1ap_mme_data_p != NULL);
@@ -258,9 +225,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return;
}
@@ -268,7 +233,6 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
/* Prepare new S1 Setup Request */
s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p);
}
@@ -277,11 +241,10 @@ static
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
{
int result;
DevAssert(sctp_data_ind != NULL);
#if defined(TEST_S1C_MME)
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
#else
s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
@@ -294,11 +257,8 @@ void *s1ap_eNB_task(void *arg)
{
MessageDef *received_msg = NULL;
int result;
S1AP_DEBUG("Starting S1AP layer\n");
s1ap_eNB_prepare_internal_data();
itti_mark_task_ready(TASK_S1AP);
MSC_START_USE();
@@ -306,116 +266,112 @@ void *s1ap_eNB_task(void *arg)
itti_receive_msg(TASK_S1AP, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
S1AP_WARN(" *** Exiting S1AP thread\n");
itti_exit_task();
case TERMINATE_MESSAGE:
S1AP_WARN(" *** Exiting S1AP thread\n");
itti_exit_task();
break;
case S1AP_REGISTER_ENB_REQ: {
/* Register a new eNB.
* in Virtual mode eNBs will be distinguished using the mod_id/
* Each eNB has to send an S1AP_REGISTER_ENB message with its
* own parameters.
*/
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_REGISTER_ENB_REQ(received_msg));
}
break;
case S1AP_REGISTER_ENB_REQ: {
/* Register a new eNB.
* in Virtual mode eNBs will be distinguished using the mod_id/
* Each eNB has to send an S1AP_REGISTER_ENB message with its
* own parameters.
*/
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_REGISTER_ENB_REQ(received_msg));
}
break;
case SCTP_NEW_ASSOCIATION_RESP: {
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
}
break;
case SCTP_NEW_ASSOCIATION_RESP: {
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
}
break;
case SCTP_DATA_IND: {
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
}
break;
case SCTP_DATA_IND: {
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
}
break;
case S1AP_NAS_FIRST_REQ: {
s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_NAS_FIRST_REQ(received_msg));
}
break;
case S1AP_NAS_FIRST_REQ: {
s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_NAS_FIRST_REQ(received_msg));
}
break;
case S1AP_UPLINK_NAS: {
s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UPLINK_NAS(received_msg));
}
break;
case S1AP_UPLINK_NAS: {
s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UPLINK_NAS(received_msg));
}
break;
case S1AP_UE_CAPABILITIES_IND: {
s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CAPABILITIES_IND(received_msg));
}
break;
case S1AP_UE_CAPABILITIES_IND: {
s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CAPABILITIES_IND(received_msg));
}
break;
case S1AP_INITIAL_CONTEXT_SETUP_RESP: {
s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg));
}
break;
case S1AP_INITIAL_CONTEXT_SETUP_RESP: {
s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg));
}
break;
case S1AP_E_RAB_SETUP_RESP: {
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_SETUP_RESP(received_msg));
}
break;
case S1AP_E_RAB_SETUP_RESP: {
s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_SETUP_RESP(received_msg));
}
break;
case S1AP_E_RAB_MODIFY_RESP: {
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_MODIFY_RESP(received_msg));
}
break;
case S1AP_E_RAB_MODIFY_RESP: {
s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_MODIFY_RESP(received_msg));
}
break;
case S1AP_NAS_NON_DELIVERY_IND: {
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
}
break;
case S1AP_NAS_NON_DELIVERY_IND: {
s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_NAS_NON_DELIVERY_IND(received_msg));
}
break;
case S1AP_UE_CONTEXT_RELEASE_COMPLETE: {
s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg));
}
break;
case S1AP_UE_CONTEXT_RELEASE_COMPLETE: {
s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg));
}
break;
case S1AP_UE_CONTEXT_RELEASE_REQ: {
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
case S1AP_UE_CONTEXT_RELEASE_REQ: {
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test
struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
DevAssert(s1ap_eNB_instance_p != NULL); // test
s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_UE_CONTEXT_RELEASE_REQ(received_msg));
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n",
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test
} // test
}
break;
s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test
DevAssert(s1ap_eNB_instance_p != NULL); // test
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test
/* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */
S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n",
S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test
} // test
}
break;
case S1AP_E_RAB_RELEASE_RESPONSE: {
case S1AP_E_RAB_RELEASE_RESPONSE: {
s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_E_RAB_RELEASE_RESPONSE(received_msg));
}
break;
default:
S1AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
}
break;
default:
S1AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
}
@@ -425,62 +381,102 @@ void *s1ap_eNB_task(void *arg)
static int s1ap_eNB_generate_s1_setup_request(
s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p)
{
s1ap_message message;
S1ap_S1SetupRequestIEs_t *s1SetupRequest_p;
S1ap_PLMNidentity_t plmnIdentity;
S1ap_SupportedTAs_Item_t ta;
S1AP_S1AP_PDU_t pdu;
S1AP_S1SetupRequest_t *out;
S1AP_S1SetupRequestIEs_t *ie;
S1AP_SupportedTAs_Item_t *ta;
S1AP_PLMNidentity_t *plmn;
uint8_t *buffer;
uint32_t len;
int ret = 0;
DevAssert(instance_p != NULL);
DevAssert(s1ap_mme_data_p != NULL);
memset(&message, 0, sizeof(s1ap_message));
message.direction = S1AP_PDU_PR_initiatingMessage;
message.procedureCode = S1ap_ProcedureCode_id_S1Setup;
message.criticality = S1ap_Criticality_reject;
s1SetupRequest_p = &message.msg.s1ap_S1SetupRequestIEs;
memset((void *)&plmnIdentity, 0, sizeof(S1ap_PLMNidentity_t));
memset((void *)&ta, 0, sizeof(S1ap_SupportedTAs_Item_t));
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
s1SetupRequest_p->global_ENB_ID.eNB_ID.present = S1ap_ENB_ID_PR_macroENB_ID;
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
&s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID);
/* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_S1Setup;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest;
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest;
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID;
MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
&s1SetupRequest_p->global_ENB_ID.pLMNidentity);
&ie->value.choice.Global_ENB_ID.pLMNidentity);
ie->value.choice.Global_ENB_ID.eNB_ID.present = S1AP_ENB_ID_PR_macroENB_ID;
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
&ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID);
S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0],
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
INT16_TO_OCTET_STRING(instance_p->tac, &ta.tAC);
MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, &plmnIdentity);
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs.list, &plmnIdentity);
ASN_SEQUENCE_ADD(&s1SetupRequest_p->supportedTAs.list, &ta);
s1SetupRequest_p->defaultPagingDRX = instance_p->default_drx;
if (instance_p->eNB_name != NULL) {
s1SetupRequest_p->presenceMask |= S1AP_S1SETUPREQUESTIES_ENBNAME_PRESENT;
OCTET_STRING_fromBuf(&s1SetupRequest_p->eNBname, instance_p->eNB_name,
/* optional */
if (instance_p->eNB_name) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNBname;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_ENBname;
OCTET_STRING_fromBuf(&ie->value.choice.ENBname, instance_p->eNB_name,
strlen(instance_p->eNB_name));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
if (s1ap_eNB_encode_pdu(&message, &buffer, &len) < 0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs;
ta = (S1AP_SupportedTAs_Item_t *)calloc(1, sizeof(S1AP_SupportedTAs_Item_t));
INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC);
plmn = (S1AP_PLMNidentity_t *)calloc(1, sizeof(S1AP_PLMNidentity_t));
MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn);
ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn);
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX;
ie->value.choice.PagingDRX = instance_p->default_drx;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CSG_IdList;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_CSG_IdList;
// ie->value.choice.CSG_IdList = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* optional */
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation ;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_UE_RetentionInformation;
// ie->value.choice.UE_RetentionInformation = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* optional */
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_NB_IoT_DefaultPagingDRX;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_NB_IoT_DefaultPagingDRX;
// ie->value.choice.NB_IoT_DefaultPagingDRX = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
S1AP_ERROR("Failed to encode S1 setup request\n");
return -1;
}
/* Non UE-Associated signalling -> stream = 0 */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
return ret;
}
@@ -20,8 +20,8 @@
*/
/*! \file s1ap_eNB_context_management_procedures.c
* \brief S1AP context management procedures
* \author S. Roux and Navid Nikaein
* \brief S1AP context management procedures
* \author S. Roux and Navid Nikaein
* \date 2010 - 2015
* \email: navid.nikaein@eurecom.fr
* \version 1.0
@@ -41,7 +41,6 @@
#include "s1ap_eNB_itti_messaging.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_encoder.h"
#include "s1ap_eNB_nnsf.h"
#include "s1ap_eNB_ue_context.h"
@@ -54,27 +53,22 @@
int s1ap_ue_context_release_complete(instance_t instance,
s1ap_ue_release_complete_t *ue_release_complete_p)
{
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
S1ap_UEContextReleaseCompleteIEs_t *ue_ctxt_release_complete_ies_p = NULL;
s1ap_message message;
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
S1AP_S1AP_PDU_t pdu;
S1AP_UEContextReleaseComplete_t *out;
S1AP_UEContextReleaseComplete_IEs_t *ie;
uint8_t *buffer;
uint32_t length;
int ret = -1;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(ue_release_complete_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
ue_context_p->ue_state);
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
ue_context_p->ue_state);
}*/
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
ue_release_complete_p->eNB_ue_s1ap_id)) == NULL) {
@@ -85,20 +79,62 @@ int s1ap_ue_context_release_complete(instance_t instance,
}
/* Prepare the S1AP message to encode */
memset(&message, 0, sizeof(s1ap_message));
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_UEContextRelease;
pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject;
pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete;
out = &pdu.choice.successfulOutcome.value.choice.UEContextReleaseComplete;
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
message.direction = S1AP_PDU_PR_successfulOutcome;
message.procedureCode = S1ap_ProcedureCode_id_UEContextRelease;
//message.criticality = S1ap_Criticality_reject;
/* optional */
if (0) {
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CriticalityDiagnostics;
// ie->value.choice.CriticalityDiagnostics = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
ue_ctxt_release_complete_ies_p = &message.msg.s1ap_UEContextReleaseCompleteIEs;
/* release 12 */
if (0) {
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_UserLocationInformation;
// ie->value.choice.UserLocationInformation = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id;
ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
//ue_ctxt_release_complete_ies_p->criticalityDiagnostics
//ue_ctxt_release_complete_ies_p->presenceMask
/* release 13 */
if (0) {
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_InformationOnRecommendedCellsAndENBsForPaging;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_InformationOnRecommendedCellsAndENBsForPaging;
// ie->value.choice.InformationOnRecommendedCellsAndENBsForPaging = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CellIdentifierAndCELevelForCECapableUEs;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CellIdentifierAndCELevelForCECapableUEs;
// ie->value.choice.CellIdentifierAndCELevelForCECapableUEs = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
/* Encode procedure has failed... */
S1AP_ERROR("Failed to encode UE context release complete\n");
return -1;
@@ -113,18 +149,12 @@ int s1ap_ue_context_release_complete(instance_t instance,
0,0, //MSC_AS_TIME_ARGS(ctxt_pP),
ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID,
ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
//LG s1ap_eNB_itti_send_sctp_close_association(s1ap_eNB_instance_p->instance,
// ue_context_p->mme_ref->assoc_id);
// release UE context
struct s1ap_eNB_ue_context_s *ue_context2_p = NULL;
@@ -137,29 +167,28 @@ int s1ap_ue_context_release_complete(instance_t instance,
S1AP_WARN("Removing UE context eNB_ue_s1ap_id %u: did not find context\n",
ue_context_p->eNB_ue_s1ap_id);
}
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
ue_context_p->ue_state);
}*/
return ret;
/*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) {
S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n",
ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,
ue_context_p->ue_state);
}*/
return 0;
}
int s1ap_ue_context_release_req(instance_t instance,
s1ap_ue_release_req_t *ue_release_req_p)
{
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
S1ap_UEContextReleaseRequestIEs_t *ue_ctxt_release_request_ies_p = NULL;
s1ap_message message;
uint8_t *buffer = NULL;
uint32_t length;
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
S1AP_S1AP_PDU_t pdu;
S1AP_UEContextReleaseRequest_t *out;
S1AP_UEContextReleaseRequest_IEs_t *ie;
uint8_t *buffer = NULL;
uint32_t length;
/* Retrieve the S1AP eNB instance associated with Mod_id */
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
DevAssert(ue_release_req_p != NULL);
DevAssert(s1ap_eNB_instance_p != NULL);
@@ -172,50 +201,74 @@ int s1ap_ue_context_release_req(instance_t instance,
}
/* Prepare the S1AP message to encode */
memset(&message, 0, sizeof(s1ap_message));
message.direction = S1AP_PDU_PR_initiatingMessage;
message.procedureCode = S1ap_ProcedureCode_id_UEContextReleaseRequest;
//message.criticality = S1ap_Criticality_reject;
ue_ctxt_release_request_ies_p = &message.msg.s1ap_UEContextReleaseRequestIEs;
ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id;
ue_ctxt_release_request_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_UEContextReleaseRequest;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UEContextReleaseRequest;
out = &pdu.choice.initiatingMessage.value.choice.UEContextReleaseRequest;
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Cause;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_Cause;
switch (ue_release_req_p->cause) {
case S1AP_CAUSE_NOTHING:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_NOTHING;
break;
case S1AP_Cause_PR_radioNetwork:
ie->value.choice.Cause.present = S1AP_Cause_PR_radioNetwork;
ie->value.choice.Cause.choice.radioNetwork = ue_release_req_p->cause_value;
break;
case S1AP_CAUSE_RADIO_NETWORK:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_radioNetwork;
ue_ctxt_release_request_ies_p->cause.choice.radioNetwork = ue_release_req_p->cause_value;
break;
case S1AP_Cause_PR_transport:
ie->value.choice.Cause.present = S1AP_Cause_PR_transport;
ie->value.choice.Cause.choice.transport = ue_release_req_p->cause_value;
break;
case S1AP_CAUSE_TRANSPORT:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_transport;
ue_ctxt_release_request_ies_p->cause.choice.transport = ue_release_req_p->cause_value;
break;
case S1AP_Cause_PR_nas:
ie->value.choice.Cause.present = S1AP_Cause_PR_nas;
ie->value.choice.Cause.choice.nas = ue_release_req_p->cause_value;
break;
case S1AP_CAUSE_NAS:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_nas;
ue_ctxt_release_request_ies_p->cause.choice.nas = ue_release_req_p->cause_value;
break;
case S1AP_Cause_PR_protocol:
ie->value.choice.Cause.present = S1AP_Cause_PR_protocol;
ie->value.choice.Cause.choice.protocol = ue_release_req_p->cause_value;
break;
case S1AP_CAUSE_PROTOCOL:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_protocol;
ue_ctxt_release_request_ies_p->cause.choice.protocol = ue_release_req_p->cause_value;
break;
case S1AP_Cause_PR_misc:
ie->value.choice.Cause.present = S1AP_Cause_PR_misc;
ie->value.choice.Cause.choice.misc = ue_release_req_p->cause_value;
break;
case S1AP_CAUSE_MISC:
default:
ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_misc;
ue_ctxt_release_request_ies_p->cause.choice.misc = ue_release_req_p->cause_value;
break;
case S1AP_Cause_PR_NOTHING:
default:
ie->value.choice.Cause.present = S1AP_Cause_PR_NOTHING;
break;
}
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
if (0) {
ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t));
ie->id = S1AP_ProtocolIE_ID_id_GWContextReleaseIndication;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_GWContextReleaseIndication;
ie->value.choice.GWContextReleaseIndication = TRUE;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
/* Encode procedure has failed... */
S1AP_ERROR("Failed to encode UE context release complete\n");
return -1;
@@ -230,12 +283,10 @@ int s1ap_ue_context_release_req(instance_t instance,
0,0,//MSC_AS_TIME_ARGS(ctxt_pP),
ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID,
ue_ctxt_release_request_ies_p->mme_ue_s1ap_id);
/* UE associated signalling -> use the allocated stream */
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
length, ue_context_p->tx_stream);
return 0;
}
+138 -206
View File
@@ -34,235 +34,172 @@
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_decoder.h"
static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
S1ap_InitiatingMessage_t *initiating_p)
static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
{
int ret = -1;
MessageDef *message_p;
char *message_string = NULL;
size_t message_string_size;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
DevAssert(initiating_p != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case S1AP_ProcedureCode_id_downlinkNASTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_DOWNLINK_NAS_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_downlink_nas_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message_string = calloc(10000, sizeof(char));
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
s1ap_string_total_size = 0;
case S1AP_ProcedureCode_id_UEContextRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_context_release_command_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message->procedureCode = initiating_p->procedureCode;
message->criticality = initiating_p->criticality;
case S1AP_ProcedureCode_id_Paging:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_PAGING_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_paging_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_paging_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
S1AP_INFO("Paging initiating message\n");
free(res.buffer);
break;
switch(initiating_p->procedureCode) {
case S1ap_ProcedureCode_id_downlinkNASTransport:
ret = s1ap_decode_s1ap_downlinknastransporties(
&message->msg.s1ap_DownlinkNASTransportIEs,
&initiating_p->value);
s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp,
message_string,
message);
message_id = S1AP_DOWNLINK_NAS_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_downlink_nas_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
break;
case S1AP_ProcedureCode_id_E_RABSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABSetup initiating message\n");
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(
&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_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 S1AP_ProcedureCode_id_E_RABModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABModify initiating message\n");
break;
case S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_decode_s1ap_uecontextreleasecommandies(
&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_context_release_command_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
break;
case S1AP_ProcedureCode_id_E_RABRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_release_request_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("TODO E_RABRelease nitiating message\n");
break;
case S1ap_ProcedureCode_id_Paging:
ret = s1ap_decode_s1ap_pagingies(
&message->msg.s1ap_PagingIEs, &initiating_p->value);
s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_PAGING_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_paging_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_paging_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
S1AP_INFO("Paging initiating message\n");
free(message_string);
break;
case S1ap_ProcedureCode_id_E_RABSetup:
ret = s1ap_decode_s1ap_e_rabsetuprequesties(
&message->msg.s1ap_E_RABSetupRequestIEs, &initiating_p->value);
//s1ap_xer_print_s1ap_e_rabsetuprequest(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("E_RABSetup initiating message\n");
break;
case S1ap_ProcedureCode_id_E_RABModify:
ret = s1ap_decode_s1ap_e_rabmodifyrequesties(
&message->msg.s1ap_E_RABModifyRequestIEs, &initiating_p->value);
message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("E_RABModify initiating message\n");
break;
case S1ap_ProcedureCode_id_E_RABRelease:
ret = s1ap_decode_s1ap_e_rabreleasecommandies(
&message->msg.s1ap_E_RABReleaseCommandIEs, &initiating_p->value);
s1ap_xer_print_s1ap_e_rabreleasecommand(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP,
message_id,
message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_release_request_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("TODO E_RABRelease nitiating message\n");
break;
default:
S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)initiating_p->procedureCode);
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
(int)initiating_p->procedureCode);
return -1;
default:
S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
return -1;
}
return ret;
return 0;
}
static int s1ap_eNB_decode_successful_outcome(s1ap_message *message,
S1ap_SuccessfulOutcome_t *successfullOutcome_p)
static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
{
int ret = -1;
MessageDef *message_p;
char *message_string = NULL;
size_t message_string_size;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
DevAssert(successfullOutcome_p != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_S1_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message_string = malloc(sizeof(char) * 10000);
memset((void*)message_string,0,sizeof(char) * 10000);
s1ap_string_total_size = 0;
message->procedureCode = successfullOutcome_p->procedureCode;
message->criticality = successfullOutcome_p->criticality;
switch(successfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setupresponseies(
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, message);
message_id = S1AP_S1_SETUP_LOG;
break;
default:
S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
(int)successfullOutcome_p->procedureCode);
return -1;
default:
S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome.procedureCode);
return -1;
}
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
return ret;
return 0;
}
static int s1ap_eNB_decode_unsuccessful_outcome(s1ap_message *message,
S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
{
int ret = -1;
DevAssert(unSuccessfullOutcome_p != NULL);
MessageDef *message_p;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
message->criticality = unSuccessfullOutcome_p->criticality;
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_S1_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
switch(unSuccessfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
return s1ap_decode_s1ap_s1setupfailureies(
&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
default:
S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)unSuccessfullOutcome_p->procedureCode);
break;
default:
S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
return -1;
}
return ret;
return 0;
}
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
const uint32_t length)
{
S1AP_PDU_t pdu;
S1AP_PDU_t *pdu_p = &pdu;
asn_dec_rval_t dec_ret;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
memset((void *)pdu_p, 0, sizeof(S1AP_PDU_t));
dec_ret = aper_decode(NULL,
&asn_DEF_S1AP_PDU,
(void **)&pdu_p,
&asn_DEF_S1AP_S1AP_PDU,
(void **)pdu,
buffer,
length,
0,
@@ -273,24 +210,19 @@ int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
return -1;
}
message->direction = pdu_p->present;
switch(pdu->present) {
case S1AP_S1AP_PDU_PR_initiatingMessage:
return s1ap_eNB_decode_initiating_message(pdu);
switch(pdu_p->present) {
case S1AP_PDU_PR_initiatingMessage:
return s1ap_eNB_decode_initiating_message(message,
&pdu_p->choice.initiatingMessage);
case S1AP_S1AP_PDU_PR_successfulOutcome:
return s1ap_eNB_decode_successful_outcome(pdu);
case S1AP_PDU_PR_successfulOutcome:
return s1ap_eNB_decode_successful_outcome(message,
&pdu_p->choice.successfulOutcome);
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
return s1ap_eNB_decode_unsuccessful_outcome(pdu);
case S1AP_PDU_PR_unsuccessfulOutcome:
return s1ap_eNB_decode_unsuccessful_outcome(message,
&pdu_p->choice.unsuccessfulOutcome);
default:
S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present);
break;
default:
S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
+2 -2
View File
@@ -20,12 +20,12 @@
*/
#include <stdint.h>
#include "s1ap_ies_defs.h"
#ifndef S1AP_ENB_DECODER_H_
#define S1AP_ENB_DECODER_H_
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer,
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
const uint32_t length) __attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_DECODER_H_ */
+180 -544
View File
@@ -32,615 +32,251 @@
#include <stdint.h>
#include "assertions.h"
#include "conversions.h"
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_encoder.h"
static inline int s1ap_eNB_encode_initiating(s1ap_message *message,
static inline int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer,
uint32_t *len);
static inline int s1ap_eNB_encode_successfull_outcome(s1ap_message *message,
static inline int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len);
static inline int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *message,
static inline int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len);
static inline int s1ap_eNB_encode_s1_setup_request(
S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs, uint8_t **buffer, uint32_t *length);
static inline int s1ap_eNB_encode_trace_failure(S1ap_TraceFailureIndicationIEs_t
*trace_failure_ies_p, uint8_t **buffer,
uint32_t *length);
static inline int s1ap_eNB_encode_initial_ue_message(S1ap_InitialUEMessageIEs_t
*initialUEmessageIEs_p, uint8_t **buffer,
uint32_t *length);
static inline int s1ap_eNB_encode_uplink_nas_transport(S1ap_UplinkNASTransportIEs_t
*uplinkNASTransportIEs,
uint8_t **buffer,
uint32_t *length);
static inline int s1ap_eNB_encode_ue_capability_info_indication(
S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
uint8_t **buffer,
uint32_t *length);
static inline int s1ap_eNB_encode_initial_context_setup_response(
S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_nas_non_delivery(
S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_ue_context_release_complete(
S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_ue_context_release_request(
S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *E_RABSetupResponseIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *E_RABModifyResponseIEs,
uint8_t **buffer,
uint32_t *length);
static inline
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs,
uint8_t **buffer,
uint32_t *length);
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
DevAssert(message != NULL);
int ret = -1;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(len != NULL);
switch(message->direction) {
case S1AP_PDU_PR_initiatingMessage:
return s1ap_eNB_encode_initiating(message, buffer, len);
switch(pdu->present) {
case S1AP_S1AP_PDU_PR_initiatingMessage:
ret = s1ap_eNB_encode_initiating(pdu, buffer, len);
break;
case S1AP_PDU_PR_successfulOutcome:
return s1ap_eNB_encode_successfull_outcome(message, buffer, len);
case S1AP_S1AP_PDU_PR_successfulOutcome:
ret = s1ap_eNB_encode_successfull_outcome(pdu, buffer, len);
break;
case S1AP_PDU_PR_unsuccessfulOutcome:
return s1ap_eNB_encode_unsuccessfull_outcome(message, buffer, len);
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
ret = s1ap_eNB_encode_unsuccessfull_outcome(pdu, buffer, len);
break;
default:
S1AP_DEBUG("Unknown message outcome (%d) or not implemented",
(int)message->direction);
break;
default:
S1AP_DEBUG("Unknown message outcome (%d) or not implemented",
(int)pdu->present);
return -1;
}
return -1;
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, pdu);
return ret;
}
static inline
int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len)
{
int ret = -1;
MessageDef *message_p;
char *message_string = NULL;
size_t message_string_size;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
DevAssert(s1ap_message_p != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_S1_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message_string = calloc(10000, sizeof(char));
case S1AP_ProcedureCode_id_uplinkNASTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_UPLINK_NAS_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_uplink_nas_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
s1ap_string_total_size = 0;
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_UE_CAPABILITY_IND_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_capability_ind_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_ue_capability_ind_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
switch(s1ap_message_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_eNB_encode_s1_setup_request(
&s1ap_message_p->msg.s1ap_S1SetupRequestIEs, buffer, len);
s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_S1_SETUP_LOG;
break;
case S1AP_ProcedureCode_id_initialUEMessage:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_ue_message_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_initial_ue_message_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1ap_ProcedureCode_id_uplinkNASTransport:
ret = s1ap_eNB_encode_uplink_nas_transport(
&s1ap_message_p->msg.s1ap_UplinkNASTransportIEs, buffer, len);
s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_UPLINK_NAS_LOG;
break;
case S1AP_ProcedureCode_id_NASNonDeliveryIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
ret = s1ap_eNB_encode_ue_capability_info_indication(
&s1ap_message_p->msg.s1ap_UECapabilityInfoIndicationIEs, buffer, len);
s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_UE_CAPABILITY_IND_LOG;
break;
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_context_release_req_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_req_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1ap_ProcedureCode_id_initialUEMessage:
ret = s1ap_eNB_encode_initial_ue_message(
&s1ap_message_p->msg.s1ap_InitialUEMessageIEs, buffer, len);
s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
ret = s1ap_eNB_encode_nas_non_delivery(
&s1ap_message_p->msg.s1ap_NASNonDeliveryIndication_IEs, buffer, len);
s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp,
message_string, s1ap_message_p);
message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
ret = s1ap_eNB_encode_ue_context_release_request(
&s1ap_message_p->msg.s1ap_UEContextReleaseRequestIEs, buffer, len);
s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp,
message_string, s1ap_message_p);
message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
break;
default:
S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
(int)s1ap_message_p->procedureCode);
return ret;
break;
default:
S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode);
return -1;
}
message_string_size = strlen(message_string);
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
}
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
return ret;
memset(&res, 0, sizeof(res));
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline
int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len)
{
int ret = -1;
MessageDef *message_p;
char *message_string = NULL;
size_t message_string_size;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
DevAssert(s1ap_message_p != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message_string = calloc(10000, sizeof(char));
case S1AP_ProcedureCode_id_UEContextRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
s1ap_string_total_size = 0;
message_string_size = strlen(message_string);
case S1AP_ProcedureCode_id_E_RABSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABSetup successful message\n");
break;
case S1AP_ProcedureCode_id_E_RABModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABModify successful message\n");
break;
switch(s1ap_message_p->procedureCode) {
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_eNB_encode_initial_context_setup_response(
&s1ap_message_p->msg.s1ap_InitialContextSetupResponseIEs, buffer, len);
case S1AP_ProcedureCode_id_E_RABRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RAB Release successful message\n");
break;
s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_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 S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_eNB_encode_ue_context_release_complete(
&s1ap_message_p->msg.s1ap_UEContextReleaseCompleteIEs, buffer, len);
s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_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;
case S1ap_ProcedureCode_id_E_RABSetup:
ret = s1ap_eNB_encode_e_rab_setup_response (
&s1ap_message_p->msg.s1ap_E_RABSetupResponseIEs, buffer, len);
//s1ap_xer_print_s1ap_e_rabsetupresponse (s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG ;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("E_RABSetup successful message\n");
break;
case S1ap_ProcedureCode_id_E_RABModify:
ret = s1ap_eNB_encode_e_rab_modify_response (
&s1ap_message_p->msg.s1ap_E_RABModifyResponseIEs, buffer, len);
message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG ;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("E_RABModify successful message\n");
break;
case S1ap_ProcedureCode_id_E_RABRelease:
ret = s1ap_eNB_encode_e_rab_release_response (
&s1ap_message_p->msg.s1ap_E_RABReleaseResponseIEs, buffer, len);
s1ap_xer_print_s1ap_e_rabreleaseresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG ;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_e_rab_release_response_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
S1AP_INFO("E_RAB Release successful message\n");
break;
default:
S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
(int)s1ap_message_p->procedureCode);
return ret;
break;
default:
S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome.procedureCode);
return -1;
}
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
}
return ret;
memset(&res, 0, sizeof(res));
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
static inline
int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p,
int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len)
{
int ret = -1;
MessageDef *message_p;
char *message_string = NULL;
size_t message_string_size;
MessagesIds message_id;
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
DevAssert(s1ap_message_p != NULL);
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
message_string = calloc(10000, sizeof(char));
s1ap_string_total_size = 0;
switch(s1ap_message_p->procedureCode) {
case S1ap_ProcedureCode_id_InitialContextSetup:
// ret = s1ap_encode_s1ap_initialcontextsetupfailureies(
// &s1ap_message_p->ittiMsg.s1ap_InitialContextSetupFailureIEs, buffer, len);
s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, s1ap_message_p);
message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
break;
default:
S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)s1ap_message_p->procedureCode);
return ret;
break;
default:
S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)pdu->choice.unsuccessfulOutcome.procedureCode);
return -1;
}
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
memcpy(&message_p->ittiMsg.s1ap_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 s1ap_eNB_encode_ue_capability_info_indication(
S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_UECapabilityInfoIndication_t ueCapabilityInfoIndication;
S1ap_UECapabilityInfoIndication_t *ueCapabilityInfoIndication_p =
&ueCapabilityInfoIndication;
memset((void *)ueCapabilityInfoIndication_p, 0, sizeof(ueCapabilityInfoIndication));
if (s1ap_encode_s1ap_uecapabilityinfoindicationies(
ueCapabilityInfoIndication_p, ueCapabilityInfoIndicationIEs) < 0) {
return -1;
if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_UECapabilityInfoIndication,
S1ap_Criticality_ignore,
&asn_DEF_S1ap_UECapabilityInfoIndication,
ueCapabilityInfoIndication_p);
}
static inline
int s1ap_eNB_encode_uplink_nas_transport(
S1ap_UplinkNASTransportIEs_t *uplinkNASTransportIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_UplinkNASTransport_t uplinkNASTransport;
S1ap_UplinkNASTransport_t *uplinkNASTransport_p = &uplinkNASTransport;
memset((void *)uplinkNASTransport_p, 0, sizeof(uplinkNASTransport));
if (s1ap_encode_s1ap_uplinknastransporties(
uplinkNASTransport_p, uplinkNASTransportIEs) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_uplinkNASTransport,
S1ap_Criticality_ignore,
&asn_DEF_S1ap_UplinkNASTransport,
uplinkNASTransport_p);
}
static inline
int s1ap_eNB_encode_nas_non_delivery(
S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_NASNonDeliveryIndication_t nasNonDeliveryIndication;
S1ap_NASNonDeliveryIndication_t *nasNonDeliveryIndication_p = &nasNonDeliveryIndication;
memset((void *)nasNonDeliveryIndication_p, 0, sizeof(nasNonDeliveryIndication));
if (s1ap_encode_s1ap_nasnondeliveryindication_ies(
nasNonDeliveryIndication_p, nasNonDeliveryIndicationIEs) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_NASNonDeliveryIndication,
S1ap_Criticality_ignore,
&asn_DEF_S1ap_NASNonDeliveryIndication,
nasNonDeliveryIndication_p);
}
static inline
int s1ap_eNB_encode_s1_setup_request(
S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_S1SetupRequest_t s1SetupRequest;
S1ap_S1SetupRequest_t *s1SetupRequest_p = &s1SetupRequest;
memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest));
if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_S1Setup,
S1ap_Criticality_reject,
&asn_DEF_S1ap_S1SetupRequest,
s1SetupRequest_p);
}
static inline
int s1ap_eNB_encode_initial_ue_message(
S1ap_InitialUEMessageIEs_t *initialUEmessageIEs_p,
uint8_t **buffer,
uint32_t *length)
{
S1ap_InitialUEMessage_t initialUEMessage;
S1ap_InitialUEMessage_t *initialUEMessage_p = &initialUEMessage;
memset((void *)initialUEMessage_p, 0, sizeof(initialUEMessage));
if (s1ap_encode_s1ap_initialuemessageies(
initialUEMessage_p, initialUEmessageIEs_p) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_initialUEMessage,
S1ap_Criticality_ignore,
&asn_DEF_S1ap_InitialUEMessage,
initialUEMessage_p);
}
static inline
int s1ap_eNB_encode_trace_failure(
S1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p,
uint8_t **buffer,
uint32_t *length)
{
S1ap_TraceFailureIndication_t trace_failure;
S1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure;
memset((void *)trace_failure_p, 0, sizeof(trace_failure));
if (s1ap_encode_s1ap_tracefailureindicationies(
trace_failure_p, trace_failure_ies_p) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_TraceFailureIndication,
S1ap_Criticality_reject,
&asn_DEF_S1ap_TraceFailureIndication,
trace_failure_p);
}
static inline
int s1ap_eNB_encode_initial_context_setup_response(
S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_InitialContextSetupResponse_t initial_context_setup_response;
S1ap_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 (s1ap_encode_s1ap_initialcontextsetupresponseies(
initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) {
return -1;
}
return s1ap_generate_successfull_outcome(buffer,
length,
S1ap_ProcedureCode_id_InitialContextSetup,
S1ap_Criticality_reject,
&asn_DEF_S1ap_InitialContextSetupResponse,
initial_context_setup_response_p);
}
static inline
int s1ap_eNB_encode_ue_context_release_complete(
S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_UEContextReleaseComplete_t ue_context_release_complete;
S1ap_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 (s1ap_encode_s1ap_uecontextreleasecompleteies(
ue_context_release_complete_p, s1ap_UEContextReleaseCompleteIEs) < 0) {
return -1;
}
return s1ap_generate_successfull_outcome(buffer,
length,
S1ap_ProcedureCode_id_UEContextRelease,
S1ap_Criticality_reject,
&asn_DEF_S1ap_UEContextReleaseComplete,
ue_context_release_complete_p);
}
static inline
int s1ap_eNB_encode_ue_context_release_request(
S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_UEContextReleaseRequest_t ue_context_release_request;
S1ap_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 (s1ap_encode_s1ap_uecontextreleaserequesties(
ue_context_release_request_p, s1ap_UEContextReleaseRequestIEs) < 0) {
return -1;
}
return s1ap_generate_initiating_message(buffer,
length,
S1ap_ProcedureCode_id_UEContextReleaseRequest,
S1ap_Criticality_reject,
&asn_DEF_S1ap_UEContextReleaseRequest,
ue_context_release_request_p);
}
static inline
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *s1ap_E_RABSetupResponseIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_E_RABSetupResponse_t e_rab_setup_response;
S1ap_E_RABSetupResponse_t *e_rab_setup_response_p = &e_rab_setup_response;
memset((void *)e_rab_setup_response_p, 0,
sizeof(e_rab_setup_response));
if (s1ap_encode_s1ap_e_rabsetupresponseies (e_rab_setup_response_p, s1ap_E_RABSetupResponseIEs) < 0) {
return -1;
}
return s1ap_generate_successfull_outcome(buffer,
length,
S1ap_ProcedureCode_id_E_RABSetup,
S1ap_Criticality_reject,
&asn_DEF_S1ap_E_RABSetupResponse,
e_rab_setup_response_p);
}
static inline
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *s1ap_E_RABModifyResponseIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_E_RABModifyResponse_t e_rab_modify_response;
S1ap_E_RABModifyResponse_t *e_rab_modify_response_p = &e_rab_modify_response;
memset((void *)e_rab_modify_response_p, 0,
sizeof(e_rab_modify_response));
if (s1ap_encode_s1ap_e_rabmodifyresponseies (e_rab_modify_response_p, s1ap_E_RABModifyResponseIEs) < 0) {
return -1;
}
return s1ap_generate_successfull_outcome(buffer,
length,
S1ap_ProcedureCode_id_E_RABModify,
S1ap_Criticality_reject,
&asn_DEF_S1ap_E_RABModifyResponse,
e_rab_modify_response_p);
}
static inline
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs,
uint8_t **buffer,
uint32_t *length)
{
S1ap_E_RABReleaseResponse_t e_rab_release_response;
S1ap_E_RABReleaseResponse_t *e_rab_release_response_p = &e_rab_release_response;
memset((void *)e_rab_release_response_p, 0,
sizeof(e_rab_release_response));
if (s1ap_encode_s1ap_e_rabreleaseresponseies (e_rab_release_response_p, s1ap_E_RABReleaseResponseIEs) < 0) {
return -1;
}
return s1ap_generate_successfull_outcome(buffer,
length,
S1ap_ProcedureCode_id_E_RABRelease,
S1ap_Criticality_reject,
&asn_DEF_S1ap_E_RABReleaseResponse,
e_rab_release_response_p);
memset(&res, 0, sizeof(res));
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
*buffer = res.buffer;
*len = res.result.encoded;
return 0;
}
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef S1AP_ENB_ENCODER_H_
#define S1AP_ENB_ENCODER_H_
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_ENCODER_H_ */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -23,14 +23,14 @@
#define S1AP_ENB_NAS_PROCEDURES_H_
int s1ap_eNB_handle_nas_downlink(
const uint32_t assoc_id,
const uint32_t stream,
struct s1ap_message_s* message_p);
uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p);
void s1ap_eNB_nas_non_delivery_ind(instance_t instance,
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
int s1ap_eNB_handle_nas_first_req(
instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p);
@@ -45,8 +45,8 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p);
int s1ap_eNB_e_rab_modify_resp(instance_t instance,
s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
int s1ap_eNB_e_rab_release_resp(instance_t instance,
s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
#endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
+17 -23
View File
@@ -33,7 +33,6 @@
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB.h"
@@ -44,21 +43,20 @@
#include "assertions.h"
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1ap_OverloadStartIEs_t *overload_start_p;
s1ap_eNB_mme_data_t *mme_desc_p;
DevAssert(message_p != NULL);
overload_start_p = &message_p->msg.s1ap_OverloadStartIEs;
DevCheck(overload_start_p->overloadResponse.present ==
S1ap_OverloadResponse_PR_overloadAction,
S1ap_OverloadResponse_PR_overloadAction, 0, 0);
S1AP_OverloadStart_t *container;
S1AP_OverloadStartIEs_t *ie;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_OverloadResponse, TRUE);
DevCheck(ie->value.choice.OverloadResponse.present ==
S1AP_OverloadResponse_PR_overloadAction,
S1AP_OverloadResponse_PR_overloadAction, 0, 0);
/* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0);
@@ -72,24 +70,20 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
*/
mme_desc_p->state = S1AP_ENB_OVERLOAD;
mme_desc_p->overload_state =
overload_start_p->overloadResponse.choice.overloadAction;
ie->value.choice.OverloadResponse.choice.overloadAction;
return 0;
}
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
/* We received Overload stop message, meaning that the MME is no more
* overloaded. This is an empty message, with only message header and no
* Information Element.
*/
DevAssert(message_p != NULL);
DevAssert(pdu != NULL);
s1ap_eNB_mme_data_t *mme_desc_p;
/* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0);
+6 -6
View File
@@ -28,9 +28,9 @@
// int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
/**
* \brief Handle an overload stop message
@@ -38,8 +38,8 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
// int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
#endif /* S1AP_ENB_OVERLOAD_H_ */
+59 -43
View File
@@ -28,7 +28,6 @@
#include "s1ap_eNB_default_values.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB.h"
@@ -40,29 +39,50 @@
static
void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
S1ap_E_UTRAN_Trace_ID_t *trace_id,
S1ap_Cause_t *cause_p)
S1AP_E_UTRAN_Trace_ID_t *trace_id,
S1AP_Cause_t *cause_p)
{
s1ap_message message;
S1ap_TraceFailureIndicationIEs_t *trace_failure_p;
uint8_t *buffer;
uint32_t length;
S1AP_S1AP_PDU_t pdu;
S1AP_TraceFailureIndication_t *out;
S1AP_TraceFailureIndicationIEs_t *ie;
uint8_t *buffer = NULL;
uint32_t length;
DevAssert(ue_desc_p != NULL);
DevAssert(trace_id != NULL);
DevAssert(cause_p != NULL);
/* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication;
out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication;
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID;
memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Cause;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause;
memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
memset(&message, 0, sizeof(s1ap_message));
trace_failure_p = &message.msg.s1ap_TraceFailureIndicationIEs;
trace_failure_p->mme_ue_s1ap_id = ue_desc_p->mme_ue_s1ap_id;
trace_failure_p->eNB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
memcpy(&trace_failure_p->e_UTRAN_Trace_ID, trace_id, sizeof(S1ap_E_UTRAN_Trace_ID_t));
memcpy(&trace_failure_p->cause, cause_p, sizeof(S1ap_Cause_t));
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
return;
}
@@ -71,48 +91,44 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
length, ue_desc_p->tx_stream);
}
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu)
{
S1ap_TraceStartIEs_t *trace_start_p;
S1AP_TraceStart_t *container;
S1AP_TraceStartIEs_t *ie;
struct s1ap_eNB_ue_context_s *ue_desc_p;
struct s1ap_eNB_mme_data_s *mme_ref_p;
DevAssert(message_p != NULL);
trace_start_p = &message_p->msg.s1ap_TraceStartIEs;
DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.TraceStart;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE);
mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0);
DevAssert(mme_ref_p != NULL);
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
trace_start_p->eNB_UE_S1AP_ID)) == NULL) {
ie->value.choice.ENB_UE_S1AP_ID)) == NULL) {
/* Could not find context associated with this eNB_ue_s1ap_id -> generate
* trace failure indication.
*/
S1ap_E_UTRAN_Trace_ID_t trace_id;
S1ap_Cause_t cause;
memset(&trace_id, 0, sizeof(S1ap_E_UTRAN_Trace_ID_t));
memset(&cause, 0, sizeof(S1ap_Cause_t));
cause.present = S1ap_Cause_PR_radioNetwork;
cause.choice.radioNetwork = S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
S1AP_E_UTRAN_Trace_ID_t trace_id;
S1AP_Cause_t cause;
memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t));
memset(&cause, 0, sizeof(S1AP_Cause_t));
cause.present = S1AP_Cause_PR_radioNetwork;
cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
s1ap_eNB_generate_trace_failure(ue_desc_p, &trace_id, &cause);
}
return 0;
}
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p)
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *message_p)
{
// S1ap_DeactivateTraceIEs_t *deactivate_trace_p;
// S1AP_DeactivateTraceIEs_t *deactivate_trace_p;
//
// deactivate_trace_p = &message_p->msg.deactivateTraceIEs;
return 0;
}
+6 -6
View File
@@ -32,15 +32,15 @@
// int s1ap_eNB_handle_trace_start(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
// int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p,
// sctp_queue_item_t *packet_p,
// struct s1ap_message_s *message_p);
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream,
struct s1ap_message_s *message_p);
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream,
S1AP_S1AP_PDU_t *pdu);
#endif /* S1AP_ENB_TRACE_H_ */
+65 -66
View File
@@ -252,12 +252,11 @@ typedef enum {
typedef struct et_s1ap_s {
//et_s1ap_pdu_type_t pdu_type;
S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
S1AP_S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome
uint16_t xml_stream_pos_offset;
uint16_t binary_stream_pos;
uint16_t binary_stream_allocated_size;
uint8_t *binary_stream;
s1ap_message message; // decoded message: information elements
xmlDocPtr doc; // XML representation of the S1AP PDU
} et_s1ap_t;
@@ -300,9 +299,9 @@ typedef struct et_ip_s {
union {
struct in6_addr ipv6;
in_addr_t ipv4;
}address;
} address;
char str[INET6_ADDRSTRLEN+1];
}et_ip_t;
} et_ip_t;
typedef struct et_ip_hdr_s {
et_ip_t src;
@@ -325,7 +324,7 @@ typedef struct et_packet_s {
et_packet_status_t status;
long timer_id; // ITTI timer id for waiting rx packets
struct timeval timestamp_packet; // timestamp when rx or tx packet
}et_packet_t;
} et_packet_t;
typedef struct sctp_epoll_s {
@@ -401,23 +400,23 @@ typedef struct et_event_s {
inline void et_free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}};
//-------------------------
void et_free_packet(et_packet_t* packet);
void et_free_scenario(et_scenario_t* scenario);
void et_free_packet(et_packet_t *packet);
void et_free_scenario(et_scenario_t *scenario);
//-------------------------
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap);
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp);
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp);
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp);
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp);
void et_display_packet_ip(const et_ip_hdr_t * const ip);
void et_display_packet(const et_packet_t * const packet);
void et_display_scenario(const et_scenario_t * const scenario);
void et_display_packet_s1ap_data(const et_s1ap_t *const s1ap);
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp);
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp);
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp);
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp);
void et_display_packet_ip(const et_ip_hdr_t *const ip);
void et_display_packet(const et_packet_t *const packet);
void et_display_scenario(const et_scenario_t *const scenario);
//-------------------------
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p);
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p);
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length);
void et_decode_s1ap(et_s1ap_t * const s1ap);
int et_s1ap_decode_initiating_message(s1ap_message *message, S1AP_InitiatingMessage_t *initiating_p);
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1AP_SuccessfulOutcome_t *successfullOutcome_p);
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1AP_UnsuccessfulOutcome_t *unSuccessfullOutcome_p);
int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, s1ap_message *const message, const uint8_t *const buffer, const uint32_t length);
void et_decode_s1ap(et_s1ap_t *const s1ap);
//-------------------------
int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2);
uint32_t et_s1ap_generate_eNB_id(void);
@@ -427,32 +426,32 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet);
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
int et_scenario_set_packet_received(et_packet_t * const packet);
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind);
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind);
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet);
asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints);
et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind);
int et_scenario_set_packet_received(et_packet_t *const packet);
int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const sctp_data_ind);
void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind);
void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
net_ip_address_t *mme_ip_address,
net_ip_address_t *local_ip_addr,
uint16_t in_streams,
uint16_t out_streams);
net_ip_address_t *mme_ip_address,
net_ip_address_t *local_ip_addr,
uint16_t in_streams,
uint16_t out_streams);
void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown);
void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB);
void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
void * et_s1ap_eNB_task(void *arg);
void *et_s1ap_eNB_task(void *arg);
//-------------------------
int et_generate_xml_scenario(
const char const * xml_in_dir_name,
const char const * xml_in_scenario_filename,
const char const * enb_config_filename,
char const * tsml_out_scenario_filename);
const char const *xml_in_dir_name,
const char const *xml_in_scenario_filename,
const char const *enb_config_filename,
char const *tsml_out_scenario_filename);
//-------------------------
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b);
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b);
void et_scenario_wait_rx_packet(et_packet_t * const packet);
void et_scenario_schedule_tx_packet(et_packet_t * packet);
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b);
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b);
void et_scenario_wait_rx_packet(et_packet_t *const packet);
void et_scenario_schedule_tx_packet(et_packet_t *packet);
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event);
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event);
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event);
@@ -460,41 +459,41 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event);
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event);
//-------------------------
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap);
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr);
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr);
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr);
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr);
et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
et_scenario_t* et_generate_scenario(const char * const et_scenario_filename);
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t *const s1ap);
void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t *const sctp_hdr);
void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t *const sctp_hdr);
void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t *const sctp_hdr);
void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t *const sctp_hdr);
et_packet_t *et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node);
et_scenario_t *et_generate_scenario(const char *const et_scenario_filename);
//-------------------------
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints);
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id);
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id);
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id);
asn_comp_rval_t *et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message *const m1, s1ap_message *const m2, const uint32_t constraints);
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id);
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id);
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id);
//-------------------------
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints);
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints);
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints);
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints);
//------------------------------------------------------------------------------
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num);
int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP);
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num);
int et_is_file_exists ( const char const *file_nameP, const char const *file_roleP);
int et_strip_extension( char *in_filename);
void et_get_shift_arg( char * line_argument, shift_packet_t * const shift);
int et_split_path ( char * pathP, char *** resP);
void et_get_shift_arg( char *line_argument, shift_packet_t *const shift);
int et_split_path ( char *pathP, char *** resP);
void et_display_node ( xmlNodePtr node, unsigned int indent);
void et_display_tree ( xmlNodePtr node, unsigned int indent);
char * et_ip2ip_str(const et_ip_t * const ip);
int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip);
int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len);
sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str);
const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
const char * const et_error_match2str(const int err);
et_packet_action_t et_action_str2et_action_t(const xmlChar * const action);
void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip);
void et_enb_config_init(const char const * lib_config_file_name_pP);
char *et_ip2ip_str(const et_ip_t *const ip);
int et_compare_et_ip_to_net_ip_address(const et_ip_t *const ip, const net_ip_address_t *const net_ip);
int et_hex2data(unsigned char *const data, const unsigned char *const hexstring, const unsigned int len);
sctp_cid_t et_chunk_type_str2cid(const xmlChar *const chunk_type_str);
const char *const et_chunk_type_cid2str(const sctp_cid_t chunk_type);
const char *const et_error_match2str(const int err);
et_packet_action_t et_action_str2et_action_t(const xmlChar *const action);
void et_ip_str2et_ip(const xmlChar *const ip_str, et_ip_t *const ip);
void et_enb_config_init(const char const *lib_config_file_name_pP);
const Enb_properties_array_t *et_enb_config_get(void);
void et_eNB_app_register(const Enb_properties_array_t *enb_properties);
void *et_eNB_app_task(void *args_p);
int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts);
int et_play_scenario(et_scenario_t *const scenario, const struct shift_packet_s *shifts);
#endif /* PLAY_SCENARIO_H_ */
+7 -147
View File
@@ -29,140 +29,18 @@
#include "intertask_interface.h"
#include "platform_types.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_decoder.h"
#include "assertions.h"
#include "play_scenario.h"
//------------------------------------------------------------------------------
int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p)
{
int ret = -1;
DevAssert(initiating_p != NULL);
message->procedureCode = initiating_p->procedureCode;
message->criticality = initiating_p->criticality;
switch(initiating_p->procedureCode) {
case S1ap_ProcedureCode_id_downlinkNASTransport:
ret = s1ap_decode_s1ap_downlinknastransporties(&message->msg.s1ap_DownlinkNASTransportIEs,&initiating_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetuprequesties(&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_decode_s1ap_uecontextreleasecommandies(&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_Paging:
ret = s1ap_decode_s1ap_pagingies(&message->msg.s1ap_PagingIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_uplinkNASTransport:
ret = s1ap_decode_s1ap_uplinknastransporties (&message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_initialUEMessage:
ret = s1ap_decode_s1ap_initialuemessageies (&message->msg.s1ap_InitialUEMessageIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
ret = s1ap_decode_s1ap_uecontextreleaserequesties (&message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value);
break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value);
break;
default:
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
(int)initiating_p->procedureCode);
return -1;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p)
{
int ret = -1;
DevAssert(successfullOutcome_p != NULL);
message->procedureCode = successfullOutcome_p->procedureCode;
message->criticality = successfullOutcome_p->criticality;
switch(successfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setupresponseies(
&message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_UEContextRelease:
ret = s1ap_decode_s1ap_uecontextreleasecompleteies (&message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value);
break;
default:
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
(int)successfullOutcome_p->procedureCode);
return -1;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
{
int ret = -1;
DevAssert(unSuccessfullOutcome_p != NULL);
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
message->criticality = unSuccessfullOutcome_p->criticality;
switch(unSuccessfullOutcome_p->procedureCode) {
case S1ap_ProcedureCode_id_S1Setup:
ret = s1ap_decode_s1ap_s1setupfailureies(&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfullOutcome_p->value);
break;
default:
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)unSuccessfullOutcome_p->procedureCode);
break;
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length)
int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, const uint8_t *const buffer, const uint32_t length)
{
asn_dec_rval_t dec_ret;
DevAssert(buffer != NULL);
memset((void *)pdu, 0, sizeof(S1AP_PDU_t));
memset((void *)pdu, 0, sizeof(S1AP_S1AP_PDU_t));
dec_ret = aper_decode(NULL,
&asn_DEF_S1AP_PDU,
&asn_DEF_S1AP_S1AP_PDU,
(void **)&pdu,
buffer,
length,
@@ -174,32 +52,14 @@ int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, con
return -1;
}
message->direction = pdu->present;
switch(pdu->present) {
case S1AP_PDU_PR_initiatingMessage:
return et_s1ap_decode_initiating_message(message,
&pdu->choice.initiatingMessage);
case S1AP_PDU_PR_successfulOutcome:
return et_s1ap_decode_successful_outcome(message,
&pdu->choice.successfulOutcome);
case S1AP_PDU_PR_unsuccessfulOutcome:
return et_s1ap_decode_unsuccessful_outcome(message,
&pdu->choice.unsuccessfulOutcome);
default:
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)pdu->present);
break;
}
return -1;
return dec_ret.code;
}
//------------------------------------------------------------------------------
void et_decode_s1ap(et_s1ap_t * const s1ap)
void et_decode_s1ap(et_s1ap_t *const s1ap)
{
if (NULL != s1ap) {
if (et_s1ap_decode_pdu(&s1ap->pdu, &s1ap->message, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
if (et_s1ap_decode_pdu(&s1ap->pdu, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) {
AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__);
}
}
+127 -85
View File
@@ -32,11 +32,10 @@
#include "intertask_interface.h"
#include "platform_types.h"
#include "assertions.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_decoder.h"
#include "play_scenario.h"
//-----------------------------------------------------------------------------
void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num)
void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num)
{
unsigned long octet_index = 0;
@@ -82,11 +81,14 @@ void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned
void et_display_node(xmlNodePtr node, unsigned int indent)
{
int i = 0;
if (node->type == XML_ELEMENT_NODE) {
xmlChar *path = xmlGetNodePath(node);
for (i=0; i<indent; i++) {
printf(" ");
}
if (node->children != NULL && node->children->type == XML_TEXT_NODE) {
xmlChar *content = xmlNodeGetContent(node);
printf("%s -> %s\n", path, content);
@@ -94,6 +96,7 @@ void et_display_node(xmlNodePtr node, unsigned int indent)
} else {
printf("%s\n", path);
}
xmlFree(path);
}
}
@@ -106,70 +109,91 @@ void et_display_tree(xmlNodePtr node, unsigned int indent)
if (cur_node->type == XML_ELEMENT_NODE) {
et_display_node(cur_node, indent);
}
et_display_tree(cur_node->children, indent++);
}
}
//------------------------------------------------------------------------------
void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap)
void et_display_packet_S1AP_data(const et_S1AP_t *const s1ap)
{
char *message_string = NULL;
if (s1ap) {
message_string = calloc(20000, sizeof(char));
AssertFatal (NULL != message_string, "ERROR malloc()failed!\n");
s1ap_string_total_size = 0;
switch(s1ap->pdu.present) {
case S1AP_PDU_PR_initiatingMessage:
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
case S1ap_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
default:
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
}
break;
case S1AP_PDU_PR_successfulOutcome:
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
default:
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
}
break;
case S1AP_PDU_PR_unsuccessfulOutcome:
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break;
switch(s1ap->pdu.present) {
case S1AP_S1AP_PDU_PR_initiatingMessage:
switch(s1ap->pdu.choice.initiatingMessage.procedureCode) {
case S1AP_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
default:
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
(int)s1ap->pdu.choice.initiatingMessage.procedureCode);
}
break;
case S1AP_S1AP_PDU_PR_successfulOutcome:
switch(s1ap->pdu.choice.successfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
default:
AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n",
(int)s1ap->pdu.choice.successfulOutcome.procedureCode);
}
break;
case S1AP_S1AP_PDU_PR_unsuccessfulOutcome:
switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break;
default:
et_free_pointer(message_string);
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
break;
}
break;
default:
et_free_pointer(message_string);
AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n",
(int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode);
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
break;
}
break;
default:
AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present);
break;
}
fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string);
et_free_pointer(message_string);
}
}
//------------------------------------------------------------------------------
void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp)
{
if (sctp) {
fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag);
fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd);
@@ -179,9 +203,8 @@ void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp)
}
}
//------------------------------------------------------------------------------
void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp)
{
if (sctp) {
fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag);
fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd);
@@ -191,17 +214,20 @@ void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp)
}
}
//------------------------------------------------------------------------------
void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp)
{
if (sctp) {
fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn);
fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream);
fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn);
fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid);
if (sctp->ppid == 18) {
et_display_packet_s1ap_data(&sctp->payload);
}
fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size);
if (NULL != sctp->payload.binary_stream) {
fprintf(stdout, "\t\tSCTP.data.binary_stream :\n");
et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size);
@@ -212,29 +238,33 @@ void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp)
}
//------------------------------------------------------------------------------
void et_display_packet_sctp(const et_sctp_hdr_t * const sctp)
void et_display_packet_sctp(const et_sctp_hdr_t *const sctp)
{
if (sctp) {
fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port);
fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port);
fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type));
switch (sctp->chunk_type) {
case SCTP_CID_DATA:
et_display_packet_sctp_data(&sctp->u.data_hdr);
break;
case SCTP_CID_INIT:
et_display_packet_sctp_initack(&sctp->u.init_hdr);
break;
case SCTP_CID_INIT_ACK:
et_display_packet_sctp_initack(&sctp->u.init_ack_hdr);
break;
default:
;
}
}
}
//------------------------------------------------------------------------------
void et_display_packet_ip(const et_ip_hdr_t * const ip)
void et_display_packet_ip(const et_ip_hdr_t *const ip)
{
if (ip) {
fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src));
@@ -243,61 +273,73 @@ void et_display_packet_ip(const et_ip_hdr_t * const ip)
}
//------------------------------------------------------------------------------
void et_display_packet(const et_packet_t * const packet)
void et_display_packet(const et_packet_t *const packet)
{
if (packet) {
fprintf(stdout, "-------------------------------------------------------------------------------\n");
fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number);
fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n",
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec);
fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n",
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec);
fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n",
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec);
switch(packet->action) {
case ET_PACKET_ACTION_S1C_SEND:
fprintf(stdout, "\tPacket:\tAction SEND\n");
break;
case ET_PACKET_ACTION_S1C_RECEIVE:
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
break;
default:
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
case ET_PACKET_ACTION_S1C_SEND:
fprintf(stdout, "\tPacket:\tAction SEND\n");
break;
case ET_PACKET_ACTION_S1C_RECEIVE:
fprintf(stdout, "\tPacket:\tAction RECEIVE\n");
break;
default:
fprintf(stdout, "\tPacket:\tAction UNKNOWN\n");
}
switch(packet->status) {
case ET_PACKET_STATUS_NONE:
fprintf(stdout, "\tPacket:\tStatus NONE\n");
break;
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
break;
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
break;
case ET_PACKET_STATUS_SENT:
fprintf(stdout, "\tPacket:\tStatus SENT\n");
break;
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
break;
case ET_PACKET_STATUS_RECEIVED:
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
break;
default:
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
case ET_PACKET_STATUS_NONE:
fprintf(stdout, "\tPacket:\tStatus NONE\n");
break;
case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT:
fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n");
break;
case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING:
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n");
break;
case ET_PACKET_STATUS_SENT:
fprintf(stdout, "\tPacket:\tStatus SENT\n");
break;
case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING:
fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n");
break;
case ET_PACKET_STATUS_RECEIVED:
fprintf(stdout, "\tPacket:\tStatus RECEIVED\n");
break;
default:
fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n");
}
et_display_packet_ip(&packet->ip_hdr);
et_display_packet_sctp(&packet->sctp_hdr);
}
}
//------------------------------------------------------------------------------
void et_display_scenario(const et_scenario_t * const scenario)
void et_display_scenario(const et_scenario_t *const scenario)
{
et_packet_t *packet = NULL;
if (scenario) {
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char*)scenario->name:"UNKNOWN NAME");
fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char *)scenario->name:"UNKNOWN NAME");
packet = scenario->list_packet;
while (packet) {
et_display_packet(packet);
packet = packet->next;
+76 -48
View File
@@ -34,7 +34,6 @@
#include "platform_types.h"
#include "assertions.h"
#include "play_scenario.h"
#include "s1ap_ies_defs.h"
#include "play_scenario_s1ap_eNB_defs.h"
#include "timer.h"
@@ -47,7 +46,7 @@ et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL;
uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN;
//------------------------------------------------------------------------------
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b)
void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b)
{
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
@@ -55,6 +54,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000;
result->tv_sec = r / (long long int)1000000;
result->tv_usec = r % (long long int)1000000;
if ((result != a) && (result != b)) {
LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
}
@@ -63,7 +63,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a,
//------------------------------------------------------------------------------
// it is assumed that if a time is negative tv_sec and tv_usec are both negative
// return true if result is positive
int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b)
int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b)
{
AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n");
AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n");
@@ -71,26 +71,30 @@ int timeval_subtract (struct timeval * const result, struct timeval * const a, s
long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000;
result->tv_sec = r / (long long int)1000000;
result->tv_usec = r % (long long int)1000000;
if ((result != a) && (result != b)) {
LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec);
}
return (result->tv_sec >= 0) && (result->tv_usec >= 0);
}
//------------------------------------------------------------------------------
void et_scenario_wait_rx_packet(et_packet_t * const packet)
void et_scenario_wait_rx_packet(et_packet_t *const packet)
{
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING;
g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT;
if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,
packet, &packet->timer_id) < 0) {
packet, &packet->timer_id) < 0) {
AssertFatal(0, " Can not start waiting RX event timer\n");
}
g_scenario->timer_count++;
LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number);
}
//------------------------------------------------------------------------------
void et_scenario_schedule_tx_packet(et_packet_t * packet)
void et_scenario_schedule_tx_packet(et_packet_t *packet)
{
s1ap_eNB_instance_t *s1ap_eNB_instance = NULL;
struct timeval now = { .tv_sec = 0, .tv_usec = 0 };
@@ -101,11 +105,9 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
int last_packet_was_rx = 0;
int we_are_too_late = 0;
int original_frame_number = -1;
AssertFatal(NULL != packet, "packet argument is NULL");
s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance);
AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance);
LOG_D(ENB_APP, "%s\n", __FUNCTION__);
g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
@@ -118,8 +120,8 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet);
LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec);
LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec);
last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet);
if (last_packet_was_rx) {
LOG_D(ENB_APP, "last_packet_was_rx\n");
we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet);
@@ -129,30 +131,32 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet);
LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec);
}
if ((0 == we_are_too_late) && (0 == g_max_speed)){
if ((0 == we_are_too_late) && (0 == g_max_speed)) {
// set timer
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)){
if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)) {
offset.tv_sec = -offset.tv_sec;
offset.tv_usec = -offset.tv_usec;
}
LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n",
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec);
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING;
if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) {
AssertFatal(0, " Can not start TX event timer\n");
}
g_scenario->timer_count++;
// Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT;
} else {
// send immediately
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
original_frame_number = packet->original_frame_number;
do {
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
et_s1ap_eNB_itti_send_sctp_data_req(
packet->enb_instance,
@@ -164,13 +168,17 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
g_scenario->next_packet = g_scenario->next_packet->next;
packet = packet->next;
} while ((NULL != packet) && (packet->original_frame_number == original_frame_number));
g_fsm_state = ET_FSM_STATE_RUNNING;
}
break;
case SCTP_CID_INIT:
case SCTP_CID_INIT_ACK:
AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK");
break;
default:
AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type);
}
@@ -178,23 +186,22 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet)
//------------------------------------------------------------------------------
et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
{
switch (event.code){
switch (event.code) {
case ET_EVENT_TICK:
while (NULL != g_scenario->next_packet) {
LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number);
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
case SCTP_CID_DATA :
// no init in this scenario, may be sub-scenario
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
et_scenario_schedule_tx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
et_event_t continue_event;
continue_event.code = ET_EVENT_TICK;
et_scenario_fsm_notify_event(continue_event);
return g_fsm_state;
} else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) {
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
@@ -202,7 +209,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->next_packet = g_scenario->next_packet->next;
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
et_scenario_wait_rx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
@@ -213,6 +219,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
} else {
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
}
break;
case SCTP_CID_INIT:
@@ -224,8 +231,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
case SCTP_CID_ECN_ECNE:
case SCTP_CID_ECN_CWR:
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
g_scenario->next_packet = g_scenario->next_packet->next;
break;
@@ -236,20 +243,22 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
case SCTP_CID_ERROR:
case SCTP_CID_SHUTDOWN_COMPLETE:
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
break;
default:
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
g_scenario->next_packet = g_scenario->next_packet->next;
}
}
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
g_fsm_state = ET_FSM_STATE_NULL;
pthread_mutex_unlock(&g_fsm_lock);
if (0 == g_scenario->timer_count) {
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
fflush(stderr);
@@ -257,21 +266,27 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
return 0;
//exit(0);
}
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
return g_fsm_state;
break;
case ET_EVENT_RX_PACKET_TIME_OUT:
AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING");
break;
case ET_EVENT_TX_TIMED_PACKET:
AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING");
break;
case ET_EVENT_RX_S1AP:
et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
break;
default:
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code);
}
pthread_mutex_unlock(&g_fsm_lock);
return 0;
}
@@ -283,7 +298,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
int original_frame_number = -1;
et_packet_t *packet = NULL;
switch (event.code){
switch (event.code) {
case ET_EVENT_TICK:
fprintf(stdout, "EVENT_TICK: waiting for tx event\n");
break;
@@ -296,23 +311,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
// send immediately
packet = event.u.tx_timed_packet;
AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed");
original_frame_number = packet->original_frame_number;
do {
g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec;
g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec;
LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number);
et_s1ap_eNB_itti_send_sctp_data_req(
packet->enb_instance,
packet->sctp_hdr.u.data_hdr.assoc_id,
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
packet->sctp_hdr.u.data_hdr.stream);
packet->enb_instance,
packet->sctp_hdr.u.data_hdr.assoc_id,
packet->sctp_hdr.u.data_hdr.payload.binary_stream,
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
packet->sctp_hdr.u.data_hdr.stream);
packet->status = ET_PACKET_STATUS_SENT;
packet = packet->next;
g_scenario->next_packet = packet;
} while ( (NULL != packet) && (packet->original_frame_number == original_frame_number));
g_fsm_state = ET_FSM_STATE_RUNNING;
break;
@@ -320,6 +335,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
default:
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code);
}
pthread_mutex_unlock(&g_fsm_lock);
return 0;
}
@@ -328,7 +344,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
{
int rv = 0;
switch (event.code){
switch (event.code) {
case ET_EVENT_TICK:
fprintf(stdout, "EVENT_TICK: waiting for rx event\n");
break;
@@ -341,16 +358,19 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
case ET_EVENT_RX_S1AP:
rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind);
// waited packet
if (rv == 0) {
g_fsm_state = ET_FSM_STATE_RUNNING;
}
break;
case ET_EVENT_TX_TIMED_PACKET:
default:
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code);
}
pthread_mutex_unlock(&g_fsm_lock);
return 0;
}
@@ -358,8 +378,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event)
//------------------------------------------------------------------------------
et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event)
{
switch (event.code){
switch (event.code) {
case ET_EVENT_TICK:
break;
@@ -370,22 +389,20 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
while (NULL != g_scenario->next_packet) {
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
case SCTP_CID_DATA :
// no init in this scenario, may be sub-scenario
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
et_scenario_schedule_tx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
et_event_t continue_event;
continue_event.code = ET_EVENT_TICK;
et_scenario_fsm_notify_event(continue_event);
return g_fsm_state;
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = g_scenario->next_packet;
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
et_scenario_wait_rx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
@@ -396,7 +413,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
} else {
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
}
break;
break;
case SCTP_CID_INIT:
case SCTP_CID_INIT_ACK:
@@ -416,7 +434,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
case SCTP_CID_ERROR:
case SCTP_CID_SHUTDOWN_COMPLETE:
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
break;
default:
@@ -424,15 +442,18 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
g_scenario->next_packet = g_scenario->next_packet->next;
}
}
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
g_fsm_state = ET_FSM_STATE_NULL;
pthread_mutex_unlock(&g_fsm_lock);
if (0 == g_scenario->timer_count) {
fprintf(stderr, "End of scenario: %s\n", g_scenario->name);
fflush(stderr);
fflush(stdout);
exit(0);
}
fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count);
return g_fsm_state;
break;
@@ -440,13 +461,14 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
default:
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code);
}
pthread_mutex_unlock(&g_fsm_lock);
return 0;
}
//------------------------------------------------------------------------------
et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
{
switch (event.code){
switch (event.code) {
case ET_EVENT_TICK:
break;
@@ -459,24 +481,21 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
while (NULL != g_scenario->next_packet) {
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
case SCTP_CID_DATA :
// no init in this scenario, may be sub-scenario, ...
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
et_scenario_schedule_tx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
et_event_t continue_event;
continue_event.code = ET_EVENT_TICK;
et_scenario_fsm_notify_event(continue_event);
return g_fsm_state;
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = g_scenario->next_packet;
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
et_scenario_wait_rx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
@@ -487,6 +506,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
} else {
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
}
break;
case SCTP_CID_INIT:
@@ -519,7 +539,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
case SCTP_CID_ERROR:
case SCTP_CID_SHUTDOWN_COMPLETE:
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
break;
default:
@@ -527,6 +547,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
g_scenario->next_packet = g_scenario->next_packet->next;
}
}
fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name);
g_fsm_state = ET_FSM_STATE_NULL;
pthread_mutex_unlock(&g_fsm_lock);
@@ -536,6 +557,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
default:
AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code);
}
return 0;
}
@@ -543,17 +565,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event)
{
AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code);
pthread_mutex_lock(&g_fsm_lock);
switch (g_fsm_state){
switch (g_fsm_state) {
case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break;
case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break;
case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break;
case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break;
case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break;
default:
AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state);
}
pthread_mutex_unlock(&g_fsm_lock);
return g_fsm_state;
}
File diff suppressed because it is too large Load Diff
@@ -56,402 +56,11 @@ extern et_scenario_t *g_scenario;
extern uint32_t g_constraints;
//------------------------------------------------------------------------------
asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
{
asn_comp_rval_t *ret = NULL;
AssertFatal(m1 != NULL, "bad parameter m1");
AssertFatal(m2 != NULL, "bad parameter m2");
AssertFatal((present == S1AP_PDU_PR_initiatingMessage) ||
(present == S1AP_PDU_PR_successfulOutcome) ||
(present == S1AP_PDU_PR_unsuccessfulOutcome) , "Bad parameter S1AP_PDU_PR present ");
AssertFatal( m1->procedureCode == m2->procedureCode, "Bad parameters: no matching procedure codes");
//asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints)
//{
//}
// some cases can never occur since uplink only.
switch (m1->procedureCode) {
case S1ap_ProcedureCode_id_HandoverPreparation:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_handoverrequiredies(
&m1->msg.s1ap_HandoverRequiredIEs,
&m2->msg.s1ap_HandoverRequiredIEs);
} else {
ret = s1ap_compare_s1ap_handovercommandies(
&m1->msg.s1ap_HandoverCommandIEs,
&m2->msg.s1ap_HandoverCommandIEs);
}
break;
case S1ap_ProcedureCode_id_HandoverResourceAllocation:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_handoverrequesties(
&m1->msg.s1ap_HandoverRequestIEs,
&m2->msg.s1ap_HandoverRequestIEs);
} else if (present == S1AP_PDU_PR_successfulOutcome) {
ret = s1ap_compare_s1ap_handoverrequestacknowledgeies(
&m1->msg.s1ap_HandoverRequestAcknowledgeIEs,
&m2->msg.s1ap_HandoverRequestAcknowledgeIEs);
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
ret = s1ap_compare_s1ap_handoverfailureies(
&m1->msg.s1ap_HandoverFailureIEs,
&m2->msg.s1ap_HandoverFailureIEs);
}
break;
case S1ap_ProcedureCode_id_HandoverNotification:
ret = s1ap_compare_s1ap_handovernotifyies(
&m1->msg.s1ap_HandoverNotifyIEs,
&m2->msg.s1ap_HandoverNotifyIEs);
break;
case S1ap_ProcedureCode_id_PathSwitchRequest:
ret = s1ap_compare_s1ap_pathswitchrequesties(
&m1->msg.s1ap_PathSwitchRequestIEs,
&m2->msg.s1ap_PathSwitchRequestIEs);
break;
case S1ap_ProcedureCode_id_HandoverCancel:
ret = s1ap_compare_s1ap_handovercancelies(
&m1->msg.s1ap_HandoverCancelIEs,
&m2->msg.s1ap_HandoverCancelIEs);
break;
case S1ap_ProcedureCode_id_E_RABSetup:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_e_rabsetuprequesties(
&m1->msg.s1ap_E_RABSetupRequestIEs,
&m2->msg.s1ap_E_RABSetupRequestIEs);
} else {
ret = s1ap_compare_s1ap_e_rabsetupresponseies(
&m1->msg.s1ap_E_RABSetupResponseIEs,
&m2->msg.s1ap_E_RABSetupResponseIEs);
}
break;
case S1ap_ProcedureCode_id_E_RABModify:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_e_rabmodifyrequesties(
&m1->msg.s1ap_E_RABModifyRequestIEs,
&m2->msg.s1ap_E_RABModifyRequestIEs);
} else {
ret = s1ap_compare_s1ap_e_rabmodifyresponseies(
&m1->msg.s1ap_E_RABModifyResponseIEs,
&m2->msg.s1ap_E_RABModifyResponseIEs);
}
break;
case S1ap_ProcedureCode_id_E_RABRelease:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_e_rabreleasecommandies(
&m1->msg.s1ap_E_RABReleaseCommandIEs,
&m2->msg.s1ap_E_RABReleaseCommandIEs);
} else {
ret = s1ap_compare_s1ap_e_rabreleaseresponseies(
&m1->msg.s1ap_E_RABReleaseResponseIEs,
&m2->msg.s1ap_E_RABReleaseResponseIEs);
}
break;
case S1ap_ProcedureCode_id_E_RABReleaseIndication:
ret = s1ap_compare_s1ap_e_rabreleaseindicationies(
&m1->msg.s1ap_E_RABReleaseIndicationIEs,
&m2->msg.s1ap_E_RABReleaseIndicationIEs);
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_initialcontextsetuprequesties(
&m1->msg.s1ap_InitialContextSetupRequestIEs,
&m2->msg.s1ap_InitialContextSetupRequestIEs);
} else {
ret = s1ap_compare_s1ap_initialcontextsetupresponseies(
&m1->msg.s1ap_InitialContextSetupResponseIEs,
&m2->msg.s1ap_InitialContextSetupResponseIEs);
}
break;
case S1ap_ProcedureCode_id_Paging:
ret = s1ap_compare_s1ap_pagingies(
&m1->msg.s1ap_PagingIEs,
&m2->msg.s1ap_PagingIEs);
break;
case S1ap_ProcedureCode_id_downlinkNASTransport:
ret = s1ap_compare_s1ap_downlinknastransporties(
&m1->msg.s1ap_DownlinkNASTransportIEs,
&m2->msg.s1ap_DownlinkNASTransportIEs);
break;
case S1ap_ProcedureCode_id_initialUEMessage:
ret = s1ap_compare_s1ap_initialuemessageies(
&m1->msg.s1ap_InitialUEMessageIEs,
&m2->msg.s1ap_InitialUEMessageIEs);
break;
case S1ap_ProcedureCode_id_uplinkNASTransport:
ret = s1ap_compare_s1ap_uplinknastransporties(
&m1->msg.s1ap_UplinkNASTransportIEs,
&m2->msg.s1ap_UplinkNASTransportIEs);
break;
case S1ap_ProcedureCode_id_Reset:
ret = s1ap_compare_s1ap_reseties(
&m1->msg.s1ap_ResetIEs,
&m2->msg.s1ap_ResetIEs);
break;
case S1ap_ProcedureCode_id_ErrorIndication:
ret = s1ap_compare_s1ap_errorindicationies(
&m1->msg.s1ap_ErrorIndicationIEs,
&m2->msg.s1ap_ErrorIndicationIEs);
break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
ret = s1ap_compare_s1ap_nasnondeliveryindication_ies(
&m1->msg.s1ap_NASNonDeliveryIndication_IEs,
&m2->msg.s1ap_NASNonDeliveryIndication_IEs);
break;
case S1ap_ProcedureCode_id_S1Setup:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_s1setuprequesties(
&m1->msg.s1ap_S1SetupRequestIEs,
&m2->msg.s1ap_S1SetupRequestIEs);
} else if (present == S1AP_PDU_PR_successfulOutcome) {
ret = s1ap_compare_s1ap_s1setupresponseies(
&m1->msg.s1ap_S1SetupResponseIEs,
&m2->msg.s1ap_S1SetupResponseIEs);
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
ret = s1ap_compare_s1ap_s1setupfailureies(
&m1->msg.s1ap_S1SetupFailureIEs,
&m2->msg.s1ap_S1SetupFailureIEs);
}
break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
ret = s1ap_compare_s1ap_uecontextreleaserequesties(
&m1->msg.s1ap_UEContextReleaseRequestIEs,
&m2->msg.s1ap_UEContextReleaseRequestIEs);
break;
case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling:
ret = s1ap_compare_s1ap_downlinks1cdma2000tunnelingies(
&m1->msg.s1ap_DownlinkS1cdma2000tunnelingIEs,
&m2->msg.s1ap_DownlinkS1cdma2000tunnelingIEs);
break;
case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling:
ret = s1ap_compare_s1ap_uplinks1cdma2000tunnelingies(
&m1->msg.s1ap_UplinkS1cdma2000tunnelingIEs,
&m2->msg.s1ap_UplinkS1cdma2000tunnelingIEs);
break;
case S1ap_ProcedureCode_id_UEContextModification:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_uecontextmodificationrequesties(
&m1->msg.s1ap_UEContextModificationRequestIEs,
&m2->msg.s1ap_UEContextModificationRequestIEs);
} else if (present == S1AP_PDU_PR_successfulOutcome) {
ret = s1ap_compare_s1ap_uecontextmodificationresponseies(
&m1->msg.s1ap_UEContextModificationResponseIEs,
&m2->msg.s1ap_UEContextModificationResponseIEs);
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
ret = s1ap_compare_s1ap_uecontextmodificationfailureies(
&m1->msg.s1ap_UEContextModificationFailureIEs,
&m2->msg.s1ap_UEContextModificationFailureIEs);
}
break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
ret = s1ap_compare_s1ap_uecapabilityinfoindicationies(
&m1->msg.s1ap_UECapabilityInfoIndicationIEs,
&m2->msg.s1ap_UECapabilityInfoIndicationIEs);
break;
case S1ap_ProcedureCode_id_UEContextRelease:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_uecontextreleasecommandies(
&m1->msg.s1ap_UEContextReleaseCommandIEs,
&m2->msg.s1ap_UEContextReleaseCommandIEs);
} else {
ret = s1ap_compare_s1ap_uecontextreleasecompleteies(
&m1->msg.s1ap_UEContextReleaseCompleteIEs,
&m2->msg.s1ap_UEContextReleaseCompleteIEs);
}
break;
case S1ap_ProcedureCode_id_eNBStatusTransfer:
ret = s1ap_compare_s1ap_enbstatustransferies(
&m1->msg.s1ap_ENBStatusTransferIEs,
&m2->msg.s1ap_ENBStatusTransferIEs);
break;
case S1ap_ProcedureCode_id_MMEStatusTransfer:
ret = s1ap_compare_s1ap_mmestatustransferies(
&m1->msg.s1ap_MMEStatusTransferIEs,
&m2->msg.s1ap_MMEStatusTransferIEs);
break;
case S1ap_ProcedureCode_id_DeactivateTrace:
ret = s1ap_compare_s1ap_deactivatetraceies(
&m1->msg.s1ap_DeactivateTraceIEs,
&m2->msg.s1ap_DeactivateTraceIEs);
break;
case S1ap_ProcedureCode_id_TraceStart:
ret = s1ap_compare_s1ap_tracestarties(
&m1->msg.s1ap_TraceStartIEs,
&m2->msg.s1ap_TraceStartIEs);
break;
case S1ap_ProcedureCode_id_TraceFailureIndication:
ret = s1ap_compare_s1ap_tracefailureindicationies(
&m1->msg.s1ap_TraceFailureIndicationIEs,
&m2->msg.s1ap_TraceFailureIndicationIEs);
break;
case S1ap_ProcedureCode_id_ENBConfigurationUpdate:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_enbconfigurationupdateies(
&m1->msg.s1ap_ENBConfigurationUpdateIEs,
&m2->msg.s1ap_ENBConfigurationUpdateIEs);
} else if (present == S1AP_PDU_PR_successfulOutcome) {
ret = s1ap_compare_s1ap_enbconfigurationupdateacknowledgeies(
&m1->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs,
&m2->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs);
} else {
ret = s1ap_compare_s1ap_enbconfigurationupdatefailureies(
&m1->msg.s1ap_ENBConfigurationUpdateFailureIEs,
&m2->msg.s1ap_ENBConfigurationUpdateFailureIEs);
}
break;
case S1ap_ProcedureCode_id_MMEConfigurationUpdate:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_mmeconfigurationupdateies(
&m1->msg.s1ap_MMEConfigurationUpdateIEs,
&m2->msg.s1ap_MMEConfigurationUpdateIEs);
} else if (present == S1AP_PDU_PR_successfulOutcome) {
ret = s1ap_compare_s1ap_mmeconfigurationupdateacknowledgeies(
&m1->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs,
&m2->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs);
} else {
ret = s1ap_compare_s1ap_mmeconfigurationupdatefailureies(
&m1->msg.s1ap_MMEConfigurationUpdateFailureIEs,
&m2->msg.s1ap_MMEConfigurationUpdateFailureIEs);
}
break;
case S1ap_ProcedureCode_id_LocationReportingControl:
ret = s1ap_compare_s1ap_locationreportingcontrolies(
&m1->msg.s1ap_LocationReportingControlIEs,
&m2->msg.s1ap_LocationReportingControlIEs);
break;
case S1ap_ProcedureCode_id_LocationReportingFailureIndication:
ret = s1ap_compare_s1ap_locationreportingfailureindicationies(
&m1->msg.s1ap_LocationReportingFailureIndicationIEs,
&m2->msg.s1ap_LocationReportingFailureIndicationIEs);
break;
case S1ap_ProcedureCode_id_LocationReport:
ret = s1ap_compare_s1ap_locationreporties(
&m1->msg.s1ap_LocationReportIEs,
&m2->msg.s1ap_LocationReportIEs);
break;
case S1ap_ProcedureCode_id_OverloadStart:
ret = s1ap_compare_s1ap_overloadstarties(
&m1->msg.s1ap_OverloadStartIEs,
&m2->msg.s1ap_OverloadStartIEs);
break;
case S1ap_ProcedureCode_id_OverloadStop:
ret = s1ap_compare_s1ap_overloadstopies(
&m1->msg.s1ap_OverloadStopIEs,
&m2->msg.s1ap_OverloadStopIEs);
break;
case S1ap_ProcedureCode_id_WriteReplaceWarning:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_writereplacewarningrequesties(
&m1->msg.s1ap_WriteReplaceWarningRequestIEs,
&m2->msg.s1ap_WriteReplaceWarningRequestIEs);
} else {
ret = s1ap_compare_s1ap_writereplacewarningresponseies(
&m1->msg.s1ap_WriteReplaceWarningResponseIEs,
&m2->msg.s1ap_WriteReplaceWarningResponseIEs);
}
break;
case S1ap_ProcedureCode_id_eNBDirectInformationTransfer:
ret = s1ap_compare_s1ap_enbdirectinformationtransferies(
&m1->msg.s1ap_ENBDirectInformationTransferIEs,
&m2->msg.s1ap_ENBDirectInformationTransferIEs);
break;
case S1ap_ProcedureCode_id_MMEDirectInformationTransfer:
ret = s1ap_compare_s1ap_mmedirectinformationtransferies(
&m1->msg.s1ap_MMEDirectInformationTransferIEs,
&m2->msg.s1ap_MMEDirectInformationTransferIEs);
break;
case S1ap_ProcedureCode_id_PrivateMessage:
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
AssertFatal(0, "TODO");
break;
case S1ap_ProcedureCode_id_CellTrafficTrace:
ret = s1ap_compare_s1ap_celltraffictraceies(
&m1->msg.s1ap_CellTrafficTraceIEs,
&m2->msg.s1ap_CellTrafficTraceIEs);
break;
case S1ap_ProcedureCode_id_Kill:
if (present == S1AP_PDU_PR_initiatingMessage) {
ret = s1ap_compare_s1ap_killrequesties(
&m1->msg.s1ap_KillRequestIEs,
&m2->msg.s1ap_KillRequestIEs);
} else {
ret = s1ap_compare_s1ap_killresponseies(
&m1->msg.s1ap_KillResponseIEs,
&m2->msg.s1ap_KillResponseIEs);
}
break;
case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport:
ret = s1ap_compare_s1ap_downlinkueassociatedlppatransport_ies(
&m1->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs,
&m2->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs);
break;
case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport:
ret = s1ap_compare_s1ap_uplinkueassociatedlppatransport_ies(
&m1->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs,
&m2->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs);
break;
case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport:
ret = s1ap_compare_s1ap_downlinknonueassociatedlppatransport_ies(
&m1->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs,
&m2->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs);
break;
case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport:
ret = s1ap_compare_s1ap_uplinknonueassociatedlppatransport_ies(
&m1->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs,
&m2->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs);
break;
default:
AssertFatal(0, "Unknown procedure code %ld", m1->procedureCode);
}
return ret;
}
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id)
void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id)
{
xmlNode *cur_node = NULL;
xmlAttrPtr attr = NULL;
@@ -464,24 +73,30 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
// modify
for (cur_node = (xmlNode *)node; cur_node; cur_node = cur_node->next) {
go_deeper_in_tree = 1;
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) {
// do not get hidden fields
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide");
if (NULL != xml_char) {
if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) {
go_deeper_in_tree = 0;
}
xmlFree(xml_char);
}
if (0 < go_deeper_in_tree) {
// first get size
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"pos");
if (NULL != xml_char) {
pos = strtoul((const char *)xml_char, NULL, 0);
pos -= s1ap->xml_stream_pos_offset;
AssertFatal(pos >= 0, "Bad pos %d xml_stream_pos_offset %d", pos, s1ap->xml_stream_pos_offset);
xmlFree(xml_char);
xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size");
if (NULL != xml_char) {
const xmlChar value_d[32];
const xmlChar value_h[20];
@@ -491,7 +106,6 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
unsigned long int uli = 0;
char hex[3] = {0,0,0};
char *end_ptr = NULL;
size = strtoul((const char *)xml_char, NULL, 0);
xmlFree(xml_char);
// second: try to set value (always hex)
@@ -501,12 +115,12 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
AssertFatal((ret > 0) && (ret < 20), "Could not convert int to hex str");
ret = snprintf((char *)showname, 64, "MME-UE-S1AP-ID: %d", new_id);
AssertFatal((ret > 0) && (ret < 64), "Could not convert int to dec str");
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"value", value_h);
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"show", value_d);
attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"showname", showname);
//TODO update s1ap->binary_stream @pos with new_id_hex, size
AssertFatal((pos+size) < s1ap->binary_stream_allocated_size, "Rewrite of mme_ue_s1ap_id out of bounds of binary_stream");
//avoid endianess issues
do {
hex[0] = value_h[pos2++];
@@ -517,6 +131,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno);
s1ap->binary_stream[pos++] = (unsigned char)uli;
} while (pos2 < (2*5));
// update ASN1
et_decode_s1ap(s1ap);
//S1AP_INFO("Updated ASN1 for %s\n", showname);
@@ -524,6 +139,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
}
}
}
if (0 < go_deeper_in_tree) {
update_xpath_node_mme_ue_s1ap_id(s1ap, cur_node->children, new_id);
}
@@ -538,12 +154,11 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con
* Prints the @nodes content to @output.
* From http://www.xmlsoft.org/examples/#xpath2.c
*/
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id)
void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id)
{
int size = 0;
int i = 0;
xmlNode *s1ap_node = NULL;
size = (nodes) ? nodes->nodeNr : 0;
//S1AP_DEBUG("%s() num nodes %u\n", __FUNCTION__, size);
@@ -559,6 +174,7 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe
s1ap_node = nodes->nodeTab[i];
AssertFatal(NULL != s1ap_node, "One element of resultset of XPATH expression is NULL\n");
update_xpath_node_mme_ue_s1ap_id(s1ap_payload, s1ap_node, new_id);
/*
* All the elements returned by an XPath query are pointers to
* elements from the tree *except* namespace nodes where the XPath
@@ -581,28 +197,24 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe
}
}
//------------------------------------------------------------------------------
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id)
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id)
{
xmlChar xpath_expression[ET_XPATH_EXPRESSION_MAX_LENGTH];
int ret = 0;
xmlDocPtr doc = NULL;
xmlXPathContextPtr xpath_ctx = NULL;
xmlXPathObjectPtr xpath_obj = NULL;
//S1AP_DEBUG("%s() packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number, old_id, new_id);
ret = snprintf(xpath_expression, ET_XPATH_EXPRESSION_MAX_LENGTH, "//field[@name=\"s1ap.MME_UE_S1AP_ID\"][@show=\"%u\"]", old_id);
AssertFatal((ret > 0) && (ret < ET_XPATH_EXPRESSION_MAX_LENGTH), "Could not build XPATH expression err=%d", ret);
doc = packet->sctp_hdr.u.data_hdr.payload.doc;
// Create xpath evaluation context
xpath_ctx = xmlXPathNewContext(doc);
if(xpath_ctx == NULL) {
fprintf(stderr,"Error: unable to create new XPath context\n");
xmlFreeDoc(doc);
return(-1);
fprintf(stderr,"Error: unable to create new XPath context\n");
xmlFreeDoc(doc);
return(-1);
}
// Evaluate xpath expression
@@ -610,17 +222,16 @@ int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_
xmlXPathFreeContext(xpath_ctx);
AssertFatal(xpath_obj != NULL, "Unable to evaluate XPATH expression \"%s\"\n", xpath_expression);
if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)){
if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)) {
xmlXPathFreeObject(xpath_obj);
S1AP_DEBUG("%s() No match \"%s\"packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n",
__FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id);
__FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id);
return -1;
}
// update selected nodes
update_xpath_nodes_mme_ue_s1ap_id(&packet->sctp_hdr.u.data_hdr.payload, xpath_obj->nodesetval, new_id);
// Cleanup of XPath data
xmlXPathFreeObject(xpath_obj);
return 0;
}
+21 -13
View File
@@ -36,22 +36,25 @@
#include "play_scenario.h"
//------------------------------------------------------------------------------
asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints)
{
asn_comp_rval_t *rv = NULL;
// no comparison for ports
if (sctp1->ppid != sctp2->ppid) {
if (sctp1->ppid != sctp2->ppid) {
S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID;
return rv;
}
if (sctp1->assoc_id != sctp2->assoc_id) {
S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID;
return rv;
}
if (sctp1->stream != sctp2->stream) {
if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) {
rv = calloc(1, sizeof(asn_comp_rval_t));
@@ -61,30 +64,33 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da
S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream);
}
}
// We do not have SSN from lower layers
// if (sctp1->ssn != sctp2->ssn) {
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
// rv = calloc(1, sizeof(asn_comp_rval_t));
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
// return rv;
// } else {
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
// }
// }
// if (sctp1->ssn != sctp2->ssn) {
// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) {
// rv = calloc(1, sizeof(asn_comp_rval_t));
// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN;
// return rv;
// } else {
// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn);
// }
// }
return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints);
}
//------------------------------------------------------------------------------
asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints)
asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints)
{
// no comparison for ports
asn_comp_rval_t *rv = NULL;
if (sctp1->chunk_type != sctp2->chunk_type){
if (sctp1->chunk_type != sctp2->chunk_type) {
S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type);
rv = calloc(1, sizeof(asn_comp_rval_t));
rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE;
return rv;
}
switch (sctp1->chunk_type) {
case SCTP_CID_DATA:
return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints);
@@ -93,9 +99,11 @@ asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_
case SCTP_CID_INIT:
AssertFatal(0, "Not needed now");
break;
case SCTP_CID_INIT_ACK:
AssertFatal(0, "Not needed now");
break;
default:
AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type);
}
-18
View File
@@ -35,7 +35,6 @@
#include "s1ap_common.h"
#include "s1ap_eNB.h"
#include "s1ap_mme.h"
#include "s1ap_ies_defs.h"
char ip_addr[] = "127.0.0.1";
@@ -60,13 +59,10 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
{
InitialUEMessageIEs initialUEmessageIEs;
InitialUEMessageIEs *initialUEmessageIEs_p = &initialUEmessageIEs;
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs));
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
initialUEmessageIEs.nas_pdu.buf = infoNAS;
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
initialUEmessageIEs.tai.tAC.buf = tac;
initialUEmessageIEs.tai.tAC.size = 2;
initialUEmessageIEs.tai.pLMNidentity.buf = identity;
@@ -76,9 +72,7 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer,
initialUEmessageIEs.eutran_cgi.cell_ID.buf = id;
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
}
@@ -95,13 +89,10 @@ int main(int argc, char *argv[])
asn_enc_rval_t retVal;
uint8_t *buffer;
uint32_t len;
SupportedTAs_Item_t ta;
PLMNidentity_t plmnIdentity;
asn_debug = 0;
asn1_xer_print = 0;
S1SetupRequestIEs s1SetupRequest;
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs));
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
@@ -109,32 +100,23 @@ int main(int argc, char *argv[])
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
strlen("ENB 1 eurecom"));
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
s1ap_eNB_encode_s1setuprequest(&s1SetupRequest, &buffer, &len);
assoc[0] = sctp_connect_to_remote_host(ip_addr, 36412, &recv_callback);
sctp_send_msg(0, 0, buffer, len);
free(buffer);
// generateUplinkNASTransport(&buffer, &len);
// sctp_send_msg(assoc[0], 0, buffer, len);
// s1ap_mme_decode_pdu(buffer, len);
pthread_join(sctp_get_receiver_thread(assoc[0]), NULL);
return(0);
}
+6 -34
View File
@@ -35,7 +35,6 @@
#include "s1ap_common.h"
#include "s1ap_eNB.h"
#include "s1ap_mme.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_encoder.h"
#include "s1ap_eNB_decoder.h"
@@ -79,27 +78,22 @@ void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer,
SupportedTAs_Item_t ta;
PLMNidentity_t plmnIdentity;
uint8_t *id_p = (uint8_t *)(&eNB_id + 1);
memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs_t));
s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID;
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id_p;
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3;
s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4;
OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3);
s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT;
OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom",
strlen("ENB 1 eurecom"));
memset(&ta, 0, sizeof(SupportedTAs_Item_t));
memset(&plmnIdentity, 0, sizeof(PLMNidentity_t));
OCTET_STRING_fromBuf(&ta.tAC, tac, 2);
OCTET_STRING_fromBuf(&plmnIdentity, identity, 3);
ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity);
ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta);
s1SetupRequest.defaultPagingDRX = PagingDRX_v64;
s1ap_eNB_encode_s1_setup_request(&s1SetupRequest, buffer, length);
}
@@ -109,13 +103,10 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
{
InitialUEMessageIEs_t initialUEmessageIEs;
InitialUEMessageIEs_t *initialUEmessageIEs_p = &initialUEmessageIEs;
memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs_t));
initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID & 0x00ffffff;
initialUEmessageIEs.nas_pdu.buf = (uint8_t *)infoNAS;
initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS);
initialUEmessageIEs.tai.tAC.buf = (uint8_t *)tac;
initialUEmessageIEs.tai.tAC.size = 2;
initialUEmessageIEs.tai.pLMNidentity.buf = (uint8_t *)identity;
@@ -125,9 +116,7 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID,
initialUEmessageIEs.eutran_cgi.cell_ID.buf = (uint8_t *)id;
initialUEmessageIEs.eutran_cgi.cell_ID.size = 4;
initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4;
initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data;
return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length);
}
@@ -140,26 +129,19 @@ int s1ap_test_generate_initial_setup_resp(uint32_t eNB_UE_S1AP_ID,
{
InitialContextSetupResponseIEs_t initialResponseIEs;
InitialContextSetupResponseIEs_t *initialResponseIEs_p = &initialResponseIEs;
E_RABSetupItemCtxtSURes_t e_RABSetupItemCtxtSURes;
memset(initialResponseIEs_p, 0, sizeof(InitialContextSetupResponseIEs_t));
memset(&e_RABSetupItemCtxtSURes, 0, sizeof(E_RABSetupItemCtxtSURes_t));
initialResponseIEs_p->mme_ue_s1ap_id = mme_UE_S1AP_ID;
initialResponseIEs_p->eNB_UE_S1AP_ID = eNB_UE_S1AP_ID;
e_RABSetupItemCtxtSURes.e_RAB_ID = eRAB_id;
e_RABSetupItemCtxtSURes.transportLayerAddress.buf = (uint8_t *)&ipv4_local;
e_RABSetupItemCtxtSURes.transportLayerAddress.size = 4;
e_RABSetupItemCtxtSURes.gTP_TEID.buf = (uint8_t *)&teid;
e_RABSetupItemCtxtSURes.gTP_TEID.size = 4;
ASN_SEQUENCE_ADD(
&initialResponseIEs_p->e_RABSetupListCtxtSURes.e_RABSetupItemCtxtSURes,
&e_RABSetupItemCtxtSURes);
return s1ap_eNB_encode_initial_context_setup_response(initialResponseIEs_p,
buffer, length);
}
@@ -169,19 +151,19 @@ int recv_callback(uint32_t assocId,
uint8_t *buffer,
uint32_t length)
{
s1ap_message message;
S1AP_S1AP_PDU_t pdu;
uint8_t *buffer2;
uint32_t len;
int j;
if (s1ap_eNB_decode_pdu(&message, buffer, length) < 0) {
if (s1ap_eNB_decode_pdu(&pdu, buffer, length) < 0) {
fprintf(stderr, "s1ap_eNB_decode_pdu returned status < 0\n");
free(buffer);
return -1;
}
if (message.procedureCode == ProcedureCode_id_S1Setup
&& message.direction == S1AP_PDU_PR_successfulOutcome) {
if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_S1Setup
&& pdu.present == S1AP_S1AP_PDU_PR_successfulOutcome) {
for (j = 0; j < nb_ue; j++) {
s1ap_test_generate_initial_ue_message(j, &buffer2, &len);
@@ -194,8 +176,8 @@ int recv_callback(uint32_t assocId,
free(buffer2);
}
} else if (message.procedureCode == ProcedureCode_id_InitialContextSetup
&& message.direction == S1AP_PDU_PR_initiatingMessage) {
} else if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_InitialContextSetup
&& pdu.present == S1AP_PDU_PR_initiatingMessage) {
fprintf(stdout, "Received InitialContextSetup request\n");
s1ap_test_generate_initial_setup_resp(
message.msg.initialContextSetupRequestIEs.eNB_UE_S1AP_ID,
@@ -220,7 +202,6 @@ int recv_callback(uint32_t assocId,
}
free(buffer);
return 0;
}
@@ -231,9 +212,7 @@ int sctp_connected(void *args,
{
uint8_t *buffer;
uint32_t len;
fprintf(stdout, "New association %d\n", assocId);
s1ap_test_generate_s1_setup_request(assocId * nb_eNB, &buffer, &len);
if (sctp_send_msg(assocId, 0, buffer, len) < 0) {
@@ -244,7 +223,6 @@ int sctp_connected(void *args,
}
free(buffer);
connected_eNB++;
return 0;
}
@@ -252,12 +230,9 @@ int sctp_connected(void *args,
int main(int argc, char *argv[])
{
asn_enc_rval_t retVal;
int i;
SupportedTAs_Item_t ta;
PLMNidentity_t plmnIdentity;
asn_debug = 0;
asn1_xer_print = 0;
@@ -278,12 +253,9 @@ int main(int argc, char *argv[])
sleep(1);
}
// generateUplinkNASTransport(&buffer, &len);
// sctp_send_msg(assoc[0], 0, buffer, len);
// s1ap_mme_decode_pdu(buffer, len);
sctp_terminate();
return(0);
}
+5 -5
View File
@@ -145,16 +145,16 @@ int main(int argc, char *argv[])
}
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
struct s1ap_message_s message;
S1AP_S1AP_PDU_t pdu;
uint8_t *buffer;
uint32_t length;
memset(&message, 0, sizeof(struct s1ap_message_s));
memset(&pdu, 0, sizeof(pdu));
printf("Trying to decode %s procedure with asn1c decoder\n",
s1ap_test[i].procedure_name);
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
printf("Failed to decode this message\n");
} else {
@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
printf("Trying to encode %s procedure with asn1c encoder\n",
s1ap_test[i].procedure_name);
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
printf("Failed to encode this message on MME side, trying eNB side\n");
} else {
compare_buffer(buffer, length, s1ap_test[i].buffer, s1ap_test[i].buf_len);
-6
View File
@@ -35,7 +35,6 @@
#include "s1ap_common.h"
#include "s1ap_eNB.h"
#include "s1ap_mme.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_encoder.h"
#include "s1ap_eNB_decoder.h"
@@ -45,9 +44,7 @@ int recv_callback(uint32_t assocId,
uint8_t *buffer,
uint32_t length)
{
free(buffer);
return 0;
}
@@ -56,14 +53,12 @@ int sctp_connected(void *args,
uint32_t instreams,
uint32_t outstreams)
{
return 0;
}
int main(int argc, char *argv[])
{
asn_enc_rval_t retVal;
int i;
for (i = 0; i < nb_eNB; i++) {
@@ -75,6 +70,5 @@ int main(int argc, char *argv[])
}
sctp_terminate();
return(0);
}
+30 -69
View File
@@ -43,7 +43,6 @@
#include "intertask_interface.h"
#include "s1ap_eNB_default_values.h"
#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB_management_procedures.h"
#include "assertions.h"
@@ -55,11 +54,9 @@
void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
{
int result;
DevAssert(sctp_data_ind != NULL);
mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
@@ -70,16 +67,12 @@ void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
{
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
@@ -100,7 +93,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
/* If there are no more associated MME, inform eNB app */
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND);
S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0;
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
@@ -119,7 +111,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut
/* If there are no more pending messages, inform eNB app */
if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) {
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF);
S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb;
itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p);
@@ -131,12 +122,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
{
s1ap_eNB_instance_t *instance_p;
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
DevAssert(sctp_new_association_resp != NULL);
instance_p = s1ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
sctp_new_association_resp->ulp_cnx_id);
DevAssert(s1ap_mme_data_p != NULL);
@@ -146,9 +134,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return;
}
@@ -156,49 +142,37 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
/* Prepare new S1 Setup Request */
mme_test_s1_start_test(instance_p, s1ap_mme_data_p);
}
void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
net_ip_address_t *mme_ip_address,
net_ip_address_t *local_ip_addr)
net_ip_address_t *mme_ip_address,
net_ip_address_t *local_ip_addr)
{
MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
DevAssert(instance_p != NULL);
DevAssert(mme_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
memcpy(&sctp_new_association_req_p->remote_address,
mme_ip_address,
sizeof(*mme_ip_address));
memcpy(&sctp_new_association_req_p->local_address,
local_ip_addr,
sizeof(*local_ip_addr));
/* Create new MME descriptor */
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
DevAssert(s1ap_mme_data_p != NULL);
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
s1ap_mme_data_p->assoc_id = -1;
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
/* Insert the new descriptor in list of known MME
* but not yet associated.
*/
@@ -206,7 +180,6 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
instance_p->s1ap_mme_nb ++;
instance_p->s1ap_mme_pending_nb ++;
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
}
@@ -216,9 +189,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
{
s1ap_eNB_instance_t *new_instance;
uint8_t index;
DevAssert(s1ap_register_eNB != NULL);
/* Look if the provided instance already exists */
new_instance = s1ap_eNB_get_instance(instance);
@@ -234,10 +205,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
} else {
new_instance = calloc(1, sizeof(s1ap_eNB_instance_t));
DevAssert(new_instance != NULL);
RB_INIT(&new_instance->s1ap_ue_head);
RB_INIT(&new_instance->s1ap_mme_head);
/* Copy usefull parameters */
new_instance->instance = instance;
new_instance->eNB_name = s1ap_register_eNB->eNB_name;
@@ -248,10 +217,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
new_instance->mnc = s1ap_register_eNB->mnc;
new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length;
new_instance->default_drx = s1ap_register_eNB->default_drx;
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
s1ap_eNB_insert_new_instance(new_instance);
S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
instance,
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
@@ -275,54 +242,48 @@ void *s1ap_eNB_task(void *arg)
{
MessageDef *received_msg = NULL;
int result;
S1AP_DEBUG("Starting S1AP layer\n");
s1ap_eNB_prepare_internal_data();
itti_mark_task_ready(TASK_S1AP);
while (1) {
itti_receive_msg(TASK_S1AP, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
itti_exit_task();
case TERMINATE_MESSAGE:
itti_exit_task();
break;
case S1AP_REGISTER_ENB_REQ: {
/* Register a new eNB.
* in Virtual mode eNBs will be distinguished using the mod_id/
* Each eNB has to send an S1AP_REGISTER_ENB message with its
* own parameters.
*/
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_REGISTER_ENB_REQ(received_msg));
}
break;
case S1AP_REGISTER_ENB_REQ: {
/* Register a new eNB.
* in Virtual mode eNBs will be distinguished using the mod_id/
* Each eNB has to send an S1AP_REGISTER_ENB message with its
* own parameters.
*/
s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&S1AP_REGISTER_ENB_REQ(received_msg));
}
break;
case SCTP_NEW_ASSOCIATION_RESP: {
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
}
break;
case SCTP_DATA_IND: {
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
}
break;
default:
S1AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
case SCTP_NEW_ASSOCIATION_RESP: {
s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
}
break;
case SCTP_DATA_IND: {
s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
}
break;
default:
S1AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
}
+6 -8
View File
@@ -153,22 +153,20 @@ static int compare_buffer(uint8_t *buffer, uint32_t length_buffer,
void doit (void)
{
int i;
break_on_error = 1;
// asn1_xer_print = 1;
// asn_debug = 1;
for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) {
struct s1ap_message_s message;
S1AP_S1AP_PDU_t pdu;
uint8_t *buffer;
uint32_t length;
memset(&message, 0, sizeof(struct s1ap_message_s));
memset(&pdu, 0, sizeof(pdu));
if (s1ap_test[i].originating == ENB) {
/* eNB originated procedure -> USE MME decoder */
if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
} else {
@@ -176,7 +174,7 @@ void doit (void)
}
} else {
/* MME originated procedure -> USE eNB decoder */
if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer,
if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer,
s1ap_test[i].buf_len) < 0) {
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
} else {
@@ -186,14 +184,14 @@ void doit (void)
if (s1ap_test[i].originating == ENB) {
/* eNB originated procedure -> USE eNB encoder */
if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
fail("Failed to decode %s\n", s1ap_test[i].procedure_name);
} else {
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
}
} else {
/* MME originated procedure -> USE mme encoder */
if (s1ap_mme_encode_pdu(&message, &buffer, &length) < 0) {
if (s1ap_mme_encode_pdu(&pdu, &buffer, &length) < 0) {
fail("Failed to encode %s\n", s1ap_test[i].procedure_name);
} else {
success("Encoded %s correctly\n", s1ap_test[i].procedure_name);
@@ -3,32 +3,74 @@
#if defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
# define NUMBER_OF_eNB_MAX 1
# define NUMBER_OF_gNB_MAX 1
# define NUMBER_OF_RU_MAX 2
# define NUMBER_OF_NR_RU_MAX 2
# define NUMBER_OF_UE_MAX 16
# define NUMBER_OF_NR_UE_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 3
# define NUMBER_OF_CONNECTED_gNB_MAX 3
#else
# define NUMBER_OF_eNB_MAX 7
# define NUMBER_OF_gNB_MAX 7
# define NUMBER_OF_RU_MAX 32
# define NUMBER_OF_NR_RU_MAX 32
# define NUMBER_OF_UE_MAX 20
# define NUMBER_OF_NR_UE_MAX 20
# define NUMBER_OF_CONNECTED_eNB_MAX 3
# define NUMBER_OF_CONNECTED_gNB_MAX 3
# if defined(STANDALONE) && STANDALONE==1
# undef NUMBER_OF_eNB_MAX
# undef NUMBER_OF_gNB_MAX
# undef NUMBER_OF_UE_MAX
# undef NUMBER_OF_NR_UE_MAX
# undef NUMBER_OF_RU_MAX
# undef NUMBER_OF_NR_RU_MAX
# define NUMBER_OF_eNB_MAX 3
# define NUMBER_OF_gNB_MAX 3
# define NUMBER_OF_UE_MAX 3
# define NUMBER_OF_NR_UE_MAX 3
# define NUMBER_OF_RU_MAX 3
# define NUMBER_OF_NR_RU_MAX 3
# endif
# if defined(LARGE_SCALE) && LARGE_SCALE
# undef NUMBER_OF_eNB_MAX
# undef NUMBER_OF_gNB_MAX
# undef NUMBER_OF_UE_MAX
# undef NUMBER_OF_NR_UE_MAX
# undef NUMBER_OF_CONNECTED_eNB_MAX
# undef NUMBER_OF_CONNECTED_gNB_MAX
# undef NUMBER_OF_RU_MAX
# undef NUMBER_OF_NR_RU_MAX
# define NUMBER_OF_eNB_MAX 2
# define NUMBER_OF_gNB_MAX 2
# define NUMBER_OF_UE_MAX 120
# define NUMBER_OF_NR_UE_MAX 120
# define NUMBER_OF_RU_MAX 16
# define NUMBER_OF_NR_RU_MAX 16
# define NUMBER_OF_CONNECTED_eNB_MAX 1 // to save some memory
# define NUMBER_OF_CONNECTED_gNB_MAX 1
# endif
#endif
@@ -2,15 +2,15 @@ Active_eNBs = ( "eNB-Eurecom-LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
gNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
gNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB-Eurecom-LTEBox";
gNB_name = "eNB-Eurecom-LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
@@ -25,43 +25,43 @@ eNBs =
component_carriers = (
{
node_function = "3GPP_eNODEB";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2685000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
node_function = "3GPP_eNODEB";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2685000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
pbch_repetition = "FALSE";
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 0;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -27;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pbch_repetition = "FALSE";
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 0;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -27;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
@@ -79,7 +79,7 @@ eNBs =
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
@@ -97,14 +97,14 @@ eNBs =
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
@@ -218,3 +218,237 @@ NETWORK_CONTROLLER :
rrc_log_verbosity ="medium";
};
Active_gNBs = ( "gNB_Eurecom_5GNRBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xe00;
cell_type = "CELL_MACRO_GNB";
gNB_name = "gNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "93";
tr_s_preference = "local_mac"
////////// Physical parameters:
component_carriers = (
{
node_function = "3GPP_gNODEB";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
DL_prefix_type = "NORMAL";
UL_prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2685000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 50;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 125;
MIB_subCarrierSpacingCommon = 0;
MIB_ssb_SubcarrierOffset = 0;
MIB_dmrs_TypeA_Position = 0;
pdcch_ConfigSIB1 = 0;
SIB1_frequencyOffsetSSB = 0;
SIB1_ssb_PeriodicityServingCell = 0;
SIB1_ss_PBCH_BlockPower = 0;
absoluteFrequencySSB = 0;
ssb_SubcarrierOffset = 0;
DL_FreqBandIndicatorNR = 0;
DL_absoluteFrequencyPointA = 0;
DL_offsetToCarrier = 0;
DL_SCS_SubcarrierSpacing = 0;
DL_SCS_SpecificCarrier_k0 = 0;
DL_carrierBandwidth = 0;
DL_locationAndBandwidth = 0;
DL_BWP_SubcarrierSpacing = 0;
DL_BWP_prefix_type = "NORMAL";
UL_FreqBandIndicatorNR = 0;
UL_absoluteFrequencyPointA = 0;
UL_additionalSpectrumEmission = 0;
UL_p_Max = 0;
UL_frequencyShift7p5khz = 0;
UL_offsetToCarrier = 0;
UL_SCS_SubcarrierSpacing = 0;
UL_SCS_SpecificCarrier_k0 = 0;
UL_carrierBandwidth = 0;
UL_locationAndBandwidth = 0;
UL_BWP_SubcarrierSpacing = 0;
UL_BWP_prefix_type = 0;
ServingCellConfigCommon__ssb_PositionsInBurst_PR = 0;
ServingCellConfigCommon_ssb_periodicityServingCell = 0;
ServingCellConfigCommon_dmrs_TypeA_Position = 0;
NIA_SubcarrierSpacing = 0;
ServingCellConfigCommon_ss_PBCH_BlockPower = 0;
referenceSubcarrierSpacing = 0;
dl_UL_TransmissionPeriodicity = 0;
nrofDownlinkSlots = 0;
nrofDownlinkSymbols = 0;
nrofUplinkSlots = 0;
nrofUplinkSymbols = 0;
rach_totalNumberOfRA_Preambles = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 0;
rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 0;
rach_groupBconfigured = NULL;
rach_ra_Msg3SizeGroupA = 0;
rach_messagePowerOffsetGroupB = 0;
rach_numberOfRA_PreamblesGroupA = 0;
rach_ra_ContentionResolutionTimer = 0;
rsrp_ThresholdSSB = 0;
rsrp_ThresholdSSB_SUL = 0;
prach_RootSequenceIndex_choice = 0;
prach_RootSequenceIndex_l839 = 0;
prach_RootSequenceIndex_l139 = 0;
prach_msg1_SubcarrierSpacing = 0;
restrictedSetConfig = 0;
msg3_transformPrecoding = 0;
prach_ConfigurationIndex = 0;
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 0;
preambleReceivedTargetPower = 0;
preambleTransMax = 0;
powerRampingStep = 0;
ra_ResponseWindow = 0;
groupHoppingEnabledTransformPrecoding = NULL;
msg3_DeltaPreamble = 0;
p0_NominalWithGrant = 0;
PUSCH_TimeDomainResourceAllocation_k2 = 0;
PUSCH_TimeDomainResourceAllocation_mappingType = 0;
pucch_GroupHopping = 0;
p0_nominal = 0;
PDSCH_TimeDomainResourceAllocation_k0 = 0;
PDSCH_TimeDomainResourceAllocation_mappingType = 0;
rateMatchPatternId = 0;
RateMatchPattern_patternType = 0;
symbolsInResourceBlock = 0;
periodicityAndPattern = 0;
RateMatchPattern_controlResourceSet = 0;
RateMatchPattern_subcarrierSpacing = 0;
RateMatchPattern_mode = 0;
searchSpaceSIB1 = 0;
searchSpaceOtherSystemInformation = 0;
pagingSearchSpace = 0;
ra_SearchSpace = 0;
rach_ra_ControlResourceSet = 0;
PDCCH_common_controlResourceSetId = 0;
PDCCH_common_ControlResourceSet_duration = 0;
PDCCH_cce_REG_MappingType = 0;
PDCCH_reg_BundleSize = 0;
PDCCH_interleaverSize = 0;
PDCCH_shiftIndex = 0;
PDCCH_precoderGranularity = 0;
PDCCH_TCI_StateId = 0;
tci_PresentInDCI = NULL;
SearchSpaceId = 0;
commonSearchSpaces_controlResourceSetId = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_choice = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl1 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 = 0;
SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 = 0;
SearchSpace_nrofCandidates_aggregationLevel1 = 0;
SearchSpace_nrofCandidates_aggregationLevel2 = 0;
SearchSpace_nrofCandidates_aggregationLevel4 = 0;
SearchSpace_nrofCandidates_aggregationLevel8 = 0;
SearchSpace_nrofCandidates_aggregationLevel16 = 0;
SearchSpace_searchSpaceType = 0;
Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 0;
Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 0;
Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 0;
Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 0;
Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 0;
Common_dci_Format2_3_monitoringPeriodicity = 0;
Common_dci_Format2_3_nrofPDCCH_Candidates = 0;
ue_Specific__dci_Formats = 0;
RateMatchPatternLTE_CRS_carrierFreqDL = 0;
RateMatchPatternLTE_CRS_carrierBandwidthDL = 0;
RateMatchPatternLTE_CRS_nrofCRS_Ports = 0;
RateMatchPatternLTE_CRS_v_Shift = 0;
RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 0;
RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0;
RateMatchPatternLTE_CRS_subframeAllocation_choice = 0;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
);
+6 -1
View File
@@ -210,7 +210,12 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
0); // HO flag
#ifdef NR
// nr_l2_init_ue();
// nr_l3_init_ue();
#endif
for (inst=0;inst<nb_inst;inst++) {
LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);