From 6d0ae249bcf3d7d799bb8d24663ea01fe63891f1 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 4 Jul 2023 10:51:39 +0200 Subject: [PATCH 1/4] handling SIB other than SIB1 at UE RRC --- executables/nr-ue.c | 2 +- openair2/COMMON/rrc_messages_types.h | 1 + openair2/LAYER2/NR_MAC_UE/config_ue.c | 7 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 9 + openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 9 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 3 +- openair2/RRC/NR_UE/rrc_UE.c | 580 ++++-------------- openair2/RRC/NR_UE/rrc_defs.h | 19 +- openair2/RRC/NR_UE/rrc_proto.h | 4 +- openair2/RRC/NR_UE/rrc_timers_and_constants.c | 118 ++++ 12 files changed, 267 insertions(+), 488 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 1b56dfccdb..bbcb4c2714 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -938,7 +938,7 @@ void *UE_thread(void *arg) { timing_advance = UE->timing_advance; } - nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_tx, curMsg.proc.nr_slot_tx); + nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_tx, curMsg.proc.nr_slot_tx, curMsg.proc.gNB_id); // Start TX slot processing here. It runs in parallel with RX slot processing notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, &txFifo, processSlotTX); diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 87ad04a2dc..4914dd9068 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -467,6 +467,7 @@ typedef struct rrc_subframe_process_s { typedef struct nrrrc_slot_process_s { int frame; int slot; + int gnb_id; } NRRrcSlotProcess; // eNB: RLC -> RRC messages diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 395a69b0b3..d2ac527a00 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -701,7 +701,7 @@ void ue_init_config_request(NR_UE_MAC_INST_t *mac, int scs) void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, - bool sched_sib1) + int sched_sib) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); AssertFatal(mib, "MIB should not be NULL\n"); @@ -709,7 +709,10 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, mac->mib = mib; // update by every reception mac->phy_config.Mod_id = module_id; mac->phy_config.CC_id = cc_idP; - mac->get_sib1 = sched_sib1; + if (sched_sib == 1) + mac->get_sib1 = true; + else if (sched_sib == 2) + mac->get_otherSI = true; } void nr_rrc_mac_config_req_sib1(module_id_t module_id, diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 4eee1bb3fe..74bee1eca5 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -394,6 +394,7 @@ typedef struct { //// MAC config int first_sync_frame; bool get_sib1; + bool get_otherSI; NR_DRX_Config_t *drx_Config; NR_SchedulingRequestConfig_t *schedulingRequestConfig; NR_BSR_Config_t *bsr_Config; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 9eb332109e..12ab08e38f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -106,7 +106,7 @@ void nr_rrc_mac_config_req_mcg(module_id_t module_id, void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP, - bool sched_sib1); + int sched_sib1); void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 8b99818508..9f91a74889 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -369,6 +369,15 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl { const NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; const int slots_per_frame = nr_slots_per_frame[current_DL_BWP->scs]; + if (mac->get_otherSI) { + // If searchSpaceOtherSystemInformation is set to zero, + // PDCCH monitoring occasions for SI message reception in SI-window + // are same as PDCCH monitoring occasions for SIB1 + const NR_SearchSpace_t *ss = mac->otherSI_SS ? mac->otherSI_SS : mac->search_space_zero; + // TODO configure SI-window + if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss)) + config_dci_pdu(mac, dl_config, NR_RNTI_SI, slot, ss); + } if (mac->state == UE_PERFORMING_RA && mac->ra.ra_state >= WAIT_RAR) { // if RA is ongoing use RA search space diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index b1e0c17cc8..8f4f0ff3fe 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -165,6 +165,7 @@ void nr_ue_init_mac(module_id_t module_idP) nr_ue_mac_default_configs(mac); mac->first_sync_frame = -1; mac->get_sib1 = false; + mac->get_otherSI = false; mac->phy_config_request_sent = false; mac->state = UE_NOT_SYNC; } @@ -354,13 +355,17 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, - uint32_t pdu_len) { + uint32_t pdu_len) +{ + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); if(ack_nack) { LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); } else - LOG_E(NR_MAC, "Got NACK on NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); + LOG_E(NR_MAC, "Got NACK on NR-BCCH-DL-SCH-Message (%s)\n", mac->get_sib1 ? "SIB1" : "other SI"); + mac->get_sib1 = false; + mac->get_otherSI = false; return 0; } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 4f3becb8f5..8f4f988834 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1053,7 +1053,8 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, } // L2 Abstraction Layer -int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len){ +int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len) +{ return nr_ue_decode_BCCH_DL_SCH(module_id, cc_id, gNB_index, ack_nack, pduP, pdu_len); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 704ea605e4..cbab54b9ab 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -393,6 +393,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, } + NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_path) { if(NB_NR_UE_INST > 0) { @@ -406,14 +407,8 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file, char* rrc_config_ rrc->ubwpd = NULL; rrc->as_security_activated = false; - // TODO: Put the appropriate list of SIBs - rrc->requested_SI_List.buf = CALLOC(1,4); - rrc->requested_SI_List.buf[0] = SIB2 | SIB3 | SIB5; // SIB2 - SIB9 - rrc->requested_SI_List.buf[1] = 0; // SIB10 - SIB17 - rrc->requested_SI_List.buf[2] = 0; // SIB18 - SIB25 - rrc->requested_SI_List.buf[3] = 0; // SIB26 - SIB32 - rrc->requested_SI_List.size= 4; - rrc->requested_SI_List.bits_unused= 0; + for (int i = 0; i < NB_SIG_CNX_UE; i++) + memset((void *)&rrc->SInfo[i], 0, sizeof(rrc->SInfo[i])); rrc->ra_trigger = RA_NOT_RUNNING; } @@ -485,6 +480,28 @@ int8_t nr_ue_process_physical_cell_group_config(NR_PhysicalCellGroupConfig_t *ph return 0; } +int check_si_status(NR_UE_RRC_SI_INFO *SI_info) +{ + // schedule reception of SIB1 + if (!SI_info->sib1) + return 1; + else { + if (!SI_info->sib1->si_SchedulingInfo) + return 0; + // The UE in RRC_IDLE and RRC_INACTIVE shall ensure having + // a valid version of (at least) the MIB, SIB1 through + // SIB4 (and SIB5 if the UE supports E-UTRA) + if (!SI_info->sib2 || + !SI_info->sib3 || + !SI_info->sib4) + // we schedule reception of otherSI + // if UE RRC doesn't have any of the + // default SIBs for now + return 2; + } + return 0; +} + /*brief decode BCCH-BCH (MIB) message*/ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { @@ -506,234 +523,18 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u bcch_message->message.choice.mib = NULL; NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index]; - NR_SIB1_t *sib1 = SI_info->sib1; - // if no sib1 because not acquired yet or expired, get a new one - bool get_sib1 = sib1 == NULL; - nr_rrc_mac_config_req_mib(module_id, 0, NR_UE_rrc_inst[module_id].mib, get_sib1); + // to schedule MAC to get SI if required + int get_sib = check_si_status(SI_info); + nr_rrc_mac_config_req_mib(module_id, 0, NR_UE_rrc_inst[module_id].mib, get_sib); ret = 0; } ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message); - return ret; } -const char *nr_SIBreserved( long value ) { - if (value < 0 || value > 1) - return "ERR"; - - if (value) - return "notReserved"; - - return "reserved"; -} - -void nr_dump_sib2( NR_SIB2_t *sib2 ){ -//cellReselectionInfoCommon - //nrofSS_BlocksToAverage - if( sib2->cellReselectionInfoCommon.nrofSS_BlocksToAverage) - LOG_I( RRC, "cellReselectionInfoCommon.nrofSS_BlocksToAverage : %ld\n", - *sib2->cellReselectionInfoCommon.nrofSS_BlocksToAverage ); - else - LOG_I( RRC, "cellReselectionInfoCommon->nrofSS_BlocksToAverage : not defined\n" ); - - //absThreshSS_BlocksConsolidation - if( sib2->cellReselectionInfoCommon.absThreshSS_BlocksConsolidation){ - LOG_I( RRC, "absThreshSS_BlocksConsolidation.thresholdRSRP : %ld\n", - *sib2->cellReselectionInfoCommon.absThreshSS_BlocksConsolidation->thresholdRSRP ); - LOG_I( RRC, "absThreshSS_BlocksConsolidation.thresholdRSRQ : %ld\n", - *sib2->cellReselectionInfoCommon.absThreshSS_BlocksConsolidation->thresholdRSRQ ); - LOG_I( RRC, "absThreshSS_BlocksConsolidation.thresholdSINR : %ld\n", - *sib2->cellReselectionInfoCommon.absThreshSS_BlocksConsolidation->thresholdSINR ); - } else - LOG_I( RRC, "cellReselectionInfoCommon->absThreshSS_BlocksConsolidation : not defined\n" ); - - //q_Hyst - LOG_I( RRC, "cellReselectionInfoCommon.q_Hyst : %ld\n", - sib2->cellReselectionInfoCommon.q_Hyst ); - - //speedStateReselectionPars - if( sib2->cellReselectionInfoCommon.speedStateReselectionPars){ - LOG_I( RRC, "speedStateReselectionPars->mobilityStateParameters.t_Evaluation : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_Evaluation); - LOG_I( RRC, "speedStateReselectionPars->mobilityStateParameters.t_HystNormal : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.t_HystNormal); - LOG_I( RRC, "speedStateReselectionPars->mobilityStateParameters.n_CellChangeMedium : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeMedium); - LOG_I( RRC, "speedStateReselectionPars->mobilityStateParameters.n_CellChangeHigh : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->mobilityStateParameters.n_CellChangeHigh); - LOG_I( RRC, "speedStateReselectionPars->q_HystSF.sf_Medium : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_Medium); - LOG_I( RRC, "speedStateReselectionPars->q_HystSF.sf_High : %ld\n", - sib2->cellReselectionInfoCommon.speedStateReselectionPars->q_HystSF.sf_High); - } else - LOG_I( RRC, "cellReselectionInfoCommon->speedStateReselectionPars : not defined\n" ); - -//cellReselectionServingFreqInfo - if( sib2->cellReselectionServingFreqInfo.s_NonIntraSearchP) - LOG_I( RRC, "cellReselectionServingFreqInfo.s_NonIntraSearchP : %ld\n", - *sib2->cellReselectionServingFreqInfo.s_NonIntraSearchP ); - else - LOG_I( RRC, "cellReselectionServingFreqInfo->s_NonIntraSearchP : not defined\n" ); - - if( sib2->cellReselectionServingFreqInfo.s_NonIntraSearchQ) - LOG_I( RRC, "cellReselectionServingFreqInfo.s_NonIntraSearchQ : %ld\n", - *sib2->cellReselectionServingFreqInfo.s_NonIntraSearchQ ); - else - LOG_I( RRC, "cellReselectionServingFreqInfo->s_NonIntraSearchQ : not defined\n" ); - - LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLowP : %ld\n", - sib2->cellReselectionServingFreqInfo.threshServingLowP ); - - if( sib2->cellReselectionServingFreqInfo.threshServingLowQ) - LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLowQ : %ld\n", - *sib2->cellReselectionServingFreqInfo.threshServingLowQ ); - else - LOG_I( RRC, "cellReselectionServingFreqInfo->threshServingLowQ : not defined\n" ); - - LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionPriority : %ld\n", - sib2->cellReselectionServingFreqInfo.cellReselectionPriority ); - if( sib2->cellReselectionServingFreqInfo.cellReselectionSubPriority) - LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionSubPriority : %ld\n", - *sib2->cellReselectionServingFreqInfo.cellReselectionSubPriority ); - else - LOG_I( RRC, "cellReselectionServingFreqInfo->cellReselectionSubPriority : not defined\n" ); - -//intraFreqCellReselectionInfo - LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMin : %ld\n", - sib2->intraFreqCellReselectionInfo.q_RxLevMin ); - - if( sib2->intraFreqCellReselectionInfo.q_RxLevMinSUL) - LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMinSUL : %ld\n", - *sib2->intraFreqCellReselectionInfo.q_RxLevMinSUL ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->q_RxLevMinSUL : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.q_QualMin) - LOG_I( RRC, "intraFreqCellReselectionInfo.q_QualMin : %ld\n", - *sib2->intraFreqCellReselectionInfo.q_QualMin ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->q_QualMin : not defined\n" ); - - LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearchP : %ld\n", - sib2->intraFreqCellReselectionInfo.s_IntraSearchP ); - - if( sib2->intraFreqCellReselectionInfo.s_IntraSearchQ) - LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearchQ : %ld\n", - *sib2->intraFreqCellReselectionInfo.s_IntraSearchQ ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->s_IntraSearchQ : not defined\n" ); - - LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionNR : %ld\n", - sib2->intraFreqCellReselectionInfo.t_ReselectionNR ); - - if( sib2->intraFreqCellReselectionInfo.frequencyBandList) - LOG_I( RRC, "intraFreqCellReselectionInfo.frequencyBandList : %p\n", - sib2->intraFreqCellReselectionInfo.frequencyBandList ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->frequencyBandList : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.frequencyBandListSUL) - LOG_I( RRC, "intraFreqCellReselectionInfo.frequencyBandListSUL : %p\n", - sib2->intraFreqCellReselectionInfo.frequencyBandListSUL ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->frequencyBandListSUL : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.p_Max) - LOG_I( RRC, "intraFreqCellReselectionInfo.p_Max : %ld\n", - *sib2->intraFreqCellReselectionInfo.p_Max ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->p_Max : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.smtc) - LOG_I( RRC, "intraFreqCellReselectionInfo.smtc : %p\n", - sib2->intraFreqCellReselectionInfo.smtc ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->smtc : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.ss_RSSI_Measurement) - LOG_I( RRC, "intraFreqCellReselectionInfo.ss_RSSI_Measurement : %p\n", - sib2->intraFreqCellReselectionInfo.ss_RSSI_Measurement ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->ss_RSSI_Measurement : not defined\n" ); - - if( sib2->intraFreqCellReselectionInfo.ssb_ToMeasure) - LOG_I( RRC, "intraFreqCellReselectionInfo.ssb_ToMeasure : %p\n", - sib2->intraFreqCellReselectionInfo.ssb_ToMeasure ); - else - LOG_I( RRC, "intraFreqCellReselectionInfo->ssb_ToMeasure : not defined\n" ); - - LOG_I( RRC, "intraFreqCellReselectionInfo.deriveSSB_IndexFromCell : %d\n", - sib2->intraFreqCellReselectionInfo.deriveSSB_IndexFromCell ); - -} - -void nr_dump_sib3( NR_SIB3_t *sib3 ) { -//intraFreqNeighCellList - if( sib3->intraFreqNeighCellList){ - LOG_I( RRC, "intraFreqNeighCellList : %p\n", - sib3->intraFreqNeighCellList ); - const int n = sib3->intraFreqNeighCellList->list.count; - for (int i = 0; i < n; ++i){ - LOG_I( RRC, "intraFreqNeighCellList->physCellId : %ld\n", - sib3->intraFreqNeighCellList->list.array[i]->physCellId ); - LOG_I( RRC, "intraFreqNeighCellList->q_OffsetCell : %ld\n", - sib3->intraFreqNeighCellList->list.array[i]->q_OffsetCell ); - - if( sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCell) - LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCell : %ld\n", - *sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCell ); - else - LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCell : not defined\n" ); - - if( sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCellSUL) - LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCellSUL : %ld\n", - *sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCellSUL ); - else - LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCellSUL : not defined\n" ); - - if( sib3->intraFreqNeighCellList->list.array[i]->q_QualMinOffsetCell) - LOG_I( RRC, "intraFreqNeighCellList->q_QualMinOffsetCell : %ld\n", - *sib3->intraFreqNeighCellList->list.array[i]->q_QualMinOffsetCell ); - else - LOG_I( RRC, "intraFreqNeighCellList->q_QualMinOffsetCell : not defined\n" ); - } - } else{ - LOG_I( RRC, "intraFreqCellReselectionInfo : not defined\n" ); - } - -//intraFreqBlackCellList - if( sib3->intraFreqExcludedCellList){ - LOG_I( RRC, "intraFreqExcludedCellList : %p\n", - sib3->intraFreqExcludedCellList ); - const int n = sib3->intraFreqExcludedCellList->list.count; - for (int i = 0; i < n; ++i){ - LOG_I( RRC, "intraFreqExcludedCellList->start : %ld\n", - sib3->intraFreqExcludedCellList->list.array[i]->start ); - - if( sib3->intraFreqExcludedCellList->list.array[i]->range) - LOG_I( RRC, "intraFreqExcludedCellList->range : %ld\n", - *sib3->intraFreqExcludedCellList->list.array[i]->range ); - else - LOG_I( RRC, "intraFreqExcludedCellList->range : not defined\n" ); - } - } else{ - LOG_I( RRC, "intraFreqExcludedCellList : not defined\n" ); - } - -//lateNonCriticalExtension - if( sib3->lateNonCriticalExtension) - LOG_I( RRC, "lateNonCriticalExtension : %p\n", - sib3->lateNonCriticalExtension ); - else - LOG_I( RRC, "lateNonCriticalExtension : not defined\n" ); -} - -int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index) +int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, NR_SystemInformation_t *si) { NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[ctxt_pP->module_id].SInfo[gNB_index]; - NR_SystemInformation_t *si = SI_info->si; - int new_sib = 0; - NR_SIB1_t *sib1 = SI_info->sib1; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents @@ -752,239 +553,91 @@ int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index) switch(typeandinfo->present) { case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: - if ((SI_info->SIStatus & 2) == 0) { - SI_info->SIStatus |= 2; - //new_sib=1; - memcpy(SI_info->sib2, &typeandinfo->choice.sib2, sizeof(NR_SIB2_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - nr_dump_sib2(SI_info->sib2); - LOG_I(RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id ); - //TODO rrc_mac_config_req_ue - - // After SI is received, prepare RRCConnectionRequest - if (NR_UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) { // see -Q option - if (get_softmodem_params()->sa) - nr_rrc_ue_generate_RRCSetupRequest( ctxt_pP->module_id, gNB_index ); - } - } - + memcpy(SI_info->sib2, &typeandinfo->choice.sib2, sizeof(NR_SIB2_t)); + SI_info->sib2_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: - if ((SI_info->SIStatus & 4) == 0) { - SI_info->SIStatus |= 4; - new_sib=1; - memcpy(SI_info->sib3, &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - nr_dump_sib3(SI_info->sib3); - } - + memcpy(SI_info->sib3, &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t)); + SI_info->sib3_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: - if ((SI_info->SIStatus & 8) == 0) { - SI_info->SIStatus |= 8; - new_sib=1; - memcpy(SI_info->sib4, typeandinfo->choice.sib4, sizeof(NR_SIB4_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib4, typeandinfo->choice.sib4, sizeof(NR_SIB4_t)); + SI_info->sib4_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: - if ((SI_info->SIStatus & 16) == 0) { - SI_info->SIStatus |= 16; - new_sib=1; - memcpy(SI_info->sib5, typeandinfo->choice.sib5, sizeof(NR_SIB5_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib5, typeandinfo->choice.sib5, sizeof(NR_SIB5_t)); + SI_info->sib5_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: - if ((SI_info->SIStatus & 32) == 0) { - SI_info->SIStatus |= 32; - new_sib=1; - memcpy(SI_info->sib6, typeandinfo->choice.sib6, sizeof(NR_SIB6_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib6, typeandinfo->choice.sib6, sizeof(NR_SIB6_t)); + SI_info->sib6_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: - if ((SI_info->SIStatus & 64) == 0) { - SI_info->SIStatus |= 64; - new_sib=1; - memcpy(SI_info->sib7, typeandinfo->choice.sib7, sizeof(NR_SIB7_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib7, typeandinfo->choice.sib7, sizeof(NR_SIB7_t)); + SI_info->sib7_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: - if ((SI_info->SIStatus & 128) == 0) { - SI_info->SIStatus |= 128; - new_sib=1; - memcpy(SI_info->sib8, typeandinfo->choice.sib8, sizeof(NR_SIB8_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib8, typeandinfo->choice.sib8, sizeof(NR_SIB8_t)); + SI_info->sib8_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: - if ((SI_info->SIStatus & 256) == 0) { - SI_info->SIStatus |= 256; - new_sib=1; - memcpy(SI_info->sib9, typeandinfo->choice.sib9, sizeof(NR_SIB9_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib9, typeandinfo->choice.sib9, sizeof(NR_SIB9_t)); + SI_info->sib9_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: - if ((SI_info->SIStatus & 512) == 0) { - SI_info->SIStatus |= 512; - new_sib=1; - memcpy(SI_info->sib10, typeandinfo->choice.sib10_v1610, sizeof(NR_SIB10_r16_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib10, typeandinfo->choice.sib10_v1610, sizeof(NR_SIB10_r16_t)); + SI_info->sib10_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: - if ((SI_info->SIStatus & 1024) == 0) { - SI_info->SIStatus |= 1024; - new_sib=1; - memcpy(SI_info->sib11, typeandinfo->choice.sib11_v1610, sizeof(NR_SIB11_r16_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib11, typeandinfo->choice.sib11_v1610, sizeof(NR_SIB11_r16_t)); + SI_info->sib11_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: - if ((SI_info->SIStatus & 2048) == 0) { - SI_info->SIStatus |= 2048; - new_sib=1; - memcpy(SI_info->sib12, typeandinfo->choice.sib12_v1610, sizeof(NR_SIB12_r16_t)); - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - + memcpy(SI_info->sib12, typeandinfo->choice.sib12_v1610, sizeof(NR_SIB12_r16_t)); + SI_info->sib12_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: - if ((SI_info->SIStatus & 4096) == 0) { - SI_info->SIStatus |= 4096; - new_sib=1; - memcpy(SI_info->sib13, typeandinfo->choice.sib13_v1610, sizeof(NR_SIB13_r16_t)); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); - //dump_sib13(SI_info->sib13); - // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_I(RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params gNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, gNB_index, ctxt_pP->module_id); - // TODO rrc_mac_config_req_ue - } + memcpy(SI_info->sib13, typeandinfo->choice.sib13_v1610, sizeof(NR_SIB13_r16_t)); + SI_info->sib13_timer = 0; + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: - if ((SI_info->SIStatus & 8192) == 0) { - SI_info->SIStatus |= 8192; - new_sib=1; memcpy(SI_info->sib12, typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t)); + SI_info->sib14_timer = 0; LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB14 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); - } - break; - default: break; } - if (new_sib == 1) { - SI_info->SIcnt++; - if (SI_info->SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count) - nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR); - - LOG_I(NR_RRC,"SIStatus %x, SIcnt %d/%d\n", - SI_info->SIStatus, - SI_info->SIcnt, - sib1->si_SchedulingInfo->schedulingInfoList.list.count); - } + nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR); } - - //if (new_sib == 1) { - // NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++; - - // if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->schedulingInfoList.list.count) - // rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); - - // LOG_I(NR_RRC, "SIStatus %x, SIcnt %d/%d\n", - // NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus, - // NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt, - // sib1->schedulingInfoList.list.count); - //} - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_OUT); return 0; } -static int8_t check_requested_SI_List(module_id_t module_id, BIT_STRING_t requested_SI_List, NR_SIB1_t sib1) { - - if(sib1.si_SchedulingInfo) { - - bool SIB_to_request[32] = {}; - - LOG_D(RRC, "SIBs broadcasting: "); - for(int i = 0; i < sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) { - LOG_D(RRC, "SIB%li ", sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type + 2); - } - LOG_D(RRC, "\n"); - - LOG_D(RRC, "SIBs needed by UE: "); - for(int j = 0; j < 8*requested_SI_List.size; j++) { - if( ((requested_SI_List.buf[j/8]>>(j%8))&1) == 1) { - - LOG_D(RRC, "SIB%i ", j + 2); - - SIB_to_request[j] = true; - for(int i = 0; i < sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.count; i++) { - if(sib1.si_SchedulingInfo->schedulingInfoList.list.array[0]->sib_MappingInfo.list.array[i]->type == j) { - SIB_to_request[j] = false; - break; - } - } - - } - } - LOG_D(RRC, "\n"); - - LOG_D(RRC, "SIBs to request by UE: "); - bool do_ra = false; - for(int j = 0; j < 8*requested_SI_List.size; j++) { - if(SIB_to_request[j]) { - LOG_D(RRC, "SIB%i ", j + 2); - do_ra = true; - } - } - LOG_D(RRC, "\n"); - - if(do_ra) { - - NR_UE_rrc_inst[module_id].ra_trigger = REQUEST_FOR_OTHER_SI; - get_softmodem_params()->do_ra = 1; - - if(sib1.si_SchedulingInfo->si_RequestConfig) { - LOG_D(RRC, "Trigger contention-free RA procedure (ra_trigger = %i)\n", NR_UE_rrc_inst[module_id].ra_trigger); - } else { - LOG_D(RRC, "Trigger contention-based RA procedure (ra_trigger = %i)\n", NR_UE_rrc_inst[module_id].ra_trigger); - } - - } - - } - - return 0; -} - int8_t nr_rrc_ue_generate_ra_msg(module_id_t module_id, uint8_t gNB_index) { switch(NR_UE_rrc_inst[module_id].ra_trigger){ @@ -1037,16 +690,8 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, { NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index]; - NR_SIB1_t *sib1 = SI_info->sib1; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN); - if (((SI_info->SIStatus & 1) == 1) && sib1->si_SchedulingInfo &&// SIB1 received - (SI_info->SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count)) { - // to prevent memory bloating - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT); - return 0; - } - nr_rrc_set_sub_state(module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR); asn_dec_rval_t dec_rval = uper_decode_complete(NULL, @@ -1073,58 +718,42 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { switch (bcch_message->message.choice.c1->present) { case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - if ((SI_info->SIStatus & 1) == 0) { - if(sib1 != NULL) { - SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)sib1, 1); - } - SI_info->SIStatus |= 1; - sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - if (*(int64_t*)sib1 != 1) { - SI_info->sib1 = sib1; - if(g_log->log_component[NR_RRC].level >= OAILOG_DEBUG) { - xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1); - } - LOG_A(NR_RRC, "SIB1 decoded\n"); - - /// dump_SIB1(); - // FIXME: improve condition for the RA trigger - // Check for on-demand not broadcasted SI - check_requested_SI_List(module_id, NR_UE_rrc_inst[module_id].requested_SI_List, *sib1); - if(nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR) { - NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; - LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n"); - nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR); - } - // configure timers and constant - nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1); - // take ServingCellConfigCommon and configure L1/L2 - NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; - nr_rrc_mac_config_req_sib1(module_id, 0, sib1->servingCellConfigCommon); - nr_rrc_ue_generate_ra_msg(module_id, gNB_index); - } else { - LOG_E(NR_RRC, "SIB1 not decoded\n"); - } + if(SI_info->sib1 != NULL) + SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)SI_info->sib1, 1); + NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + SI_info->sib1 = sib1; + if(g_log->log_component[NR_RRC].level >= OAILOG_DEBUG) + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void *) SI_info->sib1); + LOG_A(NR_RRC, "SIB1 decoded\n"); + SI_info->sib1_timer = 0; + // FIXME: improve condition for the RA trigger + if(nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR) { + NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; + LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n"); + nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR); } - break; + // configure timers and constant + nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1); + // take ServingCellConfigCommon and configure L1/L2 + NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; + nr_rrc_mac_config_req_sib1(module_id, 0, sib1->servingCellConfigCommon); + nr_rrc_ue_generate_ra_msg(module_id, gNB_index); + break; case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - if ((SI_info->SIStatus & 1) == 1) { - LOG_W(NR_RRC, "Decoding SI not implemented yet\n"); - // TODO: Decode SI - /* - // SIB1 with schedulingInfoList is available - NR_SystemInformation_t *si = NR_UE_rrc_inst[module_id].si[gNB_index]; - - memcpy( si, - bcch_message->message.choice.c1->choice.systemInformation, - sizeof(NR_SystemInformation_t) ); - LOG_I(NR_RRC, "[UE %"PRIu8"] Decoding SI\n", module_id); - nr_decode_SI( ctxt_pP, gNB_index ); - - if (nfapi_mode == 3) - UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1; - */ - } + LOG_W(NR_RRC, "Decoding SI not implemented yet\n"); + // TODO: Decode SI + /* + // SIB1 with schedulingInfoList is available + NR_SystemInformation_t *si; + memcpy( si, + bcch_message->message.choice.c1->choice.systemInformation, + sizeof(NR_SystemInformation_t) ); + LOG_I(NR_RRC, "[UE %"PRIu8"] Decoding SI\n", module_id); + nr_decode_SI( ctxt_pP, gNB_index, si ); + if (nfapi_mode == 3) + UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1; + */ break; case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: @@ -1357,8 +986,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB } if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { - if (NR_UE_rrc_inst[ctxt_pP->module_id].SInfo[gNB_index].SIStatus > 0) { - switch (dl_ccch_msg->message.choice.c1->present) { + switch (dl_ccch_msg->message.choice.c1->present) { case NR_DL_CCCH_MessageType__c1_PR_NOTHING: LOG_I(NR_RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", ctxt_pP->module_id, @@ -1396,7 +1024,6 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ctxt_pP->frame); rval = -1; break; - } } } @@ -2305,6 +1932,8 @@ void *rrc_nrue_task(void *args_p) ue_mod_id, ITTI_MSG_NAME (msg_p), NRRRC_SLOT_PROCESS (msg_p).frame, NRRRC_SLOT_PROCESS (msg_p).slot); NR_UE_Timers_Constants_t *timers = &NR_UE_rrc_inst[ue_mod_id].timers_and_constants; nr_rrc_handle_timers(timers); + NR_UE_RRC_SI_INFO *SInfo = &NR_UE_rrc_inst[ue_mod_id].SInfo[NRRRC_SLOT_PROCESS (msg_p).gnb_id]; + nr_rrc_SI_timers(SInfo); break; case NR_RRC_MAC_RA_IND: @@ -2790,12 +2419,13 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) } } -void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot) +void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot, int gnb_id) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_SLOT_PROCESS); NRRRC_SLOT_PROCESS(message_p).frame = frame; NRRRC_SLOT_PROCESS(message_p).slot = slot; + NRRRC_SLOT_PROCESS(message_p).gnb_id = gnb_id; LOG_D(NR_RRC, "RRC timer trigger: frame %d slot %d \n", frame, slot); itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); } diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index ac598bdf51..ea9ae55ba2 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -134,23 +134,34 @@ typedef enum RA_trigger_e { } RA_trigger_t; typedef struct UE_RRC_SI_INFO_NR_s { - uint32_t SIStatus; - uint32_t SIcnt; - NR_SystemInformation_t *si; NR_SIB1_t *sib1; + int sib1_timer; NR_SIB2_t *sib2; + int sib2_timer; NR_SIB3_t *sib3; + int sib3_timer; NR_SIB4_t *sib4; + int sib4_timer; NR_SIB5_t *sib5; + int sib5_timer; NR_SIB6_t *sib6; + int sib6_timer; NR_SIB7_t *sib7; + int sib7_timer; NR_SIB8_t *sib8; + int sib8_timer; NR_SIB9_t *sib9; + int sib9_timer; NR_SIB10_r16_t *sib10; + int sib10_timer; NR_SIB11_r16_t *sib11; + int sib11_timer; NR_SIB12_r16_t *sib12; + int sib12_timer; NR_SIB13_r16_t *sib13; + int sib13_timer; NR_SIB14_r16_t *sib14; + int sib14_timer; } __attribute__ ((__packed__)) NR_UE_RRC_SI_INFO; typedef struct NR_UE_Timers_Constants_s { @@ -212,7 +223,6 @@ typedef struct NR_UE_RRC_INST_s { NR_SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE]; NR_SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE]; - uint8_t MBMS_flag; OAI_NR_UECapability_t *UECap; uint8_t *UECapability; uint16_t UECapability_size; @@ -223,7 +233,6 @@ typedef struct NR_UE_RRC_INST_s { plmn_t plmnID; - BIT_STRING_t requested_SI_List; NR_UE_RRC_SI_INFO SInfo[NB_SIG_CNX_UE]; NR_MIB_t *mib; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 67369a8488..6d453dbec5 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -159,7 +159,9 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len); int get_from_lte_ue_fd(); -void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot); +void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo); + +void nr_ue_rrc_timer_trigger(int module_id, int frame, int slot, int gnb_id); void configure_spcell(NR_UE_RRC_INST_t *rrc, NR_SpCellConfig_t *spcell_config); void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac); diff --git a/openair2/RRC/NR_UE/rrc_timers_and_constants.c b/openair2/RRC/NR_UE/rrc_timers_and_constants.c index 50c2240339..b027eb3241 100644 --- a/openair2/RRC/NR_UE/rrc_timers_and_constants.c +++ b/openair2/RRC/NR_UE/rrc_timers_and_constants.c @@ -21,6 +21,124 @@ #include "openair2/RRC/NR_UE/rrc_proto.h" +void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo) +{ + // delete any stored version of a SIB after 3 hours + // from the moment it was successfully confirmed as valid + if (SInfo->sib1) { + SInfo->sib1_timer += 10; + if (SInfo->sib1_timer > 10800000) { + SInfo->sib1_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB1, SInfo->sib1, 1); + SInfo->sib1 = NULL; + } + } + if (SInfo->sib2) { + SInfo->sib2_timer += 10; + if (SInfo->sib2_timer > 10800000) { + SInfo->sib2_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB2, SInfo->sib2, 1); + SInfo->sib2 = NULL; + } + } + if (SInfo->sib3) { + SInfo->sib3_timer += 10; + if (SInfo->sib3_timer > 10800000) { + SInfo->sib3_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB3, SInfo->sib3, 1); + SInfo->sib3 = NULL; + } + } + if (SInfo->sib4) { + SInfo->sib4_timer += 10; + if (SInfo->sib4_timer > 10800000) { + SInfo->sib4_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB4, SInfo->sib4, 1); + SInfo->sib4 = NULL; + } + } + if (SInfo->sib5) { + SInfo->sib5_timer += 10; + if (SInfo->sib5_timer > 10800000) { + SInfo->sib5_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB5, SInfo->sib5, 1); + SInfo->sib5 = NULL; + } + } + if (SInfo->sib6) { + SInfo->sib6_timer += 10; + if (SInfo->sib6_timer > 10800000) { + SInfo->sib6_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB6, SInfo->sib6, 1); + SInfo->sib6 = NULL; + } + } + if (SInfo->sib7) { + SInfo->sib7_timer += 10; + if (SInfo->sib7_timer > 10800000) { + SInfo->sib7_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB7, SInfo->sib7, 1); + SInfo->sib7 = NULL; + } + } + if (SInfo->sib8) { + SInfo->sib8_timer += 10; + if (SInfo->sib8_timer > 10800000) { + SInfo->sib8_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB8, SInfo->sib8, 1); + SInfo->sib8 = NULL; + } + } + if (SInfo->sib9) { + SInfo->sib9_timer += 10; + if (SInfo->sib9_timer > 10800000) { + SInfo->sib9_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB9, SInfo->sib9, 1); + SInfo->sib9 = NULL; + } + } + if (SInfo->sib10) { + SInfo->sib10_timer += 10; + if (SInfo->sib10_timer > 10800000) { + SInfo->sib10_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB10_r16, SInfo->sib10, 1); + SInfo->sib10 = NULL; + } + } + if (SInfo->sib11) { + SInfo->sib11_timer += 10; + if (SInfo->sib11_timer > 10800000) { + SInfo->sib11_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB11_r16, SInfo->sib11, 1); + SInfo->sib11 = NULL; + } + } + if (SInfo->sib12) { + SInfo->sib12_timer += 10; + if (SInfo->sib12_timer > 10800000) { + SInfo->sib12_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB12_r16, SInfo->sib12, 1); + SInfo->sib12 = NULL; + } + } + if (SInfo->sib13) { + SInfo->sib13_timer += 10; + if (SInfo->sib13_timer > 10800000) { + SInfo->sib13_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB13_r16, SInfo->sib13, 1); + SInfo->sib13 = NULL; + } + } + if (SInfo->sib14) { + SInfo->sib14_timer += 10; + if (SInfo->sib14_timer > 10800000) { + SInfo->sib14_timer = 0; + SEQUENCE_free(&asn_DEF_NR_SIB14_r16, SInfo->sib14, 1); + SInfo->sib14 = NULL; + } + } +} + void nr_rrc_handle_timers(NR_UE_Timers_Constants_t *timers) { // T304 From 924be4edf9e2eecd1a2931976421fde83842764e Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 7 Jul 2023 10:21:55 +0200 Subject: [PATCH 2/4] monitor DCI for other SI --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 + openair2/LAYER2/NR_MAC_UE/mac_defs.h | 78 ++++++++++--------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 1 + .../NR_MAC_UE/nr_ue_dci_configuration.c | 61 ++++++++++++++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 75 +++++++++--------- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 7 files changed, 145 insertions(+), 75 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index d2ac527a00..d9b9cf6f10 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -717,11 +717,13 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, + struct NR_SI_SchedulingInfo *si_SchedulingInfo, NR_ServingCellConfigCommonSIB_t *scc) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); AssertFatal(scc, "SIB1 SCC should not be NULL\n"); mac->scc_SIB = scc; + mac->si_SchedulingInfo = si_SchedulingInfo; mac->nr_band = *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR; config_common_ue_sa(mac, module_id, cc_idP); configure_current_BWP(mac, scc, NULL); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 74bee1eca5..5051d92143 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -382,6 +382,43 @@ typedef struct NR_UL_TIME_ALIGNMENT { int slot; } NR_UL_TIME_ALIGNMENT_t; +// The PRACH Config period is a series of selected slots in one or multiple frames +typedef struct prach_conf_period { + prach_occasion_slot_t prach_occasion_slot_map[MAX_NB_FRAME_IN_PRACH_CONF_PERIOD][MAX_NB_SLOT_IN_FRAME]; + uint16_t nb_of_prach_occasion; // Total number of PRACH occasions in the PRACH Config period + uint8_t nb_of_frame; // Size of the PRACH Config period in number of 10ms frames + uint8_t nb_of_slot; // Nb of slots in each frame +} prach_conf_period_t; + +// The association period is a series of PRACH Config periods +typedef struct prach_association_period { + prach_conf_period_t *prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PERIOD]; + uint8_t nb_of_prach_conf_period; // Nb of PRACH configuration periods within the association period + uint8_t nb_of_frame; // Total number of frames included in the association period +} prach_association_period_t; + +// The association pattern is a series of Association periods +typedef struct prach_association_pattern { + prach_association_period_t prach_association_period_list[MAX_NB_ASSOCIATION_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD]; + prach_conf_period_t prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD]; + uint8_t nb_of_assoc_period; // Nb of association periods within the association pattern + uint8_t nb_of_prach_conf_period_in_max_period; // Nb of PRACH configuration periods within the maximum association pattern period (according to the size of the configured PRACH + uint8_t nb_of_frame; // Total number of frames included in the association pattern period (after mapping the SSBs and determining the real association pattern length) +} prach_association_pattern_t; + +// SSB details +typedef struct ssb_info { + bool transmitted; // True if the SSB index is transmitted according to the SSB positions map configuration + prach_occasion_info_t *mapped_ro[MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN]; // List of mapped RACH Occasions to this SSB index + uint32_t nb_mapped_ro; // Total number of mapped ROs to this SSB index +} ssb_info_t; + +// List of all the possible SSBs and their details +typedef struct ssb_list_info { + ssb_info_t tx_ssb[MAX_NB_SSB]; + uint8_t nb_tx_ssb; +} ssb_list_info_t; + /*!\brief Top level UE MAC structure */ typedef struct { NR_UE_L2_STATE_t state; @@ -402,6 +439,9 @@ typedef struct { NR_PHR_Config_t *phr_Config; NR_RNTI_Value_t *cs_RNTI; NR_MIB_t *mib; + struct NR_SI_SchedulingInfo *si_SchedulingInfo; + int si_window_start; + ssb_list_info_t ssb_list; NR_UE_DL_BWP_t current_DL_BWP; NR_UE_UL_BWP_t current_UL_BWP; @@ -485,43 +525,5 @@ typedef struct { } NR_UE_MAC_INST_t; - -// The PRACH Config period is a series of selected slots in one or multiple frames -typedef struct prach_conf_period { - prach_occasion_slot_t prach_occasion_slot_map[MAX_NB_FRAME_IN_PRACH_CONF_PERIOD][MAX_NB_SLOT_IN_FRAME]; - uint16_t nb_of_prach_occasion; // Total number of PRACH occasions in the PRACH Config period - uint8_t nb_of_frame; // Size of the PRACH Config period in number of 10ms frames - uint8_t nb_of_slot; // Nb of slots in each frame -} prach_conf_period_t; - -// The association period is a series of PRACH Config periods -typedef struct prach_association_period { - prach_conf_period_t *prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PERIOD]; - uint8_t nb_of_prach_conf_period; // Nb of PRACH configuration periods within the association period - uint8_t nb_of_frame; // Total number of frames included in the association period -} prach_association_period_t; - -// The association pattern is a series of Association periods -typedef struct prach_association_pattern { - prach_association_period_t prach_association_period_list[MAX_NB_ASSOCIATION_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD]; - prach_conf_period_t prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD]; - uint8_t nb_of_assoc_period; // Nb of association periods within the association pattern - uint8_t nb_of_prach_conf_period_in_max_period; // Nb of PRACH configuration periods within the maximum association pattern period (according to the size of the configured PRACH - uint8_t nb_of_frame; // Total number of frames included in the association pattern period (after mapping the SSBs and determining the real association pattern length) -} prach_association_pattern_t; - -// SSB details -typedef struct ssb_info { - bool transmitted; // True if the SSB index is transmitted according to the SSB positions map configuration - prach_occasion_info_t *mapped_ro[MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN]; // List of mapped RACH Occasions to this SSB index - uint32_t nb_mapped_ro; // Total number of mapped ROs to this SSB index -} ssb_info_t; - -// List of all the possible SSBs and their details -typedef struct ssb_list_info { - ssb_info_t tx_ssb[MAX_NB_SSB]; - uint8_t nb_tx_ssb; -} ssb_list_info_t; - /*@}*/ #endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 12ab08e38f..fbfc2b450c 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -110,6 +110,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, + struct NR_SI_SchedulingInfo *si_SchedulingInfo, NR_ServingCellConfigCommonSIB_t *scc); /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 9f91a74889..2097aa41c9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -365,6 +365,63 @@ bool is_ss_monitor_occasion(const int frame, const int slot, const int slots_per return monitor; } +bool montior_dci_for_other_SI(NR_UE_MAC_INST_t *mac, + const NR_SearchSpace_t *ss, + const int slots_per_frame, + const int frame, + const int slot) +{ + const struct NR_SI_SchedulingInfo *si_SchedulingInfo = mac->si_SchedulingInfo; + // 5.2.2.3.2 in 331 + if (!si_SchedulingInfo) + return false; + const int si_window_slots = 5 << si_SchedulingInfo->si_WindowLength; + const int abs_slot = frame * slots_per_frame + slot; + for (int n = 0; n < si_SchedulingInfo->schedulingInfoList.list.count; n++) { + struct NR_SchedulingInfo *sched_Info = si_SchedulingInfo->schedulingInfoList.list.array[n]; + if(mac->si_window_start == -1) { + int x = n * si_window_slots; + int T = 8 << sched_Info->si_Periodicity; // radio frame periodicity + if ((frame % T) == (x / slots_per_frame) && + (x % slots_per_frame == 0)) + mac->si_window_start = abs_slot; // in terms of absolute slot number + } + if (mac->si_window_start == -1) { + // out of window + return false; + } + else if (abs_slot > mac->si_window_start + si_window_slots) { + // window expired + mac->si_window_start = -1; + return false; + } + else { + const int duration = ss->duration ? *ss->duration : 1; + int period, offset; + get_monitoring_period_offset(ss, &period, &offset); + for (int i = 0; i < duration; i++) { + if (((frame * slots_per_frame + slot - offset - i) % period) == 0) { + int N = mac->ssb_list.nb_tx_ssb; + int K = 0; // k_th transmitted SSB + for (int i = 0; i < mac->mib_ssb; i++) { + if(mac->ssb_list.tx_ssb[i].transmitted) + K++; + } + // numbering current frame and slot in terms of monitoring occasions in window + int current_monitor_occasion = ((abs_slot - mac->si_window_start) % period) + + (duration * (abs_slot - mac->si_window_start) / period); + if (current_monitor_occasion % N == K) + return true; + else + return false; + } + } + } + } + return false; +} + + void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot) { const NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; @@ -375,8 +432,10 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl // are same as PDCCH monitoring occasions for SIB1 const NR_SearchSpace_t *ss = mac->otherSI_SS ? mac->otherSI_SS : mac->search_space_zero; // TODO configure SI-window - if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss)) + if (montior_dci_for_other_SI(mac, ss, slots_per_frame, frame, slot)) { + LOG_D(NR_MAC, "Monitoring DCI for other SIs in frame %d slot %d\n", frame, slot); config_dci_pdu(mac, dl_config, NR_RNTI_SI, slot, ss); + } } if (mac->state == UE_PERFORMING_RA && mac->ra.ra_state >= WAIT_RAR) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8f4f0ff3fe..0ab43889e4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -168,6 +168,7 @@ void nr_ue_init_mac(module_id_t module_idP) mac->get_otherSI = false; mac->phy_config_request_sent = false; mac->state = UE_NOT_SYNC; + mac->si_window_start = -1; } void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 81771629f2..4d58a7240a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -58,7 +58,6 @@ //#define SRS_DEBUG static prach_association_pattern_t prach_assoc_pattern; -static ssb_list_info_t ssb_list; void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type){ @@ -1658,6 +1657,7 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { BIT_STRING_t *ssb_bitmap; uint64_t ssb_positionsInBurst; uint8_t ssb_idx = 0; + ssb_list_info_t *ssb_list = &mac->ssb_list; if (mac->scc) { NR_ServingCellConfigCommon_t *scc = mac->scc; @@ -1671,8 +1671,8 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { for (uint8_t bit_nb=3; bit_nb<=3; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { - ssb_list.nb_tx_ssb++; - ssb_list.tx_ssb[ssb_idx].transmitted = true; + ssb_list->nb_tx_ssb++; + ssb_list->tx_ssb[ssb_idx].transmitted = true; LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; @@ -1687,8 +1687,8 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { - ssb_list.nb_tx_ssb++; - ssb_list.tx_ssb[ssb_idx].transmitted = true; + ssb_list->nb_tx_ssb++; + ssb_list->tx_ssb[ssb_idx].transmitted = true; LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; @@ -1703,8 +1703,8 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { for (uint8_t bit_nb=63; bit_nb<=63; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { - ssb_list.nb_tx_ssb++; - ssb_list.tx_ssb[ssb_idx].transmitted = true; + ssb_list->nb_tx_ssb++; + ssb_list->tx_ssb[ssb_idx].transmitted = true; LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; @@ -1726,8 +1726,8 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) { // If SSB is transmitted if ((ssb_positionsInBurst>>bit_nb) & 0x01) { - ssb_list.nb_tx_ssb++; - ssb_list.tx_ssb[ssb_idx].transmitted = true; + ssb_list->nb_tx_ssb++; + ssb_list->tx_ssb[ssb_idx].transmitted = true; LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx); } ssb_idx++; @@ -1797,15 +1797,15 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { // There is only one possible association period which can contain up to 16 PRACH configuration periods LOG_D(NR_MAC,"Evaluate the number of PRACH configuration periods required to map all the SSBs and set the association period\n"); if (true == multiple_ssb_per_ro) { - required_nb_of_prach_occasion = ((ssb_list.nb_tx_ssb-1) + ssb_rach_ratio) / ssb_rach_ratio; + required_nb_of_prach_occasion = ((mac->ssb_list.nb_tx_ssb-1) + ssb_rach_ratio) / ssb_rach_ratio; } else { - required_nb_of_prach_occasion = ssb_list.nb_tx_ssb * ssb_rach_ratio; + required_nb_of_prach_occasion = mac->ssb_list.nb_tx_ssb * ssb_rach_ratio; } AssertFatal(prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion>0, "prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion shouldn't be 0 (ssb_list.nb_tx_ssb %d, ssb_rach_ratio %d\n", - ssb_list.nb_tx_ssb,ssb_rach_ratio); + mac->ssb_list.nb_tx_ssb,ssb_rach_ratio); required_nb_of_prach_conf_period = ((required_nb_of_prach_occasion-1) + prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion) / prach_assoc_pattern.prach_conf_period_list[0].nb_of_prach_occasion; @@ -1885,17 +1885,20 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { // this is true if no PRACH occasions are conflicting with SSBs nor TDD_UL_DL_ConfigurationCommon schedule for (; ssb_idxssb_list.tx_ssb[ssb_idx].transmitted) { ro_p->mapped_ssb_idx[ro_p->nb_mapped_ssb] = ssb_idx; ro_p->nb_mapped_ssb++; - ssb_list.tx_ssb[ssb_idx].mapped_ro[ssb_list.tx_ssb[ssb_idx].nb_mapped_ro] = ro_p; - ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++; - AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); + mac->ssb_list.tx_ssb[ssb_idx].mapped_ro[mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro] = ro_p; + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++; + AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, + "Too many mapped ROs (%d) to a single SSB\n", + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); - LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", + LOG_D(NR_MAC, "Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); - LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u\n", ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); + LOG_D(NR_MAC, "Nb mapped ROs for this ssb idx: in the association period only %u\n", + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); // If all the required SSBs are mapped to this RO, exit the loop of SSBs if (ro_p->nb_mapped_ssb == ssb_rach_ratio) { @@ -1941,12 +1944,11 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { // Go through the list of transmitted SSBs for (ssb_idx=0; ssb_idx %d\n", - ssb_idx,ssb_list.tx_ssb[ssb_idx].transmitted); + LOG_D(NR_MAC,"Checking ssb_idx %d => %d\n", + ssb_idx, mac->ssb_list.tx_ssb[ssb_idx].transmitted); // Map only the transmitted ssb_idx - if (true == ssb_list.tx_ssb[ssb_idx].transmitted) { + if (true == mac->ssb_list.tx_ssb[ssb_idx].transmitted) { // Map all the required ROs to this SSB // Go through the list of PRACH config periods within this association period @@ -1964,17 +1966,18 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { ro_p->mapped_ssb_idx[0] = ssb_idx; ro_p->nb_mapped_ssb = 1; - ssb_list.tx_ssb[ssb_idx].mapped_ro[ssb_list.tx_ssb[ssb_idx].nb_mapped_ro] = ro_p; - ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++; - AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > ssb_list.tx_ssb[ssb_idx].nb_mapped_ro,"Too many mapped ROs (%d) to a single SSB\n", - ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); + mac->ssb_list.tx_ssb[ssb_idx].mapped_ro[mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro] = ro_p; + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro++; + AssertFatal(MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN > mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, + "Too many mapped ROs (%d) to a single SSB\n", + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro); nb_mapped_ro_in_association_period++; LOG_D(NR_MAC,"Mapped ssb_idx %u to RO slot-symbol %u-%u, %u-%u-%u/%u\n", ssb_idx, ro_p->slot, ro_p->start_symbol, slot, ro_in_time, ro_in_freq, prach_conf_period_p->prach_occasion_slot_map[frame][slot].nb_of_prach_occasion_in_freq); - LOG_D(NR_MAC,"Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", - ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period); + LOG_D(NR_MAC, "Nb mapped ROs for this ssb idx: in the association period only %u / total %u\n", + mac->ssb_list.tx_ssb[ssb_idx].nb_mapped_ro, nb_mapped_ro_in_association_period); // Exit the loop if this SSB has been mapped to all the required ROs // WIP: Assuming that ssb_rach_ratio equals the maximum nb of times a given ssb_idx is mapped within an association period: @@ -2024,8 +2027,9 @@ static void map_ssb_to_ro(NR_UE_MAC_INST_t *mac) { static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx, int frame, int slot, - prach_occasion_info_t **prach_occasion_info_pp) { - + ssb_list_info_t *ssb_list, + prach_occasion_info_t **prach_occasion_info_pp) +{ ssb_info_t *ssb_info_p; prach_occasion_slot_t *prach_occasion_slot_p = NULL; @@ -2036,7 +2040,7 @@ static int get_nr_prach_info_from_ssb_index(uint8_t ssb_idx, // - ssb_idx mapped to one of the ROs in that RO slot // - exact slot number // - frame offset - ssb_info_p = &ssb_list.tx_ssb[ssb_idx]; + ssb_info_p = &ssb_list->tx_ssb[ssb_idx]; LOG_D(NR_MAC,"checking for prach : ssb_info_p->nb_mapped_ro %d\n",ssb_info_p->nb_mapped_ro); for (uint8_t n_mapped_ro=0; n_mapped_ronb_mapped_ro; n_mapped_ro++) { LOG_D(NR_MAC,"%d.%d: mapped_ro[%d]->frame.slot %d.%d, prach_assoc_pattern.nb_of_frame %d\n", @@ -2104,7 +2108,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) { // Clear all the lists and maps memset(&prach_assoc_pattern, 0, sizeof(prach_association_pattern_t)); - memset(&ssb_list, 0, sizeof(ssb_list_info_t)); + memset(&mac->ssb_list, 0, sizeof(ssb_list_info_t)); // Build the list of all the valid RACH occasions in the maximum association pattern period according to the PRACH config LOG_D(NR_MAC,"Build RO list\n"); @@ -2523,9 +2527,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s // Get any valid PRACH occasion in the current slot for the selected SSB index prach_occasion_info_t *prach_occasion_info_p; int is_nr_prach_slot = get_nr_prach_info_from_ssb_index(selected_gnb_ssb_idx, - (int)frameP, - (int)slotP, - &prach_occasion_info_p); + (int)frameP, + (int)slotP, + &mac->ssb_list, + &prach_occasion_info_p); if (is_nr_prach_slot) { AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index cbab54b9ab..604000e94b 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -736,7 +736,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1); // take ServingCellConfigCommon and configure L1/L2 NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; - nr_rrc_mac_config_req_sib1(module_id, 0, sib1->servingCellConfigCommon); + nr_rrc_mac_config_req_sib1(module_id, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon); nr_rrc_ue_generate_ra_msg(module_id, gNB_index); break; From f770958d9d0d2de50dfeb64c1cce8a08d1353f75 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 8 Jul 2023 10:40:43 +0200 Subject: [PATCH 3/4] workaround to make UE decode DLSCH with other SI --- .../nfapi/public_inc/fapi_nr_ue_interface.h | 3 +++ .../NR_UE_ESTIMATION/nr_dl_channel_estimation.c | 6 +----- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 7 +++---- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 14 +++++++++----- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index a8cf02a357..4acd5e0d5f 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -442,6 +442,9 @@ typedef struct { uint16_t start_rb; uint16_t number_symbols; uint16_t start_symbol; + // TODO this is a workaround to make it work + // implementation is also a bunch of workarounds + uint16_t rb_offset; uint16_t dlDmrsSymbPos; uint8_t dmrsConfigType; uint8_t prb_bundling_size_ind; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index f42b60f4db..baf9d91bb3 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -1597,13 +1597,13 @@ void NFAPI_NR_DMRS_TYPE2_average_prb(NR_DL_FRAME_PARMS *frame_parms, } int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - bool is_SI, unsigned short p, unsigned char symbol, unsigned char nscid, unsigned short scrambling_id, unsigned short BWPStart, uint8_t config_type, + uint16_t rb_offset, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch, uint32_t pdsch_est_size, @@ -1629,10 +1629,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, #endif // generate pilot for gNB port number 1000+p - uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; - if (is_SI) { - rb_offset -= BWPStart; - } int8_t delta = get_delta(p, config_type); // checking if re-initialization of scrambling IDs is needed diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 11dad31602..19bc2f410c 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -80,13 +80,13 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - bool is_SI, unsigned short p, unsigned char symbol, unsigned char nscid, unsigned short scrambling_id, unsigned short BWPStart, uint8_t config_type, + uint16_t rb_offset, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch, uint32_t pdsch_est_size, diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index c903df6f6d..e46390af15 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -544,10 +544,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, uint16_t pdsch_nb_rb = dlsch0->dlsch_config.number_rbs; uint16_t s0 = dlsch0->dlsch_config.start_symbol; uint16_t s1 = dlsch0->dlsch_config.number_symbols; - bool is_SI = dlsch0->rnti_type == _SI_RNTI_; - LOG_D(PHY,"[UE %d] nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x, Nl %d\n", - ue->Mod_id,nr_slot_rx,harq_pid,dlsch0_harq->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->dlsch_config.dlDmrsSymbPos, dlsch0->Nl); + LOG_D(PHY,"[UE %d] nr_slot_rx %d, harq_pid %d (%d), BWP start %d, rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x, Nl %d\n", + ue->Mod_id,nr_slot_rx,harq_pid,dlsch0_harq->status,BWPStart,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->dlsch_config.dlDmrsSymbPos, dlsch0->Nl); const uint32_t pdsch_est_size = ((ue->frame_parms.symbols_per_slot * ue->frame_parms.ofdm_symbol_size + 15) / 16) * 16; __attribute__((aligned(32))) int32_t pdsch_dl_ch_estimates[ue->frame_parms.nb_antennas_rx * dlsch0->Nl][pdsch_est_size]; @@ -569,13 +568,13 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m); nr_pdsch_channel_estimation(ue, proc, - is_SI, get_dmrs_port(aatx,dlsch0->dlsch_config.dmrs_ports), m, dlsch0->dlsch_config.nscid, dlsch0->dlsch_config.dlDmrsScramblingId, BWPStart, dlsch0->dlsch_config.dmrsConfigType, + dlsch0->dlsch_config.rb_offset, ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, pdsch_nb_rb, pdsch_est_size, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0ab43889e4..5d949f74f2 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -661,7 +661,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->pduBitmap = 0; - NR_PDSCH_Config_t *pdsch_config = current_DL_BWP ? current_DL_BWP->pdsch_Config : NULL; + NR_PDSCH_Config_t *pdsch_config = (current_DL_BWP || !mac->get_sib1) ? current_DL_BWP->pdsch_Config : NULL; if (dci_ind->ss_type == NR_SearchSpace__searchSpaceType_PR_common) { dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->initial_BWPSize; dlsch_config_pdu_1_0->BWPStart = dci_ind->cset_start; @@ -678,7 +678,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; if(mac->frequency_range == FR2) dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2; - if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' } else { dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs; if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){ @@ -694,19 +693,23 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_W(MAC, "[%d.%d] Invalid frequency_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } + dlsch_config_pdu_1_0->rb_offset = dlsch_config_pdu_1_0->start_rb + dlsch_config_pdu_1_0->BWPStart; + if (mac->get_sib1) + dlsch_config_pdu_1_0->rb_offset -= dlsch_config_pdu_1_0->BWPStart; /* TIME_DOM_RESOURCE_ASSIGNMENT */ int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; - // TODO need to differentiate SI_RNTI between SIB1 and other SIB NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val, - dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, rnti == SI_RNTI); + dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, mac->get_sib1); dlsch_config_pdu_1_0->number_symbols = tda_info.nrOfSymbols; dlsch_config_pdu_1_0->start_symbol = tda_info.startSymbolIndex; struct NR_DMRS_DownlinkConfig *dl_dmrs_config = NULL; if (pdsch_config) - dl_dmrs_config = (tda_info.mapping_type == typeA) ? pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup : pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup; + dl_dmrs_config = (tda_info.mapping_type == typeA) ? + pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup : + pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup; dlsch_config_pdu_1_0->nscid = 0; if(dl_dmrs_config && dl_dmrs_config->scramblingID0) @@ -914,6 +917,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_W(MAC, "[%d.%d] Invalid frequency_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } + dlsch_config_pdu_1_1->rb_offset = dlsch_config_pdu_1_1->start_rb + dlsch_config_pdu_1_1->BWPStart; /* TIME_DOM_RESOURCE_ASSIGNMENT */ int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val, From b4734211f095cec8d49101e7a969e62b8466621f Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 8 Jul 2023 12:40:13 +0200 Subject: [PATCH 4/4] fixes to make RRC decode SI --- .../NR_MAC_UE/nr_ue_dci_configuration.c | 12 +-- openair2/RRC/NR_UE/rrc_UE.c | 93 +++++++++++-------- 2 files changed, 60 insertions(+), 45 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 2097aa41c9..b69097ae8e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -365,11 +365,11 @@ bool is_ss_monitor_occasion(const int frame, const int slot, const int slots_per return monitor; } -bool montior_dci_for_other_SI(NR_UE_MAC_INST_t *mac, - const NR_SearchSpace_t *ss, - const int slots_per_frame, - const int frame, - const int slot) +bool monitior_dci_for_other_SI(NR_UE_MAC_INST_t *mac, + const NR_SearchSpace_t *ss, + const int slots_per_frame, + const int frame, + const int slot) { const struct NR_SI_SchedulingInfo *si_SchedulingInfo = mac->si_SchedulingInfo; // 5.2.2.3.2 in 331 @@ -432,7 +432,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl // are same as PDCCH monitoring occasions for SIB1 const NR_SearchSpace_t *ss = mac->otherSI_SS ? mac->otherSI_SS : mac->search_space_zero; // TODO configure SI-window - if (montior_dci_for_other_SI(mac, ss, slots_per_frame, frame, slot)) { + if (monitior_dci_for_other_SI(mac, ss, slots_per_frame, frame, slot)) { LOG_D(NR_MAC, "Monitoring DCI for other SIs in frame %d slot %d\n", frame, slot); config_dci_pdu(mac, dl_config, NR_RNTI_SI, slot, ss); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 604000e94b..3ffae4b07d 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -532,9 +532,9 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u return ret; } -int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, NR_SystemInformation_t *si) +int nr_decode_SI(const module_id_t module_id, const uint8_t gNB_index, NR_SystemInformation_t *si) { - NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[ctxt_pP->module_id].SInfo[gNB_index]; + NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[module_id].SInfo[gNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents @@ -553,86 +553,112 @@ int nr_decode_SI(const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, switch(typeandinfo->present) { case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: - memcpy(SI_info->sib2, &typeandinfo->choice.sib2, sizeof(NR_SIB2_t)); + if(!SI_info->sib2) + SI_info->sib2 = calloc(1, sizeof(*SI_info->sib2)); + memcpy(SI_info->sib2, typeandinfo->choice.sib2, sizeof(NR_SIB2_t)); SI_info->sib2_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB2 from gNB %"PRIu8"\n", module_id, gNB_index); break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: - memcpy(SI_info->sib3, &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t)); + if(!SI_info->sib3) + SI_info->sib3 = calloc(1, sizeof(*SI_info->sib3)); + memcpy(SI_info->sib3, typeandinfo->choice.sib3, sizeof(NR_SIB3_t)); SI_info->sib3_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB3 from gNB %"PRIu8"\n", module_id, gNB_index ); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: + if(!SI_info->sib4) + SI_info->sib4 = calloc(1, sizeof(*SI_info->sib4)); memcpy(SI_info->sib4, typeandinfo->choice.sib4, sizeof(NR_SIB4_t)); SI_info->sib4_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB4 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: + if(!SI_info->sib5) + SI_info->sib5 = calloc(1, sizeof(*SI_info->sib5)); memcpy(SI_info->sib5, typeandinfo->choice.sib5, sizeof(NR_SIB5_t)); SI_info->sib5_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB5 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: + if(!SI_info->sib6) + SI_info->sib6 = calloc(1, sizeof(*SI_info->sib6)); memcpy(SI_info->sib6, typeandinfo->choice.sib6, sizeof(NR_SIB6_t)); SI_info->sib6_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB6 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: + if(!SI_info->sib7) + SI_info->sib7 = calloc(1, sizeof(*SI_info->sib7)); memcpy(SI_info->sib7, typeandinfo->choice.sib7, sizeof(NR_SIB7_t)); SI_info->sib7_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB7 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: + if(!SI_info->sib8) + SI_info->sib8 = calloc(1, sizeof(*SI_info->sib8)); memcpy(SI_info->sib8, typeandinfo->choice.sib8, sizeof(NR_SIB8_t)); SI_info->sib8_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB8 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: + if(!SI_info->sib9) + SI_info->sib9 = calloc(1, sizeof(*SI_info->sib9)); memcpy(SI_info->sib9, typeandinfo->choice.sib9, sizeof(NR_SIB9_t)); SI_info->sib9_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB9 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: + if(!SI_info->sib10) + SI_info->sib10 = calloc(1, sizeof(*SI_info->sib10)); memcpy(SI_info->sib10, typeandinfo->choice.sib10_v1610, sizeof(NR_SIB10_r16_t)); SI_info->sib10_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB10 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: + if(!SI_info->sib11) + SI_info->sib11 = calloc(1, sizeof(*SI_info->sib11)); memcpy(SI_info->sib11, typeandinfo->choice.sib11_v1610, sizeof(NR_SIB11_r16_t)); SI_info->sib11_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB11 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: + if(!SI_info->sib12) + SI_info->sib12 = calloc(1, sizeof(*SI_info->sib12)); memcpy(SI_info->sib12, typeandinfo->choice.sib12_v1610, sizeof(NR_SIB12_r16_t)); SI_info->sib12_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + LOG_I(RRC, "[UE %"PRIu8"] Found SIB12 from gNB %"PRIu8"\n", module_id, gNB_index); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: + if(!SI_info->sib13) + SI_info->sib13 = calloc(1, sizeof(*SI_info->sib13)); memcpy(SI_info->sib13, typeandinfo->choice.sib13_v1610, sizeof(NR_SIB13_r16_t)); SI_info->sib13_timer = 0; - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); + LOG_I( RRC, "[UE %"PRIu8"] Found SIB13 from gNB %"PRIu8"\n", module_id, gNB_index ); break; case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: - memcpy(SI_info->sib12, typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t)); - SI_info->sib14_timer = 0; - LOG_I(RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB14 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index); + if(!SI_info->sib14) + SI_info->sib14 = calloc(1, sizeof(*SI_info->sib14)); + memcpy(SI_info->sib12, typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t)); + SI_info->sib14_timer = 0; + LOG_I(RRC, "[UE %"PRIu8"] Found SIB14 from gNB %"PRIu8"\n", module_id, gNB_index); break; default: break; } - nr_rrc_set_sub_state(ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR); + nr_rrc_set_sub_state(module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_OUT); return 0; @@ -710,7 +736,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, dec_rval.consumed); log_dump(NR_RRC, Sdu, Sdu_len, LOG_DUMP_CHAR," Received bytes:\n"); // free the memory - SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1 ); + SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); return -1; } @@ -730,7 +756,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, if(nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR) { NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n"); - nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR); + nr_rrc_set_state(module_id, RRC_STATE_IDLE_NR); } // configure timers and constant nr_rrc_set_sib1_timers_and_constants(&NR_UE_rrc_inst[module_id].timers_and_constants, sib1); @@ -738,24 +764,13 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; nr_rrc_mac_config_req_sib1(module_id, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon); nr_rrc_ue_generate_ra_msg(module_id, gNB_index); - break; - - case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - LOG_W(NR_RRC, "Decoding SI not implemented yet\n"); - // TODO: Decode SI - /* - // SIB1 with schedulingInfoList is available - NR_SystemInformation_t *si; - memcpy( si, - bcch_message->message.choice.c1->choice.systemInformation, - sizeof(NR_SystemInformation_t) ); - LOG_I(NR_RRC, "[UE %"PRIu8"] Decoding SI\n", module_id); - nr_decode_SI( ctxt_pP, gNB_index, si ); - if (nfapi_mode == 3) - UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1; - */ break; - + case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + LOG_I(NR_RRC, "[UE %"PRIu8"] Decoding SI\n", module_id); + NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; + nr_decode_SI(module_id, gNB_index, si); + SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1); + break; case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: default: break;