From b4f462b9c816e1ef91226c486a3420a70df1edbf Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Apr 2019 13:41:14 +0200 Subject: [PATCH 1/3] Align PROTO_AGENT functions with PDCP/RLC function pointers --- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 10 +++++----- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 7cc0db24a7..a39ebc6c84 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -191,14 +191,14 @@ rlc_op_status_t proto_agent_send_rlc_data_req(const protocol_ctxt_t *const ctxt proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); free_mem_block(sdu_pP, __func__); - return 0; + return RLC_OP_STATUS_OK; error: LOG_E(PROTO_AGENT, "PROTO_AGENT there was an error\n"); - return -1; + return RLC_OP_STATUS_INTERNAL_ERROR; } -void +boolean_t 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, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { uint8_t *msg = NULL; @@ -225,10 +225,10 @@ proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_f proto_agent_async_msg_send((void *)msg, (int) msgsize, 1, proto_agent[mod_id].channel->channel_info); free_mem_block(sdu_pP, __func__); - return; + return TRUE; error: LOG_E(PROTO_AGENT, "there was an error in %s\n", __func__); - return; + return FALSE; } void * diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 674bd245e2..927b714b2c 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -51,7 +51,7 @@ rlc_op_status_t proto_agent_send_rlc_data_req( const protocol_ctxt_t *const ctxt 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, +boolean_t 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, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); From 42713b95fcc2ffe8dfebaf45efd6592c23107a67 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Apr 2019 11:35:21 +0200 Subject: [PATCH 2/3] Configure complete PDCP in lte-(ue)softmodem * Instead of partly initializing in read_config_and_init(), everything of PDCP is initialized in main() of lte-softmodem * Omit RC.rrc access in RRU through checking of RC.nb_inst > 0 * Includes FlexRAN, i.e. do not start FlexRAN in RRU * Function pointers to PDCP functions have to be set explicitly (avoid confusion of multiply setting function pointers) --- openair2/ENB_APP/enb_config.c | 8 ----- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 3 -- openair2/LAYER2/RLC/rlc.c | 4 --- targets/RT/USER/lte-softmodem.c | 46 +++++++++++++++++++---------- targets/RT/USER/lte-softmodem.h | 1 + targets/RT/USER/lte-uesoftmodem.c | 24 ++++++++++----- 6 files changed, 48 insertions(+), 38 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 341981fcf0..98ca565216 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2569,12 +2569,4 @@ void read_config_and_init(void) { memset((void *)RC.rrc[enb_id], 0, sizeof(eNB_RRC_INST)); RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } - - if (!NODE_IS_DU(RC.rrc[0]->node_type)) { - pdcp_layer_init(); - - if ( NODE_IS_CU(RC.rrc[0]->node_type) ) { - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req, (pdcp_data_ind_func_t)proto_agent_send_pdcp_data_ind); - } - } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 016b626738..3687f25fda 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -2175,9 +2175,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { netlink_init(); } } - - /* default interface with rlc (will be modified if CU) */ - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)rlc_data_req, (pdcp_data_ind_func_t) pdcp_data_ind); return pdcp_params.optmask ; } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 7454e253b5..70e0ecd20a 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -52,10 +52,6 @@ extern boolean_t pdcp_data_ind( //#define TRACE_RLC_PAYLOAD 1 #define DEBUG_RLC_DATA_REQ 1 - - -#include "proto_agent.h" - //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) //----------------------------------------------------------------------------- diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index fbfcf9020b..cd8cf3cf38 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -575,6 +575,27 @@ int restart_L1L2(module_id_t enb_id) { return 0; } +void init_pdcp(void) { + if (!NODE_IS_DU(RC.rrc[0]->node_type)) { + pdcp_layer_init(); + uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? + (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; + if (IS_SOFTMODEM_NOS1) + pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ; + pdcp_module_init(pdcp_initmask); + + if (NODE_IS_CU(RC.rrc[0]->node_type)) { + pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req, + (pdcp_data_ind_func_t)proto_agent_send_pdcp_data_ind); + } else { + pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)rlc_data_req, + (pdcp_data_ind_func_t) pdcp_data_ind); + } + } else { + pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req, + (pdcp_data_ind_func_t)proto_agent_send_pdcp_data_ind); + } +} static void wait_nfapi_init(char *thread_name) { printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name); @@ -654,24 +675,19 @@ int main( int argc, char **argv ) { fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx); /* Read configuration */ - if (RC.nb_inst > 0) + if (RC.nb_inst > 0) { read_config_and_init(); - /* Start the agent. If it is turned off in the configuration, it won't start */ - RCconfig_flexran(); + /* Start the agent. If it is turned off in the configuration, it won't start */ + RCconfig_flexran(); + for (i = 0; i < RC.nb_inst; i++) { + flexran_agent_start(i); + } - for (i = 0; i < RC.nb_inst; i++) { - flexran_agent_start(i); - } + /* initializes PDCP and sets correct RLC Request/PDCP Indication callbacks + * for monolithic/F1 modes */ + init_pdcp(); - uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; - - if ( IS_SOFTMODEM_NOS1) - pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ; - - pdcp_module_init(pdcp_initmask); - - if (RC.nb_inst > 0) { if (create_tasks(1) < 0) { printf("cannot create ITTI tasks\n"); exit(-1); @@ -683,7 +699,7 @@ int main( int argc, char **argv ) { itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } } else { - printf("No ITTI, Initializing L1\n"); + printf("RC.nb_inst = 0, Initializing L1\n"); RCconfig_L1(); } diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 2d05ca174e..5900889e6d 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -35,6 +35,7 @@ #include "flexran_agent.h" #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" +#include "proto_agent.h" /* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ #define CONFIG_HLP_RFCFGF "Configuration file for front-end (e.g. LMS7002M)\n" diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 3ae3e22ef0..c6e716306f 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -659,6 +659,21 @@ int restart_L1L2(module_id_t enb_id) { return 0; } +void init_pdcp(void) { + uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); + + if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) { + pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; + } + + if (IS_SOFTMODEM_NOKRNMOD) + pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; + + pdcp_module_init(pdcp_initmask); + pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)rlc_data_req, + (pdcp_data_ind_func_t) pdcp_data_ind); +} + int main( int argc, char **argv ) { #if defined (XFORMS) void *status; @@ -734,16 +749,9 @@ int main( int argc, char **argv ) { MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); init_opt(); - uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1 )? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT); - if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF) ) { - pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; - } + init_pdcp(); - if ( IS_SOFTMODEM_NOKRNMOD) - pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; - - pdcp_module_init( pdcp_initmask ); //TTN for D2D printf ("RRC control socket\n"); rrc_control_socket_init(); From 82db43219143dacfc8818710e1942b377cd3df07 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Apr 2019 16:21:44 +0200 Subject: [PATCH 3/3] Make separate func_ptr setters for PDCP Ind/RLC Req --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 6 ++++-- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 4 ++-- targets/RT/USER/lte-softmodem.c | 10 ++++------ targets/RT/USER/lte-uesoftmodem.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3687f25fda..d1252c8d5a 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -2140,9 +2140,11 @@ pdcp_data_ind_func_t get_pdcp_data_ind_func() { return pdcp_params.pdcp_data_ind_func; } -void pdcp_set_rlc_funcptr(send_rlc_data_req_func_t send_rlc_data_req, - pdcp_data_ind_func_t pdcp_data_ind) { +void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req) { pdcp_params.send_rlc_data_req_func = send_rlc_data_req; +} + +void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) { pdcp_params.pdcp_data_ind_func = pdcp_data_ind; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 305b8ab2b4..860f90bf34 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -412,8 +412,8 @@ int pdcp_fifo_flush_sdus ( const protocol_ctxt_t *const ct int pdcp_fifo_read_input_sdus_remaining_bytes ( const protocol_ctxt_t *const ctxt_pP); int pdcp_fifo_read_input_sdus ( const protocol_ctxt_t *const ctxt_pP); void pdcp_fifo_read_input_sdus_from_otg ( const protocol_ctxt_t *const ctxt_pP); -void pdcp_set_rlc_funcptr(send_rlc_data_req_func_t send_rlc_data_req, - pdcp_data_ind_func_t pdcp_data_ind); +void pdcp_set_rlc_data_req_func(send_rlc_data_req_func_t send_rlc_data_req); +void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind); pdcp_data_ind_func_t get_pdcp_data_ind_func(void); //----------------------------------------------------------------------------- diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index cd8cf3cf38..c87ebb0af3 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -585,15 +585,13 @@ void init_pdcp(void) { pdcp_module_init(pdcp_initmask); if (NODE_IS_CU(RC.rrc[0]->node_type)) { - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req, - (pdcp_data_ind_func_t)proto_agent_send_pdcp_data_ind); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); } else { - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)rlc_data_req, - (pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); } } else { - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req, - (pdcp_data_ind_func_t)proto_agent_send_pdcp_data_ind); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); } } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index c6e716306f..fdfdbfc1dd 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -670,8 +670,8 @@ void init_pdcp(void) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; pdcp_module_init(pdcp_initmask); - pdcp_set_rlc_funcptr((send_rlc_data_req_func_t)rlc_data_req, - (pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); + pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); } int main( int argc, char **argv ) {