diff --git a/CMakeLists.txt b/CMakeLists.txt index 8504704280f237bb52c6aceab4eef399ffd435b8..53fed857090a778e05eb30f473c798275433c319 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1216,6 +1216,10 @@ set(NR_PDCP_SRC ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia1.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c + openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c + openair2/LAYER2/nr_pdcp/cuup_cucp_if.c + openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c + openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c ) set(NR_SDAP_SRC diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 2992953ef05d452326e6d259875cc69d871372a3..95348dcf195cc5c4c9ce522cea00c48482a92d05 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -134,7 +134,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(); + nr_pdcp_layer_init(true); cu_init_f1_ue_data(); // for CU-UP/CP mapping: we use the same MessageDef *msg = RCconfig_NR_CU_E1(true); AssertFatal(msg != NULL, "Send init to task for E1AP UP failed\n"); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index cbb36dc580b6cc946bc3ab26a7e4abee8aa74739..47e2289f36783912d2c9e8a1e606bb6caae9bdfb 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -566,7 +566,7 @@ void init_pdcp(void) { LINK_ENB_PDCP_TO_GTPV1U_BIT; if (!NODE_IS_DU(get_node_type())) { - nr_pdcp_layer_init(); + nr_pdcp_layer_init(get_node_type() == ngran_gNB_CUCP); nr_pdcp_module_init(pdcp_initmask, 0); } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index e5332e8e5effe5839ab27c4f351b8f84601dcbed..a267211ce575b3732265f064f3253d2f6b9fbc36 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -380,7 +380,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(); + nr_pdcp_layer_init(false); nr_pdcp_module_init(pdcp_initmask, ue_id); 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); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index b4ec1cb9ebebc7ab20e8aba45b48007bf64e13a9..77c6fd6c8de4ee7034483f72f1d29f393a3f40d5 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -96,7 +96,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { fill_nr_noS1_bearer_config(&rbconfig, &rlc_rbconfig); // set up PDCP, RLC, MAC - nr_pdcp_layer_init(); + nr_pdcp_layer_init(false); nr_pdcp_add_drbs(ENB_FLAG_NO, nr_ue_mac_inst->crnti, rbconfig->drb_ToAddModList, 0, NULL, NULL); nr_rlc_add_drb(nr_ue_mac_inst->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list; diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index d0ee9587ef679cff79d5a8a736728d058e5e3885..fba6dde5070406052320344f54fd1594d2349ba7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -271,7 +271,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(); + if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(false); if(IS_SOFTMODEM_NOS1 && get_softmodem_params()->phy_test) { // get default noS1 configuration diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c new file mode 100644 index 0000000000000000000000000000000000000000..76575e65d9900fdfecee9be8cac39e5c09dfa358 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -0,0 +1,22 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "cucp_cuup_handler.h" diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h new file mode 100644 index 0000000000000000000000000000000000000000..ea75eb366e31590b9d5345fc055c838b7c17f6c4 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h @@ -0,0 +1,29 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef CUCP_CUUP_HANDLER_H +#define CUCP_CUUP_HANDLER_H + +#include <stdbool.h> + +void nr_pdcp_e1_if_init(bool uses_e1); + +#endif /* CUCP_CUUP_HANDLER_H */ diff --git a/openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c b/openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c new file mode 100644 index 0000000000000000000000000000000000000000..2741b473c0c4e4da052f925537dea9568d5dc5dd --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c @@ -0,0 +1,27 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "cuup_cucp_if.h" + +void cuup_cucp_init_direct(e1_if_t *iface) +{ + (void) iface; +} diff --git a/openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c b/openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c new file mode 100644 index 0000000000000000000000000000000000000000..48dc148473b93fde3215ce8be6fe894caa1eb5eb --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c @@ -0,0 +1,27 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "cuup_cucp_if.h" + +void cuup_cucp_init_e1ap(e1_if_t *iface) +{ + (void) iface; +} diff --git a/openair2/LAYER2/nr_pdcp/cuup_cucp_if.c b/openair2/LAYER2/nr_pdcp/cuup_cucp_if.c new file mode 100644 index 0000000000000000000000000000000000000000..ddeb59205e2d99723e76ba6eb6d720e4403409a4 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cuup_cucp_if.c @@ -0,0 +1,37 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "cuup_cucp_if.h" + +static e1_if_t e1_if; + +e1_if_t *get_e1_if(void) +{ + return &e1_if; +} + +void nr_pdcp_e1_if_init(bool uses_e1) +{ + if (uses_e1) + cuup_cucp_init_e1ap(&e1_if); + else + cuup_cucp_init_direct(&e1_if); +} diff --git a/openair2/LAYER2/nr_pdcp/cuup_cucp_if.h b/openair2/LAYER2/nr_pdcp/cuup_cucp_if.h new file mode 100644 index 0000000000000000000000000000000000000000..a81685395864ab61c98eb84dec26ec69ed4aabd6 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/cuup_cucp_if.h @@ -0,0 +1,36 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef CUUP_CUCP_IF_H +#define CUUP_CUCP_IF_H + +#include <stdbool.h> + +typedef struct e1_if_t { +} e1_if_t; + +e1_if_t *get_e1_if(void); +void nr_pdcp_e1_if_init(bool uses_e1); + +void cuup_cucp_init_direct(e1_if_t *iface); +void cuup_cucp_init_e1ap(e1_if_t *iface); + +#endif /* CUUP_CUCP_IF_H */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 21331ee607269e447e3f13648205a4e6fceb51d8..b7b994903633fd58173a925873d5c239a0eb668f 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -42,6 +42,7 @@ #include "nr_pdcp_e1_api.h" #include "gnb_config.h" #include "executables/softmodem-common.h" +#include "cuup_cucp_if.h" #define TODO do { \ printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \ @@ -538,7 +539,7 @@ void pdcp_layer_init(void) abort(); } -void nr_pdcp_layer_init(void) +void nr_pdcp_layer_init(bool uses_e1) { /* hack: be sure to initialize only once */ static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; @@ -559,6 +560,7 @@ void nr_pdcp_layer_init(void) init_nr_rlc_data_req_queue(); } + nr_pdcp_e1_if_init(uses_e1); init_nr_pdcp_data_ind_queue(); nr_pdcp_init_timer_thread(nr_pdcp_ue_manager); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index 6035e34bf4638d71fb090656fbb796766d6506a5..85e2c4b46b72d328c91c958fd744a883a693d97e 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(void); +void nr_pdcp_layer_init(bool uses_e1); uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id); void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP,