From 3ad16e980675afecb497b552e0a2609e8cf46c68 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Sep 2018 18:51:19 +0200 Subject: [PATCH] minor fixes --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 57 +++++++++---------- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 8 +-- .../LAYER2/PROTO_AGENT/proto_agent_async.c | 11 ++-- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 5 -- 4 files changed, 35 insertions(+), 46 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index e798500357..ee12cd6257 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -49,8 +49,6 @@ pthread_t new_thread(void *(*f)(void *), void *b); Protocol__FlexsplitMessage *proto_agent_timeout_fsp(void* args); -proto_agent_async_channel_t *client_channel[MAX_DU], *server_channel; - #define TEST_MOD 0 #define ECHO @@ -77,8 +75,6 @@ int proto_server_start(mod_id_t mod_id, const cu_params_t *cu) proto_agent_async_channel_t *channel_info; channel_info = proto_server_async_channel_info(mod_id, cu->local_ipv4_address, cu->local_port); - server_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, @@ -223,8 +219,10 @@ error: void -proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, 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) +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) { //LOG_D(PROTO_AGENT, "PROTOPDCP: sending the data req over the async channel\n"); @@ -233,6 +231,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct Protocol__FlexsplitMessage *init_msg=NULL; int msg_flag = 0; + mod_id_t mod_id = ctxt_pP->module_id; //printf( "PDCP agent: Calling the PDCP DATA REQ constructor\n"); @@ -249,7 +248,7 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct args->sdu_p = malloc(sdu_sizeP); memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - msg_flag = proto_agent_pdcp_data_req(type_id, (void *) args, &init_msg); + msg_flag = proto_agent_pdcp_data_req(mod_id, (void *) args, &init_msg); if (msg_flag != 0) goto error; @@ -263,7 +262,8 @@ proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, const protocol_ct LOG_D(PROTO_AGENT, "Sending the pdcp data_req message over the async channel\n"); if (msg!=NULL) - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) client_channel[mod_id]); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, + proto_agent[mod_id].channel->channel_info); } else @@ -290,6 +290,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f int msg_flag = 0; + mod_id_t mod_id = ctxt_pP->module_id; //printf( "PDCP agent: Calling the PDCP_DATA_IND constructor\n"); @@ -304,8 +305,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f args->sdu_p = malloc(sdu_sizeP); memcpy(args->sdu_p, sdu_pP->data, sdu_sizeP); - AssertFatal(0, "need mod_id here\n"); - msg_flag = proto_agent_pdcp_data_ind(proto_server[0].mod_id, (void *) args, &init_msg); + msg_flag = proto_agent_pdcp_data_ind(mod_id, (void *) args, &init_msg); if (msg_flag != 0) goto error; @@ -318,7 +318,7 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_f if (msg!=NULL) { LOG_D(PROTO_AGENT, "Sending the pdcp data_ind message over the async channel\n"); - proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, (void *) server_channel); + proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_server[mod_id].channel->channel_info); } } else @@ -339,7 +339,7 @@ error: void * proto_server_receive(void *args) { - proto_agent_instance_t *d = args; + proto_agent_instance_t *inst = args; void *data = NULL; int size; int priority; @@ -353,14 +353,14 @@ proto_server_receive(void *args) msg = NULL; ser_msg = NULL; - if (proto_agent_async_msg_recv(&data, &size, &priority, server_channel)){ + if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } LOG_D(PROTO_AGENT, "Server side Received message with size %d and priority %d, calling message handle\n", size, priority); - msg=proto_agent_handle_message(d->mod_id, data, size); + msg=proto_agent_handle_message(inst->mod_id, data, size); if (msg == NULL) { @@ -373,9 +373,9 @@ proto_server_receive(void *args) LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) server_channel)){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; } LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } @@ -394,10 +394,8 @@ void * proto_client_receive(void *args) { AssertFatal(0, "check proto_client_receive\n"); - mod_id_t recv_mod = 0; + proto_agent_instance_t *inst = args; - LOG_D(PROTO_AGENT, "\n\nrecv mod is %u\n\n",recv_mod); - //proto_agent_instance_t *d = &proto_agent[TEST_MOD]; void *data = NULL; int size; int priority; @@ -412,19 +410,16 @@ proto_client_receive(void *args) msg = NULL; ser_msg = NULL; - while(client_channel[recv_mod] == NULL) - { - //just wait - } - LOG_D(PROTO_AGENT, "Will receive packets\n"); - if (proto_agent_async_msg_recv(&data, &size, &priority, client_channel[recv_mod])){ + if (proto_agent_async_msg_recv(&data, &size, &priority, inst->channel->channel_info)){ err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; goto error; } - LOG_D(PROTO_AGENT, "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", size, priority, recv_mod); + LOG_D(PROTO_AGENT, + "Client Received message with size %d and priority %d, calling message handle with mod_id %u\n", + size, priority, inst->mod_id); - msg=proto_agent_handle_message(recv_mod, data, size); + msg = proto_agent_handle_message(inst->mod_id, data, size); if (msg == NULL) { @@ -437,9 +432,9 @@ proto_client_receive(void *args) LOG_D(PROTO_AGENT, "Server sending the reply message over the async channel\n"); if (ser_msg != NULL){ - if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, (void *) client_channel[recv_mod])){ - err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; - goto error; + if (proto_agent_async_msg_send((void *)ser_msg, (int) size, 1, inst->channel->channel_info)){ + err_code = PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING; + goto error; } LOG_D(PROTO_AGENT, "sent message with size %d\n", size); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 468016a2ec..7b69b82379 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -52,10 +52,10 @@ int proto_agent_stop(mod_id_t mod_id); void *proto_agent_task(void *args); -void proto_agent_send_rlc_data_req(uint8_t mod_id, uint8_t type_id, - 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); +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); void proto_agent_send_pdcp_data_ind(const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c index 0e206b7183..9bf861b056 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_async.c @@ -110,21 +110,20 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *dst_ip, uint16_t dst return NULL; } -int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { +int proto_agent_async_msg_send(void *data, int size, int priority, void *channel_info) +{ proto_agent_async_channel_t *channel = channel_info; - return message_put(channel->send_queue, data, size, priority); } int proto_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - proto_agent_async_channel_t *channel; - channel = (proto_agent_async_channel_t *)channel_info; - + proto_agent_async_channel_t *channel = channel_info; return message_get(channel->receive_queue, data, size, priority); } -void proto_agent_async_release(proto_agent_channel_t *channel) { +void proto_agent_async_release(proto_agent_channel_t *channel) +{ proto_agent_async_channel_t *channel_info; channel_info = (proto_agent_async_channel_t *) channel->channel_info; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index d89c0b09ae..147af52a12 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -45,11 +45,6 @@ #include "RRC/LTE/rrc_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" -//#include "LAYER2/PDCP_v10.1.0/pdcp_primitives.h" - -void * enb[NUM_MAX_ENB]; -void * enb_ue[NUM_MAX_ENB]; -void * enb_rrc[NUM_MAX_ENB]; /* * message primitives