Commit 763a95b1 authored by Robert Schmidt's avatar Robert Schmidt

CU-UP/E1: mirror CU-CP UE ID in CU-UP, clean up messages

- Use the same CU-UP in E1 as in CU-CP: we don't have a separate entity
  to allocate IDs, and we just use the same as the CU-CP
- Correct gNB CU-UP/CP UE IDs in E1AP message types to 32bit
- Set CU UP UE ID explicitly for clarity
- Remove RNTI from E1 messages, E1 does not know what an RNTI is
parent 5c42004e
...@@ -156,7 +156,6 @@ typedef struct pdu_session_to_setup_s { ...@@ -156,7 +156,6 @@ typedef struct pdu_session_to_setup_s {
typedef struct e1ap_bearer_setup_req_s { typedef struct e1ap_bearer_setup_req_s {
uint32_t gNB_cu_cp_ue_id; uint32_t gNB_cu_cp_ue_id;
uint32_t gNB_cu_up_ue_id; uint32_t gNB_cu_up_ue_id;
rnti_t rnti;
uint64_t cipheringAlgorithm; uint64_t cipheringAlgorithm;
uint64_t integrityProtectionAlgorithm; uint64_t integrityProtectionAlgorithm;
char encryptionKey[128]; char encryptionKey[128];
...@@ -216,8 +215,8 @@ typedef struct pdu_session_setup_s { ...@@ -216,8 +215,8 @@ typedef struct pdu_session_setup_s {
} pdu_session_setup_t; } pdu_session_setup_t;
typedef struct e1ap_bearer_setup_resp_s { typedef struct e1ap_bearer_setup_resp_s {
uint64_t gNB_cu_cp_ue_id; uint32_t gNB_cu_cp_ue_id;
uint64_t gNB_cu_up_ue_id; uint32_t gNB_cu_up_ue_id;
int numDRBs; int numDRBs;
drb_setup_t DRBList[E1AP_MAX_NUM_DRBS]; drb_setup_t DRBList[E1AP_MAX_NUM_DRBS];
int numPDUSessions; int numPDUSessions;
......
...@@ -1095,7 +1095,7 @@ static int fill_BEARER_CONTEXT_MODIFICATION_REQUEST(e1ap_setup_req_t *setupReq, ...@@ -1095,7 +1095,7 @@ static int fill_BEARER_CONTEXT_MODIFICATION_REQUEST(e1ap_setup_req_t *setupReq,
ieC2->id = E1AP_ProtocolIE_ID_id_gNB_CU_UP_UE_E1AP_ID; ieC2->id = E1AP_ProtocolIE_ID_id_gNB_CU_UP_UE_E1AP_ID;
ieC2->criticality = E1AP_Criticality_reject; ieC2->criticality = E1AP_Criticality_reject;
ieC2->value.present = E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_UP_UE_E1AP_ID; ieC2->value.present = E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_UP_UE_E1AP_ID;
ieC2->value.choice.GNB_CU_UP_UE_E1AP_ID = bearerCxt->gNB_cu_cp_ue_id; ieC2->value.choice.GNB_CU_UP_UE_E1AP_ID = bearerCxt->gNB_cu_up_ue_id;
/* optional */ /* optional */
/* */ /* */
asn1cSequenceAdd(out->protocolIEs.list, E1AP_BearerContextModificationRequestIEs_t, ieC3); asn1cSequenceAdd(out->protocolIEs.list, E1AP_BearerContextModificationRequestIEs_t, ieC3);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "openair2/RRC/LTE/MESSAGES/asn1_msg.h" #include "openair2/RRC/LTE/MESSAGES/asn1_msg.h"
#include "openair3/SECU/key_nas_deriver.h" #include "openair3/SECU/key_nas_deriver.h"
#include "openair3/ocp-gtpu/gtp_itf.h" #include "openair3/ocp-gtpu/gtp_itf.h"
#include "openair2/F1AP/f1ap_ids.h"
#include "e1ap_asnc.h" #include "e1ap_asnc.h"
#include "e1ap_common.h" #include "e1ap_common.h"
#include "e1ap.h" #include "e1ap.h"
...@@ -136,6 +137,11 @@ void process_e1_bearer_context_setup_req(instance_t instance, e1ap_bearer_setup_ ...@@ -136,6 +137,11 @@ void process_e1_bearer_context_setup_req(instance_t instance, e1ap_bearer_setup_
AssertFatal(inst, ""); AssertFatal(inst, "");
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp_N3={0}; gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp_N3={0};
uint32_t gNB_cu_up_ue_id = req ->gNB_cu_cp_ue_id;
LOG_I(E1AP, "adding UE with CU-CP UE ID %d and CU-UP UE ID %d\n", req->gNB_cu_cp_ue_id, gNB_cu_up_ue_id);
f1_ue_data_t ue_data = {.secondary_ue = req->gNB_cu_cp_ue_id};
cu_add_f1_ue_data(gNB_cu_up_ue_id, &ue_data);
// GTP tunnel for UL // GTP tunnel for UL
drb_config_N3gtpu_create(req, &create_tunnel_resp_N3, inst->gtpInstN3); drb_config_N3gtpu_create(req, &create_tunnel_resp_N3, inst->gtpInstN3);
...@@ -148,6 +154,7 @@ void process_e1_bearer_context_setup_req(instance_t instance, e1ap_bearer_setup_ ...@@ -148,6 +154,7 @@ void process_e1_bearer_context_setup_req(instance_t instance, e1ap_bearer_setup_
fill_e1ap_bearer_setup_resp(resp, req, inst->gtpInstF1U, req->gNB_cu_cp_ue_id, inst->setupReq.remotePortF1U, my_addr); fill_e1ap_bearer_setup_resp(resp, req, inst->gtpInstF1U, req->gNB_cu_cp_ue_id, inst->setupReq.remotePortF1U, my_addr);
resp->gNB_cu_cp_ue_id = req->gNB_cu_cp_ue_id; resp->gNB_cu_cp_ue_id = req->gNB_cu_cp_ue_id;
resp->gNB_cu_up_ue_id = gNB_cu_up_ue_id;
resp->numPDUSessions = req->numPDUSessions; resp->numPDUSessions = req->numPDUSessions;
for (int i=0; i < req->numPDUSessions; i++) { for (int i=0; i < req->numPDUSessions; i++) {
pdu_session_setup_t *pduSetup = resp->pduSession + i; pdu_session_setup_t *pduSetup = resp->pduSession + i;
......
...@@ -163,7 +163,7 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p, ...@@ -163,7 +163,7 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const req, instance_t instance) static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const req, instance_t instance)
{ {
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[instance], req->rnti); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], req->gNB_cu_cp_ue_id);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context; gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
protocol_ctxt_t ctxt = {0}; protocol_ctxt_t ctxt = {0};
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0, 0);
...@@ -212,7 +212,7 @@ static void cucp_cuup_bearer_context_mod_direct(e1ap_bearer_setup_req_t *const r ...@@ -212,7 +212,7 @@ static void cucp_cuup_bearer_context_mod_direct(e1ap_bearer_setup_req_t *const r
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) if (!NODE_IS_CU(RC.nrrrc[0]->node_type))
return; return;
instance_t gtpInst = getCxt(CUtype, instance)->gtpInst; instance_t gtpInst = getCxt(CUtype, instance)->gtpInst;
CU_update_UP_DL_tunnel(req, gtpInst, req->rnti); CU_update_UP_DL_tunnel(req, gtpInst, req->gNB_cu_cp_ue_id);
} }
void cucp_cuup_message_transfer_direct_init(gNB_RRC_INST *rrc) { void cucp_cuup_message_transfer_direct_init(gNB_RRC_INST *rrc) {
......
...@@ -2375,7 +2375,7 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i ...@@ -2375,7 +2375,7 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i
e1ap_bearer_setup_req_t req = {0}; e1ap_bearer_setup_req_t req = {0};
req.numPDUSessionsMod = UE->nb_of_pdusessions; req.numPDUSessionsMod = UE->nb_of_pdusessions;
req.gNB_cu_cp_ue_id = UE->rrc_ue_id; req.gNB_cu_cp_ue_id = UE->rrc_ue_id;
req.rnti = UE->rnti; req.gNB_cu_up_ue_id = UE->rrc_ue_id;
for (int i = 0; i < req.numPDUSessionsMod; i++) { for (int i = 0; i < req.numPDUSessionsMod; i++) {
req.pduSessionMod[i].numDRB2Modify = resp->drbs_to_be_setup_length; req.pduSessionMod[i].numDRB2Modify = resp->drbs_to_be_setup_length;
for (int j = 0; j < resp->drbs_to_be_setup_length; j++) { for (int j = 0; j < resp->drbs_to_be_setup_length; j++) {
...@@ -2649,6 +2649,13 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp ...@@ -2649,6 +2649,13 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp
protocol_ctxt_t ctxt = {0}; protocol_ctxt_t ctxt = {0};
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, resp->gNB_cu_cp_ue_id, 0, 0, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, resp->gNB_cu_cp_ue_id, 0, 0, 0);
// currently: we don't have "infrastructure" to save the CU-UP UE ID, so we
// assume (and below check) that CU-UP UE ID == CU-CP UE ID
AssertFatal(resp->gNB_cu_cp_ue_id == resp->gNB_cu_up_ue_id,
"cannot handle CU-UP UE ID different from CU-CP UE ID (%d vs %d)\n",
resp->gNB_cu_cp_ue_id,
resp->gNB_cu_up_ue_id);
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0}; gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0};
create_tunnel_resp.num_tunnels = resp->numPDUSessions; create_tunnel_resp.num_tunnels = resp->numPDUSessions;
for (int i=0; i < resp->numPDUSessions; i++) { for (int i=0; i < resp->numPDUSessions; i++) {
......
...@@ -760,7 +760,6 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins ...@@ -760,7 +760,6 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins
session->pdusessionTransfer = msg->pdusession_setup_params[i].pdusessionTransfer; session->pdusessionTransfer = msg->pdusession_setup_params[i].pdusessionTransfer;
decodePDUSessionResourceSetup(session); decodePDUSessionResourceSetup(session);
bearer_req.gNB_cu_cp_ue_id = msg->gNB_ue_ngap_id; bearer_req.gNB_cu_cp_ue_id = msg->gNB_ue_ngap_id;
bearer_req.rnti = UE->rnti;
bearer_req.cipheringAlgorithm = UE->ciphering_algorithm; bearer_req.cipheringAlgorithm = UE->ciphering_algorithm;
bearer_req.integrityProtectionAlgorithm = UE->integrity_algorithm; bearer_req.integrityProtectionAlgorithm = UE->integrity_algorithm;
nr_derive_key(UP_ENC_ALG, UE->ciphering_algorithm, UE->kgnb, (uint8_t *)bearer_req.encryptionKey); nr_derive_key(UP_ENC_ALG, UE->ciphering_algorithm, UE->kgnb, (uint8_t *)bearer_req.encryptionKey);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment