Commit 96e46e77 authored by Nikos Makris's avatar Nikos Makris

RLC_DATA_REQ Message is created and sent over the async channel, initial functionality preserved

parent 70ad5d58
......@@ -830,6 +830,9 @@ include_directories("${OPENAIR3_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR2_DIR}/UTIL/MEM")
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
include_directories("${OPENAIR2_DIR}/UTIL/ASYNC_IF")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
......@@ -837,9 +840,6 @@ include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
include_directories("${OPENAIR2_DIR}/LAYER2/PROTO_AGENT")
include_directories("${OPENAIR2_DIR}/ENB_APP")
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/MEM")
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
include_directories("${OPENAIR2_DIR}/UTIL/OCG")
include_directories("${OPENAIR2_DIR}/UTIL/MATH")
include_directories("${OPENAIR2_DIR}/UTIL/TIMER")
......@@ -858,17 +858,18 @@ include_directories("${OPENAIR_DIR}")
if (PDCP_SPLIT)
# set the version of protobuf messages, V3 not supported yet
add_list1_option(FSPT_VERSION V2 "FSPT MSG protobuf grammar version" V2 V3)
if (${FSPT_VERSION} STREQUAL "V2")
set (FSPTDIR V2)
elseif (${FSPT_VERSION} STREQUAL "V3")
set (FSPTDIR V3)
endif(${FSPT_VERSION} STREQUAL "V2")
set(FSPT_MSG_DIR ${OPENAIR_DIR}/targets/COMMON/MESSAGES/${FSPTDIR} )
set(FSPT_MSG_FILES
${FSPT_MSG_DIR}/header.proto
${FSPT_MSG_DIR}/flexsplit.proto
${FSPT_MSG_DIR}/flexsplit-messages.proto
)
set(FSPT_C_DIR ${protobuf_generated_dir}/${FSPTDIR})
......@@ -878,6 +879,7 @@ if (PDCP_SPLIT)
set(FSPT_OAI_generated
${FSPT_C_DIR}/header.pb-c.c
${FSPT_C_DIR}/flexsplit.pb-c.c
${FSPT_C_DIR}/flexsplit-messages.pb-c.c
)
file(GLOB fspt_h ${FSPT_C_DIR}/*.h)
......
......@@ -56,8 +56,7 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "msc.h"
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
#if defined(ENABLE_SECURITY)
......@@ -73,12 +72,14 @@
# include "gtpv1u.h"
#endif
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
#ifndef OAI_EMU
extern int otg_enabled;
#endif
//#include "LAYER2/PROTO_AGENT/proto_agent.h"
//-----------------------------------------------------------------------------
/*
* If PDCP_UNIT_TEST is set here then data flow between PDCP and RLC is broken
......@@ -365,7 +366,6 @@ boolean_t pdcp_data_req(
LOG_F(PDCP,"\n");
#endif
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
//starting async
......@@ -375,7 +375,7 @@ boolean_t pdcp_data_req(
// memset(enb_properties_p, 0, sizeof(Enb_properties_array_t));
// printf("starting the client\n\n");
printf("Starting the async client\\n");
// printf("Starting the async client\n");
// new_thread(proto_server_start, NULL);
enb_properties_p = enb_config_get();
......@@ -385,9 +385,17 @@ boolean_t pdcp_data_req(
{
agent_started = proto_agent_start(ctxt_pP->module_id, enb_properties_p);
}
// Send a Hello Message Everytime that we have a packet
//proto_agent_send_hello();
//printf("PROTOPDCP is sending a message request\n");
//printf("PROTOPDCP: vals are %u, %u, %u, %u, %u, %u, %u \n", ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, pdcp_pdu_size);
if (pdcp_pdu_p!=NULL)
{
proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
rlc_status = rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
}
switch (rlc_status) {
......
......@@ -41,6 +41,7 @@
#include "proto_agent_net_comm.h"
#include "proto_agent_async.h"
proto_agent_instance_t proto_agent[NUM_MAX_ENB];
proto_agent_instance_t proto_server[NUM_MAX_ENB];
......@@ -53,6 +54,9 @@ void *receive_thread(void *args);
pthread_t new_thread(void *(*f)(void *), void *b);
Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args);
mid_t client_mod, server_mod;
proto_agent_instance_t *client_channel, *server_channel;
#define ECHO
/* Thread continuously listening for incomming packets */
......@@ -152,6 +156,7 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
set_enb_vars(mod_id, RAN_LTE_OAI);
proto_server[mod_id].enb_id = mod_id;
server_mod = mod_id;
/*
* check the configuration - Getting all the values from the config file
* TODO: get the configuration optionally from the conf file
......@@ -172,6 +177,8 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie
/*Create the async channel info*/
proto_agent_instance_t *channel_info = proto_server_async_channel_info(mod_id, in_ip, in_port);
server_channel = channel_info;
/*Create a channel using the async channel info*/
channel_id = proto_agent_create_channel((void *) channel_info,
......@@ -252,6 +259,7 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties
set_enb_vars(mod_id, RAN_LTE_OAI);
proto_agent[mod_id].enb_id = mod_id;
client_mod = mod_id;
/*
* check the configuration - Getting all the values from the config file
......@@ -273,7 +281,7 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties
/*Create the async channel info*/
proto_agent_instance_t *channel_info = proto_agent_async_channel_info(mod_id, in_ip, in_port);
client_channel = channel_info;
/*Create a channel using the async channel info*/
channel_id = proto_agent_create_channel((void *) channel_info,
proto_agent_async_msg_send,
......@@ -307,3 +315,155 @@ error:
}
void
proto_agent_send_hello(void)
{
Protocol__FlexsplitMessage *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0;
//int priority;
//int size;
LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n");
msg_flag = proto_agent_hello(proto_agent[client_mod].enb_id, NULL, &init_msg);
int msgsize = 0;
//int err_code;
if (msg_flag > 0)
{
proto_agent_serialize_message(init_msg, &msg, &msgsize);
}
LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n");
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel);
}
void
proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP,
confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP)
{
printf("PROTOPDCP: sendig the data req over the async channel\n");
Protocol__FlexsplitMessage *msg = NULL;
Protocol__FlexsplitMessage *init_msg=NULL;
//Protocol__FlexsplitMessage *rep_msg=NULL;
int msg_flag = 0;
void *data=NULL;
int priority;
int size;
int ret;
int err_code;
LOG_D(PROTO_AGENT, "PDCP agent Server: Calling the hello packet constructor\n");
//EDW
printf("instance is %u, %u\n", ctxt_pP->instance, ctxt_pP->frame);
data_req_args *args = malloc(sizeof(data_req_args));
args->ctxt = malloc(sizeof(protocol_ctxt_t));
memcpy(args->ctxt, ctxt_pP, sizeof(protocol_ctxt_t));
args->srb_flag = srb_flagP;
args->MBMS_flag = MBMS_flagP;
args->rb_id = rb_idP;
args->mui = muiP;
args->confirm = confirmP;
args->sdu_size = sdu_sizeP;
args->sdu_p = malloc(sdu_sizeP);
memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP);
msg_flag = proto_agent_pdcp_data_req(proto_agent[client_mod].enb_id, (void *) args, &init_msg);
printf("PROTO_AGENT msg flag is %d", msg_flag);
int msgsize = 0;
//int err_code;
proto_agent_serialize_message(init_msg, &msg, &msgsize);
LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n");
proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel);
// Block until you receive the ACK with the op code
while (1) {
if (proto_agent_msg_recv(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority);
msg=proto_agent_handle_message(proto_agent[client_mod].enb_id, data, size);
if (msg == NULL)
{
LOG_E(PROTO_AGENT,"msg to send back is NULL\n");
}
free(data);
if (msg != NULL){
if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(PROTO_AGENT,"sent message with size %d\n", size);
}
}
error:
LOG_E(PROTO_AGENT,"there was an error\n");
return;
}
void *
proto_server_receive(void)
{
proto_agent_instance_t *d = &proto_server[server_mod];
void *data;
int size;
int priority;
err_code_t err_code;
Protocol__FlexsplitMessage *msg;
//while (1) {
if (proto_agent_msg_recv(d->enb_id, PROTO_AGENT_DEFAULT, &data, &size, &priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error;
}
LOG_I(PROTO_AGENT,"Server Received message with size %d and priority %d, calling message handle\n", size, priority);
msg=proto_agent_handle_message(d->enb_id, data, size);
if (msg == NULL)
{
LOG_E(PROTO_AGENT,"msg to send back is NULL\n");
}
free(data);
if (msg != NULL){
if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) {
err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING;
goto error;
}
LOG_D(PROTO_AGENT,"sent message with size %d\n", size);
}
//}
return NULL;
error:
LOG_E(PROTO_AGENT,"receive_thread: error %d occured\n",err_code);
return NULL;
}
\ No newline at end of file
......@@ -37,11 +37,12 @@
#ifndef PROTO_AGENT_H_
#define PROTO_AGENT_H_
#include "ENB_APP/enb_config.h" // for enb properties
#include "proto_agent_common.h"
//#include "ENB_APP/enb_config.h" // for enb properties
void * proto_server_init(void *args);
void * proto_server_receive(void);
int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_properties);
......
......@@ -39,6 +39,7 @@
#include <time.h>
#include "proto_agent_common.h"
//#include "proto_agent.h"
#include "PHY/extern.h"
#include "log.h"
......@@ -46,6 +47,9 @@
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "rrc_eNB_UE_context.h"
//#include <protobuf-c/protobuf-c.h>
void * enb[NUM_MAX_ENB];
void * enb_ue[NUM_MAX_ENB];
void * enb_rrc[NUM_MAX_ENB];
......@@ -108,6 +112,246 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader **
return -1;
}
int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
// Initialize the PDCP params
data_req_args *args = (data_req_args *)params;
// Create the protobuf header
Protocol__FspHeader *header;
xid_t xid = 1;
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0)
goto error;
/* Begin constructing the messages. They are defined as follows:
* 1) fspRlcPdu is storing the bytes of the packet
* 2) Message fspRlcData is packing the packet + the context of the PDCP (separate message)
* 3) Messge fspRlcDataReq is packing the header, enb_id and fspRlcData
*/
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcData *rlc_data = NULL;
Protocol__FspRlcDataReq *data_req = NULL;
pdu = malloc(sizeof(Protocol__FspRlcPdu));
ctxt = malloc(sizeof(Protocol__FspCtxt));
rlc_data = malloc(sizeof(Protocol__FspRlcData));
data_req = malloc(sizeof(Protocol__FspRlcDataReq));
protocol__fsp_rlc_pdu__init(pdu);
protocol__fsp_ctxt__init(ctxt);
protocol__fsp_rlc_data__init(rlc_data);
protocol__fsp_rlc_data_req__init(data_req);
// Copy data to the RlcPdu structure
pdu->fsp_pdu_data.data = malloc(args->sdu_size);
pdu->fsp_pdu_data.len = args->sdu_size;
memcpy(pdu->fsp_pdu_data.data, args->sdu_p, args->sdu_size);
pdu->has_fsp_pdu_data = 1;
// Copy data to the ctxt structure
ctxt->fsp_mod_id = args->ctxt->module_id;
ctxt->fsp_enb_flag = args->ctxt->enb_flag;
ctxt->fsp_instance = args->ctxt->instance;
ctxt->fsp_rnti = args->ctxt->rnti;
ctxt->fsp_frame = args->ctxt->frame;
ctxt->fsp_subframe = args->ctxt->subframe;
ctxt->fsp_enb_index = args->ctxt->eNB_index;
ctxt->has_fsp_mod_id = 1;
ctxt->has_fsp_enb_flag = 1;
ctxt->has_fsp_instance = 1;
ctxt->has_fsp_rnti = 1;
ctxt->has_fsp_frame = 1;
ctxt->has_fsp_subframe = 1;
ctxt->has_fsp_enb_index = 1;
rlc_data->fsp_ctxt = ctxt;
rlc_data->fsp_srb_flag = args->srb_flag;
rlc_data->fsp_mbms_flag = args->MBMS_flag;
rlc_data->fsp_rb_id = args->rb_id;
rlc_data->fsp_muip = args->mui;
rlc_data->fsp_confirm = args->confirm;
rlc_data->fsp_sdu_buffer_size = args->sdu_size;
rlc_data->fsp_pdu = pdu;
rlc_data->has_fsp_srb_flag = 1;
rlc_data->has_fsp_mbms_flag = 1;
rlc_data->has_fsp_rb_id = 1;
rlc_data->has_fsp_muip = 1;
rlc_data->has_fsp_confirm = 1;
rlc_data->has_fsp_sdu_buffer_size = 1;
// Up to here, everything is a signle message that is packed inside another. The final data_req
// will be created later, after the setting of all variables
data_req->header = header;
data_req->enb_id = mod_id;
data_req->has_enb_id = 1;
data_req->pdcp_data = rlc_data;
printf("PROTOPDCP:initialized the data_req\n");
printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame);
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
if(*msg == NULL)
goto error;
protocol__flexsplit_message__init(*msg);
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG;
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__INITIATING_MESSAGE; //we will be waiting for the ACK
(*msg)->has_msg_dir = 1;
(*msg)->data_req_msg = data_req; //data_req;
return 0;
error:
if(header != NULL)
free(header);
if(pdu!=NULL)
free(pdu);
if(rlc_data!=NULL)
free(rlc_data);
if(data_req!= NULL)
free(data_req);
if(*msg != NULL)
free(*msg);
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_MSG)
goto error;
free(msg->data_req_msg->header);
free(msg->data_req_msg->pdcp_data->fsp_pdu->fsp_pdu_data.data);
free(msg->data_req_msg->pdcp_data->fsp_pdu);
free(msg->data_req_msg->pdcp_data->fsp_ctxt);
free(msg->data_req_msg->pdcp_data);
free(msg->data_req_msg);
free(msg);
return 0;
error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg)
{
Protocol__FspHeader *header;
xid_t xid;
int result = 0;
Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params;
Protocol__FspRlcDataReq *data_req = input->data_req_msg;
xid = data_req->header->xid;
Protocol__FspRlcPdu *pdu = NULL;
Protocol__FspCtxt *ctxt = NULL;
Protocol__FspRlcData *rlc_data = NULL;
rlc_data = data_req->pdcp_data;
pdu = rlc_data->fsp_pdu;
ctxt = rlc_data->fsp_ctxt;
protocol_ctxt_t* ctxt_pP = NULL;
srb_flag_t srb_flagP = 0;
rb_id_t rb_idP = 0;
mui_t muiP = 0;
confirm_t confirmP = 0;
uint16_t pdcp_pdu_size = 0;
boolean_t flag_MBMS = 0;
mem_block_t *pdcp_pdu_p = NULL;
// Create a new protocol context for handling the packet
ctxt_pP = malloc(sizeof(protocol_ctxt_t));
ctxt_pP->module_id = ctxt->fsp_mod_id;
ctxt_pP->enb_flag = ctxt->fsp_enb_flag;
ctxt_pP->instance = ctxt->fsp_instance;
ctxt_pP->rnti = ctxt->fsp_rnti;
ctxt_pP->frame = ctxt->fsp_frame;
ctxt_pP->subframe = ctxt->fsp_subframe;
ctxt_pP->eNB_index = ctxt->fsp_enb_index;
srb_flagP = rlc_data->fsp_srb_flag;
flag_MBMS = rlc_data->fsp_mbms_flag;
rb_idP = rlc_data->fsp_rb_id;
muiP = rlc_data->fsp_muip;
confirmP = rlc_data->fsp_confirm;
pdcp_pdu_size = rlc_data->fsp_sdu_buffer_size; // Same as rlc_data->fsp_pdu_data.len
pdcp_pdu_p = malloc(pdcp_pdu_size);
memcpy(pdcp_pdu_p, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size);
// Ready to call the rlc_data_req
result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p);
if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0)
goto error;
Protocol__FspRlcDataReqAck *ack = NULL;
ack = malloc(sizeof(Protocol__FspRlcDataReqAck));
protocol__fsp_rlc_data_req_ack__init(ack);
ack->header = header;
ack->result = result;
ack->has_result = 1;
*msg = malloc(sizeof(Protocol__FlexsplitMessage));
if(*msg == NULL)
goto error;
protocol__flexsplit_message__init(*msg);
(*msg)->msg_case = PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK;
(*msg)->msg_dir = PROTOCOL__FLEXSPLIT_DIRECTION__SUCCESSFUL_OUTCOME;
(*msg)->has_msg_dir = 1;
(*msg)->data_req_ack = ack;
return 0;
error:
if(header != NULL)
free(header);
if(ack!=NULL)
free(ack);
if(*msg != NULL)
free(*msg);
LOG_E(MAC, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_DATA_REQ_ACK)
goto error;
free(msg->data_req_ack->header);
free(msg->data_req_ack);
free(msg);
return 0;
error:
LOG_E(PROTO_AGENT, "%s: an error occured\n", __FUNCTION__);
return -1;
}
int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) {
Protocol__FspHeader *header;
......@@ -137,7 +381,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa
error:
if(header != NULL)
free(header);
if(hello_msg != NULL)
if(hello_msg!=NULL)
free(hello_msg);
if(*msg != NULL)
free(*msg);
......
......@@ -50,9 +50,10 @@
#include "proto_agent_defs.h"
#include "enb_config.h"
#include "UTIL/MEM/mem_block.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/RLC/rlc.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/RLC/rlc.h"
# include "tree.h"
# include "intertask_interface.h"
......@@ -92,6 +93,10 @@ int proto_agent_destroy_echo_request(Protocol__FlexsplitMessage *msg);
int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg);
int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg);
int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg);
int proto_agent_destroy_pdcp_data_req_ack(Protocol__FlexsplitMessage *msg);
Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
......@@ -100,8 +105,18 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id,
Protocol__FlexsplitMessage *proto_agent_handle_timed_task(void *args);
typedef struct _data_req_args data_req_args;
struct _data_req_args{
protocol_ctxt_t* ctxt;
srb_flag_t srb_flag;
MBMS_flag_t MBMS_flag;
rb_id_t rb_id;
mui_t mui;
confirm_t confirm;
sdu_size_t sdu_size;
mem_block_t *sdu_p;
};
/****************************
......
......@@ -42,7 +42,7 @@
proto_agent_message_decoded_callback agent_messages_callback[][3] = {
{proto_agent_hello, proto_agent_hello, 0},
{proto_agent_echo_reply, 0, 0},
// {proto_agent_rlc_data_req, proto_agent_rlc_data_req_ack, proto_agent_rlc_data_req_nack},
{proto_agent_pdcp_data_req_ack, 0, 0},
// {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack},
};
......@@ -50,8 +50,8 @@ proto_agent_message_destruction_callback message_destruction_callback[] = {
proto_agent_destroy_hello,
proto_agent_destroy_echo_request,
proto_agent_destroy_echo_reply,
// proto_agent_destroy_rlc_data_req,
// proto_agent_destroy_rlc_data_req_ack,
proto_agent_destroy_pdcp_data_req,
proto_agent_destroy_pdcp_data_req_ack,
// proto_agent_destroy_rlc_data_req_nack,
// proto_agent_destroy_pdcp_data_ind,
// proto_agent_destroy_pdcp_data_ind_ack,
......
......@@ -43,8 +43,72 @@
#include "assertions.h"
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
// PROTO AGENT
void
async_server_thread_init (void)
{
//create log_list
//log_list_init(&log_list);
async_server_shutdown = 0;
if ((pthread_mutex_init (&async_server_lock, NULL) != 0)
|| (pthread_cond_init (&async_server_notify, NULL) != 0)) {
return;
}
if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL)
!= 0) {
async_server_thread_finalize();
return;
}
}
int
async_server_thread_finalize (void)
{
int err = 0;
if (pthread_mutex_lock (&async_server_lock) != 0) {
return -1;
}
async_server_shutdown = 1;
/* Wake up LOG thread */
if ((pthread_cond_broadcast (&async_server_notify) != 0)
|| (pthread_mutex_unlock (&async_server_lock) != 0)) {
err = -1;
}
if (pthread_join (async_server_thread, NULL) != 0) {
err = -1;
}
if (pthread_mutex_unlock (&async_server_lock) != 0) {
err = -1;
}
if (!err) {
//log_list_free(&log_list);
pthread_mutex_lock (&async_server_lock);
pthread_mutex_destroy (&async_server_lock);
pthread_cond_destroy (&async_server_notify);
}
return err;
}
extern boolean_t pdcp_data_ind(
const protocol_ctxt_t* const ctxt_pP,
......@@ -420,7 +484,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#ifdef DEBUG_RLC_DATA_REQ
LOG_D(RLC,"RLC_TYPE : %d\n", rlc_mode);
#endif
switch (rlc_mode) {
case RLC_MODE_NONE:
free_mem_block(sdu_pP);
......@@ -457,6 +521,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
break;
case RLC_MODE_UM:
//proto_server_receive();
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc));
if (new_sdu_p != NULL) {
......@@ -658,6 +725,12 @@ rlc_module_init (void)
pool_buffer_init();
/* Launch the RLC listening server
* as a separate thread
*/
async_server_thread_init();
return(0);
}
//-----------------------------------------------------------------------------
......
......@@ -62,6 +62,12 @@
# include "SRB-ToAddModList.h"
# include "DRB-ToReleaseList.h"
// for proto_agent operation
#include "UTIL/LOG/log.h"
#include "ENB_APP/enb_config.h"
#include "LAYER2/PROTO_AGENT/proto_agent.h"
#ifdef Rel10
#include "PMCH-InfoList-r9.h"
#endif
......@@ -670,4 +676,9 @@ public_rlc(int rlc_module_init(void);)
#define RLC_REVERSE_VIDEO "\e[7m"
#define RLC_NORMAL_VIDEO "\e[27m"
// PROTO AGENT
pthread_t async_server_thread;
int async_server_thread_finalize (void);
void async_server_thread_init (void);
#endif
......@@ -47,6 +47,7 @@
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <stdint.h>
......@@ -120,6 +121,7 @@ error:
return NULL;
}
socket_link_t *new_link_client(char *server, int port)
{
socket_link_t *ret = NULL;
......
......@@ -94,9 +94,6 @@ int log_list_nb_elements = 0;
pthread_mutex_t log_lock;
pthread_cond_t log_notify;
pthread_mutex_t async_server_lock;
pthread_cond_t async_server_notify;
int async_server_shutdown;
#if !defined(LOG_NO_THREAD)
int log_list_head = 0;
......
......@@ -361,6 +361,11 @@ int logInit (void);
}
#endif
pthread_mutex_t async_server_lock;
pthread_cond_t async_server_notify;
int async_server_shutdown;
#endif
package protocol;
message fsp_ctxt {
optional uint32 fsp_mod_id = 1;
optional bool fsp_enb_flag = 2;
optional uint32 fsp_instance = 3;
optional uint32 fsp_rnti = 4;
optional uint32 fsp_frame = 5;
optional uint32 fsp_subframe = 6;
optional uint32 fsp_eNB_index = 7;
}
message fspRlcPdu {
optional bytes fsp_pdu_data = 1; // Maximum PDU to be transfered
}
message fspRlcData {
optional fsp_ctxt fsp_ctxt = 1;
optional bool fsp_srb_flag = 2;
optional bool fsp_mbms_flag = 3;
optional uint32 fsp_rb_id = 4;
optional uint32 fsp_muip = 5;
optional uint32 fsp_confirm = 6;
optional int32 fsp_sdu_buffer_size = 7;
optional fspRlcPdu fsp_pdu = 8;
}
message fsp_pdcp_split_ind_data {
optional fsp_ctxt fsp_ctxt = 1;
optional bool fsp_srb_flag = 2;
optional bool fsp_mbms_flag = 3;
optional uint32 fsp_rb_id = 4;
optional int32 fsp_sdu_buffer_size = 5;
optional fspRlcPdu fsp_pdu = 6;
}
package protocol;
import "header.proto";
import "flexsplit-messages.proto";
message flexsplit_message {
optional flexsplit_direction msg_dir = 100;
......@@ -8,6 +9,9 @@ message flexsplit_message {
fsp_hello hello_msg = 1;
fsp_echo_request echo_request_msg = 2;
fsp_echo_reply echo_reply_msg = 3;
fspRlcDataReq data_req_msg = 4;
fspRlcDataReqAck data_req_ack = 5;
// fsp_pdcp_data_ind data_ind_msg = 6;
}
}
......@@ -56,3 +60,20 @@ message fsp_echo_reply {
// extensions 100 to 199;
}
message fspRlcDataReq {
optional fsp_header header = 1;
optional uint32 eNB_id = 2;
optional fspRlcData pdcp_data = 3;
}
message fspRlcDataReqAck {
optional fsp_header header = 1;
optional uint32 result = 2;
}
message fsp_pdcp_data_ind {
optional fsp_header header = 1;
optional uint32 eNB_id = 2;
optional fsp_pdcp_split_ind_data rlc_data = 3;
}
......@@ -11,5 +11,8 @@ enum fsp_type {
FSPT_HELLO = 0;
FSPT_ECHO_REQUEST = 1;
FSPT_ECHO_REPLY = 2;
FSPT_RLC_DATA_REQ = 3;
FSPT_RLC_DATA_REQ_ACK = 4;
FSPT_PDCP_DATA_IND = 5;
}
......@@ -259,68 +259,68 @@ help (void)
}
pthread_t log_thread;
pthread_t async_server_thread;
int async_server_thread_finalize (void);
void
async_server_thread_init (void)
{
//create log_list
//log_list_init(&log_list);
async_server_shutdown = 0;
if ((pthread_mutex_init (&async_server_lock, NULL) != 0)
|| (pthread_cond_init (&async_server_notify, NULL) != 0)) {
return;
}
if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL)
!= 0) {
async_server_thread_finalize();
return;
}
}
//Call it after the last LOG call
int
async_server_thread_finalize (void)
{
int err = 0;
if (pthread_mutex_lock (&async_server_lock) != 0) {
return -1;
}
async_server_shutdown = 1;
/* Wake up LOG thread */
if ((pthread_cond_broadcast (&async_server_notify) != 0)
|| (pthread_mutex_unlock (&async_server_lock) != 0)) {
err = -1;
}
if (pthread_join (async_server_thread, NULL) != 0) {
err = -1;
}
if (pthread_mutex_unlock (&async_server_lock) != 0) {
err = -1;
}
if (!err) {
//log_list_free(&log_list);
pthread_mutex_lock (&async_server_lock);
pthread_mutex_destroy (&async_server_lock);
pthread_cond_destroy (&async_server_notify);
}
return err;
}
// pthread_t async_server_thread;
// int async_server_thread_finalize (void);
//
// void
// async_server_thread_init (void)
// {
// //create log_list
// //log_list_init(&log_list);
//
// async_server_shutdown = 0;
//
// if ((pthread_mutex_init (&async_server_lock, NULL) != 0)
// || (pthread_cond_init (&async_server_notify, NULL) != 0)) {
// return;
// }
//
// if (pthread_create (&async_server_thread, NULL, proto_server_init, (void*) NULL)
// != 0) {
// async_server_thread_finalize();
// return;
// }
//
//
// }
//
// //Call it after the last LOG call
// int
// async_server_thread_finalize (void)
// {
// int err = 0;
//
//
// if (pthread_mutex_lock (&async_server_lock) != 0) {
// return -1;
// }
//
// async_server_shutdown = 1;
//
// /* Wake up LOG thread */
// if ((pthread_cond_broadcast (&async_server_notify) != 0)
// || (pthread_mutex_unlock (&async_server_lock) != 0)) {
// err = -1;
// }
//
// if (pthread_join (async_server_thread, NULL) != 0) {
// err = -1;
// }
//
// if (pthread_mutex_unlock (&async_server_lock) != 0) {
// err = -1;
// }
//
// if (!err) {
// //log_list_free(&log_list);
// pthread_mutex_lock (&async_server_lock);
// pthread_mutex_destroy (&async_server_lock);
// pthread_cond_destroy (&async_server_notify);
// }
//
//
// return err;
// }
......@@ -1451,7 +1451,7 @@ main (int argc, char **argv)
t = clock ();
async_server_thread_init();
// async_server_thread_init();
LOG_N(EMU,
">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU initialization done <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
......
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