diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 636d305c135a19b8b8465c15a2c75d4a8d9fa13a..a3f447baa3fdf767bba18ce0dfe2c9aff5da3398 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -304,6 +304,7 @@ void *rrc_enb_process_msg(void *); TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_PHY_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MAC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ + TASK_DEF(TASK_MAC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RLC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_PDCP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \ diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 1f1e18546e9ebda10fd48435982dc1c6cf2c90f3..e49a10462cf7efde3907c2bf1af670be6510533c 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -308,7 +308,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint16_t crnti; uint8_t *rrc_container; int rrc_container_length; - char du2cu_rrc_container[200]; + uint8_t *du2cu_rrc_container; int du2cu_rrc_container_length; } f1ap_initial_ul_rrc_message_t; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 62a62095b16fcd22f70632be95d298bc0cdf901a..3ae30cafb9f0c4b164c540811774ab247bca2021 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -79,56 +79,60 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); rnti = ie->value.choice.C_RNTI; - /* RRC Container */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_InitialULRRCMessageTransferIEs_t *rrccont; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, rrccont, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - AssertFatal(ie!=NULL,"RRCContainer is missing\n"); - - // create an ITTI message and copy SDU - if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) { - message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND); - memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); - } else { - message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - ccch_sdu_len = ie->value.choice.RRCContainer.size; - memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - ccch_sdu_len); - } + AssertFatal(rrccont!=NULL,"RRCContainer is missing\n"); - LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size); - /* DUtoCURRCContainer */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, + F1AP_InitialULRRCMessageTransferIEs_t *du2cu; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, du2cu, container, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); - if (ie) { - NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t)); - NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size; - NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(ie->value.choice.DUtoCURRCContainer.size); - memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf, - ie->value.choice.DUtoCURRCContainer.buf, - ie->value.choice.DUtoCURRCContainer.size); - } - int f1ap_uid = f1ap_add_ue(CUtype, instance, rnti); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); - itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); return -1; } + // create an ITTI message and copy SDU + if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) { + message_p = itti_alloc_new_message (TASK_CU_F1, 0, F1AP_INITIAL_UL_RRC_MESSAGE); + f1ap_initial_ul_rrc_message_t *ul_rrc = &F1AP_INITIAL_UL_RRC_MESSAGE(message_p); + ul_rrc->nr_cellid = nr_cellid; // CU instance + ul_rrc->crnti = rnti; + ul_rrc->rrc_container_length = rrccont->value.choice.RRCContainer.size; + ul_rrc->rrc_container = malloc(ul_rrc->rrc_container_length); + memcpy(ul_rrc->rrc_container, rrccont->value.choice.RRCContainer.buf, ul_rrc->rrc_container_length); + AssertFatal(du2cu != NULL, "no masterCellGroup in initial UL RRC message\n"); + ul_rrc->du2cu_rrc_container_length = du2cu->value.choice.DUtoCURRCContainer.size; + ul_rrc->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length); + memcpy(ul_rrc->du2cu_rrc_container, du2cu->value.choice.DUtoCURRCContainer.buf, ul_rrc->du2cu_rrc_container_length); + itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); + } else { + message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + ccch_sdu_len = rrccont->value.choice.RRCContainer.size; + memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, rrccont->value.choice.RRCContainer.buf, + ccch_sdu_len); + NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; + NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; + NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; + NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance + NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; + NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + if (du2cu) { + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t)); + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = du2cu->value.choice.DUtoCURRCContainer.size; + NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(du2cu->value.choice.DUtoCURRCContainer.size); + memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf, + du2cu->value.choice.DUtoCURRCContainer.buf, + du2cu->value.choice.DUtoCURRCContainer.size); + } + itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); + } + //getCxt(true,ITTI_MSG_DESTINATION_ID(message_p))->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; - NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; - NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0; - NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len; - NR_RRC_MAC_CCCH_DATA_IND (message_p).nr_cellid = nr_cellid; // CU instance - NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; - NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; - itti_send_msg_to_task (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index bee17f52566ad963360fc8d2865182547853cb2b..fab276ab2189a15401074fb85aca9a17a33944a4 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -749,7 +749,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, rnti_t rntiP, const uint8_t *sduP, sdu_size_t sdu_lenP, - const char *sdu2P, + const uint8_t *sdu2P, sdu_size_t sdu2_lenP) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_InitialULRRCMessageTransfer_t *out; @@ -808,7 +808,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, ie5->criticality = F1AP_Criticality_reject; ie5->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; OCTET_STRING_fromBuf(&ie5->value.choice.DUtoCURRCContainer, - sdu2P, + (const char *)sdu2P, sdu2_lenP); } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index d6f196e38431add79afde8ad4848f4ea50d469d9..b42d731ac702abfc7279b7a6a9296cc529a708a8 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -50,7 +50,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, rnti_t rntiP, const uint8_t *sduP, sdu_size_t sdu_lenP, - const char *sdu2P, + const uint8_t *sdu2P, sdu_size_t sdu2_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 3f7a908395dfc4039dd694e4bec8b1b76049119a..38178fed8b21be3018a3bf902d90da66ee5803b3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -44,9 +44,12 @@ #include "OCG.h" #include "OCG_extern.h" +/* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */ #include "RRC/LTE/rrc_extern.h" #include "RRC/NR/nr_rrc_extern.h" +#include "RRC/NR/rrc_gNB_UE_context.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "RRC/NR/MESSAGES/asn1_msg.h" #include "intertask_interface.h" @@ -3183,3 +3186,53 @@ void nr_mac_update_timers(module_id_t module_id, } } */ + +void send_initial_ul_rrc_message(module_id_t module_id, + int CC_id, + int UE_id, + rb_id_t srb_id, + const uint8_t *sdu, + sdu_size_t sdu_len) { + const gNB_MAC_INST *mac = RC.nrmac[module_id]; + const rnti_t rnti = mac->UE_info.rnti[UE_id]; + LOG_W(MAC, + "[RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %04x\n", + srb_id, sdu_len, UE_id, rnti); + + const NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_id]->carrier.servingcellconfigcommon; + + /* TODO REMOVE_DU_RRC: the RRC in the DU is a hack and should be taken out in the future */ + if (NODE_IS_DU(RC.nrrrc[module_id]->node_type)) { + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_id]); + ue_context_p->ue_id_rnti = rnti; + ue_context_p->ue_context.rnti = rnti; + ue_context_p->ue_context.random_ue_identity = rnti; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_id]->rrc_ue_head, ue_context_p); + } + + NR_CellGroupConfig_t cellGroupConfig; + memset(&cellGroupConfig, 0, sizeof(cellGroupConfig)); + fill_initial_cellGroupConfig(UE_id, &cellGroupConfig, scc, &RC.nrrrc[module_id]->configuration); + + uint8_t du2cu_rrc_container[1024]; + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + &cellGroupConfig, + du2cu_rrc_container, + sizeof(du2cu_rrc_container)); + AssertFatal(enc_rval.encoded > 0, + "Could not encode cellGroupConfig for UE %04x, failed element %s\n", + rnti, + enc_rval.failed_type->name); + + const f1ap_initial_ul_rrc_message_t ul_rrc_msg = { + /* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */ + .crnti = rnti, + .rrc_container = (uint8_t *) sdu, + .rrc_container_length = sdu_len, + .du2cu_rrc_container = (uint8_t *) du2cu_rrc_container, + .du2cu_rrc_container_length = (enc_rval.encoded + 7) / 8 + }; + mac->mac_rrc.initial_ul_rrc_message_transfer(module_id, &ul_rrc_msg); +} diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 83bf2a5a653a95068fda26d69fa80edf2e4cff73..6c2895e46d07bddda229caa15a5197a4f9565a84 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -439,16 +439,12 @@ int nr_process_mac_pdu(module_id_t module_idP, mac_len = 6; } - nr_mac_rrc_data_ind(module_idP, - CC_id, - frameP, - 0, - 0, - UE_info->rnti[UE_id], - CCCH, - pduP + mac_subheader_len, - mac_len, - 0); + send_initial_ul_rrc_message(module_idP, + CC_id, + UE_id, + CCCH, + pduP + mac_subheader_len, + mac_len); break; case UL_SCH_LCID_DTCH: diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 49850c9ac8c101283e38b25adeb95d0492a46c84..446514c96edff0adafe9abbb1b4717776789389f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -530,6 +530,11 @@ void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp); -void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl); +void send_initial_ul_rrc_message(module_id_t module_idP, + int CC_id, + int UE_id, + rb_id_t srb_idP, + const uint8_t *sduP, + sdu_size_t sdu_lenP); #endif /*__LAYER2_NR_MAC_PROTO_H__*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index f290e0d2680606da19123ce902fc2021560a499e..25ee7feb14a6934ecaab1d23ea4d16e758d49552 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -25,8 +25,22 @@ static void initial_ul_rrc_message_transfer_direct(module_id_t module_id, const f1ap_initial_ul_rrc_message_t *ul_rrc) { - /* TODO ITTI message for NR_RRC_MAC_IND? */ - AssertFatal(0 == 1, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE); + /* copy all fields, but reallocate rrc_containers! */ + f1ap_initial_ul_rrc_message_t *f1ap_msg = &F1AP_INITIAL_UL_RRC_MESSAGE(msg); + *f1ap_msg = *ul_rrc; + + f1ap_msg->rrc_container = malloc(ul_rrc->rrc_container_length); + DevAssert(f1ap_msg->rrc_container); + memcpy(f1ap_msg->rrc_container, ul_rrc->rrc_container, ul_rrc->rrc_container_length); + f1ap_msg->rrc_container_length = ul_rrc->rrc_container_length; + + f1ap_msg->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length); + DevAssert(f1ap_msg->du2cu_rrc_container); + memcpy(f1ap_msg->du2cu_rrc_container, ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container_length); + f1ap_msg->du2cu_rrc_container_length = ul_rrc->du2cu_rrc_container_length; + + itti_send_msg_to_task(TASK_RRC_GNB, module_id, msg); } void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index ed67fb91193fc84ab5ef720ea0621e8538aaf5bc..65e7f10405eabab771701b4a6d15a94908ec0724 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -25,7 +25,22 @@ static void initial_ul_rrc_message_transfer_f1ap(module_id_t module_id, const f1ap_initial_ul_rrc_message_t *ul_rrc) { - AssertFatal(0 == 1, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE); + /* copy all fields, but reallocate rrc_containers! */ + f1ap_initial_ul_rrc_message_t *f1ap_msg = &F1AP_INITIAL_UL_RRC_MESSAGE(msg); + *f1ap_msg = *ul_rrc; + + f1ap_msg->rrc_container = malloc(ul_rrc->rrc_container_length); + DevAssert(f1ap_msg->rrc_container); + memcpy(f1ap_msg->rrc_container, ul_rrc->rrc_container, ul_rrc->rrc_container_length); + f1ap_msg->rrc_container_length = ul_rrc->rrc_container_length; + + f1ap_msg->du2cu_rrc_container = malloc(ul_rrc->du2cu_rrc_container_length); + DevAssert(f1ap_msg->du2cu_rrc_container); + memcpy(f1ap_msg->du2cu_rrc_container, ul_rrc->du2cu_rrc_container, ul_rrc->du2cu_rrc_container_length); + f1ap_msg->du2cu_rrc_container_length = ul_rrc->du2cu_rrc_container_length; + + itti_send_msg_to_task(TASK_DU_F1, module_id, msg); } void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc) diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index cd87dfd55488cdc453bef0b897abe0a6ccc8c451..981d224d3070a7fd7012f8593c0f04033107fdce 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -293,73 +293,6 @@ int mac_rrc_nr_data_req(const module_id_t Mod_idP, } -int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, - const int CC_id, - const frame_t frameP, - const sub_frame_t sub_frameP, - const int UE_id, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP, - const boolean_t brOption) { - - if (NODE_IS_DU(RC.nrrrc[module_idP]->node_type)) { - LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n", - module_idP, srb_idP, sdu_lenP, UE_id, rntiP); - - // Generate DUtoCURRCContainer - // call do_RRCSetup like full procedure and extract masterCellGroup - NR_CellGroupConfig_t cellGroupConfig; - NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon; - memset(&cellGroupConfig,0,sizeof(cellGroupConfig)); - - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; - ue_context_p->ue_context.rnti = rntiP; - ue_context_p->ue_context.random_ue_identity = rntiP; - ue_context_p->ue_context.Srb0.Active = 1; - RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); - - fill_initial_cellGroupConfig(ue_context_p->local_uid,&cellGroupConfig,scc, &RC.nrrrc[module_idP]->configuration); - - MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP); - f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp); - - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - (void *)&cellGroupConfig, - msg->du2cu_rrc_container, - 1024); //sizeof(msg->du2cu_rrc_container)); - - if (enc_rval.encoded == -1) { - LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name); - exit(-1); - } - /* do ITTI message */ - msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8; - msg->crnti=rntiP; - msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized() - memcpy(msg->rrc_container, sduP, sdu_lenP); - msg->rrc_container_length=sdu_lenP; - itti_send_msg_to_task(TASK_DU_F1, 0, tmp); - return(0); - } - - protocol_ctxt_t ctxt; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0); - - if((srb_idP & RAB_OFFSET) == CCCH) { - LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP); - ctxt.brOption = brOption; - if (sdu_lenP > 0) { - nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, NULL, CC_id); - } - } - - return 0; -} - void nr_mac_gNB_rrc_ul_failure(const module_id_t Mod_instP, const int CC_idP, const frame_t frameP, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 8e8959c5974689ca2a2405a72940e7312351898d..1f585cdd9a5348bd36f221c836717a3b36896257 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1016,7 +1016,7 @@ long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS) { void fill_initial_SpCellConfig(int uid, NR_SpCellConfig_t *SpCellConfig, - NR_ServingCellConfigCommon_t *scc, + const NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration) { // This assert will never happen in the current implementation because NUMBER_OF_UE_MAX = 4. @@ -1739,7 +1739,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, void fill_initial_cellGroupConfig(int uid, NR_CellGroupConfig_t *cellGroupConfig, - NR_ServingCellConfigCommon_t *scc, + const NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration) { NR_RLC_BearerConfig_t *rlc_BearerConfig = NULL; @@ -1841,7 +1841,8 @@ void fill_initial_cellGroupConfig(int uid, int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, const uint8_t transaction_id, - OCTET_STRING_t *masterCellGroup_from_DU, + const uint8_t *masterCellGroup, + int masterCellGroup_len, NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration) //------------------------------------------------------------------------------ @@ -1853,7 +1854,6 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, NR_SRB_ToAddMod_t *SRB1_config = NULL; NR_PDCP_Config_t *pdcp_Config = NULL; NR_CellGroupConfig_t *cellGroupConfig = NULL; - char masterCellGroup_buf[3000]; AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n"); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; @@ -1896,40 +1896,15 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, ie->radioBearerConfig.securityConfig = NULL; /****************************** masterCellGroup ******************************/ - /* TODO */ - if (masterCellGroup_from_DU) { - memcpy(&ie->masterCellGroup,masterCellGroup_from_DU,sizeof(*masterCellGroup_from_DU)); - // decode masterCellGroup OCTET_STRING received from DU and place in ue context - uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, //might be added prefix later - (void **)&cellGroupConfig, - (uint8_t *)masterCellGroup_from_DU->buf, - masterCellGroup_from_DU->size, 0, 0); - - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); - } - else { - cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); - fill_initial_cellGroupConfig(ue_context_pP->local_uid, cellGroupConfig, scc, configuration); - - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - (void *)cellGroupConfig, - masterCellGroup_buf, - 3000); - - if(enc_rval.encoded == -1) { - LOG_E(NR_RRC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return -1; - } - - if (OCTET_STRING_fromBuf(&ie->masterCellGroup, masterCellGroup_buf, (enc_rval.encoded+7)/8) == -1) { - LOG_E(NR_RRC, "fatal: OCTET_STRING_fromBuf failed\n"); - return -1; - } - } - + DevAssert(masterCellGroup && masterCellGroup_len > 0); + ie->masterCellGroup.buf = malloc(masterCellGroup_len); + AssertFatal(ie->masterCellGroup.buf != NULL, "could not allocate memory for masterCellGroup\n"); + memcpy(ie->masterCellGroup.buf, masterCellGroup, masterCellGroup_len); + ie->masterCellGroup.size = masterCellGroup_len; + + // decode masterCellGroup OCTET_STRING received from DU and place in ue context + uper_decode(NULL, &asn_DEF_NR_CellGroupConfig, (void **)&cellGroupConfig, masterCellGroup, masterCellGroup_len, 0, 0); + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, cellGroupConfig); ue_p->masterCellGroup = cellGroupConfig; if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 81563eb7cdf5df87651e0d4531f3172ca9ca0e7c..c65b05659464f794da5af924442eb2bf0826ed7e 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -103,12 +103,12 @@ uint8_t do_RRCReject(uint8_t Mod_id, void fill_initial_SpCellConfig(int uid, NR_SpCellConfig_t *SpCellConfig, - NR_ServingCellConfigCommon_t *scc, + const NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration); void fill_initial_cellGroupConfig(int uid, NR_CellGroupConfig_t *cellGroupConfig, - NR_ServingCellConfigCommon_t *scc, + const NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration); void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, @@ -120,7 +120,8 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, const uint8_t transaction_id, - OCTET_STRING_t *masterCellGroup_from_DU, + const uint8_t *masterCellGroup, + int masterCellGroup_len, NR_ServingCellConfigCommon_t *scc, const gNB_RrcConfigurationReq *configuration); diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index c8fddbecfb9373cfd4c80b7af226f6470aac5cc1..d817db4ab7243c000469c60922b854b730b9b666 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -108,9 +108,9 @@ void rrc_gNB_generate_RRCSetup( const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP, - OCTET_STRING_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - const int CC_id); + const uint8_t *masterCellGroup, + int masterCellGroup_len, + NR_ServingCellConfigCommon_t *scc); int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo, x2ap_ENDC_sgnb_addition_req_t *m); @@ -167,24 +167,11 @@ int nr_rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP); -int8_t nr_mac_rrc_data_ind( - const module_id_t module_idP, - const int CC_id, - const frame_t frameP, - const sub_frame_t sub_frameP, - const int UE_id, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP, - const boolean_t brOption -); - int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, const uint8_t *buffer, int buffer_length, - OCTET_STRING_t *du_to_cu_rrc_container, - const int CC_id); + const uint8_t *du_to_cu_rrc_container, + int du_to_cu_rrc_container_length); void rrc_gNB_generate_dedicatedRRCReconfiguration_release( diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e679c6b181e5a758010017d41a09b7cf3f1b5051..12986bca0c3adf98b153b68255c5db95e27152e5 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -339,10 +339,9 @@ void rrc_gNB_generate_RRCSetup( const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *const ue_context_pP, - OCTET_STRING_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - const int CC_id -) + const uint8_t *masterCellGroup, + int masterCellGroup_len, + NR_ServingCellConfigCommon_t *scc) //----------------------------------------------------------------------------- { LOG_I(NR_RRC, "rrc_gNB_generate_RRCSetup for RNTI %04x\n", ctxt_pP->rnti); @@ -358,7 +357,8 @@ rrc_gNB_generate_RRCSetup( ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), - masterCellGroup_from_DU, + masterCellGroup, + masterCellGroup_len, scc, &rrc->configuration); @@ -401,10 +401,12 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + /* TODO LUIS: masterCellGroup for RRC Reestablishment Req necessary? */ ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), NULL, + 0, scc, &rrc_instance_p->configuration); @@ -445,9 +447,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( void rrc_gNB_generate_RRCReject( const protocol_ctxt_t *const ctxt_pP, - rrc_gNB_ue_context_t *const ue_context_pP, - const int CC_id -) + rrc_gNB_ue_context_t *const ue_context_pP) //----------------------------------------------------------------------------- { LOG_I(NR_RRC, "rrc_gNB_generate_RRCReject \n"); @@ -1767,8 +1767,8 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, const uint8_t *buffer, int buffer_length, - OCTET_STRING_t *du_to_cu_rrc_container, - const int CC_id) + const uint8_t *du_to_cu_rrc_container, + int du_to_cu_rrc_container_len) { module_id_t Idx; asn_dec_rval_t dec_rval; @@ -1778,22 +1778,16 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, NR_RRCSetupRequest_IEs_t *rrcSetupRequest = NULL; NR_RRCReestablishmentRequest_IEs_t rrcReestablishmentRequest; uint64_t random_value = 0; - int i; - dec_rval = uper_decode( NULL, - &asn_DEF_NR_UL_CCCH_Message, - (void **)&ul_ccch_msg, - (uint8_t *) buffer, - 100, - 0, - 0); + LOG_I(NR_RRC, "Decoding CCCH: RNTI %04x, inst %ld, payload_size %d\n", ctxt_pP->rnti, ctxt_pP->instance, buffer_length); + dec_rval = uper_decode(NULL, &asn_DEF_NR_UL_CCCH_Message, (void **) &ul_ccch_msg, buffer, buffer_length, 0, 0); - if (dec_rval.consumed == 0) { - /* TODO */ - LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", - PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - return -1; - } + if (dec_rval.code != RC_OK || dec_rval.consumed == 0) { + LOG_E(NR_RRC, + PROTOCOL_NR_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", + PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); + return -1; + } if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { switch (ul_ccch_msg->message.choice.c1->present) { @@ -1899,8 +1893,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRCSetupRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_gNB_generate_RRCReject(ctxt_pP, - rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), - CC_id); + rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti)); break; } @@ -1909,8 +1902,8 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, rrc_gNB_generate_RRCSetup(ctxt_pP, rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), du_to_cu_rrc_container, - gnb_rrc_inst->carrier.servingcellconfigcommon, - CC_id); + du_to_cu_rrc_container_len, + gnb_rrc_inst->carrier.servingcellconfigcommon); } break; @@ -1942,13 +1935,13 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), rrcReestablishmentRequest.ue_Identity.physCellId, RC.nrrrc[ctxt_pP->module_id]->carrier.physCellId); - rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, CC_id); + rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0); break; } LOG_D(NR_RRC, "physCellId is %ld\n", rrcReestablishmentRequest.ue_Identity.physCellId); - for (i = 0; i < rrcReestablishmentRequest.ue_Identity.shortMAC_I.size; i++) { + for (int i = 0; i < rrcReestablishmentRequest.ue_Identity.shortMAC_I.size; i++) { LOG_D(NR_RRC, "rrcReestablishmentRequest.ue_Identity.shortMAC_I.buf[%d] = %x\n", i, rrcReestablishmentRequest.ue_Identity.shortMAC_I.buf[i]); } @@ -1959,7 +1952,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" NR_RRCReestablishmentRequest c_RNTI range error, fallback to RRC establishment\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, CC_id); + rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0); break; } @@ -1971,7 +1964,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" NR_RRCReestablishmentRequest without UE context, fallback to RRC establishment\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, CC_id); + rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0); break; } #if(0) @@ -1982,14 +1975,14 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" NR_RRCReestablishmentRequest without UE_id(MAC) rnti %x, fallback to RRC establishment\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); - rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, CC_id); + rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0); break; } //previous rnti rnti_t previous_rnti = 0; - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][1] == c_rnti) { previous_rnti = reestablish_rnti_map[i][0]; break; @@ -2003,7 +1996,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRCReestablishmentRequest without UE_id(MAC) previous rnti %x, fallback to RRC establishment\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),previous_rnti); - rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, CC_id); + rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(ctxt_pP, 0); break; } } @@ -2057,7 +2050,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, ue_context_p->ue_context.reestablishment_xid = -1; // insert C-RNTI to map - for (i = 0; i < MAX_MOBILES_PER_ENB; i++) { + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (reestablish_rnti_map[i][0] == 0) { reestablish_rnti_map[i][0] = ctxt_pP->rnti; reestablish_rnti_map[i][1] = c_rnti; @@ -2073,7 +2066,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, rrcReestablishmentRequest.ue_Identity.physCellId, ue_context_p->ue_context.reestablishment_cause); - ue_context_p->ue_context.primaryCC_id = CC_id; + ue_context_p->ue_context.primaryCC_id = 0; //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; Idx = DCCH; // SRB1 @@ -2095,7 +2088,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - rrc_gNB_generate_RRCReestablishment(ctxt_pP, ue_context_p, CC_id); + rrc_gNB_generate_RRCReestablishment(ctxt_pP, ue_context_p, 0); LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -2725,6 +2718,38 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { }//for (int i=0;i<f1_setup_req->num_cells_available;i++) } +void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t *ul_rrc) +{ + // first get RRC instance (note, no the ITTI instance) + module_id_t i = 0; + for (i=0; i < RC.nb_nr_inst; i++) { + gNB_RRC_INST *rrc = RC.nrrrc[i]; + if (rrc->nr_cellid == ul_rrc->nr_cellid) + break; + } + //AssertFatal(i != RC.nb_nr_inst, "Cell_id not found\n"); + // TODO REMOVE_DU_RRC in monolithic mode, the MAC does not have the + // nr_cellid. Thus, the above check would fail. For the time being, just put + // a warning, as we handle one DU only anyway + if (i == RC.nb_nr_inst) { + i = 0; + LOG_W(RRC, "initial UL RRC message nr_cellid %ld does not match RRC's %ld\n", ul_rrc->nr_cellid, RC.nrrrc[0]->nr_cellid); + } + protocol_ctxt_t ctxt = { 0 }; + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, i, GNB_FLAG_YES, ul_rrc->crnti, 0, 0); + + nr_rrc_gNB_decode_ccch(&ctxt, + ul_rrc->rrc_container, + ul_rrc->rrc_container_length, + ul_rrc->du2cu_rrc_container, + ul_rrc->du2cu_rrc_container_length); + + if (ul_rrc->rrc_container) + free(ul_rrc->rrc_container); + if (ul_rrc->du2cu_rrc_container) + free(ul_rrc->du2cu_rrc_container); +} + void rrc_gNB_process_release_request(const module_id_t gnb_mod_idP, x2ap_ENDC_sgnb_release_request_t *m) { gNB_RRC_INST *rrc = RC.nrrrc[gnb_mod_idP]; @@ -3388,49 +3413,11 @@ void *rrc_gnb_task(void *args_p) { nr_rrc_subframe_process(&RRC_SUBFRAME_PROCESS(msg_p).ctxt, RRC_SUBFRAME_PROCESS(msg_p).CC_id); break; - /* Messages from MAC */ - case NR_RRC_MAC_CCCH_DATA_IND: - { - instance_t i; - for (i=0; i<RC.nb_nr_inst; i++) { - // first get RRC instance (note, no the ITTI instance) - gNB_RRC_INST *rrc = RC.nrrrc[i]; - - if (rrc->nr_cellid == NR_RRC_MAC_CCCH_DATA_IND(msg_p).nr_cellid) - break; - } - AssertFatal(i!=RC.nb_nr_inst, "Cell_id not found\n"); - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - i, - GNB_FLAG_YES, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - ctxt.rnti, - i, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, - &ctxt, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - - if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { - LOG_I(NR_RRC, "CCCH message has size %d > %d\n", - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); - break; - } - - nr_rrc_gNB_decode_ccch(&ctxt, - (uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); - - if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) { - free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf); - free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container); - } - } - break; + case F1AP_INITIAL_UL_RRC_MESSAGE: + AssertFatal(NODE_IS_CU(RC.nrrrc[instance]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[instance]->node_type), + "should not receive F1AP_INITIAL_UL_RRC_MESSAGE, need call by CU!\n"); + rrc_gNB_process_initial_ul_rrc_message(&F1AP_INITIAL_UL_RRC_MESSAGE(msg_p)); + break; /* Messages from PDCP */ case NR_RRC_DCCH_DATA_IND: