From cd6f491b97c8fa76907b69613bf10fdebc7e6e03 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 1 Aug 2023 17:15:20 +0200 Subject: [PATCH 1/2] overwriting SIBs when new acquisition --- openair2/RRC/NR_UE/rrc_UE.c | 29 ++-- openair2/RRC/NR_UE/rrc_timers_and_constants.c | 127 ++++++------------ 2 files changed, 58 insertions(+), 98 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index bf9861ecfb..5ca9dc1e32 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -439,55 +439,55 @@ bool check_si_validity(NR_UE_RRC_SI_INFO *SI_info, int si_type) { switch (si_type) { case NR_SIB_TypeInfo__type_sibType2: - if (!SI_info->sib2) + if (!SI_info->sib2 || SI_info->sib2_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType3: - if (!SI_info->sib3) + if (!SI_info->sib3 || SI_info->sib3_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType4: - if (!SI_info->sib4) + if (!SI_info->sib4 || SI_info->sib4_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType5: - if (!SI_info->sib5) + if (!SI_info->sib5 || SI_info->sib5_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType6: - if (!SI_info->sib6) + if (!SI_info->sib6 || SI_info->sib6_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType7: - if (!SI_info->sib7) + if (!SI_info->sib7 || SI_info->sib7_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType8: - if (!SI_info->sib8) + if (!SI_info->sib8 || SI_info->sib8_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType9: - if (!SI_info->sib9) + if (!SI_info->sib9 || SI_info->sib9_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType10_v1610: - if (!SI_info->sib10) + if (!SI_info->sib10 || SI_info->sib10_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType11_v1610: - if (!SI_info->sib11) + if (!SI_info->sib11 || SI_info->sib11_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType12_v1610: - if (!SI_info->sib12) + if (!SI_info->sib12 || SI_info->sib12_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType13_v1610: - if (!SI_info->sib13) + if (!SI_info->sib13 || SI_info->sib13_timer == -1) return false; break; case NR_SIB_TypeInfo__type_sibType14_v1610: - if (!SI_info->sib14) + if (!SI_info->sib14 || SI_info->sib14_timer == -1) return false; break; default : @@ -501,7 +501,8 @@ int check_si_status(NR_UE_RRC_SI_INFO *SI_info) if (!get_softmodem_params()->sa) return 0; // schedule reception of SIB1 if RRC doesn't have it - if (!SI_info->sib1) + // or if the timer expired + if (!SI_info->sib1 || SI_info->sib1_timer == -1) return 1; else { if (SI_info->sib1->si_SchedulingInfo) { diff --git a/openair2/RRC/NR_UE/rrc_timers_and_constants.c b/openair2/RRC/NR_UE/rrc_timers_and_constants.c index b027eb3241..c628b0219b 100644 --- a/openair2/RRC/NR_UE/rrc_timers_and_constants.c +++ b/openair2/RRC/NR_UE/rrc_timers_and_constants.c @@ -25,117 +25,76 @@ 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) { + if (SInfo->sib1 && SInfo->sib1_timer >= 0) { 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->sib1_timer > 10800000) + SInfo->sib1_timer = -1; } - if (SInfo->sib2) { + if (SInfo->sib2 && SInfo->sib2_timer >= 0) { 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->sib2_timer > 10800000) + SInfo->sib2_timer = -1; } - if (SInfo->sib3) { + if (SInfo->sib3 && SInfo->sib3_timer >= 0) { 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->sib3_timer > 10800000) + SInfo->sib3_timer = -1; } - if (SInfo->sib4) { + if (SInfo->sib4 && SInfo->sib4_timer >= 0) { 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->sib4_timer > 10800000) + SInfo->sib4_timer = -1; } - if (SInfo->sib5) { + if (SInfo->sib5 && SInfo->sib5_timer >= 0) { 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->sib5_timer > 10800000) + SInfo->sib5_timer = -1; } - if (SInfo->sib6) { + if (SInfo->sib6 && SInfo->sib6_timer >= 0) { 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->sib6_timer > 10800000) + SInfo->sib6_timer = -1; } - if (SInfo->sib7) { + if (SInfo->sib7 && SInfo->sib7_timer >= 0) { 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->sib7_timer > 10800000) + SInfo->sib7_timer = -1; } - if (SInfo->sib8) { + if (SInfo->sib8 && SInfo->sib8_timer >= 0) { 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->sib8_timer > 10800000) + SInfo->sib8_timer = -1; } - if (SInfo->sib9) { + if (SInfo->sib9 && SInfo->sib9_timer >= 0) { 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->sib9_timer > 10800000) + SInfo->sib9_timer = -1; + } - if (SInfo->sib10) { + if (SInfo->sib10 && SInfo->sib10_timer >= 0) { 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->sib10_timer > 10800000) + SInfo->sib10_timer = -1; } - if (SInfo->sib11) { + if (SInfo->sib11 && SInfo->sib11_timer >= 0) { 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->sib11_timer > 10800000) + SInfo->sib11_timer = -1; } - if (SInfo->sib12) { + if (SInfo->sib12 && SInfo->sib12_timer >= 0) { 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->sib12_timer > 10800000) + SInfo->sib12_timer = -1; } - if (SInfo->sib13) { + if (SInfo->sib13 && SInfo->sib13_timer >= 0) { 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->sib13_timer > 10800000) + SInfo->sib13_timer = -1; } - if (SInfo->sib14) { + if (SInfo->sib14 && SInfo->sib14_timer >= 0) { 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; - } + if (SInfo->sib14_timer > 10800000) + SInfo->sib14_timer = -1; } } From 9d45b49c3814d29ffcfbf3c50b79a5539cc78c96 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 9 Aug 2023 18:28:52 +0200 Subject: [PATCH 2/2] do not change BWP at MAC and do not free SIB1 at RRC --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 5 ++++- openair2/RRC/NR_UE/rrc_UE.c | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 8798213b4c..fa27ced3b0 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -711,7 +711,10 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, mac->si_SchedulingInfo = si_SchedulingInfo; mac->nr_band = *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR; config_common_ue_sa(mac, scc, module_id, cc_idP); - configure_current_BWP(mac, scc, NULL); + // configure BWP only if it is a SIB1 detection in non connected state (after sync) + // not if it is a periodical update of SIB1 (no change of BWP in that case) + if(mac->state < UE_CONNECTED) + configure_current_BWP(mac, scc, NULL); // Setup the SSB to Rach Occasionsif (cell_group_config->spCellConfig) { mapping according to the config build_ssb_to_ro_map(mac); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 5ca9dc1e32..d7d3e16ad4 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -779,8 +779,9 @@ 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->sib1 != NULL) - SEQUENCE_free(&asn_DEF_NR_SIB1, (void *)SI_info->sib1, 1); + LOG_D(NR_RRC, "[UE %"PRIu8"] Decoding SIB1\n", module_id); + if(SI_info->sib1) + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, SI_info->sib1); 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)