Commit 6086d9c0 authored by Laurent Thomas's avatar Laurent Thomas

Merge branch 'NR_F1C_F1U_extensions' of...

Merge branch 'NR_F1C_F1U_extensions' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_F1C_F1U_extensions
parents b5f30017 c0e9c0ea
......@@ -357,8 +357,12 @@ typedef struct f1ap_ue_context_setup_req_s {
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
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;
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;
// coniatner for the rrc_eNB_generate_SecurityModeCommand message
uint8_t *rrc_container;
......
......@@ -637,40 +637,49 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
/* GNB_CU_UE_F1AP_ID */
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;
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 */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container,
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;
/* 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_ProtocolIE_ID_id_DUtoCURRCInformation, true);
if (ie == NULL){
LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
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);
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_ProtocolIE_ID_id_DRBs_Setup_List, true);
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_setup = calloc(f1ap_ue_context_setup_resp->drbs_setup_length,
f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count;
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));
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");
for (i = 0; i < f1ap_ue_context_setup_resp->drbs_setup_length; ++i) {
f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_setup[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_to_be_setup[i];
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;
drb_p->drb_id = drbs_setup_item_p->dRBID;
/* TODO in the following, assume only one UP UL TNL is present.
* this matches/assumes OAI CU/DU implementation, can be up to 2! */
// TODO in the following, assume only one UP UL TNL is present.
// this matches/assumes OAI CU/DU implementation, can be up to 2!
drb_p->up_dl_tnl_length = 1;
AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0,
"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,
}
}
/* SRBs_FailedToBeSetup_List */
// SRBs_FailedToBeSetup_List
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){
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,
......@@ -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_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true);
F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, false);
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 = 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,
}
}
/* SCell_FailedtoSetup_List */
// SCell_FailedtoSetup_List
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){
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_ProtocolIE_ID_id_SRBs_Setup_List, true);
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_setup = calloc(f1ap_ue_context_setup_resp->srbs_setup_length,
f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count;
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));
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");
for (i = 0; i < f1ap_ue_context_setup_resp->srbs_setup_length; ++i) {
f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_setup[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_to_be_setup[i];
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;
srb_p->srb_id = srbs_setup_item_p->sRBID;
......
......@@ -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__);
break;
case F1AP_ProcedureCode_id_UEContextSetup:
LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__);
break;
default:
LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n",
(int)pdu->choice.successfulOutcome->procedureCode);
......
......@@ -36,6 +36,8 @@
/*
* 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,
uint32_t assoc_id,
uint32_t stream,
......
......@@ -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){
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;
ctxt.rnti = resp->rnti;
ctxt.module_id = instance;
......@@ -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 );
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){
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
memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, 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(j=0; j<resp->drbs_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);
for(i=0; i<resp->drbs_to_be_setup_length; i++){
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_to_be_setup[i].drb_id, resp->drbs_to_be_setup[i].up_dl_tnl[j].teid);
}
}
free(cellGroupConfig->rlc_BearerToAddModList);
......
......@@ -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);
pthread_mutex_unlock(&globGtp.gtp_lock);
return;
} auto tmp=ptrRnti->second.bearers;
}
auto tmp=ptrRnti->second.bearers;
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);
pthread_mutex_unlock(&globGtp.gtp_lock);
return;
} //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, "");
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);
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