From 9546166ebcce393708be0b3dd274a18097a90d2c Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@openairinterface.org> Date: Thu, 5 Oct 2023 09:50:30 +0200 Subject: [PATCH] Create files to handle E1AP messages at CU-UP --- CMakeLists.txt | 4 +++ executables/nr-cuup.c | 2 +- executables/nr-softmodem.c | 2 +- executables/nr-uesoftmodem.c | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 2 +- openair2/LAYER2/NR_MAC_gNB/main.c | 2 +- openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c | 22 ++++++++++++ openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h | 29 ++++++++++++++++ openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c | 27 +++++++++++++++ openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c | 27 +++++++++++++++ openair2/LAYER2/nr_pdcp/cuup_cucp_if.c | 37 +++++++++++++++++++++ openair2/LAYER2/nr_pdcp/cuup_cucp_if.h | 36 ++++++++++++++++++++ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 ++- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 2 +- 14 files changed, 191 insertions(+), 7 deletions(-) create mode 100644 openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c create mode 100644 openair2/LAYER2/nr_pdcp/cucp_cuup_handler.h create mode 100644 openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c create mode 100644 openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c create mode 100644 openair2/LAYER2/nr_pdcp/cuup_cucp_if.c create mode 100644 openair2/LAYER2/nr_pdcp/cuup_cucp_if.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8504704280f..53fed857090 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 2992953ef05..95348dcf195 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 cbb36dc580b..47e2289f367 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 e5332e8e5ef..a267211ce57 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 b4ec1cb9ebe..77c6fd6c8de 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 d0ee9587ef6..fba6dde5070 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 00000000000..76575e65d99 --- /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 00000000000..ea75eb366e3 --- /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 00000000000..2741b473c0c --- /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 00000000000..48dc148473b --- /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 00000000000..ddeb59205e2 --- /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 00000000000..a8168539586 --- /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 21331ee6072..b7b99490363 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 6035e34bf46..85e2c4b46b7 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, -- GitLab