Commit ad1c92af authored by Guido Casati's avatar Guido Casati

Refactor NG UE Context Release Request

1) Remove UE Context Release Response code: there is no
such thing in the specs, it is either UE Context Release Request
(NG-RAN node initiated) or UE Context Release (AMF initiated)
(3GPP TS 38.413). The former message has only the request, no
response is defined by the specs. The code in the stack had no
purpose at all and was removed.
2) The UE Context Release Request message only contains a PDU
Session Resource List (optional) of PDU Session IDs, therefore
the use of pdusession_release_t was wrong and was refactored
parent 92980ceb
......@@ -64,7 +64,6 @@ MESSAGE_DEF(NGAP_UE_CAPABILITIES_IND , MESSAGE_PRIORITY_MED, ngap_ue_cap_i
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_resp_t, ngap_initial_context_setup_resp)
MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_fail_t, ngap_initial_context_setup_fail)
MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, ngap_nas_non_delivery_ind_t , ngap_nas_non_delivery_ind)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_RESP , MESSAGE_PRIORITY_MED, ngap_ue_release_resp_t , ngap_ue_release_resp)
MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete)
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp)
MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail)
......
......@@ -47,7 +47,6 @@
#define NGAP_UE_CAPABILITIES_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_cap_info_ind
#define NGAP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_resp
#define NGAP_INITIAL_CONTEXT_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_fail
#define NGAP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_resp
#define NGAP_NAS_NON_DELIVERY_IND(mSGpTR) (mSGpTR)->ittiMsg.ngap_nas_non_delivery_ind
#define NGAP_UE_CTXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_resp
#define NGAP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_fail
......@@ -733,12 +732,6 @@ typedef struct ngap_ue_ctxt_modification_resp_s {
uint32_t gNB_ue_ngap_id;
} ngap_ue_ctxt_modification_resp_t;
typedef struct ngap_ue_release_complete_s {
uint32_t gNB_ue_ngap_id;
int num_pdu_sessions;
uint32_t pdu_session_id[256];
} ngap_ue_release_complete_t;
//-------------------------------------------------------------------------------------------//
// NGAP -> RRC messages
typedef struct ngap_downlink_nas_s {
......@@ -862,20 +855,24 @@ typedef struct ngap_ue_release_command_s {
//-------------------------------------------------------------------------------------------//
// NGAP <-- RRC messages
typedef struct pdusession_release_s {
/* Unique pdusession_id for the UE. */
uint8_t pdusession_id;
byte_array_t data;
} pdusession_release_t;
typedef struct ngap_ue_release_req_s {
uint32_t gNB_ue_ngap_id;
/* Number of pdusession resource in the list */
// RAN UE NGAP ID (mandatory)
uint32_t gNB_ue_ngap_id;
// PDU Session Resource List (optional)
uint16_t nb_of_pdusessions;
/* list of pdusession resource by RRC layers */
pdusession_release_t pdusessions[NGAP_MAX_PDU_SESSION];
uint8_t pdusession_ids[NGAP_MAX_PDU_SESSION];
// Cause (mandatory)
ngap_cause_t cause;
} ngap_ue_release_req_t, ngap_ue_release_resp_t;
} ngap_ue_release_req_t;
typedef struct {
// RAN UE NGAP ID (mandatory)
uint32_t gNB_ue_ngap_id;
// PDU Session Resource List (optional)
uint16_t num_pdu_sessions;
// PDU Session ID (mandatory)
uint8_t pdu_session_id[NGAP_MAX_PDU_SESSION];
} ngap_ue_release_complete_t;
typedef struct ngap_pdusession_modify_req_s {
/* AMF UE id */
......@@ -905,6 +902,12 @@ typedef struct ngap_pdusession_modify_resp_s {
pdusession_failed_t pdusessions_failed[NGAP_MAX_PDU_SESSION];
} ngap_pdusession_modify_resp_t;
typedef struct pdusession_release_s {
/* Unique pdusession_id for the UE. */
uint8_t pdusession_id;
byte_array_t data;
} pdusession_release_t;
typedef struct ngap_pdusession_release_command_s {
/* AMF UE id */
uint64_t amf_ue_ngap_id;
......
......@@ -3187,10 +3187,6 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_dc_overall_timeout(instance, &X2AP_ENDC_DC_OVERALL_TIMEOUT(msg_p));
break;
case NGAP_UE_CONTEXT_RELEASE_REQ:
rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(msg_p, instance);
break;
case NGAP_UE_CONTEXT_RELEASE_COMMAND:
rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(msg_p, instance);
break;
......
......@@ -1049,7 +1049,8 @@ int rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE
return 0;
}
//------------------------------------------------------------------------------
/** @brief Send UE Context Release Request (NG-RAN node initiated)
* Direction: NG-RAN node -> AMF (8.3.2.2 3GPP TS 38.413) */
void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(const module_id_t gnb_mod_idP,
const rrc_gNB_ue_context_t *const ue_context_pP,
const ngap_cause_t causeP)
......@@ -1068,40 +1069,12 @@ void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(const module_id_t gnb_mod_idP,
// PDU Session Resource List (optional)
FOR_EACH_SEQ_ARR(rrc_pdu_session_param_t *, session, &UE->pduSessions) {
DevAssert(req->nb_of_pdusessions < NGAP_MAX_PDU_SESSION);
req->pdusessions[req->nb_of_pdusessions].pdusession_id = session->param.pdusession_id;
req->pdusession_ids[req->nb_of_pdusessions] = session->param.pdusession_id;
req->nb_of_pdusessions++;
}
itti_send_msg_to_task(TASK_NGAP, GNB_MODULE_ID_TO_INSTANCE(gnb_mod_idP), msg);
}
}
/*------------------------------------------------------------------------------*/
int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_REQ(MessageDef *msg_p, instance_t instance)
{
uint32_t gNB_ue_ngap_id;
gNB_ue_ngap_id = NGAP_UE_CONTEXT_RELEASE_REQ(msg_p).gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[instance], gNB_ue_ngap_id);
if (ue_context_p == NULL) {
/* Can not associate this message to an UE index, send a failure to ngAP and discard it! */
MessageDef *msg_fail_p;
LOG_W(RRC, "[gNB %ld] In NGAP_UE_CONTEXT_RELEASE_REQ: unknown UE from gNB_ue_ngap_id (%u)\n",
instance,
gNB_ue_ngap_id);
msg_fail_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_RESP); /* TODO change message ID. */
NGAP_UE_CONTEXT_RELEASE_RESP(msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
// TODO add failure cause when defined!
itti_send_msg_to_task(TASK_NGAP, instance, msg_fail_p);
return (-1);
} else {
/* Send the response */
MessageDef *msg_resp_p;
msg_resp_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_UE_CONTEXT_RELEASE_RESP);
NGAP_UE_CONTEXT_RELEASE_RESP(msg_resp_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
itti_send_msg_to_task(TASK_NGAP, instance, msg_resp_p);
return (0);
}
}
/** @brief Sends the NG Handover Failure from the Target NG-RAN to the AMF */
void rrc_gNB_send_NGAP_HANDOVER_FAILURE(gNB_RRC_INST *rrc, ngap_handover_failure_t *msg)
......
......@@ -191,7 +191,7 @@ int ngap_ue_context_release_req(instance_t instance,
for (int i = 0; i < ue_release_req_p->nb_of_pdusessions; i++) {
NGAP_PDUSessionResourceItemCxtRelReq_t *item;
item = (NGAP_PDUSessionResourceItemCxtRelReq_t *)calloc(1,sizeof(NGAP_PDUSessionResourceItemCxtRelReq_t));
item->pDUSessionID = ue_release_req_p->pdusessions[i].pdusession_id;
item->pDUSessionID = ue_release_req_p->pdusession_ids[i];
asn1cSeqAdd(&ie->value.choice.PDUSessionResourceListCxtRelReq.list, item);
}
}
......
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