Commit c0e9c0ea authored by matzakos's avatar matzakos

Update handling of UE context setup Response at F1AP and RRC of the CU

parent 7b2f3440
...@@ -357,8 +357,12 @@ typedef struct f1ap_ue_context_setup_req_s { ...@@ -357,8 +357,12 @@ typedef struct f1ap_ue_context_setup_req_s {
uint8_t du_to_cu_rrc_information_length; uint8_t du_to_cu_rrc_information_length;
f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req
uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req
uint8_t drbs_failed_to_be_setup_length;
f1ap_rb_failed_to_be_setup_t *drbs_failed_to_be_setup;
f1ap_srb_to_be_setup_t *srbs_to_be_setup; f1ap_srb_to_be_setup_t *srbs_to_be_setup;
uint8_t srbs_to_be_setup_length; uint8_t srbs_to_be_setup_length;
uint8_t srbs_failed_to_be_setup_length;
f1ap_rb_failed_to_be_setup_t *srbs_failed_to_be_setup;
s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req; s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req;
// coniatner for the rrc_eNB_generate_SecurityModeCommand message // coniatner for the rrc_eNB_generate_SecurityModeCommand message
uint8_t *rrc_container; uint8_t *rrc_container;
......
...@@ -631,46 +631,55 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, ...@@ -631,46 +631,55 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
F1AP_UEContextSetupResponseIEs_t *ie; F1AP_UEContextSetupResponseIEs_t *ie;
DevAssert(pdu); DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_resp_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse;
int i; int i;
/* GNB_CU_UE_F1AP_ID */ /* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, false);
f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id);
/* GNB_DU_UE_F1AP_ID */ /* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
/* DUtoCURRCInformation */ LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_DU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_DU_ue_id);
f1ap_ue_context_setup_resp->rnti =
f1ap_get_rnti_by_du_id(true, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id);
// DUtoCURRCInformation
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true);
if (ie == NULL){ if (ie == NULL){
LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1; return -1;
} }
f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size);
memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size);
f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size; f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size;
/* DRBs_Setup_List */ // DRBs_Setup_List
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true);
if(ie!=NULL){ if(ie!=NULL){
f1ap_ue_context_setup_resp->drbs_setup_length = ie->value.choice.DRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count;
f1ap_ue_context_setup_resp->drbs_setup = calloc(f1ap_ue_context_setup_resp->drbs_setup_length, f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length,
sizeof(f1ap_drb_to_be_setup_t)); sizeof(f1ap_drb_to_be_setup_t));
AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, AssertFatal(f1ap_ue_context_setup_resp->drbs_to_be_setup,
"could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n");
for (i = 0; i < f1ap_ue_context_setup_resp->drbs_setup_length; ++i) { for (i = 0; i < f1ap_ue_context_setup_resp->drbs_to_be_setup_length; ++i) {
f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_setup[i]; f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_to_be_setup[i];
F1AP_DRBs_Setup_Item_t *drbs_setup_item_p; F1AP_DRBs_Setup_Item_t *drbs_setup_item_p;
drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item; drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item;
drb_p->drb_id = drbs_setup_item_p->dRBID; drb_p->drb_id = drbs_setup_item_p->dRBID;
/* TODO in the following, assume only one UP UL TNL is present. // TODO in the following, assume only one UP UL TNL is present.
* this matches/assumes OAI CU/DU implementation, can be up to 2! */ // this matches/assumes OAI CU/DU implementation, can be up to 2!
drb_p->up_dl_tnl_length = 1; drb_p->up_dl_tnl_length = 1;
AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0, AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0,
"no DL UP TNL Information in DRBs to be Setup list\n"); "no DL UP TNL Information in DRBs to be Setup list\n");
...@@ -681,9 +690,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, ...@@ -681,9 +690,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
} }
} }
/* SRBs_FailedToBeSetup_List */ // SRBs_FailedToBeSetup_List
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true); F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, false);
if(ie!=NULL){ if(ie!=NULL){
f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count;
f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length, f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length,
...@@ -696,9 +705,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, ...@@ -696,9 +705,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
} }
} }
/* DRBs_FailedToBeSetup_List */ // DRBs_FailedToBeSetup_List
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true); F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, false);
if(ie!=NULL){ if(ie!=NULL){
f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count;
f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length, f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length,
...@@ -711,24 +720,24 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, ...@@ -711,24 +720,24 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
} }
} }
/* SCell_FailedtoSetup_List */ // SCell_FailedtoSetup_List
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true); F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, false);
if(ie!=NULL){ if(ie!=NULL){
LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n"); LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n");
} }
/* SRBs_Setup_List */ // SRBs_Setup_List
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true); F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true);
if(ie!=NULL){ if(ie!=NULL){
f1ap_ue_context_setup_resp->srbs_setup_length = ie->value.choice.SRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count;
f1ap_ue_context_setup_resp->srbs_setup = calloc(f1ap_ue_context_setup_resp->srbs_setup_length, f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length,
sizeof(f1ap_srb_to_be_setup_t)); sizeof(f1ap_srb_to_be_setup_t));
AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, AssertFatal(f1ap_ue_context_setup_resp->srbs_to_be_setup,
"could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n");
for (i = 0; i < f1ap_ue_context_setup_resp->srbs_setup_length; ++i) { for (i = 0; i < f1ap_ue_context_setup_resp->srbs_to_be_setup_length; ++i) {
f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_setup[i]; f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_to_be_setup[i];
F1AP_SRBs_Setup_Item_t *srbs_setup_item_p; F1AP_SRBs_Setup_Item_t *srbs_setup_item_p;
srbs_setup_item_p = &((F1AP_SRBs_Setup_ItemIEs_t *)ie->value.choice.SRBs_Setup_List.list.array[i])->value.choice.SRBs_Setup_Item; srbs_setup_item_p = &((F1AP_SRBs_Setup_ItemIEs_t *)ie->value.choice.SRBs_Setup_List.list.array[i])->value.choice.SRBs_Setup_Item;
srb_p->srb_id = srbs_setup_item_p->sRBID; srb_p->srb_id = srbs_setup_item_p->sRBID;
......
...@@ -119,6 +119,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) { ...@@ -119,6 +119,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) {
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__);
break; break;
case F1AP_ProcedureCode_id_UEContextSetup:
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
break;
default: default:
LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n", LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome->procedureCode); (int)pdu->choice.successfulOutcome->procedureCode);
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <openair3/ocp-gtpu/gtp_itf.h> #include <openair3/ocp-gtpu/gtp_itf.h>
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req);
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
/* /*
* UE Context Setup * UE Context Setup
*/ */
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req);
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
......
...@@ -3249,7 +3249,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ...@@ -3249,7 +3249,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){
f1ap_ue_context_setup_resp_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
ctxt.rnti = resp->rnti; ctxt.rnti = resp->rnti;
ctxt.module_id = instance; ctxt.module_id = instance;
...@@ -3273,7 +3273,7 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch ...@@ -3273,7 +3273,7 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 ); SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 );
return; return;
} }
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig); //xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig);
if(ue_context_p->ue_context.masterCellGroup == NULL){ if(ue_context_p->ue_context.masterCellGroup == NULL){
ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t)); ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t));
...@@ -3287,10 +3287,11 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch ...@@ -3287,10 +3287,11 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList,
sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
} }
xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup);
for(i=0; i<resp->drbs_setup_length; i++){ for(i=0; i<resp->drbs_to_be_setup_length; i++){
for(j=0; j<resp->drbs_setup[i].up_dl_tnl_length; j++){ for(j=0; j<resp->drbs_to_be_setup[i].up_dl_tnl_length; j++){
GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_setup[i].drb_id, resp->drbs_setup[i].up_dl_tnl[j].teid); GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_to_be_setup[i].drb_id, resp->drbs_to_be_setup[i].up_dl_tnl[j].teid);
} }
} }
free(cellGroupConfig->rlc_BearerToAddModList); free(cellGroupConfig->rlc_BearerToAddModList);
......
...@@ -396,13 +396,15 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer ...@@ -396,13 +396,15 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer
LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} auto tmp=ptrRnti->second.bearers; }
auto tmp=ptrRnti->second.bearers;
auto ptrBearer=tmp.find(bearer_id); if ( ptrBearer == tmp.end() ) { auto ptrBearer=tmp.find(bearer_id); if ( ptrBearer == tmp.end() ) {
LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, ""); } //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, "");
ptrBearer->second.teid_outgoing = newOutgoingTeid; ptrBearer->second.teid_outgoing = newOutgoingTeid;
LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptrBearer->second.teid_outgoing);
pthread_mutex_unlock(&globGtp.gtp_lock); pthread_mutex_unlock(&globGtp.gtp_lock);
return; return;
} }
......
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