diff --git a/common/ngran_types.h b/common/ngran_types.h index 1fe48e372b987ca3d95c86047e89cfa2dc16fe6f..224a85def5c704f03f873e139f3a1a4de05123f0 100644 --- a/common/ngran_types.h +++ b/common/ngran_types.h @@ -44,4 +44,8 @@ typedef enum { ngran_gNB_DU = 7 } ngran_node_t; +#define NODE_IS_MONOLITHIC(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB || (nOdE_TyPe) == ngran_ng_eNB || (nOdE_TyPe) == ngran_gNB) +#define NODE_IS_CU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_CU || (nOdE_TyPe) == ngran_ng_eNB_CU || (nOdE_TyPe) == ngran_gNB_CU) +#define NODE_IS_DU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_DU || (nOdE_TyPe) == ngran_gNB_DU) + #endif diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index f2e7aeec30da34f9c58f1c91c47a0b1bdef506fb..0580f0eb52cffe0fffd2cecab1234059b76cfdae 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -69,7 +69,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { - if (node_type == ngran_eNB_DU) { // F1AP registration + if (NODE_IS_DU(node_type)) { // F1AP registration // configure F1AP here for F1C LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); @@ -143,7 +143,7 @@ void *eNB_app_task(void *args_p) { } /* Try to register each eNB with each other */ - if (is_x2ap_enabled() && RC.rrc[0]->node_type == ngran_eNB) { // CU or DU do not need + if (is_x2ap_enabled() && !NODE_IS_DU(RC.rrc[0]->node_type)) { x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end); } @@ -167,7 +167,7 @@ void *eNB_app_task(void *args_p) { break; case S1AP_REGISTER_ENB_CNF: - AssertFatal(RC.rrc[0]->node_type != ngran_eNB_DU, "Should not have received S1AP_REGISTER_ENB_CNF\n"); + AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); if (EPC_MODE_ENABLED) { LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); @@ -206,7 +206,7 @@ void *eNB_app_task(void *args_p) { break; case F1AP_SETUP_RESP: - AssertFatal(RC.rrc[0]->node_type == ngran_eNB_DU, "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); + AssertFatal(NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received F1AP_REGISTER_ENB_CNF in CU/eNB\n"); LOG_I(ENB_APP, "Received %s: associated ngran_eNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index db688a79653d52e075a9e236c1e3412bb8963575..189cf01e0e878b487792a09f83d0fbe2460ca864 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -441,7 +441,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { //printf("Component carrier %d\n",component_carrier); nb_cc++; - if (rrc->node_type != ngran_eNB_CU && rrc->node_type != ngran_ng_eNB_CU && rrc->node_type != ngran_gNB_CU) { + if (!NODE_IS_CU(rrc->node_type)) { // Cell params, MIB/SIB1 in DU RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = ccparams_lte.tdd_config; AssertFatal (ccparams_lte.tdd_config <= LTE_TDD_Config__subframeAssignment_sa6, @@ -533,7 +533,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = ccparams_lte.nb_antenna_ports; } - if (rrc->node_type != ngran_eNB_DU) {//this is CU or eNB, SIB2-20 in CU + if (!NODE_IS_DU(rrc->node_type)) { //this is CU or eNB, SIB2-20 in CU // Radio Resource Configuration (SIB2) RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].prach_root = ccparams_lte.prach_root; @@ -1295,10 +1295,10 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { if (SLconfig.sidelink_configured==1) fill_SL_configuration(msg_p,&SLconfig,i,j,RC.config_file_name); else printf("No SL configuration skipping it\n"); - } // node_type!=ngran_eNB_DU + } // !NODE_IS_DU(node_type) } - if (rrc->node_type == ngran_eNB || rrc->node_type == ngran_eNB_CU || rrc->node_type == ngran_ng_eNB_CU || rrc->node_type == ngran_gNB_CU) { + if (!NODE_IS_DU(rrc->node_type)) { char srb1path[MAX_OPTNAME_SIZE*2 + 8]; sprintf(srb1path,"%s.%s",enbpath,ENB_CONFIG_STRING_SRB1); config_get( SRB1Params,sizeof(SRB1Params)/sizeof(paramdef_t), srb1path); @@ -2618,6 +2618,6 @@ void read_config_and_init(void) RCconfig_RRC(enb_id, RC.rrc[enb_id],macrlc_has_f1[enb_id]); } - if (RC.rrc[0]->node_type != ngran_eNB_DU) + if (!NODE_IS_DU(RC.rrc[0]->node_type)) pdcp_layer_init(); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 23ffb7a236f4f52337c1727ce1885a9f11bd17aa..ab2856c40ce8c8d993c9fed51bbef4bea47ac980 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -404,8 +404,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, // check threshold if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) { // note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311) - if (RC.rrc[module_idP]->node_type == ngran_eNB_DU - || RC.rrc[module_idP]->node_type == ngran_gNB_DU) { + if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 79b4a02865ea8b0c1dfb7d407b9a5adcbc74e8a2..b72f26780c57941eb1f5e5e73e35ae733198f312 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -191,9 +191,7 @@ boolean_t pdcp_data_req( LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP); } #ifndef UETARGET - 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) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { /* currently, there is no support to send also the source/destinationL2Id */ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); @@ -374,9 +372,7 @@ boolean_t pdcp_data_req( LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n", rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type); - 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) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { /* currently, there is no support to send also the source/destinationL2Id */ proto_agent_send_rlc_data_req(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP, confirmP, pdcp_pdu_size, pdcp_pdu_p); @@ -386,8 +382,7 @@ boolean_t pdcp_data_req( LOG_D(PDCP, "proto_agent_send_rlc_data_req for UE RNTI %x, rb %d, pdu size %d \n", ctxt_pP->rnti, rb_idP, pdcp_pdu_size); - } else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_DU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_gNB_DU){ + } else if (NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)){ LOG_E(PDCP, "Can't be DU, bad node type %d \n", RC.rrc[ctxt_pP->module_id]->node_type); ret=FALSE; } else @@ -429,9 +424,7 @@ boolean_t pdcp_data_req( { #ifndef UETARGET - 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) ) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { // DL transfer MessageDef *message_p; // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d30f0fe27cf1fd5bc1af9d4b9e5e47b32f1861e9..96803652e806aa1dc58114e65bbd2038d6f325d5 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -611,7 +611,7 @@ void rlc_data_ind ( AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, "Can't be CU, bad node type %d\n", type); - if (type == ngran_eNB_DU || type == ngran_gNB_DU) { + if (NODE_IS_DU(type)) { if (srb_flagP == 1) { MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); F1AP_UL_RRC_MESSAGE(msg).rnti = ctxt_pP->rnti; diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 295847542a619f12dfcfaa0d620519f57a99874e..7bfeb43b53d333249b812a88f6ea4801423a34e2 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -244,7 +244,7 @@ mac_rrc_data_ind( { - if ( RC.rrc[module_idP]->node_type == ngran_eNB_DU) { + if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) { 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); diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index 8f7909a37520dfa44bbba75438b83b417498a3f2..c313ddc86beb1ef78542c0147a6aade36143ef7e 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -111,7 +111,7 @@ 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 (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) + if (NODE_IS_CU(RC.rrc[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/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 500faa158a90589fed4976d23fea8b590619e94a..f330399901b4c604e56bde68928fd92a6f4a6d13 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -154,8 +154,7 @@ init_SI( PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); LOG_I(RRC,"[eNB %d] Node type %d \n ", ctxt_pP->module_id, rrc->node_type); - if ((rrc->node_type == ngran_eNB_DU) || - (rrc->node_type == ngran_eNB) ) { + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { // copy basic Cell parameters carrier->physCellId = configuration->Nid_cell[CC_id]; carrier->p_eNB = configuration->nb_antenna_ports[CC_id]; @@ -208,11 +207,7 @@ init_SI( #endif } - if (rrc->node_type != ngran_eNB_DU) { - - /*if ((rrc->node_type == ngran_eNB_CU) || - (rrc->node_type == ngran_ng_eNB_CU) || - (rrc->node_type == ngran_eNB)) { */ + if (!NODE_IS_DU(rrc->node_type)) { carrier->SIB23 = (uint8_t*) malloc16(64); AssertFatal(carrier->SIB23!=NULL,"cannot allocate memory for SIB"); carrier->sizeof_SIB23 = do_SIB23(ctxt_pP->module_id, @@ -376,7 +371,7 @@ init_SI( #if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0)) // LTE-M stuff here (take out CU-DU for now) - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { if ((carrier->mib.message.schedulingInfoSIB1_BR_r13>0) && (carrier->sib1_BR!=NULL)) { AssertFatal(carrier->sib1_BR->nonCriticalExtension!=NULL, @@ -457,7 +452,7 @@ init_SI( } else */ - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { LOG_D(RRC, "About to call rrc_mac_config_req_eNB for ngran_eNB\n"); rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, @@ -560,7 +555,7 @@ init_MCCH( // call mac_config_req with appropriate structure from ASN.1 description // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); - if (rrc->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(rrc->node_type)) { rrc_mac_config_req_eNB(enb_mod_idP, CC_id, 0,0,0,0,0, #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) @@ -623,9 +618,7 @@ static void init_MBMS( , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) ,NULL); - if ((RC.rrc[enb_mod_idP]->node_type != ngran_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_ng_eNB_CU) || - (RC.rrc[enb_mod_idP]->node_type != ngran_gNB_CU) ) { + if (!NODE_IS_CU(RC.rrc[enb_mod_idP]->node_type)) { rrc_rlc_config_asn1_req(&ctxt, NULL, // LTE_SRB_ToAddModList NULL, // LTE_DRB_ToAddModList @@ -927,9 +920,7 @@ rrc_eNB_free_UE( } if(EPC_MODE_ENABLED) { - if (RC.rrc[enb_mod_idP]->node_type == ngran_eNB - || RC.rrc[enb_mod_idP]->node_type == ngran_eNB_CU - || RC.rrc[enb_mod_idP]->node_type == ngran_gNB_CU) { + if (!NODE_IS_DU(RC.rrc[enb_mod_idP]->node_type)) { if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) { LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n", enb_mod_idP, @@ -1085,14 +1076,12 @@ void release_UE_in_freeList(module_id_t mod_id) { } } - if (RC.rrc[mod_id]->node_type != ngran_eNB_CU - && RC.rrc[mod_id]->node_type != ngran_ng_eNB_CU - && RC.rrc[mod_id]->node_type != ngran_gNB_CU) { + if (!NODE_IS_CU(RC.rrc[mod_id]->node_type)) { rrc_mac_remove_ue(mod_id,rnti); rrc_rlc_remove_ue(&ctxt); pdcp_remove_UE(&ctxt); } - else if (RC.rrc[mod_id]->node_type == ngran_eNB_CU || RC.rrc[mod_id]->node_type == ngran_ng_eNB_CU) { + else { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -1187,8 +1176,7 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) && - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { + if (!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); rrc_data_req(ctxt_pP, @@ -1338,7 +1326,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -1391,9 +1379,7 @@ rrc_eNB_generate_RRCConnectionReestablishment( PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_p->Srb0.Tx_buffer.payload_size); - 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)) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1){ // activate release timer, if RRCComplete not received after 100 frames, remove UE @@ -1996,9 +1982,7 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( ) //----------------------------------------------------------------------------- { - 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) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id != -1) { @@ -2103,8 +2087,7 @@ rrc_eNB_generate_RRCConnectionRelease( } pthread_mutex_unlock(&rrc_release_freelist); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU - || RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -5567,7 +5550,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; } - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -5610,9 +5593,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - 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) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO, MBMS_FLAG_NO, @@ -5626,7 +5607,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB) { + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_config_req_eNB(ctxt_pP->module_id, ue_context_pP->ue_context.primaryCC_id, 0,0,0,0,0, @@ -5990,7 +5971,7 @@ char openair_rrc_eNB_configuration( LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc); */ - if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) + if (NODE_IS_CU(RC.rrc[ctxt.module_id]->node_type)) // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ); // RCconfig_CU_F1(msg_p, enb_id); setup_ngran_CU(RC.rrc[ctxt.module_id]); @@ -6230,9 +6211,7 @@ rrc_eNB_decode_ccch( NULL , (LTE_PMCH_InfoList_r9_t *) NULL ,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) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -6313,9 +6292,7 @@ rrc_eNB_decode_ccch( if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - 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) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } else { @@ -6419,10 +6396,9 @@ rrc_eNB_decode_ccch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), random_value); - if (RC.rrc[ctxt_pP->module_id] == ngran_eNB) + if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); - else if (RC.rrc[ctxt_pP->module_id]->node_type == ngran_eNB_CU || - RC.rrc[ctxt_pP->module_id]->node_type == ngran_ng_eNB_CU) { + else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; @@ -6484,9 +6460,7 @@ rrc_eNB_decode_ccch( #endif ,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) ) { + if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, (LTE_DRB_ToAddModList_t *) NULL, @@ -6654,9 +6628,7 @@ rrc_eNB_decode_dcch( break; } - AssertFatal(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, + AssertFatal(!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type), "CU cannot decode DCCH: no access to RC.mac[]\n"); if(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag == 1) { @@ -6906,7 +6878,7 @@ rrc_eNB_decode_dcch( if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. present == LTE_RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU && RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU, + AssertFatal(!NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type), "should not be reached in DU\n"); rrc_eNB_process_RRCConnectionSetupComplete( ctxt_pP, @@ -7436,7 +7408,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); - if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) + if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) rrc_eNB_generate_RRCConnectionRelease(ctxt_pP, ue_context_p); else ue_to_be_removed = ue_context_p; @@ -7489,7 +7461,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) ue_context_p->ue_context.ue_release_timer_rrc = 1; ue_context_p->ue_context.ue_release_timer_thres_rrc = 100; - if (EPC_MODE_ENABLED && RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) { + if (EPC_MODE_ENABLED && !NODE_IS_DU(RC.rrc[ctxt_pP->module_id]->node_type)) { if (rrc_release_info.RRC_release_ctrl[release_num].flag == 4) { // if timer_s1 == 0 rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(ctxt_pP->module_id, ue_context_p->ue_context.eNB_ue_s1ap_id); @@ -7512,7 +7484,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) if (rrc_ue_s1ap_ids != NULL) { rrc_eNB_S1AP_remove_ue_ids(RC.rrc[ctxt_pP->module_id], rrc_ue_s1ap_ids); } - } /* EPC_MODE_ENABLED && node_type != ngran_eNB_DU */ + } /* EPC_MODE_ENABLED && !NODE_IS_DU */ rrc_release_info.RRC_release_ctrl[release_num].flag = 0; rrc_release_info.num_UEs--; @@ -7851,7 +7823,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { /* Messages from F1AP task */ case F1AP_SETUP_REQ: - AssertFatal(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU, + AssertFatal(NODE_IS_CU(RC.rrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 1e06eba0ac5eb32f929becf7a8e61616c14d8016..cfc2bc22155235a41d439581d71d795450e53310 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -64,39 +64,29 @@ int create_tasks(uint32_t enb_nb) { } - switch (type) { - case ngran_eNB_CU: - case ngran_ng_eNB_CU: - case ngran_gNB_CU: + if (EPC_MODE_ENABLED && !NODE_IS_DU(type)) { + rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for S1AP failed\n"); + if (!(get_softmodem_params()->emulate_rf)){ + rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for UDP failed\n"); + } + rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); + if (is_x2ap_enabled()) { + rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); + AssertFatal(rc >= 0, "Create task for X2AP failed\n"); + } else { + LOG_I(X2AP, "X2AP is disabled.\n"); + } + } + + if (NODE_IS_CU(type)) { rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL); AssertFatal(rc >= 0, "Create task for CU F1AP failed\n"); - /* fall through */ - case ngran_eNB: - case ngran_ng_eNB: - case ngran_gNB: - if (EPC_MODE_ENABLED) { - rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for S1AP failed\n"); - if (!(get_softmodem_params()->emulate_rf)){ - rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for UDP failed\n"); - } - rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); - AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); - if (is_x2ap_enabled()) { - rc = itti_create_task(TASK_X2AP, x2ap_task, NULL); - AssertFatal(rc >= 0, "Create task for X2AP failed\n"); - } else { - LOG_I(X2AP, "X2AP is disabled.\n"); - } - } - break; - default: - /* intentionally left blank */ - break; } - if (type == ngran_eNB_DU || type == ngran_gNB_DU) { + if (NODE_IS_DU(type)) { rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 966b3638223a3273fa4a028a00ab4bf5fcdeb22c..aa8d832ed3e97f97e51c2e8bc89a0d51c359b030 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -688,8 +688,7 @@ int main( int argc, char **argv ) { RCconfig_L1(); } - if (RC.nb_inst > 0 - && (RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst > 0 && NODE_IS_CU(RC.rrc[0]->node_type)) { protocol_ctxt_t ctxt; ctxt.module_id = 0 ; ctxt.instance = 0; @@ -699,8 +698,7 @@ int main( int argc, char **argv ) { } /* start threads if only L1 or not a CU */ - if (RC.nb_inst == 0 || - !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) { // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*MAX_MOBILES_PER_ENB*MAX_NUM_CCs); @@ -851,8 +849,7 @@ int main( int argc, char **argv ) { // stop threads - if (RC.nb_inst == 0 || - !(RC.rrc[0]->node_type == ngran_eNB_CU || RC.rrc[0]->node_type == ngran_ng_eNB_CU)) { + if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) { int UE_id; #ifdef XFORMS printf("waiting for XFORMS thread\n");