Commit c36eb7c9 authored by Robert Schmidt's avatar Robert Schmidt

Hack: Prevent CU-UP UE ID management if integrated CU

This is a workaround for a problem described in #706. In short, we
cannot reuse the cu_add/remove_f1_ue_data() functions if we are in an
integrated CU-UP/CP ("CU"), but then we can also not reliably use
different UE IDs in CU-UP and CU-CP (except if using even more hacks).
parent 82597e7e
...@@ -134,11 +134,15 @@ static instance_t get_f1_gtp_instance(void) ...@@ -134,11 +134,15 @@ static instance_t get_f1_gtp_instance(void)
void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req)
{ {
bool need_ue_id_mgmt = e1_used();
/* mirror the CU-CP UE ID for CU-UP */ /* mirror the CU-CP UE ID for CU-UP */
uint32_t cu_up_ue_id = req->gNB_cu_cp_ue_id; uint32_t cu_up_ue_id = req->gNB_cu_cp_ue_id;
f1_ue_data_t ued = {.secondary_ue = req->gNB_cu_cp_ue_id}; f1_ue_data_t ued = {.secondary_ue = req->gNB_cu_cp_ue_id};
if (need_ue_id_mgmt) {
cu_add_f1_ue_data(cu_up_ue_id, &ued); cu_add_f1_ue_data(cu_up_ue_id, &ued);
LOG_I(E1AP, "adding UE with CU-CP UE ID %d and CU-UP UE ID %d\n", req->gNB_cu_cp_ue_id, cu_up_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, cu_up_ue_id);
}
instance_t n3inst = get_n3_gtp_instance(); instance_t n3inst = get_n3_gtp_instance();
instance_t f1inst = get_f1_gtp_instance(); instance_t f1inst = get_f1_gtp_instance();
...@@ -260,6 +264,8 @@ void e1_bearer_context_modif(const e1ap_bearer_setup_req_t *req) ...@@ -260,6 +264,8 @@ void e1_bearer_context_modif(const e1ap_bearer_setup_req_t *req)
void e1_bearer_release_cmd(const e1ap_bearer_release_cmd_t *cmd) void e1_bearer_release_cmd(const e1ap_bearer_release_cmd_t *cmd)
{ {
bool need_ue_id_mgmt = e1_used();
instance_t n3inst = get_n3_gtp_instance(); instance_t n3inst = get_n3_gtp_instance();
instance_t f1inst = get_f1_gtp_instance(); instance_t f1inst = get_f1_gtp_instance();
...@@ -269,7 +275,9 @@ void e1_bearer_release_cmd(const e1ap_bearer_release_cmd_t *cmd) ...@@ -269,7 +275,9 @@ void e1_bearer_release_cmd(const e1ap_bearer_release_cmd_t *cmd)
if (f1inst >= 0) // is there F1-U? if (f1inst >= 0) // is there F1-U?
newGtpuDeleteAllTunnels(f1inst, cmd->gNB_cu_up_ue_id); newGtpuDeleteAllTunnels(f1inst, cmd->gNB_cu_up_ue_id);
nr_pdcp_remove_UE(cmd->gNB_cu_up_ue_id); nr_pdcp_remove_UE(cmd->gNB_cu_up_ue_id);
if (need_ue_id_mgmt) {
cu_remove_f1_ue_data(cmd->gNB_cu_up_ue_id); cu_remove_f1_ue_data(cmd->gNB_cu_up_ue_id);
}
e1ap_bearer_release_cplt_t cplt = { e1ap_bearer_release_cplt_t cplt = {
.gNB_cu_cp_ue_id = cmd->gNB_cu_cp_ue_id, .gNB_cu_cp_ue_id = cmd->gNB_cu_cp_ue_id,
......
...@@ -22,14 +22,22 @@ ...@@ -22,14 +22,22 @@
#include "cuup_cucp_if.h" #include "cuup_cucp_if.h"
static e1_if_t e1_if; static e1_if_t e1_if;
static bool g_uses_e1;
e1_if_t *get_e1_if(void) e1_if_t *get_e1_if(void)
{ {
return &e1_if; return &e1_if;
} }
bool e1_used(void)
{
return g_uses_e1;
}
void nr_pdcp_e1_if_init(bool uses_e1) void nr_pdcp_e1_if_init(bool uses_e1)
{ {
g_uses_e1 = uses_e1;
if (uses_e1) if (uses_e1)
cuup_cucp_init_e1ap(&e1_if); cuup_cucp_init_e1ap(&e1_if);
else else
......
...@@ -38,6 +38,7 @@ typedef struct e1_if_t { ...@@ -38,6 +38,7 @@ typedef struct e1_if_t {
} e1_if_t; } e1_if_t;
e1_if_t *get_e1_if(void); e1_if_t *get_e1_if(void);
bool e1_used(void);
void nr_pdcp_e1_if_init(bool uses_e1); void nr_pdcp_e1_if_init(bool uses_e1);
void cuup_cucp_init_direct(e1_if_t *iface); void cuup_cucp_init_direct(e1_if_t *iface);
......
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