diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index f2ea48d3c659090dc4360bb7b7a825db914f9cab..9d6fc20ac393ab220b773774d74666bb76ca4a7d 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -168,7 +168,7 @@ int main(int argc, char **argv) AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); rc = itti_create_task(TASK_CUUP_E1, E1AP_CUUP_task, NULL); AssertFatal(rc >= 0, "Create task for CUUP E1 failed\n"); - nr_pdcp_layer_init(true); + nr_pdcp_layer_init(); cu_init_f1_ue_data(); // for CU-UP/CP mapping: we use the same E1_t e1type = UPtype; MessageDef *msg = RCconfig_NR_CU_E1(&e1type); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c28b74140604786a9cc35e95f711403c39f9ff5c..e480206c2590e7511ce4203f305276deb92eb4e5 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -532,7 +532,7 @@ void init_pdcp(void) { uint32_t pdcp_initmask = IS_SOFTMODEM_NOS1 ? ENB_NAS_USE_TUN_BIT : LINK_ENB_PDCP_TO_GTPV1U_BIT; if (!NODE_IS_DU(get_node_type())) { - nr_pdcp_layer_init(get_node_type() == ngran_gNB_CUCP); + nr_pdcp_layer_init(); nr_pdcp_module_init(pdcp_initmask, 0); } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 99ce9040d4372db826985efd52cd506132d4dc9b..f665dd26738c354537b955c30711b68e0800a404 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -317,7 +317,7 @@ static void init_pdcp(int ue_id) if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) { LOG_I(RLC, "Problem at RLC initiation \n"); } - nr_pdcp_layer_init(false); + nr_pdcp_layer_init(); nr_pdcp_module_init(pdcp_initmask, ue_id); } diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 44fc9887006b1c9e11615a90ce887f9f4f07edc2..e8519a151a1a0c9fb71941882bdf35b6c9314894 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -277,7 +277,7 @@ void mac_top_init_gNB(ngran_node_t node_type, AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); // These should be out of here later - if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(false); + if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(); if(IS_SOFTMODEM_NOS1 && get_softmodem_params()->phy_test) { // get default noS1 configuration diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d9efb527765ef9617546669731be43ae7cefdb19..a416ddd617c50efd43d7266b36d4bdf2b76bb532 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -566,7 +566,7 @@ void pdcp_layer_init(void) abort(); } -void nr_pdcp_layer_init(bool uses_e1) +void nr_pdcp_layer_init(void) { /* hack: be sure to initialize only once */ static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; @@ -586,10 +586,12 @@ void nr_pdcp_layer_init(bool uses_e1) if ((RC.nrrrc == NULL) || (!NODE_IS_CU(node_type))) { init_nr_rlc_data_req_queue(); } - - nr_pdcp_e1_if_init(uses_e1); + nr_pdcp_e1_if_init(node_type == ngran_gNB_CUUP || node_type == ngran_gNB_CUCP); init_nr_pdcp_data_ind_queue(); nr_pdcp_init_timer_thread(nr_pdcp_ue_manager); + if (NODE_IS_CU(node_type)) { + nr_pdcp_init_tick_thread(); + } } #include "nfapi/oai_integration/vendor_ext.h" diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index 101200615ef8ab6d241f10f75a5d88c4bfc82e39..967a2719ee9da84a9f271521a05c44e659a1c328 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -25,7 +25,7 @@ #include "pdcp.h" #include "nr_pdcp_ue_manager.h" -void nr_pdcp_layer_init(bool uses_e1); +void nr_pdcp_layer_init(void); uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id); void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c index 5f6939e165e3d44b62dff08f91ed9bc65af6326f..1c5e926feab07f860e5a6ce9fd8be2ec0726bddc 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c @@ -70,6 +70,26 @@ static void *nr_pdcp_timer_thread(void *_nr_pdcp_ue_manager) return NULL; } +static void *nr_pdcp_tick_thread() { + pthread_setname_np(pthread_self(),"nr_pdcp_tick_thread"); + uint64_t curr_time = 0; + while (1) { + usleep(1000); + curr_time++; + nr_pdcp_wakeup_timer_thread(curr_time); + } + return NULL; +} + +void nr_pdcp_init_tick_thread() +{ + pthread_t t; + if (pthread_create(&t, NULL, nr_pdcp_tick_thread, NULL) != 0) { + LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } +} + void nr_pdcp_init_timer_thread(nr_pdcp_ue_manager_t *nr_pdcp_ue_manager) { pthread_t t; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h index db8282f940057393b099b4f9e50542838fb30991..552d5da279caae242e8b812116e9235a59a64fa2 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.h @@ -26,6 +26,7 @@ #include <stdint.h> +void nr_pdcp_init_tick_thread(); void nr_pdcp_init_timer_thread(nr_pdcp_ue_manager_t *nr_pdcp_ue_manager); void nr_pdcp_wakeup_timer_thread(uint64_t time);