From 2eb2b5e7bafd70a3ef47ccafedb4d34425cd8c60 Mon Sep 17 00:00:00 2001 From: Nikos Makris Date: Tue, 13 Sep 2016 21:02:20 +0300 Subject: [PATCH] First working version of the DL split. TODO list: 1) check the message handler as if the function is not present it does not return msg not handled 2) use and check return arguments from the functions calling the data req 3) parse the config file for the configuration arguments 4) clean up the messy code 5) define and use other protocols than TCP for the communication between RLC and PDCP --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 17 ++- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 131 ++++++++++++++---- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 118 +++++++++++----- .../LAYER2/PROTO_AGENT/proto_agent_common.h | 10 ++ .../LAYER2/PROTO_AGENT/proto_agent_handler.c | 22 ++- openair2/LAYER2/RLC/rlc.c | 4 +- .../MESSAGES/V2/flexsplit-messages.proto | 8 -- targets/COMMON/MESSAGES/V2/flexsplit.proto | 6 +- 8 files changed, 234 insertions(+), 82 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3b790e3e5f..86bbeffa29 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -392,10 +392,23 @@ boolean_t pdcp_data_req( //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) { + printf("subframe is %u\n", ctxt_pP->subframe); + printf("srb is %u\n", srb_flagP); + printf("MBMS is %u\n", MBMS_FLAG_NO); + printf("rb_id is %u\n", rb_idP); + printf("muiP is %u\n", muiP); + printf("confirm is %u\n", confirmP); + printf("Size is %u\n", pdcp_pdu_size); + 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 = ack_result; + printf("Response is %u\n", ack_result_nikos); + rlc_status = ack_result_nikos; + } + else + { + rlc_status = 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) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index ec31133752..0a1549afcd 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -203,12 +203,13 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; Protocol__FlexsplitMessage *rep_msg=NULL; + Protocol__FlexsplitMessage *ser_msg=NULL; int msg_flag = 0; int priority; int size; #ifdef ECHO - LOG_D(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); + LOG_I(PROTO_AGENT, "Proto agent Server: Calling the echo_request packet constructor\n"); msg_flag = proto_agent_echo_request(mod_id, NULL, &init_msg); #else LOG_D(PROTO_AGENT, "Proto agent Server: Calling the hello packet constructor\n"); @@ -217,9 +218,10 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie int msgsize = 0; int err_code; - proto_agent_serialize_message(init_msg, &msg, &msgsize); + msg = proto_agent_pack_message(init_msg, &msgsize); + //proto_agent_serialize_message(init_msg, &msg, &msgsize); - LOG_D(PROTO_AGENT,"Server sending the message over the async channel\n"); + LOG_I(PROTO_AGENT,"Server sending the message over the async channel\n"); proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) channel_info); /* After sending the message, wait for any replies; @@ -227,28 +229,43 @@ int proto_server_start(mid_t mod_id, const Enb_properties_array_t* enb_propertie over the channel */ - LOG_D(PROTO_AGENT, "Server reading any message over the async channel.\n"); + LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); while (1) { - if (proto_agent_msg_recv(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { + LOG_I(PROTO_AGENT, "Server reading any message over the async channel.\n"); + if (proto_agent_async_msg_recv(&rep_msg, &size, &priority, channel_info)){ + //(mod_id, PROTO_AGENT_DEFAULT, &rep_msg, &size, &priority)) { err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - } - LOG_D(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); + + LOG_I(PROTO_AGENT,"Server received reply message with size %d and priority %d, calling message handler\n", size, priority); msg=proto_agent_handle_message(mod_id, rep_msg, size); - + if (msg == NULL) { - LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); + LOG_I(PROTO_AGENT,"Server msg to send back is NULL\n"); } + else + { //(msg != NULL){ + ser_msg = proto_agent_pack_message(msg, &size); + //proto_agent_serialize_message(msg, &ser_msg, &size); +// if (proto_agent_msg_send(mod_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)) { + + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_I(PROTO_AGENT,"sent message with size %d\n", size); + } + } LOG_I(PROTO_AGENT,"server ends\n"); return 0; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_I(PROTO_AGENT,"there was an error\n"); return 1; } @@ -304,13 +321,49 @@ int proto_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); */ - new_thread(receive_thread, &proto_agent[mod_id]); - LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); + // Do not call a new thread, but do the msg exchange without threads + //new_thread(receive_thread, &proto_agent[mod_id]); + + void *data; + int size; + int priority; + err_code_t err_code; + Protocol__FlexsplitMessage *msg; + Protocol__FlexsplitMessage *ser_msg; + + if (proto_agent_async_msg_recv(&data, &size, &priority, channel_info)) { + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_I(PROTO_AGENT,"Received message with size %d and priority %d, calling message handle\n", size, priority); + + msg=proto_agent_handle_message(proto_agent[mod_id].enb_id, data, size); + + if (msg == NULL) + { + LOG_I(PROTO_AGENT," CLIENT msg to send back is NULL\n"); + } + + //free(data); + + if (msg != NULL){ + ser_msg = proto_agent_pack_message(msg, &size); + //proto_agent_serialize_message(msg, &ser_msg, &size); + if( proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; + } + LOG_I(PROTO_AGENT,"CLIENT sent message with size %d\n", size); + } + + + //LOG_D(PROTO_AGENT, "Client launched the the receive thread for mod_id %d\n", proto_agent[mod_id]); return 0; error: - LOG_E(PROTO_AGENT,"there was an error\n"); + LOG_E(PROTO_AGENT,"there was an error %u\n", err_code); return 1; } @@ -346,10 +399,13 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { - printf("PROTOPDCP: sendig the data req over the async channel\n"); + printf("PROTOPDCP: sending the data req over the async channel\n"); Protocol__FlexsplitMessage *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; + Protocol__FlexsplitMessage *rep = NULL; + Protocol__FlexsplitMessage *srep = NULL; + //Protocol__FlexsplitMessage *rep_msg=NULL; int msg_flag = 0; void *data=NULL; @@ -380,38 +436,55 @@ proto_agent_send_rlc_data_req(const protocol_ctxt_t* const ctxt_pP, const srb_fl 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"); + msg = proto_agent_pack_message(init_msg, &msgsize); + + free(init_msg); + + LOG_I(PROTO_AGENT,"Server sending the pdcp data_req 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; + // while (1) { + /* + msg = NULL; + rep = NULL;*/ + //data = NULL; + msgsize = 0; + priority = 0; + msg = NULL; + + while (rep == NULL) + { + if (proto_agent_async_msg_recv(&rep, &msgsize, &priority, client_channel)) { + 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); + msg = proto_agent_handle_message(proto_agent[client_mod].enb_id, rep, msgsize); if (msg == NULL) { LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } + else + { + srep = proto_agent_pack_message(rep, &size); - free(data); + //free(data); - if (msg != NULL){ - if (proto_agent_msg_send(proto_agent[client_mod].enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { + + if (proto_agent_async_msg_send((void *)msg, (int) size, 1, (void *) client_channel)){ + //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"); @@ -449,7 +522,7 @@ proto_server_receive(void) LOG_E(PROTO_AGENT,"msg to send back is NULL\n"); } - free(data); + //free(data); if (msg != NULL){ if (proto_agent_msg_send(d->enb_id, PROTO_AGENT_DEFAULT, msg, size, priority)) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index a2a5de6edc..98d77fb36f 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -112,6 +112,12 @@ int fsp_create_header(xid_t xid, Protocol__FspType type, Protocol__FspHeader ** return -1; } +int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + printf("Called the callback function, returing 1\n"); + return 1; +} + int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { @@ -121,6 +127,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp // Create the protobuf header Protocol__FspHeader *header; xid_t xid = 1; + LOG_I(PROTO_AGENT, "creating the data_req message\n"); if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ, &header) != 0) goto error; @@ -130,26 +137,29 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp * 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__FspRlcPdu *pdu = NULL; Protocol__FspRlcData *rlc_data = NULL; Protocol__FspRlcDataReq *data_req = NULL; - pdu = malloc(sizeof(Protocol__FspRlcPdu)); + ctxt = malloc(sizeof(Protocol__FspCtxt)); + pdu = malloc(sizeof(Protocol__FspRlcPdu)); 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_pdu__init(pdu); 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); + printf("MSG payload is %u", 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 @@ -169,8 +179,7 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp ctxt->has_fsp_subframe = 1; ctxt->has_fsp_enb_index = 1; - - rlc_data->fsp_ctxt = ctxt; + 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; @@ -195,9 +204,9 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp 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); + printf("PROTOPDCP2: instance is %u, fame is %u", args->ctxt->instance, args->ctxt->frame);*/ *msg = malloc(sizeof(Protocol__FlexsplitMessage)); @@ -233,13 +242,13 @@ 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); + //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: @@ -247,39 +256,61 @@ int proto_agent_destroy_pdcp_data_req(Protocol__FlexsplitMessage *msg) { return -1; } +int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) +{ + // printf("Inside data handler for ACK"); + Protocol__FspHeader *header; + xid_t xid; + rlc_op_status_t result = 0; + + LOG_I(PROTO_AGENT, "handling the data_req_ack message\n"); + + Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; + Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; + + result = data_ack->result; + printf("Received result is %u\n", result); + ack_result_nikos = result; + +} + 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; + rlc_op_status_t result = 0; + + LOG_I(PROTO_AGENT, "creating the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReq *data_req = input->data_req_msg; - xid = data_req->header->xid; + 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; + protocol_ctxt_t *ctxt_pP; 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; + sdu_size_t pdcp_pdu_size = 0; + MBMS_flag_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; @@ -288,22 +319,34 @@ int proto_agent_pdcp_data_req_ack(mid_t mod_id, const void *params, Protocol__Fl 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_size = rlc_data->fsp_pdu->fsp_pdu_data.len; + //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); + pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); + //malloc(pdcp_pdu_size); + memcpy(pdcp_pdu_p->data, rlc_data->fsp_pdu->fsp_pdu_data.data, pdcp_pdu_size); + + //memset(pdcp_pdu_p, 0, 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); - + result = rlc_data_req((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, (const mui_t) muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); +// printf("subframe is %u\n", ctxt_pP->subframe); +// printf("srb is %u\n", srb_flagP); +// printf("MBMS is %u\n", flag_MBMS); +// printf("rb_id is %u\n", rb_idP); +// printf("muiP is %u\n", muiP); +// printf("confirm is %u\n", confirmP); +// printf("Size is %u\n", pdcp_pdu_size); + //result = rlc_data_req(ctxt_pP, srb_flagP, flag_MBMS, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); + + printf("result is %u\n", result); + if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_RLC_DATA_REQ_ACK, &header) != 0) goto error; @@ -342,9 +385,9 @@ 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); + //free(msg->data_req_ack->header); + //free(msg->data_req_ack); + //free(msg); return 0; error: @@ -360,6 +403,7 @@ int proto_agent_hello(mid_t mod_id, const void *params, Protocol__FlexsplitMessa if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_HELLO, &header) != 0) goto error; + LOG_I(PROTO_AGENT, "creating the HELLO message\n"); Protocol__FspHello *hello_msg = NULL; hello_msg = malloc(sizeof(Protocol__FspHello)); if(hello_msg == NULL) @@ -412,7 +456,8 @@ int proto_agent_echo_request(mid_t mod_id, const void* params, Protocol__Flexspl if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REQUEST, &header) != 0) goto error; LOG_I(PROTO_AGENT,"Created the fsp message header\n"); - + LOG_I(PROTO_AGENT, "creating the echo request message\n"); + Protocol__FspEchoRequest *echo_request_msg = NULL; echo_request_msg = malloc(sizeof(Protocol__FspEchoRequest)); if(echo_request_msg == NULL) @@ -464,6 +509,9 @@ int proto_agent_echo_reply(mid_t mod_id, const void *params, Protocol__Flexsplit Protocol__FspEchoRequest *echo_req = input->echo_request_msg; xid = (echo_req->header)->xid; + + + LOG_I(PROTO_AGENT, "creating the echo reply message\n"); Protocol__FspHeader *header; if (fsp_create_header(xid, PROTOCOL__FSP_TYPE__FSPT_ECHO_REPLY, &header) != 0) goto error; @@ -500,9 +548,9 @@ int proto_agent_destroy_echo_reply(Protocol__FlexsplitMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXSPLIT_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; - free(msg->echo_reply_msg->header); - free(msg->echo_reply_msg); - free(msg); + //free(msg->echo_reply_msg->header); + //free(msg->echo_reply_msg); + //free(msg); return 0; error: diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index 57cbf6a7d0..4622b0718b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -71,6 +71,9 @@ typedef int (*proto_agent_message_destruction_callback)( Protocol__FlexsplitMessage *msg ); + +uint32_t ack_result_nikos; + /********************************** * progRAN protocol messages helper * functions and generic handlers @@ -97,6 +100,13 @@ int proto_agent_pdcp_data_req(mid_t mod_id, const void *params, Protocol__Flexsp 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); +int proto_agent_pdcp_data_ind(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); +int proto_agent_destroy_pdcp_data_ind(Protocol__FlexsplitMessage *msg); + +int just_print(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); + + +int proto_agent_get_ack_result(mid_t mod_id, const void *params, Protocol__FlexsplitMessage **msg); Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c index b32094be32..fd307dfb9c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_handler.c @@ -42,7 +42,10 @@ proto_agent_message_decoded_callback agent_messages_callback[][3] = { {proto_agent_hello, proto_agent_hello, 0}, {proto_agent_echo_reply, 0, 0}, + {0, just_print, 0}, {proto_agent_pdcp_data_req_ack, 0, 0}, + {0, proto_agent_get_ack_result, 0}, + {0, 0, 0}, // {proto_agent_pdcp_data_ind, proto_agent_pdcp_data_ind_ack, proto_agent_rlc_data_ind_nack}, }; @@ -70,11 +73,12 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size){ - Protocol__FlexsplitMessage *decoded_message, *reply_message; + Protocol__FlexsplitMessage *decoded_message = NULL; + Protocol__FlexsplitMessage *reply_message = NULL; err_code_t err_code; DevAssert(data != NULL); - LOG_D(PROTO_AGENT, "Deserializing message \n"); + LOG_I(PROTO_AGENT, "Deserializing message with size %u \n", size); if (proto_agent_deserialize_message(data, (int) size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_DECODING; goto error; @@ -82,17 +86,27 @@ Protocol__FlexsplitMessage* proto_agent_handle_message (mid_t mod_id, Protocol__FspHeader *header = (Protocol__FspHeader*) decoded_message; if (header->has_type) { - LOG_D(PROTO_AGENT, "Deserialized MSG type is %d\n", header->type); + LOG_I(PROTO_AGENT, "Deserialized MSG type is %d and %u\n", decoded_message->msg_case, decoded_message->msg_dir); } + //printf("HANDLER: msg_case %u msg_dir %u\n\n", decoded_message->msg_case, decoded_message->msg_dir); if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(proto_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXSPLIT_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__FLEXSPLIT_ERR__MSG_NOT_HANDLED; - LOG_D(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); + LOG_I(PROTO_AGENT,"Handling message: MSG NOT handled, going to error\n"); goto error; } + + +// if ((decoded_message->msg_case != 5)&&(decoded_message->msg_dir!=2)){ err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); + printf("Err code is %u\n", err_code); +// } +// else{ +// err_code = 0; +// } + if ( err_code < 0 ) { goto error; diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 940f1f11dc..dc5cf82ce8 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -396,6 +396,8 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, mem_block_t *sdu_pP) { //----------------------------------------------------------------------------- + + mem_block_t *new_sdu_p = NULL; rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_union_t *rlc_union_p = NULL; @@ -484,7 +486,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); diff --git a/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto index e368e45007..cbb3b2dbf1 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit-messages.proto @@ -26,11 +26,3 @@ message fspRlcData { 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; -} diff --git a/targets/COMMON/MESSAGES/V2/flexsplit.proto b/targets/COMMON/MESSAGES/V2/flexsplit.proto index 22aa80789c..b743ebe2c0 100644 --- a/targets/COMMON/MESSAGES/V2/flexsplit.proto +++ b/targets/COMMON/MESSAGES/V2/flexsplit.proto @@ -11,7 +11,7 @@ message flexsplit_message { 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; + fspPdcpDataInd data_ind_msg = 6; } } @@ -72,8 +72,8 @@ message fspRlcDataReqAck { optional uint32 result = 2; } -message fsp_pdcp_data_ind { +message fspPdcpDataInd { optional fsp_header header = 1; optional uint32 eNB_id = 2; - optional fsp_pdcp_split_ind_data rlc_data = 3; + optional fspRlcData rlc_data = 3; }