Changed the structures for storing agent context info
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
#include "enb_agent_common.h"
|
#include "enb_agent_common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "enb_agent.h"
|
#include "enb_agent.h"
|
||||||
|
#include "enb_agent_mac_defs.h"
|
||||||
|
|
||||||
#include "enb_agent_extern.h"
|
#include "enb_agent_extern.h"
|
||||||
|
|
||||||
@@ -47,10 +48,7 @@
|
|||||||
|
|
||||||
//#define TEST_TIMER
|
//#define TEST_TIMER
|
||||||
|
|
||||||
enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT];
|
enb_agent_instance_t enb_agent[NUM_MAX_ENB];
|
||||||
msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT];
|
|
||||||
/* this could also go into enb_agent struct*/
|
|
||||||
enb_agent_info_t enb_agent_info;
|
|
||||||
|
|
||||||
char in_ip[40];
|
char in_ip[40];
|
||||||
static uint16_t in_port;
|
static uint16_t in_port;
|
||||||
@@ -66,7 +64,7 @@ Protocol__ProgranMessage *enb_agent_timeout(void* args);
|
|||||||
*/
|
*/
|
||||||
void *enb_agent_task(void *args){
|
void *enb_agent_task(void *args){
|
||||||
|
|
||||||
msg_context_t *d = (msg_context_t *) args;
|
enb_agent_instance_t *d = (enb_agent_instance_t *) args;
|
||||||
Protocol__ProgranMessage *msg;
|
Protocol__ProgranMessage *msg;
|
||||||
void *data;
|
void *data;
|
||||||
int size;
|
int size;
|
||||||
@@ -101,15 +99,11 @@ void *enb_agent_task(void *args){
|
|||||||
msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg);
|
msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg);
|
||||||
if (msg != NULL){
|
if (msg != NULL){
|
||||||
data=enb_agent_pack_message(msg,&size);
|
data=enb_agent_pack_message(msg,&size);
|
||||||
if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) {
|
if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) {
|
||||||
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
|
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (message_put(d->tx_mq, data, size, priority)){ */
|
|
||||||
/* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */
|
|
||||||
/* goto error; */
|
|
||||||
/* } */
|
|
||||||
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
|
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -131,7 +125,7 @@ void *enb_agent_task(void *args){
|
|||||||
|
|
||||||
void *receive_thread(void *args) {
|
void *receive_thread(void *args) {
|
||||||
|
|
||||||
msg_context_t *d = args;
|
enb_agent_instance_t *d = args;
|
||||||
void *data;
|
void *data;
|
||||||
int size;
|
int size;
|
||||||
int priority;
|
int priority;
|
||||||
@@ -140,38 +134,27 @@ void *receive_thread(void *args) {
|
|||||||
Protocol__ProgranMessage *msg;
|
Protocol__ProgranMessage *msg;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (enb_agent_msg_recv(d->mod_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) {
|
if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) {
|
||||||
err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING;
|
err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (message_get(d->rx_mq, &data, &size, &priority)){ */
|
|
||||||
/* err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; */
|
|
||||||
/* goto error; */
|
|
||||||
/* } */
|
|
||||||
LOG_D(ENB_AGENT,"received message with size %d\n", size);
|
LOG_D(ENB_AGENT,"received message with size %d\n", size);
|
||||||
|
|
||||||
|
|
||||||
msg=enb_agent_handle_message(d->mod_id, data, size);
|
msg=enb_agent_handle_message(d->enb_id, data, size);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
d->rx_xid = ((d->rx_xid)+1)%4;
|
|
||||||
d->tx_xid = d->rx_xid;
|
|
||||||
|
|
||||||
// check if there is something to send back to the controller
|
// check if there is something to send back to the controller
|
||||||
if (msg != NULL){
|
if (msg != NULL){
|
||||||
data=enb_agent_pack_message(msg,&size);
|
data=enb_agent_pack_message(msg,&size);
|
||||||
|
|
||||||
if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) {
|
if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) {
|
||||||
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
|
err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (message_put(d->tx_mq, data, size, priority)){ */
|
|
||||||
/* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */
|
|
||||||
/* goto error; */
|
|
||||||
/* } */
|
|
||||||
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
|
LOG_D(ENB_AGENT,"sent message with size %d\n", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,10 +197,8 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
|
|||||||
|
|
||||||
int channel_id;
|
int channel_id;
|
||||||
|
|
||||||
//
|
|
||||||
set_enb_vars(mod_id, RAN_LTE_OAI);
|
set_enb_vars(mod_id, RAN_LTE_OAI);
|
||||||
enb_agent[mod_id].mod_id = mod_id;
|
enb_agent[mod_id].enb_id = mod_id;
|
||||||
enb_agent_info.nb_modules+=1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check the configuration
|
* check the configuration
|
||||||
@@ -235,7 +216,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
|
|||||||
in_port = DEFAULT_ENB_AGENT_PORT ;
|
in_port = DEFAULT_ENB_AGENT_PORT ;
|
||||||
}
|
}
|
||||||
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
|
LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
|
||||||
enb_agent[mod_id].mod_id,
|
enb_agent[mod_id].enb_id,
|
||||||
in_ip,
|
in_ip,
|
||||||
in_port);
|
in_port);
|
||||||
|
|
||||||
@@ -271,46 +252,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
|
|||||||
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
|
*enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* /\* */
|
/*Initialize the continuous MAC stats update mechanism*/
|
||||||
/* * create a socket */
|
enb_agent_init_cont_mac_stats_update(mod_id);
|
||||||
/* *\/ */
|
|
||||||
/* enb_agent[mod_id].link = new_link_client(in_ip, in_port); */
|
|
||||||
/* if (enb_agent[mod_id].link == NULL) goto error; */
|
|
||||||
|
|
||||||
/* LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", */
|
new_thread(receive_thread, &enb_agent[mod_id]);
|
||||||
/* enb_agent[mod_id].mod_id, */
|
|
||||||
/* in_ip, */
|
|
||||||
/* in_port); */
|
|
||||||
/* /\* */
|
|
||||||
/* * create a message queue */
|
|
||||||
/* *\/ */
|
|
||||||
|
|
||||||
/* enb_agent[mod_id].send_queue = new_message_queue(); */
|
|
||||||
/* if (enb_agent[mod_id].send_queue == NULL) goto error; */
|
|
||||||
/* enb_agent[mod_id].receive_queue = new_message_queue(); */
|
|
||||||
/* if (enb_agent[mod_id].receive_queue == NULL) goto error; */
|
|
||||||
|
|
||||||
/* /\* */
|
|
||||||
/* * create a link manager */
|
|
||||||
/* *\/ */
|
|
||||||
|
|
||||||
/* enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); */
|
|
||||||
/* if (enb_agent[mod_id].manager == NULL) goto error; */
|
|
||||||
|
|
||||||
/* memset(&shared_ctxt, 0, sizeof(msg_context_t)); */
|
|
||||||
|
|
||||||
/* shared_ctxt[mod_id].mod_id = mod_id; */
|
|
||||||
/* shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; */
|
|
||||||
/* shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* start the enb agent rx thread
|
|
||||||
*/
|
|
||||||
|
|
||||||
memset(&shared_ctxt, 0, sizeof(msg_context_t));
|
|
||||||
shared_ctxt[mod_id].mod_id = mod_id;
|
|
||||||
|
|
||||||
new_thread(receive_thread, &shared_ctxt[mod_id]);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initilize a timer
|
* initilize a timer
|
||||||
@@ -322,7 +267,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
|
|||||||
* start the enb agent task for tx and interaction with the underlying network function
|
* start the enb agent task for tx and interaction with the underlying network function
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) {
|
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");
|
LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -338,21 +283,21 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int enb_agent_stop(mid_t mod_id){
|
/* int enb_agent_stop(mid_t mod_id){ */
|
||||||
|
|
||||||
int i=0;
|
/* int i=0; */
|
||||||
|
|
||||||
enb_agent_destroy_timers();
|
/* enb_agent_destroy_timers(); */
|
||||||
for ( i =0; i < enb_agent_info.nb_modules; i++) {
|
/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */
|
||||||
|
|
||||||
destroy_link_manager(enb_agent[i].manager);
|
/* destroy_link_manager(enb_agent[i].manager); */
|
||||||
|
|
||||||
destroy_message_queue(enb_agent[i].send_queue);
|
/* destroy_message_queue(enb_agent[i].send_queue); */
|
||||||
destroy_message_queue(enb_agent[i].receive_queue);
|
/* destroy_message_queue(enb_agent[i].receive_queue); */
|
||||||
|
|
||||||
close_link(enb_agent[i].link);
|
/* close_link(enb_agent[i].link); */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
void * enb[NUM_MAX_ENB_AGENT];
|
void * enb[NUM_MAX_ENB];
|
||||||
void * enb_ue[NUM_MAX_ENB_AGENT];
|
void * enb_ue[NUM_MAX_ENB];
|
||||||
/*
|
/*
|
||||||
* message primitives
|
* message primitives
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#include "link_manager.h"
|
#include "link_manager.h"
|
||||||
|
|
||||||
#define NUM_MAX_ENB_AGENT 2
|
#define NUM_MAX_ENB 2
|
||||||
#define NUM_MAX_UE 2048
|
#define NUM_MAX_UE 2048
|
||||||
#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1"
|
#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1"
|
||||||
#define DEFAULT_ENB_AGENT_PORT 2210
|
#define DEFAULT_ENB_AGENT_PORT 2210
|
||||||
@@ -108,36 +108,25 @@ typedef uint8_t mid_t; // module or enb id
|
|||||||
typedef uint8_t lcid_t;
|
typedef uint8_t lcid_t;
|
||||||
typedef int32_t err_code_t;
|
typedef int32_t err_code_t;
|
||||||
|
|
||||||
// tx and rx shared context
|
|
||||||
typedef struct {
|
|
||||||
mid_t mod_id;
|
|
||||||
socket_link_t *link;
|
|
||||||
message_queue_t *send_queue;
|
|
||||||
message_queue_t *receive_queue;
|
|
||||||
link_manager_t *manager;
|
|
||||||
}enb_agent_instance_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* general info */
|
/* general info */
|
||||||
uint32_t nb_modules;
|
|
||||||
|
|
||||||
|
|
||||||
/* stats */
|
/* stats */
|
||||||
|
|
||||||
uint32_t total_rx_msg;
|
uint32_t total_rx_msg;
|
||||||
uint32_t total_tx_msg;
|
uint32_t total_tx_msg;
|
||||||
|
|
||||||
uint32_t rx_msg[NUM_MAX_ENB_AGENT];
|
uint32_t rx_msg[NUM_MAX_ENB];
|
||||||
uint32_t tx_msg[NUM_MAX_ENB_AGENT];
|
uint32_t tx_msg[NUM_MAX_ENB];
|
||||||
|
|
||||||
}enb_agent_info_t;
|
}enb_agent_info_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
mid_t mod_id;
|
mid_t enb_id;
|
||||||
// message_queue_t *tx_mq;
|
enb_agent_info_t agent_info;
|
||||||
// message_queue_t *rx_mq;
|
|
||||||
xid_t tx_xid;
|
}enb_agent_instance_t;
|
||||||
xid_t rx_xid;
|
|
||||||
} msg_context_t;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,10 +41,11 @@
|
|||||||
#include "enb_agent_defs.h"
|
#include "enb_agent_defs.h"
|
||||||
#include "enb_agent_mac_defs.h"
|
#include "enb_agent_mac_defs.h"
|
||||||
|
|
||||||
extern msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT];
|
|
||||||
|
|
||||||
extern AGENT_MAC_xface *agent_mac_xface;
|
//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX];
|
||||||
|
|
||||||
extern unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT];
|
extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB][ENB_AGENT_MAX];
|
||||||
|
|
||||||
|
extern unsigned int mac_agent_registered[NUM_MAX_ENB];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,14 +42,18 @@
|
|||||||
|
|
||||||
/* ENB AGENT-MAC Interface */
|
/* ENB AGENT-MAC Interface */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
msg_context_t *agent_ctxt;
|
//msg_context_t *agent_ctxt;
|
||||||
|
|
||||||
/// Inform the controller about the scheduling requests received during the subframe
|
/// Inform the controller about the scheduling requests received during the subframe
|
||||||
void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context);
|
void (*enb_agent_send_sr_info)(mid_t mod_id);
|
||||||
|
|
||||||
/// Inform the controller about the current UL/DL subframe
|
/// Inform the controller about the current UL/DL subframe
|
||||||
void (*enb_agent_send_sf_trigger)(mid_t mod_id, msg_context_t *context);
|
void (*enb_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);
|
||||||
|
|
||||||
/*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
|
/*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/
|
||||||
|
|
||||||
} AGENT_MAC_xface;
|
} AGENT_MAC_xface;
|
||||||
|
|||||||
@@ -43,9 +43,6 @@
|
|||||||
#include "enb_agent_common.h"
|
#include "enb_agent_common.h"
|
||||||
|
|
||||||
|
|
||||||
/*Flags showing if a mac agent has already been registered*/
|
|
||||||
unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT];
|
|
||||||
|
|
||||||
/*This will be used for producing continuous status updates for the MAC
|
/*This will be used for producing continuous status updates for the MAC
|
||||||
*Needs to be thread-safe
|
*Needs to be thread-safe
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +58,7 @@ typedef struct {
|
|||||||
} mac_stats_updates_context_t;
|
} mac_stats_updates_context_t;
|
||||||
|
|
||||||
/*Array holding the last stats reports for each eNB. Used for continuous reporting*/
|
/*Array holding the last stats reports for each eNB. Used for continuous reporting*/
|
||||||
mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB_AGENT];
|
mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB];
|
||||||
|
|
||||||
/*Functions to initialize and destroy the struct required for the
|
/*Functions to initialize and destroy the struct required for the
|
||||||
*continuous stats update report*/
|
*continuous stats update report*/
|
||||||
|
|||||||
Reference in New Issue
Block a user