Commit 942d92cf authored by Navid Nikaein's avatar Navid Nikaein

send msg 4 in F1 DL RRC message transfer

parent 0e7887de
......@@ -37,7 +37,7 @@ MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_r
/* RRC -> F1AP messages */
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_downlink_rrc_message )
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message )
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req )
......
......@@ -41,6 +41,10 @@
// a compile error
#undef C_RNTI
// Bing Kai: create CU and DU context, and put all the information there.
uint64_t du_ue_f1ap_id = 0;
uint32_t f1ap_assoc_id = 0;
uint32_t f1ap_stream = 0;
/*
Initial UL RRC Message Transfer
*/
......@@ -62,15 +66,18 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint8_t *ccch_sdu;
sdu_size_t ccch_sdu_len;
int CC_id =0;
uint64_t du_ue_f1ap_id;
DevAssert(pdu != NULL);
if (stream != 0) {
LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n",
LOG_E(CU_F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n",
assoc_id, stream);
return -1;
}
// TODO: use context
f1ap_stream = stream;
f1ap_assoc_id = assoc_id;
container = &pdu->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
......@@ -80,10 +87,13 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
/* NRCGI */
/* NRCGI
* TODO: process NRCGI
*/
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_NRCGI, true);
/* RNTI */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_C_RNTI, true);
......@@ -148,16 +158,28 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
*/
//void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) {
int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
F1AP_F1AP_PDU_t pdu;
int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_dl_rrc_message_t *f1ap_dl_rrc)
{
F1AP_F1AP_PDU_t pdu;
F1AP_DLRRCMessageTransfer_t *out;
F1AP_DLRRCMessageTransferIEs_t *ie;
uint8_t *buffer;
uint32_t len;
if (f1ap_stream == 0) {
LOG_E(CU_F1AP, "[CU %d] Received DL RRC message transfer on stream == %d\n",
f1ap_assoc_id, f1ap_stream);
return -1;
}
out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
/* Create */
/* 0. Message Type */
/* 0. Message Type */
memset(&pdu, 0, sizeof(pdu));
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t));
......@@ -168,11 +190,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
/* mandatory */
/* c1. GNB_CU_UE_F1AP_ID */
ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie->value.choice.GNB_CU_UE_F1AP_ID = 126L;
ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
......@@ -181,19 +204,19 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie->value.choice.GNB_DU_UE_F1AP_ID = 651L;
ie->value.choice.GNB_DU_UE_F1AP_ID = du_ue_f1ap_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
/* c3. oldgNB_DU_UE_F1AP_ID */
if (0) {
/* if (f1ap_dl_rrc->old_gNB_DU_ue_id != 0xFFFFFFFF) {
ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
//ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING;
//ie->value.choice. = 1;
ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING;
ie->value.choice.oldgNB_DU_UE_F1AP_ID = f1ap_dl_rrc->old_gNB_DU_ue_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
}*/
/* mandatory */
/* c4. SRBID */
......@@ -201,12 +224,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
ie->id = F1AP_ProtocolIE_ID_id_SRBID;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID;
ie->value.choice.SRBID = 2L;
ie->value.choice.SRBID = f1ap_dl_rrc->srb_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
/* c5. ExecuteDuplication */
if (0) {
if (f1ap_dl_rrc->execute_duplication) {
ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication;
ie->criticality = F1AP_Criticality_ignore;
......@@ -222,11 +245,12 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
ie->id = F1AP_ProtocolIE_ID_id_RRCContainer;
ie->criticality = F1AP_Criticality_reject;
ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer;
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "A", strlen("A"));
OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
/* c7. RAT_FrequencyPriorityInformation */
/* TODO */
if (0) {
ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t));
ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation;
......@@ -246,7 +270,20 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance) {
printf("Failed to encode F1 setup request\n");
return -1;
}
#ifdef F1AP_TEST
printf("\n");
/* decode */
if (f1ap_decode_pdu(&pdu, buffer, len) > 0) {
printf("Failed to decode F1 setup request\n");
return -1;
}
#endif
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0);
return 0;
}
/*
......
......@@ -38,11 +38,13 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance);
int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
f1ap_dl_rrc_message_t *f1ap_dl_rrc);
int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
#endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */
......@@ -33,6 +33,7 @@
#include "f1ap_common.h"
#include "f1ap_handlers.h"
#include "f1ap_cu_interface_management.h"
#include "f1ap_cu_rrc_message_transfer.h"
#include "f1ap_cu_task.h"
extern RAN_CONTEXT_t RC;
......@@ -144,6 +145,13 @@ void *F1AP_CU_task(void *arg) {
&F1AP_SETUP_RESP(received_msg));
break;
case F1AP_DL_RRC_MESSAGE: // from rrc
LOG_W(CU_F1AP, "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));
break;
// case F1AP_SETUP_RESPONSE: // This is from RRC
// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp)
......
......@@ -425,7 +425,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
int num_cells_to_activate = 0;
F1AP_Cells_to_be_Activated_List_Item_t *cell;
MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_RESP);
MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP);
printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n",
in->protocolIEs.list.count);
......
......@@ -366,8 +366,6 @@ rx_sdu(const module_id_t enb_mod_idP,
for (ii = 0; ii < NB_RA_PROC_MAX; ii++) {
ra = &mac->common_channels[CC_idP].ra[ii];
if ((ra->rnti == current_rnti) && (ra->state != IDLE)) {
//int RC.cudu.du_flag = 1;
//int du_flag = 1;
mac_rrc_data_ind(
enb_mod_idP,
CC_idP,
......@@ -376,8 +374,7 @@ rx_sdu(const module_id_t enb_mod_idP,
DCCH,
(uint8_t *) payload_ptr,
rx_lengths[i],
0,
RC.rrc[enb_mod_idP]->node_type
0
);
// prepare transmission of Msg4(RRCConnectionReconfiguration)
ra->state = MSGCRNTI;
......@@ -618,19 +615,16 @@ rx_sdu(const module_id_t enb_mod_idP,
// kill RA procedure
}
//int RC.cudu.du_flag = 1;
//int du_flag = 1;
mac_rrc_data_ind(
enb_mod_idP,
enb_mod_idP,
CC_idP,
frameP, subframeP, UE_id,
current_rnti,
CCCH,
(uint8_t *) payload_ptr,
rx_lengths[i],
0,
RC.rrc[enb_mod_idP]->node_type
);
0
);
if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest
......
......@@ -56,8 +56,7 @@ mac_rrc_data_ind(
const rb_id_t srb_idP,
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const int du_flag
const uint8_t mbsfn_sync_areaP
);
int8_t
......
......@@ -270,13 +270,13 @@ mac_rrc_data_ind(
const rb_id_t srb_idP,
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const int node_type
const uint8_t mbsfn_sync_areaP
)
//--------------------------------------------------------------------------
{
LOG_E(RRC, "node_type == %d \n" , node_type);
if (node_type == ngran_eNB_DU) {
if ( RC.rrc[module_idP]->node_type == ngran_eNB_DU) {
LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n",
module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
......
......@@ -5734,7 +5734,8 @@ rrc_eNB_generate_RRCConnectionSetup(
SRB_ToAddModList_t **SRB_configList;
SRB_ToAddMod_t *SRB1_config;
int cnt;
MessageDef *message_p;
T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -5757,8 +5758,34 @@ rrc_eNB_generate_RRCConnectionSetup(
"[MSG] RRC Connection Setup\n");
// configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
if (*SRB_configList != NULL) {
switch (RC.rrc[ctxt_pP->module_id]->node_type){
case ngran_eNB_CU :
case ngran_ng_eNB_CU :
case ngran_gNB_CU :
// nothing to do for CU
break;
case ngran_eNB_DU :
case ngran_gNB_DU :
// create an ITTI message
message_p = itti_alloc_new_message (TASK_CU_F1, F1AP_DL_RRC_MESSAGE);
memset (F1AP_DL_RRC_MESSAGE (message_p).rrc_container, 0, F1AP_DL_RRC_MESSAGE);
memcpy (F1AP_DL_RRC_MESSAGE (message_p).rrc_container,
(uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
ue_p->Srb0.Tx_buffer.payload_size);
F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size;
F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0;
F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown
F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH;
F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1;
F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0;
itti_send_msg_to_task (TASK_RRC_ENB, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p);
case ngran_eNB:
case ngran_ng_eNB :
case ngran_gNB :
if (*SRB_configList != NULL) {
for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
SRB1_config = (*SRB_configList)->list.array[cnt];
......@@ -5812,11 +5839,14 @@ rrc_eNB_generate_RRCConnectionSetup(
(SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
);
break;
}
}
}
break;
default :
LOG_W(RRC, "Unknown node type %d\n", RC.rrc[ctxt_pP->module_id]->node_type);
}
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
......@@ -6058,36 +6088,6 @@ rrc_eNB_decode_ccch(
0,
0);
/*
#if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE);
memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage));
itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p);
}
# else
{
char message_string[10000];
size_t message_string_size;
if ((message_string_size =
xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) {
MessageDef *msg_p;
msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText));
msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size;
memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
}
}
# endif
#endif
*/
for (i = 0; i < 8; i++) {
LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]);
......@@ -6317,18 +6317,19 @@ rrc_eNB_decode_ccch(
#endif
,NULL);
rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_t*) NULL,
(DRB_ToReleaseList_t*) NULL
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_t*) NULL,
(DRB_ToReleaseList_t*) NULL
#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0))
, (PMCH_InfoList_r9_t *) NULL,
0,0
, (PMCH_InfoList_r9_t *) NULL,
0,0
# endif
);
);
#endif //NO_RRM
}
break;
}
break;
case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
......@@ -6362,12 +6363,12 @@ rrc_eNB_decode_ccch(
rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
{
if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) {
if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5)
{
LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu",
(long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size);
return -1;
}
if(rrcConnectionRequest->ue_Identity.choice.randomValue.size != 5)
{
LOG_I(RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu",
(long unsigned int)rrcConnectionRequest->ue_Identity.choice.randomValue.size);
return -1;
}
memcpy(((uint8_t*) & random_value) + 3,
rrcConnectionRequest->ue_Identity.choice.randomValue.buf,
rrcConnectionRequest->ue_Identity.choice.randomValue.size);
......@@ -6437,8 +6438,8 @@ rrc_eNB_decode_ccch(
PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReject(ctxt_pP,
rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
// navid:
break;
}
......@@ -6546,17 +6547,21 @@ rrc_eNB_decode_ccch(
#endif
,NULL);
rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_t*) NULL,
(DRB_ToReleaseList_t*) NULL
if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) ||
(RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) ||
(RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) {
rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_t*) NULL,
(DRB_ToReleaseList_t*) NULL
#if (RRC_VERSION >= MAKE_VERSION(9, 0, 0))
, (PMCH_InfoList_r9_t *) NULL
, 0, 0
, (PMCH_InfoList_r9_t *) NULL
, 0, 0
#endif
);
);
#endif //NO_RRM
}
break;
default:
......
......@@ -430,8 +430,7 @@ mac_rrc_data_ind(
const rb_id_t srb_idP,
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP,
const int node_type
const uint8_t mbsfn_sync_areaP
);
int8_t
......
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