Commit a7be0cc2 authored by Bing-Kai Hong's avatar Bing-Kai Hong

send F1AP_UL_RRC_MESSAGE from rrc

parent 24884bfb
......@@ -83,6 +83,8 @@ typedef struct f1ap_setup_req_s {
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
uint16_t default_sctp_stream_id;
// F1_Setup_Req payload
uint64_t gNB_DU_id;
char *gNB_DU_name;
......
......@@ -271,7 +271,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
return -1;
}
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/ , buffer, len, 0 /* BK: fix me*/);
return 0;
}
......
......@@ -147,10 +147,8 @@ void *F1AP_CU_task(void *arg) {
case F1AP_DL_RRC_MESSAGE: // from rrc
LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n");
// CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// &F1AP_SETUP_RESP(received_msg));
CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_SETUP_RESP(received_msg));
&F1AP_DL_RRC_MESSAGE(received_msg));
break;
// case F1AP_SETUP_RESPONSE: // This is from RRC
......
......@@ -94,7 +94,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); // this should be the one transmitted via initial ul rrc message transfer
LOG_D(DU_F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n",
du_ue_f1ap_id,
f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer
if (f1ap_du_add_cu_ue_id(&f1ap_du_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) {
LOG_E(DU_F1AP, "Failed to find the F1AP UID \n");
......@@ -160,11 +162,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
//void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) {
int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
rb_id_t srb_idP,
uint8_t *sduP,
sdu_size_t sdu_lenP) {
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_ul_rrc_message_t *f1ap_ul_rrc) {
LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n");
......@@ -191,7 +190,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)];
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[instance].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)];
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -200,7 +199,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)];
ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[instance].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[instance], f1ap_ul_rrc->rnti)];
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -209,7 +208,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
ie->id = F1AP_ProtocolIE_ID_id_SRBID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID;
ie->value.choice.SRBID = srb_idP;
ie->value.choice.SRBID = f1ap_ul_rrc->srb_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
// issue in here
......@@ -219,7 +218,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
ie->id = F1AP_ProtocolIE_ID_id_RRCContainer;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP);
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_ul_rrc->rrc_container, f1ap_ul_rrc->rrc_container_length);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* encode */
......@@ -228,9 +227,11 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
return -1;
}
du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id);
return 0;
}
/* UL RRC Message Transfer */
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int CC_idP,
......@@ -323,7 +324,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
return -1;
}
du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0);
du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id);
return 0;
}
......
......@@ -39,10 +39,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP,
rb_id_t srb_idP,
uint8_t *sduP,
sdu_size_t sdu_lenP);
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_ul_rrc_message_t *f1ap_ul_rrc);
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int CC_idP,
......
......@@ -93,6 +93,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id;
f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams;
f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams;
f1ap_du_data->default_sctp_stream_id = 0;
DU_send_F1_SETUP_REQUEST(instance);
......@@ -159,6 +160,12 @@ void *F1AP_DU_task(void *arg) {
&received_msg->ittiMsg.sctp_data_ind);
break;
case F1AP_UL_RRC_MESSAGE: // from rrc
LOG_I(DU_F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n");
DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&F1AP_UL_RRC_MESSAGE(received_msg));
break;
case TERMINATE_MESSAGE:
LOG_W(DU_F1AP, " *** Exiting DU_F1AP thread\n");
itti_exit_task();
......
......@@ -512,6 +512,11 @@ typedef struct HANDOVER_INFO_UE_s {
uint8_t measFlag;
} HANDOVER_INFO_UE;
typedef struct RRC_CONTAINER_s{
char *buffer;
uint8_t size;
} RRC_CONTAINER_t;
typedef struct eNB_RRC_UE_s {
uint8_t primaryCC_id;
#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
......@@ -539,6 +544,7 @@ typedef struct eNB_RRC_UE_s {
HANDOVER_INFO* handover_info;
MeasResults_t* measResults;
RRC_CONTAINER_t *security_mode_cmd;
UE_EUTRA_Capability_t* UE_Capability;
ImsiMobileIdentity_t imsi;
......
......@@ -1095,7 +1095,28 @@ rrc_eNB_process_RRCConnectionSetupComplete(
rrc_eNB_generate_SecurityModeCommand(
ctxt_pP,
ue_context_pP);
/*
if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU) ||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_CU) ||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU)) {
message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
*/
// rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP);
}
}
......@@ -1146,6 +1167,8 @@ rrc_eNB_generate_SecurityModeCommand(
rrc_eNB_mui,
size);
if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) ||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB)) {
rrc_data_req(
ctxt_pP,
DCCH,
......@@ -1154,6 +1177,7 @@ rrc_eNB_generate_SecurityModeCommand(
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
}
......@@ -6944,6 +6968,21 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.
present ==
RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) {
if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU) ||
(RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU) ) {
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UL_RRC_MESSAGE);
F1AP_UL_RRC_MESSAGE (message_p).rrc_container = &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8;
F1AP_UL_RRC_MESSAGE (message_p).rrc_container_length = strlen(&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8);
F1AP_UL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_UL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_UL_RRC_MESSAGE (message_p).rnti = ue_context_p->ue_context.rnti;
F1AP_UL_RRC_MESSAGE (message_p).srb_id = DCCH;
itti_send_msg_to_task (TASK_DU_F1, ctxt_pP->module_id, message_p);
LOG_D(RRC, "Send F1AP_UL_RRC_MESSAGE with ITTI\n");
} else { //if ((RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) ||
// (RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB) ) {
rrc_eNB_process_RRCConnectionSetupComplete(
ctxt_pP,
ue_context_p,
......@@ -6951,7 +6990,7 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
ue_context_p->ue_context.Status = RRC_CONNECTED;
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
}
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (rrc_agent_registered[ctxt_pP->module_id]) {
agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
......
......@@ -1059,6 +1059,28 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
rrc_eNB_generate_UECapabilityEnquiry (&ctxt, ue_context_p);
}
}
/*
if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) ||
(RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){
message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p);
LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n");
}
*/
return (0);
}
}
......
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