Commit 807e5dd7 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_SA_pdu_session_modify_release' into integration_2022_wk09

parents 48f26086 66d2a376
......@@ -353,9 +353,18 @@ typedef struct pdusession_tobeswitched_s {
uint32_t gtp_teid;
} pdusession_tobeswitched_t;
typedef struct qos_flow_tobe_modified_s {
uint8_t qfi; // 0~63
} qos_flow_tobe_modified_t;
typedef struct pdusession_modify_s {
/* Unique pdusession_id for the UE. */
uint8_t pdusession_id;
uint8_t nb_of_qos_flow;
// qos_flow_add_or_modify
qos_flow_tobe_modified_t qos[QOSFLOW_MAX_VALUE];
} pdusession_modify_t;
typedef enum ngap_Cause_e {
......@@ -821,7 +830,7 @@ typedef struct ngap_pdusession_modify_req_s {
/* Number of pdusession to be modify in the list */
uint8_t nb_pdusessions_tomodify;
/* E RAB modify request */
/* pdu session modify request */
pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION];
} ngap_pdusession_modify_req_t;
......
......@@ -345,14 +345,18 @@ typedef struct gNB_RRC_UE_s {
uint8_t setup_e_rabs;
/* Number of e_rab to be setup in the list */
uint8_t nb_of_e_rabs;
/* Number of e_rab to be modified in the list */
uint8_t nb_of_modify_e_rabs;
uint8_t nb_of_failed_e_rabs;
e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
/* Total number of pdu session already setup in the list */
uint8_t setup_pdu_sessions;
/* Number of pdu session to be setup in the list */
uint8_t nb_of_pdusessions;
/* Number of e_rab to be modified in the list */
uint8_t nb_of_modify_e_rabs;
uint8_t nb_of_failed_e_rabs;
e_rab_param_t modify_e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
uint8_t nb_of_modify_pdusessions;
uint8_t nb_of_failed_pdusessions;
pdu_session_param_t modify_pdusession[NR_NB_RB_MAX];
/* list of e_rab to be setup by RRC layers */
/* list of pdu session to be setup by RRC layers */
e_rab_param_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
......
......@@ -1022,6 +1022,186 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
#endif
}
//-----------------------------------------------------------------------------
void
rrc_gNB_modify_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP)
//-----------------------------------------------------------------------------
{
NR_DRB_ToAddMod_t *DRB_config = NULL;
NR_DRB_ToAddModList_t **DRB_configList = NULL;
NR_DRB_ToAddModList_t *DRB_configList2 = NULL;
struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList
*dedicatedNAS_MessageList = NULL;
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NULL;
uint8_t buffer[RRC_BUF_SIZE];
uint16_t size;
int qos_flow_index = 0;
int i, j;
uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
DRB_configList = &ue_context_pP->ue_context.DRB_configList;
DRB_configList2 = CALLOC(1, sizeof(NR_DRB_ToAddModList_t));
memset(DRB_configList2, 0, sizeof(NR_DRB_ToAddModList_t));
dedicatedNAS_MessageList = CALLOC(1, sizeof(struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList));
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
// bypass the new and already configured pdu sessions
if (ue_context_pP->ue_context.modify_pdusession[i].status >= PDU_SESSION_STATUS_DONE) {
ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
continue;
}
if (ue_context_pP->ue_context.modify_pdusession[i].cause != NGAP_CAUSE_NOTHING) {
// set xid of failure pdu session
ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
continue;
}
// search exist DRB_config
for (j = 0; j < (*DRB_configList)->list.count; j++) {
if ((*DRB_configList)->list.array[j]->cnAssociation->choice.sdap_Config->pdu_Session ==
ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id) {
DRB_config = (*DRB_configList)->list.array[j];
break;
}
}
if (DRB_config == NULL) {
ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
ue_context_pP->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_pP->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_unspecified;
ue_context_pP->ue_context.nb_of_failed_pdusessions++;
continue;
}
// Reference TS23501 Table 5.7.4-1: Standardized 5QI to QoS characteristics mapping
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
switch (ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI) {
case 1: //100ms
case 2: //150ms
case 3: //50ms
case 4: //300ms
case 5: //100ms
case 6: //300ms
case 7: //100ms
case 8: //300ms
case 9: //300ms Video (Buffered Streaming)TCP-based (e.g., www, e-mail, chat, ftp, p2p file sharing, progressive video, etc.)
// TODO
break;
default:
LOG_E(NR_RRC,"not supported 5qi %lu\n", ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI);
ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_FAILED;
ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
ue_context_pP->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_pP->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_not_supported_5QI_value;
ue_context_pP->ue_context.nb_of_failed_pdusessions++;
continue;
}
LOG_I(NR_RRC, "PDU SESSION ID %ld, DRB ID %ld (index %d), QOS flow %d, 5QI %ld \n",
DRB_config->cnAssociation->choice.sdap_Config->pdu_Session,
DRB_config->drb_Identity, i,
qos_flow_index,
ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].fiveQI
);
}
ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config);
ue_context_pP->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_DONE;
ue_context_pP->ue_context.modify_pdusession[i].xid = xid;
if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) {
dedicatedNAS_Message = CALLOC(1, sizeof(NR_DedicatedNAS_Message_t));
memset(dedicatedNAS_Message, 0, sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(dedicatedNAS_Message,
(char *)ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer,
ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.length);
ASN_SEQUENCE_ADD(&dedicatedNAS_MessageList->list, dedicatedNAS_Message);
LOG_I(NR_RRC,"add NAS info with size %d (pdusession id %d)\n",ue_context_pP->ue_context.pduSession[i].param.nas_pdu.length,
ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id);
} else {
// TODO
LOG_E(NR_RRC,"no NAS info (pdusession id %d)\n", ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id);
}
}
/* If list is empty free the list and reset the address */
if (dedicatedNAS_MessageList->list.count == 0) {
free(dedicatedNAS_MessageList);
dedicatedNAS_MessageList = NULL;
}
memset(buffer, 0, sizeof(buffer));
size = do_RRCReconfiguration(ctxt_pP, buffer, sizeof(buffer),
xid,
NULL,
DRB_configList2,
NULL,
NULL,
NULL,
NULL,
dedicatedNAS_MessageList,
NULL,
NULL);
LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n");
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
if (ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer != NULL) {
/* Free the NAS PDU buffer and invalidate it */
free(ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer);
ue_context_pP->ue_context.modify_pdusession[i].param.nas_pdu.buffer = NULL;
}
}
LOG_I(NR_RRC,
"[gNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCReconfiguration (bytes %d, UE RNTI %x)\n",
ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
LOG_D(NR_RRC,
"[FRAME %05d][RRC_gNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n",
ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_gNB_mui, ctxt_pP->module_id, DCCH);
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_RRC_UE,
buffer,
size,
MSC_AS_TIME_FMT" dedicated RRCReconfiguration UE %x MUI %d size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti,
rrc_gNB_mui,
size);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size);
memcpy (message_buffer, buffer, size);
message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND);
GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH;
GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer;
GNB_RRC_DCCH_DATA_IND (message_p).size = size;
itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p);
#else
nr_rrc_data_req(
ctxt_pP,
DCCH,
rrc_gNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
#endif
}
//-----------------------------------------------------------------------------
void
rrc_gNB_generate_dedicatedRRCReconfiguration_release(
......@@ -2189,10 +2369,23 @@ rrc_gNB_decode_dcch(
//NGAP_PDUSESSION_RELEASE_RESPONSE
rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(ctxt_pP, ue_context_p, xid);
} else if (ue_context_p->ue_context.established_pdu_sessions_flag != 1) {
if (ue_context_p->ue_context.setup_pdu_sessions > 0) {
if (ue_context_p->ue_context.nb_of_pdusessions > 0) {
rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
ue_context_p->ue_context.nb_of_pdusessions = 0;
}
}
if (ue_context_p->ue_context.nb_of_modify_pdusessions > 0) {
rrc_gNB_send_NGAP_PDUSESSION_MODIFY_RESP(ctxt_pP,
ue_context_p,
ul_dcch_msg->message.choice.c1->choice.rrcReconfigurationComplete->rrc_TransactionIdentifier);
ue_context_p->ue_context.nb_of_modify_pdusessions = 0;
ue_context_p->ue_context.nb_of_failed_pdusessions = 0;
memset(ue_context_p->ue_context.modify_pdusession, 0, sizeof(ue_context_p->ue_context.modify_pdusession));
for(int i = 0; i < NR_NB_RB_MAX; i++) {
ue_context_p->ue_context.modify_pdusession[i].xid = -1;
}
}
}
......@@ -3470,6 +3663,10 @@ void *rrc_gnb_task(void *args_p) {
rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(msg_p, msg_name_p, instance);
break;
case NGAP_PDUSESSION_MODIFY_REQ:
rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(msg_p, msg_name_p, instance);
break;
case NGAP_PDUSESSION_RELEASE_COMMAND:
rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, msg_name_p, instance);
break;
......
......@@ -1058,6 +1058,274 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
}
}
//------------------------------------------------------------------------------
int
rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(
MessageDef *msg_p,
const char *msg_name,
instance_t instance
)
//------------------------------------------------------------------------------
{
uint16_t ue_initial_id;
uint32_t gNB_ue_ngap_id;
uint8_t nb_pdusessions_tomodify;
rrc_gNB_ue_context_t *ue_context_p = NULL;
uint8_t i;
uint8_t qos_flow_index;
protocol_ctxt_t ctxt;
ue_initial_id = NGAP_PDUSESSION_MODIFY_REQ(msg_p).ue_initial_id;
gNB_ue_ngap_id = NGAP_PDUSESSION_MODIFY_REQ(msg_p).gNB_ue_ngap_id;
nb_pdusessions_tomodify = NGAP_PDUSESSION_MODIFY_REQ(msg_p).nb_pdusessions_tomodify;
ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id);
if (ue_context_p == NULL) {
LOG_W(NR_RRC, "[gNB %ld] In NGAP_PDUSESSION_MODIFY_REQ: unknown UE from NGAP ids (%d, %u)\n", instance, ue_initial_id, gNB_ue_ngap_id);
// TODO
return (-1);
} else {
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
ctxt.eNB_index = 0;
ue_context_p->ue_context.gNB_ue_ngap_id = gNB_ue_ngap_id;
{
int j;
boolean_t is_treated[NGAP_MAX_PDUSESSION] = {FALSE};
uint8_t nb_of_failed_pdusessions = 0;
for (i = 0; i < nb_pdusessions_tomodify; i++) {
if (is_treated[i] == TRUE) {
continue;
}
//Check if same PDU session ID to handle multiple pdu sessions
for (j = i+1; j < nb_pdusessions_tomodify; j++) {
if (is_treated[j] == FALSE &&
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[j].pdusession_id ==
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id) {
// handle multiple pdu session id
LOG_D(NR_RRC, "handle multiple pdu session id \n");
ue_context_p->ue_context.modify_pdusession[j].status = PDU_SESSION_STATUS_NEW;
ue_context_p->ue_context.modify_pdusession[j].param.pdusession_id =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[j].pdusession_id;
ue_context_p->ue_context.modify_pdusession[j].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_p->ue_context.modify_pdusession[j].cause_value = NGAP_CauseRadioNetwork_multiple_PDU_session_ID_instances;
nb_of_failed_pdusessions++;
is_treated[i] = TRUE;
is_treated[j] = TRUE;
}
}
// handle multiple pdu session id case
if (is_treated[i] == TRUE) {
LOG_D(NR_RRC, "handle multiple pdu session id \n");
ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_p->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_multiple_PDU_session_ID_instances;
nb_of_failed_pdusessions++;
continue;
}
// Check pdu session ID is established
for (j = 0; j < NR_NB_RB_MAX -3; j++) {
if (ue_context_p->ue_context.pduSession[j].param.pdusession_id ==
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id) {
if (ue_context_p->ue_context.pduSession[j].status == PDU_SESSION_STATUS_TORELEASE ||
ue_context_p->ue_context.pduSession[j].status == PDU_SESSION_STATUS_DONE) {
break;
}
// Found established pdu session, prepare to send RRC message
ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_NOTHING;
if (NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.buffer != NULL) {
ue_context_p->ue_context.modify_pdusession[i].param.nas_pdu.buffer =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.buffer;
ue_context_p->ue_context.modify_pdusession[i].param.nas_pdu.length =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nas_pdu.length;
}
// Save new pdu session parameters, qos, upf addr, teid
for (qos_flow_index = 0; qos_flow_index < NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nb_qos; qos_flow_index++) {
ue_context_p->ue_context.modify_pdusession[i].param.qos[qos_flow_index] =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].qos[qos_flow_index];
}
ue_context_p->ue_context.modify_pdusession[i].param.nb_qos =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].nb_qos;
ue_context_p->ue_context.modify_pdusession[i].param.upf_addr =
ue_context_p->ue_context.pduSession[j].param.upf_addr;
ue_context_p->ue_context.modify_pdusession[i].param.gtp_teid =
ue_context_p->ue_context.pduSession[j].param.gtp_teid;
is_treated[i] = TRUE;
break;
}
}
// handle Unknown pdu session ID
if (is_treated[i] == FALSE) {
LOG_D(NR_RRC, "handle Unknown pdu session ID \n");
ue_context_p->ue_context.modify_pdusession[i].status = PDU_SESSION_STATUS_NEW;
ue_context_p->ue_context.modify_pdusession[i].param.pdusession_id =
NGAP_PDUSESSION_MODIFY_REQ(msg_p).pdusession_modify_params[i].pdusession_id;
ue_context_p->ue_context.modify_pdusession[i].cause = NGAP_CAUSE_RADIO_NETWORK;
ue_context_p->ue_context.modify_pdusession[i].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID;
nb_of_failed_pdusessions++;
is_treated[i] = TRUE;
}
}
ue_context_p->ue_context.nb_of_modify_pdusessions = nb_pdusessions_tomodify;
ue_context_p->ue_context.nb_of_failed_pdusessions = nb_of_failed_pdusessions;
}
if (ue_context_p->ue_context.nb_of_failed_pdusessions < ue_context_p->ue_context.nb_of_modify_pdusessions) {
LOG_D(NR_RRC, "generate RRCReconfiguration \n");
rrc_gNB_modify_dedicatedRRCReconfiguration(&ctxt, ue_context_p);
} else { // all pdu modification failed
LOG_I(NR_RRC, "pdu session modify failed, fill NGAP_PDUSESSION_MODIFY_RESP with the pdu session information that failed to modify \n");
uint8_t nb_of_pdu_sessions_failed = 0;
MessageDef *msg_fail_p = NULL;
msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP);
if (msg_fail_p == NULL) {
LOG_E(NR_RRC, "itti_alloc_new_message failed, msg_fail_p is NULL \n");
return (-1);
}
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id;
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).nb_of_pdusessions = 0;
for (nb_of_pdu_sessions_failed = 0; nb_of_pdu_sessions_failed < ue_context_p->ue_context.nb_of_failed_pdusessions; nb_of_pdu_sessions_failed++) {
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].pdusession_id =
ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].param.pdusession_id;
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].cause =
ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].cause;
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).pdusessions_failed[nb_of_pdu_sessions_failed].cause_value =
ue_context_p->ue_context.modify_pdusession[nb_of_pdu_sessions_failed].cause_value;
}
NGAP_PDUSESSION_MODIFY_RESP(msg_fail_p).nb_of_pdusessions_failed =
ue_context_p->ue_context.nb_of_failed_pdusessions;
itti_send_msg_to_task(TASK_NGAP, instance, msg_fail_p);
ue_context_p->ue_context.nb_of_modify_pdusessions = 0;
ue_context_p->ue_context.nb_of_failed_pdusessions = 0;
memset(ue_context_p->ue_context.modify_pdusession, 0, sizeof(ue_context_p->ue_context.modify_pdusession));
return (0);
}
}
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
)
//------------------------------------------------------------------------------
{
MessageDef *msg_p = NULL;
int i, j;
uint8_t qos_flow_index;
uint8_t pdu_sessions_failed = 0;
uint8_t pdu_sessions_done = 0;
msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP);
if (msg_p == NULL) {
LOG_E(NR_RRC, "itti_alloc_new_message failed, msg_p is NULL \n");
return (-1);
}
LOG_I(NR_RRC, "send message NGAP_PDUSESSION_MODIFY_RESP \n");
NGAP_PDUSESSION_MODIFY_RESP(msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id;
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_pdusessions; i++) {
if (xid == ue_context_pP->ue_context.modify_pdusession[i].xid) {
if (ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_DONE) {
for (j = 0; j < ue_context_pP->ue_context.setup_pdu_sessions; j++) {
if (ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id ==
ue_context_pP->ue_context.pduSession[j].param.pdusession_id) {
LOG_I(NR_RRC, "update pdu session %d \n", ue_context_pP->ue_context.pduSession[j].param.pdusession_id);
// Update ue_context_pP->ue_context.pduSession
ue_context_pP->ue_context.pduSession[j].status = PDU_SESSION_STATUS_ESTABLISHED;
ue_context_pP->ue_context.pduSession[j].cause = NGAP_CAUSE_NOTHING;
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
ue_context_pP->ue_context.pduSession[j].param.qos[qos_flow_index] =
ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index];
}
break;
}
}
if (j < ue_context_pP->ue_context.setup_pdu_sessions) {
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].pdusession_id =
ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
for (qos_flow_index = 0; qos_flow_index < ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos; qos_flow_index++) {
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].qos[qos_flow_index].qfi =
ue_context_pP->ue_context.modify_pdusession[i].param.qos[qos_flow_index].qfi;
}
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].nb_of_qos_flow =
ue_context_pP->ue_context.modify_pdusession[i].param.nb_qos;
LOG_I(NR_RRC, "Modify Resp (msg index %d, pdu session index %d, status %d, xid %d): nb_of_modify_pdusessions %d, pdusession_id %d \n ",
pdu_sessions_done, i, ue_context_pP->ue_context.modify_pdusession[i].status, xid,
ue_context_pP->ue_context.nb_of_modify_pdusessions,
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions[pdu_sessions_done].pdusession_id);
pdu_sessions_done++;
} else {
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id =
ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause = NGAP_CAUSE_RADIO_NETWORK;
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause_value = NGAP_CauseRadioNetwork_unknown_PDU_session_ID;
pdu_sessions_failed++;
}
} else if ((ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_NEW) ||
(ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_ESTABLISHED)) {
LOG_D (NR_RRC, "PDU SESSION is NEW or already ESTABLISHED\n");
} else if (ue_context_pP->ue_context.modify_pdusession[i].status == PDU_SESSION_STATUS_FAILED) {
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].pdusession_id =
ue_context_pP->ue_context.modify_pdusession[i].param.pdusession_id;
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause =
ue_context_pP->ue_context.modify_pdusession[i].cause;
NGAP_PDUSESSION_MODIFY_RESP(msg_p).pdusessions_failed[pdu_sessions_failed].cause_value =
ue_context_pP->ue_context.modify_pdusession[i].cause_value;
pdu_sessions_failed++;
}
} else {
LOG_D(NR_RRC,"xid does not correspond (context pdu session index %d, status %d, xid %d/%d) \n ",
i, ue_context_pP->ue_context.modify_pdusession[i].status, xid, ue_context_pP->ue_context.modify_pdusession[i].xid);
}
}
NGAP_PDUSESSION_MODIFY_RESP(msg_p).nb_of_pdusessions = pdu_sessions_done;
NGAP_PDUSESSION_MODIFY_RESP(msg_p).nb_of_pdusessions_failed = pdu_sessions_failed;
if (pdu_sessions_done > 0 || pdu_sessions_failed > 0) {
LOG_D(NR_RRC,"NGAP_PDUSESSION_MODIFY_RESP: sending the message: nb_of_pdusessions %d, total pdu session %d, index %d\n",
ue_context_pP->ue_context.nb_of_modify_pdusessions, ue_context_pP->ue_context.setup_pdu_sessions, i);
MSC_LOG_TX_MESSAGE(
MSC_RRC_GNB,
MSC_NGAP_GNB,
(const char *)&NGAP_PDUSESSION_MODIFY_RESP(msg_p),
sizeof(ngap_pdusession_modify_resp_t),
MSC_AS_TIME_FMT" PDUSESSION_MODIFY_RESP UE %X gNB_ue_ngap_id %u pdu_sessions:%u succ %u fail",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_id_rnti,
NGAP_PDUSESSION_MODIFY_RESP(msg_p).gNB_ue_ngap_id,
pdu_sessions_done, pdu_sessions_failed);
itti_send_msg_to_task (TASK_NGAP, ctxt_pP->instance, msg_p);
} else {
itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
}
return 0;
}
//------------------------------------------------------------------------------
void
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(
const module_id_t gnb_mod_idP,
......
......@@ -38,6 +38,7 @@
#include "NR_RRCSetupComplete-IEs.h"
#include "NR_RegisteredAMF.h"
#include "NR_UL-DCCH-Message.h"
#include "NGAP_CauseRadioNetwork.h"
typedef struct rrc_ue_ngap_ids_s {
/* Tree related data */
......@@ -107,6 +108,27 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
instance_t instance
);
int
rrc_gNB_process_NGAP_PDUSESSION_MODIFY_REQ(
MessageDef *msg_p,
const char *msg_name,
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
);
void
rrc_gNB_modify_dedicatedRRCReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_ue_context_t *ue_context_pP
);
void
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(
const module_id_t gnb_mod_idP,
......
......@@ -2210,7 +2210,7 @@ nr_rrc_ue_establish_srb2(
// nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig);
}
if(ie->nonCriticalExtension->masterCellGroup!=NULL) {
if((ie->nonCriticalExtension) && (ie->nonCriticalExtension->masterCellGroup!=NULL)) {
nr_rrc_ue_process_masterCellGroup(
ctxt_pP,
gNB_index,
......@@ -2223,7 +2223,7 @@ nr_rrc_ue_establish_srb2(
}
/* Check if there is dedicated NAS information to forward to NAS */
if (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL) {
if ((ie->nonCriticalExtension) && (ie->nonCriticalExtension->dedicatedNAS_MessageList != NULL)) {
int list_count;
uint32_t pdu_length;
uint8_t *pdu_buffer;
......
......@@ -87,6 +87,9 @@
#include "NGAP_PDUSessionResourceModifyItemModReq.h"
#include "NGAP_PDUSessionResourceModifyRequestTransfer.h"
#include "NGAP_QosFlowAddOrModifyRequestItem.h"
#include "NGAP_PDUSessionResourceModifyResponseTransfer.h"
#include "NGAP_QosFlowAddOrModifyResponseList.h"
#include "NGAP_QosFlowAddOrModifyResponseItem.h"
#include "NGAP_TAIListForPagingItem.h"
#include "NGAP_GNB-ID.h"
#include "NGAP_GlobalGNB-ID.h"
......
......@@ -1614,13 +1614,6 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
return -1;
}
/* PDUSession Resource modify request = UE-related procedure -> stream != 0 */
if (stream == 0) {
NGAP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n",
assoc_id, stream);
return -1;
}
ue_desc_p->rx_stream = stream;
if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) {
......@@ -1702,14 +1695,20 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
switch(pdusessionTransfer_ies->id) {
/* optional PDUSessionAggregateMaximumBitRate */
case NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_PDUSessionAggregateMaximumBitRate\n");
break;
/* optional UL-NGU-UP-TNLModifyList */
case NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLModifyList:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_UL_NGU_UP_TNLModifyList\n");
break;
/* optional NetworkInstance */
case NGAP_ProtocolIE_ID_id_NetworkInstance:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_NetworkInstance\n");
break;
/* optional QosFlowAddOrModifyRequestList */
......@@ -1729,6 +1728,12 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
/* Set the QOS informations */
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].qfi = (uint8_t)qosFlowItem_p->qosFlowIdentifier;
if(qosFlowItem_p->qosFlowLevelQosParameters) {
if (qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.present == NGAP_QosCharacteristics_PR_nonDynamic5QI) {
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].fiveQI =
qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.choice.nonDynamic5QI->fiveQI;
} else if (qosFlowItem_p->qosFlowLevelQosParameters->qosCharacteristics.present == NGAP_QosCharacteristics_PR_dynamic5QI) {
// TODO
}
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].allocation_retention_priority.priority_level =
qosFlowItem_p->qosFlowLevelQosParameters->allocationAndRetentionPriority.priorityLevelARP;
NGAP_PDUSESSION_MODIFY_REQ(message_p).pdusession_modify_params[i].qos[qosIdx].allocation_retention_priority.pre_emp_capability =
......@@ -1742,14 +1747,20 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id,
/* optional QosFlowToReleaseList */
case NGAP_ProtocolIE_ID_id_QosFlowToReleaseList:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_QosFlowToReleaseList\n");
break;
/* optional AdditionalUL-NGU-UP-TNLInformation */
case NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_AdditionalUL_NGU_UP_TNLInformation\n");
break;
/* optional CommonNetworkInstance */
case NGAP_ProtocolIE_ID_id_CommonNetworkInstance:
// TODO
NGAP_ERROR("Cant' handle NGAP_ProtocolIE_ID_id_CommonNetworkInstance\n");
break;
default:
......
......@@ -1179,7 +1179,7 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance,
ie->value.choice.RAN_UE_NGAP_ID = pdusession_modify_resp_p->gNB_ue_ngap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
/* PDUSessionResourceModifyListModRes optional */
if (pdusession_modify_resp_p->nb_of_pdusessions > 0) {
ie = (NGAP_PDUSessionResourceModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseIEs_t));
ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceModifyListModRes;
......@@ -1188,10 +1188,29 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance,
for (i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions; i++) {
NGAP_PDUSessionResourceModifyItemModRes_t *item;
NGAP_PDUSessionResourceModifyResponseTransfer_t *transfer_p = NULL;
item = (NGAP_PDUSessionResourceModifyItemModRes_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyItemModRes_t));
item->pDUSessionID = pdusession_modify_resp_p->pdusessions[i].pdusession_id;
transfer_p = (NGAP_PDUSessionResourceModifyResponseTransfer_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseTransfer_t));
transfer_p->qosFlowAddOrModifyResponseList = (NGAP_QosFlowAddOrModifyResponseList_t *)calloc(1, sizeof(NGAP_QosFlowAddOrModifyResponseList_t));
uint8_t qos_flow_index;
for (qos_flow_index = 0; qos_flow_index < pdusession_modify_resp_p->pdusessions[i].nb_of_qos_flow; qos_flow_index++) {
NGAP_QosFlowAddOrModifyResponseItem_t *qosFlowAddOrModifyResponseItem_p = calloc(1, sizeof(NGAP_QosFlowAddOrModifyResponseItem_t));
qosFlowAddOrModifyResponseItem_p->qosFlowIdentifier =
pdusession_modify_resp_p->pdusessions[i].qos[qos_flow_index].qfi;
ASN_SEQUENCE_ADD(&transfer_p->qosFlowAddOrModifyResponseList->list, qosFlowAddOrModifyResponseItem_p);
}
memset(&res, 0, sizeof(res));
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, transfer_p);
item->pDUSessionResourceModifyResponseTransfer.buf = res.buffer;
item->pDUSessionResourceModifyResponseTransfer.size = res.result.encoded;
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, transfer_p);
NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->pDUSessionID);
ASN_SEQUENCE_ADD(&ie->value.choice.PDUSessionResourceModifyListModRes.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