diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c2baa4de3..8504704280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1277,6 +1277,7 @@ set(L2_NR_SRC ${NR_RRC_DIR}/rrc_gNB_UE_context.c ${NR_RRC_DIR}/rrc_gNB_NGAP.c ${NR_RRC_DIR}/rrc_gNB_radio_bearers.c + ${NR_RRC_DIR}/rrc_gNB_cuup.c ) set(L2_SRC_UE diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 510e058495..13f8efce50 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -132,6 +132,8 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP); +int rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req); + void bearer_context_setup_direct(e1ap_bearer_setup_req_t *req, instance_t instance); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index bd8548dc04..8360152375 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2315,29 +2315,6 @@ static int get_dl_mimo_layers(const f1ap_served_cell_info_t *cell_info, const NR return(1); } -int rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req, instance_t instance) { - - AssertFatal(req->supported_plmns <= PLMN_LIST_MAX_SIZE, "Supported PLMNs is more than PLMN_LIST_MAX_SIZE\n"); - gNB_RRC_INST *rrc = RC.nrrrc[0]; //TODO: remove hardcoding of RC index here - MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_GNB, instance, E1AP_SETUP_RESP); - - e1ap_setup_resp_t *resp = &E1AP_SETUP_RESP(msg_p); - resp->transac_id = req->transac_id; - - for (int i=0; i < req->supported_plmns; i++) { - if (rrc->configuration.mcc[i] != req->plmns[i].mcc || - rrc->configuration.mnc[i] != req->plmns[i].mnc) { - LOG_E(NR_RRC, "PLMNs received from CUUP (mcc:%d, mnc:%d) did not match with PLMNs in RRC (mcc:%d, mnc:%d)\n", - req->plmns[i].mcc, req->plmns[i].mnc, rrc->configuration.mcc[i], rrc->configuration.mnc[i]); - return -1; - } - } - - itti_send_msg_to_task(TASK_CUCP_E1, instance, msg_p); - - return 0; -} - void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp) { /* Generate a UE context modification request message towards the DU to @@ -2699,7 +2676,7 @@ void *rrc_gnb_task(void *args_p) { break; case E1AP_SETUP_REQ: - rrc_gNB_process_e1_setup_req(&E1AP_SETUP_REQ(msg_p), instance); + rrc_gNB_process_e1_setup_req(&E1AP_SETUP_REQ(msg_p)); break; case E1AP_BEARER_CONTEXT_SETUP_RESP: diff --git a/openair2/RRC/NR/rrc_gNB_cuup.c b/openair2/RRC/NR/rrc_gNB_cuup.c new file mode 100644 index 0000000000..aaf28c9025 --- /dev/null +++ b/openair2/RRC/NR/rrc_gNB_cuup.c @@ -0,0 +1,51 @@ +/* + * 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 "common/ran_context.h" +#include "nr_rrc_defs.h" + +int rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req) +{ + AssertFatal(req->supported_plmns <= PLMN_LIST_MAX_SIZE, "Supported PLMNs is more than PLMN_LIST_MAX_SIZE\n"); + gNB_RRC_INST *rrc = RC.nrrrc[0]; + + + for (int i = 0; i < req->supported_plmns; i++) { + PLMN_ID_t *id = &req->plmns[i]; + if (rrc->configuration.mcc[i] != id->mcc || rrc->configuration.mnc[i] != id->mnc) { + LOG_E(NR_RRC, + "PLMNs received from CUUP (mcc:%d, mnc:%d) did not match with PLMNs in RRC (mcc:%d, mnc:%d)\n", + id->mcc, + id->mnc, + rrc->configuration.mcc[i], + rrc->configuration.mnc[i]); + return -1; + } + } + + + MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_GNB, 0, E1AP_SETUP_RESP); + e1ap_setup_resp_t *resp = &E1AP_SETUP_RESP(msg_p); + resp->transac_id = req->transac_id; + itti_send_msg_to_task(TASK_CUCP_E1, 0, msg_p); + + return 0; +}