diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 41317f8bbcecd04071b29659a1b3be5be85cd764..cb30d21d88b8136925e6977be6b9d8d21a0b92f0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -435,7 +435,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } else { ra->cfra = false; - ra->rnti = rnti; + ra->rnti = 0; ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; ra->preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 92d9f65fef2bcaa093d84cab945e9898aaaa2f07..d3f8cf9693aae0a60e330f39da2c995900fbd1ac 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -575,8 +575,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, LOG_D(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); - // TODO: Configure RRC with the new RNTI of the following commented lines - /* int loop = 0; if (!ra->cfra) { do { @@ -590,7 +588,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, abort(); } } - */ ra->RA_rnti = ra_rnti; ra->preamble_index = preamble_index; @@ -1364,9 +1361,9 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram { if (harq->round == 0) { - ra->state = RA_IDLE; - UE_info->active[UE_id] = true; + nr_clear_ra_proc(module_id, CC_id, frame, ra); free(ra->preambles.preamble_list); + UE_info->active[UE_id] = true; LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. RA procedure succeeded!\n", UE_id, ra->rnti); } else @@ -1377,9 +1374,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram } -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ - - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[0]; +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){ LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); ra->state = RA_IDLE; ra->timing_offset = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 716d444f3ee8916ab5f1d556d079f8d527fc10e5..c22c97611f31d7d680623c819f53538f5876eb95 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -511,10 +511,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if(no_sig) { LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); - ra->state = RA_IDLE; - ra->timing_offset = 0; - ra->RRC_timer = 20; - ra->msg3_round = 0; + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } else { // random access pusch with TC-RNTI @@ -566,10 +563,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); - ra->state = RA_IDLE; - ra->timing_offset = 0; - ra->RRC_timer = 20; - ra->msg3_round = 0; + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 823e374cebdfd6000b47f0fedfec917a977e51f0..1fa27506a95700010ee9e74fa5746211ca47031d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -114,7 +114,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset); -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP); +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 60d3bdc07f99968643daa6c8d4d8e09bb8a09003..8d31bd29bce84ed332515895fc1eedcf694a050a 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1138,7 +1138,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse)); *rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master; - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + } /*Adding SRB RLC configuration to the corresponding list*/ NR_RLC_BearerConfig_t *RLC_SRB_BearerConfig = calloc(1,sizeof(*RLC_SRB_BearerConfig)); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8f5e73e89386418e36741c89e66510cd475bf045..807043b95e2a1a0459e75e074c17399260ebe6fc 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1633,6 +1633,9 @@ 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), CC_id); + + // FIXME: Check the best place to perform this DRB configuration + nr_DRB_preconfiguration(ctxt_pP->rnti); } break; diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index c45f5866332b2911e993429ed361b99e4bd5ec9d..2f16b9f8f90c2287507a21a345014eba5d865636 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -56,7 +56,29 @@ nr_mac_rrc_data_ind_ue( break; case NR_BCCH_DL_SCH: - AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n"); + if (pdu_len>0) { + LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET, + gNB_index); + + MessageDef *message_p; + int msg_sdu_size = BCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND); + memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; + itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); + } break; case CCCH: @@ -83,6 +105,8 @@ nr_mac_rrc_data_ind_ue( NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p); } + break; + default: break; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index c4676976d1ea1519194f5073346bba8db1b332f3..591d0743bc03a6cf4653c2d641093090ea49f8c5 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1366,9 +1366,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (uint8_t *)Srb_info->Rx_buffer.Payload, 100,0,0); - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); - // } + } if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); @@ -2392,7 +2392,6 @@ void *rrc_nrue_task( void *args_p ) { case NR_RRC_MAC_BCCH_DATA_IND: LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, @@ -2400,6 +2399,7 @@ void *rrc_nrue_task( void *args_p ) { NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); + break; case NR_RRC_MAC_CCCH_DATA_IND: LOG_I(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n",