Commit d2bb779e authored by Robert Schmidt's avatar Robert Schmidt

Refactor rrc_remove_ue() to not send NGAP ctxt release cplt

The next commit will use rrc_remove_ue() to delete a CU(-CP+-UP)
context. However, we don't send NGAP UE context release at that moment
(we will instead *request* the release); more generally, it's not clear
that every user of rrc_remove_ue() wants to actually send this message.
Hence, refactor the code by separately calling
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE() where appropriate.
parent ff106c41
...@@ -2074,10 +2074,6 @@ void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p) ...@@ -2074,10 +2074,6 @@ void rrc_remove_ue(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p)
* are in E1, we also need to free the UE in the CU-CP, so call it twice to * are in E1, we also need to free the UE in the CU-CP, so call it twice to
* cover all cases */ * cover all cases */
nr_pdcp_remove_UE(UE->rrc_ue_id); nr_pdcp_remove_UE(UE->rrc_ue_id);
uint32_t pdu_sessions[256];
for (int i = 0; i < UE->nb_of_pdusessions && i < 256; ++i)
pdu_sessions[i] = UE->pduSession[i].param.pdusession_id;
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(0, UE->rrc_ue_id, UE->nb_of_pdusessions, pdu_sessions);
LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti); 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_delete_ue_data(UE);
rrc_gNB_remove_ue_context(rrc, ue_context_p); rrc_gNB_remove_ue_context(rrc, ue_context_p);
...@@ -2099,6 +2095,9 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) ...@@ -2099,6 +2095,9 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p)
/* only trigger release if it has been requested by core /* only trigger release if it has been requested by core
* otherwise, it might be CU that requested release on a DU during normal * otherwise, it might be CU that requested release on a DU during normal
* operation (i.e, handover) */ * operation (i.e, handover) */
uint32_t pdu_sessions[NGAP_MAX_PDU_SESSION];
get_pduSession_array(UE, pdu_sessions);
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(0, UE->rrc_ue_id, UE->nb_of_pdusessions, pdu_sessions);
rrc_remove_ue(RC.nrrrc[0], ue_context_p); rrc_remove_ue(RC.nrrrc[0], ue_context_p);
} }
} }
......
...@@ -1231,6 +1231,9 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_ ...@@ -1231,6 +1231,9 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_
/* UE will be freed after UE context release complete */ /* UE will be freed after UE context release complete */
} else { } else {
// the DU is offline already // the DU is offline already
uint32_t pdu_sessions[NGAP_MAX_PDU_SESSION];
get_pduSession_array(UE, pdu_sessions);
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(0, UE->rrc_ue_id, UE->nb_of_pdusessions, pdu_sessions);
rrc_remove_ue(rrc, ue_context_p); rrc_remove_ue(rrc, ue_context_p);
} }
......
...@@ -58,6 +58,12 @@ rrc_pdu_session_param_t *find_pduSession_from_drbId(gNB_RRC_UE_t *ue, int drb_id ...@@ -58,6 +58,12 @@ rrc_pdu_session_param_t *find_pduSession_from_drbId(gNB_RRC_UE_t *ue, int drb_id
return find_pduSession(ue, id, false); return find_pduSession(ue, id, false);
} }
void get_pduSession_array(gNB_RRC_UE_t *ue, uint32_t pdu_sessions[NGAP_MAX_PDU_SESSION])
{
for (int i = 0; i < ue->nb_of_pdusessions && i < NGAP_MAX_PDU_SESSION; ++i)
pdu_sessions[i] = ue->pduSession[i].param.pdusession_id;
}
drb_t *get_drb(gNB_RRC_UE_t *ue, uint8_t drb_id) drb_t *get_drb(gNB_RRC_UE_t *ue, uint8_t drb_id)
{ {
DevAssert(drb_id > 0 && drb_id <= 32); DevAssert(drb_id > 0 && drb_id <= 32);
......
...@@ -73,6 +73,9 @@ rrc_pdu_session_param_t *find_pduSession(gNB_RRC_UE_t *ue, int id, bool create); ...@@ -73,6 +73,9 @@ rrc_pdu_session_param_t *find_pduSession(gNB_RRC_UE_t *ue, int id, bool create);
/// @brief get PDU session of UE ue through the DRB drb_id /// @brief get PDU session of UE ue through the DRB drb_id
rrc_pdu_session_param_t *find_pduSession_from_drbId(gNB_RRC_UE_t *ue, int drb_id); rrc_pdu_session_param_t *find_pduSession_from_drbId(gNB_RRC_UE_t *ue, int drb_id);
/// @brief get the PDU sessions of this UE in a single array
void get_pduSession_array(gNB_RRC_UE_t *ue, uint32_t pdu_sessions[NGAP_MAX_PDU_SESSION]);
/// @brief set PDCP configuration in a bearer context management message /// @brief set PDCP configuration in a bearer context management message
void set_bearer_context_pdcp_config(bearer_context_pdcp_config_t *pdcp_config, drb_t *rrc_drb, bool um_on_default_drb); void set_bearer_context_pdcp_config(bearer_context_pdcp_config_t *pdcp_config, drb_t *rrc_drb, bool um_on_default_drb);
......
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