Merge remote-tracking branch 'origin/develop' into dlsim-ulsim-fix

Conflicts:
	openair1/PHY/INIT/lte_init.c
This commit is contained in:
Raymond Knopp
2018-02-18 01:39:36 -08:00
104 changed files with 8198 additions and 7053 deletions
+93 -102
View File
@@ -599,8 +599,6 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc
add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams")
add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN agent to inteface with a SDN controller")
######################## ########################
# Include order # Include order
########################## ##########################
@@ -766,6 +764,8 @@ include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
include_directories("${OPENAIR2_DIR}/ENB_APP") include_directories("${OPENAIR2_DIR}/ENB_APP")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC")
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP")
include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
@@ -787,92 +787,94 @@ include_directories("${OPENAIR_DIR}")
# Utilities Library # Utilities Library
################ ################
if (FLEXRAN_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet
# set the version of protobuf messages, V3 not supported yet add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3)
add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3)
if (${FLPT_VERSION} STREQUAL "V2") if (${FLPT_VERSION} STREQUAL "V2")
set (FLPTDIR V2) set (FLPTDIR V2)
elseif (${FLPT_VERSION} STREQUAL "V3") elseif (${FLPT_VERSION} STREQUAL "V3")
set (FLPTDIR V3) set (FLPTDIR V3)
endif(${FLPT_VERSION} STREQUAL "V2") endif(${FLPT_VERSION} STREQUAL "V2")
set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} ) set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} )
set(FLPT_MSG_FILES set(FLPT_MSG_FILES
${FLPT_MSG_DIR}/header.proto ${FLPT_MSG_DIR}/header.proto
${FLPT_MSG_DIR}/flexran.proto ${FLPT_MSG_DIR}/flexran.proto
${FLPT_MSG_DIR}/stats_common.proto ${FLPT_MSG_DIR}/stats_common.proto
${FLPT_MSG_DIR}/stats_messages.proto ${FLPT_MSG_DIR}/stats_messages.proto
${FLPT_MSG_DIR}/time_common.proto ${FLPT_MSG_DIR}/time_common.proto
${FLPT_MSG_DIR}/controller_commands.proto ${FLPT_MSG_DIR}/controller_commands.proto
${FLPT_MSG_DIR}/mac_primitives.proto ${FLPT_MSG_DIR}/mac_primitives.proto
${FLPT_MSG_DIR}/config_messages.proto ${FLPT_MSG_DIR}/config_messages.proto
${FLPT_MSG_DIR}/config_common.proto ${FLPT_MSG_DIR}/config_common.proto
${FLPT_MSG_DIR}/control_delegation.proto ${FLPT_MSG_DIR}/control_delegation.proto
) )
set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR}) set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") #message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES}) execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
file(GLOB FLPT_source ${FLPT_C_DIR}/*.c) file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
set(FLPT_OAI_generated set(FLPT_OAI_generated
${FLPT_C_DIR}/header.pb-c.c ${FLPT_C_DIR}/header.pb-c.c
${FLPT_C_DIR}/flexran.pb-c.c ${FLPT_C_DIR}/flexran.pb-c.c
${FLPT_C_DIR}/stats_common.pb-c.c ${FLPT_C_DIR}/stats_common.pb-c.c
${FLPT_C_DIR}/stats_messages.pb-c.c ${FLPT_C_DIR}/stats_messages.pb-c.c
${FLPT_C_DIR}/time_common.pb-c.c ${FLPT_C_DIR}/time_common.pb-c.c
${FLPT_C_DIR}/controller_commands.pb-c.c ${FLPT_C_DIR}/controller_commands.pb-c.c
${FLPT_C_DIR}/mac_primitives.pb-c.c ${FLPT_C_DIR}/mac_primitives.pb-c.c
${FLPT_C_DIR}/config_messages.pb-c.c ${FLPT_C_DIR}/config_messages.pb-c.c
${FLPT_C_DIR}/config_common.pb-c.c ${FLPT_C_DIR}/config_common.pb-c.c
${FLPT_C_DIR}/control_delegation.pb-c.c ${FLPT_C_DIR}/control_delegation.pb-c.c
) )
file(GLOB flpt_h ${FLPT_C_DIR}/*.h) file(GLOB flpt_h ${FLPT_C_DIR}/*.h)
set(flpt_h ${flpt_h} ) set(flpt_h ${flpt_h} )
add_library(FLPT_MSG add_library(FLPT_MSG
${FLPT_OAI_generated} ${FLPT_OAI_generated}
${FLPT_source} ${FLPT_source}
) )
set(FLPT_MSG_LIB FLPT_MSG) set(FLPT_MSG_LIB FLPT_MSG)
#message("prpt c dir is : ${FLPT_C_DIR}") #message("prpt c dir is : ${FLPT_C_DIR}")
include_directories (${FLPT_C_DIR}) include_directories (${FLPT_C_DIR})
add_library(ASYNC_IF add_library(ASYNC_IF
${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
) )
set(ASYNC_IF_LIB ASYNC_IF) set(ASYNC_IF_LIB ASYNC_IF)
include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
add_library(FLEXRAN_AGENT add_library(FLEXRAN_AGENT
${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c
) ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c
set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c
#include_directories(${OPENAIR2_DIR}/ENB_APP) ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
)
set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
#include_directories(${OPENAIR2_DIR}/ENB_APP)
set(PROTOBUF_LIB "protobuf-c") set(PROTOBUF_LIB "protobuf-c")
FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h) FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h)
FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml) FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml)
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)
#set(PROTOBUF_LIB "protobuf") #for Cpp #set(PROTOBUF_LIB "protobuf") #for Cpp
endif()
add_library(HASHTABLE add_library(HASHTABLE
@@ -1369,17 +1371,6 @@ set (MAC_SRC_UE
${MAC_DIR}/config_ue.c ${MAC_DIR}/config_ue.c
) )
if (FLEXRAN_AGENT_SB_IF)
set (MAC_SRC ${MAC_SRC}
${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c
${MAC_DIR}/flexran_agent_scheduler_dataplane.c
${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c
)
endif()
set (ENB_APP_SRC set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_app.c ${OPENAIR2_DIR}/ENB_APP/enb_app.c
${OPENAIR2_DIR}/ENB_APP/enb_config.c ${OPENAIR2_DIR}/ENB_APP/enb_config.c
@@ -1399,14 +1390,6 @@ add_library(L2_UE
include_directories(${NFAPI_USER_DIR}) include_directories(${NFAPI_USER_DIR})
if (FLEXRAN_AGENT_SB_IF)
#Test for adding a shared library
add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c)
add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c)
endif()
# L3 Libs # L3 Libs
########################## ##########################
@@ -1880,6 +1863,16 @@ if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h")
endif() endif()
list(APPEND ATLAS_LIBRARIES lapack) list(APPEND ATLAS_LIBRARIES lapack)
# for ubuntu 17.10, directories are different
elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h")
include_directories("/usr/include/x86_64-linux-gnu")
LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
list(APPEND ATLAS_LIBRARIES cblas)
list(APPEND ATLAS_LIBRARIES atlas)
list(APPEND ATLAS_LIBRARIES lapack)
else() else()
message("No Blas/Atlas libs found, some targets will fail") message("No Blas/Atlas libs found, some targets will fail")
endif() endif()
@@ -2065,7 +2058,6 @@ add_executable(oaisim
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/system.c
${GTPU_need_ITTI}
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${XFORMS_SOURCE} ${XFORMS_SOURCE}
${T_SOURCE} ${T_SOURCE}
@@ -2077,14 +2069,13 @@ add_executable(oaisim
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim target_link_libraries (oaisim
-Wl,-ldl,--start-group -Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2 ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_USER_LIB
-Wl,--end-group z dl) -Wl,--end-group z dl)
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ) ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
#Force link with forms, regardless XFORMS option #Force link with forms, regardless XFORMS option
target_link_libraries (oaisim forms) target_link_libraries (oaisim forms)
target_link_libraries (oaisim ${T_LIB}) target_link_libraries (oaisim ${T_LIB})
@@ -2298,7 +2289,7 @@ add_custom_command (
# retrieve the compiler options to send it to gccxml # retrieve the compiler options to send it to gccxml
get_directory_property(DirDefs COMPILE_DEFINITIONS ) get_directory_property(DirDefs COMPILE_DEFINITIONS )
foreach( d ${DirDefs} ) foreach( d ${DirDefs} )
set(module_cc_opt_tmp "${module_cc_opt_tmp} -D${d}") set(module_cc_opt "${module_cc_opt} -D${d}")
endforeach() endforeach()
get_directory_property( DirDefs INCLUDE_DIRECTORIES ) get_directory_property( DirDefs INCLUDE_DIRECTORIES )
foreach( d ${DirDefs} ) foreach( d ${DirDefs} )
+4 -19
View File
@@ -42,7 +42,6 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
MSC_GEN="False" MSC_GEN="False"
XFORMS="True" XFORMS="True"
FLEXRAN_AGENT_SB_IF="True"
PRINT_STATS="False" PRINT_STATS="False"
VCD_TIMING="False" VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER="False" DEADLINE_SCHEDULER_FLAG_USER="False"
@@ -100,8 +99,6 @@ Options
Specify conf_nvram_path (default \"$conf_nvram_path\") Specify conf_nvram_path (default \"$conf_nvram_path\")
--UE-gen-nvram [output path] --UE-gen-nvram [output path]
Specify gen_nvram_path (default \"$gen_nvram_path\") Specify gen_nvram_path (default \"$gen_nvram_path\")
-a | --agent
Enables agent for software-defined control of the eNB
-r | --3gpp-release -r | --3gpp-release
default is Rel14, default is Rel14,
Rel8 limits the implementation to 3GPP Release 8 version Rel8 limits the implementation to 3GPP Release 8 version
@@ -204,8 +201,7 @@ function main() {
echo_info "Will compile eNB" echo_info "Will compile eNB"
shift;; shift;;
-a | --agent) -a | --agent)
FLEXRAN_AGENT=1 echo_info "FlexRAN support is always compiled into the eNB"
echo_info "Will compile eNB with agent support"
shift;; shift;;
--UE) --UE)
UE=1 UE=1
@@ -465,11 +461,9 @@ function main() {
flash_firmware_bladerf flash_firmware_bladerf
fi fi
fi fi
if [ "$FLEXRAN_AGENT" == "1" ] ; then echo_info "installing protobuf/protobuf-c for flexran agent support"
echo_info "installing protobuf/protobuf-c for flexran agent support" install_protobuf_from_source
install_protobuf_from_source install_protobuf_c_from_source
install_protobuf_c_from_source
fi
fi fi
if [ "$INSTALL_OPTIONAL" = "1" ] ; then if [ "$INSTALL_OPTIONAL" = "1" ] ; then
@@ -517,9 +511,6 @@ function main() {
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
@@ -679,9 +670,6 @@ function main() {
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
@@ -762,9 +750,6 @@ function main() {
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file
if [ "$FLEXRAN_AGENT" = "1" ] ; then
echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file
fi
echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( T_TRACER $T_TRACER )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file
+3
View File
@@ -40,6 +40,7 @@
#include "PHY/impl_defs_top.h" #include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_lte.h" #include "PHY/impl_defs_lte.h"
#include "RRC/LITE/defs.h" #include "RRC/LITE/defs.h"
#include "flexran_agent_defs.h"
#include "gtpv1u.h" #include "gtpv1u.h"
#include "NwGtpv1u.h" #include "NwGtpv1u.h"
@@ -64,6 +65,8 @@ typedef struct {
int *nb_L1_CC; int *nb_L1_CC;
/// Number of RU instances in this node /// Number of RU instances in this node
int nb_RU; int nb_RU;
/// FlexRAN context variables
flexran_agent_info_t **flexran;
/// eNB context variables /// eNB context variables
struct PHY_VARS_eNB_s ***eNB; struct PHY_VARS_eNB_s ***eNB;
/// RRC context variables /// RRC context variables
+13
View File
@@ -637,6 +637,19 @@ void itti_mark_task_ready(task_id_t task_id)
void itti_exit_task(void) void itti_exit_task(void)
{ {
task_id_t task_id = itti_get_current_task_id();
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
#if defined(OAI_EMU) || defined(RTAI)
if (task_id > TASK_UNKNOWN) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
__sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
}
#endif
itti_desc.threads[thread_id].task_state = TASK_STATE_NOT_CONFIGURED;
itti_desc.created_tasks--;
ITTI_DEBUG(ITTI_DEBUG_EXIT, "Thread for task %s (%d) exits\n", itti_get_task_name(task_id), task_id);
pthread_exit (NULL); pthread_exit (NULL);
} }
+12 -1
View File
@@ -27,7 +27,18 @@
#ifndef _ITTI_TYPES_H_ #ifndef _ITTI_TYPES_H_
#define _ITTI_TYPES_H_ #define _ITTI_TYPES_H_
#include <stdint.h> /* The current file is included in the ue_ip.ko compilation.
* For it to work we need to include linux/types.h and
* not stdint.h.
* A solution to this problem is to use #ifndef __KERNEL__.
* Maybe a better solution would be to clean things up
* so that ue_ip.ko does not include the current file.
*/
#ifndef __KERNEL__
# include <stdint.h>
#else
# include <linux/types.h>
#endif
#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) #define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1))
+1
View File
@@ -99,6 +99,7 @@ void *msc_task(void *args_p)
break; break;
case TERMINATE_MESSAGE: { case TERMINATE_MESSAGE: {
fprintf(stderr, " *** Exiting MSC thread\n");
timer_remove(timer_id); timer_remove(timer_id);
msc_end(); msc_end();
itti_exit_task(); itti_exit_task();
@@ -830,10 +830,10 @@ void free_td16avx2(void)
int ind; int ind;
for (ind=0; ind<188; ind++) { for (ind=0; ind<188; ind++) {
free(pi2tab16avx2[ind]); free_and_zero(pi2tab16avx2[ind]);
free(pi5tab16avx2[ind]); free_and_zero(pi5tab16avx2[ind]);
free(pi4tab16avx2[ind]); free_and_zero(pi4tab16avx2[ind]);
free(pi6tab16avx2[ind]); free_and_zero(pi6tab16avx2[ind]);
} }
} }
@@ -1907,6 +1907,18 @@ void compute_ext(llr_t* alpha,llr_t* beta,llr_t* m_11,llr_t* m_10,llr_t* ext, ll
//int pi2[n],pi3[n+8],pi5[n+8],pi4[n+8],pi6[n+8], //int pi2[n],pi3[n+8],pi5[n+8],pi4[n+8],pi6[n+8],
int *pi2tab[188],*pi5tab[188],*pi4tab[188],*pi6tab[188]; int *pi2tab[188],*pi5tab[188],*pi4tab[188],*pi6tab[188];
void free_td()
{
int ind;
for (ind = 0; ind < 188; ind++) {
free_and_zero(pi2tab[ind]);
free_and_zero(pi5tab[ind]);
free_and_zero(pi4tab[ind]);
free_and_zero(pi6tab[ind]);
}
}
void init_td() void init_td()
{ {
@@ -1117,10 +1117,10 @@ void free_td16(void)
int ind; int ind;
for (ind=0; ind<188; ind++) { for (ind=0; ind<188; ind++) {
free(pi2tab16[ind]); free_and_zero(pi2tab16[ind]);
free(pi5tab16[ind]); free_and_zero(pi5tab16[ind]);
free(pi4tab16[ind]); free_and_zero(pi4tab16[ind]);
free(pi6tab16[ind]); free_and_zero(pi6tab16[ind]);
} }
} }
@@ -838,10 +838,10 @@ void free_td8(void)
int ind; int ind;
for (ind=0; ind<188; ind++) { for (ind=0; ind<188; ind++) {
free(pi2tab8[ind]); free_and_zero(pi2tab8[ind]);
free(pi5tab8[ind]); free_and_zero(pi5tab8[ind]);
free(pi4tab8[ind]); free_and_zero(pi4tab8[ind]);
free(pi6tab8[ind]); free_and_zero(pi6tab8[ind]);
} }
} }
+10
View File
@@ -352,10 +352,17 @@ void ccodedab_init_inv(void);
\brief This function initializes the different crc tables.*/ \brief This function initializes the different crc tables.*/
void crcTableInit (void); void crcTableInit (void);
/*!\fn void free_td8(void)
\brief This function frees the tables for 8-bit LLR Turbo decoder.*/
void free_td8(void);
/*!\fn void init_td8(void) /*!\fn void init_td8(void)
\brief This function initializes the tables for 8-bit LLR Turbo decoder.*/ \brief This function initializes the tables for 8-bit LLR Turbo decoder.*/
void init_td8 (void); void init_td8 (void);
/*!\fn void free_td16(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder.*/
void free_td16(void);
/*!\fn void init_td16(void) /*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder.*/ \brief This function initializes the tables for 16-bit LLR Turbo decoder.*/
@@ -366,6 +373,9 @@ void init_td16 (void);
\brief This function initializes the tables for 8-bit LLR Turbo decoder (AVX2).*/ \brief This function initializes the tables for 8-bit LLR Turbo decoder (AVX2).*/
void init_td8avx2 (void); void init_td8avx2 (void);
/*!\fn void free_td16avx2(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder (AVX2).*/
void free_td16avx2(void);
/*!\fn void init_td16(void) /*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder (AVX2).*/ \brief This function initializes the tables for 16-bit LLR Turbo decoder (AVX2).*/
+8
View File
@@ -90,6 +90,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
unsigned char is_secondary_eNb, unsigned char is_secondary_eNb,
unsigned char abstraction_flag); unsigned char abstraction_flag);
/*!
\brief Free the PHY variables relevant to the LTE implementation (eNB).
\details Only a subset of phy_vars_eNb is freed (those who have been allocated with phy_init_lte_eNB()).
@param[in] phy_vars_eNb Pointer to eNB Variables
*/
void phy_free_lte_eNB(PHY_VARS_eNB *phy_vars_eNb);
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch). /** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).
\details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$ \details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$
@param lte_frame_parms pointer to LTE parameter structure @param lte_frame_parms pointer to LTE parameter structure
@@ -317,6 +324,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB);
*/ */
int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb); int phy_init_secsys_eNB(PHY_VARS_eNB *phy_vars_eNb);
void free_lte_top(void);
void init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms); void init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms);
+12
View File
@@ -59,6 +59,18 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
} }
void free_lte_top(void)
{
free_td8();
free_td16();
#ifdef __AVX2__
free_td16avx2();
#endif
lte_sync_time_free();
/* free_ul_ref_sigs() is called in phy_free_lte_eNB() */
}
/* /*
* @}*/ * @}*/
+74
View File
@@ -906,6 +906,80 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
} }
void phy_free_lte_eNB(PHY_VARS_eNB *eNB)
{
LTE_DL_FRAME_PARMS* const fp = &eNB->frame_parms;
LTE_eNB_COMMON* const common_vars = &eNB->common_vars;
LTE_eNB_PUSCH** const pusch_vars = eNB->pusch_vars;
LTE_eNB_SRS* const srs_vars = eNB->srs_vars;
LTE_eNB_PRACH* const prach_vars = &eNB->prach_vars;
#ifdef Rel14
LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br;
#endif
int i, UE_id;
for (i = 0; i < NB_ANTENNA_PORTS_ENB; i++) {
if (i < fp->nb_antenna_ports_eNB || i == 5) {
free_and_zero(common_vars->txdataF[i]);
/* rxdataF[i] is not allocated -> don't free */
}
}
free_and_zero(common_vars->txdataF);
free_and_zero(common_vars->rxdataF);
// Channel estimates for SRS
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
for (i=0; i<64; i++) {
free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
}
free_and_zero(srs_vars[UE_id].srs_ch_estimates);
free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
} //UE_id
free_ul_ref_sigs();
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) free_and_zero(srs_vars[UE_id].srs);
free_and_zero(prach_vars->prachF);
for (i = 0; i < 64; i++) free_and_zero(prach_vars->prach_ifft[0][i]);
free_and_zero(prach_vars->prach_ifft[0]);
#ifdef Rel14
for (int ce_level = 0; ce_level < 4; ce_level++) {
for (i = 0; i < 64; i++) free_and_zero(prach_vars_br->prach_ifft[ce_level][i]);
free_and_zero(prach_vars_br->prach_ifft[ce_level]);
free_and_zero(prach_vars->rxsigF[ce_level]);
}
free_and_zero(prach_vars_br->prachF);
#endif
free_and_zero(prach_vars->rxsigF[0]);
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
for (i = 0; i < 2; i++) {
free_and_zero(pusch_vars[UE_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]);
free_and_zero(pusch_vars[UE_id]->drs_ch_estimates[i]);
free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time[i]);
free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_mag[i]);
free_and_zero(pusch_vars[UE_id]->ul_ch_magb[i]);
}
free_and_zero(pusch_vars[UE_id]->rxdataF_ext);
free_and_zero(pusch_vars[UE_id]->rxdataF_ext2);
free_and_zero(pusch_vars[UE_id]->drs_ch_estimates);
free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time);
free_and_zero(pusch_vars[UE_id]->rxdataF_comp);
free_and_zero(pusch_vars[UE_id]->ul_ch_mag);
free_and_zero(pusch_vars[UE_id]->ul_ch_magb);
free_and_zero(pusch_vars[UE_id]->llr);
free_and_zero(pusch_vars[UE_id]);
} //UE_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL;
}
void install_schedule_handlers(IF_Module_t *if_inst) void install_schedule_handlers(IF_Module_t *if_inst)
{ {
if_inst->PHY_config_req = phy_config_request; if_inst->PHY_config_req = phy_config_request;
+48
View File
@@ -153,3 +153,51 @@ int phy_init_RU(RU_t *ru) {
return(0); return(0);
} }
void phy_free_RU(RU_t *ru)
{
int i,j;
int p;
LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
free_and_zero(ru->common.txdata);
free_and_zero(ru->common.rxdata);
} // else: IF5 or local RF -> nothing to free()
if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata_7_5kHz[i]);
free_and_zero(ru->common.rxdata_7_5kHz);
// free IFFT input buffers (TX)
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]);
free_and_zero(ru->common.txdataF_BF);
// free FFT output buffers (RX)
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
free_and_zero(ru->common.rxdataF);
for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[i]);
#ifdef Rel14
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
#endif
}
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j]);
free_and_zero(ru->prach_rxsigF);
/* ru->prach_rxsigF_br is not allocated -> don't free */
for (i = 0; i < RC.nb_L1_inst; i++) {
for (p = 0; p < 15; p++) {
if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) {
for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
free_and_zero(ru->beam_weights[i][p]);
}
}
}
}
free_and_zero(ru->common.sync_corr);
}
+7 -3
View File
@@ -185,14 +185,18 @@ void free_ul_ref_sigs(void)
unsigned int u,v,Msc_RS; unsigned int u,v,Msc_RS;
for (Msc_RS=2; Msc_RS<33; Msc_RS++) { for (Msc_RS=0; Msc_RS<33; Msc_RS++) {
for (u=0; u<30; u++) { for (u=0; u<30; u++) {
for (v=0; v<2; v++) { for (v=0; v<2; v++) {
if (ul_ref_sigs[u][v][Msc_RS]) if (ul_ref_sigs[u][v][Msc_RS]) {
free16(ul_ref_sigs[u][v][Msc_RS],2*sizeof(int16_t)*dftsizes[Msc_RS]); free16(ul_ref_sigs[u][v][Msc_RS],2*sizeof(int16_t)*dftsizes[Msc_RS]);
ul_ref_sigs[u][v][Msc_RS] = NULL;
}
if (ul_ref_sigs_rx[u][v][Msc_RS]) if (ul_ref_sigs_rx[u][v][Msc_RS]) {
free16(ul_ref_sigs_rx[u][v][Msc_RS],4*sizeof(int16_t)*dftsizes[Msc_RS]); free16(ul_ref_sigs_rx[u][v][Msc_RS],4*sizeof(int16_t)*dftsizes[Msc_RS]);
ul_ref_sigs_rx[u][v][Msc_RS] = NULL;
}
} }
} }
} }
+1 -1
View File
@@ -6563,7 +6563,7 @@ uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n)
else else
ul_subframe = ((n+4)%10); ul_subframe = ((n+4)%10);
// AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n); AssertFatal(frame_parms->frame_type == FDD || subframe_select(frame_parms,ul_subframe) == SF_UL,"illegal ul_subframe %d (n %d)\n",ul_subframe,n);
LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe); LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", n, ul_subframe);
return ul_subframe; return ul_subframe;
+6 -31
View File
@@ -56,42 +56,20 @@
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
{ {
int i; int i, r, aa, layer;
int r;
if (dlsch) { if (dlsch) {
#ifdef DEBUG_DLSCH_FREE for (layer=0; layer<4; layer++) {
printf("Freeing dlsch %p\n",dlsch); for (aa=0; aa<64; aa++) free16(dlsch->ue_spec_bf_weights[layer][aa], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
#endif free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t*));
}
for (i=0; i<dlsch->Mdlharq; i++) { for (i=0; i<dlsch->Mdlharq; i++) {
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d\n",i);
#endif
if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]) {
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d (%p)\n",i,dlsch->harq_processes[i]);
#endif
if (dlsch->harq_processes[i]->b) { if (dlsch->harq_processes[i]->b) {
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES); free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
dlsch->harq_processes[i]->b = NULL; dlsch->harq_processes[i]->b = NULL;
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b);
#endif
} }
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d c (%p)\n",i,dlsch->harq_processes[i]->c);
#endif
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) { for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
#ifdef DEBUG_DLSCH_FREE
printf("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]);
#endif
if (dlsch->harq_processes[i]->c[r]) { if (dlsch->harq_processes[i]->c[r]) {
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
dlsch->harq_processes[i]->c[r] = NULL; dlsch->harq_processes[i]->c[r] = NULL;
@@ -100,17 +78,14 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144))); free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
dlsch->harq_processes[i]->d[r] = NULL; dlsch->harq_processes[i]->d[r] = NULL;
} }
} }
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
dlsch->harq_processes[i] = NULL; dlsch->harq_processes[i] = NULL;
} }
} }
free16(dlsch,sizeof(LTE_eNB_DLSCH_t)); free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch = NULL; dlsch = NULL;
} }
} }
LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms) LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_t Nsoft,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms)
+6
View File
@@ -83,6 +83,12 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch); void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch);
/** \fn free_eNB_ulsch(LTE_eNB_DLSCH_t *dlsch)
\brief This function frees memory allocated for a particular ULSCH at eNB
@param ulsch Pointer to ULSCH to be removed
*/
void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch);
LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag);
LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag); LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag);
-22
View File
@@ -66,33 +66,12 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
#endif #endif
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch process %d\n",i);
#endif
if (ulsch->harq_processes[i]) { if (ulsch->harq_processes[i]) {
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch process %d (%p)\n",i,ulsch->harq_processes[i]);
#endif
if (ulsch->harq_processes[i]->b) { if (ulsch->harq_processes[i]->b) {
free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES); free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES);
ulsch->harq_processes[i]->b = NULL; ulsch->harq_processes[i]->b = NULL;
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch process %d b (%p)\n",i,ulsch->harq_processes[i]->b);
#endif
} }
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch process %d c (%p)\n",i,ulsch->harq_processes[i]->c);
#endif
for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) { for (r=0; r<MAX_NUM_ULSCH_SEGMENTS; r++) {
#ifdef DEBUG_ULSCH_FREE
printf("Freeing ulsch process %d c[%d] (%p)\n",i,r,ulsch->harq_processes[i]->c[r]);
#endif
if (ulsch->harq_processes[i]->c[r]) { if (ulsch->harq_processes[i]->c[r]) {
free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
ulsch->harq_processes[i]->c[r] = NULL; ulsch->harq_processes[i]->c[r] = NULL;
@@ -103,7 +82,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
ulsch->harq_processes[i] = NULL; ulsch->harq_processes[i] = NULL;
} }
} }
free16(ulsch,sizeof(LTE_UE_ULSCH_t)); free16(ulsch,sizeof(LTE_UE_ULSCH_t));
ulsch = NULL; ulsch = NULL;
} }
+6
View File
@@ -79,6 +79,12 @@
#define bigmalloc16 malloc16 #define bigmalloc16 malloc16
#define openair_free(y,x) free((y)) #define openair_free(y,x) free((y))
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#define free_and_zero(PtR) do { \
if (PtR) { \
free(PtR); \
PtR = NULL; \
} \
} while (0)
#define RX_NB_TH_MAX 2 #define RX_NB_TH_MAX 2
#define RX_NB_TH 2 #define RX_NB_TH 2
+6 -3
View File
@@ -635,7 +635,8 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
fp = &eNB->frame_parms; fp = &eNB->frame_parms;
proc = &eNB->proc.proc_rxtx[0]; proc = &eNB->proc.proc_rxtx[0];
if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return; /* TODO: check that following line is correct - in the meantime it is disabled */
//if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)==SF_UL)) return;
ul_subframe = pdcch_alloc2ul_subframe(fp,subframe); ul_subframe = pdcch_alloc2ul_subframe(fp,subframe);
ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe); ul_frame = pdcch_alloc2ul_frame(fp,frame,subframe);
@@ -670,8 +671,10 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
int do_oai =0; int do_oai =0;
int dont_send =0; int dont_send =0;
if ((ul_subframe<10)&& /* TODO: check the following test - in the meantime it is put back as it was before */
(subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is an ul_subframe that can be configured here //if ((ul_subframe<10)&&
// (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is an ul_subframe that can be configured here
if (ul_subframe<10) { // This means that there is an ul_subframe that can be configured here
LOG_D(PHY,"NFAPI: Clearing dci allocations for potential UL subframe %d\n",ul_subframe); LOG_D(PHY,"NFAPI: Clearing dci allocations for potential UL subframe %d\n",ul_subframe);
harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe); harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
+4 -2
View File
@@ -460,8 +460,10 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
} }
/* save old HARQ information needed for PHICH generation */ /* save old HARQ information needed for PHICH generation */
if ((ul_subframe < 10)&& /* TODO: check the following test - in the meantime it is put back as it was before */
(subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here //if ((ul_subframe < 10)&&
// (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here
if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe); harq_pid = subframe2harq_pid(fp,ul_frame,ul_subframe);
if (eNB->ulsch[i]) { if (eNB->ulsch[i]) {
+10
View File
@@ -69,6 +69,7 @@ typedef uint32_t frame_t;
typedef int32_t sframe_t; typedef int32_t sframe_t;
typedef uint32_t sub_frame_t; typedef uint32_t sub_frame_t;
typedef uint8_t module_id_t; typedef uint8_t module_id_t;
typedef uint8_t slice_id_t;
typedef uint8_t eNB_index_t; typedef uint8_t eNB_index_t;
typedef uint16_t ue_id_t; typedef uint16_t ue_id_t;
typedef int16_t smodule_id_t; typedef int16_t smodule_id_t;
@@ -99,6 +100,15 @@ typedef enum rb_type_e {
RADIO_ACCESS_BEARER = 2 RADIO_ACCESS_BEARER = 2
} rb_type_t; } rb_type_t;
typedef enum {
CR_ROUND = 0,
CR_SRB12 = 1,
CR_HOL = 2,
CR_LC = 3,
CR_CQI = 4,
CR_NUM = 5
} sorting_criterion_t;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// PHY TYPES // PHY TYPES
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
File diff suppressed because it is too large Load Diff
@@ -37,50 +37,10 @@
#include "flexran_agent_common.h" #include "flexran_agent_common.h"
#include "flexran_agent_extern.h" #include "flexran_agent_extern.h"
/* These types will be used to give
instructions for the type of stats reports
we need to create */
typedef struct {
uint16_t ue_rnti;
uint32_t ue_report_flags; /* Indicates the report elements
required for this UE id. See
FlexRAN specification 1.2.4.2 */
} ue_report_type_t;
typedef struct {
uint16_t cc_id;
uint32_t cc_report_flags; /* Indicates the report elements
required for this CC index. See
FlexRAN specification 1.2.4.3 */
} cc_report_type_t;
typedef struct {
int nr_ue;
ue_report_type_t *ue_report_type;
int nr_cc;
cc_report_type_t *cc_report_type;
} report_config_t;
typedef struct stats_request_config_s{
uint8_t report_type;
uint8_t report_frequency;
uint16_t period; /*In number of subframes*/
report_config_t *config;
} stats_request_config_t;
/* Initialization function for the agent structures etc */ /* Initialization function for the agent structures etc */
void flexran_agent_init_mac_agent(mid_t mod_id); void flexran_agent_init_mac_agent(mid_t mod_id);
int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
/* Statistics request protocol message constructor and destructor */
int flexran_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg);
/* Statistics reply protocol message constructor and destructor */
int flexran_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
/* Scheduling request information protocol message constructor and estructor */ /* Scheduling request information protocol message constructor and estructor */
int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
@@ -89,10 +49,18 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg);
int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg);
/* Statistics reply protocol message constructor and destructor */
int flexran_agent_mac_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */
int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg);
/* UL MAC scheduling decision protocol message constructor (empty command) and destructor */
int flexran_agent_mac_create_empty_ul_config(mid_t mod_id, Protocol__FlexranMessage **msg);
int flexran_agent_mac_destroy_ul_config(Protocol__FlexranMessage *msg);
int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
@@ -48,26 +48,20 @@ typedef struct {
/// Send to the controller all the mac stat updates that occured during this subframe /// Send to the controller all the mac stat updates that occured during this subframe
/// based on the stats request configuration /// based on the stats request configuration
void (*flexran_agent_send_update_mac_stats)(mid_t mod_id); // void (*flexran_agent_send_update_mac_stats)(mid_t mod_id);
/// Provide to the scheduler a pending dl_mac_config message /// Provide to the scheduler a pending dl_mac_config message
void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id, void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id,
Protocol__FlexranMessage **msg); Protocol__FlexranMessage **msg);
/// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that
/// dl_info is already initialized as flex_dl_mac_config and fills the
/// flex_dl_data part of it
void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
/// Notify the controller for a state change of a particular UE, by sending the proper /// Notify the controller for a state change of a particular UE, by sending the proper
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, // int (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
uint8_t state_change); // uint8_t state_change);
void *dl_scheduler_loaded_lib; void *dl_scheduler_loaded_lib;
void *ul_scheduler_loaded_lib;
/*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
} AGENT_MAC_xface; } AGENT_MAC_xface;
@@ -101,7 +101,7 @@ Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol
if (n_cell_report > 0 || n_ue_report > 0) { if (n_cell_report > 0 || n_ue_report > 0) {
/*Create header*/ /*Create header*/
int xid = old_report->header->xid; int xid = old_report->header->xid;
Protocol__FlexHeader *header; Protocol__FlexHeader *header = NULL;
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) {
goto error; goto error;
} }
@@ -180,10 +180,12 @@ Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport *
} }
} }
if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) {
copy->has_phr = original->has_phr;
copy->phr = original->phr; if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PHR) {
} copy->has_phr = original->has_phr;
copy->phr = original->phr;
}
if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) {
copy->n_rlc_report = original->n_rlc_report; copy->n_rlc_report = original->n_rlc_report;
@@ -605,7 +607,10 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) {
} else if (strcmp((char *) event.data.scalar.value, "ul_scheduler") == 0) { } else if (strcmp((char *) event.data.scalar.value, "ul_scheduler") == 0) {
// Call the proper handler // Call the proper handler
LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n"); LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n");
goto error; if (parse_ul_scheduler_config(mod_id, parser) == -1) {
LOG_D(ENB_APP, "An error occured\n");
goto error;
}
// TODO // TODO
} else if (strcmp((char *) event.data.scalar.value, "ra_scheduler") == 0) { } else if (strcmp((char *) event.data.scalar.value, "ra_scheduler") == 0) {
// Call the proper handler // Call the proper handler
@@ -698,6 +703,56 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
return -1; return -1;
} }
int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping (behavior and parameters)
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the subsystem started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the subsystem ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
if (strcmp((char *) event.data.scalar.value, "parameters") == 0) {
LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n");
if (parse_ul_scheduler_parameters(mod_id, parser) == -1) {
goto error;
}
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event; yaml_event_t event;
@@ -753,13 +808,68 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
return -1; return -1;
} }
int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
void *param;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping of parameters
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
if (mac_agent_registered[mod_id]) {
LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value);
param = dlsym(agent_mac_xface[mod_id]->ul_scheduler_loaded_lib,
(char *) event.data.scalar.value);
if (param == NULL) {
goto error;
}
apply_parameter_modification(param, parser);
} else {
goto error;
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
void *lib; void *lib;
char lib_name[120]; char lib_name[120];
char target[512]; char target[512];
snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name);
strcpy(target, local_cache); strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name); strcat(target, lib_name);
LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target); LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target);
@@ -773,7 +883,6 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
void *loaded_scheduler = dlsym(lib, function_name); void *loaded_scheduler = dlsym(lib, function_name);
if (loaded_scheduler) { if (loaded_scheduler) {
if (mac_agent_registered[mod_id]) { if (mac_agent_registered[mod_id]) {
agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler;
if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) {
dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib);
} }
@@ -101,6 +101,10 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
int parse_ul_scheduler_config(mid_t mod_id, yaml_parser_t *parser);
int parse_ul_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
int load_dl_scheduler_function(mid_t mod_id, const char *function_name); int load_dl_scheduler_function(mid_t mod_id, const char *function_name);
#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/ #endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/
@@ -0,0 +1,171 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_pdcp.c
* \brief FlexRAN agent Control Module PDCP
* \author Navid Nikaein and shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#include "flexran_agent_pdcp.h"
/*Trigger boolean for PDCP measurement*/
bool triggered_pdcp = false;
/*Flags showing if a pdcp agent has already been registered*/
unsigned int pdcp_agent_registered[NUM_MAX_ENB];
/*Array containing the Agent-PDCP interfaces*/
AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
// NUMBER_OF_UE_MAX
void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
const mid_t ue_id,
Protocol__FlexPdcpStats *pdcp_aggr_stats){
int lcid=0;
/* only calculate the DRBs */
//LOG_I(FLEXRAN_AGENT, "enb %d ue %d \n", mod_id, ue_id);
for (lcid=NUM_MAX_SRB ; lcid < NUM_MAX_SRB + NUM_MAX_DRB; lcid++){
pdcp_aggr_stats->pkt_tx += flexran_get_pdcp_tx(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_tx_bytes += flexran_get_pdcp_tx_bytes(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_tx_w += flexran_get_pdcp_tx_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_tx_bytes_w += flexran_get_pdcp_tx_bytes_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_tx_aiat += flexran_get_pdcp_tx_aiat(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_tx_aiat_w += flexran_get_pdcp_tx_aiat_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx += flexran_get_pdcp_rx(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_bytes += flexran_get_pdcp_rx_bytes(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_w += flexran_get_pdcp_rx_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_bytes_w += flexran_get_pdcp_rx_bytes_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_aiat += flexran_get_pdcp_rx_aiat(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_aiat_w += flexran_get_pdcp_rx_aiat_w(mod_id,ue_id,lcid);
pdcp_aggr_stats->pkt_rx_oo += flexran_get_pdcp_rx_oo(mod_id,ue_id,lcid);
}
}
int flexran_agent_pdcp_stats_reply(mid_t mod_id,
const report_config_t *report_config,
Protocol__FlexUeStatsReport **ue_report,
Protocol__FlexCellStatsReport **cell_report) {
// Protocol__FlexHeader *header;
int i;
// int cc_id = 0;
/* Allocate memory for list of UE reports */
if (report_config->nr_ue > 0) {
for (i = 0; i < report_config->nr_ue; i++) {
/* Check flag for creation of buffer status report */
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PDCP_STATS) {
Protocol__FlexPdcpStats *pdcp_aggr_stats;
pdcp_aggr_stats = malloc(sizeof(Protocol__FlexPdcpStats));
if (pdcp_aggr_stats == NULL)
goto error;
protocol__flex_pdcp_stats__init(pdcp_aggr_stats);
flexran_agent_pdcp_aggregate_stats(mod_id, i, pdcp_aggr_stats);
pdcp_aggr_stats->has_pkt_tx=1;
pdcp_aggr_stats->has_pkt_tx_bytes =1;
pdcp_aggr_stats->has_pkt_tx_w=1;
pdcp_aggr_stats->has_pkt_tx_bytes_w =1;
pdcp_aggr_stats->has_pkt_tx_aiat =1;
pdcp_aggr_stats->has_pkt_tx_aiat_w =1;
pdcp_aggr_stats->pkt_tx_sn = flexran_get_pdcp_tx_sn(mod_id, i, DEFAULT_DRB);
pdcp_aggr_stats->has_pkt_tx_sn =1;
pdcp_aggr_stats->has_pkt_rx =1;
pdcp_aggr_stats->has_pkt_rx_bytes =1;
pdcp_aggr_stats->has_pkt_rx_w =1;
pdcp_aggr_stats->has_pkt_rx_bytes_w =1;
pdcp_aggr_stats->has_pkt_rx_aiat =1;
pdcp_aggr_stats->has_pkt_rx_aiat_w =1;
pdcp_aggr_stats->has_pkt_rx_oo =1;
pdcp_aggr_stats->pkt_rx_sn = flexran_get_pdcp_rx_sn(mod_id, i, DEFAULT_DRB);
pdcp_aggr_stats->has_pkt_rx_sn =1;
pdcp_aggr_stats->sfn = flexran_get_pdcp_sfn(mod_id);
pdcp_aggr_stats->has_sfn =1;
ue_report[i]->pdcp_stats = pdcp_aggr_stats;
}
}
} else {
LOG_D(FLEXRAN_AGENT, "no UE\n");
}
return 0;
error:
LOG_W(FLEXRAN_AGENT, "Can't allocate PDCP stats\n");
/* if (cell_report != NULL)
free(cell_report);
if (ue_report != NULL)
free(ue_report);
*/
return -1;
}
int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
if (pdcp_agent_registered[mod_id]) {
LOG_E(PDCP, "PDCP agent for eNB %d is already registered\n", mod_id);
return -1;
}
//xface->flexran_pdcp_stats_measurement = NULL;
pdcp_agent_registered[mod_id] = 1;
agent_pdcp_xface[mod_id] = xface;
return 0;
}
int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface) {
//xface->agent_ctxt = NULL;
//xface->flexran_pdcp_stats_measurement = NULL;
pdcp_agent_registered[mod_id] = 0;
agent_pdcp_xface[mod_id] = NULL;
return 0;
}
@@ -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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_pdcp.h
* \brief FlexRAN agent Control Module PDCP header
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#ifndef FLEXRAN_AGENT_PDCP_H_
#define FLEXRAN_AGENT_PDCP_H_
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h"
#include "flexran_agent_common.h"
#include "flexran_agent_defs.h"
#include "flexran_agent_pdcp_defs.h"
#include "flexran_agent_ran_api.h"
/**********************************
* FlexRAN agent - technology PDCP API
**********************************/
/* Send to the controller all the pdcp stat updates that occured during this subframe*/
int flexran_agent_pdcp_stats_reply(mid_t mod_id,
const report_config_t *report_config,
Protocol__FlexUeStatsReport **ue_report,
Protocol__FlexCellStatsReport **cell_report);
/* Get the stats from RAN API and aggregate them per USER*/
void flexran_agent_pdcp_aggregate_stats(const mid_t mod_id,
const mid_t ue_id,
Protocol__FlexPdcpStats *pdcp_aggr_stats);
/*Register technology specific interface callbacks*/
int flexran_agent_register_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface *xface);
/*Unregister technology specific callbacks*/
int flexran_agent_unregister_pdcp_xface(mid_t mod_id, AGENT_PDCP_xface*xface);
#endif
@@ -0,0 +1,63 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
#define __FLEXRAN_AGENT_PDCP_PRIMITIVES_H__
#include "flexran_agent_defs.h"
#include "flexran.pb-c.h"
#include "header.pb-c.h"
/*PDCP aggregated Packet stats */
/*
typedef struct pdcp_aggr_stats_s {
int32_t rnti;
int32_t pkt_tx;
int32_t pkt_tx_bytes;
int32_t pkt_tx_sn;
int32_t pkt_tx_rate_s;
int32_t pkt_tx_throughput_s;
int32_t pkt_tx_aiat;
int32_t pkt_tx_aiat_s;
int32_t pkt_rx;
int32_t pkt_rx_bytes;
int32_t pkt_rx_sn;
int32_t pkt_rx_rate_s;
int32_t pkt_rx_goodput_s;
int32_t pkt_rx_aiat;
int32_t pkt_rx_aiat_s;
int32_t pkt_rx_oo;
} pdcp_aggr_stats_t;
*/
/* FLEXRAN AGENT-PDCP Interface */
typedef struct {
// PDCP statistics
void (*flexran_pdcp_stats_measurement)(mid_t mod_id, uint16_t rnti, uint16_t seq_num, uint32_t size);
} AGENT_PDCP_xface;
#endif
@@ -0,0 +1,673 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_mac.c
* \brief FlexRAN agent Control Module RRC
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#include "flexran_agent_rrc.h"
#include "liblfds700.h"
#include "log.h"
/*Trigger boolean for RRC measurement*/
bool triggered_rrc = false;
/*Flags showing if an rrc agent has already been registered*/
unsigned int rrc_agent_registered[NUM_MAX_ENB];
/*Array containing the Agent-RRC interfaces*/
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
int size;
Protocol__FlexranMessage *msg = NULL;
Protocol__FlexHeader *header = NULL;
void *data;
int priority = 0;
err_code_t err_code;
int xid = 0;
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
goto error;
Protocol__FlexUeStateChange *ue_state_change_msg;
ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange));
if(ue_state_change_msg == NULL) {
goto error;
}
protocol__flex_ue_state_change__init(ue_state_change_msg);
ue_state_change_msg->has_type = 1;
ue_state_change_msg->type = state_change;
Protocol__FlexUeConfig *config;
config = malloc(sizeof(Protocol__FlexUeConfig));
if (config == NULL) {
goto error;
}
protocol__flex_ue_config__init(config);
if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) {
// Simply set the rnti of the UE
config->has_rnti = 1;
config->rnti = rnti;
} else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED
|| state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) {
int i = find_UE_id(mod_id, rnti);
config->has_rnti = 1;
config->rnti = rnti;
if(flexran_get_time_alignment_timer(mod_id,i) != -1) {
config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i);
config->has_time_alignment_timer = 1;
}
if(flexran_get_meas_gap_config(mod_id,i) != -1){
config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i);
config->has_meas_gap_config_pattern = 1;
}
if(config->has_meas_gap_config_pattern == 1 &&
config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) {
config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i);
config->has_meas_gap_config_sf_offset = 1;
}
//TODO: Set the SPS configuration (Optional)
//Not supported for now, so we do not set it
//TODO: Set the SR configuration (Optional)
//We do not set it for now
//TODO: Set the CQI configuration (Optional)
//We do not set it for now
if(flexran_get_ue_transmission_mode(mod_id,i) != -1) {
config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i);
config->has_transmission_mode = 1;
}
config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i);
config->has_ue_aggregated_max_bitrate_ul = 1;
config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i);
config->has_ue_aggregated_max_bitrate_dl = 1;
//TODO: Set the UE capabilities
Protocol__FlexUeCapabilities *c_capabilities;
c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities));
protocol__flex_ue_capabilities__init(c_capabilities);
//TODO: Set half duplex (FDD operation)
c_capabilities->has_half_duplex = 0;
c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i);
//TODO: Set intra-frame hopping flag
c_capabilities->has_intra_sf_hopping = 0;
c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
//TODO: Set support for type 2 hopping with n_sb > 1
c_capabilities->has_type2_sb_1 = 0;
c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
//TODO: Set ue category
c_capabilities->has_ue_category = 0;
c_capabilities->ue_category = 1;//flexran_get_ue_category(i);
//TODO: Set UE support for resource allocation type 1
c_capabilities->has_res_alloc_type1 = 0;
c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
//Set the capabilites to the message
config->capabilities = c_capabilities;
if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
config->has_ue_transmission_antenna = 1;
config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
}
if(flexran_get_tti_bundling(mod_id,i) != -1) {
config->has_tti_bundling = 1;
config->tti_bundling = flexran_get_tti_bundling(mod_id,i);
}
if(flexran_get_maxHARQ_TX(mod_id,i) != -1){
config->has_max_harq_tx = 1;
config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
}
if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
config->has_beta_offset_ack_index = 1;
config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
}
if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
config->has_beta_offset_ri_index = 1;
config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
}
if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
config->has_beta_offset_cqi_index = 1;
config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
}
/* assume primary carrier */
if(flexran_get_ack_nack_simultaneous_trans(mod_id,i,0) != -1) {
config->has_ack_nack_simultaneous_trans = 1;
config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i,0);
}
if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
config->has_simultaneous_ack_nack_cqi = 1;
config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
}
if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
config->has_aperiodic_cqi_rep_mode = 1;
int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i);
if (mode > 4) {
config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE;
} else {
config->aperiodic_cqi_rep_mode = mode;
}
}
if(flexran_get_tdd_ack_nack_feedback_mode(mod_id, i) != -1) {
config->has_tdd_ack_nack_feedback = 1;
config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback_mode(mod_id,i);
}
if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
config->has_ack_nack_repetition_factor = 1;
config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
}
if(flexran_get_extended_bsr_size(mod_id, i) != -1) {
config->has_extended_bsr_size = 1;
config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
}
config->has_pcell_carrier_index = 1;
config->pcell_carrier_index = UE_PCCID(mod_id, i);
//TODO: Set carrier aggregation support (boolean)
config->has_ca_support = 0;
config->ca_support = 0;
if(config->has_ca_support){
//TODO: Set cross carrier scheduling support (boolean)
config->has_cross_carrier_sched_support = 1;
config->cross_carrier_sched_support = 0;
//TODO: Set secondary cells configuration
// We do not set it for now. No carrier aggregation support
//TODO: Set deactivation timer for secondary cell
config->has_scell_deactivation_timer = 0;
config->scell_deactivation_timer = 0;
}
} else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) {
// TODO: Not supported for now. Leave blank
}
ue_state_change_msg->config = config;
msg = malloc(sizeof(Protocol__FlexranMessage));
if (msg == NULL) {
goto error;
}
protocol__flexran_message__init(msg);
msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG;
msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
msg->ue_state_change_msg = ue_state_change_msg;
data = flexran_agent_pack_message(msg, &size);
/*Send sr info using the MAC channel of the eNB*/
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
error:
LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
}
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG)
goto error;
free(msg->ue_state_change_msg->header);
//TODO: Free the contents of the UE config structure
free(msg->ue_state_change_msg);
free(msg);
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
/* this is called by RRC as a part of rrc xface . The controller previously requested this*/
void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t* measResults) {
int i;
// int priority = 0; // Warning Preventing
// void *data;
// int size;
// err_code_t err_code = -100;
triggered_rrc = true;
int num;
num = flexran_get_num_ues (mod_id);
meas_stats = malloc(sizeof(rrc_meas_stats) * num);
for (i = 0; i < num; i++){
meas_stats[i].rnti = flexran_get_ue_crnti(mod_id, i);
meas_stats[i].meas_id = flexran_get_rrc_pcell_measid(mod_id,i);
meas_stats[i].rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i) - 140;
// measResults->measResultPCell.rsrpResult - 140;
meas_stats[i].rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i)/2 - 20;
// (measResults->measResultPCell.rsrqResult)/2 - 20;
}
// repl->neigh_meas = NULL;
// if (meas->measResultNeighCells != NULL) {
// /*
// * Neighboring cells measurements performed by UE.
// */
// NeighCellsMeasurements *neigh_meas;
// neigh_meas = malloc(sizeof(NeighCellsMeasurements));
// if (neigh_meas == NULL)
// goto error;
// neigh_cells_measurements__init(neigh_meas);
// /* EUTRAN RRC Measurements. */
// if (meas->measResultNeighCells->present ==
// MeasResults__measResultNeighCells_PR_measResultListEUTRA) {
// MeasResultListEUTRA_t meas_list = meas->measResultNeighCells->
// choice.measResultListEUTRA;
// /* Set the number of EUTRAN measurements present in report. */
// neigh_meas->n_eutra_meas = meas_list.list.count;
// if (neigh_meas->n_eutra_meas > 0) {
// /* Initialize EUTRAN measurements. */
// EUTRAMeasurements **eutra_meas;
// eutra_meas = malloc(sizeof(EUTRAMeasurements *) *
// neigh_meas->n_eutra_meas);
// for (i = 0; i < neigh_meas->n_eutra_meas; i++) {
// eutra_meas[i] = malloc(sizeof(EUTRAMeasurements));
// eutra_measurements__init(eutra_meas[i]);
// /* Fill in the physical cell identifier. */
// eutra_meas[i]->has_phys_cell_id = 1;
// eutra_meas[i]->phys_cell_id = meas_list.list.array[i]->
// physCellId;
// // log_i(agent,"PCI of Target %d", eutra_meas[i]->phys_cell_id);
// /* Check for Reference signal measurements. */
// if (&(meas_list.list.array[i]->measResult)) {
// /* Initialize Ref. signal measurements. */
// EUTRARefSignalMeas *meas_result;
// meas_result = malloc(sizeof(EUTRARefSignalMeas));
// eutra_ref_signal_meas__init(meas_result);
// if (meas_list.list.array[i]->measResult.rsrpResult) {
// meas_result->has_rsrp = 1;
// meas_result->rsrp = RSRP_meas_mapping[*(meas_list.
// list.array[i]->measResult.rsrpResult)];
// // log_i(agent,"RSRP of Target %d", meas_result->rsrp);
// }
// if (meas_list.list.array[i]->measResult.rsrqResult) {
// meas_result->has_rsrq = 1;
// meas_result->rsrq = RSRQ_meas_mapping[*(meas_list.
// list.array[i]->measResult.rsrqResult)];
// // log_i(agent,"RSRQ of Target %d", meas_result->rsrq);
// }
// eutra_meas[i]->meas_result = meas_result;
// }
// /* Check for CGI measurements. */
// if (meas_list.list.array[i]->cgi_Info) {
// /* Initialize CGI measurements. */
// EUTRACgiMeasurements *cgi_meas;
// cgi_meas = malloc(sizeof(EUTRACgiMeasurements));
// eutra_cgi_measurements__init(cgi_meas);
// /* EUTRA Cell Global Identity (CGI). */
// CellGlobalIdEUTRA *cgi;
// cgi = malloc(sizeof(CellGlobalIdEUTRA));
// cell_global_id__eutra__init(cgi);
// cgi->has_cell_id = 1;
// CellIdentity_t cId = meas_list.list.array[i]->
// cgi_Info->cellGlobalId.cellIdentity;
// cgi->cell_id = (cId.buf[0] << 20) + (cId.buf[1] << 12) +
// (cId.buf[2] << 4) + (cId.buf[3] >> 4);
// /* Public land mobile network identifier of neighbor
// * cell.
// */
// PlmnIdentity *plmn_id;
// plmn_id = malloc(sizeof(PlmnIdentity));
// plmn_identity__init(plmn_id);
// MNC_t mnc = meas_list.list.array[i]->
// cgi_Info->cellGlobalId.plmn_Identity.mnc;
// plmn_id->has_mnc = 1;
// plmn_id->mnc = 0;
// for (m = 0; m < mnc.list.count; m++) {
// plmn_id->mnc += *mnc.list.array[m] *
// ((uint32_t) pow(10, mnc.list.count - m - 1));
// }
// MCC_t *mcc = meas_list.list.array[i]->
// cgi_Info->cellGlobalId.plmn_Identity.mcc;
// plmn_id->has_mcc = 1;
// plmn_id->mcc = 0;
// for (m = 0; m < mcc->list.count; m++) {
// plmn_id->mcc += *mcc->list.array[m] *
// ((uint32_t) pow(10, mcc->list.count - m - 1));
// }
// TrackingAreaCode_t tac = meas_list.list.array[i]->
// cgi_Info->trackingAreaCode;
// cgi_meas->has_tracking_area_code = 1;
// cgi_meas->tracking_area_code = (tac.buf[0] << 8) +
// (tac.buf[1]);
// PLMN_IdentityList2_t *plmn_l = meas_list.list.array[i]->
// cgi_Info->plmn_IdentityList;
// cgi_meas->n_plmn_id = plmn_l->list.count;
// /* Set the PLMN ID list in CGI measurements. */
// PlmnIdentity **plmn_id_l;
// plmn_id_l = malloc(sizeof(PlmnIdentity *) *
// cgi_meas->n_plmn_id);
// MNC_t mnc2;
// MCC_t *mcc2;
// for (m = 0; m < cgi_meas->n_plmn_id; m++) {
// plmn_id_l[m] = malloc(sizeof(PlmnIdentity));
// plmn_identity__init(plmn_id_l[m]);
// mnc2 = plmn_l->list.array[m]->mnc;
// plmn_id_l[m]->has_mnc = 1;
// plmn_id_l[m]->mnc = 0;
// for (k = 0; k < mnc2.list.count; k++) {
// plmn_id_l[m]->mnc += *mnc2.list.array[k] *
// ((uint32_t) pow(10, mnc2.list.count - k - 1));
// }
// mcc2 = plmn_l->list.array[m]->mcc;
// plmn_id_l[m]->has_mcc = 1;
// plmn_id_l[m]->mcc = 0;
// for (k = 0; k < mcc2->list.count; k++) {
// plmn_id_l[m]->mcc += *mcc2->list.array[k] *
// ((uint32_t) pow(10, mcc2->list.count - k - 1));
// }
// }
// cgi_meas->plmn_id = plmn_id_l;
// eutra_meas[i]->cgi_meas = cgi_meas;
// }
// }
// neigh_meas->eutra_meas = eutra_meas;
// }
// }
// repl->neigh_meas = neigh_meas;
// }
/* Attach the RRC measurement reply message to RRC measurements message. */
// mrrc_meas->repl = repl;
/* Attach RRC measurement message to triggered event message. */
// te->mrrc_meas = mrrc_meas;
// te->has_action = 0;
/* Attach the triggered event message to main message. */
// reply->te = te;
/* Send the report to controller. */
// if (flexran_agent_msg_send(b_id, reply) < 0) {
// goto error;
// }
/* Free the measurement report received from UE. */
// ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
/* Free the params. */
// free(p);
// stats_reply_msg->cell_report = cell_report;
// stats_reply_msg->ue_report = ue_report;
// msg = malloc(sizeof(Protocol__FlexranMessage));
// if(msg == NULL)
// goto error;
// protocol__flexran_message__init(msg);
// msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
// msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
// msg->stats_reply_msg = stats_reply_msg;
// data = flexran_agent_pack_message(msg, &size);
// if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
// err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
// goto error;
// }
// LOG_I(FLEXRAN_AGENT,"RRC Trigger is done \n");
return;
// error:
// LOG_E(FLEXRAN_AGENT, "Could not send UE state message becasue of %d \n",err_code);
/* Free the measurement report received from UE. */
// ASN_STRUCT_FREE(asn_DEF_MeasResults, p->meas);
/* Free the params. */
// free(p);
// return -1;
}
int flexran_agent_rrc_stats_reply(mid_t mod_id,
const report_config_t *report_config,
Protocol__FlexUeStatsReport **ue_report,
Protocol__FlexCellStatsReport **cell_report) {
// Protocol__FlexHeader *header;
int i,j;
/* Allocate memory for list of UE reports */
if (report_config->nr_ue > 0) {
for (i = 0; i < report_config->nr_ue; i++) {
/* Check flag for creation of buffer status report */
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RRC_MEASUREMENTS) {
/*Source Cell*/
Protocol__FlexRrcMeasurements *rrc_measurements;
rrc_measurements = malloc(sizeof(Protocol__FlexRrcMeasurements));
if (rrc_measurements == NULL)
goto error;
protocol__flex_rrc_measurements__init(rrc_measurements);
rrc_measurements->measid = flexran_get_rrc_pcell_measid(mod_id,i);
rrc_measurements->has_measid = 1;
rrc_measurements->pcell_rsrp = flexran_get_rrc_pcell_rsrp(mod_id,i);
rrc_measurements->has_pcell_rsrp = 1;
rrc_measurements->pcell_rsrq = flexran_get_rrc_pcell_rsrq(mod_id,i);
rrc_measurements->has_pcell_rsrq = 1 ;
/* Target Cell, Neghibouring*/
Protocol__FlexNeighCellsMeasurements *neigh_meas;
neigh_meas = malloc(sizeof(Protocol__FlexNeighCellsMeasurements));
if (neigh_meas == NULL)
goto error;
protocol__flex_neigh_cells_measurements__init(neigh_meas);
neigh_meas->n_eutra_meas = flexran_get_rrc_num_ncell(mod_id, i);
Protocol__FlexEutraMeasurements **eutra_meas = NULL;
if (neigh_meas->n_eutra_meas > 0){
eutra_meas = malloc(sizeof(Protocol__FlexEutraMeasurements) * neigh_meas->n_eutra_meas);
if (eutra_meas == NULL)
goto error;
for (j = 0; j < neigh_meas->n_eutra_meas; j++ ){
eutra_meas[j] = malloc(sizeof(Protocol__FlexEutraMeasurements));
if (eutra_meas[j] == NULL)
goto error;
protocol__flex_eutra_measurements__init(eutra_meas[j]);
eutra_meas[j]->phys_cell_id = flexran_get_rrc_neigh_phy_cell_id(mod_id, i, j);
eutra_meas[j]->has_phys_cell_id = 1;
/*TODO: Extend for CGI and PLMNID*/
Protocol__FlexEutraRefSignalMeas *meas_result;
meas_result = malloc(sizeof(Protocol__FlexEutraRefSignalMeas));
protocol__flex_eutra_ref_signal_meas__init(meas_result);
meas_result->rsrp = flexran_get_rrc_neigh_rsrp(mod_id, i, eutra_meas[j]->phys_cell_id);
meas_result->has_rsrp = 1;
meas_result->rsrq = flexran_get_rrc_neigh_rsrq(mod_id, i, eutra_meas[j]->phys_cell_id);
meas_result->has_rsrq = 1;
eutra_meas[j]->meas_result = meas_result;
}
neigh_meas->eutra_meas = eutra_meas;
rrc_measurements->neigh_meas = neigh_meas;
}
ue_report[i]->rrc_measurements = rrc_measurements;
}
}
}
/* To be considered for RRC signaling of cell*/
// if (report_config->nr_cc > 0) {
// // Fill in the Cell reports
// for (i = 0; i < report_config->nr_cc; i++) {
// /* Check flag for creation of noise and interference report */
// if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) {
// // TODO: Fill in the actual noise and interference report for this cell
// Protocol__FlexNoiseInterferenceReport *ni_report;
// ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport));
// if(ni_report == NULL)
// goto error;
// protocol__flex_noise_interference_report__init(ni_report);
// // Current frame and subframe number
// ni_report->sfn_sf = flexran_get_sfn_sf(enb_id);
// ni_report->has_sfn_sf = 1;
// //TODO:Received interference power in dbm
// ni_report->rip = 0;
// ni_report->has_rip = 1;
// //TODO:Thermal noise power in dbm
// ni_report->tnp = 0;
// ni_report->has_tnp = 1;
// ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0);
// ni_report->has_p0_nominal_pucch = 1;
// cell_report[i]->noise_inter_report = ni_report;
// }
// }
// }
return 0;
error:
for (i = 0; i < report_config->nr_ue; i++){
if (ue_report[i]->rrc_measurements->neigh_meas != NULL){
for (j = 0; j < flexran_get_rrc_num_ncell(mod_id, i); j++){
free(ue_report[i]->rrc_measurements->neigh_meas->eutra_meas[j]);
}
free(ue_report[i]->rrc_measurements->neigh_meas);
}
}
if (cell_report != NULL)
free(cell_report);
if (ue_report != NULL)
free(ue_report);
return -1;
}
int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
if (rrc_agent_registered[mod_id]) {
LOG_E(RRC, "RRC agent for eNB %d is already registered\n", mod_id);
return -1;
}
// xface->flexran_agent_send_update_rrc_stats = flexran_agent_send_update_rrc_stats;
xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change;
xface->flexran_trigger_rrc_measurements = flexran_trigger_rrc_measurements;
rrc_agent_registered[mod_id] = 1;
agent_rrc_xface[mod_id] = xface;
return 0;
}
int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface) {
//xface->agent_ctxt = NULL;
// xface->flexran_agent_send_update_rrc_stats = NULL;
xface->flexran_agent_notify_ue_state_change = NULL;
xface->flexran_trigger_rrc_measurements = NULL;
rrc_agent_registered[mod_id] = 0;
agent_rrc_xface[mod_id] = NULL;
return 0;
}
@@ -0,0 +1,70 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_rrc.h
* \brief FlexRAN agent Control Module RRC header
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#ifndef FLEXRAN_AGENT_RRC_H_
#define FLEXRAN_AGENT_RRC_H_
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h"
#include "flexran_agent_common.h"
#include "flexran_agent_rrc_defs.h"
/* Initialization function for the agent structures etc */
void flexran_agent_init_rrc_agent(mid_t mod_id);
/* UE state change message constructor and destructor */
void flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
/**********************************
* FlexRAN agent - technology RRC API
**********************************/
/* Send to the controller all the rrc stat updates that occured during this subframe*/
// void flexran_agent_send_update_rrc_stats(mid_t mod_id);
/* this is called by RRC as a part of rrc xface . The controller previously requested this*/
void flexran_trigger_rrc_measurements (mid_t mod_id, MeasResults_t *);
/* Statistics reply protocol message constructor and destructor */
int flexran_agent_rrc_stats_reply(mid_t mod_id, const report_config_t *report_config, Protocol__FlexUeStatsReport **ue_report, Protocol__FlexCellStatsReport **cell_report);
int flexran_agent_rrc_destroy_stats_reply(Protocol__FlexranMessage *msg);
/*Register technology specific interface callbacks*/
int flexran_agent_register_rrc_xface(mid_t mod_id, AGENT_RRC_xface *xface);
/*Unregister technology specific callbacks*/
int flexran_agent_unregister_rrc_xface(mid_t mod_id, AGENT_RRC_xface*xface);
#endif
@@ -0,0 +1,69 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_rrc_defs.h
* \brief FlexRAN agent - RRC interface primitives
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
* \mail
*/
#ifndef __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
#define __FLEXRAN_AGENT_RRC_PRIMITIVES_H__
#include "flexran_agent_defs.h"
#include "flexran.pb-c.h"
#include "header.pb-c.h"
#include "MeasResults.h"
#define RINGBUFFER_SIZE 100
typedef struct
{
int32_t rnti;
int32_t meas_id;
int32_t rsrp;
int32_t rsrq;
/*To Be Extended*/
}rrc_meas_stats;
/* RRC CMI statistics */
rrc_meas_stats * meas_stats;
/* FLEXRAN AGENT-RRC Interface */
typedef struct {
/// Notify the controller for a state change of a particular UE, by sending the proper
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
uint8_t state_change);
void (*flexran_trigger_rrc_measurements)(mid_t mod_id, MeasResults_t* measResults);
} AGENT_RRC_xface;
#endif
@@ -38,6 +38,11 @@ message flex_cell_config {
optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only
optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values
optional uint32 carrier_index = 34; // Carrier component index optional uint32 carrier_index = 34; // Carrier component index
optional uint32 dl_freq = 35; // operating downlink frequency
optional uint32 ul_freq = 36; // operating uplink frequency
optional uint32 eutra_band= 37; // operating band
optional int32 dl_pdsch_power = 38; // operating downlink power
optional int32 ul_pusch_power = 39; // operating uplink power
} }
message flex_ue_config { message flex_ue_config {
@@ -76,6 +81,7 @@ message flex_ue_config {
optional uint32 pcell_carrier_index = 27; // Index of primary cell optional uint32 pcell_carrier_index = 27; // Index of primary cell
repeated flex_scell_config scell_config = 28; // Secondary cells configuration repeated flex_scell_config scell_config = 28; // Secondary cells configuration
optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell
optional uint64 imsi = 30;
} }
message flex_lc_ue_config { message flex_lc_ue_config {
@@ -3,4 +3,4 @@ package protocol;
enum flex_control_delegation_type { enum flex_control_delegation_type {
FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation
} }
@@ -16,6 +16,12 @@ message flex_dl_data {
optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA
} }
message flex_ul_data {
optional uint32 rnti = 1;
optional flex_ul_dci ul_dci = 2;
}
// //
// Body of the RAR scheduler configuration // Body of the RAR scheduler configuration
// //
@@ -56,4 +62,4 @@ message flex_pdcch_ofdm_sym_count {
enum flex_broadcast_type { enum flex_broadcast_type {
FLBT_BCCH = 0; FLBT_BCCH = 0;
FLBT_PCCH = 1; FLBT_PCCH = 1;
} }
+17 -1
View File
@@ -8,6 +8,7 @@ import "config_messages.proto";
import "controller_commands.proto"; import "controller_commands.proto";
import "control_delegation.proto"; import "control_delegation.proto";
message flexran_message { message flexran_message {
optional flexran_direction msg_dir = 100; optional flexran_direction msg_dir = 100;
oneof msg { oneof msg {
@@ -28,6 +29,8 @@ message flexran_message {
flex_ue_state_change ue_state_change_msg = 15; flex_ue_state_change ue_state_change_msg = 15;
flex_control_delegation control_delegation_msg = 16; flex_control_delegation control_delegation_msg = 16;
flex_agent_reconfiguration agent_reconfiguration_msg = 17; flex_agent_reconfiguration agent_reconfiguration_msg = 17;
flex_rrc_triggering rrc_triggering = 18;
flex_ul_mac_config ul_mac_config_msg = 19;
} }
} }
@@ -130,6 +133,7 @@ message flex_enb_config_reply {
optional flex_header header = 1; optional flex_header header = 1;
optional uint32 eNB_id = 2; // Unique id to distinguish the eNB optional uint32 eNB_id = 2; // Unique id to distinguish the eNB
repeated flex_cell_config cell_config = 3; repeated flex_cell_config cell_config = 3;
optional uint32 device_spec = 4;
} }
message flex_ue_config_request { message flex_ue_config_request {
@@ -163,6 +167,18 @@ message flex_dl_mac_config {
repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC
} }
message flex_ul_mac_config {
optional flex_header header = 1;
optional uint32 sfn_sf = 2;
repeated flex_ul_data ul_ue_data = 3;
}
message flex_rrc_triggering {
optional flex_header header = 1;
optional string rrc_trigger = 2;
}
// //
// UE state change message // UE state change message
// //
@@ -190,7 +206,7 @@ message flex_control_delegation {
message flex_agent_reconfiguration { message flex_agent_reconfiguration {
optional flex_header header = 1; optional flex_header header = 1;
optional string policy = 2; // The policy changes using YAML syntax in string format optional string policy = 2; // The policy changes using YAML syntax in string format
} }
// Extensions of the echo request and reply // Extensions of the echo request and reply
@@ -40,5 +40,7 @@ enum flex_type {
// Control delegation messages // Control delegation messages
FLPT_DELEGATE_CONTROL = 15; FLPT_DELEGATE_CONTROL = 15;
FLPT_RECONFIGURE_AGENT = 16; FLPT_RECONFIGURE_AGENT = 16;
FLPT_RRC_TRIGGERING = 17;
FLPT_UL_MAC_CONFIG = 18;
} }
@@ -36,6 +36,39 @@ message flex_dl_dci {
optional uint32 cif = 27; // CIF for cross-carrier scheduling optional uint32 cif = 27; // CIF for cross-carrier scheduling
} }
message flex_ul_dci {
optional uint32 rnti = 1;
optional uint32 rb_start = 2; // The start RB allocated to the UE
optional uint32 rb_len = 3; // The number of RBs allocated to the UE
optional uint32 mcs = 4; // Modulation and coding scheme
optional uint32 cyclic_shift2 = 5; // match DCI format 0/4 PDU
optional uint32 freq_hop_flag = 6; // 0 no hopping, 1 hoppping
optional uint32 freq_hop_map = 7; // Frequency hopping bits (0..4)
optional uint32 ndi = 8; // New data indicator
optional uint32 rv = 9; // Redundancy version
optional uint32 harq_pid = 10; // The harq process id
optional uint32 ultx_mode = 11; // A FLULM_* value
optional uint32 tbs_size = 12; // The size of each TBS
optional uint32 n_srs = 13; // Overlap indication with srs
optional uint32 res_alloc = 14; // Type of resource allocation
optional uint32 size = 15; // Size of the ULSCH PDU in bytes for UL Grant.
optional uint32 dai = 16; // TDD only
// optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag
// optional uint32 pdcch_order = 19;
// optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1
// optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1
// optional uint32 tbs_idx = 23; // The TBS index for Format 1A
}
// //
// Messages related to the creation of RLC PDUs // Messages related to the creation of RLC PDUs
// //
@@ -74,4 +107,4 @@ enum flex_vrb_format {
enum flex_ngap_val { enum flex_ngap_val {
FLNGV_1 = 0; FLNGV_1 = 0;
FLNGV_2 = 1; FLNGV_2 = 1;
} }
@@ -182,3 +182,90 @@ message flex_noise_interference_report {
optional int32 p0_nominal_pucch = 4; optional int32 p0_nominal_pucch = 4;
} }
//
// RRC Measurements Primitives
//
message flex_rrc_measurements {
// Measurement identifier.
optional int32 measid = 1;
// Primary Cell Reference Signal Received Power (RSRP).
optional int32 pcell_rsrp = 2;
// Primary Cell Reference Signal Received Quality (RSRQ).
optional int32 pcell_rsrq = 3;
// Neighboring cells measurements performed by UE.
optional flex_neigh_cells_measurements neigh_meas = 4;
}
message flex_neigh_cells_measurements {
// Neighboring EUTRA cells measurements.
repeated flex_eutra_measurements eutra_meas = 1;
}
message flex_eutra_measurements {
// Physical Cell identifier.
optional int32 phys_cell_id = 1;
// EUTRA Cell Global Identity (CGI) measurement.
optional flex_eutra_cgi_measurements cgi_meas = 2;
// EUTRA nearby cell reference signal measurement.
optional flex_eutra_ref_signal_meas meas_result = 3;
}
message flex_eutra_cgi_measurements {
// EUTRA Cell Global Identity (CGI).
optional flex_cell_global_eutra_id cgi = 1;
// Tracking area code of the neighbor cell.
optional uint32 tracking_area_code = 2;
// Public land mobile network identifiers of neighbor cell.
repeated flex_plmn_identity plmn_id = 3;
}
message flex_cell_global_eutra_id {
// Public land mobile network identifier of neighbor cell.
optional flex_plmn_identity plmn_id = 1;
// Cell identifier of neighbor cell.
optional uint32 cell_id = 2;
}
message flex_plmn_identity {
// Mobile Network Code (MNC).
repeated uint32 mnc = 1;
// Mobile Country Code (MCC).
repeated uint32 mcc = 2;
// tracking area code
repeated uint32 tac = 3;
}
message flex_eutra_ref_signal_meas {
// Neighboring Cell RSRP
optional int32 rsrp = 1;
// Neighboring Cell RSRQ
optional int32 rsrq = 2;
}
//
// PDCP Statistics
//
message flex_pdcp_stats {
optional uint32 pkt_tx = 1;
optional uint32 pkt_tx_bytes = 2;
optional uint32 pkt_tx_sn = 3;
optional uint32 pkt_tx_w = 4;
optional uint32 pkt_tx_bytes_w = 5;
optional uint32 pkt_tx_aiat = 7;
optional uint32 pkt_tx_aiat_w = 8;
optional uint32 pkt_rx = 9;
optional uint32 pkt_rx_bytes = 10;
optional uint32 pkt_rx_sn = 11;
optional uint32 pkt_rx_w = 12;
optional uint32 pkt_rx_bytes_w = 13;
optional uint32 pkt_rx_aiat = 14;
optional uint32 pkt_rx_aiat_w = 15;
optional uint32 pkt_rx_oo = 16;
optional uint64 sfn=17;
}
@@ -47,6 +47,8 @@ message flex_ue_stats_report {
optional flex_dl_cqi_report dl_cqi_report = 7; optional flex_dl_cqi_report dl_cqi_report = 7;
optional flex_paging_buffer_report pbr = 8; optional flex_paging_buffer_report pbr = 8;
optional flex_ul_cqi_report ul_cqi_report = 9; optional flex_ul_cqi_report ul_cqi_report = 9;
optional flex_rrc_measurements rrc_measurements = 10;
optional flex_pdcp_stats pdcp_stats = 11;
} }
// //
@@ -77,11 +79,15 @@ enum flex_cell_stats_type {
// Flags for UE-related statistics // Flags for UE-related statistics
enum flex_ue_stats_type { enum flex_ue_stats_type {
FLUST_BSR = 1; FLUST_BSR = 1;
FLUST_PRH = 2; FLUST_PHR = 2;
FLUST_RLC_BS = 4; FLUST_RLC_BS = 4;
FLUST_MAC_CE_BS = 8; FLUST_MAC_CE_BS = 8;
FLUST_DL_CQI = 16; FLUST_DL_CQI = 16;
FLUST_PBS = 32; FLUST_PBS = 32;
FLUST_UL_CQI = 64; FLUST_UL_CQI = 64;
FLUST_PDCP_STATS = 1024;
FLUST_RRC_MEASUREMENTS = 65536;
// To be extended with more types of stats // To be extended with more types of stats
}
}
@@ -25,6 +25,7 @@ message flex_ul_info {
repeated uint32 ul_reception = 2; repeated uint32 ul_reception = 2;
optional uint32 reception_status = 3; optional uint32 reception_status = 3;
optional uint32 tpc = 4; optional uint32 tpc = 4;
optional uint32 serv_cell_index = 5; optional uint32 serv_cell_index = 5;
optional uint32 rssi = 6;
} }
+3 -150
View File
@@ -46,10 +46,6 @@
# include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_task.h"
# endif # endif
#if defined(FLEXRAN_AGENT_SB_IF)
# include "flexran_agent.h"
#endif
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
#endif #endif
@@ -98,102 +94,6 @@ static void configure_rrc(uint32_t enb_id)
if (RC.rrc[enb_id]) { if (RC.rrc[enb_id]) {
RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]); RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]);
/*
RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_properties->properties[enb_id]->eNB_id;
RRC_CONFIGURATION_REQ (msg_p).tac = enb_properties->properties[enb_id]->tac;
RRC_CONFIGURATION_REQ (msg_p).mcc = enb_properties->properties[enb_id]->mcc;
RRC_CONFIGURATION_REQ (msg_p).mnc = enb_properties->properties[enb_id]->mnc;
RRC_CONFIGURATION_REQ (msg_p).mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
RRC_CONFIGURATION_REQ (msg_p).frame_type[CC_id] = enb_properties->properties[enb_id]->frame_type[CC_id];
RRC_CONFIGURATION_REQ (msg_p).tdd_config[CC_id] = enb_properties->properties[enb_id]->tdd_config[CC_id];
RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[CC_id] = enb_properties->properties[enb_id]->tdd_config_s[CC_id];
RRC_CONFIGURATION_REQ (msg_p).eutra_band[CC_id] = enb_properties->properties[enb_id]->eutra_band[CC_id];
// RACH-Config
RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[CC_id] = enb_properties->properties[enb_id]->rach_numberOfRA_Preambles[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[CC_id] = enb_properties->properties[enb_id]->rach_preamblesGroupAConfig[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_sizeOfRA_PreamblesGroupA[CC_id] = enb_properties->properties[enb_id]->rach_sizeOfRA_PreamblesGroupA[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[CC_id] = enb_properties->properties[enb_id]->rach_messageSizeGroupA[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[CC_id] = enb_properties->properties[enb_id]->rach_messagePowerOffsetGroupB[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep[CC_id] = enb_properties->properties[enb_id]->rach_powerRampingStep[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower[CC_id] = enb_properties->properties[enb_id]->rach_preambleInitialReceivedTargetPower[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[CC_id] = enb_properties->properties[enb_id]->rach_preambleTransMax[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize[CC_id] = enb_properties->properties[enb_id]->rach_raResponseWindowSize[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer[CC_id] = enb_properties->properties[enb_id]->rach_macContentionResolutionTimer[CC_id];
RRC_CONFIGURATION_REQ (msg_p).rach_maxHARQ_Msg3Tx[CC_id] = enb_properties->properties[enb_id]->rach_maxHARQ_Msg3Tx[CC_id];
// BCCH-Config
RRC_CONFIGURATION_REQ (msg_p).bcch_modificationPeriodCoeff[CC_id] = enb_properties->properties[enb_id]->bcch_modificationPeriodCoeff[CC_id];
// PCCH-Config
RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[CC_id] = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pcch_nB[CC_id] = enb_properties->properties[enb_id]->pcch_nB[CC_id];
// PRACH-Config
RRC_CONFIGURATION_REQ (msg_p).prach_root[CC_id] = enb_properties->properties[enb_id]->prach_root[CC_id];
RRC_CONFIGURATION_REQ (msg_p).prach_config_index[CC_id] = enb_properties->properties[enb_id]->prach_config_index[CC_id];
RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[CC_id] = enb_properties->properties[enb_id]->prach_high_speed[CC_id];
RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[CC_id] = enb_properties->properties[enb_id]->prach_zero_correlation[CC_id];
RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[CC_id] = enb_properties->properties[enb_id]->prach_freq_offset[CC_id];
// PDSCH-Config
RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[CC_id] = enb_properties->properties[enb_id]->pdsch_referenceSignalPower[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[CC_id] = enb_properties->properties[enb_id]->pdsch_p_b[CC_id];
// PUSCH-Config
RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[CC_id] = enb_properties->properties[enb_id]->pusch_n_SB[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[CC_id] = enb_properties->properties[enb_id]->pusch_hoppingMode[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[CC_id] = enb_properties->properties[enb_id]->pusch_hoppingOffset[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[CC_id] = enb_properties->properties[enb_id]->pusch_enable64QAM[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[CC_id] = enb_properties->properties[enb_id]->pusch_groupHoppingEnabled[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[CC_id] = enb_properties->properties[enb_id]->pusch_groupAssignment[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[CC_id] = enb_properties->properties[enb_id]->pusch_sequenceHoppingEnabled[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[CC_id] = enb_properties->properties[enb_id]->pusch_nDMRS1[CC_id];
// PUCCH-Config
RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[CC_id] = enb_properties->properties[enb_id]->pucch_delta_shift[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[CC_id] = enb_properties->properties[enb_id]->pucch_nRB_CQI[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[CC_id] = enb_properties->properties[enb_id]->pucch_nCS_AN[CC_id];
#if !defined(Rel10) && !defined(Rel14)
RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[CC_id] = enb_properties->properties[enb_id]->pucch_n1_AN[CC_id];
#endif
// SRS Config
RRC_CONFIGURATION_REQ (msg_p).srs_enable[CC_id] = enb_properties->properties[enb_id]->srs_enable[CC_id];
RRC_CONFIGURATION_REQ (msg_p).srs_BandwidthConfig[CC_id] = enb_properties->properties[enb_id]->srs_BandwidthConfig[CC_id];
RRC_CONFIGURATION_REQ (msg_p).srs_SubframeConfig[CC_id] = enb_properties->properties[enb_id]->srs_SubframeConfig[CC_id];
RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[CC_id] = enb_properties->properties[enb_id]->srs_ackNackST[CC_id];
RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[CC_id] = enb_properties->properties[enb_id]->srs_MaxUpPts[CC_id];
// uplinkPowerControlCommon
RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[CC_id] = enb_properties->properties[enb_id]->pusch_p0_Nominal[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_p0_Nominal[CC_id] = enb_properties->properties[enb_id]->pucch_p0_Nominal[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[CC_id] = enb_properties->properties[enb_id]->pusch_alpha[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format1[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format1b[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2a[CC_id];
RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[CC_id] = enb_properties->properties[enb_id]->pucch_deltaF_Format2b[CC_id];
RRC_CONFIGURATION_REQ (msg_p).msg3_delta_Preamble[CC_id] = enb_properties->properties[enb_id]->msg3_delta_Preamble[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ul_CyclicPrefixLength[CC_id] = enb_properties->properties[enb_id]->ul_CyclicPrefixLength[CC_id];
// UE Timers and Constants
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t300[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t300[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t301[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t301[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t310[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t310[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n310[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t311[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n311[CC_id];
RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[CC_id] = enb_properties->properties[enb_id]->ue_TransmissionMode[CC_id];
}
*/
LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); LOG_I(ENB_APP,"Sending configuration message to RRC task\n");
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
@@ -224,44 +124,6 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p); s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p);
LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx); LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx);
/*
s1ap_register_eNB->eNB_id = enb_properties->properties[enb_id]->eNB_id;
s1ap_register_eNB->cell_type = enb_properties->properties[enb_id]->cell_type;
s1ap_register_eNB->eNB_name = enb_properties->properties[enb_id]->eNB_name;
s1ap_register_eNB->tac = enb_properties->properties[enb_id]->tac;
s1ap_register_eNB->mcc = enb_properties->properties[enb_id]->mcc;
s1ap_register_eNB->mnc = enb_properties->properties[enb_id]->mnc;
s1ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
s1ap_register_eNB->default_drx = enb_properties->properties[enb_id]->pcch_defaultPagingCycle[0];
s1ap_register_eNB->nb_mme = enb_properties->properties[enb_id]->nb_mme;
AssertFatal (s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, "Too many MME for eNB %d (%d/%d)!", enb_id, s1ap_register_eNB->nb_mme,
S1AP_MAX_NB_MME_IP_ADDRESS);
for (mme_id = 0; mme_id < s1ap_register_eNB->nb_mme; mme_id++) {
s1ap_register_eNB->mme_ip_address[mme_id].ipv4 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4;
s1ap_register_eNB->mme_ip_address[mme_id].ipv6 = enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6;
strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv4_address,
enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv4_address,
sizeof(s1ap_register_eNB->mme_ip_address[0].ipv4_address));
strncpy (s1ap_register_eNB->mme_ip_address[mme_id].ipv6_address,
enb_properties->properties[enb_id]->mme_ip_address[mme_id].ipv6_address,
sizeof(s1ap_register_eNB->mme_ip_address[0].ipv6_address));
}
s1ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams;
s1ap_register_eNB->sctp_out_streams = enb_properties->properties[enb_id]->sctp_out_streams;
s1ap_register_eNB->enb_ip_address.ipv6 = 0;
s1ap_register_eNB->enb_ip_address.ipv4 = 1;
addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_S1_MME;
str = inet_ntoa(addr);
strcpy(s1ap_register_eNB->enb_ip_address.ipv4_address, str);
*/
LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id));
itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
@@ -288,8 +150,8 @@ void *eNB_app_task(void *args_p)
long enb_register_retry_timer_id; long enb_register_retry_timer_id;
# endif # endif
uint32_t enb_id; uint32_t enb_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
const char *msg_name = NULL; const char *msg_name = NULL;
instance_t instance; instance_t instance;
int result; int result;
/* for no gcc warnings */ /* for no gcc warnings */
@@ -322,16 +184,6 @@ void *eNB_app_task(void *args_p)
memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST));
configure_rrc(enb_id); configure_rrc(enb_id);
} }
#if defined (FLEXRAN_AGENT_SB_IF)
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
printf("\n start enb agent %d\n", enb_id);
flexran_agent_start(enb_id, enb_properties_p);
}
#endif
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
/* Try to register each eNB */ /* Try to register each eNB */
@@ -352,6 +204,7 @@ void *eNB_app_task(void *args_p)
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(ENB_APP, " *** Exiting ENB_APP thread\n");
itti_exit_task (); itti_exit_task ();
break; break;
+4
View File
@@ -30,8 +30,12 @@
#ifndef ENB_APP_H_ #ifndef ENB_APP_H_
#define ENB_APP_H_ #define ENB_APP_H_
#include <stdint.h>
void *eNB_app_task(void *args_p); void *eNB_app_task(void *args_p);
/* needed for flexran: start PHY and RRC when restarting */
void enb_app_start_phy_rrc(uint32_t enb_id_start, uint32_t enb_id_end);
#endif /* ENB_APP_H_ */ #endif /* ENB_APP_H_ */
+33 -33
View File
@@ -98,6 +98,39 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
return errors; return errors;
} }
void RCconfig_flexran()
{
int i;
paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
if (!RC.flexran) {
RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
AssertFatal(RC.flexran != NULL,
"can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
RC.nb_L1_inst * sizeof(flexran_agent_info_t*),
RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
}
/* For all agent instance, fill in the same controller configuration. */
for (i = 0; i < RC.nb_L1_inst; i++) {
RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
AssertFatal(RC.flexran[i] != NULL,
"can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst);
/* if config says "yes", enable Agent, in all other cases it's like "no" */
RC.flexran[i]->enabled = strcmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
//inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
RC.flexran[i]->node_ctrl_state = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
RC.flexran[i]->enb_id = i;
}
}
void RCconfig_L1(void) { void RCconfig_L1(void) {
int i,j; int i,j;
paramdef_t L1_Params[] = L1PARAMS_DESC; paramdef_t L1_Params[] = L1PARAMS_DESC;
@@ -357,10 +390,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
/* /*
char* flexran_agent_interface_name = NULL;
char* flexran_agent_ipv4_address = NULL;
int32_t flexran_agent_port = 0;
char* flexran_agent_cache = NULL;
int32_t otg_ue_id = 0; int32_t otg_ue_id = 0;
char* otg_app_type = NULL; char* otg_app_type = NULL;
char* otg_bg_traffic = NULL; char* otg_bg_traffic = NULL;
@@ -1934,35 +1963,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
rrc->srb1_poll_byte = PollByte_kBinfinity; rrc->srb1_poll_byte = PollByte_kBinfinity;
rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8; rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8;
} }
/*
// Network Controller
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
if (subsetting != NULL) {
if ( (
config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME,
(const char **)&flexran_agent_interface_name)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS,
(const char **)&flexran_agent_ipv4_address)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT,
&flexran_agent_port)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE,
(const char **)&flexran_agent_cache)
)
) {
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name);
cidr = flexran_agent_ipv4_address;
address = strtok(cidr, "/");
//enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address = strdup(address);
if (address) {
IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" );
}
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_port = flexran_agent_port;
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache);
}
}
*/
/* /*
// OTG _CONFIG // OTG _CONFIG
+1
View File
@@ -94,6 +94,7 @@ typedef struct ru_config_s {
} ru_config_t; } ru_config_t;
extern void RCconfig_RU(void); extern void RCconfig_RU(void);
extern void RCconfig_flexran(void);
extern void RCconfig_L1(void); extern void RCconfig_L1(void);
extern void RCconfig_macrlc(void); extern void RCconfig_macrlc(void);
extern int RCconfig_gtpu(void ); extern int RCconfig_gtpu(void );
+20 -9
View File
@@ -611,18 +611,29 @@ static int DEFENBS[] = {0};
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" #define CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME "FLEXRAN_AGENT_INTERFACE_NAME" #define CONFIG_STRING_FLEXRAN_ENABLED "FLEXRAN_ENABLED"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS "FLEXRAN_AGENT_IPV4_ADDRESS" #define CONFIG_STRING_FLEXRAN_INTERFACE_NAME "FLEXRAN_INTERFACE_NAME"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT "FLEXRAN_AGENT_PORT" #define CONFIG_STRING_FLEXRAN_IPV4_ADDRESS "FLEXRAN_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE "FLEXRAN_AGENT_CACHE" #define CONFIG_STRING_FLEXRAN_PORT "FLEXRAN_PORT"
#define CONFIG_STRING_FLEXRAN_CACHE "FLEXRAN_CACHE"
#define CONFIG_STRING_FLEXRAN_AWAIT_RECONF "FLEXRAN_AWAIT_RECONF"
#define FLEXRAN_ENABLED 0
#define FLEXRAN_INTERFACE_NAME_IDX 1
#define FLEXRAN_IPV4_ADDRESS_IDX 2
#define FLEXRAN_PORT_IDX 3
#define FLEXRAN_CACHE_IDX 4
#define FLEXRAN_AWAIT_RECONF_IDX 5
#define FLEXRANPARAMS_DESC { \ #define FLEXRANPARAMS_DESC { \
{ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \ {CONFIG_STRING_FLEXRAN_ENABLED, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \ {CONFIG_STRING_FLEXRAN_INTERFACE_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \ {CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, NULL, 0, uptr:NULL, defstrval:ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0} \ {CONFIG_STRING_FLEXRAN_PORT, NULL, 0, uptr:NULL, defintval:2210, TYPE_UINT, 0}, \
{CONFIG_STRING_FLEXRAN_CACHE, NULL, 0, strptr:NULL, defstrval:"/mnt/oai_agent_cache", TYPE_STRING, 0}, \
{CONFIG_STRING_FLEXRAN_AWAIT_RECONF, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0} \
} }
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/
+53 -59
View File
@@ -21,35 +21,15 @@
/*! \file flexran_agent.h /*! \file flexran_agent.h
* \brief top level flexran agent receive thread and itti task * \brief top level flexran agent receive thread and itti task
* \author Xenofon Foukas and Navid Nikaein * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
#include "flexran_agent_common.h"
#include "log.h"
#include "flexran_agent.h" #include "flexran_agent.h"
#include "flexran_agent_mac_defs.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_mac_internal.h"
#include "flexran_agent_extern.h"
#include "assertions.h"
#include "flexran_agent_net_comm.h"
#include "flexran_agent_async.h"
#include <arpa/inet.h> #include <arpa/inet.h>
//#define TEST_TIMER
flexran_agent_instance_t flexran_agent[NUM_MAX_ENB];
char in_ip[40];
static uint16_t in_port;
char local_cache[40];
void *send_thread(void *args); void *send_thread(void *args);
void *receive_thread(void *args); void *receive_thread(void *args);
pthread_t new_thread(void *(*f)(void *), void *b); pthread_t new_thread(void *(*f)(void *), void *b);
@@ -63,7 +43,7 @@ int agent_task_created = 0;
*/ */
void *flexran_agent_task(void *args){ void *flexran_agent_task(void *args){
//flexran_agent_instance_t *d = (flexran_agent_instance_t *) args; //flexran_agent_info_t *d = (flexran_agent_info_t *) args;
Protocol__FlexranMessage *msg; Protocol__FlexranMessage *msg;
void *data; void *data;
int size; int size;
@@ -85,6 +65,7 @@ void *flexran_agent_task(void *args){
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(FLEXRAN_AGENT, " *** Exiting FLEXRAN thread\n");
itti_exit_task (); itti_exit_task ();
break; break;
@@ -123,7 +104,7 @@ void *flexran_agent_task(void *args){
void *receive_thread(void *args) { void *receive_thread(void *args) {
flexran_agent_instance_t *d = args; flexran_agent_info_t *d = args;
void *data; void *data;
int size; int size;
int priority; int priority;
@@ -197,38 +178,25 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
} }
int channel_container_init = 0; int channel_container_init = 0;
int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int flexran_agent_start(mid_t mod_id)
{
flexran_agent_info_t *flexran = RC.flexran[mod_id];
int channel_id; int channel_id;
char *in_ip = flexran->remote_ipv4_addr;
flexran_set_enb_vars(mod_id, RAN_LTE_OAI); uint16_t in_port = flexran->remote_port;
flexran_agent[mod_id].enb_id = mod_id;
/* if this agent is disabled, return and don't do anything */
/* if (!flexran->enabled) {
* check the configuration LOG_I(FLEXRAN_AGENT, "FlexRAN Agent for eNB %d is DISABLED\n", mod_id);
*/ return 100;
if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) {
strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache));
local_cache[sizeof(local_cache) - 1] = 0;
} else {
strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
} }
if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) { flexran->enb_id = mod_id;
inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN); /* assume for the moment the monolithic case, i.e. agent can provide
} else { * information for all layers */
strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS ); flexran->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1
} | FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2
| FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC;
if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) {
in_port = enb_properties->properties[mod_id]->flexran_agent_port;
} else {
in_port = DEFAULT_FLEXRAN_AGENT_PORT ;
}
LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
flexran_agent[mod_id].enb_id,
in_ip,
in_port);
/* /*
* Initialize the channel container * Initialize the channel container
@@ -264,10 +232,10 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
*flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC); *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC);
*/ */
/*Initialize the continuous MAC stats update mechanism*/ /*Initialize the continuous stats update mechanism*/
flexran_agent_init_cont_mac_stats_update(mod_id); flexran_agent_init_cont_stats_update(mod_id);
new_thread(receive_thread, &flexran_agent[mod_id]); new_thread(receive_thread, flexran);
/*Initialize and register the mac xface. Must be modified later /*Initialize and register the mac xface. Must be modified later
*for more flexibility in agent management */ *for more flexibility in agent management */
@@ -275,6 +243,12 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
flexran_agent_register_mac_xface(mod_id, mac_agent_xface); flexran_agent_register_mac_xface(mod_id, mac_agent_xface);
AGENT_RRC_xface *rrc_agent_xface = (AGENT_RRC_xface *) malloc(sizeof(AGENT_RRC_xface));
flexran_agent_register_rrc_xface(mod_id, rrc_agent_xface);
AGENT_PDCP_xface *pdcp_agent_xface = (AGENT_PDCP_xface *) malloc(sizeof(AGENT_PDCP_xface));
flexran_agent_register_pdcp_xface(mod_id, pdcp_agent_xface);
/* /*
* initilize a timer * initilize a timer
*/ */
@@ -290,14 +264,34 @@ int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properti
* start the enb agent task for tx and interaction with the underlying network function * start the enb agent task for tx and interaction with the underlying network function
*/ */
if (!agent_task_created) { if (!agent_task_created) {
if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) { if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, flexran) < 0) {
LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n"); LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n");
return -1; return -1;
} }
agent_task_created = 1; agent_task_created = 1;
} }
LOG_I(FLEXRAN_AGENT,"client ends\n"); pthread_mutex_init(&flexran->mutex_node_ctrl, NULL);
pthread_cond_init(&flexran->cond_node_ctrl, NULL);
if (flexran->node_ctrl_state == ENB_WAIT) {
/* wait three seconds before showing message and waiting "for real".
* This way, the message is (hopefully...) the last one and the user knows
* what is happening. If the controller sends a reconfiguration message in
* the meantime, the softmodem will never wait */
sleep(3);
LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
pthread_mutex_lock(&flexran->mutex_node_ctrl);
while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
/* reconfigure RRC again, the agent might have changed the configuration */
MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[mod_id]->configuration;
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg_p);
}
return 0; return 0;
error: error:
+14 -6
View File
@@ -22,20 +22,28 @@
/*! \file flexran_agent.h /*! \file flexran_agent.h
* \brief top level flexran agent * \brief top level flexran agent
* \author Navid Nikaein and Xenofon Foukas * \author Navid Nikaein and Xenofon Foukas
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
#ifndef FLEXRAN_AGENT_H_ #ifndef FLEXRAN_AGENT_H_
#define FLEXRAN_AGENT_H_ #define FLEXRAN_AGENT_H_
#include "enb_config.h" // for enb properties
#include "flexran_agent_common.h" #include "flexran_agent_common.h"
#include "flexran_agent_async.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_timer.h"
#include "flexran_agent_defs.h"
#include "flexran_agent_net_comm.h"
#include "flexran_agent_ran_api.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_rrc.h"
#include "flexran_agent_pdcp.h"
#include "log.h"
#include "assertions.h"
/* Initiation of the eNodeB agent */
/* Initiation and termination of the eNodeB agent */ int flexran_agent_start(mid_t mod_id);
int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
int flexran_agent_stop(mid_t mod_id);
/* /*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
+2 -2
View File
@@ -68,12 +68,12 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c
error: error:
LOG_I(FLEXRAN_AGENT,"there was an error\n"); LOG_I(FLEXRAN_AGENT,"there was an error\n");
return 1; return NULL;
} }
int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
flexran_agent_async_channel_t *channel; flexran_agent_async_channel_t *channel;
channel = (flexran_agent_channel_t *)channel_info; channel = (flexran_agent_async_channel_t *)channel_info;
return message_put(channel->send_queue, data, size, priority); return message_put(channel->send_queue, data, size, priority);
} }
File diff suppressed because it is too large Load Diff
+33 -364
View File
@@ -21,8 +21,8 @@
/*! \file flexran_agent_common.h /*! \file flexran_agent_common.h
* \brief common message primitves and utilities * \brief common message primitves and utilities
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein and shahab SHARIAT BAGHERI
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
@@ -37,7 +37,8 @@
#include "flexran.pb-c.h" #include "flexran.pb-c.h"
#include "stats_messages.pb-c.h" #include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h" #include "stats_common.pb-c.h"
#include "flexran_agent_ran_api.h"
#include "flexran_agent_net_comm.h"
#include "flexran_agent_defs.h" #include "flexran_agent_defs.h"
#include "enb_config.h" #include "enb_config.h"
@@ -60,6 +61,19 @@ typedef int (*flexran_agent_message_destruction_callback)(
Protocol__FlexranMessage *msg Protocol__FlexranMessage *msg
); );
typedef struct {
uint8_t is_initialized;
volatile uint8_t cont_update;
xid_t xid;
Protocol__FlexranMessage *stats_req;
Protocol__FlexranMessage *prev_stats_reply;
pthread_mutex_t *mutex;
} stats_updates_context_t;
stats_updates_context_t stats_context[NUM_MAX_ENB];
/********************************** /**********************************
* FlexRAN protocol messages helper * FlexRAN protocol messages helper
* functions and generic handlers * functions and generic handlers
@@ -116,10 +130,6 @@ int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg);
/* TODO: Need to define and implement destructor */ /* TODO: Need to define and implement destructor */
int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg);
/* UE state change message constructor and destructor */
int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
/* Control delegation message constructor and destructor */ /* Control delegation message constructor and destructor */
int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
@@ -128,6 +138,11 @@ int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg);
/* rrc triggering measurement message constructor and destructor */
int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_rrc_measurement(Protocol__FlexranMessage *msg);
/* FlexRAN protocol message dispatcher function */ /* FlexRAN protocol message dispatcher function */
Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
uint8_t *data, uint8_t *data,
@@ -136,367 +151,21 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ /* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */
Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args); Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args);
/*Top level Statistics hanlder*/
int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
/* Function to be used to handle reply message . */
int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
/* Top level Statistics request protocol message constructor and destructor */
int flexran_agent_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg);
/**************************** err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id);
* get generic info from RAN
****************************/
void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran); void flexran_agent_send_update_stats(mid_t mod_id);
int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag);
/*Return the current frame number
*Could be using implementation specific numbering of frames
*/
unsigned int flexran_get_current_frame(mid_t mod_id);
/*Return the current SFN (0-1023)*/
unsigned int flexran_get_current_system_frame_num(mid_t mod_id);
unsigned int flexran_get_current_subframe(mid_t mod_id);
/*Return the frame and subframe number in compact 16-bit format.
Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
uint16_t flexran_get_sfn_sf (mid_t mod_id);
/* Return a future frame and subframe number that is ahead_of_time
subframes later in compact 16-bit format. Bits 0-3 subframe,
rest for frame */
uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
/* Return the number of attached UEs */
int flexran_get_num_ues(mid_t mod_id);
/* Get the rnti of a UE with id ue_id */
int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id);
/* Get the RLC buffer status report of a ue for a designated
logical channel id */
int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid);
/* Get power headroom of UE with id ue_id */
int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id);
/* Get the UE wideband CQI */
int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id);
/* Get the transmission queue size for a UE with a channel_id logical channel id */
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Get the head of line delay for a UE with a channel_id logical channel id */
int flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Check the status of the timing advance for a UE */
short flexran_get_TA(mid_t mod_id, mid_t ue_id, int CC_id);
/* Update the timing advance status (find out whether a timing advance command is required) */
void flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id);
/* Return timing advance MAC control element for a designated cell and UE */
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id);
/* Get the number of active component carriers for a specific UE */
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
/* Get the rank indicator for a designated cell and UE */
int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id);
/* See TS 36.213, section 10.1 */
int flexran_get_n1pucch_an(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.4 */
int flexran_get_nRB_CQI(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.4 */
int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.7.1 */
int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.7.1 */
int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id);
/* See TS 36.321 */
int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id);
/* Get the length of the UL cyclic prefix */
int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id);
/* Get the length of the DL cyclic prefix */
int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id);
/* Get the physical cell id of a cell */
int flexran_get_cell_id(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.5.3.2 */
int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id);
/* See TS 36.211, table 5.5.3.3-1 and 2 */
int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id);
/* Boolean value. See TS 36.211,
section 5.5.3.2. TDD only */
int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id);
/* Get number of DL resource blocks */
int flexran_get_N_RB_DL(mid_t mod_id, int CC_id);
/* Get number of UL resource blocks */
int flexran_get_N_RB_UL(mid_t mod_id, int CC_id);
/* Get number of resource block groups */
int flexran_get_N_RBG(mid_t mod_id, int CC_id);
/* Get DL/UL subframe assignment. TDD only */
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id);
/* TDD only. See TS 36.211, table 4.2.1 */
int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id);
/* Get the duration of the random access response window in subframes */
int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id);
/* Get timer used for random access */
int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id);
/* Get type of duplex mode (FDD/TDD) */
int flexran_get_duplex_mode(mid_t mod_id, int CC_id);
/* Get the SI window length */
long flexran_get_si_window_length(mid_t mod_id, int CC_id);
/* Get the number of PDCCH symbols configured for the cell */
int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id);
/* See TS 36.213, sec 5.1.1.1 */
int flexran_get_tpc(mid_t mod_id, mid_t ue_id);
/* Get the first available HARQ process for a specific cell and UE during
a designated frame and subframe. Returns 0 for success. The id and the
status of the HARQ process are stored in id and status respectively */
int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id,
const int frame, const uint8_t subframe, unsigned char *id, unsigned char *round);
/* Uplink power control management*/
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id);
int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id);
/*
* ************************************
* Get Messages for UE Configuration Reply
* ************************************
*/
/* Get timer in subframes. Controls the synchronization
status of the UE, not the actual timing
advance procedure. See TS 36.321 */
int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration. See TS 36.133 */
int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration offset if applicable */
int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
/* DL aggregated bit-rate of non-gbr bearer
per UE. See TS 36.413 */
int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id);
/* UL aggregated bit-rate of non-gbr bearer
per UE. See TS 36.413 */
int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id);
/* Only half-duplex support. FDD
operation. Boolean value */
int flexran_get_half_duplex(mid_t ue_id);
/* Support of intra-subframe hopping.
Boolean value */
int flexran_get_intra_sf_hopping(mid_t ue_id);
/* UE support for type 2 hopping with
n_sb>1 */
int flexran_get_type2_sb_1(mid_t ue_id);
/* Get the UE category */
int flexran_get_ue_category(mid_t ue_id);
/* UE support for resource allocation
type 1 */
int flexran_get_res_alloc_type1(mid_t ue_id);
/* Get UE transmission mode */
int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
/* Boolean value. See TS 36.321 */
int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
/* The max HARQ retransmission for UL.
See TS 36.321 */
int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS36.213, Section 10.1 */
int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS 36.213, Section 8.2 */
int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id);
/* Get aperiodic CQI report mode */
int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
/* Get ACK/NACK feedback mode. TDD only */
int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id);
/* See TS36.213, section 10.1 */
int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
/* Boolean. Extended buffer status report size */
int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
/* Get number of UE transmission antennas */
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
/* Get logical channel group of a channel with id lc_id */
int flexran_get_lcg(mid_t ue_id, mid_t lc_id);
/* Get direction of logical channel with id lc_id */
int flexran_get_direction(mid_t ue_id, mid_t lc_id);
/*******************
* timer primitves
*******************/
#define TIMER_NULL -1
#define TIMER_TYPE_INVALIDE -2
#define TIMER_SETUP_FAILED -3
#define TIMER_REMOVED_FAILED -4
#define TIMER_ELEMENT_NOT_FOUND -5
/* Type of the callback executed when the timer expired */
typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
typedef enum {
/* oneshot timer: */
FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0,
/* periodic timer */
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2,
/* Max number of states available */
FLEXRAN_AGENT_TIMER_TYPE_MAX,
} flexran_agent_timer_type_t;
typedef enum {
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
/* Max number of states available */
FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;
typedef struct flexran_agent_timer_args_s{
mid_t mod_id;
Protocol__FlexranMessage *msg;
} flexran_agent_timer_args_t;
typedef struct flexran_agent_timer_element_s{
RB_ENTRY(flexran_agent_timer_element_s) entry;
agent_id_t agent_id;
instance_t instance;
flexran_agent_timer_type_t type;
flexran_agent_timer_state_t state;
uint32_t interval_sec;
uint32_t interval_usec;
long timer_id; /* Timer id returned by the timer API*/
xid_t xid; /*The id of the task as received by the controller
message*/
flexran_agent_timer_callback_t cb;
flexran_agent_timer_args_t *timer_args;
} flexran_agent_timer_element_t;
typedef struct flexran_agent_timer_instance_s{
RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
}flexran_agent_timer_instance_t;
err_code_t flexran_agent_init_timer(void);
/* Create a timer for some agent related event with id xid. Will store the id
of the generated timer in timer_id */
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
uint32_t interval_usec,
agent_id_t agent_id,
instance_t instance,
uint32_t timer_type,
xid_t xid,
flexran_agent_timer_callback_t cb,
void* timer_args,
long *timer_id);
/* Destroy all existing timers */
err_code_t flexran_agent_destroy_timers(void);
/* Destroy the timer with the given timer_id */
err_code_t flexran_agent_destroy_timer(long timer_id);
/* Destroy the timer for task with id xid */
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
/* Stop a timer */
err_code_t flexran_agent_stop_timer(long timer_id);
/* Restart the given timer */
err_code_t flexran_agent_restart_timer(long *timer_id);
/* Find the timer with the given timer_id */
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
/* Obtain the protocol message stored in the given expired timer */
Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
/* Comparator function comparing two timers. Decides the ordering of the timers */
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
/*Specify a delay in nanoseconds to timespec and sleep until then*/
void flexran_agent_sleep_until(struct timespec *ts, int delay);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req) ;
err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id);
#endif #endif
@@ -21,8 +21,8 @@
/*! \file flexran_agent_common_internal.c /*! \file flexran_agent_common_internal.c
* \brief internal functions for common message primitves and utilities * \brief internal functions for common message primitves and utilities
* \author Xenofon Foukas * \author Xenofon Foukas and N. Nikaein
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
@@ -32,6 +32,57 @@
#include "flexran_agent_common_internal.h" #include "flexran_agent_common_internal.h"
#include "flexran_agent_mac_internal.h" #include "flexran_agent_mac_internal.h"
/* needed to soft-restart the lte-softmodem */
#include "targets/RT/USER/lte-softmodem.h"
void handle_reconfiguration(mid_t mod_id)
{
struct timespec start, end;
clock_gettime(CLOCK_MONOTONIC, &start);
flexran_agent_info_t *flexran = RC.flexran[mod_id];
if (ENB_WAIT == flexran->node_ctrl_state) {
/* this is already waiting, just release */
pthread_mutex_lock(&flexran->mutex_node_ctrl);
flexran->node_ctrl_state = ENB_NORMAL_OPERATION;
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
pthread_cond_signal(&flexran->cond_node_ctrl);
return;
}
if (stop_L1L2(mod_id) < 0) {
LOG_E(ENB_APP, "can not stop lte-softmodem, aborting restart\n");
return;
}
/* node_ctrl_state should have value ENB_MAKE_WAIT only if this method is not
* executed by the FlexRAN thread */
if (ENB_MAKE_WAIT == flexran->node_ctrl_state) {
LOG_I(ENB_APP, " * eNB %d: Waiting for FlexRAN RTController command *\n", mod_id);
pthread_mutex_lock(&flexran->mutex_node_ctrl);
flexran->node_ctrl_state = ENB_WAIT;
while (ENB_NORMAL_OPERATION != flexran->node_ctrl_state)
pthread_cond_wait(&flexran->cond_node_ctrl, &flexran->mutex_node_ctrl);
pthread_mutex_unlock(&flexran->mutex_node_ctrl);
}
if (restart_L1L2(mod_id) < 0) {
LOG_F(ENB_APP, "can not restart, killing lte-softmodem\n");
itti_terminate_tasks(TASK_PHY_ENB);
return;
}
clock_gettime(CLOCK_MONOTONIC, &end);
end.tv_sec -= start.tv_sec;
if (end.tv_nsec >= start.tv_nsec) {
end.tv_nsec -= start.tv_nsec;
} else {
end.tv_sec -= 1;
end.tv_nsec = end.tv_nsec - start.tv_nsec + 1000000000;
}
LOG_I(ENB_APP, "lte-softmodem restart succeeded in %ld.%ld s\n", end.tv_sec, end.tv_nsec / 1000000);
}
int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) {
yaml_parser_t parser; yaml_parser_t parser;
@@ -64,7 +115,17 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
break; break;
case YAML_SCALAR_EVENT: case YAML_SCALAR_EVENT:
// Check the system name and call the proper handler // Check the system name and call the proper handler
if (strcmp((char *) event.data.scalar.value, "mac") == 0) { // Check the system name and call the proper handler
if (strcmp((char *) event.data.scalar.value, "enb") == 0) {
LOG_I(ENB_APP, "This is intended for the enb system\n");
// Call the enb handler
if (parse_enb_id(mod_id, &parser) == -1) {
LOG_E(ENB_APP, "cannot parse data for eNB\n");
goto error;
} else { // succeful parse and setting
handle_reconfiguration(mod_id);
}
} else if (strcmp((char *) event.data.scalar.value, "mac") == 0) {
LOG_D(ENB_APP, "This is intended for the mac system\n"); LOG_D(ENB_APP, "This is intended for the mac system\n");
// Call the mac handler // Call the mac handler
if (parse_mac_config(mod_id, &parser) == -1) { if (parse_mac_config(mod_id, &parser) == -1) {
@@ -90,8 +151,8 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
// TODO : Just skip it for now // TODO : Just skip it for now
if (skip_system_section(&parser) == -1) { if (skip_system_section(&parser) == -1) {
goto error; goto error;
} }
} else { } else {
goto error; goto error;
} }
break; break;
@@ -115,6 +176,145 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
} }
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
char *endptr;
// int is_array;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping of parameters
case YAML_SEQUENCE_START_EVENT:
// is_array = 1;
break;
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
// use eNB egistered
if (mac_agent_registered[mod_id]) {
LOG_I(ENB_APP, "Setting parameter for eNB %s\n", event.data.scalar.value);
if (strcmp((char *) event.data.scalar.tag, YAML_INT_TAG) == 0) { // if int
if ((strtol((char *) event.data.scalar.value, &endptr, 10))== mod_id ) { // enb_id == mod_id: right enb instance to be configured
if (parse_enb_config_parameters(mod_id, parser) == -1) {
goto error;
}
}
else{
goto error; // not the expected type
}
}
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) {
yaml_event_t event;
char *endptr;
int done = 0;
int mapping_started = 0;
while (!done) {
if (!yaml_parser_parse(parser, &event))
goto error;
switch (event.type) {
// We are expecting a mapping of parameters
case YAML_MAPPING_START_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters started\n");
mapping_started = 1;
break;
case YAML_MAPPING_END_EVENT:
LOG_D(ENB_APP, "The mapping of the parameters ended\n");
mapping_started = 0;
break;
case YAML_SCALAR_EVENT:
if (!mapping_started) {
goto error;
}
// Check what key needs to be set
if (strcmp((char *) event.data.scalar.value, "dl_freq") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_dl_freq(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting dl_freq to %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "ul_freq_offset") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_ul_freq(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting ul_freq_offset to %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "bandwidth") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_bandwidth(mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting bandwidth to %s\n", event.data.scalar.value);
} else if (strcmp((char *) event.data.scalar.value, "frame_type") == 0) {
if (!yaml_parser_parse(parser, &event))
goto error;
flexran_agent_set_operating_frame_type (mod_id,
0,
strtol((char *) event.data.scalar.value, &endptr, 10));
LOG_I(ENB_APP, "Setting frame_type to %s\n", event.data.scalar.value);
}else { // not supported tag
LOG_E(FLEXRAN_AGENT, "Unsupported tag %s\n", event.data.scalar.value);
goto error;
}
break;
default:
goto error;
}
done = (event.type == YAML_MAPPING_END_EVENT);
yaml_event_delete(&event);
}
return 0;
error:
yaml_event_delete(&event);
return -1;
}
int skip_system_section(yaml_parser_t *parser) { int skip_system_section(yaml_parser_t *parser) {
yaml_event_t event; yaml_event_t event;
@@ -21,8 +21,8 @@
/*! \file flexran_agent_common_internal.h /*! \file flexran_agent_common_internal.h
* \brief internal agent functions for common message primitves and utilities * \brief internal agent functions for common message primitves and utilities
* \author Xenofon Foukas * \author Xenofon Foukas and N. Nikaein
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
@@ -37,6 +37,10 @@ int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy
int apply_parameter_modification(void *parameter, yaml_parser_t *parser); int apply_parameter_modification(void *parameter, yaml_parser_t *parser);
int parse_enb_id(mid_t mod_id, yaml_parser_t *parser);
int parse_enb_config_parameters(mid_t mod_id, yaml_parser_t *parser) ;
// This can be used when parsing for a specific system that is not yet implmeneted // This can be used when parsing for a specific system that is not yet implmeneted
// in order to skip its configuration, without affecting the rest // in order to skip its configuration, without affecting the rest
int skip_system_section(yaml_parser_t *parser); int skip_system_section(yaml_parser_t *parser);
+109 -7
View File
@@ -21,8 +21,8 @@
/*! \file flexran_agent_defs.h /*! \file flexran_agent_defs.h
* \brief FlexRAN agent common definitions * \brief FlexRAN agent common definitions
* \author Navid Nikaein and Xenofon Foukas * \author Navid Nikaein and Xenofon Foukas and shahab SHARIAT BAGHERI
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
#ifndef FLEXRAN_AGENT_DEFS_H_ #ifndef FLEXRAN_AGENT_DEFS_H_
@@ -32,11 +32,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <pthread.h> #include <pthread.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <time.h>
#include "link_manager.h" #include "link_manager.h"
#define NUM_MAX_ENB 2 #define NUM_MAX_ENB 2
#define NUM_MAX_DRB 8
#define NUM_MAX_SRB 3
#define NUM_MAX_UE 2048 #define NUM_MAX_UE 2048
#define DEFAULT_DRB 3
#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_FLEXRAN_AGENT_PORT 2210 #define DEFAULT_FLEXRAN_AGENT_PORT 2210
#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache" #define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache"
@@ -102,10 +107,66 @@ typedef uint8_t lcid_t;
typedef int32_t err_code_t; typedef int32_t err_code_t;
/*---------Timer Enums --------- */
typedef enum {
/* oneshot timer: */
FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0,
/* periodic timer */
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 1,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 2,
/* Max number of states available */
FLEXRAN_AGENT_TIMER_TYPE_MAX,
} flexran_agent_timer_type_t;
typedef enum {
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
/* Inactive state: initial state for any timer. */
FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
/* Max number of states available */
FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;
#define FLEXRAN_CAP_LOL1 0x1
#define FLEXRAN_CAP_HIL1 0x2
#define FLEXRAN_CAP_LOL2 0x4 // is: MAC
#define FLEXRAN_CAP_HIL2 0x8 // is: RLC
#define FLEXRAN_CAP_PDCP 0x16
#define FLEXRAN_CAP_RRC 0x32
typedef enum {
ENB_NORMAL_OPERATION = 0x0,
ENB_WAIT = 0x1,
ENB_MAKE_WAIT = 0x2,
} flexran_enb_state_t;
typedef struct { typedef struct {
/* general info */ /* general info */
int enabled;
char *interface_name;
char *remote_ipv4_addr;
uint16_t remote_port;
char *cache_name;
int enb_id;
uint8_t capability_mask;
/* lock for waiting before starting or soft-restart */
pthread_cond_t cond_node_ctrl;
pthread_mutex_t mutex_node_ctrl;
flexran_enb_state_t node_ctrl_state;
/* stats */ /* stats */
uint32_t total_rx_msg; uint32_t total_rx_msg;
@@ -116,10 +177,51 @@ typedef struct {
} flexran_agent_info_t; } flexran_agent_info_t;
/*
rrc triggering
*/
typedef struct { typedef struct {
mid_t enb_id; char * trigger_policy;
flexran_agent_info_t agent_info; uint32_t report_interval;
uint32_t report_amount;
} flexran_agent_instance_t;
} agent_reconf_rrc;
/* These structs will be used to give
instructions for the type of stats reports
we need to create */
typedef struct {
uint16_t ue_rnti;
uint32_t ue_report_flags; /* Indicates the report elements
required for this UE id. See
FlexRAN specification 1.2.4.2 */
} ue_report_type_t;
typedef struct {
uint16_t cc_id;
uint32_t cc_report_flags; /* Indicates the report elements
required for this CC index. See
FlexRAN specification 1.2.4.3 */
} cc_report_type_t;
typedef struct {
int nr_ue;
ue_report_type_t *ue_report_type;
int nr_cc;
cc_report_type_t *cc_report_type;
} report_config_t;
typedef struct stats_request_config_s{
uint8_t report_type;
uint8_t report_frequency;
uint16_t period; /*In number of subframes*/
report_config_t *config;
} stats_request_config_t;
#endif #endif
+19 -11
View File
@@ -20,9 +20,9 @@
*/ */
/*! \file ENB_APP/extern.h /*! \file ENB_APP/extern.h
* \brief FlexRAN agent - mac interface primitives * \brief FlexRAN agent - Extern VSF xfaces
* \author Xenofon Foukas * \author Xenofon Foukas and shahab SHARIAT BAGHERI
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
* \mail x.foukas@sms.ed.ac.uk * \mail x.foukas@sms.ed.ac.uk
*/ */
@@ -32,12 +32,8 @@
#include "flexran_agent_defs.h" #include "flexran_agent_defs.h"
#include "flexran_agent_mac_defs.h" #include "flexran_agent_mac_defs.h"
#include "flexran_agent_rrc_defs.h"
#include "flexran_agent_pdcp_defs.h"
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX];
/* full path of the local cache for storing VSFs */
extern char local_cache[40];
/* Control module interface for the communication of the MAC Control Module with the agent */ /* Control module interface for the communication of the MAC Control Module with the agent */
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
@@ -45,8 +41,20 @@ extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
/* Flag indicating whether the VSFs for the MAC control module have been registered */ /* Flag indicating whether the VSFs for the MAC control module have been registered */
extern unsigned int mac_agent_registered[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB];
/* Control module interface for the communication of the RRC Control Module with the agent */
extern AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
/* Flag indicating whether the VSFs for the RRC control module have been registered */
extern unsigned int rrc_agent_registered[NUM_MAX_ENB];
/* Control module interface for the communication of the RRC Control Module with the agent */
extern AGENT_PDCP_xface *agent_pdcp_xface[NUM_MAX_ENB];
/* Flag indicating whether the VSFs for the RRC control module have been registered */
extern unsigned int pdcp_agent_registered[NUM_MAX_ENB];
/* Requried to know which UEs had a harq updated over some subframe */ /* Requried to know which UEs had a harq updated over some subframe */
extern int harq_pid_updated[NUMBER_OF_UE_MAX][8]; extern int harq_pid_updated[NUM_MAX_UE][8];
extern int harq_pid_round[NUMBER_OF_UE_MAX][8]; extern int harq_pid_round[NUM_MAX_UE][8];
#endif #endif
+595 -7
View File
@@ -21,14 +21,18 @@
/*! \file flexran_agent_handler.c /*! \file flexran_agent_handler.c
* \brief FlexRAN agent tx and rx message handler * \brief FlexRAN agent tx and rx message handler
* \author Xenofon Foukas and Navid Nikaein * \author Xenofon Foukas and Navid Nikaein and shahab SHARIAT BAGHERI
* \date 2016 * \date 2017
* \version 0.1 * \version 0.1
*/ */
#include "flexran_agent_defs.h"
#include "flexran_agent_common.h" #include "flexran_agent_common.h"
#include "flexran_agent_mac.h" #include "flexran_agent_mac.h"
#include "flexran_agent_rrc.h"
#include "flexran_agent_pdcp.h"
#include "flexran_agent_timer.h"
#include "flexran_agent_ran_api.h"
#include "log.h" #include "log.h"
#include "assertions.h" #include "assertions.h"
@@ -37,7 +41,7 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
{flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ {flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/
{flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply
{flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {flexran_agent_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
{0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/
@@ -51,13 +55,14 @@ flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/
{flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ {flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/
{flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ {flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/
{flexran_agent_rrc_measurement, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_RRC_TRIGGERING_MSG*/
}; };
flexran_agent_message_destruction_callback message_destruction_callback[] = { flexran_agent_message_destruction_callback message_destruction_callback[] = {
flexran_agent_destroy_hello, flexran_agent_destroy_hello,
flexran_agent_destroy_echo_request, flexran_agent_destroy_echo_request,
flexran_agent_destroy_echo_reply, flexran_agent_destroy_echo_reply,
flexran_agent_mac_destroy_stats_request, flexran_agent_destroy_stats_request,
flexran_agent_mac_destroy_stats_reply, flexran_agent_mac_destroy_stats_reply,
flexran_agent_mac_destroy_sf_trigger, flexran_agent_mac_destroy_sf_trigger,
flexran_agent_mac_destroy_sr_info, flexran_agent_mac_destroy_sr_info,
@@ -93,7 +98,6 @@ Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING;
goto error; goto error;
} }
if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) || if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) ||
(decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){
err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED;
@@ -139,7 +143,7 @@ void * flexran_agent_pack_message(Protocol__FlexranMessage *msg,
DevAssert(buffer !=NULL); DevAssert(buffer !=NULL);
LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); LOG_D(FLEXRAN_AGENT,"Serilized the eNB-UE stats reply (size %d)\n", *size);
return buffer; return buffer;
@@ -187,3 +191,587 @@ Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* tim
err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) {
return ((*message_destruction_callback[msg->msg_case-1])(msg)); return ((*message_destruction_callback[msg->msg_case-1])(msg));
} }
/*
Top Level Statistics Report
*/
int flexran_agent_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){
// TODO: Must deal with sanitization of input
// TODO: Must check if RNTIs and cell ids of the request actually exist
// TODO: Must resolve conflicts among stats requests
int i;
err_code_t err_code;
xid_t xid;
uint32_t usec_interval, sec_interval;
//TODO: We do not deal with multiple CCs at the moment and eNB id is 0
int enb_id = mod_id;
//eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id];
//UE_list_t *eNB_UE_list= &eNB->UE_list;
report_config_t report_config;
uint32_t ue_flags = 0;
uint32_t c_flags = 0;
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
Protocol__FlexStatsRequest *stats_req = input->stats_request_msg;
xid = (stats_req->header)->xid;
// Check the type of request that is made
switch(stats_req->body_case) {
case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ;
Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request;
if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) {
/*Disable both periodic and continuous updates*/
// flexran_agent_disable_cont_stats_update(mod_id);
flexran_agent_destroy_timer_by_task_id(xid);
*msg = NULL;
return 0;
} else { //One-off, periodical or continuous reporting
//Set the proper flags
ue_flags = comp_req->ue_report_flags;
c_flags = comp_req->cell_report_flags;
//Create a list of all eNB RNTIs and cells
//Set the number of UEs and create list with their RNTIs stats configs
report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
for (i = 0; i < report_config.nr_ue; i++) {
report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti;
report_config.ue_report_type[i].ue_report_flags = ue_flags;
}
//Set the number of CCs and create a list with the cell stats configs
report_config.nr_cc = MAX_NUM_CCs;
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
if (report_config.cc_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
for (i = 0; i < report_config.nr_cc; i++) {
//TODO: Must fill in the proper cell ids
report_config.cc_report_type[i].cc_id = i;
report_config.cc_report_type[i].cc_report_flags = c_flags;
}
/* Check if request was periodical */
if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) {
/* Create a one off flexran message as an argument for the periodical task */
Protocol__FlexranMessage *timer_msg;
stats_request_config_t request_config;
request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
request_config.period = 0;
/* Need to make sure that the ue flags are saved (Bug) */
if (report_config.nr_ue == 0) {
report_config.nr_ue = 1;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
report_config.ue_report_type[0].ue_report_flags = ue_flags;
}
request_config.config = &report_config;
flexran_agent_stats_request(enb_id, xid, &request_config, &timer_msg);
/* Create a timer */
long timer_id = 0;
flexran_agent_timer_args_t *timer_args;
timer_args = malloc(sizeof(flexran_agent_timer_args_t));
memset (timer_args, 0, sizeof(flexran_agent_timer_args_t));
timer_args->mod_id = enb_id;
timer_args->msg = timer_msg;
/*Convert subframes to usec time*/
usec_interval = 1000*comp_req->sf;
sec_interval = 0;
/*add seconds if required*/
if (usec_interval >= 1000*1000) {
sec_interval = usec_interval/(1000*1000);
usec_interval = usec_interval%(1000*1000);
}
flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id);
} else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) {
/*If request was for continuous updates, disable the previous configuration and
set up a new one*/
flexran_agent_disable_cont_stats_update(mod_id);
stats_request_config_t request_config;
request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS;
request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE;
request_config.period = 0;
/* Need to make sure that the ue flags are saved (Bug) */
if (report_config.nr_ue == 0) {
report_config.nr_ue = 1;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t));
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
report_config.ue_report_type[0].ue_rnti = 0; // Dummy value
report_config.ue_report_type[0].ue_report_flags = ue_flags;
}
request_config.config = &report_config;
flexran_agent_enable_cont_stats_update(enb_id, xid, &request_config);
}
}
break;
case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:;
Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request;
// UE report config will be blank
report_config.nr_ue = 0;
report_config.ue_report_type = NULL;
report_config.nr_cc = cell_req->n_cell;
report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc);
if (report_config.cc_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
for (i = 0; i < report_config.nr_cc; i++) {
//TODO: Must fill in the proper cell ids
report_config.cc_report_type[i].cc_id = cell_req->cell[i];
report_config.cc_report_type[i].cc_report_flags = cell_req->flags;
}
break;
case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:;
Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request;
// Cell report config will be blank
report_config.nr_cc = 0;
report_config.cc_report_type = NULL;
report_config.nr_ue = ue_req->n_rnti;
report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue);
if (report_config.ue_report_type == NULL) {
// TODO: Add appropriate error code
err_code = -100;
goto error;
}
for (i = 0; i < report_config.nr_ue; i++) {
report_config.ue_report_type[i].ue_rnti = ue_req->rnti[i];
report_config.ue_report_type[i].ue_report_flags = ue_req->flags;
}
break;
default:
//TODO: Add appropriate error code
err_code = -100;
goto error;
}
if (flexran_agent_stats_reply(enb_id, xid, &report_config, msg )){
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
free(report_config.ue_report_type);
free(report_config.cc_report_type);
return 0;
error :
LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
return err_code;
}
/*
Top level reply
*/
int flexran_agent_stats_reply(mid_t enb_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg){
Protocol__FlexHeader *header = NULL;
err_code_t err_code;
int i;
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0)
goto error;
Protocol__FlexStatsReply *stats_reply_msg;
stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply));
if (stats_reply_msg == NULL)
goto error;
protocol__flex_stats_reply__init(stats_reply_msg);
stats_reply_msg->header = header;
stats_reply_msg->n_ue_report = report_config->nr_ue;
stats_reply_msg->n_cell_report = report_config->nr_cc;
// UE report
Protocol__FlexUeStatsReport **ue_report;
ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue);
if (ue_report == NULL)
goto error;
for (i = 0; i < report_config->nr_ue; i++) {
ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport));
protocol__flex_ue_stats_report__init(ue_report[i]);
ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti;
ue_report[i]->has_rnti = 1;
ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags;
ue_report[i]->has_flags = 1;
}
// cell rpoert
Protocol__FlexCellStatsReport **cell_report;
cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc);
if (cell_report == NULL)
goto error;
for (i = 0; i < report_config->nr_cc; i++) {
cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport));
if(cell_report[i] == NULL)
goto error;
protocol__flex_cell_stats_report__init(cell_report[i]);
cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id;
cell_report[i]->has_carrier_index = 1;
cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags;
cell_report[i]->has_flags = 1;
}
/*
MAC reply split
*/
if (flexran_agent_mac_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
/*
RRC reply split
*/
if (flexran_agent_rrc_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
/*
PDCP reply split
*/
if (flexran_agent_pdcp_stats_reply(enb_id, report_config, ue_report, cell_report) < 0 ) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
stats_reply_msg->cell_report = cell_report;
stats_reply_msg->ue_report = ue_report;
*msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL)
goto error;
protocol__flexran_message__init(*msg);
(*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG;
(*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME;
(*msg)->stats_reply_msg = stats_reply_msg;
return 0;
error :
LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
return err_code;
}
/*
Top Level Request
*/
int flexran_agent_stats_request(mid_t mod_id,
xid_t xid,
const stats_request_config_t *report_config,
Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header = NULL;
int i;
Protocol__FlexStatsRequest *stats_request_msg;
stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest));
if(stats_request_msg == NULL)
goto error;
protocol__flex_stats_request__init(stats_request_msg);
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
goto error;
stats_request_msg->header = header;
stats_request_msg->type = report_config->report_type;
stats_request_msg->has_type = 1;
switch (report_config->report_type) {
case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS:
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST;
Protocol__FlexCompleteStatsRequest *complete_stats;
complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest));
if(complete_stats == NULL)
goto error;
protocol__flex_complete_stats_request__init(complete_stats);
complete_stats->report_frequency = report_config->report_frequency;
complete_stats->has_report_frequency = 1;
complete_stats->sf = report_config->period;
complete_stats->has_sf = 1;
complete_stats->has_cell_report_flags = 1;
complete_stats->has_ue_report_flags = 1;
if (report_config->config->nr_cc > 0) {
complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags;
}
if (report_config->config->nr_ue > 0) {
complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags;
}
stats_request_msg->complete_stats_request = complete_stats;
break;
case PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS:
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST;
Protocol__FlexCellStatsRequest *cell_stats;
cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest));
if(cell_stats == NULL)
goto error;
protocol__flex_cell_stats_request__init(cell_stats);
cell_stats->n_cell = report_config->config->nr_cc;
cell_stats->has_flags = 1;
if (cell_stats->n_cell > 0) {
uint32_t *cells;
cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell);
for (i = 0; i < cell_stats->n_cell; i++) {
cells[i] = report_config->config->cc_report_type[i].cc_id;
}
cell_stats->cell = cells;
cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags;
}
stats_request_msg->cell_stats_request = cell_stats;
break;
case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS:
stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST;
Protocol__FlexUeStatsRequest *ue_stats;
ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest));
if(ue_stats == NULL)
goto error;
protocol__flex_ue_stats_request__init(ue_stats);
ue_stats->n_rnti = report_config->config->nr_ue;
ue_stats->has_flags = 1;
if (ue_stats->n_rnti > 0) {
uint32_t *ues;
ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti);
for (i = 0; i < ue_stats->n_rnti; i++) {
ues[i] = report_config->config->ue_report_type[i].ue_rnti;
}
ue_stats->rnti = ues;
ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags;
}
stats_request_msg->ue_stats_request = ue_stats;
break;
default:
goto error;
}
*msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL)
goto error;
protocol__flexran_message__init(*msg);
(*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG;
(*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
(*msg)->stats_request_msg = stats_request_msg;
return 0;
error:
// TODO: Need to make proper error handling
if (header != NULL)
free(header);
if (stats_request_msg != NULL)
free(stats_request_msg);
if(*msg != NULL)
free(*msg);
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int flexran_agent_destroy_stats_request(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG)
goto error;
free(msg->stats_request_msg->header);
if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) {
free(msg->stats_request_msg->cell_stats_request->cell);
}
if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) {
free(msg->stats_request_msg->ue_stats_request->rnti);
}
free(msg->stats_request_msg);
free(msg);
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
/*
Top Level Update
*/
void flexran_agent_send_update_stats(mid_t mod_id) {
Protocol__FlexranMessage *current_report = NULL;
void *data;
int size;
err_code_t err_code;
int priority = 0;
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
goto error;
}
if (stats_context[mod_id].cont_update == 1) {
/*Create a fresh report with the required flags*/
err_code = flexran_agent_handle_stats(mod_id, (void *) stats_context[mod_id].stats_req, &current_report);
if (err_code < 0) {
goto error;
}
}
/* /\*TODO:Check if a previous reports exists and if yes, generate a report */
/* *that is the diff between the old and the new report, */
/* *respecting the thresholds. Otherwise send the new report*\/ */
/* if (stats_context[mod_id].prev_stats_reply != NULL) { */
/* msg = flexran_agent_generate_diff_mac_stats_report(current_report, stats_context[mod_id].prev_stats_reply); */
/* /\*Destroy the old stats*\/ */
/* flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply); */
/* } */
/* /\*Use the current report for future comparissons*\/ */
/* stats_context[mod_id].prev_stats_reply = current_report; */
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
goto error;
}
if (current_report != NULL){
data=flexran_agent_pack_message(current_report, &size);
/*Send any stats updates using the MAC channel of the eNB*/
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
}
error:
LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
}
err_code_t flexran_agent_disable_cont_stats_update(mid_t mod_id) {
/*Disable the continuous updates for the MAC*/
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
goto error;
}
stats_context[mod_id].cont_update = 0;
stats_context[mod_id].xid = 0;
if (stats_context[mod_id].stats_req != NULL) {
flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
}
if (stats_context[mod_id].prev_stats_reply != NULL) {
flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
}
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
goto error;
}
return 0;
error:
LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
return -1;
}
err_code_t flexran_agent_enable_cont_stats_update(mid_t mod_id,
xid_t xid, stats_request_config_t *stats_req) {
if (pthread_mutex_lock(stats_context[mod_id].mutex)) {
goto error;
}
Protocol__FlexranMessage *req_msg;
flexran_agent_stats_request(mod_id, xid, stats_req, &req_msg);
stats_context[mod_id].stats_req = req_msg;
stats_context[mod_id].prev_stats_reply = NULL;
stats_context[mod_id].cont_update = 1;
stats_context[mod_id].xid = xid;
if (pthread_mutex_unlock(stats_context[mod_id].mutex)) {
goto error;
}
return 0;
error:
LOG_E(FLEXRAN_AGENT, "stats_context for eNB %d is not initialized\n", mod_id);
return -1;
}
err_code_t flexran_agent_init_cont_stats_update(mid_t mod_id) {
/*Initially the continuous update is set to false*/
stats_context[mod_id].cont_update = 0;
stats_context[mod_id].is_initialized = 1;
stats_context[mod_id].stats_req = NULL;
stats_context[mod_id].prev_stats_reply = NULL;
stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t));
if (stats_context[mod_id].mutex == NULL)
goto error;
if (pthread_mutex_init(stats_context[mod_id].mutex, NULL))
goto error;
return 0;
error:
return -1;
}
err_code_t flexran_agent_destroy_cont_stats_update(mid_t mod_id) {
stats_context[mod_id].cont_update = 0;
stats_context[mod_id].is_initialized = 0;
flexran_agent_destroy_flexran_message(stats_context[mod_id].stats_req);
flexran_agent_destroy_flexran_message(stats_context[mod_id].prev_stats_reply);
free(stats_context[mod_id].mutex);
// mac_agent_registered[mod_id] = 0;
return 1;
}
+7 -5
View File
@@ -118,7 +118,7 @@ int flexran_agent_create_channel(void *channel_info,
/*element should be a real pointer*/ /*element should be a real pointer*/
RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel); RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel);
LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); LOG_I(FLEXRAN_AGENT,"Created a new channel with id %d \n", channel->channel_id);
return channel_id; return channel_id;
} }
@@ -141,9 +141,9 @@ int flexran_agent_destroy_channel(int channel_id) {
for (i = 0; i < NUM_MAX_ENB; i++) { for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
if (agent_channel[i][j] != NULL) { if (agent_channel[i][j] != NULL) {
if (agent_channel[i][j]->channel_id == e->channel_id) { if (agent_channel[i][j]->channel_id == e->channel_id) {
agent_channel[i][j] == NULL; free(agent_channel[i][j]);
} }
} }
} }
} }
@@ -164,7 +164,9 @@ err_code_t flexran_agent_init_channel_container(void) {
for (i = 0; i < NUM_MAX_ENB; i++) { for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
agent_channel[i][j] == NULL; agent_channel[i][j] = malloc(sizeof(flexran_agent_channel_t));
if (!agent_channel[i][j])
return -1;
} }
} }
File diff suppressed because it is too large Load Diff
+432
View File
@@ -0,0 +1,432 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_ran_api.h
* \brief FlexRAN RAN API abstraction header
* \author N. Nikaein, X. Foukas and S. SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#include <stdio.h>
#include <time.h>
#include "flexran_agent_common.h"
#include "flexran_agent_common_internal.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_defs.h"
#include "enb_config.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/RLC/rlc.h"
#include "SCHED/defs.h"
#include "pdcp.h"
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "RRC/LITE/rrc_eNB_UE_context.h"
#include "PHY/extern.h"
#include "log.h"
/****************************
* get generic info from RAN
****************************/
uint32_t flexran_get_current_time_ms(mid_t mod_id, int subframe_flag);
/*Return the current frame number
*Could be using implementation specific numbering of frames
*/
frame_t flexran_get_current_frame(mid_t mod_id);
/*Return the current SFN (0-1023)*/
frame_t flexran_get_current_system_frame_num(mid_t mod_id);
sub_frame_t flexran_get_current_subframe(mid_t mod_id);
/*Return the frame and subframe number in compact 16-bit format.
Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/
uint16_t flexran_get_sfn_sf(mid_t mod_id);
/* Return a future frame and subframe number that is ahead_of_time
subframes later in compact 16-bit format. Bits 0-3 subframe,
rest for frame */
uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
/* Return the number of attached UEs */
int flexran_get_num_ues(mid_t mod_id);
/* Get the rnti of a UE with id ue_id */
rnti_t flexran_get_ue_crnti(mid_t mod_id, mid_t ue_id);
/* Get the RLC buffer status report in bytes of a ue for a designated
* logical channel id */
int flexran_get_ue_bsr_ul_buffer_info(mid_t mod_id, mid_t ue_id, lcid_t lcid);
/* Get power headroom of UE with id ue_id */
int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id);
/* Get the UE wideband CQI */
uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id);
/* Get the transmission queue size for a UE with a channel_id logical channel id */
rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/*Get number of pdus in RLC buffer*/
rlc_buffer_occupancy_t flexran_get_num_pdus_buffer(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Get the head of line delay for a UE with a channel_id logical channel id */
frame_t flexran_get_hol_delay(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Check the status of the timing advance for a UE */
int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/* Update the timing advance status(find out whether a timing advance command is required) */
/* currently broken
void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); */
/* Return timing advance MAC control element for a designated cell and UE */
/* this function is broken */
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/* Get the number of active component carriers for a specific UE */
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
/* Get the rank indicator for a designated cell and UE */
uint8_t flexran_get_current_RI(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/* See TS 36.213, section 10.1 */
uint16_t flexran_get_n1pucch_an(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, section 5.4 */
uint8_t flexran_get_nRB_CQI(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, section 5.4 */
uint8_t flexran_get_deltaPUCCH_Shift(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, section 5.7.1 */
uint8_t flexran_get_prach_ConfigIndex(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, section 5.7.1 */
uint8_t flexran_get_prach_FreqOffset(mid_t mod_id, uint8_t cc_id);
/* See TS 36.321 */
uint8_t flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, uint8_t cc_id);
/* Get the length of the UL cyclic prefix */
lte_prefix_type_t flexran_get_ul_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
/* Get the length of the DL cyclic prefix */
lte_prefix_type_t flexran_get_dl_cyclic_prefix_length(mid_t mod_id, uint8_t cc_id);
/* Get the physical cell id of a cell */
uint16_t flexran_get_cell_id(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, section 5.5.3.2 */
uint8_t flexran_get_srs_BandwidthConfig(mid_t mod_id, uint8_t cc_id);
/* See TS 36.211, table 5.5.3.3-1 and 2 */
uint8_t flexran_get_srs_SubframeConfig(mid_t mod_id, uint8_t cc_id);
/* Boolean value. See TS 36.211,
section 5.5.3.2. TDD only */
uint8_t flexran_get_srs_MaxUpPts(mid_t mod_id, uint8_t cc_id);
/* Get number of DL resource blocks */
uint8_t flexran_get_N_RB_DL(mid_t mod_id, uint8_t cc_id);
/* Get number of UL resource blocks */
uint8_t flexran_get_N_RB_UL(mid_t mod_id, uint8_t cc_id);
/* Get number of resource block groups */
uint8_t flexran_get_N_RBG(mid_t mod_id, uint8_t cc_id);
/* Get DL/UL subframe assignment. TDD only */
uint8_t flexran_get_subframe_assignment(mid_t mod_id, uint8_t cc_id);
/* TDD only. See TS 36.211, table 4.2.1 */
uint8_t flexran_get_special_subframe_assignment(mid_t mod_id, uint8_t cc_id);
/* Get the duration of the random access response window in subframes */
long flexran_get_ra_ResponseWindowSize(mid_t mod_id, uint8_t cc_id);
/* Get timer used for random access */
long flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, uint8_t cc_id);
/* Get type of duplex mode(FDD/TDD) */
Protocol__FlexDuplexMode flexran_get_duplex_mode(mid_t mod_id, uint8_t cc_id);
/* Get the SI window length */
long flexran_get_si_window_length(mid_t mod_id, uint8_t cc_id);
/* Get length of SystemInformationBlock1 */
uint8_t flexran_get_sib1_length(mid_t mod_id, uint8_t cc_id);
/* Get the number of PDCCH symbols configured for the cell */
uint8_t flexran_get_num_pdcch_symb(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_antenna_ports(mid_t mod_id, uint8_t cc_id);
/* See TS 36.213, sec 5.1.1.1 */
int flexran_get_tpc(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/* Get the first available HARQ process for a specific cell and UE during
a designated frame and subframe. Returns 0 for success. The id and the
status of the HARQ process are stored in id and status respectively */
/* currently broken
int flexran_get_harq(mid_t mod_id, uint8_t cc_id, mid_t ue_id, frame_t frame,
sub_frame_t subframe, unsigned char *id, unsigned char *round,
uint8_t harq_flag); */
/* Uplink power control management*/
int32_t flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
int8_t flexran_get_p0_nominal_pucch(mid_t mod_id, uint8_t cc_id);
int32_t flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
uint8_t flexran_get_threequarter_fs(mid_t mod_id, uint8_t cc_id);
PUSCH_HOPPING_t flexran_get_hopping_mode(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_hopping_offset(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_n_SB(mid_t mod_id, uint8_t cc_id);
int flexran_get_phich_resource(mid_t mod_id, uint8_t cc_id);
uint8_t flexran_get_enable64QAM(mid_t mod_id, uint8_t cc_id);
PHICH_DURATION_t flexran_get_phich_duration(mid_t mod_id, uint8_t cc_id);
/*
* ************************************
* Get Messages for UE Configuration Reply
* ************************************
*/
/* Get timer in subframes. Controls the synchronization
status of the UE, not the actual timing
advance procedure. See TS 36.321 */
TimeAlignmentTimer_t flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration. See TS 36.133 */
Protocol__FlexMeasGapConfigPattern flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration offset if applicable */
long flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
/* DL aggregated bit-rate of non-gbr bearer
per UE. See TS 36.413 */
uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id);
/* UL aggregated bit-rate of non-gbr bearer
per UE. See TS 36.413 */
uint64_t flexran_get_ue_aggregated_max_bitrate_ul(mid_t mod_id, mid_t ue_id);
/* Only half-duplex support. FDD operation. Boolean value */
int flexran_get_half_duplex(mid_t mod_id, mid_t ue_id);
/* Support of intra-subframe hopping. Boolean value */
int flexran_get_intra_sf_hopping(mid_t mod_id, mid_t ue_id);
/* UE support for type 2 hopping with n_sb>1 */
int flexran_get_type2_sb_1(mid_t mod_id, mid_t ue_id);
/* Get the UE category */
long flexran_get_ue_category(mid_t mod_id, mid_t ue_id);
/* UE support for resource allocation type 1 */
int flexran_get_res_alloc_type1(mid_t mod_id, mid_t ue_id);
/* Get UE transmission mode */
long flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
/* Boolean value. See TS 36.321 */
BOOLEAN_t flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
/* The max HARQ retransmission for UL.
See TS 36.321 */
long flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
long flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
long flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
long flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS36.213, Section 10.1 */
BOOLEAN_t flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS 36.213, Section 8.2 */
BOOLEAN_t flexran_get_ack_nack_simultaneous_trans(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/* Get aperiodic CQI report mode */
CQI_ReportModeAperiodic_t flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
/* Get ACK/NACK feedback mode. TDD only */
long flexran_get_tdd_ack_nack_feedback_mode(mid_t mod_id, mid_t ue_id);
/* See TS36.213, section 10.1 */
long flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
/* Boolean. Extended buffer status report size */
long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
/* Get number of UE transmission antennas */
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
/* Get the IMSI of UE */
uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id);
/* Get logical channel group of a channel with id lc_id */
long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id);
/* Get direction of logical channel with id lc_id */
int flexran_get_direction(mid_t ue_id, mid_t lc_id);
/*Get downlink frequency*/
uint32_t flexran_agent_get_operating_dl_freq(mid_t mod_id, uint8_t cc_id);
/*Get uplink frequency*/
uint32_t flexran_agent_get_operating_ul_freq(mid_t mod_id, uint8_t cc_id);
/*Get eutra band*/
uint8_t flexran_agent_get_operating_eutra_band(mid_t mod_id, uint8_t cc_id);
/*Get downlink ref signal power*/
int8_t flexran_agent_get_operating_pdsch_refpower(mid_t mod_id, uint8_t cc_id);
/*Get uplink power*/
long flexran_agent_get_operating_pusch_p0(mid_t mod_id, uint8_t cc_id);
/*set the dl freq */
void flexran_agent_set_operating_dl_freq(mid_t mod_id, uint8_t cc_id, uint32_t dl_freq_mhz);
/* set the ul freq */
void flexran_agent_set_operating_ul_freq(mid_t mod_id, uint8_t cc_id, int32_t ul_freq_mhz_offset);
/*set the the band */
void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t eutra_band);
/* set the bandwidth (in RB) */
void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB);
/*set frame type*/
void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type);
/*RRC status flexRAN*/
uint8_t flexran_get_rrc_status(mid_t mod_id, mid_t ue_id);
/***************************** PDCP ***********************/
/*PDCP superframe numberflexRAN*/
uint32_t flexran_get_pdcp_sfn(const mid_t mod_id);
/*PDCP pdcp tx stats window*/
void flexran_set_pdcp_tx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
/*PDCP pdcp rx stats window*/
void flexran_set_pdcp_rx_stat_window(const mid_t mod_id, const mid_t ue_id, uint16_t obs_window);
/*PDCP num tx pdu status flexRAN*/
uint32_t flexran_get_pdcp_tx(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP num tx bytes status flexRAN*/
uint32_t flexran_get_pdcp_tx_bytes(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP number of transmit packet / second status flexRAN*/
uint32_t flexran_get_pdcp_tx_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP pdcp tx bytes in a given window flexRAN*/
uint32_t flexran_get_pdcp_tx_bytes_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP tx sequence number flexRAN*/
uint32_t flexran_get_pdcp_tx_sn(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP tx aggregated packet arrival flexRAN*/
uint32_t flexran_get_pdcp_tx_aiat(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP tx aggregated packet arrival per second flexRAN*/
uint32_t flexran_get_pdcp_tx_aiat_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP num rx pdu status flexRAN*/
uint32_t flexran_get_pdcp_rx(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP num rx bytes status flexRAN*/
uint32_t flexran_get_pdcp_rx_bytes(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP number of received packet / second flexRAN*/
uint32_t flexran_get_pdcp_rx_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP gootput (bit/s) status flexRAN*/
uint32_t flexran_get_pdcp_rx_bytes_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP rx sequence number flexRAN*/
uint32_t flexran_get_pdcp_rx_sn(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP rx aggregated packet arrival flexRAN*/
uint32_t flexran_get_pdcp_rx_aiat(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP rx aggregated packet arrival per second flexRAN*/
uint32_t flexran_get_pdcp_rx_aiat_w(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*PDCP num of received outoforder pdu status flexRAN*/
uint32_t flexran_get_pdcp_rx_oo(const mid_t mod_id, const mid_t ue_id, const lcid_t lcid);
/*********************RRC**********************/
/*Get primary cell measuremeant id flexRAN*/
MeasId_t flexran_get_rrc_pcell_measid(mid_t mod_id, mid_t ue_id);
/*Get primary cell RSRP measurement flexRAN*/
float flexran_get_rrc_pcell_rsrp(mid_t mod_id, mid_t ue_id);
/*Get primary cell RSRQ measurement flexRAN*/
float flexran_get_rrc_pcell_rsrq(mid_t mod_id, mid_t ue_id);
/* Get RRC neighbouring measurement */
int flexran_get_rrc_num_ncell(mid_t mod_id, mid_t ue_id);
/*Get physical cell id*/
PhysCellId_t flexran_get_rrc_neigh_phy_cell_id(mid_t mod_id, mid_t ue_id, int cell_id);
/*Get RSRP of neighbouring Cell*/
float flexran_get_rrc_neigh_rsrp(mid_t mod_id, mid_t ue_id, int cell_id);
/*Get RSRQ of neighbouring Cell*/
float flexran_get_rrc_neigh_rsrq(mid_t mod_id, mid_t ue_id, int cell_id);
/*Get MCC PLMN identity neighbouring Cell*/
/* currently not implemented
int flexran_get_rrc_neigh_plmn_mcc(mid_t mod_id, mid_t ue_id, int cell_id); */
/*Get MNC PLMN identity neighbouring Cell*/
/* currently not implemented
int flexran_get_rrc_neigh_plmn_mnc(mid_t mod_id, mid_t ue_id, int cell_id); */
+217
View File
@@ -0,0 +1,217 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_timer.c
* \brief FlexRAN Timer
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
/*
* timer primitives
*/
#include "flexran_agent_timer.h"
//struct flexran_agent_map agent_map;
flexran_agent_timer_instance_t timer_instance;
int agent_timer_init = 0;
err_code_t flexran_agent_init_timer(void){
LOG_I(FLEXRAN_AGENT, "init RB tree\n");
if (!agent_timer_init) {
RB_INIT(&timer_instance.flexran_agent_head);
agent_timer_init = 1;
}
return PROTOCOL__FLEXRAN_ERR__NO_ERR;
}
RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
/* The timer_id might not be the best choice for the comparison */
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){
if (a->timer_id < b->timer_id) return -1;
if (a->timer_id > b->timer_id) return 1;
// equal timers
return 0;
}
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
uint32_t interval_usec,
agent_id_t agent_id,
instance_t instance,
uint32_t timer_type,
xid_t xid,
flexran_agent_timer_callback_t cb,
void* timer_args,
long *timer_id){
struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
DevAssert(e != NULL);
//uint32_t timer_id;
int ret=-1;
if ((interval_sec == 0) && (interval_usec == 0 ))
return TIMER_NULL;
if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
return TIMER_TYPE_INVALIDE;
if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){
ret = timer_setup(interval_sec,
interval_usec,
TASK_FLEXRAN_AGENT,
instance,
TIMER_ONE_SHOT,
timer_args,
timer_id);
e->type = TIMER_ONE_SHOT;
}
else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
ret = timer_setup(interval_sec,
interval_usec,
TASK_FLEXRAN_AGENT,
instance,
TIMER_PERIODIC,
timer_args,
timer_id);
e->type = TIMER_PERIODIC;
}
if (ret < 0 ) {
return TIMER_SETUP_FAILED;
}
e->agent_id = agent_id;
e->instance = instance;
e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE;
e->timer_id = *timer_id;
e->xid = xid;
e->timer_args = timer_args;
e->cb = cb;
/*element should be a real pointer*/
RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e);
LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
e->timer_id, e->agent_id, e->instance);
return 0;
}
err_code_t flexran_agent_destroy_timer(long timer_id){
struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
if (e != NULL ) {
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
flexran_agent_destroy_flexran_message(e->timer_args->msg);
free(e);
}
if (timer_remove(timer_id) < 0 )
goto error;
return 0;
error:
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
return TIMER_REMOVED_FAILED ;
}
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) {
struct flexran_agent_timer_element_s *e = NULL;
long timer_id;
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
if (e->xid == xid) {
timer_id = e->timer_id;
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
flexran_agent_destroy_flexran_message(e->timer_args->msg);
free(e);
if (timer_remove(timer_id) < 0 ) {
goto error;
}
}
}
return 0;
error:
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
return TIMER_REMOVED_FAILED ;
}
err_code_t flexran_agent_destroy_timers(void){
struct flexran_agent_timer_element_s *e = NULL;
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
timer_remove(e->timer_id);
flexran_agent_destroy_flexran_message(e->timer_args->msg);
free(e);
}
return 0;
}
void flexran_agent_sleep_until(struct timespec *ts, int delay) {
ts->tv_nsec += delay;
if(ts->tv_nsec >= 1000*1000*1000){
ts->tv_nsec -= 1000*1000*1000;
ts->tv_sec++;
}
clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL);
}
err_code_t flexran_agent_stop_timer(long timer_id){
struct flexran_agent_timer_element_s *e=NULL;
struct flexran_agent_timer_element_s search;
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
search.timer_id = timer_id;
e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
if (e != NULL ) {
e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED;
}
timer_remove(timer_id);
return 0;
}
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
struct flexran_agent_timer_element_s search;
memset(&search, 0, sizeof(struct flexran_agent_timer_element_s));
search.timer_id = timer_id;
return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
}
+133
View File
@@ -0,0 +1,133 @@
/*
* 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.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_timer.h
* \brief FlexRAN Timer header
* \author shahab SHARIAT BAGHERI
* \date 2017
* \version 0.1
*/
#include <stdio.h>
#include <time.h>
#include "flexran_agent_common.h"
#include "flexran_agent_common_internal.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_defs.h"
# include "tree.h"
# include "intertask_interface.h"
# include "timer.h"
/*******************
* timer primitves
*******************/
#define TIMER_NULL -1
#define TIMER_TYPE_INVALIDE -2
#define TIMER_SETUP_FAILED -3
#define TIMER_REMOVED_FAILED -4
#define TIMER_ELEMENT_NOT_FOUND -5
/* Type of the callback executed when the timer expired */
typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
typedef struct flexran_agent_timer_args_s{
mid_t mod_id;
Protocol__FlexranMessage *msg;
} flexran_agent_timer_args_t;
typedef struct flexran_agent_timer_element_s{
RB_ENTRY(flexran_agent_timer_element_s) entry;
agent_id_t agent_id;
instance_t instance;
flexran_agent_timer_type_t type;
flexran_agent_timer_state_t state;
uint32_t interval_sec;
uint32_t interval_usec;
long timer_id; /* Timer id returned by the timer API*/
xid_t xid; /*The id of the task as received by the controller
message*/
flexran_agent_timer_callback_t cb;
flexran_agent_timer_args_t *timer_args;
} flexran_agent_timer_element_t;
typedef struct flexran_agent_timer_instance_s{
RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head;
}flexran_agent_timer_instance_t;
err_code_t flexran_agent_init_timer(void);
/* Create a timer for some agent related event with id xid. Will store the id
of the generated timer in timer_id */
err_code_t flexran_agent_create_timer(uint32_t interval_sec,
uint32_t interval_usec,
agent_id_t agent_id,
instance_t instance,
uint32_t timer_type,
xid_t xid,
flexran_agent_timer_callback_t cb,
void* timer_args,
long *timer_id);
/* Destroy all existing timers */
err_code_t flexran_agent_destroy_timers(void);
/* Destroy the timer with the given timer_id */
err_code_t flexran_agent_destroy_timer(long timer_id);
/* Destroy the timer for task with id xid */
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
/* Stop a timer */
err_code_t flexran_agent_stop_timer(long timer_id);
/* Restart the given timer */
err_code_t flexran_agent_restart_timer(long *timer_id);
/* Find the timer with the given timer_id */
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id);
/* Obtain the protocol message stored in the given expired timer */
Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
/* Comparator function comparing two timers. Decides the ordering of the timers */
int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b);
/*Specify a delay in nanoseconds to timespec and sleep until then*/
void flexran_agent_sleep_until(struct timespec *ts, int delay);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
+153 -89
View File
@@ -436,59 +436,31 @@ config_sib2(int Mod_idP,
cfg->srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG; cfg->srs_config.srs_acknack_srs_simultaneous_transmission.tl.tag = NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG;
cfg->num_tlv++; cfg->num_tlv++;
nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts) {
cfg->srs_config.max_up_pts.value = 1;
cfg->subframe_config.pb.value = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b;
cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower;
cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value +
power_off_dB[cfg->rf_config.dl_channel_bandwidth.value];
cfg->prach_config.configuration_index.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
cfg->prach_config.root_sequence_index.value = radioResourceConfigCommonP->prach_Config.rootSequenceIndex;
cfg->prach_config.zero_correlation_zone_configuration.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
cfg->prach_config.high_speed_flag.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.highSpeedFlag;
cfg->prach_config.frequency_offset.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_FreqOffset;
cfg->pusch_config.hopping_mode.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
cfg->pusch_config.number_of_subbands.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
cfg->pusch_config.hopping_offset.value = radioResourceConfigCommonP->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
cfg->pucch_config.delta_pucch_shift.value = radioResourceConfigCommonP->pucch_ConfigCommon.deltaPUCCH_Shift;
cfg->pucch_config.n_cqi_rb.value = radioResourceConfigCommonP->pucch_ConfigCommon.nRB_CQI;
cfg->pucch_config.n_an_cs.value = radioResourceConfigCommonP->pucch_ConfigCommon.nCS_AN;
cfg->pucch_config.n1_pucch_an.value = radioResourceConfigCommonP->pucch_ConfigCommon.n1PUCCH_AN;
if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == true)
cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 1;
else if (radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled == true)
cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 2;
else // No hopping
cfg->uplink_reference_signal_config.uplink_rs_hopping.value = 0;
cfg->uplink_reference_signal_config.group_assignment.value = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
cfg->uplink_reference_signal_config.cyclic_shift_1_for_drms.value = radioResourceConfigCommonP->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
// how to enable/disable SRS?
if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.present == SoundingRS_UL_ConfigCommon_PR_setup) {
cfg->srs_config.bandwidth_configuration.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
cfg->srs_config.srs_subframe_configuration.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
cfg->srs_config.srs_acknack_srs_simultaneous_transmission.value = radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
if (radioResourceConfigCommonP->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
cfg->srs_config.max_up_pts.value = 1;
else
cfg->srs_config.max_up_pts.value = 0;
} }
else {
cfg->srs_config.max_up_pts.value = 0;
}
cfg->srs_config.max_up_pts.tl.tag = NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG;
cfg->num_tlv++;
} }
#ifdef Rel14 #ifdef Rel14
if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0) { if (RC.mac[Mod_idP]->common_channels[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0) {
AssertFatal(radioResourceConfigCommon_BRP != NULL, AssertFatal(radioResourceConfigCommon_BRP != NULL, "radioResource rou is missing\n");
"radioResource rou is missing\n"); AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL, "ext4 is missing\n");
AssertFatal(radioResourceConfigCommon_BRP->ext4 != NULL,
"ext4 is missing\n");
cfg->emtc_config.prach_catm_root_sequence_index.value = radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex; cfg->emtc_config.prach_catm_root_sequence_index.value = radioResourceConfigCommon_BRP->prach_Config.rootSequenceIndex;
cfg->emtc_config.prach_catm_root_sequence_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig; cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
cfg->emtc_config.prach_catm_zero_correlation_zone_configuration.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_catm_high_speed_flag.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.highSpeedFlag; cfg->emtc_config.prach_catm_high_speed_flag.value = radioResourceConfigCommon_BRP->prach_Config.prach_ConfigInfo.highSpeedFlag;
cfg->emtc_config.prach_catm_high_speed_flag.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG;
cfg->num_tlv++;
struct PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310; struct PRACH_ConfigSIB_v1310 *ext4_prach = radioResourceConfigCommon_BRP->ext4->prach_ConfigCommon_v1310;
@@ -496,94 +468,186 @@ config_sib2(int Mod_idP,
PRACH_ParametersCE_r13_t *p; PRACH_ParametersCE_r13_t *p;
cfg->emtc_config.prach_ce_level_0_enable.value = 0; cfg->emtc_config.prach_ce_level_0_enable.value = 0;
cfg->emtc_config.prach_ce_level_0_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_1_enable.value = 0; cfg->emtc_config.prach_ce_level_1_enable.value = 0;
cfg->emtc_config.prach_ce_level_1_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_2_enable.value = 0; cfg->emtc_config.prach_ce_level_2_enable.value = 0;
cfg->emtc_config.prach_ce_level_2_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_3_enable.value = 0; cfg->emtc_config.prach_ce_level_3_enable.value = 0;
cfg->emtc_config.prach_ce_level_3_enable.tl.tag=NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
cfg->num_tlv++;
switch (prach_ParametersListCE_r13->list.count) { switch (prach_ParametersListCE_r13->list.count) {
case 4: case 4:
p = prach_ParametersListCE_r13->list.array[3]; p = prach_ParametersListCE_r13->list.array[3];
cfg->emtc_config.prach_ce_level_3_enable.value = 1; cfg->emtc_config.prach_ce_level_3_enable.value = 1;
cfg->emtc_config.prach_ce_level_3_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_3_configuration_index.value = p->prach_ConfigIndex_r13; cfg->emtc_config.prach_ce_level_3_configuration_index.value = p->prach_ConfigIndex_r13;
cfg->emtc_config.prach_ce_level_3_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_3_frequency_offset.value = p->prach_FreqOffset_r13; cfg->emtc_config.prach_ce_level_3_frequency_offset.value = p->prach_FreqOffset_r13;
cfg->emtc_config.prach_ce_level_3_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
if (p->prach_StartingSubframe_r13) cfg->emtc_config.prach_ce_level_3_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
cfg->num_tlv++;
if (p->prach_StartingSubframe_r13) {
cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13;
cfg->emtc_config.prach_ce_level_3_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG;
cfg->num_tlv++;
}
cfg->emtc_config.prach_ce_level_3_hopping_enable.value = p->prach_HoppingConfig_r13; cfg->emtc_config.prach_ce_level_3_hopping_enable.value = p->prach_HoppingConfig_r13;
cfg->emtc_config.prach_ce_level_3_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_3_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; cfg->emtc_config.prach_ce_level_3_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6;
cfg->emtc_config.prach_ce_level_3_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG;
cfg->num_tlv++;
case 3: case 3:
p = prach_ParametersListCE_r13->list.array[2]; p = prach_ParametersListCE_r13->list.array[2];
cfg->emtc_config.prach_ce_level_2_enable.value = 1; cfg->emtc_config.prach_ce_level_2_enable.value = 1;
cfg->emtc_config.prach_ce_level_2_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_2_configuration_index.value = p->prach_ConfigIndex_r13; cfg->emtc_config.prach_ce_level_2_configuration_index.value = p->prach_ConfigIndex_r13;
cfg->emtc_config.prach_ce_level_2_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_2_frequency_offset.value = p->prach_FreqOffset_r13; cfg->emtc_config.prach_ce_level_2_frequency_offset.value = p->prach_FreqOffset_r13;
cfg->emtc_config.prach_ce_level_2_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
if (p->prach_StartingSubframe_r13) cfg->emtc_config.prach_ce_level_2_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
cfg->num_tlv++;
if (p->prach_StartingSubframe_r13) {
cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13;
cfg->emtc_config.prach_ce_level_2_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG;
cfg->num_tlv++;
}
cfg->emtc_config.prach_ce_level_2_hopping_enable.value = p->prach_HoppingConfig_r13; cfg->emtc_config.prach_ce_level_2_hopping_enable.value = p->prach_HoppingConfig_r13;
cfg->emtc_config.prach_ce_level_2_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_2_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; cfg->emtc_config.prach_ce_level_2_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6;
cfg->emtc_config.prach_ce_level_2_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG;
cfg->num_tlv++;
case 2: case 2:
p = prach_ParametersListCE_r13->list.array[1]; p = prach_ParametersListCE_r13->list.array[1];
cfg->emtc_config.prach_ce_level_1_enable.value = 1; cfg->emtc_config.prach_ce_level_1_enable.value = 1;
cfg->emtc_config.prach_ce_level_1_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_1_configuration_index.value = p->prach_ConfigIndex_r13; cfg->emtc_config.prach_ce_level_1_configuration_index.value = p->prach_ConfigIndex_r13;
cfg->emtc_config.prach_ce_level_1_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_1_frequency_offset.value = p->prach_FreqOffset_r13; cfg->emtc_config.prach_ce_level_1_frequency_offset.value = p->prach_FreqOffset_r13;
cfg->emtc_config.prach_ce_level_1_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
if (p->prach_StartingSubframe_r13) cfg->emtc_config.prach_ce_level_1_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
cfg->num_tlv++;
if (p->prach_StartingSubframe_r13) {
cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13;
cfg->emtc_config.prach_ce_level_1_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG;
cfg->num_tlv++;
}
cfg->emtc_config.prach_ce_level_1_hopping_enable.value = p->prach_HoppingConfig_r13; cfg->emtc_config.prach_ce_level_1_hopping_enable.value = p->prach_HoppingConfig_r13;
cfg->emtc_config.prach_ce_level_1_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_1_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; cfg->emtc_config.prach_ce_level_1_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6;
cfg->emtc_config.prach_ce_level_1_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG;
cfg->num_tlv++;
case 1: case 1:
p = prach_ParametersListCE_r13->list.array[0]; p = prach_ParametersListCE_r13->list.array[0];
cfg->emtc_config.prach_ce_level_0_enable.value = 1; cfg->emtc_config.prach_ce_level_0_enable.value = 1;
cfg->emtc_config.prach_ce_level_0_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_0_configuration_index.value = p->prach_ConfigIndex_r13; cfg->emtc_config.prach_ce_level_0_configuration_index.value = p->prach_ConfigIndex_r13;
cfg->emtc_config.prach_ce_level_0_configuration_index.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_0_frequency_offset.value = p->prach_FreqOffset_r13; cfg->emtc_config.prach_ce_level_0_frequency_offset.value = p->prach_FreqOffset_r13;
cfg->emtc_config.prach_ce_level_0_frequency_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13; cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.value = p->numRepetitionPerPreambleAttempt_r13;
if (p->prach_StartingSubframe_r13) cfg->emtc_config.prach_ce_level_0_number_of_repetitions_per_attempt.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG;
cfg->num_tlv++;
if (p->prach_StartingSubframe_r13) {
cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13; cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.value = *p->prach_StartingSubframe_r13;
cfg->emtc_config.prach_ce_level_0_starting_subframe_periodicity.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG;
cfg->num_tlv++;
}
cfg->emtc_config.prach_ce_level_0_hopping_enable.value = p->prach_HoppingConfig_r13; cfg->emtc_config.prach_ce_level_0_hopping_enable.value = p->prach_HoppingConfig_r13;
cfg->emtc_config.prach_ce_level_0_hopping_enable.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG;
cfg->num_tlv++;
cfg->emtc_config.prach_ce_level_0_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6; cfg->emtc_config.prach_ce_level_0_hopping_offset.value = cfg->rf_config.ul_channel_bandwidth.value - 6;
cfg->emtc_config.prach_ce_level_0_hopping_offset.tl.tag = NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG;
cfg->num_tlv++;
} }
struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13; struct FreqHoppingParameters_r13 *ext4_freqHoppingParameters = radioResourceConfigCommonP->ext4->freqHoppingParameters_r13;
if ((ext4_freqHoppingParameters)&&
(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13))
{
switch (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->present) {
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */
break;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13:
cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value =
ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->
choice.interval_FDD_r13;
break;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13:
cfg->emtc_config.
pucch_interval_ulhoppingconfigcommonmodea.value =
ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->
choice.interval_TDD_r13;
break;
}
}
if ((ext4_freqHoppingParameters) && if ((ext4_freqHoppingParameters) &&
(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)) (ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13)){
{ switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->present) {
switch case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_NOTHING: /* No components present */
(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> break;
present) { case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13:
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */ cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_FDD_r13;
break; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13: cfg->num_tlv++;
cfg->emtc_config. break;
pucch_interval_ulhoppingconfigcommonmodeb.value = case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13:
ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13-> cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeA_r13->choice.interval_TDD_r13;
choice.interval_FDD_r13; cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodea.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG;
break; cfg->num_tlv++;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13: break;
cfg->emtc_config.
pucch_interval_ulhoppingconfigcommonmodeb.value =
ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->
choice.interval_TDD_r13;
break;
}
} }
}
if ((ext4_freqHoppingParameters) &&
(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13)){
switch(ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->present) {
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_NOTHING: /* No components present */
break;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13:
cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_FDD_r13;
cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;
cfg->num_tlv++;
break;
case FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13:
cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.value = ext4_freqHoppingParameters->interval_ULHoppingConfigCommonModeB_r13->choice.interval_TDD_r13;
cfg->emtc_config.pucch_interval_ulhoppingconfigcommonmodeb.tl.tag = NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG;
cfg->num_tlv++;
break;
}
}
} }
#endif #endif
+7 -2
View File
@@ -692,7 +692,7 @@ typedef struct {
uint16_t cshift[8]; // num_max_harq uint16_t cshift[8]; // num_max_harq
/// Number of Allocated RBs by the ulsch preprocessor /// Number of Allocated RBs by the ulsch preprocessor
uint8_t pre_allocated_nb_rb_ul; uint8_t pre_allocated_nb_rb_ul[MAX_NUM_SLICES];
/// index of Allocated RBs by the ulsch preprocessor /// index of Allocated RBs by the ulsch preprocessor
int8_t pre_allocated_rb_table_index_ul; int8_t pre_allocated_rb_table_index_ul;
@@ -803,7 +803,8 @@ typedef struct {
///Contention resolution timer used during random access ///Contention resolution timer used during random access
uint8_t mac_ContentionResolutionTimer; uint8_t mac_ContentionResolutionTimer;
uint16_t max_allowed_rbs[MAX_NUM_LCID]; uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES];
uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES];
uint8_t max_mcs[MAX_NUM_LCID]; uint8_t max_mcs[MAX_NUM_LCID];
@@ -962,6 +963,10 @@ typedef struct {
int avail; int avail;
int num_UEs; int num_UEs;
boolean_t active[NUMBER_OF_UE_MAX]; boolean_t active[NUMBER_OF_UE_MAX];
/// Sorting criteria for the UE list in the MAC preprocessor
uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
} UE_list_t; } UE_list_t;
/*! \brief eNB common channels */ /*! \brief eNB common channels */
+44 -57
View File
@@ -52,12 +52,9 @@
//#include "LAYER2/MAC/pre_processor.c" //#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h" #include "pdcp.h"
#if defined(FLEXRAN_AGENT_SB_IF)
//Agent-related headers //Agent-related headers
#include "flexran_agent_extern.h" #include "flexran_agent_extern.h"
#include "flexran_agent_mac.h" #include "flexran_agent_mac.h"
#include "flexran_agent_mac_proto.h"
#endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
#include "intertask_interface.h" #include "intertask_interface.h"
@@ -416,6 +413,13 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti); mac_eNB_rrc_ul_failure(module_idP, CC_id, frameP, subframeP,rnti);
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0; UE_list->UE_sched_ctrl[UE_id].ul_failure_timer = 0;
UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1; UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync = 1;
//Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
if (rrc_agent_registered[module_idP]) {
LOG_W(MAC, "notify flexran Agent of UE state change\n");
agent_rrc_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
} }
} // ul_failure_timer>0 } // ul_failure_timer>0
@@ -497,22 +501,20 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
int mbsfn_status[MAX_NUM_CCs]; int mbsfn_status[MAX_NUM_CCs];
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
int CC_id, i; int CC_id, i = -1;
UE_list_t *UE_list = &RC.mac[module_idP]->UE_list; UE_list_t *UE_list = &RC.mac[module_idP]->UE_list;
rnti_t rnti; rnti_t rnti;
COMMON_channels_t *cc = RC.mac[module_idP]->common_channels; COMMON_channels_t *cc = RC.mac[module_idP]->common_channels;
#if defined(FLEXRAN_AGENT_SB_IF)
Protocol__FlexranMessage *msg;
#endif
start_meas(&RC.mac[module_idP]->eNB_scheduler); start_meas(&RC.mac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, (VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
VCD_FUNCTION_IN); VCD_FUNCTION_IN);
RC.mac[module_idP]->frame = frameP;
RC.mac[module_idP]->subframe = subframeP;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
mbsfn_status[CC_id] = 0; mbsfn_status[CC_id] = 0;
@@ -524,9 +526,29 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
cc[CC_id].mcch_active = 0; cc[CC_id].mcch_active = 0;
#endif #endif
RC.mac[module_idP]->frame = frameP;
RC.mac[module_idP]->subframe = subframeP;
clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP);
}
// refresh UE list based on UEs dropped by PHY in previous subframe
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if (UE_list->active[i] != TRUE)
continue;
rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i);
if ((frameP == 0) && (subframeP == 0)) {
LOG_I(MAC,
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
rnti,
UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
0 ? "in synch" : "out of sync",
UE_list->UE_template[CC_id][i].phr_info,
UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
}
RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) + RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) +
subframeP] = -63; subframeP] = -63;
@@ -594,42 +616,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
} }
} }
// refresh UE list based on UEs dropped by PHY in previous subframe
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if (UE_list->active[i] != TRUE) continue;
rnti = UE_RNTI(module_idP, i);
CC_id = UE_PCCID(module_idP, i);
if ((frameP == 0) && (subframeP == 0)) {
LOG_I(MAC,
"UE rnti %x : %s, PHR %d dB DL CQI %d PUSCH SNR %d PUCCH SNR %d\n",
rnti,
UE_list->UE_sched_ctrl[i].ul_out_of_sync ==
0 ? "in synch" : "out of sync",
UE_list->UE_template[CC_id][i].phr_info,
UE_list->UE_sched_ctrl[i].dl_cqi[CC_id],
(UE_list->UE_sched_ctrl[i].pusch_snr[CC_id] - 128) / 2,
(UE_list->UE_sched_ctrl[i].pucch1_snr[CC_id] - 128) / 2);
}
RC.eNB[module_idP][CC_id]->pusch_stats_bsr[i][(frameP * 10) + subframeP] = -63;
if (i == UE_list->head)
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME
(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR,
RC.eNB[module_idP][CC_id]->
pusch_stats_bsr[i][(frameP * 10) + subframeP]);
// increment this, it is cleared when we receive an sdu
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].ul_inactivity_timer++;
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer++;
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n", i, rnti,
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].
ul_inactivity_timer,
RC.mac[module_idP]->UE_list.UE_sched_ctrl[i].cqi_req_timer);
check_ul_failure(module_idP, CC_id, i, frameP, subframeP);
}
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,
NOT_A_RNTI, frameP, subframeP, NOT_A_RNTI, frameP, subframeP,
module_idP); module_idP);
@@ -652,7 +638,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
// This schedules MIB // This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0) if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP); schedule_mib(module_idP, frameP, subframeP);
// This schedules SI for legacy LTE and eMTC starting in subframeP // This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI(module_idP, frameP, subframeP); schedule_SI(module_idP, frameP, subframeP);
// This schedules Paging in subframeP // This schedules Paging in subframeP
@@ -669,18 +655,19 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
schedule_SR(module_idP, frameP, subframeP); schedule_SR(module_idP, frameP, subframeP);
// This schedules UCI_CSI in subframeP // This schedules UCI_CSI in subframeP
schedule_CSI(module_idP, frameP, subframeP); schedule_CSI(module_idP, frameP, subframeP);
// This schedules DLSCH in subframeP // This schedules DLSCH in subframeP
schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); schedule_dlsch(module_idP, frameP, subframeP, mbsfn_status);
if (RC.flexran[module_idP]->enabled)
flexran_agent_send_update_stats(module_idP);
// Allocate CCEs for good after scheduling is done // Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
allocate_CCEs(module_idP, CC_id, subframeP, 0); allocate_CCEs(module_idP, CC_id, subframeP, 0);
stop_meas(&RC.mac[module_idP]->eNB_scheduler); stop_meas(&RC.mac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
VCD_FUNCTION_OUT); (VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,
VCD_FUNCTION_OUT);
} }
+167 -10
View File
@@ -57,6 +57,12 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#endif #endif
#include "ENB_APP/flexran_agent_defs.h"
#include "flexran_agent_ran_api.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include <dlfcn.h>
#include "T.h" #include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
@@ -65,6 +71,40 @@
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
// number of active slices for past and current time
int n_active_slices = 1;
int n_active_slices_current = 1;
// RB share for each slice for past and current time
float avg_slice_percentage=0.25;
float slice_percentage[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float slice_percentage_current[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float total_slice_percentage = 0;
float total_slice_percentage_current = 0;
// MAX MCS for each slice for past and current time
int slice_maxmcs[MAX_NUM_SLICES] = { 28, 28, 28, 28 };
int slice_maxmcs_current[MAX_NUM_SLICES] = { 28, 28, 28, 28 };
int update_dl_scheduler[MAX_NUM_SLICES] = { 1, 1, 1, 1 };
int update_dl_scheduler_current[MAX_NUM_SLICES] = { 1, 1, 1, 1 };
// name of available scheduler
char *dl_scheduler_type[MAX_NUM_SLICES] =
{ "schedule_ue_spec",
"schedule_ue_spec",
"schedule_ue_spec",
"schedule_ue_spec"
};
// The lists of criteria that enforce the sorting policies of the slices
uint32_t sorting_policy[MAX_NUM_SLICES] = {0x01234, 0x01234, 0x01234, 0x01234};
uint32_t sorting_policy_current[MAX_NUM_SLICES] = {0x01234, 0x01234, 0x01234, 0x01234};
// pointer to the slice specific scheduler
slice_scheduler_dl slice_sched_dl[MAX_NUM_SLICES] = {0};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void void
add_ue_dlsch_info(module_id_t module_idP, add_ue_dlsch_info(module_id_t module_idP,
@@ -404,12 +444,122 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
} }
} }
//------------------------------------------------------------------------------
void
schedule_dlsch(module_id_t module_idP,
frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag)
//------------------------------------------------------------------------------{
{
int i = 0;
total_slice_percentage=0;
avg_slice_percentage=1.0/n_active_slices;
// reset the slice percentage for inactive slices
for (i = n_active_slices; i< MAX_NUM_SLICES; i++) {
slice_percentage[i]=0;
}
for (i = 0; i < n_active_slices; i++) {
if (slice_percentage[i] < 0 ){
LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero",
module_idP, frameP, subframeP, i, slice_percentage[i]);
slice_percentage[i]=0;
}
total_slice_percentage+=slice_percentage[i];
}
for (i = 0; i < n_active_slices; i++) {
// Load any updated functions
if (update_dl_scheduler[i] > 0 ) {
slice_sched_dl[i] = dlsym(NULL, dl_scheduler_type[i]);
update_dl_scheduler[i] = 0 ;
update_dl_scheduler_current[i] = 0;
LOG_N(MAC,"update dl scheduler slice %d\n", i);
}
if (total_slice_percentage <= 1.0){ // the new total RB share is within the range
// check if the number of slices has changed, and log
if (n_active_slices_current != n_active_slices ){
if ((n_active_slices > 0) && (n_active_slices <= MAX_NUM_SLICES)) {
LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active DL slices has changed: %d-->%d\n",
module_idP, frameP, subframeP, n_active_slices_current, n_active_slices);
n_active_slices_current = n_active_slices;
} else {
LOG_W(MAC,"invalid number of DL slices %d, revert to the previous value %d\n",n_active_slices, n_active_slices_current);
n_active_slices = n_active_slices_current;
}
}
// check if the slice rb share has changed, and log the console
if (slice_percentage_current[i] != slice_percentage[i]){ // new slice percentage
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n",
module_idP, i, frameP, subframeP, total_slice_percentage_current, total_slice_percentage, slice_percentage_current[i], slice_percentage[i]);
total_slice_percentage_current= total_slice_percentage;
slice_percentage_current[i] = slice_percentage[i];
}
// check if the slice max MCS, and log the console
if (slice_maxmcs_current[i] != slice_maxmcs[i]){
if ((slice_maxmcs[i] >= 0) && (slice_maxmcs[i] < 29)){
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
module_idP, i, frameP, subframeP, slice_maxmcs_current[i], slice_maxmcs[i]);
slice_maxmcs_current[i] = slice_maxmcs[i];
} else {
LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid slice max mcs %d, revert the previous value %d\n",module_idP, i, slice_maxmcs[i],slice_maxmcs_current[i]);
slice_maxmcs[i]= slice_maxmcs_current[i];
}
}
// check if a new scheduler, and log the console
if (update_dl_scheduler_current[i] != update_dl_scheduler[i]){
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: DL scheduler for this slice is updated: %s \n",
module_idP, i, frameP, subframeP, dl_scheduler_type[i]);
update_dl_scheduler_current[i] = update_dl_scheduler[i];
}
} else {
// here we can correct the values, e.g. reduce proportionally
if (n_active_slices == n_active_slices_current){
LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n",
module_idP, i, total_slice_percentage_current, total_slice_percentage);
if (slice_percentage[i] >= avg_slice_percentage){
slice_percentage[i]-=0.1;
total_slice_percentage-=0.1;
}
} else {
LOG_W(MAC,"[eNB %d][SLICE %d][DL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n",
module_idP, i, total_slice_percentage_current, total_slice_percentage,
n_active_slices, n_active_slices_current );
n_active_slices = n_active_slices_current;
slice_percentage[i] = slice_percentage_current[i];
}
}
// Check for new sorting policy
if (sorting_policy_current[i] != sorting_policy[i]) {
LOG_N(MAC,"[eNB %d][SLICE %d][DL] frame %d subframe %d: UE sorting policy has changed (%x-->%x)\n",
module_idP, i, frameP, subframeP, sorting_policy_current[i], sorting_policy[i]);
sorting_policy_current[i] = sorting_policy[i];
}
// Run each enabled slice-specific schedulers one by one
slice_sched_dl[i](module_idP, i, frameP, subframeP, mbsfn_flag/*, dl_info*/);
}
}
// changes to pre-processor for eMTC // changes to pre-processor for eMTC
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void void
schedule_ue_spec(module_id_t module_idP, schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
@@ -529,13 +679,18 @@ schedule_ue_spec(module_id_t module_idP,
/// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band) /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_IN);
start_meas(&eNB->schedule_dlsch_preprocessor); start_meas(&eNB->schedule_dlsch_preprocessor);
dlsch_scheduler_pre_processor(module_idP, dlsch_scheduler_pre_processor(module_idP,
frameP, subframeP, N_RBG, mbsfn_flag); slice_idP,
frameP,
subframeP,
N_RBG,
mbsfn_flag);
stop_meas(&eNB->schedule_dlsch_preprocessor); stop_meas(&eNB->schedule_dlsch_preprocessor);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_OUT); (VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_OUT);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n", CC_id); LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n", CC_id);
@@ -560,9 +715,11 @@ schedule_ue_spec(module_id_t module_idP,
} }
if (eNB_UE_stats == NULL) { if (eNB_UE_stats == NULL) {
LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n"); LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n");
continue_flag = 1; continue_flag = 1;
} }
if (!ue_slice_membership(UE_id, slice_idP))
continue;
if (continue_flag != 1) { if (continue_flag != 1) {
switch (get_tmode(module_idP, CC_id, UE_id)) { switch (get_tmode(module_idP, CC_id, UE_id)) {
@@ -643,12 +800,12 @@ schedule_ue_spec(module_id_t module_idP,
eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE); eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
*/ */
if (nfapi_mode) { if (nfapi_mode) {
eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; eNB_UE_stats->dlsch_mcs1 = 10;//cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]];
} }
else { else { // this operation is also done in the preprocessor
eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[ue_sched_ctl->dl_cqi[CC_id]]; eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, slice_maxmcs[slice_idP]); //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
} }
eNB_UE_stats->dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1; //cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
// store stats // store stats
@@ -61,6 +61,8 @@
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
extern int n_active_slices;
int choose(int n, int k) int choose(int n, int k)
{ {
int res = 1; int res = 1;
@@ -1739,6 +1741,7 @@ int UE_num_active_CC(UE_list_t * listP, int ue_idP)
int UE_PCCID(module_id_t mod_idP, int ue_idP) int UE_PCCID(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
if (!RC.mac || !RC.mac[mod_idP]) return 0;
return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]); return (RC.mac[mod_idP]->UE_list.pCC_id[ue_idP]);
} }
@@ -1746,6 +1749,7 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP)
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
if (!RC.mac || !RC.mac[mod_idP]) return 0;
rnti_t rnti = rnti_t rnti =
RC.mac[mod_idP]-> RC.mac[mod_idP]->
UE_list.UE_template[UE_PCCID(mod_idP, ue_idP)][ue_idP].rnti; UE_list.UE_template[UE_PCCID(mod_idP, ue_idP)][ue_idP].rnti;
@@ -1763,6 +1767,7 @@ rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP)
boolean_t is_UE_active(module_id_t mod_idP, int ue_idP) boolean_t is_UE_active(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
if (!RC.mac || !RC.mac[mod_idP]) return 0;
return (RC.mac[mod_idP]->UE_list.active[ue_idP]); return (RC.mac[mod_idP]->UE_list.active[ue_idP]);
} }
@@ -4037,3 +4042,22 @@ harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP,
sched_ctl->pucch1_cqi_update[CC_idP] = 1; sched_ctl->pucch1_cqi_update[CC_idP] = 1;
} }
} }
// Flexran Slicing functions
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs)
{
return (uint16_t) floor(rb_percentage * total_rbs);
}
int ue_slice_membership(int UE_id, int slice_id)
{
if ((slice_id < 0) || (slice_id > n_active_slices))
LOG_W(MAC, "out of range slice id %d\n", slice_id);
if ((UE_id % n_active_slices) == slice_id) {
return 1; // this ue is a member of this slice
}
return 0;
}
+156 -22
View File
@@ -57,6 +57,13 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#endif #endif
#include "ENB_APP/flexran_agent_defs.h"
#include "flexran_agent_ran_api.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "flexran_agent_mac.h"
#include <dlfcn.h>
#include "T.h" #include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
@@ -76,6 +83,37 @@ uint8_t rb_table[34] =
36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100 36, 40, 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 96, 100
}; };
/* number of active slices for past and current time*/
int n_active_slices_uplink = 1;
int n_active_slices_current_uplink = 1;
/* RB share for each slice for past and current time*/
float avg_slice_percentage_uplink=0.25;
float slice_percentage_uplink[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float slice_percentage_current_uplink[MAX_NUM_SLICES] = {1.0, 0.0, 0.0, 0.0};
float total_slice_percentage_uplink = 0;
float total_slice_percentage_current_uplink = 0;
// MAX MCS for each slice for past and current time
int slice_maxmcs_uplink[MAX_NUM_SLICES] = {20, 20, 20, 20};
int slice_maxmcs_current_uplink[MAX_NUM_SLICES] = {20,20,20,20};
/*resource blocks allowed*/
uint16_t nb_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES];
/*Slice Update */
int update_ul_scheduler[MAX_NUM_SLICES] = {1, 1, 1, 1};
int update_ul_scheduler_current[MAX_NUM_SLICES] = {1, 1, 1, 1};
/* name of available scheduler*/
char *ul_scheduler_type[MAX_NUM_SLICES] = {"schedule_ulsch_rnti",
"schedule_ulsch_rnti",
"schedule_ulsch_rnti",
"schedule_ulsch_rnti"
};
/* Slice Function Pointer */
slice_scheduler_ul slice_sched_ul[MAX_NUM_SLICES] = {0};
void void
rx_sdu(const module_id_t enb_mod_idP, rx_sdu(const module_id_t enb_mod_idP,
const int CC_idP, const int CC_idP,
@@ -804,13 +842,13 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
* (done below in schedule_ulsch). * (done below in schedule_ulsch).
*/ */
void void
set_msg3_subframe(module_id_t Mod_id, set_msg3_subframe(module_id_t mod_id,
int CC_id, int CC_id,
int frame, int frame,
int subframe, int rnti, int Msg3_frame, int subframe, int rnti, int Msg3_frame,
int Msg3_subframe) int Msg3_subframe)
{ {
eNB_MAC_INST *mac = RC.mac[Mod_id]; eNB_MAC_INST *mac = RC.mac[mod_id];
int i; int i;
for (i = 0; i < NB_RA_PROC_MAX; i++) { for (i = 0; i < NB_RA_PROC_MAX; i++) {
if (mac->common_channels[CC_id].ra[i].state != IDLE && if (mac->common_channels[CC_id].ra[i].state != IDLE &&
@@ -822,7 +860,6 @@ set_msg3_subframe(module_id_t Mod_id,
} }
} }
void void
schedule_ulsch(module_id_t module_idP, frame_t frameP, schedule_ulsch(module_id_t module_idP, frame_t frameP,
sub_frame_t subframeP) sub_frame_t subframeP)
@@ -935,14 +972,110 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
} }
} }
schedule_ulsch_rnti(module_idP, frameP, subframeP, sched_subframe, // perform slice-specifc operations
first_rb);
total_slice_percentage_uplink=0;
avg_slice_percentage_uplink=1.0/n_active_slices_uplink;
// reset the slice percentage for inactive slices
for (i = n_active_slices_uplink; i< MAX_NUM_SLICES; i++) {
slice_percentage_uplink[i]=0;
}
for (i = 0; i < n_active_slices_uplink; i++) {
if (slice_percentage_uplink[i] < 0 ){
LOG_W(MAC, "[eNB %d] frame %d subframe %d:invalid slice %d percentage %f. resetting to zero",
module_idP, frameP, subframeP, i, slice_percentage_uplink[i]);
slice_percentage_uplink[i]=0;
}
total_slice_percentage_uplink+=slice_percentage_uplink[i];
}
for (i = 0; i < n_active_slices_uplink; i++) {
// Load any updated functions
if (update_ul_scheduler[i] > 0 ) {
slice_sched_ul[i] = dlsym(NULL, ul_scheduler_type[i]);
update_ul_scheduler[i] = 0;
update_ul_scheduler_current[i] = 0;
//slice_percentage_current_uplink[i]= slice_percentage_uplink[i];
//total_slice_percentage_current_uplink+=slice_percentage_uplink[i];
//if (total_slice_percentage_current_uplink> 1)
//total_slice_percentage_current_uplink=1;
LOG_N(MAC,"update ul scheduler slice %d\n", i);
}
// the new total RB share is within the range
if (total_slice_percentage_uplink <= 1.0){
// check if the number of slices has changed, and log
if (n_active_slices_current_uplink != n_active_slices_uplink ){
if ((n_active_slices_uplink > 0) && (n_active_slices_uplink <= MAX_NUM_SLICES)) {
LOG_N(MAC,"[eNB %d]frame %d subframe %d: number of active UL slices has changed: %d-->%d\n",
module_idP, frameP, subframeP, n_active_slices_current_uplink, n_active_slices_uplink);
n_active_slices_current_uplink = n_active_slices_uplink;
} else {
LOG_W(MAC,"invalid number of UL slices %d, revert to the previous value %d\n",
n_active_slices_uplink, n_active_slices_current_uplink);
n_active_slices_uplink = n_active_slices_current_uplink;
}
}
// check if the slice rb share has changed, and log the console
if (slice_percentage_current_uplink[i] != slice_percentage_uplink[i]){
LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: total percentage %f-->%f, slice RB percentage has changed: %f-->%f\n",
module_idP, i, frameP, subframeP, total_slice_percentage_current_uplink,
total_slice_percentage_uplink, slice_percentage_current_uplink[i], slice_percentage_uplink[i]);
total_slice_percentage_current_uplink = total_slice_percentage_uplink;
slice_percentage_current_uplink[i] = slice_percentage_uplink[i];
}
// check if the slice max MCS, and log the console
if (slice_maxmcs_current_uplink[i] != slice_maxmcs_uplink[i]){
if ((slice_maxmcs_uplink[i] >= 0) && (slice_maxmcs_uplink[i] <= 16)){
LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: slice MAX MCS has changed: %d-->%d\n",
module_idP, i, frameP, subframeP, slice_maxmcs_current_uplink[i], slice_maxmcs_uplink[i]);
slice_maxmcs_current_uplink[i] = slice_maxmcs_uplink[i];
} else {
LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid slice max mcs %d, revert the previous value %d\n",
module_idP, i, slice_maxmcs_uplink[i],slice_maxmcs_current_uplink[i]);
slice_maxmcs_uplink[i] = slice_maxmcs_current_uplink[i];
}
}
// check if a new scheduler, and log the console
if (update_ul_scheduler_current[i] != update_ul_scheduler[i]){
LOG_N(MAC,"[eNB %d][SLICE %d][UL] frame %d subframe %d: UL scheduler for this slice is updated: %s \n",
module_idP, i, frameP, subframeP, ul_scheduler_type[i]);
update_ul_scheduler_current[i] = update_ul_scheduler[i];
}
} else {
if (n_active_slices_uplink == n_active_slices_current_uplink) {
LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), reduce proportionally the RB share by 0.1\n",
module_idP, i, total_slice_percentage_current_uplink, total_slice_percentage_uplink);
if (slice_percentage_uplink[i] > avg_slice_percentage_uplink) {
slice_percentage_uplink[i] -= 0.1;
total_slice_percentage_uplink -= 0.1;
}
} else {
// here we can correct the values, e.g. reduce proportionally
LOG_W(MAC,"[eNB %d][SLICE %d][UL] invalid total RB share (%f->%f), revert the number of slice to its previous value (%d->%d)\n",
module_idP, i, total_slice_percentage_current_uplink,
total_slice_percentage_uplink, n_active_slices_uplink,
n_active_slices_current_uplink);
n_active_slices_uplink = n_active_slices_current_uplink;
slice_percentage_uplink[i] = slice_percentage_current_uplink[i];
}
}
// Run each enabled slice-specific schedulers one by one
slice_sched_ul[i](module_idP, i, frameP, subframeP, sched_subframe, first_rb);
}
stop_meas(&mac->schedule_ulsch); stop_meas(&mac->schedule_ulsch);
} }
void void
schedule_ulsch_rnti(module_id_t module_idP, schedule_ulsch_rnti(module_id_t module_idP,
slice_id_t slice_id,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP, sub_frame_t subframeP,
unsigned char sched_subframeP, uint16_t * first_rb) unsigned char sched_subframeP, uint16_t * first_rb)
@@ -971,7 +1104,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
int rvidx_tab[4] = { 0, 2, 3, 1 }; int rvidx_tab[4] = { 0, 2, 3, 1 };
if (sched_subframeP < subframeP) if (sched_subframeP < subframeP)
sched_frame++; sched_frame++;
nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id]; nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id];
nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body;
@@ -981,7 +1114,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body; nfapi_ul_config_request_body_t *ul_req_tmp_body = &ul_req_tmp->ul_config_request_body;
//LOG_D(MAC, "entering ulsch preprocesor\n"); //LOG_D(MAC, "entering ulsch preprocesor\n");
ulsch_scheduler_pre_processor(module_idP, frameP, subframeP, first_rb); ulsch_scheduler_pre_processor(module_idP, slice_id, frameP, subframeP, first_rb);
//LOG_D(MAC, "exiting ulsch preprocesor\n"); //LOG_D(MAC, "exiting ulsch preprocesor\n");
@@ -991,13 +1124,16 @@ schedule_ulsch_rnti(module_id_t module_idP,
for (UE_id = UE_list->head_ul; UE_id >= 0; for (UE_id = UE_list->head_ul; UE_id >= 0;
UE_id = UE_list->next_ul[UE_id]) { UE_id = UE_list->next_ul[UE_id]) {
if (!ue_slice_membership(UE_id, slice_id))
continue;
// don't schedule if Msg4 is not received yet // don't schedule if Msg4 is not received yet
if (UE_list->UE_template[UE_PCCID(module_idP, UE_id)][UE_id]. if (UE_list->UE_template[UE_PCCID(module_idP, UE_id)][UE_id].
configured == FALSE) { configured == FALSE) {
LOG_D(MAC, LOG_D(MAC,
"[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n", "[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n",
module_idP, frameP, subframeP, UE_id); module_idP, frameP, subframeP, UE_id);
continue; continue;
} }
rnti = UE_RNTI(module_idP, UE_id); rnti = UE_RNTI(module_idP, UE_id);
@@ -1153,14 +1289,13 @@ schedule_ulsch_rnti(module_id_t module_idP,
ndi = 1 - UE_template->oldNDI_UL[harq_pid]; ndi = 1 - UE_template->oldNDI_UL[harq_pid];
UE_template->oldNDI_UL[harq_pid] = ndi; UE_template->oldNDI_UL[harq_pid] = ndi;
UE_list->eNB_UE_stats[CC_id][UE_id]. UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power = normalized_rx_power;
normalized_rx_power = normalized_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power; UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power = target_rx_power;
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1 = UE_template->pre_assigned_mcs_ul; UE_template->mcs_UL[harq_pid] = cmin(UE_template->pre_assigned_mcs_ul, slice_maxmcs_uplink[slice_id]);
UE_template->mcs_UL[harq_pid] = UE_template->pre_assigned_mcs_ul; //cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1= UE_template->mcs_UL[harq_pid];
//cmin (UE_template->pre_assigned_mcs_ul, openair_daq_vars.target_ue_ul_mcs); // adjust, based on user-defined MCS
if (UE_template->pre_allocated_rb_table_index_ul >= 0) { if (UE_template->pre_allocated_rb_table_index_ul >= 0) {
rb_table_index = rb_table_index = UE_template->pre_allocated_rb_table_index_ul;
UE_template->pre_allocated_rb_table_index_ul;
} else { } else {
UE_template->mcs_UL[harq_pid] = 10; //cmin (10, openair_daq_vars.target_ue_ul_mcs); UE_template->mcs_UL[harq_pid] = 10; //cmin (10, openair_daq_vars.target_ue_ul_mcs);
rb_table_index = 5; // for PHR rb_table_index = 5; // for PHR
@@ -1170,10 +1305,9 @@ schedule_ulsch_rnti(module_id_t module_idP,
// buffer_occupancy = UE_template->ul_total_buffer; // buffer_occupancy = UE_template->ul_total_buffer;
while (((rb_table[rb_table_index] > while (((rb_table[rb_table_index] > (N_RB_UL - 1 - first_rb[CC_id]))
(N_RB_UL - 1 - first_rb[CC_id])) || (rb_table[rb_table_index] > 45))
|| (rb_table[rb_table_index] > 45)) && (rb_table_index > 0)) {
&& (rb_table_index > 0)) {
rb_table_index--; rb_table_index--;
} }
@@ -1,216 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_mac_proto.h
* \brief MAC functions for FlexRAN agent
* \author Xenofon Foukas and Navid Nikaein
* \date 2016
* \email: x.foukas@sms.ed.ac.uk
* \version 0.1
* @ingroup _mac
*/
#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
#include "flexran_agent_defs.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
/*
* slice specific scheduler
*/
typedef void (*slice_scheduler) (module_id_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* top level flexran scheduler used by the eNB scheduler
*/
void flexran_schedule_ue_spec_default(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* slice specific scheduler for embb
*/
void
flexran_schedule_ue_spec_embb(mid_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* slice specific scheduler for urllc
*/
void
flexran_schedule_ue_spec_urllc(mid_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* slice specific scheduler for mmtc
*/
void
flexran_schedule_ue_spec_mmtc(mid_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* slice specific scheduler for best effort traffic
*/
void
flexran_schedule_ue_spec_be(mid_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* common flexran scheduler function
*/
void
flexran_schedule_ue_spec_common(mid_t mod_id,
int slice_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
int flexran_slice_member(int UE_id, int slice_id);
int flexran_slice_maxmcs(int slice_id);
void _store_dlsch_buffer(module_id_t Mod_id,
int slice_id,
frame_t frameP, sub_frame_t subframeP);
void _assign_rbs_required(module_id_t Mod_id,
int slice_id,
frame_t frameP,
sub_frame_t subframe,
uint16_t
nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
uint16_t
nb_rbs_allowed_slice[MAX_NUM_CCs]
[MAX_NUM_SLICES], int min_rb_unit[MAX_NUM_CCs]);
void _dlsch_scheduler_pre_processor(module_id_t Mod_id,
int slice_id,
frame_t frameP,
sub_frame_t subframeP,
int N_RBG[MAX_NUM_CCs],
int *mbsfn_flag);
void _dlsch_scheduler_pre_processor_reset(int module_idP,
int UE_id,
uint8_t CC_id,
int frameP,
int subframeP,
int N_RBG,
uint16_t
nb_rbs_required[MAX_NUM_CCs]
[NUMBER_OF_UE_MAX],
uint16_t
nb_rbs_required_remaining
[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
uint16_t
nb_rbs_allowed_slice[MAX_NUM_CCs]
[MAX_NUM_SLICES],
unsigned char
rballoc_sub[MAX_NUM_CCs]
[N_RBG_MAX],
unsigned char
MIMO_mode_indicator[MAX_NUM_CCs]
[N_RBG_MAX]);
void _dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
int UE_id,
uint8_t CC_id,
int N_RBG,
int transmission_mode,
int min_rb_unit,
uint8_t N_RB_DL,
uint16_t
nb_rbs_required[MAX_NUM_CCs]
[NUMBER_OF_UE_MAX],
uint16_t
nb_rbs_required_remaining
[MAX_NUM_CCs]
[NUMBER_OF_UE_MAX],
unsigned char
rballoc_sub[MAX_NUM_CCs]
[N_RBG_MAX],
unsigned char
MIMO_mode_indicator
[MAX_NUM_CCs][N_RBG_MAX]);
/*
* Default scheduler used by the eNB agent
*/
void flexran_schedule_ue_spec_default(mid_t mod_id, uint32_t frame,
uint32_t subframe, int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
/*
* Data plane function for applying the DL decisions of the scheduler
*/
void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage *
dl_scheduling_info);
/*
* Data plane function for applying the UE specific DL decisions of the scheduler
*/
void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
uint32_t n_dl_ue_data,
Protocol__FlexDlData **
dl_ue_data);
/*
* Data plane function for filling the DCI structure
*/
void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti,
Protocol__FlexDlDci * dl_dci);
#endif
@@ -1,588 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_scheduler_dataplane.c
* \brief data plane procedures related to eNB scheduling
* \author Xenofon Foukas
* \date 2016
* \email: x.foukas@sms.ed.ac.uk
* \version 0.1
* @ingroup _mac
*/
#include "assertions.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/flexran_dci_conversions.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_common.h"
#include "SIMULATION/TOOLS/defs.h" // for taus
void
flexran_apply_dl_scheduling_decisions(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage *
dl_scheduling_info)
{
Protocol__FlexDlMacConfig *mac_config =
dl_scheduling_info->dl_mac_config_msg;
// Check if there is anything to schedule for random access
if (mac_config->n_dl_rar > 0) {
/*TODO: call the random access data plane function */
}
// Check if there is anything to schedule for paging/broadcast
if (mac_config->n_dl_broadcast > 0) {
/*TODO: call the broadcast/paging data plane function */
}
// Check if there is anything to schedule for the UEs
if (mac_config->n_dl_ue_data > 0) {
flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe,
mbsfn_flag,
mac_config->
n_dl_ue_data,
mac_config->dl_ue_data);
}
}
void
flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
uint32_t n_dl_ue_data,
Protocol__FlexDlData **
dl_ue_data)
{
uint8_t CC_id;
int UE_id;
mac_rlc_status_resp_t rlc_status;
unsigned char ta_len = 0;
unsigned char header_len = 0, header_len_tmp = 0;
unsigned char sdu_lcids[11], offset, num_sdus = 0;
uint16_t nb_rb;
uint16_t TBS, sdu_lengths[11], rnti, padding = 0, post_padding = 0;
unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
uint8_t round = 0;
uint8_t harq_pid = 0;
// LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
uint16_t sdu_length_total = 0;
short ta_update = 0;
eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id];
UE_list_t *UE_list = &eNB->UE_list;
// static int32_t tpc_accumulated=0;
UE_sched_ctrl *ue_sched_ctl;
int last_sdu_header_len = 0;
int i, j;
Protocol__FlexDlData *dl_data;
Protocol__FlexDlDci *dl_dci;
uint32_t rlc_size, n_lc, lcid;
// For each UE-related command
for (i = 0; i < n_dl_ue_data; i++) {
dl_data = dl_ue_data[i];
dl_dci = dl_data->dl_dci;
CC_id = dl_data->serv_cell_index;
// frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
rnti = dl_data->rnti;
UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
round = dl_dci->rv[0];
harq_pid = dl_dci->harq_process;
//LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] Scheduling harq %d\n", frame, subframe, harq_pid);
// LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d]Now scheduling harq_pid %d (round %d)\n", frame, subframe, harq_pid, round);
// If this is a new transmission
if (round == 0) {
// First we have to deal with the creation of the PDU based on the message instructions
rlc_status.bytes_in_buffer = 0;
TBS = dl_dci->tbs_size[0];
if (dl_data->n_ce_bitmap > 0) {
//Check if there is TA command and set the length appropriately
ta_len =
(dl_data->
ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2
: 0;
}
num_sdus = 0;
sdu_length_total = 0;
n_lc = dl_data->n_rlc_pdu;
// Go through each one of the channel commands and create SDUs
header_len = 0;
last_sdu_header_len = 0;
for (j = 0; j < n_lc; j++) {
sdu_lengths[j] = 0;
lcid =
dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->logical_channel_id;
rlc_size = dl_data->rlc_pdu[j]->rlc_pdu_tb[0]->size;
LOG_D(MAC,
"[TEST] [eNB %d] [Frame %d] [Subframe %d], LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
mod_id, frame, subframe, lcid, CC_id, rlc_size);
if (rlc_size > 0) {
rlc_status = mac_rlc_status_ind(mod_id,
rnti,
mod_id,
frame,
subframe,
ENB_FLAG_YES,
MBMS_FLAG_NO, lcid, 0);
if (rlc_status.bytes_in_buffer > 0) {
if (rlc_status.bytes_in_buffer < rlc_size) {
rlc_size = rlc_status.bytes_in_buffer;
}
if (rlc_size <= 2) {
rlc_size = 3;
}
rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, subframe, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, rlc_size); // transport block set size
LOG_D(MAC,
"[TEST] RLC can give %d bytes for LCID %d during second call\n",
rlc_status.bytes_in_buffer, lcid);
if (rlc_status.bytes_in_buffer > 0) {
sdu_lengths[j] = mac_rlc_data_req(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, rlc_size, //not used
(char *)
&dlsch_buffer
[sdu_length_total]);
LOG_D(MAC,
"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",
mod_id, lcid, CC_id, sdu_lengths[j]);
sdu_length_total += sdu_lengths[j];
sdu_lcids[j] = lcid;
UE_list->
eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]
+= 1;
UE_list->
eNB_UE_stats[CC_id][UE_id].num_bytes_tx
[lcid] += sdu_lengths[j];
if (sdu_lengths[j] < 128) {
header_len += 2;
last_sdu_header_len = 2;
} else {
header_len += 3;
last_sdu_header_len = 3;
}
num_sdus++;
}
}
}
} // SDU creation end
if (((sdu_length_total + header_len + ta_len) > 0)) {
header_len_tmp = header_len;
// If we have only a single SDU, header length becomes 1
if ((num_sdus) == 1) {
//if (header_len == 2 || header_len == 3) {
header_len = 1;
} else {
header_len = (header_len - last_sdu_header_len) + 1;
}
// If we need a 1 or 2 bit padding or no padding at all
if ((TBS - header_len - sdu_length_total - ta_len) <= 2 || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow
padding =
(TBS - header_len - sdu_length_total - ta_len);
post_padding = 0;
} else { // The last sdu needs to have a length field, since we add padding
padding = 0;
header_len = header_len_tmp;
post_padding = TBS - sdu_length_total - header_len - ta_len; // 1 is for the postpadding header
}
if (ta_len > 0) {
// Reset the measurement
ta_update = flexran_get_TA(mod_id, UE_id, CC_id);
ue_sched_ctl->ta_timer = 20;
eNB_UE_stats->timing_advance_update = 0;
} else {
ta_update = 0;
}
// If there is nothing to schedule, just leave
if ((sdu_length_total) <= 0) {
harq_pid_updated[UE_id][harq_pid] = 1;
harq_pid_round[UE_id][harq_pid] = 0;
continue;
}
// LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d] TBS is %d and bytes are %d\n", frame, subframe, TBS, sdu_length_total);
offset = generate_dlsch_header((unsigned char *) UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus
sdu_lengths, //
sdu_lcids, 255, // no drx
ta_update, // timing advance
NULL, // contention res id
padding, post_padding);
#ifdef DEBUG_eNB_SCHEDULER
LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
for (i = 0; i < 16; i++) {
LOG_T(MAC, "%x.", dlsch_buffer[i]);
}
LOG_T(MAC, "\n");
#endif
// cycle through SDUs and place in dlsch_buffer
memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].
payload[0][offset], dlsch_buffer, sdu_length_total);
// memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
// fill remainder of DLSCH with random data
for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset +
sdu_length_total
+ j] =
(char) (taus() & 0xff);
}
//eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff);
if (opt_enabled == 1) {
trace_pdu(1,
(uint8_t *)
UE_list->DLSCH_pdu[CC_id][0][UE_id].
payload[0], TBS, mod_id, 3, UE_RNTI(mod_id,
UE_id),
eNB->frame, eNB->subframe, 0, 0);
LOG_D(OPT,
"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
mod_id, CC_id, frame, UE_RNTI(mod_id, UE_id),
TBS);
}
// store stats
eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total;
eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi =
eNB_UE_stats->DL_cqi[0];
UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti;
UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status =
mac_eNB_get_rrc_status(mod_id, rnti);
UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
//nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
//Find the number of resource blocks and set them to the template for retransmissions
nb_rb = get_min_rb_unit(mod_id, CC_id);
uint16_t stats_tbs =
mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
while (stats_tbs < TBS) {
nb_rb += get_min_rb_unit(mod_id, CC_id);
stats_tbs =
mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb);
}
// LOG_I(FLEXRAN_AGENT, "The MCS was %d\n", dl_dci->mcs[0]);
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used +=
nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 =
dl_dci->mcs[0];
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 =
dl_dci->mcs[0];
UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes =
TBS - sdu_length_total;
UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes +=
sdu_length_total;
UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes += TBS;
UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus += 1;
//eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]];
//eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs);
} else {
LOG_D(FLEXRAN_AGENT,
"No need to schedule a dci after all. Just drop it\n");
harq_pid_updated[UE_id][harq_pid] = 1;
harq_pid_round[UE_id][harq_pid] = 0;
continue;
}
} else {
// No need to create anything apart of DCI in case of retransmission
/*TODO: Must add these */
// eNB_UE_stats->dlsch_trials[round]++;
//UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1;
//UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb;
//UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb;
//UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id];
}
// UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0];
// eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0];
//Fill the proper DCI of OAI
flexran_fill_oai_dci(mod_id, CC_id, rnti, dl_dci);
}
}
void
flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti,
Protocol__FlexDlDci * dl_dci)
{
void *DLSCH_dci = NULL;
DCI_PDU *DCI_pdu;
unsigned char harq_pid = 0;
// unsigned char round = 0;
LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
int size_bits = 0, size_bytes = 0;
eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id];
UE_list_t *UE_list = &eNB->UE_list;
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]);
uint32_t format;
harq_pid = dl_dci->harq_process;
// round = dl_dci->rv[0];
// Note this code is for a specific DCI format
DLSCH_dci =
(void *) UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid];
DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu;
frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id);
if (dl_dci->has_tpc == 1) {
// Check if tpc has been set and reset measurement */
if ((dl_dci->tpc == 0) || (dl_dci->tpc == 2)) {
eNB_UE_stats =
mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
eNB_UE_stats->Po_PUCCH_update = 0;
}
}
switch (frame_parms[CC_id]->N_RB_DL) {
case 6:
if (frame_parms[CC_id]->frame_type == TDD) {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_1_5MHz_TDD_t);
size_bits = sizeof_DCI1_1_5MHz_TDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
} else {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_1_5MHz_FDD_t);
size_bits = sizeof_DCI1_1_5MHz_FDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
}
break;
case 25:
if (frame_parms[CC_id]->frame_type == TDD) {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_5MHz_TDD_t);
size_bits = sizeof_DCI1_5MHz_TDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
} else {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_5MHz_FDD_t);
size_bits = sizeof_DCI1_5MHz_FDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
}
break;
case 50:
if (frame_parms[CC_id]->frame_type == TDD) {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_10MHz_TDD_t);
size_bits = sizeof_DCI1_10MHz_TDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
} else {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_10MHz_FDD_t);
size_bits = sizeof_DCI1_10MHz_FDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
}
break;
case 100:
if (frame_parms[CC_id]->frame_type == TDD) {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_20MHz_TDD_t);
size_bits = sizeof_DCI1_20MHz_TDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
} else {
if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) {
FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci);
size_bytes = sizeof(DCI1_20MHz_FDD_t);
size_bits = sizeof_DCI1_20MHz_FDD_t;
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) {
//TODO
} else if (dl_dci->format ==
PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) {
//TODO
}
}
break;
}
//Set format to the proper type
switch (dl_dci->format) {
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1:
format = format1;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1A:
format = format1A;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1B:
format = format1B;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1C:
format = format1C;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D:
format = format1E_2A_M10PRB;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2:
format = format2;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A:
format = format2A;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2B:
format = format2B;
break;
case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_3:
format = 3;
break;
default:
/*TODO: Need to deal with unsupported DCI type */
return;
}
add_ue_spec_dci(DCI_pdu,
DLSCH_dci,
rnti,
size_bytes, dl_dci->aggr_level, size_bits, format, 0);
}
File diff suppressed because it is too large Load Diff
@@ -1,202 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_scheduler_dlsch_ue_remote.c
* \brief procedures related to remote scheduling in the DLSCH transport channel
* \author Xenofon Foukas
* \date 2016
* \email: x.foukas@sms.ed.ac.uk
* \version 0.1
* @ingroup _mac
*/
#include "flexran_agent_common_internal.h"
#include "flexran_agent_scheduler_dlsch_ue_remote.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
struct DlMacConfigHead queue_head;
int queue_initialized = 0;
//uint32_t skip_subframe = 1;
//uint32_t period = 10;
//uint32_t sched [] = {1, 2, 3};
void
flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame,
uint32_t subframe, int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info)
{
//if ((subframe == skip_subframe) && (frame % period == 0)) {
// LOG_I(MAC, "Will skip subframe %d %d\n", subframe, frame);
// for (int i = 0; i < 3; i++) {
// LOG_I(MAC, "%d\n", sched[i]);
// }
//}
/* if (frame == 500 && subframe == 1) { */
/* char policy[] = "rrc: \n - ul_scheduler: \n behavior : tester_function\n parameters:\n period: !!int 3\nmac: \n - dl_scheduler: \n parameters: \n period : !!int 40\n skip_subframe : !!int 3\n sched : [!!int 4, !!int 5, !!int 6]"; */
/* apply_reconfiguration_policy(mod_id, policy, strlen(policy)); */
/* } */
eNB_MAC_INST *eNB;
if (!queue_initialized) {
TAILQ_INIT(&queue_head);
queue_initialized = 1;
}
eNB = &eNB_mac_inst[mod_id];
dl_mac_config_element_t *dl_config_elem;
int diff;
LOG_D(MAC, "[TEST] Current frame and subframe %d, %d\n", frame,
subframe);
// First we check to see if we have a scheduling decision for this sfn_sf already in our queue
while (queue_head.tqh_first != NULL) {
dl_config_elem = queue_head.tqh_first;
diff =
get_sf_difference(mod_id,
dl_config_elem->dl_info->
dl_mac_config_msg->sfn_sf);
// Check if this decision is for now, for a later or a previous subframe
if (diff == 0) { // Now
LOG_D(MAC,
"Found a decision for this subframe in the queue. Let's use it!\n");
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
*dl_info = dl_config_elem->dl_info;
free(dl_config_elem);
eNB->eNB_stats[mod_id].sched_decisions++;
return;
} else if (diff < 0) { //previous subframe , delete message and free memory
LOG_D(MAC,
"Found a decision for a previous subframe in the queue. Let's get rid of it\n");
TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs);
flexran_agent_mac_destroy_dl_config(dl_config_elem->dl_info);
free(dl_config_elem);
eNB->eNB_stats[mod_id].sched_decisions++;
eNB->eNB_stats[mod_id].missed_deadlines++;
} else { // next subframe, nothing to do now
LOG_D(MAC,
"Found a decision for a future subframe in the queue. Nothing to do now\n");
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
return;
}
}
//Done with the local cache. Now we need to check if something new arrived
flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
while (*dl_info != NULL) {
diff =
get_sf_difference(mod_id,
(*dl_info)->dl_mac_config_msg->sfn_sf);
if (diff == 0) { // Got a command for this sfn_sf
LOG_D(MAC,
"Found a decision for this subframe pending. Let's use it\n");
eNB->eNB_stats[mod_id].sched_decisions++;
return;
} else if (diff < 0) {
LOG_D(MAC,
"Found a decision for a previous subframe. Let's get rid of it\n");
flexran_agent_mac_destroy_dl_config(*dl_info);
*dl_info = NULL;
flexran_agent_get_pending_dl_mac_config(mod_id, dl_info);
eNB->eNB_stats[mod_id].sched_decisions++;
eNB->eNB_stats[mod_id].missed_deadlines++;
} else { // Intended for future subframe. Store it in local cache
LOG_D(MAC,
"Found a decision for a future subframe in the queue. Let's store it in the cache\n");
dl_mac_config_element_t *e =
malloc(sizeof(dl_mac_config_element_t));
e->dl_info = *dl_info;
TAILQ_INSERT_TAIL(&queue_head, e, configs);
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
// No need to look for another. Messages arrive ordered
return;
}
}
// We found no pending command, so we will simply pass an empty one
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
}
int get_sf_difference(mid_t mod_id, uint32_t sfn_sf)
{
int diff_in_subframes;
uint16_t current_frame = flexran_get_current_system_frame_num(mod_id);
uint16_t current_subframe = flexran_get_current_subframe(mod_id);
uint32_t current_sfn_sf = flexran_get_sfn_sf(mod_id);
if (sfn_sf == current_sfn_sf) {
return 0;
}
uint16_t frame_mask = ((1 << 12) - 1);
uint16_t frame = (sfn_sf & (frame_mask << 4)) >> 4;
uint16_t sf_mask = ((1 << 4) - 1);
uint16_t subframe = (sfn_sf & sf_mask);
LOG_D(MAC, "[TEST] Target frame and subframe %d, %d\n", frame,
subframe);
if (frame == current_frame) {
return subframe - current_subframe;
} else if (frame > current_frame) {
diff_in_subframes =
((frame * 10) + subframe) - ((current_frame * 10) +
current_subframe);
// diff_in_subframes = 9 - current_subframe;
//diff_in_subframes += (subframe + 1);
//diff_in_subframes += (frame-2) * 10;
if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
return -1;
} else {
return 1;
}
} else { //frame < current_frame
//diff_in_subframes = 9 - current_subframe;
//diff_in_subframes += (subframe + 1);
//if (frame > 0) {
// diff_in_subframes += (frame - 1) * 10;
//}
//diff_in_subframes += (1023 - current_frame) * 10;
diff_in_subframes =
10240 - ((current_frame * 10) + current_subframe) +
((frame * 10) + subframe);
if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) {
return -1;
} else {
return 1;
}
}
}
@@ -1,70 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_agent_scheduler_dlsch_ue_remote.h
* \brief Local stub for remote scheduler used by the controller
* \author Xenofon Foukas
* \date 2016
* \email: x.foukas@sms.ed.ac.uk
* \version 0.1
* @ingroup _mac
*/
#ifndef __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__
#define __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___
#include "flexran.pb-c.h"
#include "header.pb-c.h"
#include "ENB_APP/flexran_agent_defs.h"
#include "flexran_agent_mac.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
#include <sys/queue.h>
// Maximum value of schedule ahead of time
// Required to identify if a dl_command is for the future or not
#define SCHED_AHEAD_SUBFRAMES 20
typedef struct dl_mac_config_element_s {
Protocol__FlexranMessage *dl_info;
TAILQ_ENTRY(dl_mac_config_element_s) configs;
} dl_mac_config_element_t;
TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s);
/*
* Default scheduler used by the eNB agent
*/
void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame,
uint32_t subframe, int *mbsfn_flag,
Protocol__FlexranMessage ** dl_info);
// Find the difference in subframes from the given subframe
// negative for older value
// 0 for equal
// positive for future value
// Based on
int get_sf_difference(mid_t mod_id, uint32_t sfn_sf);
#endif
@@ -1,51 +0,0 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file flexran_dci_conversions.h
* \brief Conversion helpers from flexran messages to OAI formats DCI
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef LAYER2_MAC_FLEXRAN_DCI_CONVERISIONS_H__
#define LAYER2_MAC_DCI_FLEXRAN_CONVERISIONS_H__
#define FILL_DCI_FDD_1(TYPE, DCI, FLEXRAN_DCI) \
((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
#define FILL_DCI_TDD_1(TYPE, DCI, FLEXRAN_DCI) \
((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \
((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \
((TYPE*)DCI)->dai = FLEXRAN_DCI->dai; \
((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \
((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \
((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \
((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \
((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0];
#endif
File diff suppressed because it is too large Load Diff
+33 -4
View File
@@ -35,6 +35,22 @@
* @{ * @{
*/ */
/**
* slice specific scheduler
*/
typedef void (*slice_scheduler_dl)(module_id_t mod_id,
slice_id_t slice_id,
frame_t frame,
sub_frame_t subframe,
int *mbsfn_flag);
typedef void (*slice_scheduler_ul)(module_id_t mod_id,
slice_id_t slice_id,
frame_t frame,
sub_frame_t subframe,
unsigned char sched_subframe,
uint16_t *first_rb);
/** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe); /** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1. \brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1.
@param Mod_id Instance ID of eNB @param Mod_id Instance ID of eNB
@@ -102,11 +118,12 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,
/** \brief ULSCH Scheduling per RNTI /** \brief ULSCH Scheduling per RNTI
@param Mod_id Instance ID of eNB @param Mod_id Instance ID of eNB
@param slice_id Instance slice for this eNB
@param frame Frame index @param frame Frame index
@param subframe Subframe number on which to act @param subframe Subframe number on which to act
@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup) @param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup)
*/ */
void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP,
sub_frame_t subframe, sub_frame_t subframe,
unsigned char sched_subframe, unsigned char sched_subframe,
uint16_t * first_rb); uint16_t * first_rb);
@@ -127,9 +144,12 @@ void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP,
@param mbsfn_flag Indicates that MCH/MCCH is in this subframe @param mbsfn_flag Indicates that MCH/MCCH is in this subframe
*/ */
void schedule_ue_spec(module_id_t module_idP, frame_t frameP, void schedule_dlsch(module_id_t module_idP, frame_t frameP,
sub_frame_t subframe, int *mbsfn_flag); sub_frame_t subframe, int *mbsfn_flag);
void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP,
frame_t frameP,sub_frame_t subframe, int *mbsfn_flag);
/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure.
@param Mod_id Module id of UE @param Mod_id Module id of UE
@@ -192,6 +212,8 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id,
uint16_t uint16_t
nb_rbs_required_remaining nb_rbs_required_remaining
[MAX_NUM_CCs][NUMBER_OF_UE_MAX], [MAX_NUM_CCs][NUMBER_OF_UE_MAX],
unsigned char total_ue_count[MAX_NUM_CCs],
unsigned char total_rbs_used[MAX_NUM_CCs],
unsigned char unsigned char
rballoc_sub[MAX_NUM_CCs] rballoc_sub[MAX_NUM_CCs]
[N_RBG_MAX], [N_RBG_MAX],
@@ -209,6 +231,7 @@ void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id,
void dlsch_scheduler_pre_processor(module_id_t module_idP, void dlsch_scheduler_pre_processor(module_id_t module_idP,
slice_id_t slice_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframe, sub_frame_t subframe,
int N_RBG[MAX_NUM_CCs], int N_RBG[MAX_NUM_CCs],
@@ -641,17 +664,18 @@ int UE_PCCID(module_id_t mod_idP, int ue_idP);
rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP); rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP);
void ulsch_scheduler_pre_processor(module_id_t module_idP, int frameP, void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP,
sub_frame_t subframeP, sub_frame_t subframeP,
uint16_t * first_rb); uint16_t * first_rb);
void store_ulsch_buffer(module_id_t module_idP, int frameP, void store_ulsch_buffer(module_id_t module_idP, int frameP,
sub_frame_t subframeP); sub_frame_t subframeP);
void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP); void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP);
void assign_max_mcs_min_rb(module_id_t module_idP, int frameP, void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP,
sub_frame_t subframeP, uint16_t * first_rb); sub_frame_t subframeP, uint16_t * first_rb);
void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, void adjust_bsr_info(int buffer_occupancy, uint16_t TBS,
UE_TEMPLATE * UE_template); UE_TEMPLATE * UE_template);
int phy_stats_exist(module_id_t Mod_id, int rnti); int phy_stats_exist(module_id_t Mod_id, int rnti);
void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP);
/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index) /*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index)
\brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures. \brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
@@ -1165,5 +1189,10 @@ int32_t get_uldl_offset(int eutra_bandP);
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
uint8_t HO_active); uint8_t HO_active);
/*Slice related functions */
uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs);
int ue_slice_membership(int UE_id, int slice_id);
#endif #endif
/** @}*/ /** @}*/
+202 -48
View File
@@ -99,6 +99,8 @@ boolean_t pdcp_data_req(
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 : 0;
uint16_t pdcp_uid=0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_IN);
CHECK_CTXT_ARGS(ctxt_pP); CHECK_CTXT_ARGS(ctxt_pP);
@@ -144,7 +146,7 @@ boolean_t pdcp_data_req(
ctxt_pP->configured=TRUE; ctxt_pP->configured=TRUE;
} }
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
} else { } else {
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req); start_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -215,7 +217,7 @@ boolean_t pdcp_data_req(
LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n", LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p)); PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
} else { } else {
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -233,8 +235,9 @@ boolean_t pdcp_data_req(
if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) { if (pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer((unsigned char*)pdcp_pdu_p->data, &pdu_header) == FALSE) {
LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n", LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" Cannot fill PDU buffer with relevant header fields!\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p)); PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p));
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
} else { } else {
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -256,7 +259,7 @@ boolean_t pdcp_data_req(
free_mem_block(pdcp_pdu_p, __func__); free_mem_block(pdcp_pdu_p, __func__);
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
} else { } else {
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -284,7 +287,7 @@ boolean_t pdcp_data_req(
(((pdcp_p->cipheringAlgorithm) != 0) || (((pdcp_p->cipheringAlgorithm) != 0) ||
((pdcp_p->integrityProtAlgorithm) != 0))) { ((pdcp_p->integrityProtAlgorithm) != 0))) {
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security); start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security);
} else { } else {
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].apply_security); start_meas(&UE_pdcp_stats[ctxt_pP->module_id].apply_security);
@@ -379,7 +382,7 @@ boolean_t pdcp_data_req(
break; break;
} }
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
} else { } else {
stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
@@ -389,16 +392,23 @@ boolean_t pdcp_data_req(
* Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK * Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK
* so we return TRUE afterwards * so we return TRUE afterwards
*/ */
/*
if (rb_id>=DTCH) { for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
if (ctxt_pP->enb_flag == 1) { if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti )
Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++; break;
Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size; }
} else {
Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++; //LOG_I(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, rb_idP+rb_offset, current_sn);
Pdcp_stats_tx_bytes[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH] += sdu_buffer_size; Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
} Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
}*/ Pdcp_stats_tx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP;
Pdcp_stats_tx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=current_sn;
Pdcp_stats_tx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
Pdcp_stats_tx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_REQ,VCD_FUNCTION_OUT);
return ret; return ret;
@@ -428,6 +438,9 @@ pdcp_data_ind(
boolean_t packet_forwarded = FALSE; boolean_t packet_forwarded = FALSE;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
uint8_t rb_offset= (srb_flagP == 0) ? DTCH -1 :0;
uint16_t pdcp_uid=0;
uint8_t oo_flag=0;
#if defined(LINK_ENB_PDCP_TO_GTPV1U) #if defined(LINK_ENB_PDCP_TO_GTPV1U)
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
uint8_t *gtpu_buffer_p = NULL; uint8_t *gtpu_buffer_p = NULL;
@@ -577,6 +590,7 @@ pdcp_data_ind(
else else
LOG_D(PDCP, "Passing piggybacked SDU to RRC ...\n");*/ LOG_D(PDCP, "Passing piggybacked SDU to RRC ...\n");*/
} else { } else {
oo_flag=1;
LOG_W(PDCP, LOG_W(PDCP,
PROTOCOL_PDCP_CTXT_FMT"Incoming PDU has an unexpected sequence number (%d), RX window synchronisation have probably been lost!\n", PROTOCOL_PDCP_CTXT_FMT"Incoming PDU has an unexpected sequence number (%d), RX window synchronisation have probably been lost!\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
@@ -634,6 +648,7 @@ pdcp_data_ind(
rb_id, rb_id,
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len, sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]); (uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
free_mem_block(sdu_buffer_pP, __func__);
// free_mem_block(new_sdu, __func__); // free_mem_block(new_sdu, __func__);
@@ -729,9 +744,9 @@ pdcp_data_ind(
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti;
GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4;
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
packet_forwarded = TRUE; packet_forwarded = TRUE;
} }
#else #else
packet_forwarded = FALSE; packet_forwarded = FALSE;
#endif #endif
@@ -776,28 +791,44 @@ pdcp_data_ind(
sdu_buffer_sizeP - payload_offset); sdu_buffer_sizeP - payload_offset);
list_add_tail_eurecom (new_sdu_p, sdu_list_p); list_add_tail_eurecom (new_sdu_p, sdu_list_p);
/* Print octets of incoming data in hexadecimal form */
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
sdu_buffer_sizeP - payload_offset);
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
/*
* Update PDCP statistics
* XXX Following two actions are identical, is there a merge error?
*/
/*if (ctxt_pP->enb_flag == 1) {
Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
} else {
Pdcp_stats_rx[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH]++;
Pdcp_stats_rx_bytes[module_id][(rb_idP & RAB_OFFSET2) >> RAB_SHIFT2][(rb_idP & RAB_OFFSET) - DTCH] += sdu_buffer_sizeP;
}*/
} }
} }
/* Print octets of incoming data in hexadecimal form */
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
sdu_buffer_sizeP - payload_offset);
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
//util_flush_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
/*
* Update PDCP statistics
* XXX Following two actions are identical, is there a merge error?
*/
for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
if (pdcp_enb[ctxt_pP->module_id].rnti[pdcp_uid] == ctxt_pP->rnti ){
break;
}
}
Pdcp_stats_rx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_rx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(sdu_buffer_sizeP - payload_offset);
Pdcp_stats_rx_sn[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=sequence_number;
if (oo_flag == 1 )
Pdcp_stats_rx_outoforder[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++;
Pdcp_stats_rx_aiat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+= (pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=(pdcp_enb[ctxt_pP->module_id].sfn - Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]);
Pdcp_stats_rx_iat[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]=pdcp_enb[ctxt_pP->module_id].sfn;
#if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD)
else { else {
AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n", AssertFatal(0, PROTOCOL_PDCP_CTXT_FMT" PDCP_DATA_IND SDU DROPPED, OUT OF MEMORY \n",
@@ -818,6 +849,53 @@ pdcp_data_ind(
return TRUE; return TRUE;
} }
void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){
uint8_t pdcp_uid = 0;
uint8_t rb_id = 0;
// these stats are measured for both eNB and UE on per seond basis
for (rb_id =0; rb_id < NB_RB_MAX; rb_id ++){
for (pdcp_uid=0; pdcp_uid< NUMBER_OF_UE_MAX;pdcp_uid++){
//printf("frame %d and subframe %d \n", pdcp_enb[ctxt_pP->module_id].frame, pdcp_enb[ctxt_pP->module_id].subframe);
// tx stats
if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_tx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
// unit: bit/s
Pdcp_stats_tx_throughput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
Pdcp_stats_tx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
Pdcp_stats_tx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
if (Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=(Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
}else {
Pdcp_stats_tx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
}
// reset the tmp vars
Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
Pdcp_stats_tx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
Pdcp_stats_tx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
}
if (pdcp_enb[ctxt_pP->module_id].sfn % Pdcp_stats_rx_window_ms[ctxt_pP->module_id][pdcp_uid] == 0){
// rx stats
Pdcp_stats_rx_goodput_w[ctxt_pP->module_id][pdcp_uid][rb_id]=Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]*8;
Pdcp_stats_rx_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
Pdcp_stats_rx_bytes_w[ctxt_pP->module_id][pdcp_uid][rb_id]= Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id];
if(Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id] > 0){
Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]= (Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]/Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]);
} else {
Pdcp_stats_rx_aiat_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
}
// reset the tmp vars
Pdcp_stats_rx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
Pdcp_stats_rx_bytes_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
Pdcp_stats_rx_aiat_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_id]=0;
}
}
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
pdcp_run ( pdcp_run (
@@ -825,6 +903,7 @@ pdcp_run (
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
MessageDef *msg_p; MessageDef *msg_p;
const char *msg_name; const char *msg_name;
@@ -833,12 +912,18 @@ pdcp_run (
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
#endif #endif
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run); start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].pdcp_run);
} else { } else {
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_run); start_meas(&UE_pdcp_stats[ctxt_pP->module_id].pdcp_run);
} }
pdcp_enb[ctxt_pP->module_id].sfn++; // range: 0 to 18,446,744,073,709,551,615
pdcp_enb[ctxt_pP->module_id].frame=ctxt_pP->frame; // 1023
pdcp_enb[ctxt_pP->module_id].subframe= ctxt_pP->subframe;
pdcp_update_stats(ctxt_pP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
@@ -971,6 +1056,28 @@ pdcp_run (
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT);
} }
void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP){
int i, ue_flag=1; //, ret=-1; to be decied later
for (i=0; i < NUMBER_OF_UE_MAX; i++){
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti) {
ue_flag=-1;
break;
}
}
if (ue_flag == 1 ){
for (i=0; i < NUMBER_OF_UE_MAX ; i++){
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == 0 ){
pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti;
pdcp_enb[ctxt_pP->module_id].uid[i]=i;
pdcp_enb[ctxt_pP->module_id].num_ues++;
printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti);
// ret=1;
break;
}
}
}
//return ret;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
boolean_t boolean_t
@@ -983,8 +1090,8 @@ pdcp_remove_UE(
DRB_Identity_t drb_id = 0; DRB_Identity_t drb_id = 0;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc; hashtable_rc_t h_rc;
int i;
// check and remove SRBs first // check and remove SRBs first
for(int i = 0;i<NUMBER_OF_UE_MAX;i++){ for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){ if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){
@@ -993,7 +1100,7 @@ pdcp_remove_UE(
} }
} }
for (srb_id=0; srb_id<2; srb_id++) { for (srb_id=1; srb_id<3; srb_id++) {
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES);
h_rc = hashtable_remove(pdcp_coll_p, key); h_rc = hashtable_remove(pdcp_coll_p, key);
} }
@@ -1006,6 +1113,19 @@ pdcp_remove_UE(
(void)h_rc; /* remove gcc warning "set but not used" */ (void)h_rc; /* remove gcc warning "set but not used" */
// remove ue for pdcp enb inst
for (i=0; i < NUMBER_OF_UE_MAX; i++) {
if (pdcp_enb[ctxt_pP->module_id].rnti[i] == ctxt_pP->rnti ) {
LOG_I(PDCP, "remove uid is %d/%d %x\n", i,
pdcp_enb[ctxt_pP->module_id].uid[i],
pdcp_enb[ctxt_pP->module_id].rnti[i]);
pdcp_enb[ctxt_pP->module_id].uid[i]=0;
pdcp_enb[ctxt_pP->module_id].rnti[i]=0;
pdcp_enb[ctxt_pP->module_id].num_ues--;
break;
}
}
return 1; return 1;
} }
@@ -1090,7 +1210,7 @@ rrc_pdcp_config_asn1_req (
return TRUE; return TRUE;
} else { } else {
LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n", LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD key 0x%"PRIx64"\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
key); key);
} }
@@ -1400,7 +1520,6 @@ rrc_pdcp_config_asn1_req (
return 0; return 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
boolean_t boolean_t
pdcp_config_req_asn1 ( pdcp_config_req_asn1 (
@@ -1421,12 +1540,14 @@ pdcp_config_req_asn1 (
uint8_t *const kUPenc_pP) uint8_t *const kUPenc_pP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
switch (actionP) { switch (actionP) {
case CONFIG_ACTION_ADD: case CONFIG_ACTION_ADD:
DevAssert(pdcp_pP != NULL); DevAssert(pdcp_pP != NULL);
if (ctxt_pP->enb_flag == ENB_FLAG_YES) { if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
pdcp_pP->is_ue = FALSE; pdcp_pP->is_ue = FALSE;
pdcp_add_UE(ctxt_pP);
//pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti; //pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti;
// pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti; // pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
if( srb_flagP == SRB_FLAG_NO ) { if( srb_flagP == SRB_FLAG_NO ) {
@@ -1536,6 +1657,10 @@ pdcp_config_req_asn1 (
lc_idP, lc_idP,
rb_idP); rb_idP);
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
// pdcp_remove_UE(ctxt_pP);
}
/* Security keys */ /* Security keys */
if (pdcp_pP->kUPenc != NULL) { if (pdcp_pP->kUPenc != NULL) {
free(pdcp_pP->kUPenc); free(pdcp_pP->kUPenc);
@@ -1787,13 +1912,14 @@ rrc_pdcp_config_req (
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// TODO PDCP module initialization code might be removed
int int
pdcp_module_init ( pdcp_module_init (
void void
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
#ifdef PDCP_USE_RT_FIFO #ifdef PDCP_USE_RT_FIFO
int ret; int ret;
@@ -1869,6 +1995,7 @@ void pdcp_layer_init(void)
{ {
module_id_t instance; module_id_t instance;
int i,j;
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
mbms_session_id_t session_id; mbms_session_id_t session_id;
mbms_service_id_t service_id; mbms_service_id_t service_id;
@@ -1912,15 +2039,42 @@ void pdcp_layer_init(void)
pdcp_output_header_bytes_to_write=0; pdcp_output_header_bytes_to_write=0;
pdcp_input_sdu_remaining_size_to_read=0; pdcp_input_sdu_remaining_size_to_read=0;
memset(pdcp_enb, 0, sizeof(pdcp_enb_t));
memset(Pdcp_stats_tx_window_ms, 0, sizeof(Pdcp_stats_tx_window_ms));
memset(Pdcp_stats_rx_window_ms, 0, sizeof(Pdcp_stats_rx_window_ms));
for (i =0; i< MAX_NUM_CCs ; i ++){
for (j=0; j< NUMBER_OF_UE_MAX;j++){
Pdcp_stats_tx_window_ms[i][j]=100;
Pdcp_stats_rx_window_ms[i][j]=100;
}
}
memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx)); memset(Pdcp_stats_tx, 0, sizeof(Pdcp_stats_tx));
memset(Pdcp_stats_tx_w, 0, sizeof(Pdcp_stats_tx_w));
memset(Pdcp_stats_tx_tmp_w, 0, sizeof(Pdcp_stats_tx_tmp_w));
memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes)); memset(Pdcp_stats_tx_bytes, 0, sizeof(Pdcp_stats_tx_bytes));
memset(Pdcp_stats_tx_bytes_last, 0, sizeof(Pdcp_stats_tx_bytes_last)); memset(Pdcp_stats_tx_bytes_w, 0, sizeof(Pdcp_stats_tx_bytes_w));
memset(Pdcp_stats_tx_rate, 0, sizeof(Pdcp_stats_tx_rate)); memset(Pdcp_stats_tx_bytes_tmp_w, 0, sizeof(Pdcp_stats_tx_bytes_tmp_w));
memset(Pdcp_stats_tx_sn, 0, sizeof(Pdcp_stats_tx_sn));
memset(Pdcp_stats_tx_throughput_w, 0, sizeof(Pdcp_stats_tx_throughput_w));
memset(Pdcp_stats_tx_aiat, 0, sizeof(Pdcp_stats_tx_aiat));
memset(Pdcp_stats_tx_iat, 0, sizeof(Pdcp_stats_tx_iat));
memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx)); memset(Pdcp_stats_rx, 0, sizeof(Pdcp_stats_rx));
memset(Pdcp_stats_rx_w, 0, sizeof(Pdcp_stats_rx_w));
memset(Pdcp_stats_rx_tmp_w, 0, sizeof(Pdcp_stats_rx_tmp_w));
memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes)); memset(Pdcp_stats_rx_bytes, 0, sizeof(Pdcp_stats_rx_bytes));
memset(Pdcp_stats_rx_bytes_last, 0, sizeof(Pdcp_stats_rx_bytes_last)); memset(Pdcp_stats_rx_bytes_w, 0, sizeof(Pdcp_stats_rx_bytes_w));
memset(Pdcp_stats_rx_rate, 0, sizeof(Pdcp_stats_rx_rate)); memset(Pdcp_stats_rx_bytes_tmp_w, 0, sizeof(Pdcp_stats_rx_bytes_tmp_w));
memset(Pdcp_stats_rx_sn, 0, sizeof(Pdcp_stats_rx_sn));
memset(Pdcp_stats_rx_goodput_w, 0, sizeof(Pdcp_stats_rx_goodput_w));
memset(Pdcp_stats_rx_aiat, 0, sizeof(Pdcp_stats_rx_aiat));
memset(Pdcp_stats_rx_iat, 0, sizeof(Pdcp_stats_rx_iat));
memset(Pdcp_stats_rx_outoforder, 0, sizeof(Pdcp_stats_rx_outoforder));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+56 -11
View File
@@ -94,15 +94,54 @@ extern int pdcp_instance_cnt;
int init_pdcp_thread(void); int init_pdcp_thread(void);
void cleanup_pdcp_thread(void); void cleanup_pdcp_thread(void);
public_pdcp(uint32_t Pdcp_stats_tx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_throughput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_tx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_tx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_window_ms[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
public_pdcp(unsigned int Pdcp_stats_tx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_tx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_tx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_rx[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_bytes[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_rx_bytes[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_bytes_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_rx_bytes_last[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(unsigned int Pdcp_stats_rx_rate[NB_MODULES_MAX][NB_CNX_CH][NB_RAB_MAX]); public_pdcp(uint32_t Pdcp_stats_rx_sn[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_goodput_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_iat[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(uint32_t Pdcp_stats_rx_outoforder[MAX_NUM_CCs][NUMBER_OF_UE_MAX][NB_RB_MAX]);
public_pdcp(void pdcp_update_perioidical_stats(const protocol_ctxt_t* const ctxt_pP));
/*Packet Probing for agent PDCP*/
//public_pdcp(uint64_t *pdcp_packet_counter);
//public_pdcp(uint64_t *pdcp_size_packet);
typedef struct pdcp_enb_s {
// used for eNB stats generation
uint16_t uid[NUMBER_OF_UE_MAX];
rnti_t rnti[NUMBER_OF_UE_MAX];
uint16_t num_ues;
uint64_t sfn;
frame_t frame;
sub_frame_t subframe;
} pdcp_enb_t;
public_pdcp(pdcp_enb_t pdcp_enb[MAX_NUM_CCs]);
typedef struct pdcp_stats_s { typedef struct pdcp_stats_s {
time_stats_t pdcp_run; time_stats_t pdcp_run;
@@ -125,7 +164,7 @@ typedef struct pdcp_s {
boolean_t is_ue; boolean_t is_ue;
boolean_t is_srb; boolean_t is_srb;
/* Configured security algorithms */ /* Configured security algorithms */
uint8_t cipheringAlgorithm; uint8_t cipheringAlgorithm;
uint8_t integrityProtAlgorithm; uint8_t integrityProtAlgorithm;
@@ -327,9 +366,15 @@ public_pdcp(boolean_t pdcp_config_req_asn1 (
uint8_t *const kRRCint, uint8_t *const kRRCint,
uint8_t *const kUPenc)); uint8_t *const kUPenc));
/*! \fn void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function (for RRC) to add a new UE in PDCP module
* \param[in] ctxt_pP Running context.
* \return A status about the processing, OK or error code.
*/
public_pdcp(void pdcp_add_UE(const protocol_ctxt_t* const ctxt_pP));
/*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP) /*! \fn boolean_t pdcp_remove_UE(const protocol_ctxt_t* const ctxt_pP)
* \brief Function for RRC to configure a Radio Bearer clear all PDCP resources for a particular UE * \brief Function for RRC to remove UE from PDCP module hashtable
* \param[in] ctxt_pP Running context. * \param[in] ctxt_pP Running context.
* \return A status about the processing, OK or error code. * \return A status about the processing, OK or error code.
*/ */
+3 -1
View File
@@ -228,7 +228,9 @@ int dump_eNB_l2_stats(char *buffer, int length)
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
eNB_id, eNB_id,
ENB_FLAG_YES, ENB_FLAG_YES,
UE_list->eNB_UE_stats[0][UE_id].crnti,//UE_PCCID(eNB_id,UE_id)][UE_id].crnti, /* the following is suspicious, let's put back what was there before */
/*UE_list->eNB_UE_stats[0][UE_id].crnti,//UE_PCCID(eNB_id,UE_id)][UE_id].crnti, */
UE_list->eNB_UE_stats[UE_PCCID(eNB_id,UE_id)][UE_id].crnti,
eNB->frame, eNB->frame,
eNB->subframe, eNB->subframe,
eNB_id); eNB_id);
+7
View File
@@ -53,6 +53,8 @@ extern UE_MAC_INST *UE_mac_inst;
# include "intertask_interface.h" # include "intertask_interface.h"
#endif #endif
#include "flexran_agent_extern.h"
//#define RRC_DATA_REQ_DEBUG //#define RRC_DATA_REQ_DEBUG
//#define DEBUG_RRC 1 //#define DEBUG_RRC 1
@@ -466,6 +468,11 @@ void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
else { else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); 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); // rrc_mac_remove_ue(Mod_instP,rntiP);
} }
+7
View File
@@ -65,6 +65,9 @@
#include "UE-EUTRA-Capability.h" #include "UE-EUTRA-Capability.h"
#include "MeasResults.h" #include "MeasResults.h"
/* for ImsiMobileIdentity_t */
#include "MobileIdentity.h"
/* correct Rel(8|10)/Rel14 differences /* correct Rel(8|10)/Rel14 differences
* the code is in favor of Rel14, those defines do the translation * the code is in favor of Rel14, those defines do the translation
*/ */
@@ -391,6 +394,10 @@ typedef struct eNB_RRC_UE_s {
SRB_INFO_TABLE_ENTRY Srb2; SRB_INFO_TABLE_ENTRY Srb2;
MeasConfig_t* measConfig; MeasConfig_t* measConfig;
HANDOVER_INFO* handover_info; HANDOVER_INFO* handover_info;
MeasResults_t* measResults;
UE_EUTRA_Capability_t* UE_Capability;
ImsiMobileIdentity_t imsi;
#if defined(ENABLE_SECURITY) #if defined(ENABLE_SECURITY)
/* KeNB as derived from KASME received from EPC */ /* KeNB as derived from KASME received from EPC */
+2 -2
View File
@@ -74,8 +74,8 @@ extern uint16_t N310[8];
extern uint16_t N311[8]; extern uint16_t N311[8];
extern uint32_t T304[8]; extern uint32_t T304[8];
extern uint32_t timeToTrigger_ms[16]; extern uint32_t timeToTrigger_ms[16];
extern float RSRP_meas_mapping[100]; extern float RSRP_meas_mapping[98];
extern float RSRQ_meas_mapping[33]; extern float RSRQ_meas_mapping[35];
extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern pthread_mutex_t ue_pf_po_mutex; extern pthread_mutex_t ue_pf_po_mutex;
+12 -1
View File
@@ -33,6 +33,8 @@
#include "RRC/LITE/defs.h" #include "RRC/LITE/defs.h"
#include "flexran_agent_extern.h"
//main.c //main.c
int rrc_init_global_param(void); int rrc_init_global_param(void);
int L3_xface_init(void); int L3_xface_init(void);
@@ -269,6 +271,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(
const uint8_t ho_state const uint8_t ho_state
); );
void
flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
const uint8_t ho_state,
agent_reconf_rrc * trig_param
);
int freq_to_arfcn10(int band, unsigned long freq); int freq_to_arfcn10(int band, unsigned long freq);
void void
@@ -465,7 +476,7 @@ rrc_eNB_generate_SecurityModeCommand(
void void
rrc_eNB_process_MeasurementReport( rrc_eNB_process_MeasurementReport(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP, rrc_eNB_ue_context_t* ue_context_pP,
const MeasResults_t* const measResults2 const MeasResults_t* const measResults2
); );
+1
View File
@@ -4312,6 +4312,7 @@ void *rrc_ue_task( void *args_p )
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting RRC thread\n");
itti_exit_task (); itti_exit_task ();
break; break;
+726 -53
View File
@@ -95,9 +95,6 @@
#include "SIMULATION/TOOLS/defs.h" // for taus #include "SIMULATION/TOOLS/defs.h" // for taus
#if defined(FLEXRAN_AGENT_SB_IF)
#include "flexran_agent_extern.h"
#endif
//#define XER_PRINT //#define XER_PRINT
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
@@ -874,6 +871,11 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
} }
} }
if (rrc_agent_registered[enb_mod_idP]) {
agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP,
rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
for(j = 0; j < 10; j++){ for(j = 0; j < 10; j++){
ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
if(ul_req_tmp){ if(ul_req_tmp){
@@ -3098,7 +3100,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity;
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
if (ho_state == 1 /*HO_MEASURMENT */ ) { if (ho_state == 1 /*HO_MEASURMENT */ ) {
LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n",
ctxt_pP->module_id, ctxt_pP->frame); ctxt_pP->module_id, ctxt_pP->frame);
@@ -3357,6 +3359,595 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
PDCP_TRANSMISSION_MODE_CONTROL); PDCP_TRANSMISSION_MODE_CONTROL);
} }
//-----------------------------------------------------------------------------
void
flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
const uint8_t ho_state,
agent_reconf_rrc * trig_param
)
//-----------------------------------------------------------------------------
{
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size;
int i;
// configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id];
struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated;
struct SRB_ToAddMod *SRB2_config = NULL;
struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL;
struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL;
struct LogicalChannelConfig__ul_SpecificParameters
*SRB2_ul_SpecificParameters = NULL;
SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList;
SRB_ToAddModList_t **SRB_configList2 = NULL;
struct DRB_ToAddMod *DRB_config = NULL;
struct RLC_Config *DRB_rlc_config = NULL;
struct PDCP_Config *DRB_pdcp_config = NULL;
struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL;
struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
struct LogicalChannelConfig *DRB_lchan_config = NULL;
struct LogicalChannelConfig__ul_SpecificParameters
*DRB_ul_SpecificParameters = NULL;
DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList;
DRB_ToAddModList_t** DRB_configList2 = NULL;
MAC_MainConfig_t *mac_MainConfig = NULL;
MeasObjectToAddModList_t *MeasObj_list = NULL;
MeasObjectToAddMod_t *MeasObj = NULL;
ReportConfigToAddModList_t *ReportConfig_list = NULL;
ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1,
// *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5;
MeasIdToAddModList_t *MeasId_list = NULL;
MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5;
#if Rel10
long *sr_ProhibitTimer_r9 = NULL;
// uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1);
//uint8_t sCellIndexToAdd = 0;
#endif
long *logicalchannelgroup, *logicalchannelgroup_drb;
long *maxHARQ_Tx, *periodicBSR_Timer;
RSRP_Range_t *rsrp = NULL;
struct MeasConfig__speedStatePars *Sparams = NULL;
QuantityConfig_t *quantityConfig = NULL;
CellsToAddMod_t *CellToAdd = NULL;
CellsToAddModList_t *CellsToAddModList = NULL;
struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL;
DedicatedInfoNAS_t *dedicatedInfoNas = NULL;
/* for no gcc warnings */
(void)dedicatedInfoNas;
C_RNTI_t *cba_RNTI = NULL;
uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id,
#ifdef CBA
//struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola;
uint8_t *cba_RNTI_buf;
cba_RNTI = CALLOC(1, sizeof(C_RNTI_t));
cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t));
cba_RNTI->buf = cba_RNTI_buf;
cba_RNTI->size = 2;
cba_RNTI->bits_unused = 0;
// associate UEs to the CBa groups as a function of their UE id
if (rrc_inst->num_active_cba_groups) {
cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff;
cba_RNTI->buf[1] = 0xff;
LOG_D(RRC,
"[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n",
enb_mod_idP, frameP,
rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups],
ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP);
} else {
cba_RNTI->buf[0] = 0x0;
cba_RNTI->buf[1] = 0x0;
LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP);
}
#endif
T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
// Configure SRB2
/// SRB2
SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid];
if (*SRB_configList2) {
free(*SRB_configList2);
}
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
memset(*SRB_configList2, 0, sizeof(**SRB_configList2));
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2;
SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config));
SRB2_config->rlc_Config = SRB2_rlc_config;
SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am;
SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15;
SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8;
SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000;
SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32;
SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10;
SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config));
SRB2_config->logicalChannelConfig = SRB2_lchan_config;
SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters));
SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs
SRB2_ul_SpecificParameters->prioritisedBitRate =
LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
SRB2_ul_SpecificParameters->bucketSizeDuration =
LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for CCCH and DCCH is 0 as defined in 36331
logicalchannelgroup = CALLOC(1, sizeof(long));
*logicalchannelgroup = 0;
SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters;
// this list has the configuration for SRB1 and SRB2
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config);
// this list has only the configuration for SRB2
ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config);
// Configure DRB
//*DRB_configList = CALLOC(1, sizeof(*DRB_configList));
// list for all the configured DRB
if (*DRB_configList) {
free(*DRB_configList);
}
*DRB_configList = CALLOC(1, sizeof(**DRB_configList));
memset(*DRB_configList, 0, sizeof(**DRB_configList));
// list for the configured DRB for a this xid
DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
if (*DRB_configList2) {
free(*DRB_configList2);
}
*DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2));
memset(*DRB_configList2, 0, sizeof(**DRB_configList2));
/// DRB
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long));
*(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4
// DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32
// NN: this is the 1st DRB for this ue, so set it to 1
DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x
DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long));
*(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2
DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
DRB_config->rlc_Config = DRB_rlc_config;
#ifdef RRC_DEFAULT_RAB_IS_AM
DRB_rlc_config->present = RLC_Config_PR_am;
DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity;
DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8;
DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35;
DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25;
#else
DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
#ifdef CBA
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25;
#else
DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
#endif
#endif
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
DRB_config->pdcp_Config = DRB_pdcp_config;
DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
*DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
DRB_pdcp_config->rlc_AM = NULL;
DRB_pdcp_config->rlc_UM = NULL;
/* avoid gcc warnings */
(void)PDCP_rlc_AM;
(void)PDCP_rlc_UM;
#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT
PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
PDCP_rlc_AM->statusReportRequired = FALSE;
#else
PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
#endif
DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config));
DRB_config->logicalChannelConfig = DRB_lchan_config;
DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
//LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
DRB_ul_SpecificParameters->bucketSizeDuration =
LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
//ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList);
mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig));
// ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig;
mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config));
maxHARQ_Tx = CALLOC(1, sizeof(long));
*maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx;
periodicBSR_Timer = CALLOC(1, sizeof(long));
*periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64;
mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer;
mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320;
mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE
mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity;
mac_MainConfig->drx_Config = NULL;
mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config));
mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup;
mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes
mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes
mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB
#ifdef Rel10
sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long));
*sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR
mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1));
mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9;
//sps_RA_ConfigList_rlola = NULL;
#endif
//change the transmission mode for the primary component carrier
//TODO: add codebook subset restriction here
//TODO: change TM for secondary CC in SCelltoaddmodlist
if (*physicalConfigDedicated) {
if ((*physicalConfigDedicated)->antennaInfo) {
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) {
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
}
else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) {
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
}
else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) {
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
}
else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) {
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR));
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
(*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
}
}
else {
LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
}
if ((*physicalConfigDedicated)->cqi_ReportConfig) {
if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) ||
(rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) ||
(rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) {
//feedback mode needs to be set as well
//TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
printf("setting cqi reporting mode to rm31\n");
#if defined(Rel10) || defined(Rel14)
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31;
#else
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI
#endif
}
}
else {
LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n");
}
}
else {
LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n");
}
// Measurement ID list
MeasId_list = CALLOC(1, sizeof(*MeasId_list));
memset((void *)MeasId_list, 0, sizeof(*MeasId_list));
MeasId0 = CALLOC(1, sizeof(*MeasId0));
MeasId0->measId = 1;
MeasId0->measObjectId = 1;
MeasId0->reportConfigId = 1;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0);
/*
* Add one EUTRA Measurement Object
*/
MeasObj_list = CALLOC(1, sizeof(*MeasObj_list));
memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list));
// Configure MeasObject
MeasObj = CALLOC(1, sizeof(*MeasObj));
memset((void *)MeasObj, 0, sizeof(*MeasObj));
MeasObj->measObjectId = 1;
MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA;
MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz
//MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz
MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25;
MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t));
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1;
MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6;
MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB
MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList =
(CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList));
CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
// Add adjacent cell lists (6 per eNB)
for (i = 0; i < 6; i++) {
CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd));
CellToAdd->cellIndex = i + 1;
CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i);
CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0;
ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd);
}
ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj);
// rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
// Report Configurations for periodical, A1-A5 events
/* RRC Strategy Measurement */
if (strcmp("one_shot", trig_param->trigger_policy) == 0){
trig_param->report_interval = 0;
trig_param->report_amount = 0;
}
else if (strcmp("event_driven", trig_param->trigger_policy) == 0){
trig_param->report_interval = 6;
trig_param->report_amount = 2;
}
else if (strcmp("periodical", trig_param->trigger_policy) == 0){
trig_param->report_interval = 1;
trig_param->report_amount = 7;
}
else {
LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!");
}
ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list));
ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per));
// Periodical Measurement Report
ReportConfig_per->reportConfigId = 1;
ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present =
ReportConfigEUTRA__triggerType_PR_periodical;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose =
ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells;
// ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2;
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms
ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ...
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per);
quantityConfig = CALLOC(1, sizeof(*quantityConfig));
memset((void *)quantityConfig, 0, sizeof(*quantityConfig));
quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA));
memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA));
quantityConfig->quantityConfigCDMA2000 = NULL;
quantityConfig->quantityConfigGERAN = NULL;
quantityConfig->quantityConfigUTRA = NULL;
quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP =
CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)));
quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ =
CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4;
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4;
#if defined(ENABLE_ITTI)
/* Initialize NAS list */
dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
/* Add all NAS PDUs to the list */
for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(dedicatedInfoNas,
(char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer,
ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length);
ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
}
/* TODO parameters yet to process ... */
// {
// ue_context_pP->ue_context.e_rab[i].param.qos;
// ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
// ue_context_pP->ue_context.e_rab[i].param.gtp_teid;
// }
/* TODO should test if e RAB are Ok before! */
ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE;
LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n",
i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE");
}
/* If list is empty free the list and reset the address */
if (dedicatedInfoNASList->list.count == 0) {
free(dedicatedInfoNASList);
dedicatedInfoNASList = NULL;
}
#endif
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionReconfiguration(ctxt_pP,
buffer,
xid, //Transaction_id,
(SRB_ToAddModList_t*)NULL, // SRB_configList
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL, // DRB2_list,
(struct SPS_Config*)NULL, // *sps_Config,
(struct PhysicalConfigDedicated*)*physicalConfigDedicated,
// #ifdef EXMIMO_IOT
// NULL, NULL, NULL,NULL,
// #else
(MeasObjectToAddModList_t*)MeasObj_list,
(ReportConfigToAddModList_t*)ReportConfig_list,
(QuantityConfig_t*)quantityConfig,
(MeasIdToAddModList_t*)MeasId_list,
// #endif
(MAC_MainConfig_t*)mac_MainConfig,
(MeasGapConfig_t*)NULL,
(MobilityControlInfo_t*)NULL,
(struct MeasConfig__speedStatePars*)Sparams,
(RSRP_Range_t*)rsrp,
(C_RNTI_t*)cba_RNTI,
(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList
#if defined(Rel10) || defined(Rel14)
, (SCellToAddMod_r10_t*)NULL
#endif
);
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n");
for (i = 0; i < size; i++) {
LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
}
LOG_F(RRC,"\n");
////////////////////////////////////////
#endif
#if defined(ENABLE_ITTI)
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) {
/* Free the NAS PDU buffer and invalidate it */
free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer);
ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
}
}
#endif
LOG_I(RRC,
"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n",
ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
LOG_D(RRC,
"[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH);
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
buffer,
size,
MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
rrc_eNB_mui,
size);
rrc_data_req(
ctxt_pP,
DCCH,
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -3440,46 +4031,72 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
void void
rrc_eNB_process_MeasurementReport( rrc_eNB_process_MeasurementReport(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP, rrc_eNB_ue_context_t* ue_context_pP,
const MeasResults_t* const measResults2 const MeasResults_t* const measResults2
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
int i=0;
int neighboring_cells=-1;
T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
if (measResults2 == NULL )
return;
if (measResults2->measId > 0 ){
if (ue_context_pP->ue_context.measResults == NULL) {
ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t));
}
ue_context_pP->ue_context.measResults->measId=measResults2->measId;
ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult;
ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult;
LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140);
LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20);
}
if (measResults2->measResultNeighCells == NULL)
return;
LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n", if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId); neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count;
if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) {
ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells);
}
ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells;
for (i=0; i < neighboring_cells; i++){
memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i],
sizeof(MeasResultListEUTRA_t));
LOG_D(RRC, "Physical Cell Id %d\n",
(int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId);
LOG_D(RRC, "RSRP of Target %d\n",
(int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult));
LOG_D(RRC, "RSRQ of Target %d\n",
(int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult));
}
}
if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { // #if defined(Rel10) || defined(Rel14)
LOG_I(RRC, "Physical Cell Id %d\n",
(int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
LOG_I(RRC, "RSRP of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrpResult));
LOG_I(RRC, "RSRQ of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrqResult));
}
#if defined(Rel10) || defined(Rel14)
LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult); // #else
LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultPCell.rsrqResult); // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult);
#else // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult);
LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultServCell.rsrpResult); // #endif
LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultServCell.rsrqResult);
#endif
if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) {
rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, // rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP,
ue_context_pP, // ue_context_pP,
measResults2->measResultNeighCells->choice. // measResults2->measResultNeighCells->choice.
measResultListEUTRA.list.array[0]->physCellId); // measResultListEUTRA.list.array[0]->physCellId);
} else { // } else {
LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, // LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame,
ctxt_pP->rnti); // ctxt_pP->rnti);
} // }
//Look for IP address of the target eNB //Look for IP address of the target eNB
//Send Handover Request -> target eNB //Send Handover Request -> target eNB
@@ -5672,6 +6289,11 @@ rrc_eNB_decode_ccch(
} else { } else {
// no context available // no context available
if (rrc_agent_registered[ctxt_pP->module_id]) {
agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ctxt_pP->rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
random_value); random_value);
@@ -5778,7 +6400,6 @@ rrc_eNB_decode_dcch(
asn_dec_rval_t dec_rval; asn_dec_rval_t dec_rval;
//UL_DCCH_Message_t uldcchmsg; //UL_DCCH_Message_t uldcchmsg;
UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg;
UE_EUTRA_Capability_t *UE_EUTRA_Capability = NULL;
int i; int i;
struct rrc_eNB_ue_context_s* ue_context_p = NULL; struct rrc_eNB_ue_context_s* ue_context_p = NULL;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
@@ -5934,14 +6555,12 @@ rrc_eNB_decode_dcch(
ue_context_p, ue_context_p,
ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) { if (rrc_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti, ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
} }
#endif
} }
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
@@ -6076,14 +6695,12 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier,
&ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8);
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) { if (mac_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti, ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
} }
#endif
} }
//ue_context_p->ue_context.ue_release_timer = 0; //ue_context_p->ue_context.ue_release_timer = 0;
ue_context_p->ue_context.ue_reestablishment_timer = 1; ue_context_p->ue_context.ue_reestablishment_timer = 1;
@@ -6133,14 +6750,12 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) { if (rrc_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti, ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
} }
#endif
} }
} }
@@ -6270,18 +6885,33 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg);
#endif #endif
LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
if (ue_context_p->ue_context.UE_Capability) {
LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti);
asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
ue_context_p->ue_context.UE_Capability, 0);
ue_context_p->ue_context.UE_Capability = 0;
}
dec_rval = uper_decode(NULL, dec_rval = uper_decode(NULL,
&asn_DEF_UE_EUTRA_Capability, &asn_DEF_UE_EUTRA_Capability,
(void **)&UE_EUTRA_Capability, (void **)&ue_context_p->ue_context.UE_Capability,
ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.buf, array[0]->ueCapabilityRAT_Container.buf,
ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.size, 0, 0); array[0]->ueCapabilityRAT_Container.size, 0, 0);
//#ifdef XER_PRINT #ifdef XER_PRINT
//xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability); xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
//#endif #endif
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
dec_rval.consumed);
asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability,
ue_context_p->ue_context.UE_Capability, 0);
ue_context_p->ue_context.UE_Capability = 0;
}
#if defined(ENABLE_USE_MME) #if defined(ENABLE_USE_MME)
@@ -6469,6 +7099,7 @@ rrc_enb_task(
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting RRC thread\n");
itti_exit_task(); itti_exit_task();
break; break;
@@ -6682,26 +7313,58 @@ rrc_rx_tx(
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n", LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
ue_context_p->ue_context.ul_failure_timer); ue_context_p->ue_context.ul_failure_timer);
} }
else { else {
LOG_I(RRC,"UE rnti %x failure timer %d/20000\n", LOG_I(RRC,"UE rnti %x failure timer %d/8\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
ue_context_p->ue_context.ul_failure_timer); ue_context_p->ue_context.ul_failure_timer);
} }
} }
if (ue_context_p->ue_context.ul_failure_timer>0) { if (ue_context_p->ue_context.ul_failure_timer>0) {
ue_context_p->ue_context.ul_failure_timer++; ue_context_p->ue_context.ul_failure_timer++;
if (ue_context_p->ue_context.ul_failure_timer >= 20000) { if (ue_context_p->ue_context.ul_failure_timer >= 8) {
// remove UE after 20 seconds after MAC has indicated UL failure // remove UE after 20 seconds after MAC has indicated UL failure
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p; ue_to_be_removed = ue_context_p;
break; break;
} }
} }
if (ue_context_p->ue_context.ue_release_timer_s1>0) {
ue_context_p->ue_context.ue_release_timer_s1++;
if (ue_context_p->ue_context.ue_release_timer_s1 >=
ue_context_p->ue_context.ue_release_timer_thres_s1) {
LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1);
ue_to_be_removed = ue_context_p;
break;
}
}
if (ue_context_p->ue_context.ue_release_timer_rrc>0) {
ue_context_p->ue_context.ue_release_timer_rrc++;
if (ue_context_p->ue_context.ue_release_timer_rrc >=
ue_context_p->ue_context.ue_release_timer_thres_rrc) {
LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
break;
}
}
if (ue_context_p->ue_context.ue_reestablishment_timer>0) {
ue_context_p->ue_context.ue_reestablishment_timer++;
if (ue_context_p->ue_context.ue_reestablishment_timer >=
ue_context_p->ue_context.ue_reestablishment_timer_thres) {
LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ul_failure_timer = 20000;
ue_to_be_removed = ue_context_p;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
break;
}
}
if (ue_context_p->ue_context.ue_release_timer>0) { if (ue_context_p->ue_context.ue_release_timer>0) {
ue_context_p->ue_context.ue_release_timer++; ue_context_p->ue_context.ue_release_timer++;
if (ue_context_p->ue_context.ue_release_timer >= if (ue_context_p->ue_context.ue_release_timer >=
@@ -6712,8 +7375,18 @@ rrc_rx_tx(
} }
} }
} }
if (ue_to_be_removed) if (ue_to_be_removed) {
if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) {
ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
ue_to_be_removed->ue_context.ue_release_timer = 0;
ue_to_be_removed->ue_context.ue_reestablishment_timer = 0;
}
rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){
ue_to_be_removed->ue_context.ul_failure_timer = 0;
}
}
#ifdef RRC_LOCALIZATION #ifdef RRC_LOCALIZATION
+94 -9
View File
@@ -59,6 +59,10 @@
#include "gtpv1u_eNB_task.h" #include "gtpv1u_eNB_task.h"
#include "RRC/LITE/rrc_eNB_GTPV1U.h" #include "RRC/LITE/rrc_eNB_GTPV1U.h"
#include "TLVDecoder.h"
#include "S1ap-NAS-PDU.h"
#include "flexran_agent_common_internal.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
/* Value to indicate an invalid UE initial id */ /* Value to indicate an invalid UE initial id */
@@ -82,8 +86,80 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000;
#endif #endif
#endif #endif
void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_context_pP)
{
/* Process NAS message locally to get the IMSI */
nas_message_t nas_msg;
memset(&nas_msg, 0, sizeof(nas_message_t));
int size = 0;
nas_message_security_header_t *header = &nas_msg.header;
/* Decode the first octet of the header (security header type or EPS
* bearer identity, and protocol discriminator) */
DECODE_U8((char *) pdu_buf, *(uint8_t*) (header), size);
/* Decode NAS message only if decodable*/
if (!(header->security_header_type <= SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED
&& header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE
&& pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE))
return;
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
/* Decode the message authentication code */
DECODE_U32((char *) pdu_buf+size, header->message_authentication_code, size);
/* Decode the sequence number */
DECODE_U8((char *) pdu_buf+size, header->sequence_number, size);
}
/* Note: the value of the pointer (i.e. the address) is given by value, so we
* can modify it as we want. The callee retains the original address! */
pdu_buf += size;
pdu_len -= size;
/* Decode plain NAS message */
EMM_msg *e_msg = &nas_msg.plain.emm;
emm_msg_header_t *emm_header = &e_msg->header;
/* First decode the EMM message header */
int e_head_size = 0;
/* Check that buffer contains more than only the header */
if (pdu_len <= sizeof(emm_msg_header_t))
return;
/* Decode the security header type and the protocol discriminator */
DECODE_U8(pdu_buf + e_head_size, *(uint8_t *)(emm_header), e_head_size);
/* Decode the message type */
DECODE_U8(pdu_buf + e_head_size, emm_header->message_type, e_head_size);
/* Check that this is the right message */
if (emm_header->protocol_discriminator != EPS_MOBILITY_MANAGEMENT_MESSAGE)
return;
pdu_buf += e_head_size;
pdu_len -= e_head_size;
if (emm_header->message_type == IDENTITY_RESPONSE) {
decode_identity_response(&e_msg->identity_response, pdu_buf, pdu_len);
if (e_msg->identity_response.mobileidentity.imsi.typeofidentity == MOBILE_IDENTITY_IMSI) {
memcpy(&ue_context_pP->ue_context.imsi,
&e_msg->identity_response.mobileidentity.imsi,
sizeof(ImsiMobileIdentity_t));
}
} else if (emm_header->message_type == ATTACH_REQUEST) {
decode_attach_request(&e_msg->attach_request, pdu_buf, pdu_len);
if (e_msg->attach_request.oldgutiorimsi.imsi.typeofidentity == MOBILE_IDENTITY_IMSI) {
/* the following is very dirty, we cast (implicitly) from
* ImsiEpsMobileIdentity_t to ImsiMobileIdentity_t*/
memcpy(&ue_context_pP->ue_context.imsi,
&e_msg->attach_request.oldgutiorimsi.imsi,
sizeof(ImsiMobileIdentity_t));
}
}
}
# if defined(ENABLE_ITTI) # if defined(ENABLE_ITTI)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -542,6 +618,10 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length;
S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer;
extract_imsi(S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer,
S1AP_UPLINK_NAS (msg_p).nas_pdu.length,
ue_context_pP);
itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p);
} }
} }
@@ -563,16 +643,17 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
&ulInformationTransfer->criticalExtensions.choice. &ulInformationTransfer->criticalExtensions.choice.
c1.choice.ulInformationTransfer_r8; c1.choice.ulInformationTransfer_r8;
if (ulInformationTransferR8->dedicatedInfoType. if (ulInformationTransferR8->dedicatedInfoType.present ==
present == ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) {
ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)
extract_imsi(ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf,
ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size,
ue_context_pP);
s1ap_eNB_new_data_request (mod_id, ue_index, s1ap_eNB_new_data_request (mod_id, ue_index,
ulInformationTransferR8-> ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf,
dedicatedInfoType.choice. ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size);
dedicatedInfoNAS.buf, }
ulInformationTransferR8->
dedicatedInfoType.choice.
dedicatedInfoNAS.size);
} }
} }
} }
@@ -674,6 +755,10 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ(
rrcConnectionSetupComplete->dedicatedInfoNAS.buf; rrcConnectionSetupComplete->dedicatedInfoNAS.buf;
S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length = rrcConnectionSetupComplete->dedicatedInfoNAS.size; S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length = rrcConnectionSetupComplete->dedicatedInfoNAS.size;
extract_imsi(S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer,
S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length,
ue_context_pP);
/* Fill UE identities with available information */ /* Fill UE identities with available information */
{ {
S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask = UE_IDENTITIES_NONE; S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask = UE_IDENTITIES_NONE;
+1 -1
View File
@@ -117,7 +117,7 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) {
return 0; return 0;
} }
message_queue_t destroy_message_queue(message_queue_t *queue) { void destroy_message_queue(message_queue_t *queue) {
struct lfds700_misc_prng_state ls; struct lfds700_misc_prng_state ls;
message_t *m; message_t *m;
+1 -1
View File
@@ -48,6 +48,6 @@ typedef struct {
message_queue_t * new_message_queue(int size); message_queue_t * new_message_queue(int size);
int message_put(message_queue_t *queue, void *data, int size, int priority); int message_put(message_queue_t *queue, void *data, int size, int priority);
int message_get(message_queue_t *queue, void **data, int *size, int *priority); int message_get(message_queue_t *queue, void **data, int *size, int *priority);
message_queue_t destroy_message_queue(message_queue_t *queue); void destroy_message_queue(message_queue_t *queue);
#endif /* RINGBUFFER_QUEUE_H */ #endif /* RINGBUFFER_QUEUE_H */
+1
View File
@@ -49,6 +49,7 @@ void *x2ap_task(void *arg)
switch (ITTI_MSG_ID(received_msg)) { switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
X2AP_WARN(" *** Exiting X2AP thread\n");
itti_exit_task(); itti_exit_task();
break; break;
+1
View File
@@ -1219,6 +1219,7 @@ void *gtpv1u_eNB_task(void *args)
hashtable_destroy (RC.gtpv1u_data_g->teid_mapping); hashtable_destroy (RC.gtpv1u_data_g->teid_mapping);
} }
LOG_W(GTPU, " *** Exiting GTPU thread\n");
itti_exit_task(); itti_exit_task();
} }
break; break;
+1
View File
@@ -423,6 +423,7 @@ static void *gtpv1u_thread(void *args)
switch (ITTI_MSG_ID(received_message_p)) { switch (ITTI_MSG_ID(received_message_p)) {
case TERMINATE_MESSAGE: { case TERMINATE_MESSAGE: {
GTPU_WARN(" *** Exiting GTPU thread\n");
itti_exit_task(); itti_exit_task();
} }
break; break;
+1
View File
@@ -307,6 +307,7 @@ void *s1ap_eNB_task(void *arg)
switch (ITTI_MSG_ID(received_msg)) { switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
S1AP_WARN(" *** Exiting S1AP thread\n");
itti_exit_task(); itti_exit_task();
break; break;
+1
View File
@@ -841,6 +841,7 @@ void *sctp_eNB_task(void *arg)
break; break;
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
SCTP_WARN("*** Exiting SCTP thread\n");
itti_exit_task(); itti_exit_task();
break; break;
@@ -1089,6 +1089,7 @@ void *et_s1ap_eNB_task(void *arg)
switch (ITTI_MSG_ID(received_msg)) { switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE: case TERMINATE_MESSAGE:
S1AP_WARN("*** Exiting S1AP thread\n");
itti_exit_task(); itti_exit_task();
break; break;
+1 -1
View File
@@ -389,7 +389,7 @@ void *udp_eNB_task(void *args_p)
break; break;
case TERMINATE_MESSAGE: { case TERMINATE_MESSAGE: {
LOG_W(UDP_, "Received TERMINATE_MESSAGE\n"); LOG_W(UDP_, " *** Exiting UDP thread\n");
itti_exit_task(); itti_exit_task();
} }
break; break;
@@ -189,6 +189,16 @@ RUs = (
} }
); );
NETWORK_CONTROLLER :
{
FLEXRAN_ENABLED = "no";
FLEXRAN_INTERFACE_NAME = "lo";
FLEXRAN_IPV4_ADDRESS = "127.0.0.1";
FLEXRAN_PORT = 2210;
FLEXRAN_CACHE = "/mnt/oai_agent_cache";
FLEXRAN_AWAIT_RECONF = "no";
};
log_config : log_config :
{ {
global_log_level ="info"; global_log_level ="info";
+25 -6
View File
@@ -344,7 +344,7 @@ static void* eNB_thread_rxtx( void* param ) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
printf( "Exiting eNB thread RXn_TXnp4\n"); LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n");
eNB_thread_rxtx_status = 0; eNB_thread_rxtx_status = 0;
return &eNB_thread_rxtx_status; return &eNB_thread_rxtx_status;
@@ -817,20 +817,24 @@ void kill_eNB_proc(int inst) {
proc = &eNB->proc; proc = &eNB->proc;
proc_rxtx = &proc->proc_rxtx[0]; proc_rxtx = &proc->proc_rxtx[0];
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst ); LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
if (eNB->single_thread_flag==0) { if (eNB->single_thread_flag==0) {
proc_rxtx[0].instance_cnt_rxtx = 0; // FIXME data race! pthread_mutex_lock(&proc_rxtx[0].mutex_rxtx);
proc_rxtx[1].instance_cnt_rxtx = 0; // FIXME data race! proc_rxtx[0].instance_cnt_rxtx = 0;
pthread_cond_signal( &proc_rxtx[0].cond_rxtx ); pthread_mutex_unlock(&proc_rxtx[0].mutex_rxtx);
pthread_cond_signal( &proc_rxtx[1].cond_rxtx ); pthread_mutex_lock(&proc_rxtx[1].mutex_rxtx);
proc_rxtx[1].instance_cnt_rxtx = 0;
pthread_mutex_unlock(&proc_rxtx[1].mutex_rxtx);
} }
proc->instance_cnt_prach = 0; proc->instance_cnt_prach = 0;
pthread_cond_signal( &proc->cond_prach ); pthread_cond_signal( &proc->cond_prach );
pthread_cond_signal( &proc->cond_asynch_rxtx );
pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx); pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
LOG_D(PHY, "joining pthread_prach\n");
pthread_join( proc->pthread_prach, (void**)&status ); pthread_join( proc->pthread_prach, (void**)&status );
LOG_I(PHY, "Destroying prach mutex/cond\n"); LOG_I(PHY, "Destroying prach mutex/cond\n");
@@ -886,6 +890,21 @@ void print_opp_meas(void) {
} }
} }
void free_transport(PHY_VARS_eNB *eNB)
{
int i;
int j;
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
LOG_I(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
for (j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
LOG_I(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
free_eNB_ulsch(eNB->ulsch[1+i]);
}
free_eNB_ulsch(eNB->ulsch[0]);
}
void init_transport(PHY_VARS_eNB *eNB) { void init_transport(PHY_VARS_eNB *eNB) {
int i; int i;
+272 -158
View File
@@ -117,9 +117,10 @@ extern volatile int oai_exit;
extern void phy_init_RU(RU_t*); extern void phy_init_RU(RU_t*);
extern void phy_free_RU(RU_t*);
void init_RU(char*); void init_RU(char*);
void stop_RU(RU_t *ru); void stop_RU(int nb_ru);
void do_ru_sync(RU_t *ru); void do_ru_sync(RU_t *ru);
void configure_ru(int idx, void configure_ru(int idx,
@@ -1273,8 +1274,8 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq; cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
cfg->rx_freq[i] = (double)fp->ul_CarrierFreq; cfg->rx_freq[i] = (double)fp->ul_CarrierFreq;
cfg->tx_gain[i] = (double)fp->att_tx; cfg->tx_gain[i] = ru->att_tx;
cfg->rx_gain[i] = ru->max_rxgain-(double)fp->att_rx; cfg->rx_gain[i] = ru->max_rxgain-ru->att_rx;
cfg->configFilename = rf_config_file; cfg->configFilename = rf_config_file;
printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n", printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
@@ -1597,8 +1598,6 @@ void *ru_thread_synch(void *arg) {
if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break; if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break;
} // oai_exit } // oai_exit
lte_sync_time_free();
ru_thread_synch_status = 0; ru_thread_synch_status = 0;
return &ru_thread_synch_status; return &ru_thread_synch_status;
@@ -1656,11 +1655,13 @@ void init_RU_proc(RU_t *ru) {
pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL); pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL);
pthread_mutex_init( &proc->mutex_synch,NULL); pthread_mutex_init( &proc->mutex_synch,NULL);
pthread_mutex_init( &proc->mutex_FH,NULL); pthread_mutex_init( &proc->mutex_FH,NULL);
pthread_mutex_init( &proc->mutex_eNBs, NULL);
pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_prach, NULL);
pthread_cond_init( &proc->cond_FH, NULL); pthread_cond_init( &proc->cond_FH, NULL);
pthread_cond_init( &proc->cond_asynch_rxtx, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
pthread_cond_init( &proc->cond_synch,NULL); pthread_cond_init( &proc->cond_synch,NULL);
pthread_cond_init( &proc->cond_eNBs, NULL);
pthread_attr_init( &proc->attr_FH); pthread_attr_init( &proc->attr_FH);
pthread_attr_init( &proc->attr_prach); pthread_attr_init( &proc->attr_prach);
@@ -1716,6 +1717,116 @@ void init_RU_proc(RU_t *ru) {
} }
void kill_RU_proc(int inst)
{
RU_t *ru = RC.ru[inst];
RU_proc_t *proc = &ru->proc;
pthread_mutex_lock(&proc->mutex_FH);
proc->instance_cnt_FH = 0;
pthread_mutex_unlock(&proc->mutex_FH);
pthread_cond_signal(&proc->cond_FH);
pthread_mutex_lock(&proc->mutex_prach);
proc->instance_cnt_prach = 0;
pthread_mutex_unlock(&proc->mutex_prach);
pthread_cond_signal(&proc->cond_prach);
#ifdef Rel14
pthread_mutex_lock(&proc->mutex_prach_br);
proc->instance_cnt_prach_br = 0;
pthread_mutex_unlock(&proc->mutex_prach_br);
pthread_cond_signal(&proc->cond_prach_br);
#endif
pthread_mutex_lock(&proc->mutex_synch);
proc->instance_cnt_synch = 0;
pthread_mutex_unlock(&proc->mutex_synch);
pthread_cond_signal(&proc->cond_synch);
pthread_mutex_lock(&proc->mutex_eNBs);
proc->instance_cnt_eNBs = 0;
pthread_mutex_unlock(&proc->mutex_eNBs);
pthread_cond_signal(&proc->cond_eNBs);
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
proc->instance_cnt_asynch_rxtx = 0;
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
pthread_cond_signal(&proc->cond_asynch_rxtx);
LOG_D(PHY, "Joining pthread_FH\n");
pthread_join(proc->pthread_FH, NULL);
if (ru->function == NGFI_RRU_IF4p5) {
LOG_D(PHY, "Joining pthread_prach\n");
pthread_join(proc->pthread_prach, NULL);
#ifdef Rel14
LOG_D(PHY, "Joining pthread_prach_br\n");
pthread_join(proc->pthread_prach_br, NULL);
#endif
if (ru->is_slave) {
LOG_D(PHY, "Joining pthread_\n");
pthread_join(proc->pthread_synch, NULL);
}
if ((ru->if_timing == synch_to_other) ||
(ru->function == NGFI_RRU_IF5) ||
(ru->function == NGFI_RRU_IF4p5)) {
LOG_D(PHY, "Joining pthread_asynch_rxtx\n");
pthread_join(proc->pthread_asynch_rxtx, NULL);
}
}
if (get_nprocs() >= 2) {
if (ru->feprx) {
pthread_mutex_lock(&proc->mutex_fep);
proc->instance_cnt_fep = 0;
pthread_mutex_unlock(&proc->mutex_fep);
pthread_cond_signal(&proc->cond_fep);
LOG_D(PHY, "Joining pthread_fep\n");
pthread_join(proc->pthread_fep, NULL);
pthread_mutex_destroy(&proc->mutex_fep);
pthread_cond_destroy(&proc->cond_fep);
}
if (ru->feptx_ofdm) {
pthread_mutex_lock(&proc->mutex_feptx);
proc->instance_cnt_feptx = 0;
pthread_mutex_unlock(&proc->mutex_feptx);
pthread_cond_signal(&proc->cond_feptx);
LOG_D(PHY, "Joining pthread_feptx\n");
pthread_join(proc->pthread_feptx, NULL);
pthread_mutex_destroy(&proc->mutex_feptx);
pthread_cond_destroy(&proc->cond_feptx);
}
}
if (opp_enabled) {
LOG_D(PHY, "Joining ru_stats_thread\n");
pthread_join(ru->ru_stats_thread, NULL);
}
pthread_mutex_destroy(&proc->mutex_prach);
pthread_mutex_destroy(&proc->mutex_asynch_rxtx);
pthread_mutex_destroy(&proc->mutex_synch);
pthread_mutex_destroy(&proc->mutex_FH);
pthread_mutex_destroy(&proc->mutex_eNBs);
pthread_cond_destroy(&proc->cond_prach);
pthread_cond_destroy(&proc->cond_FH);
pthread_cond_destroy(&proc->cond_asynch_rxtx);
pthread_cond_destroy(&proc->cond_synch);
pthread_cond_destroy(&proc->cond_eNBs);
pthread_attr_destroy(&proc->attr_FH);
pthread_attr_destroy(&proc->attr_prach);
pthread_attr_destroy(&proc->attr_synch);
pthread_attr_destroy(&proc->attr_asynch_rxtx);
pthread_attr_destroy(&proc->attr_fep);
#ifdef Rel14
pthread_mutex_destroy(&proc->mutex_prach_br);
pthread_cond_destroy(&proc->cond_prach_br);
pthread_attr_destroy(&proc->attr_prach_br);
#endif
}
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) { int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
FH_fmt_options_t fmt = cap->FH_fmt; FH_fmt_options_t fmt = cap->FH_fmt;
@@ -1897,13 +2008,159 @@ void init_precoding_weights(PHY_VARS_eNB *eNB) {
} }
} }
void set_function_spec_param(RU_t *ru)
{
int ret;
switch (ru->if_south) {
case LOCAL_RF: // this is an RU with integrated RF (RRU, eNB)
if (ru->function == NGFI_RRU_IF5) { // IF5 RRU
ru->do_prach = 0; // no prach processing in RU
ru->fh_north_in = NULL; // no shynchronous incoming fronthaul from north
ru->fh_north_out = fh_if5_north_out; // need only to do send_IF5 reception
ru->fh_south_out = tx_rf; // send output to RF
ru->fh_north_asynch_in = fh_if5_north_asynch_in; // TX packets come asynchronously
ru->feprx = NULL; // nothing (this is a time-domain signal)
ru->feptx_ofdm = NULL; // nothing (this is a time-domain signal)
ru->feptx_prec = NULL; // nothing (this is a time-domain signal)
ru->start_if = start_if; // need to start the if interface for if5
ru->ifdevice.host_type = RRU_HOST;
ru->rfdevice.host_type = RRU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
reset_meas(&ru->rx_fhaul);
reset_meas(&ru->tx_fhaul);
reset_meas(&ru->compression);
reset_meas(&ru->transport);
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
}
else if (ru->function == NGFI_RRU_IF4p5) {
ru->do_prach = 1; // do part of prach processing in RU
ru->fh_north_in = NULL; // no synchronous incoming fronthaul from north
ru->fh_north_out = fh_if4p5_north_out; // send_IF4p5 on reception
ru->fh_south_out = tx_rf; // send output to RF
ru->fh_north_asynch_in = fh_if4p5_north_asynch_in; // TX packets come asynchronously
ru->feprx = (get_nprocs()<=2) ? fep_full :ru_fep_full_2thread; // RX DFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft only (no precoding in RRU)
ru->feptx_prec = NULL;
ru->start_if = start_if; // need to start the if interface for if4p5
ru->ifdevice.host_type = RRU_HOST;
ru->rfdevice.host_type = RRU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
reset_meas(&ru->rx_fhaul);
reset_meas(&ru->tx_fhaul);
reset_meas(&ru->compression);
reset_meas(&ru->transport);
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
malloc_IF4p5_buffer(ru);
}
else if (ru->function == eNodeB_3GPP) {
ru->do_prach = 0; // no prach processing in RU
ru->feprx = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread; // RX DFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft and precoding
ru->feptx_prec = feptx_prec; // this is fep with idft and precoding
ru->fh_north_in = NULL; // no incoming fronthaul from north
ru->fh_north_out = NULL; // no outgoing fronthaul to north
ru->start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST;
}
ru->fh_south_in = rx_rf; // local synchronous RF RX
ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface
printf("configuring ru_id %d (start_rf %p)\n", ru->idx, start_rf);
/*
if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1);
phy_init_RU(ru);
}
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
}*/
break;
case REMOTE_IF5: // the remote unit is IF5 RRU
ru->do_prach = 0;
ru->feprx = (get_nprocs()<=2) ? fep_full : fep_full; // this is frequency-shift + DFTs
ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs
if (ru->if_timing == synch_to_other) {
ru->fh_south_in = fh_slave_south_in; // synchronize to master
ru->fh_south_out = fh_if5_mobipass_south_out; // use send_IF5 for mobipass
ru->fh_south_asynch_in = fh_if5_south_asynch_in_mobipass; // UL is asynchronous
}
else {
ru->fh_south_in = fh_if5_south_in; // synchronous IF5 reception
ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission
ru->fh_south_asynch_in = NULL; // no asynchronous UL
}
ru->start_rf = NULL; // no local RF
ru->start_if = start_if; // need to start if interface for IF5
ru->ifdevice.host_type = RAU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
ru->ifdevice.configure_rru = configure_ru;
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
break;
case REMOTE_IF4p5:
ru->do_prach = 0;
ru->feprx = NULL; // DFTs
ru->feptx_prec = feptx_prec; // Precoding operation
ru->feptx_ofdm = NULL; // no OFDM mod
ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception
ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission
ru->fh_south_asynch_in = (ru->if_timing == synch_to_other) ? fh_if4p5_south_in : NULL; // asynchronous UL if synch_to_other
ru->fh_north_out = NULL;
ru->fh_north_asynch_in = NULL;
ru->start_rf = NULL; // no local RF
ru->start_if = start_if; // need to start if interface for IF4p5
ru->ifdevice.host_type = RAU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
ru->ifdevice.configure_rru = configure_ru;
ret = openair0_transport_load(&ru->ifdevice, &ru->openair0_cfg, &ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n", ret, ru->idx);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
malloc_IF4p5_buffer(ru);
break;
default:
LOG_E(PHY,"RU with invalid or unknown southbound interface type %d\n",ru->if_south);
break;
} // switch on interface type
}
extern void RCconfig_RU(void); extern void RCconfig_RU(void);
void init_RU(char *rf_config_file) { void init_RU(char *rf_config_file) {
int ru_id; int ru_id;
RU_t *ru; RU_t *ru;
int ret;
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL; PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i; int i;
int CC_id; int CC_id;
@@ -1971,152 +2228,7 @@ void init_RU(char *rf_config_file) {
} }
// LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); // LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
set_function_spec_param(ru);
LOG_D(PHY,"ru->if_south:%d\n", ru->if_south);
switch (ru->if_south) {
case LOCAL_RF: // this is an RU with integrated RF (RRU, eNB)
if (ru->function == NGFI_RRU_IF5) { // IF5 RRU
ru->do_prach = 0; // no prach processing in RU
ru->fh_north_in = NULL; // no shynchronous incoming fronthaul from north
ru->fh_north_out = fh_if5_north_out; // need only to do send_IF5 reception
ru->fh_south_out = tx_rf; // send output to RF
ru->fh_north_asynch_in = fh_if5_north_asynch_in; // TX packets come asynchronously
ru->feprx = NULL; // nothing (this is a time-domain signal)
ru->feptx_ofdm = NULL; // nothing (this is a time-domain signal)
ru->feptx_prec = NULL; // nothing (this is a time-domain signal)
ru->start_if = start_if; // need to start the if interface for if5
ru->ifdevice.host_type = RRU_HOST;
ru->rfdevice.host_type = RRU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
reset_meas(&ru->rx_fhaul);
reset_meas(&ru->tx_fhaul);
reset_meas(&ru->compression);
reset_meas(&ru->transport);
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
}
else if (ru->function == NGFI_RRU_IF4p5) {
ru->do_prach = 1; // do part of prach processing in RU
ru->fh_north_in = NULL; // no synchronous incoming fronthaul from north
ru->fh_north_out = fh_if4p5_north_out; // send_IF4p5 on reception
ru->fh_south_out = tx_rf; // send output to RF
ru->fh_north_asynch_in = fh_if4p5_north_asynch_in; // TX packets come asynchronously
ru->feprx = (get_nprocs()<=2) ? fep_full :ru_fep_full_2thread; // RX DFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft only (no precoding in RRU)
ru->feptx_prec = NULL;
ru->start_if = start_if; // need to start the if interface for if4p5
ru->ifdevice.host_type = RRU_HOST;
ru->rfdevice.host_type = RRU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
reset_meas(&ru->rx_fhaul);
reset_meas(&ru->tx_fhaul);
reset_meas(&ru->compression);
reset_meas(&ru->transport);
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
malloc_IF4p5_buffer(ru);
}
else if (ru->function == eNodeB_3GPP) {
ru->do_prach = 0; // no prach processing in RU
ru->feprx = (get_nprocs()<=2) ? fep_full : ru_fep_full_2thread; // RX DFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // this is fep with idft and precoding
ru->feptx_prec = feptx_prec; // this is fep with idft and precoding
ru->fh_north_in = NULL; // no incoming fronthaul from north
ru->fh_north_out = NULL; // no outgoing fronthaul to north
ru->start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST;
}
ru->fh_south_in = rx_rf; // local synchronous RF RX
ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface
printf("configuring ru_id %d (start_rf %p)\n",ru_id,start_rf);
/*
if (ru->function == eNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
fill_rf_config(ru,rf_config_file);
init_frame_parms(&ru->frame_parms,1);
phy_init_RU(ru);
}
ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
if (setup_RU_buffers(ru)!=0) {
printf("Exiting, cannot initialize RU Buffers\n");
exit(-1);
}
*/
break;
case REMOTE_IF5: // the remote unit is IF5 RRU
ru->do_prach = 0;
ru->feprx = (get_nprocs()<=2) ? fep_full : fep_full; // this is frequency-shift + DFTs
ru->feptx_prec = feptx_prec; // need to do transmit Precoding + IDFTs
ru->feptx_ofdm = (get_nprocs()<=2) ? feptx_ofdm : feptx_ofdm_2thread; // need to do transmit Precoding + IDFTs
if (ru->if_timing == synch_to_other) {
ru->fh_south_in = fh_slave_south_in; // synchronize to master
ru->fh_south_out = fh_if5_mobipass_south_out; // use send_IF5 for mobipass
ru->fh_south_asynch_in = fh_if5_south_asynch_in_mobipass; // UL is asynchronous
}
else {
ru->fh_south_in = fh_if5_south_in; // synchronous IF5 reception
ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission
ru->fh_south_asynch_in = NULL; // no asynchronous UL
}
ru->start_rf = NULL; // no local RF
ru->start_if = start_if; // need to start if interface for IF5
ru->ifdevice.host_type = RAU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
ru->ifdevice.configure_rru = configure_ru;
ret = openair0_transport_load(&ru->ifdevice,&ru->openair0_cfg,&ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
break;
case REMOTE_IF4p5:
ru->do_prach = 0;
ru->feprx = NULL; // DFTs
ru->feptx_prec = feptx_prec; // Precoding operation
ru->feptx_ofdm = NULL; // no OFDM mod
ru->fh_south_in = fh_if4p5_south_in; // synchronous IF4p5 reception
ru->fh_south_out = fh_if4p5_south_out; // synchronous IF4p5 transmission
ru->fh_south_asynch_in = (ru->if_timing == synch_to_other) ? fh_if4p5_south_in : NULL; // asynchronous UL if synch_to_other
ru->fh_north_out = NULL;
ru->fh_north_asynch_in = NULL;
ru->start_rf = NULL; // no local RF
ru->start_if = start_if; // need to start if interface for IF4p5
ru->ifdevice.host_type = RAU_HOST;
ru->ifdevice.eth_params = &ru->eth_params;
ru->ifdevice.configure_rru = configure_ru;
ret = openair0_transport_load(&ru->ifdevice, &ru->openair0_cfg, &ru->eth_params);
printf("openair0_transport_init returns %d for ru_id %d\n",ret,ru_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
exit(-1);
}
malloc_IF4p5_buffer(ru);
break;
default:
LOG_E(PHY,"RU with invalid or unknown southbound interface type %d\n",ru->if_south);
break;
} // switch on interface type
LOG_I(PHY,"Starting ru_thread %d\n",ru_id); LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
init_RU_proc(ru); init_RU_proc(ru);
@@ -2134,10 +2246,12 @@ void init_RU(char *rf_config_file) {
void stop_ru(RU_t *ru) { void stop_RU(int nb_ru)
{
printf("Stopping RU %p processing threads\n",(void*)ru); for (int inst = 0; inst < nb_ru; inst++) {
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
kill_RU_proc(inst);
}
} }
@@ -2256,13 +2370,13 @@ void RCconfig_RU(void) {
RC.ru[j]->if_timing = synch_to_other; RC.ru[j]->if_timing = synch_to_other;
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS; RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
} }
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
} /* strcmp(local_rf, "yes") != 0 */ } /* strcmp(local_rf, "yes") != 0 */
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
}// j=0..num_rus }// j=0..num_rus
} else { } else {
RC.nb_RU = 0; RC.nb_RU = 0;

Some files were not shown because too many files have changed in this diff Show More