diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 2bb2600572e1f547302fb47f3251bec581e03770..e81851c27341a20f0ebec1fae6b6e53f40b252e3 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -133,7 +133,7 @@ task_list_t tasks[TASK_MAX]; LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s ); if ( s > 50 ) - LOG_I(TMR,"Queue for %s task size: %ld from %s task\n",itti_get_task_name(destination_task_id), s+1, itti_get_task_name(message->ittiMsgHeader.originTaskId)); + LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1); t->message_queue.insert(t->message_queue.begin(), message); eventfd_t sem_counter = 1; diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fd40900d948c9d25572b8c97d13b7cc3ec60a026..8dbe82f6214efc37a298c8fdd604cb8c291bcbe6 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -816,7 +816,7 @@ static void wait_nfapi_init(char *thread_name) { void init_pdcp(void) { if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) { // pdcp_layer_init(); - pdcp_layer_init_for_CU(); + // pdcp_layer_init_for_CU(); uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ? (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT; if (IS_SOFTMODEM_NOS1) { diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 37fe8a079f922fd19308d1bb793308ef6301c8aa..251613a1d927a6137e9c6cc05a171b18788b1a06 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -116,13 +116,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { + message_p = itti_alloc_new_message (TASK_CU_F1, 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, 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, @@ -376,20 +377,20 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, NR_RRC_DCCH_DATA_IND); +// message_p = itti_alloc_new_message (TASK_CU_F1, NR_RRC_DCCH_DATA_IND); - NR_RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); +// NR_RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); - NR_RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; - memcpy(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, - ie->value.choice.RRCContainer.size); +// NR_RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; +// memcpy(NR_RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, +// ie->value.choice.RRCContainer.size); - NR_RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; - NR_RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); - NR_RRC_DCCH_DATA_IND (message_p).module_id = instance; - NR_RRC_DCCH_DATA_IND (message_p).gNB_index = instance; // not needed for CU +// NR_RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id; +// NR_RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); +// NR_RRC_DCCH_DATA_IND (message_p).module_id = instance; +// NR_RRC_DCCH_DATA_IND (message_p).gNB_index = instance; // not needed for CU - itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); +// itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); /* @@ -408,12 +409,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); */ -#if(0) protocol_ctxt_t ctxt; ctxt.module_id = instance; ctxt.instance = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id); ctxt.enb_flag = 1; + ctxt.eNB_index = 0; + ctxt.configured = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); @@ -429,6 +431,5 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, srb_id, ie->value.choice.RRCContainer.size, mb); -#endif return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index e8395202e831b27fcd09ad09594d5b4ec42f6a18..26165217e6d7d3b62d3047adf538283b83ff5897 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -67,13 +67,25 @@ extern f1ap_setup_req_t *f1ap_du_data; extern RAN_CONTEXT_t RC; extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; +uint8_t du_ccch_flag = 1; +int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { + + if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n"); + DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu); + return 0; + } + LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); F1AP_DLRRCMessageTransfer_t *container; @@ -981,8 +993,30 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header msg->rrc_container_length, 0, 0); - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); + /* for rfsim, because UE send RRCSetupRequest in SRB1 */ + // NR_UL_CCCH_Message_t *ul_ccch_msg; + // dec_rval = uper_decode(NULL, + // &asn_DEF_NR_UL_CCCH_Message, + // (void**)&ul_ccch_msg, + // &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + // msg->rrc_container_length, 0, 0); + // if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + // LOG_E(F1AP, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed); + // } else { + // LOG_I(F1AP, "decode UL-CCCH success \n"); + // LOG_I(F1AP, "Received message: present %d and c1 present %d\n", + // ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present); + + // if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { + // if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) { + // LOG_I(F1AP, "[MSG] RRC Setup Request\n"); + + // } + // } + // } + } else LOG_I(F1AP, "Received message: present %d and c1 present %d\n", ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1->present); @@ -1209,14 +1243,31 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, RC.nrrrc[ctxt.module_id], ctxt.rnti); - if (srb_id == 0) { - NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; - asn_dec_rval_t dec_rval; + NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; + asn_dec_rval_t dec_rval; + if (du_ccch_flag) { + /* for rfsim */ dec_rval = uper_decode(NULL, - &asn_DEF_NR_DL_CCCH_Message, - (void**)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); + &asn_DEF_NR_DL_CCCH_Message, + (void**)&dl_ccch_msg, + &ie->value.choice.RRCContainer.buf[2], + rrc_dl_sdu_len-6,0,0); + if (dec_rval.code == RC_OK) { + srb_id = 0; + du_ccch_flag = 0; + } else { + srb_id = 1; + } + } + + if (srb_id == 0) { + // NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; + // asn_dec_rval_t dec_rval; + // dec_rval = uper_decode(NULL, + // &asn_DEF_NR_DL_CCCH_Message, + // (void**)&dl_ccch_msg, + // ie->value.choice.RRCContainer.buf, + // rrc_dl_sdu_len,0,0); AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); switch (dl_ccch_msg->message.choice.c1->present) { @@ -1298,6 +1349,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, "Unknown message\n"); break; }// switch case + + /* for rfsim */ + mem_block_t *memblock; + memblock = get_free_mem_block(rrc_dl_sdu_len, __FUNCTION__); + memcpy(memblock->data, ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, memblock); return(0); } else if (srb_id == 1) { diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 1406e48f3d3a76320a2d4ca99b7fc1b5cbdd6bd6..f1e24e77df8eab195dc905802eea5213814f65a5 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -42,6 +42,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_F1AP_PDU_t *pdu); int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); +int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, int CC_idP, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 80d761d73b8a25aeb63bc8f3c726cb5c3664d29b..75271b2ebab5b2e9dc71b29b885fd56801081aa7 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -177,8 +177,13 @@ void *F1AP_DU_task(void *arg) { case F1AP_UL_RRC_MESSAGE: // to rrc LOG_I(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)); + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { + DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + } else { + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &F1AP_UL_RRC_MESSAGE(received_msg)); + } break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index a2f7518a6590f2bd8e2efab14dba720bb8da1043..96bdd2ed58e9b2ba951c85b8e66b705ac5db70c4 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1543,10 +1543,14 @@ void nr_read_config_and_init(void) { RC.nrrrc[0]->carrier.MIB = (uint8_t *) malloc16(4); RC.nrrrc[0]->carrier.sizeof_MIB = do_MIB_NR(RC.nrrrc[0], 0); RC.nrrrc[0]->carrier.sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[0]->carrier, &RC.nrrrc[0]->configuration); + + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[0]); + LOG_I(GNB_APP, "Adding new user (%p)\n",ue_context_p); + rrc_add_nsa_user(RC.nrrrc[0], ue_context_p,NULL); } if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - pdcp_layer_init(); + pdcp_layer_init_for_CU(); nr_DRB_preconfiguration(0x1234); rrc_init_nr_global_param(); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index ed164528c28bd66c613e025be40b0d444cd93c38..0d80aa7d876c17cc2a6d6f3bc0d60b1812568df3 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -241,6 +241,26 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, if (pthread_mutex_unlock(&q.m) != 0) abort(); } +void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP) +{ + enqueue_rlc_data_req(ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, muiP, + confirmP, + sdu_sizeP, + sdu_pP, + NULL, + NULL); +} + /****************************************************************************/ /* rlc_data_req queue - end */ /****************************************************************************/ @@ -600,18 +620,18 @@ static void deliver_sdu_srb(protocol_ctxt_t *ctxt_pP, void *_ue, nr_pdcp_entity_ uint8_t *gtpu_buffer_p; int srb_id; int i; - - if (ccch_or_dcch == 0) - { - nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf); - ccch_or_dcch = 1; - } - else - { + + if (NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) { nr_rrc_data_ind( ctxt_pP, 1, size, buf); + } else { + if (ccch_or_dcch == 0) { + nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf); + ccch_or_dcch = 1; + } else { + nr_rrc_data_ind( ctxt_pP, 1, size, buf); + } } - - + return; } @@ -655,7 +675,22 @@ rb_found: printf("!!!!!!! deliver_pdu_srb (srb %d) calling rlc_data_req size %d: ", srb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); printf("\n"); - enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buf; + F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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).rnti = ue->rnti; + F1AP_DL_RRC_MESSAGE (message_p).srb_id = srb_id; + 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_CU_F1, ctxt.module_id, message_p); + } else { + enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); + } } boolean_t pdcp_data_ind( @@ -726,6 +761,7 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) break; switch (ITTI_MSG_ID(msg_p)) { case RRC_DCCH_DATA_REQ: + LOG_I(PDCP, "Received message %s\n", ITTI_MSG_NAME(msg_p)); PROTOCOL_CTXT_SET_BY_MODULE_ID( &ctxt, RRC_DCCH_DATA_REQ(msg_p).module_id, @@ -766,7 +802,7 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) printf("\n\n################# rnti %d add srb %d\n\n\n", rnti, srb_id); if (srb_id > 3) { - LOG_E(PDCP, "%s:%d:%s: fatal, bad drb id %d\n", + LOG_E(PDCP, "%s:%d:%s: fatal, bad srb id %d\n", __FILE__, __LINE__, __FUNCTION__, srb_id); exit(1); } @@ -774,13 +810,13 @@ static void add_srb(int rnti, struct NR_SRB_ToAddMod *s) nr_pdcp_manager_lock(nr_pdcp_ue_manager); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); if (ue->srb[srb_id-1] != NULL) { - LOG_W(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", + LOG_W(PDCP, "%s:%d:%s: warning SRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } else { pdcp_srb = new_nr_pdcp_entity_srb(srb_id, deliver_sdu_srb, ue, deliver_pdu_srb, ue); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); - LOG_I(PDCP, "%s:%d:%s: added drb %d to ue %d\n", + LOG_I(PDCP, "%s:%d:%s: added srb %d to ue %d\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); @@ -1112,7 +1148,7 @@ static boolean_t pdcp_data_req_srb( nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, 0x1234); if (rb_id < 1 || rb_id > 3) rb = NULL; @@ -1165,7 +1201,7 @@ static boolean_t pdcp_data_req_drb( rb = ue->drb[rb_id - 1]; if (rb == NULL) { - LOG_E(PDCP, "%s:%d:%s: no DRB found (rnti %d, rb_id %ld)\n", + LOG_E(PDCP, "%s:%d:%s: no SRB found (rnti %d, rb_id %ld)\n", __FILE__, __LINE__, __FUNCTION__, rnti, rb_id); return 0; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 02ff2672710c1b4f19635e31587d5c6e89ac15fb..a0cc5400ab8b49e69917b2a53d3444f5f31f25f4 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -36,11 +36,17 @@ #include "NR_CellGroupConfig.h" #include "NR_RLC-Config.h" #include "common/ran_context.h" +#include "NR_UL-CCCH-Message.h" + +#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace +#include "openair2/F1AP/f1ap_du_rrc_message_transfer.h" + extern RAN_CONTEXT_t RC; #include <stdint.h> static nr_rlc_ue_manager_t *nr_rlc_ue_manager; +uint8_t ccch_flag = 1; /* TODO: handle time a bit more properly */ static uint64_t nr_rlc_current_time; @@ -468,6 +474,33 @@ rb_found: "Can't be CU, bad node type %d\n", type); if (NODE_IS_DU(type) && is_srb == 1) { + if (ccch_flag) { + /* for rfsim, because UE send RRCSetupRequest in SRB1 */ + asn_dec_rval_t dec_rval; + NR_UL_CCCH_Message_t *ul_ccch_msg; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_UL_CCCH_Message, + (void**)&ul_ccch_msg, + &buf[1], // buf[0] includes the pdcp header + size, 0, 0); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RLC, " Failed to decode UL-CCCH (%zu bytes)\n",dec_rval.consumed); + } else { + LOG_I(RLC, "decode UL-CCCH success \n"); + LOG_I(RLC, "Received message: present %d and c1 present %d\n", + ul_ccch_msg->message.present, ul_ccch_msg->message.choice.c1->present); + + if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) { + if (ul_ccch_msg->message.choice.c1->present == NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest) { + LOG_I(RLC, "[MSG] RRC Setup Request\n"); + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,ue->rnti,(uint8_t *)buf,size); + ccch_flag = 0; + return; + } + } + } + } + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index fbb3c8073ee5a1def2daf48f4ccb88d9db66cf5d..b69f1f2c162a6d9b5da08691503ef5ffdfe4b277 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -108,8 +108,8 @@ nr_rrc_data_req( /* Hack: only trigger PDCP if in CU, otherwise it is triggered by RU threads * Ideally, PDCP would not neet to be triggered like this but react to ITTI * messages automatically */ - // if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) - // pdcp_run(ctxt_pP); + if (ctxt_pP->enb_flag && NODE_IS_CU(RC.nrrrc[ctxt_pP->module_id]->node_type)) + pdcp_run(ctxt_pP); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8d3cb7e399b1b696b56769e425df640e2973aa71..57e1d2905d224c032c7790e469a5a327341f12de 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -389,18 +389,25 @@ rrc_gNB_generate_RRCSetup( case ngran_gNB_CU: // create an ITTI message /* TODO: F1 IDs ar missing in RRC */ - message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload; - 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).rnti = ue_p->rnti; - 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_CU_F1, ctxt_pP->module_id, message_p); - LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + // message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); + // F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload; + // 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).rnti = ue_p->rnti; + // 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_CU_F1, ctxt_pP->module_id, message_p); + // LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + nr_rrc_data_req(ctxt_pP, + DCCH, + rrc_gNB_mui++, + SDU_CONFIRM_NO, + ue_p->Srb0.Tx_buffer.payload_size, + ue_p->Srb0.Tx_buffer.Payload, + PDCP_TRANSMISSION_MODE_CONTROL); break; case ngran_gNB_DU: @@ -767,18 +774,18 @@ rrc_gNB_generate_defaultRRCReconfiguration( case ngran_gNB_CU: // create an ITTI message // F1AP_DL_RRC_MESSAGE - message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; - F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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).rnti = ue_context_pP->ue_context.rnti; - F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; - 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_CU_F1, ctxt_pP->module_id, message_p); - LOG_I(NR_RRC, "send RRCReconfiguration to F1AP by F1AP_DL_RRC_MESSAGE \n"); + // message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); + // F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; + // F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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).rnti = ue_context_pP->ue_context.rnti; + // F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; + // 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_CU_F1, ctxt_pP->module_id, message_p); + // LOG_I(NR_RRC, "send RRCReconfiguration to F1AP by F1AP_DL_RRC_MESSAGE \n"); nr_rrc_data_req(ctxt_pP, DCCH, @@ -825,7 +832,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( ue_context_pP->ue_context.rnti, rrc_gNB_mui, size); -#if(0) nr_rrc_data_req(ctxt_pP, DCCH, rrc_gNB_mui++, @@ -834,7 +840,6 @@ rrc_gNB_generate_defaultRRCReconfiguration( buffer, PDCP_TRANSMISSION_MODE_CONTROL); // rrc_pdcp_config_asn1_req -#endif #endif // rrc_rlc_config_asn1_req } @@ -2773,7 +2778,6 @@ rrc_gNB_generate_SecurityModeCommand( GNB_RRC_DCCH_DATA_IND (message_p).size = size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else -#if(0) LOG_I(NR_RRC,"calling rrc_data_req :securityModeCommand\n"); nr_rrc_data_req(ctxt_pP, DCCH, @@ -2782,7 +2786,6 @@ rrc_gNB_generate_SecurityModeCommand( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); -#endif #endif break; @@ -2816,18 +2819,18 @@ rrc_gNB_generate_UECapabilityEnquiry( case ngran_gNB_CU: // create an ITTI message // F1AP_DL_RRC_MESSAGE - message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; - F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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).rnti = ue_context_pP->ue_context.rnti; - F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; - 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_CU_F1, ctxt_pP->module_id, message_p); - LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); + // message_p = itti_alloc_new_message (TASK_RRC_GNB, F1AP_DL_RRC_MESSAGE); + // F1AP_DL_RRC_MESSAGE (message_p).rrc_container = buffer; + // F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = 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).rnti = ue_context_pP->ue_context.rnti; + // F1AP_DL_RRC_MESSAGE (message_p).srb_id = DCCH; + // 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_CU_F1, ctxt_pP->module_id, message_p); + // LOG_D(NR_RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); nr_rrc_data_req( ctxt_pP, @@ -2872,7 +2875,6 @@ rrc_gNB_generate_UECapabilityEnquiry( GNB_RRC_DCCH_DATA_IND (message_p).size = size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); #else -#if(0) nr_rrc_data_req( ctxt_pP, DCCH, @@ -2881,7 +2883,6 @@ rrc_gNB_generate_UECapabilityEnquiry( size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); -#endif #endif break;