Commit 8baf3e7e authored by Xenofon Foukas's avatar Xenofon Foukas

Changed naming convention for flexran related calls

parent 0cee514c
......@@ -621,7 +621,7 @@ 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_PHY False "trace some PHY exchanges in sequence diagrams")
add_boolean_option(ENB_AGENT_SB_IF True "enable eNB agent to inteface with a SDN contrller")
add_boolean_option(FLEXRAN_AGENT_SB_IF True "enable FlexRAN agent to inteface with a SDN contrller")
########################
# Include order
......@@ -838,7 +838,7 @@ include_directories("${OPENAIR_DIR}")
# Utilities Library
################
if (ENB_AGENT_SB_IF)
if (FLEXRAN_AGENT_SB_IF)
# set the version of protobuf messages, V3 not supported yet
add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3)
......@@ -899,18 +899,18 @@ if (ENB_AGENT_SB_IF)
set(ASYNC_IF_LIB ASYNC_IF)
include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
add_library(ENB_AGENT
${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_common_internal.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c
${OPENAIR2_DIR}/ENB_APP/enb_agent.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c
${OPENAIR2_DIR}/ENB_APP/enb_agent_mac_internal.c
add_library(FLEXRAN_AGENT
${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac_internal.c
)
set(ENB_AGENT_LIB ENB_AGENT)
set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
#include_directories(${OPENAIR2_DIR}/ENB_APP)
set(PROTOBUF_LIB "protobuf-c")
......@@ -1184,9 +1184,9 @@ set (MAC_SRC
${MAC_DIR}/eNB_scheduler_RA.c
${MAC_DIR}/pre_processor.c
${MAC_DIR}/config.c
${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c
${MAC_DIR}/eNB_agent_scheduler_dataplane.c
${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c
${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c
${MAC_DIR}/flexran_agent_scheduler_dataplane.c
${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c
)
set (ENB_APP_SRC
......@@ -1201,8 +1201,8 @@ add_library(L2
# ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
#Test for adding a shared library
add_library(default_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c)
add_library(remote_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c)
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)
# L3 Libs
##########################
......@@ -1757,7 +1757,7 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem -ldl
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-Wl,--end-group )
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
......@@ -1791,7 +1791,7 @@ add_executable(lte-softmodem-nos1
)
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-Wl,--end-group )
target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES})
......@@ -1936,7 +1936,7 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1
-Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
-Wl,--end-group )
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
......
......@@ -63,9 +63,9 @@
//Agent-related headers
#include "ENB_APP/enb_agent_extern.h"
#include "ENB_APP/enb_agent_mac.h"
#include "LAYER2/MAC/enb_agent_mac_proto.h"
#include "ENB_APP/flexran_agent_extern.h"
#include "ENB_APP/flexran_agent_mac.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
//#define DIAG_PHY
......@@ -1372,7 +1372,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
#ifndef DISABLE_SF_TRIGGER
//Send subframe trigger to the controller
if (mac_agent_registered[eNB->Mod_id]) {
agent_mac_xface[eNB->Mod_id]->enb_agent_send_sf_trigger(eNB->Mod_id);
agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id);
}
#endif
......
......@@ -56,7 +56,7 @@ TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200)
/// eNB APP task
TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200)
/// eNB Agent task
TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_FLEXRAN_AGENT, TASK_PRIORITY_MED, 200)
// UE tasks and sub-tasks:
//// Layer 2 and Layer 1 sub-tasks
......
......@@ -49,8 +49,8 @@
# include "gtpv1u_eNB_task.h"
# endif
#if defined(ENB_AGENT_SB_IF)
# include "enb_agent.h"
#if defined(FLEXRAN_AGENT_SB_IF)
# include "flexran_agent.h"
#endif
extern unsigned char NB_eNB_INST;
......@@ -314,11 +314,11 @@ void *eNB_app_task(void *args_p)
configure_rrc(enb_id, enb_properties_p);
}
#if defined (ENB_AGENT_SB_IF)
#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);
enb_agent_start(enb_id, enb_properties_p);
flexran_agent_start(enb_id, enb_properties_p);
}
#endif
......
......@@ -191,10 +191,10 @@
#define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U"
#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER"
#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT"
#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME "FLEXRAN_AGENT_INTERFACE_NAME"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS "FLEXRAN_AGENT_IPV4_ADDRESS"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT "FLEXRAN_AGENT_PORT"
#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE "FLEXRAN_AGENT_CACHE"
#define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config"
#define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name"
......@@ -341,12 +341,12 @@ void enb_config_display(void)
}
}
#if defined(ENB_AGENT_SB_IF)
printf( "\nENB AGENT CONFIG : \n\n");
printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name);
printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address);
printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port);
printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache);
#if defined(FLEXRAN_AGENT_SB_IF)
printf( "\nFLEXRAN AGENT CONFIG : \n\n");
printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->flexran_agent_interface_name);
printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->flexran_agent_ipv4_address);
printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->flexran_agent_port);
printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->flexran_agent_cache);
#endif
......@@ -674,10 +674,10 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
char *address = NULL;
char *cidr = NULL;
char *astring = NULL;
char* enb_agent_interface_name = NULL;
char* enb_agent_ipv4_address = NULL;
libconfig_int enb_agent_port = 0;
char* enb_agent_cache = NULL;
char* flexran_agent_interface_name = NULL;
char* flexran_agent_ipv4_address = NULL;
libconfig_int flexran_agent_port = 0;
char* flexran_agent_cache = NULL;
libconfig_int otg_ue_id = 0;
char* otg_app_type = NULL;
char* otg_bg_traffic = NULL;
......@@ -2481,26 +2481,26 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
if (subsetting != NULL) {
if ( (
config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME,
(const char **)&enb_agent_interface_name)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS,
(const char **)&enb_agent_ipv4_address)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT,
&enb_agent_port)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE,
(const char **)&enb_agent_cache)
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.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name);
cidr = enb_agent_ipv4_address;
enb_properties.properties[enb_properties_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name);
cidr = flexran_agent_ipv4_address;
address = strtok(cidr, "/");
enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address = strdup(address);
enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address = strdup(address);
/* if (address) {
IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" );
IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" );
}*/
enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port;
enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache);
enb_properties.properties[enb_properties_index]->flexran_agent_port = flexran_agent_port;
enb_properties.properties[enb_properties_index]->flexran_agent_cache = strdup(flexran_agent_cache);
}
}
......
......@@ -228,10 +228,10 @@ typedef struct Enb_properties_s {
char *enb_interface_name_for_S1_MME;
in_addr_t enb_ipv4_address_for_S1_MME;
char *enb_agent_interface_name;
in_addr_t enb_agent_ipv4_address;
tcp_udp_port_t enb_agent_port;
char *enb_agent_cache;
char *flexran_agent_interface_name;
in_addr_t flexran_agent_ipv4_address;
tcp_udp_port_t flexran_agent_port;
char *flexran_agent_cache;
/* Nb of RRH to connect to */
uint8_t nb_rrh_gw;
......
......@@ -27,28 +27,28 @@
*******************************************************************************/
/*! \file enb_agent.h
* \brief top level enb agent receive thread and itti task
/*! \file flexran_agent.h
* \brief top level flexran agent receive thread and itti task
* \author Xenofon Foukas and Navid Nikaein
* \date 2016
* \version 0.1
*/
#include "enb_agent_common.h"
#include "flexran_agent_common.h"
#include "log.h"
#include "enb_agent.h"
#include "enb_agent_mac_defs.h"
#include "flexran_agent.h"
#include "flexran_agent_mac_defs.h"
#include "enb_agent_extern.h"
#include "flexran_agent_extern.h"
#include "assertions.h"
#include "enb_agent_net_comm.h"
#include "enb_agent_async.h"
#include "flexran_agent_net_comm.h"
#include "flexran_agent_async.h"
//#define TEST_TIMER
enb_agent_instance_t enb_agent[NUM_MAX_ENB];
flexran_agent_instance_t flexran_agent[NUM_MAX_ENB];
char in_ip[40];
static uint16_t in_port;
......@@ -57,7 +57,7 @@ char local_cache[40];
void *send_thread(void *args);
void *receive_thread(void *args);
pthread_t new_thread(void *(*f)(void *), void *b);
Protocol__FlexranMessage *enb_agent_timeout(void* args);
Protocol__FlexranMessage *flexran_agent_timeout(void* args);
int agent_task_created = 0;
......@@ -65,9 +65,9 @@ int agent_task_created = 0;
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
* and can interact with other itti tasks
*/
void *enb_agent_task(void *args){
void *flexran_agent_task(void *args){
//enb_agent_instance_t *d = (enb_agent_instance_t *) args;
//flexran_agent_instance_t *d = (flexran_agent_instance_t *) args;
Protocol__FlexranMessage *msg;
void *data;
int size;
......@@ -78,13 +78,13 @@ void *enb_agent_task(void *args){
const char *msg_name = NULL;
instance_t instance;
int result;
struct enb_agent_timer_element_s * elem = NULL;
struct flexran_agent_timer_element_s * elem = NULL;
itti_mark_task_ready(TASK_ENB_AGENT);
itti_mark_task_ready(TASK_FLEXRAN_AGENT);
do {
// Wait for a message
itti_receive_msg (TASK_ENB_AGENT, &msg_p);
itti_receive_msg (TASK_FLEXRAN_AGENT, &msg_p);
DevAssert(msg_p != NULL);
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
......@@ -95,25 +95,25 @@ void *enb_agent_task(void *args){
break;
case MESSAGE_TEST:
LOG_I(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p));
LOG_I(FLEXRAN_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p));
break;
case TIMER_HAS_EXPIRED:
msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg);
msg = flexran_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg);
if (msg != NULL){
data=enb_agent_pack_message(msg,&size);
data=flexran_agent_pack_message(msg,&size);
elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id);
if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) {
if (flexran_agent_msg_send(elem->agent_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
}
break;
default:
LOG_E(ENB_AGENT, "Received unexpected message %s\n", msg_name);
LOG_E(FLEXRAN_AGENT, "Received unexpected message %s\n", msg_name);
break;
}
......@@ -121,7 +121,7 @@ void *enb_agent_task(void *args){
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
continue;
error:
LOG_E(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code);
LOG_E(FLEXRAN_AGENT,"flexran_agent_task: error %d occured\n",err_code);
} while (1);
return NULL;
......@@ -129,7 +129,7 @@ void *enb_agent_task(void *args){
void *receive_thread(void *args) {
enb_agent_instance_t *d = args;
flexran_agent_instance_t *d = args;
void *data;
int size;
int priority;
......@@ -139,25 +139,25 @@ void *receive_thread(void *args) {
while (1) {
while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) {
while (flexran_agent_msg_recv(d->enb_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) {
LOG_D(ENB_AGENT,"received message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size);
// Invoke the message handler
msg=enb_agent_handle_message(d->enb_id, data, size);
msg=flexran_agent_handle_message(d->enb_id, data, size);
free(data);
// check if there is something to send back to the controller
if (msg != NULL){
data=enb_agent_pack_message(msg,&size);
data=flexran_agent_pack_message(msg,&size);
if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) {
if (flexran_agent_msg_send(d->enb_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
}
}
}
......@@ -165,7 +165,7 @@ void *receive_thread(void *args) {
return NULL;
error:
LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code);
LOG_E(FLEXRAN_AGENT,"receive_thread: error %d occured\n",err_code);
return NULL;
}
......@@ -203,37 +203,37 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
}
int channel_container_init = 0;
int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
int channel_id;
set_enb_vars(mod_id, RAN_LTE_OAI);
enb_agent[mod_id].enb_id = mod_id;
flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
flexran_agent[mod_id].enb_id = mod_id;
/*
* check the configuration
*/
if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) {
strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache));
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_ENB_AGENT_CACHE);
strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
}
if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) {
strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) );
if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != NULL) {
strncpy(in_ip, enb_properties->properties[mod_id]->flexran_agent_ipv4_address, sizeof(in_ip) );
in_ip[sizeof(in_ip) - 1] = 0; // terminate string
} else {
strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS );
strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS );
}
if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) {
in_port = enb_properties->properties[mod_id]->enb_agent_port;
if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) {
in_port = enb_properties->properties[mod_id]->flexran_agent_port;
} else {
in_port = DEFAULT_ENB_AGENT_PORT ;
in_port = DEFAULT_FLEXRAN_AGENT_PORT ;
}
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
enb_agent[mod_id].enb_id,
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);
......@@ -241,87 +241,87 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
* Initialize the channel container
*/
if (!channel_container_init) {
enb_agent_init_channel_container();
flexran_agent_init_channel_container();
channel_container_init = 1;
}
/*Create the async channel info*/
enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port);
flexran_agent_instance_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port);
/*Create a channel using the async channel info*/
channel_id = enb_agent_create_channel((void *) channel_info,
enb_agent_async_msg_send,
enb_agent_async_msg_recv,
enb_agent_async_release);
channel_id = flexran_agent_create_channel((void *) channel_info,
flexran_agent_async_msg_send,
flexran_agent_async_msg_recv,
flexran_agent_async_release);
if (channel_id <= 0) {
goto error;
}
enb_agent_channel_t *channel = get_channel(channel_id);
flexran_agent_channel_t *channel = get_channel(channel_id);
if (channel == NULL) {
goto error;
}
/*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/
enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAX);
/*Register the channel for all underlying agents (use FLEXRAN_AGENT_MAX)*/
flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAX);
/*Example of registration for a specific agent(MAC):
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
*flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC);
*/
/*Initialize the continuous MAC stats update mechanism*/
enb_agent_init_cont_mac_stats_update(mod_id);
flexran_agent_init_cont_mac_stats_update(mod_id);
new_thread(receive_thread, &enb_agent[mod_id]);
new_thread(receive_thread, &flexran_agent[mod_id]);
/*Initialize and register the mac xface. Must be modified later
*for more flexibility in agent management */
AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface));
enb_agent_register_mac_xface(mod_id, mac_agent_xface);
flexran_agent_register_mac_xface(mod_id, mac_agent_xface);
/*
* initilize a timer
*/
enb_agent_init_timer();
flexran_agent_init_timer();
/*
* Initialize the mac agent
*/
enb_agent_init_mac_agent(mod_id);
flexran_agent_init_mac_agent(mod_id);
/*
* start the enb agent task for tx and interaction with the underlying network function
*/
if (!agent_task_created) {
if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) {
LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n");
if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) {
LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n");
return -1;
}
agent_task_created = 1;
}
LOG_I(ENB_AGENT,"client ends\n");
LOG_I(FLEXRAN_AGENT,"client ends\n");
return 0;
error:
LOG_I(ENB_AGENT,"there was an error\n");
LOG_I(FLEXRAN_AGENT,"there was an error\n");
return 1;
}
Protocol__FlexranMessage *enb_agent_timeout(void* args){
Protocol__FlexranMessage *flexran_agent_timeout(void* args){
// enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args));
// flexran_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args));
//memcpy (timer_args, args, sizeof(*timer_args));
enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args;
flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args;
LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id);
//LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags);
//LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags);
LOG_I(FLEXRAN_AGENT, "flexran_agent %d timeout\n", timer_args->mod_id);
//LOG_I(FLEXRAN_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags);
//LOG_I(FLEXRAN_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags);
return NULL;
}
......@@ -28,28 +28,28 @@
*******************************************************************************/
/*! \file enb_agent.h
* \brief top level enb agent
/*! \file flexran_agent.h
* \brief top level flexran agent
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_H_
#define ENB_AGENT_H_
#ifndef FLEXRAN_AGENT_H_
#define FLEXRAN_AGENT_H_
#include "enb_config.h" // for enb properties
#include "enb_agent_common.h"
#include "flexran_agent_common.h"
/* Initiation and termination of the eNodeB agent */
int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
int enb_agent_stop(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
* and can interact with other itti tasks
*/
void *enb_agent_task(void *args);
void *flexran_agent_task(void *args);
#endif
......@@ -27,22 +27,22 @@
*******************************************************************************/
/*! \file enb_agent_async.c
/*! \file flexran_agent_async.c
* \brief channel implementation for async interface
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_async.h"
#include "enb_agent_defs.h"
#include "flexran_agent_async.h"
#include "flexran_agent_defs.h"
#include "log.h"
enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) {
flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t));
flexran_agent_async_channel_t *channel;
channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t));
if (channel == NULL)
goto error;
......@@ -52,7 +52,7 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst
channel->link = new_link_client(dst_ip, dst_port);
if (channel->link == NULL) goto error;
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
channel->enb_id,
dst_ip,
dst_port);
......@@ -75,27 +75,27 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst
return channel;
error:
LOG_I(ENB_AGENT,"there was an error\n");
LOG_I(FLEXRAN_AGENT,"there was an error\n");
return 1;
}
int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_channel_t *)channel_info;
int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) {
flexran_agent_async_channel_t *channel;
channel = (flexran_agent_channel_t *)channel_info;
return message_put(channel->send_queue, data, size, priority);
}
int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) {
enb_agent_async_channel_t *channel;
channel = (enb_agent_async_channel_t *)channel_info;
int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) {
flexran_agent_async_channel_t *channel;
channel = (flexran_agent_async_channel_t *)channel_info;
return message_get(channel->receive_queue, data, size, priority);
}
void enb_agent_async_release(enb_agent_channel_t *channel) {
enb_agent_async_channel_t *channel_info;
channel_info = (enb_agent_async_channel_t *) channel->channel_info;
void flexran_agent_async_release(flexran_agent_channel_t *channel) {
flexran_agent_async_channel_t *channel_info;
channel_info = (flexran_agent_async_channel_t *) channel->channel_info;
destroy_link_manager(channel_info->manager);
......
......@@ -27,17 +27,17 @@
*******************************************************************************/
/*! \file enb_agent_async.h
/*! \file flexran_agent_async.h
* \brief channel implementation for async interface
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_ASYNC_H_
#define ENB_AGENT_ASYNC_H_
#ifndef FLEXRAN_AGENT_ASYNC_H_
#define FLEXRAN_AGENT_ASYNC_H_
#include "enb_agent_net_comm.h"
#include "flexran_agent_net_comm.h"
typedef struct {
mid_t enb_id;
......@@ -45,19 +45,19 @@ typedef struct {
message_queue_t *send_queue;
message_queue_t *receive_queue;
link_manager_t *manager;
} enb_agent_async_channel_t;
} flexran_agent_async_channel_t;
/* Create a new channel for a given destination ip and destination port */
enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port);
flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port);
/* Send a message to the given channel */
int enb_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);
/* Receive a message from a given channel */
int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info);
int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info);
/* Release a channel */
void enb_agent_async_release(enb_agent_channel_t *channel);
void flexran_agent_async_release(flexran_agent_channel_t *channel);
#endif /*ENB_AGENT_ASYNC_H_*/
#endif /*FLEXRAN_AGENT_ASYNC_H_*/
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file enb_agent_common.c
/*! \file flexran_agent_common.c
* \brief common primitives for all agents
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
* \date 2016
......@@ -37,9 +37,9 @@
#include<stdio.h>
#include <time.h>
#include "enb_agent_common.h"
#include "enb_agent_common_internal.h"
#include "enb_agent_extern.h"
#include "flexran_agent_common.h"
#include "flexran_agent_common_internal.h"
#include "flexran_agent_extern.h"
#include "PHY/extern.h"
#include "log.h"
......@@ -56,7 +56,7 @@ void * enb_rrc[NUM_MAX_ENB];
* message primitives
*/
int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) {
int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) {
*size = protocol__flexran_message__get_packed_size(msg);
......@@ -69,7 +69,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *
return 0;
error:
LOG_E(ENB_AGENT, "an error occured\n"); // change the com
LOG_E(FLEXRAN_AGENT, "an error occured\n"); // change the com
return -1;
}
......@@ -77,7 +77,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *
/* We assume that the buffer size is equal to the message size.
Should be chekced durint Tx/Rx */
int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) {
int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) {
*msg = protocol__flexran_message__unpack(NULL, size, data);
if (*msg == NULL)
goto error;
......@@ -91,7 +91,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage
int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) {
int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) {
*header = malloc(sizeof(Protocol__FlexHeader));
if(*header == NULL)
......@@ -108,17 +108,17 @@ int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader
return 0;
error:
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header;
/*TODO: Need to set random xid or xid from received hello message*/
xid_t xid = 1;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0)
goto error;
Protocol__FlexHello *hello_msg;
......@@ -146,12 +146,12 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage *
free(hello_msg);
if(*msg != NULL)
free(*msg);
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG)
goto error;
......@@ -162,16 +162,16 @@ int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) {
return 0;
error:
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
int flexran_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header;
/*TODO: Need to set a random xid*/
xid_t xid = 1;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0)
goto error;
Protocol__FlexEchoRequest *echo_request_msg;
......@@ -202,7 +202,7 @@ int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMe
}
int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG)
goto error;
......@@ -212,13 +212,13 @@ int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) {
return 0;
error:
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
xid_t xid;
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
......@@ -226,7 +226,7 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess
xid = (echo_req->header)->xid;
Protocol__FlexHeader *header;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0)
goto error;
Protocol__FlexEchoReply *echo_reply_msg;
......@@ -253,12 +253,12 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess
free(echo_reply_msg);
if(*msg != NULL)
free(*msg);
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG)
goto error;
......@@ -268,19 +268,19 @@ int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) {
return 0;
error:
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG)
goto error;
free(msg->enb_config_reply_msg->header);
int i, j;
Protocol__FlexEnbConfigReply *reply = msg->enb_config_reply_msg;
for(i = 0; i < reply->n_cell_config;i++){
for(i = 0; i < reply->n_cell_config;i++) {
free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset);
free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod);
free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc);
......@@ -299,11 +299,11 @@ int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) {
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG)
goto error;
free(msg->ue_config_reply_msg->header);
......@@ -320,11 +320,11 @@ int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) {
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG)
goto error;
......@@ -342,11 +342,11 @@ int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) {
free(msg);
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG)
goto error;
free(msg->ue_state_change_msg->header);
......@@ -360,7 +360,7 @@ int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) {
return -1;
}
int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG)
goto error;
free(msg->enb_config_request_msg->header);
......@@ -369,16 +369,16 @@ int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) {
return 0;
error:
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) {
/* TODO: Deallocate memory for a dynamically allocated UE config message */
return 0;
}
int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) {
/* TODO: Deallocate memory for a dynamically allocated LC config message */
return 0;
}
......@@ -398,7 +398,7 @@ long timer_end(struct timespec start_time){
return diffInNanos;
}
int enb_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) {
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg;
......@@ -429,11 +429,11 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Fle
return -1;
}
int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) {
/*TODO: Dealocate memory for a dynamically allocated control delegation message*/
}
int enb_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) {
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg;
......@@ -443,7 +443,7 @@ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__Flexra
return 0;
}
int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) {
int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) {
/*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/
}
......@@ -452,7 +452,7 @@ int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) {
* get generic info from RAN
*/
void set_enb_vars(mid_t mod_id, ran_name_t ran){
void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran){
switch (ran){
case RAN_LTE_OAI :
......@@ -467,10 +467,10 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){
return;
error:
LOG_E(ENB_AGENT, "unknown RAN name %d\n", ran);
LOG_E(FLEXRAN_AGENT, "unknown RAN name %d\n", ran);
}
int get_current_time_ms (mid_t mod_id, int subframe_flag){
int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag){
if (subframe_flag == 1){
return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe;
......@@ -480,31 +480,31 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){
}
unsigned int get_current_frame (mid_t mod_id) {
unsigned int flexran_get_current_frame (mid_t mod_id) {
#warning "SFN will not be in [0-1023] when oaisim is used"
return ((eNB_MAC_INST *)enb[mod_id])->frame;
}
unsigned int get_current_system_frame_num(mid_t mod_id) {
return (get_current_frame(mod_id) %1024);
unsigned int flexran_get_current_system_frame_num(mid_t mod_id) {
return (flexran_get_current_frame(mod_id) %1024);
}
unsigned int get_current_subframe (mid_t mod_id) {
unsigned int flexran_get_current_subframe (mid_t mod_id) {
return ((eNB_MAC_INST *)enb[mod_id])->subframe;
}
uint16_t get_sfn_sf (mid_t mod_id) {
uint16_t flexran_get_sfn_sf (mid_t mod_id) {
frame_t frame;
sub_frame_t subframe;
uint16_t sfn_sf, frame_mask, sf_mask;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
frame_mask = ((1<<12) - 1);
sf_mask = ((1<<4) - 1);
sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4);
......@@ -512,14 +512,14 @@ uint16_t get_sfn_sf (mid_t mod_id) {
return sfn_sf;
}
uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
uint16_t flexran_get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
frame_t frame;
sub_frame_t subframe;
uint16_t sfn_sf, frame_mask, sf_mask;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
subframe = ((subframe + ahead_of_time) % 10);
......@@ -527,7 +527,7 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
frame = frame + full_frames_ahead;
if (subframe < get_current_subframe(mod_id)) {
if (subframe < flexran_get_current_subframe(mod_id)) {
frame++;
}
......@@ -538,40 +538,40 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) {
return sfn_sf;
}
int get_num_ues (mid_t mod_id){
int flexran_get_num_ues (mid_t mod_id){
return ((UE_list_t *)enb_ue[mod_id])->num_UEs;
}
int get_ue_crnti (mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id) {
return UE_RNTI(mod_id, ue_id);
}
int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) {
int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) {
return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid];
}
int get_ue_phr (mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info;
}
int get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi;
}
int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id)
{
rnti_t rnti = get_ue_crnti(mod_id,ue_id);
uint16_t frame = (uint16_t) get_current_frame(mod_id);
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) {
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id);
mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0);
return rlc_status.bytes_in_buffer;
}
int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id)
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id)
{
rnti_t rnti = get_ue_crnti(mod_id,ue_id);
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
if (eNB_UE_stats == NULL) {
......@@ -611,15 +611,15 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id)
return 0;
}
int get_active_CC(mid_t mod_id, mid_t ue_id) {
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id];
}
int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) {
int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) {
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
int pCCid = UE_PCCID(mod_id,ue_id);
rnti_t rnti = get_ue_crnti(mod_id,ue_id);
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti);
......@@ -630,13 +630,13 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) {
return eNB_UE_stats[CC_id].rank;
}
int get_tpc(mid_t mod_id, mid_t ue_id) {
int flexran_get_tpc(mid_t mod_id, mid_t ue_id) {
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
int32_t normalized_rx_power, target_rx_power;
int tpc = 1;
int pCCid = UE_PCCID(mod_id,ue_id);
rnti_t rnti = get_ue_crnti(mod_id,ue_id);
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti);
......@@ -660,7 +660,7 @@ int get_tpc(mid_t mod_id, mid_t ue_id) {
return tpc;
}
int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) { //flag_id_status = 0 then id, else status
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, int *id, int *status) { //flag_id_status = 0 then id, else status
/*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in
* get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add
* DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/
......@@ -669,7 +669,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i
uint8_t round;
uint16_t rnti = get_ue_crnti(mod_id,ue_id);
uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL);
......@@ -683,9 +683,9 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i
return 0;
}
int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) {
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) {
LTE_eNB_UE_stats *eNB_UE_stats = NULL;
uint32_t rnti = get_ue_crnti(mod_id,ue_id);
uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti);
......@@ -693,15 +693,14 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) {
return -1;
}
if(eNB_UE_stats->Po_PUCCH_update == 1)
{
if(eNB_UE_stats->Po_PUCCH_update == 1) {
return eNB_UE_stats->Po_PUCCH_dBm;
}
else
return -1;
}
int get_p0_nominal_pucch(mid_t mod_id, int CC_id) {
int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) {
int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id);
return pucch_rx_received;
}
......@@ -713,42 +712,42 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id) {
* ************************************
*/
int get_hopping_offset(mid_t mod_id, int CC_id) {
int flexran_get_hopping_offset(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pusch_config_common.pusch_HoppingOffset;
}
int get_hopping_mode(mid_t mod_id, int CC_id) {
int flexran_get_hopping_mode(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pusch_config_common.hoppingMode;
}
int get_n_SB(mid_t mod_id, int CC_id) {
int flexran_get_n_SB(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pusch_config_common.n_SB;
}
int get_enable64QAM(mid_t mod_id, int CC_id) {
int flexran_get_enable64QAM(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pusch_config_common.enable64QAM;
}
int get_phich_duration(mid_t mod_id, int CC_id) {
int flexran_get_phich_duration(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->phich_config_common.phich_duration;
}
int get_phich_resource(mid_t mod_id, int CC_id) {
int flexran_get_phich_resource(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
......@@ -764,131 +763,131 @@ int get_phich_resource(mid_t mod_id, int CC_id) {
return -1;
}
int get_n1pucch_an(mid_t mod_id, int CC_id) {
int flexran_get_n1pucch_an(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pucch_config_common.n1PUCCH_AN;
}
int get_nRB_CQI(mid_t mod_id, int CC_id) {
int flexran_get_nRB_CQI(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pucch_config_common.nRB_CQI;
}
int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) {
int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->pucch_config_common.deltaPUCCH_Shift;
}
int get_prach_ConfigIndex(mid_t mod_id, int CC_id) {
int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
}
int get_prach_FreqOffset(mid_t mod_id, int CC_id) {
int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset;
}
int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) {
int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->maxHARQ_Msg3Tx;
}
int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) {
int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->Ncp_UL;
}
int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) {
int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->Ncp;
}
int get_cell_id(mid_t mod_id, int CC_id) {
int flexran_get_cell_id(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->Nid_cell;
}
int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) {
int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig;
}
int get_srs_SubframeConfig(mid_t mod_id, int CC_id) {
int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig;
}
int get_srs_MaxUpPts(mid_t mod_id, int CC_id) {
int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts;
}
int get_N_RB_DL(mid_t mod_id, int CC_id) {
int flexran_get_N_RB_DL(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->N_RB_DL;
}
int get_N_RB_UL(mid_t mod_id, int CC_id) {
int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->N_RB_UL;
}
int get_subframe_assignment(mid_t mod_id, int CC_id) {
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->tdd_config;
}
int get_special_subframe_assignment(mid_t mod_id, int CC_id) {
int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
return frame_parms->tdd_config_S;
}
int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) {
int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) {
Enb_properties_array_t *enb_properties;
enb_properties = enb_config_get();
return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id];
}
int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) {
int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) {
Enb_properties_array_t *enb_properties;
enb_properties = enb_config_get();
return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id];
}
int get_duplex_mode(mid_t mod_id, int CC_id) {
int flexran_get_duplex_mode(mid_t mod_id, int CC_id) {
LTE_DL_FRAME_PARMS *frame_parms;
frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id);
......@@ -900,15 +899,15 @@ int get_duplex_mode(mid_t mod_id, int CC_id) {
return -1;
}
long get_si_window_length(mid_t mod_id, int CC_id) {
long flexran_get_si_window_length(mid_t mod_id, int CC_id) {
return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength;
}
int get_sib1_length(mid_t mod_id, int CC_id) {
int flexran_get_sib1_length(mid_t mod_id, int CC_id) {
return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1;
}
int get_num_pdcch_symb(mid_t mod_id, int CC_id) {
int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id) {
/* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */
return 0;
//(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols);
......@@ -923,13 +922,12 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) {
*/
int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) {
int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.mac_MainConfig != NULL)
return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated;
}
......@@ -937,13 +935,13 @@ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_meas_gap_config(mid_t mod_id, mid_t ue_id) {
int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.measGapConfig != NULL){
if(ue_context_p->ue_context.measGapConfig != NULL) {
if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) {
if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) {
return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1;
......@@ -959,9 +957,9 @@ int get_meas_gap_config(mid_t mod_id, mid_t ue_id) {
}
int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) {
int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
......@@ -979,15 +977,15 @@ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL;
}
int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) {
return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL;
}
int get_half_duplex(mid_t ue_id) {
int flexran_get_half_duplex(mid_t ue_id) {
// TODO
//int halfduplex = 0;
//int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count;
......@@ -998,39 +996,38 @@ int get_half_duplex(mid_t ue_id) {
//return halfduplex;
}
int get_intra_sf_hopping(mid_t ue_id) {
int flexran_get_intra_sf_hopping(mid_t ue_id) {
//TODO:Get proper value
//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
//return (0 & ( 1 << (31)));
}
int get_type2_sb_1(mid_t ue_id) {
int flexran_get_type2_sb_1(mid_t ue_id) {
//TODO:Get proper value
//uint8_t temp = 0;
//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
//return (temp & ( 1 << (11)));
}
int get_ue_category(mid_t ue_id) {
int flexran_get_ue_category(mid_t ue_id) {
//TODO:Get proper value
//return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category);
}
int get_res_alloc_type1(mid_t ue_id) {
int flexran_get_res_alloc_type1(mid_t ue_id) {
//TODO:Get proper value
//uint8_t temp = 0;
//temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf);
//return (temp & ( 1 << (30)));
}
int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
}
......@@ -1039,13 +1036,12 @@ int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_tti_bundling(mid_t mod_id, mid_t ue_id) {
int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.mac_MainConfig != NULL){
return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling;
}
......@@ -1054,9 +1050,9 @@ int get_tti_bundling(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) {
int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL) {
......@@ -1067,13 +1063,12 @@ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) {
int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
}
......@@ -1082,13 +1077,12 @@ int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) {
int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
}
......@@ -1097,13 +1091,12 @@ int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) {
int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
}
......@@ -1112,9 +1105,9 @@ int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) {
int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL) {
......@@ -1127,13 +1120,13 @@ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) {
int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) {
return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
}
int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) {
int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
......@@ -1145,14 +1138,13 @@ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) {
return -1;
}
int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) {
int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode;
}
......@@ -1161,13 +1153,12 @@ int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) {
int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor;
}
......@@ -1176,10 +1167,10 @@ int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) {
int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) {
//TODO: need to double check
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL) {
......@@ -1195,14 +1186,13 @@ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) {
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) {
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
uint32_t rntiP = get_ue_crnti(mod_id,ue_id);
uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id);
ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP);
if(ue_context_p != NULL)
{
if(ue_context_p != NULL) {
if(ue_context_p->ue_context.physicalConfigDedicated != NULL){
if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop)
return 2;
......@@ -1216,7 +1206,7 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) {
return -1;
}
int get_lcg(mid_t ue_id, mid_t lc_id) {
int flexran_get_lcg(mid_t ue_id, mid_t lc_id) {
if (UE_mac_inst == NULL) {
return -1;
}
......@@ -1227,7 +1217,7 @@ int get_lcg(mid_t ue_id, mid_t lc_id) {
}
}
int get_direction(mid_t ue_id, mid_t lc_id) {
int flexran_get_direction(mid_t ue_id, mid_t lc_id) {
/*TODO: fill with the value for the rest of LCID*/
if(lc_id == DCCH | lc_id == DCCH1)
return 2;
......@@ -1235,7 +1225,7 @@ int get_direction(mid_t ue_id, mid_t lc_id) {
return 1;
}
int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) {
int size;
Protocol__FlexranMessage *msg;
Protocol__FlexHeader *header;
......@@ -1245,7 +1235,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
int xid = 0;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0)
goto error;
Protocol__FlexUeStateChange *ue_state_change_msg;
......@@ -1269,20 +1259,20 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
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);
int i = find_UE_id(mod_id, rnti);
config->has_rnti = 1;
config->rnti = rnti;
if(get_time_alignment_timer(mod_id,i) != -1){
config->time_alignment_timer = get_time_alignment_timer(mod_id,i);
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(get_meas_gap_config(mod_id,i) != -1){
config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i);
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 = get_meas_gap_config_offset(mod_id,i);
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)
......@@ -1294,15 +1284,15 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
//TODO: Set the CQI configuration (Optional)
//We do not set it for now
if(get_ue_transmission_mode(mod_id,i) != -1){
config->transmission_mode = get_ue_transmission_mode(mod_id,i);
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 = get_ue_aggregated_max_bitrate_ul(mod_id,i);
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 = get_ue_aggregated_max_bitrate_dl(mod_id,i);
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
......@@ -1311,65 +1301,65 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
protocol__flex_ue_capabilities__init(c_capabilities);
//TODO: Set half duplex (FDD operation)
c_capabilities->has_half_duplex = 0;
c_capabilities->half_duplex = 1;//get_half_duplex(i);
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;//get_intra_sf_hopping(i);
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;//get_type2_sb_1(i);
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;//get_ue_category(i);
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;//get_res_alloc_type1(i);
c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
//Set the capabilites to the message
config->capabilities = c_capabilities;
if(get_ue_transmission_antenna(mod_id,i) != -1){
if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
config->has_ue_transmission_antenna = 1;
config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i);
config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
}
if(get_tti_bundling(mod_id,i) != -1){
if(flexran_get_tti_bundling(mod_id,i) != -1) {
config->has_tti_bundling = 1;
config->tti_bundling = get_tti_bundling(mod_id,i);
config->tti_bundling = flexran_get_tti_bundling(mod_id,i);
}
if(get_maxHARQ_TX(mod_id,i) != -1){
if(flexran_get_maxHARQ_TX(mod_id,i) != -1){
config->has_max_harq_tx = 1;
config->max_harq_tx = get_maxHARQ_TX(mod_id,i);
config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
}
if(get_beta_offset_ack_index(mod_id,i) != -1){
if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
config->has_beta_offset_ack_index = 1;
config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i);
config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
}
if(get_beta_offset_ri_index(mod_id,i) != -1){
if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
config->has_beta_offset_ri_index = 1;
config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i);
config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
}
if(get_beta_offset_cqi_index(mod_id,i) != -1){
if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
config->has_beta_offset_cqi_index = 1;
config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i);
config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
}
if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){
if(flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) {
config->has_ack_nack_simultaneous_trans = 1;
config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i);
config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i);
}
if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){
if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
config->has_simultaneous_ack_nack_cqi = 1;
config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i);
config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
}
if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){
if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
config->has_aperiodic_cqi_rep_mode = 1;
int mode = get_aperiodic_cqi_rep_mode(mod_id,i);
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 {
......@@ -1377,19 +1367,19 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
}
}
if(get_tdd_ack_nack_feedback(mod_id, i) != -1){
if(flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) {
config->has_tdd_ack_nack_feedback = 1;
config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i);
config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i);
}
if(get_ack_nack_repetition_factor(mod_id, i) != -1){
if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
config->has_ack_nack_repetition_factor = 1;
config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i);
config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
}
if(get_extended_bsr_size(mod_id, i) != -1){
if(flexran_get_extended_bsr_size(mod_id, i) != -1) {
config->has_extended_bsr_size = 1;
config->extended_bsr_size = get_extended_bsr_size(mod_id,i);
config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
}
config->has_pcell_carrier_index = 1;
......@@ -1422,22 +1412,22 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change)
msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
msg->ue_state_change_msg = ue_state_change_msg;
data = enb_agent_pack_message(msg, &size);
data = flexran_agent_pack_message(msg, &size);
/*Send sr info using the MAC channel of the eNB*/
if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) {
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
error:
LOG_D(ENB_AGENT, "Could not send UE state message\n");
LOG_D(FLEXRAN_AGENT, "Could not send UE state message\n");
}
int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
xid_t xid;
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
......@@ -1446,7 +1436,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
int i, j;
Protocol__FlexHeader *header;
if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0)
if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0)
goto error;
Protocol__FlexLcConfigReply *lc_config_reply_msg;
......@@ -1456,7 +1446,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
protocol__flex_lc_config_reply__init(lc_config_reply_msg);
lc_config_reply_msg->header = header;
lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id);
lc_config_reply_msg->n_lc_ue_config = flexran_get_num_ues(mod_id);
Protocol__FlexLcUeConfig **lc_ue_config;
if (lc_config_reply_msg->n_lc_ue_config > 0) {
......@@ -1470,12 +1460,12 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
protocol__flex_lc_ue_config__init(lc_ue_config[i]);
lc_ue_config[i]->has_rnti = 1;
lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i);
lc_ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i);
//TODO: Set the number of LC configurations that will be reported for this UE
//Set this according to the current state of the UE. This is only a temporary fix
int status = 0;
status = mac_eNB_get_rrc_status(mod_id, get_ue_crnti(mod_id, i));
status = mac_eNB_get_rrc_status(mod_id, flexran_get_ue_crnti(mod_id, i));
if (status < RRC_CONNECTED) {
lc_ue_config[i]->n_lc_config = 0;
} else if (status == RRC_CONNECTED) {
......@@ -1497,14 +1487,14 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
lc_config[j]->has_lcid = 1;
lc_config[j]->lcid = j+1;
int lcg = get_lcg(i, j+1);
int lcg = flexran_get_lcg(i, j+1);
if (lcg >= 0 && lcg <= 3) {
lc_config[j]->has_lcg = 1;
lc_config[j]->lcg = get_lcg(i,j+1);
lc_config[j]->lcg = flexran_get_lcg(i,j+1);
}
lc_config[j]->has_direction = 1;
lc_config[j]->direction = get_direction(i,j+1);
lc_config[j]->direction = flexran_get_direction(i,j+1);
//TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported
lc_config[j]->has_qos_bearer_type = 1;
lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR;
......@@ -1551,7 +1541,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
free(lc_config_reply_msg);
if(*msg != NULL)
free(*msg);
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
......@@ -1561,7 +1551,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
* ************************************
*/
int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
xid_t xid;
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
......@@ -1571,7 +1561,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
int i;
Protocol__FlexHeader *header;
if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0)
if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0)
goto error;
Protocol__FlexUeConfigReply *ue_config_reply_msg;
......@@ -1581,7 +1571,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
protocol__flex_ue_config_reply__init(ue_config_reply_msg);
ue_config_reply_msg->header = header;
ue_config_reply_msg->n_ue_config = get_num_ues(mod_id);
ue_config_reply_msg->n_ue_config = flexran_get_num_ues(mod_id);
Protocol__FlexUeConfig **ue_config;
if (ue_config_reply_msg->n_ue_config > 0) {
......@@ -1593,24 +1583,24 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig));
protocol__flex_ue_config__init(ue_config[i]);
ue_config[i]->rnti = get_ue_crnti(mod_id,i);
ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i);
ue_config[i]->has_rnti = 1;
//TODO: Set the DRX configuration (optional)
//Not supported for now, so we do not set it
if(get_time_alignment_timer(mod_id,i) != -1){
ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i);
if (flexran_get_time_alignment_timer(mod_id,i) != -1) {
ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i);
ue_config[i]->has_time_alignment_timer = 1;
}
if(get_meas_gap_config(mod_id,i) != -1){
ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i);
if (flexran_get_meas_gap_config(mod_id,i) != -1) {
ue_config[i]->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i);
ue_config[i]->has_meas_gap_config_pattern = 1;
}
if(ue_config[i]->has_meas_gap_config_pattern == 1 &&
if (ue_config[i]->has_meas_gap_config_pattern == 1 &&
ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) {
ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i);
ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i);
ue_config[i]->has_meas_gap_config_sf_offset = 1;
}
//TODO: Set the SPS configuration (Optional)
......@@ -1622,15 +1612,15 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
//TODO: Set the CQI configuration (Optional)
//We do not set it for now
if(get_ue_transmission_mode(mod_id,i) != -1){
ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i);
if (flexran_get_ue_transmission_mode(mod_id,i) != -1) {
ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i);
ue_config[i]->has_transmission_mode = 1;
}
ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i);
ue_config[i]->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i);
ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1;
ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i);
ue_config[i]->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i);
ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1;
Protocol__FlexUeCapabilities *capabilities;
......@@ -1638,65 +1628,65 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
protocol__flex_ue_capabilities__init(capabilities);
//TODO: Set half duplex (FDD operation)
capabilities->has_half_duplex = 0;
capabilities->half_duplex = 0;//get_half_duplex(i);
capabilities->half_duplex = 0;//flexran_get_half_duplex(i);
//TODO: Set intra-frame hopping flag
capabilities->has_intra_sf_hopping = 0;
capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i);
capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i);
//TODO: Set support for type 2 hopping with n_sb > 1
capabilities->has_type2_sb_1 = 0;
capabilities->type2_sb_1 = 1;//get_type2_sb_1(i);
capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i);
//TODO: Set ue category
capabilities->has_ue_category = 0;
capabilities->ue_category = 1;//get_ue_category(i);
capabilities->ue_category = 1;//flexran_get_ue_category(i);
//TODO: Set UE support for resource allocation type 1
capabilities->has_res_alloc_type1 = 0;
capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i);
capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i);
//Set the capabilites to the message
ue_config[i]->capabilities = capabilities;
if(get_ue_transmission_antenna(mod_id,i) != -1){
if (flexran_get_ue_transmission_antenna(mod_id,i) != -1) {
ue_config[i]->has_ue_transmission_antenna = 1;
ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i);
ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i);
}
if(get_tti_bundling(mod_id,i) != -1){
if (flexran_get_tti_bundling(mod_id,i) != -1) {
ue_config[i]->has_tti_bundling = 1;
ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i);
ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id,i);
}
if(get_maxHARQ_TX(mod_id,i) != -1){
if (flexran_get_maxHARQ_TX(mod_id,i) != -1) {
ue_config[i]->has_max_harq_tx = 1;
ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i);
ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i);
}
if(get_beta_offset_ack_index(mod_id,i) != -1){
if (flexran_get_beta_offset_ack_index(mod_id,i) != -1) {
ue_config[i]->has_beta_offset_ack_index = 1;
ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i);
ue_config[i]->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i);
}
if(get_beta_offset_ri_index(mod_id,i) != -1){
if (flexran_get_beta_offset_ri_index(mod_id,i) != -1) {
ue_config[i]->has_beta_offset_ri_index = 1;
ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i);
ue_config[i]->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i);
}
if(get_beta_offset_cqi_index(mod_id,i) != -1){
if (flexran_get_beta_offset_cqi_index(mod_id,i) != -1) {
ue_config[i]->has_beta_offset_cqi_index = 1;
ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i);
ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i);
}
if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){
if (flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) {
ue_config[i]->has_ack_nack_simultaneous_trans = 1;
ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i);
ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i);
}
if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){
if (flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) {
ue_config[i]->has_simultaneous_ack_nack_cqi = 1;
ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i);
ue_config[i]->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i);
}
if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){
if (flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) {
ue_config[i]->has_aperiodic_cqi_rep_mode = 1;
int mode = get_aperiodic_cqi_rep_mode(mod_id,i);
int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i);
if (mode > 4) {
ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE;
} else {
......@@ -1704,19 +1694,19 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
}
}
if(get_tdd_ack_nack_feedback(mod_id, i) != -1){
if (flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) {
ue_config[i]->has_tdd_ack_nack_feedback = 1;
ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i);
ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i);
}
if(get_ack_nack_repetition_factor(mod_id, i) != -1){
if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) {
ue_config[i]->has_ack_nack_repetition_factor = 1;
ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i);
ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i);
}
if(get_extended_bsr_size(mod_id, i) != -1){
if (flexran_get_extended_bsr_size(mod_id, i) != -1) {
ue_config[i]->has_extended_bsr_size = 1;
ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i);
ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i);
}
//TODO: Set carrier aggregation support (boolean)
ue_config[i]->has_ca_support = 0;
......@@ -1754,7 +1744,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
free(ue_config_reply_msg);
if(*msg != NULL)
free(*msg);
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
......@@ -1765,11 +1755,11 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra
* ************************************
*/
int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header;
xid_t xid = 1;
if(flex_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0)
if(flexran_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0)
goto error;
Protocol__FlexEnbConfigRequest *enb_config_request_msg;
......@@ -1803,7 +1793,7 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Fle
return -1;
}
int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
xid_t xid;
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
......@@ -1815,7 +1805,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
int enb_id = mod_id;
Protocol__FlexHeader *header;
if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0)
if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0)
goto error;
Protocol__FlexEnbConfigReply *enb_config_reply_msg;
......@@ -1840,43 +1830,43 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
protocol__flex_cell_config__init(cell_conf[i]);
cell_conf[i]->phy_cell_id = 1;
cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i);
cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(enb_id,i);
cell_conf[i]->cell_id = i;
cell_conf[i]->has_cell_id = 1;
cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i);
cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(enb_id,i);
cell_conf[i]->has_pusch_hopping_offset = 1;
if(get_hopping_mode(enb_id,i) == 0){
if (flexran_get_hopping_mode(enb_id,i) == 0) {
cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER;
}else if(get_hopping_mode(enb_id,i) == 1){
} else if(flexran_get_hopping_mode(enb_id,i) == 1) {
cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA;
}
cell_conf[i]->has_hopping_mode = 1;
cell_conf[i]->n_sb = get_n_SB(enb_id,i);
cell_conf[i]->n_sb = flexran_get_n_SB(enb_id,i);
cell_conf[i]->has_n_sb = 1;
if(get_phich_resource(enb_id,i) == 0){
if (flexran_get_phich_resource(enb_id,i) == 0) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0
}else if (get_phich_resource(enb_id,i) == 1){
} else if (flexran_get_phich_resource(enb_id,i) == 1) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1
}else if (get_phich_resource(enb_id,i) == 2){
} else if (flexran_get_phich_resource(enb_id,i) == 2) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2
}else if (get_phich_resource(enb_id,i) == 3){
} else if (flexran_get_phich_resource(enb_id,i) == 3) {
cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3
}
cell_conf[i]->has_phich_resource = 1;
if(get_phich_duration(enb_id,i) == 0){
if (flexran_get_phich_duration(enb_id,i) == 0) {
cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL;
}else if(get_phich_duration(enb_id,i) == 1){
} else if(flexran_get_phich_duration(enb_id,i) == 1) {
cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED;
}
cell_conf[i]->has_phich_duration = 1;
//TODO: Fill in with actual value, See TS 36.211, section 6.9
cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i);
cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(enb_id,i);
cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0;
//TODO: Fill in with actual value
/* Protocol__FlexSiConfig *si_config; */
......@@ -1916,22 +1906,22 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
/* } */
/* cell_conf[i]->si_config = si_config; */
cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i);
cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(enb_id,i);
cell_conf[i]->has_dl_bandwidth = 1;
cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i);
cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(enb_id,i);
cell_conf[i]->has_ul_bandwidth = 1;
if(get_ul_cyclic_prefix_length(enb_id,i) == 0){
if (flexran_get_ul_cyclic_prefix_length(enb_id, i) == 0) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL;
}else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){
} else if(flexran_get_ul_cyclic_prefix_length(enb_id, i) == 1) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED;
}
cell_conf[i]->has_ul_cyclic_prefix_length = 1;
if(get_ul_cyclic_prefix_length(enb_id,i) == 0){
if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 0) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL;
}else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){
} else if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 1) {
cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED;
}
......@@ -1940,20 +1930,20 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
cell_conf[i]->antenna_ports_count = 1;
cell_conf[i]->has_antenna_ports_count = 1;
if(get_duplex_mode(enb_id,i) == 1){
if (flexran_get_duplex_mode(enb_id,i) == 1) {
cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD;
}else if(get_duplex_mode(enb_id,i) == 0){
} else if(flexran_get_duplex_mode(enb_id,i) == 0) {
cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD;
}
cell_conf[i]->has_duplex_mode = 1;
//TODO: Fill in with actual value, DL/UL subframe assignment. TDD only
cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i);
cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(enb_id, i);
cell_conf[i]->has_subframe_assignment = 0;
//TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1
cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i);
cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(enb_id,i);
cell_conf[i]->has_special_subframe_patterns = 0;
//TODO: Fill in with actual value, The MBSFN radio frame period
cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5;
cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 0;
uint32_t *elem_rfperiod;
elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod);
if(elem_rfperiod == NULL)
......@@ -1964,7 +1954,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod;
//TODO: Fill in with actual value, The MBSFN radio frame offset
cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 5;
cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 0;
uint32_t *elem_rfoffset;
elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset);
if(elem_rfoffset == NULL)
......@@ -1975,7 +1965,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset;
//TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes
cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 5;
cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 0;
uint32_t *elem_sfalloc;
elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc);
if(elem_sfalloc == NULL)
......@@ -1985,42 +1975,42 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
}
cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc;
cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i);
cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(enb_id,i);
cell_conf[i]->has_prach_config_index = 1;
cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i);
cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(enb_id,i);
cell_conf[i]->has_prach_freq_offset = 1;
cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i);
cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(enb_id,i);
cell_conf[i]->has_ra_response_window_size = 1;
cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i);
cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(enb_id,i);
cell_conf[i]->has_mac_contention_resolution_timer = 1;
cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i);
cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(enb_id,i);
cell_conf[i]->has_max_harq_msg3tx = 1;
cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i);
cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(enb_id,i);
cell_conf[i]->has_n1pucch_an = 1;
cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i);
cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(enb_id,i);
cell_conf[i]->has_deltapucch_shift = 1;
cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i);
cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(enb_id,i);
cell_conf[i]->has_nrb_cqi = 1;
cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i);
cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(enb_id,i);
cell_conf[i]->has_srs_subframe_config = 1;
cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i);
cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(enb_id,i);
cell_conf[i]->has_srs_bw_config = 1;
cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i);
cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(enb_id,i);
cell_conf[i]->has_srs_mac_up_pts = 1;
if(get_enable64QAM(enb_id,i) == 0){
if (flexran_get_enable64QAM(enb_id,i) == 0) {
cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM;
}else if(get_enable64QAM(enb_id,i) == 1){
} else if(flexran_get_enable64QAM(enb_id,i) == 1) {
cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM;
}
cell_conf[i]->has_enable_64qam = 1;
......@@ -2048,7 +2038,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
free(enb_config_reply_msg);
if(*msg != NULL)
free(*msg);
//LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
//LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
......@@ -2058,24 +2048,24 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr
* timer primitives
*/
//struct enb_agent_map agent_map;
enb_agent_timer_instance_t timer_instance;
//struct flexran_agent_map agent_map;
flexran_agent_timer_instance_t timer_instance;
int agent_timer_init = 0;
err_code_t enb_agent_init_timer(void){
err_code_t flexran_agent_init_timer(void){
LOG_I(ENB_AGENT, "init RB tree\n");
LOG_I(FLEXRAN_AGENT, "init RB tree\n");
if (!agent_timer_init) {
RB_INIT(&timer_instance.enb_agent_head);
RB_INIT(&timer_instance.flexran_agent_head);
agent_timer_init = 1;
}
return PROTOCOL__FLEXRAN_ERR__NO_ERR;
}
RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer);
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 enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){
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;
......@@ -2084,17 +2074,17 @@ int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agen
return 0;
}
err_code_t enb_agent_create_timer(uint32_t interval_sec,
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,
enb_agent_timer_callback_t cb,
flexran_agent_timer_callback_t cb,
void* timer_args,
long *timer_id){
struct enb_agent_timer_element_s *e = calloc(1, sizeof(*e));
struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e));
DevAssert(e != NULL);
//uint32_t timer_id;
......@@ -2103,13 +2093,13 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
if ((interval_sec == 0) && (interval_usec == 0 ))
return TIMER_NULL;
if (timer_type >= ENB_AGENT_TIMER_TYPE_MAX)
if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX)
return TIMER_TYPE_INVALIDE;
if (timer_type == ENB_AGENT_TIMER_TYPE_ONESHOT){
if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){
ret = timer_setup(interval_sec,
interval_usec,
TASK_ENB_AGENT,
TASK_FLEXRAN_AGENT,
instance,
TIMER_ONE_SHOT,
timer_args,
......@@ -2117,10 +2107,10 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
e->type = TIMER_ONE_SHOT;
}
else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){
else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){
ret = timer_setup(interval_sec,
interval_usec,
TASK_ENB_AGENT,
TASK_FLEXRAN_AGENT,
instance,
TIMER_PERIODIC,
timer_args,
......@@ -2135,27 +2125,27 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec,
e->agent_id = agent_id;
e->instance = instance;
e->state = ENB_AGENT_TIMER_STATE_ACTIVE;
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(enb_agent_map, &timer_instance.enb_agent_head, e);
RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e);
LOG_I(ENB_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n",
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 enb_agent_destroy_timer(long timer_id){
err_code_t flexran_agent_destroy_timer(long timer_id){
struct enb_agent_timer_element_s *e = get_timer_entry(timer_id);
struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id);
if (e != NULL ) {
RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e);
enb_agent_destroy_flexran_message(e->timer_args->msg);
RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e);
flexran_agent_destroy_flexran_message(e->timer_args->msg);
free(e);
}
......@@ -2165,18 +2155,18 @@ err_code_t enb_agent_destroy_timer(long timer_id){
return 0;
error:
LOG_E(ENB_AGENT, "timer can't be removed\n");
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
return TIMER_REMOVED_FAILED ;
}
err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) {
struct enb_agent_timer_element_s *e = NULL;
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, enb_agent_map, &timer_instance.enb_agent_head) {
RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) {
if (e->xid == xid) {
timer_id = e->timer_id;
RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e);
enb_agent_destroy_flexran_message(e->timer_args->msg);
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;
......@@ -2186,18 +2176,18 @@ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) {
return 0;
error:
LOG_E(ENB_AGENT, "timer can't be removed\n");
LOG_E(FLEXRAN_AGENT, "timer can't be removed\n");
return TIMER_REMOVED_FAILED ;
}
err_code_t enb_agent_destroy_timers(void){
err_code_t flexran_agent_destroy_timers(void){
struct enb_agent_timer_element_s *e = NULL;
struct flexran_agent_timer_element_s *e = NULL;
RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) {
RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e);
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);
enb_agent_destroy_flexran_message(e->timer_args->msg);
flexran_agent_destroy_flexran_message(e->timer_args->msg);
free(e);
}
......@@ -2205,7 +2195,7 @@ err_code_t enb_agent_destroy_timers(void){
}
void enb_agent_sleep_until(struct timespec *ts, int delay) {
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;
......@@ -2215,17 +2205,17 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) {
}
err_code_t enb_agent_stop_timer(long timer_id){
err_code_t flexran_agent_stop_timer(long timer_id){
struct enb_agent_timer_element_s *e=NULL;
struct enb_agent_timer_element_s search;
memset(&search, 0, sizeof(struct enb_agent_timer_element_s));
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(enb_agent_map, &timer_instance.enb_agent_head, &search);
e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
if (e != NULL ) {
e->state = ENB_AGENT_TIMER_STATE_STOPPED;
e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED;
}
timer_remove(timer_id);
......@@ -2233,11 +2223,11 @@ err_code_t enb_agent_stop_timer(long timer_id){
return 0;
}
struct enb_agent_timer_element_s * get_timer_entry(long timer_id) {
struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) {
struct enb_agent_timer_element_s search;
memset(&search, 0, sizeof(struct enb_agent_timer_element_s));
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(enb_agent_map, &timer_instance.enb_agent_head, &search);
return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search);
}
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file enb_agent_common.h
/*! \file flexran_agent_common.h
* \brief common message primitves and utilities
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
* \date 2016
......@@ -36,8 +36,8 @@
#ifndef ENB_AGENT_COMMON_H_
#define ENB_AGENT_COMMON_H_
#ifndef FLEXRAN_AGENT_COMMON_H_
#define FLEXRAN_AGENT_COMMON_H_
#include <time.h>
......@@ -46,7 +46,7 @@
#include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h"
# include "enb_agent_defs.h"
#include "flexran_agent_defs.h"
#include "enb_config.h"
#include "LAYER2/MAC/extern.h"
......@@ -58,13 +58,13 @@
#define FLEXRAN_VERSION 0
typedef int (*enb_agent_message_decoded_callback)(
typedef int (*flexran_agent_message_decoded_callback)(
mid_t mod_id,
const void *params,
Protocol__FlexranMessage **msg
);
typedef int (*enb_agent_message_destruction_callback)(
typedef int (*flexran_agent_message_destruction_callback)(
Protocol__FlexranMessage *msg
);
......@@ -74,75 +74,75 @@ typedef int (*enb_agent_message_destruction_callback)(
**********************************/
/* Helper functions for message (de)serialization */
int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size);
int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg);
int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size);
int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg);
/* Serialize message and then destroy the input flexran msg. Should be called when protocol
message is created dynamically */
void * enb_agent_pack_message(Protocol__FlexranMessage *msg,
void * flexran_agent_pack_message(Protocol__FlexranMessage *msg,
uint32_t * size);
/* Calls destructor of the given message */
err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg);
err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg);
/* Function to create the header for any FlexRAN protocol message */
int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header);
int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header);
/* Hello protocol message constructor and destructor */
int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_hello(Protocol__FlexranMessage *msg);
int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg);
/* Echo request protocol message constructor and destructor */
int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg);
int flexran_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg);
/* Echo reply protocol message constructor and destructor */
int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg);
int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg);
/* eNodeB configuration reply message constructor and destructor */
int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg);
int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg);
/* UE configuration reply message constructor and destructor */
int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg);
int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg);
/* Logical channel reply configuration message constructor and destructor */
int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg);
int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg);
/* eNodeB configuration request message constructor and destructor */
int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg);
int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg);
/* UE configuration request message constructor */
/* TODO: Need to define and implement destructor */
int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg);
int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg);
/* Logical channel configuration request message constructor */
/* TODO: Need to define and implement destructor */
int enb_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 enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change);
int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg);
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 */
int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_control_delegation(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);
/* Policy reconfiguration message constructor and destructor */
int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_destroy_agent_reconfiguration(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);
/* FlexRAN protocol message dispatcher function */
Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id,
Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
uint8_t *data,
uint32_t size);
/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */
Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args);
Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args);
......@@ -151,134 +151,134 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args);
* get generic info from RAN
****************************/
void set_enb_vars(mid_t mod_id, ran_name_t ran);
void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran);
int get_current_time_ms (mid_t mod_id, int subframe_flag);
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 get_current_frame(mid_t mod_id);
unsigned int flexran_get_current_frame(mid_t mod_id);
/*Return the current SFN (0-1023)*/
unsigned int get_current_system_frame_num(mid_t mod_id);
unsigned int flexran_get_current_system_frame_num(mid_t mod_id);
unsigned int get_current_subframe(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 get_sfn_sf (mid_t mod_id);
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 get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time);
/* Return the number of attached UEs */
int get_num_ues(mid_t mod_id);
int flexran_get_num_ues(mid_t mod_id);
/* Get the rnti of a UE with id ue_id */
int get_ue_crnti (mid_t mod_id, mid_t 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 get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid);
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 get_ue_phr (mid_t mod_id, mid_t ue_id);
int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id);
/* Get the UE wideband CQI */
int get_ue_wcqi (mid_t mod_id, mid_t ue_id);
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 get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id);
/* Return timing advance MAC control element for a designated cell and UE */
int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id);
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 get_active_CC(mid_t mod_id, mid_t ue_id);
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
/* Get the rank indicator for a designated cell and UE */
int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id);
/* See TS 36.213, section 10.1 */
int get_n1pucch_an(mid_t mod_id, int CC_id);
int flexran_get_n1pucch_an(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.4 */
int get_nRB_CQI(mid_t mod_id, int CC_id);
int flexran_get_nRB_CQI(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.4 */
int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id);
int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.7.1 */
int get_prach_ConfigIndex(mid_t mod_id, int CC_id);
int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.7.1 */
int get_prach_FreqOffset(mid_t mod_id, int CC_id);
int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id);
/* See TS 36.321 */
int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id);
int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id);
/* Get the length of the UL cyclic prefix */
int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id);
int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id);
/* Get the length of the DL cyclic prefix */
int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id);
int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id);
/* Get the physical cell id of a cell */
int get_cell_id(mid_t mod_id, int CC_id);
int flexran_get_cell_id(mid_t mod_id, int CC_id);
/* See TS 36.211, section 5.5.3.2 */
int get_srs_BandwidthConfig(mid_t mod_id, int CC_id);
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 get_srs_SubframeConfig(mid_t mod_id, int CC_id);
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 get_srs_MaxUpPts(mid_t mod_id, int CC_id);
int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id);
/* Get number of DL resource blocks */
int get_N_RB_DL(mid_t mod_id, int CC_id);
int flexran_get_N_RB_DL(mid_t mod_id, int CC_id);
/* Get number of UL resource blocks */
int get_N_RB_UL(mid_t mod_id, int CC_id);
int flexran_get_N_RB_UL(mid_t mod_id, int CC_id);
/* Get DL/UL subframe assignment. TDD only */
int get_subframe_assignment(mid_t mod_id, int CC_id);
int flexran_get_subframe_assignment(mid_t mod_id, int CC_id);
/* TDD only. See TS 36.211, table 4.2.1 */
int get_special_subframe_assignment(mid_t mod_id, int CC_id);
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 get_ra_ResponseWindowSize(mid_t mod_id, int CC_id);
int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id);
/* Get timer used for random access */
int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id);
int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id);
/* Get type of duplex mode (FDD/TDD) */
int get_duplex_mode(mid_t mod_id, int CC_id);
int flexran_get_duplex_mode(mid_t mod_id, int CC_id);
/* Get the SI window length */
long get_si_window_length(mid_t mod_id, int CC_id);
long flexran_get_si_window_length(mid_t mod_id, int CC_id);
/* Get the number of PDCCH symbols configured for the cell */
int get_num_pdcch_symb(mid_t mod_id, int CC_id);
int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id);
/* See TS 36.213, sec 5.1.1.1 */
int get_tpc(mid_t mod_id, mid_t ue_id);
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 get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id,
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, int *id, int *status);
/* Reported values for uplink power control */
int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id);
int get_p0_nominal_pucch(mid_t mod_id, int CC_id);
int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id);
/*
* ************************************
......@@ -289,86 +289,86 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id);
/* Get timer in subframes. Controls the synchronization
status of the UE, not the actual timing
advance procedure. See TS 36.321 */
int get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration. See TS 36.133 */
int get_meas_gap_config(mid_t mod_id, mid_t ue_id);
int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id);
/* Get measurement gap configuration offset if applicable */
int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id);
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 get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id);
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 get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id);
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 get_half_duplex(mid_t ue_id);
int flexran_get_half_duplex(mid_t ue_id);
/* Support of intra-subframe hopping.
Boolean value */
int get_intra_sf_hopping(mid_t ue_id);
int flexran_get_intra_sf_hopping(mid_t ue_id);
/* UE support for type 2 hopping with
n_sb>1 */
int get_type2_sb_1(mid_t ue_id);
int flexran_get_type2_sb_1(mid_t ue_id);
/* Get the UE category */
int get_ue_category(mid_t ue_id);
int flexran_get_ue_category(mid_t ue_id);
/* UE support for resource allocation
type 1 */
int get_res_alloc_type1(mid_t ue_id);
int flexran_get_res_alloc_type1(mid_t ue_id);
/* Get UE transmission mode */
int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id);
/* Boolean value. See TS 36.321 */
int get_tti_bundling(mid_t mod_id, mid_t ue_id);
int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id);
/* The max HARQ retransmission for UL.
See TS 36.321 */
int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id);
/* See TS 36.213 */
int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS36.213, Section 10.1 */
int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id);
/* Boolean. See TS 36.213, Section 8.2 */
int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id);
int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id);
/* Get aperiodic CQI report mode */
int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id);
/* Get ACK/NACK feedback mode. TDD only */
int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id);
int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id);
/* See TS36.213, section 10.1 */
int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id);
/* Boolean. Extended buffer status report size */
int get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
/* Get number of UE transmission antennas */
int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
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 get_lcg(mid_t ue_id, mid_t lc_id);
int flexran_get_lcg(mid_t ue_id, mid_t lc_id);
/* Get direction of logical channel with id lc_id */
int get_direction(mid_t ue_id, mid_t lc_id);
int flexran_get_direction(mid_t ue_id, mid_t lc_id);
/*******************
* timer primitves
......@@ -382,51 +382,51 @@ int get_direction(mid_t ue_id, mid_t lc_id);
/* Type of the callback executed when the timer expired */
typedef Protocol__FlexranMessage *(*enb_agent_timer_callback_t)(void*);
typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*);
typedef enum {
/* oneshot timer: */
ENB_AGENT_TIMER_TYPE_ONESHOT = 0x0,
FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0,
/* periodic timer */
ENB_AGENT_TIMER_TYPE_PERIODIC = 0x1,
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1,
/* Inactive state: initial state for any timer. */
ENB_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2,
FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2,
/* Max number of states available */
ENB_AGENT_TIMER_TYPE_MAX,
} eNB_agent_timer_type_t;
FLEXRAN_AGENT_TIMER_TYPE_MAX,
} flexran_agent_timer_type_t;
typedef enum {
/* Inactive state: initial state for any timer. */
ENB_AGENT_TIMER_STATE_INACTIVE = 0x0,
FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0,
/* Inactive state: initial state for any timer. */
ENB_AGENT_TIMER_STATE_ACTIVE = 0x1,
FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1,
/* Inactive state: initial state for any timer. */
ENB_AGENT_TIMER_STATE_STOPPED = 0x2,
FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2,
/* Max number of states available */
ENB_AGENT_TIMER_STATE_MAX,
} eNB_agent_timer_state_t;
FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;
typedef struct enb_agent_timer_args_s{
typedef struct flexran_agent_timer_args_s{
mid_t mod_id;
Protocol__FlexranMessage *msg;
} enb_agent_timer_args_t;
} flexran_agent_timer_args_t;
typedef struct enb_agent_timer_element_s{
RB_ENTRY(enb_agent_timer_element_s) entry;
typedef struct flexran_agent_timer_element_s{
RB_ENTRY(flexran_agent_timer_element_s) entry;
agent_id_t agent_id;
instance_t instance;
eNB_agent_timer_type_t type;
eNB_agent_timer_state_t state;
flexran_agent_timer_type_t type;
flexran_agent_timer_state_t state;
uint32_t interval_sec;
uint32_t interval_usec;
......@@ -435,59 +435,59 @@ typedef struct enb_agent_timer_element_s{
xid_t xid; /*The id of the task as received by the controller
message*/
enb_agent_timer_callback_t cb;
enb_agent_timer_args_t *timer_args;
flexran_agent_timer_callback_t cb;
flexran_agent_timer_args_t *timer_args;
} enb_agent_timer_element_t;
} flexran_agent_timer_element_t;
typedef struct enb_agent_timer_instance_s{
RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head;
}enb_agent_timer_instance_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 enb_agent_init_timer(void);
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 enb_agent_create_timer(uint32_t interval_sec,
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,
enb_agent_timer_callback_t cb,
flexran_agent_timer_callback_t cb,
void* timer_args,
long *timer_id);
/* Destroy all existing timers */
err_code_t enb_agent_destroy_timers(void);
err_code_t flexran_agent_destroy_timers(void);
/* Destroy the timer with the given timer_id */
err_code_t enb_agent_destroy_timer(long timer_id);
err_code_t flexran_agent_destroy_timer(long timer_id);
/* Destroy the timer for task with id xid */
err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid);
err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid);
/* Stop a timer */
err_code_t enb_agent_stop_timer(long timer_id);
err_code_t flexran_agent_stop_timer(long timer_id);
/* Restart the given timer */
err_code_t enb_agent_restart_timer(long *timer_id);
err_code_t flexran_agent_restart_timer(long *timer_id);
/* Find the timer with the given timer_id */
struct enb_agent_timer_element_s * get_timer_entry(long 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 * enb_agent_process_timeout(long timer_id, void* timer_args);
Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args);
/* Comparator function comparing two timers. Decides the ordering of the timers */
int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b);
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 enb_agent_sleep_until(struct timespec *ts, int delay);
void flexran_agent_sleep_until(struct timespec *ts, int delay);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer);
RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer);
#endif
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file enb_agent_common_internal.c
/*! \file flexran_agent_common_internal.c
* \brief internal functions for common message primitves and utilities
* \author Xenofon Foukas
* \date 2016
......@@ -37,8 +37,8 @@
#include <stdlib.h>
#include <string.h>
#include "enb_agent_common_internal.h"
#include "enb_agent_mac_internal.h"
#include "flexran_agent_common_internal.h"
#include "flexran_agent_mac_internal.h"
int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) {
......
......@@ -27,19 +27,19 @@
*******************************************************************************/
/*! \file enb_agent_common_internal.h
/*! \file flexran_agent_common_internal.h
* \brief internal agent functions for common message primitves and utilities
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_COMMON_INTERNAL_H_
#define ENB_AGENT_COMMON_INTERNAL_H_
#ifndef FLEXRAN_AGENT_COMMON_INTERNAL_H_
#define FLEXRAN_AGENT_COMMON_INTERNAL_H_
#include <yaml.h>
#include "enb_agent_defs.h"
#include "flexran_agent_defs.h"
int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length);
......
......@@ -27,14 +27,14 @@
*******************************************************************************/
/*! \file enb_agent_defs.h
* \brief enb agent common definitions
/*! \file flexran_agent_defs.h
* \brief FlexRAN agent common definitions
* \author Navid Nikaein and Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_DEFS_H_
#define ENB_AGENT_DEFS_H_
#ifndef FLEXRAN_AGENT_DEFS_H_
#define FLEXRAN_AGENT_DEFS_H_
#include <stdio.h>
#include <stdlib.h>
......@@ -45,54 +45,54 @@
#define NUM_MAX_ENB 2
#define NUM_MAX_UE 2048
#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_ENB_AGENT_PORT 2210
#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache"
#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1"
#define DEFAULT_FLEXRAN_AGENT_PORT 2210
#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache"
typedef enum {
ENB_AGENT_DEFAULT=0,
FLEXRAN_AGENT_DEFAULT=0,
ENB_AGENT_PHY=1,
ENB_AGENT_MAC=2,
ENB_AGENT_RLC=3,
ENB_AGENT_PDCP=4,
ENB_AGENT_RRC=5,
ENB_AGENT_S1AP=6,
ENB_AGENT_GTP=7,
ENB_AGENT_X2AP=8,
FLEXRAN_AGENT_PHY=1,
FLEXRAN_AGENT_MAC=2,
FLEXRAN_AGENT_RLC=3,
FLEXRAN_AGENT_PDCP=4,
FLEXRAN_AGENT_RRC=5,
FLEXRAN_AGENT_S1AP=6,
FLEXRAN_AGENT_GTP=7,
FLEXRAN_AGENT_X2AP=8,
ENB_AGENT_MAX=9,
FLEXRAN_AGENT_MAX=9,
} agent_id_t;
typedef enum {
/* no action */
ENB_AGENT_ACTION_NONE = 0x0,
FLEXRAN_AGENT_ACTION_NONE = 0x0,
/* send action */
ENB_AGENT_ACTION_SEND = 0x1,
FLEXRAN_AGENT_ACTION_SEND = 0x1,
/* apply action */
ENB_AGENT_ACTION_APPLY = 0x2,
FLEXRAN_AGENT_ACTION_APPLY = 0x2,
/* clear action */
ENB_AGENT_ACTION_CLEAR = 0x4,
FLEXRAN_AGENT_ACTION_CLEAR = 0x4,
/* write action */
ENB_AGENT_ACTION_WRITE = 0x8,
FLEXRAN_AGENT_ACTION_WRITE = 0x8,
/* filter action */
ENB_AGENT_ACTION_FILTER = 0x10,
FLEXRAN_AGENT_ACTION_FILTER = 0x10,
/* preprocess action */
ENB_AGENT_ACTION_PREPROCESS = 0x20,
FLEXRAN_AGENT_ACTION_PREPROCESS = 0x20,
/* meter action */
ENB_AGENT_ACTION_METER = 0x40,
FLEXRAN_AGENT_ACTION_METER = 0x40,
/* Max number of states available */
ENB_AGENT_ACTION_MAX = 0x7f,
FLEXRAN_AGENT_ACTION_MAX = 0x7f,
} agent_action_t;
......@@ -122,12 +122,12 @@ typedef struct {
uint32_t rx_msg[NUM_MAX_ENB];
uint32_t tx_msg[NUM_MAX_ENB];
}enb_agent_info_t;
} flexran_agent_info_t;
typedef struct {
mid_t enb_id;
enb_agent_info_t agent_info;
flexran_agent_info_t agent_info;
}enb_agent_instance_t;
} flexran_agent_instance_t;
#endif
......@@ -28,21 +28,21 @@
*******************************************************************************/
/*! \file ENB_APP/extern.h
* \brief enb agent - mac interface primitives
* \brief FlexRAN agent - mac interface primitives
* \author Xenofon Foukas
* \date 2016
* \version 0.1
* \mail x.foukas@sms.ed.ac.uk
*/
#ifndef __ENB_AGENT_EXTERN_H__
#define __ENB_AGENT_EXTERN_H__
#ifndef __FLEXRAN_AGENT_EXTERN_H__
#define __FLEXRAN_AGENT_EXTERN_H__
#include "enb_agent_defs.h"
#include "enb_agent_mac_defs.h"
#include "flexran_agent_defs.h"
#include "flexran_agent_mac_defs.h"
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX];
//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];
......
......@@ -27,61 +27,61 @@
*******************************************************************************/
/*! \file enb_agent_handler.c
* \brief enb agent tx and rx message handler
/*! \file flexran_agent_handler.c
* \brief FlexRAN agent tx and rx message handler
* \author Xenofon Foukas and Navid Nikaein
* \date 2016
* \version 0.1
*/
#include "enb_agent_common.h"
#include "enb_agent_mac.h"
#include "flexran_agent_common.h"
#include "flexran_agent_mac.h"
#include "log.h"
#include "assertions.h"
enb_agent_message_decoded_callback agent_messages_callback[][3] = {
{enb_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/
{enb_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
flexran_agent_message_decoded_callback agent_messages_callback[][3] = {
{flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/
{flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply
{enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
{flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/
{0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/
{enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/
{flexran_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/
{enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/
{flexran_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/
{enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/
{flexran_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/
{enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/
{flexran_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/
{0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/
{enb_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/
{enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_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*/
};
enb_agent_message_destruction_callback message_destruction_callback[] = {
enb_agent_destroy_hello,
enb_agent_destroy_echo_request,
enb_agent_destroy_echo_reply,
enb_agent_mac_destroy_stats_request,
enb_agent_mac_destroy_stats_reply,
enb_agent_mac_destroy_sf_trigger,
enb_agent_mac_destroy_sr_info,
enb_agent_destroy_enb_config_request,
enb_agent_destroy_enb_config_reply,
enb_agent_destroy_ue_config_request,
enb_agent_destroy_ue_config_reply,
enb_agent_destroy_lc_config_request,
enb_agent_destroy_lc_config_reply,
enb_agent_mac_destroy_dl_config,
enb_agent_destroy_ue_state_change,
enb_agent_destroy_control_delegation,
enb_agent_destroy_agent_reconfiguration,
flexran_agent_message_destruction_callback message_destruction_callback[] = {
flexran_agent_destroy_hello,
flexran_agent_destroy_echo_request,
flexran_agent_destroy_echo_reply,
flexran_agent_mac_destroy_stats_request,
flexran_agent_mac_destroy_stats_reply,
flexran_agent_mac_destroy_sf_trigger,
flexran_agent_mac_destroy_sr_info,
flexran_agent_destroy_enb_config_request,
flexran_agent_destroy_enb_config_reply,
flexran_agent_destroy_ue_config_request,
flexran_agent_destroy_ue_config_reply,
flexran_agent_destroy_lc_config_request,
flexran_agent_destroy_lc_config_reply,
flexran_agent_mac_destroy_dl_config,
flexran_agent_destroy_ue_state_change,
flexran_agent_destroy_control_delegation,
flexran_agent_destroy_agent_reconfiguration,
};
static const char *enb_agent_direction2String[] = {
static const char *flexran_agent_direction2String[] = {
"", /* not_set */
"originating message", /* originating message */
"successfull outcome", /* successfull outcome */
......@@ -89,7 +89,7 @@ static const char *enb_agent_direction2String[] = {
};
Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id,
Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id,
uint8_t *data,
uint32_t size){
......@@ -97,12 +97,12 @@ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id,
err_code_t err_code;
DevAssert(data != NULL);
if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) {
if (flexran_agent_deserialize_message(data, size, &decoded_message) < 0) {
err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING;
goto error;
}
if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_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)){
err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED;
goto error;
......@@ -123,20 +123,20 @@ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id,
return reply_message;
error:
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code);
return NULL;
}
void * enb_agent_pack_message(Protocol__FlexranMessage *msg,
void * flexran_agent_pack_message(Protocol__FlexranMessage *msg,
uint32_t * size){
void * buffer;
err_code_t err_code = PROTOCOL__FLEXRAN_ERR__NO_ERR;
if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) {
if (flexran_agent_serialize_message(msg, &buffer, size) < 0 ) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENCODING;
goto error;
}
......@@ -147,19 +147,19 @@ void * enb_agent_pack_message(Protocol__FlexranMessage *msg,
DevAssert(buffer !=NULL);
LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size);
LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size);
return buffer;
error :
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code);
return NULL;
}
Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) {
Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args) {
err_code_t err_code;
enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args;
flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args;
Protocol__FlexranMessage *timed_task, *reply_message;
timed_task = timer_args->msg;
......@@ -171,27 +171,27 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) {
return reply_message;
error:
LOG_E(ENB_AGENT,"errno %d occured\n",err_code);
LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code);
return NULL;
}
Protocol__FlexranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){
Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* timer_args){
struct enb_agent_timer_element_s *found = get_timer_entry(timer_id);
struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id);
if (found == NULL ) goto error;
LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id);
LOG_I(FLEXRAN_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id);
if (timer_args == NULL)
LOG_W(ENB_AGENT,"null timer args\n");
LOG_W(FLEXRAN_AGENT,"null timer args\n");
return found->cb(timer_args);
error:
LOG_E(ENB_AGENT, "can't get the timer element\n");
LOG_E(FLEXRAN_AGENT, "can't get the timer element\n");
return TIMER_ELEMENT_NOT_FOUND;
}
err_code_t enb_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));
}
......@@ -27,21 +27,21 @@
*******************************************************************************/
/*! \file enb_agent_mac.c
* \brief enb agent message handler for MAC layer
/*! \file flexran_agent_mac.c
* \brief FlexRAN agent message handler for MAC layer
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
* \date 2016
* \version 0.1
*/
#include "enb_agent_mac.h"
#include "enb_agent_extern.h"
#include "enb_agent_common.h"
#include "enb_agent_mac_internal.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_common.h"
#include "flexran_agent_mac_internal.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/enb_agent_mac_proto.h"
#include "LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
#include "LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h"
#include "liblfds700.h"
......@@ -61,7 +61,7 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB];
struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB];
int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){
int flexran_agent_mac_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
......@@ -97,8 +97,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
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*/
enb_agent_disable_cont_mac_stats_update(mod_id);
enb_agent_destroy_timer_by_task_id(xid);
flexran_agent_disable_cont_mac_stats_update(mod_id);
flexran_agent_destroy_timer_by_task_id(xid);
*msg = NULL;
return 0;
} else { //One-off, periodical or continuous reporting
......@@ -108,7 +108,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
//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 = get_num_ues(mod_id); //eNB_UE_list->num_UEs
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
......@@ -116,7 +116,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
goto error;
}
for (i = 0; i < report_config.nr_ue; i++) {
report_config.ue_report_type[i].ue_rnti = 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_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
......@@ -153,12 +153,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
report_config.ue_report_type[0].ue_report_flags = ue_flags;
}
request_config.config = &report_config;
enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg);
flexran_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg);
/* Create a timer */
long timer_id = 0;
enb_agent_timer_args_t *timer_args;
timer_args = malloc(sizeof(enb_agent_timer_args_t));
memset (timer_args, 0, sizeof(enb_agent_timer_args_t));
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*/
......@@ -169,11 +169,11 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
sec_interval = usec_interval/(1000*1000);
usec_interval = usec_interval%(1000*1000);
}
enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id);
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*/
enb_agent_disable_cont_mac_stats_update(mod_id);
flexran_agent_disable_cont_mac_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;
......@@ -191,7 +191,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
report_config.ue_report_type[0].ue_report_flags = ue_flags;
}
request_config.config = &report_config;
enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config);
flexran_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config);
}
}
break;
......@@ -236,7 +236,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
goto error;
}
if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){
if (flexran_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){
err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD;
goto error;
}
......@@ -247,18 +247,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr
return 0;
error :
LOG_E(ENB_AGENT, "errno %d occured\n", err_code);
LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code);
return err_code;
}
int enb_agent_mac_stats_request(mid_t mod_id,
int flexran_agent_mac_stats_request(mid_t mod_id,
xid_t xid,
const stats_request_config_t *report_config,
Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header;
int i;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0)
goto error;
Protocol__FlexStatsRequest *stats_request_msg;
......@@ -358,7 +358,7 @@ int enb_agent_mac_stats_request(mid_t mod_id,
return -1;
}
int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_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);
......@@ -377,7 +377,7 @@ int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) {
return -1;
}
int enb_agent_mac_stats_reply(mid_t mod_id,
int flexran_agent_mac_stats_reply(mid_t mod_id,
xid_t xid,
const report_config_t *report_config,
Protocol__FlexranMessage **msg) {
......@@ -389,7 +389,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
//UE_list_t *eNB_UE_list= &eNB->UE_list;
if (flex_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;
Protocol__FlexStatsReply *stats_reply_msg;
......@@ -429,14 +429,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
goto error;
for (j = 0; j++; j < ue_report[i]->n_bsr) {
// NN: we need to know the cc_id here, consider the first one
elem[j] = get_ue_bsr (enb_id, i, j);
elem[j] = flexran_get_ue_bsr (enb_id, i, j);
}
ue_report[i]->bsr = elem;
}
/* Check flag for creation of PRH report */
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) {
ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info;
ue_report[i]->phr = flexran_get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info;
ue_report[i]->has_phr = 1;
}
......@@ -456,7 +456,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
protocol__flex_rlc_bsr__init(rlc_reports[j]);
rlc_reports[j]->lc_id = j+1;
rlc_reports[j]->has_lc_id = 1;
rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1);
rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j+1);
rlc_reports[j]->has_tx_queue_size = 1;
//TODO:Set tx queue head of line delay in ms
......@@ -480,7 +480,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
/* Check flag for creation of MAC CE buffer status report */
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) {
// TODO: Fill in the actual MAC CE buffer status report
ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the
ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the
PROTOCOL__FLEX_CE_TYPE__FLPCET_ values
found in stats_common.pb-c.h. See
flex_ce_type in FlexRAN specification */
......@@ -496,10 +496,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
goto error;
protocol__flex_dl_cqi_report__init(dl_report);
dl_report->sfn_sn = get_sfn_sf(enb_id);
dl_report->sfn_sn = flexran_get_sfn_sf(enb_id);
dl_report->has_sfn_sn = 1;
//Set the number of DL CQI reports for this UE. One for each CC
dl_report->n_csi_report = get_active_CC(enb_id,i);
dl_report->n_csi_report = flexran_get_active_CC(enb_id,i);
//Create the actual CSI reports.
Protocol__FlexDlCsi **csi_reports;
......@@ -515,7 +515,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
csi_reports[j]->serv_cell_index = j;
csi_reports[j]->has_serv_cell_index = 1;
//The rank indicator value for this cc
csi_reports[j]->ri = get_current_RI(enb_id,i,j);
csi_reports[j]->ri = flexran_get_current_RI(enb_id,i,j);
csi_reports[j]->has_ri = 1;
//TODO: the type of CSI report based on the configuration of the UE
//For now we only support type P10, which only needs a wideband value
......@@ -532,7 +532,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
protocol__flex_csi_p10__init(csi10);
//TODO: set the wideband value
// NN: this is also depends on cc_id
csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi;
csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi;
csi10->has_wb_cqi = 1;
//Add the type of measurements to the csi report in the proper union type
csi_reports[j]->p10csi = csi10;
......@@ -618,7 +618,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
goto error;
protocol__flex_ul_cqi_report__init(full_ul_report);
//TODO:Set the SFN and SF of the generated report
full_ul_report->sfn_sn = get_sfn_sf(enb_id);
full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id);
full_ul_report->has_sfn_sn = 1;
//TODO:Set the number of UL measurement reports based on the types of measurements
//configured for this UE and on the servCellIndex
......@@ -664,8 +664,8 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]);
full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1;
full_ul_report->pucch_dbm[j]->serv_cell_index = j;
if(get_p0_pucch_dbm(enb_id,i, j) != -1){
full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j);
if(flexran_get_p0_pucch_dbm(enb_id,i, j) != -1){
full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j);
full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1;
}
}
......@@ -704,7 +704,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
goto error;
protocol__flex_noise_interference_report__init(ni_report);
// Current frame and subframe number
ni_report->sfn_sf = get_sfn_sf(enb_id);
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;
......@@ -713,7 +713,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
ni_report->tnp = 0;
ni_report->has_tnp = 0;
ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0);
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;
}
......@@ -743,7 +743,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id,
return -1;
}
int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) {
//TODO: Need to deallocate memory for the stats reply message
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG)
goto error;
......@@ -860,11 +860,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) {
return -1;
}
int enb_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) {
Protocol__FlexHeader *header;
int i;
const int xid = *((int *)params);
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0)
goto error;
Protocol__FlexUlSrInfo *ul_sr_info_msg;
......@@ -876,7 +876,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes
ul_sr_info_msg->header = header;
ul_sr_info_msg->has_sfn_sf = 1;
ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id);
ul_sr_info_msg->sfn_sf = flexran_get_sfn_sf(mod_id);
/*TODO: Set the number of UEs that sent an SR */
ul_sr_info_msg->n_rnti = 1;
ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t));
......@@ -912,7 +912,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes
return -1;
}
int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG)
goto error;
......@@ -927,11 +927,11 @@ int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) {
return -1;
}
int enb_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) {
Protocol__FlexHeader *header;
int i,j;
const int xid = *((int *)params);
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0)
goto error;
Protocol__FlexSfTrigger *sf_trigger_msg;
......@@ -946,8 +946,8 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
int ahead_of_time = 1;
frame = (frame_t) get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) get_current_subframe(mod_id);
frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
subframe = ((subframe + ahead_of_time) % 10);
......@@ -955,18 +955,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
frame = frame + full_frames_ahead;
if (subframe < get_current_subframe(mod_id)) {
if (subframe < flexran_get_current_subframe(mod_id)) {
frame++;
}
sf_trigger_msg->header = header;
sf_trigger_msg->has_sfn_sf = 1;
sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1);
sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 1);
/*TODO: Fill in the number of dl HARQ related info, based on the number of currently
*transmitting UEs
*/
sf_trigger_msg->n_dl_info = get_num_ues(mod_id);
sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id);
Protocol__FlexDlInfo **dl_info = NULL;
......@@ -980,12 +980,12 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
if(dl_info[i] == NULL)
goto error;
protocol__flex_dl_info__init(dl_info[i]);
dl_info[i]->rnti = get_ue_crnti(mod_id, i);
dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, i);
dl_info[i]->has_rnti = 1;
/*Fill in the right id of this round's HARQ process for this UE*/
int harq_id;
int harq_status;
get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
dl_info[i]->harq_process_id = harq_id;
dl_info[i]->has_harq_process_id = 1;
/* Fill in the status of the HARQ process (2 TBs)*/
......@@ -1009,7 +1009,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
/* Fill in the number of UL reception status related info, based on the number of currently
* transmitting UEs
*/
sf_trigger_msg->n_ul_info = get_num_ues(mod_id);
sf_trigger_msg->n_ul_info = flexran_get_num_ues(mod_id);
Protocol__FlexUlInfo **ul_info = NULL;
......@@ -1023,15 +1023,15 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
if(ul_info[i] == NULL)
goto error;
protocol__flex_ul_info__init(ul_info[i]);
ul_info[i]->rnti = get_ue_crnti(mod_id, i);
ul_info[i]->rnti = flexran_get_ue_crnti(mod_id, i);
ul_info[i]->has_rnti = 1;
/*Fill in the Tx power control command for this UE (if available)*/
if(get_tpc(mod_id,i) != 1){
ul_info[i]->tpc = get_tpc(mod_id,i);
if(flexran_get_tpc(mod_id,i) != 1){
ul_info[i]->tpc = flexran_get_tpc(mod_id,i);
ul_info[i]->has_tpc = 1;
}
else{
ul_info[i]->tpc = get_tpc(mod_id,i);
ul_info[i]->tpc = flexran_get_tpc(mod_id,i);
ul_info[i]->has_tpc = 0;
}
/*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the
......@@ -1081,7 +1081,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran
return -1;
}
int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) {
int i;
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG)
goto error;
......@@ -1107,11 +1107,11 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) {
return -1;
}
int enb_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 xid = 0;
Protocol__FlexHeader *header;
if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0)
if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0)
goto error;
Protocol__FlexDlMacConfig *dl_mac_config_msg;
......@@ -1123,7 +1123,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage
dl_mac_config_msg->header = header;
dl_mac_config_msg->has_sfn_sf = 1;
dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id);
dl_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id);
*msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL)
......@@ -1139,7 +1139,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage
return -1;
}
int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) {
int i,j, k;
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG)
goto error;
......@@ -1202,7 +1202,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) {
return -1;
}
void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) {
void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) {
struct lfds700_misc_prng_state ls;
......@@ -1214,7 +1214,7 @@ void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage
}
}
int enb_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) {
struct lfds700_misc_prng_state ls;
enum lfds700_misc_flag overwrite_occurred_flag;
......@@ -1233,7 +1233,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco
if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) {
// Delete unmanaged dl_config
enb_agent_mac_destroy_dl_config(overwritten_dl_config);
flexran_agent_mac_destroy_dl_config(overwritten_dl_config);
}
*msg = NULL;
return 2;
......@@ -1243,7 +1243,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco
return -1;
}
void enb_agent_init_mac_agent(mid_t mod_id) {
void flexran_agent_init_mac_agent(mid_t mod_id) {
lfds700_misc_library_init_valid_on_current_logical_core();
lfds700_misc_prng_init(&ps[mod_id]);
int num_elements = RINGBUFFER_SIZE + 1;
......@@ -1253,10 +1253,10 @@ void enb_agent_init_mac_agent(mid_t mod_id) {
}
/***********************************************
* eNB agent - technology mac API implementation
* FlexRAN agent - technology mac API implementation
***********************************************/
void enb_agent_send_sr_info(mid_t mod_id) {
void flexran_agent_send_sr_info(mid_t mod_id) {
int size;
Protocol__FlexranMessage *msg;
void *data;
......@@ -1266,27 +1266,27 @@ void enb_agent_send_sr_info(mid_t mod_id) {
int xid = 0;
/*TODO: Must use a proper xid*/
err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg);
err_code = flexran_agent_mac_sr_info(mod_id, (void *) &xid, &msg);
if (err_code < 0) {
goto error;
}
if (msg != NULL){
data=enb_agent_pack_message(msg, &size);
data=flexran_agent_pack_message(msg, &size);
/*Send sr info using the MAC channel of the eNB*/
if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) {
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
}
error:
LOG_D(ENB_AGENT, "Could not send sr message\n");
LOG_D(FLEXRAN_AGENT, "Could not send sr message\n");
}
void enb_agent_send_sf_trigger(mid_t mod_id) {
void flexran_agent_send_sf_trigger(mid_t mod_id) {
int size;
Protocol__FlexranMessage *msg;
void *data;
......@@ -1296,27 +1296,27 @@ void enb_agent_send_sf_trigger(mid_t mod_id) {
int xid = 0;
/*TODO: Must use a proper xid*/
err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg);
err_code = flexran_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg);
if (err_code < 0) {
goto error;
}
if (msg != NULL){
data=enb_agent_pack_message(msg, &size);
data=flexran_agent_pack_message(msg, &size);
/*Send sr info using the MAC channel of the eNB*/
if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) {
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
}
error:
LOG_D(ENB_AGENT, "Could not send sf trigger message\n");
LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
}
void enb_agent_send_update_mac_stats(mid_t mod_id) {
void flexran_agent_send_update_mac_stats(mid_t mod_id) {
Protocol__FlexranMessage *current_report = NULL, *msg;
void *data;
......@@ -1333,7 +1333,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) {
if (mac_stats_context[mod_id].cont_update == 1) {
/*Create a fresh report with the required flags*/
err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, &current_report);
err_code = flexran_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, &current_report);
if (err_code < 0) {
goto error;
}
......@@ -1343,10 +1343,10 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) {
/* *respecting the thresholds. Otherwise send the new report*\/ */
/* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */
/* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */
/* msg = flexran_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */
/* /\*Destroy the old stats*\/ */
/* enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */
/* flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */
/* } */
/* /\*Use the current report for future comparissons*\/ */
/* mac_stats_context[mod_id].prev_stats_reply = current_report; */
......@@ -1357,34 +1357,34 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) {
}
if (current_report != NULL){
data=enb_agent_pack_message(current_report, &size);
data=flexran_agent_pack_message(current_report, &size);
/*Send any stats updates using the MAC channel of the eNB*/
if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) {
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) {
err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size);
return;
}
error:
LOG_D(ENB_AGENT, "Could not send sf trigger message\n");
LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n");
}
int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
if (mac_agent_registered[mod_id]) {
LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id);
return -1;
}
//xface->agent_ctxt = &shared_ctxt[mod_id];
xface->enb_agent_send_sr_info = enb_agent_send_sr_info;
xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger;
xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats;
//xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default;
xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote;
xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config;
xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change;
xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info;
xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger;
xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats;
xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_default;
//xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_remote;
xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config;
xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change;
xface->dl_scheduler_loaded_lib = NULL;
......@@ -1394,15 +1394,15 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
return 0;
}
int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
//xface->agent_ctxt = NULL;
xface->enb_agent_send_sr_info = NULL;
xface->enb_agent_send_sf_trigger = NULL;
xface->enb_agent_send_update_mac_stats = NULL;
xface->enb_agent_schedule_ue_spec = NULL;
xface->enb_agent_get_pending_dl_mac_config = NULL;
xface->enb_agent_notify_ue_state_change = NULL;
xface->flexran_agent_send_sr_info = NULL;
xface->flexran_agent_send_sf_trigger = NULL;
xface->flexran_agent_send_update_mac_stats = NULL;
xface->flexran_agent_schedule_ue_spec = NULL;
xface->flexran_agent_get_pending_dl_mac_config = NULL;
xface->flexran_agent_notify_ue_state_change = NULL;
xface->dl_scheduler_loaded_lib = NULL;
......@@ -1414,10 +1414,10 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) {
/******************************************************
*Implementations of enb_agent_mac_internal.h functions
*Implementations of flexran_agent_mac_internal.h functions
******************************************************/
err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) {
err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id) {
/*Initialize the Mac stats update structure*/
/*Initially the continuous update is set to false*/
......@@ -1437,12 +1437,12 @@ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) {
return -1;
}
err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) {
err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id) {
/*Disable the continuous updates for the MAC*/
mac_stats_context[mod_id].cont_update = 0;
mac_stats_context[mod_id].is_initialized = 0;
enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
free(mac_stats_context[mod_id].mutex);
mac_agent_registered[mod_id] = NULL;
......@@ -1450,7 +1450,7 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) {
}
err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id,
err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id,
xid_t xid, stats_request_config_t *stats_req) {
/*Enable the continuous updates for the MAC*/
if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) {
......@@ -1459,7 +1459,7 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id,
Protocol__FlexranMessage *req_msg;
enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg);
flexran_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg);
mac_stats_context[mod_id].stats_req = req_msg;
mac_stats_context[mod_id].prev_stats_reply = NULL;
......@@ -1472,11 +1472,11 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id,
return 0;
error:
LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
return -1;
}
err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) {
err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id) {
/*Disable the continuous updates for the MAC*/
if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) {
goto error;
......@@ -1484,10 +1484,10 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) {
mac_stats_context[mod_id].cont_update = 0;
mac_stats_context[mod_id].xid = 0;
if (mac_stats_context[mod_id].stats_req != NULL) {
enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req);
}
if (mac_stats_context[mod_id].prev_stats_reply != NULL) {
enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply);
}
if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) {
goto error;
......@@ -1495,7 +1495,7 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) {
return 0;
error:
LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id);
return -1;
}
......@@ -27,23 +27,23 @@
*******************************************************************************/
/*! \file enb_agent_mac.h
* \brief enb agent message handler APIs for MAC layer
/*! \file flexran_agent_mac.h
* \brief FlexRAN agent message handler APIs for MAC layer
* \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_MAC_H_
#define ENB_AGENT_MAC_H_
#ifndef FLEXRAN_AGENT_MAC_H_
#define FLEXRAN_AGENT_MAC_H_
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "stats_messages.pb-c.h"
#include "stats_common.pb-c.h"
#include "enb_agent_common.h"
#include "enb_agent_extern.h"
#include "flexran_agent_common.h"
#include "flexran_agent_extern.h"
/* These types will be used to give
instructions for the type of stats reports
......@@ -77,54 +77,54 @@ typedef struct stats_request_config_s{
} stats_request_config_t;
/* Initialization function for the agent structures etc */
void enb_agent_init_mac_agent(mid_t mod_id);
void flexran_agent_init_mac_agent(mid_t mod_id);
int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
/* Statistics request protocol message constructor and destructor */
int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg);
int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg);
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 enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg);
int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg);
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 */
int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_mac_destroy_sr_info(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);
/* Subframe trigger protocol msssage constructor and destructor */
int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int enb_agent_mac_destroy_sf_trigger(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);
/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */
int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg);
int enb_agent_mac_destroy_dl_config(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 enb_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);
/**********************************
* eNB agent - technology mac API
* FlexRAN agent - technology mac API
**********************************/
/*Inform controller about received scheduling requests during a subframe*/
void enb_agent_send_sr_info(mid_t mod_id);
void flexran_agent_send_sr_info(mid_t mod_id);
/*Inform the controller about the current UL/DL subframe*/
void enb_agent_send_sf_trigger(mid_t mod_id);
void flexran_agent_send_sf_trigger(mid_t mod_id);
/// Send to the controller all the mac stat updates that occured during this subframe
/// based on the stats request configuration
void enb_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
void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg);
void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg);
/*Register technology specific interface callbacks*/
int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface);
int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface);
/*Unregister technology specific callbacks*/
int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface);
int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface);
#endif
......@@ -27,51 +27,51 @@
*******************************************************************************/
/*! \file enb_agent_mac_defs.h
* \brief enb agent - mac interface primitives
/*! \file flexran_agent_mac_defs.h
* \brief FlexRAN agent - mac interface primitives
* \author Xenofon Foukas
* \date 2016
* \version 0.1
* \mail x.foukas@sms.ed.ac.uk
*/
#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__
#define __ENB_AGENT_MAC_PRIMITIVES_H__
#ifndef __FLEXRAN_AGENT_MAC_PRIMITIVES_H__
#define __FLEXRAN_AGENT_MAC_PRIMITIVES_H__
#include "enb_agent_defs.h"
#include "flexran_agent_defs.h"
#include "flexran.pb-c.h"
#include "header.pb-c.h"
#define RINGBUFFER_SIZE 100
/* ENB AGENT-MAC Interface */
/* FLEXRAN AGENT-MAC Interface */
typedef struct {
//msg_context_t *agent_ctxt;
/// Inform the controller about the scheduling requests received during the subframe
void (*enb_agent_send_sr_info)(mid_t mod_id);
void (*flexran_agent_send_sr_info)(mid_t mod_id);
/// Inform the controller about the current UL/DL subframe
void (*enb_agent_send_sf_trigger)(mid_t mod_id);
void (*flexran_agent_send_sf_trigger)(mid_t mod_id);
/// Send to the controller all the mac stat updates that occured during this subframe
/// based on the stats request configuration
void (*enb_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
void (*enb_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);
/// 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 (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe,
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
/// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER)
void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti,
uint32_t state_change);
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file enb_agent_mac_internal.c
/*! \file flexran_agent_mac_internal.c
* \brief Helper functions for the MAC agent
* \author Xenofon Foukas
* \date 2016
......@@ -37,9 +37,9 @@
#include <string.h>
#include <dlfcn.h>
#include "enb_agent_mac_internal.h"
#include "flexran_agent_mac_internal.h"
Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message,
Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message,
Protocol__FlexranMessage *old_message) {
int i, j;
......@@ -131,7 +131,7 @@ Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Fl
/*Create header*/
int xid = old_report->header->xid;
Protocol__FlexHeader *header;
if (flex_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;
}
stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply));
......@@ -780,7 +780,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
void *loaded_scheduler = dlsym(lib, function_name);
if (loaded_scheduler) {
if (mac_agent_registered[mod_id]) {
agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler;
agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler;
if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) {
dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib);
}
......
......@@ -27,23 +27,23 @@
*******************************************************************************/
/*! \file enb_agent_mac_internal.h
* \brief Implementation specific definitions for the eNB MAC agent
/*! \file flexran_agent_mac_internal.h
* \brief Implementation specific definitions for the FlexRAN MAC agent
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_MAC_INTERNAL_H_
#define ENB_AGENT_MAC_INTERNAL_H_
#ifndef FLEXRAN_AGENT_MAC_INTERNAL_H_
#define FLEXRAN_AGENT_MAC_INTERNAL_H_
#include <pthread.h>
#include <yaml.h>
#include "enb_agent_mac.h"
#include "enb_agent_common.h"
#include "enb_agent_defs.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_common.h"
#include "flexran_agent_defs.h"
/*This will be used for producing continuous status updates for the MAC
*Needs to be thread-safe
......@@ -64,18 +64,18 @@ mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB];
/*Functions to initialize and destroy the struct required for the
*continuous stats update report*/
err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id);
err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id);
err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id);
err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id);
/*Enable/Disable the continuous stats update service for the MAC*/
err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid,
err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid,
stats_request_config_t *stats_req);
err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id);
err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id);
Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report,
Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report,
Protocol__FlexranMessage *old_report);
Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original);
......@@ -111,4 +111,4 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser);
int load_dl_scheduler_function(mid_t mod_id, const char *function_name);
#endif /*ENB_AGENT_MAC_INTERNAL_H_*/
#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/
......@@ -27,26 +27,26 @@
*******************************************************************************/
/*! \file enb_agent_net_comm.c
* \brief enb agent network interface abstraction
/*! \file flexran_agent_net_comm.c
* \brief FlexRAN agent network interface abstraction
* \author Xenofon Foukas
* \date 2016
* \version 0.1
*/
#include "enb_agent_net_comm.h"
#include "flexran_agent_net_comm.h"
#include "log.h"
enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX];
enb_agent_channel_instance_t channel_instance;
int enb_agent_channel_id = 0;
flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX];
flexran_agent_channel_instance_t channel_instance;
int flexran_agent_channel_id = 0;
int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) {
int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) {
goto error;
}
enb_agent_channel_t *channel;
flexran_agent_channel_t *channel;
channel = agent_channel[mod_id][agent_id];
/*Check if agent has a channel registered*/
......@@ -57,16 +57,16 @@ int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size,
return channel->msg_send(data, size, priority, channel->channel_info);
error:
LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id);
LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id);
return -1;
}
int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) {
int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) {
/*Check if agent id is valid*/
if (agent_id >= ENB_AGENT_MAX || agent_id < 0) {
if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) {
goto error;
}
enb_agent_channel_t *channel;
flexran_agent_channel_t *channel;
channel = agent_channel[mod_id][agent_id];
/*Check if agent has a channel registered*/
......@@ -77,19 +77,19 @@ int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size
return channel->msg_recv(data, size, priority, channel->channel_info);
error:
LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id);
LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id);
return -1;
}
int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) {
int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id) {
int i;
if (channel == NULL) {
return -1;
}
if (agent_id == ENB_AGENT_MAX) {
for (i = 0; i < ENB_AGENT_MAX; i++) {
if (agent_id == FLEXRAN_AGENT_MAX) {
for (i = 0; i < FLEXRAN_AGENT_MAX; i++) {
agent_channel[mod_id][i] = channel;
}
} else {
......@@ -98,11 +98,11 @@ int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent
return 0;
}
void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) {
void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) {
int i;
if (agent_id == ENB_AGENT_MAX) {
for (i = 0; i < ENB_AGENT_MAX; i++) {
if (agent_id == FLEXRAN_AGENT_MAX) {
for (i = 0; i < FLEXRAN_AGENT_MAX; i++) {
agent_channel[mod_id][i] = NULL;
}
} else {
......@@ -110,13 +110,13 @@ void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) {
}
}
int enb_agent_create_channel(void *channel_info,
int flexran_agent_create_channel(void *channel_info,
int (*msg_send)(void *data, int size, int priority, void *channel_info),
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info),
void (*release)(enb_agent_channel_t *channel)) {
void (*release)(flexran_agent_channel_t *channel)) {
int channel_id = ++enb_agent_channel_id;
enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_agent_channel_t));
int channel_id = ++flexran_agent_channel_id;
flexran_agent_channel_t *channel = (flexran_agent_channel_t *) malloc(sizeof(flexran_agent_channel_t));
channel->channel_id = channel_id;
channel->channel_info = channel_info;
channel->msg_send = msg_send;
......@@ -124,22 +124,22 @@ int enb_agent_create_channel(void *channel_info,
channel->release = release;
/*element should be a real pointer*/
RB_INSERT(enb_agent_channel_map, &channel_instance.enb_agent_head, channel);
RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel);
LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id);
return channel_id;
}
int enb_agent_destroy_channel(int channel_id) {
int flexran_agent_destroy_channel(int channel_id) {
int i, j;
/*Check to see if channel exists*/
struct enb_agent_channel_s *e = NULL;
struct enb_agent_channel_s search;
memset(&search, 0, sizeof(struct enb_agent_channel_s));
struct flexran_agent_channel_s *e = NULL;
struct flexran_agent_channel_s search;
memset(&search, 0, sizeof(struct flexran_agent_channel_s));
e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search);
e = RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search);
if (e == NULL) {
return -1;
......@@ -147,7 +147,7 @@ int enb_agent_destroy_channel(int channel_id) {
/*Unregister the channel from all agents*/
for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
if (agent_channel[i][j] != NULL) {
if (agent_channel[i][j]->channel_id == e->channel_id) {
agent_channel[i][j] == NULL;
......@@ -157,21 +157,21 @@ int enb_agent_destroy_channel(int channel_id) {
}
/*Remove the channel from the tree and free memory*/
RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e);
RB_REMOVE(flexran_agent_channel_map, &channel_instance.flexran_agent_head, e);
e->release(e);
free(e);
return 0;
}
err_code_t enb_agent_init_channel_container(void) {
err_code_t flexran_agent_init_channel_container(void) {
int i, j;
LOG_I(ENB_AGENT, "init RB tree for channel container\n");
LOG_I(FLEXRAN_AGENT, "init RB tree for channel container\n");
RB_INIT(&channel_instance.enb_agent_head);
RB_INIT(&channel_instance.flexran_agent_head);
for (i = 0; i < NUM_MAX_ENB; i++) {
for (j = 0; j < ENB_AGENT_MAX; j++) {
for (j = 0; j < FLEXRAN_AGENT_MAX; j++) {
agent_channel[i][j] == NULL;
}
}
......@@ -179,9 +179,9 @@ err_code_t enb_agent_init_channel_container(void) {
return 0;
}
RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel);
RB_GENERATE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel);
int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b) {
int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b) {
if (a->channel_id < b->channel_id) return -1;
if (a->channel_id > b->channel_id) return 1;
......@@ -189,12 +189,12 @@ int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_ch
return 0;
}
enb_agent_channel_t * get_channel(int channel_id) {
flexran_agent_channel_t * get_channel(int channel_id) {
struct enb_agent_channel_s search;
memset(&search, 0, sizeof(struct enb_agent_channel_s));
struct flexran_agent_channel_s search;
memset(&search, 0, sizeof(struct flexran_agent_channel_s));
search.channel_id = channel_id;
return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search);
return RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search);
}
......@@ -27,63 +27,63 @@
*******************************************************************************/
/*! \file enb_agent_net_comm.h
* \brief enb agent network interface abstraction
/*! \file flexran_agent_net_comm.h
* \brief FlexRAN agent network interface abstraction
* \autho Xenofon Foukas
* \date 2016
* \version 0.1
*/
#ifndef ENB_AGENT_NET_COMM_H_
#define ENB_AGENT_NET_COMM_H_
#ifndef FLEXRAN_AGENT_NET_COMM_H_
#define FLEXRAN_AGENT_NET_COMM_H_
#include "enb_agent_defs.h"
#include "flexran_agent_defs.h"
#include "tree.h"
/*Channel related information used for Tx/Rx of protocol messages*/
typedef struct enb_agent_channel_s {
RB_ENTRY(enb_agent_channel_s) entry;
typedef struct flexran_agent_channel_s {
RB_ENTRY(flexran_agent_channel_s) entry;
int channel_id;
void *channel_info;
/*Callbacks for channel message Tx and Rx*/
int (*msg_send)(void *data, int size, int priority, void *channel_info);
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info);
void (*release)(struct enb_agent_channel_s *channel);
} enb_agent_channel_t;
void (*release)(struct flexran_agent_channel_s *channel);
} flexran_agent_channel_t;
typedef struct enb_agent_channel_instance_s{
RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head;
} enb_agent_channel_instance_t;
typedef struct flexran_agent_channel_instance_s{
RB_HEAD(flexran_agent_channel_map, flexran_agent_channel_s) flexran_agent_head;
} flexran_agent_channel_instance_t;
/*Send and receive messages using the channel registered for a specific agent*/
int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority);
int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority);
int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority);
int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority);
/*Register a channel to an agent. Use ENB_AGENT_MAX to register the
/*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the
*same channel to all agents*/
int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id);
int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id);
/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/
void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id);
/*Unregister the current channel of an agent. Use FLEXRAN_AGENT_MAX to unregister all channels*/
void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id);
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
int enb_agent_create_channel(void *channel_info,
int flexran_agent_create_channel(void *channel_info,
int (*msg_send)(void *data, int size, int priority, void *channel_info),
int (*msg_recv)(void **data, int *size, int *priority, void *channel_info),
void (*release)(enb_agent_channel_t *channel));
void (*release)(flexran_agent_channel_t *channel));
/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
int enb_agent_destroy_channel(int channel_id);
int flexran_agent_destroy_channel(int channel_id);
/*Return an agent communication channel based on its id*/
enb_agent_channel_t * get_channel(int channel_id);
flexran_agent_channel_t * get_channel(int channel_id);
/*Should be called before performing any channel operations*/
err_code_t enb_agent_init_channel_container(void);
err_code_t flexran_agent_init_channel_container(void);
int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b);
int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel);
RB_PROTOTYPE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel);
#endif /*ENB_AGENT_COMM_H_*/
#endif /*FLEXRAN_AGENT_COMM_H_*/
......@@ -26,8 +26,8 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file enb_agent_task_manager.h
* \brief Implementation of scheduled tasks manager for the enb agent
/*! \file flexran_agent_task_manager.h
* \brief Implementation of scheduled tasks manager for the FlexRAN agent
* \author Xenofon Foukas
* \date January 2016
* \version 0.1
......@@ -39,8 +39,8 @@
#include <string.h>
#include <stdio.h>
#include "enb_agent_task_manager.h"
#include "enb_agent_common.c"
#include "flexran_agent_task_manager.h"
#include "flexran_agent_common.c"
/* Util macros */
......@@ -48,10 +48,10 @@
#define RIGHT(x) (2 * (x) + 2)
#define PARENT(x) ((x - 1) / 2)
enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg,
flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg,
uint16_t frame_num, uint8_t subframe_num) {
enb_agent_task_t *task = NULL;
task = malloc(sizeof(enb_agent_task_t));
flexran_agent_task_t *task = NULL;
task = malloc(sizeof(flexran_agent_task_t));
if (task == NULL)
goto error;
......@@ -66,7 +66,7 @@ enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg,
return NULL;
}
void enb_agent_task_destroy(enb_agent_task_t *task) {
void flexran_agent_task_destroy(flexran_agent_task_t *task) {
if (task == NULL)
return;
......@@ -75,17 +75,18 @@ void enb_agent_task_destroy(enb_agent_task_t *task) {
free(task);
}
enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity,
int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)) {
enb_agent_task_queue_t *queue = NULL;
flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity,
int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1,
const flexran_agent_task_t *t2)) {
flexran_agent_task_queue_t *queue = NULL;
queue = malloc(sizeof(enb_agent_task_queue_t));
queue = malloc(sizeof(flexran_agent_task_queue_t));
if (queue == NULL)
goto error;
/* If no comparator was given, use the default one */
if (cmp == NULL)
queue->cmp = _enb_agent_task_queue_cmp;
queue->cmp = _flexran_agent_task_queue_cmp;
else
queue->cmp = cmp;
......@@ -94,7 +95,7 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity,
queue->first_frame = 0;
queue->first_subframe = 0;
queue->task = malloc(capacity * sizeof(enb_agent_task_t *));
queue->task = malloc(capacity * sizeof(flexran_agent_task_t *));
if (queue->task == NULL)
goto error;
......@@ -118,27 +119,27 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity,
return NULL;
}
enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id) {
return enb_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL);
flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id) {
return flexran_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL);
}
void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) {
void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue) {
int i;
if (queue == NULL)
return;
for (i = 0; i < queue->count; i++) {
enb_agent_task_destroy(queue->task[i]);
flexran_agent_task_destroy(queue->task[i]);
}
free(queue->task);
free(queue->mutex);
free(queue);
}
int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task) {
int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task) {
size_t i;
enb_agent_task_t *tmp = NULL;
flexran_agent_task_t *tmp = NULL;
int realloc_status, err_code;
if (pthread_mutex_lock(queue->mutex)) {
......@@ -149,7 +150,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta
if (queue->count >= queue->capacity) {
/*TODO: need to call realloc heap*/
realloc_status = _enb_agent_task_queue_realloc_heap(queue);
realloc_status = _flexran_agent_task_queue_realloc_heap(queue);
if (realloc_status != HEAP_OK) {
err_code = realloc_status;
goto error;
......@@ -179,7 +180,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta
}
int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) {
int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task) {
int err_code;
if (pthread_mutex_lock(queue->mutex)) {
......@@ -195,8 +196,8 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age
}
/* Find current frame and subframe number */
uint16_t curr_frame=get_current_frame(queue->mod_id);
uint8_t curr_subframe=get_current_subframe(queue->mod_id);
uint16_t curr_frame = flexran_get_current_frame(queue->mod_id);
uint8_t curr_subframe = flexran_get_current_subframe(queue->mod_id);
/* If no task is scheduled for the current subframe, return without any task */
if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) {
......@@ -208,7 +209,7 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age
queue->task[0] = queue->task[queue->count-1];
queue->count--;
/* Restore heap property */
_enb_agent_task_queue_heapify(queue, 0);
_flexran_agent_task_queue_heapify(queue, 0);
/*If queue has no element*/
if (queue->count < 1) {
......@@ -231,9 +232,9 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age
}
/*Warning: Internal function. Should not be called as API function. Not thread safe*/
void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) {
void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx) {
/* left index, right index, largest */
enb_agent_task_t *tmp = NULL;
flexran_agent_task_t *tmp = NULL;
size_t l_idx, r_idx, lrg_idx;
l_idx = LEFT(idx);
......@@ -258,32 +259,32 @@ void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) {
queue->task[lrg_idx] = queue->task[idx];
queue->task[idx] = tmp;
/* Heapify again */
_enb_agent_task_queue_heapify(queue, lrg_idx);
_flexran_agent_task_queue_heapify(queue, lrg_idx);
}
}
/*Warning: Internal function. Should not be called as API function. Not thread safe*/
int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) {
enb_agent_task_t **resized_task_heap;
int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue) {
flexran_agent_task_t **resized_task_heap;
if (queue->count >= queue->capacity) {
size_t task_size = sizeof(enb_agent_task_t);
size_t task_size = sizeof(flexran_agent_task_t);
resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size);
if (resized_task_heap != NULL) {
queue->capacity *= 2;
queue->task = (enb_agent_task_t **) resized_task_heap;
queue->task = (flexran_agent_task_t **) resized_task_heap;
return HEAP_OK;
} else return HEAP_REALLOCERROR;
}
return HEAP_NOREALLOC;
}
int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2) {
int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2) {
if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num))
return 0;
uint16_t curr_frame = get_current_frame(mod_id);
uint8_t curr_subframe = get_current_subframe(mod_id);
uint16_t curr_frame = flexran_get_current_frame(mod_id);
uint8_t curr_subframe = flexran_get_current_subframe(mod_id);
int f_offset, sf_offset, tmp1, tmp2;
......
......@@ -26,8 +26,8 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file enb_agent_task_manager.h
* \brief Implementation of scheduled tasks manager for the enb agent
/*! \file flexran_agent_task_manager.h
* \brief Implementation of scheduled tasks manager for the FlexRAN agent
* \author Xenofon Foukas
* \date January 2016
* \version 0.1
......@@ -35,15 +35,15 @@
* @ingroup _mac
*/
#ifndef ENB_AGENT_TASK_MANAGER_
#define ENB_AGENT_TASK_MANAGER_
#ifndef FLEXRAN_AGENT_TASK_MANAGER_
#define FLEXRAN_AGENT_TASK_MANAGER_
#include <stdint.h>
#include <pthread.h>
#include "flexran.pb-c.h"
#include "enb_agent_common.h"
#include "flexran_agent_common.h"
#ifdef __cplusplus
extern "C" {
......@@ -54,19 +54,19 @@ extern "C" {
/**
* The structure containing the enb agent task to be executed
*/
typedef struct enb_agent_task_s {
typedef struct flexran_agent_task_s {
/* The frame in which the task needs to be executed */
uint16_t frame_num;
/* The subframe in which the task needs to be executed */
uint8_t subframe_num;
/* The task to be executed in the form of a Protocol__FlexranMessage */
Protocol__FlexranMessage *task;
} enb_agent_task_t;
} flexran_agent_task_t;
/**
* Priority Queue Structure for tasks
*/
typedef struct enb_agent_task_queue_s {
typedef struct flexran_agent_task_queue_s {
mid_t mod_id;
/* The amount of allocated memory for agent tasks in the heap*/
volatile size_t capacity;
......@@ -77,11 +77,11 @@ typedef struct enb_agent_task_queue_s {
/* The earliest subframe within the frame that has a pending task */
volatile uint8_t first_subframe;
/* An array of prioritized tasks stored in a heap */
enb_agent_task_t **task;
flexran_agent_task_t **task;
/* A pointer to a comparator function, used to prioritize elements */
int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2);
int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2);
pthread_mutex_t *mutex;
} enb_agent_task_queue_t;
} flexran_agent_task_queue_t;
typedef enum {
HEAP_OK = 0,
......@@ -95,56 +95,57 @@ typedef enum {
/**
* Allocate memory for a task in the queue
*/
enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg,
flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg,
uint16_t frame_num, uint8_t subframe_num);
/**
* Free memory for a task of the queue
*/
void enb_agent_task_destroy(enb_agent_task_t *task);
void flexran_agent_task_destroy(flexran_agent_task_t *task);
/**
* Allocate initial memory for storing the tasks
*/
enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity,
int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2));
flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity,
int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1,
const flexran_agent_task_t *t2));
/**
* Allocate initial memory for storing the tasks using default parameters
*/
enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id);
flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id);
/**
* De-allocate memory for the tasks queue
*/
void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue);
void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue);
/**
* Insert task into the queue
*/
int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task);
int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task);
/**
* Remove the task with the highest priority from the queue
* task becomes NULL if there is no task for the current frame and subframe
*/
int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task);
int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task);
/**
* Check if the top priority task is for a specific frame and subframe
*/
int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue,
int flexran_agent_task_queue_has_upcoming_task (flexran_agent_task_queue_t *queue,
const uint16_t frame, const uint8_t subframe);
/**
* Restructure heap after modifications
*/
void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx);
void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx);
/**
* Reallocate memory once the heap reaches max size
*/
int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue);
int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue);
/**
* Compare two agent tasks based on frame and subframe
......@@ -153,10 +154,10 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue);
* return positive value if t1 preceeds t2
* Need to give eNB id for the comparisson based on the current frame-subframe
*/
int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2);
int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2);
#ifdef __cplusplus
}
#endif
#endif /*ENB_AGENT_TASK_MANAGER_*/
#endif /*FLEXRAN_AGENT_TASK_MANAGER_*/
......@@ -53,9 +53,9 @@
#include "pdcp.h"
//Agent-related headers
#include "enb_agent_extern.h"
#include "enb_agent_mac.h"
#include "enb_agent_mac_proto.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_mac_proto.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
......@@ -141,7 +141,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
//mac_remove_ue(module_idP, i, frameP, subframeP);
//Inform the controller about the UE deactivation. Should be moved to RRC agent in the future
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP,
agent_mac_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP,
rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
}
......@@ -330,7 +330,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
/* #ifndef DISABLE_SF_TRIGGER */
/* //Send subframe trigger to the controller */
/* if (mac_agent_registered[module_idP]) { */
/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */
/* agent_mac_xface[module_idP]->flexran_agent_send_sf_trigger(module_idP); */
/* } */
/* #endif */
......@@ -392,19 +392,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -440,19 +440,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -470,19 +470,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -506,19 +506,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -534,19 +534,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -577,19 +577,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -606,19 +606,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -642,19 +642,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
} else if ((mac_xface->frame_parms->tdd_config == 0) || // TDD Config 0
......@@ -669,19 +669,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -721,19 +721,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -745,19 +745,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -772,19 +772,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -805,19 +805,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -828,19 +828,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -855,19 +855,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -893,19 +893,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -920,19 +920,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -952,19 +952,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -977,19 +977,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -1002,19 +1002,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -1027,19 +1027,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
break;
......@@ -1054,19 +1054,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status);
#else
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec(
agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec(
module_idP,
frameP,
subframeP,
mbsfn_status,
&msg);
apply_dl_scheduling_decisions(module_idP,
flexran_apply_dl_scheduling_decisions(module_idP,
frameP,
subframeP,
mbsfn_status,
msg);
enb_agent_mac_destroy_dl_config(msg);
flexran_agent_mac_destroy_dl_config(msg);
}
#endif
}
......@@ -1084,7 +1084,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
#ifndef DISABLE_CONT_STATS
//Send subframe trigger to the controller
if (mac_agent_registered[module_idP]) {
agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP);
agent_mac_xface[module_idP]->flexran_agent_send_update_mac_stats(module_idP);
}
#endif
......
......@@ -27,8 +27,8 @@
*******************************************************************************/
/*! \file enb_agent_mac_proto.h
* \brief MAC functions for eNB agent
/*! \file flexran_agent_mac_proto.h
* \brief MAC functions for FlexRAN agent
* \author Xenofon Foukas
* \date 2016
* \email: x.foukas@sms.ed.ac.uk
......@@ -37,34 +37,34 @@
*/
#ifndef __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__
#define __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__
#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__
#include "enb_agent_defs.h"
#include "flexran_agent_defs.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
/*
* Default scheduler used by the eNB agent
*/
void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe,
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 apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag,
void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag,
const Protocol__FlexranMessage *dl_scheduling_info);
/*
* Data plane function for applying the UE specific DL decisions of the scheduler
*/
void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag,
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, const Protocol__FlexDlData **dl_ue_data);
/*
* Data plane function for filling the DCI structure
*/
void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci);
void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci);
#endif
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file eNB_agent_scheduler_dataplane.c
/*! \file flexran_agent_scheduler_dataplane.c
* \brief data plane procedures related to eNB scheduling
* \author Xenofon Foukas
* \date 2016
......@@ -44,7 +44,7 @@
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "LAYER2/MAC/enb_agent_mac_proto.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/extern.h"
......@@ -65,7 +65,7 @@
#include "SIMULATION/TOOLS/defs.h" // for taus
void apply_dl_scheduling_decisions(mid_t mod_id,
void flexran_apply_dl_scheduling_decisions(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
......@@ -85,14 +85,14 @@ void apply_dl_scheduling_decisions(mid_t mod_id,
// Check if there is anything to schedule for the UEs
if (mac_config->n_dl_ue_data > 0) {
apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag,
flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag,
mac_config->n_dl_ue_data, mac_config->dl_ue_data);
}
}
void apply_ue_spec_scheduling_decisions(mid_t mod_id,
void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file eNB_agent_scheduler_dlsch_ue.c
/*! \file flexran_agent_scheduler_dlsch_ue.c
* \brief procedures related to eNB for the DLSCH transport channel
* \author Xenofon Foukas
* \date 2016
......@@ -44,7 +44,7 @@
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "LAYER2/MAC/enb_agent_mac_proto.h"
#include "LAYER2/MAC/flexran_agent_mac_proto.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/extern.h"
......@@ -57,14 +57,14 @@
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "ENB_APP/enb_agent_defs.h"
#include "ENB_APP/flexran_agent_defs.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#include "header.pb-c.h"
#include "flexran.pb-c.h"
#include "enb_agent_mac.h"
#include "flexran_agent_mac.h"
#include "SIMULATION/TOOLS/defs.h" // for taus
......@@ -76,13 +76,11 @@
//------------------------------------------------------------------------------
void
schedule_ue_spec_default(
mid_t mod_id,
flexran_schedule_ue_spec_default(mid_t mod_id,
uint32_t frame,
uint32_t subframe,
int *mbsfn_flag,
Protocol__FlexranMessage **dl_info
)
Protocol__FlexranMessage **dl_info)
//------------------------------------------------------------------------------
{
uint8_t CC_id;
......@@ -127,7 +125,7 @@ schedule_ue_spec_default(
uint8_t ue_has_transmission = 0;
uint32_t ndi;
enb_agent_mac_create_empty_dl_config(mod_id, dl_info);
flexran_agent_mac_create_empty_dl_config(mod_id, dl_info);
if (UE_list->head==-1) {
return;
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file eNB_agent_scheduler_dlsch_ue_remote.c
/*! \file flexran_agent_scheduler_dlsch_ue_remote.c
* \brief procedures related to remote scheduling in the DLSCH transport channel
* \author Xenofon Foukas
* \date 2016
......@@ -37,9 +37,9 @@
*/
#include "enb_agent_common_internal.h"
#include "flexran_agent_common_internal.h"
#include "eNB_agent_scheduler_dlsch_ue_remote.h"
#include "flexran_agent_scheduler_dlsch_ue_remote.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
......@@ -52,7 +52,7 @@ int queue_initialized = 0;
//uint32_t period = 10;
//uint32_t sched [] = {1, 2, 3};
void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
int *mbsfn_flag, Protocol__FlexranMessage **dl_info) {
......@@ -97,19 +97,19 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
} 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);
enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info);
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");
enb_agent_mac_create_empty_dl_config(mod_id, dl_info);
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
enb_agent_get_pending_dl_mac_config(mod_id, dl_info);
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);
......@@ -119,9 +119,9 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
return;
} else if (diff < 0) {
LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n");
enb_agent_mac_destroy_dl_config(*dl_info);
flexran_agent_mac_destroy_dl_config(*dl_info);
*dl_info = NULL;
enb_agent_get_pending_dl_mac_config(mod_id, dl_info);
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
......@@ -129,22 +129,22 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
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);
enb_agent_mac_create_empty_dl_config(mod_id, dl_info);
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
enb_agent_mac_create_empty_dl_config(mod_id, dl_info);
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 = get_current_system_frame_num(mod_id);
uint16_t current_subframe = get_current_subframe(mod_id);
uint32_t current_sfn_sf = get_sfn_sf(mod_id);
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;
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file eNB_agent_scheduler_dlsch_ue_remote.h
/*! \file flexran_agent_scheduler_dlsch_ue_remote.h
* \brief Local stub for remote scheduler used by the controller
* \author Xenofon Foukas
* \date 2016
......@@ -37,15 +37,15 @@
*/
#ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__
#define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___
#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/enb_agent_defs.h"
#include "enb_agent_mac.h"
#include "LAYER2/MAC/enb_agent_mac_proto.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>
......@@ -63,7 +63,7 @@ TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s);
/*
* Default scheduler used by the eNB agent
*/
void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe,
int *mbsfn_flag, Protocol__FlexranMessage **dl_info);
......
......@@ -27,7 +27,7 @@
*******************************************************************************/
/*! \file dci_conversions.h
/*! \file flexran_dci_conversions.h
* \brief Conversion helpers from flexran messages to OAI formats DCI
* \author Xenofon Foukas
* \date 2016
......
......@@ -93,7 +93,7 @@
#include "SIMULATION/TOOLS/defs.h" // for taus
#include "enb_agent_extern.h"
#include "flexran_agent_extern.h"
#define XER_PRINT
#ifdef PHY_EMUL
......@@ -4543,7 +4543,7 @@ rrc_eNB_decode_dcch(
//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]) {
agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id,
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
}
......@@ -4644,7 +4644,7 @@ rrc_eNB_decode_dcch(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id,
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
}
......
......@@ -325,13 +325,13 @@ int logInit (void)
g_log->log_component[ENB_APP].filelog = 0;
g_log->log_component[ENB_APP].filelog_name = "";
g_log->log_component[ENB_AGENT].name = "ENB_AGENT";
g_log->log_component[ENB_AGENT].level = LOG_DEBUG;
g_log->log_component[ENB_AGENT].flag = LOG_MED;
g_log->log_component[ENB_AGENT].interval = 1;
g_log->log_component[ENB_AGENT].fd = 0;
g_log->log_component[ENB_AGENT].filelog = 0;
g_log->log_component[ENB_AGENT].filelog_name = "";
g_log->log_component[FLEXRAN_AGENT].name = "FLEXRAN_AGENT";
g_log->log_component[FLEXRAN_AGENT].level = LOG_DEBUG;
g_log->log_component[FLEXRAN_AGENT].flag = LOG_MED;
g_log->log_component[FLEXRAN_AGENT].interval = 1;
g_log->log_component[FLEXRAN_AGENT].fd = 0;
g_log->log_component[FLEXRAN_AGENT].filelog = 0;
g_log->log_component[FLEXRAN_AGENT].filelog_name = "";
g_log->log_component[TMR].name = "TMR";
g_log->log_component[TMR].level = LOG_EMERG;
......
......@@ -270,7 +270,7 @@ typedef enum {
RAL_ENB,
RAL_UE,
ENB_APP,
ENB_AGENT,
FLEXRAN_AGENT,
TMR,
USIM,
LOCALIZE,
......
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "95";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 5;
downlink_frequency = 879000000L;
uplink_frequency_offset = -45000000;
Nid_cell = 0;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 115;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -26;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -108;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -108;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.100.101";
ipv6 = "192:168:100::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
NETWORK_CONTROLLER :
{
FLEXRAN_AGENT_INTERFACE_NAME = "eth1";
FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
FLEXRAN_AGENT_PORT = 2210;
FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache";
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "95";
////////// Physical parameters:
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 5;
downlink_frequency = 879000000L;
uplink_frequency_offset = -45000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 115;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -26;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -108;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -108;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.100.101";
ipv6 = "192:168:100::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
NETWORK_CONTROLLER :
{
FLEXRAN_AGENT_INTERFACE_NAME = "eth1";
FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
FLEXRAN_AGENT_PORT = 2210;
FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache";
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
......@@ -155,10 +155,10 @@ eNBs =
NETWORK_CONTROLLER :
{
ENB_AGENT_INTERFACE_NAME = "eth1";
ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
ENB_AGENT_PORT = 2210;
ENB_AGENT_CACHE = "/mnt/oai_agent_cache";
FLEXRAN_AGENT_INTERFACE_NAME = "eth1";
FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
FLEXRAN_AGENT_PORT = 2210;
FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache";
};
log_config :
......
......@@ -155,10 +155,10 @@ eNBs =
NETWORK_CONTROLLER :
{
ENB_AGENT_INTERFACE_NAME = "eth1";
ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
ENB_AGENT_PORT = 2210;
ENB_AGENT_CACHE = "/mnt/oai_agent_cache";
FLEXRAN_AGENT_INTERFACE_NAME = "eth1";
FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30";
FLEXRAN_AGENT_PORT = 2210;
FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache";
};
log_config :
......
......@@ -75,8 +75,8 @@ uint8_t config_smbv = 0;
char smbv_ip[16];
#endif
#if defined(ENB_AGENT_SB_IF)
# include "enb_agent.h"
#if defined(FLEXRAN_AGENT_SB_IF)
# include "flexran_agent.h"
#endif
......@@ -1301,8 +1301,8 @@ main (int argc, char **argv)
smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->frame_parms);
#endif
/* #if defined (ENB_AGENT_SB_IF)
enb_agent_start();
/* #if defined (FLEXRAN_AGENT_SB_IF)
flexran_agent_start();
#endif */
// add events to future event list: Currently not used
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment