Merge remote-tracking branch 'origin/fix-f1-id-ues' into integration_2024_w13
This commit is contained in:
@@ -239,14 +239,20 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id
|
||||
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
|
||||
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
|
||||
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
|
||||
|
||||
if (!cu_exists_f1_ue_data(cu_ue_f1ap_id)) {
|
||||
LOG_E(F1AP, "unknown CU UE ID %ld\n", cu_ue_f1ap_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* the RLC-PDCP does not transport the DU UE ID (yet), so we drop it here.
|
||||
* For the moment, let's hope this won't become relevant; to sleep in peace,
|
||||
* let's put an assert to check that it is the expected DU UE ID. */
|
||||
f1_ue_data_t ue_data = cu_get_f1_ue_data(cu_ue_f1ap_id);
|
||||
AssertFatal(ue_data.secondary_ue == du_ue_f1ap_id,
|
||||
"unexpected DU UE ID %d received, expected it to be %ld\n",
|
||||
ue_data.secondary_ue,
|
||||
du_ue_f1ap_id);
|
||||
if (ue_data.secondary_ue != du_ue_f1ap_id) {
|
||||
LOG_E(F1AP, "unexpected DU UE ID %d received, expected it to be %ld\n", ue_data.secondary_ue, du_ue_f1ap_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* mandatory */
|
||||
/* SRBID */
|
||||
|
||||
@@ -283,11 +283,12 @@ void e1_bearer_release_cmd(const e1ap_bearer_release_cmd_t *cmd)
|
||||
newGtpuDeleteAllTunnels(n3inst, cmd->gNB_cu_up_ue_id);
|
||||
if (f1inst >= 0) // is there F1-U?
|
||||
newGtpuDeleteAllTunnels(f1inst, cmd->gNB_cu_up_ue_id);
|
||||
nr_pdcp_remove_UE(cmd->gNB_cu_up_ue_id);
|
||||
nr_sdap_delete_ue_entities(cmd->gNB_cu_up_ue_id);
|
||||
if (need_ue_id_mgmt) {
|
||||
// see issue #706: in monolithic, gNB will free PDCP of UE
|
||||
nr_pdcp_remove_UE(cmd->gNB_cu_up_ue_id);
|
||||
cu_remove_f1_ue_data(cmd->gNB_cu_up_ue_id);
|
||||
}
|
||||
nr_sdap_delete_ue_entities(cmd->gNB_cu_up_ue_id);
|
||||
|
||||
e1ap_bearer_release_cplt_t cplt = {
|
||||
.gNB_cu_cp_ue_id = cmd->gNB_cu_cp_ue_id,
|
||||
|
||||
@@ -249,6 +249,8 @@ typedef enum {
|
||||
} rrc_action_t;
|
||||
|
||||
typedef struct gNB_RRC_UE_s {
|
||||
time_t last_seen; // last time this UE has been accessed
|
||||
|
||||
drb_t established_drbs[MAX_DRBS_PER_UE];
|
||||
NR_DRB_ToReleaseList_t *DRB_ReleaseList;
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi
|
||||
void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2ap_ENDC_sgnb_addition_req_t *m);
|
||||
|
||||
void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti);
|
||||
void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p);
|
||||
|
||||
void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
|
||||
NR_ServingCellConfig_t *servingcellconfigdedicated,
|
||||
|
||||
+18
-26
@@ -33,6 +33,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "nr_rrc_config.h"
|
||||
#include "nr_rrc_defs.h"
|
||||
@@ -1939,6 +1940,19 @@ static void rrc_delete_ue_data(gNB_RRC_UE_t *UE)
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_MeasResults, UE->measResults);
|
||||
}
|
||||
|
||||
void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p)
|
||||
{
|
||||
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
||||
/* we call nr_pdcp_remove_UE() in the handler of E1 bearer release, but if we
|
||||
* are in E1, we also need to free the UE in the CU-CP, so call it twice to
|
||||
* cover all cases */
|
||||
nr_pdcp_remove_UE(UE->rrc_ue_id);
|
||||
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(0, UE->rrc_ue_id);
|
||||
LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti);
|
||||
rrc_delete_ue_data(UE);
|
||||
rrc_gNB_remove_ue_context(rrc, ue_context_p);
|
||||
}
|
||||
|
||||
static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p)
|
||||
{
|
||||
const int instance = 0;
|
||||
@@ -1949,16 +1963,8 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p)
|
||||
LOG_E(RRC, "could not find UE context for CU UE ID %u, aborting transaction\n", complete->gNB_CU_ue_id);
|
||||
return;
|
||||
}
|
||||
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
||||
|
||||
/* we call nr_pdcp_remove_UE() in the handler of E1 bearer release, but if we
|
||||
* are in E1, we also need to free the UE in the CU-CP, so call it twice to
|
||||
* cover all cases */
|
||||
nr_pdcp_remove_UE(UE->rrc_ue_id);
|
||||
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance, UE->rrc_ue_id);
|
||||
LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti);
|
||||
rrc_delete_ue_data(UE);
|
||||
rrc_gNB_remove_ue_context(rrc, ue_context_p);
|
||||
rrc_remove_ue(RC.nrrrc[0], ue_context_p);
|
||||
}
|
||||
|
||||
static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, instance_t instance)
|
||||
@@ -2290,6 +2296,7 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
int i = 0;
|
||||
rrc_gNB_ue_context_t *ue_context_p = NULL;
|
||||
/* cast is necessary to eliminate warning "discards ‘const’ qualifier" */
|
||||
@@ -2309,6 +2316,8 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
|
||||
fprintf(f, " S-TMSI %x", ue_ctxt->Initialue_identity_5g_s_TMSI.fiveg_tmsi);
|
||||
fprintf(f, ":\n");
|
||||
|
||||
time_t last_seen = now - ue_ctxt->last_seen;
|
||||
fprintf(f, " last RRC activity: %ld seconds ago\n", last_seen);
|
||||
fprintf(f, " RRC status %s\n", get_rrc_connection_status_text(ue_ctxt->StatusRrc));
|
||||
|
||||
if (ue_ctxt->nb_of_pdusessions == 0)
|
||||
@@ -2668,23 +2677,6 @@ rrc_gNB_generate_RRCRelease(
|
||||
};
|
||||
deliver_ue_ctxt_release_data_t data = {.rrc = rrc, .release_cmd = &ue_context_release_cmd, .assoc_id = ue_data.du_assoc_id};
|
||||
nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, rrc_deliver_ue_ctxt_release_cmd, &data);
|
||||
|
||||
/* a UE might not be associated to a CU-UP if it never requested a PDU
|
||||
* session (intentionally, or because of erros) */
|
||||
if (ue_associated_to_cuup(rrc, UE)) {
|
||||
sctp_assoc_t assoc_id = get_existing_cuup_for_ue(rrc, UE);
|
||||
e1ap_bearer_release_cmd_t cmd = {
|
||||
.gNB_cu_cp_ue_id = UE->rrc_ue_id,
|
||||
.gNB_cu_up_ue_id = UE->rrc_ue_id,
|
||||
};
|
||||
rrc->cucp_cuup.bearer_context_release(assoc_id, &cmd);
|
||||
}
|
||||
|
||||
#ifdef E2_AGENT
|
||||
signal_rrc_state_changed_to(UE, RC_SM_RRC_IDLE);
|
||||
#endif
|
||||
|
||||
/* UE will be freed after UE context release complete */
|
||||
}
|
||||
|
||||
int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib1, uint32_t tmsi, uint8_t paging_drx)
|
||||
|
||||
@@ -73,6 +73,10 @@
|
||||
#include "conversions.h"
|
||||
#include "RRC/NR/rrc_gNB_radio_bearers.h"
|
||||
|
||||
#ifdef E2_AGENT
|
||||
#include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h"
|
||||
#endif
|
||||
|
||||
#include "uper_encoder.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
@@ -1178,7 +1182,7 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(MessageDef *msg_p, instance_t in
|
||||
itti_send_msg_to_task(TASK_NGAP, instance, msg_fail_p);
|
||||
return (-1);
|
||||
} else {
|
||||
/* TODO release context. */
|
||||
|
||||
/* Send the response */
|
||||
MessageDef *msg_resp_p;
|
||||
msg_resp_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_RESP);
|
||||
@@ -1195,7 +1199,7 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(MessageDef *msg_p, instance_t in
|
||||
*/
|
||||
int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_t instance)
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[0];
|
||||
uint32_t gNB_ue_ngap_id = 0;
|
||||
protocol_ctxt_t ctxt;
|
||||
gNB_ue_ngap_id = NGAP_UE_CONTEXT_RELEASE_COMMAND(msg_p).gNB_ue_ngap_id;
|
||||
@@ -1214,9 +1218,34 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_
|
||||
}
|
||||
|
||||
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
||||
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0);
|
||||
ctxt.eNB_index = 0;
|
||||
rrc_gNB_generate_RRCRelease(&ctxt, ue_context_p);
|
||||
#ifdef E2_AGENT
|
||||
signal_rrc_state_changed_to(UE, RC_SM_RRC_IDLE);
|
||||
#endif
|
||||
|
||||
/* a UE might not be associated to a CU-UP if it never requested a PDU
|
||||
* session (intentionally, or because of erros) */
|
||||
if (ue_associated_to_cuup(rrc, UE)) {
|
||||
sctp_assoc_t assoc_id = get_existing_cuup_for_ue(rrc, UE);
|
||||
e1ap_bearer_release_cmd_t cmd = {
|
||||
.gNB_cu_cp_ue_id = UE->rrc_ue_id,
|
||||
.gNB_cu_up_ue_id = UE->rrc_ue_id,
|
||||
};
|
||||
rrc->cucp_cuup.bearer_context_release(assoc_id, &cmd);
|
||||
}
|
||||
|
||||
/* special case: the DU might be offline, in which case the f1_ue_data exists
|
||||
* but is set to 0 */
|
||||
if (cu_exists_f1_ue_data(UE->rrc_ue_id) && cu_get_f1_ue_data(UE->rrc_ue_id).du_assoc_id != 0) {
|
||||
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0);
|
||||
ctxt.eNB_index = 0;
|
||||
rrc_gNB_generate_RRCRelease(&ctxt, ue_context_p);
|
||||
|
||||
/* UE will be freed after UE context release complete */
|
||||
} else {
|
||||
// the DU is offline already
|
||||
rrc_remove_ue(rrc, ue_context_p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "rrc_gNB_UE_context.h"
|
||||
#include "openair2/F1AP/f1ap_ids.h"
|
||||
|
||||
static void rrc_gNB_ue_context_update_time(rrc_gNB_ue_context_t *ctxt)
|
||||
{
|
||||
ctxt->ue_context.last_seen = time(NULL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int rrc_gNB_compare_ue_rnti_id(rrc_gNB_ue_context_t *c1_pP, rrc_gNB_ue_context_t *c2_pP)
|
||||
@@ -68,6 +73,7 @@ rrc_gNB_ue_context_t *rrc_gNB_allocate_new_ue_context(gNB_RRC_INST *rrc_instance
|
||||
return NULL;
|
||||
}
|
||||
new_p->ue_context.rrc_ue_id = uid_linear_allocator_new(&rrc_instance_pP->uid_allocator) + 1;
|
||||
rrc_gNB_ue_context_update_time(new_p);
|
||||
|
||||
for(int i = 0; i < NB_RB_MAX; i++)
|
||||
new_p->ue_context.pduSession[i].xid = -1;
|
||||
@@ -92,8 +98,10 @@ rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_by_rnti(gNB_RRC_INST *rrc_instance_
|
||||
rrc_gNB_ue_context_t *ue_context_p;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) {
|
||||
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_context_p->ue_context.rrc_ue_id);
|
||||
if (ue_data.du_assoc_id == assoc_id && ue_context_p->ue_context.rnti == rntiP)
|
||||
if (ue_data.du_assoc_id == assoc_id && ue_context_p->ue_context.rnti == rntiP) {
|
||||
rrc_gNB_ue_context_update_time(ue_context_p);
|
||||
return ue_context_p;
|
||||
}
|
||||
}
|
||||
LOG_W(NR_RRC, "search by RNTI %04x and assoc_id %d: no UE found\n", rntiP, assoc_id);
|
||||
return NULL;
|
||||
@@ -104,8 +112,10 @@ rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_by_rnti_any_du(gNB_RRC_INST *rrc_in
|
||||
rrc_gNB_ue_context_t *ue_context_p;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head))
|
||||
{
|
||||
if (ue_context_p->ue_context.rnti == rntiP)
|
||||
if (ue_context_p->ue_context.rnti == rntiP) {
|
||||
rrc_gNB_ue_context_update_time(ue_context_p);
|
||||
return ue_context_p;
|
||||
}
|
||||
}
|
||||
LOG_W(NR_RRC, "search by rnti not found %04x\n", rntiP);
|
||||
return NULL;
|
||||
@@ -146,8 +156,10 @@ rrc_gNB_ue_context_t *rrc_gNB_ue_context_random_exist(gNB_RRC_INST *rrc_instance
|
||||
{
|
||||
rrc_gNB_ue_context_t *ue_context_p = NULL;
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head) {
|
||||
if (ue_context_p->ue_context.random_ue_identity == ue_identityP)
|
||||
if (ue_context_p->ue_context.random_ue_identity == ue_identityP) {
|
||||
rrc_gNB_ue_context_update_time(ue_context_p);
|
||||
return ue_context_p;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -161,8 +173,10 @@ rrc_gNB_ue_context_t *rrc_gNB_ue_context_5g_s_tmsi_exist(gNB_RRC_INST *rrc_insta
|
||||
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head)
|
||||
{
|
||||
LOG_I(NR_RRC, "Checking for UE 5G S-TMSI %ld: RNTI %04x\n", s_TMSI, ue_context_p->ue_context.rnti);
|
||||
if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 == s_TMSI)
|
||||
if (ue_context_p->ue_context.ng_5G_S_TMSI_Part1 == s_TMSI) {
|
||||
rrc_gNB_ue_context_update_time(ue_context_p);
|
||||
return ue_context_p;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "rrc_gNB_du.h"
|
||||
#include "rrc_gNB_NGAP.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "nr_rrc_defs.h"
|
||||
#include "rrc_gNB_UE_context.h"
|
||||
@@ -211,10 +212,14 @@ static int invalidate_du_connections(gNB_RRC_INST *rrc, sctp_assoc_t assoc_id)
|
||||
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_id);
|
||||
if (ue_data.du_assoc_id == assoc_id) {
|
||||
/* this UE belongs to the DU that disconnected, set du_assoc_id to 0,
|
||||
* meaning DU is offline */
|
||||
* meaning DU is offline, then trigger release request */
|
||||
cu_remove_f1_ue_data(ue_id);
|
||||
f1_ue_data_t new = {.secondary_ue = ue_data.secondary_ue, .du_assoc_id = 0 };
|
||||
cu_add_f1_ue_data(ue_id, &new);
|
||||
ue_data.du_assoc_id = 0;
|
||||
cu_add_f1_ue_data(ue_id, &ue_data);
|
||||
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(0,
|
||||
ue_context_p,
|
||||
NGAP_CAUSE_RADIO_NETWORK,
|
||||
NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user