Commit fac96824 authored by Robert Schmidt's avatar Robert Schmidt

define FlexRAN data in RAN context and use it

- defines RCconfig data structures
- adds method to read data
- use it in source files
parent 765d6370
......@@ -40,6 +40,9 @@
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_lte.h"
#include "RRC/LITE/defs.h"
#ifdef FLEXRAN_AGENT_SB_IF
#include "flexran_agent_defs.h"
#endif
#include "gtpv1u.h"
#include "NwGtpv1u.h"
......@@ -64,6 +67,10 @@ typedef struct {
int *nb_L1_CC;
/// Number of RU instances in this node
int nb_RU;
#ifdef FLEXRAN_AGENT_SB_IF
/// FlexRAN context variables
flexran_agent_info_t **flexran;
#endif
/// eNB context variables
struct PHY_VARS_eNB_s ***eNB;
/// RRC context variables
......
......@@ -869,7 +869,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
char lib_name[120];
char target[512];
snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name);
strcpy(target, local_cache);
strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name);
LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target);
......
......@@ -343,8 +343,8 @@ void *eNB_app_task(void *args_p)
enb_app_start_phy_rrc(enb_id_start, enb_id_end);
#ifdef FLEXRAN_AGENT_SB_IF
for (enb_i = 0; enb_i <1; enb_i ++){ // To be handled for all of current eNB
flexran_set_enb_vars(enb_i, RAN_LTE_OAI);
for (uint32_t enb_i = 0; enb_i <1; enb_i ++){ // To be handled for all of current eNB
flexran_set_RC_vars(enb_i, RAN_LTE_OAI);
}
#endif
......
......@@ -237,6 +237,44 @@ void RCconfig_RU(void) {
}
#ifdef FLEXRAN_AGENT_SB_IF
void RCconfig_flexran()
{
int i;
paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
if (!RC.flexran) {
RC.flexran = calloc(RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
AssertFatal(RC.flexran != NULL,
"can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
RC.nb_L1_inst * sizeof(flexran_agent_info_t*),
RC.nb_L1_inst, sizeof(flexran_agent_info_t*));
}
/* For all agent instance, fill in the same controller configuration. */
for (i = 0; i < RC.nb_L1_inst; i++) {
RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
AssertFatal(RC.flexran[i] != NULL,
"can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
sizeof(flexran_agent_info_t), i + 1, RC.nb_L1_inst);
RC.flexran[i]->interface_name = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
//inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
//strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS );
RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
// DEFAULT_FLEXRAN_AGENT_PORT
RC.flexran[i]->remote_port = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
// DEFAULT_FLEXRAN_AGENT_CACHE
RC.flexran[i]->cache_name = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
RC.flexran[i]->await_reconf = strcmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0;
RC.flexran[i]->enb_id = i;
}
/* TODO: show FlexRAN config now? */
}
#endif
void RCconfig_L1() {
int i,j;
paramdef_t L1_Params[] = L1PARAMS_DESC;
......@@ -451,10 +489,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
/*
char* flexran_agent_interface_name = NULL;
char* flexran_agent_ipv4_address = NULL;
int32_t flexran_agent_port = 0;
char* flexran_agent_cache = NULL;
int32_t otg_ue_id = 0;
char* otg_app_type = NULL;
char* otg_bg_traffic = NULL;
......@@ -2028,35 +2062,6 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
rrc->srb1_poll_byte = PollByte_kBinfinity;
rrc->srb1_max_retx_threshold = UL_AM_RLC__maxRetxThreshold_t8;
}
/*
// Network Controller
subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
if (subsetting != NULL) {
if ( (
config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME,
(const char **)&flexran_agent_interface_name)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS,
(const char **)&flexran_agent_ipv4_address)
&& config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT,
&flexran_agent_port)
&& config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE,
(const char **)&flexran_agent_cache)
)
) {
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name);
cidr = flexran_agent_ipv4_address;
address = strtok(cidr, "/");
//enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address = strdup(address);
if (address) {
IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" );
}
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_port = flexran_agent_port;
enb_properties_loc.properties[enb_properties_loc_index]->flexran_agent_cache = strdup(flexran_agent_cache);
}
}
*/
/*
// OTG _CONFIG
......
......@@ -94,6 +94,9 @@ typedef struct ru_config_s {
} ru_config_t;
extern void RCconfig_RU(void);
#ifdef FLEXRAN_AGENT_SB_IF
extern void RCconfig_flexran(void);
#endif
extern void RCconfig_L1(void);
extern void RCconfig_macrlc(void);
extern int RCconfig_gtpu(void );
......
......@@ -627,7 +627,7 @@ static int DEFENBS[] = {0};
#define FLEXRANPARAMS_DESC { \
{CONFIG_STRING_FLEXRAN_INTERFACE_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1/30", TYPE_STRING, 0}, \
{CONFIG_STRING_FLEXRAN_IPV4_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_STRING_FLEXRAN_PORT, NULL, 0, uptr:NULL, defintval:2210, TYPE_UINT, 0}, \
{CONFIG_STRING_FLEXRAN_CACHE, NULL, 0, strptr:NULL, defstrval:"/mnt/oai_agent_cache", TYPE_STRING, 0}, \
{CONFIG_STRING_FLEXRAN_AWAIT_RECONF, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0} \
......
......@@ -30,15 +30,6 @@
#include <arpa/inet.h>
//#define TEST_TIMER
flexran_agent_instance_t flexran_agent[NUM_MAX_ENB];
char in_ip[40];
static uint16_t in_port;
char local_cache[40];
void *send_thread(void *args);
void *receive_thread(void *args);
pthread_t new_thread(void *(*f)(void *), void *b);
......@@ -52,7 +43,7 @@ int agent_task_created = 0;
*/
void *flexran_agent_task(void *args){
//flexran_agent_instance_t *d = (flexran_agent_instance_t *) args;
//flexran_agent_info_t *d = (flexran_agent_info_t *) args;
Protocol__FlexranMessage *msg;
void *data;
int size;
......@@ -113,7 +104,7 @@ void *flexran_agent_task(void *args){
void *receive_thread(void *args) {
flexran_agent_instance_t *d = args;
flexran_agent_info_t *d = args;
void *data;
int size;
int priority;
......@@ -186,46 +177,19 @@ pthread_t new_thread(void *(*f)(void *), void *b) {
return t;
}
void flexran_agent_reconfigure(mid_t mod_id){
Enb_properties_array_t *enb_properties = enb_config_get();
/*
* check the configuration
*/
if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) {
strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache));
local_cache[sizeof(local_cache) - 1] = 0;
} else {
strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE);
}
if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != 0) {
inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
} else {
strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS );
}
if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) {
in_port = enb_properties->properties[mod_id]->flexran_agent_port;
} else {
in_port = DEFAULT_FLEXRAN_AGENT_PORT ;
}
LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
flexran_agent[mod_id].enb_id,
in_ip,
in_port);
}
int channel_container_init = 0;
int flexran_agent_start(mid_t mod_id)
{
int channel_id;
char *in_ip = RC.flexran[mod_id]->remote_ipv4_addr;
uint16_t in_port = RC.flexran[mod_id]->remote_port;
flexran_set_enb_vars(mod_id, RAN_LTE_OAI);
flexran_agent[mod_id].enb_id = mod_id;
flexran_agent_reconfigure(mod_id);
RC.flexran[mod_id]->enb_id = mod_id;
/* assume for the moment the monolithic case, i.e. agent can provide
* information for all layers */
RC.flexran[mod_id]->capability_mask = FLEXRAN_CAP_LOL1 | FLEXRAN_CAP_HIL1
| FLEXRAN_CAP_LOL2 | FLEXRAN_CAP_HIL2
| FLEXRAN_CAP_PDCP | FLEXRAN_CAP_RRC;
/*
* Initialize the channel container
......@@ -264,7 +228,7 @@ int flexran_agent_start(mid_t mod_id)
/*Initialize the continuous stats update mechanism*/
flexran_agent_init_cont_stats_update(mod_id);
new_thread(receive_thread, &flexran_agent[mod_id]);
new_thread(receive_thread, RC.flexran[mod_id]);
/*Initialize and register the mac xface. Must be modified later
*for more flexibility in agent management */
......@@ -293,7 +257,7 @@ int flexran_agent_start(mid_t 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_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) {
if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) RC.flexran[mod_id]) < 0) {
LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n");
return -1;
}
......
......@@ -48,7 +48,6 @@
/* Initiation and termination of the eNodeB agent */
int flexran_agent_start(mid_t mod_id);
int flexran_agent_stop(mid_t mod_id);
void flexran_agent_reconfigure(mid_t mod_id);
/*
* enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller
......
......@@ -391,7 +391,7 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
char lib_name[120];
char target[512];
snprintf(lib_name, sizeof(lib_name), "/%s.so", control_delegation_msg->name);
strcpy(target, local_cache);
strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name);
FILE *f;
......@@ -1075,7 +1075,7 @@ int flexran_agent_rrc_measurement(mid_t mod_id, const void *params, Protocol__Fl
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[mod_id].rrc_ue_head)){
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[mod_id]->rrc_ue_head)){
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, ue_context_p->ue_context.rnti, flexran_get_current_frame(mod_id), flexran_get_current_subframe (mod_id), mod_id);
......
......@@ -138,11 +138,24 @@ typedef enum {
FLEXRAN_AGENT_TIMER_STATE_MAX,
} flexran_agent_timer_state_t;
#define FLEXRAN_CAP_LOL1 0x1
#define FLEXRAN_CAP_HIL1 0x2
#define FLEXRAN_CAP_LOL2 0x4 // is: MAC
#define FLEXRAN_CAP_HIL2 0x8 // is: RLC
#define FLEXRAN_CAP_PDCP 0x16
#define FLEXRAN_CAP_RRC 0x32
typedef struct {
/* general info */
char *interface_name;
char *remote_ipv4_addr;
uint16_t remote_port;
char *cache_name;
uint8_t await_reconf;
int enb_id;
uint8_t capability_mask;
/* stats */
uint32_t total_rx_msg;
......@@ -200,10 +213,4 @@ typedef struct stats_request_config_s{
report_config_t *config;
} stats_request_config_t;
typedef struct {
mid_t enb_id;
flexran_agent_info_t agent_info;
} flexran_agent_instance_t;
#endif
......@@ -34,11 +34,7 @@
#include "flexran_agent_mac_defs.h"
#include "flexran_agent_rrc_defs.h"
#include "flexran_agent_pdcp_defs.h"
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX];
/* full path of the local cache for storing VSFs */
extern char local_cache[40];
#include "common/ran_context.h"
/* Control module interface for the communication of the MAC Control Module with the agent */
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
......
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