Cleanup: Pass RRC/UE context directly into handle_rrcReconfigurationComplete()
This commit is contained in:
+11
-16
@@ -1498,16 +1498,16 @@ static int handle_ueCapabilityInformation(const protocol_ctxt_t *const ctxt_pP,
|
||||
|
||||
rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(ctxt_pP, ue_context_p, ue_cap_info);
|
||||
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
||||
if (UE->n_initial_pdu > 0) {
|
||||
/* there were PDU sessions with the NG UE Context setup, but we had to set
|
||||
* up security and request capabilities, so trigger PDU sessions now. The
|
||||
* UE NAS message will be forwarded in the corresponding reconfiguration,
|
||||
* the Initial context setup response after reconfiguration complete. */
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
||||
trigger_bearer_setup(rrc, UE, UE->n_initial_pdu, UE->initial_pdus, 0);
|
||||
} else {
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
|
||||
rrc_forward_ue_nas_message(RC.nrrrc[ctxt_pP->instance], UE);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(rrc, UE);
|
||||
rrc_forward_ue_nas_message(rrc, UE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1579,13 +1579,8 @@ static void handle_rrcSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, const N
|
||||
return;
|
||||
}
|
||||
|
||||
static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *ue_context_p,
|
||||
const NR_RRCReconfigurationComplete_t *reconfig_complete)
|
||||
static void handle_rrcReconfigurationComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, const NR_RRCReconfigurationComplete_t *reconfig_complete)
|
||||
{
|
||||
AssertFatal(ue_context_p != NULL, "Processing %s() for UE %lx, ue_context_p is NULL\n", __func__, ctxt_pP->rntiMaybeUEid);
|
||||
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
||||
|
||||
uint8_t xid = reconfig_complete->rrc_TransactionIdentifier;
|
||||
UE->ue_reconfiguration_counter++;
|
||||
LOG_I(NR_RRC, "UE %d: Receive RRC Reconfiguration Complete message (xid %d)\n", UE->rrc_ue_id, xid);
|
||||
@@ -1593,22 +1588,22 @@ static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_
|
||||
switch (UE->xids[xid]) {
|
||||
case RRC_PDUSESSION_RELEASE: {
|
||||
gtpv1u_gnb_delete_tunnel_req_t req = {0};
|
||||
gtpv1u_delete_ngu_tunnel(ctxt_pP->instance, &req);
|
||||
gtpv1u_delete_ngu_tunnel(rrc->module_id, &req);
|
||||
// NGAP_PDUSESSION_RELEASE_RESPONSE
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(ctxt_pP, ue_context_p, xid);
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(rrc, UE, xid);
|
||||
} break;
|
||||
case RRC_PDUSESSION_ESTABLISH:
|
||||
if (UE->n_initial_pdu > 0) {
|
||||
/* PDU sessions through initial UE context setup */
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(rrc, UE);
|
||||
UE->n_initial_pdu = 0;
|
||||
free(UE->initial_pdus);
|
||||
UE->initial_pdus = NULL;
|
||||
} else if (UE->nb_of_pdusessions > 0)
|
||||
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(ctxt_pP, ue_context_p, xid);
|
||||
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(rrc, UE, xid);
|
||||
break;
|
||||
case RRC_PDUSESSION_MODIFY:
|
||||
rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(ctxt_pP, ue_context_p, xid);
|
||||
rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(rrc, UE, xid);
|
||||
break;
|
||||
case RRC_REESTABLISH_COMPLETE:
|
||||
case RRC_DEDICATED_RECONF:
|
||||
@@ -1670,7 +1665,7 @@ int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP,
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcReconfigurationComplete:
|
||||
handle_rrcReconfigurationComplete(ctxt_pP, ue_context_p, ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete);
|
||||
handle_rrcReconfigurationComplete(rrc, UE, ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete);
|
||||
break;
|
||||
|
||||
case NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete:
|
||||
@@ -1735,7 +1730,7 @@ int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP,
|
||||
} else {
|
||||
/* we already have capabilities, and no PDU sessions to setup, ack
|
||||
* this UE */
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(rrc, UE);
|
||||
rrc_forward_ue_nas_message(RC.nrrrc[0], &ue_context_p->ue_context);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -157,10 +157,7 @@ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRC
|
||||
req->gNB_ue_ngap_id = UE->rrc_ue_id;
|
||||
|
||||
/* Assume that cause is coded in the same way in RRC and NGap, just check that the value is in NGap range */
|
||||
AssertFatal(UE->establishment_cause < NGAP_RRC_CAUSE_LAST,
|
||||
"Establishment cause invalid (%jd/%d)!",
|
||||
UE->establishment_cause,
|
||||
NGAP_RRC_CAUSE_LAST);
|
||||
AssertFatal(UE->establishment_cause < NGAP_RRC_CAUSE_LAST, "Establishment cause invalid (%jd/%d)!", UE->establishment_cause, NGAP_RRC_CAUSE_LAST);
|
||||
req->establishment_cause = UE->establishment_cause;
|
||||
|
||||
/* Forward NAS message */
|
||||
@@ -484,7 +481,7 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t
|
||||
} else {
|
||||
/* no PDU sesion to setup: acknowledge this message, and forward NAS
|
||||
* message, if required */
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt, ue_context_p);
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(rrc, UE);
|
||||
rrc_forward_ue_nas_message(rrc, UE);
|
||||
}
|
||||
}
|
||||
@@ -496,16 +493,13 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP)
|
||||
//------------------------------------------------------------------------------
|
||||
void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE)
|
||||
{
|
||||
MessageDef *msg_p = NULL;
|
||||
int pdu_sessions_done = 0;
|
||||
int pdu_sessions_failed = 0;
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, NGAP_INITIAL_CONTEXT_SETUP_RESP);
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_ENB, rrc->module_id, NGAP_INITIAL_CONTEXT_SETUP_RESP);
|
||||
ngap_initial_context_setup_resp_t *resp = &NGAP_INITIAL_CONTEXT_SETUP_RESP(msg_p);
|
||||
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
|
||||
|
||||
resp->gNB_ue_ngap_id = UE->rrc_ue_id;
|
||||
|
||||
@@ -536,7 +530,7 @@ void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(const protocol_ctxt_t *const c
|
||||
|
||||
resp->nb_of_pdusessions = pdu_sessions_done;
|
||||
resp->nb_of_pdusessions_failed = pdu_sessions_failed;
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
|
||||
itti_send_msg_to_task (TASK_NGAP, rrc->module_id, msg_p);
|
||||
}
|
||||
|
||||
static NR_CipheringAlgorithm_t rrc_gNB_select_ciphering(const gNB_RRC_INST *rrc, uint16_t algorithms)
|
||||
@@ -688,22 +682,14 @@ rrc_gNB_send_NGAP_UPLINK_NAS(
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
void rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid)
|
||||
{
|
||||
MessageDef *msg_p;
|
||||
int pdu_sessions_done = 0;
|
||||
int pdu_sessions_failed = 0;
|
||||
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_SETUP_RESP);
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, rrc->module_id, NGAP_PDUSESSION_SETUP_RESP);
|
||||
ngap_pdusession_setup_resp_t *resp = &NGAP_PDUSESSION_SETUP_RESP(msg_p);
|
||||
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
|
||||
resp->gNB_ue_ngap_id = UE->rrc_ue_id;
|
||||
|
||||
for (int pdusession = 0; pdusession < UE->nb_of_pdusessions; pdusession++) {
|
||||
@@ -750,7 +736,7 @@ rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
|
||||
|
||||
if ((pdu_sessions_done > 0 || pdu_sessions_failed)) {
|
||||
LOG_I(NR_RRC, "NGAP_PDUSESSION_SETUP_RESP: sending the message\n");
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
|
||||
itti_send_msg_to_task(TASK_NGAP, rrc->module_id, msg_p);
|
||||
}
|
||||
|
||||
for(int i = 0; i < NB_RB_MAX; i++) {
|
||||
@@ -976,21 +962,13 @@ int rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(MessageDef *msg_p, instance_t ins
|
||||
return (0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
int rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid)
|
||||
{
|
||||
MessageDef *msg_p = NULL;
|
||||
uint8_t pdu_sessions_failed = 0;
|
||||
uint8_t pdu_sessions_done = 0;
|
||||
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
|
||||
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP);
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, rrc->module_id, NGAP_PDUSESSION_MODIFY_RESP);
|
||||
if (msg_p == NULL) {
|
||||
LOG_E(NR_RRC, "itti_alloc_new_message failed, msg_p is NULL \n");
|
||||
return (-1);
|
||||
@@ -1057,7 +1035,7 @@ rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
|
||||
|
||||
if (pdu_sessions_done > 0 || pdu_sessions_failed > 0) {
|
||||
LOG_D(NR_RRC, "NGAP_PDUSESSION_MODIFY_RESP: sending the message (total pdu session %d)\n", UE->nb_of_pdusessions);
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
|
||||
itti_send_msg_to_task (TASK_NGAP, rrc->module_id, msg_p);
|
||||
} else {
|
||||
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
|
||||
}
|
||||
@@ -1227,19 +1205,11 @@ void rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(const protocol_ctxt_t *const ctxt_pP,
|
||||
LOG_I(NR_RRC,"Send message to ngap: NGAP_UE_CAPABILITIES_IND\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
void rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid)
|
||||
{
|
||||
int pdu_sessions_released = 0;
|
||||
MessageDef *msg_p;
|
||||
gNB_RRC_UE_t *UE = &ue_context_pP->ue_context;
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_RELEASE_RESPONSE);
|
||||
msg_p = itti_alloc_new_message (TASK_RRC_GNB, rrc->module_id, NGAP_PDUSESSION_RELEASE_RESPONSE);
|
||||
ngap_pdusession_release_resp_t *resp = &NGAP_PDUSESSION_RELEASE_RESPONSE(msg_p);
|
||||
memset(resp, 0, sizeof(*resp));
|
||||
resp->gNB_ue_ngap_id = UE->rrc_ue_id;
|
||||
@@ -1258,7 +1228,7 @@ rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
|
||||
resp->nb_of_pdusessions_released = pdu_sessions_released;
|
||||
resp->nb_of_pdusessions_failed = 0;
|
||||
LOG_I(NR_RRC, "NGAP PDUSESSION RELEASE RESPONSE: rrc_ue_id %u release_pdu_sessions %d\n", resp->gNB_ue_ngap_id, pdu_sessions_released);
|
||||
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
|
||||
itti_send_msg_to_task (TASK_NGAP, rrc->module_id, msg_p);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -1273,7 +1243,8 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_
|
||||
LOG_E(NR_RRC, "incorrect number of pdu session do release %d\n", cmd->nb_pdusessions_torelease);
|
||||
return -1;
|
||||
}
|
||||
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], gNB_ue_ngap_id);
|
||||
gNB_RRC_INST *rrc = RC.nrrrc[instance];
|
||||
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(rrc, gNB_ue_ngap_id);
|
||||
|
||||
if (!ue_context_p) {
|
||||
LOG_E(NR_RRC, "[gNB %ld] not found ue context gNB_ue_ngap_id %u \n", instance, gNB_ue_ngap_id);
|
||||
@@ -1320,9 +1291,9 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_
|
||||
LOG_I(NR_RRC, "gtp tunnel delete all tunnels for UE %04x\n", UE->rnti);
|
||||
gtpv1u_gnb_delete_tunnel_req_t req = {0};
|
||||
req.ue_id = UE->rnti;
|
||||
gtpv1u_delete_ngu_tunnel(instance, &req);
|
||||
gtpv1u_delete_ngu_tunnel(rrc->module_id, &req);
|
||||
// NGAP_PDUSESSION_RELEASE_RESPONSE
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(&ctxt, ue_context_p, xid);
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(rrc, UE, xid);
|
||||
LOG_I(NR_RRC, "Send PDU Session Release Response \n");
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -44,11 +44,7 @@ void rrc_gNB_send_NGAP_NAS_FIRST_REQ(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, NR_RRC
|
||||
|
||||
int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t instance);
|
||||
|
||||
void
|
||||
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP
|
||||
);
|
||||
void rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE);
|
||||
|
||||
int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mui_t *rrc_gNB_mui);
|
||||
|
||||
@@ -59,23 +55,13 @@ rrc_gNB_send_NGAP_UPLINK_NAS(
|
||||
NR_UL_DCCH_Message_t *const ul_dcch_msg
|
||||
);
|
||||
|
||||
void
|
||||
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
);
|
||||
void rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid);
|
||||
|
||||
void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t instance);
|
||||
|
||||
int rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(MessageDef *msg_p, instance_t instance);
|
||||
|
||||
int
|
||||
rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
);
|
||||
int rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid);
|
||||
|
||||
void
|
||||
rrc_gNB_modify_dedicatedRRCReconfiguration(
|
||||
@@ -100,12 +86,7 @@ void rrc_gNB_send_NGAP_UE_CAPABILITIES_IND(const protocol_ctxt_t *const ctxt_pP,
|
||||
|
||||
int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_t instance);
|
||||
|
||||
void
|
||||
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(
|
||||
const protocol_ctxt_t *const ctxt_pP,
|
||||
rrc_gNB_ue_context_t *const ue_context_pP,
|
||||
uint8_t xid
|
||||
);
|
||||
void rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t xid);
|
||||
|
||||
void nr_rrc_pdcp_config_security(gNB_RRC_UE_t *UE, bool enable_ciphering);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user